@inf-monkeys-tech/monkeys 1.1.12 → 1.1.13
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/README.md +11 -1
- package/lib/contracts/declarative-control-http.d.ts +101 -0
- package/lib/contracts/declarative-control-http.d.ts.map +1 -1
- package/lib/contracts/declarative-control-http.js +5 -0
- package/lib/contracts/declarative-control-http.js.map +1 -1
- package/lib/contracts/declarative-control.d.ts +11 -0
- package/lib/contracts/declarative-control.d.ts.map +1 -1
- package/lib/contracts/declarative-control.js +3 -0
- package/lib/contracts/declarative-control.js.map +1 -1
- package/lib/contracts/declarative-publication-job.d.ts +24 -0
- package/lib/contracts/declarative-publication-job.d.ts.map +1 -1
- package/lib/contracts/render.d.ts +4 -0
- package/lib/contracts/render.d.ts.map +1 -1
- package/lib/contracts/render.js +2 -0
- package/lib/contracts/render.js.map +1 -1
- package/lib/esm/contracts/index.mjs +10 -0
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +236 -9
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +236 -9
- package/lib/esm/runtime/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +10 -0
- package/lib/esm/schemas/index.mjs.map +1 -1
- package/lib/json-schema/design-capability-catalog-artifact.schema.json +10 -0
- package/lib/json-schema/overlay-node.schema.json +5 -0
- package/lib/json-schema/page-runtime-bundle.schema.json +10 -0
- package/lib/json-schema/render-node.schema.json +5 -0
- package/lib/json-schema/render-tree.schema.json +5 -0
- package/lib/json-schema/view-provider-descriptor.schema.json +5 -0
- package/lib/json-schema/workbench-runtime-bundle.schema.json +10 -0
- package/lib/json-schema/workbench.schema.json +10 -0
- package/lib/runtime/declarative-control-compiler.d.ts +4 -0
- package/lib/runtime/declarative-control-compiler.d.ts.map +1 -1
- package/lib/runtime/declarative-control-compiler.js +29 -10
- package/lib/runtime/declarative-control-compiler.js.map +1 -1
- package/lib/runtime/declarative-runtime-contract.d.ts +45 -0
- package/lib/runtime/declarative-runtime-contract.d.ts.map +1 -0
- package/lib/runtime/declarative-runtime-contract.js +237 -0
- package/lib/runtime/declarative-runtime-contract.js.map +1 -0
- package/lib/runtime/index.d.ts +1 -0
- package/lib/runtime/index.d.ts.map +1 -1
- package/lib/runtime/index.js +1 -0
- package/lib/runtime/index.js.map +1 -1
- package/lib/schemas/index.d.ts +12 -0
- package/lib/schemas/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -7868,6 +7868,7 @@ var RenderNodeSchema = z3.object({
|
|
|
7868
7868
|
semanticRef: EntityRefSchema.optional(),
|
|
7869
7869
|
dataContextRef: EntityRefSchema.optional(),
|
|
7870
7870
|
capabilityRef: EntityRefSchema,
|
|
7871
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
7871
7872
|
providerRef: EntityRefSchema.optional(),
|
|
7872
7873
|
stateRef: EntityRefSchema.optional(),
|
|
7873
7874
|
surface: RenderSurfaceSchema,
|
|
@@ -8033,6 +8034,7 @@ var ViewProviderDescriptorSchema = z3.object({
|
|
|
8033
8034
|
contract: z3.literal("ViewProviderDescriptor"),
|
|
8034
8035
|
providerId: ContractIdentifierSchema,
|
|
8035
8036
|
providerVersion: ContractIdentifierSchema,
|
|
8037
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
8036
8038
|
ownerRepo: ContractIdentifierSchema,
|
|
8037
8039
|
capabilityRef: EntityRefSchema,
|
|
8038
8040
|
rendererKey: ContractIdentifierSchema,
|
|
@@ -12327,6 +12329,7 @@ var QueryBindingSchema = z13.object({
|
|
|
12327
12329
|
}
|
|
12328
12330
|
});
|
|
12329
12331
|
var CapabilityInstanceSchema = z13.object({
|
|
12332
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
12330
12333
|
instanceId: ContractIdentifierSchema,
|
|
12331
12334
|
nodeId: ContractIdentifierSchema,
|
|
12332
12335
|
capabilityRevisionRef: RevisionRefSchema,
|
|
@@ -14180,6 +14183,7 @@ var WorkbenchGroupSchema = z13.object({
|
|
|
14180
14183
|
accessPolicy: AccessPolicySchema.optional()
|
|
14181
14184
|
}).strict();
|
|
14182
14185
|
var WorkbenchAppInstanceSchema = z13.object({
|
|
14186
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
14183
14187
|
instanceId: ContractIdentifierSchema,
|
|
14184
14188
|
kind: z13.enum([
|
|
14185
14189
|
"built-in-application",
|
|
@@ -14225,6 +14229,7 @@ var WorkbenchSchema = z13.object({
|
|
|
14225
14229
|
showDefaultGroup: z13.boolean()
|
|
14226
14230
|
}).strict(),
|
|
14227
14231
|
layout: z13.object({
|
|
14232
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
14228
14233
|
hostCapabilityRevisionRef: RevisionRefSchema,
|
|
14229
14234
|
hostProviderRevisionRef: RevisionRefSchema,
|
|
14230
14235
|
layoutPolicyRevisionRef: RevisionRefSchema,
|
|
@@ -15858,6 +15863,7 @@ var DeclarativeCapabilitySchemaDocumentSchema = z15.object({
|
|
|
15858
15863
|
}
|
|
15859
15864
|
});
|
|
15860
15865
|
var DeclarativeCapabilityAuthoringRegistrationSchema = z15.object({
|
|
15866
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
15861
15867
|
registrationRevisionRef: RevisionRefSchema,
|
|
15862
15868
|
capabilityRevisionRef: RevisionRefSchema,
|
|
15863
15869
|
providerRevisionRef: RevisionRefSchema,
|
|
@@ -15984,6 +15990,9 @@ var ProductDeclarativeCapabilityRegistrationSchema = z15.object({
|
|
|
15984
15990
|
declarativeRegistration: DeclarativeCapabilityAuthoringRegistrationSchema,
|
|
15985
15991
|
requiredPermissionCodes: z15.array(ContractIdentifierSchema).default([])
|
|
15986
15992
|
}).strict().superRefine((value, context) => {
|
|
15993
|
+
if (value.provider.runtimeContractVersion !== value.declarativeRegistration.runtimeContractVersion) {
|
|
15994
|
+
context.addIssue({ code: "custom", path: ["declarativeRegistration", "runtimeContractVersion"], message: "The authoring contract must match its runtime provider." });
|
|
15995
|
+
}
|
|
15987
15996
|
const ownerRepo = value.manifest.ownerRepo;
|
|
15988
15997
|
const registration = value.declarativeRegistration;
|
|
15989
15998
|
if (ownerRepo === "monkeys-design") {
|
|
@@ -16498,6 +16507,7 @@ var DeclarativeBindingAuthoringChoiceSchema = DeclarativeAuthoringChoiceSchema.e
|
|
|
16498
16507
|
}).strict()
|
|
16499
16508
|
}).strict();
|
|
16500
16509
|
var DeclarativeWorkbenchTargetChoiceSchema = z15.object({
|
|
16510
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
16501
16511
|
stableTargetRef: StableRefSchema,
|
|
16502
16512
|
targetRevisionRef: RevisionRefSchema,
|
|
16503
16513
|
providerRevisionRef: RevisionRefSchema,
|
|
@@ -17501,6 +17511,7 @@ var stableRefKey = (reference) => `${reference.visibility}:${reference.tenantSco
|
|
|
17501
17511
|
var revisionRefKey = (reference) => `${stableRefKey(reference)}@${reference.revision}:v${reference.schemaVersion}:${reference.contentHash.toLowerCase()}`;
|
|
17502
17512
|
var sameStableRef = (left, right) => stableRefKey(left) === stableRefKey(right);
|
|
17503
17513
|
var sameRevisionRef = (left, right) => revisionRefKey(left) === revisionRefKey(right);
|
|
17514
|
+
var sameSchemaContract = (left, right) => left.kind === "schema" && right.kind === "schema" && sameStableRef(left, right) && left.schemaVersion === right.schemaVersion && left.contentHash === right.contentHash;
|
|
17504
17515
|
var assertUniqueRegistryKeys = (keys, path) => {
|
|
17505
17516
|
const seen = /* @__PURE__ */ new Set();
|
|
17506
17517
|
keys.forEach((key, index) => {
|
|
@@ -17770,7 +17781,7 @@ var compileDesignCapabilityCatalogArtifact = (input) => {
|
|
|
17770
17781
|
...unsignedRegistration
|
|
17771
17782
|
} = registration;
|
|
17772
17783
|
const registrationHash = canonicalContentHash(unsignedRegistration);
|
|
17773
|
-
if (registration.capabilityRevisionRef.id !== entry.manifest.id || registration.capabilityRevisionRef.ownerRepo !== entry.manifest.ownerRepo || String(registration.capabilityRevisionRef.revision) !== String(entry.manifest.capabilityVersion) || registration.capabilityRevisionRef.contentHash !== canonicalContentHash(entry.manifest) || registration.providerRevisionRef.id !== entry.provider.providerId || registration.providerRevisionRef.ownerRepo !== entry.provider.ownerRepo || String(registration.providerRevisionRef.revision) !== String(entry.provider.providerVersion) || registration.providerRevisionRef.contentHash !== canonicalContentHash(entry.provider) || registration.sourceContentHash !== registrationHash || registration.registrationRevisionRef.contentHash !== registrationHash) {
|
|
17784
|
+
if (registration.runtimeContractVersion !== entry.provider.runtimeContractVersion || registration.capabilityRevisionRef.id !== entry.manifest.id || registration.capabilityRevisionRef.ownerRepo !== entry.manifest.ownerRepo || String(registration.capabilityRevisionRef.revision) !== String(entry.manifest.capabilityVersion) || registration.capabilityRevisionRef.contentHash !== canonicalContentHash(entry.manifest) || registration.providerRevisionRef.id !== entry.provider.providerId || registration.providerRevisionRef.ownerRepo !== entry.provider.ownerRepo || String(registration.providerRevisionRef.revision) !== String(entry.provider.providerVersion) || registration.providerRevisionRef.contentHash !== canonicalContentHash(entry.provider) || registration.sourceContentHash !== registrationHash || registration.registrationRevisionRef.contentHash !== registrationHash) {
|
|
17774
17785
|
throw new DeclarativeControlCompilationError(
|
|
17775
17786
|
"DESIGN_CATALOG_INVALID",
|
|
17776
17787
|
`entries[${index}]`,
|
|
@@ -18711,6 +18722,7 @@ var resolvePage = (input) => {
|
|
|
18711
18722
|
version: 1,
|
|
18712
18723
|
ownerRepo: input.pageOwnerRepo
|
|
18713
18724
|
},
|
|
18725
|
+
...registration.runtimeContractVersion ? { runtimeContractVersion: registration.runtimeContractVersion } : {},
|
|
18714
18726
|
capabilityRef: simpleEntityRef(registration.revisionRef),
|
|
18715
18727
|
providerRef: simpleEntityRef(registration.providerRevisionRef),
|
|
18716
18728
|
surface: node.surface ?? defaultRenderSurface,
|
|
@@ -18725,6 +18737,7 @@ var resolvePage = (input) => {
|
|
|
18725
18737
|
...node.repeat ? { repeat: { ...node.repeat, limit: node.repeat.limit ?? 200 } } : {}
|
|
18726
18738
|
});
|
|
18727
18739
|
capabilityInstances.push({
|
|
18740
|
+
...registration.runtimeContractVersion ? { runtimeContractVersion: registration.runtimeContractVersion } : {},
|
|
18728
18741
|
instanceId: node.id,
|
|
18729
18742
|
nodeId: node.id,
|
|
18730
18743
|
capabilityRevisionRef: registration.revisionRef,
|
|
@@ -19274,6 +19287,9 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
19274
19287
|
"Capability/provider pair has no exact governed Design registration."
|
|
19275
19288
|
);
|
|
19276
19289
|
}
|
|
19290
|
+
if (instance.runtimeContractVersion !== registration.runtimeContractVersion || node.runtimeContractVersion !== instance.runtimeContractVersion) {
|
|
19291
|
+
throw new DeclarativeControlCompilationError("CAPABILITY_BINDING_MISMATCH", `capabilityInstances[${index}].runtimeContractVersion`, "Runtime contract must be issued by the exact governed registration.");
|
|
19292
|
+
}
|
|
19277
19293
|
if (instance.allowedSideEffects.some(
|
|
19278
19294
|
(sideEffect) => !registration.allowedSideEffects.includes(sideEffect)
|
|
19279
19295
|
)) {
|
|
@@ -19334,7 +19350,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
19334
19350
|
const port = registration?.inputPorts.find(
|
|
19335
19351
|
(candidate) => candidate.name === binding.target.port
|
|
19336
19352
|
);
|
|
19337
|
-
if (!port || !
|
|
19353
|
+
if (!port || !sameSchemaContract(
|
|
19338
19354
|
port.schemaRevisionRef,
|
|
19339
19355
|
binding.renderModelSchemaRevisionRef
|
|
19340
19356
|
)) {
|
|
@@ -19354,7 +19370,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
19354
19370
|
const pageChangePort = sourceRegistration?.outputPorts.find(
|
|
19355
19371
|
(candidate) => candidate.name === binding.cursorWindow.pageChangePort
|
|
19356
19372
|
);
|
|
19357
|
-
if (!pageChangePort || !
|
|
19373
|
+
if (!pageChangePort || !sameSchemaContract(
|
|
19358
19374
|
pageChangePort.schemaRevisionRef,
|
|
19359
19375
|
binding.cursorWindow.pageChangeIntentSchemaRevisionRef
|
|
19360
19376
|
)) {
|
|
@@ -19376,7 +19392,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
19376
19392
|
const port = registration?.inputPorts.find(
|
|
19377
19393
|
(candidate) => candidate.name === binding.target.port
|
|
19378
19394
|
);
|
|
19379
|
-
if (!port || !
|
|
19395
|
+
if (!port || !sameSchemaContract(
|
|
19380
19396
|
port.schemaRevisionRef,
|
|
19381
19397
|
binding.targetProjection?.schemaRevisionRef ?? binding.renderModelSchemaRevisionRef
|
|
19382
19398
|
)) {
|
|
@@ -19406,7 +19422,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
19406
19422
|
const pageChangePort = sourceRegistration?.outputPorts.find(
|
|
19407
19423
|
(candidate) => candidate.name === binding.cursorWindow.pageChangePort
|
|
19408
19424
|
);
|
|
19409
|
-
if (!pageChangePort || !
|
|
19425
|
+
if (!pageChangePort || !sameSchemaContract(
|
|
19410
19426
|
pageChangePort.schemaRevisionRef,
|
|
19411
19427
|
binding.cursorWindow.pageChangeIntentSchemaRevisionRef
|
|
19412
19428
|
)) {
|
|
@@ -19455,7 +19471,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
19455
19471
|
const port = registration?.outputPorts.find(
|
|
19456
19472
|
(candidate) => candidate.name === binding.source.port
|
|
19457
19473
|
);
|
|
19458
|
-
if (!port || !
|
|
19474
|
+
if (!port || !sameSchemaContract(
|
|
19459
19475
|
port.schemaRevisionRef,
|
|
19460
19476
|
binding.sourceIntentSchemaRevisionRef
|
|
19461
19477
|
)) {
|
|
@@ -19476,7 +19492,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
19476
19492
|
const port = registration?.outputPorts.find(
|
|
19477
19493
|
(candidate) => candidate.name === binding.source.port
|
|
19478
19494
|
);
|
|
19479
|
-
if (!port || !
|
|
19495
|
+
if (!port || !sameSchemaContract(
|
|
19480
19496
|
port.schemaRevisionRef,
|
|
19481
19497
|
binding.sourceIntentSchemaRevisionRef
|
|
19482
19498
|
)) {
|
|
@@ -19799,6 +19815,14 @@ var compileWorkbenchRuntimeBundle = (input) => {
|
|
|
19799
19815
|
const groupsById = new Map(
|
|
19800
19816
|
workbench.groups.map((group) => [group.groupId, group])
|
|
19801
19817
|
);
|
|
19818
|
+
const contractFor = (capabilityRef, providerRef, declared) => {
|
|
19819
|
+
const registration = input.capabilityRegistry?.find((candidate) => sameRevisionRef(candidate.capabilityRevisionRef, capabilityRef) && sameRevisionRef(candidate.providerRevisionRef, providerRef));
|
|
19820
|
+
if (declared !== void 0 && declared !== registration?.runtimeContractVersion) {
|
|
19821
|
+
throw new DeclarativeControlCompilationError("CAPABILITY_BINDING_MISMATCH", "workbench.runtimeContractVersion", "Runtime contract must be issued by the exact governed registration.");
|
|
19822
|
+
}
|
|
19823
|
+
return registration?.runtimeContractVersion;
|
|
19824
|
+
};
|
|
19825
|
+
const layoutContract = contractFor(workbench.layout.hostCapabilityRevisionRef, workbench.layout.hostProviderRevisionRef, workbench.layout.runtimeContractVersion);
|
|
19802
19826
|
const appInstances = workbench.appInstances.map((instance, index) => {
|
|
19803
19827
|
const stableTarget = StableRefSchema.parse({
|
|
19804
19828
|
kind: instance.targetRevisionRef.kind,
|
|
@@ -19839,7 +19863,8 @@ var compileWorkbenchRuntimeBundle = (input) => {
|
|
|
19839
19863
|
"Workbench and instance audience is wider than the target audience."
|
|
19840
19864
|
);
|
|
19841
19865
|
}
|
|
19842
|
-
|
|
19866
|
+
const runtimeContractVersion = contractFor(instance.targetRevisionRef, instance.providerRevisionRef, instance.runtimeContractVersion);
|
|
19867
|
+
return { ...instance, ...runtimeContractVersion ? { runtimeContractVersion } : {}, targetAccessPolicy: registration.accessPolicy };
|
|
19843
19868
|
});
|
|
19844
19869
|
const unsigned = {
|
|
19845
19870
|
contract: "WorkbenchRuntimeBundle",
|
|
@@ -19862,7 +19887,7 @@ var compileWorkbenchRuntimeBundle = (input) => {
|
|
|
19862
19887
|
groups: workbench.groups,
|
|
19863
19888
|
appInstances,
|
|
19864
19889
|
defaultEntry: workbench.defaultEntry,
|
|
19865
|
-
layout: workbench.layout,
|
|
19890
|
+
layout: { ...workbench.layout, ...layoutContract ? { runtimeContractVersion: layoutContract } : {} },
|
|
19866
19891
|
workbenchAccessPolicy: workbench.workbenchAccessPolicy,
|
|
19867
19892
|
personalPreferencesPolicy: workbench.personalPreferencesPolicy,
|
|
19868
19893
|
target: { ...release.target, routeClaim: releaseRoute },
|
|
@@ -24551,6 +24576,201 @@ var compileTenantRuntimeBindings = (config, policy) => {
|
|
|
24551
24576
|
});
|
|
24552
24577
|
};
|
|
24553
24578
|
|
|
24579
|
+
// src/runtime/declarative-runtime-contract.ts
|
|
24580
|
+
var assertViewProviderContract = (node, provider) => {
|
|
24581
|
+
if (node.capabilityRef.kind !== "capability" || node.providerRef?.kind !== "view-provider" || node.capabilityRef.id !== provider.capabilityRef.id || node.capabilityRef.ownerRepo !== provider.capabilityRef.ownerRepo || node.providerRef.id !== provider.providerId || node.providerRef.ownerRepo !== provider.ownerRepo) {
|
|
24582
|
+
throw new TypeError("Runtime capability and provider identities do not match their registered owners.");
|
|
24583
|
+
}
|
|
24584
|
+
if (node.runtimeContractVersion !== void 0) {
|
|
24585
|
+
if (node.runtimeContractVersion !== provider.runtimeContractVersion) {
|
|
24586
|
+
throw new TypeError("The provider does not implement the declared runtime contract.");
|
|
24587
|
+
}
|
|
24588
|
+
} else if (String(node.capabilityRef.version) !== String(provider.capabilityRef.version) || String(node.providerRef.version) !== provider.providerVersion) {
|
|
24589
|
+
throw new TypeError("An unversioned runtime contract requires an exact provider snapshot.");
|
|
24590
|
+
}
|
|
24591
|
+
};
|
|
24592
|
+
var supportsCapabilityInputSchema = (entry, reference, runtimeContractVersion, portName) => entry.declarativeRegistration.inputPorts.some((port) => (portName === void 0 || port.name === portName) && (sameSchemaContract(port.schemaRevisionRef, reference) || runtimeContractVersion !== void 0 && runtimeContractVersion === entry.provider.runtimeContractVersion && reference.schemaVersion === port.schemaRevisionRef.schemaVersion && sameStableRef(port.schemaRevisionRef, reference)));
|
|
24593
|
+
var assertDeclarativeCapabilityContract = (entry, request) => {
|
|
24594
|
+
const registration = entry.declarativeRegistration;
|
|
24595
|
+
if (request.inputSchemaRevisionRef && !supportsCapabilityInputSchema(entry, request.inputSchemaRevisionRef, request.runtimeContractVersion)) {
|
|
24596
|
+
throw new TypeError("The input schema is not owned by the runtime contract.");
|
|
24597
|
+
}
|
|
24598
|
+
if (!sameStableRef(request.capabilityRevisionRef, registration.capabilityRevisionRef) || !sameStableRef(request.providerRevisionRef, registration.providerRevisionRef) || request.capabilityRevisionRef.schemaVersion !== registration.capabilityRevisionRef.schemaVersion || request.providerRevisionRef.schemaVersion !== registration.providerRevisionRef.schemaVersion) {
|
|
24599
|
+
throw new TypeError("Runtime contract snapshots must retain their registered identity, scope and schema version.");
|
|
24600
|
+
}
|
|
24601
|
+
if (request.runtimeContractVersion !== void 0) {
|
|
24602
|
+
if (request.runtimeContractVersion !== entry.provider.runtimeContractVersion || request.propertySchemaRevisionRef && (!sameStableRef(request.propertySchemaRevisionRef, registration.propertySchemaRevisionRef) || request.propertySchemaRevisionRef.schemaVersion !== registration.propertySchemaRevisionRef.schemaVersion)) {
|
|
24603
|
+
throw new TypeError("The capability does not implement the declared runtime contract.");
|
|
24604
|
+
}
|
|
24605
|
+
return;
|
|
24606
|
+
}
|
|
24607
|
+
const capabilityVersion = String(request.capabilityRevisionRef.revision);
|
|
24608
|
+
const providerVersion = String(request.providerRevisionRef.revision);
|
|
24609
|
+
const manifest = {
|
|
24610
|
+
...entry.manifest,
|
|
24611
|
+
capabilityVersion,
|
|
24612
|
+
runtime: {
|
|
24613
|
+
...entry.manifest.runtime,
|
|
24614
|
+
providerBindings: entry.manifest.runtime.providerBindings.map((binding) => ({
|
|
24615
|
+
...binding,
|
|
24616
|
+
providerRef: binding.providerRef.id === entry.provider.providerId ? { ...binding.providerRef, version: providerVersion } : binding.providerRef
|
|
24617
|
+
}))
|
|
24618
|
+
}
|
|
24619
|
+
};
|
|
24620
|
+
const { runtimeContractVersion: _contract, ...descriptor } = entry.provider;
|
|
24621
|
+
const provider = {
|
|
24622
|
+
...descriptor,
|
|
24623
|
+
providerVersion,
|
|
24624
|
+
capabilityRef: { ...descriptor.capabilityRef, version: capabilityVersion },
|
|
24625
|
+
...descriptor.sideEffectAdapterRef ? { sideEffectAdapterRef: { ...descriptor.sideEffectAdapterRef, version: capabilityVersion } } : {}
|
|
24626
|
+
};
|
|
24627
|
+
const exact = sameRevisionRef(request.capabilityRevisionRef, registration.capabilityRevisionRef) && sameRevisionRef(request.providerRevisionRef, registration.providerRevisionRef);
|
|
24628
|
+
const equivalent = request.capabilityRevisionRef.contentHash === canonicalContentHash(manifest) && request.providerRevisionRef.contentHash === canonicalContentHash(provider);
|
|
24629
|
+
if (!exact && !equivalent || request.propertySchemaRevisionRef && !sameSchemaContract(request.propertySchemaRevisionRef, registration.propertySchemaRevisionRef)) {
|
|
24630
|
+
throw new TypeError("The historical capability snapshot is not supported by the current runtime contract.");
|
|
24631
|
+
}
|
|
24632
|
+
};
|
|
24633
|
+
var acceptsPreviousSchema = (previous, next) => {
|
|
24634
|
+
if (canonicalContentHash(previous) === canonicalContentHash(next) || next === true) return true;
|
|
24635
|
+
if (previous === false) return true;
|
|
24636
|
+
if (!previous || !next || typeof previous !== "object" || typeof next !== "object" || Array.isArray(previous) || Array.isArray(next)) return false;
|
|
24637
|
+
const withoutAnnotations = (schema2) => Object.fromEntries(Object.entries(schema2).filter(([key]) => !["title", "description", "examples", "$comment"].includes(key)));
|
|
24638
|
+
const before = withoutAnnotations(previous);
|
|
24639
|
+
const after = withoutAnnotations(next);
|
|
24640
|
+
const {
|
|
24641
|
+
properties: oldProperties,
|
|
24642
|
+
required: oldRequired,
|
|
24643
|
+
additionalProperties: oldAdditional,
|
|
24644
|
+
enum: oldEnum,
|
|
24645
|
+
...oldFixed
|
|
24646
|
+
} = before;
|
|
24647
|
+
const {
|
|
24648
|
+
properties: newProperties,
|
|
24649
|
+
required: newRequired,
|
|
24650
|
+
additionalProperties: newAdditional,
|
|
24651
|
+
enum: newEnum,
|
|
24652
|
+
...newFixed
|
|
24653
|
+
} = after;
|
|
24654
|
+
if (canonicalContentHash(oldFixed) !== canonicalContentHash(newFixed)) return false;
|
|
24655
|
+
if (newEnum && (!oldEnum || oldEnum.some((value) => !newEnum.some((candidate) => canonicalContentHash(candidate) === canonicalContentHash(value))))) return false;
|
|
24656
|
+
if ((newRequired ?? []).some((key) => !(oldRequired ?? []).includes(key))) return false;
|
|
24657
|
+
const oldExtra = oldAdditional ?? true;
|
|
24658
|
+
const newExtra = newAdditional ?? true;
|
|
24659
|
+
if (!acceptsPreviousSchema(oldExtra, newExtra)) return false;
|
|
24660
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(oldProperties ?? {}), ...Object.keys(newProperties ?? {})]);
|
|
24661
|
+
for (const key of keys) {
|
|
24662
|
+
if (!acceptsPreviousSchema(oldProperties?.[key] ?? oldExtra, newProperties?.[key] ?? newExtra)) return false;
|
|
24663
|
+
}
|
|
24664
|
+
return true;
|
|
24665
|
+
};
|
|
24666
|
+
var assertCompatibleCapabilityUpgrade = (previous, next) => {
|
|
24667
|
+
if (previous.provider.runtimeContractVersion !== void 0 && previous.provider.runtimeContractVersion !== next.provider.runtimeContractVersion || !sameStableRef(previous.declarativeRegistration.capabilityRevisionRef, next.declarativeRegistration.capabilityRevisionRef) || !sameStableRef(previous.declarativeRegistration.providerRevisionRef, next.declarativeRegistration.providerRevisionRef)) {
|
|
24668
|
+
throw new TypeError("A breaking runtime contract requires a new capability/provider identity while the existing contract remains supported.");
|
|
24669
|
+
}
|
|
24670
|
+
const providerContract = (entry) => {
|
|
24671
|
+
const { providerVersion: _revision, capabilityRef, performance: _performance, sideEffectAdapterRef, ...rest } = entry.provider;
|
|
24672
|
+
const { version: _capabilityRevision, ...capability } = capabilityRef;
|
|
24673
|
+
return {
|
|
24674
|
+
...rest,
|
|
24675
|
+
runtimeContractVersion: next.provider.runtimeContractVersion,
|
|
24676
|
+
capabilityRef: capability,
|
|
24677
|
+
...sideEffectAdapterRef ? { sideEffectAdapterRef: { ...sideEffectAdapterRef, version: void 0 } } : {}
|
|
24678
|
+
};
|
|
24679
|
+
};
|
|
24680
|
+
if (canonicalContentHash(providerContract(previous)) !== canonicalContentHash(providerContract(next))) {
|
|
24681
|
+
throw new TypeError("A compatible provider upgrade must preserve lifecycle, effects, ownership and public rendering semantics.");
|
|
24682
|
+
}
|
|
24683
|
+
const manifestContract = (entry) => ({
|
|
24684
|
+
kind: entry.manifest.kind,
|
|
24685
|
+
ports: entry.manifest.ports,
|
|
24686
|
+
runtime: { ...entry.manifest.runtime, providerBindings: entry.manifest.runtime.providerBindings.map((binding) => ({ ...binding, providerRef: { ...binding.providerRef, version: void 0 } })) },
|
|
24687
|
+
placement: entry.manifest.placement,
|
|
24688
|
+
accessibility: entry.manifest.accessibility
|
|
24689
|
+
});
|
|
24690
|
+
if (canonicalContentHash(manifestContract(previous)) !== canonicalContentHash(manifestContract(next))) {
|
|
24691
|
+
throw new TypeError("Capability behavior, placement and access semantics must preserve the published runtime contract.");
|
|
24692
|
+
}
|
|
24693
|
+
const oldRegistration = previous.declarativeRegistration;
|
|
24694
|
+
const newRegistration = next.declarativeRegistration;
|
|
24695
|
+
const schema2 = (entry, reference) => {
|
|
24696
|
+
const document = entry.schemaDocuments.find((candidate) => sameSchemaContract(candidate.schemaRevisionRef, reference));
|
|
24697
|
+
if (!document || canonicalContentHash(document.document) !== reference.contentHash) throw new TypeError("Runtime contract schema integrity failed.");
|
|
24698
|
+
return document.document;
|
|
24699
|
+
};
|
|
24700
|
+
const checkSchema = (oldRef, newRef, output = false) => {
|
|
24701
|
+
if (!sameStableRef(oldRef, newRef) || oldRef.schemaVersion !== newRef.schemaVersion || !acceptsPreviousSchema(
|
|
24702
|
+
schema2(output ? newRegistration : oldRegistration, output ? newRef : oldRef),
|
|
24703
|
+
schema2(output ? oldRegistration : newRegistration, output ? oldRef : newRef)
|
|
24704
|
+
)) {
|
|
24705
|
+
throw new TypeError(`Schema ${oldRef.id} breaks the published runtime contract.`);
|
|
24706
|
+
}
|
|
24707
|
+
};
|
|
24708
|
+
checkSchema(oldRegistration.propertySchemaRevisionRef, newRegistration.propertySchemaRevisionRef);
|
|
24709
|
+
for (const direction of ["inputPorts", "outputPorts"]) {
|
|
24710
|
+
const oldPorts = oldRegistration[direction];
|
|
24711
|
+
const newPorts = newRegistration[direction];
|
|
24712
|
+
if (oldPorts.length !== newPorts.length) throw new TypeError("Public runtime ports cannot be removed or replaced.");
|
|
24713
|
+
for (const port of oldPorts) {
|
|
24714
|
+
const replacement = newPorts.find((candidate) => candidate.name === port.name);
|
|
24715
|
+
if (!replacement || port.required !== replacement.required || port.multiple !== replacement.multiple) throw new TypeError("Public runtime port cardinality changed.");
|
|
24716
|
+
checkSchema(port.schemaRevisionRef, replacement.schemaRevisionRef, direction === "outputPorts");
|
|
24717
|
+
}
|
|
24718
|
+
}
|
|
24719
|
+
const requirements = (entry) => entry.ontologyRequirements.map((requirement) => {
|
|
24720
|
+
const { revision: _revision, contentHash: _hash, ...schema3 } = requirement.renderModelSchemaRevisionRef;
|
|
24721
|
+
return { ...requirement, renderModelSchemaRevisionRef: schema3 };
|
|
24722
|
+
});
|
|
24723
|
+
if (canonicalContentHash(requirements(oldRegistration)) !== canonicalContentHash(requirements(newRegistration))) {
|
|
24724
|
+
throw new TypeError("Runtime Ontology access requirements changed.");
|
|
24725
|
+
}
|
|
24726
|
+
for (const key of ["allowedSideEffects", "actionRequirements", "allowedSlots", "supportedSurfaces", "allowedParentCapabilityRefs", "allowedChildCapabilityRefs"]) {
|
|
24727
|
+
if (canonicalContentHash(oldRegistration[key]) !== canonicalContentHash(newRegistration[key])) throw new TypeError(`Runtime contract ${key} changed.`);
|
|
24728
|
+
}
|
|
24729
|
+
};
|
|
24730
|
+
var projectRuntimeContracts = (bundle, entries) => {
|
|
24731
|
+
const resolve = (request) => {
|
|
24732
|
+
if (request.runtimeContractVersion) return request.runtimeContractVersion;
|
|
24733
|
+
const candidates = entries.filter((entry) => sameStableRef(entry.declarativeRegistration.capabilityRevisionRef, request.capabilityRevisionRef) && sameStableRef(entry.declarativeRegistration.providerRevisionRef, request.providerRevisionRef));
|
|
24734
|
+
const current = [...candidates].sort((a, b) => b.declarativeRegistration.capabilityRevisionRef.revision - a.declarativeRegistration.capabilityRevisionRef.revision || b.declarativeRegistration.registrationRevisionRef.revision - a.declarativeRegistration.registrationRevisionRef.revision || Number(Boolean(b.provider.runtimeContractVersion)) - Number(Boolean(a.provider.runtimeContractVersion)))[0];
|
|
24735
|
+
if (!current?.provider.runtimeContractVersion) return void 0;
|
|
24736
|
+
try {
|
|
24737
|
+
assertDeclarativeCapabilityContract(current, request);
|
|
24738
|
+
return current.provider.runtimeContractVersion;
|
|
24739
|
+
} catch {
|
|
24740
|
+
const historical = candidates.find((entry) => sameRevisionRef(entry.declarativeRegistration.capabilityRevisionRef, request.capabilityRevisionRef) && sameRevisionRef(entry.declarativeRegistration.providerRevisionRef, request.providerRevisionRef));
|
|
24741
|
+
if (!historical) return void 0;
|
|
24742
|
+
try {
|
|
24743
|
+
assertDeclarativeCapabilityContract(historical, request);
|
|
24744
|
+
assertCompatibleCapabilityUpgrade(historical, current);
|
|
24745
|
+
return current.provider.runtimeContractVersion;
|
|
24746
|
+
} catch {
|
|
24747
|
+
return void 0;
|
|
24748
|
+
}
|
|
24749
|
+
}
|
|
24750
|
+
};
|
|
24751
|
+
const projected = structuredClone(bundle);
|
|
24752
|
+
if (projected.contract === "PageRuntimeBundle") {
|
|
24753
|
+
for (const instance of projected.capabilityInstances) {
|
|
24754
|
+
const contract = resolve(instance);
|
|
24755
|
+
if (!contract) continue;
|
|
24756
|
+
const node = projected.renderTree.nodes.find((node2) => node2.nodeId === instance.nodeId);
|
|
24757
|
+
if (!node || String(node.providerRef?.version) !== String(instance.providerRevisionRef.revision) || String(node.capabilityRef.version) !== String(instance.capabilityRevisionRef.revision) || node.providerRef?.id !== instance.providerRevisionRef.id || node.capabilityRef.id !== instance.capabilityRevisionRef.id) continue;
|
|
24758
|
+
instance.runtimeContractVersion = contract;
|
|
24759
|
+
node.runtimeContractVersion = contract;
|
|
24760
|
+
}
|
|
24761
|
+
} else {
|
|
24762
|
+
for (const instance of projected.appInstances) {
|
|
24763
|
+
const contract2 = resolve({ capabilityRevisionRef: instance.targetRevisionRef, providerRevisionRef: instance.providerRevisionRef, inputSchemaRevisionRef: instance.inputSchemaRevisionRef, runtimeContractVersion: instance.runtimeContractVersion });
|
|
24764
|
+
if (contract2) instance.runtimeContractVersion = contract2;
|
|
24765
|
+
}
|
|
24766
|
+
const contract = resolve({ capabilityRevisionRef: projected.layout.hostCapabilityRevisionRef, providerRevisionRef: projected.layout.hostProviderRevisionRef, runtimeContractVersion: projected.layout.runtimeContractVersion });
|
|
24767
|
+
if (contract) projected.layout.runtimeContractVersion = contract;
|
|
24768
|
+
}
|
|
24769
|
+
const { contentHash: _hash, ...unsigned } = projected;
|
|
24770
|
+
projected.contentHash = canonicalContentHash(unsigned);
|
|
24771
|
+
return projected;
|
|
24772
|
+
};
|
|
24773
|
+
|
|
24554
24774
|
// src/runtime/view-render-model.ts
|
|
24555
24775
|
var DEFAULT_FORBIDDEN_RENDER_MODEL_KEYS = Object.freeze([
|
|
24556
24776
|
"tenant",
|
|
@@ -25610,12 +25830,16 @@ export {
|
|
|
25610
25830
|
NAVIGATION_UNAVAILABLE_CAPABILITY_HEADER,
|
|
25611
25831
|
PageStreamReducerError,
|
|
25612
25832
|
ThemeTokenValidationError,
|
|
25833
|
+
acceptsPreviousSchema,
|
|
25613
25834
|
accessPolicyChainImplies,
|
|
25614
25835
|
applyPageStreamEvent,
|
|
25615
25836
|
applyRecordEditorDraft,
|
|
25616
25837
|
applyViewRuntimeBindings,
|
|
25838
|
+
assertCompatibleCapabilityUpgrade,
|
|
25839
|
+
assertDeclarativeCapabilityContract,
|
|
25617
25840
|
assertMonkeysThemeTokensComplete,
|
|
25618
25841
|
assertThemeTokensDocumentStructure,
|
|
25842
|
+
assertViewProviderContract,
|
|
25619
25843
|
buildApplicationHandoffUrl,
|
|
25620
25844
|
buildChangeImpactGraph,
|
|
25621
25845
|
canonicalContentHash,
|
|
@@ -25684,6 +25908,7 @@ export {
|
|
|
25684
25908
|
projectNavigationCompatibility,
|
|
25685
25909
|
projectPageProperties,
|
|
25686
25910
|
projectRecordEditorValidation,
|
|
25911
|
+
projectRuntimeContracts,
|
|
25687
25912
|
publishOpenApiToolCapabilityManifests,
|
|
25688
25913
|
readApplicationHandoffFromUrl,
|
|
25689
25914
|
readMenuActivationFromSearch,
|
|
@@ -25700,10 +25925,12 @@ export {
|
|
|
25700
25925
|
resolveWorkflowColumnResult,
|
|
25701
25926
|
revisionRefKey,
|
|
25702
25927
|
sameRevisionRef,
|
|
25928
|
+
sameSchemaContract,
|
|
25703
25929
|
sameStableRef,
|
|
25704
25930
|
serializeApplicationHandoff,
|
|
25705
25931
|
serializeMenuActivationSearch,
|
|
25706
25932
|
stableRefKey,
|
|
25933
|
+
supportsCapabilityInputSchema,
|
|
25707
25934
|
toAgentSessionViewModel,
|
|
25708
25935
|
validateDomainCommand,
|
|
25709
25936
|
validateThemeTokensDocument,
|