@continuonai/rcan-ts 1.2.1 → 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/browser.d.mts +88 -12
- package/dist/browser.mjs +68 -3
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +88 -12
- package/dist/index.d.ts +88 -12
- package/dist/index.js +74 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -3
- package/dist/index.mjs.map +1 -1
- package/dist/rcan-validate.js +1 -1
- package/dist/rcan.iife.js +2 -2
- package/package.json +1 -1
package/dist/browser.d.mts
CHANGED
|
@@ -102,7 +102,7 @@ declare enum MessageType {
|
|
|
102
102
|
/** §8.5 — Sender Type and Service Identity */
|
|
103
103
|
type SenderType = "robot" | "human" | "cloud_function" | "system";
|
|
104
104
|
/** §12 — Command Delegation and Chain of Custody */
|
|
105
|
-
interface DelegationHop {
|
|
105
|
+
interface DelegationHop$1 {
|
|
106
106
|
issuerRuri: string;
|
|
107
107
|
humanSubject: string;
|
|
108
108
|
timestamp: string;
|
|
@@ -139,7 +139,7 @@ interface RCANMessageData {
|
|
|
139
139
|
/** v1.5: GAP-09 key id */
|
|
140
140
|
keyId?: string;
|
|
141
141
|
/** v1.5: GAP-01 delegation chain */
|
|
142
|
-
delegationChain?: DelegationHop[];
|
|
142
|
+
delegationChain?: DelegationHop$1[];
|
|
143
143
|
/** v1.5: GAP-13 fleet group */
|
|
144
144
|
groupId?: string;
|
|
145
145
|
/** v1.5: GAP-11 QoS level */
|
|
@@ -161,6 +161,11 @@ interface RCANMessageData {
|
|
|
161
161
|
attestationRef?: string;
|
|
162
162
|
/** v2.2: ML-DSA-65 post-quantum signature block (field 16, FIPS 204). Hybrid mode alongside Ed25519. */
|
|
163
163
|
pqSig?: PQSignatureBlock | undefined;
|
|
164
|
+
/** v2.2 snake_case envelope aliases (spec §3.2) */
|
|
165
|
+
firmware_hash?: string;
|
|
166
|
+
attestation_ref?: string;
|
|
167
|
+
pq_sig?: string;
|
|
168
|
+
pq_alg?: string;
|
|
164
169
|
[key: string]: unknown;
|
|
165
170
|
}
|
|
166
171
|
declare class RCANMessageError extends Error {
|
|
@@ -181,7 +186,7 @@ declare class RCANMessage {
|
|
|
181
186
|
readonly senderType: SenderType | undefined;
|
|
182
187
|
readonly cloudProvider: string | undefined;
|
|
183
188
|
readonly keyId: string | undefined;
|
|
184
|
-
readonly delegationChain: DelegationHop[] | undefined;
|
|
189
|
+
readonly delegationChain: DelegationHop$1[] | undefined;
|
|
185
190
|
readonly groupId: string | undefined;
|
|
186
191
|
readonly qos: number | undefined;
|
|
187
192
|
readonly presenceVerified: boolean | undefined;
|
|
@@ -220,7 +225,7 @@ declare function makeCloudRelayMessage(base: RCANMessage, provider: string): RCA
|
|
|
220
225
|
/**
|
|
221
226
|
* §12 — Add a delegation hop to a message.
|
|
222
227
|
*/
|
|
223
|
-
declare function addDelegationHop(msg: RCANMessage, hop: DelegationHop): RCANMessage;
|
|
228
|
+
declare function addDelegationHop(msg: RCANMessage, hop: DelegationHop$1): RCANMessage;
|
|
224
229
|
/**
|
|
225
230
|
* §12 — Validate a delegation chain (structure only; signature verification
|
|
226
231
|
* requires crypto module).
|
|
@@ -229,7 +234,7 @@ declare function addDelegationHop(msg: RCANMessage, hop: DelegationHop): RCANMes
|
|
|
229
234
|
* - Max depth 4 hops
|
|
230
235
|
* - Each hop must have issuerRuri, humanSubject, timestamp, scope, signature
|
|
231
236
|
*/
|
|
232
|
-
declare function validateDelegationChain(chain: DelegationHop[]): {
|
|
237
|
+
declare function validateDelegationChain$1(chain: DelegationHop$1[]): {
|
|
233
238
|
valid: boolean;
|
|
234
239
|
reason: string;
|
|
235
240
|
};
|
|
@@ -750,14 +755,14 @@ interface TransparencyMessage {
|
|
|
750
755
|
timestamp_ms: number;
|
|
751
756
|
message_id: string;
|
|
752
757
|
/** v1.5 GAP-22: third-party control chain */
|
|
753
|
-
delegation_chain?: DelegationHop[];
|
|
758
|
+
delegation_chain?: DelegationHop$1[];
|
|
754
759
|
}
|
|
755
760
|
/**
|
|
756
761
|
* Build a TRANSPARENCY message for EU AI Act Article 13 compliance.
|
|
757
762
|
*
|
|
758
763
|
* v1.5 (GAP-22): includes delegation_chain when available.
|
|
759
764
|
*/
|
|
760
|
-
declare function makeTransparencyMessage(ruri: string, disclosure: string, delegationChain?: DelegationHop[]): TransparencyMessage;
|
|
765
|
+
declare function makeTransparencyMessage(ruri: string, disclosure: string, delegationChain?: DelegationHop$1[]): TransparencyMessage;
|
|
761
766
|
|
|
762
767
|
/**
|
|
763
768
|
* RCAN Protocol Version — single source of truth.
|
|
@@ -766,9 +771,9 @@ declare function makeTransparencyMessage(ruri: string, disclosure: string, deleg
|
|
|
766
771
|
* §3.5 — Protocol Version Compatibility
|
|
767
772
|
*/
|
|
768
773
|
/** The RCAN spec version this SDK implements. */
|
|
769
|
-
declare const SPEC_VERSION = "2.2.
|
|
774
|
+
declare const SPEC_VERSION = "2.2.1";
|
|
770
775
|
/** The SDK release version. */
|
|
771
|
-
declare const SDK_VERSION = "1.2.
|
|
776
|
+
declare const SDK_VERSION = "1.2.2";
|
|
772
777
|
/**
|
|
773
778
|
* Validate version compatibility.
|
|
774
779
|
*
|
|
@@ -1466,7 +1471,7 @@ declare enum MediaEncoding {
|
|
|
1466
1471
|
BASE64 = "base64",
|
|
1467
1472
|
REF = "ref"
|
|
1468
1473
|
}
|
|
1469
|
-
interface MediaChunk {
|
|
1474
|
+
interface MediaChunk$1 {
|
|
1470
1475
|
chunkId: string;
|
|
1471
1476
|
mimeType: string;
|
|
1472
1477
|
encoding: MediaEncoding;
|
|
@@ -1479,7 +1484,7 @@ interface StreamChunk {
|
|
|
1479
1484
|
streamId: string;
|
|
1480
1485
|
chunkIndex: number;
|
|
1481
1486
|
isFinal: boolean;
|
|
1482
|
-
chunk: MediaChunk;
|
|
1487
|
+
chunk: MediaChunk$1;
|
|
1483
1488
|
}
|
|
1484
1489
|
/**
|
|
1485
1490
|
* Attach inline (base64-encoded) media to a message.
|
|
@@ -1914,6 +1919,77 @@ declare const addPQSignature: typeof signMessage;
|
|
|
1914
1919
|
/** @deprecated Use verifyMessage() — Ed25519 is removed in RCAN v2.2 */
|
|
1915
1920
|
declare function verifyPQSignature(msg: RCANMessage, trustedKeys: MLDSAKeyPair[], _requirePQ?: boolean): Promise<void>;
|
|
1916
1921
|
|
|
1922
|
+
/**
|
|
1923
|
+
* rcan/mcp.ts — MCP integration types for RCAN v2.2 §22
|
|
1924
|
+
*
|
|
1925
|
+
* Provider-agnostic: LoA is tied to the token, not the model or AI provider.
|
|
1926
|
+
*/
|
|
1927
|
+
/** LoA → RCAN command scopes mapping (§22.4) */
|
|
1928
|
+
declare const LOA_TO_SCOPES: Record<number, string[]>;
|
|
1929
|
+
/** Required LoA for each MCP tool (§22.3) */
|
|
1930
|
+
declare const TOOL_LOA_REQUIREMENTS: Record<string, number>;
|
|
1931
|
+
/** MCP client entry stored in the RCAN yaml mcp_clients: block */
|
|
1932
|
+
interface McpClientConfig {
|
|
1933
|
+
name: string;
|
|
1934
|
+
token_hash: string;
|
|
1935
|
+
loa: number;
|
|
1936
|
+
}
|
|
1937
|
+
/** Full MCP server configuration extracted from the RCAN yaml */
|
|
1938
|
+
interface McpServerConfig {
|
|
1939
|
+
rrn: string;
|
|
1940
|
+
clients: McpClientConfig[];
|
|
1941
|
+
}
|
|
1942
|
+
/** Check if a client's LoA satisfies a tool's requirement */
|
|
1943
|
+
declare function clientAllowsTool(client: McpClientConfig, toolName: string): boolean;
|
|
1944
|
+
/** Tool call result shapes */
|
|
1945
|
+
interface RobotStatusResult {
|
|
1946
|
+
rrn: string;
|
|
1947
|
+
status: Record<string, unknown>;
|
|
1948
|
+
}
|
|
1949
|
+
interface FleetListResult {
|
|
1950
|
+
fleet: Record<string, unknown>[];
|
|
1951
|
+
}
|
|
1952
|
+
interface RrfLookupResult {
|
|
1953
|
+
entity_id: string;
|
|
1954
|
+
record: Record<string, unknown>;
|
|
1955
|
+
}
|
|
1956
|
+
interface RobotCommandResult {
|
|
1957
|
+
rrn: string;
|
|
1958
|
+
instruction: string;
|
|
1959
|
+
scope: string;
|
|
1960
|
+
result: Record<string, unknown>;
|
|
1961
|
+
}
|
|
1962
|
+
interface ComplianceReportResult {
|
|
1963
|
+
rrn: string;
|
|
1964
|
+
compliance: Record<string, unknown>;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
/**
|
|
1968
|
+
* RCAN v2.2 Delegation and Media envelope types.
|
|
1969
|
+
* Spec: https://robotregistryfoundation.org/docs/mcp/
|
|
1970
|
+
*/
|
|
1971
|
+
/** A single hop in a v2.2 delegation chain. */
|
|
1972
|
+
interface DelegationHop {
|
|
1973
|
+
robot_rrn: string;
|
|
1974
|
+
scope: string;
|
|
1975
|
+
issued_at: string;
|
|
1976
|
+
expires_at: string;
|
|
1977
|
+
sig?: string;
|
|
1978
|
+
}
|
|
1979
|
+
/** An inline or by-reference media attachment for v2.2 messages. */
|
|
1980
|
+
interface MediaChunk {
|
|
1981
|
+
chunk_id: string;
|
|
1982
|
+
mime_type: string;
|
|
1983
|
+
size_bytes: number;
|
|
1984
|
+
hash_sha256: string;
|
|
1985
|
+
data?: string;
|
|
1986
|
+
ref_url?: string;
|
|
1987
|
+
}
|
|
1988
|
+
declare function validateDelegationChain(chain: DelegationHop[]): void;
|
|
1989
|
+
declare function verifyMediaChunkHash(chunk: MediaChunk): void;
|
|
1990
|
+
type V22DelegationHop = DelegationHop;
|
|
1991
|
+
type V22MediaChunk = MediaChunk;
|
|
1992
|
+
|
|
1917
1993
|
/**
|
|
1918
1994
|
* rcan-ts — Official TypeScript SDK for RCAN v1.6
|
|
1919
1995
|
* Robot Communication and Accountability Network
|
|
@@ -1926,4 +2002,4 @@ declare const VERSION = "0.6.0";
|
|
|
1926
2002
|
/** @deprecated Use SPEC_VERSION from ./version instead */
|
|
1927
2003
|
declare const RCAN_VERSION = "1.6";
|
|
1928
2004
|
|
|
1929
|
-
export { AUTHORITY_ERROR_CODES, type ApprovalStatus, AuditChain, AuditError, type AuditExportRequest, type AuthorityAccessPayload, type AuthorityAccessPayloadWire, type AuthorityDataCategory, type AuthorityResponseData, type AuthorityResponsePayload, COMPETITION_SCOPE_LEVEL, CONTRIBUTE_SCOPE_LEVEL, type CachedKey, type ChainVerifyResult, ClockDriftError, type ClockSyncStatus, CommitmentRecord, type CommitmentRecordData, type CommitmentRecordJSON, type CompetitionBadge, type CompetitionEnter, type CompetitionFormat, type CompetitionScore, type ComputeResource, ConfidenceGate, type ConsentRequestParams, type ConsentResponseParams, type ConsentType, type ContributeCancel, type ContributeRequest, type ContributeResult, DEFAULT_LOA_POLICY, DataCategory, type DelegationHop, FIRMWARE_MANIFEST_PATH, FaultCode, type FaultReportParams, type FaultSeverity, type FederationSyncPayload, FederationSyncType, type FirmwareComponent, FirmwareIntegrityError, type FirmwareManifest, type FirmwareManifestWire, GateError, HiTLGate, type IdentityRecord, type JWKEntry, type JWKSDocument, KeyStore, LevelOfAssurance, type ListResult, type LoaPolicy, M2MAuthError, type M2MPeerClaims, type M2MTrustedClaims, M2M_TRUSTED_ISSUER, MLDSAKeyPair, type MLDSAKeyPairData, type MediaChunk, MediaEncoding, MessageType, NodeClient, type OfflineCommandResult, OfflineModeManager, type OfflineState, PRODUCTION_LOA_POLICY, type PendingApproval, type PersonalResearchResult, QoSAckTimeoutError, QoSLevel, QoSManager, type QoSResult, type QoSSendOptions, RCANAddressError, type RCANAgentConfig, type RCANConfig, RCANConfigAuthorizationError, RCANDelegationChainError, RCANError, RCANGateError, RCANMessage, type RCANMessageData, type RCANMessageEnvelope, RCANMessageError, type RCANMetadata, RCANNodeError, RCANNodeNotFoundError, RCANNodeSyncError, RCANNodeTrustError, RCANRegistryError, type RCANRegistryNode, RCANReplayAttackError, type RCANResolveResult, RCANSignatureError, RCANValidationError, RCANVersionIncompatibleError, RCAN_VERSION, ROLE_JWT_LEVEL, RRF_REVOCATION_CACHE_TTL_MS, RRF_REVOCATION_URL, type RegistrationResult, RegistryClient, type RegistryIdentity, RegistryTier, ReplayCache, type ReplayCheckResult, type ReplayableMessage, type ResearchMetrics, RevocationCache$1 as RevocationCache, type RevocationStatus, type RevocationStatusValue, type Robot, type RobotRegistration, RobotURI, RobotURIError, type RobotURIOptions, Role, type RunType, SAFETY_MESSAGE_TYPE, SCOPE_MIN_ROLE, SDK_VERSION, SPEC_VERSION, type SafetyEvent, type SafetyMessage, type ScopeValidationResult, type SeasonStanding, type SenderType, type SignatureBlock, type StandingEntry, type StreamChunk, type TrainingConsentRequestParams, type TransparencyMessage, TransportEncoding, TransportError, TrustAnchorCache, VERSION, type ValidationResult, type WorkUnitStatus, addDelegationHop, addMediaInline, addMediaRef, addPQSignature, assertClockSynced, authorityAccessFromWire, authorityAccessToWire, canonicalManifestJson, checkClockSync, checkRevocation, decodeBleFrames, decodeCompact, decodeMinimal, encodeBleFrames, encodeCompact, encodeMinimal, extractIdentityFromJwt, extractLoaFromJwt, extractRoleFromJwt, fetchCanonicalSchema, fetchRRFRevocations, isAuthorityRequestValid, isM2mTrustedRevoked, isPreemptedBy, isSafetyMessage, makeCloudRelayMessage, makeCompetitionEnter, makeCompetitionScore, makeConfigUpdate, makeConsentDeny, makeConsentGrant, makeConsentRequest, makeContributeCancel, makeContributeRequest, makeContributeResult, makeEstopMessage, makeEstopWithQoS, makeFaultReport, makeFederationSync, makeKeyRotationMessage, makePersonalResearchResult, makeResumeMessage, makeRevocationBroadcast, makeSeasonStanding, makeStopMessage, makeStreamChunk, makeTrainingConsentDeny, makeTrainingConsentGrant, makeTrainingConsentRequest, makeTrainingDataMessage, makeTransparencyMessage, manifestFromWire, manifestToWire, parseM2mPeerToken, parseM2mTrustedToken, roleFromJwtLevel, selectTransport, signMessage, validateAuthorityAccess, validateCompetitionScope, validateConfig, validateConfigAgainstSchema, validateConfigUpdate, validateConsentMessage, validateContributeScope, validateCrossRegistryCommand, validateDelegationChain, validateLoaForScope, validateManifest, validateMediaChunks, validateMessage, validateNodeAgainstSchema, validateReplay, validateRoleForScope, validateSafetyMessage, validateTrainingDataMessage, validateURI, validateVersionCompat, verifyM2mTrustedToken, verifyM2mTrustedTokenClaims, verifyMessage, verifyPQSignature };
|
|
2005
|
+
export { AUTHORITY_ERROR_CODES, type ApprovalStatus, AuditChain, AuditError, type AuditExportRequest, type AuthorityAccessPayload, type AuthorityAccessPayloadWire, type AuthorityDataCategory, type AuthorityResponseData, type AuthorityResponsePayload, COMPETITION_SCOPE_LEVEL, CONTRIBUTE_SCOPE_LEVEL, type CachedKey, type ChainVerifyResult, ClockDriftError, type ClockSyncStatus, CommitmentRecord, type CommitmentRecordData, type CommitmentRecordJSON, type CompetitionBadge, type CompetitionEnter, type CompetitionFormat, type CompetitionScore, type ComplianceReportResult, type ComputeResource, ConfidenceGate, type ConsentRequestParams, type ConsentResponseParams, type ConsentType, type ContributeCancel, type ContributeRequest, type ContributeResult, DEFAULT_LOA_POLICY, DataCategory, type DelegationHop$1 as DelegationHop, FIRMWARE_MANIFEST_PATH, FaultCode, type FaultReportParams, type FaultSeverity, type FederationSyncPayload, FederationSyncType, type FirmwareComponent, FirmwareIntegrityError, type FirmwareManifest, type FirmwareManifestWire, type FleetListResult, GateError, HiTLGate, type IdentityRecord, type JWKEntry, type JWKSDocument, KeyStore, LOA_TO_SCOPES, LevelOfAssurance, type ListResult, type LoaPolicy, M2MAuthError, type M2MPeerClaims, type M2MTrustedClaims, M2M_TRUSTED_ISSUER, MLDSAKeyPair, type MLDSAKeyPairData, type McpClientConfig, type McpServerConfig, type MediaChunk$1 as MediaChunk, MediaEncoding, MessageType, NodeClient, type OfflineCommandResult, OfflineModeManager, type OfflineState, PRODUCTION_LOA_POLICY, type PendingApproval, type PersonalResearchResult, QoSAckTimeoutError, QoSLevel, QoSManager, type QoSResult, type QoSSendOptions, RCANAddressError, type RCANAgentConfig, type RCANConfig, RCANConfigAuthorizationError, RCANDelegationChainError, RCANError, RCANGateError, RCANMessage, type RCANMessageData, type RCANMessageEnvelope, RCANMessageError, type RCANMetadata, RCANNodeError, RCANNodeNotFoundError, RCANNodeSyncError, RCANNodeTrustError, RCANRegistryError, type RCANRegistryNode, RCANReplayAttackError, type RCANResolveResult, RCANSignatureError, RCANValidationError, RCANVersionIncompatibleError, RCAN_VERSION, ROLE_JWT_LEVEL, RRF_REVOCATION_CACHE_TTL_MS, RRF_REVOCATION_URL, type RegistrationResult, RegistryClient, type RegistryIdentity, RegistryTier, ReplayCache, type ReplayCheckResult, type ReplayableMessage, type ResearchMetrics, RevocationCache$1 as RevocationCache, type RevocationStatus, type RevocationStatusValue, type Robot, type RobotCommandResult, type RobotRegistration, type RobotStatusResult, RobotURI, RobotURIError, type RobotURIOptions, Role, type RrfLookupResult, type RunType, SAFETY_MESSAGE_TYPE, SCOPE_MIN_ROLE, SDK_VERSION, SPEC_VERSION, type SafetyEvent, type SafetyMessage, type ScopeValidationResult, type SeasonStanding, type SenderType, type SignatureBlock, type StandingEntry, type StreamChunk, TOOL_LOA_REQUIREMENTS, type TrainingConsentRequestParams, type TransparencyMessage, TransportEncoding, TransportError, TrustAnchorCache, type V22DelegationHop, type V22MediaChunk, VERSION, type ValidationResult, type WorkUnitStatus, addDelegationHop, addMediaInline, addMediaRef, addPQSignature, assertClockSynced, authorityAccessFromWire, authorityAccessToWire, canonicalManifestJson, checkClockSync, checkRevocation, clientAllowsTool, decodeBleFrames, decodeCompact, decodeMinimal, encodeBleFrames, encodeCompact, encodeMinimal, extractIdentityFromJwt, extractLoaFromJwt, extractRoleFromJwt, fetchCanonicalSchema, fetchRRFRevocations, isAuthorityRequestValid, isM2mTrustedRevoked, isPreemptedBy, isSafetyMessage, makeCloudRelayMessage, makeCompetitionEnter, makeCompetitionScore, makeConfigUpdate, makeConsentDeny, makeConsentGrant, makeConsentRequest, makeContributeCancel, makeContributeRequest, makeContributeResult, makeEstopMessage, makeEstopWithQoS, makeFaultReport, makeFederationSync, makeKeyRotationMessage, makePersonalResearchResult, makeResumeMessage, makeRevocationBroadcast, makeSeasonStanding, makeStopMessage, makeStreamChunk, makeTrainingConsentDeny, makeTrainingConsentGrant, makeTrainingConsentRequest, makeTrainingDataMessage, makeTransparencyMessage, manifestFromWire, manifestToWire, parseM2mPeerToken, parseM2mTrustedToken, roleFromJwtLevel, selectTransport, signMessage, validateAuthorityAccess, validateCompetitionScope, validateConfig, validateConfigAgainstSchema, validateConfigUpdate, validateConsentMessage, validateContributeScope, validateCrossRegistryCommand, validateDelegationChain$1 as validateDelegationChain, validateLoaForScope, validateManifest, validateMediaChunks, validateMessage, validateNodeAgainstSchema, validateReplay, validateRoleForScope, validateSafetyMessage, validateTrainingDataMessage, validateURI, validateDelegationChain as validateV22DelegationChain, validateVersionCompat, verifyM2mTrustedToken, verifyM2mTrustedTokenClaims, verifyMessage, verifyPQSignature, verifyMediaChunkHash as verifyV22MediaChunkHash };
|
package/dist/browser.mjs
CHANGED
|
@@ -99,8 +99,8 @@ var RobotURI = class _RobotURI {
|
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
// src/version.ts
|
|
102
|
-
var SPEC_VERSION = "2.2.
|
|
103
|
-
var SDK_VERSION = "1.2.
|
|
102
|
+
var SPEC_VERSION = "2.2.1";
|
|
103
|
+
var SDK_VERSION = "1.2.2";
|
|
104
104
|
function validateVersionCompat(incomingVersion, localVersion = SPEC_VERSION) {
|
|
105
105
|
const parseParts = (v) => {
|
|
106
106
|
const parts = v.split(".");
|
|
@@ -3229,6 +3229,66 @@ async function verifyPQSignature(msg, trustedKeys, _requirePQ = true) {
|
|
|
3229
3229
|
return verifyMessage(msg, trustedKeys);
|
|
3230
3230
|
}
|
|
3231
3231
|
|
|
3232
|
+
// src/mcp.ts
|
|
3233
|
+
var LOA_TO_SCOPES = {
|
|
3234
|
+
0: ["discover", "status", "transparency"],
|
|
3235
|
+
1: ["chat", "control", "system"],
|
|
3236
|
+
3: ["system", "safety"]
|
|
3237
|
+
};
|
|
3238
|
+
var TOOL_LOA_REQUIREMENTS = {
|
|
3239
|
+
// Tier 0 — read
|
|
3240
|
+
robot_ping: 0,
|
|
3241
|
+
robot_status: 0,
|
|
3242
|
+
robot_telemetry: 0,
|
|
3243
|
+
fleet_list: 0,
|
|
3244
|
+
rrf_lookup: 0,
|
|
3245
|
+
compliance_report: 0,
|
|
3246
|
+
// Tier 1 — operate
|
|
3247
|
+
robot_command: 1,
|
|
3248
|
+
harness_get: 1,
|
|
3249
|
+
research_run: 1,
|
|
3250
|
+
contribute_toggle: 1,
|
|
3251
|
+
components_list: 1,
|
|
3252
|
+
// Tier 3 — admin
|
|
3253
|
+
harness_set: 3,
|
|
3254
|
+
system_upgrade: 3,
|
|
3255
|
+
loa_enable: 3
|
|
3256
|
+
};
|
|
3257
|
+
function clientAllowsTool(client, toolName) {
|
|
3258
|
+
const required = TOOL_LOA_REQUIREMENTS[toolName] ?? 99;
|
|
3259
|
+
return client.loa >= required;
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3262
|
+
// src/delegation.ts
|
|
3263
|
+
var MAX_DELEGATION_DEPTH = 3;
|
|
3264
|
+
function validateDelegationChain2(chain) {
|
|
3265
|
+
if (chain.length > MAX_DELEGATION_DEPTH) {
|
|
3266
|
+
throw new Error(
|
|
3267
|
+
`RCAN: delegation chain max depth is ${MAX_DELEGATION_DEPTH}, got ${chain.length}`
|
|
3268
|
+
);
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
var _hashImpl;
|
|
3272
|
+
function verifyMediaChunkHash(chunk) {
|
|
3273
|
+
if (!chunk.data) return;
|
|
3274
|
+
let actual;
|
|
3275
|
+
if (_hashImpl) {
|
|
3276
|
+
actual = _hashImpl(chunk.data);
|
|
3277
|
+
} else {
|
|
3278
|
+
try {
|
|
3279
|
+
const m = typeof __require !== "undefined" ? __require : null;
|
|
3280
|
+
if (!m) return;
|
|
3281
|
+
const { createHash } = m("node:crypto");
|
|
3282
|
+
actual = "sha256:" + createHash("sha256").update(chunk.data).digest("hex");
|
|
3283
|
+
} catch {
|
|
3284
|
+
return;
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
if (actual !== chunk.hash_sha256) {
|
|
3288
|
+
throw new Error(`MediaChunk hash mismatch: expected ${chunk.hash_sha256}, got ${actual}`);
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
|
|
3232
3292
|
// src/index.ts
|
|
3233
3293
|
var VERSION = "0.6.0";
|
|
3234
3294
|
var RCAN_VERSION = "1.6";
|
|
@@ -3250,6 +3310,7 @@ export {
|
|
|
3250
3310
|
GateError,
|
|
3251
3311
|
HiTLGate,
|
|
3252
3312
|
KeyStore,
|
|
3313
|
+
LOA_TO_SCOPES,
|
|
3253
3314
|
LevelOfAssurance,
|
|
3254
3315
|
M2MAuthError,
|
|
3255
3316
|
M2M_TRUSTED_ISSUER,
|
|
@@ -3293,6 +3354,7 @@ export {
|
|
|
3293
3354
|
SCOPE_MIN_ROLE,
|
|
3294
3355
|
SDK_VERSION,
|
|
3295
3356
|
SPEC_VERSION,
|
|
3357
|
+
TOOL_LOA_REQUIREMENTS,
|
|
3296
3358
|
TransportEncoding,
|
|
3297
3359
|
TransportError,
|
|
3298
3360
|
TrustAnchorCache,
|
|
@@ -3307,6 +3369,7 @@ export {
|
|
|
3307
3369
|
canonicalManifestJson,
|
|
3308
3370
|
checkClockSync,
|
|
3309
3371
|
checkRevocation,
|
|
3372
|
+
clientAllowsTool,
|
|
3310
3373
|
decodeBleFrames,
|
|
3311
3374
|
decodeCompact,
|
|
3312
3375
|
decodeMinimal,
|
|
@@ -3374,10 +3437,12 @@ export {
|
|
|
3374
3437
|
validateSafetyMessage,
|
|
3375
3438
|
validateTrainingDataMessage,
|
|
3376
3439
|
validateURI,
|
|
3440
|
+
validateDelegationChain2 as validateV22DelegationChain,
|
|
3377
3441
|
validateVersionCompat,
|
|
3378
3442
|
verifyM2mTrustedToken,
|
|
3379
3443
|
verifyM2mTrustedTokenClaims,
|
|
3380
3444
|
verifyMessage,
|
|
3381
|
-
verifyPQSignature
|
|
3445
|
+
verifyPQSignature,
|
|
3446
|
+
verifyMediaChunkHash as verifyV22MediaChunkHash
|
|
3382
3447
|
};
|
|
3383
3448
|
//# sourceMappingURL=browser.mjs.map
|