@xemahq/agent-session-runtime 0.6.6 → 0.7.0
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 +176 -175
- package/README.md +6 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/dispatch-contract.d.ts +2 -1
- package/dist/lib/dispatch-contract.d.ts.map +1 -1
- package/dist/lib/launch-identity/canonical-contract.d.ts +21 -0
- package/dist/lib/launch-identity/canonical-contract.d.ts.map +1 -0
- package/dist/lib/launch-identity/canonical-contract.js +217 -0
- package/dist/lib/launch-identity/canonical-contract.js.map +1 -0
- package/dist/lib/launch-identity/compiled-session-launch-plan-store.d.ts +44 -0
- package/dist/lib/launch-identity/compiled-session-launch-plan-store.d.ts.map +1 -0
- package/dist/lib/launch-identity/compiled-session-launch-plan-store.js +116 -0
- package/dist/lib/launch-identity/compiled-session-launch-plan-store.js.map +1 -0
- package/dist/lib/launch-identity/compiled-session-launch-plan.d.ts +84 -0
- package/dist/lib/launch-identity/compiled-session-launch-plan.d.ts.map +1 -0
- package/dist/lib/launch-identity/compiled-session-launch-plan.js +386 -0
- package/dist/lib/launch-identity/compiled-session-launch-plan.js.map +1 -0
- package/dist/lib/launch-identity/index.d.ts +7 -0
- package/dist/lib/launch-identity/index.d.ts.map +1 -0
- package/dist/lib/launch-identity/index.js +23 -0
- package/dist/lib/launch-identity/index.js.map +1 -0
- package/dist/lib/launch-identity/runtime-template-key.d.ts +30 -0
- package/dist/lib/launch-identity/runtime-template-key.d.ts.map +1 -0
- package/dist/lib/launch-identity/runtime-template-key.js +73 -0
- package/dist/lib/launch-identity/runtime-template-key.js.map +1 -0
- package/dist/lib/launch-identity/session-binding.d.ts +24 -0
- package/dist/lib/launch-identity/session-binding.d.ts.map +1 -0
- package/dist/lib/launch-identity/session-binding.js +62 -0
- package/dist/lib/launch-identity/session-binding.js.map +1 -0
- package/dist/lib/launch-identity/thread-reuse-key.d.ts +19 -0
- package/dist/lib/launch-identity/thread-reuse-key.d.ts.map +1 -0
- package/dist/lib/launch-identity/thread-reuse-key.js +46 -0
- package/dist/lib/launch-identity/thread-reuse-key.js.map +1 -0
- package/package.json +15 -4
- package/src/index.ts +1 -0
- package/src/lib/agent-workspace-manifest.ts +2 -2
- package/src/lib/composer.ts +2 -2
- package/src/lib/dispatch-contract.ts +4 -9
- package/src/lib/drift-detector.ts +2 -2
- package/src/lib/environment-resolver.ts +3 -3
- package/src/lib/launch-identity/canonical-contract.ts +318 -0
- package/src/lib/launch-identity/compiled-session-launch-plan-store.ts +178 -0
- package/src/lib/launch-identity/compiled-session-launch-plan.ts +689 -0
- package/src/lib/launch-identity/index.ts +6 -0
- package/src/lib/launch-identity/runtime-template-key.ts +148 -0
- package/src/lib/launch-identity/session-binding.ts +152 -0
- package/src/lib/launch-identity/thread-reuse-key.ts +93 -0
- package/src/lib/skill-bundle-template-resolver.ts +1 -1
- package/src/lib/types.ts +1 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.canonicalContractJson = canonicalContractJson;
|
|
4
|
+
exports.hashCanonicalContract = hashCanonicalContract;
|
|
5
|
+
exports.requireExactObject = requireExactObject;
|
|
6
|
+
exports.requireNonEmptyString = requireNonEmptyString;
|
|
7
|
+
exports.requireBoolean = requireBoolean;
|
|
8
|
+
exports.requireSha256 = requireSha256;
|
|
9
|
+
exports.requireNonNegativeSafeInteger = requireNonNegativeSafeInteger;
|
|
10
|
+
exports.requireEnumValue = requireEnumValue;
|
|
11
|
+
exports.requireStringRefs = requireStringRefs;
|
|
12
|
+
exports.requireResourceBindingRefs = requireResourceBindingRefs;
|
|
13
|
+
exports.requireSecretFreeJsonObject = requireSecretFreeJsonObject;
|
|
14
|
+
exports.requireCanonicalJsonObject = requireCanonicalJsonObject;
|
|
15
|
+
exports.assertNoTenantOrSecretTemplateFields = assertNoTenantOrSecretTemplateFields;
|
|
16
|
+
const declarative_reconciler_1 = require("@xemahq/declarative-reconciler");
|
|
17
|
+
const SHA256_PATTERN = /^[a-f0-9]{64}$/u;
|
|
18
|
+
const SECRET_FIELD_PATTERN = /(?:^|[_-])(api[_-]?key|authorization|cookie|credential|password|private[_-]?key|secret|token)(?:$|[_-])/iu;
|
|
19
|
+
const SECRET_CAMEL_CASE_PATTERN = /(?:apiKey|authorization|cookie|credential|password|privateKey|secret|token)/u;
|
|
20
|
+
const SECRET_REFERENCE_SUFFIX_PATTERN = /Refs?$/u;
|
|
21
|
+
function canonicalContractJson(value) {
|
|
22
|
+
return (0, declarative_reconciler_1.canonicalJson)(value);
|
|
23
|
+
}
|
|
24
|
+
function hashCanonicalContract(value) {
|
|
25
|
+
return (0, declarative_reconciler_1.stableHash)(value);
|
|
26
|
+
}
|
|
27
|
+
function requireExactObject(value, path, requiredKeys, optionalKeys = []) {
|
|
28
|
+
if (!isPlainObject(value)) {
|
|
29
|
+
throw new TypeError(`${path} must be a plain object.`);
|
|
30
|
+
}
|
|
31
|
+
const allowedKeys = new Set([...requiredKeys, ...optionalKeys]);
|
|
32
|
+
for (const key of Object.keys(value)) {
|
|
33
|
+
if (!allowedKeys.has(key)) {
|
|
34
|
+
throw new TypeError(`${path}.${key} is not a supported field.`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
for (const key of requiredKeys) {
|
|
38
|
+
if (!Object.hasOwn(value, key)) {
|
|
39
|
+
throw new TypeError(`${path}.${key} is required.`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
function requireNonEmptyString(value, path) {
|
|
45
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
46
|
+
throw new TypeError(`${path} must be a non-empty string.`);
|
|
47
|
+
}
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
function requireBoolean(value, path) {
|
|
51
|
+
if (typeof value !== 'boolean') {
|
|
52
|
+
throw new TypeError(`${path} must be a boolean.`);
|
|
53
|
+
}
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
function requireSha256(value, path) {
|
|
57
|
+
const hash = requireNonEmptyString(value, path);
|
|
58
|
+
if (!SHA256_PATTERN.test(hash)) {
|
|
59
|
+
throw new TypeError(`${path} must be a lowercase SHA-256 hex digest.`);
|
|
60
|
+
}
|
|
61
|
+
return hash;
|
|
62
|
+
}
|
|
63
|
+
function requireNonNegativeSafeInteger(value, path) {
|
|
64
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
65
|
+
throw new TypeError(`${path} must be a non-negative safe integer.`);
|
|
66
|
+
}
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
function requireEnumValue(value, path, values) {
|
|
70
|
+
if (typeof value !== 'string' || !values.includes(value)) {
|
|
71
|
+
throw new TypeError(`${path} must be one of: ${values.map((entry) => `'${entry}'`).join(', ')}.`);
|
|
72
|
+
}
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
function requireStringRefs(value, path) {
|
|
76
|
+
if (!Array.isArray(value)) {
|
|
77
|
+
throw new TypeError(`${path} must be an array.`);
|
|
78
|
+
}
|
|
79
|
+
return Object.freeze([
|
|
80
|
+
...new Set(value.map((entry, index) => requireNonEmptyString(entry, `${path}[${index}]`))),
|
|
81
|
+
].sort());
|
|
82
|
+
}
|
|
83
|
+
function requireResourceBindingRefs(value, path) {
|
|
84
|
+
if (!Array.isArray(value)) {
|
|
85
|
+
throw new TypeError(`${path} must be an array.`);
|
|
86
|
+
}
|
|
87
|
+
const refs = value.map((entry, index) => {
|
|
88
|
+
const entryPath = `${path}[${index}]`;
|
|
89
|
+
const object = requireExactObject(entry, entryPath, ['kind', 'ref']);
|
|
90
|
+
return Object.freeze({
|
|
91
|
+
kind: requireNonEmptyString(object.kind, `${entryPath}.kind`),
|
|
92
|
+
ref: requireNonEmptyString(object.ref, `${entryPath}.ref`),
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
const byCanonicalRef = new Map(refs.map((entry) => [(0, declarative_reconciler_1.canonicalJson)(entry), entry]));
|
|
96
|
+
return Object.freeze([...byCanonicalRef.entries()]
|
|
97
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
98
|
+
.map(([, entry]) => entry));
|
|
99
|
+
}
|
|
100
|
+
function requireSecretFreeJsonObject(value, path) {
|
|
101
|
+
const normalized = normalizeCanonicalJson(value, path, true);
|
|
102
|
+
if (normalized === null ||
|
|
103
|
+
Array.isArray(normalized) ||
|
|
104
|
+
typeof normalized !== 'object') {
|
|
105
|
+
throw new TypeError(`${path} must be a plain JSON object.`);
|
|
106
|
+
}
|
|
107
|
+
return normalized;
|
|
108
|
+
}
|
|
109
|
+
function requireCanonicalJsonObject(value, path) {
|
|
110
|
+
const normalized = normalizeCanonicalJson(value, path, false);
|
|
111
|
+
if (normalized === null ||
|
|
112
|
+
Array.isArray(normalized) ||
|
|
113
|
+
typeof normalized !== 'object') {
|
|
114
|
+
throw new TypeError(`${path} must be a plain JSON object.`);
|
|
115
|
+
}
|
|
116
|
+
return normalized;
|
|
117
|
+
}
|
|
118
|
+
function assertNoTenantOrSecretTemplateFields(value, path) {
|
|
119
|
+
const visited = new Set();
|
|
120
|
+
function inspect(current, currentPath) {
|
|
121
|
+
if (current === null || typeof current !== 'object') {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (visited.has(current)) {
|
|
125
|
+
throw new TypeError(`${currentPath} must not contain cycles.`);
|
|
126
|
+
}
|
|
127
|
+
visited.add(current);
|
|
128
|
+
if (Array.isArray(current)) {
|
|
129
|
+
current.forEach((entry, index) => inspect(entry, `${currentPath}[${index}]`));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (!isPlainObject(current)) {
|
|
133
|
+
throw new TypeError(`${currentPath} must contain only plain objects.`);
|
|
134
|
+
}
|
|
135
|
+
for (const [key, entry] of Object.entries(current)) {
|
|
136
|
+
if (isTenantField(key) || isSecretField(key)) {
|
|
137
|
+
throw new TypeError(`${currentPath}.${key} is tenant/session/secret state and cannot enter a RuntimeTemplateKey.`);
|
|
138
|
+
}
|
|
139
|
+
inspect(entry, `${currentPath}.${key}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
inspect(value, path);
|
|
143
|
+
}
|
|
144
|
+
function normalizeCanonicalJson(value, path, rejectSecretFields, visited = new Set()) {
|
|
145
|
+
if (value === null ||
|
|
146
|
+
typeof value === 'string' ||
|
|
147
|
+
typeof value === 'boolean') {
|
|
148
|
+
return value;
|
|
149
|
+
}
|
|
150
|
+
if (typeof value === 'number') {
|
|
151
|
+
if (!Number.isFinite(value)) {
|
|
152
|
+
throw new TypeError(`${path} must contain only finite numbers.`);
|
|
153
|
+
}
|
|
154
|
+
return value;
|
|
155
|
+
}
|
|
156
|
+
if (typeof value !== 'object') {
|
|
157
|
+
throw new TypeError(`${path} must contain only JSON values.`);
|
|
158
|
+
}
|
|
159
|
+
if (visited.has(value)) {
|
|
160
|
+
throw new TypeError(`${path} must not contain cycles.`);
|
|
161
|
+
}
|
|
162
|
+
visited.add(value);
|
|
163
|
+
if (Array.isArray(value)) {
|
|
164
|
+
const normalized = value.map((entry, index) => normalizeCanonicalJson(entry, `${path}[${index}]`, rejectSecretFields, visited));
|
|
165
|
+
visited.delete(value);
|
|
166
|
+
return Object.freeze(normalized);
|
|
167
|
+
}
|
|
168
|
+
if (!isPlainObject(value)) {
|
|
169
|
+
throw new TypeError(`${path} must contain only plain JSON objects.`);
|
|
170
|
+
}
|
|
171
|
+
const normalized = {};
|
|
172
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
173
|
+
if (rejectSecretFields &&
|
|
174
|
+
isSecretField(key) &&
|
|
175
|
+
!SECRET_REFERENCE_SUFFIX_PATTERN.test(key)) {
|
|
176
|
+
throw new TypeError(`${path}.${key} appears to contain secret material; pass an opaque reference ending in Ref or Refs instead.`);
|
|
177
|
+
}
|
|
178
|
+
normalized[key] = normalizeCanonicalJson(entry, `${path}.${key}`, rejectSecretFields, visited);
|
|
179
|
+
}
|
|
180
|
+
visited.delete(value);
|
|
181
|
+
return Object.freeze(normalized);
|
|
182
|
+
}
|
|
183
|
+
function isTenantField(key) {
|
|
184
|
+
const normalized = key.replaceAll(/[_-]/gu, '').toLowerCase();
|
|
185
|
+
return [
|
|
186
|
+
'binding',
|
|
187
|
+
'context',
|
|
188
|
+
'domain',
|
|
189
|
+
'domainid',
|
|
190
|
+
'input',
|
|
191
|
+
'organization',
|
|
192
|
+
'organizationid',
|
|
193
|
+
'org',
|
|
194
|
+
'orgid',
|
|
195
|
+
'project',
|
|
196
|
+
'projectid',
|
|
197
|
+
'session',
|
|
198
|
+
'sessionid',
|
|
199
|
+
'tenant',
|
|
200
|
+
'tenantid',
|
|
201
|
+
'thread',
|
|
202
|
+
'threadid',
|
|
203
|
+
'user',
|
|
204
|
+
'userid',
|
|
205
|
+
].includes(normalized);
|
|
206
|
+
}
|
|
207
|
+
function isSecretField(key) {
|
|
208
|
+
return SECRET_FIELD_PATTERN.test(key) || SECRET_CAMEL_CASE_PATTERN.test(key);
|
|
209
|
+
}
|
|
210
|
+
function isPlainObject(value) {
|
|
211
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
const prototype = Object.getPrototypeOf(value);
|
|
215
|
+
return prototype === Object.prototype || prototype === null;
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=canonical-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-contract.js","sourceRoot":"","sources":["../../../src/lib/launch-identity/canonical-contract.ts"],"names":[],"mappings":";;AAsBA,sDAEC;AAED,sDAEC;AAED,gDAwBC;AAED,sDAKC;AAED,wCAKC;AAED,sCAMC;AAED,sEAQC;AAED,4CAWC;AAED,8CAiBC;AAED,gEAyBC;AAED,k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CAAC;IACf,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type CompiledSessionLaunchPlan } from './compiled-session-launch-plan';
|
|
2
|
+
export interface CompiledSessionLaunchPlanStore {
|
|
3
|
+
getByHash(contentHash: string): Promise<CompiledSessionLaunchPlan>;
|
|
4
|
+
putByHash(contentHash: string, plan: CompiledSessionLaunchPlan): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export interface ImmutableCompiledSessionLaunchPlanContentStore {
|
|
7
|
+
read(contentHash: string): Promise<string | undefined>;
|
|
8
|
+
create(contentHash: string, encodedPlan: string): Promise<boolean>;
|
|
9
|
+
}
|
|
10
|
+
export declare class CompiledSessionLaunchPlanMissingError extends Error {
|
|
11
|
+
readonly contentHash: string;
|
|
12
|
+
readonly name = "CompiledSessionLaunchPlanMissingError";
|
|
13
|
+
constructor(contentHash: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class CompiledSessionLaunchPlanAddressMismatchError extends Error {
|
|
16
|
+
readonly expectedHash: string;
|
|
17
|
+
readonly actualHash: string;
|
|
18
|
+
readonly name = "CompiledSessionLaunchPlanAddressMismatchError";
|
|
19
|
+
constructor(expectedHash: string, actualHash: string);
|
|
20
|
+
}
|
|
21
|
+
export declare class CompiledSessionLaunchPlanCollisionError extends Error {
|
|
22
|
+
readonly contentHash: string;
|
|
23
|
+
readonly name = "CompiledSessionLaunchPlanCollisionError";
|
|
24
|
+
constructor(contentHash: string);
|
|
25
|
+
}
|
|
26
|
+
export declare class CompiledSessionLaunchPlanIntegrityError extends Error {
|
|
27
|
+
readonly contentHash: string;
|
|
28
|
+
readonly cause: unknown;
|
|
29
|
+
readonly name = "CompiledSessionLaunchPlanIntegrityError";
|
|
30
|
+
constructor(contentHash: string, cause: unknown);
|
|
31
|
+
}
|
|
32
|
+
export declare class VerifyingCompiledSessionLaunchPlanStore implements CompiledSessionLaunchPlanStore {
|
|
33
|
+
private readonly contentStore;
|
|
34
|
+
constructor(contentStore: ImmutableCompiledSessionLaunchPlanContentStore);
|
|
35
|
+
getByHash(contentHash: string): Promise<CompiledSessionLaunchPlan>;
|
|
36
|
+
putByHash(contentHash: string, plan: CompiledSessionLaunchPlan): Promise<void>;
|
|
37
|
+
private assertSameContent;
|
|
38
|
+
}
|
|
39
|
+
export declare class InMemoryCompiledSessionLaunchPlanContentStore implements ImmutableCompiledSessionLaunchPlanContentStore {
|
|
40
|
+
private readonly values;
|
|
41
|
+
read(contentHash: string): Promise<string | undefined>;
|
|
42
|
+
create(contentHash: string, encodedPlan: string): Promise<boolean>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=compiled-session-launch-plan-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiled-session-launch-plan-store.d.ts","sourceRoot":"","sources":["../../../src/lib/launch-identity/compiled-session-launch-plan-store.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,yBAAyB,EAC/B,MAAM,gCAAgC,CAAC;AAMxC,MAAM,WAAW,8BAA8B;IAC7C,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACnE,SAAS,CACP,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AAMD,MAAM,WAAW,8CAA8C;IAC7D,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACvD,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpE;AAED,qBAAa,qCAAsC,SAAQ,KAAK;IAGlD,QAAQ,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"__esModule", { value: true });
|
|
3
|
+
exports.InMemoryCompiledSessionLaunchPlanContentStore = exports.VerifyingCompiledSessionLaunchPlanStore = exports.CompiledSessionLaunchPlanIntegrityError = exports.CompiledSessionLaunchPlanCollisionError = exports.CompiledSessionLaunchPlanAddressMismatchError = exports.CompiledSessionLaunchPlanMissingError = void 0;
|
|
4
|
+
const canonical_contract_1 = require("./canonical-contract");
|
|
5
|
+
const compiled_session_launch_plan_1 = require("./compiled-session-launch-plan");
|
|
6
|
+
class CompiledSessionLaunchPlanMissingError extends Error {
|
|
7
|
+
contentHash;
|
|
8
|
+
name = 'CompiledSessionLaunchPlanMissingError';
|
|
9
|
+
constructor(contentHash) {
|
|
10
|
+
super(`Compiled session launch plan '${contentHash}' does not exist.`);
|
|
11
|
+
this.contentHash = contentHash;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.CompiledSessionLaunchPlanMissingError = CompiledSessionLaunchPlanMissingError;
|
|
15
|
+
class CompiledSessionLaunchPlanAddressMismatchError extends Error {
|
|
16
|
+
expectedHash;
|
|
17
|
+
actualHash;
|
|
18
|
+
name = 'CompiledSessionLaunchPlanAddressMismatchError';
|
|
19
|
+
constructor(expectedHash, actualHash) {
|
|
20
|
+
super(`Compiled session launch plan address '${expectedHash}' does not match its content hash '${actualHash}'.`);
|
|
21
|
+
this.expectedHash = expectedHash;
|
|
22
|
+
this.actualHash = actualHash;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.CompiledSessionLaunchPlanAddressMismatchError = CompiledSessionLaunchPlanAddressMismatchError;
|
|
26
|
+
class CompiledSessionLaunchPlanCollisionError extends Error {
|
|
27
|
+
contentHash;
|
|
28
|
+
name = 'CompiledSessionLaunchPlanCollisionError';
|
|
29
|
+
constructor(contentHash) {
|
|
30
|
+
super(`Immutable content collision at compiled session launch plan '${contentHash}'.`);
|
|
31
|
+
this.contentHash = contentHash;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.CompiledSessionLaunchPlanCollisionError = CompiledSessionLaunchPlanCollisionError;
|
|
35
|
+
class CompiledSessionLaunchPlanIntegrityError extends Error {
|
|
36
|
+
contentHash;
|
|
37
|
+
cause;
|
|
38
|
+
name = 'CompiledSessionLaunchPlanIntegrityError';
|
|
39
|
+
constructor(contentHash, cause) {
|
|
40
|
+
super(`Compiled session launch plan '${contentHash}' failed content verification.`, { cause });
|
|
41
|
+
this.contentHash = contentHash;
|
|
42
|
+
this.cause = cause;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.CompiledSessionLaunchPlanIntegrityError = CompiledSessionLaunchPlanIntegrityError;
|
|
46
|
+
class VerifyingCompiledSessionLaunchPlanStore {
|
|
47
|
+
contentStore;
|
|
48
|
+
constructor(contentStore) {
|
|
49
|
+
this.contentStore = contentStore;
|
|
50
|
+
}
|
|
51
|
+
async getByHash(contentHash) {
|
|
52
|
+
const hash = (0, canonical_contract_1.requireSha256)(contentHash, 'contentHash');
|
|
53
|
+
const encoded = await this.contentStore.read(hash);
|
|
54
|
+
if (encoded === undefined) {
|
|
55
|
+
throw new CompiledSessionLaunchPlanMissingError(hash);
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
const plan = (0, compiled_session_launch_plan_1.decodeCompiledSessionLaunchPlan)(encoded);
|
|
59
|
+
const actualHash = (0, compiled_session_launch_plan_1.hashCompiledSessionLaunchPlan)(plan);
|
|
60
|
+
if (actualHash !== hash) {
|
|
61
|
+
throw new CompiledSessionLaunchPlanAddressMismatchError(hash, actualHash);
|
|
62
|
+
}
|
|
63
|
+
if ((0, compiled_session_launch_plan_1.encodeCompiledSessionLaunchPlan)(plan) !== encoded) {
|
|
64
|
+
throw new TypeError('Stored launch plan bytes are not in canonical encoding.');
|
|
65
|
+
}
|
|
66
|
+
return plan;
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
throw new CompiledSessionLaunchPlanIntegrityError(hash, error);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async putByHash(contentHash, plan) {
|
|
73
|
+
const hash = (0, canonical_contract_1.requireSha256)(contentHash, 'contentHash');
|
|
74
|
+
const canonicalPlan = (0, compiled_session_launch_plan_1.createCompiledSessionLaunchPlan)(plan);
|
|
75
|
+
const actualHash = (0, compiled_session_launch_plan_1.hashCompiledSessionLaunchPlan)(canonicalPlan);
|
|
76
|
+
if (actualHash !== hash) {
|
|
77
|
+
throw new CompiledSessionLaunchPlanAddressMismatchError(hash, actualHash);
|
|
78
|
+
}
|
|
79
|
+
const encoded = (0, compiled_session_launch_plan_1.encodeCompiledSessionLaunchPlan)(canonicalPlan);
|
|
80
|
+
const existing = await this.contentStore.read(hash);
|
|
81
|
+
if (existing !== undefined) {
|
|
82
|
+
this.assertSameContent(hash, existing, encoded);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const created = await this.contentStore.create(hash, encoded);
|
|
86
|
+
if (created) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const racedExisting = await this.contentStore.read(hash);
|
|
90
|
+
if (racedExisting === undefined) {
|
|
91
|
+
throw new CompiledSessionLaunchPlanIntegrityError(hash, new Error('Immutable content store reported an existing value but returned no content.'));
|
|
92
|
+
}
|
|
93
|
+
this.assertSameContent(hash, racedExisting, encoded);
|
|
94
|
+
}
|
|
95
|
+
assertSameContent(contentHash, existing, expected) {
|
|
96
|
+
if (existing !== expected) {
|
|
97
|
+
throw new CompiledSessionLaunchPlanCollisionError(contentHash);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.VerifyingCompiledSessionLaunchPlanStore = VerifyingCompiledSessionLaunchPlanStore;
|
|
102
|
+
class InMemoryCompiledSessionLaunchPlanContentStore {
|
|
103
|
+
values = new Map();
|
|
104
|
+
async read(contentHash) {
|
|
105
|
+
return this.values.get(contentHash);
|
|
106
|
+
}
|
|
107
|
+
async create(contentHash, encodedPlan) {
|
|
108
|
+
if (this.values.has(contentHash)) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
this.values.set(contentHash, encodedPlan);
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.InMemoryCompiledSessionLaunchPlanContentStore = InMemoryCompiledSessionLaunchPlanContentStore;
|
|
116
|
+
//# sourceMappingURL=compiled-session-launch-plan-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiled-session-launch-plan-store.js","sourceRoot":"","sources":["../../../src/lib/launch-identity/compiled-session-launch-plan-store.ts"],"names":[],"mappings":";;;AAAA,6DAAqD;AACrD,iFAMwC;AAuBxC,MAAa,qCAAsC,SAAQ,KAAK;IAGzC;IAFH,IAAI,GAAG,uCAAuC,CAAC;IAEjE,YAAqB,WAAmB;QACtC,KAAK,CAAC,iCAAiC,WAAW,mBAAmB,CAAC,CAAC;QADpD,gBAAW,GAAX,WAAW,CAAQ;IAExC,CAAC;CACF;AAND,sFAMC;AAED,MAAa,6CAA8C,SAAQ,KAAK;IAI3D;IACA;IAJO,IAAI,GAAG,+CAA+C,CAAC;IAEzE,YACW,YAAoB,EACpB,UAAkB;QAE3B,KAAK,CACH,yCAAyC,YAAY,sCAAsC,UAAU,IAAI,CAC1G,CAAC;QALO,iBAAY,GAAZ,YAAY,CAAQ;QACpB,eAAU,GAAV,UAAU,CAAQ;IAK7B,CAAC;CACF;AAXD,sGAWC;AAED,MAAa,uCAAwC,SAAQ,KAAK;IAG3C;IAFH,IAAI,GAAG,yCAAyC,CAAC;IAEnE,YAAqB,WAAmB;QACtC,KAAK,CACH,gEAAgE,WAAW,IAAI,CAChF,CAAC;QAHiB,gBAAW,GAAX,WAAW,CAAQ;IAIxC,CAAC;CACF;AARD,0FAQC;AAED,MAAa,uCAAwC,SAAQ,KAAK;IAIrD;IACS;IAJF,IAAI,GAAG,yCAAyC,CAAC;IAEnE,YACW,WAAmB,EACV,KAAc;QAEhC,KAAK,CACH,iCAAiC,WAAW,g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AC,IAAI,CAAC,WAAmB;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,WAAmB,EAAE,WAAmB;QACnD,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YACjC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAhBD,sGAgBC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type CanonicalJsonValue } from './canonical-contract';
|
|
2
|
+
import { type RuntimeTemplateKey, RuntimeTemplateTenantDependency, RuntimeTemplateTrustPolicy } from './runtime-template-key';
|
|
3
|
+
export declare enum LaunchPlanBindingSlotKind {
|
|
4
|
+
OrganizationId = "organization-id",
|
|
5
|
+
ProjectId = "project-id",
|
|
6
|
+
UserId = "user-id",
|
|
7
|
+
SessionId = "session-id",
|
|
8
|
+
ThreadId = "thread-id",
|
|
9
|
+
InvocationId = "invocation-id",
|
|
10
|
+
DomainRef = "domain-ref",
|
|
11
|
+
Input = "input",
|
|
12
|
+
DynamicContext = "dynamic-context",
|
|
13
|
+
StorageAllocationRef = "storage-allocation-ref",
|
|
14
|
+
WorkingFileSourceRef = "working-file-source-ref",
|
|
15
|
+
OutputRouteRef = "output-route-ref",
|
|
16
|
+
ActorTokenRef = "actor-token-ref",
|
|
17
|
+
ServiceTokenRef = "service-token-ref",
|
|
18
|
+
ProviderTokenRef = "provider-token-ref",
|
|
19
|
+
CredentialGrantRef = "credential-grant-ref",
|
|
20
|
+
DatabaseGrantRef = "database-grant-ref",
|
|
21
|
+
SecretRef = "secret-ref"
|
|
22
|
+
}
|
|
23
|
+
export declare enum LaunchPlanBindingSlotCardinality {
|
|
24
|
+
One = "one",
|
|
25
|
+
Many = "many"
|
|
26
|
+
}
|
|
27
|
+
export interface LaunchPlanBindingSlot {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly kind: LaunchPlanBindingSlotKind;
|
|
30
|
+
readonly cardinality: LaunchPlanBindingSlotCardinality;
|
|
31
|
+
readonly required: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface PinnedLaunchResource {
|
|
34
|
+
readonly kind: string;
|
|
35
|
+
readonly ref: string;
|
|
36
|
+
readonly revisionRef: string;
|
|
37
|
+
readonly contentHash: string;
|
|
38
|
+
}
|
|
39
|
+
export interface CompiledWorkspaceLaunchPlan {
|
|
40
|
+
readonly manifestRef: string;
|
|
41
|
+
readonly manifestHash: string;
|
|
42
|
+
readonly structure: Readonly<Record<string, CanonicalJsonValue>>;
|
|
43
|
+
readonly layout: Readonly<Record<string, CanonicalJsonValue>>;
|
|
44
|
+
}
|
|
45
|
+
export interface CompiledRuntimeRequirements {
|
|
46
|
+
readonly runtimeRef: string;
|
|
47
|
+
readonly runtimeRevision: string;
|
|
48
|
+
readonly imageDigest: string;
|
|
49
|
+
readonly requirementsHash: string;
|
|
50
|
+
readonly requirements: Readonly<Record<string, CanonicalJsonValue>>;
|
|
51
|
+
}
|
|
52
|
+
export interface LaunchPolicyCompatibility {
|
|
53
|
+
readonly tenantDependency: RuntimeTemplateTenantDependency;
|
|
54
|
+
readonly trustPolicy: RuntimeTemplateTrustPolicy;
|
|
55
|
+
readonly compatibleSurfaces: readonly string[];
|
|
56
|
+
readonly policies: readonly PinnedLaunchResource[];
|
|
57
|
+
}
|
|
58
|
+
export interface CompiledOutputSurfaceSchema {
|
|
59
|
+
readonly kind: string;
|
|
60
|
+
readonly schemaRef: string;
|
|
61
|
+
readonly schemaHash: string;
|
|
62
|
+
readonly schema: Readonly<Record<string, CanonicalJsonValue>>;
|
|
63
|
+
}
|
|
64
|
+
export interface CompiledSessionLaunchPlan {
|
|
65
|
+
readonly schemaVersion: 1;
|
|
66
|
+
readonly runtimeTemplateKey: RuntimeTemplateKey;
|
|
67
|
+
readonly agent: PinnedLaunchResource;
|
|
68
|
+
readonly subagents: readonly PinnedLaunchResource[];
|
|
69
|
+
readonly skills: readonly PinnedLaunchResource[];
|
|
70
|
+
readonly tools: readonly PinnedLaunchResource[];
|
|
71
|
+
readonly mcpDescriptors: readonly PinnedLaunchResource[];
|
|
72
|
+
readonly capabilityDescriptors: readonly PinnedLaunchResource[];
|
|
73
|
+
readonly workspace: CompiledWorkspaceLaunchPlan;
|
|
74
|
+
readonly runtimeRequirements: CompiledRuntimeRequirements;
|
|
75
|
+
readonly policyCompatibility: LaunchPolicyCompatibility;
|
|
76
|
+
readonly outputSurface: CompiledOutputSurfaceSchema;
|
|
77
|
+
readonly bindingSlots: readonly LaunchPlanBindingSlot[];
|
|
78
|
+
}
|
|
79
|
+
export declare function createCompiledSessionLaunchPlan(input: unknown): CompiledSessionLaunchPlan;
|
|
80
|
+
export declare function encodeCompiledSessionLaunchPlan(input: CompiledSessionLaunchPlan): string;
|
|
81
|
+
export declare function decodeCompiledSessionLaunchPlan(encoded: string): CompiledSessionLaunchPlan;
|
|
82
|
+
export declare function hashCompiledSessionLaunchPlan(input: CompiledSessionLaunchPlan): string;
|
|
83
|
+
export declare function hashCompiledWorkspaceLaunchPlan(input: CompiledWorkspaceLaunchPlan): string;
|
|
84
|
+
//# sourceMappingURL=compiled-session-launch-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiled-session-launch-plan.d.ts","sourceRoot":"","sources":["../../../src/lib/launch-identity/compiled-session-launch-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EASxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,kBAAkB,EACvB,+BAA+B,EAC/B,0BAA0B,EAC3B,MAAM,wBAAwB,CAAC;AAEhC,oBAAY,yBAAyB;IACnC,cAAc,oBAAoB;IAClC,SAAS,eAAe;IACxB,MAAM,YAAY;IAClB,SAA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