@cortexkit/opencode-antigravity-auth 3.0.5 → 3.0.6
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 +38 -352
- package/dist/cli.js +9199 -8799
- package/dist/cli.js.map +4 -4
- package/dist/cli.meta.json +1286 -1064
- package/dist/index.js +13641 -14559
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +1333 -1342
- package/dist/server.js +10618 -11080
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/auth-method-labels.d.ts +3 -0
- package/dist/src/auth-method-labels.d.ts.map +1 -0
- package/dist/src/auth-method-labels.js +5 -0
- package/dist/src/auth-method-labels.js.map +1 -0
- package/dist/src/cli.d.ts +3 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +98 -12
- package/dist/src/cli.js.map +1 -1
- package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +33 -3
- package/dist/src/common-auth-embedded/claustrum/consumer.js +96 -1
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +4 -1
- package/dist/src/common-auth-embedded/claustrum/enrollment.d.ts +6 -1
- package/dist/src/common-auth-embedded/claustrum/enrollment.js +6 -1
- package/dist/src/common-auth-embedded/claustrum/index.d.ts +2 -1
- package/dist/src/common-auth-embedded/claustrum/index.js +5 -3
- package/dist/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
- package/dist/src/common-auth-embedded/claustrum/insula.js +152 -0
- package/dist/src/common-auth-embedded/claustrum/roster.d.ts +13 -0
- package/dist/src/common-auth-embedded/claustrum/roster.js +33 -3
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +20 -11
- package/dist/src/common-auth-embedded/quota/codec.d.ts +2 -0
- package/dist/src/common-auth-embedded/quota/codec.js +2 -1
- package/dist/src/common-auth-embedded/quota/format.d.ts +26 -0
- package/dist/src/common-auth-embedded/quota/format.js +78 -42
- package/dist/src/common-auth-embedded/quota/index.d.ts +4 -4
- package/dist/src/common-auth-embedded/quota/index.js +2 -2
- package/dist/src/common-auth-embedded/quota/map.d.ts +11 -0
- package/dist/src/common-auth-embedded/quota/map.js +36 -1
- package/dist/src/common-auth-embedded/quota/merge.d.ts +3 -1
- package/dist/src/common-auth-embedded/quota/merge.js +21 -5
- package/dist/src/common-auth-embedded/quota/projection.d.ts +2 -1
- package/dist/src/common-auth-embedded/quota/projection.js +3 -1
- package/dist/src/common-auth-embedded/setup/command-runner.js +49 -0
- package/dist/src/common-auth-embedded/setup/command.d.ts +3 -0
- package/dist/src/common-auth-embedded/setup/command.js +215 -0
- package/dist/src/common-auth-embedded/setup/config-write.js +60 -0
- package/dist/src/common-auth-embedded/setup/detect.d.ts +6 -0
- package/dist/src/common-auth-embedded/setup/detect.js +224 -0
- package/dist/src/common-auth-embedded/setup/enroll.js +70 -0
- package/dist/src/common-auth-embedded/setup/index.d.ts +5 -0
- package/dist/src/common-auth-embedded/setup/index.js +4 -0
- package/dist/src/common-auth-embedded/setup/paths.js +33 -0
- package/dist/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
- package/dist/src/common-auth-embedded/setup/process-fence.js +270 -0
- package/dist/src/common-auth-embedded/setup/prompts.js +26 -0
- package/dist/src/common-auth-embedded/setup/register.d.ts +11 -0
- package/dist/src/common-auth-embedded/setup/register.js +130 -0
- package/dist/src/common-auth-embedded/setup/types.d.ts +136 -0
- package/dist/src/common-auth-embedded/source-output.json +228 -80
- package/dist/src/common-auth-embedded/store/schema.d.ts +2 -0
- package/dist/src/common-auth-embedded/store/schema.js +3 -2
- package/dist/src/ga/rpc/protocol.d.ts +4 -7
- package/dist/src/ga/rpc/protocol.d.ts.map +1 -1
- package/dist/src/ga/rpc/protocol.js +5 -13
- package/dist/src/ga/rpc/protocol.js.map +1 -1
- package/dist/src/ga/server/auth.d.ts +8 -3
- package/dist/src/ga/server/auth.d.ts.map +1 -1
- package/dist/src/ga/server/auth.js +25 -9
- package/dist/src/ga/server/auth.js.map +1 -1
- package/dist/src/ga/server/index.d.ts +39 -12
- package/dist/src/ga/server/index.d.ts.map +1 -1
- package/dist/src/ga/server/index.js +214 -53
- package/dist/src/ga/server/index.js.map +1 -1
- package/dist/src/ga/server/pool-login.d.ts +22 -0
- package/dist/src/ga/server/pool-login.d.ts.map +1 -0
- package/dist/src/ga/server/pool-login.js +150 -0
- package/dist/src/ga/server/pool-login.js.map +1 -0
- package/dist/src/ga/tui/host-ga.d.ts +2 -5
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
- package/dist/src/ga/tui/host-ga.js +17 -49
- package/dist/src/ga/tui/host-ga.js.map +1 -1
- package/dist/src/plugin/accounts.d.ts +1 -1
- package/dist/src/plugin/accounts.d.ts.map +1 -1
- package/dist/src/plugin/accounts.js +1 -0
- package/dist/src/plugin/accounts.js.map +1 -1
- package/dist/src/plugin/background-vault-quota-refresh.d.ts +2 -0
- package/dist/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
- package/dist/src/plugin/background-vault-quota-refresh.js +125 -10
- package/dist/src/plugin/background-vault-quota-refresh.js.map +1 -1
- package/dist/src/plugin/command-apply.d.ts +2 -2
- package/dist/src/plugin/command-apply.d.ts.map +1 -1
- package/dist/src/plugin/command-apply.js +3 -10
- package/dist/src/plugin/command-apply.js.map +1 -1
- package/dist/src/plugin/commands.d.ts +1 -0
- package/dist/src/plugin/commands.d.ts.map +1 -1
- package/dist/src/plugin/commands.js +2 -2
- package/dist/src/plugin/commands.js.map +1 -1
- package/dist/src/plugin/config/operator-settings-schema.d.ts +0 -4
- package/dist/src/plugin/config/operator-settings-schema.d.ts.map +1 -1
- package/dist/src/plugin/config/operator-settings-schema.js +0 -5
- package/dist/src/plugin/config/operator-settings-schema.js.map +1 -1
- package/dist/src/plugin/config/schema.d.ts +0 -7
- package/dist/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/src/plugin/config/schema.js +0 -43
- package/dist/src/plugin/config/schema.js.map +1 -1
- package/dist/src/plugin/config/writer.d.ts +1 -1
- package/dist/src/plugin/config/writer.js +1 -1
- package/dist/src/plugin/fetch/retry-state.d.ts +19 -3
- package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -1
- package/dist/src/plugin/fetch/retry-state.js +0 -6
- package/dist/src/plugin/fetch/retry-state.js.map +1 -1
- package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/src/plugin/fetch-interceptor.js +0 -3
- package/dist/src/plugin/fetch-interceptor.js.map +1 -1
- package/dist/src/plugin/fetch-routing.d.ts +0 -16
- package/dist/src/plugin/fetch-routing.d.ts.map +1 -1
- package/dist/src/plugin/fetch-routing.js +0 -49
- package/dist/src/plugin/fetch-routing.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts +14 -9
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +120 -40
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/google-origin.d.ts +7 -0
- package/dist/src/plugin/google-origin.d.ts.map +1 -0
- package/dist/src/plugin/google-origin.js +14 -0
- package/dist/src/plugin/google-origin.js.map +1 -0
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +15 -4
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/oauth-methods.d.ts.map +1 -1
- package/dist/src/plugin/oauth-methods.js +0 -33
- package/dist/src/plugin/oauth-methods.js.map +1 -1
- package/dist/src/plugin/operator-settings.d.ts +1 -1
- package/dist/src/plugin/operator-settings.d.ts.map +1 -1
- package/dist/src/plugin/operator-settings.js +1 -8
- package/dist/src/plugin/operator-settings.js.map +1 -1
- package/dist/src/plugin/quota.d.ts +11 -7
- package/dist/src/plugin/quota.d.ts.map +1 -1
- package/dist/src/plugin/quota.js +128 -102
- package/dist/src/plugin/quota.js.map +1 -1
- package/dist/src/plugin/request.d.ts +5 -3
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +87 -168
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/server.d.ts.map +1 -1
- package/dist/src/plugin/server.js +60 -53
- package/dist/src/plugin/server.js.map +1 -1
- package/dist/src/plugin/shared/advisory-repository.d.ts +20 -0
- package/dist/src/plugin/shared/advisory-repository.d.ts.map +1 -0
- package/dist/src/plugin/shared/advisory-repository.js +91 -0
- package/dist/src/plugin/shared/advisory-repository.js.map +1 -0
- package/dist/src/plugin/shared/request-services.d.ts +19 -25
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +105 -188
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/src/plugin/shared/runtime.js +4 -2
- package/dist/src/plugin/shared/runtime.js.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +4 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +41 -7
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
- package/dist/src/plugin/storage.d.ts +2 -2
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/src/plugin/vault-custody.js +147 -35
- package/dist/src/plugin/vault-custody.js.map +1 -1
- package/dist/src/plugin/vault-quota-outcome.d.ts +19 -0
- package/dist/src/plugin/vault-quota-outcome.d.ts.map +1 -0
- package/dist/src/plugin/vault-quota-outcome.js +47 -0
- package/dist/src/plugin/vault-quota-outcome.js.map +1 -0
- package/dist/src/quota-presentation.d.ts +29 -1
- package/dist/src/quota-presentation.d.ts.map +1 -1
- package/dist/src/quota-presentation.js +52 -17
- package/dist/src/quota-presentation.js.map +1 -1
- package/dist/src/setup.d.ts +15 -0
- package/dist/src/setup.d.ts.map +1 -0
- package/dist/src/setup.js +320 -0
- package/dist/src/setup.js.map +1 -0
- package/dist/src/sidebar-projection.d.ts +1 -1
- package/dist/src/sidebar-projection.d.ts.map +1 -1
- package/dist/src/sidebar-state.d.ts +1 -1
- package/dist/src/sidebar-state.d.ts.map +1 -1
- package/dist/src/sidebar-state.js +19 -1
- package/dist/src/sidebar-state.js.map +1 -1
- package/dist/src/tui.d.ts.map +1 -1
- package/dist/src/tui.js +205 -110
- package/dist/src/tui.js.map +1 -1
- package/dist/tui-build-map.json +37 -37
- package/dist/tui-ga-build-map.json +33 -33
- package/dist/types/src/auth-method-labels.d.ts +3 -0
- package/dist/types/src/auth-method-labels.d.ts.map +1 -0
- package/dist/types/src/cli.d.ts +3 -1
- package/dist/types/src/cli.d.ts.map +1 -1
- package/dist/types/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
- package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +132 -0
- package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +178 -0
- package/dist/types/src/common-auth-embedded/claustrum/enrollment.d.ts +164 -0
- package/dist/types/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
- package/dist/types/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
- package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +19 -0
- package/dist/types/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
- package/dist/types/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
- package/dist/types/src/common-auth-embedded/claustrum/roster.d.ts +221 -0
- package/dist/types/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
- package/dist/types/src/common-auth-embedded/opencode2/index.d.ts +8 -0
- package/dist/types/src/common-auth-embedded/opencode2/install.d.ts +55 -0
- package/dist/types/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
- package/dist/types/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
- package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +413 -0
- package/dist/types/src/common-auth-embedded/quota/codec.d.ts +2 -0
- package/dist/types/src/common-auth-embedded/quota/format.d.ts +26 -0
- package/dist/types/src/common-auth-embedded/quota/index.d.ts +4 -4
- package/dist/types/src/common-auth-embedded/quota/map.d.ts +11 -0
- package/dist/types/src/common-auth-embedded/quota/merge.d.ts +3 -1
- package/dist/types/src/common-auth-embedded/quota/projection.d.ts +2 -1
- package/dist/types/src/common-auth-embedded/routing/admission.d.ts +93 -0
- package/dist/types/src/common-auth-embedded/routing/index.d.ts +8 -0
- package/dist/types/src/common-auth-embedded/routing/ordered.d.ts +47 -0
- package/dist/types/src/common-auth-embedded/routing/pins.d.ts +22 -0
- package/dist/types/src/common-auth-embedded/routing/sticky.d.ts +158 -0
- package/dist/types/src/common-auth-embedded/setup/command.d.ts +3 -0
- package/dist/types/src/common-auth-embedded/setup/detect.d.ts +6 -0
- package/dist/types/src/common-auth-embedded/setup/index.d.ts +5 -0
- package/dist/types/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
- package/dist/types/src/common-auth-embedded/setup/register.d.ts +11 -0
- package/dist/types/src/common-auth-embedded/setup/types.d.ts +136 -0
- package/dist/types/src/common-auth-embedded/store/schema.d.ts +2 -0
- package/dist/types/src/ga/rpc/protocol.d.ts +4 -7
- package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -1
- package/dist/types/src/ga/server/auth.d.ts +8 -3
- package/dist/types/src/ga/server/auth.d.ts.map +1 -1
- package/dist/types/src/ga/server/index.d.ts +39 -12
- package/dist/types/src/ga/server/index.d.ts.map +1 -1
- package/dist/types/src/ga/server/pool-login.d.ts +22 -0
- package/dist/types/src/ga/server/pool-login.d.ts.map +1 -0
- package/dist/types/src/plugin/accounts.d.ts +1 -1
- package/dist/types/src/plugin/accounts.d.ts.map +1 -1
- package/dist/types/src/plugin/background-vault-quota-refresh.d.ts +2 -0
- package/dist/types/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
- package/dist/types/src/plugin/command-apply.d.ts +2 -2
- package/dist/types/src/plugin/command-apply.d.ts.map +1 -1
- package/dist/types/src/plugin/commands.d.ts +1 -0
- package/dist/types/src/plugin/commands.d.ts.map +1 -1
- package/dist/types/src/plugin/config/operator-settings-schema.d.ts +0 -4
- package/dist/types/src/plugin/config/operator-settings-schema.d.ts.map +1 -1
- package/dist/types/src/plugin/config/schema.d.ts +0 -7
- package/dist/types/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/types/src/plugin/config/writer.d.ts +1 -1
- package/dist/types/src/plugin/fetch/retry-state.d.ts +19 -3
- package/dist/types/src/plugin/fetch/retry-state.d.ts.map +1 -1
- package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/types/src/plugin/fetch-routing.d.ts +0 -16
- package/dist/types/src/plugin/fetch-routing.d.ts.map +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts +14 -9
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/google-origin.d.ts +7 -0
- package/dist/types/src/plugin/google-origin.d.ts.map +1 -0
- package/dist/types/src/plugin/index.d.ts.map +1 -1
- package/dist/types/src/plugin/oauth-methods.d.ts.map +1 -1
- package/dist/types/src/plugin/operator-settings.d.ts +1 -1
- package/dist/types/src/plugin/operator-settings.d.ts.map +1 -1
- package/dist/types/src/plugin/quota.d.ts +11 -7
- package/dist/types/src/plugin/quota.d.ts.map +1 -1
- package/dist/types/src/plugin/request.d.ts +5 -3
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/server.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/advisory-repository.d.ts +20 -0
- package/dist/types/src/plugin/shared/advisory-repository.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/request-services.d.ts +19 -25
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +4 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/types/src/plugin/storage.d.ts +2 -2
- package/dist/types/src/plugin/storage.d.ts.map +1 -1
- package/dist/types/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/types/src/plugin/vault-quota-outcome.d.ts +19 -0
- package/dist/types/src/plugin/vault-quota-outcome.d.ts.map +1 -0
- package/dist/types/src/setup.d.ts +15 -0
- package/dist/types/src/setup.d.ts.map +1 -0
- package/dist/types/src/sidebar-state.d.ts +1 -1
- package/dist/types/src/sidebar-state.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/common-auth-embedded/claustrum/consumer.d.ts +33 -3
- package/src/common-auth-embedded/claustrum/consumer.js +96 -1
- package/src/common-auth-embedded/claustrum/custody.d.ts +4 -1
- package/src/common-auth-embedded/claustrum/enrollment.d.ts +6 -1
- package/src/common-auth-embedded/claustrum/enrollment.js +6 -1
- package/src/common-auth-embedded/claustrum/index.d.ts +2 -1
- package/src/common-auth-embedded/claustrum/index.js +5 -3
- package/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
- package/src/common-auth-embedded/claustrum/insula.js +152 -0
- package/src/common-auth-embedded/claustrum/roster.d.ts +13 -0
- package/src/common-auth-embedded/claustrum/roster.js +33 -3
- package/src/common-auth-embedded/fs/refresh-file-lock.js +20 -11
- package/src/common-auth-embedded/quota/codec.d.ts +2 -0
- package/src/common-auth-embedded/quota/codec.js +2 -1
- package/src/common-auth-embedded/quota/format.d.ts +26 -0
- package/src/common-auth-embedded/quota/format.js +78 -42
- package/src/common-auth-embedded/quota/index.d.ts +4 -4
- package/src/common-auth-embedded/quota/index.js +2 -2
- package/src/common-auth-embedded/quota/map.d.ts +11 -0
- package/src/common-auth-embedded/quota/map.js +36 -1
- package/src/common-auth-embedded/quota/merge.d.ts +3 -1
- package/src/common-auth-embedded/quota/merge.js +21 -5
- package/src/common-auth-embedded/quota/projection.d.ts +2 -1
- package/src/common-auth-embedded/quota/projection.js +3 -1
- package/src/common-auth-embedded/setup/command-runner.js +49 -0
- package/src/common-auth-embedded/setup/command.d.ts +3 -0
- package/src/common-auth-embedded/setup/command.js +215 -0
- package/src/common-auth-embedded/setup/config-write.js +60 -0
- package/src/common-auth-embedded/setup/detect.d.ts +6 -0
- package/src/common-auth-embedded/setup/detect.js +224 -0
- package/src/common-auth-embedded/setup/enroll.js +70 -0
- package/src/common-auth-embedded/setup/index.d.ts +5 -0
- package/src/common-auth-embedded/setup/index.js +4 -0
- package/src/common-auth-embedded/setup/paths.js +33 -0
- package/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
- package/src/common-auth-embedded/setup/process-fence.js +270 -0
- package/src/common-auth-embedded/setup/prompts.js +26 -0
- package/src/common-auth-embedded/setup/register.d.ts +11 -0
- package/src/common-auth-embedded/setup/register.js +130 -0
- package/src/common-auth-embedded/setup/types.d.ts +136 -0
- package/src/common-auth-embedded/source-output.json +228 -80
- package/src/common-auth-embedded/store/schema.d.ts +2 -0
- package/src/common-auth-embedded/store/schema.js +3 -2
- package/src/sidebar-state.ts +19 -2
- package/src/tui-compiled/common-auth-embedded/quota/codec.js +2 -1
- package/src/tui-compiled/common-auth-embedded/quota/format.js +78 -42
- package/src/tui-compiled/common-auth-embedded/quota/index.js +2 -2
- package/src/tui-compiled/common-auth-embedded/quota/map.js +36 -1
- package/src/tui-compiled/common-auth-embedded/quota/merge.js +21 -5
- package/src/tui-compiled/common-auth-embedded/quota/projection.js +3 -1
- package/src/tui-compiled/quota-presentation.js +42 -9
- package/src/tui-compiled/sidebar-state.js +15 -1
- package/src/tui-compiled/tui.js +516 -334
- package/src/tui-ga-compiled/host-ga.js +11 -38
- package/src/tui-ga-compiled/shared/1ff34afa7c42d196-projection.js +3 -1
- package/src/tui-ga-compiled/shared/77138df80c7ae006-map.js +36 -1
- package/src/tui-ga-compiled/shared/98cc0c186c46c42d-quota-presentation.js +42 -9
- package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +78 -42
- package/src/tui-ga-compiled/shared/bf17cbee28e58197-index.js +2 -2
- package/src/tui-ga-compiled/shared/ca21dc417b36dc5d-codec.js +2 -1
- package/src/tui-ga-compiled/shared/ecc214300932dfb6-merge.js +21 -5
- package/src/tui-ga-raw/host-ga.tsx +31 -62
- package/src/tui-ga-raw/shared/1ff34afa7c42d196-projection.js +3 -1
- package/src/tui-ga-raw/shared/77138df80c7ae006-map.js +36 -1
- package/src/tui-ga-raw/shared/98cc0c186c46c42d-quota-presentation.js +42 -9
- package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +78 -42
- package/src/tui-ga-raw/shared/bf17cbee28e58197-index.js +2 -2
- package/src/tui-ga-raw/shared/ca21dc417b36dc5d-codec.js +2 -1
- package/src/tui-ga-raw/shared/ecc214300932dfb6-merge.js +21 -5
- package/src/tui-raw/common-auth-embedded/quota/codec.js +2 -1
- package/src/tui-raw/common-auth-embedded/quota/format.js +78 -42
- package/src/tui-raw/common-auth-embedded/quota/index.js +2 -2
- package/src/tui-raw/common-auth-embedded/quota/map.js +36 -1
- package/src/tui-raw/common-auth-embedded/quota/merge.js +21 -5
- package/src/tui-raw/common-auth-embedded/quota/projection.js +3 -1
- package/src/tui-raw/quota-presentation.js +42 -9
- package/src/tui-raw/sidebar-state.js +15 -1
- package/src/tui-raw/tui.tsx +423 -218
- package/src/tui.tsx +423 -218
- package/dist/src/tui/vault-setup.d.ts +0 -98
- package/dist/src/tui/vault-setup.d.ts.map +0 -1
- package/dist/src/tui/vault-setup.js +0 -198
- package/dist/src/tui/vault-setup.js.map +0 -1
- package/dist/types/src/plugin/transform/model-resolver.d.ts +0 -2
- package/dist/types/src/plugin/transform/model-resolver.d.ts.map +0 -1
- package/dist/types/src/quota-presentation.d.ts +0 -18
- package/dist/types/src/quota-presentation.d.ts.map +0 -1
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { type QuotaMap, type QuotaObservation } from '../quota/index.js';
|
|
2
|
+
import type { RoutingRow } from '../routing/index.js';
|
|
3
|
+
import type { ClaustrumScopedAttempt, ClaustrumScopedCustody, SkippedVaultRecord, VaultCredential, VaultCredentialType, VaultInventory } from './custody.js';
|
|
4
|
+
import { type DeclinedAccount } from './interlock.js';
|
|
5
|
+
/**
|
|
6
|
+
* One vault account as the pool sees it. It carries no bearer material: the
|
|
7
|
+
* access token is fetched from the vault for every send. Several vault
|
|
8
|
+
* records logged into the same provider account collapse into one row, so
|
|
9
|
+
* duplicate logins never count as extra quota.
|
|
10
|
+
*/
|
|
11
|
+
export interface VaultRosterRow {
|
|
12
|
+
routeId: string;
|
|
13
|
+
credentialId: string;
|
|
14
|
+
credentialType: VaultCredentialType;
|
|
15
|
+
accountIdentity?: string;
|
|
16
|
+
/** Other credential ids logged into the same provider account. */
|
|
17
|
+
aliases?: string[];
|
|
18
|
+
state: string;
|
|
19
|
+
label: string;
|
|
20
|
+
email?: string;
|
|
21
|
+
orgName?: string;
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
addedAt: number;
|
|
24
|
+
quota?: QuotaMap;
|
|
25
|
+
/**
|
|
26
|
+
* The vault listed this record in a form this consumer could not use, so the
|
|
27
|
+
* row is the last good projection kept as it was rather than dropped.
|
|
28
|
+
*/
|
|
29
|
+
stale?: true;
|
|
30
|
+
/**
|
|
31
|
+
* The vault's latest list named no account for `credentialId`, so
|
|
32
|
+
* `accountIdentity` is the last account that credential was known to log
|
|
33
|
+
* into, kept until the vault names one again. It proves neither that the
|
|
34
|
+
* credential still logs into that account nor that it changed accounts.
|
|
35
|
+
*/
|
|
36
|
+
unclaimed?: true;
|
|
37
|
+
}
|
|
38
|
+
export interface VaultRosterFile {
|
|
39
|
+
version: 1;
|
|
40
|
+
view?: string;
|
|
41
|
+
/**
|
|
42
|
+
* False when the vault's reply carried records this consumer could not use.
|
|
43
|
+
* An incomplete reply never removes an account it may still hold: every
|
|
44
|
+
* previous member it does not account for is kept.
|
|
45
|
+
*/
|
|
46
|
+
complete: boolean;
|
|
47
|
+
/** The unusable records of an incomplete reply: a safe id and a fixed reason. */
|
|
48
|
+
rejected?: SkippedVaultRecord[];
|
|
49
|
+
rows: VaultRosterRow[];
|
|
50
|
+
declined: DeclinedAccount[];
|
|
51
|
+
}
|
|
52
|
+
/** How a vault credential is presented in the pool. */
|
|
53
|
+
export type AccountMapper = (credential: VaultCredential) => {
|
|
54
|
+
label?: string;
|
|
55
|
+
};
|
|
56
|
+
export interface ProjectionOptions {
|
|
57
|
+
/** Ids already used by local rows; a vault route never takes one. */
|
|
58
|
+
reservedRouteIds?: ReadonlySet<string>;
|
|
59
|
+
/** Prefix for vault route ids, so they read differently from local ids. */
|
|
60
|
+
routePrefix?: string;
|
|
61
|
+
mapAccount?: AccountMapper;
|
|
62
|
+
now?: number;
|
|
63
|
+
}
|
|
64
|
+
export declare const DEFAULT_ROUTE_PREFIX = "vault:";
|
|
65
|
+
/**
|
|
66
|
+
* Project the vault's list onto the previous roster. Pure: callers serialize
|
|
67
|
+
* discovery and commit. Route ids, quota and the time an account was added
|
|
68
|
+
* survive for the same account; a credential that now logs into a different
|
|
69
|
+
* known account gets a new route id and no inherited quota.
|
|
70
|
+
*
|
|
71
|
+
* A record listed without an identity keeps the last account it was known to
|
|
72
|
+
* log into (the row is marked `unclaimed`). Dropping that binding would let a
|
|
73
|
+
* later different account look like an identity learned for the first time
|
|
74
|
+
* and inherit the first account's route and quota.
|
|
75
|
+
*
|
|
76
|
+
* A reply with unusable records is incomplete: a previous member it does not
|
|
77
|
+
* account for (its record was rejected, or a rejected record has no usable id
|
|
78
|
+
* and could be any of them) is kept, as an alias of its live account or as a
|
|
79
|
+
* `stale` row. Only a complete reply removes an account.
|
|
80
|
+
*/
|
|
81
|
+
export declare function projectVaultRoster(previous: VaultRosterFile | undefined, inventory: VaultInventory, options?: ProjectionOptions): VaultRosterFile;
|
|
82
|
+
/**
|
|
83
|
+
* The rows `/routing` selects among. Only enabled, active accounts route;
|
|
84
|
+
* a declined or cold vault account stays listed for the menu but never
|
|
85
|
+
* reaches admission.
|
|
86
|
+
*/
|
|
87
|
+
export declare function vaultRoutingRows(roster: VaultRosterFile | undefined): RoutingRow[];
|
|
88
|
+
export declare function readVaultRoster(path: string): Promise<VaultRosterFile | undefined>;
|
|
89
|
+
/** The ownership assertion available to a roster mutation callback. */
|
|
90
|
+
export interface VaultRosterLockContext {
|
|
91
|
+
assertOwned: () => Promise<void>;
|
|
92
|
+
}
|
|
93
|
+
export interface MutateVaultRosterOptions {
|
|
94
|
+
/**
|
|
95
|
+
* Runs when the new roster is fully staged on disk, immediately before the
|
|
96
|
+
* rename that publishes it, so a caller can confirm a lease of its own at
|
|
97
|
+
* the moment of publication rather than when `change` returned. If it
|
|
98
|
+
* throws, nothing is published and the staged file is removed. The
|
|
99
|
+
* roster's own write lock is reasserted right after it.
|
|
100
|
+
*/
|
|
101
|
+
beforePublish?: () => Promise<void>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Read, change and write the roster under its write lock. `change` returns
|
|
105
|
+
* undefined to leave the file as it is. Call `assertOwned()` immediately
|
|
106
|
+
* before any rename performed inside `change`; if it throws, do not rename.
|
|
107
|
+
*/
|
|
108
|
+
export declare function mutateVaultRoster<T>(path: string, change: (current: VaultRosterFile | undefined, context: VaultRosterLockContext) => Promise<{
|
|
109
|
+
next?: VaultRosterFile;
|
|
110
|
+
result: T;
|
|
111
|
+
}> | {
|
|
112
|
+
next?: VaultRosterFile;
|
|
113
|
+
result: T;
|
|
114
|
+
}, options?: MutateVaultRosterOptions): Promise<T>;
|
|
115
|
+
/** Mark a vault account declined; it stays listed but never routes. */
|
|
116
|
+
export declare function declineVaultRoute(path: string, routeId: string): Promise<undefined>;
|
|
117
|
+
/** Lift the user's decline for a vault account and every alias of it. */
|
|
118
|
+
export declare function acceptVaultRoute(path: string, routeId: string): Promise<undefined>;
|
|
119
|
+
/**
|
|
120
|
+
* The receipt fields a quota or profile observation must carry to say which
|
|
121
|
+
* send (credential and account) it came from. Pass the
|
|
122
|
+
* `ClaustrumScopedAttempt` that send was authorized with.
|
|
123
|
+
*/
|
|
124
|
+
export type QuotaReceipt = Pick<ClaustrumScopedAttempt, 'credentialId' | 'accountIdentity' | 'accountIdentitySource' | 'expectedAccountIdentity'>;
|
|
125
|
+
/**
|
|
126
|
+
* Merge a quota observation into a vault row through `/quota`'s merge. The
|
|
127
|
+
* write is fenced on the receipt the reading was taken with: it lands only
|
|
128
|
+
* while the row still holds that receipt's credential (as representative or
|
|
129
|
+
* alias) and account, so a slow read for a replaced account can never land on
|
|
130
|
+
* its successor. Returns whether the observation was kept.
|
|
131
|
+
*/
|
|
132
|
+
export declare function recordVaultQuota(path: string, input: QuotaReceipt & {
|
|
133
|
+
routeId: string;
|
|
134
|
+
observation: QuotaObservation;
|
|
135
|
+
}): Promise<boolean>;
|
|
136
|
+
/**
|
|
137
|
+
* Merge a quota observation that belongs to an account rather than to a
|
|
138
|
+
* served credential, such as a background reading from insula. The write
|
|
139
|
+
* lands only while the row is still bound to that exact known account, so a
|
|
140
|
+
* reading taken before a replacement never reaches the successor. Unlike
|
|
141
|
+
* `recordVaultQuota` it never binds an account: a row without a known account
|
|
142
|
+
* is refused. Returns whether the observation was kept.
|
|
143
|
+
*/
|
|
144
|
+
export declare function recordVaultAccountQuota(path: string, input: {
|
|
145
|
+
routeId: string;
|
|
146
|
+
accountIdentity: string;
|
|
147
|
+
observation: QuotaObservation;
|
|
148
|
+
}): Promise<boolean>;
|
|
149
|
+
/**
|
|
150
|
+
* Discover and commit the roster. The lease covers the list call and the
|
|
151
|
+
* commit, not just the write: an opaque view cannot tell a delayed old reply
|
|
152
|
+
* from a newer one, so a run that lost its lease is refused at commit. A
|
|
153
|
+
* failed list, or custody switching off mid-run, never writes anything; a
|
|
154
|
+
* peer holding the lease means its last committed roster is served instead.
|
|
155
|
+
*/
|
|
156
|
+
export declare function refreshVaultRoster(options: {
|
|
157
|
+
path: string;
|
|
158
|
+
custody: Pick<ClaustrumScopedCustody, 'discover'>;
|
|
159
|
+
isActive?: () => boolean | Promise<boolean>;
|
|
160
|
+
signal?: AbortSignal;
|
|
161
|
+
projection?: ProjectionOptions | (() => ProjectionOptions);
|
|
162
|
+
}): Promise<VaultRosterFile | undefined>;
|
|
163
|
+
/**
|
|
164
|
+
* A host-owned main account as last verified from the vault: the plugin's
|
|
165
|
+
* logical route, the credential that serves it and the account it logs into.
|
|
166
|
+
*/
|
|
167
|
+
export interface VaultPrimaryBinding {
|
|
168
|
+
routeId: string;
|
|
169
|
+
credentialId: string;
|
|
170
|
+
accountIdentity: string;
|
|
171
|
+
view: string;
|
|
172
|
+
}
|
|
173
|
+
export type VaultPrimaryUnavailableReason = 'malformed' | 'unclaimed' | 'incomplete' | 'identity-changed';
|
|
174
|
+
export type VaultPrimary =
|
|
175
|
+
/**
|
|
176
|
+
* Main is bound. `replaced` is the previous binding when it named a
|
|
177
|
+
* different account: everything owned by that account (quota, profile,
|
|
178
|
+
* backoff, cache affinity) must be dropped, and outstanding observations
|
|
179
|
+
* for it fenced, even though the logical route stays the same.
|
|
180
|
+
*/
|
|
181
|
+
{
|
|
182
|
+
status: 'ready';
|
|
183
|
+
binding: VaultPrimaryBinding;
|
|
184
|
+
replaced?: VaultPrimaryBinding;
|
|
185
|
+
}
|
|
186
|
+
/** A complete reply lists no primary record: there is no main. */
|
|
187
|
+
| {
|
|
188
|
+
status: 'absent';
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The reply cannot say who main is. Not the same as absent: the last
|
|
192
|
+
* verified binding is handed back untouched, and serving it still needs a
|
|
193
|
+
* fresh receipt that matches it.
|
|
194
|
+
*/
|
|
195
|
+
| {
|
|
196
|
+
status: 'unavailable';
|
|
197
|
+
reason: VaultPrimaryUnavailableReason;
|
|
198
|
+
lastVerified?: VaultPrimaryBinding;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* The seam for a plugin that keeps a main account: one fixed account the host
|
|
202
|
+
* owns under a logical route, outside the pool's rotating rows. The library
|
|
203
|
+
* has no main convention of its own: the plugin names the
|
|
204
|
+
* vault record that holds the role (`primaryCredentialId`) and its logical
|
|
205
|
+
* route. Main follows the account that record claims; another credential of
|
|
206
|
+
* that same account may serve it when the record itself is not active, but a
|
|
207
|
+
* credential of any other account is never promoted into main.
|
|
208
|
+
*
|
|
209
|
+
* Inputs are the plugin's filtered inventory, whether that inventory is
|
|
210
|
+
* complete (defaults to the reply having no unusable records; pass the
|
|
211
|
+
* roster's `complete` or false to override), the previous verified binding
|
|
212
|
+
* and, on the request path, the account the chosen request expects.
|
|
213
|
+
*/
|
|
214
|
+
export declare function resolveVaultPrimary(input: {
|
|
215
|
+
inventory: VaultInventory;
|
|
216
|
+
complete?: boolean;
|
|
217
|
+
previous?: VaultPrimaryBinding;
|
|
218
|
+
expectedAccountIdentity?: string;
|
|
219
|
+
primaryCredentialId: string;
|
|
220
|
+
routeId: string;
|
|
221
|
+
}): VaultPrimary;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why an OpenCode 2 auth hook refused a request.
|
|
3
|
+
*
|
|
4
|
+
* - `no-account`: the adapter had no account to offer for this request, so
|
|
5
|
+
* the request is stopped before the host picks a transport. Also used when
|
|
6
|
+
* session forgetting or installation disposal revokes an in-flight auth
|
|
7
|
+
* selection: that selection no longer has an account it may send under.
|
|
8
|
+
* - `host-credential-on-wire`: after every rewrite, a header still carried
|
|
9
|
+
* one of the host's placeholder credentials. Sending it would leak a
|
|
10
|
+
* non-routable value to the provider and fail with a confusing error.
|
|
11
|
+
*/
|
|
12
|
+
export type OpenCode2AuthFailureKind = 'no-account' | 'host-credential-on-wire';
|
|
13
|
+
export declare class OpenCode2AuthError extends Error {
|
|
14
|
+
readonly kind: OpenCode2AuthFailureKind;
|
|
15
|
+
readonly providerID: string;
|
|
16
|
+
readonly sessionID: string;
|
|
17
|
+
readonly requestKind: string;
|
|
18
|
+
constructor(details: {
|
|
19
|
+
kind: OpenCode2AuthFailureKind;
|
|
20
|
+
providerID: string;
|
|
21
|
+
sessionID: string;
|
|
22
|
+
requestKind: string;
|
|
23
|
+
message?: string;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { OpenCode2AuthFailureKind } from './errors.js';
|
|
2
|
+
export { OpenCode2AuthError } from './errors.js';
|
|
3
|
+
export { ATTEMPT_HEADER, applyHeaderEdits, DEFAULT_MAX_RECORDS, installOpenCode2Auth, } from './install.js';
|
|
4
|
+
export type { FormAnswer, LoginContext, PoolAuthorization, PoolLoginMethod, RegisterOpenCode2AuthMethodsOptions, VaultActivationMethod, } from './integration.js';
|
|
5
|
+
export { isPlaceholderCredential, PLACEHOLDER_LIFETIME_MS, PLACEHOLDER_METADATA_KEY, PLACEHOLDER_PREFIX, placeholderCredential, placeholderSecret, registerOpenCode2AuthMethods, VAULT_ACTIVATION_INSTRUCTIONS, } from './integration.js';
|
|
6
|
+
export type { ServerSentEvent } from './sse.js';
|
|
7
|
+
export { watchServerSentEvents } from './sse.js';
|
|
8
|
+
export type { AccountHeadersResult, AccountRequest, Attempt, AttemptEndReason, AttemptOutcome, ChooseAccountInput, EventVerdict, HeaderEdits, HostError, InstallOpenCode2AuthOptions, LimitSignal, OpenCode2AuthAdapter, OpenCode2AuthEventName, OpenCode2AuthEvents, OpenCode2AuthInstallation, OpenCode2AuthLogger, OpenCode2HookContext, RequestKind, RequestScope, ResponseAccount, RetryReason, SelectingHook, Transport, } from './types.js';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { HeaderEdits, InstallOpenCode2AuthOptions, OpenCode2AuthAdapter, OpenCode2AuthInstallation, OpenCode2HookContext } from './types.js';
|
|
2
|
+
export declare const DEFAULT_MAX_RECORDS = 512;
|
|
3
|
+
/**
|
|
4
|
+
* The request header `model.request` sets to the attempt it started. The
|
|
5
|
+
* host builds the HTTP request and the WebSocket handshake from the headers
|
|
6
|
+
* `model.request` leaves, so `http.request` and `experimental.ws.handshake`
|
|
7
|
+
* read it to find their own attempt among several of one session and kind,
|
|
8
|
+
* and remove it: it never reaches the wire.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ATTEMPT_HEADER = "x-common-auth-attempt";
|
|
11
|
+
/** Applies edits to a plain header record, replacing every spelling of each name. */
|
|
12
|
+
export declare function applyHeaderEdits(target: Record<string, string>, edits: HeaderEdits): void;
|
|
13
|
+
/**
|
|
14
|
+
* Installs multi-account auth on OpenCode 2's own provider drivers. Every
|
|
15
|
+
* hook is scoped to `adapter.providerID`:
|
|
16
|
+
*
|
|
17
|
+
* - `model.request` picks the account for one model call of a session and
|
|
18
|
+
* request kind, which starts a new attempt, sets its headers and marks the
|
|
19
|
+
* request with the attempt (`ATTEMPT_HEADER`);
|
|
20
|
+
* - `http.request` and `experimental.ws.handshake` find the attempt by that
|
|
21
|
+
* mark, remove it and set the account headers again, because the host
|
|
22
|
+
* applies its own credential after `model.request`;
|
|
23
|
+
* - `experimental.ws.send` (only when the adapter rewrites frames) rewrites
|
|
24
|
+
* each outgoing frame;
|
|
25
|
+
* - `http.response` and `experimental.ws.receive` read quota, refusals,
|
|
26
|
+
* whether output has started and when the response ended, attributed to
|
|
27
|
+
* an attempt by the rules below;
|
|
28
|
+
* - `retry` asks the host to retry at once when an account was refused
|
|
29
|
+
* before any output, so `model.request` runs again and can pick another
|
|
30
|
+
* account, and refuses to retry once output has started.
|
|
31
|
+
*
|
|
32
|
+
* Attribution. A send belongs to the attempt named by the mark
|
|
33
|
+
* `model.request` left on it, so several attempts of one session and kind
|
|
34
|
+
* can be in flight at once, each on its own account. An HTTP response
|
|
35
|
+
* belongs to the attempt whose `http.request` produced its request object,
|
|
36
|
+
* and to nothing else. The host hands `http.response` the request object the
|
|
37
|
+
* `http.request` hooks left, so a different object means a later hook
|
|
38
|
+
* replaced it; nothing then proves which send the response answers, and its
|
|
39
|
+
* feedback is dropped rather than guessed by recency. A WebSocket frame
|
|
40
|
+
* names no attempt, so frames go to the newest open attempt of their session
|
|
41
|
+
* and kind that went out over WebSocket, and an older one is abandoned as
|
|
42
|
+
* soon as a newer attempt of that session and kind begins or goes out over
|
|
43
|
+
* WebSocket: the host runs one exchange at a time on a session's socket.
|
|
44
|
+
* Anything else is attributed to no attempt and reaches no adapter callback
|
|
45
|
+
* or listener.
|
|
46
|
+
*
|
|
47
|
+
* With `gateOnPlaceholder`, `model.request` is a no-op. Each transport hook
|
|
48
|
+
* compares the host-prepared secret exactly, then selects a fresh attempt only
|
|
49
|
+
* for an owned send. Request-object attribution therefore needs no attempt
|
|
50
|
+
* header. Frames are owned by the latest handshake of their session and kind;
|
|
51
|
+
* retry runs only when the session's latest transport was owned. The host's
|
|
52
|
+
* retry hook has no request identity, so concurrent mixed-ownership calls
|
|
53
|
+
* cannot be distinguished there; owned retries retain the heuristic above.
|
|
54
|
+
*/
|
|
55
|
+
export declare function installOpenCode2Auth<Q, A = unknown>(ctx: OpenCode2HookContext, adapter: OpenCode2AuthAdapter<Q, A>, options?: InstallOpenCode2AuthOptions): Promise<OpenCode2AuthInstallation<Q, A>>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { Credential, Plugin } from '@opencode/plugin';
|
|
2
|
+
import type { IntegrationOAuthMethod, IntegrationOAuthMethodRegistration } from '@opencode/plugin/promise/integration';
|
|
3
|
+
import type { Registration } from '@opencode/plugin/promise/registration';
|
|
4
|
+
/** The host's form answer handed to `authorize`. */
|
|
5
|
+
export type FormAnswer = Parameters<IntegrationOAuthMethodRegistration['authorize']>[0];
|
|
6
|
+
/**
|
|
7
|
+
* Prefix of every placeholder secret. No provider issues tokens of this
|
|
8
|
+
* shape, so a placeholder that escaped to the wire is refused by the
|
|
9
|
+
* provider and recognisable in any log.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PLACEHOLDER_PREFIX = "common-auth-placeholder";
|
|
12
|
+
/** How long a placeholder claims to be valid; refresh simply issues another. */
|
|
13
|
+
export declare const PLACEHOLDER_LIFETIME_MS: number;
|
|
14
|
+
/** Metadata key marking a host credential as a placeholder. */
|
|
15
|
+
export declare const PLACEHOLDER_METADATA_KEY = "commonAuthPlaceholder";
|
|
16
|
+
/** The non-routable secret the host holds for an integration. */
|
|
17
|
+
export declare function placeholderSecret(integrationID: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* The credential the host stores for an integration whose real accounts live
|
|
20
|
+
* in the plugin's pool. It keeps the provider catalogued and usable in the
|
|
21
|
+
* host, and carries nothing that works against the provider.
|
|
22
|
+
*/
|
|
23
|
+
export declare function placeholderCredential(input: {
|
|
24
|
+
integrationID: string;
|
|
25
|
+
methodID: string;
|
|
26
|
+
now: number;
|
|
27
|
+
}): Credential.OAuth;
|
|
28
|
+
/** Whether a host credential is a placeholder (for any integration, or the one named). */
|
|
29
|
+
export declare function isPlaceholderCredential(value: Credential.Value | undefined, integrationID?: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The plugin's half of an OAuth login. It has the same shape as the host's
|
|
32
|
+
* authorization, except that `callback` resolves to the plugin's own login
|
|
33
|
+
* result instead of a host credential.
|
|
34
|
+
*/
|
|
35
|
+
export type PoolAuthorization<T> = {
|
|
36
|
+
readonly url: string;
|
|
37
|
+
readonly instructions: string;
|
|
38
|
+
readonly expiresAt?: number;
|
|
39
|
+
} & ({
|
|
40
|
+
readonly mode: 'auto';
|
|
41
|
+
readonly callback: Promise<T>;
|
|
42
|
+
} | {
|
|
43
|
+
readonly mode: 'code';
|
|
44
|
+
readonly callback: (code: string) => Promise<T>;
|
|
45
|
+
});
|
|
46
|
+
export interface PoolLoginMethod<T> {
|
|
47
|
+
readonly method: IntegrationOAuthMethod;
|
|
48
|
+
authorize(answer: FormAnswer): Promise<PoolAuthorization<T>>;
|
|
49
|
+
}
|
|
50
|
+
/** What `activate` and `onLogin` are told about the login they serve. */
|
|
51
|
+
export interface LoginContext {
|
|
52
|
+
readonly integrationID: string;
|
|
53
|
+
readonly methodID: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Shown by `opencode auth login` when the vault method starts. The host has no
|
|
57
|
+
* page to open for this method, so the text only says what happens instead.
|
|
58
|
+
*/
|
|
59
|
+
export declare const VAULT_ACTIVATION_INSTRUCTIONS = "No browser sign-in: this connects the plugin to the accounts in its vault.";
|
|
60
|
+
/**
|
|
61
|
+
* A login method for a host whose accounts all come from a vault. Choosing it
|
|
62
|
+
* signs in to nothing and writes nothing to the plugin's pool: once
|
|
63
|
+
* `activate` resolves, the host only receives this integration's placeholder,
|
|
64
|
+
* which marks later requests as the plugin's to serve from the vault.
|
|
65
|
+
*/
|
|
66
|
+
export interface VaultActivationMethod {
|
|
67
|
+
/** Must not share an ID with any of the pool login methods. */
|
|
68
|
+
readonly method: IntegrationOAuthMethod;
|
|
69
|
+
/**
|
|
70
|
+
* Confirms the host may use this method, normally by checking that
|
|
71
|
+
* `enrollmentAuthority` reports `'vault'`. Throw to refuse: the host shows
|
|
72
|
+
* the error's message and stores nothing, so it must be a fixed text that
|
|
73
|
+
* carries no credential.
|
|
74
|
+
*/
|
|
75
|
+
activate(context: LoginContext): Promise<void> | void;
|
|
76
|
+
/** Replaces `VAULT_ACTIVATION_INSTRUCTIONS`. */
|
|
77
|
+
readonly instructions?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface RegisterOpenCode2AuthMethodsOptions<T> {
|
|
80
|
+
readonly integrationID: string;
|
|
81
|
+
readonly methods: readonly PoolLoginMethod<T>[];
|
|
82
|
+
/**
|
|
83
|
+
* Adds a login method that activates the plugin for vault accounts without
|
|
84
|
+
* creating a local account. Leave it out when the plugin has no vault.
|
|
85
|
+
*/
|
|
86
|
+
readonly vault?: VaultActivationMethod;
|
|
87
|
+
/**
|
|
88
|
+
* Writes a completed login into the plugin's pool. The host only receives
|
|
89
|
+
* a placeholder once this resolves; if it throws, the login fails in the
|
|
90
|
+
* host and nothing is stored there.
|
|
91
|
+
*/
|
|
92
|
+
onLogin(result: T, context: LoginContext): Promise<void> | void;
|
|
93
|
+
/** Label the host shows for its (placeholder) connection. */
|
|
94
|
+
readonly label?: string;
|
|
95
|
+
readonly now?: () => number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Registers the plugin's own login methods with the host so that a login lands
|
|
99
|
+
* in the plugin's pool and the host keeps only a placeholder credential.
|
|
100
|
+
*
|
|
101
|
+
* With `vault`, one more method lets a host whose accounts all live in a vault
|
|
102
|
+
* activate the plugin: it calls `activate`, writes nothing to the pool and
|
|
103
|
+
* hands the host the same placeholder under its own method ID.
|
|
104
|
+
*
|
|
105
|
+
* Host-driven refresh never reaches the pool: it renews only this integration's
|
|
106
|
+
* placeholder and refuses every other credential without replacing it. Plugins
|
|
107
|
+
* must register under their own method IDs; a plugin importing an existing
|
|
108
|
+
* host login should read it through `ctx.integration.connection` instead.
|
|
109
|
+
*/
|
|
110
|
+
export declare function registerOpenCode2AuthMethods<T>(ctx: {
|
|
111
|
+
readonly integration: Pick<Plugin.Context['integration'], 'transform'>;
|
|
112
|
+
}, options: RegisterOpenCode2AuthMethodsOptions<T>): Promise<Registration>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** One server-sent event: its `event:` name, if any, and its joined `data:` lines. */
|
|
2
|
+
export interface ServerSentEvent {
|
|
3
|
+
readonly event?: string;
|
|
4
|
+
readonly data: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A pass-through stream that hands every complete server-sent event to
|
|
8
|
+
* `onEvent` while forwarding the original bytes unchanged, so the host still
|
|
9
|
+
* consumes the body exactly once. A throwing `onEvent` is reported to
|
|
10
|
+
* `onError` and never breaks the stream.
|
|
11
|
+
*/
|
|
12
|
+
export declare function watchServerSentEvents(onEvent: (event: ServerSentEvent) => void, onError: (error: unknown) => void): TransformStream<Uint8Array, Uint8Array>;
|