@sentisec/sdk 0.1.0-rc.6 → 0.1.0-rc.7
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 +158 -73
- package/README.md +17 -6
- package/dist/index.cjs +5 -13
- package/dist/index.d.cts +63 -254
- package/dist/index.d.ts +63 -254
- package/dist/index.js +5 -13
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Structural OpenAI client types and control-plane URL resolution.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `openai` npm package here:
|
|
7
|
-
*
|
|
8
|
-
* 1. `package.json` was frozen by T-150; adding `openai` (or
|
|
9
|
-
* `openai` as a peerDependency) is out of scope for T-151.
|
|
10
|
-
* 2. The wrap signature is generic — `wrap<T>(client: T): T` —
|
|
11
|
-
* so the SDK works against any client whose surface matches
|
|
12
|
-
* this structural type, including future provider SDKs that
|
|
13
|
-
* adopt the same chat.completions.create shape.
|
|
14
|
-
* 3. Customers who wire their own `openai` instance into
|
|
15
|
-
* `monitor.wrap(openai)` get full type-preservation via the
|
|
16
|
-
* generic; they never see this `OpenAILike` surface unless
|
|
17
|
-
* they explicitly cast.
|
|
18
|
-
*
|
|
19
|
-
* If the OpenAI package's public shape ever changes in a way that
|
|
20
|
-
* breaks the fields below, the fix is on the customer side
|
|
21
|
-
* (upgrade their openai version) or in the wrap implementation
|
|
22
|
-
* (adapt to the new shape) — never in this file's structural
|
|
23
|
-
* contract, which is pinned by the T-151 acceptance tests.
|
|
24
|
-
*
|
|
25
|
-
* Reference: public Monitor surface and OpenAI adapter wave-2 notes.
|
|
4
|
+
* The wrapper accepts compatible client objects without importing
|
|
5
|
+
* the OpenAI package and preserves the supplied client's type.
|
|
26
6
|
*/
|
|
27
7
|
/**
|
|
28
8
|
* Structural shape of the OpenAI Node SDK's client surface that
|
|
@@ -51,19 +31,16 @@ interface OpenAILike {
|
|
|
51
31
|
};
|
|
52
32
|
}
|
|
53
33
|
/**
|
|
54
|
-
* Optional
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* acceptance contract. Customers who run an on-prem proxy or who
|
|
58
|
-
* want to point the wrap at a staging ingress override `baseUrl`
|
|
59
|
-
* explicitly — the override is a literal string, not a template.
|
|
34
|
+
* Optional overrides for `wrap(...)`. `baseUrl` is a literal, fully
|
|
35
|
+
* formed URL: no workspace path is appended. Without it, the wrapper
|
|
36
|
+
* resolves the Monitor endpoint, environment, then hosted default.
|
|
60
37
|
*/
|
|
61
38
|
interface WrapOptions {
|
|
62
39
|
baseUrl?: string;
|
|
63
40
|
}
|
|
64
41
|
/**
|
|
65
|
-
* Environment variable naming the Sentisec control-plane host.
|
|
66
|
-
* with the Python SDK's `SENTISEC_ENDPOINT
|
|
42
|
+
* Environment variable naming the Sentisec control-plane host. Shared
|
|
43
|
+
* with the Python SDK's `SENTISEC_ENDPOINT`, so a
|
|
67
44
|
* self-hosted operator sets one variable and both SDKs obey it.
|
|
68
45
|
*/
|
|
69
46
|
declare const ENV_ENDPOINT = "SENTISEC_ENDPOINT";
|
|
@@ -78,73 +55,29 @@ declare const DEFAULT_ENDPOINT = "https://api.sentisec.ch";
|
|
|
78
55
|
*/
|
|
79
56
|
declare const WORKSPACE_PROXY_PATH = "/ws/{workspace}/v1";
|
|
80
57
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* time. Phase-2 may add region-pinned ingresses
|
|
84
|
-
* (`https://ingress-eu.sentisec.ch/...`); until then, this is the
|
|
85
|
-
* single canonical hostname.
|
|
86
|
-
*
|
|
87
|
-
* A change in this constant silently re-routes every wrapped client
|
|
88
|
-
* to the wrong ingress; the T-151 test
|
|
89
|
-
* `test_wrap_rewrites_base_url` grep-guards the literal.
|
|
58
|
+
* Hosted proxy URL template. `{workspace}` is replaced with
|
|
59
|
+
* `Monitor.customerId` when no endpoint override is supplied.
|
|
90
60
|
*/
|
|
91
61
|
declare const DEFAULT_INGRESS_TEMPLATE = "https://api.sentisec.ch/ws/{workspace}/v1";
|
|
92
62
|
/**
|
|
93
|
-
* Resolve the proxy
|
|
63
|
+
* Resolve the proxy URL for a workspace, highest precedence first:
|
|
94
64
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
65
|
+
* 1. `opts.baseUrl`: literal URL; no path is appended.
|
|
66
|
+
* 2. `endpoint`: control-plane host from `new Monitor({ endpoint })`.
|
|
67
|
+
* 3. `SENTISEC_ENDPOINT`: control-plane host from the environment.
|
|
68
|
+
* 4. Hosted default: `https://api.sentisec.ch/ws/<workspace>/v1`.
|
|
97
69
|
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* (e.g. `http://localhost:8080`); the
|
|
102
|
-
* workspace path is appended to it.
|
|
103
|
-
* 3. `SENTISEC_ENDPOINT` — same host semantics, from the environment.
|
|
104
|
-
* 4. the hosted default — `https://api.sentisec.ch/ws/<ws>/v1`.
|
|
105
|
-
*
|
|
106
|
-
* Step 4 is the trap S1-FU-05 caught on the Python side: a reader
|
|
107
|
-
* running a local control plane who never set a destination had their
|
|
108
|
-
* prompts silently routed to production. The SDK cannot detect that
|
|
109
|
-
* intent, so the fix is to make steps 2 and 3 exist and to say so
|
|
110
|
-
* loudly in the docs — not to guess.
|
|
111
|
-
*
|
|
112
|
-
* Pure function so it can be unit-tested without constructing a
|
|
113
|
-
* `Monitor`.
|
|
70
|
+
* The workspace path is appended to host overrides. Set an override
|
|
71
|
+
* for local or self-hosted deployments to avoid sending requests to
|
|
72
|
+
* the hosted plane.
|
|
114
73
|
*/
|
|
115
74
|
declare function resolveProxyBaseUrl(workspace: string, opts?: WrapOptions, endpoint?: string): string;
|
|
116
75
|
|
|
117
76
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* T-150 inlined the `Monitor` class in `index.ts`. T-151 extends
|
|
121
|
-
* that same class with a `wrap(...)` method via prototype
|
|
122
|
-
* augmentation in this dedicated file so the wave-2 sibling cards
|
|
123
|
-
* (T-152 Anthropic, T-153 streaming) can each pull their own
|
|
124
|
-
* `wrap-<vendor>.ts` without touching `index.ts` or each other's
|
|
125
|
-
* wrap files.
|
|
126
|
-
*
|
|
127
|
-
* Module-graph topology (acyclic by design):
|
|
77
|
+
* Provider dispatch for `Monitor.wrap()`.
|
|
128
78
|
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* └─> openai.ts
|
|
132
|
-
*
|
|
133
|
-
* monitor.ts PULLS each `*VendorEntry` value from its sibling
|
|
134
|
-
* wrap-<vendor>.ts modules and appends them to a local registry.
|
|
135
|
-
* The wrap modules do NOT import from monitor.ts — that direction
|
|
136
|
-
* would re-introduce the ESM cycle the wave-1 architecture is
|
|
137
|
-
* structured to avoid.
|
|
138
|
-
*
|
|
139
|
-
* Why prototype augmentation rather than subclassing: customers
|
|
140
|
-
* already construct `Monitor` directly per the README ("`new
|
|
141
|
-
* Monitor({...})`") and the T-150 acceptance tests
|
|
142
|
-
* (`tests/scaffold.test.ts`). Subclassing would force them to
|
|
143
|
-
* import a different name. Augmentation keeps the public surface
|
|
144
|
-
* a single class while the per-vendor adapters live in their own
|
|
145
|
-
* files.
|
|
146
|
-
*
|
|
147
|
-
* Reference: public Monitor surface and T-151 acceptance tests.
|
|
79
|
+
* Installs the OpenAI and Anthropic adapters on the public Monitor
|
|
80
|
+
* class while preserving the caller's client type.
|
|
148
81
|
*/
|
|
149
82
|
|
|
150
83
|
declare module "./index.js" {
|
|
@@ -170,41 +103,14 @@ declare module "./index.js" {
|
|
|
170
103
|
}
|
|
171
104
|
|
|
172
105
|
/**
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* T-150 inlined the four base/policy/verifier/tamper exceptions in
|
|
176
|
-
* `index.ts`. T-151 adds `SentisecHijackError` (the SDK-side
|
|
177
|
-
* surface for proxy-emitted HALT verdicts) in this dedicated file
|
|
178
|
-
* so the wave-2 sibling cards (T-152 Anthropic, T-153 streaming)
|
|
179
|
-
* extend the surface in the same module instead of growing
|
|
180
|
-
* `index.ts` further.
|
|
181
|
-
*
|
|
182
|
-
* `SentisecHijackError` deliberately mirrors the Python SDK's
|
|
183
|
-
* `TaskTamperError` constructor surface (`session_id` + optional
|
|
184
|
-
* `detail`, both retained as instance attributes; formatted message
|
|
185
|
-
* stable for grep-based alert rules) and the contract that
|
|
186
|
-
* `sdk_error_surface_version:
|
|
187
|
-
* v1.0-phase1` is a cross-language contract, not a per-language
|
|
188
|
-
* one.
|
|
189
|
-
*
|
|
190
|
-
* Reference: public error surface and HIJACK / HALT verdict handling.
|
|
106
|
+
* Typed errors for Sentisec proxy block responses.
|
|
191
107
|
*/
|
|
192
108
|
/**
|
|
193
|
-
* Raised when the
|
|
194
|
-
* The wrap layer translates the proxy's HALT body into
|
|
195
|
-
* this exception **before** the underlying provider SDK can throw
|
|
196
|
-
* its own HTTP-status error so customer integration code catches
|
|
197
|
-
* Sentisec's typed surface, not a vendor-specific shape.
|
|
109
|
+
* Raised when the OpenAI wrapper recognises a HIJACK / HALT response.
|
|
198
110
|
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* - `args[0]` (i.e. `.message`) — `Sentisec HALT for session
|
|
203
|
-
* {sessionId!r}.` optionally extended with `detail`.
|
|
204
|
-
*
|
|
205
|
-
* The Python equivalent lives at `platform/sentisec/sdk/errors.py`
|
|
206
|
-
* (`TaskTamperError`); both are pinned at
|
|
207
|
-
* `sdk_error_surface_version: v1.0-phase1`.
|
|
111
|
+
* `sessionId` identifies the session and `detail`, when present,
|
|
112
|
+
* carries the proxy response detail. The formatted message includes
|
|
113
|
+
* both values.
|
|
208
114
|
*/
|
|
209
115
|
declare class SentisecHijackError extends Error {
|
|
210
116
|
readonly sessionId: string;
|
|
@@ -213,31 +119,10 @@ declare class SentisecHijackError extends Error {
|
|
|
213
119
|
}
|
|
214
120
|
|
|
215
121
|
/**
|
|
216
|
-
*
|
|
217
|
-
* client + vendor-specific types and the opt-in
|
|
218
|
-
* `SentisecAnthropicBlockError` (T-152).
|
|
122
|
+
* Structural Anthropic client types and block-response errors.
|
|
219
123
|
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
* deliberately do NOT import the `@anthropic-ai/sdk` npm package here:
|
|
223
|
-
*
|
|
224
|
-
* 1. `package.json` was frozen by T-150; adding `@anthropic-ai/sdk`
|
|
225
|
-
* (or it as a peerDependency) is out of scope for T-152.
|
|
226
|
-
* 2. The wrap signature is generic — `wrap<T>(client: T): T` — so
|
|
227
|
-
* the SDK works against any client whose surface matches this
|
|
228
|
-
* structural type, including future provider SDKs that adopt the
|
|
229
|
-
* same `messages.create` shape.
|
|
230
|
-
* 3. Customers who wire their own `Anthropic` instance into
|
|
231
|
-
* `monitor.wrap(anthropic)` get full type-preservation via the
|
|
232
|
-
* generic; they never see this `AnthropicLike` surface unless
|
|
233
|
-
* they explicitly cast.
|
|
234
|
-
*
|
|
235
|
-
* Vendor-specific error: `SentisecAnthropicBlockError` lives here
|
|
236
|
-
* (NOT in `errors.ts`) per the T-152 scope fence — T-151 owns
|
|
237
|
-
* `errors.ts` (`SentisecHijackError`); Anthropic-specific errors ship
|
|
238
|
-
* in vendor files so the two cards do not contend for a single file.
|
|
239
|
-
*
|
|
240
|
-
* Reference: public Monitor surface and Anthropic adapter wave-2 notes.
|
|
124
|
+
* The wrapper accepts compatible client objects without importing
|
|
125
|
+
* the Anthropic package and preserves the supplied client's type.
|
|
241
126
|
*/
|
|
242
127
|
/**
|
|
243
128
|
* Structural shape of `@anthropic-ai/sdk`'s `Anthropic` client surface
|
|
@@ -250,8 +135,7 @@ declare class SentisecHijackError extends Error {
|
|
|
250
135
|
* workspace-scoped key).
|
|
251
136
|
* - `baseURL` — read + rewritten to the Sentisec proxy URL.
|
|
252
137
|
* - `defaultHeaders` — read + extended with `x-sentisec-session-id`
|
|
253
|
-
* (matches the OpenAI adapter's header name
|
|
254
|
-
* T-151 / T-152 acceptance contract).
|
|
138
|
+
* (matches the OpenAI adapter's header name).
|
|
255
139
|
* - `messages.create` — the call site whose Promise return is
|
|
256
140
|
* post-processed. Unlike OpenAI (which throws on HALT), the
|
|
257
141
|
* Anthropic adapter rewrites the response into a synthetic
|
|
@@ -330,32 +214,12 @@ interface SentisecHaltEnvelope {
|
|
|
330
214
|
detail?: string;
|
|
331
215
|
}
|
|
332
216
|
/**
|
|
333
|
-
* Opt-in exception for
|
|
334
|
-
* instead of the default gated-return shape (acceptance test 3).
|
|
335
|
-
*
|
|
336
|
-
* The wrap layer does NOT throw this by default — Anthropic's agent
|
|
337
|
-
* loop pattern is "consume the model's content blocks, dispatch
|
|
338
|
-
* tool_use blocks, append tool_result blocks, repeat." Throwing
|
|
339
|
-
* mid-loop fights that pattern. Customers who want fail-closed
|
|
340
|
-
* semantics opt in via `Monitor.wrap(client, { onBlock: "throw" })`.
|
|
217
|
+
* Opt-in exception for Anthropic HALT responses.
|
|
341
218
|
*
|
|
342
|
-
* The
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
* observe. Anthropic gives us a richer return shape and the card
|
|
347
|
-
* pins us to use it.
|
|
348
|
-
*
|
|
349
|
-
* Surface mirrors `SentisecHijackError` (T-151) so consumer catch
|
|
350
|
-
* sites can type-discriminate on the vendor-specific class while
|
|
351
|
-
* sharing common fields:
|
|
352
|
-
* - `sessionId` — alerting key
|
|
353
|
-
* - `forensicId` — points into the §2.10 forensic pipeline
|
|
354
|
-
* - `row` — the decision-table row that fired
|
|
355
|
-
* - `intervention` — `"HALT"` (or `"ABORT"` if Stage-3 escalates)
|
|
356
|
-
*
|
|
357
|
-
* Pinned at `sdk_error_surface_version: v1.0-phase1`. Adding new fields
|
|
358
|
-
* here is a minor bump; renaming or removing is a major bump.
|
|
219
|
+
* The default wrapper returns a synthetic `sentisec_block` tool-use
|
|
220
|
+
* block. Set `Monitor.wrap(client, { onBlock: "throw" })` to throw
|
|
221
|
+
* this error instead. `sessionId`, `forensicId`, `row`, `intervention`
|
|
222
|
+
* and optional `detail` carry the block-response metadata.
|
|
359
223
|
*/
|
|
360
224
|
declare class SentisecAnthropicBlockError extends Error {
|
|
361
225
|
readonly sessionId: string;
|
|
@@ -373,32 +237,10 @@ declare class SentisecAnthropicBlockError extends Error {
|
|
|
373
237
|
}
|
|
374
238
|
|
|
375
239
|
/**
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
* Implements `AsyncIterator<StreamChunk>` consuming server-sent-events
|
|
379
|
-
* from the proxy SSE endpoint and provides streaming wrappers for both
|
|
380
|
-
* OpenAI and Anthropic clients.
|
|
381
|
-
*
|
|
382
|
-
* Design constraints:
|
|
240
|
+
* SSE adapters for OpenAI and Anthropic clients.
|
|
383
241
|
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
* 2. Node-compatible: same `fetch` path works via Node 20's built-in
|
|
387
|
-
* fetch or undici (no import needed beyond globalThis.fetch).
|
|
388
|
-
* 3. No new runtime dependencies: no `eventsource-parser`, no `msw`.
|
|
389
|
-
* Pure fetch + ReadableStream + TextDecoder.
|
|
390
|
-
* 4. AbortSignal honoured: consumer calls `AbortController.abort()`;
|
|
391
|
-
* the stream closes and emits a `session_closed` event on the
|
|
392
|
-
* last chunk.
|
|
393
|
-
*
|
|
394
|
-
* Acceptance tests (T-153):
|
|
395
|
-
* - test_openai_stream_clean_passthrough
|
|
396
|
-
* - test_openai_stream_tool_call_halted_mid_stream
|
|
397
|
-
* - test_anthropic_stream_clean_passthrough
|
|
398
|
-
* - test_anthropic_stream_tool_use_halted_mid_stream
|
|
399
|
-
* - test_abort_signal_honored
|
|
400
|
-
*
|
|
401
|
-
* Reference: public Monitor surface and T-153 acceptance tests.
|
|
242
|
+
* Uses fetch, ReadableStream and TextDecoder to pass through stream
|
|
243
|
+
* events, attach Sentisec verdict metadata and honour AbortSignal.
|
|
402
244
|
*/
|
|
403
245
|
/**
|
|
404
246
|
* A verdict emitted by the proxy SSE endpoint.
|
|
@@ -540,22 +382,11 @@ interface AnthropicStreamingLike {
|
|
|
540
382
|
declare function wrapAnthropicStream<T extends AnthropicStreamingLike>(client: T, sessionId: string, opts?: StreamOptions): T;
|
|
541
383
|
|
|
542
384
|
/**
|
|
543
|
-
* @sentisec/sdk — TypeScript SDK public surface
|
|
544
|
-
*
|
|
545
|
-
* This file mirrors the Python SDK's public shape (see
|
|
546
|
-
* `platform/sentisec/sdk/__init__.py` + `platform/sentisec/sdk/monitor.py`
|
|
547
|
-
* + `platform/sentisec/sdk/session.py` + `platform/sentisec/sdk/errors.py`)
|
|
548
|
-
* so the wave-2 cards (T-151/T-152/T-153/T-154) can fill in the
|
|
549
|
-
* adapter bodies against a frozen surface.
|
|
550
|
-
*
|
|
551
|
-
* T-150 deliberately does NOT implement session lifecycle / wrap /
|
|
552
|
-
* task-integrity checks / forensic export — those responsibilities
|
|
553
|
-
* land with T-151 (OpenAI wrap), T-152 (Anthropic wrap), T-153
|
|
554
|
-
* (Session lifecycle parity), T-154 (error-surface parity). This
|
|
555
|
-
* file pins the types + class shape so those cards do not each
|
|
556
|
-
* re-invent it.
|
|
385
|
+
* @sentisec/sdk — TypeScript SDK public surface.
|
|
557
386
|
*
|
|
558
|
-
*
|
|
387
|
+
* Use `Monitor.wrap()` for OpenAI and Anthropic clients, and the
|
|
388
|
+
* separate streaming wrappers for SSE responses. Session lifecycle
|
|
389
|
+
* and forensic export methods are reserved and currently throw.
|
|
559
390
|
*/
|
|
560
391
|
/**
|
|
561
392
|
* Base class for all Sentisec SDK exceptions. Frozen at
|
|
@@ -574,10 +405,8 @@ declare class UnknownPolicyError extends SentisecError {
|
|
|
574
405
|
constructor(policyName: string, message?: string);
|
|
575
406
|
}
|
|
576
407
|
/**
|
|
577
|
-
*
|
|
578
|
-
*
|
|
579
|
-
* `Error` to match the Python surface (the Python class is
|
|
580
|
-
* `VerifierBackendNotConfigured`, frozen at v1.0-phase1).
|
|
408
|
+
* Error type for integrations with no configured verifier backend.
|
|
409
|
+
* Carries an optional hint in addition to the base error message.
|
|
581
410
|
*/
|
|
582
411
|
declare class VerifierBackendNotConfigured extends SentisecError {
|
|
583
412
|
readonly hint: string | undefined;
|
|
@@ -598,22 +427,19 @@ declare class TaskTamperError extends SentisecError {
|
|
|
598
427
|
*/
|
|
599
428
|
type ResponsePolicy = "shadow" | "gated" | "block" | "sanitize_then_resume";
|
|
600
429
|
/**
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
-
*
|
|
430
|
+
* Status values for the reserved session handle. Constructing a
|
|
431
|
+
* `Session` sets `ACTIVE`; automated lifecycle transitions are not
|
|
432
|
+
* implemented in this SDK.
|
|
604
433
|
*/
|
|
605
434
|
type SessionStatus = "ACTIVE" | "HALTED" | "COMPLETED" | "ABORTED";
|
|
606
435
|
/**
|
|
607
|
-
*
|
|
608
|
-
*
|
|
609
|
-
* Phase-1.5 adds the `*_enterprise.yaml` + agent-specific bundles
|
|
610
|
-
* (Track 4C, T-115..T-129) — those ship as `.yaml` paths, not new ids.
|
|
436
|
+
* Built-in policy identifiers accepted by `Monitor`. A string ending
|
|
437
|
+
* in `.yaml` is also accepted; the SDK does not load the YAML file.
|
|
611
438
|
*/
|
|
612
439
|
declare const BUILTIN_POLICIES: readonly ["research_agent", "customer_support", "coding_agent"];
|
|
613
440
|
type BuiltinPolicy = (typeof BUILTIN_POLICIES)[number];
|
|
614
441
|
/**
|
|
615
|
-
* Developer-facing
|
|
616
|
-
* `Monitor` dataclass constructor in `platform/sentisec/sdk/monitor.py`.
|
|
442
|
+
* Developer-facing configuration for a `Monitor`.
|
|
617
443
|
*/
|
|
618
444
|
interface MonitorConfig {
|
|
619
445
|
apiKey: string;
|
|
@@ -629,18 +455,14 @@ interface MonitorConfig {
|
|
|
629
455
|
* Set this whenever you are not talking to the hosted plane. Leaving
|
|
630
456
|
* it unset falls back to `SENTISEC_ENDPOINT` and then to
|
|
631
457
|
* `https://api.sentisec.ch`, which means a local or self-hosted
|
|
632
|
-
* deployment that forgets it
|
|
633
|
-
* field, same precedence, same failure mode as the Python SDK's
|
|
634
|
-
* `Monitor(endpoint=...)`.
|
|
458
|
+
* deployment that forgets it sends its prompts to the hosted plane.
|
|
635
459
|
*/
|
|
636
460
|
endpoint?: string;
|
|
637
461
|
}
|
|
638
462
|
/**
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
642
|
-
*
|
|
643
|
-
* NOT constructed directly — obtain via `monitor.session()`.
|
|
463
|
+
* Reserved session handle. `Monitor.session()`, `Session.wrap()` and
|
|
464
|
+
* `Session.exportForensicBundle()` are not implemented and throw.
|
|
465
|
+
* Use `Monitor.wrap()` to configure a provider client.
|
|
644
466
|
*/
|
|
645
467
|
declare class Session {
|
|
646
468
|
readonly sessionId: string;
|
|
@@ -658,30 +480,21 @@ declare class Session {
|
|
|
658
480
|
taskImmutableHash: string;
|
|
659
481
|
});
|
|
660
482
|
/**
|
|
661
|
-
*
|
|
662
|
-
*
|
|
663
|
-
* T-151 (OpenAI) and T-152 (Anthropic) fill this in. Calling it at
|
|
664
|
-
* T-150 throws so downstream code can't accidentally ship against
|
|
665
|
-
* a silently-passthrough stub.
|
|
483
|
+
* Reserved provider wrapper; currently throws. Use `Monitor.wrap()`
|
|
484
|
+
* instead.
|
|
666
485
|
*/
|
|
667
486
|
wrap<T>(_client: T): T;
|
|
668
487
|
/**
|
|
669
|
-
*
|
|
670
|
-
* T-153 alongside the Python `export_forensic_bundle` parity work.
|
|
488
|
+
* Reserved forensic export method; currently throws.
|
|
671
489
|
*/
|
|
672
490
|
exportForensicBundle(): string;
|
|
673
491
|
}
|
|
674
492
|
/**
|
|
675
|
-
*
|
|
676
|
-
* object. Mirrors the Python `Monitor` dataclass.
|
|
493
|
+
* Configuration object for the provider wrappers.
|
|
677
494
|
*
|
|
678
|
-
* Construction validates
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
* control-plane alert grouping works cross-language.
|
|
682
|
-
*
|
|
683
|
-
* Real bundle YAML loading is deferred to the policy-bundle cards
|
|
684
|
-
* (Track 3, T-070..T-072); T-150 only pins the registry gate.
|
|
495
|
+
* Construction validates built-in policy identifiers or a string ending
|
|
496
|
+
* in `.yaml`. Other values throw `UnknownPolicyError` with `.policyName`
|
|
497
|
+
* populated. The SDK does not load or validate YAML contents.
|
|
685
498
|
*/
|
|
686
499
|
declare class Monitor {
|
|
687
500
|
readonly apiKey: string;
|
|
@@ -694,12 +507,8 @@ declare class Monitor {
|
|
|
694
507
|
constructor(config: MonitorConfig);
|
|
695
508
|
private validatePolicy;
|
|
696
509
|
/**
|
|
697
|
-
*
|
|
698
|
-
*
|
|
699
|
-
* T-153 fills in the sha256 task-hash computation + `_checkTaskIntegrity`
|
|
700
|
-
* parity. T-150 throws a `NotImplementedError`-shaped exception so
|
|
701
|
-
* accidental usage during wave-2 development does not silently
|
|
702
|
-
* produce a session with an empty hash.
|
|
510
|
+
* Reserved session lifecycle method; currently throws.
|
|
511
|
+
* Use `Monitor.wrap()` to configure a provider client.
|
|
703
512
|
*/
|
|
704
513
|
session(): Session;
|
|
705
514
|
}
|
package/dist/index.js
CHANGED
|
@@ -709,11 +709,8 @@ var Session = class {
|
|
|
709
709
|
this.status = "ACTIVE";
|
|
710
710
|
}
|
|
711
711
|
/**
|
|
712
|
-
*
|
|
713
|
-
*
|
|
714
|
-
* T-151 (OpenAI) and T-152 (Anthropic) fill this in. Calling it at
|
|
715
|
-
* T-150 throws so downstream code can't accidentally ship against
|
|
716
|
-
* a silently-passthrough stub.
|
|
712
|
+
* Reserved provider wrapper; currently throws. Use `Monitor.wrap()`
|
|
713
|
+
* instead.
|
|
717
714
|
*/
|
|
718
715
|
wrap(_client) {
|
|
719
716
|
throw new Error(
|
|
@@ -721,8 +718,7 @@ var Session = class {
|
|
|
721
718
|
);
|
|
722
719
|
}
|
|
723
720
|
/**
|
|
724
|
-
*
|
|
725
|
-
* T-153 alongside the Python `export_forensic_bundle` parity work.
|
|
721
|
+
* Reserved forensic export method; currently throws.
|
|
726
722
|
*/
|
|
727
723
|
exportForensicBundle() {
|
|
728
724
|
throw new Error(
|
|
@@ -760,12 +756,8 @@ var Monitor = class {
|
|
|
760
756
|
);
|
|
761
757
|
}
|
|
762
758
|
/**
|
|
763
|
-
*
|
|
764
|
-
*
|
|
765
|
-
* T-153 fills in the sha256 task-hash computation + `_checkTaskIntegrity`
|
|
766
|
-
* parity. T-150 throws a `NotImplementedError`-shaped exception so
|
|
767
|
-
* accidental usage during wave-2 development does not silently
|
|
768
|
-
* produce a session with an empty hash.
|
|
759
|
+
* Reserved session lifecycle method; currently throws.
|
|
760
|
+
* Use `Monitor.wrap()` to configure a provider client.
|
|
769
761
|
*/
|
|
770
762
|
session() {
|
|
771
763
|
throw new Error(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentisec/sdk",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.7",
|
|
4
4
|
"description": "Sentisec TypeScript SDK — cognitive integrity monitoring for autonomous agents. Monitor + wrap(...) for OpenAI / Anthropic agent loops with SSE streaming support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|