@xemahq/agent-session-runtime 0.11.0 → 0.11.2

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.
Files changed (33) hide show
  1. package/package.json +4 -5
  2. package/dist/lib/launch-identity/compiled-session-launch-plan-store.d.ts +0 -44
  3. package/dist/lib/launch-identity/compiled-session-launch-plan-store.d.ts.map +0 -1
  4. package/dist/lib/launch-identity/compiled-session-launch-plan-store.js +0 -116
  5. package/dist/lib/launch-identity/compiled-session-launch-plan-store.js.map +0 -1
  6. package/dist/lib/launch-identity/compiled-session-launch-plan.d.ts +0 -84
  7. package/dist/lib/launch-identity/compiled-session-launch-plan.d.ts.map +0 -1
  8. package/dist/lib/launch-identity/compiled-session-launch-plan.js +0 -382
  9. package/dist/lib/launch-identity/compiled-session-launch-plan.js.map +0 -1
  10. package/dist/lib/launch-identity/preparation-generation.d.ts +0 -26
  11. package/dist/lib/launch-identity/preparation-generation.d.ts.map +0 -1
  12. package/dist/lib/launch-identity/preparation-generation.js +0 -88
  13. package/dist/lib/launch-identity/preparation-generation.js.map +0 -1
  14. package/dist/lib/launch-identity/prepared-launch-variant.d.ts +0 -46
  15. package/dist/lib/launch-identity/prepared-launch-variant.d.ts.map +0 -1
  16. package/dist/lib/launch-identity/prepared-launch-variant.js +0 -118
  17. package/dist/lib/launch-identity/prepared-launch-variant.js.map +0 -1
  18. package/src/index.ts +0 -36
  19. package/src/lib/agent-resolution.ts +0 -557
  20. package/src/lib/agent-workspace-manifest.ts +0 -632
  21. package/src/lib/composer.ts +0 -1315
  22. package/src/lib/dispatch-contract.ts +0 -151
  23. package/src/lib/drift-detector.ts +0 -497
  24. package/src/lib/environment-resolver.ts +0 -480
  25. package/src/lib/errors.ts +0 -43
  26. package/src/lib/launch-identity/canonical-contract.ts +0 -352
  27. package/src/lib/launch-identity/index.ts +0 -4
  28. package/src/lib/launch-identity/runtime-template-key.ts +0 -143
  29. package/src/lib/launch-identity/session-binding.ts +0 -152
  30. package/src/lib/launch-identity/thread-reuse-key.ts +0 -93
  31. package/src/lib/lifecycle-state.ts +0 -30
  32. package/src/lib/skill-bundle-template-resolver.ts +0 -147
  33. package/src/lib/types.ts +0 -453
@@ -1,352 +0,0 @@
1
- import { canonicalJson, stableHash } from '@xemahq/declarative-reconciler';
2
- import { Sha256HexSchema } from '@xemahq/kernel-contracts/content-address';
3
-
4
- export type CanonicalJsonValue =
5
- | boolean
6
- | number
7
- | string
8
- | null
9
- | readonly CanonicalJsonValue[]
10
- | { readonly [key: string]: CanonicalJsonValue };
11
-
12
- export interface ResourceBindingRef {
13
- readonly kind: string;
14
- readonly ref: string;
15
- }
16
-
17
- /**
18
- * OCI immutable-digest prefix. The digest BODY is validated by the canonical
19
- * {@link Sha256HexSchema} rather than a local `[a-f0-9]{64}` copy, so this
20
- * package holds no SHA-256 grammar of its own.
21
- */
22
- const IMAGE_DIGEST_PREFIX = 'sha256:';
23
-
24
- const SECRET_FIELD_PATTERN =
25
- /(?:^|[_-])(api[_-]?key|authorization|cookie|credential|password|private[_-]?key|secret|token)(?:$|[_-])/iu;
26
- const SECRET_CAMEL_CASE_PATTERN =
27
- /(?:apiKey|authorization|cookie|credential|password|privateKey|secret|token)/u;
28
- const SECRET_REFERENCE_SUFFIX_PATTERN = /Refs?$/u;
29
-
30
- export function canonicalContractJson(value: unknown): string {
31
- return canonicalJson(value);
32
- }
33
-
34
- export function hashCanonicalContract(value: unknown): string {
35
- return stableHash(value);
36
- }
37
-
38
- export function requireExactObject(
39
- value: unknown,
40
- path: string,
41
- requiredKeys: readonly string[],
42
- optionalKeys: readonly string[] = [],
43
- ): Readonly<Record<string, unknown>> {
44
- if (!isPlainObject(value)) {
45
- throw new TypeError(`${path} must be a plain object.`);
46
- }
47
-
48
- const allowedKeys = new Set([...requiredKeys, ...optionalKeys]);
49
- for (const key of Object.keys(value)) {
50
- if (!allowedKeys.has(key)) {
51
- throw new TypeError(`${path}.${key} is not a supported field.`);
52
- }
53
- }
54
-
55
- for (const key of requiredKeys) {
56
- if (!Object.hasOwn(value, key)) {
57
- throw new TypeError(`${path}.${key} is required.`);
58
- }
59
- }
60
-
61
- return value;
62
- }
63
-
64
- export function requireNonEmptyString(value: unknown, path: string): string {
65
- if (typeof value !== 'string' || value.trim().length === 0) {
66
- throw new TypeError(`${path} must be a non-empty string.`);
67
- }
68
- return value;
69
- }
70
-
71
- export function requireBoolean(value: unknown, path: string): boolean {
72
- if (typeof value !== 'boolean') {
73
- throw new TypeError(`${path} must be a boolean.`);
74
- }
75
- return value;
76
- }
77
-
78
- export function requireSha256(value: unknown, path: string): string {
79
- const hash = requireNonEmptyString(value, path);
80
- if (!Sha256HexSchema.safeParse(hash).success) {
81
- throw new TypeError(`${path} must be a lowercase SHA-256 hex digest.`);
82
- }
83
- return hash;
84
- }
85
-
86
- /**
87
- * Validates an OCI IMMUTABLE image reference — `sha256:<64 lowercase hex>`.
88
- *
89
- * The single site for this rule. It was previously spelled as an identical
90
- * `IMAGE_DIGEST_PATTERN` regex in both `runtime-template-key.ts` and
91
- * `compiled-session-launch-plan.ts`; two copies of a security-relevant
92
- * "is this reference immutable" check can drift, and each was also a private
93
- * restatement of the SHA-256 grammar that `@xemahq/kernel-contracts
94
- * /content-address` now owns canonically.
95
- */
96
- export function requireImageDigest(value: unknown, path: string): string {
97
- const digest = requireNonEmptyString(value, path);
98
- if (!digest.startsWith(IMAGE_DIGEST_PREFIX)) {
99
- throw new TypeError(
100
- `${path} must be an immutable sha256 image digest.`,
101
- );
102
- }
103
- if (
104
- !Sha256HexSchema.safeParse(digest.slice(IMAGE_DIGEST_PREFIX.length)).success
105
- ) {
106
- throw new TypeError(
107
- `${path} must be an immutable sha256 image digest.`,
108
- );
109
- }
110
- return digest;
111
- }
112
-
113
- export function requireNonNegativeSafeInteger(
114
- value: unknown,
115
- path: string,
116
- ): number {
117
- if (!Number.isSafeInteger(value) || (value as number) < 0) {
118
- throw new TypeError(`${path} must be a non-negative safe integer.`);
119
- }
120
- return value as number;
121
- }
122
-
123
- export function requireEnumValue<T extends string>(
124
- value: unknown,
125
- path: string,
126
- values: readonly T[],
127
- ): T {
128
- if (typeof value !== 'string' || !values.includes(value as T)) {
129
- throw new TypeError(
130
- `${path} must be one of: ${values.map((entry) => `'${entry}'`).join(', ')}.`,
131
- );
132
- }
133
- return value as T;
134
- }
135
-
136
- export function requireStringRefs(
137
- value: unknown,
138
- path: string,
139
- ): readonly string[] {
140
- if (!Array.isArray(value)) {
141
- throw new TypeError(`${path} must be an array.`);
142
- }
143
-
144
- return Object.freeze(
145
- [
146
- ...new Set(
147
- value.map((entry, index) =>
148
- requireNonEmptyString(entry, `${path}[${index}]`),
149
- ),
150
- ),
151
- ].sort(),
152
- );
153
- }
154
-
155
- export function requireResourceBindingRefs(
156
- value: unknown,
157
- path: string,
158
- ): readonly ResourceBindingRef[] {
159
- if (!Array.isArray(value)) {
160
- throw new TypeError(`${path} must be an array.`);
161
- }
162
-
163
- const refs = value.map((entry, index) => {
164
- const entryPath = `${path}[${index}]`;
165
- const object = requireExactObject(entry, entryPath, ['kind', 'ref']);
166
- return Object.freeze({
167
- kind: requireNonEmptyString(object.kind, `${entryPath}.kind`),
168
- ref: requireNonEmptyString(object.ref, `${entryPath}.ref`),
169
- });
170
- });
171
-
172
- const byCanonicalRef = new Map(
173
- refs.map((entry) => [canonicalJson(entry), entry] as const),
174
- );
175
- return Object.freeze(
176
- [...byCanonicalRef.entries()]
177
- .sort(([left], [right]) => left.localeCompare(right))
178
- .map(([, entry]) => entry),
179
- );
180
- }
181
-
182
- export function requireSecretFreeJsonObject(
183
- value: unknown,
184
- path: string,
185
- ): Readonly<Record<string, CanonicalJsonValue>> {
186
- const normalized = normalizeCanonicalJson(value, path, true);
187
- if (
188
- normalized === null ||
189
- Array.isArray(normalized) ||
190
- typeof normalized !== 'object'
191
- ) {
192
- throw new TypeError(`${path} must be a plain JSON object.`);
193
- }
194
- return normalized as Readonly<Record<string, CanonicalJsonValue>>;
195
- }
196
-
197
- export function requireCanonicalJsonObject(
198
- value: unknown,
199
- path: string,
200
- ): Readonly<Record<string, CanonicalJsonValue>> {
201
- const normalized = normalizeCanonicalJson(value, path, false);
202
- if (
203
- normalized === null ||
204
- Array.isArray(normalized) ||
205
- typeof normalized !== 'object'
206
- ) {
207
- throw new TypeError(`${path} must be a plain JSON object.`);
208
- }
209
- return normalized as Readonly<Record<string, CanonicalJsonValue>>;
210
- }
211
-
212
- export function assertNoTenantOrSecretTemplateFields(
213
- value: unknown,
214
- path: string,
215
- ): void {
216
- const visited = new Set<object>();
217
-
218
- function inspect(current: unknown, currentPath: string): void {
219
- if (current === null || typeof current !== 'object') {
220
- return;
221
- }
222
- if (visited.has(current)) {
223
- throw new TypeError(`${currentPath} must not contain cycles.`);
224
- }
225
- visited.add(current);
226
-
227
- if (Array.isArray(current)) {
228
- current.forEach((entry, index) =>
229
- inspect(entry, `${currentPath}[${index}]`),
230
- );
231
- return;
232
- }
233
- if (!isPlainObject(current)) {
234
- throw new TypeError(`${currentPath} must contain only plain objects.`);
235
- }
236
-
237
- for (const [key, entry] of Object.entries(current)) {
238
- if (isTenantField(key) || isSecretField(key)) {
239
- throw new TypeError(
240
- `${currentPath}.${key} is tenant/session/secret state and cannot enter a RuntimeTemplateKey.`,
241
- );
242
- }
243
- inspect(entry, `${currentPath}.${key}`);
244
- }
245
- }
246
-
247
- inspect(value, path);
248
- }
249
-
250
- function normalizeCanonicalJson(
251
- value: unknown,
252
- path: string,
253
- rejectSecretFields: boolean,
254
- visited = new Set<object>(),
255
- ): CanonicalJsonValue {
256
- if (
257
- value === null ||
258
- typeof value === 'string' ||
259
- typeof value === 'boolean'
260
- ) {
261
- return value;
262
- }
263
- if (typeof value === 'number') {
264
- if (!Number.isFinite(value)) {
265
- throw new TypeError(`${path} must contain only finite numbers.`);
266
- }
267
- return value;
268
- }
269
- if (typeof value !== 'object') {
270
- throw new TypeError(`${path} must contain only JSON values.`);
271
- }
272
- if (visited.has(value)) {
273
- throw new TypeError(`${path} must not contain cycles.`);
274
- }
275
- visited.add(value);
276
-
277
- if (Array.isArray(value)) {
278
- const normalized = value.map((entry, index) =>
279
- normalizeCanonicalJson(
280
- entry,
281
- `${path}[${index}]`,
282
- rejectSecretFields,
283
- visited,
284
- ),
285
- );
286
- visited.delete(value);
287
- return Object.freeze(normalized);
288
- }
289
- if (!isPlainObject(value)) {
290
- throw new TypeError(`${path} must contain only plain JSON objects.`);
291
- }
292
-
293
- const normalized: Record<string, CanonicalJsonValue> = {};
294
- for (const [key, entry] of Object.entries(value)) {
295
- if (
296
- rejectSecretFields &&
297
- isSecretField(key) &&
298
- !SECRET_REFERENCE_SUFFIX_PATTERN.test(key)
299
- ) {
300
- throw new TypeError(
301
- `${path}.${key} appears to contain secret material; pass an opaque reference ending in Ref or Refs instead.`,
302
- );
303
- }
304
- normalized[key] = normalizeCanonicalJson(
305
- entry,
306
- `${path}.${key}`,
307
- rejectSecretFields,
308
- visited,
309
- );
310
- }
311
- visited.delete(value);
312
- return Object.freeze(normalized);
313
- }
314
-
315
- function isTenantField(key: string): boolean {
316
- const normalized = key.replaceAll(/[_-]/gu, '').toLowerCase();
317
- return [
318
- 'binding',
319
- 'context',
320
- 'domain',
321
- 'domainid',
322
- 'input',
323
- 'organization',
324
- 'organizationid',
325
- 'org',
326
- 'orgid',
327
- 'project',
328
- 'projectid',
329
- 'session',
330
- 'sessionid',
331
- 'tenant',
332
- 'tenantid',
333
- 'thread',
334
- 'threadid',
335
- 'user',
336
- 'userid',
337
- ].includes(normalized);
338
- }
339
-
340
- function isSecretField(key: string): boolean {
341
- return SECRET_FIELD_PATTERN.test(key) || SECRET_CAMEL_CASE_PATTERN.test(key);
342
- }
343
-
344
- function isPlainObject(
345
- value: unknown,
346
- ): value is Readonly<Record<string, unknown>> {
347
- if (value === null || typeof value !== 'object' || Array.isArray(value)) {
348
- return false;
349
- }
350
- const prototype = Object.getPrototypeOf(value);
351
- return prototype === Object.prototype || prototype === null;
352
- }
@@ -1,4 +0,0 @@
1
- export * from './canonical-contract';
2
- export * from './runtime-template-key';
3
- export * from './session-binding';
4
- export * from './thread-reuse-key';
@@ -1,143 +0,0 @@
1
- import {
2
- assertNoTenantOrSecretTemplateFields,
3
- canonicalContractJson,
4
- hashCanonicalContract,
5
- requireEnumValue,
6
- requireExactObject,
7
- requireImageDigest,
8
- requireNonEmptyString,
9
- requireSha256,
10
- } from './canonical-contract';
11
-
12
- export enum RuntimeTemplateTenantDependency {
13
- OrganizationNeutral = 'organization-neutral',
14
- OrganizationBound = 'organization-bound',
15
- }
16
-
17
- export enum RuntimeTemplateTrustPolicy {
18
- Shared = 'shared',
19
- Dedicated = 'dedicated',
20
- Confidential = 'confidential',
21
- }
22
-
23
- export interface RuntimeTemplateKey {
24
- readonly schemaVersion: 1;
25
- readonly tenantDependency: RuntimeTemplateTenantDependency;
26
- readonly trustPolicy: RuntimeTemplateTrustPolicy;
27
- readonly runtimeRef: string;
28
- readonly runtimeRevision: string;
29
- readonly imageDigest: string;
30
- readonly agentRevision: string;
31
- readonly primaryAgentHash: string;
32
- readonly subagentsHash: string;
33
- readonly skillsHash: string;
34
- readonly toolsHash: string;
35
- readonly capabilityDescriptorsHash: string;
36
- readonly mcpDescriptorsHash: string;
37
- readonly workspacePlanHash: string;
38
- readonly layoutProfile: string;
39
- }
40
-
41
- const REQUIRED_KEYS = [
42
- 'schemaVersion',
43
- 'tenantDependency',
44
- 'trustPolicy',
45
- 'runtimeRef',
46
- 'runtimeRevision',
47
- 'imageDigest',
48
- 'agentRevision',
49
- 'primaryAgentHash',
50
- 'subagentsHash',
51
- 'skillsHash',
52
- 'toolsHash',
53
- 'capabilityDescriptorsHash',
54
- 'mcpDescriptorsHash',
55
- 'workspacePlanHash',
56
- 'layoutProfile',
57
- ] as const;
58
-
59
- const TENANT_DEPENDENCIES = Object.values(RuntimeTemplateTenantDependency);
60
- const TRUST_POLICIES = Object.values(RuntimeTemplateTrustPolicy);
61
-
62
- /**
63
- * Validates and canonicalizes the immutable execution dimensions used to
64
- * select warm compute. Tenant, invocation and credential data have no valid
65
- * slot in this contract and are rejected even when supplied as extra fields.
66
- */
67
- export function createRuntimeTemplateKey(input: unknown): RuntimeTemplateKey {
68
- assertNoTenantOrSecretTemplateFields(input, 'RuntimeTemplateKey');
69
- const object = requireExactObject(input, 'RuntimeTemplateKey', REQUIRED_KEYS);
70
-
71
- if (object.schemaVersion !== 1) {
72
- throw new TypeError('RuntimeTemplateKey.schemaVersion must be 1.');
73
- }
74
-
75
- const imageDigest = requireImageDigest(
76
- object.imageDigest,
77
- 'RuntimeTemplateKey.imageDigest',
78
- );
79
-
80
- return Object.freeze({
81
- schemaVersion: 1,
82
- tenantDependency: requireEnumValue(
83
- object.tenantDependency,
84
- 'RuntimeTemplateKey.tenantDependency',
85
- TENANT_DEPENDENCIES,
86
- ),
87
- trustPolicy: requireEnumValue(
88
- object.trustPolicy,
89
- 'RuntimeTemplateKey.trustPolicy',
90
- TRUST_POLICIES,
91
- ),
92
- runtimeRef: requireNonEmptyString(
93
- object.runtimeRef,
94
- 'RuntimeTemplateKey.runtimeRef',
95
- ),
96
- runtimeRevision: requireNonEmptyString(
97
- object.runtimeRevision,
98
- 'RuntimeTemplateKey.runtimeRevision',
99
- ),
100
- imageDigest,
101
- agentRevision: requireNonEmptyString(
102
- object.agentRevision,
103
- 'RuntimeTemplateKey.agentRevision',
104
- ),
105
- primaryAgentHash: requireSha256(
106
- object.primaryAgentHash,
107
- 'RuntimeTemplateKey.primaryAgentHash',
108
- ),
109
- subagentsHash: requireSha256(
110
- object.subagentsHash,
111
- 'RuntimeTemplateKey.subagentsHash',
112
- ),
113
- skillsHash: requireSha256(
114
- object.skillsHash,
115
- 'RuntimeTemplateKey.skillsHash',
116
- ),
117
- toolsHash: requireSha256(object.toolsHash, 'RuntimeTemplateKey.toolsHash'),
118
- capabilityDescriptorsHash: requireSha256(
119
- object.capabilityDescriptorsHash,
120
- 'RuntimeTemplateKey.capabilityDescriptorsHash',
121
- ),
122
- mcpDescriptorsHash: requireSha256(
123
- object.mcpDescriptorsHash,
124
- 'RuntimeTemplateKey.mcpDescriptorsHash',
125
- ),
126
- workspacePlanHash: requireSha256(
127
- object.workspacePlanHash,
128
- 'RuntimeTemplateKey.workspacePlanHash',
129
- ),
130
- layoutProfile: requireNonEmptyString(
131
- object.layoutProfile,
132
- 'RuntimeTemplateKey.layoutProfile',
133
- ),
134
- });
135
- }
136
-
137
- export function serializeRuntimeTemplateKey(input: RuntimeTemplateKey): string {
138
- return canonicalContractJson(createRuntimeTemplateKey(input));
139
- }
140
-
141
- export function hashRuntimeTemplateKey(input: RuntimeTemplateKey): string {
142
- return hashCanonicalContract(createRuntimeTemplateKey(input));
143
- }
@@ -1,152 +0,0 @@
1
- import {
2
- canonicalContractJson,
3
- type CanonicalJsonValue,
4
- hashCanonicalContract,
5
- type ResourceBindingRef,
6
- requireExactObject,
7
- requireNonEmptyString,
8
- requireNonNegativeSafeInteger,
9
- requireResourceBindingRefs,
10
- requireSecretFreeJsonObject,
11
- requireStringRefs,
12
- } from './canonical-contract';
13
-
14
- export interface SessionBinding {
15
- readonly schemaVersion: 1;
16
- readonly sessionId: string;
17
- readonly organizationId: string;
18
- readonly projectId: string;
19
- readonly userId: string;
20
- readonly domainRefs: readonly ResourceBindingRef[];
21
- readonly storageAllocationRef: string;
22
- readonly workingFileSourceRefs: readonly string[];
23
- readonly outputRouteRef: string;
24
- readonly actorTokenRef?: string;
25
- readonly serviceTokenRef?: string;
26
- readonly providerTokenRefs: readonly string[];
27
- readonly credentialGrantRefs: readonly string[];
28
- readonly databaseGrantRefs: readonly string[];
29
- readonly dynamicContext: Readonly<Record<string, CanonicalJsonValue>>;
30
- readonly bindingRevision: string;
31
- readonly bindingEpoch: number;
32
- }
33
-
34
- const REQUIRED_KEYS = [
35
- 'schemaVersion',
36
- 'sessionId',
37
- 'organizationId',
38
- 'projectId',
39
- 'userId',
40
- 'domainRefs',
41
- 'storageAllocationRef',
42
- 'workingFileSourceRefs',
43
- 'outputRouteRef',
44
- 'providerTokenRefs',
45
- 'credentialGrantRefs',
46
- 'databaseGrantRefs',
47
- 'dynamicContext',
48
- 'bindingRevision',
49
- 'bindingEpoch',
50
- ] as const;
51
-
52
- const OPTIONAL_KEYS = ['actorTokenRef', 'serviceTokenRef'] as const;
53
-
54
- /**
55
- * Canonical tenant/session state applied atomically after a runtime claim.
56
- * Credentials are represented only by opaque refs; raw secrets are rejected
57
- * from dynamicContext.
58
- */
59
- export function createSessionBinding(input: unknown): SessionBinding {
60
- const object = requireExactObject(
61
- input,
62
- 'SessionBinding',
63
- REQUIRED_KEYS,
64
- OPTIONAL_KEYS,
65
- );
66
-
67
- if (object.schemaVersion !== 1) {
68
- throw new TypeError('SessionBinding.schemaVersion must be 1.');
69
- }
70
-
71
- const actorTokenRef =
72
- object.actorTokenRef === undefined
73
- ? undefined
74
- : requireNonEmptyString(
75
- object.actorTokenRef,
76
- 'SessionBinding.actorTokenRef',
77
- );
78
- const serviceTokenRef =
79
- object.serviceTokenRef === undefined
80
- ? undefined
81
- : requireNonEmptyString(
82
- object.serviceTokenRef,
83
- 'SessionBinding.serviceTokenRef',
84
- );
85
-
86
- return Object.freeze({
87
- schemaVersion: 1,
88
- sessionId: requireNonEmptyString(
89
- object.sessionId,
90
- 'SessionBinding.sessionId',
91
- ),
92
- organizationId: requireNonEmptyString(
93
- object.organizationId,
94
- 'SessionBinding.organizationId',
95
- ),
96
- projectId: requireNonEmptyString(
97
- object.projectId,
98
- 'SessionBinding.projectId',
99
- ),
100
- userId: requireNonEmptyString(object.userId, 'SessionBinding.userId'),
101
- domainRefs: requireResourceBindingRefs(
102
- object.domainRefs,
103
- 'SessionBinding.domainRefs',
104
- ),
105
- storageAllocationRef: requireNonEmptyString(
106
- object.storageAllocationRef,
107
- 'SessionBinding.storageAllocationRef',
108
- ),
109
- workingFileSourceRefs: requireStringRefs(
110
- object.workingFileSourceRefs,
111
- 'SessionBinding.workingFileSourceRefs',
112
- ),
113
- outputRouteRef: requireNonEmptyString(
114
- object.outputRouteRef,
115
- 'SessionBinding.outputRouteRef',
116
- ),
117
- ...(actorTokenRef === undefined ? {} : { actorTokenRef }),
118
- ...(serviceTokenRef === undefined ? {} : { serviceTokenRef }),
119
- providerTokenRefs: requireStringRefs(
120
- object.providerTokenRefs,
121
- 'SessionBinding.providerTokenRefs',
122
- ),
123
- credentialGrantRefs: requireStringRefs(
124
- object.credentialGrantRefs,
125
- 'SessionBinding.credentialGrantRefs',
126
- ),
127
- databaseGrantRefs: requireStringRefs(
128
- object.databaseGrantRefs,
129
- 'SessionBinding.databaseGrantRefs',
130
- ),
131
- dynamicContext: requireSecretFreeJsonObject(
132
- object.dynamicContext,
133
- 'SessionBinding.dynamicContext',
134
- ),
135
- bindingRevision: requireNonEmptyString(
136
- object.bindingRevision,
137
- 'SessionBinding.bindingRevision',
138
- ),
139
- bindingEpoch: requireNonNegativeSafeInteger(
140
- object.bindingEpoch,
141
- 'SessionBinding.bindingEpoch',
142
- ),
143
- });
144
- }
145
-
146
- export function serializeSessionBinding(input: SessionBinding): string {
147
- return canonicalContractJson(createSessionBinding(input));
148
- }
149
-
150
- export function hashSessionBinding(input: SessionBinding): string {
151
- return hashCanonicalContract(createSessionBinding(input));
152
- }