@aopslabs/aops-server 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES +425 -16
- package/THIRD_PARTY_NOTICES.inventory.json +70 -10
- package/build/client/_app/immutable/chunks/B88gKiyt.js +1 -0
- package/build/client/_app/immutable/entry/{app.a0iGCm6X.js → app.DyrORum_.js} +2 -2
- package/build/client/_app/immutable/entry/start.BCM14rdL.js +1 -0
- package/build/client/_app/immutable/nodes/{1.BtbjYUHR.js → 1.DM-iOsKD.js} +1 -1
- package/build/client/_app/version.json +1 -1
- package/build/handler.js +3 -3
- package/build/index.js +3 -3
- package/build/server/chunks/{1-UJuUicIe.js → 1-CbIMYd7N.js} +2 -2
- package/build/server/chunks/{_server.ts-6bdzoHJH.js → _server.ts-5jTLRkY0.js} +17 -6
- package/build/server/chunks/{_server.ts-u2UWBqNN.js → _server.ts-6MVYw3sO.js} +1 -1
- package/build/server/chunks/{_server.ts-DQzYSH_C.js → _server.ts-B7LBExsI.js} +12 -9
- package/build/server/chunks/{_server.ts-o9pJceJP.js → _server.ts-BF5YsxES.js} +1 -1
- package/build/server/chunks/{_server.ts-Ua5Ieisy.js → _server.ts-BUI8oOpK.js} +13 -10
- package/build/server/chunks/{_server.ts-Bz-Erv-1.js → _server.ts-BWMQcP-R.js} +1 -1
- package/build/server/chunks/{_server.ts-CRKd0KAC.js → _server.ts-Bd_TqS-J.js} +13 -10
- package/build/server/chunks/{_server.ts-BX4X0tW0.js → _server.ts-BrEAWHDb.js} +1 -1
- package/build/server/chunks/{_server.ts-DsTeOL2P.js → _server.ts-C1zRNRcN.js} +1 -1
- package/build/server/chunks/{_server.ts-DQWRrk5C.js → _server.ts-CQ436Lhs.js} +1 -1
- package/build/server/chunks/{_server.ts-N61POKjl.js → _server.ts-CX96Yo6-.js} +12 -9
- package/build/server/chunks/{_server.ts-BkxSxdd0.js → _server.ts-CkYsJYFX.js} +29 -68
- package/build/server/chunks/{_server.ts-DaIr3NkR.js → _server.ts-ClhXKSU-.js} +1 -1
- package/build/server/chunks/{_server.ts-B9gjXi95.js → _server.ts-D7mxMg8q.js} +1 -1
- package/build/server/chunks/{_server.ts-CjzSQgpk.js → _server.ts-DHaqrCbN.js} +11 -8
- package/build/server/chunks/{_server.ts-XmKDT59M.js → _server.ts-DbPb54XR.js} +13 -10
- package/build/server/chunks/{_server.ts-De9ZrSV0.js → _server.ts-P-bj5Kfv.js} +12 -9
- package/build/server/chunks/{_server.ts-AwMeEYiZ.js → _server.ts-p6Wxv_wG.js} +1 -1
- package/build/server/chunks/{agent-gateway-runtime-C7Kvvy0H.js → agent-gateway-runtime-DV-xLmJx.js} +39 -4
- package/build/server/chunks/commercial-admission-loader-ZGZHRPLe.js +480 -0
- package/build/server/chunks/{discovery-BvDEgiqC.js → discovery-DL0RzVks.js} +2 -2
- package/build/server/chunks/{error.svelte-B9R6O_Hn.js → error.svelte-BTdVSWca.js} +1 -1
- package/build/server/chunks/{handler-DurXhqww.js → handler-VLy1sI9x.js} +262 -2
- package/build/server/chunks/{hooks.server-DYGrWbgh.js → hooks.server-Zx-k_ERd.js} +1 -1
- package/build/server/chunks/{index.js-BQnOaW3H.js → index.js-CWgll4BT.js} +921 -924
- package/build/server/chunks/{manifest.js-CCJDdahY.js → manifest.js-C2lkmNzz.js} +20 -20
- package/build/server/chunks/{registry-DO8ob5o1.js → registry-DIreA2IZ.js} +132 -268
- package/cockpit/.vite/manifest.json +122 -122
- package/cockpit/community.module-inventory.json +30 -30
- package/host.config.json +140 -0
- package/npm-shrinkwrap.json +64 -2
- package/package.json +8 -2
- package/runtime/commercial-integrity-worker.mjs +8 -1
- package/runtime-closure.package.json +12 -1
- package/build/client/_app/immutable/chunks/BlANKL2r.js +0 -1
- package/build/client/_app/immutable/entry/start.Df7u6fQ1.js +0 -1
- package/build/server/chunks/admission-snapshot-C2wGfTWE.js +0 -1034
- package/build/server/chunks/canonical-text-order-DbXJJnFD.js +0 -5
- package/build/server/chunks/commercial-admission-loader-V_vXHdVa.js +0 -2077
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { j as json } from './index.js-
|
|
2
|
-
import { g as getAgentDiscoveryDocument } from './discovery-
|
|
1
|
+
import { j as json } from './index.js-CWgll4BT.js';
|
|
2
|
+
import { g as getAgentDiscoveryDocument } from './discovery-DL0RzVks.js';
|
|
3
3
|
import { r as resolveRequestBaseUrl } from './request-base-url-zKJpVUv5.js';
|
|
4
|
-
import './agent-gateway-runtime-
|
|
4
|
+
import './agent-gateway-runtime-DV-xLmJx.js';
|
|
5
5
|
import '@aopslabs/host-core';
|
|
6
6
|
import '@aopslabs/manifest';
|
|
7
|
-
import './registry-
|
|
7
|
+
import './registry-DIreA2IZ.js';
|
|
8
|
+
import 'node:fs';
|
|
9
|
+
import 'node:os';
|
|
8
10
|
import 'node:path';
|
|
9
|
-
import 'node:module';
|
|
10
11
|
import 'node:url';
|
|
12
|
+
import '@aopslabs/host-admission';
|
|
13
|
+
import '@aopslabs/host-auth';
|
|
14
|
+
import '@aopslabs/host-shell';
|
|
15
|
+
import 'node:worker_threads';
|
|
16
|
+
import '@aopslabs/artifact-trust-contracts';
|
|
11
17
|
import './aops-runtime-config-CHpDUCdE.js';
|
|
12
|
-
import 'node:fs';
|
|
13
18
|
import 'pg';
|
|
14
|
-
import 'node:worker_threads';
|
|
15
|
-
import './admission-snapshot-C2wGfTWE.js';
|
|
16
|
-
import 'node:crypto';
|
|
17
19
|
import 'node:child_process';
|
|
20
|
+
import 'node:module';
|
|
18
21
|
import 'node:util';
|
|
19
22
|
import './project-alias-BdnRxWft.js';
|
|
20
|
-
import '
|
|
23
|
+
import 'node:crypto';
|
|
21
24
|
import 'ajv';
|
|
22
25
|
import 'zod';
|
|
23
26
|
import './auth-provider-C07OUlnz.js';
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { j as json } from './index.js-
|
|
2
|
-
import { g as getAgentGateway } from './agent-gateway-runtime-
|
|
1
|
+
import { j as json } from './index.js-CWgll4BT.js';
|
|
2
|
+
import { g as getAgentGateway } from './agent-gateway-runtime-DV-xLmJx.js';
|
|
3
3
|
import { r as resolveRequestBaseUrl } from './request-base-url-zKJpVUv5.js';
|
|
4
4
|
import { g as getAuthProvider, i as isTrustedLocalAuthProvider } from './auth-provider-C07OUlnz.js';
|
|
5
5
|
import '@aopslabs/host-core';
|
|
6
6
|
import '@aopslabs/manifest';
|
|
7
|
-
import './registry-
|
|
7
|
+
import './registry-DIreA2IZ.js';
|
|
8
|
+
import 'node:fs';
|
|
9
|
+
import 'node:os';
|
|
8
10
|
import 'node:path';
|
|
9
|
-
import 'node:module';
|
|
10
11
|
import 'node:url';
|
|
12
|
+
import '@aopslabs/host-admission';
|
|
13
|
+
import '@aopslabs/host-auth';
|
|
14
|
+
import '@aopslabs/host-shell';
|
|
15
|
+
import 'node:worker_threads';
|
|
16
|
+
import '@aopslabs/artifact-trust-contracts';
|
|
11
17
|
import './aops-runtime-config-CHpDUCdE.js';
|
|
12
|
-
import 'node:fs';
|
|
13
18
|
import 'pg';
|
|
14
|
-
import 'node:worker_threads';
|
|
15
|
-
import './admission-snapshot-C2wGfTWE.js';
|
|
16
|
-
import 'node:crypto';
|
|
17
19
|
import 'node:child_process';
|
|
20
|
+
import 'node:module';
|
|
18
21
|
import 'node:util';
|
|
19
22
|
import './project-alias-BdnRxWft.js';
|
|
20
|
-
import '
|
|
23
|
+
import 'node:crypto';
|
|
21
24
|
import 'ajv';
|
|
22
25
|
import 'zod';
|
|
23
26
|
|
package/build/server/chunks/{agent-gateway-runtime-C7Kvvy0H.js → agent-gateway-runtime-DV-xLmJx.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { dispatchDomainRequest } from '@aopslabs/host-core';
|
|
2
2
|
import { buildAgentGatewayOpenApi, buildFederatedToolCatalog, validateManifest } from '@aopslabs/manifest';
|
|
3
|
-
import { g as getHostConfig,
|
|
3
|
+
import { g as getHostConfig, a as getKernelRuntimeSnapshot, f as checkHostDomainAdmission, h as resetHostPluginRegistry, e as getHostPluginRegistry } from './registry-DIreA2IZ.js';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { execFile } from 'node:child_process';
|
|
6
6
|
import { createRequire } from 'node:module';
|
|
@@ -8,8 +8,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
8
8
|
import { promisify } from 'node:util';
|
|
9
9
|
import { g as getLogger, h as hasProjectAliasValue } from './project-alias-BdnRxWft.js';
|
|
10
10
|
import { createHash } from 'node:crypto';
|
|
11
|
-
import {
|
|
12
|
-
import './admission-snapshot-C2wGfTWE.js';
|
|
11
|
+
import { compareCanonicalText } from '@aopslabs/artifact-trust-contracts';
|
|
13
12
|
import Ajv from 'ajv';
|
|
14
13
|
import { z } from 'zod';
|
|
15
14
|
|
|
@@ -2610,5 +2609,41 @@ function getAgentGatewayDiagnostics() {
|
|
|
2610
2609
|
errorCount: 0
|
|
2611
2610
|
};
|
|
2612
2611
|
}
|
|
2612
|
+
function normalize(value) {
|
|
2613
|
+
return String(value ?? "").trim().toLowerCase();
|
|
2614
|
+
}
|
|
2615
|
+
async function invokeKernelAgentTool(args) {
|
|
2616
|
+
const catalogGateway = getAgentGateway();
|
|
2617
|
+
const catalog = await catalogGateway.listTools();
|
|
2618
|
+
const catalogTool = catalog.tools.find((tool) => normalize(tool.toolId) === normalize(args.toolId));
|
|
2619
|
+
if (!catalogTool) throw new Error(`tool_not_found:${args.toolId}`);
|
|
2620
|
+
const snapshot = await getKernelRuntimeSnapshot();
|
|
2621
|
+
const plugin = snapshot.registry.get(normalize(catalogTool.domain));
|
|
2622
|
+
if (!plugin) throw new Error(`domain_not_registered:${catalogTool.domain}`);
|
|
2623
|
+
const route = plugin.manifest.routes.find(
|
|
2624
|
+
(candidate) => normalize(candidate.operation) === normalize(catalogTool.operationId)
|
|
2625
|
+
);
|
|
2626
|
+
if (!route) {
|
|
2627
|
+
throw new Error(`operation_route_not_found:${catalogTool.domain}:${catalogTool.operationId}`);
|
|
2628
|
+
}
|
|
2629
|
+
const routeId = normalize(route.id);
|
|
2630
|
+
const kernelToolId = routeId.startsWith(`${normalize(catalogTool.domain)}.`) ? routeId : `${normalize(catalogTool.domain)}.${routeId}`;
|
|
2631
|
+
const result = await snapshot.gateway.invokeTool({
|
|
2632
|
+
toolId: kernelToolId,
|
|
2633
|
+
envelope: args.envelope,
|
|
2634
|
+
context: args.context,
|
|
2635
|
+
...args.requestHeaders ? { requestHeaders: args.requestHeaders } : {}
|
|
2636
|
+
});
|
|
2637
|
+
return {
|
|
2638
|
+
tool: {
|
|
2639
|
+
...catalogTool,
|
|
2640
|
+
sourceId: result.tool.sourceId,
|
|
2641
|
+
sourceKind: "local-route"
|
|
2642
|
+
},
|
|
2643
|
+
status: result.status,
|
|
2644
|
+
data: result.data,
|
|
2645
|
+
...result.headers ? { headers: result.headers } : {}
|
|
2646
|
+
};
|
|
2647
|
+
}
|
|
2613
2648
|
|
|
2614
|
-
export { normalizeToolId as a, getAgentGatewayDiagnostics as b, getAgentGateway as g, normalizeDomain as n, resolveOperationKind as r };
|
|
2649
|
+
export { normalizeToolId as a, getAgentGatewayDiagnostics as b, getAgentGateway as g, invokeKernelAgentTool as i, normalizeDomain as n, resolveOperationKind as r };
|
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
import { readVerifiedActiveCommercialArtifact, verifyEntitlementLease, buildAdmittedDomainSnapshot, RELEASE_MANIFEST_PURPOSE, readCommercialIntegrityVerificationSchedule, createInstallationPossessionProof, verifyInstallationPossessionProof, resolveManagedInstallationLayout, ENTITLEMENT_LEASE_PURPOSE, ENTITLEMENT_LEASE_ALGORITHM } from '@aopslabs/artifact-trust-contracts';
|
|
2
|
+
import { randomBytes, randomUUID } from 'node:crypto';
|
|
3
|
+
import { readFileSync, lstatSync, realpathSync } from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
function commercialIntegrityReadOptions(storeRoot, requestedMode = "routine") {
|
|
7
|
+
const layout = resolveManagedInstallationLayout();
|
|
8
|
+
if (path.resolve(storeRoot) !== path.resolve(layout.storeRoot)) {
|
|
9
|
+
if (requestedMode === "scheduled") {
|
|
10
|
+
throw new Error("commercial_integrity_scheduler_requires_managed_store");
|
|
11
|
+
}
|
|
12
|
+
return Object.freeze({ verificationMode: "full" });
|
|
13
|
+
}
|
|
14
|
+
return Object.freeze({
|
|
15
|
+
integrityStateRoot: layout.stateRoot,
|
|
16
|
+
verificationMode: requestedMode
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const CONFIG_KEYS_V1 = Object.freeze([
|
|
20
|
+
"domain",
|
|
21
|
+
"entitlementEpoch",
|
|
22
|
+
"extensionNamespace",
|
|
23
|
+
"hostInstanceId",
|
|
24
|
+
"installationId",
|
|
25
|
+
"issuer",
|
|
26
|
+
"leaseFile",
|
|
27
|
+
"leaseMode",
|
|
28
|
+
"leaseTrustBundle",
|
|
29
|
+
"minimumRevocationEpoch",
|
|
30
|
+
"objectType",
|
|
31
|
+
"productId",
|
|
32
|
+
"releaseTrustBundle",
|
|
33
|
+
"schemaVersion",
|
|
34
|
+
"storeRoot",
|
|
35
|
+
"tenantId",
|
|
36
|
+
"target"
|
|
37
|
+
]);
|
|
38
|
+
const CONFIG_KEYS_V2 = Object.freeze([
|
|
39
|
+
...CONFIG_KEYS_V1,
|
|
40
|
+
"activationChallengeDigest",
|
|
41
|
+
"installationKeyThumbprint",
|
|
42
|
+
"installationPrivateKeyFile"
|
|
43
|
+
]);
|
|
44
|
+
const SHA256_HEX = /^[a-f0-9]{64}$/;
|
|
45
|
+
function isRecord(value) {
|
|
46
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
47
|
+
}
|
|
48
|
+
function exactKeys(value, expected, reason) {
|
|
49
|
+
const actual = Object.keys(value).sort();
|
|
50
|
+
const sorted = [...expected].sort();
|
|
51
|
+
if (actual.length !== sorted.length || actual.some((key, index) => key !== sorted[index])) {
|
|
52
|
+
throw new Error(reason);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function text(value, reason) {
|
|
56
|
+
if (typeof value !== "string" || value !== value.trim() || value.length === 0) {
|
|
57
|
+
throw new Error(reason);
|
|
58
|
+
}
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
function nullableInteger(value, reason) {
|
|
62
|
+
if (value === null) return null;
|
|
63
|
+
if (!Number.isSafeInteger(value) || Number(value) < 0) throw new Error(reason);
|
|
64
|
+
return Number(value);
|
|
65
|
+
}
|
|
66
|
+
function sha256(value, reason) {
|
|
67
|
+
const normalized = text(value, reason);
|
|
68
|
+
if (!SHA256_HEX.test(normalized)) throw new Error(reason);
|
|
69
|
+
return normalized;
|
|
70
|
+
}
|
|
71
|
+
function digestHex(value, reason) {
|
|
72
|
+
const normalized = value.startsWith("sha256:") ? value.slice("sha256:".length) : value;
|
|
73
|
+
if (!SHA256_HEX.test(normalized)) throw new Error(reason);
|
|
74
|
+
return normalized;
|
|
75
|
+
}
|
|
76
|
+
function safeRegularFile(filePath, reason) {
|
|
77
|
+
if (!path.isAbsolute(filePath)) throw new Error(reason);
|
|
78
|
+
try {
|
|
79
|
+
const stat = lstatSync(filePath);
|
|
80
|
+
if (stat.isSymbolicLink() || !stat.isFile()) throw new Error(reason);
|
|
81
|
+
return realpathSync.native(filePath);
|
|
82
|
+
} catch {
|
|
83
|
+
throw new Error(reason);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function verifyOfflineInstallationPossessionAtLoad(input) {
|
|
87
|
+
const privateKeyPem = readFileSync(
|
|
88
|
+
safeRegularFile(
|
|
89
|
+
input.installationPrivateKeyFile,
|
|
90
|
+
"commercial_installation_private_key_invalid"
|
|
91
|
+
),
|
|
92
|
+
"utf8"
|
|
93
|
+
);
|
|
94
|
+
const nonce = randomBytes(32).toString("base64url");
|
|
95
|
+
const iat = Math.floor(input.now.getTime() / 1e3);
|
|
96
|
+
const manifestDigest = digestHex(
|
|
97
|
+
input.receipt.manifestDigest,
|
|
98
|
+
"commercial_installation_possession_invalid"
|
|
99
|
+
);
|
|
100
|
+
const closureDigest = digestHex(
|
|
101
|
+
input.receipt.closureDigest,
|
|
102
|
+
"commercial_installation_possession_invalid"
|
|
103
|
+
);
|
|
104
|
+
try {
|
|
105
|
+
const proof = createInstallationPossessionProof({
|
|
106
|
+
privateKeyPem,
|
|
107
|
+
proofId: randomUUID(),
|
|
108
|
+
nonce,
|
|
109
|
+
installationId: input.installationId,
|
|
110
|
+
hostInstanceId: input.hostInstanceId,
|
|
111
|
+
leaseToken: input.leaseToken,
|
|
112
|
+
activationChallengeDigest: input.activationChallengeDigest,
|
|
113
|
+
receiptBinding: {
|
|
114
|
+
receiptId: input.receipt.receiptId,
|
|
115
|
+
releaseId: input.receipt.releaseId,
|
|
116
|
+
manifestDigest,
|
|
117
|
+
closureDigest
|
|
118
|
+
},
|
|
119
|
+
iat,
|
|
120
|
+
exp: iat + 2 * 60
|
|
121
|
+
});
|
|
122
|
+
verifyInstallationPossessionProof({
|
|
123
|
+
token: proof.token,
|
|
124
|
+
now: input.now,
|
|
125
|
+
expected: {
|
|
126
|
+
nonce,
|
|
127
|
+
installationId: input.installationId,
|
|
128
|
+
hostInstanceId: input.hostInstanceId,
|
|
129
|
+
installationKeyThumbprint: input.installationKeyThumbprint,
|
|
130
|
+
leaseToken: input.leaseToken,
|
|
131
|
+
activationChallengeDigest: input.activationChallengeDigest,
|
|
132
|
+
receiptId: input.receipt.receiptId,
|
|
133
|
+
releaseId: input.receipt.releaseId,
|
|
134
|
+
manifestDigest,
|
|
135
|
+
closureDigest
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
} catch {
|
|
139
|
+
throw new Error("commercial_installation_possession_invalid");
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function safeRuntimeEntrypoint(storeRoot, relativePath) {
|
|
143
|
+
if (!path.isAbsolute(storeRoot) || path.isAbsolute(relativePath) || relativePath.split(/[\\/]/u).some((segment) => !segment || segment === "." || segment === "..")) throw new Error("commercial_runtime_entrypoint_invalid");
|
|
144
|
+
const root = realpathSync.native(storeRoot);
|
|
145
|
+
const candidate = path.resolve(root, relativePath);
|
|
146
|
+
const relative = path.relative(root, candidate);
|
|
147
|
+
if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) {
|
|
148
|
+
throw new Error("commercial_runtime_entrypoint_invalid");
|
|
149
|
+
}
|
|
150
|
+
const real = safeRegularFile(candidate, "commercial_runtime_entrypoint_invalid");
|
|
151
|
+
const realRelative = path.relative(root, real);
|
|
152
|
+
if (!realRelative || realRelative.startsWith("..") || path.isAbsolute(realRelative)) {
|
|
153
|
+
throw new Error("commercial_runtime_entrypoint_invalid");
|
|
154
|
+
}
|
|
155
|
+
return real;
|
|
156
|
+
}
|
|
157
|
+
function parseJsonFile(filePath, reason) {
|
|
158
|
+
try {
|
|
159
|
+
return JSON.parse(readFileSync(safeRegularFile(filePath, reason), "utf8"));
|
|
160
|
+
} catch (error) {
|
|
161
|
+
if (error instanceof Error && error.message === reason) throw error;
|
|
162
|
+
throw new Error(reason);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function parseConfig(filePath) {
|
|
166
|
+
const value = parseJsonFile(filePath, "commercial_admission_config_invalid");
|
|
167
|
+
if (!isRecord(value)) throw new Error("commercial_admission_config_invalid");
|
|
168
|
+
const schemaVersion = value.schemaVersion;
|
|
169
|
+
if (schemaVersion !== 1 && schemaVersion !== 2 || value.objectType !== `aops-commercial-admission-config-v${schemaVersion}`) throw new Error("commercial_admission_config_invalid");
|
|
170
|
+
exactKeys(
|
|
171
|
+
value,
|
|
172
|
+
schemaVersion === 1 ? CONFIG_KEYS_V1 : CONFIG_KEYS_V2,
|
|
173
|
+
"commercial_admission_config_invalid"
|
|
174
|
+
);
|
|
175
|
+
const leaseMode = value.leaseMode;
|
|
176
|
+
if (leaseMode !== null && leaseMode !== "online" && leaseMode !== "offline") {
|
|
177
|
+
throw new Error("commercial_admission_config_invalid");
|
|
178
|
+
}
|
|
179
|
+
if (schemaVersion === 2 && leaseMode !== "offline") {
|
|
180
|
+
throw new Error("commercial_admission_config_invalid");
|
|
181
|
+
}
|
|
182
|
+
return Object.freeze({
|
|
183
|
+
schemaVersion,
|
|
184
|
+
target: text(value.target, "commercial_admission_config_invalid"),
|
|
185
|
+
storeRoot: text(value.storeRoot, "commercial_admission_config_invalid"),
|
|
186
|
+
releaseTrustBundle: text(value.releaseTrustBundle, "commercial_admission_config_invalid"),
|
|
187
|
+
leaseFile: text(value.leaseFile, "commercial_admission_config_invalid"),
|
|
188
|
+
leaseTrustBundle: text(value.leaseTrustBundle, "commercial_admission_config_invalid"),
|
|
189
|
+
issuer: text(value.issuer, "commercial_admission_config_invalid"),
|
|
190
|
+
tenantId: text(value.tenantId, "commercial_admission_config_invalid"),
|
|
191
|
+
installationId: text(value.installationId, "commercial_admission_config_invalid"),
|
|
192
|
+
hostInstanceId: text(value.hostInstanceId, "commercial_admission_config_invalid"),
|
|
193
|
+
productId: text(value.productId, "commercial_admission_config_invalid"),
|
|
194
|
+
domain: text(value.domain, "commercial_admission_config_invalid").toLowerCase(),
|
|
195
|
+
extensionNamespace: text(value.extensionNamespace, "commercial_admission_config_invalid"),
|
|
196
|
+
entitlementEpoch: nullableInteger(value.entitlementEpoch, "commercial_admission_config_invalid"),
|
|
197
|
+
minimumRevocationEpoch: nullableInteger(
|
|
198
|
+
value.minimumRevocationEpoch,
|
|
199
|
+
"commercial_admission_config_invalid"
|
|
200
|
+
),
|
|
201
|
+
leaseMode,
|
|
202
|
+
activationChallengeDigest: schemaVersion === 1 ? null : sha256(value.activationChallengeDigest, "commercial_admission_config_invalid"),
|
|
203
|
+
installationKeyThumbprint: schemaVersion === 1 ? null : sha256(value.installationKeyThumbprint, "commercial_admission_config_invalid"),
|
|
204
|
+
installationPrivateKeyFile: schemaVersion === 1 ? null : text(value.installationPrivateKeyFile, "commercial_admission_config_invalid")
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function parseReleaseTrustBundleFile(filePath) {
|
|
208
|
+
const value = parseJsonFile(filePath, "release_trust_bundle_invalid");
|
|
209
|
+
if (!isRecord(value)) throw new Error("release_trust_bundle_invalid");
|
|
210
|
+
exactKeys(
|
|
211
|
+
value,
|
|
212
|
+
["schemaVersion", "objectType", "purpose", "keys"],
|
|
213
|
+
"release_trust_bundle_invalid"
|
|
214
|
+
);
|
|
215
|
+
if (value.schemaVersion !== 1 || value.objectType !== "aops-release-trust-bundle-v1" || value.purpose !== RELEASE_MANIFEST_PURPOSE || !Array.isArray(value.keys) || value.keys.length === 0) throw new Error("release_trust_bundle_invalid");
|
|
216
|
+
const keys = value.keys.map((candidate) => {
|
|
217
|
+
if (!isRecord(candidate)) throw new Error("release_trust_bundle_invalid");
|
|
218
|
+
const actualKeys = Object.keys(candidate).sort();
|
|
219
|
+
const legacyKeys = ["alg", "kid", "publicKeyPem", "purpose"];
|
|
220
|
+
const rotatingKeys = [
|
|
221
|
+
"alg",
|
|
222
|
+
"kid",
|
|
223
|
+
"notAfter",
|
|
224
|
+
"notBefore",
|
|
225
|
+
"publicKeyPem",
|
|
226
|
+
"purpose",
|
|
227
|
+
"status"
|
|
228
|
+
];
|
|
229
|
+
const rotating = actualKeys.length === rotatingKeys.length && actualKeys.every((key, index) => key === rotatingKeys[index]);
|
|
230
|
+
if (!rotating && (actualKeys.length !== legacyKeys.length || actualKeys.some((key, index) => key !== legacyKeys[index]))) throw new Error("release_trust_bundle_invalid");
|
|
231
|
+
if (candidate.alg !== "EdDSA" || candidate.purpose !== RELEASE_MANIFEST_PURPOSE || typeof candidate.kid !== "string" || typeof candidate.publicKeyPem !== "string" || rotating && !["active", "verify-only", "retired", "revoked"].includes(
|
|
232
|
+
String(candidate.status)
|
|
233
|
+
) || rotating && candidate.notBefore !== null && typeof candidate.notBefore !== "string" || rotating && candidate.notAfter !== null && typeof candidate.notAfter !== "string") throw new Error("release_trust_bundle_invalid");
|
|
234
|
+
if (candidate.kid.toLowerCase().includes("test-ephemeral")) {
|
|
235
|
+
throw new Error("release_trust_test_key_refused");
|
|
236
|
+
}
|
|
237
|
+
return Object.freeze({
|
|
238
|
+
alg: "EdDSA",
|
|
239
|
+
purpose: RELEASE_MANIFEST_PURPOSE,
|
|
240
|
+
kid: candidate.kid,
|
|
241
|
+
publicKeyPem: candidate.publicKeyPem,
|
|
242
|
+
...rotating ? {
|
|
243
|
+
status: candidate.status,
|
|
244
|
+
...candidate.notBefore === null ? {} : { notBefore: candidate.notBefore },
|
|
245
|
+
...candidate.notAfter === null ? {} : { notAfter: candidate.notAfter }
|
|
246
|
+
} : {}
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
if (new Set(keys.map((key) => key.kid)).size !== keys.length) {
|
|
250
|
+
throw new Error("release_trust_bundle_invalid");
|
|
251
|
+
}
|
|
252
|
+
return Object.freeze(keys);
|
|
253
|
+
}
|
|
254
|
+
function parseLeaseTrustBundle(filePath) {
|
|
255
|
+
const value = parseJsonFile(filePath, "lease_trust_bundle_invalid");
|
|
256
|
+
if (!isRecord(value)) throw new Error("lease_trust_bundle_invalid");
|
|
257
|
+
exactKeys(
|
|
258
|
+
value,
|
|
259
|
+
["schemaVersion", "objectType", "purpose", "keys"],
|
|
260
|
+
"lease_trust_bundle_invalid"
|
|
261
|
+
);
|
|
262
|
+
if (value.schemaVersion !== 1 || value.objectType !== "aops-entitlement-lease-trust-bundle-v1" || value.purpose !== ENTITLEMENT_LEASE_PURPOSE || !Array.isArray(value.keys) || value.keys.length === 0) throw new Error("lease_trust_bundle_invalid");
|
|
263
|
+
const keys = value.keys.map((candidate) => {
|
|
264
|
+
if (!isRecord(candidate)) throw new Error("lease_trust_bundle_invalid");
|
|
265
|
+
exactKeys(
|
|
266
|
+
candidate,
|
|
267
|
+
["alg", "kid", "notAfter", "notBefore", "publicKeyPem", "purpose", "status"],
|
|
268
|
+
"lease_trust_bundle_invalid"
|
|
269
|
+
);
|
|
270
|
+
if (candidate.alg !== ENTITLEMENT_LEASE_ALGORITHM || candidate.purpose !== ENTITLEMENT_LEASE_PURPOSE || typeof candidate.kid !== "string" || typeof candidate.publicKeyPem !== "string" || candidate.status !== "active" && candidate.status !== "verify-only" || candidate.notBefore !== null && typeof candidate.notBefore !== "string" || candidate.notAfter !== null && typeof candidate.notAfter !== "string") throw new Error("lease_trust_bundle_invalid");
|
|
271
|
+
return Object.freeze({
|
|
272
|
+
alg: ENTITLEMENT_LEASE_ALGORITHM,
|
|
273
|
+
purpose: ENTITLEMENT_LEASE_PURPOSE,
|
|
274
|
+
kid: candidate.kid,
|
|
275
|
+
publicKeyPem: candidate.publicKeyPem,
|
|
276
|
+
status: candidate.status,
|
|
277
|
+
...candidate.notBefore === null ? {} : { notBefore: candidate.notBefore },
|
|
278
|
+
...candidate.notAfter === null ? {} : { notAfter: candidate.notAfter }
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
if (new Set(keys.map((key) => key.kid)).size !== keys.length) {
|
|
282
|
+
throw new Error("lease_trust_bundle_invalid");
|
|
283
|
+
}
|
|
284
|
+
return Object.freeze(keys);
|
|
285
|
+
}
|
|
286
|
+
function parseOperations(dcmBytes, operationCatalogBytes, domain, extension) {
|
|
287
|
+
let dcmValue;
|
|
288
|
+
let catalogValue;
|
|
289
|
+
try {
|
|
290
|
+
dcmValue = JSON.parse(dcmBytes.toString("utf8"));
|
|
291
|
+
catalogValue = JSON.parse(operationCatalogBytes.toString("utf8"));
|
|
292
|
+
} catch {
|
|
293
|
+
throw new Error("commercial_operation_contract_invalid");
|
|
294
|
+
}
|
|
295
|
+
if (!isRecord(dcmValue) || !isRecord(dcmValue.domain) || dcmValue.domain.id !== domain || !isRecord(dcmValue.capabilities) || !Array.isArray(dcmValue.capabilities.operations) || !Array.isArray(catalogValue) || !isRecord(extension)) throw new Error("commercial_operation_contract_invalid");
|
|
296
|
+
const featureBindings = extension.operationFeatures;
|
|
297
|
+
if (!Array.isArray(featureBindings)) throw new Error("commercial_operation_contract_invalid");
|
|
298
|
+
const features = /* @__PURE__ */ new Map();
|
|
299
|
+
let previousOperationId = "";
|
|
300
|
+
for (const binding of featureBindings) {
|
|
301
|
+
if (!isRecord(binding)) throw new Error("commercial_operation_contract_invalid");
|
|
302
|
+
exactKeys(binding, ["operationId", "requiredFeatureIds"], "commercial_operation_contract_invalid");
|
|
303
|
+
if (typeof binding.operationId !== "string" || !Array.isArray(binding.requiredFeatureIds)) {
|
|
304
|
+
throw new Error("commercial_operation_contract_invalid");
|
|
305
|
+
}
|
|
306
|
+
const required = binding.requiredFeatureIds.map((entry) => text(entry, "commercial_operation_contract_invalid"));
|
|
307
|
+
if (binding.operationId <= previousOperationId || required.length === 0 || new Set(required).size !== required.length || required.some((entry, index) => entry !== [...required].sort()[index])) throw new Error("commercial_operation_contract_invalid");
|
|
308
|
+
previousOperationId = binding.operationId;
|
|
309
|
+
features.set(binding.operationId, Object.freeze(required));
|
|
310
|
+
}
|
|
311
|
+
const catalog = /* @__PURE__ */ new Map();
|
|
312
|
+
for (const operation of catalogValue) {
|
|
313
|
+
if (!isRecord(operation) || typeof operation.operationId !== "string" || typeof operation.sideEffect !== "string" || catalog.has(operation.operationId)) throw new Error("commercial_operation_contract_invalid");
|
|
314
|
+
catalog.set(operation.operationId, operation);
|
|
315
|
+
}
|
|
316
|
+
const policies = dcmValue.capabilities.operations.map((operation) => {
|
|
317
|
+
if (!isRecord(operation) || typeof operation.operationId !== "string" || !["none", "db", "fs", "network", "mixed"].includes(String(operation.sideEffect)) || !features.has(operation.operationId)) throw new Error("commercial_operation_contract_invalid");
|
|
318
|
+
const catalogOperation = catalog.get(operation.operationId);
|
|
319
|
+
if (!catalogOperation || catalogOperation.sideEffect !== operation.sideEffect) {
|
|
320
|
+
throw new Error("commercial_operation_contract_invalid");
|
|
321
|
+
}
|
|
322
|
+
return Object.freeze({
|
|
323
|
+
operationId: operation.operationId,
|
|
324
|
+
requiredFeatureIds: features.get(operation.operationId),
|
|
325
|
+
sideEffect: operation.sideEffect,
|
|
326
|
+
...isRecord(operation.safety) ? {
|
|
327
|
+
safety: Object.freeze({
|
|
328
|
+
destructive: operation.safety.destructive === true,
|
|
329
|
+
confirmationRequired: operation.safety.confirmationRequired === true,
|
|
330
|
+
applyRequired: operation.safety.applyRequired === true
|
|
331
|
+
})
|
|
332
|
+
} : {}
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
if (catalog.size !== policies.length || features.size !== policies.length) {
|
|
336
|
+
throw new Error("commercial_operation_contract_invalid");
|
|
337
|
+
}
|
|
338
|
+
return Object.freeze(policies);
|
|
339
|
+
}
|
|
340
|
+
function loadCommercialAdmissionSnapshot(configFile, freeDomains, now = /* @__PURE__ */ new Date(), generation) {
|
|
341
|
+
const config = parseConfig(configFile);
|
|
342
|
+
const active = readVerifiedActiveCommercialArtifact({
|
|
343
|
+
storeRoot: config.storeRoot,
|
|
344
|
+
...commercialIntegrityReadOptions(config.storeRoot),
|
|
345
|
+
trustKeys: parseReleaseTrustBundleFile(config.releaseTrustBundle),
|
|
346
|
+
now,
|
|
347
|
+
expectedIdentity: {
|
|
348
|
+
installationId: config.installationId,
|
|
349
|
+
hostInstanceId: config.hostInstanceId
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
if (!active) throw new Error("commercial_artifact_not_active");
|
|
353
|
+
const extension = active.manifest.envelope.payload.extensions[config.extensionNamespace];
|
|
354
|
+
if (!isRecord(extension) || extension.releaseTier !== "commercial" || !Array.isArray(extension.productIds) || !extension.productIds.includes(config.productId)) throw new Error("commercial_release_extension_invalid");
|
|
355
|
+
const hostProjection = extension.hostProjection;
|
|
356
|
+
if (!isRecord(hostProjection)) throw new Error("commercial_release_extension_invalid");
|
|
357
|
+
exactKeys(
|
|
358
|
+
hostProjection,
|
|
359
|
+
["manifestExport", "pluginFactory"],
|
|
360
|
+
"commercial_release_extension_invalid"
|
|
361
|
+
);
|
|
362
|
+
const pluginFactory = text(
|
|
363
|
+
hostProjection.pluginFactory,
|
|
364
|
+
"commercial_release_extension_invalid"
|
|
365
|
+
);
|
|
366
|
+
const manifestExport = text(
|
|
367
|
+
hostProjection.manifestExport,
|
|
368
|
+
"commercial_release_extension_invalid"
|
|
369
|
+
);
|
|
370
|
+
const operations = parseOperations(
|
|
371
|
+
active.dcmBytes,
|
|
372
|
+
active.operationCatalogBytes,
|
|
373
|
+
config.domain,
|
|
374
|
+
extension
|
|
375
|
+
);
|
|
376
|
+
const token = readFileSync(safeRegularFile(config.leaseFile, "entitlement_lease_file_invalid"), "utf8").trim();
|
|
377
|
+
const lease = verifyEntitlementLease({
|
|
378
|
+
token,
|
|
379
|
+
trustKeys: parseLeaseTrustBundle(config.leaseTrustBundle),
|
|
380
|
+
issuer: config.issuer,
|
|
381
|
+
now,
|
|
382
|
+
expected: {
|
|
383
|
+
tenantId: config.tenantId,
|
|
384
|
+
installationId: config.installationId,
|
|
385
|
+
productId: config.productId,
|
|
386
|
+
domain: config.domain,
|
|
387
|
+
manifestDigest: active.manifest.manifestDigest,
|
|
388
|
+
closureDigest: active.receipt.closureDigest,
|
|
389
|
+
...config.entitlementEpoch === null ? {} : {
|
|
390
|
+
entitlementEpoch: config.entitlementEpoch
|
|
391
|
+
},
|
|
392
|
+
...config.minimumRevocationEpoch === null ? {} : {
|
|
393
|
+
minimumRevocationEpoch: config.minimumRevocationEpoch
|
|
394
|
+
},
|
|
395
|
+
...config.leaseMode === null ? {} : { leaseMode: config.leaseMode },
|
|
396
|
+
...config.installationKeyThumbprint === null ? {} : {
|
|
397
|
+
installationKeyThumbprint: config.installationKeyThumbprint
|
|
398
|
+
},
|
|
399
|
+
...config.activationChallengeDigest === null ? {} : {
|
|
400
|
+
activationChallengeDigest: config.activationChallengeDigest
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
if (config.schemaVersion === 2) {
|
|
405
|
+
if (lease.claims.schemaVersion !== 2 || config.installationPrivateKeyFile === null || config.installationKeyThumbprint === null || config.activationChallengeDigest === null) throw new Error("commercial_installation_possession_invalid");
|
|
406
|
+
verifyOfflineInstallationPossessionAtLoad({
|
|
407
|
+
installationPrivateKeyFile: config.installationPrivateKeyFile,
|
|
408
|
+
installationKeyThumbprint: config.installationKeyThumbprint,
|
|
409
|
+
activationChallengeDigest: config.activationChallengeDigest,
|
|
410
|
+
installationId: config.installationId,
|
|
411
|
+
hostInstanceId: config.hostInstanceId,
|
|
412
|
+
leaseToken: token,
|
|
413
|
+
receipt: {
|
|
414
|
+
receiptId: active.receipt.receiptId,
|
|
415
|
+
releaseId: active.receipt.releaseId,
|
|
416
|
+
manifestDigest: active.receipt.manifestDigest,
|
|
417
|
+
closureDigest: active.receipt.closureDigest
|
|
418
|
+
},
|
|
419
|
+
now
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
const operationIds = new Set(operations.map((operation) => operation.operationId));
|
|
423
|
+
if (active.manifest.envelope.payload.degradedOperationIds.some(
|
|
424
|
+
(operationId) => !operationIds.has(operationId)
|
|
425
|
+
)) throw new Error("commercial_operation_contract_invalid");
|
|
426
|
+
const manifestEntrypoint = active.receipt.resolvedEntrypoints.manifestProviders[0] ?? active.receipt.resolvedEntrypoints.dcmProviders[0];
|
|
427
|
+
if (!manifestEntrypoint) throw new Error("commercial_runtime_entrypoint_invalid");
|
|
428
|
+
const snapshot = buildAdmittedDomainSnapshot({
|
|
429
|
+
generation: generation ?? Math.max(2, active.receipt.activation.generation + 1),
|
|
430
|
+
freeDomains,
|
|
431
|
+
commercialDomains: [{
|
|
432
|
+
domain: config.domain,
|
|
433
|
+
productId: config.productId,
|
|
434
|
+
receipt: active.receipt,
|
|
435
|
+
manifest: active.manifest,
|
|
436
|
+
lease,
|
|
437
|
+
operations
|
|
438
|
+
}],
|
|
439
|
+
now
|
|
440
|
+
});
|
|
441
|
+
return Object.freeze({
|
|
442
|
+
snapshot,
|
|
443
|
+
runtime: Object.freeze({
|
|
444
|
+
domain: config.domain,
|
|
445
|
+
pluginModule: safeRuntimeEntrypoint(
|
|
446
|
+
config.storeRoot,
|
|
447
|
+
active.receipt.resolvedEntrypoints.plugin
|
|
448
|
+
),
|
|
449
|
+
pluginFactory,
|
|
450
|
+
manifestModule: safeRuntimeEntrypoint(config.storeRoot, manifestEntrypoint),
|
|
451
|
+
manifestExport
|
|
452
|
+
})
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
function readCommercialAdmissionIntegritySchedule(configFile, now = /* @__PURE__ */ new Date()) {
|
|
456
|
+
const config = parseConfig(configFile);
|
|
457
|
+
const options = commercialIntegrityReadOptions(config.storeRoot, "scheduled");
|
|
458
|
+
if (!options.integrityStateRoot) {
|
|
459
|
+
throw new Error("commercial_integrity_scheduler_requires_managed_store");
|
|
460
|
+
}
|
|
461
|
+
return readCommercialIntegrityVerificationSchedule(options.integrityStateRoot, now);
|
|
462
|
+
}
|
|
463
|
+
function resolveCommercialIntegrityWorkerInput(configFile) {
|
|
464
|
+
const config = parseConfig(configFile);
|
|
465
|
+
const options = commercialIntegrityReadOptions(config.storeRoot, "scheduled");
|
|
466
|
+
if (!options.integrityStateRoot) {
|
|
467
|
+
throw new Error("commercial_integrity_scheduler_requires_managed_store");
|
|
468
|
+
}
|
|
469
|
+
return Object.freeze({
|
|
470
|
+
storeRoot: config.storeRoot,
|
|
471
|
+
integrityStateRoot: options.integrityStateRoot,
|
|
472
|
+
trustKeys: parseReleaseTrustBundleFile(config.releaseTrustBundle),
|
|
473
|
+
expectedIdentity: Object.freeze({
|
|
474
|
+
installationId: config.installationId,
|
|
475
|
+
hostInstanceId: config.hostInstanceId
|
|
476
|
+
})
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
export { loadCommercialAdmissionSnapshot, parseReleaseTrustBundleFile, readCommercialAdmissionIntegritySchedule, resolveCommercialIntegrityWorkerInput, verifyOfflineInstallationPossessionAtLoad };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as getAgentGateway, n as normalizeDomain, a as normalizeToolId, r as resolveOperationKind } from './agent-gateway-runtime-
|
|
2
|
-
import { g as getHostConfig } from './registry-
|
|
1
|
+
import { g as getAgentGateway, n as normalizeDomain, a as normalizeToolId, r as resolveOperationKind } from './agent-gateway-runtime-DV-xLmJx.js';
|
|
2
|
+
import { g as getHostConfig } from './registry-DIreA2IZ.js';
|
|
3
3
|
import { g as getAuthProvider, i as isTrustedLocalAuthProvider } from './auth-provider-C07OUlnz.js';
|
|
4
4
|
|
|
5
5
|
const COMMUNITY_CLIENT_COMPATIBILITY_SCHEMA_VERSION = 1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as escape_html, g as getContext, n as noop, w as writable } from './index.js-
|
|
1
|
+
import { e as escape_html, g as getContext, n as noop, w as writable } from './index.js-CWgll4BT.js';
|
|
2
2
|
|
|
3
3
|
function create_updated_store() {
|
|
4
4
|
const { set, subscribe } = writable(false);
|