@agentplat/inference-control 0.3.0-alpha.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/LICENSE +202 -0
- package/README.md +101 -0
- package/dist/assessments.d.ts +5 -0
- package/dist/assessments.d.ts.map +1 -0
- package/dist/assessments.js +216 -0
- package/dist/assessments.js.map +1 -0
- package/dist/boundary.d.ts +24 -0
- package/dist/boundary.d.ts.map +1 -0
- package/dist/boundary.js +46 -0
- package/dist/boundary.js.map +1 -0
- package/dist/canonical.d.ts +6 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +74 -0
- package/dist/canonical.js.map +1 -0
- package/dist/capabilities.d.ts +43 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +304 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/context.d.ts +7 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +191 -0
- package/dist/context.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +124 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +475 -0
- package/dist/messages.js.map +1 -0
- package/dist/model.d.ts +104 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +437 -0
- package/dist/model.js.map +1 -0
- package/dist/policy.d.ts +11 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +338 -0
- package/dist/policy.js.map +1 -0
- package/dist/reducer.d.ts +193 -0
- package/dist/reducer.d.ts.map +1 -0
- package/dist/reducer.js +1341 -0
- package/dist/reducer.js.map +1 -0
- package/dist/runtime.d.ts +132 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +587 -0
- package/dist/runtime.js.map +1 -0
- package/dist/scopes.d.ts +3 -0
- package/dist/scopes.d.ts.map +1 -0
- package/dist/scopes.js +83 -0
- package/dist/scopes.js.map +1 -0
- package/dist/sha256.d.ts +2 -0
- package/dist/sha256.d.ts.map +1 -0
- package/dist/sha256.js +72 -0
- package/dist/sha256.js.map +1 -0
- package/dist/state-records.d.ts +8 -0
- package/dist/state-records.d.ts.map +1 -0
- package/dist/state-records.js +204 -0
- package/dist/state-records.js.map +1 -0
- package/dist/state.d.ts +19 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +689 -0
- package/dist/state.js.map +1 -0
- package/dist/streams.d.ts +5 -0
- package/dist/streams.d.ts.map +1 -0
- package/dist/streams.js +93 -0
- package/dist/streams.js.map +1 -0
- package/dist/telemetry.d.ts +12 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +20 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/tools.d.ts +221 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +755 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +474 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +43 -0
- package/dist/types.js.map +1 -0
- package/dist/validation.d.ts +23 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +154 -0
- package/dist/validation.js.map +1 -0
- package/package.json +56 -0
package/dist/scopes.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { assertControlToken, assertExactKeys, assertIdentifier, assertSafeInteger, deepFreeze, } from './validation.js';
|
|
2
|
+
const standaloneKeys = [
|
|
3
|
+
'schemaVersion',
|
|
4
|
+
'kind',
|
|
5
|
+
'tenantId',
|
|
6
|
+
'runId',
|
|
7
|
+
'agentId',
|
|
8
|
+
'organizationId',
|
|
9
|
+
'workspaceId',
|
|
10
|
+
'policyId',
|
|
11
|
+
'policyVersion',
|
|
12
|
+
];
|
|
13
|
+
const coordinatedKeys = [
|
|
14
|
+
'schemaVersion',
|
|
15
|
+
'kind',
|
|
16
|
+
'tenantId',
|
|
17
|
+
'runId',
|
|
18
|
+
'agentId',
|
|
19
|
+
'policyId',
|
|
20
|
+
'policyVersion',
|
|
21
|
+
'meshId',
|
|
22
|
+
'objectiveId',
|
|
23
|
+
'objectiveRevision',
|
|
24
|
+
'workItemId',
|
|
25
|
+
'workItemRevision',
|
|
26
|
+
'peerId',
|
|
27
|
+
'instanceId',
|
|
28
|
+
'assignmentAuthorityId',
|
|
29
|
+
'assignmentEpoch',
|
|
30
|
+
'fencingToken',
|
|
31
|
+
'leaseExpiresAtLogicalMs',
|
|
32
|
+
'authorityGeneration',
|
|
33
|
+
'objectiveTerminal',
|
|
34
|
+
'workTerminal',
|
|
35
|
+
];
|
|
36
|
+
export function validateControlScopeV1(value) {
|
|
37
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
38
|
+
throw new TypeError('grant_scope_mismatch');
|
|
39
|
+
const scope = value;
|
|
40
|
+
if (scope.kind === 'standalone') {
|
|
41
|
+
assertExactKeys(scope, standaloneKeys, 'standalone scope');
|
|
42
|
+
if (scope.schemaVersion !== 1)
|
|
43
|
+
throw new TypeError('grant_scope_mismatch');
|
|
44
|
+
for (const key of ['tenantId', 'runId', 'agentId', 'policyId'])
|
|
45
|
+
assertIdentifier(scope[key], key);
|
|
46
|
+
for (const key of ['organizationId', 'workspaceId'])
|
|
47
|
+
if (scope[key] !== null)
|
|
48
|
+
assertIdentifier(scope[key], key);
|
|
49
|
+
assertSafeInteger(scope.policyVersion, 'policyVersion', 1);
|
|
50
|
+
return deepFreeze(structuredClone(scope));
|
|
51
|
+
}
|
|
52
|
+
assertExactKeys(scope, coordinatedKeys, 'coordinated scope');
|
|
53
|
+
if (scope.kind !== 'coordinated' || scope.schemaVersion !== 1)
|
|
54
|
+
throw new TypeError('grant_scope_mismatch');
|
|
55
|
+
for (const key of [
|
|
56
|
+
'tenantId',
|
|
57
|
+
'runId',
|
|
58
|
+
'agentId',
|
|
59
|
+
'policyId',
|
|
60
|
+
'meshId',
|
|
61
|
+
'objectiveId',
|
|
62
|
+
'workItemId',
|
|
63
|
+
'peerId',
|
|
64
|
+
'instanceId',
|
|
65
|
+
'assignmentAuthorityId',
|
|
66
|
+
])
|
|
67
|
+
assertIdentifier(scope[key], key);
|
|
68
|
+
assertControlToken(scope.fencingToken, 'fencingToken');
|
|
69
|
+
for (const key of [
|
|
70
|
+
'policyVersion',
|
|
71
|
+
'objectiveRevision',
|
|
72
|
+
'workItemRevision',
|
|
73
|
+
'assignmentEpoch',
|
|
74
|
+
'leaseExpiresAtLogicalMs',
|
|
75
|
+
'authorityGeneration',
|
|
76
|
+
])
|
|
77
|
+
assertSafeInteger(scope[key], key, 1);
|
|
78
|
+
if (typeof scope.objectiveTerminal !== 'boolean' ||
|
|
79
|
+
typeof scope.workTerminal !== 'boolean')
|
|
80
|
+
throw new TypeError('grant_scope_mismatch');
|
|
81
|
+
return deepFreeze(structuredClone(scope));
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=scopes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopes.js","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,GACX,MAAM,iBAAiB,CAAC;AAEzB,MAAM,cAAc,GAAG;IACrB,eAAe;IACf,MAAM;IACN,UAAU;IACV,OAAO;IACP,SAAS;IACT,gBAAgB;IAChB,aAAa;IACb,UAAU;IACV,eAAe;CACP,CAAC;AAEX,MAAM,eAAe,GAAG;IACtB,eAAe;IACf,MAAM;IACN,UAAU;IACV,OAAO;IACP,SAAS;IACT,UAAU;IACV,eAAe;IACf,QAAQ;IACR,aAAa;IACb,mBAAmB;IACnB,YAAY;IACZ,kBAAkB;IAClB,QAAQ;IACR,YAAY;IACZ,uBAAuB;IACvB,iBAAiB;IACjB,cAAc;IACd,yBAAyB;IACzB,qBAAqB;IACrB,mBAAmB;IACnB,cAAc;CACN,CAAC;AAEX,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,IAAI,CAAC,KAA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K,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACpC,kBAAkB,CAAC,KAAK,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IACvD,KAAK,MAAM,GAAG,IAAI;QAChB,eAAe;QACf,mBAAmB;QACnB,kBAAkB;QAClB,iBAAiB;QACjB,yBAAyB;QACzB,qBAAqB;KACb;QACR,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IACxC,IACE,OAAO,KAAK,CAAC,iBAAiB,KAAK,SAAS;QAC5C,OAAO,KAAK,CAAC,YAAY,KAAK,SAAS;QAEvC,MAAM,IAAI,SAAS,CAAC,sBAAsB,CAAC,CAAC;IAC9C,OAAO,UAAU,CAAC,eAAe,CAAC,KAAK,CAA8B,CAAC,CAAC;AACzE,CAAC"}
|
package/dist/sha256.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sha256.d.ts","sourceRoot":"","sources":["../src/sha256.ts"],"names":[],"mappings":"AAiBA,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAuEnD"}
|
package/dist/sha256.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* A small synchronous SHA-256 implementation. It is intentionally free of
|
|
2
|
+
* Node imports so identical digest bytes are available in browser runtimes. */
|
|
3
|
+
const K = new Uint32Array([
|
|
4
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
|
|
5
|
+
0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
|
6
|
+
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
|
|
7
|
+
0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
8
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
|
|
9
|
+
0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
|
10
|
+
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
|
|
11
|
+
0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
12
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
|
|
13
|
+
0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
|
14
|
+
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
|
15
|
+
]);
|
|
16
|
+
const rotr = (x, n) => (x >>> n) | (x << (32 - n));
|
|
17
|
+
export function sha256Hex(bytes) {
|
|
18
|
+
const bitLength = bytes.length * 8;
|
|
19
|
+
if (!Number.isSafeInteger(bitLength))
|
|
20
|
+
throw new RangeError('SHA-256 input is too large');
|
|
21
|
+
const paddedLength = Math.ceil((bytes.length + 9) / 64) * 64;
|
|
22
|
+
const data = new Uint8Array(paddedLength);
|
|
23
|
+
data.set(bytes);
|
|
24
|
+
data[bytes.length] = 0x80;
|
|
25
|
+
const view = new DataView(data.buffer);
|
|
26
|
+
view.setUint32(paddedLength - 8, Math.floor(bitLength / 0x1_0000_0000), false);
|
|
27
|
+
view.setUint32(paddedLength - 4, bitLength >>> 0, false);
|
|
28
|
+
let a = 0x6a09e667, b = 0xbb67ae85, c = 0x3c6ef372, d = 0xa54ff53a;
|
|
29
|
+
let e = 0x510e527f, f = 0x9b05688c, g = 0x1f83d9ab, h = 0x5be0cd19;
|
|
30
|
+
const w = new Uint32Array(64);
|
|
31
|
+
for (let offset = 0; offset < data.length; offset += 64) {
|
|
32
|
+
for (let i = 0; i < 16; i++)
|
|
33
|
+
w[i] = view.getUint32(offset + i * 4, false);
|
|
34
|
+
for (let i = 16; i < 64; i++) {
|
|
35
|
+
const x = w[i - 15], y = w[i - 2];
|
|
36
|
+
w[i] =
|
|
37
|
+
((rotr(x, 7) ^ rotr(x, 18) ^ (x >>> 3)) +
|
|
38
|
+
w[i - 16] +
|
|
39
|
+
((rotr(y, 17) ^ rotr(y, 19) ^ (y >>> 10)) + w[i - 7])) >>>
|
|
40
|
+
0;
|
|
41
|
+
}
|
|
42
|
+
let aa = a, bb = b, cc = c, dd = d, ee = e, ff = f, gg = g, hh = h;
|
|
43
|
+
for (let i = 0; i < 64; i++) {
|
|
44
|
+
const s1 = rotr(ee, 6) ^ rotr(ee, 11) ^ rotr(ee, 25);
|
|
45
|
+
const choice = (ee & ff) ^ (~ee & gg);
|
|
46
|
+
const t1 = (hh + s1 + choice + K[i] + w[i]) >>> 0;
|
|
47
|
+
const s0 = rotr(aa, 2) ^ rotr(aa, 13) ^ rotr(aa, 22);
|
|
48
|
+
const majority = (aa & bb) ^ (aa & cc) ^ (bb & cc);
|
|
49
|
+
const t2 = (s0 + majority) >>> 0;
|
|
50
|
+
hh = gg;
|
|
51
|
+
gg = ff;
|
|
52
|
+
ff = ee;
|
|
53
|
+
ee = (dd + t1) >>> 0;
|
|
54
|
+
dd = cc;
|
|
55
|
+
cc = bb;
|
|
56
|
+
bb = aa;
|
|
57
|
+
aa = (t1 + t2) >>> 0;
|
|
58
|
+
}
|
|
59
|
+
a = (a + aa) >>> 0;
|
|
60
|
+
b = (b + bb) >>> 0;
|
|
61
|
+
c = (c + cc) >>> 0;
|
|
62
|
+
d = (d + dd) >>> 0;
|
|
63
|
+
e = (e + ee) >>> 0;
|
|
64
|
+
f = (f + ff) >>> 0;
|
|
65
|
+
g = (g + gg) >>> 0;
|
|
66
|
+
h = (h + hh) >>> 0;
|
|
67
|
+
}
|
|
68
|
+
return [a, b, c, d, e, f, g, h]
|
|
69
|
+
.map((value) => value.toString(16).padStart(8, '0'))
|
|
70
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CAAC;QACnB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SAC5B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SACnD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ActionGrantStateV1, ActionIdempotencyRecordV1, DependencyBindingRecordV1, DiagnosticV1, InferenceControlLimitsV1, MessageIdempotencyRecordV1, OutboundMessageAttemptStateV1 } from './types.js';
|
|
2
|
+
export declare function validateDependencyBindingRecordV1(binding: DependencyBindingRecordV1): void;
|
|
3
|
+
export declare function validateActionGrantStateV1(grant: ActionGrantStateV1, limits: InferenceControlLimitsV1): void;
|
|
4
|
+
export declare function validateActionIdempotencyRecordV1(record: ActionIdempotencyRecordV1): void;
|
|
5
|
+
export declare function validateOutboundMessageAttemptStateV1(attempt: OutboundMessageAttemptStateV1): void;
|
|
6
|
+
export declare function validateMessageIdempotencyRecordV1(record: MessageIdempotencyRecordV1): void;
|
|
7
|
+
export declare function validateDiagnosticV1(diagnostic: DiagnosticV1): void;
|
|
8
|
+
//# sourceMappingURL=state-records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-records.d.ts","sourceRoot":"","sources":["../src/state-records.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,YAAY,EACZ,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAC9B,MAAM,YAAY,CAAC;AAUpB,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,yBAAyB,GACjC,IAAI,CAuBN;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,kBAAkB,EACzB,MAAM,EAAE,wBAAwB,GAC/B,IAAI,CA6EN;AAED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,yBAAyB,GAChC,IAAI,CAuBN;AAED,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,6BAA6B,GACrC,IAAI,CA+DN;AAED,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,0BAA0B,GACjC,IAAI,CAuBN;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,YAAY,GAAG,IAAI,CAmCnE"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { digestControlJsonV1 } from './canonical.js';
|
|
2
|
+
import { validateControlScopeV1 } from './scopes.js';
|
|
3
|
+
import { assertDigest, assertExactKeys, assertOneOf, assertSafeInteger, assertStrictJsonValue, assertString, } from './validation.js';
|
|
4
|
+
export function validateDependencyBindingRecordV1(binding) {
|
|
5
|
+
assertExactKeys(binding, ['schemaVersion', 'kind', 'bindingId', 'bindingVersion', 'bindingDigest'], 'dependency binding');
|
|
6
|
+
if (binding.schemaVersion !== 1)
|
|
7
|
+
throw new TypeError('state_conflict');
|
|
8
|
+
assertOneOf(binding.kind, [
|
|
9
|
+
'capability',
|
|
10
|
+
'assessor',
|
|
11
|
+
'transformer',
|
|
12
|
+
'action_dispatcher',
|
|
13
|
+
'action_context_resolver',
|
|
14
|
+
'authority_resolver',
|
|
15
|
+
'message_dispatcher',
|
|
16
|
+
], 'dependency kind');
|
|
17
|
+
assertString(binding.bindingId, 'bindingId');
|
|
18
|
+
assertSafeInteger(binding.bindingVersion, 'bindingVersion', 1);
|
|
19
|
+
assertDigest(binding.bindingDigest, 'bindingDigest');
|
|
20
|
+
}
|
|
21
|
+
export function validateActionGrantStateV1(grant, limits) {
|
|
22
|
+
assertExactKeys(grant, [
|
|
23
|
+
'schemaVersion',
|
|
24
|
+
'grantId',
|
|
25
|
+
'runId',
|
|
26
|
+
'stateGeneration',
|
|
27
|
+
'scope',
|
|
28
|
+
'scopeDigest',
|
|
29
|
+
'namespace',
|
|
30
|
+
'toolId',
|
|
31
|
+
'operation',
|
|
32
|
+
'actionBindingId',
|
|
33
|
+
'actionBindingVersion',
|
|
34
|
+
'handlerDigest',
|
|
35
|
+
'inputDigest',
|
|
36
|
+
'actionDigest',
|
|
37
|
+
'assessmentRequestId',
|
|
38
|
+
'assessmentId',
|
|
39
|
+
'assessmentTargetDigest',
|
|
40
|
+
'idempotencyKey',
|
|
41
|
+
'issuedAtLogicalMs',
|
|
42
|
+
'expiresAtLogicalMs',
|
|
43
|
+
'singleUse',
|
|
44
|
+
'status',
|
|
45
|
+
'reservation',
|
|
46
|
+
], 'grant');
|
|
47
|
+
if (grant.schemaVersion !== 1 || grant.singleUse !== true)
|
|
48
|
+
throw new TypeError('state_conflict');
|
|
49
|
+
for (const [label, value] of [
|
|
50
|
+
['grantId', grant.grantId],
|
|
51
|
+
['runId', grant.runId],
|
|
52
|
+
['namespace', grant.namespace],
|
|
53
|
+
['toolId', grant.toolId],
|
|
54
|
+
['operation', grant.operation],
|
|
55
|
+
['actionBindingId', grant.actionBindingId],
|
|
56
|
+
['assessmentRequestId', grant.assessmentRequestId],
|
|
57
|
+
['assessmentId', grant.assessmentId],
|
|
58
|
+
['idempotencyKey', grant.idempotencyKey],
|
|
59
|
+
])
|
|
60
|
+
assertString(value, label);
|
|
61
|
+
for (const [label, value] of [
|
|
62
|
+
['scopeDigest', grant.scopeDigest],
|
|
63
|
+
['handlerDigest', grant.handlerDigest],
|
|
64
|
+
['inputDigest', grant.inputDigest],
|
|
65
|
+
['actionDigest', grant.actionDigest],
|
|
66
|
+
['assessmentTargetDigest', grant.assessmentTargetDigest],
|
|
67
|
+
])
|
|
68
|
+
assertDigest(value, label);
|
|
69
|
+
validateControlScopeV1(grant.scope);
|
|
70
|
+
if (digestControlJsonV1('scope', grant.scope) !== grant.scopeDigest)
|
|
71
|
+
throw new TypeError('state_conflict');
|
|
72
|
+
assertSafeInteger(grant.stateGeneration, 'stateGeneration', 1);
|
|
73
|
+
assertSafeInteger(grant.actionBindingVersion, 'actionBindingVersion', 1);
|
|
74
|
+
assertSafeInteger(grant.issuedAtLogicalMs, 'issuedAtLogicalMs');
|
|
75
|
+
assertSafeInteger(grant.expiresAtLogicalMs, 'expiresAtLogicalMs');
|
|
76
|
+
if (grant.expiresAtLogicalMs <= grant.issuedAtLogicalMs ||
|
|
77
|
+
grant.expiresAtLogicalMs - grant.issuedAtLogicalMs > limits.maxGrantTtlMs)
|
|
78
|
+
throw new TypeError('grant_expired');
|
|
79
|
+
assertOneOf(grant.status, ['issued', 'reserved', 'dispatched', 'failed', 'indeterminate', 'expired'], 'grant status');
|
|
80
|
+
if ((['issued', 'expired'].includes(grant.status) &&
|
|
81
|
+
grant.reservation !== null) ||
|
|
82
|
+
(!['issued', 'expired'].includes(grant.status) &&
|
|
83
|
+
grant.reservation === null))
|
|
84
|
+
throw new TypeError('state_conflict');
|
|
85
|
+
if (grant.reservation !== null)
|
|
86
|
+
assertStrictJsonValue(grant.reservation);
|
|
87
|
+
}
|
|
88
|
+
export function validateActionIdempotencyRecordV1(record) {
|
|
89
|
+
assertExactKeys(record, [
|
|
90
|
+
'schemaVersion',
|
|
91
|
+
'scopeDigest',
|
|
92
|
+
'idempotencyKey',
|
|
93
|
+
'actionDigest',
|
|
94
|
+
'grantId',
|
|
95
|
+
'retainedOutcome',
|
|
96
|
+
], 'action idempotency');
|
|
97
|
+
if (record.schemaVersion !== 1)
|
|
98
|
+
throw new TypeError('state_conflict');
|
|
99
|
+
assertDigest(record.scopeDigest, 'scopeDigest');
|
|
100
|
+
assertString(record.idempotencyKey, 'idempotencyKey');
|
|
101
|
+
assertDigest(record.actionDigest, 'actionDigest');
|
|
102
|
+
assertString(record.grantId, 'grantId');
|
|
103
|
+
assertOneOf(record.retainedOutcome, ['issued', 'reserved', 'dispatched', 'failed', 'indeterminate', 'expired'], 'retainedOutcome');
|
|
104
|
+
}
|
|
105
|
+
export function validateOutboundMessageAttemptStateV1(attempt) {
|
|
106
|
+
assertExactKeys(attempt, [
|
|
107
|
+
'schemaVersion',
|
|
108
|
+
'messageAttemptId',
|
|
109
|
+
'runId',
|
|
110
|
+
'messageId',
|
|
111
|
+
'assessmentRequestId',
|
|
112
|
+
'assessmentId',
|
|
113
|
+
'messageDigest',
|
|
114
|
+
'scopeDigest',
|
|
115
|
+
'idempotencyKey',
|
|
116
|
+
'generation',
|
|
117
|
+
'dispatcherId',
|
|
118
|
+
'dispatcherVersion',
|
|
119
|
+
'dispatcherDigest',
|
|
120
|
+
'status',
|
|
121
|
+
'reservation',
|
|
122
|
+
'preparedAtLogicalMs',
|
|
123
|
+
'reservedAtLogicalMs',
|
|
124
|
+
'expiresAtLogicalMs',
|
|
125
|
+
], 'message attempt');
|
|
126
|
+
if (attempt.schemaVersion !== 1)
|
|
127
|
+
throw new TypeError('state_conflict');
|
|
128
|
+
for (const [label, value] of [
|
|
129
|
+
['messageAttemptId', attempt.messageAttemptId],
|
|
130
|
+
['runId', attempt.runId],
|
|
131
|
+
['messageId', attempt.messageId],
|
|
132
|
+
['assessmentRequestId', attempt.assessmentRequestId],
|
|
133
|
+
['assessmentId', attempt.assessmentId],
|
|
134
|
+
['idempotencyKey', attempt.idempotencyKey],
|
|
135
|
+
['dispatcherId', attempt.dispatcherId],
|
|
136
|
+
])
|
|
137
|
+
assertString(value, label);
|
|
138
|
+
for (const [label, value] of [
|
|
139
|
+
['messageDigest', attempt.messageDigest],
|
|
140
|
+
['scopeDigest', attempt.scopeDigest],
|
|
141
|
+
['dispatcherDigest', attempt.dispatcherDigest],
|
|
142
|
+
])
|
|
143
|
+
assertDigest(value, label);
|
|
144
|
+
assertSafeInteger(attempt.generation, 'generation', 1);
|
|
145
|
+
assertSafeInteger(attempt.dispatcherVersion, 'dispatcherVersion', 1);
|
|
146
|
+
assertSafeInteger(attempt.expiresAtLogicalMs, 'expiresAtLogicalMs');
|
|
147
|
+
assertSafeInteger(attempt.preparedAtLogicalMs, 'preparedAtLogicalMs');
|
|
148
|
+
if (attempt.expiresAtLogicalMs <= attempt.preparedAtLogicalMs)
|
|
149
|
+
throw new TypeError('state_conflict');
|
|
150
|
+
assertOneOf(attempt.status, ['prepared', 'reserved', 'sent', 'failed', 'indeterminate', 'expired'], 'message status');
|
|
151
|
+
if ((['prepared', 'expired'].includes(attempt.status) &&
|
|
152
|
+
(attempt.reservation !== null || attempt.reservedAtLogicalMs !== null)) ||
|
|
153
|
+
(!['prepared', 'expired'].includes(attempt.status) &&
|
|
154
|
+
(attempt.reservation === null || attempt.reservedAtLogicalMs === null)))
|
|
155
|
+
throw new TypeError('state_conflict');
|
|
156
|
+
if (attempt.reservation !== null)
|
|
157
|
+
assertStrictJsonValue(attempt.reservation);
|
|
158
|
+
if (attempt.reservedAtLogicalMs !== null)
|
|
159
|
+
assertSafeInteger(attempt.reservedAtLogicalMs, 'reservedAtLogicalMs');
|
|
160
|
+
}
|
|
161
|
+
export function validateMessageIdempotencyRecordV1(record) {
|
|
162
|
+
assertExactKeys(record, [
|
|
163
|
+
'schemaVersion',
|
|
164
|
+
'scopeDigest',
|
|
165
|
+
'idempotencyKey',
|
|
166
|
+
'messageDigest',
|
|
167
|
+
'messageAttemptId',
|
|
168
|
+
'retainedOutcome',
|
|
169
|
+
], 'message idempotency');
|
|
170
|
+
if (record.schemaVersion !== 1)
|
|
171
|
+
throw new TypeError('state_conflict');
|
|
172
|
+
assertDigest(record.scopeDigest, 'scopeDigest');
|
|
173
|
+
assertString(record.idempotencyKey, 'idempotencyKey');
|
|
174
|
+
assertDigest(record.messageDigest, 'messageDigest');
|
|
175
|
+
assertString(record.messageAttemptId, 'messageAttemptId');
|
|
176
|
+
assertOneOf(record.retainedOutcome, ['prepared', 'reserved', 'sent', 'failed', 'indeterminate', 'expired'], 'retainedOutcome');
|
|
177
|
+
}
|
|
178
|
+
export function validateDiagnosticV1(diagnostic) {
|
|
179
|
+
assertExactKeys(diagnostic, [
|
|
180
|
+
'schemaVersion',
|
|
181
|
+
'diagnosticId',
|
|
182
|
+
'logicalTimeMs',
|
|
183
|
+
'runId',
|
|
184
|
+
'checkpoint',
|
|
185
|
+
'reasonCode',
|
|
186
|
+
'outcome',
|
|
187
|
+
'sizeBucket',
|
|
188
|
+
'correlationId',
|
|
189
|
+
], 'diagnostic');
|
|
190
|
+
if (diagnostic.schemaVersion !== 1)
|
|
191
|
+
throw new TypeError('state_conflict');
|
|
192
|
+
assertString(diagnostic.diagnosticId, 'diagnosticId');
|
|
193
|
+
assertSafeInteger(diagnostic.logicalTimeMs, 'logicalTimeMs');
|
|
194
|
+
if (diagnostic.runId !== null)
|
|
195
|
+
assertString(diagnostic.runId, 'runId');
|
|
196
|
+
if (diagnostic.checkpoint !== null)
|
|
197
|
+
assertOneOf(diagnostic.checkpoint, ['pre_run', 'stream', 'post_run', 'pre_tool', 'pre_message'], 'checkpoint');
|
|
198
|
+
assertOneOf(diagnostic.outcome, ['accepted', 'withheld', 'denied', 'unavailable'], 'outcome');
|
|
199
|
+
if (![0, 1, 2, 3, 4].includes(diagnostic.sizeBucket))
|
|
200
|
+
throw new TypeError('state_conflict');
|
|
201
|
+
if (diagnostic.correlationId !== null)
|
|
202
|
+
assertString(diagnostic.correlationId, 'correlationId');
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=state-records.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-records.js","sourceRoot":"","sources":["../src/state-records.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAUrD,OAAO,EACL,YAAY,EACZ,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,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7D,IAAI,UAAU,CAAC,KAAK,KAAK,IAAI;QAAE,YAAY,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACvE,IAAI,UAAU,CAAC,UAAU,KAAK,IAAI;QAChC,WAAW,CACT,UAAU,CAAC,UAAU,EACrB,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,CAAC,EAC5D,YAAY,CACb,CAAC;IACJ,WAAW,CACT,UAAU,CAAC,OAAO,EAClB,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,CAAC,EACjD,SAAS,CACV,CAAC;IACF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC;QAClD,MAAM,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACxC,IAAI,UAAU,CAAC,aAAa,KAAK,IAAI;QACnC,YAAY,CAAC,UAAU,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;AAC5D,CAAC"}
|
package/dist/state.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DependencyBindingRecordV1, InferenceControlSnapshotV1, InferenceControlStateV1, RedactedInferenceControlEvidenceV1 } from './types.js';
|
|
2
|
+
export interface DependencyRebinderV1 {
|
|
3
|
+
rebind(binding: DependencyBindingRecordV1): boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function createInferenceControlStateV1(input: {
|
|
6
|
+
stateId: string;
|
|
7
|
+
tenantId: string;
|
|
8
|
+
logicalTimeMs?: number;
|
|
9
|
+
}): InferenceControlStateV1;
|
|
10
|
+
export declare function restoreInferenceControlStateV1(value: unknown, rebinder?: DependencyRebinderV1): InferenceControlStateV1;
|
|
11
|
+
export declare function createInferenceControlSnapshotV1(input: {
|
|
12
|
+
snapshotId: string;
|
|
13
|
+
createdAtLogicalMs: number;
|
|
14
|
+
state: InferenceControlStateV1;
|
|
15
|
+
}): InferenceControlSnapshotV1;
|
|
16
|
+
export declare function restoreInferenceControlSnapshotV1(value: unknown, rebinder?: DependencyRebinderV1): InferenceControlSnapshotV1;
|
|
17
|
+
export declare function createRedactedInferenceControlEvidenceV1(state: InferenceControlStateV1): RedactedInferenceControlEvidenceV1;
|
|
18
|
+
export declare function finalizeInferenceControlStateV1(material: Omit<InferenceControlStateV1, 'traceDigest' | 'encodedBytes'>): InferenceControlStateV1;
|
|
19
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,yBAAyB,EAGzB,0BAA0B,EAC1B,uBAAuB,EACvB,kCAAkC,EACnC,MAAM,YAAY,CAAC;AAuDpB,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC;CACrD;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,uBAAuB,CA2B1B;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,uBAAuB,CA8CzB;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,uBAAuB,CAAC;CAChC,GAAG,0BAA0B,CAY7B;AAED,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,0BAA0B,CAuB5B;AAED,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,uBAAuB,GAC7B,kCAAkC,CAqBpC;AAED,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,IAAI,CAAC,uBAAuB,EAAE,aAAa,GAAG,cAAc,CAAC,GACtE,uBAAuB,CAEzB"}
|