@smthrs/control 0.0.0-stage → 1.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +194 -0
- package/LICENSE +21 -0
- package/README.md +168 -2
- package/dist/cjs/ApprovalAuthority.d.ts +73 -0
- package/dist/cjs/ApprovalAuthority.d.ts.map +1 -0
- package/dist/cjs/ApprovalAuthority.js +62 -0
- package/dist/cjs/ApprovalAuthority.js.map +7 -0
- package/dist/cjs/Cancellation.d.ts +107 -0
- package/dist/cjs/Cancellation.d.ts.map +1 -0
- package/dist/cjs/Cancellation.js +72 -0
- package/dist/cjs/Cancellation.js.map +7 -0
- package/dist/cjs/Channels.d.ts +170 -0
- package/dist/cjs/Channels.d.ts.map +1 -0
- package/dist/cjs/Channels.js +278 -0
- package/dist/cjs/Channels.js.map +7 -0
- package/dist/cjs/Control.d.ts +202 -0
- package/dist/cjs/Control.d.ts.map +1 -0
- package/dist/cjs/Control.js +47 -0
- package/dist/cjs/Control.js.map +7 -0
- package/dist/cjs/ControlClient.d.ts +52 -0
- package/dist/cjs/ControlClient.d.ts.map +1 -0
- package/dist/cjs/ControlClient.js +191 -0
- package/dist/cjs/ControlClient.js.map +7 -0
- package/dist/cjs/ControlError.d.ts +318 -0
- package/dist/cjs/ControlError.d.ts.map +1 -0
- package/dist/cjs/ControlError.js +249 -0
- package/dist/cjs/ControlError.js.map +7 -0
- package/dist/cjs/ControlExecutor.d.ts +372 -0
- package/dist/cjs/ControlExecutor.d.ts.map +1 -0
- package/dist/cjs/ControlExecutor.js +123 -0
- package/dist/cjs/ControlExecutor.js.map +7 -0
- package/dist/cjs/ControlFacts.d.ts +454 -0
- package/dist/cjs/ControlFacts.d.ts.map +1 -0
- package/dist/cjs/ControlFacts.js +261 -0
- package/dist/cjs/ControlFacts.js.map +7 -0
- package/dist/cjs/ControlLive.d.ts +23 -0
- package/dist/cjs/ControlLive.d.ts.map +1 -0
- package/dist/cjs/ControlLive.js +1280 -0
- package/dist/cjs/ControlLive.js.map +7 -0
- package/dist/cjs/ControlRpcs.d.ts +1204 -0
- package/dist/cjs/ControlRpcs.d.ts.map +1 -0
- package/dist/cjs/ControlRpcs.js +247 -0
- package/dist/cjs/ControlRpcs.js.map +7 -0
- package/dist/cjs/ControlRuntime.d.ts +635 -0
- package/dist/cjs/ControlRuntime.d.ts.map +1 -0
- package/dist/cjs/ControlRuntime.js +740 -0
- package/dist/cjs/ControlRuntime.js.map +7 -0
- package/dist/cjs/ControlSchema.d.ts +2642 -0
- package/dist/cjs/ControlSchema.d.ts.map +1 -0
- package/dist/cjs/ControlSchema.js +634 -0
- package/dist/cjs/ControlSchema.js.map +7 -0
- package/dist/cjs/ControlServer.d.ts +51 -0
- package/dist/cjs/ControlServer.d.ts.map +1 -0
- package/dist/cjs/ControlServer.js +121 -0
- package/dist/cjs/ControlServer.js.map +7 -0
- package/dist/cjs/Credential.d.ts +136 -0
- package/dist/cjs/Credential.d.ts.map +1 -0
- package/dist/cjs/Credential.js +168 -0
- package/dist/cjs/Credential.js.map +7 -0
- package/dist/cjs/CredentialCipher.d.ts +90 -0
- package/dist/cjs/CredentialCipher.d.ts.map +1 -0
- package/dist/cjs/CredentialCipher.js +45 -0
- package/dist/cjs/CredentialCipher.js.map +7 -0
- package/dist/cjs/CredentialStore.d.ts +97 -0
- package/dist/cjs/CredentialStore.d.ts.map +1 -0
- package/dist/cjs/CredentialStore.js +81 -0
- package/dist/cjs/CredentialStore.js.map +7 -0
- package/dist/cjs/DispatchReader.d.ts +112 -0
- package/dist/cjs/DispatchReader.d.ts.map +1 -0
- package/dist/cjs/DispatchReader.js +45 -0
- package/dist/cjs/DispatchReader.js.map +7 -0
- package/dist/cjs/Health.d.ts +333 -0
- package/dist/cjs/Health.d.ts.map +1 -0
- package/dist/cjs/Health.js +311 -0
- package/dist/cjs/Health.js.map +7 -0
- package/dist/cjs/JevSessionChecker.d.ts +57 -0
- package/dist/cjs/JevSessionChecker.d.ts.map +1 -0
- package/dist/cjs/JevSessionChecker.js +113 -0
- package/dist/cjs/JevSessionChecker.js.map +7 -0
- package/dist/cjs/Lineage.d.ts +131 -0
- package/dist/cjs/Lineage.d.ts.map +1 -0
- package/dist/cjs/Lineage.js +81 -0
- package/dist/cjs/Lineage.js.map +7 -0
- package/dist/cjs/Migrations.d.ts +34 -0
- package/dist/cjs/Migrations.d.ts.map +1 -0
- package/dist/cjs/Migrations.js +60 -0
- package/dist/cjs/Migrations.js.map +7 -0
- package/dist/cjs/Monitor.d.ts +282 -0
- package/dist/cjs/Monitor.d.ts.map +1 -0
- package/dist/cjs/Monitor.js +283 -0
- package/dist/cjs/Monitor.js.map +7 -0
- package/dist/cjs/ScopedToken.d.ts +193 -0
- package/dist/cjs/ScopedToken.d.ts.map +1 -0
- package/dist/cjs/ScopedToken.js +135 -0
- package/dist/cjs/ScopedToken.js.map +7 -0
- package/dist/cjs/SqlControlRuntime.d.ts +161 -0
- package/dist/cjs/SqlControlRuntime.d.ts.map +1 -0
- package/dist/cjs/SqlControlRuntime.js +1521 -0
- package/dist/cjs/SqlControlRuntime.js.map +7 -0
- package/dist/cjs/SqlCredentialStore.d.ts +43 -0
- package/dist/cjs/SqlCredentialStore.d.ts.map +1 -0
- package/dist/cjs/SqlCredentialStore.js +113 -0
- package/dist/cjs/SqlCredentialStore.js.map +7 -0
- package/dist/cjs/Steering.d.ts +69 -0
- package/dist/cjs/Steering.d.ts.map +1 -0
- package/dist/cjs/Steering.js +49 -0
- package/dist/cjs/Steering.js.map +7 -0
- package/dist/cjs/SystemFlows.d.ts +223 -0
- package/dist/cjs/SystemFlows.d.ts.map +1 -0
- package/dist/cjs/SystemFlows.js +195 -0
- package/dist/cjs/SystemFlows.js.map +7 -0
- package/dist/cjs/WebCryptoCipher.d.ts +49 -0
- package/dist/cjs/WebCryptoCipher.d.ts.map +1 -0
- package/dist/cjs/WebCryptoCipher.js +129 -0
- package/dist/cjs/WebCryptoCipher.js.map +7 -0
- package/dist/cjs/WebhookChannel.d.ts +113 -0
- package/dist/cjs/WebhookChannel.d.ts.map +1 -0
- package/dist/cjs/WebhookChannel.js +98 -0
- package/dist/cjs/WebhookChannel.js.map +7 -0
- package/dist/cjs/index.d.ts +160 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +91 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/MutationBoundary.d.ts +27 -0
- package/dist/cjs/internal/MutationBoundary.d.ts.map +1 -0
- package/dist/cjs/internal/MutationBoundary.js +50 -0
- package/dist/cjs/internal/MutationBoundary.js.map +7 -0
- package/dist/cjs/internal/activeFibers.d.ts +12 -0
- package/dist/cjs/internal/activeFibers.d.ts.map +1 -0
- package/dist/cjs/internal/activeFibers.js +30 -0
- package/dist/cjs/internal/activeFibers.js.map +7 -0
- package/dist/cjs/internal/issues.d.ts +28 -0
- package/dist/cjs/internal/issues.d.ts.map +1 -0
- package/dist/cjs/internal/issues.js +34 -0
- package/dist/cjs/internal/issues.js.map +7 -0
- package/dist/cjs/internal/planning.d.ts +347 -0
- package/dist/cjs/internal/planning.d.ts.map +1 -0
- package/dist/cjs/internal/planning.js +137 -0
- package/dist/cjs/internal/planning.js.map +7 -0
- package/dist/cjs/internal/sqlSchemaErrors.d.ts +18 -0
- package/dist/cjs/internal/sqlSchemaErrors.d.ts.map +1 -0
- package/dist/cjs/internal/sqlSchemaErrors.js +40 -0
- package/dist/cjs/internal/sqlSchemaErrors.js.map +7 -0
- package/dist/cjs/migrations/0001_control_tables.d.ts +18 -0
- package/dist/cjs/migrations/0001_control_tables.d.ts.map +1 -0
- package/dist/cjs/migrations/0001_control_tables.js +115 -0
- package/dist/cjs/migrations/0001_control_tables.js.map +7 -0
- package/dist/cjs/migrations/0002_run_keys.d.ts +15 -0
- package/dist/cjs/migrations/0002_run_keys.d.ts.map +1 -0
- package/dist/cjs/migrations/0002_run_keys.js +44 -0
- package/dist/cjs/migrations/0002_run_keys.js.map +7 -0
- package/dist/cjs/migrations/0003_signal_commands.d.ts +13 -0
- package/dist/cjs/migrations/0003_signal_commands.d.ts.map +1 -0
- package/dist/cjs/migrations/0003_signal_commands.js +50 -0
- package/dist/cjs/migrations/0003_signal_commands.js.map +7 -0
- package/dist/cjs/migrations/0004_approval_decisions.d.ts +13 -0
- package/dist/cjs/migrations/0004_approval_decisions.d.ts.map +1 -0
- package/dist/cjs/migrations/0004_approval_decisions.js +45 -0
- package/dist/cjs/migrations/0004_approval_decisions.js.map +7 -0
- package/dist/cjs/migrations/0005_signal_principals.d.ts +18 -0
- package/dist/cjs/migrations/0005_signal_principals.d.ts.map +1 -0
- package/dist/cjs/migrations/0005_signal_principals.js +45 -0
- package/dist/cjs/migrations/0005_signal_principals.js.map +7 -0
- package/dist/cjs/migrations/0006_run_principals.d.ts +18 -0
- package/dist/cjs/migrations/0006_run_principals.d.ts.map +1 -0
- package/dist/cjs/migrations/0006_run_principals.js +49 -0
- package/dist/cjs/migrations/0006_run_principals.js.map +7 -0
- package/dist/cjs/migrations/0007_resume_consent.d.ts +18 -0
- package/dist/cjs/migrations/0007_resume_consent.d.ts.map +1 -0
- package/dist/cjs/migrations/0007_resume_consent.js +46 -0
- package/dist/cjs/migrations/0007_resume_consent.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test/TestControl.d.ts +19 -0
- package/dist/cjs/test/TestControl.d.ts.map +1 -0
- package/dist/cjs/test/TestControl.js +62 -0
- package/dist/cjs/test/TestControl.js.map +7 -0
- package/dist/esm/ApprovalAuthority.d.ts +73 -0
- package/dist/esm/ApprovalAuthority.d.ts.map +1 -0
- package/dist/esm/ApprovalAuthority.js +72 -0
- package/dist/esm/ApprovalAuthority.js.map +1 -0
- package/dist/esm/Cancellation.d.ts +107 -0
- package/dist/esm/Cancellation.d.ts.map +1 -0
- package/dist/esm/Cancellation.js +116 -0
- package/dist/esm/Cancellation.js.map +1 -0
- package/dist/esm/Channels.d.ts +170 -0
- package/dist/esm/Channels.d.ts.map +1 -0
- package/dist/esm/Channels.js +312 -0
- package/dist/esm/Channels.js.map +1 -0
- package/dist/esm/Control.d.ts +202 -0
- package/dist/esm/Control.d.ts.map +1 -0
- package/dist/esm/Control.js +42 -0
- package/dist/esm/Control.js.map +1 -0
- package/dist/esm/ControlClient.d.ts +52 -0
- package/dist/esm/ControlClient.d.ts.map +1 -0
- package/dist/esm/ControlClient.js +217 -0
- package/dist/esm/ControlClient.js.map +1 -0
- package/dist/esm/ControlError.d.ts +318 -0
- package/dist/esm/ControlError.d.ts.map +1 -0
- package/dist/esm/ControlError.js +359 -0
- package/dist/esm/ControlError.js.map +1 -0
- package/dist/esm/ControlExecutor.d.ts +372 -0
- package/dist/esm/ControlExecutor.d.ts.map +1 -0
- package/dist/esm/ControlExecutor.js +212 -0
- package/dist/esm/ControlExecutor.js.map +1 -0
- package/dist/esm/ControlFacts.d.ts +454 -0
- package/dist/esm/ControlFacts.d.ts.map +1 -0
- package/dist/esm/ControlFacts.js +324 -0
- package/dist/esm/ControlFacts.js.map +1 -0
- package/dist/esm/ControlLive.d.ts +23 -0
- package/dist/esm/ControlLive.d.ts.map +1 -0
- package/dist/esm/ControlLive.js +1585 -0
- package/dist/esm/ControlLive.js.map +1 -0
- package/dist/esm/ControlRpcs.d.ts +1204 -0
- package/dist/esm/ControlRpcs.d.ts.map +1 -0
- package/dist/esm/ControlRpcs.js +299 -0
- package/dist/esm/ControlRpcs.js.map +1 -0
- package/dist/esm/ControlRuntime.d.ts +635 -0
- package/dist/esm/ControlRuntime.d.ts.map +1 -0
- package/dist/esm/ControlRuntime.js +807 -0
- package/dist/esm/ControlRuntime.js.map +1 -0
- package/dist/esm/ControlSchema.d.ts +2642 -0
- package/dist/esm/ControlSchema.d.ts.map +1 -0
- package/dist/esm/ControlSchema.js +1030 -0
- package/dist/esm/ControlSchema.js.map +1 -0
- package/dist/esm/ControlServer.d.ts +51 -0
- package/dist/esm/ControlServer.d.ts.map +1 -0
- package/dist/esm/ControlServer.js +145 -0
- package/dist/esm/ControlServer.js.map +1 -0
- package/dist/esm/Credential.d.ts +136 -0
- package/dist/esm/Credential.d.ts.map +1 -0
- package/dist/esm/Credential.js +190 -0
- package/dist/esm/Credential.js.map +1 -0
- package/dist/esm/CredentialCipher.d.ts +90 -0
- package/dist/esm/CredentialCipher.d.ts.map +1 -0
- package/dist/esm/CredentialCipher.js +56 -0
- package/dist/esm/CredentialCipher.js.map +1 -0
- package/dist/esm/CredentialStore.d.ts +97 -0
- package/dist/esm/CredentialStore.d.ts.map +1 -0
- package/dist/esm/CredentialStore.js +101 -0
- package/dist/esm/CredentialStore.js.map +1 -0
- package/dist/esm/DispatchReader.d.ts +112 -0
- package/dist/esm/DispatchReader.d.ts.map +1 -0
- package/dist/esm/DispatchReader.js +76 -0
- package/dist/esm/DispatchReader.js.map +1 -0
- package/dist/esm/Health.d.ts +333 -0
- package/dist/esm/Health.d.ts.map +1 -0
- package/dist/esm/Health.js +400 -0
- package/dist/esm/Health.js.map +1 -0
- package/dist/esm/JevSessionChecker.d.ts +57 -0
- package/dist/esm/JevSessionChecker.d.ts.map +1 -0
- package/dist/esm/JevSessionChecker.js +108 -0
- package/dist/esm/JevSessionChecker.js.map +1 -0
- package/dist/esm/Lineage.d.ts +131 -0
- package/dist/esm/Lineage.d.ts.map +1 -0
- package/dist/esm/Lineage.js +174 -0
- package/dist/esm/Lineage.js.map +1 -0
- package/dist/esm/Migrations.d.ts +34 -0
- package/dist/esm/Migrations.d.ts.map +1 -0
- package/dist/esm/Migrations.js +53 -0
- package/dist/esm/Migrations.js.map +1 -0
- package/dist/esm/Monitor.d.ts +282 -0
- package/dist/esm/Monitor.d.ts.map +1 -0
- package/dist/esm/Monitor.js +415 -0
- package/dist/esm/Monitor.js.map +1 -0
- package/dist/esm/ScopedToken.d.ts +193 -0
- package/dist/esm/ScopedToken.d.ts.map +1 -0
- package/dist/esm/ScopedToken.js +224 -0
- package/dist/esm/ScopedToken.js.map +1 -0
- package/dist/esm/SqlControlRuntime.d.ts +161 -0
- package/dist/esm/SqlControlRuntime.d.ts.map +1 -0
- package/dist/esm/SqlControlRuntime.js +1756 -0
- package/dist/esm/SqlControlRuntime.js.map +1 -0
- package/dist/esm/SqlCredentialStore.d.ts +43 -0
- package/dist/esm/SqlCredentialStore.d.ts.map +1 -0
- package/dist/esm/SqlCredentialStore.js +97 -0
- package/dist/esm/SqlCredentialStore.js.map +1 -0
- package/dist/esm/Steering.d.ts +69 -0
- package/dist/esm/Steering.d.ts.map +1 -0
- package/dist/esm/Steering.js +89 -0
- package/dist/esm/Steering.js.map +1 -0
- package/dist/esm/SystemFlows.d.ts +223 -0
- package/dist/esm/SystemFlows.d.ts.map +1 -0
- package/dist/esm/SystemFlows.js +198 -0
- package/dist/esm/SystemFlows.js.map +1 -0
- package/dist/esm/WebCryptoCipher.d.ts +49 -0
- package/dist/esm/WebCryptoCipher.d.ts.map +1 -0
- package/dist/esm/WebCryptoCipher.js +123 -0
- package/dist/esm/WebCryptoCipher.js.map +1 -0
- package/dist/esm/WebhookChannel.d.ts +113 -0
- package/dist/esm/WebhookChannel.d.ts.map +1 -0
- package/dist/esm/WebhookChannel.js +109 -0
- package/dist/esm/WebhookChannel.js.map +1 -0
- package/dist/esm/index.d.ts +160 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +160 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/MutationBoundary.d.ts +27 -0
- package/dist/esm/internal/MutationBoundary.d.ts.map +1 -0
- package/dist/esm/internal/MutationBoundary.js +40 -0
- package/dist/esm/internal/MutationBoundary.js.map +1 -0
- package/dist/esm/internal/activeFibers.d.ts +12 -0
- package/dist/esm/internal/activeFibers.d.ts.map +1 -0
- package/dist/esm/internal/activeFibers.js +17 -0
- package/dist/esm/internal/activeFibers.js.map +1 -0
- package/dist/esm/internal/issues.d.ts +28 -0
- package/dist/esm/internal/issues.d.ts.map +1 -0
- package/dist/esm/internal/issues.js +35 -0
- package/dist/esm/internal/issues.js.map +1 -0
- package/dist/esm/internal/planning.d.ts +347 -0
- package/dist/esm/internal/planning.d.ts.map +1 -0
- package/dist/esm/internal/planning.js +199 -0
- package/dist/esm/internal/planning.js.map +1 -0
- package/dist/esm/internal/sqlSchemaErrors.d.ts +18 -0
- package/dist/esm/internal/sqlSchemaErrors.d.ts.map +1 -0
- package/dist/esm/internal/sqlSchemaErrors.js +38 -0
- package/dist/esm/internal/sqlSchemaErrors.js.map +1 -0
- package/dist/esm/migrations/0001_control_tables.d.ts +18 -0
- package/dist/esm/migrations/0001_control_tables.d.ts.map +1 -0
- package/dist/esm/migrations/0001_control_tables.js +96 -0
- package/dist/esm/migrations/0001_control_tables.js.map +1 -0
- package/dist/esm/migrations/0002_run_keys.d.ts +15 -0
- package/dist/esm/migrations/0002_run_keys.d.ts.map +1 -0
- package/dist/esm/migrations/0002_run_keys.js +22 -0
- package/dist/esm/migrations/0002_run_keys.js.map +1 -0
- package/dist/esm/migrations/0003_signal_commands.d.ts +13 -0
- package/dist/esm/migrations/0003_signal_commands.d.ts.map +1 -0
- package/dist/esm/migrations/0003_signal_commands.js +26 -0
- package/dist/esm/migrations/0003_signal_commands.js.map +1 -0
- package/dist/esm/migrations/0004_approval_decisions.d.ts +13 -0
- package/dist/esm/migrations/0004_approval_decisions.d.ts.map +1 -0
- package/dist/esm/migrations/0004_approval_decisions.js +25 -0
- package/dist/esm/migrations/0004_approval_decisions.js.map +1 -0
- package/dist/esm/migrations/0005_signal_principals.d.ts +18 -0
- package/dist/esm/migrations/0005_signal_principals.d.ts.map +1 -0
- package/dist/esm/migrations/0005_signal_principals.js +27 -0
- package/dist/esm/migrations/0005_signal_principals.js.map +1 -0
- package/dist/esm/migrations/0006_run_principals.d.ts +18 -0
- package/dist/esm/migrations/0006_run_principals.d.ts.map +1 -0
- package/dist/esm/migrations/0006_run_principals.js +30 -0
- package/dist/esm/migrations/0006_run_principals.js.map +1 -0
- package/dist/esm/migrations/0007_resume_consent.d.ts +18 -0
- package/dist/esm/migrations/0007_resume_consent.d.ts.map +1 -0
- package/dist/esm/migrations/0007_resume_consent.js +27 -0
- package/dist/esm/migrations/0007_resume_consent.js.map +1 -0
- package/dist/esm/test/TestControl.d.ts +19 -0
- package/dist/esm/test/TestControl.d.ts.map +1 -0
- package/dist/esm/test/TestControl.js +30 -0
- package/dist/esm/test/TestControl.js.map +1 -0
- package/docs/README.md +189 -0
- package/docs/api.md +982 -0
- package/docs/concepts/authority.md +109 -0
- package/docs/concepts/cancellation.md +129 -0
- package/docs/concepts/lineage.md +132 -0
- package/docs/concepts/ownership.md +139 -0
- package/docs/concepts/projections.md +203 -0
- package/docs/concepts/receipts.md +128 -0
- package/docs/guides/approvals.md +284 -0
- package/docs/guides/cancel-and-resume.md +162 -0
- package/docs/guides/durable-storage.md +147 -0
- package/docs/guides/implement-an-executor.md +173 -0
- package/docs/guides/ingest-a-webhook.md +177 -0
- package/docs/guides/list-runs.md +160 -0
- package/docs/guides/monitor-runs.md +176 -0
- package/docs/guides/observe-health.md +147 -0
- package/docs/guides/postgres-tests.md +5 -0
- package/docs/guides/serve-over-rpc.md +220 -0
- package/docs/guides/signal-a-run.md +53 -0
- package/docs/guides/steer-a-run.md +138 -0
- package/docs/guides/store-credentials.md +164 -0
- package/docs/guides/testing.md +139 -0
- package/docs/guides/watch-a-run.md +154 -0
- package/docs/installation.md +106 -0
- package/docs/quickstart.md +163 -0
- package/docs/troubleshooting.md +208 -0
- package/package.json +405 -3
- package/src/ApprovalAuthority.ts +114 -0
- package/src/Cancellation.ts +172 -0
- package/src/Channels.ts +493 -0
- package/src/Control.ts +337 -0
- package/src/ControlClient.ts +319 -0
- package/src/ControlError.ts +378 -0
- package/src/ControlExecutor.ts +490 -0
- package/src/ControlFacts.ts +383 -0
- package/src/ControlLive.ts +2113 -0
- package/src/ControlRpcs.ts +443 -0
- package/src/ControlRuntime.ts +1597 -0
- package/src/ControlSchema.ts +1380 -0
- package/src/ControlServer.ts +182 -0
- package/src/Credential.ts +310 -0
- package/src/CredentialCipher.ts +110 -0
- package/src/CredentialStore.ts +152 -0
- package/src/DispatchReader.ts +122 -0
- package/src/Health.ts +591 -0
- package/src/JevSessionChecker.ts +127 -0
- package/src/Lineage.ts +203 -0
- package/src/Migrations.ts +56 -0
- package/src/Monitor.ts +600 -0
- package/src/ScopedToken.ts +306 -0
- package/src/SqlControlRuntime.ts +2476 -0
- package/src/SqlCredentialStore.ts +148 -0
- package/src/Steering.ts +96 -0
- package/src/SystemFlows.ts +225 -0
- package/src/WebCryptoCipher.ts +169 -0
- package/src/WebhookChannel.ts +166 -0
- package/src/index.ts +188 -0
- package/src/internal/MutationBoundary.ts +46 -0
- package/src/internal/activeFibers.ts +22 -0
- package/src/internal/issues.ts +40 -0
- package/src/internal/planning.ts +262 -0
- package/src/internal/sqlSchemaErrors.ts +37 -0
- package/src/migrations/0001_control_tables.ts +99 -0
- package/src/migrations/0002_run_keys.ts +23 -0
- package/src/migrations/0003_signal_commands.ts +27 -0
- package/src/migrations/0004_approval_decisions.ts +25 -0
- package/src/migrations/0005_signal_principals.ts +27 -0
- package/src/migrations/0006_run_principals.ts +31 -0
- package/src/migrations/0007_resume_consent.ts +28 -0
- package/src/test/TestControl.ts +47 -0
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Versioned control lifecycle facts and their shared read projection.
|
|
3
|
+
* @since 1.0.0
|
|
4
|
+
*/
|
|
5
|
+
import { Journal } from "@smthrs/journal";
|
|
6
|
+
import { Effect, Schema } from "effect";
|
|
7
|
+
import type * as ControlRuntime from "./ControlRuntime.ts";
|
|
8
|
+
import * as ControlSchema from "./ControlSchema.ts";
|
|
9
|
+
/** This is the control producer contract, independent of the harness journal format.
|
|
10
|
+
* @category facts
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
export declare const version = 1;
|
|
14
|
+
/** A committed control snapshot. A baseline claims no history before its sequence.
|
|
15
|
+
* @category facts
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
*/
|
|
18
|
+
export declare const RunFact: Schema.Struct<{
|
|
19
|
+
readonly factVersion: Schema.Literal<1>;
|
|
20
|
+
readonly baseline: Schema.Literals<readonly ["created", "legacy"]>;
|
|
21
|
+
readonly run: Schema.Struct<{
|
|
22
|
+
readonly executionObservation: Schema.optional<Schema.Literals<readonly ["observed", "missing"]>>;
|
|
23
|
+
readonly executionView: Schema.optional<Schema.Struct<{
|
|
24
|
+
readonly root: Schema.Struct<{
|
|
25
|
+
readonly executionId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
|
|
26
|
+
readonly flowName: Schema.NonEmptyString;
|
|
27
|
+
readonly status: Schema.Literals<readonly ["pending", "running", "suspended", "completed", "failed", "cancelled"]>;
|
|
28
|
+
readonly createdAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
|
|
29
|
+
readonly startedAtMs: Schema.NullOr<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
|
|
30
|
+
readonly finishedAtMs: Schema.NullOr<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
|
|
31
|
+
readonly parentRunId: Schema.NullOr<Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">>;
|
|
32
|
+
readonly lineageId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
|
|
33
|
+
readonly roundOrdinal: Schema.Int;
|
|
34
|
+
readonly cancelRequestedAtMs: Schema.NullOr<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
|
|
35
|
+
readonly treeVersion: Schema.optional<Schema.Literal<1>>;
|
|
36
|
+
readonly parentPolicy: Schema.optional<Schema.Literals<readonly ["cancel", "detach"]>>;
|
|
37
|
+
readonly waiting: Schema.NullOr<Schema.Struct<{
|
|
38
|
+
readonly reason: Schema.NonEmptyString;
|
|
39
|
+
readonly wakeAtMs: Schema.NullOr<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
|
|
40
|
+
readonly tokenDigest: Schema.NullOr<Schema.NonEmptyString>;
|
|
41
|
+
readonly point: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
42
|
+
readonly request: Schema.optional<Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
43
|
+
}>>;
|
|
44
|
+
}>;
|
|
45
|
+
readonly current: Schema.Struct<{
|
|
46
|
+
readonly executionId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
|
|
47
|
+
readonly flowName: Schema.NonEmptyString;
|
|
48
|
+
readonly status: Schema.Literals<readonly ["pending", "running", "suspended", "completed", "failed", "cancelled"]>;
|
|
49
|
+
readonly createdAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
|
|
50
|
+
readonly startedAtMs: Schema.NullOr<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
|
|
51
|
+
readonly finishedAtMs: Schema.NullOr<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
|
|
52
|
+
readonly parentRunId: Schema.NullOr<Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">>;
|
|
53
|
+
readonly lineageId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
|
|
54
|
+
readonly roundOrdinal: Schema.Int;
|
|
55
|
+
readonly cancelRequestedAtMs: Schema.NullOr<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
|
|
56
|
+
readonly treeVersion: Schema.optional<Schema.Literal<1>>;
|
|
57
|
+
readonly parentPolicy: Schema.optional<Schema.Literals<readonly ["cancel", "detach"]>>;
|
|
58
|
+
readonly waiting: Schema.NullOr<Schema.Struct<{
|
|
59
|
+
readonly reason: Schema.NonEmptyString;
|
|
60
|
+
readonly wakeAtMs: Schema.NullOr<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
|
|
61
|
+
readonly tokenDigest: Schema.NullOr<Schema.NonEmptyString>;
|
|
62
|
+
readonly point: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
63
|
+
readonly request: Schema.optional<Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
64
|
+
}>>;
|
|
65
|
+
}>;
|
|
66
|
+
readonly humanWaits: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
67
|
+
readonly executionId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
|
|
68
|
+
readonly flowName: Schema.NonEmptyString;
|
|
69
|
+
readonly status: Schema.Literals<readonly ["pending", "running", "suspended", "completed", "failed", "cancelled"]>;
|
|
70
|
+
readonly createdAtMs: Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">;
|
|
71
|
+
readonly startedAtMs: Schema.NullOr<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
|
|
72
|
+
readonly finishedAtMs: Schema.NullOr<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
|
|
73
|
+
readonly parentRunId: Schema.NullOr<Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">>;
|
|
74
|
+
readonly lineageId: Schema.brand<Schema.String, "@smthrs/journal/JournalEvent/RunId">;
|
|
75
|
+
readonly roundOrdinal: Schema.Int;
|
|
76
|
+
readonly cancelRequestedAtMs: Schema.NullOr<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
|
|
77
|
+
readonly treeVersion: Schema.optional<Schema.Literal<1>>;
|
|
78
|
+
readonly parentPolicy: Schema.optional<Schema.Literals<readonly ["cancel", "detach"]>>;
|
|
79
|
+
readonly waiting: Schema.NullOr<Schema.Struct<{
|
|
80
|
+
readonly reason: Schema.NonEmptyString;
|
|
81
|
+
readonly wakeAtMs: Schema.NullOr<Schema.brand<Schema.Int, "@smthrs/journal/TimestampMs">>;
|
|
82
|
+
readonly tokenDigest: Schema.NullOr<Schema.NonEmptyString>;
|
|
83
|
+
readonly point: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
84
|
+
readonly request: Schema.optional<Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
85
|
+
}>>;
|
|
86
|
+
}>>>;
|
|
87
|
+
}>>;
|
|
88
|
+
readonly runId: Schema.String;
|
|
89
|
+
readonly flowId: Schema.String;
|
|
90
|
+
readonly status: Schema.Literals<readonly ["accepted", "running", "parked", "waiting-approval", "cancelled", "completed", "failed"]>;
|
|
91
|
+
readonly planId: Schema.optional<Schema.String>;
|
|
92
|
+
readonly planDigest: Schema.optional<Schema.String>;
|
|
93
|
+
readonly executionDigest: Schema.optional<Schema.String>;
|
|
94
|
+
readonly engineVersion: Schema.optional<Schema.String>;
|
|
95
|
+
readonly codeDrift: Schema.optional<Schema.Struct<{
|
|
96
|
+
readonly recorded: Schema.optional<Schema.String>;
|
|
97
|
+
readonly current: Schema.optional<Schema.String>;
|
|
98
|
+
readonly recordedEngine: Schema.optional<Schema.String>;
|
|
99
|
+
readonly currentEngine: Schema.optional<Schema.String>;
|
|
100
|
+
}>>;
|
|
101
|
+
readonly ownerId: Schema.optional<Schema.String>;
|
|
102
|
+
readonly launchedBy: Schema.optional<Schema.Struct<{
|
|
103
|
+
readonly id: Schema.String;
|
|
104
|
+
readonly kind: Schema.String;
|
|
105
|
+
}>>;
|
|
106
|
+
readonly parentRunId: Schema.optional<Schema.String>;
|
|
107
|
+
readonly lineageId: Schema.optional<Schema.String>;
|
|
108
|
+
readonly roundOrdinal: Schema.optional<Schema.Number>;
|
|
109
|
+
readonly origin: Schema.optional<Schema.Literals<readonly ["child", "fork", "continuation"]>>;
|
|
110
|
+
readonly waitingReason: Schema.optional<Schema.String>;
|
|
111
|
+
readonly steering: Schema.optional<Schema.Struct<{
|
|
112
|
+
readonly pending: Schema.Number;
|
|
113
|
+
}>>;
|
|
114
|
+
readonly pendingResume: Schema.optional<Schema.Number>;
|
|
115
|
+
readonly parkedBy: Schema.optional<Schema.String>;
|
|
116
|
+
readonly cancellation: Schema.optional<Schema.Struct<{
|
|
117
|
+
readonly requestedAt: Schema.Number;
|
|
118
|
+
readonly source: Schema.Literals<readonly ["control", "engine", "cascade"]>;
|
|
119
|
+
readonly principal: Schema.optional<Schema.Struct<{
|
|
120
|
+
readonly id: Schema.String;
|
|
121
|
+
readonly kind: Schema.String;
|
|
122
|
+
readonly stampedAt: Schema.Number;
|
|
123
|
+
}>>;
|
|
124
|
+
readonly reason: Schema.optional<Schema.String>;
|
|
125
|
+
readonly cascadedFrom: Schema.optional<Schema.String>;
|
|
126
|
+
}>>;
|
|
127
|
+
readonly pendingWaits: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
128
|
+
readonly runId: Schema.String;
|
|
129
|
+
readonly flowId: Schema.optional<Schema.String>;
|
|
130
|
+
readonly reason: Schema.String;
|
|
131
|
+
readonly token: Schema.String;
|
|
132
|
+
readonly tokenDigest: Schema.optional<Schema.String>;
|
|
133
|
+
readonly name: Schema.optional<Schema.String>;
|
|
134
|
+
readonly attempt: Schema.optional<Schema.Number>;
|
|
135
|
+
readonly request: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
136
|
+
readonly createdAt: Schema.Number;
|
|
137
|
+
}>>>;
|
|
138
|
+
readonly deadlineAt: Schema.optional<Schema.Number>;
|
|
139
|
+
readonly createdAt: Schema.Number;
|
|
140
|
+
readonly updatedAt: Schema.Number;
|
|
141
|
+
}>;
|
|
142
|
+
}>;
|
|
143
|
+
/** Capture the exact result of a fenced write, inside its journal transaction.
|
|
144
|
+
* @category facts
|
|
145
|
+
* @since 1.0.0
|
|
146
|
+
*/
|
|
147
|
+
export declare const runFact: (run: ControlSchema.RunSummary, baseline?: "created" | "legacy") => typeof RunFact.Type;
|
|
148
|
+
/** The exact facts of the guard that parked a run, frozen when it tripped.
|
|
149
|
+
*
|
|
150
|
+
* `Runaway` is a run spending past an approved ceiling (`tokens`, `usd`,
|
|
151
|
+
* `latency`). `Stuck` is one operation that ran past its time limit
|
|
152
|
+
* (`model-call`, `tool-call`, `cell`). Every number is in the source's unit,
|
|
153
|
+
* tokens, dollars, or milliseconds: `used`, `reserved`, `max`, and `next` are
|
|
154
|
+
* a budget's spend, held forecast, ceiling, and refused call; `max` is a
|
|
155
|
+
* timeout's limit.
|
|
156
|
+
* `allowance` is what Continue authorizes: the raised ceiling for a budget,
|
|
157
|
+
* one more run of `max` for a timeout. `subject` names the operation a
|
|
158
|
+
* timeout interrupted.
|
|
159
|
+
* @category facts
|
|
160
|
+
* @since 1.0.0
|
|
161
|
+
*/
|
|
162
|
+
export declare const GuardIncident: Schema.Struct<{
|
|
163
|
+
readonly classification: Schema.Literals<readonly ["Runaway", "Stuck"]>;
|
|
164
|
+
readonly source: Schema.Literals<readonly ["tokens", "usd", "latency", "model-call", "tool-call", "cell"]>;
|
|
165
|
+
readonly message: Schema.String;
|
|
166
|
+
readonly used: Schema.optional<Schema.Number>;
|
|
167
|
+
readonly reserved: Schema.optional<Schema.Number>;
|
|
168
|
+
readonly max: Schema.optional<Schema.Number>;
|
|
169
|
+
readonly next: Schema.optional<Schema.Number>;
|
|
170
|
+
readonly allowance: Schema.optional<Schema.Number>;
|
|
171
|
+
readonly subject: Schema.optional<Schema.String>;
|
|
172
|
+
}>;
|
|
173
|
+
/** The identity-bearing request admitted with its approval token.
|
|
174
|
+
*
|
|
175
|
+
* `incident` is present on a request a guard made, so a restarted host reads
|
|
176
|
+
* the facts the park was made on rather than measuring them again.
|
|
177
|
+
* @category facts
|
|
178
|
+
* @since 1.0.0
|
|
179
|
+
*/
|
|
180
|
+
export declare const ApprovalRequestFact: Schema.Struct<{
|
|
181
|
+
readonly factVersion: Schema.Literal<1>;
|
|
182
|
+
readonly runId: Schema.String;
|
|
183
|
+
readonly requestId: Schema.String;
|
|
184
|
+
readonly question: Schema.String;
|
|
185
|
+
readonly payload: Schema.Struct<{
|
|
186
|
+
readonly target: Schema.Union<readonly [Schema.TaggedStruct<"Plan", {
|
|
187
|
+
readonly planId: Schema.String;
|
|
188
|
+
readonly digest: Schema.String;
|
|
189
|
+
readonly envelope: Schema.Struct<{
|
|
190
|
+
readonly capabilities: Schema.$Array<Schema.String>;
|
|
191
|
+
readonly hostImports: Schema.optional<Schema.$Array<Schema.String>>;
|
|
192
|
+
readonly flows: Schema.$Array<Schema.String>;
|
|
193
|
+
readonly budget: Schema.Struct<{
|
|
194
|
+
readonly tokens: Schema.optional<Schema.Number>;
|
|
195
|
+
readonly milliseconds: Schema.optional<Schema.Number>;
|
|
196
|
+
readonly usd: Schema.optional<Schema.Number>;
|
|
197
|
+
readonly onExceeded: Schema.optional<Schema.Literals<readonly ["fail", "warn", "skip-remaining", "park"]>>;
|
|
198
|
+
readonly deadline: Schema.optional<Schema.Int>;
|
|
199
|
+
}>;
|
|
200
|
+
readonly host: Schema.optional<Schema.String>;
|
|
201
|
+
}>;
|
|
202
|
+
}>, Schema.TaggedStruct<"Node", {
|
|
203
|
+
readonly runId: Schema.String;
|
|
204
|
+
readonly requestId: Schema.String;
|
|
205
|
+
readonly digest: Schema.String;
|
|
206
|
+
readonly envelope: Schema.Struct<{
|
|
207
|
+
readonly capabilities: Schema.$Array<Schema.String>;
|
|
208
|
+
readonly hostImports: Schema.optional<Schema.$Array<Schema.String>>;
|
|
209
|
+
readonly flows: Schema.$Array<Schema.String>;
|
|
210
|
+
readonly budget: Schema.Struct<{
|
|
211
|
+
readonly tokens: Schema.optional<Schema.Number>;
|
|
212
|
+
readonly milliseconds: Schema.optional<Schema.Number>;
|
|
213
|
+
readonly usd: Schema.optional<Schema.Number>;
|
|
214
|
+
readonly onExceeded: Schema.optional<Schema.Literals<readonly ["fail", "warn", "skip-remaining", "park"]>>;
|
|
215
|
+
readonly deadline: Schema.optional<Schema.Int>;
|
|
216
|
+
}>;
|
|
217
|
+
readonly host: Schema.optional<Schema.String>;
|
|
218
|
+
}>;
|
|
219
|
+
}>]>;
|
|
220
|
+
readonly scope: Schema.Literals<readonly ["once", "run", "remembered"]>;
|
|
221
|
+
readonly idempotencyKey: Schema.String;
|
|
222
|
+
}>;
|
|
223
|
+
readonly incident: Schema.optional<Schema.Struct<{
|
|
224
|
+
readonly classification: Schema.Literals<readonly ["Runaway", "Stuck"]>;
|
|
225
|
+
readonly source: Schema.Literals<readonly ["tokens", "usd", "latency", "model-call", "tool-call", "cell"]>;
|
|
226
|
+
readonly message: Schema.String;
|
|
227
|
+
readonly used: Schema.optional<Schema.Number>;
|
|
228
|
+
readonly reserved: Schema.optional<Schema.Number>;
|
|
229
|
+
readonly max: Schema.optional<Schema.Number>;
|
|
230
|
+
readonly next: Schema.optional<Schema.Number>;
|
|
231
|
+
readonly allowance: Schema.optional<Schema.Number>;
|
|
232
|
+
readonly subject: Schema.optional<Schema.String>;
|
|
233
|
+
}>>;
|
|
234
|
+
}>;
|
|
235
|
+
/** The exact target a committed decision resolves; old target-tag fields remain readable.
|
|
236
|
+
* @category facts
|
|
237
|
+
* @since 1.0.0
|
|
238
|
+
*/
|
|
239
|
+
export declare const ApprovalDecisionFact: Schema.Struct<{
|
|
240
|
+
readonly factVersion: Schema.Literal<1>;
|
|
241
|
+
readonly tokenId: Schema.String;
|
|
242
|
+
readonly approvalTarget: Schema.Union<readonly [Schema.TaggedStruct<"Plan", {
|
|
243
|
+
readonly planId: Schema.String;
|
|
244
|
+
readonly digest: Schema.String;
|
|
245
|
+
readonly envelope: Schema.Struct<{
|
|
246
|
+
readonly capabilities: Schema.$Array<Schema.String>;
|
|
247
|
+
readonly hostImports: Schema.optional<Schema.$Array<Schema.String>>;
|
|
248
|
+
readonly flows: Schema.$Array<Schema.String>;
|
|
249
|
+
readonly budget: Schema.Struct<{
|
|
250
|
+
readonly tokens: Schema.optional<Schema.Number>;
|
|
251
|
+
readonly milliseconds: Schema.optional<Schema.Number>;
|
|
252
|
+
readonly usd: Schema.optional<Schema.Number>;
|
|
253
|
+
readonly onExceeded: Schema.optional<Schema.Literals<readonly ["fail", "warn", "skip-remaining", "park"]>>;
|
|
254
|
+
readonly deadline: Schema.optional<Schema.Int>;
|
|
255
|
+
}>;
|
|
256
|
+
readonly host: Schema.optional<Schema.String>;
|
|
257
|
+
}>;
|
|
258
|
+
}>, Schema.TaggedStruct<"Node", {
|
|
259
|
+
readonly runId: Schema.String;
|
|
260
|
+
readonly requestId: Schema.String;
|
|
261
|
+
readonly digest: Schema.String;
|
|
262
|
+
readonly envelope: Schema.Struct<{
|
|
263
|
+
readonly capabilities: Schema.$Array<Schema.String>;
|
|
264
|
+
readonly hostImports: Schema.optional<Schema.$Array<Schema.String>>;
|
|
265
|
+
readonly flows: Schema.$Array<Schema.String>;
|
|
266
|
+
readonly budget: Schema.Struct<{
|
|
267
|
+
readonly tokens: Schema.optional<Schema.Number>;
|
|
268
|
+
readonly milliseconds: Schema.optional<Schema.Number>;
|
|
269
|
+
readonly usd: Schema.optional<Schema.Number>;
|
|
270
|
+
readonly onExceeded: Schema.optional<Schema.Literals<readonly ["fail", "warn", "skip-remaining", "park"]>>;
|
|
271
|
+
readonly deadline: Schema.optional<Schema.Int>;
|
|
272
|
+
}>;
|
|
273
|
+
readonly host: Schema.optional<Schema.String>;
|
|
274
|
+
}>;
|
|
275
|
+
}>]>;
|
|
276
|
+
}>;
|
|
277
|
+
/** Capture and validate the target the decision writer has actually resolved.
|
|
278
|
+
* @category facts
|
|
279
|
+
* @since 1.0.0
|
|
280
|
+
*/
|
|
281
|
+
export declare const approvalDecisionFact: (tokenId: string, approvalTarget: ControlSchema.ApprovalTarget) => typeof ApprovalDecisionFact.Type;
|
|
282
|
+
/** Commit a fenced control write and the exact resulting lifecycle fact together.
|
|
283
|
+
* @category facts
|
|
284
|
+
* @since 1.0.0
|
|
285
|
+
*/
|
|
286
|
+
export declare const commitRun: <E, R>(journal: Journal.Service, change: Effect.Effect<ControlSchema.RunSummary, E, R>, sourceId: string, eventType: string, detail?: Readonly<Record<string, unknown>>, baseline?: "created" | "legacy") => Effect.Effect<{
|
|
287
|
+
readonly status: "running" | "completed" | "failed" | "cancelled" | "accepted" | "parked" | "waiting-approval";
|
|
288
|
+
readonly runId: string;
|
|
289
|
+
readonly flowId: string;
|
|
290
|
+
readonly createdAt: number;
|
|
291
|
+
readonly updatedAt: number;
|
|
292
|
+
readonly origin?: "continuation" | "child" | "fork" | undefined;
|
|
293
|
+
readonly planId?: string | undefined;
|
|
294
|
+
readonly lineageId?: string | undefined;
|
|
295
|
+
readonly roundOrdinal?: number | undefined;
|
|
296
|
+
readonly parentRunId?: string | undefined;
|
|
297
|
+
readonly executionDigest?: string | undefined;
|
|
298
|
+
readonly executionObservation?: "missing" | "observed" | undefined;
|
|
299
|
+
readonly executionView?: {
|
|
300
|
+
readonly current: {
|
|
301
|
+
readonly status: "pending" | "running" | "suspended" | "completed" | "failed" | "cancelled";
|
|
302
|
+
readonly executionId: string & import("effect/Brand").Brand<"@smthrs/journal/JournalEvent/RunId">;
|
|
303
|
+
readonly flowName: string;
|
|
304
|
+
readonly startedAtMs: (number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">) | null;
|
|
305
|
+
readonly lineageId: string & import("effect/Brand").Brand<"@smthrs/journal/JournalEvent/RunId">;
|
|
306
|
+
readonly waiting: {
|
|
307
|
+
readonly reason: string;
|
|
308
|
+
readonly wakeAtMs: (number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">) | null;
|
|
309
|
+
readonly tokenDigest: string | null;
|
|
310
|
+
readonly request?: Schema.Json | undefined;
|
|
311
|
+
readonly point?: string | null | undefined;
|
|
312
|
+
} | null;
|
|
313
|
+
readonly roundOrdinal: number;
|
|
314
|
+
readonly parentRunId: (string & import("effect/Brand").Brand<"@smthrs/journal/JournalEvent/RunId">) | null;
|
|
315
|
+
readonly finishedAtMs: (number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">) | null;
|
|
316
|
+
readonly cancelRequestedAtMs: (number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">) | null;
|
|
317
|
+
readonly createdAtMs: number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">;
|
|
318
|
+
readonly treeVersion?: 1 | undefined;
|
|
319
|
+
readonly parentPolicy?: "cancel" | "detach" | undefined;
|
|
320
|
+
};
|
|
321
|
+
readonly root: {
|
|
322
|
+
readonly status: "pending" | "running" | "suspended" | "completed" | "failed" | "cancelled";
|
|
323
|
+
readonly executionId: string & import("effect/Brand").Brand<"@smthrs/journal/JournalEvent/RunId">;
|
|
324
|
+
readonly flowName: string;
|
|
325
|
+
readonly startedAtMs: (number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">) | null;
|
|
326
|
+
readonly lineageId: string & import("effect/Brand").Brand<"@smthrs/journal/JournalEvent/RunId">;
|
|
327
|
+
readonly waiting: {
|
|
328
|
+
readonly reason: string;
|
|
329
|
+
readonly wakeAtMs: (number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">) | null;
|
|
330
|
+
readonly tokenDigest: string | null;
|
|
331
|
+
readonly request?: Schema.Json | undefined;
|
|
332
|
+
readonly point?: string | null | undefined;
|
|
333
|
+
} | null;
|
|
334
|
+
readonly roundOrdinal: number;
|
|
335
|
+
readonly parentRunId: (string & import("effect/Brand").Brand<"@smthrs/journal/JournalEvent/RunId">) | null;
|
|
336
|
+
readonly finishedAtMs: (number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">) | null;
|
|
337
|
+
readonly cancelRequestedAtMs: (number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">) | null;
|
|
338
|
+
readonly createdAtMs: number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">;
|
|
339
|
+
readonly treeVersion?: 1 | undefined;
|
|
340
|
+
readonly parentPolicy?: "cancel" | "detach" | undefined;
|
|
341
|
+
};
|
|
342
|
+
readonly humanWaits?: readonly {
|
|
343
|
+
readonly status: "pending" | "running" | "suspended" | "completed" | "failed" | "cancelled";
|
|
344
|
+
readonly executionId: string & import("effect/Brand").Brand<"@smthrs/journal/JournalEvent/RunId">;
|
|
345
|
+
readonly flowName: string;
|
|
346
|
+
readonly startedAtMs: (number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">) | null;
|
|
347
|
+
readonly lineageId: string & import("effect/Brand").Brand<"@smthrs/journal/JournalEvent/RunId">;
|
|
348
|
+
readonly waiting: {
|
|
349
|
+
readonly reason: string;
|
|
350
|
+
readonly wakeAtMs: (number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">) | null;
|
|
351
|
+
readonly tokenDigest: string | null;
|
|
352
|
+
readonly request?: Schema.Json | undefined;
|
|
353
|
+
readonly point?: string | null | undefined;
|
|
354
|
+
} | null;
|
|
355
|
+
readonly roundOrdinal: number;
|
|
356
|
+
readonly parentRunId: (string & import("effect/Brand").Brand<"@smthrs/journal/JournalEvent/RunId">) | null;
|
|
357
|
+
readonly finishedAtMs: (number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">) | null;
|
|
358
|
+
readonly cancelRequestedAtMs: (number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">) | null;
|
|
359
|
+
readonly createdAtMs: number & import("effect/Brand").Brand<"@smthrs/journal/TimestampMs">;
|
|
360
|
+
readonly treeVersion?: 1 | undefined;
|
|
361
|
+
readonly parentPolicy?: "cancel" | "detach" | undefined;
|
|
362
|
+
}[] | undefined;
|
|
363
|
+
} | undefined;
|
|
364
|
+
readonly planDigest?: string | undefined;
|
|
365
|
+
readonly engineVersion?: string | undefined;
|
|
366
|
+
readonly codeDrift?: {
|
|
367
|
+
readonly current?: string | undefined;
|
|
368
|
+
readonly recorded?: string | undefined;
|
|
369
|
+
readonly recordedEngine?: string | undefined;
|
|
370
|
+
readonly currentEngine?: string | undefined;
|
|
371
|
+
} | undefined;
|
|
372
|
+
readonly ownerId?: string | undefined;
|
|
373
|
+
readonly launchedBy?: {
|
|
374
|
+
readonly id: string;
|
|
375
|
+
readonly kind: string;
|
|
376
|
+
} | undefined;
|
|
377
|
+
readonly waitingReason?: string | undefined;
|
|
378
|
+
readonly steering?: {
|
|
379
|
+
readonly pending: number;
|
|
380
|
+
} | undefined;
|
|
381
|
+
readonly pendingResume?: number | undefined;
|
|
382
|
+
readonly parkedBy?: string | undefined;
|
|
383
|
+
readonly cancellation?: {
|
|
384
|
+
readonly source: "control" | "engine" | "cascade";
|
|
385
|
+
readonly requestedAt: number;
|
|
386
|
+
readonly reason?: string | undefined;
|
|
387
|
+
readonly principal?: {
|
|
388
|
+
readonly id: string;
|
|
389
|
+
readonly kind: string;
|
|
390
|
+
readonly stampedAt: number;
|
|
391
|
+
} | undefined;
|
|
392
|
+
readonly cascadedFrom?: string | undefined;
|
|
393
|
+
} | undefined;
|
|
394
|
+
readonly pendingWaits?: readonly {
|
|
395
|
+
readonly reason: string;
|
|
396
|
+
readonly token: string;
|
|
397
|
+
readonly runId: string;
|
|
398
|
+
readonly createdAt: number;
|
|
399
|
+
readonly name?: string | undefined;
|
|
400
|
+
readonly attempt?: number | undefined;
|
|
401
|
+
readonly request?: Schema.Json | undefined;
|
|
402
|
+
readonly tokenDigest?: string | undefined;
|
|
403
|
+
readonly flowId?: string | undefined;
|
|
404
|
+
}[] | undefined;
|
|
405
|
+
readonly deadlineAt?: number | undefined;
|
|
406
|
+
}, Journal.JournalError | E, R>;
|
|
407
|
+
/** The token and submit-ready request have one durable admission boundary.
|
|
408
|
+
* @category facts
|
|
409
|
+
* @since 1.0.0
|
|
410
|
+
*/
|
|
411
|
+
export declare const commitApprovalRequest: (journal: Journal.Service, runtime: Pick<ControlRuntime.Service, "registerApproval">, input: Omit<typeof ApprovalRequestFact.Type, "factVersion">, sourceId: string) => Effect.Effect<ControlRuntime.ApprovalToken, Journal.JournalError | import("./ControlError.ts").RunNotFound | import("./ControlError.ts").PlanDigestMismatch | import("./ControlError.ts").EnvelopeMismatch | import("./ControlError.ts").PersistenceError, never>;
|
|
412
|
+
/** Honest coverage of the displayed lifecycle; engine rows are a separate authority.
|
|
413
|
+
* @category facts
|
|
414
|
+
* @since 1.0.0
|
|
415
|
+
*/
|
|
416
|
+
export declare const LifecycleProvenance: Schema.Struct<{
|
|
417
|
+
readonly control: Schema.Literals<readonly ["events", "legacy-snapshot", "unverified-snapshot"]>;
|
|
418
|
+
readonly execution: Schema.Literals<readonly ["control", "engine-observed", "engine-missing"]>;
|
|
419
|
+
readonly baseline: Schema.optional<Schema.Literals<readonly ["created", "legacy"]>>;
|
|
420
|
+
readonly fromSequence: Schema.optional<Schema.Number>;
|
|
421
|
+
readonly throughSequence: Schema.optional<Schema.Number>;
|
|
422
|
+
}>;
|
|
423
|
+
/** Submit-ready approval state derived solely from admitted facts.
|
|
424
|
+
* @category facts
|
|
425
|
+
* @since 1.0.0
|
|
426
|
+
*/
|
|
427
|
+
export interface Approval {
|
|
428
|
+
readonly runId: string;
|
|
429
|
+
readonly waitRunId?: string | undefined;
|
|
430
|
+
readonly questionProvenance?: "events" | "legacy-observation" | "unverified-observation" | undefined;
|
|
431
|
+
readonly requestId: string;
|
|
432
|
+
readonly title: string;
|
|
433
|
+
readonly request: ControlSchema.ControlEvent["payload"];
|
|
434
|
+
readonly payload: ControlSchema.ApprovalPayload;
|
|
435
|
+
readonly requestedAt: number;
|
|
436
|
+
readonly status: "pending" | "approved" | "denied";
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* One fold for gateway snapshots and subscriptions. Current writers are strict;
|
|
440
|
+
* legacy unnamed decisions may close only a legacy request in the same run.
|
|
441
|
+
* Observed human waits may seed the approval projection without claiming a
|
|
442
|
+
* journaled request. They still require an exact named decision, and share the
|
|
443
|
+
* same digest binding as admitted requests.
|
|
444
|
+
* Duplicate requests never reopen decisions, and a new-style unknown identity
|
|
445
|
+
* never consumes another gate. Snapshot fallback is explicitly unverified.
|
|
446
|
+
* @category facts
|
|
447
|
+
* @since 1.0.0
|
|
448
|
+
*/
|
|
449
|
+
export declare const fold: (events: ReadonlyArray<ControlSchema.ControlEvent>, snapshot?: ControlSchema.RunSummary, observedApprovals?: ReadonlyArray<Approval>) => {
|
|
450
|
+
readonly run: ControlSchema.RunSummary | undefined;
|
|
451
|
+
readonly provenance: typeof LifecycleProvenance.Type;
|
|
452
|
+
readonly approvals: ReadonlyArray<Approval>;
|
|
453
|
+
};
|
|
454
|
+
//# sourceMappingURL=ControlFacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ControlFacts.d.ts","sourceRoot":"","sources":["../../src/ControlFacts.ts"],"names":[],"mappings":"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"}
|