@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
package/lib/esm/index.mjs
CHANGED
|
@@ -9144,6 +9144,7 @@ var RenderNodeSchema = z7.object({
|
|
|
9144
9144
|
semanticRef: EntityRefSchema.optional(),
|
|
9145
9145
|
dataContextRef: EntityRefSchema.optional(),
|
|
9146
9146
|
capabilityRef: EntityRefSchema,
|
|
9147
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
9147
9148
|
providerRef: EntityRefSchema.optional(),
|
|
9148
9149
|
stateRef: EntityRefSchema.optional(),
|
|
9149
9150
|
surface: RenderSurfaceSchema,
|
|
@@ -9309,6 +9310,7 @@ var ViewProviderDescriptorSchema = z7.object({
|
|
|
9309
9310
|
contract: z7.literal("ViewProviderDescriptor"),
|
|
9310
9311
|
providerId: ContractIdentifierSchema,
|
|
9311
9312
|
providerVersion: ContractIdentifierSchema,
|
|
9313
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
9312
9314
|
ownerRepo: ContractIdentifierSchema,
|
|
9313
9315
|
capabilityRef: EntityRefSchema,
|
|
9314
9316
|
rendererKey: ContractIdentifierSchema,
|
|
@@ -11566,6 +11568,7 @@ var QueryBindingSchema = z15.object({
|
|
|
11566
11568
|
}
|
|
11567
11569
|
});
|
|
11568
11570
|
var CapabilityInstanceSchema = z15.object({
|
|
11571
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
11569
11572
|
instanceId: ContractIdentifierSchema,
|
|
11570
11573
|
nodeId: ContractIdentifierSchema,
|
|
11571
11574
|
capabilityRevisionRef: RevisionRefSchema,
|
|
@@ -13419,6 +13422,7 @@ var WorkbenchGroupSchema = z15.object({
|
|
|
13419
13422
|
accessPolicy: AccessPolicySchema.optional()
|
|
13420
13423
|
}).strict();
|
|
13421
13424
|
var WorkbenchAppInstanceSchema = z15.object({
|
|
13425
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
13422
13426
|
instanceId: ContractIdentifierSchema,
|
|
13423
13427
|
kind: z15.enum([
|
|
13424
13428
|
"built-in-application",
|
|
@@ -13464,6 +13468,7 @@ var WorkbenchSchema = z15.object({
|
|
|
13464
13468
|
showDefaultGroup: z15.boolean()
|
|
13465
13469
|
}).strict(),
|
|
13466
13470
|
layout: z15.object({
|
|
13471
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
13467
13472
|
hostCapabilityRevisionRef: RevisionRefSchema,
|
|
13468
13473
|
hostProviderRevisionRef: RevisionRefSchema,
|
|
13469
13474
|
layoutPolicyRevisionRef: RevisionRefSchema,
|
|
@@ -15420,6 +15425,7 @@ var DeclarativeCapabilitySchemaDocumentSchema = z19.object({
|
|
|
15420
15425
|
}
|
|
15421
15426
|
});
|
|
15422
15427
|
var DeclarativeCapabilityAuthoringRegistrationSchema = z19.object({
|
|
15428
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
15423
15429
|
registrationRevisionRef: RevisionRefSchema,
|
|
15424
15430
|
capabilityRevisionRef: RevisionRefSchema,
|
|
15425
15431
|
providerRevisionRef: RevisionRefSchema,
|
|
@@ -15546,6 +15552,9 @@ var ProductDeclarativeCapabilityRegistrationSchema = z19.object({
|
|
|
15546
15552
|
declarativeRegistration: DeclarativeCapabilityAuthoringRegistrationSchema,
|
|
15547
15553
|
requiredPermissionCodes: z19.array(ContractIdentifierSchema).default([])
|
|
15548
15554
|
}).strict().superRefine((value, context) => {
|
|
15555
|
+
if (value.provider.runtimeContractVersion !== value.declarativeRegistration.runtimeContractVersion) {
|
|
15556
|
+
context.addIssue({ code: "custom", path: ["declarativeRegistration", "runtimeContractVersion"], message: "The authoring contract must match its runtime provider." });
|
|
15557
|
+
}
|
|
15549
15558
|
const ownerRepo = value.manifest.ownerRepo;
|
|
15550
15559
|
const registration = value.declarativeRegistration;
|
|
15551
15560
|
if (ownerRepo === "monkeys-design") {
|
|
@@ -16060,6 +16069,7 @@ var DeclarativeBindingAuthoringChoiceSchema = DeclarativeAuthoringChoiceSchema.e
|
|
|
16060
16069
|
}).strict()
|
|
16061
16070
|
}).strict();
|
|
16062
16071
|
var DeclarativeWorkbenchTargetChoiceSchema = z19.object({
|
|
16072
|
+
runtimeContractVersion: ContractIdentifierSchema.optional(),
|
|
16063
16073
|
stableTargetRef: StableRefSchema,
|
|
16064
16074
|
targetRevisionRef: RevisionRefSchema,
|
|
16065
16075
|
providerRevisionRef: RevisionRefSchema,
|
|
@@ -22002,6 +22012,7 @@ var stableRefKey = (reference) => `${reference.visibility}:${reference.tenantSco
|
|
|
22002
22012
|
var revisionRefKey = (reference) => `${stableRefKey(reference)}@${reference.revision}:v${reference.schemaVersion}:${reference.contentHash.toLowerCase()}`;
|
|
22003
22013
|
var sameStableRef = (left, right) => stableRefKey(left) === stableRefKey(right);
|
|
22004
22014
|
var sameRevisionRef = (left, right) => revisionRefKey(left) === revisionRefKey(right);
|
|
22015
|
+
var sameSchemaContract = (left, right) => left.kind === "schema" && right.kind === "schema" && sameStableRef(left, right) && left.schemaVersion === right.schemaVersion && left.contentHash === right.contentHash;
|
|
22005
22016
|
var assertUniqueRegistryKeys = (keys, path) => {
|
|
22006
22017
|
const seen = /* @__PURE__ */ new Set();
|
|
22007
22018
|
keys.forEach((key, index) => {
|
|
@@ -22271,7 +22282,7 @@ var compileDesignCapabilityCatalogArtifact = (input) => {
|
|
|
22271
22282
|
...unsignedRegistration
|
|
22272
22283
|
} = registration;
|
|
22273
22284
|
const registrationHash = canonicalContentHash(unsignedRegistration);
|
|
22274
|
-
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) {
|
|
22285
|
+
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) {
|
|
22275
22286
|
throw new DeclarativeControlCompilationError(
|
|
22276
22287
|
"DESIGN_CATALOG_INVALID",
|
|
22277
22288
|
`entries[${index}]`,
|
|
@@ -23212,6 +23223,7 @@ var resolvePage = (input) => {
|
|
|
23212
23223
|
version: 1,
|
|
23213
23224
|
ownerRepo: input.pageOwnerRepo
|
|
23214
23225
|
},
|
|
23226
|
+
...registration.runtimeContractVersion ? { runtimeContractVersion: registration.runtimeContractVersion } : {},
|
|
23215
23227
|
capabilityRef: simpleEntityRef(registration.revisionRef),
|
|
23216
23228
|
providerRef: simpleEntityRef(registration.providerRevisionRef),
|
|
23217
23229
|
surface: node.surface ?? defaultRenderSurface,
|
|
@@ -23226,6 +23238,7 @@ var resolvePage = (input) => {
|
|
|
23226
23238
|
...node.repeat ? { repeat: { ...node.repeat, limit: node.repeat.limit ?? 200 } } : {}
|
|
23227
23239
|
});
|
|
23228
23240
|
capabilityInstances.push({
|
|
23241
|
+
...registration.runtimeContractVersion ? { runtimeContractVersion: registration.runtimeContractVersion } : {},
|
|
23229
23242
|
instanceId: node.id,
|
|
23230
23243
|
nodeId: node.id,
|
|
23231
23244
|
capabilityRevisionRef: registration.revisionRef,
|
|
@@ -23775,6 +23788,9 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
23775
23788
|
"Capability/provider pair has no exact governed Design registration."
|
|
23776
23789
|
);
|
|
23777
23790
|
}
|
|
23791
|
+
if (instance.runtimeContractVersion !== registration.runtimeContractVersion || node.runtimeContractVersion !== instance.runtimeContractVersion) {
|
|
23792
|
+
throw new DeclarativeControlCompilationError("CAPABILITY_BINDING_MISMATCH", `capabilityInstances[${index}].runtimeContractVersion`, "Runtime contract must be issued by the exact governed registration.");
|
|
23793
|
+
}
|
|
23778
23794
|
if (instance.allowedSideEffects.some(
|
|
23779
23795
|
(sideEffect) => !registration.allowedSideEffects.includes(sideEffect)
|
|
23780
23796
|
)) {
|
|
@@ -23835,7 +23851,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
23835
23851
|
const port = registration?.inputPorts.find(
|
|
23836
23852
|
(candidate) => candidate.name === binding.target.port
|
|
23837
23853
|
);
|
|
23838
|
-
if (!port || !
|
|
23854
|
+
if (!port || !sameSchemaContract(
|
|
23839
23855
|
port.schemaRevisionRef,
|
|
23840
23856
|
binding.renderModelSchemaRevisionRef
|
|
23841
23857
|
)) {
|
|
@@ -23855,7 +23871,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
23855
23871
|
const pageChangePort = sourceRegistration?.outputPorts.find(
|
|
23856
23872
|
(candidate) => candidate.name === binding.cursorWindow.pageChangePort
|
|
23857
23873
|
);
|
|
23858
|
-
if (!pageChangePort || !
|
|
23874
|
+
if (!pageChangePort || !sameSchemaContract(
|
|
23859
23875
|
pageChangePort.schemaRevisionRef,
|
|
23860
23876
|
binding.cursorWindow.pageChangeIntentSchemaRevisionRef
|
|
23861
23877
|
)) {
|
|
@@ -23877,7 +23893,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
23877
23893
|
const port = registration?.inputPorts.find(
|
|
23878
23894
|
(candidate) => candidate.name === binding.target.port
|
|
23879
23895
|
);
|
|
23880
|
-
if (!port || !
|
|
23896
|
+
if (!port || !sameSchemaContract(
|
|
23881
23897
|
port.schemaRevisionRef,
|
|
23882
23898
|
binding.targetProjection?.schemaRevisionRef ?? binding.renderModelSchemaRevisionRef
|
|
23883
23899
|
)) {
|
|
@@ -23907,7 +23923,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
23907
23923
|
const pageChangePort = sourceRegistration?.outputPorts.find(
|
|
23908
23924
|
(candidate) => candidate.name === binding.cursorWindow.pageChangePort
|
|
23909
23925
|
);
|
|
23910
|
-
if (!pageChangePort || !
|
|
23926
|
+
if (!pageChangePort || !sameSchemaContract(
|
|
23911
23927
|
pageChangePort.schemaRevisionRef,
|
|
23912
23928
|
binding.cursorWindow.pageChangeIntentSchemaRevisionRef
|
|
23913
23929
|
)) {
|
|
@@ -23956,7 +23972,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
23956
23972
|
const port = registration?.outputPorts.find(
|
|
23957
23973
|
(candidate) => candidate.name === binding.source.port
|
|
23958
23974
|
);
|
|
23959
|
-
if (!port || !
|
|
23975
|
+
if (!port || !sameSchemaContract(
|
|
23960
23976
|
port.schemaRevisionRef,
|
|
23961
23977
|
binding.sourceIntentSchemaRevisionRef
|
|
23962
23978
|
)) {
|
|
@@ -23977,7 +23993,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
23977
23993
|
const port = registration?.outputPorts.find(
|
|
23978
23994
|
(candidate) => candidate.name === binding.source.port
|
|
23979
23995
|
);
|
|
23980
|
-
if (!port || !
|
|
23996
|
+
if (!port || !sameSchemaContract(
|
|
23981
23997
|
port.schemaRevisionRef,
|
|
23982
23998
|
binding.sourceIntentSchemaRevisionRef
|
|
23983
23999
|
)) {
|
|
@@ -24300,6 +24316,14 @@ var compileWorkbenchRuntimeBundle = (input) => {
|
|
|
24300
24316
|
const groupsById = new Map(
|
|
24301
24317
|
workbench.groups.map((group) => [group.groupId, group])
|
|
24302
24318
|
);
|
|
24319
|
+
const contractFor = (capabilityRef, providerRef, declared) => {
|
|
24320
|
+
const registration = input.capabilityRegistry?.find((candidate) => sameRevisionRef(candidate.capabilityRevisionRef, capabilityRef) && sameRevisionRef(candidate.providerRevisionRef, providerRef));
|
|
24321
|
+
if (declared !== void 0 && declared !== registration?.runtimeContractVersion) {
|
|
24322
|
+
throw new DeclarativeControlCompilationError("CAPABILITY_BINDING_MISMATCH", "workbench.runtimeContractVersion", "Runtime contract must be issued by the exact governed registration.");
|
|
24323
|
+
}
|
|
24324
|
+
return registration?.runtimeContractVersion;
|
|
24325
|
+
};
|
|
24326
|
+
const layoutContract = contractFor(workbench.layout.hostCapabilityRevisionRef, workbench.layout.hostProviderRevisionRef, workbench.layout.runtimeContractVersion);
|
|
24303
24327
|
const appInstances = workbench.appInstances.map((instance, index) => {
|
|
24304
24328
|
const stableTarget = StableRefSchema.parse({
|
|
24305
24329
|
kind: instance.targetRevisionRef.kind,
|
|
@@ -24340,7 +24364,8 @@ var compileWorkbenchRuntimeBundle = (input) => {
|
|
|
24340
24364
|
"Workbench and instance audience is wider than the target audience."
|
|
24341
24365
|
);
|
|
24342
24366
|
}
|
|
24343
|
-
|
|
24367
|
+
const runtimeContractVersion = contractFor(instance.targetRevisionRef, instance.providerRevisionRef, instance.runtimeContractVersion);
|
|
24368
|
+
return { ...instance, ...runtimeContractVersion ? { runtimeContractVersion } : {}, targetAccessPolicy: registration.accessPolicy };
|
|
24344
24369
|
});
|
|
24345
24370
|
const unsigned = {
|
|
24346
24371
|
contract: "WorkbenchRuntimeBundle",
|
|
@@ -24363,7 +24388,7 @@ var compileWorkbenchRuntimeBundle = (input) => {
|
|
|
24363
24388
|
groups: workbench.groups,
|
|
24364
24389
|
appInstances,
|
|
24365
24390
|
defaultEntry: workbench.defaultEntry,
|
|
24366
|
-
layout: workbench.layout,
|
|
24391
|
+
layout: { ...workbench.layout, ...layoutContract ? { runtimeContractVersion: layoutContract } : {} },
|
|
24367
24392
|
workbenchAccessPolicy: workbench.workbenchAccessPolicy,
|
|
24368
24393
|
personalPreferencesPolicy: workbench.personalPreferencesPolicy,
|
|
24369
24394
|
target: { ...release.target, routeClaim: releaseRoute },
|
|
@@ -26016,6 +26041,201 @@ var compileTenantRuntimeBindings = (config, policy) => {
|
|
|
26016
26041
|
});
|
|
26017
26042
|
};
|
|
26018
26043
|
|
|
26044
|
+
// src/runtime/declarative-runtime-contract.ts
|
|
26045
|
+
var assertViewProviderContract = (node, provider) => {
|
|
26046
|
+
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) {
|
|
26047
|
+
throw new TypeError("Runtime capability and provider identities do not match their registered owners.");
|
|
26048
|
+
}
|
|
26049
|
+
if (node.runtimeContractVersion !== void 0) {
|
|
26050
|
+
if (node.runtimeContractVersion !== provider.runtimeContractVersion) {
|
|
26051
|
+
throw new TypeError("The provider does not implement the declared runtime contract.");
|
|
26052
|
+
}
|
|
26053
|
+
} else if (String(node.capabilityRef.version) !== String(provider.capabilityRef.version) || String(node.providerRef.version) !== provider.providerVersion) {
|
|
26054
|
+
throw new TypeError("An unversioned runtime contract requires an exact provider snapshot.");
|
|
26055
|
+
}
|
|
26056
|
+
};
|
|
26057
|
+
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)));
|
|
26058
|
+
var assertDeclarativeCapabilityContract = (entry, request) => {
|
|
26059
|
+
const registration = entry.declarativeRegistration;
|
|
26060
|
+
if (request.inputSchemaRevisionRef && !supportsCapabilityInputSchema(entry, request.inputSchemaRevisionRef, request.runtimeContractVersion)) {
|
|
26061
|
+
throw new TypeError("The input schema is not owned by the runtime contract.");
|
|
26062
|
+
}
|
|
26063
|
+
if (!sameStableRef(request.capabilityRevisionRef, registration.capabilityRevisionRef) || !sameStableRef(request.providerRevisionRef, registration.providerRevisionRef) || request.capabilityRevisionRef.schemaVersion !== registration.capabilityRevisionRef.schemaVersion || request.providerRevisionRef.schemaVersion !== registration.providerRevisionRef.schemaVersion) {
|
|
26064
|
+
throw new TypeError("Runtime contract snapshots must retain their registered identity, scope and schema version.");
|
|
26065
|
+
}
|
|
26066
|
+
if (request.runtimeContractVersion !== void 0) {
|
|
26067
|
+
if (request.runtimeContractVersion !== entry.provider.runtimeContractVersion || request.propertySchemaRevisionRef && (!sameStableRef(request.propertySchemaRevisionRef, registration.propertySchemaRevisionRef) || request.propertySchemaRevisionRef.schemaVersion !== registration.propertySchemaRevisionRef.schemaVersion)) {
|
|
26068
|
+
throw new TypeError("The capability does not implement the declared runtime contract.");
|
|
26069
|
+
}
|
|
26070
|
+
return;
|
|
26071
|
+
}
|
|
26072
|
+
const capabilityVersion = String(request.capabilityRevisionRef.revision);
|
|
26073
|
+
const providerVersion = String(request.providerRevisionRef.revision);
|
|
26074
|
+
const manifest = {
|
|
26075
|
+
...entry.manifest,
|
|
26076
|
+
capabilityVersion,
|
|
26077
|
+
runtime: {
|
|
26078
|
+
...entry.manifest.runtime,
|
|
26079
|
+
providerBindings: entry.manifest.runtime.providerBindings.map((binding) => ({
|
|
26080
|
+
...binding,
|
|
26081
|
+
providerRef: binding.providerRef.id === entry.provider.providerId ? { ...binding.providerRef, version: providerVersion } : binding.providerRef
|
|
26082
|
+
}))
|
|
26083
|
+
}
|
|
26084
|
+
};
|
|
26085
|
+
const { runtimeContractVersion: _contract, ...descriptor } = entry.provider;
|
|
26086
|
+
const provider = {
|
|
26087
|
+
...descriptor,
|
|
26088
|
+
providerVersion,
|
|
26089
|
+
capabilityRef: { ...descriptor.capabilityRef, version: capabilityVersion },
|
|
26090
|
+
...descriptor.sideEffectAdapterRef ? { sideEffectAdapterRef: { ...descriptor.sideEffectAdapterRef, version: capabilityVersion } } : {}
|
|
26091
|
+
};
|
|
26092
|
+
const exact = sameRevisionRef(request.capabilityRevisionRef, registration.capabilityRevisionRef) && sameRevisionRef(request.providerRevisionRef, registration.providerRevisionRef);
|
|
26093
|
+
const equivalent = request.capabilityRevisionRef.contentHash === canonicalContentHash(manifest) && request.providerRevisionRef.contentHash === canonicalContentHash(provider);
|
|
26094
|
+
if (!exact && !equivalent || request.propertySchemaRevisionRef && !sameSchemaContract(request.propertySchemaRevisionRef, registration.propertySchemaRevisionRef)) {
|
|
26095
|
+
throw new TypeError("The historical capability snapshot is not supported by the current runtime contract.");
|
|
26096
|
+
}
|
|
26097
|
+
};
|
|
26098
|
+
var acceptsPreviousSchema = (previous, next) => {
|
|
26099
|
+
if (canonicalContentHash(previous) === canonicalContentHash(next) || next === true) return true;
|
|
26100
|
+
if (previous === false) return true;
|
|
26101
|
+
if (!previous || !next || typeof previous !== "object" || typeof next !== "object" || Array.isArray(previous) || Array.isArray(next)) return false;
|
|
26102
|
+
const withoutAnnotations = (schema2) => Object.fromEntries(Object.entries(schema2).filter(([key]) => !["title", "description", "examples", "$comment"].includes(key)));
|
|
26103
|
+
const before = withoutAnnotations(previous);
|
|
26104
|
+
const after = withoutAnnotations(next);
|
|
26105
|
+
const {
|
|
26106
|
+
properties: oldProperties,
|
|
26107
|
+
required: oldRequired,
|
|
26108
|
+
additionalProperties: oldAdditional,
|
|
26109
|
+
enum: oldEnum,
|
|
26110
|
+
...oldFixed
|
|
26111
|
+
} = before;
|
|
26112
|
+
const {
|
|
26113
|
+
properties: newProperties,
|
|
26114
|
+
required: newRequired,
|
|
26115
|
+
additionalProperties: newAdditional,
|
|
26116
|
+
enum: newEnum,
|
|
26117
|
+
...newFixed
|
|
26118
|
+
} = after;
|
|
26119
|
+
if (canonicalContentHash(oldFixed) !== canonicalContentHash(newFixed)) return false;
|
|
26120
|
+
if (newEnum && (!oldEnum || oldEnum.some((value) => !newEnum.some((candidate) => canonicalContentHash(candidate) === canonicalContentHash(value))))) return false;
|
|
26121
|
+
if ((newRequired ?? []).some((key) => !(oldRequired ?? []).includes(key))) return false;
|
|
26122
|
+
const oldExtra = oldAdditional ?? true;
|
|
26123
|
+
const newExtra = newAdditional ?? true;
|
|
26124
|
+
if (!acceptsPreviousSchema(oldExtra, newExtra)) return false;
|
|
26125
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(oldProperties ?? {}), ...Object.keys(newProperties ?? {})]);
|
|
26126
|
+
for (const key of keys) {
|
|
26127
|
+
if (!acceptsPreviousSchema(oldProperties?.[key] ?? oldExtra, newProperties?.[key] ?? newExtra)) return false;
|
|
26128
|
+
}
|
|
26129
|
+
return true;
|
|
26130
|
+
};
|
|
26131
|
+
var assertCompatibleCapabilityUpgrade = (previous, next) => {
|
|
26132
|
+
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)) {
|
|
26133
|
+
throw new TypeError("A breaking runtime contract requires a new capability/provider identity while the existing contract remains supported.");
|
|
26134
|
+
}
|
|
26135
|
+
const providerContract = (entry) => {
|
|
26136
|
+
const { providerVersion: _revision, capabilityRef, performance: _performance, sideEffectAdapterRef, ...rest } = entry.provider;
|
|
26137
|
+
const { version: _capabilityRevision, ...capability } = capabilityRef;
|
|
26138
|
+
return {
|
|
26139
|
+
...rest,
|
|
26140
|
+
runtimeContractVersion: next.provider.runtimeContractVersion,
|
|
26141
|
+
capabilityRef: capability,
|
|
26142
|
+
...sideEffectAdapterRef ? { sideEffectAdapterRef: { ...sideEffectAdapterRef, version: void 0 } } : {}
|
|
26143
|
+
};
|
|
26144
|
+
};
|
|
26145
|
+
if (canonicalContentHash(providerContract(previous)) !== canonicalContentHash(providerContract(next))) {
|
|
26146
|
+
throw new TypeError("A compatible provider upgrade must preserve lifecycle, effects, ownership and public rendering semantics.");
|
|
26147
|
+
}
|
|
26148
|
+
const manifestContract = (entry) => ({
|
|
26149
|
+
kind: entry.manifest.kind,
|
|
26150
|
+
ports: entry.manifest.ports,
|
|
26151
|
+
runtime: { ...entry.manifest.runtime, providerBindings: entry.manifest.runtime.providerBindings.map((binding) => ({ ...binding, providerRef: { ...binding.providerRef, version: void 0 } })) },
|
|
26152
|
+
placement: entry.manifest.placement,
|
|
26153
|
+
accessibility: entry.manifest.accessibility
|
|
26154
|
+
});
|
|
26155
|
+
if (canonicalContentHash(manifestContract(previous)) !== canonicalContentHash(manifestContract(next))) {
|
|
26156
|
+
throw new TypeError("Capability behavior, placement and access semantics must preserve the published runtime contract.");
|
|
26157
|
+
}
|
|
26158
|
+
const oldRegistration = previous.declarativeRegistration;
|
|
26159
|
+
const newRegistration = next.declarativeRegistration;
|
|
26160
|
+
const schema2 = (entry, reference) => {
|
|
26161
|
+
const document = entry.schemaDocuments.find((candidate) => sameSchemaContract(candidate.schemaRevisionRef, reference));
|
|
26162
|
+
if (!document || canonicalContentHash(document.document) !== reference.contentHash) throw new TypeError("Runtime contract schema integrity failed.");
|
|
26163
|
+
return document.document;
|
|
26164
|
+
};
|
|
26165
|
+
const checkSchema = (oldRef, newRef, output = false) => {
|
|
26166
|
+
if (!sameStableRef(oldRef, newRef) || oldRef.schemaVersion !== newRef.schemaVersion || !acceptsPreviousSchema(
|
|
26167
|
+
schema2(output ? newRegistration : oldRegistration, output ? newRef : oldRef),
|
|
26168
|
+
schema2(output ? oldRegistration : newRegistration, output ? oldRef : newRef)
|
|
26169
|
+
)) {
|
|
26170
|
+
throw new TypeError(`Schema ${oldRef.id} breaks the published runtime contract.`);
|
|
26171
|
+
}
|
|
26172
|
+
};
|
|
26173
|
+
checkSchema(oldRegistration.propertySchemaRevisionRef, newRegistration.propertySchemaRevisionRef);
|
|
26174
|
+
for (const direction of ["inputPorts", "outputPorts"]) {
|
|
26175
|
+
const oldPorts = oldRegistration[direction];
|
|
26176
|
+
const newPorts = newRegistration[direction];
|
|
26177
|
+
if (oldPorts.length !== newPorts.length) throw new TypeError("Public runtime ports cannot be removed or replaced.");
|
|
26178
|
+
for (const port of oldPorts) {
|
|
26179
|
+
const replacement = newPorts.find((candidate) => candidate.name === port.name);
|
|
26180
|
+
if (!replacement || port.required !== replacement.required || port.multiple !== replacement.multiple) throw new TypeError("Public runtime port cardinality changed.");
|
|
26181
|
+
checkSchema(port.schemaRevisionRef, replacement.schemaRevisionRef, direction === "outputPorts");
|
|
26182
|
+
}
|
|
26183
|
+
}
|
|
26184
|
+
const requirements = (entry) => entry.ontologyRequirements.map((requirement) => {
|
|
26185
|
+
const { revision: _revision, contentHash: _hash, ...schema3 } = requirement.renderModelSchemaRevisionRef;
|
|
26186
|
+
return { ...requirement, renderModelSchemaRevisionRef: schema3 };
|
|
26187
|
+
});
|
|
26188
|
+
if (canonicalContentHash(requirements(oldRegistration)) !== canonicalContentHash(requirements(newRegistration))) {
|
|
26189
|
+
throw new TypeError("Runtime Ontology access requirements changed.");
|
|
26190
|
+
}
|
|
26191
|
+
for (const key of ["allowedSideEffects", "actionRequirements", "allowedSlots", "supportedSurfaces", "allowedParentCapabilityRefs", "allowedChildCapabilityRefs"]) {
|
|
26192
|
+
if (canonicalContentHash(oldRegistration[key]) !== canonicalContentHash(newRegistration[key])) throw new TypeError(`Runtime contract ${key} changed.`);
|
|
26193
|
+
}
|
|
26194
|
+
};
|
|
26195
|
+
var projectRuntimeContracts = (bundle, entries) => {
|
|
26196
|
+
const resolve = (request) => {
|
|
26197
|
+
if (request.runtimeContractVersion) return request.runtimeContractVersion;
|
|
26198
|
+
const candidates = entries.filter((entry) => sameStableRef(entry.declarativeRegistration.capabilityRevisionRef, request.capabilityRevisionRef) && sameStableRef(entry.declarativeRegistration.providerRevisionRef, request.providerRevisionRef));
|
|
26199
|
+
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];
|
|
26200
|
+
if (!current?.provider.runtimeContractVersion) return void 0;
|
|
26201
|
+
try {
|
|
26202
|
+
assertDeclarativeCapabilityContract(current, request);
|
|
26203
|
+
return current.provider.runtimeContractVersion;
|
|
26204
|
+
} catch {
|
|
26205
|
+
const historical = candidates.find((entry) => sameRevisionRef(entry.declarativeRegistration.capabilityRevisionRef, request.capabilityRevisionRef) && sameRevisionRef(entry.declarativeRegistration.providerRevisionRef, request.providerRevisionRef));
|
|
26206
|
+
if (!historical) return void 0;
|
|
26207
|
+
try {
|
|
26208
|
+
assertDeclarativeCapabilityContract(historical, request);
|
|
26209
|
+
assertCompatibleCapabilityUpgrade(historical, current);
|
|
26210
|
+
return current.provider.runtimeContractVersion;
|
|
26211
|
+
} catch {
|
|
26212
|
+
return void 0;
|
|
26213
|
+
}
|
|
26214
|
+
}
|
|
26215
|
+
};
|
|
26216
|
+
const projected = structuredClone(bundle);
|
|
26217
|
+
if (projected.contract === "PageRuntimeBundle") {
|
|
26218
|
+
for (const instance of projected.capabilityInstances) {
|
|
26219
|
+
const contract = resolve(instance);
|
|
26220
|
+
if (!contract) continue;
|
|
26221
|
+
const node = projected.renderTree.nodes.find((node2) => node2.nodeId === instance.nodeId);
|
|
26222
|
+
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;
|
|
26223
|
+
instance.runtimeContractVersion = contract;
|
|
26224
|
+
node.runtimeContractVersion = contract;
|
|
26225
|
+
}
|
|
26226
|
+
} else {
|
|
26227
|
+
for (const instance of projected.appInstances) {
|
|
26228
|
+
const contract2 = resolve({ capabilityRevisionRef: instance.targetRevisionRef, providerRevisionRef: instance.providerRevisionRef, inputSchemaRevisionRef: instance.inputSchemaRevisionRef, runtimeContractVersion: instance.runtimeContractVersion });
|
|
26229
|
+
if (contract2) instance.runtimeContractVersion = contract2;
|
|
26230
|
+
}
|
|
26231
|
+
const contract = resolve({ capabilityRevisionRef: projected.layout.hostCapabilityRevisionRef, providerRevisionRef: projected.layout.hostProviderRevisionRef, runtimeContractVersion: projected.layout.runtimeContractVersion });
|
|
26232
|
+
if (contract) projected.layout.runtimeContractVersion = contract;
|
|
26233
|
+
}
|
|
26234
|
+
const { contentHash: _hash, ...unsigned } = projected;
|
|
26235
|
+
projected.contentHash = canonicalContentHash(unsigned);
|
|
26236
|
+
return projected;
|
|
26237
|
+
};
|
|
26238
|
+
|
|
26019
26239
|
// src/runtime/view-render-model.ts
|
|
26020
26240
|
var DEFAULT_FORBIDDEN_RENDER_MODEL_KEYS = Object.freeze([
|
|
26021
26241
|
"tenant",
|
|
@@ -27393,15 +27613,19 @@ export {
|
|
|
27393
27613
|
WorkflowTriggerSchema,
|
|
27394
27614
|
WorkflowTriggerType,
|
|
27395
27615
|
WorkflowValidationIssueSchema,
|
|
27616
|
+
acceptsPreviousSchema,
|
|
27396
27617
|
accessPolicyChainImplies,
|
|
27397
27618
|
agentModeHasCapability,
|
|
27398
27619
|
analyzePageBindingDependencies,
|
|
27399
27620
|
applyPageStreamEvent,
|
|
27400
27621
|
applyRecordEditorDraft,
|
|
27401
27622
|
applyViewRuntimeBindings,
|
|
27623
|
+
assertCompatibleCapabilityUpgrade,
|
|
27624
|
+
assertDeclarativeCapabilityContract,
|
|
27402
27625
|
assertMonkeysThemeTokensComplete,
|
|
27403
27626
|
assertPageValueBudget,
|
|
27404
27627
|
assertThemeTokensDocumentStructure,
|
|
27628
|
+
assertViewProviderContract,
|
|
27405
27629
|
buildApplicationHandoffUrl,
|
|
27406
27630
|
buildChangeImpactGraph,
|
|
27407
27631
|
canApplyAgentSessionRunStatus,
|
|
@@ -27486,6 +27710,7 @@ export {
|
|
|
27486
27710
|
projectNavigationCompatibility,
|
|
27487
27711
|
projectPageProperties,
|
|
27488
27712
|
projectRecordEditorValidation,
|
|
27713
|
+
projectRuntimeContracts,
|
|
27489
27714
|
publishOpenApiToolCapabilityManifests,
|
|
27490
27715
|
readApplicationHandoffFromUrl,
|
|
27491
27716
|
readMenuActivationFromSearch,
|
|
@@ -27504,10 +27729,12 @@ export {
|
|
|
27504
27729
|
resolveWorkflowColumnResult,
|
|
27505
27730
|
revisionRefKey,
|
|
27506
27731
|
sameRevisionRef,
|
|
27732
|
+
sameSchemaContract,
|
|
27507
27733
|
sameStableRef,
|
|
27508
27734
|
serializeApplicationHandoff,
|
|
27509
27735
|
serializeMenuActivationSearch,
|
|
27510
27736
|
stableRefKey,
|
|
27737
|
+
supportsCapabilityInputSchema,
|
|
27511
27738
|
toAgentSessionViewModel,
|
|
27512
27739
|
validateDomainCommand,
|
|
27513
27740
|
validateThemeTokensDocument,
|