@xemahq/agent-session-runtime 0.9.0 → 0.10.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.
Files changed (34) hide show
  1. package/LICENSE +176 -0
  2. package/dist/lib/agent-workspace-manifest.js +13 -1
  3. package/dist/lib/agent-workspace-manifest.js.map +1 -1
  4. package/dist/lib/composer.d.ts.map +1 -1
  5. package/dist/lib/composer.js +6 -8
  6. package/dist/lib/composer.js.map +1 -1
  7. package/dist/lib/launch-identity/index.d.ts +0 -4
  8. package/dist/lib/launch-identity/index.d.ts.map +1 -1
  9. package/dist/lib/launch-identity/index.js +0 -4
  10. package/dist/lib/launch-identity/index.js.map +1 -1
  11. package/package.json +19 -19
  12. package/src/lib/agent-workspace-manifest.ts +41 -1
  13. package/src/lib/composer.ts +13 -14
  14. package/src/lib/launch-identity/index.ts +0 -4
  15. package/dist/lib/launch-identity/compiled-session-launch-plan-store.d.ts +0 -44
  16. package/dist/lib/launch-identity/compiled-session-launch-plan-store.d.ts.map +0 -1
  17. package/dist/lib/launch-identity/compiled-session-launch-plan-store.js +0 -116
  18. package/dist/lib/launch-identity/compiled-session-launch-plan-store.js.map +0 -1
  19. package/dist/lib/launch-identity/compiled-session-launch-plan.d.ts +0 -84
  20. package/dist/lib/launch-identity/compiled-session-launch-plan.d.ts.map +0 -1
  21. package/dist/lib/launch-identity/compiled-session-launch-plan.js +0 -382
  22. package/dist/lib/launch-identity/compiled-session-launch-plan.js.map +0 -1
  23. package/dist/lib/launch-identity/preparation-generation.d.ts +0 -26
  24. package/dist/lib/launch-identity/preparation-generation.d.ts.map +0 -1
  25. package/dist/lib/launch-identity/preparation-generation.js +0 -88
  26. package/dist/lib/launch-identity/preparation-generation.js.map +0 -1
  27. package/dist/lib/launch-identity/prepared-launch-variant.d.ts +0 -46
  28. package/dist/lib/launch-identity/prepared-launch-variant.d.ts.map +0 -1
  29. package/dist/lib/launch-identity/prepared-launch-variant.js +0 -118
  30. package/dist/lib/launch-identity/prepared-launch-variant.js.map +0 -1
  31. package/src/lib/launch-identity/compiled-session-launch-plan-store.ts +0 -178
  32. package/src/lib/launch-identity/compiled-session-launch-plan.ts +0 -681
  33. package/src/lib/launch-identity/preparation-generation.ts +0 -171
  34. package/src/lib/launch-identity/prepared-launch-variant.ts +0 -263
@@ -1,44 +0,0 @@
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
@@ -1 +0,0 @@
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,CAAC,WAAW,EAAE,MAAM;IAFxC,SAAkB,IAAI,2CAA2C;gBAE5C,WAAW,EAAE,MAAM;CAGzC;AAED,qBAAa,6CAA8C,SAAQ,KAAK;IAIpE,QAAQ,CAAC,YAAY,EAAE,MAAM;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM;IAJ7B,SAAkB,IAAI,mDAAmD;gBAG9D,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM;CAM9B;AAED,qBAAa,uCAAwC,SAAQ,KAAK;IAGpD,QAAQ,CAAC,WAAW,EAAE,MAAM;IAFxC,SAAkB,IAAI,6CAA6C;gBAE9C,WAAW,EAAE,MAAM;CAKzC;AAED,qBAAa,uCAAwC,SAAQ,KAAK;IAI9D,QAAQ,CAAC,WAAW,EAAE,MAAM;aACV,KAAK,EAAE,OAAO;IAJlC,SAAkB,IAAI,6CAA6C;gBAGxD,WAAW,EAAE,MAAM,EACV,KAAK,EAAE,OAAO;CAOnC;AAOD,qBAAa,uCACX,YAAW,8BAA8B;IAGvC,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAAZ,YAAY,EAAE,8CAA8C;IAGzE,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IA2BlE,SAAS,CACb,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,IAAI,CAAC;IAgChB,OAAO,CAAC,iBAAiB;CAS1B;AAGD,qBAAa,6CACX,YAAW,8CAA8C;IAEzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;IAE9C,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAItD,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAOzE"}
@@ -1,116 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__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
@@ -1 +0,0 @@
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,gCAAgC,EAC5E,EAAE,KAAK,EAAE,CACV,CAAC;QANO,gBAAW,GAAX,WAAW,CAAQ;QACV,UAAK,GAAL,KAAK,CAAS;IAMlC,CAAC;CACF;AAZD,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AC,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"}
@@ -1,84 +0,0 @@
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
@@ -1 +0,0 @@
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,EAUxB,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,SAAS,eAAe;IACxB,QAAQ,cAAc;IACtB,YAAY,kBAAkB;IAC9B,SAAS,eAAe;IACxB,KAAK,UAAU;IACf,cAAc,oBAAoB;IAClC,oBAAoB,2BAA2B;IAC/C,oBAAoB,4BAA4B;IAChD,cAAc,qBAAqB;IACnC,aAAa,oBAAoB;IACjC,eAAe,sBAAsB;IACrC,gBAAgB,uBAAuB;IACvC,kBAAkB,yBAAyB;IAC3C,gBAAgB,uBAAuB;IACvC,SAAS,eAAe;CACzB;AAED,oBAAY,gCAAgC;IAC1C,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,gCAAgC,CAAC;IACvD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC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,CAAC,SAAS,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACpD,QAAQ,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACjD,QAAQ,CAAC,KAAK,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAChD,QAAQ,CAAC,cAAc,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACzD,QAAQ,CAAC,qBAAqB,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAChE,QAAQ,CAAC,SAAS,EAAE,2BAA2B,CAAC;IAChD,QAAQ,CAAC,mBAAmB,EAAE,2BAA2B,CAAC;IAC1D,QAAQ,CAAC,mBAAmB,EAAE,yBAAyB,CAAC;IACxD,QAAQ,CAAC,aAAa,EAAE,2BAA2B,CAAC;IACpD,QAAQ,CAAC,YAAY,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACzD;AA8FD,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,OAAO,GACb,yBAAyB,CA+E3B;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,yBAAyB,GAC/B,MAAM,CAER;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,MAAM,GACd,yBAAyB,CAU3B;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,yBAAyB,GAC/B,MAAM,CAER;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,2BAA2B,GACjC,MAAM,CAER"}
@@ -1,382 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LaunchPlanBindingSlotCardinality = exports.LaunchPlanBindingSlotKind = void 0;
4
- exports.createCompiledSessionLaunchPlan = createCompiledSessionLaunchPlan;
5
- exports.encodeCompiledSessionLaunchPlan = encodeCompiledSessionLaunchPlan;
6
- exports.decodeCompiledSessionLaunchPlan = decodeCompiledSessionLaunchPlan;
7
- exports.hashCompiledSessionLaunchPlan = hashCompiledSessionLaunchPlan;
8
- exports.hashCompiledWorkspaceLaunchPlan = hashCompiledWorkspaceLaunchPlan;
9
- const canonical_contract_1 = require("./canonical-contract");
10
- const runtime_template_key_1 = require("./runtime-template-key");
11
- var LaunchPlanBindingSlotKind;
12
- (function (LaunchPlanBindingSlotKind) {
13
- LaunchPlanBindingSlotKind["OrganizationId"] = "organization-id";
14
- LaunchPlanBindingSlotKind["ProjectId"] = "project-id";
15
- LaunchPlanBindingSlotKind["UserId"] = "user-id";
16
- LaunchPlanBindingSlotKind["SessionId"] = "session-id";
17
- LaunchPlanBindingSlotKind["ThreadId"] = "thread-id";
18
- LaunchPlanBindingSlotKind["InvocationId"] = "invocation-id";
19
- LaunchPlanBindingSlotKind["DomainRef"] = "domain-ref";
20
- LaunchPlanBindingSlotKind["Input"] = "input";
21
- LaunchPlanBindingSlotKind["DynamicContext"] = "dynamic-context";
22
- LaunchPlanBindingSlotKind["StorageAllocationRef"] = "storage-allocation-ref";
23
- LaunchPlanBindingSlotKind["WorkingFileSourceRef"] = "working-file-source-ref";
24
- LaunchPlanBindingSlotKind["OutputRouteRef"] = "output-route-ref";
25
- LaunchPlanBindingSlotKind["ActorTokenRef"] = "actor-token-ref";
26
- LaunchPlanBindingSlotKind["ServiceTokenRef"] = "service-token-ref";
27
- LaunchPlanBindingSlotKind["ProviderTokenRef"] = "provider-token-ref";
28
- LaunchPlanBindingSlotKind["CredentialGrantRef"] = "credential-grant-ref";
29
- LaunchPlanBindingSlotKind["DatabaseGrantRef"] = "database-grant-ref";
30
- LaunchPlanBindingSlotKind["SecretRef"] = "secret-ref";
31
- })(LaunchPlanBindingSlotKind || (exports.LaunchPlanBindingSlotKind = LaunchPlanBindingSlotKind = {}));
32
- var LaunchPlanBindingSlotCardinality;
33
- (function (LaunchPlanBindingSlotCardinality) {
34
- LaunchPlanBindingSlotCardinality["One"] = "one";
35
- LaunchPlanBindingSlotCardinality["Many"] = "many";
36
- })(LaunchPlanBindingSlotCardinality || (exports.LaunchPlanBindingSlotCardinality = LaunchPlanBindingSlotCardinality = {}));
37
- const PLAN_KEYS = [
38
- 'schemaVersion',
39
- 'runtimeTemplateKey',
40
- 'agent',
41
- 'subagents',
42
- 'skills',
43
- 'tools',
44
- 'mcpDescriptors',
45
- 'capabilityDescriptors',
46
- 'workspace',
47
- 'runtimeRequirements',
48
- 'policyCompatibility',
49
- 'outputSurface',
50
- 'bindingSlots',
51
- ];
52
- const RESOURCE_KEYS = ['kind', 'ref', 'revisionRef', 'contentHash'];
53
- const WORKSPACE_KEYS = [
54
- 'manifestRef',
55
- 'manifestHash',
56
- 'structure',
57
- 'layout',
58
- ];
59
- const RUNTIME_REQUIREMENT_KEYS = [
60
- 'runtimeRef',
61
- 'runtimeRevision',
62
- 'imageDigest',
63
- 'requirementsHash',
64
- 'requirements',
65
- ];
66
- const POLICY_KEYS = [
67
- 'tenantDependency',
68
- 'trustPolicy',
69
- 'compatibleSurfaces',
70
- 'policies',
71
- ];
72
- const OUTPUT_SURFACE_KEYS = [
73
- 'kind',
74
- 'schemaRef',
75
- 'schemaHash',
76
- 'schema',
77
- ];
78
- const BINDING_SLOT_KEYS = ['name', 'kind', 'cardinality', 'required'];
79
- const BINDING_SLOT_KINDS = Object.values(LaunchPlanBindingSlotKind);
80
- const BINDING_SLOT_CARDINALITIES = Object.values(LaunchPlanBindingSlotCardinality);
81
- const TENANT_DEPENDENCIES = Object.values(runtime_template_key_1.RuntimeTemplateTenantDependency);
82
- const TRUST_POLICIES = Object.values(runtime_template_key_1.RuntimeTemplateTrustPolicy);
83
- const BINDING_SLOT_NAME_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z][a-z0-9]*)*$/u;
84
- const DYNAMIC_LITERAL_PATTERN = /\$\{\s*(?:input|tenant|org|organization|project|user|session|thread|domain|token|secret|credential)(?:[.:[\]}]|$)/iu;
85
- const SECRET_REFERENCE_PATTERN = /^(?:secret|vault|credential|token)(?:-ref)?:\/\//iu;
86
- const DYNAMIC_FIELD_NAMES = new Set([
87
- 'apikey',
88
- 'authorization',
89
- 'cookie',
90
- 'credential',
91
- 'credentialgrantref',
92
- 'credentialref',
93
- 'databasegrantref',
94
- 'domain',
95
- 'domainid',
96
- 'domainref',
97
- 'input',
98
- 'invocationid',
99
- 'organization',
100
- 'organizationid',
101
- 'org',
102
- 'orgid',
103
- 'password',
104
- 'privatekey',
105
- 'project',
106
- 'projectid',
107
- 'secret',
108
- 'secretref',
109
- 'session',
110
- 'sessionid',
111
- 'storageref',
112
- 'tenant',
113
- 'tenantid',
114
- 'thread',
115
- 'threadid',
116
- 'token',
117
- 'tokenref',
118
- 'user',
119
- 'userid',
120
- 'value',
121
- ]);
122
- const SECRET_OR_CREDENTIAL_FIELD_PATTERN = /(?:apikey|authorization|cookie|credential|password|privatekey|secret|token)(?:ref)?$/u;
123
- function createCompiledSessionLaunchPlan(input) {
124
- const object = (0, canonical_contract_1.requireExactObject)(input, 'CompiledSessionLaunchPlan', PLAN_KEYS);
125
- if (object.schemaVersion !== 1) {
126
- throw new TypeError('CompiledSessionLaunchPlan.schemaVersion must be 1.');
127
- }
128
- const runtimeTemplateKey = (0, runtime_template_key_1.createRuntimeTemplateKey)(object.runtimeTemplateKey);
129
- const agent = requirePinnedResource(object.agent, 'CompiledSessionLaunchPlan.agent');
130
- const subagents = requirePinnedResources(object.subagents, 'CompiledSessionLaunchPlan.subagents');
131
- const skills = requirePinnedResources(object.skills, 'CompiledSessionLaunchPlan.skills');
132
- const tools = requirePinnedResources(object.tools, 'CompiledSessionLaunchPlan.tools');
133
- const mcpDescriptors = requirePinnedResources(object.mcpDescriptors, 'CompiledSessionLaunchPlan.mcpDescriptors');
134
- const capabilityDescriptors = requirePinnedResources(object.capabilityDescriptors, 'CompiledSessionLaunchPlan.capabilityDescriptors');
135
- const workspace = requireWorkspace(object.workspace);
136
- const runtimeRequirements = requireRuntimeRequirements(object.runtimeRequirements);
137
- const policyCompatibility = requirePolicyCompatibility(object.policyCompatibility);
138
- const outputSurface = requireOutputSurface(object.outputSurface);
139
- const bindingSlots = requireBindingSlots(object.bindingSlots);
140
- assertTemplateConsistency({
141
- runtimeTemplateKey,
142
- agent,
143
- subagents,
144
- skills,
145
- tools,
146
- mcpDescriptors,
147
- capabilityDescriptors,
148
- workspace,
149
- runtimeRequirements,
150
- policyCompatibility,
151
- });
152
- assertDeclaredBindingSlotReferences([workspace.structure, workspace.layout, runtimeRequirements.requirements], bindingSlots);
153
- return Object.freeze({
154
- schemaVersion: 1,
155
- runtimeTemplateKey,
156
- agent,
157
- subagents,
158
- skills,
159
- tools,
160
- mcpDescriptors,
161
- capabilityDescriptors,
162
- workspace,
163
- runtimeRequirements,
164
- policyCompatibility,
165
- outputSurface,
166
- bindingSlots,
167
- });
168
- }
169
- function encodeCompiledSessionLaunchPlan(input) {
170
- return (0, canonical_contract_1.canonicalContractJson)(createCompiledSessionLaunchPlan(input));
171
- }
172
- function decodeCompiledSessionLaunchPlan(encoded) {
173
- let parsed;
174
- try {
175
- parsed = JSON.parse(encoded);
176
- }
177
- catch (error) {
178
- throw new TypeError(`CompiledSessionLaunchPlan is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
179
- }
180
- return createCompiledSessionLaunchPlan(parsed);
181
- }
182
- function hashCompiledSessionLaunchPlan(input) {
183
- return (0, canonical_contract_1.hashCanonicalContract)(createCompiledSessionLaunchPlan(input));
184
- }
185
- function hashCompiledWorkspaceLaunchPlan(input) {
186
- return (0, canonical_contract_1.hashCanonicalContract)(input);
187
- }
188
- function requirePinnedResource(value, path) {
189
- const object = (0, canonical_contract_1.requireExactObject)(value, path, RESOURCE_KEYS);
190
- return Object.freeze({
191
- kind: (0, canonical_contract_1.requireNonEmptyString)(object.kind, `${path}.kind`),
192
- ref: (0, canonical_contract_1.requireNonEmptyString)(object.ref, `${path}.ref`),
193
- revisionRef: (0, canonical_contract_1.requireNonEmptyString)(object.revisionRef, `${path}.revisionRef`),
194
- contentHash: (0, canonical_contract_1.requireSha256)(object.contentHash, `${path}.contentHash`),
195
- });
196
- }
197
- function requirePinnedResources(value, path) {
198
- if (!Array.isArray(value)) {
199
- throw new TypeError(`${path} must be an array.`);
200
- }
201
- const resources = value.map((entry, index) => requirePinnedResource(entry, `${path}[${index}]`));
202
- const identities = new Set();
203
- for (const resource of resources) {
204
- const identity = `${resource.kind}\u0000${resource.ref}`;
205
- if (identities.has(identity)) {
206
- throw new TypeError(`${path} contains duplicate resource '${resource.kind}:${resource.ref}'.`);
207
- }
208
- identities.add(identity);
209
- }
210
- return Object.freeze(resources.toSorted((left, right) => (0, canonical_contract_1.canonicalContractJson)(left).localeCompare((0, canonical_contract_1.canonicalContractJson)(right))));
211
- }
212
- function requireWorkspace(value) {
213
- const path = 'CompiledSessionLaunchPlan.workspace';
214
- const object = (0, canonical_contract_1.requireExactObject)(value, path, WORKSPACE_KEYS);
215
- return Object.freeze({
216
- manifestRef: (0, canonical_contract_1.requireNonEmptyString)(object.manifestRef, `${path}.manifestRef`),
217
- manifestHash: (0, canonical_contract_1.requireSha256)(object.manifestHash, `${path}.manifestHash`),
218
- structure: requireStaticPayload(object.structure, `${path}.structure`),
219
- layout: requireStaticPayload(object.layout, `${path}.layout`),
220
- });
221
- }
222
- function requireRuntimeRequirements(value) {
223
- const path = 'CompiledSessionLaunchPlan.runtimeRequirements';
224
- const object = (0, canonical_contract_1.requireExactObject)(value, path, RUNTIME_REQUIREMENT_KEYS);
225
- const imageDigest = (0, canonical_contract_1.requireImageDigest)(object.imageDigest, `${path}.imageDigest`);
226
- const requirements = requireStaticPayload(object.requirements, `${path}.requirements`);
227
- const requirementsHash = (0, canonical_contract_1.requireSha256)(object.requirementsHash, `${path}.requirementsHash`);
228
- assertContentHash(requirementsHash, requirements, `${path}.requirementsHash`);
229
- return Object.freeze({
230
- runtimeRef: (0, canonical_contract_1.requireNonEmptyString)(object.runtimeRef, `${path}.runtimeRef`),
231
- runtimeRevision: (0, canonical_contract_1.requireNonEmptyString)(object.runtimeRevision, `${path}.runtimeRevision`),
232
- imageDigest,
233
- requirementsHash,
234
- requirements,
235
- });
236
- }
237
- function requirePolicyCompatibility(value) {
238
- const path = 'CompiledSessionLaunchPlan.policyCompatibility';
239
- const object = (0, canonical_contract_1.requireExactObject)(value, path, POLICY_KEYS);
240
- return Object.freeze({
241
- tenantDependency: (0, canonical_contract_1.requireEnumValue)(object.tenantDependency, `${path}.tenantDependency`, TENANT_DEPENDENCIES),
242
- trustPolicy: (0, canonical_contract_1.requireEnumValue)(object.trustPolicy, `${path}.trustPolicy`, TRUST_POLICIES),
243
- compatibleSurfaces: (0, canonical_contract_1.requireStringRefs)(object.compatibleSurfaces, `${path}.compatibleSurfaces`),
244
- policies: requirePinnedResources(object.policies, `${path}.policies`),
245
- });
246
- }
247
- function requireOutputSurface(value) {
248
- const path = 'CompiledSessionLaunchPlan.outputSurface';
249
- const object = (0, canonical_contract_1.requireExactObject)(value, path, OUTPUT_SURFACE_KEYS);
250
- const schema = (0, canonical_contract_1.requireCanonicalJsonObject)(object.schema, `${path}.schema`);
251
- const schemaHash = (0, canonical_contract_1.requireSha256)(object.schemaHash, `${path}.schemaHash`);
252
- assertContentHash(schemaHash, schema, `${path}.schemaHash`);
253
- return Object.freeze({
254
- kind: (0, canonical_contract_1.requireNonEmptyString)(object.kind, `${path}.kind`),
255
- schemaRef: (0, canonical_contract_1.requireNonEmptyString)(object.schemaRef, `${path}.schemaRef`),
256
- schemaHash,
257
- schema,
258
- });
259
- }
260
- function requireBindingSlots(value) {
261
- const path = 'CompiledSessionLaunchPlan.bindingSlots';
262
- if (!Array.isArray(value)) {
263
- throw new TypeError(`${path} must be an array.`);
264
- }
265
- const slots = value.map((entry, index) => {
266
- const slotPath = `${path}[${index}]`;
267
- const object = (0, canonical_contract_1.requireExactObject)(entry, slotPath, BINDING_SLOT_KEYS);
268
- const name = (0, canonical_contract_1.requireNonEmptyString)(object.name, `${slotPath}.name`);
269
- if (!BINDING_SLOT_NAME_PATTERN.test(name)) {
270
- throw new TypeError(`${slotPath}.name must be a lowercase dotted or hyphenated identifier.`);
271
- }
272
- return Object.freeze({
273
- name,
274
- kind: (0, canonical_contract_1.requireEnumValue)(object.kind, `${slotPath}.kind`, BINDING_SLOT_KINDS),
275
- cardinality: (0, canonical_contract_1.requireEnumValue)(object.cardinality, `${slotPath}.cardinality`, BINDING_SLOT_CARDINALITIES),
276
- required: (0, canonical_contract_1.requireBoolean)(object.required, `${slotPath}.required`),
277
- });
278
- });
279
- const names = new Set();
280
- for (const slot of slots) {
281
- if (names.has(slot.name)) {
282
- throw new TypeError(`${path} contains duplicate slot '${slot.name}'.`);
283
- }
284
- names.add(slot.name);
285
- }
286
- return Object.freeze(slots.toSorted((left, right) => left.name.localeCompare(right.name)));
287
- }
288
- function requireStaticPayload(value, path) {
289
- const normalized = (0, canonical_contract_1.requireCanonicalJsonObject)(value, path);
290
- assertStaticPayloadNode(normalized, path);
291
- return normalized;
292
- }
293
- function assertStaticPayloadNode(value, path) {
294
- if (typeof value === 'string') {
295
- if (DYNAMIC_LITERAL_PATTERN.test(value) ||
296
- SECRET_REFERENCE_PATTERN.test(value)) {
297
- throw new TypeError(`${path} embeds dynamic or secret data; use a typed $bindingSlot reference.`);
298
- }
299
- return;
300
- }
301
- if (value === null || typeof value !== 'object') {
302
- return;
303
- }
304
- if (Array.isArray(value)) {
305
- value.forEach((entry, index) => assertStaticPayloadNode(entry, `${path}[${index}]`));
306
- return;
307
- }
308
- if (Object.hasOwn(value, '$bindingSlot')) {
309
- const marker = (0, canonical_contract_1.requireExactObject)(value, path, ['$bindingSlot']);
310
- (0, canonical_contract_1.requireNonEmptyString)(marker.$bindingSlot, `${path}.$bindingSlot`);
311
- return;
312
- }
313
- for (const [key, entry] of Object.entries(value)) {
314
- const normalizedKey = key.replaceAll(/[^a-z0-9]/giu, '').toLowerCase();
315
- if (DYNAMIC_FIELD_NAMES.has(normalizedKey) ||
316
- SECRET_OR_CREDENTIAL_FIELD_PATTERN.test(normalizedKey)) {
317
- if (!isBindingSlotMarker(entry)) {
318
- throw new TypeError(`${path}.${key} is dynamic data; its value must be a typed $bindingSlot reference.`);
319
- }
320
- }
321
- assertStaticPayloadNode(entry, `${path}.${key}`);
322
- }
323
- }
324
- function isBindingSlotMarker(value) {
325
- return (value !== null &&
326
- typeof value === 'object' &&
327
- !Array.isArray(value) &&
328
- Object.hasOwn(value, '$bindingSlot'));
329
- }
330
- function assertDeclaredBindingSlotReferences(values, slots) {
331
- const declared = new Set(slots.map((slot) => slot.name));
332
- for (const [index, value] of values.entries()) {
333
- inspectBindingSlotReferences(value, `staticPayloads[${index}]`, declared);
334
- }
335
- }
336
- function inspectBindingSlotReferences(value, path, declared) {
337
- if (value === null || typeof value !== 'object') {
338
- return;
339
- }
340
- if (Array.isArray(value)) {
341
- value.forEach((entry, index) => inspectBindingSlotReferences(entry, `${path}[${index}]`, declared));
342
- return;
343
- }
344
- if (isBindingSlotMarker(value)) {
345
- const name = value.$bindingSlot;
346
- if (typeof name !== 'string' || !declared.has(name)) {
347
- throw new TypeError(`${path} references undeclared binding slot '${String(name)}'.`);
348
- }
349
- return;
350
- }
351
- for (const [key, entry] of Object.entries(value)) {
352
- inspectBindingSlotReferences(entry, `${path}.${key}`, declared);
353
- }
354
- }
355
- function assertTemplateConsistency(input) {
356
- const key = input.runtimeTemplateKey;
357
- assertEqual(input.agent.revisionRef, key.agentRevision, 'agent.revisionRef', 'runtimeTemplateKey.agentRevision');
358
- assertEqual(input.agent.contentHash, key.primaryAgentHash, 'agent.contentHash', 'runtimeTemplateKey.primaryAgentHash');
359
- assertContentHash(key.subagentsHash, input.subagents, 'subagents');
360
- assertContentHash(key.skillsHash, input.skills, 'skills');
361
- assertContentHash(key.toolsHash, input.tools, 'tools');
362
- assertContentHash(key.mcpDescriptorsHash, input.mcpDescriptors, 'mcpDescriptors');
363
- assertContentHash(key.capabilityDescriptorsHash, input.capabilityDescriptors, 'capabilityDescriptors');
364
- assertContentHash(key.workspacePlanHash, input.workspace, 'runtimeTemplateKey.workspacePlanHash');
365
- assertEqual(input.runtimeRequirements.runtimeRef, key.runtimeRef, 'runtimeRequirements.runtimeRef', 'runtimeTemplateKey.runtimeRef');
366
- assertEqual(input.runtimeRequirements.runtimeRevision, key.runtimeRevision, 'runtimeRequirements.runtimeRevision', 'runtimeTemplateKey.runtimeRevision');
367
- assertEqual(input.runtimeRequirements.imageDigest, key.imageDigest, 'runtimeRequirements.imageDigest', 'runtimeTemplateKey.imageDigest');
368
- assertEqual(input.policyCompatibility.tenantDependency, key.tenantDependency, 'policyCompatibility.tenantDependency', 'runtimeTemplateKey.tenantDependency');
369
- assertEqual(input.policyCompatibility.trustPolicy, key.trustPolicy, 'policyCompatibility.trustPolicy', 'runtimeTemplateKey.trustPolicy');
370
- }
371
- function assertContentHash(expectedHash, content, path) {
372
- const actualHash = (0, canonical_contract_1.hashCanonicalContract)(content);
373
- if (actualHash !== expectedHash) {
374
- throw new TypeError(`${path} content hash mismatch: expected '${expectedHash}', computed '${actualHash}'.`);
375
- }
376
- }
377
- function assertEqual(actual, expected, actualPath, expectedPath) {
378
- if (actual !== expected) {
379
- throw new TypeError(`${actualPath} must equal ${expectedPath}; received '${actual}' and '${expected}'.`);
380
- }
381
- }
382
- //# sourceMappingURL=compiled-session-launch-plan.js.map