@responsibleai/agent-hooks 0.1.0-beta.2 → 0.1.0-beta.3

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/README.md CHANGED
@@ -16,13 +16,13 @@ runner.
16
16
  > before relying on it.
17
17
 
18
18
  ```bash
19
- npm install @responsibleai/agent-hooks@alpha
19
+ npm install @responsibleai/agent-hooks
20
20
  ```
21
21
 
22
- Keep the `@alpha` tag (or pin an exact published version) while the
23
- package is pre-release: npm's `latest` tag can lag the newest
24
- pre-release, so a plain `npm install` may fetch an older build. Check
25
- what the tags resolve to with
22
+ A plain install gets the newest release, pre-releases included. The
23
+ channel tags `alpha`, `beta` and `rc` exist for pinning to one line
24
+ (`@responsibleai/agent-hooks@beta`); or pin an exact published
25
+ version. Check what the tags resolve to with
26
26
  `npm view @responsibleai/agent-hooks dist-tags`.
27
27
 
28
28
  ## Usage
package/binding.d.ts CHANGED
@@ -54,6 +54,8 @@ export declare function declarationVersions(): string
54
54
 
55
55
  export declare function finalize(ctxJson: string, verdictJson: string, mode: string, optionsJson: string): string
56
56
 
57
+ export declare function normalizeInterceptorResponse(responseJson: string): string
58
+
57
59
  export declare function specVersion(): string
58
60
 
59
61
  /** §4/§6.3: envelope validation (fail closed, value-free detail). */
package/binding.js CHANGED
@@ -89,8 +89,8 @@ function requireNative() {
89
89
  try {
90
90
  const binding = require('@responsibleai/agent-hooks-android-arm64')
91
91
  const bindingPackageVersion = require('@responsibleai/agent-hooks-android-arm64/package.json').version
92
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
93
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
92
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
93
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
94
94
  }
95
95
  return binding
96
96
  } catch (e) {
@@ -105,8 +105,8 @@ function requireNative() {
105
105
  try {
106
106
  const binding = require('@responsibleai/agent-hooks-android-arm-eabi')
107
107
  const bindingPackageVersion = require('@responsibleai/agent-hooks-android-arm-eabi/package.json').version
108
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
109
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
108
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
109
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
110
110
  }
111
111
  return binding
112
112
  } catch (e) {
@@ -126,8 +126,8 @@ function requireNative() {
126
126
  try {
127
127
  const binding = require('@responsibleai/agent-hooks-win32-x64-gnu')
128
128
  const bindingPackageVersion = require('@responsibleai/agent-hooks-win32-x64-gnu/package.json').version
129
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
130
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
129
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
130
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
131
131
  }
132
132
  return binding
133
133
  } catch (e) {
@@ -142,8 +142,8 @@ function requireNative() {
142
142
  try {
143
143
  const binding = require('@responsibleai/agent-hooks-win32-x64-msvc')
144
144
  const bindingPackageVersion = require('@responsibleai/agent-hooks-win32-x64-msvc/package.json').version
145
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
146
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
145
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
146
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
147
147
  }
148
148
  return binding
149
149
  } catch (e) {
@@ -159,8 +159,8 @@ function requireNative() {
159
159
  try {
160
160
  const binding = require('@responsibleai/agent-hooks-win32-ia32-msvc')
161
161
  const bindingPackageVersion = require('@responsibleai/agent-hooks-win32-ia32-msvc/package.json').version
162
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
163
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
162
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
163
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
164
164
  }
165
165
  return binding
166
166
  } catch (e) {
@@ -175,8 +175,8 @@ function requireNative() {
175
175
  try {
176
176
  const binding = require('@responsibleai/agent-hooks-win32-arm64-msvc')
177
177
  const bindingPackageVersion = require('@responsibleai/agent-hooks-win32-arm64-msvc/package.json').version
178
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
179
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
178
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
179
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
180
180
  }
181
181
  return binding
182
182
  } catch (e) {
@@ -194,8 +194,8 @@ function requireNative() {
194
194
  try {
195
195
  const binding = require('@responsibleai/agent-hooks-darwin-universal')
196
196
  const bindingPackageVersion = require('@responsibleai/agent-hooks-darwin-universal/package.json').version
197
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
198
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
197
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
198
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
199
199
  }
200
200
  return binding
201
201
  } catch (e) {
@@ -210,8 +210,8 @@ function requireNative() {
210
210
  try {
211
211
  const binding = require('@responsibleai/agent-hooks-darwin-x64')
212
212
  const bindingPackageVersion = require('@responsibleai/agent-hooks-darwin-x64/package.json').version
213
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
214
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
213
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
214
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
215
215
  }
216
216
  return binding
217
217
  } catch (e) {
@@ -226,8 +226,8 @@ function requireNative() {
226
226
  try {
227
227
  const binding = require('@responsibleai/agent-hooks-darwin-arm64')
228
228
  const bindingPackageVersion = require('@responsibleai/agent-hooks-darwin-arm64/package.json').version
229
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
230
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
229
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
230
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
231
231
  }
232
232
  return binding
233
233
  } catch (e) {
@@ -246,8 +246,8 @@ function requireNative() {
246
246
  try {
247
247
  const binding = require('@responsibleai/agent-hooks-freebsd-x64')
248
248
  const bindingPackageVersion = require('@responsibleai/agent-hooks-freebsd-x64/package.json').version
249
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
250
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
249
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
250
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
251
251
  }
252
252
  return binding
253
253
  } catch (e) {
@@ -262,8 +262,8 @@ function requireNative() {
262
262
  try {
263
263
  const binding = require('@responsibleai/agent-hooks-freebsd-arm64')
264
264
  const bindingPackageVersion = require('@responsibleai/agent-hooks-freebsd-arm64/package.json').version
265
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
266
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
265
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
266
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
267
267
  }
268
268
  return binding
269
269
  } catch (e) {
@@ -283,8 +283,8 @@ function requireNative() {
283
283
  try {
284
284
  const binding = require('@responsibleai/agent-hooks-linux-x64-musl')
285
285
  const bindingPackageVersion = require('@responsibleai/agent-hooks-linux-x64-musl/package.json').version
286
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
286
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
288
288
  }
289
289
  return binding
290
290
  } catch (e) {
@@ -299,8 +299,8 @@ function requireNative() {
299
299
  try {
300
300
  const binding = require('@responsibleai/agent-hooks-linux-x64-gnu')
301
301
  const bindingPackageVersion = require('@responsibleai/agent-hooks-linux-x64-gnu/package.json').version
302
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
303
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
302
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
303
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
304
304
  }
305
305
  return binding
306
306
  } catch (e) {
@@ -317,8 +317,8 @@ function requireNative() {
317
317
  try {
318
318
  const binding = require('@responsibleai/agent-hooks-linux-arm64-musl')
319
319
  const bindingPackageVersion = require('@responsibleai/agent-hooks-linux-arm64-musl/package.json').version
320
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
321
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
320
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
321
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
322
322
  }
323
323
  return binding
324
324
  } catch (e) {
@@ -333,8 +333,8 @@ function requireNative() {
333
333
  try {
334
334
  const binding = require('@responsibleai/agent-hooks-linux-arm64-gnu')
335
335
  const bindingPackageVersion = require('@responsibleai/agent-hooks-linux-arm64-gnu/package.json').version
336
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
337
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
336
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
337
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
338
338
  }
339
339
  return binding
340
340
  } catch (e) {
@@ -351,8 +351,8 @@ function requireNative() {
351
351
  try {
352
352
  const binding = require('@responsibleai/agent-hooks-linux-arm-musleabihf')
353
353
  const bindingPackageVersion = require('@responsibleai/agent-hooks-linux-arm-musleabihf/package.json').version
354
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
355
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
354
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
355
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
356
356
  }
357
357
  return binding
358
358
  } catch (e) {
@@ -367,8 +367,8 @@ function requireNative() {
367
367
  try {
368
368
  const binding = require('@responsibleai/agent-hooks-linux-arm-gnueabihf')
369
369
  const bindingPackageVersion = require('@responsibleai/agent-hooks-linux-arm-gnueabihf/package.json').version
370
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
371
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
370
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
371
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
372
372
  }
373
373
  return binding
374
374
  } catch (e) {
@@ -385,8 +385,8 @@ function requireNative() {
385
385
  try {
386
386
  const binding = require('@responsibleai/agent-hooks-linux-loong64-musl')
387
387
  const bindingPackageVersion = require('@responsibleai/agent-hooks-linux-loong64-musl/package.json').version
388
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
389
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
388
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
389
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
390
390
  }
391
391
  return binding
392
392
  } catch (e) {
@@ -401,8 +401,8 @@ function requireNative() {
401
401
  try {
402
402
  const binding = require('@responsibleai/agent-hooks-linux-loong64-gnu')
403
403
  const bindingPackageVersion = require('@responsibleai/agent-hooks-linux-loong64-gnu/package.json').version
404
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
405
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
404
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
405
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
406
406
  }
407
407
  return binding
408
408
  } catch (e) {
@@ -419,8 +419,8 @@ function requireNative() {
419
419
  try {
420
420
  const binding = require('@responsibleai/agent-hooks-linux-riscv64-musl')
421
421
  const bindingPackageVersion = require('@responsibleai/agent-hooks-linux-riscv64-musl/package.json').version
422
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
423
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
422
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
423
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
424
424
  }
425
425
  return binding
426
426
  } catch (e) {
@@ -435,8 +435,8 @@ function requireNative() {
435
435
  try {
436
436
  const binding = require('@responsibleai/agent-hooks-linux-riscv64-gnu')
437
437
  const bindingPackageVersion = require('@responsibleai/agent-hooks-linux-riscv64-gnu/package.json').version
438
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
439
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
438
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
439
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
440
440
  }
441
441
  return binding
442
442
  } catch (e) {
@@ -452,8 +452,8 @@ function requireNative() {
452
452
  try {
453
453
  const binding = require('@responsibleai/agent-hooks-linux-ppc64-gnu')
454
454
  const bindingPackageVersion = require('@responsibleai/agent-hooks-linux-ppc64-gnu/package.json').version
455
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
456
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
455
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
456
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
457
457
  }
458
458
  return binding
459
459
  } catch (e) {
@@ -468,8 +468,8 @@ function requireNative() {
468
468
  try {
469
469
  const binding = require('@responsibleai/agent-hooks-linux-s390x-gnu')
470
470
  const bindingPackageVersion = require('@responsibleai/agent-hooks-linux-s390x-gnu/package.json').version
471
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
472
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
471
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
472
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
473
473
  }
474
474
  return binding
475
475
  } catch (e) {
@@ -488,8 +488,8 @@ function requireNative() {
488
488
  try {
489
489
  const binding = require('@responsibleai/agent-hooks-openharmony-arm64')
490
490
  const bindingPackageVersion = require('@responsibleai/agent-hooks-openharmony-arm64/package.json').version
491
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
492
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
491
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
492
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
493
493
  }
494
494
  return binding
495
495
  } catch (e) {
@@ -504,8 +504,8 @@ function requireNative() {
504
504
  try {
505
505
  const binding = require('@responsibleai/agent-hooks-openharmony-x64')
506
506
  const bindingPackageVersion = require('@responsibleai/agent-hooks-openharmony-x64/package.json').version
507
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
508
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
507
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
508
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
509
509
  }
510
510
  return binding
511
511
  } catch (e) {
@@ -520,8 +520,8 @@ function requireNative() {
520
520
  try {
521
521
  const binding = require('@responsibleai/agent-hooks-openharmony-arm')
522
522
  const bindingPackageVersion = require('@responsibleai/agent-hooks-openharmony-arm/package.json').version
523
- if (bindingPackageVersion !== '0.1.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
524
- throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
523
+ if (bindingPackageVersion !== '0.1.0-beta.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
524
+ throw new Error(`Native binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
525
525
  }
526
526
  return binding
527
527
  } catch (e) {
@@ -661,8 +661,8 @@ if (!nativeBinding || forceWasi) {
661
661
  if (!candidateFailed) {
662
662
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
663
663
  const bindingPackageVersion = require('@responsibleai/agent-hooks-wasm32-wasi/package.json').version
664
- if (bindingPackageVersion !== '0.1.0-beta.2') {
665
- throw new Error(`WASI binding package version mismatch, expected 0.1.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
664
+ if (bindingPackageVersion !== '0.1.0-beta.3') {
665
+ throw new Error(`WASI binding package version mismatch, expected 0.1.0-beta.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
666
666
  }
667
667
  }
668
668
  wasiBinding = require('@responsibleai/agent-hooks-wasm32-wasi')
@@ -792,6 +792,7 @@ module.exports.declarationResolveSurface = nativeBinding.declarationResolveSurfa
792
792
  module.exports.declarationValidate = nativeBinding.declarationValidate
793
793
  module.exports.declarationVersions = nativeBinding.declarationVersions
794
794
  module.exports.finalize = nativeBinding.finalize
795
+ module.exports.normalizeInterceptorResponse = nativeBinding.normalizeInterceptorResponse
795
796
  module.exports.specVersion = nativeBinding.specVersion
796
797
  module.exports.validateEnvelope = nativeBinding.validateEnvelope
797
798
  module.exports.validateTransformCtx = nativeBinding.validateTransformCtx
package/dist/builder.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
2
+ // Copyright (c) Microsoft. All rights reserved.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AgentContextBuilder = void 0;
4
5
  /**
5
6
  * `AgentContext` construction (§4).
6
7
  *
@@ -8,8 +9,6 @@
8
9
  * (agent/session/sequence) and exposes one method per interception
9
10
  * point that fills L1 and sets `target`.
10
11
  */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.AgentContextBuilder = void 0;
13
12
  const index_1 = require("./index");
14
13
  function now() {
15
14
  return new Date().toISOString();
package/dist/ctk/index.js CHANGED
@@ -1,13 +1,5 @@
1
1
  "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- /**
5
- * Conformance Test Kit (§13.2).
6
- *
7
- * The assertion engine and scripted interceptor/resolver live in the
8
- * Rust core; this module defines the `Harness` interface framework
9
- * adapters implement, plus the runner and reference harness that use it.
10
- */
2
+ // Copyright (c) Microsoft. All rights reserved.
11
3
  Object.defineProperty(exports, "__esModule", { value: true });
12
4
  exports.REFERENCE_DECLARATION = exports.ReferenceHarness = exports.provePaths = exports.builderFromValue = exports.runVectors = exports.runVector = exports.loadVectors = exports.assessHarness = void 0;
13
5
  var runner_1 = require("./runner");
@@ -1,17 +1,3 @@
1
- /**
2
- * Reference in-memory agent + harness.
3
- *
4
- * The simplest possible conformant agent loop; exists so the
5
- * CTK can self-test without a real framework. Port of
6
- * `sdk/python/python/agent_hooks/ctk/reference.py`.
7
- *
8
- * Every emitter it builds goes through the host declaration loader
9
- * (§7.7): for a field-based vector it writes the vector's mode,
10
- * composition and provider into a copy of its own document
11
- * (`reference.declaration.json`) and binds the scripted interceptors
12
- * through a `ctk.instance` kind, so the field-based vectors exercise
13
- * the loader too.
14
- */
15
1
  import { ApprovalResolver, CompositionConfig, EnforcementMode, HostRegistry, HostSurface, Interceptor, JsonValue } from "../index";
16
2
  import type { Capability, Harness, RunRecord, Scenario } from "./index";
17
3
  /** The reference harness's own declaration (§7.7.9), with an explicit
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
2
+ // Copyright (c) Microsoft. All rights reserved.
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ReferenceHarness = exports.REFERENCE_DECLARATION = void 0;
4
8
  /**
5
9
  * Reference in-memory agent + harness.
6
10
  *
@@ -15,11 +19,6 @@
15
19
  * through a `ctk.instance` kind, so the field-based vectors exercise
16
20
  * the loader too.
17
21
  */
18
- var __importDefault = (this && this.__importDefault) || function (mod) {
19
- return (mod && mod.__esModule) ? mod : { "default": mod };
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.ReferenceHarness = exports.REFERENCE_DECLARATION = void 0;
23
22
  const node_crypto_1 = require("node:crypto");
24
23
  const index_1 = require("../index");
25
24
  const builder_1 = require("../builder");
@@ -1,13 +1,3 @@
1
- /**
2
- * CTK runner: load vectors, drive a harness, assert `expect`.
3
- *
4
- * The assertion engine, capability skip check, and scripted
5
- * interceptor/resolver evaluation live in the Rust core (native.ctk*).
6
- * This module keeps only vector globbing, the recording wrapper, the
7
- * host declaration seam (§7.7.9: the CTK registry, the construction
8
- * path proof and the `load` outcome) and the orchestration loop that
9
- * calls the native `Harness`.
10
- */
11
1
  import { AgentContext, DeclarationBuilder, HostRegistry, JsonValue } from "../index";
12
2
  import type { Harness } from "./index";
13
3
  export interface VectorResult {
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
2
+ // Copyright (c) Microsoft. All rights reserved.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.loadVectors = loadVectors;
5
+ exports.redactPaths = redactPaths;
6
+ exports.builderFromValue = builderFromValue;
7
+ exports.provePaths = provePaths;
8
+ exports.assessHarness = assessHarness;
9
+ exports.runVector = runVector;
10
+ exports.runVectors = runVectors;
4
11
  /**
5
12
  * CTK runner: load vectors, drive a harness, assert `expect`.
6
13
  *
@@ -11,14 +18,6 @@
11
18
  * path proof and the `load` outcome) and the orchestration loop that
12
19
  * calls the native `Harness`.
13
20
  */
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.loadVectors = loadVectors;
16
- exports.redactPaths = redactPaths;
17
- exports.builderFromValue = builderFromValue;
18
- exports.provePaths = provePaths;
19
- exports.assessHarness = assessHarness;
20
- exports.runVector = runVector;
21
- exports.runVectors = runVectors;
22
21
  const node_fs_1 = require("node:fs");
23
22
  const node_os_1 = require("node:os");
24
23
  const node_path_1 = require("node:path");
@@ -1,19 +1,3 @@
1
- /**
2
- * Host declaration document (spec §7.7): the loader, the registry it
3
- * resolves against, and the builder for the code path.
4
- *
5
- * A declaration is one JSON object that fixes a host's configuration
6
- * (§7.1, §8, §10.1, §13.1), its declared surface (§13.1) and its
7
- * interceptor bindings. It is a versioned contract of its own
8
- * (`agent-hooks-declaration/<major>.<minor>`, §7.7.2), separate from
9
- * the wire version `SPEC_VERSION` and from the package version.
10
- *
11
- * Every normative check lives in the Rust core. This module does the
12
- * two things only the wrapper can do: read a file (step 1 of §7.7.6)
13
- * and run the host's kind resolvers (step 11, in `emitter.ts`). Steps
14
- * 2 to 10 cross the native boundary as JSON text, so a document yields
15
- * the same refusal class here as in every other SDK.
16
- */
17
1
  import { AgentContext, ApprovalResolver, CompositionConfig, CompositionProfile, EnforcementMode, InterceptionPoint, Interceptor, JsonValue, OnApproval, SynthesisPolicy } from "./index";
18
2
  /** The declaration contract version this SDK writes and accepts
19
3
  * (§7.7.2). A test pins it to the core's `declaration_versions()`. */
@@ -233,9 +217,10 @@ export declare class HostDeclaration {
233
217
  private readonly doc;
234
218
  private readonly text;
235
219
  /** `text` is the core's serialization of the validated document and
236
- * is what every later core call receives, so integers beyond 2^53
237
- * inside `bindings[].config` reach steps 8 to 10 as the file had
238
- * them. `doc` is the JavaScript view of the same text. */
220
+ * is what every later core call receives. The loader refuses any
221
+ * integer token beyond 2^53 - 1 anywhere in the document (§7.7.6),
222
+ * so `doc`, the JavaScript view of the same text, carries every
223
+ * number exactly. */
239
224
  private constructor();
240
225
  /** Step 1 then {@link HostDeclaration.fromJson}: open exactly `path`,
241
226
  * require a regular file of at most {@link MAX_DOCUMENT_BYTES},
@@ -254,8 +239,8 @@ export declare class HostDeclaration {
254
239
  /** The document's own `declaration` value. */
255
240
  get version(): string;
256
241
  /** The validated document, verbatim (including `$schema`). A copy.
257
- * Integers beyond 2^53 inside `bindings[].config` are rounded in this
258
- * view; {@link HostDeclaration.toJson} keeps them exact. */
242
+ * Every integer in a validated document is within ±(2^53 - 1), so
243
+ * this view loses nothing against {@link HostDeclaration.toJson}. */
259
244
  toValue(): Record<string, JsonValue>;
260
245
  /** @internal The validated document as JSON text, as the core
261
246
  * serialized it. */
@@ -1,6 +1,14 @@
1
1
  "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
2
+ // Copyright (c) Microsoft. All rights reserved.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.DeclarationBuilder = exports.HostDeclaration = exports.HostRegistry = exports.HostSurface = exports.HostRegistryError = exports.DeclarationError = exports.DeclarationErrorClass = exports.CAPABILITIES = exports.MAX_TIMEOUT_MS = exports.MAX_DETAIL_LEN = exports.MAX_KIND_LEN = exports.MAX_ID_LEN = exports.MAX_BINDINGS = exports.MAX_DEPTH = exports.MAX_DOCUMENT_BYTES = exports.SUPPORTED_DECLARATION_VERSIONS = exports.DECLARATION_VERSION = void 0;
5
+ exports.fullKnobSupport = fullKnobSupport;
6
+ exports.validReference = validReference;
7
+ exports.validKind = validKind;
8
+ exports.canonicalDeclaration = canonicalDeclaration;
9
+ exports.resolveDeclaration = resolveDeclaration;
10
+ exports.resolveSurfaceOnly = resolveSurfaceOnly;
11
+ exports.declarationVersions = declarationVersions;
4
12
  /**
5
13
  * Host declaration document (spec §7.7): the loader, the registry it
6
14
  * resolves against, and the builder for the code path.
@@ -17,15 +25,6 @@
17
25
  * 2 to 10 cross the native boundary as JSON text, so a document yields
18
26
  * the same refusal class here as in every other SDK.
19
27
  */
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.DeclarationBuilder = exports.HostDeclaration = exports.HostRegistry = exports.HostSurface = exports.HostRegistryError = exports.DeclarationError = exports.DeclarationErrorClass = exports.CAPABILITIES = exports.MAX_TIMEOUT_MS = exports.MAX_DETAIL_LEN = exports.MAX_KIND_LEN = exports.MAX_ID_LEN = exports.MAX_BINDINGS = exports.MAX_DEPTH = exports.MAX_DOCUMENT_BYTES = exports.SUPPORTED_DECLARATION_VERSIONS = exports.DECLARATION_VERSION = void 0;
22
- exports.fullKnobSupport = fullKnobSupport;
23
- exports.validReference = validReference;
24
- exports.validKind = validKind;
25
- exports.canonicalDeclaration = canonicalDeclaration;
26
- exports.resolveDeclaration = resolveDeclaration;
27
- exports.resolveSurfaceOnly = resolveSurfaceOnly;
28
- exports.declarationVersions = declarationVersions;
29
28
  const promises_1 = require("node:fs/promises");
30
29
  const index_1 = require("./index");
31
30
  const native_1 = require("./native");
@@ -410,9 +409,10 @@ class HostDeclaration {
410
409
  doc;
411
410
  text;
412
411
  /** `text` is the core's serialization of the validated document and
413
- * is what every later core call receives, so integers beyond 2^53
414
- * inside `bindings[].config` reach steps 8 to 10 as the file had
415
- * them. `doc` is the JavaScript view of the same text. */
412
+ * is what every later core call receives. The loader refuses any
413
+ * integer token beyond 2^53 - 1 anywhere in the document (§7.7.6),
414
+ * so `doc`, the JavaScript view of the same text, carries every
415
+ * number exactly. */
416
416
  constructor(doc, text) {
417
417
  this.doc = doc;
418
418
  this.text = text;
@@ -512,8 +512,8 @@ class HostDeclaration {
512
512
  return typeof v === "string" ? v : "";
513
513
  }
514
514
  /** The validated document, verbatim (including `$schema`). A copy.
515
- * Integers beyond 2^53 inside `bindings[].config` are rounded in this
516
- * view; {@link HostDeclaration.toJson} keeps them exact. */
515
+ * Every integer in a validated document is within ±(2^53 - 1), so
516
+ * this view loses nothing against {@link HostDeclaration.toJson}. */
517
517
  toValue() {
518
518
  return JSON.parse(this.text);
519
519
  }
package/dist/emitter.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
2
+ // Copyright (c) Microsoft. All rights reserved.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.InterceptionEmitter = exports.EmitterSealed = exports.DEFAULT_TIMEOUT_MS = void 0;
4
5
  /**
5
6
  * Host-side emitter: dispatch context → interceptors → composition →
6
7
  * combined verdict → record (§6–§10).
@@ -37,8 +38,6 @@
37
38
  * on the event loop; sequence assignment and record append are atomic on
38
39
  * a single JS thread. Sharing one emitter across workers is unsupported.
39
40
  */
40
- Object.defineProperty(exports, "__esModule", { value: true });
41
- exports.InterceptionEmitter = exports.EmitterSealed = exports.DEFAULT_TIMEOUT_MS = void 0;
42
41
  const index_1 = require("./index");
43
42
  const declaration_1 = require("./declaration");
44
43
  const native_1 = require("./native");
package/dist/index.d.ts CHANGED
@@ -90,6 +90,11 @@ export interface Verdict {
90
90
  evidence?: Evidence;
91
91
  result_labels?: string[];
92
92
  }
93
+ /** Optional hosted/cross-process response envelope (§5.5). */
94
+ export interface InterceptorResponse {
95
+ verdict: Verdict;
96
+ extensions?: Record<string, JsonValue>;
97
+ }
93
98
  /** Constructor sugar for the three-verdict vocabulary (§5.1). Merges
94
99
  * with the `Verdict` interface: `Verdict.warn(...)`, `Verdict.escalate(...)`. */
95
100
  export declare const Verdict: Readonly<{
@@ -295,6 +300,10 @@ export declare function canonicalJson(v: JsonValue): string;
295
300
  export declare function contextIdentity(ctx: AgentContext): string;
296
301
  /** §5: validate an interceptor's wire return value. Rust core. */
297
302
  export declare function validateVerdict(v: Verdict): void;
303
+ /** Parse a bare Verdict or §5.5 response envelope. */
304
+ export declare function parseInterceptorResponse(value: JsonValue | string): InterceptorResponse;
305
+ /** Emit a bare Verdict when the response carries no transport metadata. */
306
+ export declare function serializeInterceptorResponse(response: InterceptorResponse): JsonValue;
298
307
  /** §5.2: apply a `$target`-rooted transform. Returns a new object. Rust core. */
299
308
  export declare function applyTransform(target: JsonValue, path: string, value: JsonValue): JsonValue;
300
309
  /** §7.4 fold-through: apply one transform to the context's `target` (and
package/dist/index.js CHANGED
@@ -1,11 +1,5 @@
1
1
  "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- /**
5
- * agent-hooks: framework-neutral agent lifecycle hook contract.
6
- * Implements AGENT-HOOKS-0.1. Lifted and adapted from
7
- * `policy-engine/sdk/node/src/index.ts`.
8
- */
2
+ // Copyright (c) Microsoft. All rights reserved.
9
3
  Object.defineProperty(exports, "__esModule", { value: true });
10
4
  exports.InterceptionBlocked = exports.validReference = exports.validKind = exports.fullKnobSupport = exports.declarationVersions = exports.canonicalDeclaration = exports.SUPPORTED_DECLARATION_VERSIONS = exports.MAX_TIMEOUT_MS = exports.MAX_KIND_LEN = exports.MAX_ID_LEN = exports.MAX_DOCUMENT_BYTES = exports.MAX_DETAIL_LEN = exports.MAX_DEPTH = exports.MAX_BINDINGS = exports.HostSurface = exports.HostRegistryError = exports.HostRegistry = exports.HostDeclaration = exports.DeclarationErrorClass = exports.DeclarationError = exports.DeclarationBuilder = exports.DECLARATION_VERSION = exports.CAPABILITIES = exports.EmitterSealed = exports.InterceptionEmitter = exports.AgentContextBuilder = exports.ApprovalOutcome = exports.Composition = exports.CompositionProfile = exports.ALLOW = exports.Verdict = exports.HostError = exports.EnforcementMode = exports.Decision = exports.InterceptionPoint = exports.JCS_SHA256 = exports.SPEC_VERSION = exports.AgentHooksCoreError = void 0;
11
5
  exports.transformPermitted = transformPermitted;
@@ -19,11 +13,18 @@ exports.nonFiniteDetail = nonFiniteDetail;
19
13
  exports.canonicalJson = canonicalJson;
20
14
  exports.contextIdentity = contextIdentity;
21
15
  exports.validateVerdict = validateVerdict;
16
+ exports.parseInterceptorResponse = parseInterceptorResponse;
17
+ exports.serializeInterceptorResponse = serializeInterceptorResponse;
22
18
  exports.applyTransform = applyTransform;
23
19
  exports.applyTransformCtx = applyTransformCtx;
24
20
  exports.validateTransformCtx = validateTransformCtx;
25
21
  exports.finalize = finalize;
26
22
  exports.composeAggregate = composeAggregate;
23
+ /**
24
+ * agent-hooks: framework-neutral agent lifecycle hook contract.
25
+ * Implements AGENT-HOOKS-0.1. Lifted and adapted from
26
+ * `policy-engine/sdk/node/src/index.ts`.
27
+ */
27
28
  const native_1 = require("./native");
28
29
  Object.defineProperty(exports, "AgentHooksCoreError", { enumerable: true, get: function () { return native_1.AgentHooksCoreError; } });
29
30
  /** Spec version this SDK implements (§4.1 `spec` field). */
@@ -225,6 +226,21 @@ function contextIdentity(ctx) {
225
226
  function validateVerdict(v) {
226
227
  native_1.native.validateVerdict(marshal(v));
227
228
  }
229
+ /** Parse a bare Verdict or §5.5 response envelope. */
230
+ function parseInterceptorResponse(value) {
231
+ const wire = typeof value === "string" ? value : marshal(value);
232
+ return JSON.parse(native_1.native.normalizeInterceptorResponse(wire));
233
+ }
234
+ /** Emit a bare Verdict when the response carries no transport metadata. */
235
+ function serializeInterceptorResponse(response) {
236
+ if (response.extensions == null || Object.keys(response.extensions).length === 0) {
237
+ return response.verdict;
238
+ }
239
+ return {
240
+ verdict: response.verdict,
241
+ extensions: response.extensions,
242
+ };
243
+ }
228
244
  /** §5.2: apply a `$target`-rooted transform. Returns a new object. Rust core. */
229
245
  function applyTransform(target, path, value) {
230
246
  return JSON.parse(native_1.native.applyTransform(marshal(target), path, marshal(value)));
package/dist/native.d.ts CHANGED
@@ -1,10 +1,3 @@
1
- /**
2
- * Loader for the napi-rs native module + typed re-export.
3
- *
4
- * `@napi-rs/cli build` emits `agent-hooks.<platform>.node` alongside a
5
- * generated `index.js` loader; this module re-exports it with types and
6
- * the `AgentHooksCoreError` unwrapping so callers get `.code`.
7
- */
8
1
  /** Thrown by every native function on failure. `.code` is the §11
9
2
  * `host_error:*` wire string, or a §7.7.6 `declaration_error:*`
10
3
  * string from the declaration functions (the detail is then JSON
@@ -19,6 +12,7 @@ export declare const native: {
19
12
  canonicalJson: (valueJson: string) => string;
20
13
  contextIdentity: (ctxJson: string) => string;
21
14
  validateVerdict: (verdictJson: string) => string;
15
+ normalizeInterceptorResponse: (responseJson: string) => string;
22
16
  validateEnvelope: (ctxJson: string) => string;
23
17
  applyTransform: (targetJson: string, path: string, valueJson: string) => string;
24
18
  applyTransformCtx: (ctxJson: string, path: string, valueJson: string) => string;
package/dist/native.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
2
+ // Copyright (c) Microsoft. All rights reserved.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.native = exports.AgentHooksCoreError = void 0;
4
5
  /**
5
6
  * Loader for the napi-rs native module + typed re-export.
6
7
  *
@@ -8,8 +9,6 @@
8
9
  * generated `index.js` loader; this module re-exports it with types and
9
10
  * the `AgentHooksCoreError` unwrapping so callers get `.code`.
10
11
  */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.native = exports.AgentHooksCoreError = void 0;
13
12
  // napi-rs emits a platform-detecting loader at ../binding.js (see
14
13
  // package.json scripts.build:native --js binding.js).
15
14
  // eslint-disable-next-line @typescript-eslint/no-var-requires
@@ -48,6 +47,7 @@ exports.native = {
48
47
  canonicalJson: wrap(binding.canonicalJson),
49
48
  contextIdentity: wrap(binding.contextIdentity),
50
49
  validateVerdict: wrap(binding.validateVerdict),
50
+ normalizeInterceptorResponse: wrap(binding.normalizeInterceptorResponse),
51
51
  validateEnvelope: wrap(binding.validateEnvelope),
52
52
  applyTransform: wrap(binding.applyTransform),
53
53
  applyTransformCtx: wrap(binding.applyTransformCtx),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@responsibleai/agent-hooks",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "description": "Framework-neutral agent control contract (AGENT-HOOKS-0.1). TypeScript wrapper over the canonical Rust core. Cooperative contract, not a security boundary: the host is fully trusted (see SECURITY.md).",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
@@ -44,10 +44,10 @@
44
44
  "node": ">=20"
45
45
  },
46
46
  "optionalDependencies": {
47
- "@responsibleai/agent-hooks-linux-x64-gnu": "0.1.0-beta.2",
48
- "@responsibleai/agent-hooks-linux-arm64-gnu": "0.1.0-beta.2",
49
- "@responsibleai/agent-hooks-darwin-x64": "0.1.0-beta.2",
50
- "@responsibleai/agent-hooks-darwin-arm64": "0.1.0-beta.2",
51
- "@responsibleai/agent-hooks-win32-x64-msvc": "0.1.0-beta.2"
47
+ "@responsibleai/agent-hooks-linux-x64-gnu": "0.1.0-beta.3",
48
+ "@responsibleai/agent-hooks-linux-arm64-gnu": "0.1.0-beta.3",
49
+ "@responsibleai/agent-hooks-darwin-x64": "0.1.0-beta.3",
50
+ "@responsibleai/agent-hooks-darwin-arm64": "0.1.0-beta.3",
51
+ "@responsibleai/agent-hooks-win32-x64-msvc": "0.1.0-beta.3"
52
52
  }
53
53
  }