@appport/sdk 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +23 -1
  2. package/dist/external-compatibility.d.ts +142 -0
  3. package/dist/external-compatibility.d.ts.map +1 -0
  4. package/dist/external-compatibility.js +132 -0
  5. package/dist/external-compatibility.js.map +1 -0
  6. package/dist/index.d.ts +4 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +4 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/provider-lifecycle.d.ts +247 -0
  11. package/dist/provider-lifecycle.d.ts.map +1 -0
  12. package/dist/provider-lifecycle.js +314 -0
  13. package/dist/provider-lifecycle.js.map +1 -0
  14. package/dist/resolution-policy.d.ts +81 -0
  15. package/dist/resolution-policy.d.ts.map +1 -0
  16. package/dist/resolution-policy.js +131 -0
  17. package/dist/resolution-policy.js.map +1 -0
  18. package/package.json +1 -1
  19. package/vendor/@appport/core/dist/appboundry-capability-catalog.d.ts +930 -0
  20. package/vendor/@appport/core/dist/appboundry-capability-catalog.d.ts.map +1 -0
  21. package/vendor/@appport/core/dist/appboundry-capability-catalog.js +352 -0
  22. package/vendor/@appport/core/dist/appboundry-capability-catalog.js.map +1 -0
  23. package/vendor/@appport/core/dist/appboundry-composition.d.ts +93 -0
  24. package/vendor/@appport/core/dist/appboundry-composition.d.ts.map +1 -0
  25. package/vendor/@appport/core/dist/appboundry-composition.js +184 -0
  26. package/vendor/@appport/core/dist/appboundry-composition.js.map +1 -0
  27. package/vendor/@appport/core/dist/appboundry-discovery.d.ts +110 -0
  28. package/vendor/@appport/core/dist/appboundry-discovery.d.ts.map +1 -0
  29. package/vendor/@appport/core/dist/appboundry-discovery.js +141 -0
  30. package/vendor/@appport/core/dist/appboundry-discovery.js.map +1 -0
  31. package/vendor/@appport/core/dist/appboundry-entitlements.d.ts +128 -0
  32. package/vendor/@appport/core/dist/appboundry-entitlements.d.ts.map +1 -0
  33. package/vendor/@appport/core/dist/appboundry-entitlements.js +312 -0
  34. package/vendor/@appport/core/dist/appboundry-entitlements.js.map +1 -0
  35. package/vendor/@appport/core/dist/appboundry-execution.d.ts +72 -0
  36. package/vendor/@appport/core/dist/appboundry-execution.d.ts.map +1 -0
  37. package/vendor/@appport/core/dist/appboundry-execution.js +114 -0
  38. package/vendor/@appport/core/dist/appboundry-execution.js.map +1 -0
  39. package/vendor/@appport/core/dist/appboundry-materialization.d.ts +222 -0
  40. package/vendor/@appport/core/dist/appboundry-materialization.d.ts.map +1 -0
  41. package/vendor/@appport/core/dist/appboundry-materialization.js +474 -0
  42. package/vendor/@appport/core/dist/appboundry-materialization.js.map +1 -0
  43. package/vendor/@appport/core/dist/appboundry-resolution.d.ts +160 -0
  44. package/vendor/@appport/core/dist/appboundry-resolution.d.ts.map +1 -0
  45. package/vendor/@appport/core/dist/appboundry-resolution.js +218 -0
  46. package/vendor/@appport/core/dist/appboundry-resolution.js.map +1 -0
  47. package/vendor/@appport/core/dist/appboundry-surface.d.ts +96 -0
  48. package/vendor/@appport/core/dist/appboundry-surface.d.ts.map +1 -0
  49. package/vendor/@appport/core/dist/appboundry-surface.js +223 -0
  50. package/vendor/@appport/core/dist/appboundry-surface.js.map +1 -0
  51. package/vendor/@appport/core/dist/application.d.ts +3 -1
  52. package/vendor/@appport/core/dist/application.d.ts.map +1 -1
  53. package/vendor/@appport/core/dist/application.js +3 -0
  54. package/vendor/@appport/core/dist/application.js.map +1 -1
  55. package/vendor/@appport/core/dist/index.d.ts +8 -0
  56. package/vendor/@appport/core/dist/index.d.ts.map +1 -1
  57. package/vendor/@appport/core/dist/index.js +8 -0
  58. package/vendor/@appport/core/dist/index.js.map +1 -1
  59. package/vendor/@appport/core/dist/public.d.ts +1 -0
  60. package/vendor/@appport/core/dist/public.d.ts.map +1 -1
  61. package/vendor/@appport/core/dist/public.js +1 -0
  62. package/vendor/@appport/core/dist/public.js.map +1 -1
  63. package/vendor/@appport/core/dist/registry.d.ts +2 -1
  64. package/vendor/@appport/core/dist/registry.d.ts.map +1 -1
  65. package/vendor/@appport/core/dist/registry.js +1 -0
  66. package/vendor/@appport/core/dist/registry.js.map +1 -1
  67. package/vendor/@appport/mcp/README.md +29 -0
  68. package/vendor/@appport/mcp/dist/index.d.ts +58 -0
  69. package/vendor/@appport/mcp/dist/index.d.ts.map +1 -0
  70. package/vendor/@appport/mcp/dist/index.js +69 -0
  71. package/vendor/@appport/mcp/dist/index.js.map +1 -0
  72. package/vendor/@appport/mcp/package.json +29 -0
  73. package/vendor/@appport/protocol/dist/errors.d.ts +1 -1
  74. package/vendor/@appport/protocol/dist/errors.d.ts.map +1 -1
  75. package/vendor/@appport/protocol/dist/errors.js +1 -0
  76. package/vendor/@appport/protocol/dist/errors.js.map +1 -1
  77. package/vendor/@appport/protocol/dist/index.d.ts +1 -0
  78. package/vendor/@appport/protocol/dist/index.d.ts.map +1 -1
  79. package/vendor/@appport/protocol/dist/index.js +1 -0
  80. package/vendor/@appport/protocol/dist/index.js.map +1 -1
  81. package/vendor/@appport/protocol/dist/manifest.d.ts +3 -0
  82. package/vendor/@appport/protocol/dist/manifest.d.ts.map +1 -1
  83. package/vendor/@appport/protocol/dist/manifest.js.map +1 -1
  84. package/vendor/@appport/protocol/dist/materialization.d.ts +59 -0
  85. package/vendor/@appport/protocol/dist/materialization.d.ts.map +1 -0
  86. package/vendor/@appport/protocol/dist/materialization.js +2 -0
  87. package/vendor/@appport/protocol/dist/materialization.js.map +1 -0
  88. package/vendor/@appport/server/dist/http.d.ts.map +1 -1
  89. package/vendor/@appport/server/dist/http.js +1 -0
  90. package/vendor/@appport/server/dist/http.js.map +1 -1
@@ -0,0 +1,474 @@
1
+ /**
2
+ * AppBoundry materialization orchestration for resolved capabilities.
3
+ *
4
+ * AppPort defines the materialization request/result/evidence contract.
5
+ * AppBoundry consumes that contract after authorization and capability
6
+ * resolution, selects a compatible materializer, and executes the resulting
7
+ * ephemeral instance. This layer does not add a protocol, scheduler, daemon,
8
+ * remote deployment system, or FeltDB dependency.
9
+ */
10
+ import { NO_COMPATIBLE_MATERIALIZATION, PROTOCOL_ID } from "../../protocol/dist/index.js";
11
+ const issuedMaterializations = new WeakSet();
12
+ export class AppBoundryMaterializerRegistry {
13
+ #materializers = new Map();
14
+ register(materializer) {
15
+ if (!materializer.id)
16
+ throw new Error("materializer id must be non-empty");
17
+ if (materializer.targets.length === 0)
18
+ throw new Error(`materializer "${materializer.id}" must support at least one target`);
19
+ if (this.#materializers.has(materializer.id))
20
+ throw new Error(`materializer "${materializer.id}" is already registered`);
21
+ this.#materializers.set(materializer.id, materializer);
22
+ return this;
23
+ }
24
+ list() {
25
+ return [...this.#materializers.values()].sort(compareMaterializers);
26
+ }
27
+ compatible(target, resolution, artifact) {
28
+ return this.list().filter((materializer) => materializerCanSatisfy(materializer, target, resolution, artifact));
29
+ }
30
+ }
31
+ export class AppBoundryMaterializationResolver {
32
+ registry;
33
+ constructor(registry) {
34
+ this.registry = registry;
35
+ }
36
+ resolve(input) {
37
+ const requestedTarget = selectRequestedTarget(input.resolution, input.requestedTarget);
38
+ const request = createAppBoundryMaterializationRequest({
39
+ resolution: input.resolution,
40
+ artifact: input.artifact,
41
+ requestedTarget
42
+ });
43
+ const candidates = this.registry.compatible(requestedTarget, input.resolution, input.artifact);
44
+ if (candidates.length === 0) {
45
+ return {
46
+ kind: "unsupported",
47
+ resolution: input.resolution,
48
+ requestedTarget,
49
+ candidates: [],
50
+ request,
51
+ result: noCompatibleMaterializationResult(request, `No materializer supports target "${requestedTarget}"`)
52
+ };
53
+ }
54
+ const topPriority = candidates[0].priority ?? 0;
55
+ const top = candidates.filter((candidate) => (candidate.priority ?? 0) === topPriority);
56
+ if (top.length > 1) {
57
+ return {
58
+ kind: "ambiguous",
59
+ resolution: input.resolution,
60
+ requestedTarget,
61
+ candidates: top,
62
+ request,
63
+ reason: `Multiple materializers can satisfy "${requestedTarget}" with priority ${topPriority}`
64
+ };
65
+ }
66
+ return {
67
+ kind: "resolved",
68
+ resolution: input.resolution,
69
+ materializer: candidates[0],
70
+ request
71
+ };
72
+ }
73
+ }
74
+ export class AppBoundryMaterializationOrchestrator {
75
+ resolver;
76
+ constructor(resolver) {
77
+ this.resolver = resolver;
78
+ }
79
+ async materialize(input) {
80
+ if (input.resolution.kind !== "resolved") {
81
+ const requestedTarget = input.requestedTarget ?? "unknown";
82
+ const request = fallbackMaterializationRequest(input.resolution, input.artifact, requestedTarget);
83
+ return {
84
+ kind: "blocked",
85
+ resolution: input.resolution,
86
+ requestedTarget,
87
+ request,
88
+ result: noCompatibleMaterializationResult(request, `Capability request "${input.resolution.request.requestId}" was not authorized and resolved`)
89
+ };
90
+ }
91
+ const materialization = this.resolver.resolve({
92
+ resolution: input.resolution,
93
+ artifact: input.artifact,
94
+ requestedTarget: input.requestedTarget
95
+ });
96
+ if (materialization.kind !== "resolved")
97
+ return materialization;
98
+ const success = await materialization.materializer.materialize({
99
+ resolution: materialization.resolution,
100
+ artifact: input.artifact,
101
+ request: materialization.request,
102
+ context: input.context
103
+ });
104
+ issuedMaterializations.add(success.materialized);
105
+ return success;
106
+ }
107
+ }
108
+ export function createAppBoundryMaterializationRequest(input) {
109
+ const requestedTarget = selectRequestedTarget(input.resolution, input.requestedTarget);
110
+ return {
111
+ protocol: PROTOCOL_ID,
112
+ requestId: input.requestId ?? `${input.resolution.resolutionId}::materialize::${requestedTarget}`,
113
+ application: input.resolution.materialization.application,
114
+ requestedTarget,
115
+ package: {
116
+ name: input.resolution.provider.id,
117
+ version: input.resolution.provider.version,
118
+ digest: input.artifact.contentHash,
119
+ attributes: {
120
+ capability: `${input.resolution.capability.name}@${input.resolution.capability.version}`,
121
+ artifactFormat: input.artifact.metadata.compiler.format
122
+ }
123
+ },
124
+ configuration: {
125
+ hash: input.resolution.materialization.contractFingerprint
126
+ },
127
+ context: {
128
+ appboundryResolutionId: input.resolution.resolutionId,
129
+ originalRequestId: input.resolution.request.requestId,
130
+ consumerApplicationId: input.resolution.application.id,
131
+ providerApplicationId: input.resolution.provider.id,
132
+ capabilityName: input.resolution.capability.name,
133
+ capabilityVersion: input.resolution.capability.version,
134
+ authorizationOutcome: input.resolution.authorization.outcome,
135
+ authorizationId: computeAuthorizationId(input.resolution),
136
+ ...(input.resolution.eligibility?.source ? { eligibilitySource: input.resolution.eligibility.source } : {}),
137
+ ...(input.resolution.eligibility?.relationshipId
138
+ ? { relationshipId: input.resolution.eligibility.relationshipId }
139
+ : {}),
140
+ ...(input.resolution.eligibility?.relationshipRevision !== undefined
141
+ ? { relationshipRevision: input.resolution.eligibility.relationshipRevision }
142
+ : {}),
143
+ ...(input.resolution.eligibility?.offerId ? { offerId: input.resolution.eligibility.offerId } : {}),
144
+ ...(input.resolution.eligibility?.offerRevision !== undefined
145
+ ? { offerRevision: input.resolution.eligibility.offerRevision }
146
+ : {}),
147
+ resolvedEnvironment: input.resolution.request.context.environment ?? requestedTarget,
148
+ ...(input.resolution.request.discovery?.discoveryId ? { discoveryId: input.resolution.request.discovery.discoveryId } : {})
149
+ }
150
+ };
151
+ }
152
+ export function createBrowserWasmMaterializer(options) {
153
+ return createExecutorMaterializer({
154
+ id: options.id ?? "appboundry.browser.wasm",
155
+ targets: ["browser"],
156
+ priority: options.priority,
157
+ constraints: { ...options.constraints, artifactFormats: ["wasm/1"] },
158
+ resolvedTarget: "browser",
159
+ execute: options.execute
160
+ });
161
+ }
162
+ export function createLocalMaterializer(options) {
163
+ return createExecutorMaterializer({
164
+ id: options.id ?? "appboundry.local.node",
165
+ targets: ["local"],
166
+ priority: options.priority,
167
+ constraints: options.constraints,
168
+ resolvedTarget: "local",
169
+ execute: options.execute
170
+ });
171
+ }
172
+ export function createRemoteMaterializer(options) {
173
+ const id = options.id ?? "appboundry.remote.contract";
174
+ return {
175
+ id,
176
+ targets: ["remote"],
177
+ ...(options.priority !== undefined ? { priority: options.priority } : {}),
178
+ ...(options.constraints ? { constraints: options.constraints } : {}),
179
+ async materialize(input) {
180
+ const materializationId = `${input.request.requestId}::${id}`;
181
+ const remoteHandoffId = `${materializationId}::handoff`;
182
+ const remote = await options.materialize({
183
+ handoffId: remoteHandoffId,
184
+ resolution: input.resolution,
185
+ artifact: input.artifact,
186
+ request: input.request,
187
+ context: input.context
188
+ });
189
+ const result = {
190
+ protocol: PROTOCOL_ID,
191
+ requestId: input.request.requestId,
192
+ ok: true,
193
+ evidence: {
194
+ application: input.request.application,
195
+ requestedTarget: input.request.requestedTarget,
196
+ resolvedTarget: "remote",
197
+ materializer: id,
198
+ materializationId,
199
+ configuration: input.request.configuration,
200
+ runtime: {
201
+ capability: `${input.resolution.capability.name}@${input.resolution.capability.version}`,
202
+ artifactHash: input.artifact.contentHash,
203
+ resolutionId: input.resolution.resolutionId,
204
+ authorizationId: computeAuthorizationId(input.resolution),
205
+ ...(input.resolution.eligibility?.source ? { eligibilitySource: input.resolution.eligibility.source } : {}),
206
+ ...(input.resolution.eligibility?.relationshipId
207
+ ? { relationshipId: input.resolution.eligibility.relationshipId }
208
+ : {}),
209
+ ...(input.resolution.eligibility?.relationshipRevision !== undefined
210
+ ? { relationshipRevision: input.resolution.eligibility.relationshipRevision }
211
+ : {}),
212
+ ...(input.resolution.eligibility?.offerId ? { offerId: input.resolution.eligibility.offerId } : {}),
213
+ ...(input.resolution.eligibility?.offerRevision !== undefined
214
+ ? { offerRevision: input.resolution.eligibility.offerRevision }
215
+ : {}),
216
+ remoteHandoffId: remote.remoteHandoffId,
217
+ resolvedEnvironment: input.resolution.request.context.environment ?? input.request.requestedTarget
218
+ }
219
+ }
220
+ };
221
+ const materialized = {
222
+ resolutionId: input.resolution.resolutionId,
223
+ materializationId,
224
+ materializerId: id,
225
+ requestedTarget: input.request.requestedTarget,
226
+ resolvedTarget: "remote",
227
+ artifact: input.artifact,
228
+ request: input.request,
229
+ result,
230
+ async execute(executionInput) {
231
+ const executionId = executionInput.executionId ?? `${remote.remoteHandoffId}::execute`;
232
+ try {
233
+ if (!issuedMaterializations.has(materialized)) {
234
+ throw new Error("Materialized capability was not issued by AppBoundryMaterializationOrchestrator");
235
+ }
236
+ const output = await remote.execute({
237
+ executionId,
238
+ capabilityInput: executionInput.input,
239
+ context: executionInput.context,
240
+ request: input.request
241
+ });
242
+ return {
243
+ kind: "success",
244
+ executionId,
245
+ resolutionId: input.resolution.resolutionId,
246
+ materializationId,
247
+ materializerId: id,
248
+ artifactHash: input.artifact.contentHash,
249
+ output,
250
+ evidence: executionEvidence(input, result, executionId),
251
+ completed: true
252
+ };
253
+ }
254
+ catch (error) {
255
+ return {
256
+ kind: "failed",
257
+ executionId,
258
+ resolutionId: input.resolution.resolutionId,
259
+ materializationId,
260
+ materializerId: id,
261
+ artifactHash: input.artifact.contentHash,
262
+ error: {
263
+ code: "appboundry.REMOTE_EXECUTION_FAILED",
264
+ message: error instanceof Error ? error.message : String(error)
265
+ },
266
+ evidence: executionEvidence(input, result, executionId),
267
+ completed: true
268
+ };
269
+ }
270
+ }
271
+ };
272
+ return { kind: "materialized", materialized, request: input.request, result };
273
+ }
274
+ };
275
+ }
276
+ function createExecutorMaterializer(options) {
277
+ return {
278
+ id: options.id,
279
+ targets: options.targets,
280
+ ...(options.priority !== undefined ? { priority: options.priority } : {}),
281
+ ...(options.constraints ? { constraints: options.constraints } : {}),
282
+ async materialize(input) {
283
+ const materializationId = `${input.request.requestId}::${options.id}`;
284
+ const result = {
285
+ protocol: PROTOCOL_ID,
286
+ requestId: input.request.requestId,
287
+ ok: true,
288
+ evidence: {
289
+ application: input.request.application,
290
+ requestedTarget: input.request.requestedTarget,
291
+ resolvedTarget: options.resolvedTarget,
292
+ materializer: options.id,
293
+ materializationId,
294
+ configuration: input.request.configuration,
295
+ runtime: {
296
+ capability: `${input.resolution.capability.name}@${input.resolution.capability.version}`,
297
+ artifactHash: input.artifact.contentHash,
298
+ resolutionId: input.resolution.resolutionId,
299
+ authorizationId: computeAuthorizationId(input.resolution),
300
+ ...(input.resolution.eligibility?.source ? { eligibilitySource: input.resolution.eligibility.source } : {}),
301
+ ...(input.resolution.eligibility?.relationshipId
302
+ ? { relationshipId: input.resolution.eligibility.relationshipId }
303
+ : {}),
304
+ ...(input.resolution.eligibility?.relationshipRevision !== undefined
305
+ ? { relationshipRevision: input.resolution.eligibility.relationshipRevision }
306
+ : {}),
307
+ ...(input.resolution.eligibility?.offerId ? { offerId: input.resolution.eligibility.offerId } : {}),
308
+ ...(input.resolution.eligibility?.offerRevision !== undefined
309
+ ? { offerRevision: input.resolution.eligibility.offerRevision }
310
+ : {}),
311
+ resolvedEnvironment: input.resolution.request.context.environment ?? input.request.requestedTarget
312
+ }
313
+ }
314
+ };
315
+ const materialized = {
316
+ resolutionId: input.resolution.resolutionId,
317
+ materializationId,
318
+ materializerId: options.id,
319
+ requestedTarget: input.request.requestedTarget,
320
+ resolvedTarget: options.resolvedTarget,
321
+ artifact: input.artifact,
322
+ request: input.request,
323
+ result,
324
+ async execute(executionInput) {
325
+ const executionId = executionInput.executionId ?? `${materializationId}::execute`;
326
+ try {
327
+ if (!issuedMaterializations.has(materialized)) {
328
+ throw new Error("Materialized capability was not issued by AppBoundryMaterializationOrchestrator");
329
+ }
330
+ const output = await options.execute({
331
+ artifact: input.artifact,
332
+ resolution: input.resolution,
333
+ materialization: materialized,
334
+ executionId,
335
+ capabilityInput: executionInput.input,
336
+ context: executionInput.context
337
+ });
338
+ return {
339
+ kind: "success",
340
+ executionId,
341
+ resolutionId: input.resolution.resolutionId,
342
+ materializationId,
343
+ materializerId: options.id,
344
+ artifactHash: input.artifact.contentHash,
345
+ output,
346
+ evidence: executionEvidence(input, result, executionId),
347
+ completed: true
348
+ };
349
+ }
350
+ catch (error) {
351
+ return {
352
+ kind: "failed",
353
+ executionId,
354
+ resolutionId: input.resolution.resolutionId,
355
+ materializationId,
356
+ materializerId: options.id,
357
+ artifactHash: input.artifact.contentHash,
358
+ error: {
359
+ code: "appboundry.EXECUTION_FAILED",
360
+ message: error instanceof Error ? error.message : String(error)
361
+ },
362
+ evidence: executionEvidence(input, result, executionId),
363
+ completed: true
364
+ };
365
+ }
366
+ }
367
+ };
368
+ return { kind: "materialized", materialized, request: input.request, result };
369
+ }
370
+ };
371
+ }
372
+ function selectRequestedTarget(resolution, requestedTarget) {
373
+ if (requestedTarget)
374
+ return requestedTarget;
375
+ if (resolution.materialization.requestedTarget)
376
+ return resolution.materialization.requestedTarget;
377
+ const [firstTarget] = resolution.materialization.declaration?.targets ?? [];
378
+ return firstTarget ?? "local";
379
+ }
380
+ function materializerCanSatisfy(materializer, target, resolution, artifact) {
381
+ if (!materializer.targets.includes(target))
382
+ return false;
383
+ const declaredTargets = resolution.materialization.declaration?.targets;
384
+ if (declaredTargets && !declaredTargets.includes(target))
385
+ return false;
386
+ const constraints = materializer.constraints;
387
+ if (!constraints)
388
+ return true;
389
+ if (constraints.applicationIds && !constraints.applicationIds.includes(resolution.materialization.application.id))
390
+ return false;
391
+ if (constraints.providerIds && !constraints.providerIds.includes(resolution.provider.id))
392
+ return false;
393
+ if (constraints.capabilities &&
394
+ !constraints.capabilities.some((capability) => capability.name === resolution.capability.name &&
395
+ (capability.version === undefined || capability.version === resolution.capability.version))) {
396
+ return false;
397
+ }
398
+ if (constraints.artifactFormats && !constraints.artifactFormats.includes(artifact.metadata.compiler.format))
399
+ return false;
400
+ return true;
401
+ }
402
+ function compareMaterializers(left, right) {
403
+ return (right.priority ?? 0) - (left.priority ?? 0) || left.id.localeCompare(right.id);
404
+ }
405
+ function noCompatibleMaterializationResult(request, message) {
406
+ return {
407
+ protocol: PROTOCOL_ID,
408
+ requestId: request.requestId,
409
+ ok: false,
410
+ error: {
411
+ code: NO_COMPATIBLE_MATERIALIZATION,
412
+ message
413
+ }
414
+ };
415
+ }
416
+ function fallbackMaterializationRequest(resolution, artifact, requestedTarget) {
417
+ return {
418
+ protocol: PROTOCOL_ID,
419
+ requestId: `${resolution.request.requestId}::materialize::${requestedTarget}`,
420
+ application: "provider" in resolution
421
+ ? { id: resolution.provider.id, name: resolution.provider.name, version: resolution.provider.version }
422
+ : { id: resolution.request.applicationId, name: resolution.request.applicationId, version: "unresolved" },
423
+ requestedTarget,
424
+ package: { digest: artifact.contentHash },
425
+ context: {
426
+ originalRequestId: resolution.request.requestId,
427
+ resolutionKind: resolution.kind
428
+ }
429
+ };
430
+ }
431
+ function executionEvidence(input, result, executionId) {
432
+ return {
433
+ requestId: input.resolution.request.requestId,
434
+ resolutionId: input.resolution.resolutionId,
435
+ materializationRequestId: input.request.requestId,
436
+ materializationId: result.evidence.materializationId,
437
+ ...(input.resolution.request.discovery?.discoveryId ? { discoveryId: input.resolution.request.discovery.discoveryId } : {}),
438
+ authorizationId: typeof result.evidence.runtime?.["authorizationId"] === "string" ? result.evidence.runtime["authorizationId"] : undefined,
439
+ eligibilitySource: typeof result.evidence.runtime?.["eligibilitySource"] === "string"
440
+ ? result.evidence.runtime["eligibilitySource"]
441
+ : undefined,
442
+ relationshipId: typeof result.evidence.runtime?.["relationshipId"] === "string" ? result.evidence.runtime["relationshipId"] : undefined,
443
+ relationshipRevision: typeof result.evidence.runtime?.["relationshipRevision"] === "number"
444
+ ? result.evidence.runtime["relationshipRevision"]
445
+ : undefined,
446
+ offerId: typeof result.evidence.runtime?.["offerId"] === "string" ? result.evidence.runtime["offerId"] : undefined,
447
+ offerRevision: typeof result.evidence.runtime?.["offerRevision"] === "number" ? result.evidence.runtime["offerRevision"] : undefined,
448
+ remoteHandoffId: typeof result.evidence.runtime?.["remoteHandoffId"] === "string" ? result.evidence.runtime["remoteHandoffId"] : undefined,
449
+ executionId,
450
+ providerApplicationId: input.resolution.provider.id,
451
+ consumerApplicationId: input.resolution.application.id,
452
+ capability: {
453
+ name: input.resolution.capability.name,
454
+ version: input.resolution.capability.version
455
+ },
456
+ requestedTarget: input.request.requestedTarget,
457
+ resolvedTarget: result.evidence.resolvedTarget,
458
+ resolvedEnvironment: typeof result.evidence.runtime?.["resolvedEnvironment"] === "string"
459
+ ? result.evidence.runtime["resolvedEnvironment"]
460
+ : undefined,
461
+ materializerId: result.evidence.materializer,
462
+ artifactHash: input.artifact.contentHash,
463
+ contractFingerprint: input.artifact.metadata.contractFingerprint
464
+ };
465
+ }
466
+ function computeAuthorizationId(resolution) {
467
+ return [
468
+ resolution.resolutionId,
469
+ "authorization",
470
+ resolution.authorization.outcome,
471
+ ...(resolution.authorization.grantedScopes ?? [])
472
+ ].join("::");
473
+ }
474
+ //# sourceMappingURL=appboundry-materialization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appboundry-materialization.js","sourceRoot":"","sources":["../src/appboundry-materialization.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,6BAA6B,EAC7B,WAAW,EAMZ,MAAM,mBAAmB,CAAC;AA4J3B,MAAM,sBAAsB,GAAG,IAAI,OAAO,EAAU,CAAC;AAErD,MAAM,OAAO,8BAA8B;IAChC,cAAc,GAAG,IAAI,GAAG,EAAkC,CAAC;IAEpE,QAAQ,CAAC,YAAoC;QAC3C,IAAI,CAAC,YAAY,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QAC3E,IAAI,YAAY,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,CAAC,EAAE,oCAAoC,CAAC,CAAC;QAC7H,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,CAAC,EAAE,yBAAyB,CAAC,CAAC;QACzH,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI;QACF,OAAO,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACtE,CAAC;IAED,UAAU,CACR,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AQ,CAAC,YAAY;QAC5C,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,WAAW;QACxC,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,mBAAmB;KACjE,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAAC,UAAwC;IACtE,OAAO;QACL,UAAU,CAAC,YAAY;QACvB,eAAe;QACf,UAAU,CAAC,aAAa,CAAC,OAAO;QAChC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,aAAa,IAAI,EAAE,CAAC;KAClD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,160 @@
1
+ /**
2
+ * AppBoundry capability resolution boundary.
3
+ *
4
+ * This is the AppBoundry-owned decision layer above the AppPort protocol:
5
+ * request context + available capabilities → authorization → deterministic
6
+ * resolution record. It produces data only; it does not materialize, schedule,
7
+ * deploy, execute, or depend on any particular state store.
8
+ */
9
+ import { PROTOCOL_ID, type JsonValue, type MaterializationDeclaration, type MaterializationTarget } from "../../protocol/dist/index.d.ts";
10
+ import type { ApplicationState } from "./state.js";
11
+ import type { ApplicationRegistry } from "./registration.js";
12
+ import type { CapabilityManifestEntry } from "./manifest.js";
13
+ import { type CompatibilityResult, type RequirementWithConstraints } from "./resolver.js";
14
+ import type { Denied } from "./binding.js";
15
+ /** The caller and ambient facts AppBoundry may use for authorization. */
16
+ export interface AppBoundryRequestContext {
17
+ readonly subject: {
18
+ readonly id: string;
19
+ readonly roles?: readonly string[];
20
+ readonly scopes?: readonly string[];
21
+ readonly tags?: readonly string[];
22
+ };
23
+ readonly tenantId?: string;
24
+ readonly environment?: string;
25
+ readonly attributes?: Readonly<Record<string, JsonValue>>;
26
+ }
27
+ /** A concrete capability offered by a provider application. */
28
+ export interface OfferedCapability {
29
+ readonly provider: ApplicationState;
30
+ readonly capability: CapabilityManifestEntry;
31
+ /** Deployment-neutral AppPort materialization declaration, if known. */
32
+ readonly materialization?: MaterializationDeclaration;
33
+ readonly metadata?: Readonly<Record<string, JsonValue>>;
34
+ }
35
+ /** AppBoundry request for one required capability. */
36
+ export interface AppBoundryCapabilityRequest {
37
+ readonly requestId: string;
38
+ readonly applicationId: string;
39
+ readonly context: AppBoundryRequestContext;
40
+ readonly requirement: RequirementWithConstraints;
41
+ /**
42
+ * Optional already-discovered offers. If omitted, the resolver discovers from
43
+ * the application registry. Supplying offers lets tests and callers model
44
+ * capability discovery without coupling discovery to a runtime.
45
+ */
46
+ readonly availableCapabilities?: readonly OfferedCapability[];
47
+ readonly discovery?: {
48
+ readonly discoveryId: string;
49
+ readonly providerIds?: readonly string[];
50
+ readonly candidateIds?: readonly string[];
51
+ };
52
+ readonly materialization?: {
53
+ readonly requestedTarget?: MaterializationTarget;
54
+ };
55
+ }
56
+ export interface CapabilityMatch {
57
+ readonly offer: OfferedCapability;
58
+ readonly compatibility: CompatibilityResult;
59
+ }
60
+ export type AppBoundryAuthorizationDecision = {
61
+ readonly outcome: "allow";
62
+ readonly grantedScopes?: readonly string[];
63
+ } | {
64
+ readonly outcome: "deny";
65
+ readonly reason: Denied["reason"];
66
+ readonly message: string;
67
+ };
68
+ export interface AppBoundryAuthorizationInput {
69
+ readonly request: AppBoundryCapabilityRequest;
70
+ readonly consumer: ApplicationState;
71
+ readonly provider: ApplicationState;
72
+ readonly capability: CapabilityManifestEntry;
73
+ readonly requirement: RequirementWithConstraints;
74
+ readonly context: AppBoundryRequestContext;
75
+ }
76
+ /** Injectable, side-effect-free authorization boundary for candidate offers. */
77
+ export interface AppBoundryAuthorizationBoundary {
78
+ evaluate(input: AppBoundryAuthorizationInput): AppBoundryAuthorizationDecision | Promise<AppBoundryAuthorizationDecision>;
79
+ }
80
+ export interface CapabilityAuthorizationEvaluation {
81
+ readonly offer: OfferedCapability;
82
+ readonly compatibility: CompatibilityResult;
83
+ readonly authorization: AppBoundryAuthorizationDecision;
84
+ }
85
+ export interface AppBoundryMaterializationHandoff {
86
+ readonly protocol: typeof PROTOCOL_ID;
87
+ readonly application: {
88
+ readonly id: string;
89
+ readonly name: string;
90
+ readonly version: string;
91
+ };
92
+ readonly capability: {
93
+ readonly name: string;
94
+ readonly version: number;
95
+ };
96
+ readonly contractFingerprint: string;
97
+ readonly requestedTarget?: MaterializationTarget;
98
+ readonly declaration?: MaterializationDeclaration;
99
+ }
100
+ export interface AppBoundryEligibilityEvidence {
101
+ readonly source: string;
102
+ readonly relationshipId?: string;
103
+ readonly relationshipRevision?: number;
104
+ readonly offerId?: string;
105
+ readonly offerRevision?: number;
106
+ readonly availabilityModel?: string;
107
+ }
108
+ export type AppBoundryResolutionRecord = {
109
+ readonly kind: "resolved";
110
+ readonly resolutionId: string;
111
+ readonly request: AppBoundryCapabilityRequest;
112
+ readonly application: ApplicationState;
113
+ readonly provider: ApplicationState;
114
+ readonly capability: CapabilityManifestEntry;
115
+ readonly requirement: RequirementWithConstraints;
116
+ readonly authorization: Extract<AppBoundryAuthorizationDecision, {
117
+ outcome: "allow";
118
+ }>;
119
+ readonly evaluated: readonly CapabilityAuthorizationEvaluation[];
120
+ readonly eligibility?: AppBoundryEligibilityEvidence;
121
+ readonly materialization: AppBoundryMaterializationHandoff;
122
+ } | {
123
+ readonly kind: "denied";
124
+ readonly request: AppBoundryCapabilityRequest;
125
+ readonly application: ApplicationState;
126
+ readonly requirement: RequirementWithConstraints;
127
+ readonly authorization: Extract<AppBoundryAuthorizationDecision, {
128
+ outcome: "deny";
129
+ }>;
130
+ readonly evaluated: readonly CapabilityAuthorizationEvaluation[];
131
+ } | {
132
+ readonly kind: "unresolved";
133
+ readonly request: AppBoundryCapabilityRequest;
134
+ readonly application?: ApplicationState;
135
+ readonly requirement: RequirementWithConstraints;
136
+ readonly candidates: readonly OfferedCapability[];
137
+ readonly reason: string;
138
+ } | {
139
+ readonly kind: "ambiguous";
140
+ readonly request: AppBoundryCapabilityRequest;
141
+ readonly application: ApplicationState;
142
+ readonly requirement: RequirementWithConstraints;
143
+ readonly candidates: readonly CapabilityAuthorizationEvaluation[];
144
+ readonly reason: string;
145
+ };
146
+ export declare function allowAllAppBoundryAuthorizationBoundary(): AppBoundryAuthorizationBoundary;
147
+ /** Evaluate one offered capability without consulting runtime implementation state. */
148
+ export declare function evaluateOfferedCapability(requirement: RequirementWithConstraints, offer: OfferedCapability): CompatibilityResult;
149
+ /** Deterministically filter and order compatible offers for a requirement. */
150
+ export declare function matchCapabilityRequirement(requirement: RequirementWithConstraints, offers: readonly OfferedCapability[]): readonly CapabilityMatch[];
151
+ /** Discover provider offers from the AppBoundry application registry. */
152
+ export declare function discoverCapabilityOffers(registry: ApplicationRegistry, requirement: RequirementWithConstraints): Promise<readonly OfferedCapability[]>;
153
+ /** AppBoundry decision layer for one capability request. */
154
+ export declare class AppBoundryCapabilityResolver {
155
+ private readonly registry;
156
+ private readonly authorization;
157
+ constructor(registry: ApplicationRegistry, authorization?: AppBoundryAuthorizationBoundary);
158
+ resolve(request: AppBoundryCapabilityRequest): Promise<AppBoundryResolutionRecord>;
159
+ }
160
+ //# sourceMappingURL=appboundry-resolution.d.ts.map