@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,1030 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serializable control-plane values shared by local and RPC projections.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
*/
|
|
6
|
+
import { EngineEvent, ExecutionFact } from "@smthrs/journal";
|
|
7
|
+
import { Attribution } from "@smthrs/notifications/Notification";
|
|
8
|
+
import * as SteerPayload from "@smthrs/notifications/SteerPayload";
|
|
9
|
+
import * as PersistedPlan from "@smthrs/plan/Plan";
|
|
10
|
+
import { BudgetOnExceeded, DiscoveryWarning } from "@smthrs/registry/Descriptor";
|
|
11
|
+
import { Schema } from "effect";
|
|
12
|
+
import { Origin } from "./Lineage.js";
|
|
13
|
+
/**
|
|
14
|
+
* A durable control-plane run identifier.
|
|
15
|
+
*
|
|
16
|
+
* @since 0.1.0
|
|
17
|
+
* @category models
|
|
18
|
+
*/
|
|
19
|
+
export const RunId = Schema.String;
|
|
20
|
+
/**
|
|
21
|
+
* A registry flow identifier.
|
|
22
|
+
*
|
|
23
|
+
* @since 0.1.0
|
|
24
|
+
* @category models
|
|
25
|
+
*/
|
|
26
|
+
export const FlowId = Schema.String;
|
|
27
|
+
/**
|
|
28
|
+
* A caller-supplied key that makes a control mutation idempotent.
|
|
29
|
+
*
|
|
30
|
+
* @since 0.1.0
|
|
31
|
+
* @category models
|
|
32
|
+
*/
|
|
33
|
+
export const IdempotencyKey = Schema.String;
|
|
34
|
+
/**
|
|
35
|
+
* A server-authenticated identity stamped at the control boundary.
|
|
36
|
+
*
|
|
37
|
+
* @since 0.1.0
|
|
38
|
+
* @category models
|
|
39
|
+
*/
|
|
40
|
+
export const Principal = Schema.Struct({
|
|
41
|
+
id: Schema.String,
|
|
42
|
+
kind: Schema.String,
|
|
43
|
+
stampedAt: Schema.Number
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* The capabilities, flows, budget, and placement approved for a plan.
|
|
47
|
+
*
|
|
48
|
+
* `budget` holds the run's approved ceilings: `tokens`, `milliseconds` of
|
|
49
|
+
* active time, and `usd` in dollars, and its `deadline`: milliseconds of
|
|
50
|
+
* wall-clock time counted from the run's first start, shared by every round
|
|
51
|
+
* of the run. An absent ceiling or deadline is none.
|
|
52
|
+
*
|
|
53
|
+
* @since 0.1.0
|
|
54
|
+
* @category models
|
|
55
|
+
*/
|
|
56
|
+
export const Envelope = Schema.Struct({
|
|
57
|
+
capabilities: Schema.Array(Schema.String),
|
|
58
|
+
/** Unrestricted builtin/addon/package imports, outside the guarded capability ceiling. */
|
|
59
|
+
hostImports: Schema.optional(Schema.Array(Schema.String)),
|
|
60
|
+
flows: Schema.Array(Schema.String),
|
|
61
|
+
budget: Schema.Struct({
|
|
62
|
+
tokens: Schema.optional(Schema.Number),
|
|
63
|
+
milliseconds: Schema.optional(Schema.Number),
|
|
64
|
+
usd: Schema.optional(Schema.Number),
|
|
65
|
+
onExceeded: Schema.optional(BudgetOnExceeded),
|
|
66
|
+
deadline: Schema.optional(Schema.Int.check(Schema.isGreaterThan(0)))
|
|
67
|
+
}),
|
|
68
|
+
host: Schema.optional(Schema.String)
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* The durability selected for an approval grant.
|
|
72
|
+
*
|
|
73
|
+
* @since 0.1.0
|
|
74
|
+
* @category models
|
|
75
|
+
*/
|
|
76
|
+
export const GrantScope = Schema.Literals(["once", "run", "remembered"]);
|
|
77
|
+
/**
|
|
78
|
+
* A plan or in-run approval target. The digest and full envelope are submitted
|
|
79
|
+
* with the target so the server can verify exactly what the caller reviewed.
|
|
80
|
+
*
|
|
81
|
+
* @since 0.1.0
|
|
82
|
+
* @category models
|
|
83
|
+
*/
|
|
84
|
+
export const ApprovalTarget = Schema.Union([
|
|
85
|
+
Schema.TaggedStruct("Plan", {
|
|
86
|
+
planId: Schema.String,
|
|
87
|
+
digest: Schema.String,
|
|
88
|
+
envelope: Envelope
|
|
89
|
+
}),
|
|
90
|
+
Schema.TaggedStruct("Node", {
|
|
91
|
+
runId: RunId,
|
|
92
|
+
requestId: Schema.String,
|
|
93
|
+
digest: Schema.String,
|
|
94
|
+
envelope: Envelope
|
|
95
|
+
})
|
|
96
|
+
]);
|
|
97
|
+
/**
|
|
98
|
+
* The complete, reviewable payload emitted by planning and submitted unchanged
|
|
99
|
+
* when an approval decision is made.
|
|
100
|
+
*
|
|
101
|
+
* @since 0.1.0
|
|
102
|
+
* @category models
|
|
103
|
+
*/
|
|
104
|
+
export const ApprovalPayload = Schema.Struct({
|
|
105
|
+
target: ApprovalTarget,
|
|
106
|
+
scope: GrantScope,
|
|
107
|
+
idempotencyKey: IdempotencyKey
|
|
108
|
+
});
|
|
109
|
+
/**
|
|
110
|
+
* What `smithers plan` reports for one node before anything runs.
|
|
111
|
+
*
|
|
112
|
+
* The two outcomes fall out of step keys for free — a key either hits the
|
|
113
|
+
* step cache or it does not — which is why they are reported here rather than
|
|
114
|
+
* discovered during execution. The third outcome, `release`, belongs to
|
|
115
|
+
* orphan reconciliation and is deliberately not part of a plan card.
|
|
116
|
+
*
|
|
117
|
+
* @since 0.1.0
|
|
118
|
+
* @category models
|
|
119
|
+
*/
|
|
120
|
+
export const PlanNodeStatus = Schema.Literals(["cached", "run"]);
|
|
121
|
+
/**
|
|
122
|
+
* One keyed node of the plan an approval is being taken on.
|
|
123
|
+
*
|
|
124
|
+
* `key` is an `@smthrs/keys` `Key` produced by `@smthrs/plan`'s step-key
|
|
125
|
+
* compiler, so a node named here and a node recorded in the persisted plan are
|
|
126
|
+
* the same node. Ids are lookup addresses and are never hashed.
|
|
127
|
+
*
|
|
128
|
+
* @since 0.1.0
|
|
129
|
+
* @category models
|
|
130
|
+
*/
|
|
131
|
+
export const PlanNode = Schema.Struct({
|
|
132
|
+
...PersistedPlan.PlanNode.fields,
|
|
133
|
+
status: PlanNodeStatus
|
|
134
|
+
});
|
|
135
|
+
/**
|
|
136
|
+
* Why one node of a plan waits for another.
|
|
137
|
+
*
|
|
138
|
+
* These are the reasons the two shipped graph builders already record.
|
|
139
|
+
* `value` consumes an upstream result and `continuation` is the sequencing
|
|
140
|
+
* edge of a builder or a branch arm, from both. `failure` is `@smthrs/flow`'s
|
|
141
|
+
* recovery arm; `conflict` is the ordering edge `@smthrs/core`'s
|
|
142
|
+
* write-conflict pass adds, and `lane-merge` orders laned writers with their
|
|
143
|
+
* merge. A host reports the vocabulary of the builder it graphs with.
|
|
144
|
+
*
|
|
145
|
+
* @since 0.1.0
|
|
146
|
+
* @category models
|
|
147
|
+
*/
|
|
148
|
+
export const PlanEdgeReason = Schema.Literals(["value", "continuation", "failure", "conflict", "lane-merge"]);
|
|
149
|
+
/**
|
|
150
|
+
* One labelled edge of the graph a plan was built from.
|
|
151
|
+
*
|
|
152
|
+
* @since 0.1.0
|
|
153
|
+
* @category models
|
|
154
|
+
*/
|
|
155
|
+
export const PlanEdge = Schema.Struct({
|
|
156
|
+
from: Schema.NonEmptyString,
|
|
157
|
+
to: Schema.NonEmptyString,
|
|
158
|
+
reason: PlanEdgeReason
|
|
159
|
+
});
|
|
160
|
+
/**
|
|
161
|
+
* One node of the built graph, as the reader of a plan drills into it.
|
|
162
|
+
*
|
|
163
|
+
* It carries the address and the declaration site, and nothing else: the
|
|
164
|
+
* keyed node beside it (`PlanNode`) already says what the node is and what it
|
|
165
|
+
* would do, and this is the one fact about it the key material deliberately
|
|
166
|
+
* does not hold. `declaredAt` is the journal's own schema, so a plan card and
|
|
167
|
+
* a run's records state a declaration site the same way and under the same
|
|
168
|
+
* refusal of an absolute path; a host that cannot make a path relative to its
|
|
169
|
+
* own root omits it.
|
|
170
|
+
*
|
|
171
|
+
* @since 0.1.0
|
|
172
|
+
* @category models
|
|
173
|
+
*/
|
|
174
|
+
export const PlanGraphNode = Schema.Struct({
|
|
175
|
+
id: Schema.NonEmptyString,
|
|
176
|
+
declaredAt: Schema.optionalKey(EngineEvent.DeclaredAt)
|
|
177
|
+
});
|
|
178
|
+
/**
|
|
179
|
+
* The shape of the graph a plan was built from, for a reader that draws it.
|
|
180
|
+
*
|
|
181
|
+
* A `PlanNode` carries `dependsOn`, which is one unlabelled edge set: it
|
|
182
|
+
* cannot tell a value dependency from a `catch` arm or from an ordering edge
|
|
183
|
+
* a write conflict added. The graph builder knows which is which, so a host
|
|
184
|
+
* that graphs a flow reports the reasons here rather than making every reader
|
|
185
|
+
* guess them back.
|
|
186
|
+
*
|
|
187
|
+
* `nodes` is the same statement about provenance: the builder observed where
|
|
188
|
+
* each node was declared and the key material deliberately does not carry it,
|
|
189
|
+
* so it travels here, beside the edges and outside the digest. A host that
|
|
190
|
+
* reports none is a host whose reader cannot open the code, not a host whose
|
|
191
|
+
* plan is wrong.
|
|
192
|
+
*
|
|
193
|
+
* @since 0.1.0
|
|
194
|
+
* @category models
|
|
195
|
+
*/
|
|
196
|
+
export const PlanGraph = Schema.Struct({
|
|
197
|
+
edges: Schema.Array(PlanEdge),
|
|
198
|
+
nodes: Schema.optional(Schema.Array(PlanGraphNode)),
|
|
199
|
+
/**
|
|
200
|
+
* The revision of the workspace those declaration sites were read out of.
|
|
201
|
+
*
|
|
202
|
+
* A site is a path and a line, and neither says which bytes were there: a
|
|
203
|
+
* host's working tree moves, so the same path after an edit or a branch
|
|
204
|
+
* switch is a different file. This is the immutable name of the tree the
|
|
205
|
+
* host loaded the flow from — a jj working-copy commit id, or a git commit
|
|
206
|
+
* for a tree that still matches one — and a reader asks the content route
|
|
207
|
+
* for the file AT this revision rather than for whatever is on disk now.
|
|
208
|
+
*
|
|
209
|
+
* A host that cannot name one reports nothing, and a reader that has
|
|
210
|
+
* nothing shows no code at all rather than code it cannot bind (D-068).
|
|
211
|
+
*
|
|
212
|
+
* Exactly the forty lowercase hex digits the only producer emits
|
|
213
|
+
* (`SourceRevision.objectId`), because the app puts this value straight
|
|
214
|
+
* into a contents route's `?ref=` and a route that spawns jj or git from it
|
|
215
|
+
* should never see anything else.
|
|
216
|
+
*/
|
|
217
|
+
sourceRevision: Schema.optional(Schema.NonEmptyString.check(Schema.makeFilter((value) => /^[0-9a-f]{40}$/.test(value))))
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* The reviewable, signed payload returned by planning and resubmitted to
|
|
221
|
+
* approval without reconstructing authority client-side.
|
|
222
|
+
*
|
|
223
|
+
* `nodes` is the keyed node graph the plan phase produced. It is part of the
|
|
224
|
+
* card, and part of the digest an approval binds to, because "approve this
|
|
225
|
+
* flow with this input" and "approve this graph of keyed work" are different
|
|
226
|
+
* promises: a change that re-keys a node changes what will run, and an
|
|
227
|
+
* approval taken against the old graph must not authorize the new one. A host
|
|
228
|
+
* that has not built a graph reports an empty one and loses nothing.
|
|
229
|
+
*
|
|
230
|
+
* @since 0.1.0
|
|
231
|
+
* @category models
|
|
232
|
+
*/
|
|
233
|
+
export const PlanCard = Schema.Struct({
|
|
234
|
+
planId: Schema.String,
|
|
235
|
+
flowId: FlowId,
|
|
236
|
+
digest: Schema.String,
|
|
237
|
+
inputSummary: Schema.String,
|
|
238
|
+
/** Discovery diagnostics for the selected flow; outside the approval identity. */
|
|
239
|
+
warnings: Schema.optional(Schema.Array(DiscoveryWarning)),
|
|
240
|
+
envelope: Envelope,
|
|
241
|
+
deployClass: Schema.Boolean,
|
|
242
|
+
/** Executable source/metadata identity supplied by a discovery-based host. */
|
|
243
|
+
executionDigest: Schema.optional(Schema.String),
|
|
244
|
+
plan: Schema.optional(PersistedPlan.Plan),
|
|
245
|
+
nodes: Schema.Array(PlanNode),
|
|
246
|
+
/**
|
|
247
|
+
* The labelled edges of the graph this plan was built from, and where its
|
|
248
|
+
* nodes were declared.
|
|
249
|
+
*
|
|
250
|
+
* Deliberately OUTSIDE the digest an approval binds to: the edges and the
|
|
251
|
+
* declaration sites describe the plan a reader draws, and nothing here
|
|
252
|
+
* changes what will run. The
|
|
253
|
+
* persisted plan's own digest already covers keys, edges, effects,
|
|
254
|
+
* conflicts, priorities and generations, so a host that starts reporting
|
|
255
|
+
* this field re-plans to the digest it planned to before and every parked
|
|
256
|
+
* approval still validates.
|
|
257
|
+
*/
|
|
258
|
+
graph: Schema.optional(PlanGraph),
|
|
259
|
+
approval: ApprovalPayload
|
|
260
|
+
});
|
|
261
|
+
/**
|
|
262
|
+
* Stable statuses projected for a durable run.
|
|
263
|
+
*
|
|
264
|
+
* @since 0.1.0
|
|
265
|
+
* @category models
|
|
266
|
+
*/
|
|
267
|
+
export const RunStatus = Schema.Literals([
|
|
268
|
+
"accepted",
|
|
269
|
+
"running",
|
|
270
|
+
"parked",
|
|
271
|
+
"waiting-approval",
|
|
272
|
+
"cancelled",
|
|
273
|
+
"completed",
|
|
274
|
+
"failed"
|
|
275
|
+
]);
|
|
276
|
+
/**
|
|
277
|
+
* How a run came to exist, when it did not start on its own.
|
|
278
|
+
*
|
|
279
|
+
* Defined by `@smthrs/control/Lineage` and re-exported here so a serializable
|
|
280
|
+
* projection needs one import.
|
|
281
|
+
*
|
|
282
|
+
* @since 0.1.0
|
|
283
|
+
* @category models
|
|
284
|
+
*/
|
|
285
|
+
export const RunOrigin = Origin;
|
|
286
|
+
/**
|
|
287
|
+
* Where a cancellation came from.
|
|
288
|
+
*
|
|
289
|
+
* `control` is an operator asking through this plane, and it is the only
|
|
290
|
+
* source that can name a principal. `cascade` is a run swept up in an
|
|
291
|
+
* ancestor's cancellation. `engine` is everything the runtime decided on its
|
|
292
|
+
* own account: a lease expiry, a budget, a supervisor.
|
|
293
|
+
*
|
|
294
|
+
* @since 0.1.0
|
|
295
|
+
* @category models
|
|
296
|
+
*/
|
|
297
|
+
export const CancelSource = Schema.Literals(["control", "engine", "cascade"]);
|
|
298
|
+
/**
|
|
299
|
+
* Who cancelled a run, why, and on whose behalf.
|
|
300
|
+
*
|
|
301
|
+
* A durable cancellation is anonymous on its own: the run row records that
|
|
302
|
+
* somebody asked and when, and nothing else. This is the attribution the
|
|
303
|
+
* journal adds back. `principal` and `reason` are present exactly when a
|
|
304
|
+
* request named them, which a cascade inherits from the request that started
|
|
305
|
+
* it and an engine-decided cancellation never has.
|
|
306
|
+
*
|
|
307
|
+
* @since 0.1.0
|
|
308
|
+
* @category models
|
|
309
|
+
*/
|
|
310
|
+
export const Cancellation = Schema.Struct({
|
|
311
|
+
requestedAt: Schema.Number,
|
|
312
|
+
source: CancelSource,
|
|
313
|
+
principal: Schema.optional(Principal),
|
|
314
|
+
reason: Schema.optional(Schema.String),
|
|
315
|
+
/** The cancelled ancestor this run was swept up with, on a cascade. */
|
|
316
|
+
cascadedFrom: Schema.optional(RunId)
|
|
317
|
+
});
|
|
318
|
+
/**
|
|
319
|
+
* One open wait in a run tree that a person or named signal can end.
|
|
320
|
+
*
|
|
321
|
+
* A run that calls another flow parks the CHILD execution, not the run an
|
|
322
|
+
* operator named. `run-3` of `coding/request` sat at `waiting-reason: event`
|
|
323
|
+
* while the question a person owed an answer to — `coding-clarification` —
|
|
324
|
+
* was parked three executions below it on `coding/PreparePlan`. Every reader
|
|
325
|
+
* that asked the named run what it was waiting on was therefore told "an
|
|
326
|
+
* event", which is true of that one row and false of the run tree: nothing
|
|
327
|
+
* was going to arrive, because the run was waiting on a human.
|
|
328
|
+
*
|
|
329
|
+
* This is the wait as the ROOT of the tree reports it. `runId` is the
|
|
330
|
+
* execution actually holding it, which is what a decision has to be routed
|
|
331
|
+
* to; `token` is the durable wait address, submitted back unchanged;
|
|
332
|
+
* `request` is what the wait declared about itself, which for a `HumanTask`
|
|
333
|
+
* is `{kind, name, prompt, attempt, maxAttempts}`.
|
|
334
|
+
*
|
|
335
|
+
* @since 1.0.0
|
|
336
|
+
* @category models
|
|
337
|
+
*/
|
|
338
|
+
export const PendingWait = Schema.Struct({
|
|
339
|
+
/** The execution parked on this wait, which may be the root run itself. */
|
|
340
|
+
runId: RunId,
|
|
341
|
+
/** The flow that execution is running. */
|
|
342
|
+
flowId: Schema.optional(FlowId),
|
|
343
|
+
/** The supervisor vocabulary: `approval` for people or `event` for a named signal. */
|
|
344
|
+
reason: Schema.String,
|
|
345
|
+
/** The durable wait address a decision is routed to. */
|
|
346
|
+
token: Schema.String,
|
|
347
|
+
/** Digest used to join replayed display facts to this current operational address. */
|
|
348
|
+
tokenDigest: Schema.optional(Schema.String),
|
|
349
|
+
/** The wait point's own name, when the token addresses a named one. */
|
|
350
|
+
name: Schema.optional(Schema.String),
|
|
351
|
+
/** Which attempt of a re-asked question this is, counting from 1. */
|
|
352
|
+
attempt: Schema.optional(Schema.Number),
|
|
353
|
+
/** What the wait declared about itself, absent when it declared nothing. */
|
|
354
|
+
request: Schema.optional(Schema.Json),
|
|
355
|
+
/** When the execution holding this wait was created. */
|
|
356
|
+
createdAt: Schema.Number
|
|
357
|
+
});
|
|
358
|
+
/**
|
|
359
|
+
* A compact summary for run listings and status projections.
|
|
360
|
+
*
|
|
361
|
+
* @since 0.1.0
|
|
362
|
+
* @category models
|
|
363
|
+
*/
|
|
364
|
+
export const RunSummary = Schema.Struct({
|
|
365
|
+
/** Whether lifecycle fields were observed in the engine or no engine row was visible. */
|
|
366
|
+
executionObservation: Schema.optional(Schema.Literals(["observed", "missing"])),
|
|
367
|
+
/** Exact native semantic observation; never a control-stream fact. */
|
|
368
|
+
executionView: Schema.optional(ExecutionFact.View),
|
|
369
|
+
runId: RunId,
|
|
370
|
+
flowId: FlowId,
|
|
371
|
+
status: RunStatus,
|
|
372
|
+
planId: Schema.optional(Schema.String),
|
|
373
|
+
planDigest: Schema.optional(Schema.String),
|
|
374
|
+
/** The flow's executable identity when the run started; resume refuses a different one. */
|
|
375
|
+
executionDigest: Schema.optional(Schema.String),
|
|
376
|
+
/** The engine version that started the run. */
|
|
377
|
+
engineVersion: Schema.optional(Schema.String),
|
|
378
|
+
/**
|
|
379
|
+
* How the code that would resume this run differs from the code it
|
|
380
|
+
* recorded. Computed by an exact run lookup, never stored; absent when
|
|
381
|
+
* nothing changed or the run is terminal.
|
|
382
|
+
*/
|
|
383
|
+
codeDrift: Schema.optional(Schema.Struct({
|
|
384
|
+
recorded: Schema.optional(Schema.String),
|
|
385
|
+
current: Schema.optional(Schema.String),
|
|
386
|
+
recordedEngine: Schema.optional(Schema.String),
|
|
387
|
+
currentEngine: Schema.optional(Schema.String)
|
|
388
|
+
})),
|
|
389
|
+
ownerId: Schema.optional(Schema.String),
|
|
390
|
+
/**
|
|
391
|
+
* The authenticated principal that launched this run through the control
|
|
392
|
+
* plane. A reader that does not see every run sees only the runs its own
|
|
393
|
+
* principal launched. Absent on a run the engine created (a child, a fork,
|
|
394
|
+
* a later trampoline round) and on a run launched before it was recorded;
|
|
395
|
+
* only a reader that sees every run sees those.
|
|
396
|
+
*/
|
|
397
|
+
launchedBy: Schema.optional(Schema.Struct({ id: Schema.String, kind: Schema.String })),
|
|
398
|
+
/**
|
|
399
|
+
* The run this one branched from: the spawning run, the forked-from run, or
|
|
400
|
+
* the previous trampoline round. Absent on a run with no ancestor.
|
|
401
|
+
*/
|
|
402
|
+
parentRunId: Schema.optional(RunId),
|
|
403
|
+
/**
|
|
404
|
+
* The trampoline lineage this run is a round of, and which round it is.
|
|
405
|
+
* Both absent means a lineage of one, read as round 0 of itself.
|
|
406
|
+
*/
|
|
407
|
+
lineageId: Schema.optional(Schema.String),
|
|
408
|
+
roundOrdinal: Schema.optional(Schema.Number),
|
|
409
|
+
origin: Schema.optional(RunOrigin),
|
|
410
|
+
/**
|
|
411
|
+
* What a parked run is holding on: `approval`, `event`, `timer`, `quota`, or
|
|
412
|
+
* a reason a plugin declared. Absent on a run that is not parked, and on a
|
|
413
|
+
* park whose owner released the run without declaring one.
|
|
414
|
+
*
|
|
415
|
+
* The CLI's `ps` and `status` listings also render `executor` here for a run
|
|
416
|
+
* that has sat at `accepted` with no owner process past the launch handoff
|
|
417
|
+
* window. That value is computed at render time and never stored, so a
|
|
418
|
+
* reader going through the control RPC, the gateway projection, or a plugin
|
|
419
|
+
* sees the field absent on the same run.
|
|
420
|
+
*/
|
|
421
|
+
waitingReason: Schema.optional(Schema.String),
|
|
422
|
+
/** What has been steered to this run and not yet delivered. */
|
|
423
|
+
steering: Schema.optional(Schema.Struct({ pending: Schema.Number })),
|
|
424
|
+
/**
|
|
425
|
+
* A resume this run has been told to take and no host has taken up yet.
|
|
426
|
+
*
|
|
427
|
+
* A decision on an in-run approval restarts the run server-side, and the
|
|
428
|
+
* process that decides is usually not the process that hosts the execution:
|
|
429
|
+
* an operator's `smithers approve`, a gateway, a second CLI. The intent is
|
|
430
|
+
* therefore recorded durably here, and the host that owns the execution
|
|
431
|
+
* takes it up on its next tick and clears it. The number is the durable
|
|
432
|
+
* sequence of the request, so an operator can tell a delegation that is
|
|
433
|
+
* still outstanding from one that has been taken up. Absent means nothing
|
|
434
|
+
* is waiting to be taken up.
|
|
435
|
+
*/
|
|
436
|
+
pendingResume: Schema.optional(Schema.Number),
|
|
437
|
+
/**
|
|
438
|
+
* The executor claim this run was parked under.
|
|
439
|
+
*
|
|
440
|
+
* A parked execution releases its owner columns — that is what makes it
|
|
441
|
+
* resumable at all — so after a park nothing on the row says which process
|
|
442
|
+
* is hosting it. Every process that shares the databases can therefore see
|
|
443
|
+
* the parked execution and resume it, including a short-lived `smithers
|
|
444
|
+
* approve` that would drive the run and then exit. The fence the park was
|
|
445
|
+
* written under is recorded here instead, so the host that parked the run
|
|
446
|
+
* recognizes its own park and every other composition can tell that the
|
|
447
|
+
* execution is not its to take up (triage B-15). Absent on a run that is not
|
|
448
|
+
* parked, and on a park written by something that held no fence.
|
|
449
|
+
*/
|
|
450
|
+
parkedBy: Schema.optional(Schema.String),
|
|
451
|
+
/** Who cancelled this run, why, and on whose behalf. Absent until one did. */
|
|
452
|
+
cancellation: Schema.optional(Cancellation),
|
|
453
|
+
/**
|
|
454
|
+
* Open human waits anywhere in this run's tree, nearest execution first.
|
|
455
|
+
*
|
|
456
|
+
* Present only when there is at least one, so a run nobody owes an answer
|
|
457
|
+
* carries no field rather than an empty array. `status` rolls up with it:
|
|
458
|
+
* a run any of whose descendants is parked on `approval` reports
|
|
459
|
+
* `waiting-approval`, which is what the existing inbox filters select on.
|
|
460
|
+
*/
|
|
461
|
+
pendingWaits: Schema.optional(Schema.Array(PendingWait)),
|
|
462
|
+
/**
|
|
463
|
+
* When the run's approved deadline passes: its `createdAt` plus the
|
|
464
|
+
* envelope's `budget.deadline`, which is the instant the run is failed with
|
|
465
|
+
* `deadline_exceeded` if it has not settled. Absent on a run approved with
|
|
466
|
+
* no deadline.
|
|
467
|
+
*/
|
|
468
|
+
deadlineAt: Schema.optional(Schema.Number),
|
|
469
|
+
createdAt: Schema.Number,
|
|
470
|
+
updatedAt: Schema.Number
|
|
471
|
+
});
|
|
472
|
+
/**
|
|
473
|
+
* The bookkeeping every steer variant carries.
|
|
474
|
+
*
|
|
475
|
+
* `principal` stays here even though `CancelInput` argues a wire principal is
|
|
476
|
+
* a client naming someone else, and the difference is who the callers are. A
|
|
477
|
+
* cancel is only ever an operator command, so the server can be its sole
|
|
478
|
+
* source of identity. A steer is not: `agent/send` steers a child run and
|
|
479
|
+
* attributes the message to the parent flow, which is an identity no
|
|
480
|
+
* authenticator knows and no operator issued. Dropping the field would erase
|
|
481
|
+
* that attribution, so the field remains and `ControlServer` overwrites it
|
|
482
|
+
* with the authenticated principal on every steer that arrives over RPC. An
|
|
483
|
+
* in-process caller keeps naming its own.
|
|
484
|
+
*/
|
|
485
|
+
const steerEnvelope = {
|
|
486
|
+
messageId: Schema.String,
|
|
487
|
+
/**
|
|
488
|
+
* The run this message is for. `Control.steer` refuses a message whose
|
|
489
|
+
* `runId` disagrees with the one the call names: the notification would be
|
|
490
|
+
* admitted to the call's run while the stored message claimed another, and an
|
|
491
|
+
* operator reading it later would be told it belongs somewhere it was never
|
|
492
|
+
* delivered.
|
|
493
|
+
*/
|
|
494
|
+
runId: RunId,
|
|
495
|
+
principal: Principal,
|
|
496
|
+
// Producer labels are data, distinct from principal. Public RPC strips
|
|
497
|
+
// these; a trusted product bridge may relay its already-authorized sender.
|
|
498
|
+
attribution: Schema.optional(Attribution),
|
|
499
|
+
/**
|
|
500
|
+
* When the caller says it wrote the message. It is the caller's own
|
|
501
|
+
* statement, recorded on `control.steer.enqueued` and never used to decide
|
|
502
|
+
* anything. Over RPC the server's own clock is already on
|
|
503
|
+
* `principal.stampedAt`, which is the time a decision may be replayed
|
|
504
|
+
* against.
|
|
505
|
+
*/
|
|
506
|
+
createdAt: Schema.Number
|
|
507
|
+
};
|
|
508
|
+
/**
|
|
509
|
+
* An operator message inserted into the transcript at the next turn boundary.
|
|
510
|
+
*
|
|
511
|
+
* `kind` is optional here and required on every other variant, which is what
|
|
512
|
+
* keeps a steer written before the vocabulary widened readable: a body and no
|
|
513
|
+
* kind is a message, and always was.
|
|
514
|
+
*
|
|
515
|
+
* @since 0.1.0
|
|
516
|
+
* @category models
|
|
517
|
+
*/
|
|
518
|
+
export const MessageSteer = Schema.Struct({
|
|
519
|
+
...steerEnvelope,
|
|
520
|
+
kind: Schema.optional(Schema.Literal("Message")),
|
|
521
|
+
body: Schema.String
|
|
522
|
+
});
|
|
523
|
+
/**
|
|
524
|
+
* A model-seat change that applies from the next turn on.
|
|
525
|
+
*
|
|
526
|
+
* @since 0.1.0
|
|
527
|
+
* @category models
|
|
528
|
+
*/
|
|
529
|
+
export const SeatSteer = Schema.Struct({ ...steerEnvelope, ...SteerPayload.SeatPayload.fields });
|
|
530
|
+
/**
|
|
531
|
+
* A thinking-level change that applies from the next turn on.
|
|
532
|
+
*
|
|
533
|
+
* @since 0.1.0
|
|
534
|
+
* @category models
|
|
535
|
+
*/
|
|
536
|
+
export const ThinkingSteer = Schema.Struct({ ...steerEnvelope, ...SteerPayload.ThinkingPayload.fields });
|
|
537
|
+
/**
|
|
538
|
+
* Tools added to the active set for future turns.
|
|
539
|
+
*
|
|
540
|
+
* @since 0.1.0
|
|
541
|
+
* @category models
|
|
542
|
+
*/
|
|
543
|
+
export const ToolsSteer = Schema.Struct({ ...steerEnvelope, ...SteerPayload.ToolsPayload.fields });
|
|
544
|
+
/**
|
|
545
|
+
* A durable operator steer delivered at an execution turn boundary.
|
|
546
|
+
*
|
|
547
|
+
* An operator steers a run for four different reasons, and only one of them is
|
|
548
|
+
* something to tell the model. Saying "your seat changed" would spend a turn on
|
|
549
|
+
* bookkeeping; changing the seat is what was asked for. So the four are one
|
|
550
|
+
* union rather than four free-text conventions the harness would have to
|
|
551
|
+
* parse.
|
|
552
|
+
*
|
|
553
|
+
* @since 0.1.0
|
|
554
|
+
* @category models
|
|
555
|
+
*/
|
|
556
|
+
export const SteerMessage = Schema.Union([MessageSteer, SeatSteer, ThinkingSteer, ToolsSteer]);
|
|
557
|
+
/**
|
|
558
|
+
* The stored steering item one steer carries.
|
|
559
|
+
*
|
|
560
|
+
* The envelope — who asked, when, for which run — is control-plane
|
|
561
|
+
* bookkeeping. What crosses into the notification queue is the item alone, in
|
|
562
|
+
* the vocabulary `@smthrs/notifications` defines and the harness reads back.
|
|
563
|
+
*
|
|
564
|
+
* @param message the steer
|
|
565
|
+
* @since 0.1.0
|
|
566
|
+
* @category conversions
|
|
567
|
+
*/
|
|
568
|
+
export const steerItem = (message) => {
|
|
569
|
+
switch (message.kind) {
|
|
570
|
+
case undefined:
|
|
571
|
+
case "Message":
|
|
572
|
+
return { kind: "Message", body: message.body };
|
|
573
|
+
case "Seat":
|
|
574
|
+
return { kind: "Seat", seat: message.seat };
|
|
575
|
+
case "Thinking":
|
|
576
|
+
return { kind: "Thinking", thinking: message.thinking };
|
|
577
|
+
case "Tools":
|
|
578
|
+
return { kind: "Tools", toolNames: message.toolNames };
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
/**
|
|
582
|
+
* A durable, named signal delivered to a waiting run.
|
|
583
|
+
*
|
|
584
|
+
* @since 0.1.0
|
|
585
|
+
* @category models
|
|
586
|
+
*/
|
|
587
|
+
export const SignalPayload = Schema.Struct({
|
|
588
|
+
name: Schema.String,
|
|
589
|
+
payload: Schema.Json
|
|
590
|
+
});
|
|
591
|
+
/**
|
|
592
|
+
* The RPC request schema for planning.
|
|
593
|
+
*
|
|
594
|
+
* The wire accepts JSON because an RPC request must be serializable. The local
|
|
595
|
+
* `Control.PlanInput` keeps `input` as `unknown` so a runtime can decode its
|
|
596
|
+
* flow's own input schema before anything crosses a transport.
|
|
597
|
+
*
|
|
598
|
+
* @since 0.1.0
|
|
599
|
+
* @category models
|
|
600
|
+
*/
|
|
601
|
+
export const PlanInputSchema = Schema.Struct({
|
|
602
|
+
flowId: FlowId,
|
|
603
|
+
input: Schema.Json,
|
|
604
|
+
idempotencyKey: Schema.optional(IdempotencyKey),
|
|
605
|
+
budget: Schema.optional(Envelope.fields.budget)
|
|
606
|
+
});
|
|
607
|
+
/**
|
|
608
|
+
* The RPC request schema for starting a plan or resuming a run.
|
|
609
|
+
*
|
|
610
|
+
* @since 0.1.0
|
|
611
|
+
* @category models
|
|
612
|
+
*/
|
|
613
|
+
export const RunInputSchema = Schema.Union([
|
|
614
|
+
Schema.TaggedStruct("Plan", {
|
|
615
|
+
planId: Schema.String,
|
|
616
|
+
digest: Schema.String,
|
|
617
|
+
envelope: Envelope,
|
|
618
|
+
idempotencyKey: IdempotencyKey
|
|
619
|
+
}),
|
|
620
|
+
Schema.TaggedStruct("Resume", {
|
|
621
|
+
runId: RunId,
|
|
622
|
+
idempotencyKey: IdempotencyKey,
|
|
623
|
+
allowCodeDrift: Schema.optional(Schema.Boolean)
|
|
624
|
+
})
|
|
625
|
+
]);
|
|
626
|
+
/**
|
|
627
|
+
* The RPC request schema for an approval decision.
|
|
628
|
+
*
|
|
629
|
+
* The authenticated server supplies the principal, so a client cannot name a
|
|
630
|
+
* different identity on the wire.
|
|
631
|
+
*
|
|
632
|
+
* @since 0.1.0
|
|
633
|
+
* @category models
|
|
634
|
+
*/
|
|
635
|
+
export const ApprovalInputSchema = ApprovalPayload;
|
|
636
|
+
/**
|
|
637
|
+
* The RPC request schema for steering a run.
|
|
638
|
+
*
|
|
639
|
+
* @since 0.1.0
|
|
640
|
+
* @category models
|
|
641
|
+
*/
|
|
642
|
+
export const SteerInputSchema = Schema.Struct({
|
|
643
|
+
version: Schema.optional(Schema.Number),
|
|
644
|
+
runId: RunId,
|
|
645
|
+
message: SteerMessage,
|
|
646
|
+
idempotencyKey: IdempotencyKey
|
|
647
|
+
});
|
|
648
|
+
/**
|
|
649
|
+
* The RPC request schema for signaling a run.
|
|
650
|
+
*
|
|
651
|
+
* @since 0.1.0
|
|
652
|
+
* @category models
|
|
653
|
+
*/
|
|
654
|
+
export const SignalInputSchema = Schema.Struct({
|
|
655
|
+
runId: RunId,
|
|
656
|
+
signal: SignalPayload,
|
|
657
|
+
idempotencyKey: IdempotencyKey
|
|
658
|
+
});
|
|
659
|
+
/**
|
|
660
|
+
* The shared fields of an RPC run mutation request.
|
|
661
|
+
*
|
|
662
|
+
* @since 0.1.0
|
|
663
|
+
* @category models
|
|
664
|
+
*/
|
|
665
|
+
export const RunMutationInputSchema = Schema.Struct({ runId: RunId, idempotencyKey: IdempotencyKey });
|
|
666
|
+
/**
|
|
667
|
+
* The RPC request schema for a lifecycle mutation that records a reason.
|
|
668
|
+
*
|
|
669
|
+
* The reason is on the wire because the server records it with the decision.
|
|
670
|
+
* The principal is absent because the authenticated server stamps it.
|
|
671
|
+
*
|
|
672
|
+
* @since 0.1.0
|
|
673
|
+
* @category models
|
|
674
|
+
*/
|
|
675
|
+
export const ReasonedMutationInputSchema = Schema.Struct({
|
|
676
|
+
...RunMutationInputSchema.fields,
|
|
677
|
+
reason: Schema.optional(Schema.String)
|
|
678
|
+
});
|
|
679
|
+
/**
|
|
680
|
+
* The RPC request schema for cancellation.
|
|
681
|
+
*
|
|
682
|
+
* Cancellation currently has the same wire shape as every reasoned lifecycle
|
|
683
|
+
* mutation. This named alias keeps the operation's public contract explicit.
|
|
684
|
+
*
|
|
685
|
+
* @since 0.1.0
|
|
686
|
+
* @category models
|
|
687
|
+
*/
|
|
688
|
+
export const CancelInputSchema = ReasonedMutationInputSchema;
|
|
689
|
+
/**
|
|
690
|
+
* The RPC request schema for resume: a reasoned mutation that may accept a
|
|
691
|
+
* changed flow.
|
|
692
|
+
*
|
|
693
|
+
* @since 1.0.0
|
|
694
|
+
* @category models
|
|
695
|
+
*/
|
|
696
|
+
export const ResumeInputSchema = Schema.Struct({
|
|
697
|
+
...ReasonedMutationInputSchema.fields,
|
|
698
|
+
allowCodeDrift: Schema.optional(Schema.Boolean)
|
|
699
|
+
});
|
|
700
|
+
/**
|
|
701
|
+
* A checkpoint in one journal entry's expansion. Without `offset`, the whole
|
|
702
|
+
* entry is consumed. With it, only members through that zero-based index are
|
|
703
|
+
* consumed. Pass the cursor back unchanged with the same run id.
|
|
704
|
+
*
|
|
705
|
+
* @since 0.1.0
|
|
706
|
+
* @category models
|
|
707
|
+
*/
|
|
708
|
+
export const WatchCursor = Schema.Struct({
|
|
709
|
+
sequence: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0), Schema.isLessThan(Number.MAX_SAFE_INTEGER)),
|
|
710
|
+
offset: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0), Schema.isLessThan(Number.MAX_SAFE_INTEGER)))
|
|
711
|
+
});
|
|
712
|
+
/**
|
|
713
|
+
* A journal-projection cursor, optional run restriction, and delivery mode.
|
|
714
|
+
* Omitting `follow` preserves the live-stream behavior; `false` requests a
|
|
715
|
+
* finite snapshot of entries durable when the request is handled.
|
|
716
|
+
*
|
|
717
|
+
* @since 0.1.0
|
|
718
|
+
* @category models
|
|
719
|
+
*/
|
|
720
|
+
export const WatchFilter = Schema.Struct({
|
|
721
|
+
runId: Schema.optional(RunId),
|
|
722
|
+
/** Resume after a fully consumed source entry, including all its deltas. Requires `runId`. */
|
|
723
|
+
afterSequence: Schema.optional(Schema.Number),
|
|
724
|
+
/** Resume after one emitted event, even inside an expansion. Requires `runId`. Cannot be combined with `afterSequence`. */
|
|
725
|
+
afterCursor: Schema.optional(WatchCursor),
|
|
726
|
+
follow: Schema.optional(Schema.Boolean)
|
|
727
|
+
});
|
|
728
|
+
/**
|
|
729
|
+
* One ordered journal-projection delta streamed by `watch`.
|
|
730
|
+
*
|
|
731
|
+
* @since 0.1.0
|
|
732
|
+
* @category models
|
|
733
|
+
*/
|
|
734
|
+
export const ControlEvent = Schema.Struct({
|
|
735
|
+
/** Present on `ControlLive.watch` events; absent on raw projections and older providers. */
|
|
736
|
+
cursor: Schema.optional(WatchCursor),
|
|
737
|
+
sequence: Schema.Number,
|
|
738
|
+
kind: Schema.String,
|
|
739
|
+
runId: Schema.optional(RunId),
|
|
740
|
+
occurredAt: Schema.Number,
|
|
741
|
+
payload: Schema.Json
|
|
742
|
+
});
|
|
743
|
+
/**
|
|
744
|
+
* How many items a listing returns when the caller names no `limit`.
|
|
745
|
+
*
|
|
746
|
+
* A listing with no bound returned the whole collection and paid one pending
|
|
747
|
+
* steer query per run, so `smithers ps` on a busy project grew without bound.
|
|
748
|
+
* A default is the smallest fix that keeps every caller working: a client that
|
|
749
|
+
* wants more walks `nextCursor`.
|
|
750
|
+
*
|
|
751
|
+
* @since 0.1.0
|
|
752
|
+
* @category models
|
|
753
|
+
*/
|
|
754
|
+
export const defaultPageSize = 100;
|
|
755
|
+
/**
|
|
756
|
+
* The largest `limit` a listing accepts.
|
|
757
|
+
*
|
|
758
|
+
* The cap is the resource bound: a remote bearer holder cannot ask one request
|
|
759
|
+
* to project an unbounded number of rows.
|
|
760
|
+
*
|
|
761
|
+
* @since 0.1.0
|
|
762
|
+
* @category models
|
|
763
|
+
*/
|
|
764
|
+
export const maxPageSize = 500;
|
|
765
|
+
/**
|
|
766
|
+
* A page size a listing can actually make progress on.
|
|
767
|
+
*
|
|
768
|
+
* `0`, a negative size, a fraction, `NaN`, and `Infinity` are all refused. A
|
|
769
|
+
* zero-sized page used to answer `{ items: [], nextCursor: "0" }`, which is a
|
|
770
|
+
* cursor a client loops on forever.
|
|
771
|
+
*
|
|
772
|
+
* @since 0.1.0
|
|
773
|
+
* @category models
|
|
774
|
+
*/
|
|
775
|
+
export const PageLimit = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(maxPageSize));
|
|
776
|
+
/**
|
|
777
|
+
* How a claimed trigger occurrence ended.
|
|
778
|
+
*
|
|
779
|
+
* The same six words `@smthrs/triggers` records in its fire ledger. They are
|
|
780
|
+
* declared here rather than imported because the triggers package depends on
|
|
781
|
+
* this one (its scheduler launches runs through `Control`), so the vocabulary
|
|
782
|
+
* has to live on the control side of that edge.
|
|
783
|
+
*
|
|
784
|
+
* @since 1.0.0
|
|
785
|
+
* @category models
|
|
786
|
+
*/
|
|
787
|
+
export const FireOutcome = Schema.Literals(["launched", "completed", "skipped", "buffered", "superseded", "failed"]);
|
|
788
|
+
/**
|
|
789
|
+
* One registered trigger as a listing reports it.
|
|
790
|
+
*
|
|
791
|
+
* `nextOccurrencesMs` is the store clock's view of the next fires, computed at
|
|
792
|
+
* read time, so an operator sees when a schedule will next run without
|
|
793
|
+
* evaluating the cron expression client-side. `schedulerLastTickMs` is the
|
|
794
|
+
* last poll the scheduler recorded; absent means no scheduler has ticked on
|
|
795
|
+
* this host, so an enabled trigger is not going to fire. `activeRunId` names
|
|
796
|
+
* the run the trigger is currently holding, and is absent while the trigger
|
|
797
|
+
* holds a reservation rather than a launched run.
|
|
798
|
+
*
|
|
799
|
+
* @since 1.0.0
|
|
800
|
+
* @category models
|
|
801
|
+
*/
|
|
802
|
+
export const TriggerSummary = Schema.Struct({
|
|
803
|
+
triggerId: Schema.String,
|
|
804
|
+
flowId: FlowId,
|
|
805
|
+
input: Schema.Json,
|
|
806
|
+
cron: Schema.String,
|
|
807
|
+
timezone: Schema.optional(Schema.String),
|
|
808
|
+
overlap: Schema.Literals(["skip", "buffer-one", "supersede"]),
|
|
809
|
+
catchUp: Schema.Literals(["none", "one", "all"]),
|
|
810
|
+
maxCatchUp: Schema.optional(Schema.Number),
|
|
811
|
+
enabled: Schema.Boolean,
|
|
812
|
+
revision: Schema.Number,
|
|
813
|
+
lastFiredAtMs: Schema.optional(Schema.Number),
|
|
814
|
+
pendingAtMs: Schema.optional(Schema.Number),
|
|
815
|
+
activeRunId: Schema.optional(RunId),
|
|
816
|
+
nextOccurrencesMs: Schema.Array(Schema.Number),
|
|
817
|
+
schedulerLastTickMs: Schema.optional(Schema.Number)
|
|
818
|
+
});
|
|
819
|
+
/**
|
|
820
|
+
* One claimed trigger occurrence and what became of it.
|
|
821
|
+
*
|
|
822
|
+
* `outcome` is `null` while the occurrence is claimed and not yet reported,
|
|
823
|
+
* which is the window between a claim and its `recordResult`. `waiting` names
|
|
824
|
+
* what a launched run is parked on when the ledger can see it.
|
|
825
|
+
*
|
|
826
|
+
* @since 1.0.0
|
|
827
|
+
* @category models
|
|
828
|
+
*/
|
|
829
|
+
export const FireSummary = Schema.Struct({
|
|
830
|
+
triggerId: Schema.String,
|
|
831
|
+
occurrenceAtMs: Schema.Number,
|
|
832
|
+
outcome: Schema.NullOr(FireOutcome),
|
|
833
|
+
runId: Schema.optional(RunId),
|
|
834
|
+
error: Schema.optional(Schema.String),
|
|
835
|
+
waiting: Schema.optional(Schema.Literal("approval"))
|
|
836
|
+
});
|
|
837
|
+
/**
|
|
838
|
+
* An operator's decision on a stored plan.
|
|
839
|
+
*
|
|
840
|
+
* @since 1.0.0
|
|
841
|
+
* @category models
|
|
842
|
+
*/
|
|
843
|
+
export const PlanDecision = Schema.Literals(["pending", "approved", "denied"]);
|
|
844
|
+
/**
|
|
845
|
+
* One stored plan as a listing reports it: the card an approval submits
|
|
846
|
+
* (`card.approval`), the decoded input it was planned with, and its decision.
|
|
847
|
+
*
|
|
848
|
+
* @since 1.0.0
|
|
849
|
+
* @category models
|
|
850
|
+
*/
|
|
851
|
+
export const PlanSummary = Schema.Struct({
|
|
852
|
+
card: PlanCard,
|
|
853
|
+
input: Schema.Json,
|
|
854
|
+
decision: PlanDecision
|
|
855
|
+
});
|
|
856
|
+
/** Exact native observations, including unavailable evidence rather than a guessed lifecycle.
|
|
857
|
+
* @category schemas
|
|
858
|
+
* @since 1.0.0
|
|
859
|
+
*/
|
|
860
|
+
export const ExecutionBatch = Schema.Struct({
|
|
861
|
+
source: Schema.NullOr(Schema.String),
|
|
862
|
+
revision: Schema.NullOr(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
|
|
863
|
+
snapshots: Schema.Array(Schema.Union([
|
|
864
|
+
Schema.TaggedStruct("Observed", {
|
|
865
|
+
executionId: RunId,
|
|
866
|
+
source: Schema.String,
|
|
867
|
+
revision: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
868
|
+
observation: ExecutionFact.Observation
|
|
869
|
+
}),
|
|
870
|
+
Schema.TaggedStruct("Missing", {
|
|
871
|
+
executionId: RunId,
|
|
872
|
+
source: Schema.String,
|
|
873
|
+
revision: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
874
|
+
deleted: Schema.Boolean
|
|
875
|
+
}),
|
|
876
|
+
Schema.TaggedStruct("Unavailable", {
|
|
877
|
+
executionId: RunId,
|
|
878
|
+
reason: Schema.Literals(["unsupported", "outside-run", "ancestry-unavailable"])
|
|
879
|
+
})
|
|
880
|
+
]))
|
|
881
|
+
});
|
|
882
|
+
/**
|
|
883
|
+
* A typed listing request for discovered flows, durable runs, registered
|
|
884
|
+
* triggers, the trigger fire ledger, or stored plans.
|
|
885
|
+
*
|
|
886
|
+
* `plans` lists stored plans oldest first, narrowed by flow and decision, so an
|
|
887
|
+
* operator can find what is waiting for approval: a build target declaring
|
|
888
|
+
* `approval: "required"` leaves a pending `system/target` plan. Plans are an
|
|
889
|
+
* operator's to read; a restricted reader lists none.
|
|
890
|
+
*
|
|
891
|
+
* `principalId` selects the runs whose `launchedBy.id` it names. It narrows a
|
|
892
|
+
* listing; it is not an authorization boundary. The server restricts a reader
|
|
893
|
+
* that does not see every run to the runs its own principal launched, whatever
|
|
894
|
+
* filter it sends.
|
|
895
|
+
*
|
|
896
|
+
* @since 0.1.0
|
|
897
|
+
* @category models
|
|
898
|
+
*/
|
|
899
|
+
export const ListRequest = Schema.Union([
|
|
900
|
+
Schema.TaggedStruct("executions", {
|
|
901
|
+
runId: RunId,
|
|
902
|
+
executionIds: Schema.Array(Schema.NonEmptyString).check(Schema.isMaxLength(200))
|
|
903
|
+
}),
|
|
904
|
+
Schema.TaggedStruct("flows", {
|
|
905
|
+
filters: Schema.optional(Schema.Json),
|
|
906
|
+
cursor: Schema.optional(Schema.String),
|
|
907
|
+
limit: Schema.optional(PageLimit)
|
|
908
|
+
}),
|
|
909
|
+
Schema.TaggedStruct("runs", {
|
|
910
|
+
filters: Schema.optional(Schema.Struct({
|
|
911
|
+
runId: Schema.optional(RunId),
|
|
912
|
+
flowId: Schema.optional(FlowId),
|
|
913
|
+
status: Schema.optional(RunStatus),
|
|
914
|
+
terminal: Schema.optional(Schema.Boolean),
|
|
915
|
+
principalId: Schema.optional(Schema.String),
|
|
916
|
+
parentRunId: Schema.optional(RunId),
|
|
917
|
+
lineageId: Schema.optional(Schema.String),
|
|
918
|
+
/** Runs created at or after this epoch millisecond. */
|
|
919
|
+
since: Schema.optional(Schema.Number),
|
|
920
|
+
/** Runs created before this epoch millisecond. */
|
|
921
|
+
until: Schema.optional(Schema.Number),
|
|
922
|
+
/** Runs a fire of this trigger started. */
|
|
923
|
+
triggerId: Schema.optional(Schema.String)
|
|
924
|
+
})),
|
|
925
|
+
/** Creation time, newest or oldest first; omitted preserves the historical listing order. */
|
|
926
|
+
order: Schema.optional(Schema.Literals(["newest", "oldest"])),
|
|
927
|
+
cursor: Schema.optional(Schema.String),
|
|
928
|
+
limit: Schema.optional(PageLimit)
|
|
929
|
+
}),
|
|
930
|
+
Schema.TaggedStruct("triggers", {
|
|
931
|
+
filters: Schema.optional(Schema.Struct({
|
|
932
|
+
triggerId: Schema.optional(Schema.String),
|
|
933
|
+
flowId: Schema.optional(FlowId),
|
|
934
|
+
enabled: Schema.optional(Schema.Boolean)
|
|
935
|
+
})),
|
|
936
|
+
cursor: Schema.optional(Schema.String),
|
|
937
|
+
limit: Schema.optional(PageLimit)
|
|
938
|
+
}),
|
|
939
|
+
Schema.TaggedStruct("fires", {
|
|
940
|
+
filters: Schema.optional(Schema.Struct({
|
|
941
|
+
triggerId: Schema.optional(Schema.String),
|
|
942
|
+
runId: Schema.optional(RunId),
|
|
943
|
+
outcome: Schema.optional(FireOutcome)
|
|
944
|
+
})),
|
|
945
|
+
cursor: Schema.optional(Schema.String),
|
|
946
|
+
limit: Schema.optional(PageLimit)
|
|
947
|
+
}),
|
|
948
|
+
Schema.TaggedStruct("plans", {
|
|
949
|
+
filters: Schema.optional(Schema.Struct({
|
|
950
|
+
flowId: Schema.optional(FlowId),
|
|
951
|
+
decision: Schema.optional(PlanDecision)
|
|
952
|
+
})),
|
|
953
|
+
cursor: Schema.optional(Schema.String),
|
|
954
|
+
limit: Schema.optional(PageLimit)
|
|
955
|
+
})
|
|
956
|
+
]);
|
|
957
|
+
/**
|
|
958
|
+
* A typed page returned for a flow, run, trigger, fire, or plan listing.
|
|
959
|
+
*
|
|
960
|
+
* @since 0.1.0
|
|
961
|
+
* @category models
|
|
962
|
+
*/
|
|
963
|
+
export const ListResponse = Schema.Union([
|
|
964
|
+
Schema.TaggedStruct("executions", {
|
|
965
|
+
source: ExecutionBatch.fields.source,
|
|
966
|
+
revision: ExecutionBatch.fields.revision,
|
|
967
|
+
items: ExecutionBatch.fields.snapshots,
|
|
968
|
+
nextCursor: Schema.optional(Schema.Never)
|
|
969
|
+
}),
|
|
970
|
+
Schema.TaggedStruct("flows", {
|
|
971
|
+
items: Schema.Array(Schema.Struct({ flowId: FlowId, description: Schema.String, inputSchema: Schema.optional(Schema.Json) })),
|
|
972
|
+
warnings: Schema.optional(Schema.Array(DiscoveryWarning)),
|
|
973
|
+
nextCursor: Schema.optional(Schema.String)
|
|
974
|
+
}),
|
|
975
|
+
Schema.TaggedStruct("runs", {
|
|
976
|
+
items: Schema.Array(RunSummary),
|
|
977
|
+
nextCursor: Schema.optional(Schema.String)
|
|
978
|
+
}),
|
|
979
|
+
Schema.TaggedStruct("triggers", {
|
|
980
|
+
items: Schema.Array(TriggerSummary),
|
|
981
|
+
nextCursor: Schema.optional(Schema.String)
|
|
982
|
+
}),
|
|
983
|
+
Schema.TaggedStruct("fires", {
|
|
984
|
+
items: Schema.Array(FireSummary),
|
|
985
|
+
nextCursor: Schema.optional(Schema.String)
|
|
986
|
+
}),
|
|
987
|
+
Schema.TaggedStruct("plans", {
|
|
988
|
+
items: Schema.Array(PlanSummary),
|
|
989
|
+
nextCursor: Schema.optional(Schema.String)
|
|
990
|
+
})
|
|
991
|
+
]);
|
|
992
|
+
/**
|
|
993
|
+
* A live process that hosts a run: its machine and process id.
|
|
994
|
+
*
|
|
995
|
+
* @since 1.0.0
|
|
996
|
+
* @category models
|
|
997
|
+
*/
|
|
998
|
+
export const RunHost = Schema.Struct({ hostId: Schema.String, pid: Schema.Number });
|
|
999
|
+
/**
|
|
1000
|
+
* The idempotent outcome returned by every control mutation.
|
|
1001
|
+
*
|
|
1002
|
+
* An `Accepted` resume with `handedTo` was not claimed by the caller: the live
|
|
1003
|
+
* process that parked the run takes it up and drives it.
|
|
1004
|
+
*
|
|
1005
|
+
* @since 0.1.0
|
|
1006
|
+
* @category models
|
|
1007
|
+
*/
|
|
1008
|
+
export const Receipt = Schema.Union([
|
|
1009
|
+
Schema.TaggedStruct("Accepted", {
|
|
1010
|
+
inputConsumed: Schema.optional(Schema.Boolean),
|
|
1011
|
+
inputBody: Schema.optional(Schema.String),
|
|
1012
|
+
receiptId: Schema.String,
|
|
1013
|
+
runId: Schema.optional(RunId),
|
|
1014
|
+
handedTo: Schema.optional(RunHost)
|
|
1015
|
+
}),
|
|
1016
|
+
Schema.TaggedStruct("AlreadyApplied", {
|
|
1017
|
+
receiptId: Schema.String,
|
|
1018
|
+
runId: Schema.optional(RunId),
|
|
1019
|
+
inputConsumed: Schema.optional(Schema.Boolean),
|
|
1020
|
+
inputBody: Schema.optional(Schema.String)
|
|
1021
|
+
}),
|
|
1022
|
+
Schema.TaggedStruct("Parked", {
|
|
1023
|
+
receiptId: Schema.String,
|
|
1024
|
+
planId: Schema.String,
|
|
1025
|
+
status: Schema.Literal("waiting-approval")
|
|
1026
|
+
}),
|
|
1027
|
+
Schema.TaggedStruct("Conflict", { message: Schema.String }),
|
|
1028
|
+
Schema.TaggedStruct("Terminal", { runId: RunId, status: RunStatus })
|
|
1029
|
+
]);
|
|
1030
|
+
//# sourceMappingURL=ControlSchema.js.map
|