@aeolus-fleet/core 0.27.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/adapters/crypto/account-token-signatures.d.ts +12 -0
- package/dist/adapters/crypto/account-token-signatures.js +104 -0
- package/dist/adapters/crypto/account-token-signatures.js.map +1 -0
- package/dist/adapters/http/request-credentials.d.ts +7 -1
- package/dist/adapters/http/request-credentials.js +18 -5
- package/dist/adapters/http/request-credentials.js.map +1 -1
- package/dist/adapters/http/server.js +4 -2
- package/dist/adapters/http/server.js.map +1 -1
- package/dist/adapters/prisma/event-log.js +13 -1
- package/dist/adapters/prisma/event-log.js.map +1 -1
- package/dist/adapters/prisma/generated/browser.d.ts +36 -0
- package/dist/adapters/prisma/generated/client.d.ts +36 -0
- package/dist/adapters/prisma/generated/commonInputTypes.d.ts +150 -0
- package/dist/adapters/prisma/generated/enums.d.ts +33 -0
- package/dist/adapters/prisma/generated/enums.js +29 -1
- package/dist/adapters/prisma/generated/enums.js.map +1 -1
- package/dist/adapters/prisma/generated/internal/class.d.ts +55 -0
- package/dist/adapters/prisma/generated/internal/class.js +4 -4
- package/dist/adapters/prisma/generated/internal/class.js.map +1 -1
- package/dist/adapters/prisma/generated/internal/prismaNamespace.d.ts +463 -8
- package/dist/adapters/prisma/generated/internal/prismaNamespace.js +45 -10
- package/dist/adapters/prisma/generated/internal/prismaNamespace.js.map +1 -1
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.d.ts +47 -7
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js +45 -10
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js.map +1 -1
- package/dist/adapters/prisma/generated/models/AccountCutOff.d.ts +944 -0
- package/dist/adapters/prisma/generated/models/AccountCutOff.js +2 -0
- package/dist/adapters/prisma/generated/models/AccountCutOff.js.map +1 -0
- package/dist/adapters/prisma/generated/models/ConsoleSession.d.ts +59 -1
- package/dist/adapters/prisma/generated/models/Event.d.ts +426 -1
- package/dist/adapters/prisma/generated/models/Fleet.d.ts +1270 -116
- package/dist/adapters/prisma/generated/models/InstallationDeclaredNetworkRules.d.ts +1031 -0
- package/dist/adapters/prisma/generated/models/InstallationDeclaredNetworkRules.js +2 -0
- package/dist/adapters/prisma/generated/models/InstallationDeclaredNetworkRules.js.map +1 -0
- package/dist/adapters/prisma/generated/models/Label.d.ts +113 -39
- package/dist/adapters/prisma/generated/models/Lease.d.ts +60 -1
- package/dist/adapters/prisma/generated/models/NetworkRulesDraft.d.ts +1133 -0
- package/dist/adapters/prisma/generated/models/NetworkRulesDraft.js +2 -0
- package/dist/adapters/prisma/generated/models/NetworkRulesDraft.js.map +1 -0
- package/dist/adapters/prisma/generated/models/NetworkSettings.d.ts +24 -223
- package/dist/adapters/prisma/generated/models/PluginConnection.d.ts +1180 -0
- package/dist/adapters/prisma/generated/models/PluginConnection.js +2 -0
- package/dist/adapters/prisma/generated/models/PluginConnection.js.map +1 -0
- package/dist/adapters/prisma/generated/models/ReachRefusal.d.ts +1 -40
- package/dist/adapters/prisma/generated/models/Ship.d.ts +1072 -6
- package/dist/adapters/prisma/generated/models/SignInTicket.d.ts +39 -1
- package/dist/adapters/prisma/generated/models/VerifiedFacts.d.ts +1325 -0
- package/dist/adapters/prisma/generated/models/VerifiedFacts.js +2 -0
- package/dist/adapters/prisma/generated/models/VerifiedFacts.js.map +1 -0
- package/dist/adapters/prisma/generated/models.d.ts +5 -0
- package/dist/adapters/prisma/history.js +5 -2
- package/dist/adapters/prisma/history.js.map +1 -1
- package/dist/adapters/prisma/identity.d.ts +3 -1
- package/dist/adapters/prisma/identity.js +41 -8
- package/dist/adapters/prisma/identity.js.map +1 -1
- package/dist/adapters/prisma/messaging.js +5 -2
- package/dist/adapters/prisma/messaging.js.map +1 -1
- package/dist/adapters/prisma/network.d.ts +7 -2
- package/dist/adapters/prisma/network.js +92 -62
- package/dist/adapters/prisma/network.js.map +1 -1
- package/dist/adapters/prisma/overdue.js +4 -3
- package/dist/adapters/prisma/overdue.js.map +1 -1
- package/dist/adapters/prisma/plugin-connections.d.ts +4 -0
- package/dist/adapters/prisma/plugin-connections.js +20 -0
- package/dist/adapters/prisma/plugin-connections.js.map +1 -0
- package/dist/adapters/prisma/registry.js +22 -16
- package/dist/adapters/prisma/registry.js.map +1 -1
- package/dist/adapters/prisma/rows.d.ts +9 -4
- package/dist/adapters/prisma/rows.js +77 -19
- package/dist/adapters/prisma/rows.js.map +1 -1
- package/dist/adapters/prisma/unit-of-work.d.ts +5 -2
- package/dist/adapters/prisma/unit-of-work.js +7 -2
- package/dist/adapters/prisma/unit-of-work.js.map +1 -1
- package/dist/adapters/prisma/verified-facts.d.ts +4 -0
- package/dist/adapters/prisma/verified-facts.js +65 -0
- package/dist/adapters/prisma/verified-facts.js.map +1 -0
- package/dist/adapters/rest/rest-api.js +2 -2
- package/dist/adapters/rest/rest-api.js.map +1 -1
- package/dist/adapters/trpc/console.d.ts +3 -1
- package/dist/adapters/trpc/context.d.ts +28 -6
- package/dist/adapters/trpc/fleet.d.ts +314 -51
- package/dist/adapters/trpc/fleet.js +137 -75
- package/dist/adapters/trpc/fleet.js.map +1 -1
- package/dist/adapters/trpc/installation-token.d.ts +7 -0
- package/dist/adapters/trpc/installation-token.js +10 -0
- package/dist/adapters/trpc/installation-token.js.map +1 -0
- package/dist/adapters/trpc/installation.d.ts +32 -2
- package/dist/adapters/trpc/installation.js +14 -10
- package/dist/adapters/trpc/installation.js.map +1 -1
- package/dist/adapters/trpc/router.d.ts +435 -42
- package/dist/adapters/trpc/ship-contract.js +6 -3
- package/dist/adapters/trpc/ship-contract.js.map +1 -1
- package/dist/adapters/trpc/ship-protocol.js +1 -1
- package/dist/adapters/trpc/ship-protocol.js.map +1 -1
- package/dist/adapters/trpc/ship.d.ts +117 -1
- package/dist/adapters/trpc/ship.js +52 -6
- package/dist/adapters/trpc/ship.js.map +1 -1
- package/dist/adapters/trpc/trpc.d.ts +43 -17
- package/dist/adapters/trpc/trpc.js +131 -31
- package/dist/adapters/trpc/trpc.js.map +1 -1
- package/dist/app.d.ts +2 -0
- package/dist/app.js +22 -0
- package/dist/app.js.map +1 -1
- package/dist/config.d.ts +5 -0
- package/dist/config.js +3 -1
- package/dist/config.js.map +1 -1
- package/dist/domain/identity/authenticate-account.d.ts +35 -0
- package/dist/domain/identity/authenticate-account.js +54 -0
- package/dist/domain/identity/authenticate-account.js.map +1 -0
- package/dist/domain/identity/authenticate-installation.d.ts +23 -0
- package/dist/domain/identity/authenticate-installation.js +20 -0
- package/dist/domain/identity/authenticate-installation.js.map +1 -0
- package/dist/domain/identity/authenticate.d.ts +2 -2
- package/dist/domain/identity/console-session.d.ts +6 -3
- package/dist/domain/identity/console-session.js.map +1 -1
- package/dist/domain/identity/cut-off-account.d.ts +29 -0
- package/dist/domain/identity/cut-off-account.js +37 -0
- package/dist/domain/identity/cut-off-account.js.map +1 -0
- package/dist/domain/identity/dismiss-notice.d.ts +2 -2
- package/dist/domain/identity/issue-sign-in-ticket.d.ts +9 -3
- package/dist/domain/identity/issue-sign-in-ticket.js +8 -2
- package/dist/domain/identity/issue-sign-in-ticket.js.map +1 -1
- package/dist/domain/identity/ports.d.ts +52 -5
- package/dist/domain/identity/read-account.d.ts +8 -4
- package/dist/domain/identity/read-account.js +1 -1
- package/dist/domain/identity/read-account.js.map +1 -1
- package/dist/domain/identity/read-guide.d.ts +2 -2
- package/dist/domain/identity/read-notices.d.ts +2 -2
- package/dist/domain/identity/record-guide-progress.d.ts +2 -2
- package/dist/domain/identity/redeem-sign-in-ticket.d.ts +2 -1
- package/dist/domain/identity/redeem-sign-in-ticket.js +3 -2
- package/dist/domain/identity/redeem-sign-in-ticket.js.map +1 -1
- package/dist/domain/identity/set-theme.d.ts +2 -2
- package/dist/domain/identity/sign-in-ticket.d.ts +3 -1
- package/dist/domain/identity/sign-in.d.ts +2 -2
- package/dist/domain/identity/sign-in.js +2 -0
- package/dist/domain/identity/sign-in.js.map +1 -1
- package/dist/domain/identity/sign-out.d.ts +2 -2
- package/dist/domain/identity/sign-out.js +1 -1
- package/dist/domain/identity/sign-out.js.map +1 -1
- package/dist/domain/identity/start-console-session.d.ts +4 -2
- package/dist/domain/identity/start-console-session.js +6 -4
- package/dist/domain/identity/start-console-session.js.map +1 -1
- package/dist/domain/identity/start-viewer-session.js +1 -0
- package/dist/domain/identity/start-viewer-session.js.map +1 -1
- package/dist/domain/messaging/delivery.d.ts +11 -3
- package/dist/domain/messaging/delivery.js +23 -15
- package/dist/domain/messaging/delivery.js.map +1 -1
- package/dist/domain/messaging/dismiss-delivery.d.ts +2 -2
- package/dist/domain/messaging/hand-over-delivery.d.ts +1 -0
- package/dist/domain/messaging/hand-over-delivery.js +1 -0
- package/dist/domain/messaging/hand-over-delivery.js.map +1 -1
- package/dist/domain/messaging/message.d.ts +3 -1
- package/dist/domain/messaging/message.js +1 -1
- package/dist/domain/messaging/message.js.map +1 -1
- package/dist/domain/messaging/overdue.d.ts +2 -0
- package/dist/domain/messaging/overdue.js +3 -0
- package/dist/domain/messaging/overdue.js.map +1 -1
- package/dist/domain/messaging/ping-ship.d.ts +2 -2
- package/dist/domain/messaging/ping-ship.js +1 -1
- package/dist/domain/messaging/ping-ship.js.map +1 -1
- package/dist/domain/messaging/ports.d.ts +2 -0
- package/dist/domain/messaging/push-receive-deliveries.d.ts +4 -1
- package/dist/domain/messaging/push-receive-deliveries.js +5 -3
- package/dist/domain/messaging/push-receive-deliveries.js.map +1 -1
- package/dist/domain/messaging/receive-deliveries.d.ts +21 -0
- package/dist/domain/messaging/receive-deliveries.js +5 -3
- package/dist/domain/messaging/receive-deliveries.js.map +1 -1
- package/dist/domain/messaging/receive-reply.d.ts +32 -0
- package/dist/domain/messaging/receive-reply.js +25 -0
- package/dist/domain/messaging/receive-reply.js.map +1 -0
- package/dist/domain/messaging/resend-delivery.d.ts +2 -2
- package/dist/domain/messaging/resend-delivery.js +1 -0
- package/dist/domain/messaging/resend-delivery.js.map +1 -1
- package/dist/domain/messaging/send-message.d.ts +3 -3
- package/dist/domain/messaging/send-message.js +1 -0
- package/dist/domain/messaging/send-message.js.map +1 -1
- package/dist/domain/registry/apply-network-rules.d.ts +32 -0
- package/dist/domain/registry/apply-network-rules.js +33 -0
- package/dist/domain/registry/apply-network-rules.js.map +1 -0
- package/dist/domain/registry/assign-crew.d.ts +2 -2
- package/dist/domain/registry/assign-crew.js +3 -2
- package/dist/domain/registry/assign-crew.js.map +1 -1
- package/dist/domain/registry/assign-label.d.ts +7 -5
- package/dist/domain/registry/assign-label.js +16 -6
- package/dist/domain/registry/assign-label.js.map +1 -1
- package/dist/domain/registry/change-label-values.d.ts +1 -1
- package/dist/domain/registry/change-label-values.js +4 -3
- package/dist/domain/registry/change-label-values.js.map +1 -1
- package/dist/domain/registry/check-reach.d.ts +49 -24
- package/dist/domain/registry/check-reach.js +77 -42
- package/dist/domain/registry/check-reach.js.map +1 -1
- package/dist/domain/registry/clear-request.d.ts +1 -1
- package/dist/domain/registry/clear-request.js +1 -1
- package/dist/domain/registry/clear-request.js.map +1 -1
- package/dist/domain/registry/commission-ship.d.ts +26 -13
- package/dist/domain/registry/commission-ship.js +199 -22
- package/dist/domain/registry/commission-ship.js.map +1 -1
- package/dist/domain/registry/confirm-crew-release.d.ts +2 -2
- package/dist/domain/registry/confirm-crew-release.js +3 -2
- package/dist/domain/registry/confirm-crew-release.js.map +1 -1
- package/dist/domain/registry/confirm-worktree-cleared.d.ts +2 -2
- package/dist/domain/registry/confirm-worktree-cleared.js +3 -2
- package/dist/domain/registry/confirm-worktree-cleared.js.map +1 -1
- package/dist/domain/registry/connect-plugin.d.ts +31 -0
- package/dist/domain/registry/connect-plugin.js +34 -0
- package/dist/domain/registry/connect-plugin.js.map +1 -0
- package/dist/domain/registry/crew-request.d.ts +2 -2
- package/dist/domain/registry/crew-request.js.map +1 -1
- package/dist/domain/registry/declare-network-rules.d.ts +9 -6
- package/dist/domain/registry/declare-network-rules.js +13 -8
- package/dist/domain/registry/declare-network-rules.js.map +1 -1
- package/dist/domain/registry/declare-scopes.d.ts +2 -2
- package/dist/domain/registry/declared-network-rules.d.ts +30 -21
- package/dist/domain/registry/declared-network-rules.js +46 -22
- package/dist/domain/registry/declared-network-rules.js.map +1 -1
- package/dist/domain/registry/define-label.d.ts +1 -1
- package/dist/domain/registry/define-label.js +5 -5
- package/dist/domain/registry/define-label.js.map +1 -1
- package/dist/domain/registry/delete-label.d.ts +1 -1
- package/dist/domain/registry/delete-label.js +4 -3
- package/dist/domain/registry/delete-label.js.map +1 -1
- package/dist/domain/registry/discard-network-rules-draft.d.ts +23 -0
- package/dist/domain/registry/discard-network-rules-draft.js +24 -0
- package/dist/domain/registry/discard-network-rules-draft.js.map +1 -0
- package/dist/domain/registry/discover.d.ts +12 -10
- package/dist/domain/registry/discover.js +11 -5
- package/dist/domain/registry/discover.js.map +1 -1
- package/dist/domain/registry/explain-crew-request.d.ts +2 -2
- package/dist/domain/registry/explain-crew-request.js +3 -2
- package/dist/domain/registry/explain-crew-request.js.map +1 -1
- package/dist/domain/registry/explain-reach.d.ts +22 -14
- package/dist/domain/registry/explain-reach.js +53 -53
- package/dist/domain/registry/explain-reach.js.map +1 -1
- package/dist/domain/registry/get-ship.d.ts +2 -2
- package/dist/domain/registry/get-starting-prompt.d.ts +4 -2
- package/dist/domain/registry/get-starting-prompt.js +7 -5
- package/dist/domain/registry/get-starting-prompt.js.map +1 -1
- package/dist/domain/registry/give-back-crew-request.d.ts +2 -2
- package/dist/domain/registry/give-back-crew-request.js +3 -2
- package/dist/domain/registry/give-back-crew-request.js.map +1 -1
- package/dist/domain/registry/grant-scopes.d.ts +8 -5
- package/dist/domain/registry/grant-scopes.js +14 -5
- package/dist/domain/registry/grant-scopes.js.map +1 -1
- package/dist/domain/registry/label.d.ts +69 -18
- package/dist/domain/registry/label.js +79 -28
- package/dist/domain/registry/label.js.map +1 -1
- package/dist/domain/registry/lease.d.ts +1 -1
- package/dist/domain/registry/leases.d.ts +6 -3
- package/dist/domain/registry/leases.js +7 -5
- package/dist/domain/registry/leases.js.map +1 -1
- package/dist/domain/registry/list-fleet.d.ts +2 -0
- package/dist/domain/registry/list-fleet.js +1 -0
- package/dist/domain/registry/list-fleet.js.map +1 -1
- package/dist/domain/registry/list-scopes.d.ts +2 -1
- package/dist/domain/registry/list-scopes.js +2 -1
- package/dist/domain/registry/list-scopes.js.map +1 -1
- package/dist/domain/registry/managed-or-assigned.d.ts +12 -4
- package/dist/domain/registry/managed-or-assigned.js +25 -7
- package/dist/domain/registry/managed-or-assigned.js.map +1 -1
- package/dist/domain/registry/network-rules-draft.d.ts +45 -0
- package/dist/domain/registry/network-rules-draft.js +41 -0
- package/dist/domain/registry/network-rules-draft.js.map +1 -0
- package/dist/domain/registry/network-settings.d.ts +96 -115
- package/dist/domain/registry/network-settings.js +101 -150
- package/dist/domain/registry/network-settings.js.map +1 -1
- package/dist/domain/registry/plugin-connection.d.ts +48 -0
- package/dist/domain/registry/plugin-connection.js +35 -0
- package/dist/domain/registry/plugin-connection.js.map +1 -0
- package/dist/domain/registry/ports.d.ts +60 -12
- package/dist/domain/registry/reach-refusal.d.ts +18 -4
- package/dist/domain/registry/read-assigned-crew-requests.d.ts +2 -2
- package/dist/domain/registry/read-built-in-rules.d.ts +5 -4
- package/dist/domain/registry/read-built-in-rules.js +9 -7
- package/dist/domain/registry/read-built-in-rules.js.map +1 -1
- package/dist/domain/registry/read-clear-requests.d.ts +2 -2
- package/dist/domain/registry/read-clear-requests.js.map +1 -1
- package/dist/domain/registry/read-declared-network-rules.d.ts +5 -5
- package/dist/domain/registry/read-declared-network-rules.js +4 -4
- package/dist/domain/registry/read-declared-network-rules.js.map +1 -1
- package/dist/domain/registry/read-network-rules-draft-changes.d.ts +22 -0
- package/dist/domain/registry/read-network-rules-draft-changes.js +53 -0
- package/dist/domain/registry/read-network-rules-draft-changes.js.map +1 -0
- package/dist/domain/registry/read-network-rules.d.ts +30 -0
- package/dist/domain/registry/read-network-rules.js +18 -0
- package/dist/domain/registry/read-network-rules.js.map +1 -0
- package/dist/domain/registry/read-on-behalf.d.ts +3 -3
- package/dist/domain/registry/read-on-behalf.js.map +1 -1
- package/dist/domain/registry/read-reach-refusals.d.ts +6 -5
- package/dist/domain/registry/read-reach-refusals.js +13 -8
- package/dist/domain/registry/read-reach-refusals.js.map +1 -1
- package/dist/domain/registry/read-reach.d.ts +10 -10
- package/dist/domain/registry/read-reach.js +26 -16
- package/dist/domain/registry/read-reach.js.map +1 -1
- package/dist/domain/registry/recrew-ship.d.ts +2 -2
- package/dist/domain/registry/recrew-ship.js +5 -3
- package/dist/domain/registry/recrew-ship.js.map +1 -1
- package/dist/domain/registry/release-ship.d.ts +7 -4
- package/dist/domain/registry/release-ship.js +8 -4
- package/dist/domain/registry/release-ship.js.map +1 -1
- package/dist/domain/registry/remove-crew-request.d.ts +2 -2
- package/dist/domain/registry/remove-crew-request.js +4 -3
- package/dist/domain/registry/remove-crew-request.js.map +1 -1
- package/dist/domain/registry/rename-ship.d.ts +1 -1
- package/dist/domain/registry/rename-ship.js +4 -3
- package/dist/domain/registry/rename-ship.js.map +1 -1
- package/dist/domain/registry/report-crew-status.d.ts +2 -2
- package/dist/domain/registry/report-crew-status.js +3 -2
- package/dist/domain/registry/report-crew-status.js.map +1 -1
- package/dist/domain/registry/request-crew.d.ts +3 -3
- package/dist/domain/registry/request-crew.js +4 -3
- package/dist/domain/registry/request-crew.js.map +1 -1
- package/dist/domain/registry/request-worktree-clear.d.ts +2 -2
- package/dist/domain/registry/request-worktree-clear.js +4 -3
- package/dist/domain/registry/request-worktree-clear.js.map +1 -1
- package/dist/domain/registry/retire-ship.d.ts +17 -12
- package/dist/domain/registry/retire-ship.js +30 -21
- package/dist/domain/registry/retire-ship.js.map +1 -1
- package/dist/domain/registry/save-network-rules-draft.d.ts +31 -0
- package/dist/domain/registry/save-network-rules-draft.js +27 -0
- package/dist/domain/registry/save-network-rules-draft.js.map +1 -0
- package/dist/domain/registry/scope-grant.d.ts +19 -19
- package/dist/domain/registry/scope-grant.js +8 -9
- package/dist/domain/registry/scope-grant.js.map +1 -1
- package/dist/domain/registry/set-built-in-rule.d.ts +3 -3
- package/dist/domain/registry/set-built-in-rule.js +5 -9
- package/dist/domain/registry/set-built-in-rule.js.map +1 -1
- package/dist/domain/registry/set-owner.d.ts +9 -6
- package/dist/domain/registry/set-owner.js +14 -8
- package/dist/domain/registry/set-owner.js.map +1 -1
- package/dist/domain/registry/set-verified-facts.d.ts +36 -0
- package/dist/domain/registry/set-verified-facts.js +58 -0
- package/dist/domain/registry/set-verified-facts.js.map +1 -0
- package/dist/domain/registry/ship.d.ts +55 -17
- package/dist/domain/registry/ship.js +107 -16
- package/dist/domain/registry/ship.js.map +1 -1
- package/dist/domain/registry/statement.d.ts +2 -2
- package/dist/domain/registry/statement.js +2 -2
- package/dist/domain/registry/statement.js.map +1 -1
- package/dist/domain/registry/turn.d.ts +2 -2
- package/dist/domain/registry/turn.js +2 -2
- package/dist/domain/registry/turn.js.map +1 -1
- package/dist/domain/registry/unassign-label.d.ts +8 -5
- package/dist/domain/registry/unassign-label.js +17 -6
- package/dist/domain/registry/unassign-label.js.map +1 -1
- package/dist/domain/registry/verified-facts.d.ts +75 -0
- package/dist/domain/registry/verified-facts.js +107 -0
- package/dist/domain/registry/verified-facts.js.map +1 -0
- package/dist/domain/registry/whoami.d.ts +2 -2
- package/dist/domain/shared/caller.d.ts +40 -6
- package/dist/domain/shared/caller.js +20 -0
- package/dist/domain/shared/caller.js.map +1 -1
- package/dist/domain/shared/delivery-way.d.ts +9 -5
- package/dist/domain/shared/delivery-way.js +17 -5
- package/dist/domain/shared/delivery-way.js.map +1 -1
- package/dist/domain/shared/errors.d.ts +1 -1
- package/dist/domain/shared/errors.js.map +1 -1
- package/dist/domain/shared/events.d.ts +13 -2
- package/dist/domain/shared/events.js.map +1 -1
- package/dist/domain/shared/health.d.ts +3 -1
- package/dist/domain/shared/health.js +5 -3
- package/dist/domain/shared/health.js.map +1 -1
- package/dist/domain/shared/history.d.ts +5 -1
- package/dist/domain/shared/history.js.map +1 -1
- package/dist/domain/shared/read-fleet-limits.d.ts +2 -2
- package/dist/domain/shared/read-health.d.ts +4 -3
- package/dist/domain/shared/read-health.js +9 -3
- package/dist/domain/shared/read-health.js.map +1 -1
- package/dist/domain/shared/read-inbox.d.ts +2 -2
- package/dist/domain/shared/read-message.d.ts +2 -2
- package/dist/domain/shared/read-needs-attention.d.ts +2 -2
- package/dist/domain/shared/read-sent-message.d.ts +31 -0
- package/dist/domain/shared/read-sent-message.js +28 -0
- package/dist/domain/shared/read-sent-message.js.map +1 -0
- package/dist/domain/shared/read-ship-messages.d.ts +2 -2
- package/dist/domain/shared/read-ship-timeline.d.ts +2 -2
- package/dist/domain/shared/read-ship-way.d.ts +2 -2
- package/dist/domain/shared/read-ship-way.js +1 -1
- package/dist/domain/shared/read-ship-way.js.map +1 -1
- package/dist/domain/shared/stuck.js +4 -2
- package/dist/domain/shared/stuck.js.map +1 -1
- package/dist/start.js +1 -0
- package/dist/start.js.map +1 -1
- package/dist/testing/account-token-issuer.d.ts +30 -0
- package/dist/testing/account-token-issuer.js +48 -0
- package/dist/testing/account-token-issuer.js.map +1 -0
- package/dist/testing/container-images.d.ts +14 -0
- package/dist/testing/container-images.js +18 -0
- package/dist/testing/container-images.js.map +1 -0
- package/dist/testing/database.d.ts +14 -0
- package/dist/testing/database.js +48 -0
- package/dist/testing/database.js.map +1 -0
- package/dist/testing/fleet.d.ts +13 -0
- package/dist/testing/fleet.js +17 -0
- package/dist/testing/fleet.js.map +1 -0
- package/dist/testing/index.d.ts +12 -0
- package/dist/testing/index.js +12 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/keys.d.ts +1 -0
- package/dist/testing/keys.js +7 -0
- package/dist/testing/keys.js.map +1 -0
- package/dist/testing/migrate-lock.d.ts +12 -0
- package/dist/testing/migrate-lock.js +51 -0
- package/dist/testing/migrate-lock.js.map +1 -0
- package/dist/testing/migrated-template.d.ts +12 -0
- package/dist/testing/migrated-template.js +29 -0
- package/dist/testing/migrated-template.js.map +1 -0
- package/dist/testing/postgres-container.d.ts +16 -0
- package/dist/testing/postgres-container.js +30 -0
- package/dist/testing/postgres-container.js.map +1 -0
- package/dist/testing/postgres-global-setup.d.ts +15 -0
- package/dist/testing/postgres-global-setup.js +20 -0
- package/dist/testing/postgres-global-setup.js.map +1 -0
- package/dist/testing/prisma-cli.d.ts +5 -0
- package/dist/testing/prisma-cli.js +15 -0
- package/dist/testing/prisma-cli.js.map +1 -0
- package/dist/testing/result.d.ts +5 -0
- package/dist/testing/result.js +15 -0
- package/dist/testing/result.js.map +1 -0
- package/dist/wiring.d.ts +27 -6
- package/dist/wiring.js +44 -11
- package/dist/wiring.js.map +1 -1
- package/package.json +26 -3
- package/src/adapters/prisma/migrations/20261018250000_scope_catalogue/migration.sql +8 -7
- package/src/adapters/prisma/migrations/20261019100000_on_behalf_scope/migration.sql +3 -1
- package/src/adapters/prisma/migrations/20261019130000_plugin_connections/migration.sql +54 -0
- package/src/adapters/prisma/migrations/20261019150000_network_plugin_registered_at/migration.sql +23 -0
- package/src/adapters/prisma/migrations/20261019160000_lease_waker/migration.sql +4 -0
- package/src/adapters/prisma/migrations/20261019200000_account_cut_offs/migration.sql +10 -0
- package/src/adapters/prisma/migrations/20261019210000_event_actors/migration.sql +32 -0
- package/src/adapters/prisma/migrations/20261020090000_argos_jobs_as_scopes/migration.sql +65 -0
- package/src/adapters/prisma/migrations/20261020100000_installation_labels/migration.sql +7 -0
- package/src/adapters/prisma/migrations/20261020110000_installation_declared_network_rules/migration.sql +10 -0
- package/src/adapters/prisma/migrations/20261020120000_commissioning_actors/migration.sql +14 -0
- package/src/adapters/prisma/migrations/20261020130000_console_sign_in_accounts/migration.sql +4 -0
- package/src/adapters/prisma/migrations/20261020140000_event_signed_in_accounts/migration.sql +4 -0
- package/src/adapters/prisma/migrations/20261020150000_account_cut_off_ends_console_sessions/migration.sql +2 -0
- package/src/adapters/prisma/migrations/20261020160000_network_in_core/migration.sql +30 -0
- package/src/adapters/prisma/migrations/20261020170000_verify_scope/migration.sql +64 -0
- package/src/adapters/prisma/migrations/20261020180000_verified_facts/migration.sql +21 -0
- package/src/adapters/prisma/migrations/20261020190000_verified_facts_by_writer/migration.sql +3 -0
- package/src/adapters/prisma/schema.prisma +160 -22
- package/dist/domain/registry/register-network-plugin.d.ts +0 -28
- package/dist/domain/registry/register-network-plugin.js +0 -26
- package/dist/domain/registry/register-network-plugin.js.map +0 -1
- package/dist/domain/registry/set-network-rules.d.ts +0 -31
- package/dist/domain/registry/set-network-rules.js +0 -27
- package/dist/domain/registry/set-network-rules.js.map +0 -1
- package/dist/domain/registry/unregister-network-plugin.d.ts +0 -27
- package/dist/domain/registry/unregister-network-plugin.js +0 -25
- package/dist/domain/registry/unregister-network-plugin.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeolus-fleet/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "The Aeolus fleet server: ships, guaranteed delivery and the API for Claude Code, Codex and any agent.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
|
@@ -23,9 +23,16 @@
|
|
|
23
23
|
},
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
-
"@aeolus-fleet/source": "./src/index.ts",
|
|
27
26
|
"types": "./dist/index.d.ts",
|
|
28
27
|
"default": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./testing": {
|
|
30
|
+
"types": "./dist/testing/index.d.ts",
|
|
31
|
+
"default": "./dist/testing/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./testing/postgres-global-setup": {
|
|
34
|
+
"types": "./dist/testing/postgres-global-setup.d.ts",
|
|
35
|
+
"default": "./dist/testing/postgres-global-setup.js"
|
|
29
36
|
}
|
|
30
37
|
},
|
|
31
38
|
"bin": {
|
|
@@ -51,7 +58,7 @@
|
|
|
51
58
|
"postpack": "rm LICENSE"
|
|
52
59
|
},
|
|
53
60
|
"dependencies": {
|
|
54
|
-
"@aeolus-fleet/common": "0.
|
|
61
|
+
"@aeolus-fleet/common": "0.28.0",
|
|
55
62
|
"@fastify/websocket": "^11.3.1",
|
|
56
63
|
"@modelcontextprotocol/server": "^2.3.0",
|
|
57
64
|
"@prisma/adapter-pg": "^7.10.0",
|
|
@@ -63,6 +70,22 @@
|
|
|
63
70
|
"prisma": "^7.10.0",
|
|
64
71
|
"zod": "^4.6.5"
|
|
65
72
|
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"@testcontainers/postgresql": "^12.2.0",
|
|
75
|
+
"testcontainers": "^12.2.0",
|
|
76
|
+
"vitest": "^5.0.3"
|
|
77
|
+
},
|
|
78
|
+
"peerDependenciesMeta": {
|
|
79
|
+
"@testcontainers/postgresql": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"testcontainers": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"vitest": {
|
|
86
|
+
"optional": true
|
|
87
|
+
}
|
|
88
|
+
},
|
|
66
89
|
"devDependencies": {
|
|
67
90
|
"@modelcontextprotocol/client": "^2.2.0",
|
|
68
91
|
"@testcontainers/postgresql": "^12.2.0",
|
|
@@ -10,8 +10,9 @@ CREATE OR REPLACE FUNCTION "ships_scopes_are_known"("scopes" TEXT[]) RETURNS BOO
|
|
|
10
10
|
$$;
|
|
11
11
|
|
|
12
12
|
-- Each holder keeps what it did within the new bounds: every active ship holding fleet:manage also gets
|
|
13
|
-
-- fleet:commission and messages:resend, and each active plugin ship
|
|
14
|
-
--
|
|
13
|
+
-- fleet:commission and messages:resend, and each active plugin ship holds exactly its set, losing what the
|
|
14
|
+
-- set leaves out. A plugin's ship is known by its name and type together, as the console connects it: types
|
|
15
|
+
-- are not reserved, so another ship of that type keeps what it holds. Scopes stay in catalogue order, a plugin's own after them. Every ship it
|
|
15
16
|
-- changes gets one ScopesChanged, by the system, naming what it added and took away, at the next number of
|
|
16
17
|
-- its fleet's stream, with an evt_ id as common/src/ids makes them (the time in milliseconds, then 80 random
|
|
17
18
|
-- bits, in lowercase Crockford base32).
|
|
@@ -29,14 +30,14 @@ DECLARE
|
|
|
29
30
|
next_seq bigint;
|
|
30
31
|
BEGIN
|
|
31
32
|
FOR ship IN
|
|
32
|
-
SELECT "id", "fleet_id", "type", "scopes" FROM "ships"
|
|
33
|
-
WHERE "retired_at" IS NULL AND ("type" IN ('squadrons', 'trierarch-plugin') OR 'fleet:manage' = ANY("scopes"))
|
|
33
|
+
SELECT "id", "fleet_id", "name", "type", "scopes" FROM "ships"
|
|
34
|
+
WHERE "retired_at" IS NULL AND ("name" = "type" AND "type" IN ('squadrons', 'trierarch-plugin') OR 'fleet:manage' = ANY("scopes"))
|
|
34
35
|
ORDER BY "fleet_id", "id"
|
|
35
36
|
FOR UPDATE
|
|
36
37
|
LOOP
|
|
37
|
-
wanted := CASE ship."type"
|
|
38
|
-
WHEN 'squadrons' THEN ARRAY['messages:send', 'messages:receive', 'fleet:read', 'fleet:commission', 'fleet:manage', 'labels:define', 'labels:assign', 'scopes:declare']
|
|
39
|
-
WHEN 'trierarch-plugin' THEN ARRAY['messages:send', 'messages:receive', 'fleet:read', 'fleet:commission', 'crew:assign', 'crew:run', 'labels:define', 'labels:assign']
|
|
38
|
+
wanted := CASE ship."name" || '/' || ship."type"
|
|
39
|
+
WHEN 'squadrons/squadrons' THEN ARRAY['messages:send', 'messages:receive', 'fleet:read', 'fleet:commission', 'fleet:manage', 'labels:define', 'labels:assign', 'scopes:declare']
|
|
40
|
+
WHEN 'trierarch-plugin/trierarch-plugin' THEN ARRAY['messages:send', 'messages:receive', 'fleet:read', 'fleet:commission', 'crew:assign', 'crew:run', 'labels:define', 'labels:assign']
|
|
40
41
|
ELSE ship."scopes" || ARRAY['fleet:commission', 'messages:resend']
|
|
41
42
|
END;
|
|
42
43
|
SELECT array_agg("scope" ORDER BY coalesce(array_position(catalogue, "scope"), cardinality(catalogue) + 1), "first_at") INTO wanted
|
|
@@ -11,6 +11,8 @@ $$;
|
|
|
11
11
|
|
|
12
12
|
-- argo holds every scope, and squadrons reads on behalf of a person's ship (decision 0017): every argo and every
|
|
13
13
|
-- active squadrons ship gets fleet:on-behalf, its scopes kept in catalogue order, a plugin's own after them.
|
|
14
|
+
-- Squadrons' ship is known by its name and type together, as the console connects it: types are not reserved,
|
|
15
|
+
-- so another ship of type squadrons keeps what it holds.
|
|
14
16
|
-- Every state change writes its event: each ship it changes gets
|
|
15
17
|
-- ScopesChanged, by the system, taking the next number of its fleet's stream. Its id is an evt_ id as
|
|
16
18
|
-- common/src/ids makes them: the time in milliseconds, then 80 random bits, in lowercase Crockford base32.
|
|
@@ -29,7 +31,7 @@ BEGIN
|
|
|
29
31
|
SELECT array_agg("scope" ORDER BY coalesce(array_position(catalogue, "scope"), cardinality(catalogue) + 1), "place")
|
|
30
32
|
FROM unnest(array_append("ships"."scopes", 'fleet:on-behalf')) WITH ORDINALITY AS u("scope", "place")
|
|
31
33
|
)
|
|
32
|
-
WHERE ("kind" = 'operator' OR "type" = 'squadrons') AND "retired_at" IS NULL AND NOT ('fleet:on-behalf' = ANY("scopes"))
|
|
34
|
+
WHERE ("kind" = 'operator' OR ("name" = 'squadrons' AND "type" = 'squadrons')) AND "retired_at" IS NULL AND NOT ('fleet:on-behalf' = ANY("scopes"))
|
|
33
35
|
RETURNING "fleet_id", "id"
|
|
34
36
|
LOOP
|
|
35
37
|
at := clock_timestamp();
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
-- A plugin argo connected (decision 0034): its ship reads every ship of the fleet, whatever the rules, until a
|
|
2
|
+
-- release or a retire of the ship ends it.
|
|
3
|
+
-- CreateTable
|
|
4
|
+
CREATE TABLE "plugin_connections" (
|
|
5
|
+
"fleet_id" TEXT NOT NULL,
|
|
6
|
+
"ship_id" TEXT NOT NULL,
|
|
7
|
+
"connected_at" TIMESTAMPTZ(3) NOT NULL,
|
|
8
|
+
|
|
9
|
+
CONSTRAINT "plugin_connections_pkey" PRIMARY KEY ("fleet_id","ship_id")
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
-- AddForeignKey
|
|
13
|
+
ALTER TABLE "plugin_connections" ADD CONSTRAINT "plugin_connections_fleet_id_fkey" FOREIGN KEY ("fleet_id") REFERENCES "fleets"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
14
|
+
|
|
15
|
+
-- AddForeignKey
|
|
16
|
+
ALTER TABLE "plugin_connections" ADD CONSTRAINT "plugin_connections_fleet_id_ship_id_fkey" FOREIGN KEY ("fleet_id", "ship_id") REFERENCES "ships"("fleet_id", "id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
17
|
+
|
|
18
|
+
-- The plugins argo connected before: every active ship the console connects a plugin as, known by its name and type
|
|
19
|
+
-- together (squadrons, the trierarch plugin, the networking plugin), is connected now. Each gets PluginConnected, by
|
|
20
|
+
-- the system, at the next number of its fleet's stream, with an evt_ id as common/src/ids makes them (the time in
|
|
21
|
+
-- milliseconds, then 80 random bits, in lowercase Crockford base32).
|
|
22
|
+
DO $$
|
|
23
|
+
DECLARE
|
|
24
|
+
alphabet CONSTANT text := '0123456789abcdefghjkmnpqrstvwxyz';
|
|
25
|
+
plugin record;
|
|
26
|
+
at timestamptz;
|
|
27
|
+
millis bigint;
|
|
28
|
+
body text;
|
|
29
|
+
next_seq bigint;
|
|
30
|
+
BEGIN
|
|
31
|
+
FOR plugin IN
|
|
32
|
+
SELECT "id", "fleet_id" FROM "ships"
|
|
33
|
+
WHERE "retired_at" IS NULL AND "name" = "type" AND "type" IN ('squadrons', 'trierarch-plugin', 'networking-plugin')
|
|
34
|
+
ORDER BY "fleet_id", "id"
|
|
35
|
+
LOOP
|
|
36
|
+
at := clock_timestamp();
|
|
37
|
+
INSERT INTO "plugin_connections" ("fleet_id", "ship_id", "connected_at") VALUES (plugin."fleet_id", plugin."id", at);
|
|
38
|
+
|
|
39
|
+
millis := floor(extract(epoch FROM at) * 1000)::bigint;
|
|
40
|
+
body := '';
|
|
41
|
+
FOR position IN REVERSE 9..0 LOOP
|
|
42
|
+
body := body || substr(alphabet, ((millis >> (position * 5)) & 31)::integer + 1, 1);
|
|
43
|
+
END LOOP;
|
|
44
|
+
FOR position IN 1..16 LOOP
|
|
45
|
+
body := body || substr(alphabet, floor(random() * 32)::integer + 1, 1);
|
|
46
|
+
END LOOP;
|
|
47
|
+
|
|
48
|
+
UPDATE "fleets" SET "last_event_seq" = "last_event_seq" + 1 WHERE "id" = plugin."fleet_id"
|
|
49
|
+
RETURNING "last_event_seq" INTO next_seq;
|
|
50
|
+
INSERT INTO "events" ("id", "fleet_id", "type", "occurred_at", "ship_id", "details", "seq")
|
|
51
|
+
VALUES ('evt_' || body, plugin."fleet_id", 'PluginConnected', at, plugin."id", '{}'::jsonb, next_seq);
|
|
52
|
+
END LOOP;
|
|
53
|
+
END;
|
|
54
|
+
$$;
|
package/src/adapters/prisma/migrations/20261019150000_network_plugin_registered_at/migration.sql
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
-- When the fleet's networking plugin first registered (decision 0035), set
|
|
2
|
+
-- with its ship and declaration, all four or none. A plugin registered before
|
|
3
|
+
-- this column takes the time of its first NetworkPluginRegistered event since
|
|
4
|
+
-- the fleet's latest NetworkPluginUnregistered (a retirement writes one too).
|
|
5
|
+
ALTER TABLE "network_settings" ADD COLUMN "plugin_registered_at" TIMESTAMPTZ(3);
|
|
6
|
+
|
|
7
|
+
UPDATE "network_settings" AS s
|
|
8
|
+
SET "plugin_registered_at" = COALESCE(
|
|
9
|
+
(SELECT min(e."occurred_at") FROM "events" e
|
|
10
|
+
WHERE e."fleet_id" = s."fleet_id" AND e."type" = 'NetworkPluginRegistered' AND e."ship_id" = s."plugin_ship_id"
|
|
11
|
+
AND e."occurred_at" > COALESCE(
|
|
12
|
+
(SELECT max(u."occurred_at") FROM "events" u WHERE u."fleet_id" = s."fleet_id" AND u."type" = 'NetworkPluginUnregistered'),
|
|
13
|
+
'-infinity')),
|
|
14
|
+
now())
|
|
15
|
+
WHERE s."plugin_ship_id" IS NOT NULL;
|
|
16
|
+
|
|
17
|
+
ALTER TABLE "network_settings"
|
|
18
|
+
DROP CONSTRAINT "network_settings_plugin_whole",
|
|
19
|
+
ADD CONSTRAINT "network_settings_plugin_whole" CHECK (
|
|
20
|
+
("plugin_ship_id" IS NULL) = ("plugin_while_unavailable" IS NULL)
|
|
21
|
+
AND ("plugin_ship_id" IS NULL) = ("plugin_not_responding_after_seconds" IS NULL)
|
|
22
|
+
AND ("plugin_ship_id" IS NULL) = ("plugin_registered_at" IS NULL)
|
|
23
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
-- The accounts pagasae cut off, kept until their last token has ended (decision 0058).
|
|
2
|
+
CREATE TABLE "account_cut_offs" (
|
|
3
|
+
"account_id" TEXT NOT NULL,
|
|
4
|
+
"cut_off_at" TIMESTAMPTZ(3) NOT NULL,
|
|
5
|
+
"forget_at" TIMESTAMPTZ(3) NOT NULL,
|
|
6
|
+
|
|
7
|
+
CONSTRAINT "account_cut_offs_pkey" PRIMARY KEY ("account_id")
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
CREATE INDEX "account_cut_offs_forget_at_idx" ON "account_cut_offs"("forget_at");
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
-- Every event names its actor (decision 0057): a ship, an account by its id
|
|
2
|
+
-- only with the ship it came through, the installation, or the system.
|
|
3
|
+
CREATE TYPE "event_actor_kind" AS ENUM ('ship', 'account', 'installation', 'system');
|
|
4
|
+
|
|
5
|
+
ALTER TABLE "events" ADD COLUMN "actor_kind" "event_actor_kind",
|
|
6
|
+
ADD COLUMN "actor_account_id" TEXT,
|
|
7
|
+
ADD COLUMN "actor_through_ship_id" TEXT;
|
|
8
|
+
|
|
9
|
+
-- Naming the actor of the events already written, a ship or the system, is
|
|
10
|
+
-- the one exception to append-only events, so the guard is off for this
|
|
11
|
+
-- statement alone.
|
|
12
|
+
ALTER TABLE "events" DISABLE TRIGGER "events_append_only";
|
|
13
|
+
|
|
14
|
+
UPDATE "events" SET "actor_kind" = CASE WHEN "actor_ship_id" IS NULL THEN 'system'::"event_actor_kind" ELSE 'ship'::"event_actor_kind" END;
|
|
15
|
+
|
|
16
|
+
ALTER TABLE "events" ENABLE TRIGGER "events_append_only";
|
|
17
|
+
|
|
18
|
+
-- An event that names no actor is the system's, as every migration that writes events writes them.
|
|
19
|
+
ALTER TABLE "events" ALTER COLUMN "actor_kind" SET NOT NULL, ALTER COLUMN "actor_kind" SET DEFAULT 'system';
|
|
20
|
+
|
|
21
|
+
-- A ship actor has its ship, an account its id and maybe the ship it came through, the others neither.
|
|
22
|
+
ALTER TABLE "events" ADD CONSTRAINT "events_actor_named" CHECK (
|
|
23
|
+
("actor_ship_id" IS NOT NULL) = ("actor_kind" = 'ship')
|
|
24
|
+
AND ("actor_account_id" IS NOT NULL) = ("actor_kind" = 'account')
|
|
25
|
+
AND ("actor_through_ship_id" IS NULL OR "actor_kind" = 'account')
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
-- Led by the ship, not the fleet: almost every row has none, and an index led
|
|
29
|
+
-- by the fleet would tempt the planner off (fleet_id, occurred_at).
|
|
30
|
+
CREATE INDEX "events_actor_through_ship_id_fleet_id_idx" ON "events"("actor_through_ship_id", "fleet_id");
|
|
31
|
+
|
|
32
|
+
ALTER TABLE "events" ADD CONSTRAINT "events_fleet_id_actor_through_ship_id_fkey" FOREIGN KEY ("fleet_id", "actor_through_ship_id") REFERENCES "ships"("fleet_id", "id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
-- The jobs that were argo's alone become scopes any actor can be granted (decision 0053): fleet:person,
|
|
2
|
+
-- fleet:owner, fleet:explain, fleet:connect and labels:any join the core scopes (decision 0046).
|
|
3
|
+
CREATE OR REPLACE FUNCTION "ships_scopes_are_known"("scopes" TEXT[]) RETURNS BOOLEAN IMMUTABLE LANGUAGE SQL AS $$
|
|
4
|
+
SELECT "scopes" IS NOT NULL AND NOT EXISTS (
|
|
5
|
+
SELECT 1 FROM unnest("scopes") AS "scope"
|
|
6
|
+
WHERE NOT (
|
|
7
|
+
"scope" = ANY(ARRAY['messages:send', 'messages:receive', 'messages:force', 'messages:resend', 'fleet:read', 'fleet:commission', 'fleet:manage', 'crew:assign', 'crew:run', 'labels:define', 'labels:assign', 'fleet:network', 'fleet:on-behalf', 'fleet:person', 'fleet:owner', 'fleet:explain', 'fleet:connect', 'labels:any', 'scopes:declare', 'scopes:grant']::TEXT[])
|
|
8
|
+
OR ("scope" ~ '^[a-z][a-z0-9-]{0,31}:[a-z][a-z0-9-]{0,31}$' AND split_part("scope", ':', 1) <> ALL(ARRAY['messages', 'fleet', 'crew', 'labels', 'scopes']::TEXT[]))
|
|
9
|
+
)
|
|
10
|
+
)
|
|
11
|
+
$$;
|
|
12
|
+
|
|
13
|
+
-- argo holds every scope: every argo gets the five, its scopes kept in catalogue order, a plugin's own after
|
|
14
|
+
-- them. Every state change writes its event: each argo it changes gets ScopesChanged, by the system, taking
|
|
15
|
+
-- the next number of its fleet's stream. Its id is an evt_ id as common/src/ids makes them: the time in
|
|
16
|
+
-- milliseconds, then 80 random bits, in lowercase Crockford base32.
|
|
17
|
+
DO $$
|
|
18
|
+
DECLARE
|
|
19
|
+
alphabet CONSTANT text := '0123456789abcdefghjkmnpqrstvwxyz';
|
|
20
|
+
catalogue CONSTANT text[] := ARRAY['messages:send', 'messages:receive', 'messages:force', 'messages:resend', 'fleet:read', 'fleet:commission', 'fleet:manage', 'crew:assign', 'crew:run', 'labels:define', 'labels:assign', 'fleet:network', 'fleet:on-behalf', 'fleet:person', 'fleet:owner', 'fleet:explain', 'fleet:connect', 'labels:any', 'scopes:declare', 'scopes:grant'];
|
|
21
|
+
jobs CONSTANT text[] := ARRAY['fleet:person', 'fleet:owner', 'fleet:explain', 'fleet:connect', 'labels:any'];
|
|
22
|
+
changed record;
|
|
23
|
+
at timestamptz;
|
|
24
|
+
millis bigint;
|
|
25
|
+
body text;
|
|
26
|
+
next_seq bigint;
|
|
27
|
+
BEGIN
|
|
28
|
+
FOR changed IN
|
|
29
|
+
WITH "before" AS (
|
|
30
|
+
SELECT "id", "scopes" FROM "ships" WHERE "kind" = 'operator' AND NOT ("scopes" @> jobs) FOR UPDATE
|
|
31
|
+
)
|
|
32
|
+
UPDATE "ships" SET "scopes" = (
|
|
33
|
+
SELECT array_agg("scope" ORDER BY coalesce(array_position(catalogue, "scope"), cardinality(catalogue) + 1), "place")
|
|
34
|
+
FROM unnest("ships"."scopes" || ARRAY(SELECT "job" FROM unnest(jobs) AS "job" WHERE NOT ("job" = ANY("ships"."scopes")))) WITH ORDINALITY AS u("scope", "place")
|
|
35
|
+
)
|
|
36
|
+
FROM "before"
|
|
37
|
+
WHERE "ships"."id" = "before"."id"
|
|
38
|
+
RETURNING "ships"."fleet_id", "ships"."id",
|
|
39
|
+
array_to_string(ARRAY(SELECT "job" FROM unnest(jobs) AS "job" WHERE NOT ("job" = ANY("before"."scopes"))), ' ') AS "added"
|
|
40
|
+
LOOP
|
|
41
|
+
at := clock_timestamp();
|
|
42
|
+
millis := floor(extract(epoch FROM at) * 1000)::bigint;
|
|
43
|
+
body := '';
|
|
44
|
+
FOR position IN REVERSE 9..0 LOOP
|
|
45
|
+
body := body || substr(alphabet, ((millis >> (position * 5)) & 31)::integer + 1, 1);
|
|
46
|
+
END LOOP;
|
|
47
|
+
FOR position IN 1..16 LOOP
|
|
48
|
+
body := body || substr(alphabet, floor(random() * 32)::integer + 1, 1);
|
|
49
|
+
END LOOP;
|
|
50
|
+
|
|
51
|
+
UPDATE "fleets" SET "last_event_seq" = "last_event_seq" + 1 WHERE "id" = changed."fleet_id"
|
|
52
|
+
RETURNING "last_event_seq" INTO next_seq;
|
|
53
|
+
INSERT INTO "events" ("id", "fleet_id", "type", "occurred_at", "ship_id", "details", "seq")
|
|
54
|
+
VALUES (
|
|
55
|
+
'evt_' || body,
|
|
56
|
+
changed."fleet_id",
|
|
57
|
+
'ScopesChanged',
|
|
58
|
+
at,
|
|
59
|
+
changed."id",
|
|
60
|
+
jsonb_build_object('added', changed."added", 'removed', ''),
|
|
61
|
+
next_seq
|
|
62
|
+
);
|
|
63
|
+
END LOOP;
|
|
64
|
+
END;
|
|
65
|
+
$$;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- A label belongs to the actor that defined it: a ship, or the installation (decision 0031), which defines
|
|
2
|
+
-- the label group in each fleet (decision 0052). An installation's label names no owner ship.
|
|
3
|
+
CREATE TYPE "label_owner_kind" AS ENUM ('ship', 'installation');
|
|
4
|
+
|
|
5
|
+
ALTER TABLE "labels" ADD COLUMN "owner_kind" "label_owner_kind" NOT NULL DEFAULT 'ship';
|
|
6
|
+
ALTER TABLE "labels" ALTER COLUMN "owner_ship_id" DROP NOT NULL;
|
|
7
|
+
ALTER TABLE "labels" ADD CONSTRAINT "labels_owner_named" CHECK (("owner_ship_id" IS NOT NULL) = ("owner_kind" = 'ship'));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
-- The network rules the installation declares on the labels it owns, such as group=# to group=# (decisions 0037, 0052):
|
|
2
|
+
-- one row per fleet while it declares any, apart from the ships' declared rules, as it is no ship.
|
|
3
|
+
CREATE TABLE "installation_declared_network_rules" (
|
|
4
|
+
"fleet_id" TEXT NOT NULL,
|
|
5
|
+
"rules" JSONB NOT NULL,
|
|
6
|
+
|
|
7
|
+
CONSTRAINT "installation_declared_network_rules_pkey" PRIMARY KEY ("fleet_id")
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
ALTER TABLE "installation_declared_network_rules" ADD CONSTRAINT "installation_declared_network_rules_fleet_id_fkey" FOREIGN KEY ("fleet_id") REFERENCES "fleets"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- A ship is commissioned by an actor (decisions 0053, 0057): a ship, an account by its id only, or the installation,
|
|
2
|
+
-- which commissions person ships. commissioned_by names it: the ship's id, the account's id, or 'installation'.
|
|
3
|
+
-- Every commission so far was a ship's. An idempotency key is used once per commissioning actor.
|
|
4
|
+
CREATE TYPE "commissioner_kind" AS ENUM ('ship', 'account', 'installation');
|
|
5
|
+
|
|
6
|
+
ALTER TABLE "ships" ADD COLUMN "commissioned_by_kind" "commissioner_kind";
|
|
7
|
+
UPDATE "ships" SET "commissioned_by_kind" = 'ship' WHERE "commissioned_by" IS NOT NULL;
|
|
8
|
+
ALTER TABLE "ships" ADD CONSTRAINT "ships_commissioner_named" CHECK (
|
|
9
|
+
("commissioned_by" IS NULL) = ("commissioned_by_kind" IS NULL)
|
|
10
|
+
AND ("commissioned_by_kind" <> 'installation' OR "commissioned_by" = 'installation')
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
DROP INDEX "ships_fleet_id_commissioned_by_commission_key_key";
|
|
14
|
+
CREATE UNIQUE INDEX "ships_commission_key_key" ON "ships"("fleet_id", "commissioned_by_kind", "commissioned_by", "commission_key");
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
-- A sign-in ticket from pagasae may name the account it signs in as argo, by its id only, never its email
|
|
2
|
+
-- (decisions 0054, 0058); the console session it starts keeps that id. Null for argo's own sign-in and a viewer.
|
|
3
|
+
ALTER TABLE "sign_in_tickets" ADD COLUMN "account_id" TEXT;
|
|
4
|
+
ALTER TABLE "console_sessions" ADD COLUMN "account_id" TEXT;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
-- An event argo writes names the account signed in to the console as it, by its id only (decision 0054).
|
|
2
|
+
-- Earlier events name none.
|
|
3
|
+
ALTER TABLE "events" ADD COLUMN "actor_signed_in_account_id" TEXT;
|
|
4
|
+
ALTER TABLE "events" ADD CONSTRAINT "events_signed_in_account_by_a_ship" CHECK ("actor_signed_in_account_id" IS NULL OR "actor_kind" = 'ship');
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
-- Network rules live in core (decision 0034): the networking plugin goes.
|
|
2
|
+
-- A fleet's own rules are a list, or NULL while none are applied: all-to-all,
|
|
3
|
+
-- open on. A fleet whose open was on for send had no rules in force beside
|
|
4
|
+
-- the built-in ones, so it keeps none; any other keeps its list.
|
|
5
|
+
UPDATE "network_settings" SET "rules" = NULL WHERE "built_in_open_send";
|
|
6
|
+
ALTER TABLE "network_settings" ALTER COLUMN "rules" DROP NOT NULL, ALTER COLUMN "rules" DROP DEFAULT;
|
|
7
|
+
|
|
8
|
+
ALTER TABLE "network_settings"
|
|
9
|
+
DROP CONSTRAINT IF EXISTS "network_settings_plugin_whole",
|
|
10
|
+
DROP COLUMN "built_in_open_send",
|
|
11
|
+
DROP COLUMN "built_in_open_read",
|
|
12
|
+
DROP COLUMN "built_in_open_manage",
|
|
13
|
+
DROP COLUMN "plugin_ship_id",
|
|
14
|
+
DROP COLUMN "plugin_while_unavailable",
|
|
15
|
+
DROP COLUMN "plugin_not_responding_after_seconds",
|
|
16
|
+
DROP COLUMN "plugin_registered_at";
|
|
17
|
+
|
|
18
|
+
ALTER TABLE "reach_refusals" DROP COLUMN "while_plugin_unavailable";
|
|
19
|
+
|
|
20
|
+
-- The draft of a fleet's own rules: one a fleet at most, never in force.
|
|
21
|
+
CREATE TABLE "network_rules_drafts" (
|
|
22
|
+
"fleet_id" TEXT NOT NULL,
|
|
23
|
+
"rules" JSONB,
|
|
24
|
+
"saved_at" TIMESTAMPTZ(3) NOT NULL,
|
|
25
|
+
"saved_against_version" INTEGER NOT NULL,
|
|
26
|
+
|
|
27
|
+
CONSTRAINT "network_rules_drafts_pkey" PRIMARY KEY ("fleet_id")
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
ALTER TABLE "network_rules_drafts" ADD CONSTRAINT "network_rules_drafts_fleet_id_fkey" FOREIGN KEY ("fleet_id") REFERENCES "fleets"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
-- fleet:verify, writing verified facts about the ships an actor manages, joins the core scopes (decisions 0046, 0059).
|
|
2
|
+
CREATE OR REPLACE FUNCTION "ships_scopes_are_known"("scopes" TEXT[]) RETURNS BOOLEAN IMMUTABLE LANGUAGE SQL AS $$
|
|
3
|
+
SELECT "scopes" IS NOT NULL AND NOT EXISTS (
|
|
4
|
+
SELECT 1 FROM unnest("scopes") AS "scope"
|
|
5
|
+
WHERE NOT (
|
|
6
|
+
"scope" = ANY(ARRAY['messages:send', 'messages:receive', 'messages:force', 'messages:resend', 'fleet:read', 'fleet:commission', 'fleet:manage', 'crew:assign', 'crew:run', 'labels:define', 'labels:assign', 'fleet:network', 'fleet:on-behalf', 'fleet:person', 'fleet:owner', 'fleet:explain', 'fleet:connect', 'labels:any', 'fleet:verify', 'scopes:declare', 'scopes:grant']::TEXT[])
|
|
7
|
+
OR ("scope" ~ '^[a-z][a-z0-9-]{0,31}:[a-z][a-z0-9-]{0,31}$' AND split_part("scope", ':', 1) <> ALL(ARRAY['messages', 'fleet', 'crew', 'labels', 'scopes']::TEXT[]))
|
|
8
|
+
)
|
|
9
|
+
)
|
|
10
|
+
$$;
|
|
11
|
+
|
|
12
|
+
-- argo holds every scope: every argo gets fleet:verify, its scopes kept in catalogue order, a plugin's own after
|
|
13
|
+
-- them. Every state change writes its event: each argo it changes gets ScopesChanged, by the system, taking
|
|
14
|
+
-- the next number of its fleet's stream. Its id is an evt_ id as common/src/ids makes them: the time in
|
|
15
|
+
-- milliseconds, then 80 random bits, in lowercase Crockford base32.
|
|
16
|
+
DO $$
|
|
17
|
+
DECLARE
|
|
18
|
+
alphabet CONSTANT text := '0123456789abcdefghjkmnpqrstvwxyz';
|
|
19
|
+
catalogue CONSTANT text[] := ARRAY['messages:send', 'messages:receive', 'messages:force', 'messages:resend', 'fleet:read', 'fleet:commission', 'fleet:manage', 'crew:assign', 'crew:run', 'labels:define', 'labels:assign', 'fleet:network', 'fleet:on-behalf', 'fleet:person', 'fleet:owner', 'fleet:explain', 'fleet:connect', 'labels:any', 'fleet:verify', 'scopes:declare', 'scopes:grant'];
|
|
20
|
+
jobs CONSTANT text[] := ARRAY['fleet:verify'];
|
|
21
|
+
changed record;
|
|
22
|
+
at timestamptz;
|
|
23
|
+
millis bigint;
|
|
24
|
+
body text;
|
|
25
|
+
next_seq bigint;
|
|
26
|
+
BEGIN
|
|
27
|
+
FOR changed IN
|
|
28
|
+
WITH "before" AS (
|
|
29
|
+
SELECT "id", "scopes" FROM "ships" WHERE "kind" = 'operator' AND NOT ("scopes" @> jobs) FOR UPDATE
|
|
30
|
+
)
|
|
31
|
+
UPDATE "ships" SET "scopes" = (
|
|
32
|
+
SELECT array_agg("scope" ORDER BY coalesce(array_position(catalogue, "scope"), cardinality(catalogue) + 1), "place")
|
|
33
|
+
FROM unnest("ships"."scopes" || ARRAY(SELECT "job" FROM unnest(jobs) AS "job" WHERE NOT ("job" = ANY("ships"."scopes")))) WITH ORDINALITY AS u("scope", "place")
|
|
34
|
+
)
|
|
35
|
+
FROM "before"
|
|
36
|
+
WHERE "ships"."id" = "before"."id"
|
|
37
|
+
RETURNING "ships"."fleet_id", "ships"."id",
|
|
38
|
+
array_to_string(ARRAY(SELECT "job" FROM unnest(jobs) AS "job" WHERE NOT ("job" = ANY("before"."scopes"))), ' ') AS "added"
|
|
39
|
+
LOOP
|
|
40
|
+
at := clock_timestamp();
|
|
41
|
+
millis := floor(extract(epoch FROM at) * 1000)::bigint;
|
|
42
|
+
body := '';
|
|
43
|
+
FOR position IN REVERSE 9..0 LOOP
|
|
44
|
+
body := body || substr(alphabet, ((millis >> (position * 5)) & 31)::integer + 1, 1);
|
|
45
|
+
END LOOP;
|
|
46
|
+
FOR position IN 1..16 LOOP
|
|
47
|
+
body := body || substr(alphabet, floor(random() * 32)::integer + 1, 1);
|
|
48
|
+
END LOOP;
|
|
49
|
+
|
|
50
|
+
UPDATE "fleets" SET "last_event_seq" = "last_event_seq" + 1 WHERE "id" = changed."fleet_id"
|
|
51
|
+
RETURNING "last_event_seq" INTO next_seq;
|
|
52
|
+
INSERT INTO "events" ("id", "fleet_id", "type", "occurred_at", "ship_id", "details", "seq")
|
|
53
|
+
VALUES (
|
|
54
|
+
'evt_' || body,
|
|
55
|
+
changed."fleet_id",
|
|
56
|
+
'ScopesChanged',
|
|
57
|
+
at,
|
|
58
|
+
changed."id",
|
|
59
|
+
jsonb_build_object('added', changed."added", 'removed', ''),
|
|
60
|
+
next_seq
|
|
61
|
+
);
|
|
62
|
+
END LOOP;
|
|
63
|
+
END;
|
|
64
|
+
$$;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- One writer's verified facts about a ship (decision 0059): what it checked, set whole and kept with the ship.
|
|
2
|
+
-- CreateEnum
|
|
3
|
+
CREATE TYPE "fact_writer_kind" AS ENUM ('ship', 'account', 'installation');
|
|
4
|
+
|
|
5
|
+
-- CreateTable
|
|
6
|
+
CREATE TABLE "verified_facts" (
|
|
7
|
+
"fleet_id" TEXT NOT NULL,
|
|
8
|
+
"ship_id" TEXT NOT NULL,
|
|
9
|
+
"writer_kind" "fact_writer_kind" NOT NULL,
|
|
10
|
+
"writer" TEXT NOT NULL,
|
|
11
|
+
"facts" JSONB NOT NULL,
|
|
12
|
+
"written_at" TIMESTAMPTZ(3) NOT NULL,
|
|
13
|
+
|
|
14
|
+
CONSTRAINT "verified_facts_pkey" PRIMARY KEY ("fleet_id","ship_id","writer_kind","writer")
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
-- AddForeignKey
|
|
18
|
+
ALTER TABLE "verified_facts" ADD CONSTRAINT "verified_facts_fleet_id_fkey" FOREIGN KEY ("fleet_id") REFERENCES "fleets"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
19
|
+
|
|
20
|
+
-- AddForeignKey
|
|
21
|
+
ALTER TABLE "verified_facts" ADD CONSTRAINT "verified_facts_fleet_id_ship_id_fkey" FOREIGN KEY ("fleet_id", "ship_id") REFERENCES "ships"("fleet_id", "id") ON DELETE RESTRICT ON UPDATE CASCADE;
|