@continuonai/rcan-ts 1.2.2 → 1.2.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/dist/index.mjs CHANGED
@@ -3218,6 +3218,66 @@ async function verifyPQSignature(msg, trustedKeys, _requirePQ = true) {
3218
3218
  return verifyMessage(msg, trustedKeys);
3219
3219
  }
3220
3220
 
3221
+ // src/mcp.ts
3222
+ var LOA_TO_SCOPES = {
3223
+ 0: ["discover", "status", "transparency"],
3224
+ 1: ["chat", "control", "system"],
3225
+ 3: ["system", "safety"]
3226
+ };
3227
+ var TOOL_LOA_REQUIREMENTS = {
3228
+ // Tier 0 — read
3229
+ robot_ping: 0,
3230
+ robot_status: 0,
3231
+ robot_telemetry: 0,
3232
+ fleet_list: 0,
3233
+ rrf_lookup: 0,
3234
+ compliance_report: 0,
3235
+ // Tier 1 — operate
3236
+ robot_command: 1,
3237
+ harness_get: 1,
3238
+ research_run: 1,
3239
+ contribute_toggle: 1,
3240
+ components_list: 1,
3241
+ // Tier 3 — admin
3242
+ harness_set: 3,
3243
+ system_upgrade: 3,
3244
+ loa_enable: 3
3245
+ };
3246
+ function clientAllowsTool(client, toolName) {
3247
+ const required = TOOL_LOA_REQUIREMENTS[toolName] ?? 99;
3248
+ return client.loa >= required;
3249
+ }
3250
+
3251
+ // src/delegation.ts
3252
+ var MAX_DELEGATION_DEPTH = 3;
3253
+ function validateDelegationChain2(chain) {
3254
+ if (chain.length > MAX_DELEGATION_DEPTH) {
3255
+ throw new Error(
3256
+ `RCAN: delegation chain max depth is ${MAX_DELEGATION_DEPTH}, got ${chain.length}`
3257
+ );
3258
+ }
3259
+ }
3260
+ var _hashImpl;
3261
+ function verifyMediaChunkHash(chunk) {
3262
+ if (!chunk.data) return;
3263
+ let actual;
3264
+ if (_hashImpl) {
3265
+ actual = _hashImpl(chunk.data);
3266
+ } else {
3267
+ try {
3268
+ const m = typeof __require !== "undefined" ? __require : null;
3269
+ if (!m) return;
3270
+ const { createHash } = m("node:crypto");
3271
+ actual = "sha256:" + createHash("sha256").update(chunk.data).digest("hex");
3272
+ } catch {
3273
+ return;
3274
+ }
3275
+ }
3276
+ if (actual !== chunk.hash_sha256) {
3277
+ throw new Error(`MediaChunk hash mismatch: expected ${chunk.hash_sha256}, got ${actual}`);
3278
+ }
3279
+ }
3280
+
3221
3281
  // src/index.ts
3222
3282
  var VERSION = "0.6.0";
3223
3283
  var RCAN_VERSION = "1.6";
@@ -3239,6 +3299,7 @@ export {
3239
3299
  GateError,
3240
3300
  HiTLGate,
3241
3301
  KeyStore,
3302
+ LOA_TO_SCOPES,
3242
3303
  LevelOfAssurance,
3243
3304
  M2MAuthError,
3244
3305
  M2M_TRUSTED_ISSUER,
@@ -3282,6 +3343,7 @@ export {
3282
3343
  SCOPE_MIN_ROLE,
3283
3344
  SDK_VERSION,
3284
3345
  SPEC_VERSION,
3346
+ TOOL_LOA_REQUIREMENTS,
3285
3347
  TransportEncoding,
3286
3348
  TransportError,
3287
3349
  TrustAnchorCache,
@@ -3296,6 +3358,7 @@ export {
3296
3358
  canonicalManifestJson,
3297
3359
  checkClockSync,
3298
3360
  checkRevocation,
3361
+ clientAllowsTool,
3299
3362
  decodeBleFrames,
3300
3363
  decodeCompact,
3301
3364
  decodeMinimal,
@@ -3363,10 +3426,12 @@ export {
3363
3426
  validateSafetyMessage,
3364
3427
  validateTrainingDataMessage,
3365
3428
  validateURI,
3429
+ validateDelegationChain2 as validateV22DelegationChain,
3366
3430
  validateVersionCompat,
3367
3431
  verifyM2mTrustedToken,
3368
3432
  verifyM2mTrustedTokenClaims,
3369
3433
  verifyMessage,
3370
- verifyPQSignature
3434
+ verifyPQSignature,
3435
+ verifyMediaChunkHash as verifyV22MediaChunkHash
3371
3436
  };
3372
3437
  //# sourceMappingURL=index.mjs.map