@appport/sdk 1.0.1
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/LICENSE +126 -0
- package/README.md +39 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.ts +3 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +3 -0
- package/dist/node.js.map +1 -0
- package/node_modules/@appport/authorization/README.md +28 -0
- package/node_modules/@appport/authorization/dist/index.d.ts +94 -0
- package/node_modules/@appport/authorization/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/authorization/dist/index.js +131 -0
- package/node_modules/@appport/authorization/dist/index.js.map +1 -0
- package/node_modules/@appport/authorization/package.json +28 -0
- package/node_modules/@appport/client/README.md +35 -0
- package/node_modules/@appport/client/dist/channel.d.ts +14 -0
- package/node_modules/@appport/client/dist/channel.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/channel.js +58 -0
- package/node_modules/@appport/client/dist/channel.js.map +1 -0
- package/node_modules/@appport/client/dist/client.d.ts +61 -0
- package/node_modules/@appport/client/dist/client.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/client.js +214 -0
- package/node_modules/@appport/client/dist/client.js.map +1 -0
- package/node_modules/@appport/client/dist/contract.d.ts +55 -0
- package/node_modules/@appport/client/dist/contract.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/contract.js +12 -0
- package/node_modules/@appport/client/dist/contract.js.map +1 -0
- package/node_modules/@appport/client/dist/discovery.d.ts +17 -0
- package/node_modules/@appport/client/dist/discovery.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/discovery.js +56 -0
- package/node_modules/@appport/client/dist/discovery.js.map +1 -0
- package/node_modules/@appport/client/dist/duplex.d.ts +25 -0
- package/node_modules/@appport/client/dist/duplex.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/duplex.js +194 -0
- package/node_modules/@appport/client/dist/duplex.js.map +1 -0
- package/node_modules/@appport/client/dist/index.d.ts +13 -0
- package/node_modules/@appport/client/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/index.js +13 -0
- package/node_modules/@appport/client/dist/index.js.map +1 -0
- package/node_modules/@appport/client/dist/transport.d.ts +42 -0
- package/node_modules/@appport/client/dist/transport.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/transport.js +2 -0
- package/node_modules/@appport/client/dist/transport.js.map +1 -0
- package/node_modules/@appport/client/package.json +32 -0
- package/node_modules/@appport/core/README.md +91 -0
- package/node_modules/@appport/core/dist/appboundry-contract.d.ts +80 -0
- package/node_modules/@appport/core/dist/appboundry-contract.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/appboundry-contract.js +160 -0
- package/node_modules/@appport/core/dist/appboundry-contract.js.map +1 -0
- package/node_modules/@appport/core/dist/application-implementation.d.ts +125 -0
- package/node_modules/@appport/core/dist/application-implementation.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/application-implementation.js +220 -0
- package/node_modules/@appport/core/dist/application-implementation.js.map +1 -0
- package/node_modules/@appport/core/dist/application-lifecycle.d.ts +150 -0
- package/node_modules/@appport/core/dist/application-lifecycle.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/application-lifecycle.js +70 -0
- package/node_modules/@appport/core/dist/application-lifecycle.js.map +1 -0
- package/node_modules/@appport/core/dist/application-source.d.ts +109 -0
- package/node_modules/@appport/core/dist/application-source.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/application-source.js +186 -0
- package/node_modules/@appport/core/dist/application-source.js.map +1 -0
- package/node_modules/@appport/core/dist/application.d.ts +122 -0
- package/node_modules/@appport/core/dist/application.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/application.js +515 -0
- package/node_modules/@appport/core/dist/application.js.map +1 -0
- package/node_modules/@appport/core/dist/artifact.d.ts +395 -0
- package/node_modules/@appport/core/dist/artifact.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/artifact.js +392 -0
- package/node_modules/@appport/core/dist/artifact.js.map +1 -0
- package/node_modules/@appport/core/dist/assembly.d.ts +237 -0
- package/node_modules/@appport/core/dist/assembly.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/assembly.js +458 -0
- package/node_modules/@appport/core/dist/assembly.js.map +1 -0
- package/node_modules/@appport/core/dist/authority-attestation.d.ts +34 -0
- package/node_modules/@appport/core/dist/authority-attestation.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/authority-attestation.js +72 -0
- package/node_modules/@appport/core/dist/authority-attestation.js.map +1 -0
- package/node_modules/@appport/core/dist/authorization-grant.d.ts +107 -0
- package/node_modules/@appport/core/dist/authorization-grant.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/authorization-grant.js +131 -0
- package/node_modules/@appport/core/dist/authorization-grant.js.map +1 -0
- package/node_modules/@appport/core/dist/binding.d.ts +294 -0
- package/node_modules/@appport/core/dist/binding.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/binding.js +263 -0
- package/node_modules/@appport/core/dist/binding.js.map +1 -0
- package/node_modules/@appport/core/dist/builtins.d.ts +18 -0
- package/node_modules/@appport/core/dist/builtins.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/builtins.js +38 -0
- package/node_modules/@appport/core/dist/builtins.js.map +1 -0
- package/node_modules/@appport/core/dist/capability.d.ts +94 -0
- package/node_modules/@appport/core/dist/capability.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/capability.js +85 -0
- package/node_modules/@appport/core/dist/capability.js.map +1 -0
- package/node_modules/@appport/core/dist/concurrency.d.ts +16 -0
- package/node_modules/@appport/core/dist/concurrency.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/concurrency.js +46 -0
- package/node_modules/@appport/core/dist/concurrency.js.map +1 -0
- package/node_modules/@appport/core/dist/context.d.ts +59 -0
- package/node_modules/@appport/core/dist/context.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/context.js +14 -0
- package/node_modules/@appport/core/dist/context.js.map +1 -0
- package/node_modules/@appport/core/dist/contract-artifact.d.ts +15 -0
- package/node_modules/@appport/core/dist/contract-artifact.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/contract-artifact.js +152 -0
- package/node_modules/@appport/core/dist/contract-artifact.js.map +1 -0
- package/node_modules/@appport/core/dist/contract-attestation.d.ts +68 -0
- package/node_modules/@appport/core/dist/contract-attestation.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/contract-attestation.js +76 -0
- package/node_modules/@appport/core/dist/contract-attestation.js.map +1 -0
- package/node_modules/@appport/core/dist/crash-injection.d.ts +3 -0
- package/node_modules/@appport/core/dist/crash-injection.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/crash-injection.js +8 -0
- package/node_modules/@appport/core/dist/crash-injection.js.map +1 -0
- package/node_modules/@appport/core/dist/events.d.ts +33 -0
- package/node_modules/@appport/core/dist/events.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/events.js +79 -0
- package/node_modules/@appport/core/dist/events.js.map +1 -0
- package/node_modules/@appport/core/dist/execution-barrier.d.ts +13 -0
- package/node_modules/@appport/core/dist/execution-barrier.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/execution-barrier.js +33 -0
- package/node_modules/@appport/core/dist/execution-barrier.js.map +1 -0
- package/node_modules/@appport/core/dist/execution-ledger.d.ts +81 -0
- package/node_modules/@appport/core/dist/execution-ledger.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/execution-ledger.js +173 -0
- package/node_modules/@appport/core/dist/execution-ledger.js.map +1 -0
- package/node_modules/@appport/core/dist/execution.d.ts +387 -0
- package/node_modules/@appport/core/dist/execution.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/execution.js +165 -0
- package/node_modules/@appport/core/dist/execution.js.map +1 -0
- package/node_modules/@appport/core/dist/idempotency.d.ts +36 -0
- package/node_modules/@appport/core/dist/idempotency.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/idempotency.js +36 -0
- package/node_modules/@appport/core/dist/idempotency.js.map +1 -0
- package/node_modules/@appport/core/dist/implementation.d.ts +110 -0
- package/node_modules/@appport/core/dist/implementation.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/implementation.js +65 -0
- package/node_modules/@appport/core/dist/implementation.js.map +1 -0
- package/node_modules/@appport/core/dist/index.d.ts +44 -0
- package/node_modules/@appport/core/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/index.js +44 -0
- package/node_modules/@appport/core/dist/index.js.map +1 -0
- package/node_modules/@appport/core/dist/invocation.d.ts +253 -0
- package/node_modules/@appport/core/dist/invocation.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/invocation.js +258 -0
- package/node_modules/@appport/core/dist/invocation.js.map +1 -0
- package/node_modules/@appport/core/dist/manifest.d.ts +157 -0
- package/node_modules/@appport/core/dist/manifest.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/manifest.js +255 -0
- package/node_modules/@appport/core/dist/manifest.js.map +1 -0
- package/node_modules/@appport/core/dist/memory-application-data-store.d.ts +19 -0
- package/node_modules/@appport/core/dist/memory-application-data-store.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/memory-application-data-store.js +161 -0
- package/node_modules/@appport/core/dist/memory-application-data-store.js.map +1 -0
- package/node_modules/@appport/core/dist/operations.d.ts +61 -0
- package/node_modules/@appport/core/dist/operations.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/operations.js +210 -0
- package/node_modules/@appport/core/dist/operations.js.map +1 -0
- package/node_modules/@appport/core/dist/public.d.ts +19 -0
- package/node_modules/@appport/core/dist/public.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/public.js +18 -0
- package/node_modules/@appport/core/dist/public.js.map +1 -0
- package/node_modules/@appport/core/dist/registration.d.ts +165 -0
- package/node_modules/@appport/core/dist/registration.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/registration.js +253 -0
- package/node_modules/@appport/core/dist/registration.js.map +1 -0
- package/node_modules/@appport/core/dist/registry.d.ts +29 -0
- package/node_modules/@appport/core/dist/registry.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/registry.js +148 -0
- package/node_modules/@appport/core/dist/registry.js.map +1 -0
- package/node_modules/@appport/core/dist/repository-connection.d.ts +100 -0
- package/node_modules/@appport/core/dist/repository-connection.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/repository-connection.js +57 -0
- package/node_modules/@appport/core/dist/repository-connection.js.map +1 -0
- package/node_modules/@appport/core/dist/resolver.d.ts +130 -0
- package/node_modules/@appport/core/dist/resolver.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/resolver.js +252 -0
- package/node_modules/@appport/core/dist/resolver.js.map +1 -0
- package/node_modules/@appport/core/dist/runtime-manifest.d.ts +68 -0
- package/node_modules/@appport/core/dist/runtime-manifest.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/runtime-manifest.js +84 -0
- package/node_modules/@appport/core/dist/runtime-manifest.js.map +1 -0
- package/node_modules/@appport/core/dist/sanitize.d.ts +14 -0
- package/node_modules/@appport/core/dist/sanitize.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/sanitize.js +49 -0
- package/node_modules/@appport/core/dist/sanitize.js.map +1 -0
- package/node_modules/@appport/core/dist/server-internal.d.ts +5 -0
- package/node_modules/@appport/core/dist/server-internal.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/server-internal.js +4 -0
- package/node_modules/@appport/core/dist/server-internal.js.map +1 -0
- package/node_modules/@appport/core/dist/sessions.d.ts +29 -0
- package/node_modules/@appport/core/dist/sessions.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/sessions.js +39 -0
- package/node_modules/@appport/core/dist/sessions.js.map +1 -0
- package/node_modules/@appport/core/dist/sha256.d.ts +3 -0
- package/node_modules/@appport/core/dist/sha256.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/sha256.js +46 -0
- package/node_modules/@appport/core/dist/sha256.js.map +1 -0
- package/node_modules/@appport/core/dist/source-verification.d.ts +53 -0
- package/node_modules/@appport/core/dist/source-verification.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/source-verification.js +92 -0
- package/node_modules/@appport/core/dist/source-verification.js.map +1 -0
- package/node_modules/@appport/core/dist/state-context.d.ts +312 -0
- package/node_modules/@appport/core/dist/state-context.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/state-context.js +100 -0
- package/node_modules/@appport/core/dist/state-context.js.map +1 -0
- package/node_modules/@appport/core/dist/state.d.ts +96 -0
- package/node_modules/@appport/core/dist/state.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/state.js +89 -0
- package/node_modules/@appport/core/dist/state.js.map +1 -0
- package/node_modules/@appport/core/dist/streams.d.ts +38 -0
- package/node_modules/@appport/core/dist/streams.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/streams.js +123 -0
- package/node_modules/@appport/core/dist/streams.js.map +1 -0
- package/node_modules/@appport/core/dist/telemetry.d.ts +42 -0
- package/node_modules/@appport/core/dist/telemetry.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/telemetry.js +32 -0
- package/node_modules/@appport/core/dist/telemetry.js.map +1 -0
- package/node_modules/@appport/core/dist/wasm-engine.d.ts +22 -0
- package/node_modules/@appport/core/dist/wasm-engine.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/wasm-engine.js +367 -0
- package/node_modules/@appport/core/dist/wasm-engine.js.map +1 -0
- package/node_modules/@appport/core/package.json +58 -0
- package/node_modules/@appport/mobile/README.md +10 -0
- package/node_modules/@appport/mobile/dist/index.d.ts +66 -0
- package/node_modules/@appport/mobile/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/mobile/dist/index.js +182 -0
- package/node_modules/@appport/mobile/dist/index.js.map +1 -0
- package/node_modules/@appport/mobile/package.json +33 -0
- package/node_modules/@appport/protocol/README.md +41 -0
- package/node_modules/@appport/protocol/dist/blob.d.ts +46 -0
- package/node_modules/@appport/protocol/dist/blob.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/blob.js +23 -0
- package/node_modules/@appport/protocol/dist/blob.js.map +1 -0
- package/node_modules/@appport/protocol/dist/compatibility.d.ts +25 -0
- package/node_modules/@appport/protocol/dist/compatibility.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/compatibility.js +189 -0
- package/node_modules/@appport/protocol/dist/compatibility.js.map +1 -0
- package/node_modules/@appport/protocol/dist/envelopes.d.ts +175 -0
- package/node_modules/@appport/protocol/dist/envelopes.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/envelopes.js +97 -0
- package/node_modules/@appport/protocol/dist/envelopes.js.map +1 -0
- package/node_modules/@appport/protocol/dist/errors.d.ts +74 -0
- package/node_modules/@appport/protocol/dist/errors.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/errors.js +91 -0
- package/node_modules/@appport/protocol/dist/errors.js.map +1 -0
- package/node_modules/@appport/protocol/dist/ids.d.ts +12 -0
- package/node_modules/@appport/protocol/dist/ids.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/ids.js +50 -0
- package/node_modules/@appport/protocol/dist/ids.js.map +1 -0
- package/node_modules/@appport/protocol/dist/index.d.ts +20 -0
- package/node_modules/@appport/protocol/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/index.js +20 -0
- package/node_modules/@appport/protocol/dist/index.js.map +1 -0
- package/node_modules/@appport/protocol/dist/jsonschema.d.ts +50 -0
- package/node_modules/@appport/protocol/dist/jsonschema.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/jsonschema.js +6 -0
- package/node_modules/@appport/protocol/dist/jsonschema.js.map +1 -0
- package/node_modules/@appport/protocol/dist/manifest.d.ts +131 -0
- package/node_modules/@appport/protocol/dist/manifest.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/manifest.js +20 -0
- package/node_modules/@appport/protocol/dist/manifest.js.map +1 -0
- package/node_modules/@appport/protocol/dist/names.d.ts +26 -0
- package/node_modules/@appport/protocol/dist/names.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/names.js +85 -0
- package/node_modules/@appport/protocol/dist/names.js.map +1 -0
- package/node_modules/@appport/protocol/dist/operations.d.ts +34 -0
- package/node_modules/@appport/protocol/dist/operations.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/operations.js +9 -0
- package/node_modules/@appport/protocol/dist/operations.js.map +1 -0
- package/node_modules/@appport/protocol/dist/session.d.ts +27 -0
- package/node_modules/@appport/protocol/dist/session.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/session.js +7 -0
- package/node_modules/@appport/protocol/dist/session.js.map +1 -0
- package/node_modules/@appport/protocol/dist/validate.d.ts +37 -0
- package/node_modules/@appport/protocol/dist/validate.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/validate.js +321 -0
- package/node_modules/@appport/protocol/dist/validate.js.map +1 -0
- package/node_modules/@appport/protocol/dist/version.d.ts +27 -0
- package/node_modules/@appport/protocol/dist/version.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/version.js +26 -0
- package/node_modules/@appport/protocol/dist/version.js.map +1 -0
- package/node_modules/@appport/protocol/package.json +25 -0
- package/node_modules/@appport/schema/README.md +32 -0
- package/node_modules/@appport/schema/dist/builder.d.ts +85 -0
- package/node_modules/@appport/schema/dist/builder.d.ts.map +1 -0
- package/node_modules/@appport/schema/dist/builder.js +278 -0
- package/node_modules/@appport/schema/dist/builder.js.map +1 -0
- package/node_modules/@appport/schema/dist/from-json-schema.d.ts +12 -0
- package/node_modules/@appport/schema/dist/from-json-schema.d.ts.map +1 -0
- package/node_modules/@appport/schema/dist/from-json-schema.js +186 -0
- package/node_modules/@appport/schema/dist/from-json-schema.js.map +1 -0
- package/node_modules/@appport/schema/dist/index.d.ts +23 -0
- package/node_modules/@appport/schema/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/schema/dist/index.js +22 -0
- package/node_modules/@appport/schema/dist/index.js.map +1 -0
- package/node_modules/@appport/schema/dist/standard.d.ts +46 -0
- package/node_modules/@appport/schema/dist/standard.d.ts.map +1 -0
- package/node_modules/@appport/schema/dist/standard.js +42 -0
- package/node_modules/@appport/schema/dist/standard.js.map +1 -0
- package/node_modules/@appport/schema/dist/types.d.ts +40 -0
- package/node_modules/@appport/schema/dist/types.d.ts.map +1 -0
- package/node_modules/@appport/schema/dist/types.js +19 -0
- package/node_modules/@appport/schema/dist/types.js.map +1 -0
- package/node_modules/@appport/schema/package.json +28 -0
- package/node_modules/@appport/server/README.md +39 -0
- package/node_modules/@appport/server/dist/connection.d.ts +45 -0
- package/node_modules/@appport/server/dist/connection.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/connection.js +217 -0
- package/node_modules/@appport/server/dist/connection.js.map +1 -0
- package/node_modules/@appport/server/dist/fetch.d.ts +10 -0
- package/node_modules/@appport/server/dist/fetch.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/fetch.js +50 -0
- package/node_modules/@appport/server/dist/fetch.js.map +1 -0
- package/node_modules/@appport/server/dist/http.d.ts +80 -0
- package/node_modules/@appport/server/dist/http.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/http.js +306 -0
- package/node_modules/@appport/server/dist/http.js.map +1 -0
- package/node_modules/@appport/server/dist/index.d.ts +11 -0
- package/node_modules/@appport/server/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/index.js +11 -0
- package/node_modules/@appport/server/dist/index.js.map +1 -0
- package/node_modules/@appport/server/dist/node-entry.d.ts +4 -0
- package/node_modules/@appport/server/dist/node-entry.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/node-entry.js +4 -0
- package/node_modules/@appport/server/dist/node-entry.js.map +1 -0
- package/node_modules/@appport/server/dist/node.d.ts +45 -0
- package/node_modules/@appport/server/dist/node.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/node.js +190 -0
- package/node_modules/@appport/server/dist/node.js.map +1 -0
- package/node_modules/@appport/server/dist/server.d.ts +83 -0
- package/node_modules/@appport/server/dist/server.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/server.js +114 -0
- package/node_modules/@appport/server/dist/server.js.map +1 -0
- package/node_modules/@appport/server/dist/websocket.d.ts +25 -0
- package/node_modules/@appport/server/dist/websocket.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/websocket.js +221 -0
- package/node_modules/@appport/server/dist/websocket.js.map +1 -0
- package/node_modules/@appport/server/package.json +34 -0
- package/node_modules/@appport/transport-electron/README.md +56 -0
- package/node_modules/@appport/transport-electron/dist/index.d.ts +11 -0
- package/node_modules/@appport/transport-electron/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/transport-electron/dist/index.js +11 -0
- package/node_modules/@appport/transport-electron/dist/index.js.map +1 -0
- package/node_modules/@appport/transport-electron/dist/main.d.ts +31 -0
- package/node_modules/@appport/transport-electron/dist/main.d.ts.map +1 -0
- package/node_modules/@appport/transport-electron/dist/main.js +61 -0
- package/node_modules/@appport/transport-electron/dist/main.js.map +1 -0
- package/node_modules/@appport/transport-electron/dist/preload.d.ts +22 -0
- package/node_modules/@appport/transport-electron/dist/preload.d.ts.map +1 -0
- package/node_modules/@appport/transport-electron/dist/preload.js +29 -0
- package/node_modules/@appport/transport-electron/dist/preload.js.map +1 -0
- package/node_modules/@appport/transport-electron/dist/renderer.d.ts +16 -0
- package/node_modules/@appport/transport-electron/dist/renderer.d.ts.map +1 -0
- package/node_modules/@appport/transport-electron/dist/renderer.js +36 -0
- package/node_modules/@appport/transport-electron/dist/renderer.js.map +1 -0
- package/node_modules/@appport/transport-electron/dist/types.d.ts +49 -0
- package/node_modules/@appport/transport-electron/dist/types.d.ts.map +1 -0
- package/node_modules/@appport/transport-electron/dist/types.js +5 -0
- package/node_modules/@appport/transport-electron/dist/types.js.map +1 -0
- package/node_modules/@appport/transport-electron/package.json +46 -0
- package/node_modules/@appport/transport-http/README.md +24 -0
- package/node_modules/@appport/transport-http/dist/index.d.ts +18 -0
- package/node_modules/@appport/transport-http/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/transport-http/dist/index.js +223 -0
- package/node_modules/@appport/transport-http/dist/index.js.map +1 -0
- package/node_modules/@appport/transport-http/package.json +29 -0
- package/node_modules/@appport/transport-inprocess/README.md +24 -0
- package/node_modules/@appport/transport-inprocess/dist/index.d.ts +16 -0
- package/node_modules/@appport/transport-inprocess/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/transport-inprocess/dist/index.js +30 -0
- package/node_modules/@appport/transport-inprocess/dist/index.js.map +1 -0
- package/node_modules/@appport/transport-inprocess/package.json +30 -0
- package/node_modules/@appport/transport-tauri/README.md +45 -0
- package/node_modules/@appport/transport-tauri/dist/index.d.ts +23 -0
- package/node_modules/@appport/transport-tauri/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/transport-tauri/dist/index.js +44 -0
- package/node_modules/@appport/transport-tauri/dist/index.js.map +1 -0
- package/node_modules/@appport/transport-tauri/package.json +29 -0
- package/node_modules/@appport/transport-websocket/README.md +22 -0
- package/node_modules/@appport/transport-websocket/dist/index.d.ts +26 -0
- package/node_modules/@appport/transport-websocket/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/transport-websocket/dist/index.js +72 -0
- package/node_modules/@appport/transport-websocket/dist/index.js.map +1 -0
- package/node_modules/@appport/transport-websocket/package.json +29 -0
- package/package.json +79 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-barrier.js","sourceRoot":"","sources":["../src/execution-barrier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,8DAA8D;AAC9D,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,MAAM,WAAW,GAAI,UAAkB,CAAC,OAAO,EAAE,GAAG,CAAC;IACrD,MAAM,SAAS,GAAuB,WAAW,EAAE,4BAA4B,CAAC;IAChF,IAAI,CAAC,SAAS,IAAI,WAAW,EAAE,8BAA8B,KAAK,KAAK;QAAE,OAAO;IAEhF,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,KAAK,WAAW,CAAC,CAAC;IACtD,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,KAAK,UAAU,CAAC,EAAE,KAAK,CAAC,CAAC;IAE1D,wEAAwE;IACxE,oEAAoE;IACpE,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,CAAC;IACjD,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,sBAAsB,CAAC,CAAC;QAC9F,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { CapabilityContext } from "./context.js";
|
|
2
|
+
import { type ExecutionEngine, type ExecutionInstance, type ExecutionRequest } from "./execution.js";
|
|
3
|
+
import { type AuthorizedCapabilityBinding } from "./binding.js";
|
|
4
|
+
import type { ExecutableArtifact } from "./artifact.js";
|
|
5
|
+
export type ExecutionId = string;
|
|
6
|
+
export type ExecutionStatus = "running" | "succeeded" | "failed" | "cancelled" | "timed_out";
|
|
7
|
+
export interface ExecutionErrorMetadata {
|
|
8
|
+
kind: "InvalidBinding" | "AuthorizationRevoked" | "InvalidContext" | "InvalidInput" | "ImplementationFailure" | "InvalidOutput" | "ExecutionFailure" | "Cancelled" | "TimedOut";
|
|
9
|
+
message: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ExecutionResourceUsage {
|
|
12
|
+
cpuTimeMs?: number;
|
|
13
|
+
wallTimeMs?: number;
|
|
14
|
+
memoryBytes?: number;
|
|
15
|
+
fuelConsumed?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface ExecutionRecord {
|
|
18
|
+
executionId: ExecutionId;
|
|
19
|
+
materializationId: string;
|
|
20
|
+
invocationId: string;
|
|
21
|
+
applicationId: string;
|
|
22
|
+
providerApplicationId: string;
|
|
23
|
+
capabilityName: string;
|
|
24
|
+
capabilityVersion: number;
|
|
25
|
+
contractFingerprint: string;
|
|
26
|
+
artifactHash: string;
|
|
27
|
+
/** Source connection the executed artifact was materialized from (F6). */
|
|
28
|
+
repositoryConnectionId?: string;
|
|
29
|
+
/** Implementation record that selected the artifact (F6). */
|
|
30
|
+
implementationId?: string;
|
|
31
|
+
consumerApplicationId?: string;
|
|
32
|
+
stateTransactionId?: string;
|
|
33
|
+
startedAt: string;
|
|
34
|
+
completedAt?: string;
|
|
35
|
+
status: ExecutionStatus;
|
|
36
|
+
error?: ExecutionErrorMetadata;
|
|
37
|
+
resourceUsage?: ExecutionResourceUsage;
|
|
38
|
+
}
|
|
39
|
+
export type ExecutionCompletion = {
|
|
40
|
+
status: "succeeded";
|
|
41
|
+
completedAt: string;
|
|
42
|
+
resourceUsage?: ExecutionResourceUsage;
|
|
43
|
+
} | {
|
|
44
|
+
status: "failed";
|
|
45
|
+
completedAt: string;
|
|
46
|
+
error: ExecutionErrorMetadata;
|
|
47
|
+
resourceUsage?: ExecutionResourceUsage;
|
|
48
|
+
} | {
|
|
49
|
+
status: "cancelled" | "timed_out";
|
|
50
|
+
completedAt: string;
|
|
51
|
+
error?: ExecutionErrorMetadata;
|
|
52
|
+
resourceUsage?: ExecutionResourceUsage;
|
|
53
|
+
};
|
|
54
|
+
export interface ExecutionLedger {
|
|
55
|
+
begin(record: ExecutionRecord): Promise<void>;
|
|
56
|
+
complete(executionId: ExecutionId, result: ExecutionCompletion): Promise<void>;
|
|
57
|
+
completeWithState?(executionId: ExecutionId, result: Extract<ExecutionCompletion, {
|
|
58
|
+
status: "succeeded";
|
|
59
|
+
}>, stateTransaction: import("./state-context.js").ApplicationStateTransaction): Promise<void>;
|
|
60
|
+
get(executionId: ExecutionId): Promise<ExecutionRecord | undefined>;
|
|
61
|
+
listByApplication(applicationId: string): Promise<readonly ExecutionRecord[]>;
|
|
62
|
+
listByInvocation(invocationId: string): Promise<readonly ExecutionRecord[]>;
|
|
63
|
+
listByCapability(applicationId: string, capabilityName: string): Promise<readonly ExecutionRecord[]>;
|
|
64
|
+
}
|
|
65
|
+
export declare function newExecutionId(): ExecutionId;
|
|
66
|
+
export declare function newMaterializationId(): string;
|
|
67
|
+
export declare function validateExecutionRecord(record: ExecutionRecord): void;
|
|
68
|
+
export declare function assertExecutionLedgerData(value: unknown, path?: string): void;
|
|
69
|
+
export declare function sortExecutionRecords(records: readonly ExecutionRecord[]): ExecutionRecord[];
|
|
70
|
+
/** Adds durable lifecycle history to the canonical ExecutionEngine path. */ export declare class LedgeredExecutionEngine implements ExecutionEngine {
|
|
71
|
+
private readonly delegate;
|
|
72
|
+
private readonly ledger;
|
|
73
|
+
private readonly materializationId;
|
|
74
|
+
constructor(delegate: ExecutionEngine, ledger: ExecutionLedger, materializationId?: string);
|
|
75
|
+
acquireInstance(artifact: ExecutableArtifact, binding: AuthorizedCapabilityBinding, context: CapabilityContext): Promise<ExecutionInstance>;
|
|
76
|
+
execute<TOutput = unknown>(request: ExecutionRequest, context: CapabilityContext): Promise<{
|
|
77
|
+
result: import("./execution.js").ExecutionInstanceResult<TOutput>;
|
|
78
|
+
observation: import("./execution.js").ExecutionObservationRecord;
|
|
79
|
+
}>;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=execution-ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-ledger.d.ts","sourceRoot":"","sources":["../src/execution-ledger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,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CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAAC;IAC5E,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAAC;CACtG;AAED,wBAAgB,cAAc,IAAI,WAAW,CAE5C;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAOrE;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,SAAW,GAAG,IAAI,CAK/E;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,GAAG,eAAe,EAAE,CAE3F;AA+BD,4EAA4E,CAAA,qBAAa,uBAAwB,YAAW,eAAe;IAC7H,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAAmB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAmB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAAvG,QAAQ,EAAE,eAAe,EAAmB,MAAM,EAAE,eAAe,EAAmB,iBAAiB,SAAyB;IAE7J,eAAe,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,2BAA2B,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIrI,OAAO,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB;;;;CAwFvF"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { assertExecutionRequestAuthority } from "./execution.js";
|
|
3
|
+
import { assertIssuedAuthorizedBinding } from "./binding.js";
|
|
4
|
+
import { assertBindingAuthoritative } from "./authority-attestation.js";
|
|
5
|
+
import { assertArtifactMatchesSelection, assertImplementationSelectionEligible } from "./application-implementation.js";
|
|
6
|
+
import { crashAt } from "./crash-injection.js";
|
|
7
|
+
export function newExecutionId() {
|
|
8
|
+
return `exec_${randomUUID()}`;
|
|
9
|
+
}
|
|
10
|
+
export function newMaterializationId() {
|
|
11
|
+
return `mat_${randomUUID()}`;
|
|
12
|
+
}
|
|
13
|
+
export function validateExecutionRecord(record) {
|
|
14
|
+
for (const [field, value] of Object.entries({ executionId: record.executionId, materializationId: record.materializationId, invocationId: record.invocationId, applicationId: record.applicationId, providerApplicationId: record.providerApplicationId, capabilityName: record.capabilityName, contractFingerprint: record.contractFingerprint, artifactHash: record.artifactHash, startedAt: record.startedAt })) {
|
|
15
|
+
if (typeof value !== "string" || value.length === 0)
|
|
16
|
+
throw new Error(`${field} must be a non-empty string`);
|
|
17
|
+
}
|
|
18
|
+
if (record.status !== "running" || record.completedAt || record.error)
|
|
19
|
+
throw new Error("begin requires an uncompleted running record");
|
|
20
|
+
if (!Number.isInteger(record.capabilityVersion) || record.capabilityVersion < 1)
|
|
21
|
+
throw new Error("capabilityVersion must be a positive integer");
|
|
22
|
+
assertExecutionLedgerData(record);
|
|
23
|
+
}
|
|
24
|
+
export function assertExecutionLedgerData(value, path = "record") {
|
|
25
|
+
if (value === null || ["string", "number", "boolean"].includes(typeof value))
|
|
26
|
+
return;
|
|
27
|
+
if (Array.isArray(value)) {
|
|
28
|
+
value.forEach((entry, index) => assertExecutionLedgerData(entry, `${path}[${index}]`));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype)
|
|
32
|
+
throw new Error(`${path} must contain data only`);
|
|
33
|
+
for (const [key, entry] of Object.entries(value))
|
|
34
|
+
assertExecutionLedgerData(entry, `${path}.${key}`);
|
|
35
|
+
}
|
|
36
|
+
export function sortExecutionRecords(records) {
|
|
37
|
+
return [...records].sort((a, b) => a.startedAt.localeCompare(b.startedAt) || a.executionId.localeCompare(b.executionId));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Report the authority failure that makes a durable effect unauthorized.
|
|
41
|
+
*
|
|
42
|
+
* Returns the failure message when the binding's authority is no longer
|
|
43
|
+
* authoritative (for example after a durable revocation), or undefined when the
|
|
44
|
+
* binding still holds the authority the execution depends on.
|
|
45
|
+
*/
|
|
46
|
+
async function revocationDenial(binding) {
|
|
47
|
+
try {
|
|
48
|
+
await assertBindingAuthoritative(binding);
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return error instanceof Error ? error.message : String(error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Report the authority failure that makes the selected implementation
|
|
57
|
+
* ineligible, or undefined when the source and artifact are still executable.
|
|
58
|
+
*/
|
|
59
|
+
async function implementationDenial(implementation) {
|
|
60
|
+
try {
|
|
61
|
+
await assertImplementationSelectionEligible(implementation);
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
return error instanceof Error ? error.message : String(error);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Adds durable lifecycle history to the canonical ExecutionEngine path. */ export class LedgeredExecutionEngine {
|
|
69
|
+
delegate;
|
|
70
|
+
ledger;
|
|
71
|
+
materializationId;
|
|
72
|
+
constructor(delegate, ledger, materializationId = newMaterializationId()) {
|
|
73
|
+
this.delegate = delegate;
|
|
74
|
+
this.ledger = ledger;
|
|
75
|
+
this.materializationId = materializationId;
|
|
76
|
+
}
|
|
77
|
+
acquireInstance(artifact, binding, context) {
|
|
78
|
+
return this.delegate.acquireInstance(artifact, binding, context);
|
|
79
|
+
}
|
|
80
|
+
async execute(request, context) {
|
|
81
|
+
// Reject forged structural bindings before creating even a running ledger
|
|
82
|
+
// record. A denial must leave no executable or historical side effect.
|
|
83
|
+
crashAt("before_binding_validation");
|
|
84
|
+
assertIssuedAuthorizedBinding(request.binding);
|
|
85
|
+
await assertBindingAuthoritative(request.binding);
|
|
86
|
+
assertExecutionRequestAuthority(request);
|
|
87
|
+
// Source eligibility is durable authority, never an in-memory assumption a
|
|
88
|
+
// serialized binding can carry across processes: it is revalidated here,
|
|
89
|
+
// before the artifact is materialized.
|
|
90
|
+
if (request.implementation) {
|
|
91
|
+
await assertImplementationSelectionEligible(request.implementation);
|
|
92
|
+
assertArtifactMatchesSelection(request.implementation, request.artifact);
|
|
93
|
+
}
|
|
94
|
+
crashAt("after_binding_validation");
|
|
95
|
+
const executionId = newExecutionId();
|
|
96
|
+
const startedAt = new Date().toISOString();
|
|
97
|
+
crashAt("before_ledger_begin");
|
|
98
|
+
await this.ledger.begin({
|
|
99
|
+
executionId, materializationId: this.materializationId, invocationId: context.requestId,
|
|
100
|
+
applicationId: request.binding.provider.id,
|
|
101
|
+
providerApplicationId: request.binding.provider.id,
|
|
102
|
+
capabilityName: request.capability.name,
|
|
103
|
+
capabilityVersion: request.capability.version,
|
|
104
|
+
contractFingerprint: request.artifact.metadata.contractFingerprint,
|
|
105
|
+
artifactHash: request.artifact.contentHash,
|
|
106
|
+
startedAt, status: "running",
|
|
107
|
+
...(request.implementation ? { repositoryConnectionId: request.implementation.sourceConnectionId, implementationId: request.implementation.implementationId } : {}),
|
|
108
|
+
...(request.binding.consumer?.id ? { consumerApplicationId: request.binding.consumer.id } : {}),
|
|
109
|
+
...(request.stateTransaction ? { stateTransactionId: request.stateTransaction.transactionId } : {})
|
|
110
|
+
});
|
|
111
|
+
crashAt("after_ledger_begin");
|
|
112
|
+
try {
|
|
113
|
+
const executed = await this.delegate.execute(request, context);
|
|
114
|
+
const completedAt = new Date().toISOString();
|
|
115
|
+
const resourceUsage = { wallTimeMs: executed.observation.durationMs };
|
|
116
|
+
if (executed.result.kind === "success") {
|
|
117
|
+
// A durable success is authority-dependent, so authority is revalidated
|
|
118
|
+
// at the commit linearization point and not only at invocation. An
|
|
119
|
+
// execution that began while authorized but whose authority was revoked
|
|
120
|
+
// durably before commit must not produce a durable authorized effect.
|
|
121
|
+
const revoked = await revocationDenial(request.binding);
|
|
122
|
+
if (revoked) {
|
|
123
|
+
await request.stateTransaction?.abort().catch(() => undefined);
|
|
124
|
+
await this.ledger.complete(executionId, { status: "failed", completedAt, error: { kind: "AuthorizationRevoked", message: revoked }, resourceUsage });
|
|
125
|
+
return { ...executed, result: { kind: "failure", error: { code: "AUTHORIZATION_REVOKED", message: revoked } } };
|
|
126
|
+
}
|
|
127
|
+
// Source eligibility is revalidated at the same durable commit boundary:
|
|
128
|
+
// a source disconnected mid-execution must not produce a durable effect
|
|
129
|
+
// attributed to it.
|
|
130
|
+
const ineligible = request.implementation ? await implementationDenial(request.implementation) : undefined;
|
|
131
|
+
if (ineligible) {
|
|
132
|
+
await request.stateTransaction?.abort().catch(() => undefined);
|
|
133
|
+
await this.ledger.complete(executionId, { status: "failed", completedAt, error: { kind: "InvalidBinding", message: ineligible }, resourceUsage });
|
|
134
|
+
return { ...executed, result: { kind: "failure", error: { code: "IMPLEMENTATION_INELIGIBLE", message: ineligible } } };
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
const completion = { status: "succeeded", completedAt, resourceUsage };
|
|
138
|
+
crashAt("before_success_commit");
|
|
139
|
+
if (request.stateTransaction && this.ledger.completeWithState) {
|
|
140
|
+
await this.ledger.completeWithState(executionId, completion, request.stateTransaction);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
await request.stateTransaction?.commit();
|
|
144
|
+
await this.ledger.complete(executionId, completion);
|
|
145
|
+
}
|
|
146
|
+
crashAt("after_success_commit");
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
await request.stateTransaction?.abort().catch(() => undefined);
|
|
150
|
+
await this.ledger.complete(executionId, { status: "failed", completedAt, error: { kind: "ExecutionFailure", message: "State commit failed" }, resourceUsage });
|
|
151
|
+
return { ...executed, result: { kind: "failure", error: { code: "STATE_COMMIT_FAILED", message: "State commit failed" } } };
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
await request.stateTransaction?.abort();
|
|
156
|
+
if (executed.result.kind === "failure")
|
|
157
|
+
await this.ledger.complete(executionId, { status: "failed", completedAt, error: { kind: "ExecutionFailure", message: "Execution failed" }, resourceUsage });
|
|
158
|
+
if (executed.result.kind === "cancelled")
|
|
159
|
+
await this.ledger.complete(executionId, { status: "cancelled", completedAt, error: { kind: "Cancelled", message: "Execution cancelled" }, resourceUsage });
|
|
160
|
+
if (executed.result.kind === "timed_out")
|
|
161
|
+
await this.ledger.complete(executionId, { status: "timed_out", completedAt, error: { kind: "TimedOut", message: "Execution timed out" }, resourceUsage });
|
|
162
|
+
}
|
|
163
|
+
crashAt("before_success_return");
|
|
164
|
+
return executed;
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
await request.stateTransaction?.abort();
|
|
168
|
+
await this.ledger.complete(executionId, { status: "failed", completedAt: new Date().toISOString(), error: { kind: "ExecutionFailure", message: "Execution failed" } });
|
|
169
|
+
throw new Error("Execution failed");
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=execution-ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-ledger.js","sourceRoot":"","sources":["../src/execution-ledger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,+BAA+B,EAAuE,MAAM,gBAAgB,CAAC;AACtI,OAAO,EAAE,6BAA6B,EAAoC,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,qCAAqC,EAA+B,MAAM,iCAAiC,CAAC;AAErJ,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAuD/C,MAAM,UAAU,cAAc;IAC5B,OAAO,QAAQ,UAAU,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,oBA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ACjC,OAAO,QAAQ,CAAC;QAClB,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,OAAO,CAAC,gBAAgB,EAAE,KAAK,EAAE,CAAC;YACxC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;YACvK,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ephemeral WASM Execution Runtime (PR26)
|
|
3
|
+
*
|
|
4
|
+
* The execution engine layer that materializes ExecutableArtifacts into
|
|
5
|
+
* ephemeral WASM instances, executes capabilities, and destroys instances
|
|
6
|
+
* after completion.
|
|
7
|
+
*
|
|
8
|
+
* CRITICAL INVARIANT:
|
|
9
|
+
* - Every execution produces exactly one instance
|
|
10
|
+
* - Every instance has an explicit lifecycle (CREATED → READY → RUNNING → COMPLETED/FAILED/CANCELLED → DESTROYED)
|
|
11
|
+
* - After any outcome (success, failure, cancellation, timeout), running instances = 0
|
|
12
|
+
* - Instances are never reused or pooled
|
|
13
|
+
* - Memory is isolated per instance
|
|
14
|
+
* - Guest code cannot access host resources (filesystem, network, etc.)
|
|
15
|
+
*
|
|
16
|
+
* The execution engine bridges:
|
|
17
|
+
* AuthorizedCapabilityBinding
|
|
18
|
+
* ↓
|
|
19
|
+
* ExecutionEngine.execute()
|
|
20
|
+
* ↓
|
|
21
|
+
* ExecutionInstance (ephemeral WASM)
|
|
22
|
+
* ↓
|
|
23
|
+
* ExecutionResult + ExecutionObservationRecord
|
|
24
|
+
* ↓
|
|
25
|
+
* instance.destroy()
|
|
26
|
+
* ↓
|
|
27
|
+
* running instances = 0
|
|
28
|
+
*/
|
|
29
|
+
import type { ExecutableArtifact } from "./artifact.js";
|
|
30
|
+
import type { CapabilityContext } from "./context.js";
|
|
31
|
+
import type { AuthorizedCapabilityBinding } from "./binding.js";
|
|
32
|
+
/**
|
|
33
|
+
* Explicit lifecycle state for an execution instance.
|
|
34
|
+
*
|
|
35
|
+
* Valid state transitions:
|
|
36
|
+
* CREATED → READY → RUNNING → COMPLETED
|
|
37
|
+
* CREATED → READY → RUNNING → FAILED
|
|
38
|
+
* CREATED → READY → RUNNING → CANCELLED
|
|
39
|
+
* CREATED → READY → RUNNING → TIMED_OUT
|
|
40
|
+
* (any state) → DESTROYED (idempotent)
|
|
41
|
+
*
|
|
42
|
+
* Invalid transitions must throw InvalidStateTransitionError.
|
|
43
|
+
* For example: DESTROYED → RUNNING must be rejected.
|
|
44
|
+
*/
|
|
45
|
+
export declare enum ExecutionInstanceState {
|
|
46
|
+
/**
|
|
47
|
+
* Instance created but not yet instantiated.
|
|
48
|
+
* WASM module is not yet loaded.
|
|
49
|
+
*/
|
|
50
|
+
CREATED = "CREATED",
|
|
51
|
+
/**
|
|
52
|
+
* WASM module instantiated and ready for execution.
|
|
53
|
+
* Instance has acquired resources (linear memory allocated).
|
|
54
|
+
*/
|
|
55
|
+
READY = "READY",
|
|
56
|
+
/**
|
|
57
|
+
* Capability execution in progress.
|
|
58
|
+
* Guest code is running or suspended on host callback.
|
|
59
|
+
*/
|
|
60
|
+
RUNNING = "RUNNING",
|
|
61
|
+
/**
|
|
62
|
+
* Execution completed successfully.
|
|
63
|
+
* Output has been validated and is available.
|
|
64
|
+
*/
|
|
65
|
+
COMPLETED = "COMPLETED",
|
|
66
|
+
/**
|
|
67
|
+
* Execution failed (implementation error or validation failure).
|
|
68
|
+
* Error information is available; output is not.
|
|
69
|
+
*/
|
|
70
|
+
FAILED = "FAILED",
|
|
71
|
+
/**
|
|
72
|
+
* Execution cancelled by host (AbortSignal fired).
|
|
73
|
+
* Cancellation reason is available.
|
|
74
|
+
*/
|
|
75
|
+
CANCELLED = "CANCELLED",
|
|
76
|
+
/**
|
|
77
|
+
* Execution timed out (deadline exceeded).
|
|
78
|
+
* No result is available.
|
|
79
|
+
*/
|
|
80
|
+
TIMED_OUT = "TIMED_OUT",
|
|
81
|
+
/**
|
|
82
|
+
* Instance destroyed and all resources released.
|
|
83
|
+
* Instance is no longer usable.
|
|
84
|
+
* This is the terminal state.
|
|
85
|
+
*/
|
|
86
|
+
DESTROYED = "DESTROYED"
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Execution instance: a temporary materialization of an executable artifact.
|
|
90
|
+
*
|
|
91
|
+
* The instance is:
|
|
92
|
+
* - Ephemeral: created for one execution, destroyed after
|
|
93
|
+
* - Isolated: separate memory from other instances
|
|
94
|
+
* - Bounded: subject to resource limits
|
|
95
|
+
* - Safe: guest cannot access host resources
|
|
96
|
+
*
|
|
97
|
+
* NOT:
|
|
98
|
+
* - Persistent
|
|
99
|
+
* - Reusable
|
|
100
|
+
* - Pooled
|
|
101
|
+
* - Shared between invocations
|
|
102
|
+
*/
|
|
103
|
+
export interface ExecutionInstance {
|
|
104
|
+
/**
|
|
105
|
+
* Unique identifier for this instance.
|
|
106
|
+
* Used for observability and debugging.
|
|
107
|
+
*/
|
|
108
|
+
readonly instanceId: string;
|
|
109
|
+
/**
|
|
110
|
+
* Current lifecycle state of this instance.
|
|
111
|
+
*/
|
|
112
|
+
readonly state: ExecutionInstanceState;
|
|
113
|
+
/**
|
|
114
|
+
* The artifact this instance materializes.
|
|
115
|
+
*/
|
|
116
|
+
readonly artifact: ExecutableArtifact;
|
|
117
|
+
/**
|
|
118
|
+
* Timestamp when the instance was created (ISO 8601).
|
|
119
|
+
*/
|
|
120
|
+
readonly createdAt: string;
|
|
121
|
+
/**
|
|
122
|
+
* Execute a capability on this instance.
|
|
123
|
+
*
|
|
124
|
+
* The instance must be in READY state.
|
|
125
|
+
* After execution, the instance transitions to COMPLETED, FAILED, CANCELLED, or TIMED_OUT.
|
|
126
|
+
*
|
|
127
|
+
* @param capabilityName The fully qualified capability name (e.g., "invoice.create")
|
|
128
|
+
* @param input The capability input (already validated by caller)
|
|
129
|
+
* @param context Execution context with signal, deadline, logger
|
|
130
|
+
* @returns The execution result (output or error)
|
|
131
|
+
* @throws InvalidStateTransitionError if instance is not in READY state
|
|
132
|
+
*/
|
|
133
|
+
execute<TOutput = unknown>(capabilityName: string, input: unknown, context: CapabilityContext): Promise<ExecutionInstanceResult<TOutput>>;
|
|
134
|
+
/**
|
|
135
|
+
* Destroy the instance and release all resources.
|
|
136
|
+
*
|
|
137
|
+
* This is idempotent: calling destroy() multiple times is safe.
|
|
138
|
+
* After destruction:
|
|
139
|
+
* - Guest memory is inaccessible
|
|
140
|
+
* - Execution cannot resume
|
|
141
|
+
* - All host resources are released
|
|
142
|
+
* - Instance state transitions to DESTROYED
|
|
143
|
+
*
|
|
144
|
+
* @throws InvalidStateTransitionError only if called on a non-destroyable state
|
|
145
|
+
* (though in practice, destroy should be callable from any state for cleanup)
|
|
146
|
+
*/
|
|
147
|
+
destroy(): Promise<void>;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Result of executing a capability on an instance.
|
|
151
|
+
*
|
|
152
|
+
* CRITICAL: This result is produced INSIDE the execution engine
|
|
153
|
+
* and is not directly returned to the caller. The invocation layer
|
|
154
|
+
* wraps this in a CapabilityInvocationResult which adds binding/context
|
|
155
|
+
* information and normalizes errors.
|
|
156
|
+
*/
|
|
157
|
+
export type ExecutionInstanceResult<TOutput = unknown> = ExecutionInstanceSuccess<TOutput> | ExecutionInstanceFailure | ExecutionInstanceCancelled | ExecutionInstanceTimedOut;
|
|
158
|
+
/**
|
|
159
|
+
* Successful execution: the capability executed and produced output.
|
|
160
|
+
*/
|
|
161
|
+
export interface ExecutionInstanceSuccess<TOutput = unknown> {
|
|
162
|
+
readonly kind: "success";
|
|
163
|
+
readonly output: TOutput;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Failed execution: the implementation threw or produced invalid output.
|
|
167
|
+
*
|
|
168
|
+
* The error message should be normalized and safe to return to caller
|
|
169
|
+
* (no internal stack traces or credentials).
|
|
170
|
+
*/
|
|
171
|
+
export interface ExecutionInstanceFailure {
|
|
172
|
+
readonly kind: "failure";
|
|
173
|
+
readonly error: {
|
|
174
|
+
readonly message: string;
|
|
175
|
+
readonly code?: string;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Cancelled execution: the host cancelled the execution via AbortSignal.
|
|
180
|
+
*/
|
|
181
|
+
export interface ExecutionInstanceCancelled {
|
|
182
|
+
readonly kind: "cancelled";
|
|
183
|
+
readonly reason: string;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Timed out execution: the deadline was exceeded during execution.
|
|
187
|
+
*/
|
|
188
|
+
export interface ExecutionInstanceTimedOut {
|
|
189
|
+
readonly kind: "timed_out";
|
|
190
|
+
readonly reason: string;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Execution request: parameters for executing a capability on an artifact.
|
|
194
|
+
*
|
|
195
|
+
* This captures the semantic identity of the execution without runtime handles.
|
|
196
|
+
*/
|
|
197
|
+
export interface ExecutionRequest<TInput = unknown> {
|
|
198
|
+
/**
|
|
199
|
+
* The executable artifact to instantiate and execute.
|
|
200
|
+
*/
|
|
201
|
+
readonly artifact: ExecutableArtifact;
|
|
202
|
+
/**
|
|
203
|
+
* The authorized binding permitting this execution.
|
|
204
|
+
*/
|
|
205
|
+
readonly binding: AuthorizedCapabilityBinding;
|
|
206
|
+
/**
|
|
207
|
+
* The capability being invoked (must be in artifact.exports).
|
|
208
|
+
*/
|
|
209
|
+
readonly capability: {
|
|
210
|
+
readonly name: string;
|
|
211
|
+
readonly version: number;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* The input to pass to the capability (already validated by caller).
|
|
215
|
+
*/
|
|
216
|
+
readonly input: TInput;
|
|
217
|
+
/** Optional host-owned durable state transaction correlated with this execution. */
|
|
218
|
+
readonly stateTransaction?: import("./state-context.js").ApplicationStateTransaction;
|
|
219
|
+
/**
|
|
220
|
+
* Optional implementation selected for this execution (F6).
|
|
221
|
+
*
|
|
222
|
+
* Present when the artifact was materialized from a verified application
|
|
223
|
+
* source. The selection is revalidated against durable authority before the
|
|
224
|
+
* artifact is materialized, and its provenance reaches the execution ledger.
|
|
225
|
+
*/
|
|
226
|
+
readonly implementation?: import("./application-implementation.js").SelectedImplementation;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Execution observation record: immutable record of execution for observability.
|
|
230
|
+
*
|
|
231
|
+
* This record is sufficient for:
|
|
232
|
+
* - Audit trails
|
|
233
|
+
* - Debugging
|
|
234
|
+
* - Future analytics/metering
|
|
235
|
+
* - Compliance logging
|
|
236
|
+
*
|
|
237
|
+
* It MUST NOT contain:
|
|
238
|
+
* - Secrets or credentials
|
|
239
|
+
* - Raw input/output (only hashes or summaries)
|
|
240
|
+
* - Guest memory dumps
|
|
241
|
+
* - Personal data
|
|
242
|
+
*/
|
|
243
|
+
export interface ExecutionObservationRecord {
|
|
244
|
+
/** Unique execution identifier. */
|
|
245
|
+
readonly invocationId: string;
|
|
246
|
+
/** Application providing the capability. */
|
|
247
|
+
readonly providerId: string;
|
|
248
|
+
/** Application consuming the capability. */
|
|
249
|
+
readonly consumerId?: string;
|
|
250
|
+
/** Capability name. */
|
|
251
|
+
readonly capabilityName: string;
|
|
252
|
+
/** Capability version. */
|
|
253
|
+
readonly capabilityVersion: number;
|
|
254
|
+
/** SHA256 hash of artifact bytes. */
|
|
255
|
+
readonly artifactHash: string;
|
|
256
|
+
/** Contract fingerprint. */
|
|
257
|
+
readonly contractFingerprint: string;
|
|
258
|
+
/** Execution instance ID. */
|
|
259
|
+
readonly instanceId: string;
|
|
260
|
+
/** Timestamp when execution started (ISO 8601). */
|
|
261
|
+
readonly startedAt: string;
|
|
262
|
+
/** Timestamp when execution completed (ISO 8601). */
|
|
263
|
+
readonly completedAt: string;
|
|
264
|
+
/** Duration in milliseconds. */
|
|
265
|
+
readonly durationMs: number;
|
|
266
|
+
/** Execution outcome. */
|
|
267
|
+
readonly outcome: "success" | "failure" | "cancelled" | "timed_out";
|
|
268
|
+
/** Resource usage metrics. */
|
|
269
|
+
readonly resourceUsage?: {
|
|
270
|
+
/** Peak memory used by instance linear memory (bytes). */
|
|
271
|
+
readonly peakMemoryBytes?: number;
|
|
272
|
+
/** Approximate instruction count or fuel used. */
|
|
273
|
+
readonly instructionCount?: number;
|
|
274
|
+
};
|
|
275
|
+
/** State transaction metadata (PR27). */
|
|
276
|
+
readonly stateTransaction?: {
|
|
277
|
+
/** Unique transaction identifier. */
|
|
278
|
+
readonly transactionId: string;
|
|
279
|
+
/** Number of state read operations. */
|
|
280
|
+
readonly readCount: number;
|
|
281
|
+
/** Number of state write operations. */
|
|
282
|
+
readonly writeCount: number;
|
|
283
|
+
/** Number of state delete operations. */
|
|
284
|
+
readonly deleteCount: number;
|
|
285
|
+
/** Transaction commit status. */
|
|
286
|
+
readonly commitStatus: "committed" | "aborted" | "pending";
|
|
287
|
+
/** If commit failed, the error reason. */
|
|
288
|
+
readonly commitError?: string;
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Execution Engine: materializes artifacts into ephemeral WASM instances.
|
|
293
|
+
*
|
|
294
|
+
* The engine:
|
|
295
|
+
* - Validates artifacts before instantiation
|
|
296
|
+
* - Enforces resource limits
|
|
297
|
+
* - Handles cancellation and timeout
|
|
298
|
+
* - Produces execution observation records
|
|
299
|
+
* - Ensures instances are destroyed after execution
|
|
300
|
+
*
|
|
301
|
+
* The engine does NOT:
|
|
302
|
+
* - Persist or pool instances
|
|
303
|
+
* - Cache or reuse compiled modules (for now; design for future optimization)
|
|
304
|
+
* - Make authorization decisions (caller provides AuthorizedCapabilityBinding)
|
|
305
|
+
* - Validate input or output (caller handles validation)
|
|
306
|
+
*/
|
|
307
|
+
export interface ExecutionEngine {
|
|
308
|
+
/**
|
|
309
|
+
* Execute a capability through an execution request.
|
|
310
|
+
*
|
|
311
|
+
* Flow:
|
|
312
|
+
* 1. Acquire instance from artifact
|
|
313
|
+
* 2. Resolve capability export from artifact metadata
|
|
314
|
+
* 3. Execute capability on instance
|
|
315
|
+
* 4. Observe execution
|
|
316
|
+
* 5. Destroy instance
|
|
317
|
+
* 6. Return result + observation record
|
|
318
|
+
*
|
|
319
|
+
* @param request Execution request with artifact, binding, capability, input
|
|
320
|
+
* @param context Execution context with signal, deadline, logger
|
|
321
|
+
* @returns Execution result and observation record
|
|
322
|
+
*/
|
|
323
|
+
execute<TOutput = unknown>(request: ExecutionRequest, context: CapabilityContext): Promise<{
|
|
324
|
+
result: ExecutionInstanceResult<TOutput>;
|
|
325
|
+
observation: ExecutionObservationRecord;
|
|
326
|
+
}>;
|
|
327
|
+
/**
|
|
328
|
+
* Acquire an execution instance from an artifact.
|
|
329
|
+
*
|
|
330
|
+
* Creates a new instance by:
|
|
331
|
+
* 1. Validating artifact (contract/content consistency)
|
|
332
|
+
* 2. Loading WASM bytes
|
|
333
|
+
* 3. Instantiating WASM module
|
|
334
|
+
* 4. Setting up host imports
|
|
335
|
+
* 5. Verifying all declared exports are present
|
|
336
|
+
*
|
|
337
|
+
* The instance is in READY state and can be executed.
|
|
338
|
+
*
|
|
339
|
+
* @param artifact The executable artifact
|
|
340
|
+
* @param binding The authorized binding (for identity context)
|
|
341
|
+
* @param context The execution context
|
|
342
|
+
* @returns A new ephemeral execution instance
|
|
343
|
+
* @throws ArtifactValidationError if artifact is invalid
|
|
344
|
+
* @throws MissingExportError if declared exports are missing
|
|
345
|
+
*/
|
|
346
|
+
acquireInstance(artifact: ExecutableArtifact, binding: AuthorizedCapabilityBinding, context: CapabilityContext): Promise<ExecutionInstance>;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Validate that execution uses exactly the authority granted by the issued
|
|
350
|
+
* binding. Execution requests are caller-supplied data, so the runtime must not
|
|
351
|
+
* trust request capability or artifact identity fields when they disagree with
|
|
352
|
+
* the authoritative binding and registered provider state.
|
|
353
|
+
*/
|
|
354
|
+
export declare function assertExecutionRequestAuthority(request: ExecutionRequest): void;
|
|
355
|
+
/**
|
|
356
|
+
* Artifact instantiation error: artifact failed validation or instantiation.
|
|
357
|
+
*
|
|
358
|
+
* This includes:
|
|
359
|
+
* - WASM structural errors
|
|
360
|
+
* - Contract fingerprint mismatch
|
|
361
|
+
* - Export/capability mismatch
|
|
362
|
+
* - Forbidden imports
|
|
363
|
+
*/
|
|
364
|
+
export declare class ArtifactInstantiationError extends Error {
|
|
365
|
+
readonly message: string;
|
|
366
|
+
readonly artifactHash: string;
|
|
367
|
+
readonly details?: unknown | undefined;
|
|
368
|
+
constructor(message: string, artifactHash: string, details?: unknown | undefined);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Missing export error: artifact doesn't export declared capability.
|
|
372
|
+
*/
|
|
373
|
+
export declare class MissingExportError extends Error {
|
|
374
|
+
readonly capabilityName: string;
|
|
375
|
+
readonly artifactHash: string;
|
|
376
|
+
readonly availableExports: readonly string[];
|
|
377
|
+
constructor(capabilityName: string, artifactHash: string, availableExports: readonly string[]);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Invalid state transition: instance lifecycle state change is not allowed.
|
|
381
|
+
*/
|
|
382
|
+
export declare class InvalidStateTransitionError extends Error {
|
|
383
|
+
readonly fromState: ExecutionInstanceState;
|
|
384
|
+
readonly toState: ExecutionInstanceState;
|
|
385
|
+
constructor(fromState: ExecutionInstanceState, toState: ExecutionInstanceState);
|
|
386
|
+
}
|
|
387
|
+
//# sourceMappingURL=execution.d.ts.map
|