@techis/ai-runtime 0.0.0-stage → 0.3.0-rc.16

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 (109) hide show
  1. package/LICENSE +122 -0
  2. package/README.md +56 -3
  3. package/THIRD_PARTY_NOTICES +34 -0
  4. package/dist/adapters/gemini.d.ts +3 -0
  5. package/dist/adapters/gemini.d.ts.map +1 -0
  6. package/dist/adapters/gemini.js +85 -0
  7. package/dist/adapters/gemini.js.map +1 -0
  8. package/dist/adapters/http.d.ts +21 -0
  9. package/dist/adapters/http.d.ts.map +1 -0
  10. package/dist/adapters/http.js +86 -0
  11. package/dist/adapters/http.js.map +1 -0
  12. package/dist/adapters/mock.d.ts +40 -0
  13. package/dist/adapters/mock.d.ts.map +1 -0
  14. package/dist/adapters/mock.js +48 -0
  15. package/dist/adapters/mock.js.map +1 -0
  16. package/dist/adapters/moonshot.d.ts +3 -0
  17. package/dist/adapters/moonshot.d.ts.map +1 -0
  18. package/dist/adapters/moonshot.js +46 -0
  19. package/dist/adapters/moonshot.js.map +1 -0
  20. package/dist/adapters/openai.d.ts +4 -0
  21. package/dist/adapters/openai.d.ts.map +1 -0
  22. package/dist/adapters/openai.js +110 -0
  23. package/dist/adapters/openai.js.map +1 -0
  24. package/dist/adapters/registry.d.ts +6 -0
  25. package/dist/adapters/registry.d.ts.map +1 -0
  26. package/dist/adapters/registry.js +39 -0
  27. package/dist/adapters/registry.js.map +1 -0
  28. package/dist/adapters/types.d.ts +60 -0
  29. package/dist/adapters/types.d.ts.map +1 -0
  30. package/dist/adapters/types.js +2 -0
  31. package/dist/adapters/types.js.map +1 -0
  32. package/dist/adapters/zai.d.ts +27 -0
  33. package/dist/adapters/zai.d.ts.map +1 -0
  34. package/dist/adapters/zai.js +111 -0
  35. package/dist/adapters/zai.js.map +1 -0
  36. package/dist/bundle-source-factory.d.ts +4 -0
  37. package/dist/bundle-source-factory.d.ts.map +1 -0
  38. package/dist/bundle-source-factory.js +5 -0
  39. package/dist/bundle-source-factory.js.map +1 -0
  40. package/dist/bundle-source.d.ts +40 -0
  41. package/dist/bundle-source.d.ts.map +1 -0
  42. package/dist/bundle-source.js +167 -0
  43. package/dist/bundle-source.js.map +1 -0
  44. package/dist/catalog-delivery.d.ts +53 -0
  45. package/dist/catalog-delivery.d.ts.map +1 -0
  46. package/dist/catalog-delivery.js +148 -0
  47. package/dist/catalog-delivery.js.map +1 -0
  48. package/dist/client.d.ts +33 -0
  49. package/dist/client.d.ts.map +1 -0
  50. package/dist/client.js +238 -0
  51. package/dist/client.js.map +1 -0
  52. package/dist/cost.d.ts +28 -0
  53. package/dist/cost.d.ts.map +1 -0
  54. package/dist/cost.js +92 -0
  55. package/dist/cost.js.map +1 -0
  56. package/dist/deadline.d.ts +3 -0
  57. package/dist/deadline.d.ts.map +1 -0
  58. package/dist/deadline.js +37 -0
  59. package/dist/deadline.js.map +1 -0
  60. package/dist/errors.d.ts +64 -0
  61. package/dist/errors.d.ts.map +1 -0
  62. package/dist/errors.js +116 -0
  63. package/dist/errors.js.map +1 -0
  64. package/dist/index.d.ts +24 -0
  65. package/dist/index.d.ts.map +1 -0
  66. package/dist/index.js +22 -0
  67. package/dist/index.js.map +1 -0
  68. package/dist/package-updates.d.ts +24 -0
  69. package/dist/package-updates.d.ts.map +1 -0
  70. package/dist/package-updates.js +56 -0
  71. package/dist/package-updates.js.map +1 -0
  72. package/dist/reasoning-resolution.d.ts +33 -0
  73. package/dist/reasoning-resolution.d.ts.map +1 -0
  74. package/dist/reasoning-resolution.js +89 -0
  75. package/dist/reasoning-resolution.js.map +1 -0
  76. package/dist/resolution.d.ts +17 -0
  77. package/dist/resolution.d.ts.map +1 -0
  78. package/dist/resolution.js +94 -0
  79. package/dist/resolution.js.map +1 -0
  80. package/dist/run.d.ts +45 -0
  81. package/dist/run.d.ts.map +1 -0
  82. package/dist/run.js +803 -0
  83. package/dist/run.js.map +1 -0
  84. package/dist/scoped-source.d.ts +20 -0
  85. package/dist/scoped-source.d.ts.map +1 -0
  86. package/dist/scoped-source.js +112 -0
  87. package/dist/scoped-source.js.map +1 -0
  88. package/dist/snapshot.d.ts +40 -0
  89. package/dist/snapshot.d.ts.map +1 -0
  90. package/dist/snapshot.js +234 -0
  91. package/dist/snapshot.js.map +1 -0
  92. package/dist/types.d.ts +244 -0
  93. package/dist/types.d.ts.map +1 -0
  94. package/dist/types.js +15 -0
  95. package/dist/types.js.map +1 -0
  96. package/dist/version.d.ts +9 -0
  97. package/dist/version.d.ts.map +1 -0
  98. package/dist/version.js +9 -0
  99. package/dist/version.js.map +1 -0
  100. package/package.json +24 -4
  101. package/third-party-licenses/ajv-formats@3.0.1/LICENSE +21 -0
  102. package/third-party-licenses/ajv@8.20.0/LICENSE +22 -0
  103. package/third-party-licenses/fast-deep-equal@3.1.3/LICENSE +21 -0
  104. package/third-party-licenses/fast-uri@3.1.7/LICENSE +30 -0
  105. package/third-party-licenses/json-schema-traverse@1.0.0/LICENSE +21 -0
  106. package/third-party-licenses/require-from-string@2.0.2/license +21 -0
  107. package/third-party-licenses/typescript@5.9.3/LICENSE.txt +55 -0
  108. package/third-party-licenses/typescript@5.9.3/ThirdPartyNoticeText.txt +193 -0
  109. package/third-party-licenses.json +102 -0
@@ -0,0 +1,110 @@
1
+ import { InvalidOutputError, ProviderOutputTruncatedError, UnsupportedCapabilityError } from "../errors.js";
2
+ import { callProviderHttp, requireCredentialKind } from "./http.js";
3
+ function translate(model, control) {
4
+ switch (control.mode) {
5
+ case "provider-default":
6
+ return {};
7
+ case "disabled": {
8
+ const levels = model.nativeReasoning.supportedEffortLevels ?? [];
9
+ if (!levels.includes("none")) {
10
+ throw new UnsupportedCapabilityError(`${model.catalogId} cannot represent explicitly disabled reasoning (no "none" effort level)`);
11
+ }
12
+ return { reasoning: { effort: "none" } };
13
+ }
14
+ case "effort":
15
+ return { reasoning: { effort: control.level } };
16
+ case "thinking":
17
+ case "token-budget":
18
+ throw new UnsupportedCapabilityError(`${model.catalogId} exposes effort-based reasoning only; ${control.mode} control is not representable on the OpenAI Responses protocol`);
19
+ case "combined": {
20
+ const settings = {};
21
+ if (control.effort)
22
+ settings.effort = control.effort.level;
23
+ if (control.thinking || control.tokenBudget) {
24
+ throw new UnsupportedCapabilityError(`${model.catalogId} cannot combine effort with thinking or token budget controls`);
25
+ }
26
+ return { reasoning: settings };
27
+ }
28
+ }
29
+ }
30
+ /** OpenAI Responses API adapter. Wire contract unverified against live API; flagged for verification before live enablement. */
31
+ export function createOpenAiResponsesAdapter() {
32
+ return {
33
+ id: "openai-responses",
34
+ version: "0.1.0",
35
+ providers: ["openai"],
36
+ defaultEndpoint: "https://api.openai.com/v1/responses",
37
+ supportedInputModalities: ["text", "image"],
38
+ supportsStructuredOutput: true,
39
+ supportedProviderTools: ["web_search"],
40
+ translateReasoning: translate,
41
+ async execute(request, fetchImpl) {
42
+ requireCredentialKind(request.credential, "bearer", "openai-responses");
43
+ const inputText = typeof request.input === "string" ? request.input : (request.input.text ?? "");
44
+ const content = [{ type: "input_text", text: inputText }];
45
+ for (const image of typeof request.input === "string" ? [] : request.input.images ?? []) {
46
+ content.push({ type: "input_image", image_url: `data:${image.mimeType};base64,${image.dataBase64}`, ...(image.detail ? { detail: image.detail } : {}) });
47
+ }
48
+ const controls = request.operation?.openai;
49
+ const body = {
50
+ model: request.model.providerModelId,
51
+ instructions: request.systemInstructions,
52
+ ...(controls?.store !== undefined ? { store: controls.store } : {}),
53
+ input: [{ role: "user", content }],
54
+ ...(request.nativeSettings.reasoning ? { reasoning: request.nativeSettings.reasoning } : {}),
55
+ ...(request.maxOutputTokens !== undefined ? { max_output_tokens: request.maxOutputTokens } : {}),
56
+ ...(request.temperature !== undefined ? { temperature: request.temperature } : {}),
57
+ ...((request.outputSchema || controls?.verbosity) ? { text: {
58
+ ...(controls?.verbosity ? { verbosity: controls.verbosity } : {}),
59
+ ...(request.outputSchema ? { format: { type: "json_schema", name: controls?.schemaName ?? "output",
60
+ schema: request.outputSchema, strict: controls?.strictSchema ?? false } } : {})
61
+ } } : {}),
62
+ ...(request.operation?.webSearch ? {
63
+ tools: [{ type: "web_search", external_web_access: true,
64
+ ...(controls?.searchContextSize ? { search_context_size: controls.searchContextSize } : {}) }],
65
+ tool_choice: "auto", include: ["web_search_call.action.sources"],
66
+ ...(controls?.maxToolCalls !== undefined ? { max_tool_calls: controls.maxToolCalls } : {})
67
+ } : {})
68
+ };
69
+ const raw = await callProviderHttp(fetchImpl, {
70
+ url: request.endpoint,
71
+ headers: { authorization: `Bearer ${request.credential.token}` },
72
+ body,
73
+ timeoutMs: request.timeoutMs,
74
+ signal: request.signal,
75
+ description: "openai-responses"
76
+ });
77
+ const response = raw;
78
+ if (response.status === "incomplete" && response.incomplete_details?.reason === "max_output_tokens") {
79
+ throw new ProviderOutputTruncatedError("OpenAI response stopped at the requested max_output_tokens limit");
80
+ }
81
+ if (response.status && response.status !== "completed")
82
+ throw new InvalidOutputError("OpenAI response did not complete");
83
+ const texts = [];
84
+ let refusal;
85
+ for (const item of response.output ?? []) {
86
+ for (const part of item.content ?? []) {
87
+ if (part.type === "output_text" && part.text)
88
+ texts.push(part.text);
89
+ if (part.type === "refusal" && part.refusal)
90
+ refusal = part.refusal;
91
+ }
92
+ }
93
+ if (refusal)
94
+ return { output: { kind: "refusal", message: refusal }, providerRequestId: response.id };
95
+ const usage = response.usage;
96
+ return {
97
+ output: { kind: "text", text: texts.join("\n") },
98
+ providerRequestId: response.id,
99
+ usage: usage ? {
100
+ inputTokens: usage.input_tokens,
101
+ outputTokens: usage.output_tokens,
102
+ cachedInputTokens: usage.input_tokens_details?.cached_tokens,
103
+ reasoningTokens: usage.output_tokens_details?.reasoning_tokens,
104
+ ...(request.operation?.webSearch ? { toolCalls: (response.output ?? []).filter(item => item.type === "web_search_call").length } : {})
105
+ } : undefined
106
+ };
107
+ }
108
+ };
109
+ }
110
+ //# sourceMappingURL=openai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai.js","sourceR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AAG,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,iBAAiB,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACvI,CAAC,CAAC,CAAC,SAAS;aACd,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { AdapterRegistry, ProviderAdapter } from "./types.js";
2
+ export declare function defaultAdapters(): ProviderAdapter[];
3
+ export declare function createAdapterRegistry(adapters: ProviderAdapter[]): AdapterRegistry;
4
+ /** Minimal dotted-version comparison (no full semver semantics needed for min-version gates). */
5
+ export declare function satisfiesMinVersion(version: string, minVersion: string): boolean;
6
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/adapters/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOnE,wBAAgB,eAAe,IAAI,eAAe,EAAE,CAOnD;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,eAAe,CAUlF;AAED,iGAAiG;AACjG,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAUhF"}
@@ -0,0 +1,39 @@
1
+ import { ConfigurationInvalidError } from "../errors.js";
2
+ import { createGeminiGenerateContentAdapter } from "./gemini.js";
3
+ import { createMoonshotChatCompletionsAdapter } from "./moonshot.js";
4
+ import { createOpenAiResponsesAdapter } from "./openai.js";
5
+ import { createZaiChatCompletionsAdapter } from "./zai.js";
6
+ export function defaultAdapters() {
7
+ return [
8
+ createOpenAiResponsesAdapter(),
9
+ createZaiChatCompletionsAdapter(),
10
+ createGeminiGenerateContentAdapter(),
11
+ createMoonshotChatCompletionsAdapter()
12
+ ];
13
+ }
14
+ export function createAdapterRegistry(adapters) {
15
+ const byId = new Map();
16
+ for (const adapter of adapters) {
17
+ if (byId.has(adapter.id))
18
+ throw new ConfigurationInvalidError(`Adapter ID "${adapter.id}" is registered more than once`);
19
+ byId.set(adapter.id, adapter);
20
+ }
21
+ return {
22
+ get: (adapterId) => byId.get(adapterId),
23
+ list: () => [...byId.values()]
24
+ };
25
+ }
26
+ /** Minimal dotted-version comparison (no full semver semantics needed for min-version gates). */
27
+ export function satisfiesMinVersion(version, minVersion) {
28
+ const parse = (v) => v.split(".").map((part) => Number.parseInt(part, 10) || 0);
29
+ const [a, b] = [parse(version), parse(minVersion)];
30
+ const length = Math.max(a.length, b.length);
31
+ for (let i = 0; i < length; i++) {
32
+ const av = a[i] ?? 0;
33
+ const bv = b[i] ?? 0;
34
+ if (av !== bv)
35
+ return av > bv;
36
+ }
37
+ return true;
38
+ }
39
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/adapters/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,kCAAkC,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAE3D,MAAM,UAAU,eAAe;IAC7B,OAAO;QACL,4BAA4B,EAAE;QAC9B,+BAA+B,EAAE;QACjC,kCAAkC,EAAE;QACpC,oCAAoC,EAAE;KACvC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAA2B;IAC/D,MAAM,IAAI,GAAG,IAAI,GAAG,EAA2B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YAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,60 @@
1
+ import type { ModelDefinition, NativeReasoningControl, ProviderId, UsageDimensions } from "@techis/ai-contracts";
2
+ import type { Credential, FetchImpl, GenerateInput, OperationSettings } from "../types.js";
3
+ /**
4
+ * Provider-native request fragment produced by translating a reasoning control through a
5
+ * catalog model's declared support. Adapters merge this into their protocol-specific body.
6
+ */
7
+ export interface NativeSettings {
8
+ reasoning?: Record<string, unknown>;
9
+ /** Input modalities the installed adapter can actually carry (distinct from provider capability). */
10
+ notes?: string[];
11
+ }
12
+ export interface AdapterRequest {
13
+ operation?: OperationSettings;
14
+ model: ModelDefinition;
15
+ systemInstructions: string;
16
+ input: GenerateInput;
17
+ outputSchema?: Record<string, unknown>;
18
+ nativeSettings: NativeSettings;
19
+ maxOutputTokens?: number;
20
+ temperature?: number;
21
+ endpoint: string;
22
+ credential: Credential;
23
+ timeoutMs: number;
24
+ signal?: AbortSignal;
25
+ }
26
+ export type AdapterOutput = {
27
+ kind: "text";
28
+ text: string;
29
+ } | {
30
+ kind: "structured";
31
+ value: unknown;
32
+ } | {
33
+ kind: "refusal";
34
+ message: string;
35
+ };
36
+ export interface AdapterResponse {
37
+ output: AdapterOutput;
38
+ usage?: UsageDimensions;
39
+ providerRequestId?: string;
40
+ }
41
+ export interface ProviderAdapter {
42
+ /** Stable adapter identity; catalog models reference it. */
43
+ readonly id: string;
44
+ readonly version: string;
45
+ readonly providers: ProviderId[];
46
+ readonly defaultEndpoint: string;
47
+ /** Modalities this adapter version can carry, independent of what a model supports. */
48
+ readonly supportedInputModalities: import("@techis/ai-contracts").Modality[];
49
+ readonly supportsStructuredOutput: boolean;
50
+ /** Absent means no provider-hosted tools can be carried by this adapter. */
51
+ readonly supportedProviderTools?: readonly string[];
52
+ /** Maps a validated reasoning control to this protocol's native request fields. */
53
+ translateReasoning(model: ModelDefinition, control: NativeReasoningControl): NativeSettings;
54
+ execute(request: AdapterRequest, fetchImpl: FetchImpl): Promise<AdapterResponse>;
55
+ }
56
+ export interface AdapterRegistry {
57
+ get(adapterId: string): ProviderAdapter | undefined;
58
+ list(): ProviderAdapter[];
59
+ }
60
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACjH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE3F;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,qGAAqG;IACrG,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,KAAK,EAAE,eAAe,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,cAAc,EAAE,cAAc,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,UAAU,EAAE,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,uFAAuF;IACvF,QAAQ,CAAC,wBAAwB,EAAE,OAAO,sBAAsB,EAAE,QAAQ,EAAE,CAAC;IAC7E,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAC;IAC3C,4EAA4E;IAC5E,QAAQ,CAAC,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpD,mFAAmF;IACnF,kBAAkB,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,sBAAsB,GAAG,cAAc,CAAC;IAC5F,OAAO,CAAC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAClF;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;IACpD,IAAI,IAAI,eAAe,EAAE,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ import type { AdapterRequest, AdapterResponse, ProviderAdapter } from "./types.js";
2
+ /** Moonshot and Z.AI share the chat-completions wire shape; this builds their common body. */
3
+ export declare function buildChatCompletionsBody(request: AdapterRequest, extra?: Record<string, unknown>): Record<string, unknown>;
4
+ export interface ChatCompletionsResponse {
5
+ id?: string;
6
+ choices?: Array<{
7
+ finish_reason?: string;
8
+ message?: {
9
+ content?: string | Array<{
10
+ type?: string;
11
+ text?: string;
12
+ }>;
13
+ refusal?: string;
14
+ };
15
+ }>;
16
+ usage?: {
17
+ prompt_tokens?: number;
18
+ completion_tokens?: number;
19
+ prompt_tokens_details?: {
20
+ cached_tokens?: number;
21
+ };
22
+ reasoning_tokens?: number;
23
+ };
24
+ }
25
+ export declare function parseChatCompletions(raw: unknown): AdapterResponse;
26
+ export declare function createZaiChatCompletionsAdapter(): ProviderAdapter;
27
+ //# sourceMappingURL=zai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zai.d.ts","sourceRoot":"","sources":["../../src/adapters/zai.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAkB,eAAe,EAAE,MAAM,YAAY,CAAC;AAiCnG,8FAA8F;AAC9F,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkB1H;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;gBAAE,IAAI,CAAC,EAAE,MAAM,CAAC;gBAAC,IAAI,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC,CAAC;IACxI,KAAK,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,qBAAqB,CAAC,EAAE;YAAE,aAAa,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/I;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAyBlE;AAED,wBAAgB,+BAA+B,IAAI,eAAe,CA2BjE"}
@@ -0,0 +1,111 @@
1
+ import { InvalidOutputError, UnsupportedCapabilityError } from "../errors.js";
2
+ import { callProviderHttp, requireCredentialKind } from "./http.js";
3
+ /**
4
+ * Z.AI chat-completions adapter. Mapping follows the ICC observation: GLM-5.3 models expose
5
+ * an effort control; other GLM models expose thinking enable/disable. Wire contract
6
+ * unverified against live API; flagged for verification before live enablement.
7
+ */
8
+ function translate(model, control) {
9
+ switch (control.mode) {
10
+ case "provider-default":
11
+ return {};
12
+ case "disabled":
13
+ if (!model.nativeReasoning.disableSupported) {
14
+ throw new UnsupportedCapabilityError(`${model.catalogId} cannot represent explicitly disabled reasoning`);
15
+ }
16
+ return { reasoning: { thinking: { type: "disabled" } } };
17
+ case "effort":
18
+ if (!model.nativeReasoning.supportedControls.includes("effort")) {
19
+ throw new UnsupportedCapabilityError(`${model.catalogId} does not expose an effort control`);
20
+ }
21
+ return { reasoning: { reasoning_effort: control.level, thinking: { type: "enabled", clear_thinking: true } } };
22
+ case "thinking":
23
+ if (!model.nativeReasoning.supportedControls.includes("thinking")) {
24
+ throw new UnsupportedCapabilityError(`${model.catalogId} does not expose a thinking control`);
25
+ }
26
+ return { reasoning: { thinking: { type: control.enabled ? "enabled" : "disabled" } } };
27
+ case "token-budget":
28
+ throw new UnsupportedCapabilityError(`${model.catalogId} has no token-budget control on the chat-completions protocol`);
29
+ case "combined":
30
+ throw new UnsupportedCapabilityError(`${model.catalogId} cannot combine reasoning controls on the chat-completions protocol`);
31
+ }
32
+ }
33
+ /** Moonshot and Z.AI share the chat-completions wire shape; this builds their common body. */
34
+ export function buildChatCompletionsBody(request, extra) {
35
+ const inputText = typeof request.input === "string" ? request.input : (request.input.text ?? "");
36
+ const images = typeof request.input === "string" ? [] : request.input.images ?? [];
37
+ const userContent = images.length
38
+ ? [{ type: "text", text: inputText }, ...images.map((image) => ({ type: "image_url", image_url: { url: `data:${image.mimeType};base64,${image.dataBase64}` } }))]
39
+ : inputText;
40
+ return {
41
+ model: request.model.providerModelId,
42
+ messages: [
43
+ { role: "system", content: request.outputSchema ? `${request.systemInstructions}\n\nReturn only JSON conforming to this JSON Schema:\n${JSON.stringify(request.outputSchema)}` : request.systemInstructions },
44
+ { role: "user", content: userContent }
45
+ ],
46
+ ...(request.nativeSettings.reasoning ?? {}),
47
+ ...(request.maxOutputTokens !== undefined ? { max_tokens: request.maxOutputTokens } : {}),
48
+ ...(request.temperature !== undefined ? { temperature: request.temperature } : {}),
49
+ ...(request.outputSchema ? { response_format: { type: "json_object" } } : {}),
50
+ ...extra
51
+ };
52
+ }
53
+ export function parseChatCompletions(raw) {
54
+ const response = raw;
55
+ const choice = response.choices?.[0];
56
+ if (choice?.finish_reason && choice.finish_reason !== "stop")
57
+ throw new InvalidOutputError("Chat completion did not finish normally");
58
+ const message = choice?.message;
59
+ if (message?.refusal)
60
+ return { output: { kind: "refusal", message: message.refusal }, providerRequestId: response.id };
61
+ let text;
62
+ if (typeof message?.content === "string") {
63
+ text = message.content;
64
+ }
65
+ else if (Array.isArray(message?.content)) {
66
+ text = message.content.map((part) => part.text ?? "").join("\n");
67
+ }
68
+ else {
69
+ text = "";
70
+ }
71
+ const usage = response.usage;
72
+ return {
73
+ output: { kind: "text", text },
74
+ providerRequestId: response.id,
75
+ usage: usage ? {
76
+ inputTokens: usage.prompt_tokens,
77
+ outputTokens: usage.completion_tokens,
78
+ cachedInputTokens: usage.prompt_tokens_details?.cached_tokens,
79
+ reasoningTokens: usage.reasoning_tokens
80
+ } : undefined
81
+ };
82
+ }
83
+ export function createZaiChatCompletionsAdapter() {
84
+ return {
85
+ id: "zai-chat-completions",
86
+ version: "0.1.0",
87
+ providers: ["zai"],
88
+ defaultEndpoint: "https://api.z.ai/api/paas/v4/chat/completions",
89
+ supportedInputModalities: ["text", "image"],
90
+ supportsStructuredOutput: true,
91
+ supportedProviderTools: ["web_search"],
92
+ translateReasoning: translate,
93
+ async execute(request, fetchImpl) {
94
+ requireCredentialKind(request.credential, "bearer", "zai-chat-completions");
95
+ const raw = await callProviderHttp(fetchImpl, {
96
+ url: request.endpoint,
97
+ headers: { authorization: `Bearer ${request.credential.token}` },
98
+ body: buildChatCompletionsBody(request, request.operation?.webSearch ? {
99
+ tools: [{ type: "web_search", web_search: { enable: "True", search_engine: "search-prime", search_result: "True",
100
+ count: String(request.operation.zai?.searchResultCount ?? 5), search_recency_filter: "noLimit",
101
+ ...(request.operation.zai?.searchContentSize ? { content_size: request.operation.zai.searchContentSize } : {}) } }]
102
+ } : undefined),
103
+ timeoutMs: request.timeoutMs,
104
+ signal: request.signal,
105
+ description: "zai-chat-completions"
106
+ });
107
+ return parseChatCompletions(raw);
108
+ }
109
+ };
110
+ }
111
+ //# sourceMappingURL=zai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zai.js","sourceRoot":"","sources":["../../src/adapters/zai.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAGpE;;;;GAIG;AACH,SAAS,SAAS,CAAC,KAAsB,EAAE,OAA+B;IACxE,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,kBAAkB;YACrB,OAAO,EAAE,CAAC;QACZ,KAAK,UAAU;YACb,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,gBAAgB,EAAE,CAAC;gBAC5C,MAAM,IAAI,0BAA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,aAAa,EAAE,MAAM;gCAC9G,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,iBAAiB,IAAI,CAAC,CAAC,EAAE,qBAAqB,EAAE,SAAS;gCAC9F,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;iBACtH,CAAC,CAAC,CAAC,SAAS,CAAC;gBACd,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,WAAW,EAAE,sBAAsB;aACpC,CAAC,CAAC;YACH,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { BundleSource } from "./types.js";
2
+ /** Constructs a bundle configuration source: `createAIClient({ configurationSource: bundleSource({ directory }) })`. */
3
+ export declare function bundleSource(options: Omit<BundleSource, "kind">): BundleSource;
4
+ //# sourceMappingURL=bundle-source-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle-source-factory.d.ts","sourceRoot":"","sources":["../src/bundle-source-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,wHAAwH;AACxH,wBAAgB,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG,YAAY,CAE9E"}
@@ -0,0 +1,5 @@
1
+ /** Constructs a bundle configuration source: `createAIClient({ configurationSource: bundleSource({ directory }) })`. */
2
+ export function bundleSource(options) {
3
+ return { kind: "bundle", ...options };
4
+ }
5
+ //# sourceMappingURL=bundle-source-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle-source-factory.js","sourceRoot":"","sources":["../src/bundle-source-factory.ts"],"names":[],"mappings":"AAEA,wHAAwH;AACxH,MAAM,UAAU,YAAY,CAAC,OAAmC;IAC9D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC;AACxC,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { type Connection, type VerifiedConfigurationBundle } from "@techis/ai-contracts";
2
+ import type { AdapterRegistry } from "./adapters/types.js";
3
+ import type { ConfigurationSnapshot } from "./types.js";
4
+ /**
5
+ * D2: the first-class runtime bundle loader — loading is verifying.
6
+ *
7
+ * This replaces the host code ICC had to hand-write (EmbeddedModelsHost.loadBundle's hash
8
+ * walk plus its ad-hoc shape checks): the manifest schema, every per-document SHA-256,
9
+ * every document schema (profile schema v2 only), instruction hashes, cross-references,
10
+ * profile compatibility against the installed adapters, the compatibleRuntime declaration
11
+ * and the secrets-excluded invariant are re-verified on every load. Any mismatch fails
12
+ * closed before a single document influences execution. Consumers install only
13
+ * @techis/ai-runtime + @techis/ai-contracts; the verification core lives in contracts
14
+ * and no verifier package enters the consumer dependency graph.
15
+ */
16
+ export interface LoadBundleOptions {
17
+ /** Bundle directory containing manifest.json and the declared documents. */
18
+ directory: string;
19
+ /** Injected file read (tests); defaults to node:fs/promises. Must return exact content. */
20
+ readFile?: (path: string) => Promise<string>;
21
+ /** Adapter registry of the loading runtime; used for profile compatibility checks. */
22
+ registry?: AdapterRegistry;
23
+ }
24
+ /**
25
+ * Reads and fully verifies a configuration bundle from a directory. Throws
26
+ * ConfigurationInvalidError (fail closed) on any hash, schema, cross-reference,
27
+ * compatibility or secrets violation.
28
+ */
29
+ export declare function loadBundle(options: LoadBundleOptions): Promise<VerifiedConfigurationBundle>;
30
+ /**
31
+ * Projects a verified bundle into the runtime's execution view (the same v1 projection
32
+ * scoped-v2 sources use), then re-validates the assembled snapshot for cross-reference
33
+ * consistency. The bundle's content-addressed identity becomes the manifest revision the
34
+ * runtime reports on receipts (D14).
35
+ */
36
+ export declare function projectBundleSnapshot(bundle: VerifiedConfigurationBundle, scope: {
37
+ applicationId: string;
38
+ environmentId: string;
39
+ }, connections?: Connection[]): ConfigurationSnapshot;
40
+ //# sourceMappingURL=bundle-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle-source.d.ts","sourceRoot":"","sources":["../src/bundle-source.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAI9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;IAClB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,sFAAsF;IACtF,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAgCjG;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,2BAA2B,EACnC,KAAK,EAAE;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,EACvD,WAAW,GAAE,UAAU,EAAO,GAC7B,qBAAqB,CAsHvB"}
@@ -0,0 +1,167 @@
1
+ import { readFile as defaultReadFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { verifyConfigurationBundle, hashInstructions, BUNDLE_MANIFEST_FILE } from "@techis/ai-contracts";
4
+ import { ConfigurationInvalidError } from "./errors.js";
5
+ import { validateSnapshot } from "./snapshot.js";
6
+ import { RUNTIME_VERSION } from "./version.js";
7
+ /**
8
+ * Reads and fully verifies a configuration bundle from a directory. Throws
9
+ * ConfigurationInvalidError (fail closed) on any hash, schema, cross-reference,
10
+ * compatibility or secrets violation.
11
+ */
12
+ export async function loadBundle(options) {
13
+ const readFile = options.readFile ?? ((path) => defaultReadFile(path, "utf8"));
14
+ const installedAdapters = {};
15
+ for (const adapter of options.registry?.list() ?? []) {
16
+ installedAdapters[adapter.id] = { version: adapter.version };
17
+ }
18
+ let manifestRaw;
19
+ try {
20
+ manifestRaw = await readFile(join(options.directory, BUNDLE_MANIFEST_FILE));
21
+ }
22
+ catch (error) {
23
+ throw new ConfigurationInvalidError(`Configuration bundle at ${options.directory} has no readable ${BUNDLE_MANIFEST_FILE}: ${error instanceof Error ? error.message : String(error)}.`);
24
+ }
25
+ let manifest;
26
+ try {
27
+ manifest = JSON.parse(manifestRaw);
28
+ }
29
+ catch (error) {
30
+ throw new ConfigurationInvalidError(`Bundle manifest is not valid JSON: ${error instanceof Error ? error.message : String(error)}.`);
31
+ }
32
+ const verification = await verifyConfigurationBundle({
33
+ manifest,
34
+ readDocument: (name) => readFile(join(options.directory, name)),
35
+ runtimeVersion: RUNTIME_VERSION,
36
+ ...(Object.keys(installedAdapters).length > 0 ? { installedAdapters } : {})
37
+ });
38
+ if (!verification.valid || !verification.bundle) {
39
+ throw new ConfigurationInvalidError(`Configuration bundle at ${options.directory} failed verification (loading is verifying): ${verification.errors.join(" | ")}.`);
40
+ }
41
+ return verification.bundle;
42
+ }
43
+ /**
44
+ * Projects a verified bundle into the runtime's execution view (the same v1 projection
45
+ * scoped-v2 sources use), then re-validates the assembled snapshot for cross-reference
46
+ * consistency. The bundle's content-addressed identity becomes the manifest revision the
47
+ * runtime reports on receipts (D14).
48
+ */
49
+ export function projectBundleSnapshot(bundle, scope, connections = []) {
50
+ const personas = {};
51
+ for (const source of bundle.personaSources) {
52
+ if (source.inheritsBinding)
53
+ continue; // sub-personas compose under their parent binding
54
+ personas[source.bindingId] = {
55
+ schemaVersion: 1,
56
+ applicationId: scope.applicationId,
57
+ personaId: source.bindingId,
58
+ name: source.name,
59
+ systemInstructions: source.systemInstructions,
60
+ // v1's numeric instruction version is fixed at 1 in this projection; the exact
61
+ // content hash is the identity (bundle persona sources are hash-revisioned).
62
+ instructionVersion: 1,
63
+ instructionHash: source.instructionHash,
64
+ tools: [],
65
+ inputRequirements: { modalities: ["text"] },
66
+ outputRequirements: { kind: "text" }
67
+ };
68
+ }
69
+ // Sub-personas resolve their parent binding's source so variant-bound runs work
70
+ // without duplicating instruction content (ICC's inheritance pattern).
71
+ for (const source of bundle.personaSources) {
72
+ if (!source.inheritsBinding)
73
+ continue;
74
+ const parent = personas[source.inheritsBinding];
75
+ if (parent)
76
+ personas[source.bindingId] = { ...parent, personaId: source.bindingId, name: source.name };
77
+ }
78
+ for (const [subPersona, parent] of Object.entries(bundle.subPersonaInheritance)) {
79
+ if (personas[subPersona])
80
+ continue;
81
+ const parentSource = personas[parent];
82
+ if (!parentSource) {
83
+ throw new ConfigurationInvalidError(`Bundle sub-persona ${subPersona} inherits unknown parent binding ${parent}.`);
84
+ }
85
+ personas[subPersona] = { ...parentSource, personaId: subPersona };
86
+ }
87
+ // A binding may legitimately ship without a persona source template (verification only
88
+ // warns): its instructions are host-composed through a trusted instructionProjection.
89
+ // Synthesize a deterministic placeholder so the binding resolves; localInstructions can
90
+ // never accidentally match it.
91
+ for (const bindingId of [...Object.keys(bundle.defaultBindings), ...Object.keys(bundle.subPersonaInheritance)]) {
92
+ if (personas[bindingId])
93
+ continue;
94
+ const placeholder = `persona:${bindingId}:instructions-supplied-by-host-projection`;
95
+ personas[bindingId] = {
96
+ schemaVersion: 1,
97
+ applicationId: scope.applicationId,
98
+ personaId: bindingId,
99
+ name: bindingId,
100
+ systemInstructions: placeholder,
101
+ instructionVersion: 1,
102
+ instructionHash: hashInstructions(placeholder),
103
+ tools: [],
104
+ inputRequirements: { modalities: ["text"] },
105
+ outputRequirements: { kind: "text" }
106
+ };
107
+ }
108
+ const profiles = {};
109
+ const profileReferences = {};
110
+ for (const profile of bundle.profiles) {
111
+ profiles[profile.profileId] = profile;
112
+ profileReferences[profile.profileId] = profile.revision;
113
+ }
114
+ const assignmentEntries = [];
115
+ for (const [bindingId, profileId] of Object.entries(bundle.defaultBindings)) {
116
+ const revision = profileReferences[profileId];
117
+ if (!revision) {
118
+ throw new ConfigurationInvalidError(`Bundle default binding ${bindingId} references missing profile ${profileId}.`);
119
+ }
120
+ assignmentEntries.push({ personaId: bindingId, profile: { profileId, revision } });
121
+ }
122
+ for (const [subPersona, parent] of Object.entries(bundle.subPersonaInheritance)) {
123
+ const parentBinding = bundle.defaultBindings[parent];
124
+ if (!parentBinding)
125
+ continue; // already rejected by verification
126
+ assignmentEntries.push({ personaId: subPersona, profile: { profileId: parentBinding, revision: profileReferences[parentBinding] } });
127
+ }
128
+ const manifestRevision = bundle.manifestIdentity;
129
+ const snapshot = {
130
+ manifest: {
131
+ schemaVersion: 1,
132
+ applicationId: scope.applicationId,
133
+ environmentId: scope.environmentId,
134
+ manifestRevision,
135
+ references: {
136
+ catalogRevision: bundle.catalog.catalogRevision,
137
+ priceRevisions: Object.fromEntries(bundle.catalog.models
138
+ .filter((model) => model.activePriceRevisionId)
139
+ .map((model) => [model.catalogId, model.activePriceRevisionId])),
140
+ profiles: profileReferences,
141
+ personas: Object.fromEntries(Object.keys(personas).map((bindingId) => [bindingId, "1"])),
142
+ assignmentRevision: manifestRevision,
143
+ connections
144
+ },
145
+ adapterRequirements: Object.fromEntries([...new Set(bundle.catalog.models.map((model) => model.adapterId))].map((adapterId) => [adapterId, { minVersion: "0.0.0" }])),
146
+ publication: {
147
+ publishedAt: bundle.manifest.provenance.builtAt,
148
+ publishedBy: bundle.manifest.provenance.builtBy
149
+ }
150
+ },
151
+ catalog: bundle.catalog,
152
+ profiles,
153
+ personas,
154
+ assignments: {
155
+ schemaVersion: 1,
156
+ applicationId: scope.applicationId,
157
+ environmentId: scope.environmentId,
158
+ assignmentRevision: manifestRevision,
159
+ entries: assignmentEntries,
160
+ updatedBy: bundle.manifest.provenance.builtBy,
161
+ updatedAt: bundle.manifest.provenance.builtAt
162
+ },
163
+ sourceDescription: `bundle:${bundle.manifest.bundleVersion}:${manifestRevision}`
164
+ };
165
+ return validateSnapshot(snapshot, scope);
166
+ }
167
+ //# sourceMappingURL=bundle-source.js.map