@celljs/ta-host 4.8.0 → 4.9.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.en.md +33 -5
- package/README.md +33 -5
- package/cell.schema.json +4 -0
- package/cell.yml +2 -0
- package/esm/node/client-tool-broker.d.ts +11 -3
- package/esm/node/client-tool-broker.js +23 -3
- package/esm/node/host-protocol.d.ts +22 -1
- package/esm/node/host-protocol.js +1 -0
- package/esm/node/index.d.ts +4 -0
- package/esm/node/index.js +4 -0
- package/esm/node/live-run.d.ts +22 -0
- package/esm/node/live-run.js +58 -0
- package/esm/node/message-page.d.ts +17 -0
- package/esm/node/message-page.js +71 -0
- package/esm/node/package-server-impl.d.ts +9 -1
- package/esm/node/package-server-impl.js +16 -1
- package/esm/node/relay-bridge.d.ts +9 -1
- package/esm/node/relay-bridge.js +44 -4
- package/esm/node/session-catalog.d.ts +69 -0
- package/esm/node/session-catalog.js +211 -0
- package/esm/node/session-info-util.d.ts +4 -1
- package/esm/node/session-info-util.js +8 -3
- package/esm/node/settings-store.d.ts +1 -4
- package/esm/node/settings-store.js +11 -3
- package/esm/node/sign-in/access-server-impl.d.ts +19 -0
- package/esm/node/sign-in/access-server-impl.js +82 -0
- package/esm/node/sign-in/access-store.d.ts +65 -0
- package/esm/node/sign-in/access-store.js +175 -0
- package/esm/node/sign-in/index.d.ts +7 -0
- package/esm/node/sign-in/index.js +8 -0
- package/esm/node/sign-in/sign-in-flow.d.ts +58 -0
- package/esm/node/sign-in/sign-in-flow.js +104 -0
- package/esm/node/sign-in/sign-in-middleware.d.ts +10 -0
- package/esm/node/sign-in/sign-in-middleware.js +48 -0
- package/esm/node/sign-in/sign-in-pages.d.ts +31 -0
- package/esm/node/sign-in/sign-in-pages.js +118 -0
- package/esm/node/sign-in/sign-in-provider.d.ts +135 -0
- package/esm/node/sign-in/sign-in-provider.js +225 -0
- package/esm/node/sign-in/ta-sign-in.d.ts +10 -0
- package/esm/node/sign-in/ta-sign-in.js +32 -0
- package/esm/node/ta-access.d.ts +7 -0
- package/esm/node/ta-access.js +30 -1
- package/esm/node/ta-server-impl.d.ts +8 -3
- package/esm/node/ta-server-impl.js +25 -6
- package/esm/node/ta-session-factory.d.ts +1 -1
- package/esm/node/ta-session-factory.js +14 -4
- package/esm/node/ta-session-registry.d.ts +2 -0
- package/esm/node/ta-session-registry.js +23 -3
- package/esm/node/ta-session.d.ts +24 -2
- package/esm/node/ta-session.js +83 -6
- package/esm/node/temporary-packages.d.ts +46 -0
- package/esm/node/temporary-packages.js +114 -0
- package/esm/node/temporary-purge.d.ts +13 -0
- package/esm/node/temporary-purge.js +51 -0
- package/esm/node/web-extension-catalog.d.ts +28 -1
- package/esm/node/web-extension-catalog.js +173 -5
- package/esm/node/web-extension-util.d.ts +5 -1
- package/esm/node/web-extension-util.js +36 -5
- package/esm/node/workspace-service.js +1 -1
- package/lib/node/client-tool-broker.d.ts +11 -3
- package/lib/node/client-tool-broker.js +23 -3
- package/lib/node/host-protocol.d.ts +22 -1
- package/lib/node/host-protocol.js +2 -1
- package/lib/node/index.d.ts +4 -0
- package/lib/node/index.js +4 -0
- package/lib/node/live-run.d.ts +23 -0
- package/lib/node/live-run.js +62 -0
- package/lib/node/message-page.d.ts +18 -0
- package/lib/node/message-page.js +74 -0
- package/lib/node/package-server-impl.d.ts +9 -1
- package/lib/node/package-server-impl.js +15 -0
- package/lib/node/relay-bridge.d.ts +9 -1
- package/lib/node/relay-bridge.js +43 -3
- package/lib/node/session-catalog.d.ts +70 -0
- package/lib/node/session-catalog.js +214 -0
- package/lib/node/session-info-util.d.ts +4 -1
- package/lib/node/session-info-util.js +7 -2
- package/lib/node/settings-store.d.ts +1 -4
- package/lib/node/settings-store.js +11 -3
- package/lib/node/sign-in/access-server-impl.d.ts +20 -0
- package/lib/node/sign-in/access-server-impl.js +85 -0
- package/lib/node/sign-in/access-store.d.ts +66 -0
- package/lib/node/sign-in/access-store.js +179 -0
- package/lib/node/sign-in/index.d.ts +8 -0
- package/lib/node/sign-in/index.js +24 -0
- package/lib/node/sign-in/sign-in-flow.d.ts +59 -0
- package/lib/node/sign-in/sign-in-flow.js +108 -0
- package/lib/node/sign-in/sign-in-middleware.d.ts +11 -0
- package/lib/node/sign-in/sign-in-middleware.js +51 -0
- package/lib/node/sign-in/sign-in-pages.d.ts +32 -0
- package/lib/node/sign-in/sign-in-pages.js +121 -0
- package/lib/node/sign-in/sign-in-provider.d.ts +136 -0
- package/lib/node/sign-in/sign-in-provider.js +232 -0
- package/lib/node/sign-in/ta-sign-in.d.ts +11 -0
- package/lib/node/sign-in/ta-sign-in.js +35 -0
- package/lib/node/ta-access.d.ts +7 -0
- package/lib/node/ta-access.js +30 -1
- package/lib/node/ta-server-impl.d.ts +8 -3
- package/lib/node/ta-server-impl.js +24 -5
- package/lib/node/ta-session-factory.d.ts +1 -1
- package/lib/node/ta-session-factory.js +14 -4
- package/lib/node/ta-session-registry.d.ts +2 -0
- package/lib/node/ta-session-registry.js +23 -3
- package/lib/node/ta-session.d.ts +24 -2
- package/lib/node/ta-session.js +83 -6
- package/lib/node/temporary-packages.d.ts +47 -0
- package/lib/node/temporary-packages.js +118 -0
- package/lib/node/temporary-purge.d.ts +14 -0
- package/lib/node/temporary-purge.js +54 -0
- package/lib/node/web-extension-catalog.d.ts +28 -1
- package/lib/node/web-extension-catalog.js +172 -4
- package/lib/node/web-extension-util.d.ts +5 -1
- package/lib/node/web-extension-util.js +36 -5
- package/lib/node/workspace-service.js +1 -1
- package/package.json +17 -12
- package/esm/node/auth-server-impl.js.map +0 -1
- package/esm/node/client-channel.js.map +0 -1
- package/esm/node/client-tool-broker.js.map +0 -1
- package/esm/node/event-log.js.map +0 -1
- package/esm/node/exec-environment-factory.js.map +0 -1
- package/esm/node/extension-data-notifier.js.map +0 -1
- package/esm/node/extension-data.js.map +0 -1
- package/esm/node/extension-providers.js.map +0 -1
- package/esm/node/host-protocol.js.map +0 -1
- package/esm/node/index.js.map +0 -1
- package/esm/node/module.js.map +0 -1
- package/esm/node/package-host-extension.js.map +0 -1
- package/esm/node/package-hosts.js.map +0 -1
- package/esm/node/package-server-impl.js.map +0 -1
- package/esm/node/package-switch.js.map +0 -1
- package/esm/node/receipt-book.js.map +0 -1
- package/esm/node/relay-bridge.js.map +0 -1
- package/esm/node/remote/index.js.map +0 -1
- package/esm/node/remote/pi-directories.js.map +0 -1
- package/esm/node/remote/port-forwards.js.map +0 -1
- package/esm/node/remote/remote-hosts.js.map +0 -1
- package/esm/node/remote/remote-protocol.js.map +0 -1
- package/esm/node/remote/remote-server-impl.js.map +0 -1
- package/esm/node/remote-ui-context.js.map +0 -1
- package/esm/node/session-files.js.map +0 -1
- package/esm/node/session-info-util.js.map +0 -1
- package/esm/node/session-storage/file-session-storage.js.map +0 -1
- package/esm/node/session-storage/index.js.map +0 -1
- package/esm/node/session-storage/session-storage-protocol.js.map +0 -1
- package/esm/node/session-storage/stored-session.js.map +0 -1
- package/esm/node/settings-server-impl.js.map +0 -1
- package/esm/node/settings-store.js.map +0 -1
- package/esm/node/ta-access.js.map +0 -1
- package/esm/node/ta-errors.js.map +0 -1
- package/esm/node/ta-event-util.js.map +0 -1
- package/esm/node/ta-server-impl.js.map +0 -1
- package/esm/node/ta-session-factory.js.map +0 -1
- package/esm/node/ta-session-registry.js.map +0 -1
- package/esm/node/ta-session.js.map +0 -1
- package/esm/node/terminal-protocol.js.map +0 -1
- package/esm/node/terminal-service.js.map +0 -1
- package/esm/node/terminal-util.js.map +0 -1
- package/esm/node/web-extension-catalog.js.map +0 -1
- package/esm/node/web-extension-util.js.map +0 -1
- package/esm/node/working-directory.js.map +0 -1
- package/esm/node/workspace-files.js.map +0 -1
- package/esm/node/workspace-protocol.js.map +0 -1
- package/esm/node/workspace-server-impl.js.map +0 -1
- package/esm/node/workspace-service.js.map +0 -1
- package/esm/node/workspace-util.js.map +0 -1
- package/lib/node/auth-server-impl.d.ts.map +0 -1
- package/lib/node/auth-server-impl.js.map +0 -1
- package/lib/node/auth-server-impl.spec.d.ts +0 -2
- package/lib/node/auth-server-impl.spec.d.ts.map +0 -1
- package/lib/node/auth-server-impl.spec.js +0 -47
- package/lib/node/auth-server-impl.spec.js.map +0 -1
- package/lib/node/client-channel.d.ts.map +0 -1
- package/lib/node/client-channel.js.map +0 -1
- package/lib/node/client-channel.spec.d.ts +0 -2
- package/lib/node/client-channel.spec.d.ts.map +0 -1
- package/lib/node/client-channel.spec.js +0 -106
- package/lib/node/client-channel.spec.js.map +0 -1
- package/lib/node/client-tool-broker.d.ts.map +0 -1
- package/lib/node/client-tool-broker.js.map +0 -1
- package/lib/node/client-tool-broker.spec.d.ts +0 -2
- package/lib/node/client-tool-broker.spec.d.ts.map +0 -1
- package/lib/node/client-tool-broker.spec.js +0 -49
- package/lib/node/client-tool-broker.spec.js.map +0 -1
- package/lib/node/event-log.d.ts.map +0 -1
- package/lib/node/event-log.js.map +0 -1
- package/lib/node/event-log.spec.d.ts +0 -2
- package/lib/node/event-log.spec.d.ts.map +0 -1
- package/lib/node/event-log.spec.js +0 -48
- package/lib/node/event-log.spec.js.map +0 -1
- package/lib/node/exec-environment-factory.d.ts.map +0 -1
- package/lib/node/exec-environment-factory.js.map +0 -1
- package/lib/node/extension-data-notifier.d.ts.map +0 -1
- package/lib/node/extension-data-notifier.js.map +0 -1
- package/lib/node/extension-data-notifier.spec.d.ts +0 -2
- package/lib/node/extension-data-notifier.spec.d.ts.map +0 -1
- package/lib/node/extension-data-notifier.spec.js +0 -35
- package/lib/node/extension-data-notifier.spec.js.map +0 -1
- package/lib/node/extension-data.d.ts.map +0 -1
- package/lib/node/extension-data.js.map +0 -1
- package/lib/node/extension-data.spec.d.ts +0 -2
- package/lib/node/extension-data.spec.d.ts.map +0 -1
- package/lib/node/extension-data.spec.js +0 -99
- package/lib/node/extension-data.spec.js.map +0 -1
- package/lib/node/extension-providers.d.ts.map +0 -1
- package/lib/node/extension-providers.js.map +0 -1
- package/lib/node/host-protocol.d.ts.map +0 -1
- package/lib/node/host-protocol.js.map +0 -1
- package/lib/node/index.d.ts.map +0 -1
- package/lib/node/index.js.map +0 -1
- package/lib/node/module.d.ts.map +0 -1
- package/lib/node/module.js.map +0 -1
- package/lib/node/package-host-extension.d.ts.map +0 -1
- package/lib/node/package-host-extension.js.map +0 -1
- package/lib/node/package-hosts.d.ts.map +0 -1
- package/lib/node/package-hosts.js.map +0 -1
- package/lib/node/package-hosts.spec.d.ts +0 -2
- package/lib/node/package-hosts.spec.d.ts.map +0 -1
- package/lib/node/package-hosts.spec.js +0 -53
- package/lib/node/package-hosts.spec.js.map +0 -1
- package/lib/node/package-server-impl.d.ts.map +0 -1
- package/lib/node/package-server-impl.js.map +0 -1
- package/lib/node/package-switch.d.ts.map +0 -1
- package/lib/node/package-switch.js.map +0 -1
- package/lib/node/receipt-book.d.ts.map +0 -1
- package/lib/node/receipt-book.js.map +0 -1
- package/lib/node/receipt-book.spec.d.ts +0 -2
- package/lib/node/receipt-book.spec.d.ts.map +0 -1
- package/lib/node/receipt-book.spec.js +0 -39
- package/lib/node/receipt-book.spec.js.map +0 -1
- package/lib/node/relay-bridge.d.ts.map +0 -1
- package/lib/node/relay-bridge.js.map +0 -1
- package/lib/node/remote/index.d.ts.map +0 -1
- package/lib/node/remote/index.js.map +0 -1
- package/lib/node/remote/pi-directories.d.ts.map +0 -1
- package/lib/node/remote/pi-directories.js.map +0 -1
- package/lib/node/remote/port-forwards.d.ts.map +0 -1
- package/lib/node/remote/port-forwards.js.map +0 -1
- package/lib/node/remote/remote-hosts.d.ts.map +0 -1
- package/lib/node/remote/remote-hosts.js.map +0 -1
- package/lib/node/remote/remote-protocol.d.ts.map +0 -1
- package/lib/node/remote/remote-protocol.js.map +0 -1
- package/lib/node/remote/remote-server-impl.d.ts.map +0 -1
- package/lib/node/remote/remote-server-impl.js.map +0 -1
- package/lib/node/remote/remote.spec.d.ts +0 -2
- package/lib/node/remote/remote.spec.d.ts.map +0 -1
- package/lib/node/remote/remote.spec.js +0 -130
- package/lib/node/remote/remote.spec.js.map +0 -1
- package/lib/node/remote-ui-context.d.ts.map +0 -1
- package/lib/node/remote-ui-context.js.map +0 -1
- package/lib/node/remote-ui-context.spec.d.ts +0 -2
- package/lib/node/remote-ui-context.spec.d.ts.map +0 -1
- package/lib/node/remote-ui-context.spec.js +0 -85
- package/lib/node/remote-ui-context.spec.js.map +0 -1
- package/lib/node/session-files.d.ts.map +0 -1
- package/lib/node/session-files.js.map +0 -1
- package/lib/node/session-files.spec.d.ts +0 -2
- package/lib/node/session-files.spec.d.ts.map +0 -1
- package/lib/node/session-files.spec.js +0 -51
- package/lib/node/session-files.spec.js.map +0 -1
- package/lib/node/session-info-util.d.ts.map +0 -1
- package/lib/node/session-info-util.js.map +0 -1
- package/lib/node/session-info-util.spec.d.ts +0 -2
- package/lib/node/session-info-util.spec.d.ts.map +0 -1
- package/lib/node/session-info-util.spec.js +0 -22
- package/lib/node/session-info-util.spec.js.map +0 -1
- package/lib/node/session-storage/file-session-storage.d.ts.map +0 -1
- package/lib/node/session-storage/file-session-storage.js.map +0 -1
- package/lib/node/session-storage/file-session-storage.spec.d.ts +0 -2
- package/lib/node/session-storage/file-session-storage.spec.d.ts.map +0 -1
- package/lib/node/session-storage/file-session-storage.spec.js +0 -70
- package/lib/node/session-storage/file-session-storage.spec.js.map +0 -1
- package/lib/node/session-storage/index.d.ts.map +0 -1
- package/lib/node/session-storage/index.js.map +0 -1
- package/lib/node/session-storage/session-storage-protocol.d.ts.map +0 -1
- package/lib/node/session-storage/session-storage-protocol.js.map +0 -1
- package/lib/node/session-storage/stored-session.d.ts.map +0 -1
- package/lib/node/session-storage/stored-session.js.map +0 -1
- package/lib/node/session-storage/stored-session.spec.d.ts +0 -2
- package/lib/node/session-storage/stored-session.spec.d.ts.map +0 -1
- package/lib/node/session-storage/stored-session.spec.js +0 -73
- package/lib/node/session-storage/stored-session.spec.js.map +0 -1
- package/lib/node/settings-server-impl.d.ts.map +0 -1
- package/lib/node/settings-server-impl.js.map +0 -1
- package/lib/node/settings-store.d.ts.map +0 -1
- package/lib/node/settings-store.js.map +0 -1
- package/lib/node/settings-store.spec.d.ts +0 -2
- package/lib/node/settings-store.spec.d.ts.map +0 -1
- package/lib/node/settings-store.spec.js +0 -148
- package/lib/node/settings-store.spec.js.map +0 -1
- package/lib/node/ta-access.d.ts.map +0 -1
- package/lib/node/ta-access.js.map +0 -1
- package/lib/node/ta-access.spec.d.ts +0 -2
- package/lib/node/ta-access.spec.d.ts.map +0 -1
- package/lib/node/ta-access.spec.js +0 -33
- package/lib/node/ta-access.spec.js.map +0 -1
- package/lib/node/ta-errors.d.ts.map +0 -1
- package/lib/node/ta-errors.js.map +0 -1
- package/lib/node/ta-errors.spec.d.ts +0 -2
- package/lib/node/ta-errors.spec.d.ts.map +0 -1
- package/lib/node/ta-errors.spec.js +0 -25
- package/lib/node/ta-errors.spec.js.map +0 -1
- package/lib/node/ta-event-util.d.ts.map +0 -1
- package/lib/node/ta-event-util.js.map +0 -1
- package/lib/node/ta-event-util.spec.d.ts +0 -2
- package/lib/node/ta-event-util.spec.d.ts.map +0 -1
- package/lib/node/ta-event-util.spec.js +0 -28
- package/lib/node/ta-event-util.spec.js.map +0 -1
- package/lib/node/ta-server-impl.d.ts.map +0 -1
- package/lib/node/ta-server-impl.js.map +0 -1
- package/lib/node/ta-session-factory.d.ts.map +0 -1
- package/lib/node/ta-session-factory.js.map +0 -1
- package/lib/node/ta-session-registry.d.ts.map +0 -1
- package/lib/node/ta-session-registry.js.map +0 -1
- package/lib/node/ta-session.d.ts.map +0 -1
- package/lib/node/ta-session.js.map +0 -1
- package/lib/node/terminal-protocol.d.ts.map +0 -1
- package/lib/node/terminal-protocol.js.map +0 -1
- package/lib/node/terminal-service.d.ts.map +0 -1
- package/lib/node/terminal-service.js.map +0 -1
- package/lib/node/terminal-service.spec.d.ts +0 -2
- package/lib/node/terminal-service.spec.d.ts.map +0 -1
- package/lib/node/terminal-service.spec.js +0 -110
- package/lib/node/terminal-service.spec.js.map +0 -1
- package/lib/node/terminal-util.d.ts.map +0 -1
- package/lib/node/terminal-util.js.map +0 -1
- package/lib/node/terminal-util.spec.d.ts +0 -2
- package/lib/node/terminal-util.spec.d.ts.map +0 -1
- package/lib/node/terminal-util.spec.js +0 -95
- package/lib/node/terminal-util.spec.js.map +0 -1
- package/lib/node/web-extension-catalog.d.ts.map +0 -1
- package/lib/node/web-extension-catalog.js.map +0 -1
- package/lib/node/web-extension-catalog.spec.d.ts +0 -2
- package/lib/node/web-extension-catalog.spec.d.ts.map +0 -1
- package/lib/node/web-extension-catalog.spec.js +0 -157
- package/lib/node/web-extension-catalog.spec.js.map +0 -1
- package/lib/node/web-extension-util.d.ts.map +0 -1
- package/lib/node/web-extension-util.js.map +0 -1
- package/lib/node/working-directory.d.ts.map +0 -1
- package/lib/node/working-directory.js.map +0 -1
- package/lib/node/workspace-files.d.ts.map +0 -1
- package/lib/node/workspace-files.js.map +0 -1
- package/lib/node/workspace-files.spec.d.ts +0 -2
- package/lib/node/workspace-files.spec.d.ts.map +0 -1
- package/lib/node/workspace-files.spec.js +0 -133
- package/lib/node/workspace-files.spec.js.map +0 -1
- package/lib/node/workspace-protocol.d.ts.map +0 -1
- package/lib/node/workspace-protocol.js.map +0 -1
- package/lib/node/workspace-server-impl.d.ts.map +0 -1
- package/lib/node/workspace-server-impl.js.map +0 -1
- package/lib/node/workspace-service.d.ts.map +0 -1
- package/lib/node/workspace-service.js.map +0 -1
- package/lib/node/workspace-service.spec.d.ts +0 -2
- package/lib/node/workspace-service.spec.d.ts.map +0 -1
- package/lib/node/workspace-service.spec.js +0 -113
- package/lib/node/workspace-service.spec.js.map +0 -1
- package/lib/node/workspace-util.d.ts.map +0 -1
- package/lib/node/workspace-util.js.map +0 -1
- package/lib/node/workspace-util.spec.d.ts +0 -2
- package/lib/node/workspace-util.spec.d.ts.map +0 -1
- package/lib/node/workspace-util.spec.js +0 -44
- package/lib/node/workspace-util.spec.js.map +0 -1
- package/src/node/auth-server-impl.spec.ts +0 -49
- package/src/node/auth-server-impl.ts +0 -258
- package/src/node/client-channel.spec.ts +0 -117
- package/src/node/client-channel.ts +0 -94
- package/src/node/client-tool-broker.spec.ts +0 -53
- package/src/node/client-tool-broker.ts +0 -106
- package/src/node/event-log.spec.ts +0 -52
- package/src/node/event-log.ts +0 -59
- package/src/node/exec-environment-factory.ts +0 -66
- package/src/node/extension-data-notifier.spec.ts +0 -34
- package/src/node/extension-data-notifier.ts +0 -124
- package/src/node/extension-data.spec.ts +0 -105
- package/src/node/extension-data.ts +0 -180
- package/src/node/extension-providers.ts +0 -49
- package/src/node/host-protocol.ts +0 -62
- package/src/node/index.ts +0 -39
- package/src/node/module.ts +0 -4
- package/src/node/package-host-extension.ts +0 -23
- package/src/node/package-hosts.spec.ts +0 -54
- package/src/node/package-hosts.ts +0 -204
- package/src/node/package-server-impl.ts +0 -87
- package/src/node/package-switch.ts +0 -80
- package/src/node/receipt-book.spec.ts +0 -41
- package/src/node/receipt-book.ts +0 -40
- package/src/node/relay-bridge.ts +0 -94
- package/src/node/remote/index.ts +0 -5
- package/src/node/remote/pi-directories.ts +0 -49
- package/src/node/remote/port-forwards.ts +0 -148
- package/src/node/remote/remote-hosts.ts +0 -170
- package/src/node/remote/remote-protocol.ts +0 -57
- package/src/node/remote/remote-server-impl.ts +0 -60
- package/src/node/remote/remote.spec.ts +0 -142
- package/src/node/remote-ui-context.spec.ts +0 -93
- package/src/node/remote-ui-context.ts +0 -197
- package/src/node/session-files.spec.ts +0 -52
- package/src/node/session-files.ts +0 -41
- package/src/node/session-info-util.spec.ts +0 -23
- package/src/node/session-info-util.ts +0 -55
- package/src/node/session-storage/file-session-storage.spec.ts +0 -72
- package/src/node/session-storage/file-session-storage.ts +0 -145
- package/src/node/session-storage/index.ts +0 -3
- package/src/node/session-storage/session-storage-protocol.ts +0 -81
- package/src/node/session-storage/stored-session.spec.ts +0 -80
- package/src/node/session-storage/stored-session.ts +0 -149
- package/src/node/settings-server-impl.ts +0 -42
- package/src/node/settings-store.spec.ts +0 -158
- package/src/node/settings-store.ts +0 -327
- package/src/node/ta-access.spec.ts +0 -36
- package/src/node/ta-access.ts +0 -156
- package/src/node/ta-errors.spec.ts +0 -25
- package/src/node/ta-errors.ts +0 -75
- package/src/node/ta-event-util.spec.ts +0 -29
- package/src/node/ta-event-util.ts +0 -23
- package/src/node/ta-server-impl.ts +0 -341
- package/src/node/ta-session-factory.ts +0 -216
- package/src/node/ta-session-registry.ts +0 -75
- package/src/node/ta-session.ts +0 -241
- package/src/node/terminal-protocol.ts +0 -18
- package/src/node/terminal-service.spec.ts +0 -119
- package/src/node/terminal-service.ts +0 -291
- package/src/node/terminal-util.spec.ts +0 -109
- package/src/node/terminal-util.ts +0 -197
- package/src/node/web-extension-catalog.spec.ts +0 -172
- package/src/node/web-extension-catalog.ts +0 -177
- package/src/node/web-extension-util.ts +0 -144
- package/src/node/working-directory.ts +0 -71
- package/src/node/workspace-files.spec.ts +0 -145
- package/src/node/workspace-files.ts +0 -256
- package/src/node/workspace-protocol.ts +0 -24
- package/src/node/workspace-server-impl.ts +0 -108
- package/src/node/workspace-service.spec.ts +0 -123
- package/src/node/workspace-service.ts +0 -235
- package/src/node/workspace-util.spec.ts +0 -47
- package/src/node/workspace-util.ts +0 -103
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SignInPages = exports.SignInPageUtil = void 0;
|
|
4
|
+
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
5
|
+
const sign_in_flow_1 = require("./sign-in-flow");
|
|
6
|
+
/** Ties the browser that comes back from the provider to the one that went: login CSRF. */
|
|
7
|
+
const STATE_COOKIE = 'ta_sign_in';
|
|
8
|
+
var SignInPageUtil;
|
|
9
|
+
(function (SignInPageUtil) {
|
|
10
|
+
function cookie(header, name) {
|
|
11
|
+
for (const part of (header !== null && header !== void 0 ? header : '').split(';')) {
|
|
12
|
+
const [key, ...value] = part.trim().split('=');
|
|
13
|
+
if (key === name) {
|
|
14
|
+
return decodeURIComponent(value.join('='));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
SignInPageUtil.cookie = cookie;
|
|
20
|
+
/** The page of the web client, told how the sign-in went in its fragment, which no server sees. */
|
|
21
|
+
function back(fragment) {
|
|
22
|
+
const params = new URLSearchParams('token' in fragment ? { token: fragment.token } : { 'sign-in': fragment.outcome, ...(fragment.account ? { account: fragment.account } : {}) });
|
|
23
|
+
return `/#${params.toString()}`;
|
|
24
|
+
}
|
|
25
|
+
SignInPageUtil.back = back;
|
|
26
|
+
function redirect(response, location) {
|
|
27
|
+
response.statusCode = 302;
|
|
28
|
+
response.setHeader('Location', location);
|
|
29
|
+
response.end();
|
|
30
|
+
}
|
|
31
|
+
SignInPageUtil.redirect = redirect;
|
|
32
|
+
function end(response, status, body = '') {
|
|
33
|
+
response.statusCode = status;
|
|
34
|
+
response.end(body);
|
|
35
|
+
}
|
|
36
|
+
SignInPageUtil.end = end;
|
|
37
|
+
})(SignInPageUtil || (exports.SignInPageUtil = SignInPageUtil = {}));
|
|
38
|
+
/**
|
|
39
|
+
* The pages of TA_SIGN_IN_PATH, which the browser goes to without a token: the ways to sign in, the way to
|
|
40
|
+
* a provider, and back from it to the web client with a token of its own (`/#token=`, as `ta serve --web`).
|
|
41
|
+
* False for a request of another path.
|
|
42
|
+
*/
|
|
43
|
+
var SignInPages;
|
|
44
|
+
(function (SignInPages) {
|
|
45
|
+
function matches(request) {
|
|
46
|
+
var _a;
|
|
47
|
+
const path = ((_a = request.url) !== null && _a !== void 0 ? _a : '/').split('?')[0];
|
|
48
|
+
return path === ta_protocol_1.TA_SIGN_IN_PATH || path.startsWith(`${ta_protocol_1.TA_SIGN_IN_PATH}/`);
|
|
49
|
+
}
|
|
50
|
+
SignInPages.matches = matches;
|
|
51
|
+
async function handle(request, response, flow, options) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
const url = new URL((_a = request.url) !== null && _a !== void 0 ? _a : '/', 'http://localhost');
|
|
54
|
+
response.setHeader('Cache-Control', 'no-store');
|
|
55
|
+
response.setHeader('Referrer-Policy', 'no-referrer');
|
|
56
|
+
if (request.method !== 'GET' && request.method !== 'HEAD') {
|
|
57
|
+
response.setHeader('Allow', 'GET, HEAD');
|
|
58
|
+
SignInPageUtil.end(response, 405);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const [providerId, step, ...rest] = url.pathname.slice(ta_protocol_1.TA_SIGN_IN_PATH.length + 1).split('/');
|
|
62
|
+
if (!providerId) {
|
|
63
|
+
const ways = { providers: flow.providers.map(({ id, name }) => ({ id, name })) };
|
|
64
|
+
response.setHeader('Content-Type', 'application/json');
|
|
65
|
+
SignInPageUtil.end(response, 200, JSON.stringify(ways));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (!flow.provider(providerId) || rest.length > 0 || (step && step !== 'callback')) {
|
|
69
|
+
SignInPageUtil.end(response, 404);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!step) {
|
|
73
|
+
await go(request, response, flow, providerId, (_b = url.searchParams.get('bind')) !== null && _b !== void 0 ? _b : undefined, options);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
await back(request, response, flow, providerId, url.searchParams, options);
|
|
77
|
+
}
|
|
78
|
+
SignInPages.handle = handle;
|
|
79
|
+
async function go(request, response, flow, providerId, bind, options) {
|
|
80
|
+
const origin = sign_in_flow_1.SignInUtil.origin(request, flow.publicUrl);
|
|
81
|
+
try {
|
|
82
|
+
const { url, state } = await flow.start(providerId, origin, bind);
|
|
83
|
+
const secure = origin.startsWith('https:') ? '; Secure' : '';
|
|
84
|
+
response.setHeader('Set-Cookie', `${STATE_COOKIE}=${state}; Path=${ta_protocol_1.TA_SIGN_IN_PATH}; Max-Age=600; HttpOnly; SameSite=Lax${secure}`);
|
|
85
|
+
SignInPageUtil.redirect(response, url);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
console.warn(`${options.name}: signing in with ${providerId} failed: ${error instanceof Error ? error.message : error}`);
|
|
89
|
+
SignInPageUtil.redirect(response, SignInPageUtil.back({ outcome: 'failed' }));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async function back(request, response, flow, providerId, params, options) {
|
|
93
|
+
var _a;
|
|
94
|
+
var _b;
|
|
95
|
+
const state = (_b = params.get('state')) !== null && _b !== void 0 ? _b : '';
|
|
96
|
+
const code = params.get('code');
|
|
97
|
+
response.setHeader('Set-Cookie', `${STATE_COOKIE}=; Path=${ta_protocol_1.TA_SIGN_IN_PATH}; Max-Age=0; HttpOnly; SameSite=Lax`);
|
|
98
|
+
if (!code || !state || SignInPageUtil.cookie(request.headers.cookie, STATE_COOKIE) !== state) {
|
|
99
|
+
// Cancelled at the provider (`error`), or a link that did not start in this browser.
|
|
100
|
+
SignInPageUtil.redirect(response, SignInPageUtil.back({ outcome: 'failed' }));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
const result = await flow.finish(providerId, state, code, request.headers['user-agent']);
|
|
105
|
+
if ('token' in result) {
|
|
106
|
+
console.log(`${options.name}: ${result.account.id} signed in`);
|
|
107
|
+
await ((_a = options.onSignedIn) === null || _a === void 0 ? void 0 : _a.call(options, response, result.token, result.account, sign_in_flow_1.SignInUtil.origin(request, flow.publicUrl)));
|
|
108
|
+
SignInPageUtil.redirect(response, SignInPageUtil.back({ token: result.token }));
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
console.log(`${options.name}: ${result.denied.id} signed in and waits to be let in`);
|
|
112
|
+
SignInPageUtil.redirect(response, SignInPageUtil.back({ outcome: 'denied', account: result.denied.id }));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.warn(`${options.name}: signing in with ${providerId} failed: ${error instanceof Error ? error.message : error}`);
|
|
117
|
+
SignInPageUtil.redirect(response, SignInPageUtil.back({ outcome: 'failed' }));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
})(SignInPages || (exports.SignInPages = SignInPages = {}));
|
|
121
|
+
//# sourceMappingURL=sign-in-pages.js.map
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { TaSignInProvider } from '@celljs/ta-protocol';
|
|
2
|
+
/** Who signed in, as the provider says: `id` is the account as TA_ALLOWED_USERS names it (`github:<login>`). */
|
|
3
|
+
export interface SignInAccount {
|
|
4
|
+
id: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
avatar?: string;
|
|
7
|
+
}
|
|
8
|
+
/** A sign-in that failed with the provider (a code refused, an account without what it needs). */
|
|
9
|
+
export declare class SignInError extends Error {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A provider of accounts, through OAuth 2.0's authorization code: the browser goes to {@link authorizeUrl},
|
|
13
|
+
* comes back with a code, which {@link account} turns into the account. `challenge` and `verifier` are those
|
|
14
|
+
* of PKCE (S256), for the providers that take them.
|
|
15
|
+
*/
|
|
16
|
+
export interface SignInProvider extends TaSignInProvider {
|
|
17
|
+
authorizeUrl(params: {
|
|
18
|
+
redirectUri: string;
|
|
19
|
+
state: string;
|
|
20
|
+
challenge: string;
|
|
21
|
+
}): Promise<string>;
|
|
22
|
+
account(params: {
|
|
23
|
+
code: string;
|
|
24
|
+
redirectUri: string;
|
|
25
|
+
verifier: string;
|
|
26
|
+
}): Promise<SignInAccount>;
|
|
27
|
+
}
|
|
28
|
+
export declare namespace SignInHttp {
|
|
29
|
+
function url(base: string, params: Record<string, string | undefined>): string;
|
|
30
|
+
/** The JSON a provider answers; one that fails says what it said. */
|
|
31
|
+
function json<T>(url: string, init?: RequestInit): Promise<T>;
|
|
32
|
+
/** A form posted for a token, the way OAuth 2.0 wants it. */
|
|
33
|
+
function form(params: Record<string, string>): RequestInit;
|
|
34
|
+
}
|
|
35
|
+
export interface GitHubEndpoints {
|
|
36
|
+
authorize: string;
|
|
37
|
+
token: string;
|
|
38
|
+
user: string;
|
|
39
|
+
}
|
|
40
|
+
/** GitHub's OAuth apps; the account is `github:<login>`. GitHub Enterprise Server has the same at its own address. */
|
|
41
|
+
export declare class GitHubSignIn implements SignInProvider {
|
|
42
|
+
protected readonly clientId: string;
|
|
43
|
+
protected readonly clientSecret: string;
|
|
44
|
+
protected readonly endpoints: GitHubEndpoints;
|
|
45
|
+
readonly id = "github";
|
|
46
|
+
readonly name = "GitHub";
|
|
47
|
+
static endpoints(url?: string): GitHubEndpoints;
|
|
48
|
+
constructor(clientId: string, clientSecret: string, endpoints?: GitHubEndpoints);
|
|
49
|
+
authorizeUrl({ redirectUri, state, challenge }: {
|
|
50
|
+
redirectUri: string;
|
|
51
|
+
state: string;
|
|
52
|
+
challenge: string;
|
|
53
|
+
}): Promise<string>;
|
|
54
|
+
account({ code, redirectUri, verifier }: {
|
|
55
|
+
code: string;
|
|
56
|
+
redirectUri: string;
|
|
57
|
+
verifier: string;
|
|
58
|
+
}): Promise<SignInAccount>;
|
|
59
|
+
}
|
|
60
|
+
interface OidcConfiguration {
|
|
61
|
+
authorization_endpoint: string;
|
|
62
|
+
token_endpoint: string;
|
|
63
|
+
userinfo_endpoint: string;
|
|
64
|
+
}
|
|
65
|
+
export interface OidcOptions {
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
issuer: string;
|
|
69
|
+
clientId: string;
|
|
70
|
+
clientSecret: string;
|
|
71
|
+
/** The account is its address, verified; without one, a provider that requires it refuses (Google). */
|
|
72
|
+
requireEmail?: boolean;
|
|
73
|
+
/** More of the authorization request, such as Google's `prompt: select_account`. */
|
|
74
|
+
extra?: Record<string, string>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* OpenID Connect, found from the issuer (`/.well-known/openid-configuration`): Google, and the provider of
|
|
78
|
+
* the operator (Microsoft Entra, Okta, Keycloak, Authing...). The account is `<id>:<email>` when the
|
|
79
|
+
* address is verified, otherwise `<id>:<sub>`. The token is taken straight from the provider over TLS,
|
|
80
|
+
* so the user comes from its userinfo endpoint, with that token.
|
|
81
|
+
*/
|
|
82
|
+
export declare class OidcSignIn implements SignInProvider {
|
|
83
|
+
protected readonly options: OidcOptions;
|
|
84
|
+
readonly id: string;
|
|
85
|
+
readonly name: string;
|
|
86
|
+
protected configuration?: Promise<OidcConfiguration>;
|
|
87
|
+
static google(clientId: string, clientSecret: string): OidcSignIn;
|
|
88
|
+
constructor(options: OidcOptions);
|
|
89
|
+
authorizeUrl({ redirectUri, state, challenge }: {
|
|
90
|
+
redirectUri: string;
|
|
91
|
+
state: string;
|
|
92
|
+
challenge: string;
|
|
93
|
+
}): Promise<string>;
|
|
94
|
+
account({ code, redirectUri, verifier }: {
|
|
95
|
+
code: string;
|
|
96
|
+
redirectUri: string;
|
|
97
|
+
verifier: string;
|
|
98
|
+
}): Promise<SignInAccount>;
|
|
99
|
+
protected discover(): Promise<OidcConfiguration>;
|
|
100
|
+
}
|
|
101
|
+
export interface WeChatEndpoints {
|
|
102
|
+
authorize: string;
|
|
103
|
+
token: string;
|
|
104
|
+
user: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* WeChat's sign-in for websites (a website app of the WeChat Open Platform): the page shows a code to scan
|
|
108
|
+
* with WeChat. The account is `wechat:<unionid>`, or the openid when the app has no unionid.
|
|
109
|
+
*/
|
|
110
|
+
export declare class WeChatSignIn implements SignInProvider {
|
|
111
|
+
protected readonly appId: string;
|
|
112
|
+
protected readonly appSecret: string;
|
|
113
|
+
protected readonly endpoints: WeChatEndpoints;
|
|
114
|
+
readonly id = "wechat";
|
|
115
|
+
readonly name = "WeChat";
|
|
116
|
+
static readonly ENDPOINTS: WeChatEndpoints;
|
|
117
|
+
constructor(appId: string, appSecret: string, endpoints?: WeChatEndpoints);
|
|
118
|
+
authorizeUrl({ redirectUri, state }: {
|
|
119
|
+
redirectUri: string;
|
|
120
|
+
state: string;
|
|
121
|
+
}): Promise<string>;
|
|
122
|
+
account({ code }: {
|
|
123
|
+
code: string;
|
|
124
|
+
}): Promise<SignInAccount>;
|
|
125
|
+
}
|
|
126
|
+
export declare namespace SignInProviders {
|
|
127
|
+
/** TA_PUBLIC_URL without its trailing `/`. */
|
|
128
|
+
function publicUrl(env: Record<string, string | undefined>): string | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* The providers the operator configured in the environment of ta serve: a provider is offered when it
|
|
131
|
+
* has its id and its secret.
|
|
132
|
+
*/
|
|
133
|
+
function fromEnv(env: Record<string, string | undefined>): SignInProvider[];
|
|
134
|
+
}
|
|
135
|
+
export {};
|
|
136
|
+
//# sourceMappingURL=sign-in-provider.d.ts.map
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SignInProviders = exports.WeChatSignIn = exports.OidcSignIn = exports.GitHubSignIn = exports.SignInHttp = exports.SignInError = void 0;
|
|
4
|
+
/** A sign-in that failed with the provider (a code refused, an account without what it needs). */
|
|
5
|
+
class SignInError extends Error {
|
|
6
|
+
}
|
|
7
|
+
exports.SignInError = SignInError;
|
|
8
|
+
const TIMEOUT_MS = 10000;
|
|
9
|
+
var SignInHttp;
|
|
10
|
+
(function (SignInHttp) {
|
|
11
|
+
function url(base, params) {
|
|
12
|
+
const url = new URL(base);
|
|
13
|
+
for (const [key, value] of Object.entries(params)) {
|
|
14
|
+
if (value !== undefined) {
|
|
15
|
+
url.searchParams.set(key, value);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return url.toString();
|
|
19
|
+
}
|
|
20
|
+
SignInHttp.url = url;
|
|
21
|
+
/** The JSON a provider answers; one that fails says what it said. */
|
|
22
|
+
async function json(url, init = {}) {
|
|
23
|
+
const response = await fetch(url, { ...init, signal: AbortSignal.timeout(TIMEOUT_MS) });
|
|
24
|
+
const text = await response.text();
|
|
25
|
+
if (!response.ok) {
|
|
26
|
+
throw new SignInError(`${new URL(url).host} answered ${response.status}: ${text.slice(0, 200)}`);
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
return JSON.parse(text);
|
|
30
|
+
}
|
|
31
|
+
catch (_a) {
|
|
32
|
+
throw new SignInError(`${new URL(url).host} did not answer JSON: ${text.slice(0, 200)}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
SignInHttp.json = json;
|
|
36
|
+
/** A form posted for a token, the way OAuth 2.0 wants it. */
|
|
37
|
+
function form(params) {
|
|
38
|
+
return {
|
|
39
|
+
method: 'POST',
|
|
40
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded', Accept: 'application/json' },
|
|
41
|
+
body: new URLSearchParams(params).toString(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
SignInHttp.form = form;
|
|
45
|
+
})(SignInHttp || (exports.SignInHttp = SignInHttp = {}));
|
|
46
|
+
/** GitHub's OAuth apps; the account is `github:<login>`. GitHub Enterprise Server has the same at its own address. */
|
|
47
|
+
class GitHubSignIn {
|
|
48
|
+
static endpoints(url = 'https://github.com') {
|
|
49
|
+
const base = url.replace(/\/+$/, '');
|
|
50
|
+
const api = base === 'https://github.com' ? 'https://api.github.com' : `${base}/api/v3`;
|
|
51
|
+
return { authorize: `${base}/login/oauth/authorize`, token: `${base}/login/oauth/access_token`, user: `${api}/user` };
|
|
52
|
+
}
|
|
53
|
+
constructor(clientId, clientSecret, endpoints = GitHubSignIn.endpoints()) {
|
|
54
|
+
this.clientId = clientId;
|
|
55
|
+
this.clientSecret = clientSecret;
|
|
56
|
+
this.endpoints = endpoints;
|
|
57
|
+
this.id = 'github';
|
|
58
|
+
this.name = 'GitHub';
|
|
59
|
+
}
|
|
60
|
+
async authorizeUrl({ redirectUri, state, challenge }) {
|
|
61
|
+
return SignInHttp.url(this.endpoints.authorize, {
|
|
62
|
+
client_id: this.clientId,
|
|
63
|
+
redirect_uri: redirectUri,
|
|
64
|
+
scope: 'read:user',
|
|
65
|
+
state,
|
|
66
|
+
allow_signup: 'false',
|
|
67
|
+
code_challenge: challenge,
|
|
68
|
+
code_challenge_method: 'S256',
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async account({ code, redirectUri, verifier }) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
const token = await SignInHttp.json(this.endpoints.token, SignInHttp.form({ client_id: this.clientId, client_secret: this.clientSecret, code, redirect_uri: redirectUri, code_verifier: verifier }));
|
|
74
|
+
if (!token.access_token) {
|
|
75
|
+
throw new SignInError(`GitHub: ${(_b = (_a = token.error_description) !== null && _a !== void 0 ? _a : token.error) !== null && _b !== void 0 ? _b : 'no access token'}`);
|
|
76
|
+
}
|
|
77
|
+
const user = await SignInHttp.json(this.endpoints.user, {
|
|
78
|
+
headers: { Authorization: `Bearer ${token.access_token}`, Accept: 'application/vnd.github+json', 'User-Agent': 'Ta' },
|
|
79
|
+
});
|
|
80
|
+
if (!user.login) {
|
|
81
|
+
throw new SignInError('GitHub: the user has no login');
|
|
82
|
+
}
|
|
83
|
+
return { id: `github:${user.login.toLowerCase()}`, name: user.name || user.login, avatar: user.avatar_url };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.GitHubSignIn = GitHubSignIn;
|
|
87
|
+
/**
|
|
88
|
+
* OpenID Connect, found from the issuer (`/.well-known/openid-configuration`): Google, and the provider of
|
|
89
|
+
* the operator (Microsoft Entra, Okta, Keycloak, Authing...). The account is `<id>:<email>` when the
|
|
90
|
+
* address is verified, otherwise `<id>:<sub>`. The token is taken straight from the provider over TLS,
|
|
91
|
+
* so the user comes from its userinfo endpoint, with that token.
|
|
92
|
+
*/
|
|
93
|
+
class OidcSignIn {
|
|
94
|
+
static google(clientId, clientSecret) {
|
|
95
|
+
return new OidcSignIn({
|
|
96
|
+
id: 'google',
|
|
97
|
+
name: 'Google',
|
|
98
|
+
issuer: 'https://accounts.google.com',
|
|
99
|
+
clientId,
|
|
100
|
+
clientSecret,
|
|
101
|
+
requireEmail: true,
|
|
102
|
+
extra: { prompt: 'select_account' },
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
constructor(options) {
|
|
106
|
+
this.options = options;
|
|
107
|
+
this.id = options.id;
|
|
108
|
+
this.name = options.name;
|
|
109
|
+
}
|
|
110
|
+
async authorizeUrl({ redirectUri, state, challenge }) {
|
|
111
|
+
const { authorization_endpoint } = await this.discover();
|
|
112
|
+
return SignInHttp.url(authorization_endpoint, {
|
|
113
|
+
response_type: 'code',
|
|
114
|
+
client_id: this.options.clientId,
|
|
115
|
+
redirect_uri: redirectUri,
|
|
116
|
+
scope: 'openid email profile',
|
|
117
|
+
state,
|
|
118
|
+
code_challenge: challenge,
|
|
119
|
+
code_challenge_method: 'S256',
|
|
120
|
+
...this.options.extra,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
async account({ code, redirectUri, verifier }) {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
const { token_endpoint, userinfo_endpoint } = await this.discover();
|
|
126
|
+
const token = await SignInHttp.json(token_endpoint, SignInHttp.form({
|
|
127
|
+
grant_type: 'authorization_code',
|
|
128
|
+
code,
|
|
129
|
+
redirect_uri: redirectUri,
|
|
130
|
+
client_id: this.options.clientId,
|
|
131
|
+
client_secret: this.options.clientSecret,
|
|
132
|
+
code_verifier: verifier,
|
|
133
|
+
}));
|
|
134
|
+
if (!token.access_token) {
|
|
135
|
+
throw new SignInError(`${this.name}: ${(_b = (_a = token.error_description) !== null && _a !== void 0 ? _a : token.error) !== null && _b !== void 0 ? _b : 'no access token'}`);
|
|
136
|
+
}
|
|
137
|
+
const user = await SignInHttp.json(userinfo_endpoint, { headers: { Authorization: `Bearer ${token.access_token}`, Accept: 'application/json' } });
|
|
138
|
+
// Some providers say "false" as a string.
|
|
139
|
+
const email = user.email && user.email_verified !== false && user.email_verified !== 'false' ? user.email : undefined;
|
|
140
|
+
if (!email && (this.options.requireEmail || !user.sub)) {
|
|
141
|
+
throw new SignInError(`${this.name}: the account has no verified email address`);
|
|
142
|
+
}
|
|
143
|
+
const id = email ? `${this.id}:${email.toLowerCase()}` : `${this.id}:${user.sub}`;
|
|
144
|
+
return { id, name: user.name || user.email || user.sub, avatar: user.picture };
|
|
145
|
+
}
|
|
146
|
+
discover() {
|
|
147
|
+
if (!this.configuration) {
|
|
148
|
+
const url = `${this.options.issuer.replace(/\/+$/, '')}/.well-known/openid-configuration`;
|
|
149
|
+
this.configuration = SignInHttp.json(url);
|
|
150
|
+
// A provider down now may answer later.
|
|
151
|
+
this.configuration.catch(() => (this.configuration = undefined));
|
|
152
|
+
}
|
|
153
|
+
return this.configuration;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.OidcSignIn = OidcSignIn;
|
|
157
|
+
/**
|
|
158
|
+
* WeChat's sign-in for websites (a website app of the WeChat Open Platform): the page shows a code to scan
|
|
159
|
+
* with WeChat. The account is `wechat:<unionid>`, or the openid when the app has no unionid.
|
|
160
|
+
*/
|
|
161
|
+
class WeChatSignIn {
|
|
162
|
+
constructor(appId, appSecret, endpoints = WeChatSignIn.ENDPOINTS) {
|
|
163
|
+
this.appId = appId;
|
|
164
|
+
this.appSecret = appSecret;
|
|
165
|
+
this.endpoints = endpoints;
|
|
166
|
+
this.id = 'wechat';
|
|
167
|
+
this.name = 'WeChat';
|
|
168
|
+
}
|
|
169
|
+
async authorizeUrl({ redirectUri, state }) {
|
|
170
|
+
// WeChat wants its fragment, and no PKCE.
|
|
171
|
+
const url = SignInHttp.url(this.endpoints.authorize, {
|
|
172
|
+
appid: this.appId,
|
|
173
|
+
redirect_uri: redirectUri,
|
|
174
|
+
response_type: 'code',
|
|
175
|
+
scope: 'snsapi_login',
|
|
176
|
+
state,
|
|
177
|
+
});
|
|
178
|
+
return `${url}#wechat_redirect`;
|
|
179
|
+
}
|
|
180
|
+
async account({ code }) {
|
|
181
|
+
var _a, _b, _c, _d;
|
|
182
|
+
const token = await SignInHttp.json(SignInHttp.url(this.endpoints.token, { appid: this.appId, secret: this.appSecret, code, grant_type: 'authorization_code' }));
|
|
183
|
+
if (!token.access_token || !token.openid) {
|
|
184
|
+
throw new SignInError(`WeChat: ${(_a = token.errmsg) !== null && _a !== void 0 ? _a : 'no access token'} (${(_b = token.errcode) !== null && _b !== void 0 ? _b : '-'})`);
|
|
185
|
+
}
|
|
186
|
+
const user = await SignInHttp.json(SignInHttp.url(this.endpoints.user, { access_token: token.access_token, openid: token.openid }));
|
|
187
|
+
return { id: `wechat:${(_d = (_c = user.unionid) !== null && _c !== void 0 ? _c : token.unionid) !== null && _d !== void 0 ? _d : token.openid}`, name: user.nickname, avatar: user.headimgurl || undefined };
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
exports.WeChatSignIn = WeChatSignIn;
|
|
191
|
+
WeChatSignIn.ENDPOINTS = {
|
|
192
|
+
authorize: 'https://open.weixin.qq.com/connect/qrconnect',
|
|
193
|
+
token: 'https://api.weixin.qq.com/sns/oauth2/access_token',
|
|
194
|
+
user: 'https://api.weixin.qq.com/sns/userinfo',
|
|
195
|
+
};
|
|
196
|
+
var SignInProviders;
|
|
197
|
+
(function (SignInProviders) {
|
|
198
|
+
/** TA_PUBLIC_URL without its trailing `/`. */
|
|
199
|
+
function publicUrl(env) {
|
|
200
|
+
var _a;
|
|
201
|
+
return ((_a = env.TA_PUBLIC_URL) === null || _a === void 0 ? void 0 : _a.trim().replace(/\/+$/, '')) || undefined;
|
|
202
|
+
}
|
|
203
|
+
SignInProviders.publicUrl = publicUrl;
|
|
204
|
+
/**
|
|
205
|
+
* The providers the operator configured in the environment of ta serve: a provider is offered when it
|
|
206
|
+
* has its id and its secret.
|
|
207
|
+
*/
|
|
208
|
+
function fromEnv(env) {
|
|
209
|
+
const providers = [];
|
|
210
|
+
if (env.TA_GITHUB_CLIENT_ID && env.TA_GITHUB_CLIENT_SECRET) {
|
|
211
|
+
providers.push(new GitHubSignIn(env.TA_GITHUB_CLIENT_ID, env.TA_GITHUB_CLIENT_SECRET, GitHubSignIn.endpoints(env.TA_GITHUB_URL || undefined)));
|
|
212
|
+
}
|
|
213
|
+
if (env.TA_GOOGLE_CLIENT_ID && env.TA_GOOGLE_CLIENT_SECRET) {
|
|
214
|
+
providers.push(OidcSignIn.google(env.TA_GOOGLE_CLIENT_ID, env.TA_GOOGLE_CLIENT_SECRET));
|
|
215
|
+
}
|
|
216
|
+
if (env.TA_WECHAT_APP_ID && env.TA_WECHAT_APP_SECRET) {
|
|
217
|
+
providers.push(new WeChatSignIn(env.TA_WECHAT_APP_ID, env.TA_WECHAT_APP_SECRET));
|
|
218
|
+
}
|
|
219
|
+
if (env.TA_OIDC_ISSUER && env.TA_OIDC_CLIENT_ID && env.TA_OIDC_CLIENT_SECRET) {
|
|
220
|
+
providers.push(new OidcSignIn({
|
|
221
|
+
id: 'oidc',
|
|
222
|
+
name: env.TA_OIDC_NAME || 'SSO',
|
|
223
|
+
issuer: env.TA_OIDC_ISSUER,
|
|
224
|
+
clientId: env.TA_OIDC_CLIENT_ID,
|
|
225
|
+
clientSecret: env.TA_OIDC_CLIENT_SECRET,
|
|
226
|
+
}));
|
|
227
|
+
}
|
|
228
|
+
return providers;
|
|
229
|
+
}
|
|
230
|
+
SignInProviders.fromEnv = fromEnv;
|
|
231
|
+
})(SignInProviders || (exports.SignInProviders = SignInProviders = {}));
|
|
232
|
+
//# sourceMappingURL=sign-in-provider.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SignInFlow } from './sign-in-flow';
|
|
2
|
+
export declare const TA_SIGN_IN: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* Signing in to ta serve with an account, besides its token. The providers come from the environment
|
|
5
|
+
* (SignInProviders.fromEnv); who may sign in from TA_ALLOWED_USERS and the accounts added in the web client
|
|
6
|
+
* (AccessStore). Someone else who signs in is told to wait, and shows up as a request.
|
|
7
|
+
*/
|
|
8
|
+
export declare class TaSignIn extends SignInFlow {
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ta-sign-in.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TaSignIn = exports.TA_SIGN_IN = void 0;
|
|
13
|
+
const node_path_1 = require("node:path");
|
|
14
|
+
const core_1 = require("@celljs/core");
|
|
15
|
+
const ta_brand_1 = require("@celljs/ta-harness/lib/node/ta-brand");
|
|
16
|
+
const access_store_1 = require("./access-store");
|
|
17
|
+
const sign_in_flow_1 = require("./sign-in-flow");
|
|
18
|
+
const sign_in_provider_1 = require("./sign-in-provider");
|
|
19
|
+
exports.TA_SIGN_IN = Symbol('TaSignIn');
|
|
20
|
+
/**
|
|
21
|
+
* Signing in to ta serve with an account, besides its token. The providers come from the environment
|
|
22
|
+
* (SignInProviders.fromEnv); who may sign in from TA_ALLOWED_USERS and the accounts added in the web client
|
|
23
|
+
* (AccessStore). Someone else who signs in is told to wait, and shows up as a request.
|
|
24
|
+
*/
|
|
25
|
+
let TaSignIn = class TaSignIn extends sign_in_flow_1.SignInFlow {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(sign_in_provider_1.SignInProviders.fromEnv(process.env), new access_store_1.AccessStore((0, node_path_1.join)(ta_brand_1.TaBrand.agentDir(), 'access.json'), access_store_1.AccessUtil.parseList(process.env.TA_ALLOWED_USERS)), sign_in_provider_1.SignInProviders.publicUrl(process.env));
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.TaSignIn = TaSignIn;
|
|
31
|
+
exports.TaSignIn = TaSignIn = __decorate([
|
|
32
|
+
(0, core_1.Component)(exports.TA_SIGN_IN),
|
|
33
|
+
__metadata("design:paramtypes", [])
|
|
34
|
+
], TaSignIn);
|
|
35
|
+
//# sourceMappingURL=ta-sign-in.js.map
|
package/lib/node/ta-access.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type Application, ApplicationLifecycle } from '@celljs/core';
|
|
|
3
3
|
import { RpcWebSocketGuard } from '@celljs/rpc/lib/node';
|
|
4
4
|
import { type Context, Middleware, ServerAware } from '@celljs/web/lib/node';
|
|
5
5
|
import { TaSessionRegistry } from './host-protocol';
|
|
6
|
+
import { type TaSignIn } from './sign-in/ta-sign-in';
|
|
6
7
|
/** The id of {@link TaAccess}, for what needs the token, as RelayBridge does. */
|
|
7
8
|
export declare const TA_ACCESS: unique symbol;
|
|
8
9
|
/** Runs before everything else that handles a request. */
|
|
@@ -22,6 +23,11 @@ export declare namespace TaAccessUtil {
|
|
|
22
23
|
function isHttpCall(request: IncomingMessage): boolean;
|
|
23
24
|
/** The token goes in the fragment, which the browser does not send to the server or in `Referer`. */
|
|
24
25
|
function webUrl(httpUrl: string, token: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* What ta serve says where it starts on an address of the network: the link that signs in with its token
|
|
28
|
+
* (none for a token of TA_SERVE_TOKEN, which whoever set it knows), and the accounts that can sign in.
|
|
29
|
+
*/
|
|
30
|
+
function signInLines(signIn: Pick<TaSignIn, 'publicUrl' | 'providers' | 'store'>, port: number, token?: string): string[];
|
|
25
31
|
/** Opens a URL in the user's browser. */
|
|
26
32
|
function openBrowser(url: string): void;
|
|
27
33
|
}
|
|
@@ -36,6 +42,7 @@ export declare class TaAccess implements RpcWebSocketGuard, Middleware, ServerAw
|
|
|
36
42
|
readonly token: string;
|
|
37
43
|
protected readonly host?: string;
|
|
38
44
|
protected readonly sessions: TaSessionRegistry;
|
|
45
|
+
protected readonly signIn: TaSignIn;
|
|
39
46
|
protected readonly infoFile: string;
|
|
40
47
|
allows(request: IncomingMessage): boolean;
|
|
41
48
|
/** Calls over a WebSocket were checked when it opened; this covers plain HTTP. */
|
package/lib/node/ta-access.js
CHANGED
|
@@ -21,6 +21,7 @@ const ta_brand_1 = require("@celljs/ta-harness/lib/node/ta-brand");
|
|
|
21
21
|
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
22
22
|
const node_2 = require("@celljs/web/lib/node");
|
|
23
23
|
const host_protocol_1 = require("./host-protocol");
|
|
24
|
+
const ta_sign_in_1 = require("./sign-in/ta-sign-in");
|
|
24
25
|
const LOOPBACK_NAMES = new Set(['127.0.0.1', 'localhost', '[::1]']);
|
|
25
26
|
/** Where the calls go (`rpc.path`); everything else is the web client, if it is installed. */
|
|
26
27
|
const API_PATH = '/api';
|
|
@@ -72,6 +73,23 @@ var TaAccessUtil;
|
|
|
72
73
|
return `${httpUrl}/#token=${token}`;
|
|
73
74
|
}
|
|
74
75
|
TaAccessUtil.webUrl = webUrl;
|
|
76
|
+
/**
|
|
77
|
+
* What ta serve says where it starts on an address of the network: the link that signs in with its token
|
|
78
|
+
* (none for a token of TA_SERVE_TOKEN, which whoever set it knows), and the accounts that can sign in.
|
|
79
|
+
*/
|
|
80
|
+
function signInLines(signIn, port, token) {
|
|
81
|
+
var _a;
|
|
82
|
+
const base = (_a = signIn.publicUrl) !== null && _a !== void 0 ? _a : `http://localhost:${port}`;
|
|
83
|
+
const lines = [token ? `sign in at ${webUrl(base, token)}` : `web client at ${base}/ (sign in with TA_SERVE_TOKEN)`];
|
|
84
|
+
if (signIn.providers.length > 0) {
|
|
85
|
+
const names = signIn.providers.map(provider => provider.name).join(', ');
|
|
86
|
+
lines.push(signIn.store.open
|
|
87
|
+
? `accounts let in sign in with ${names}`
|
|
88
|
+
: `sign-in with ${names} lets nobody in yet: set TA_ALLOWED_USERS, or open the link above and add your account in Settings, Access`);
|
|
89
|
+
}
|
|
90
|
+
return lines;
|
|
91
|
+
}
|
|
92
|
+
TaAccessUtil.signInLines = signInLines;
|
|
75
93
|
/** Opens a URL in the user's browser. */
|
|
76
94
|
function openBrowser(url) {
|
|
77
95
|
const [command, ...args] = process.platform === 'darwin' ? ['open', url] : process.platform === 'win32' ? ['cmd', '/c', 'start', '""', url] : ['xdg-open', url];
|
|
@@ -95,7 +113,8 @@ let TaAccess = class TaAccess {
|
|
|
95
113
|
}
|
|
96
114
|
allows(request) {
|
|
97
115
|
const token = TaAccessUtil.tokenOf(request);
|
|
98
|
-
|
|
116
|
+
// The token of the server, or that of a browser signed in with an account (TaSignIn).
|
|
117
|
+
return token !== undefined && (TaAccessUtil.equals(token, this.token) || this.signIn.store.check(token) !== undefined) && this.acceptsHost(request);
|
|
99
118
|
}
|
|
100
119
|
/** Calls over a WebSocket were checked when it opened; this covers plain HTTP. */
|
|
101
120
|
async handle(ctx, next) {
|
|
@@ -150,6 +169,12 @@ let TaAccess = class TaAccess {
|
|
|
150
169
|
console.log(`ta serve: web client at ${url}`);
|
|
151
170
|
TaAccessUtil.openBrowser(url);
|
|
152
171
|
}
|
|
172
|
+
else if (!TaAccessUtil.isLoopbackHost(this.host)) {
|
|
173
|
+
// Reached from elsewhere (a container, a server): whoever started it opens the link to sign in.
|
|
174
|
+
for (const line of TaAccessUtil.signInLines(this.signIn, port, process.env.TA_SERVE_TOKEN ? undefined : this.token)) {
|
|
175
|
+
console.log(`ta serve: ${line}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
153
178
|
}
|
|
154
179
|
};
|
|
155
180
|
exports.TaAccess = TaAccess;
|
|
@@ -161,6 +186,10 @@ __decorate([
|
|
|
161
186
|
(0, core_1.Autowired)(host_protocol_1.TaSessionRegistry),
|
|
162
187
|
__metadata("design:type", Object)
|
|
163
188
|
], TaAccess.prototype, "sessions", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
(0, core_1.Autowired)(ta_sign_in_1.TA_SIGN_IN),
|
|
191
|
+
__metadata("design:type", Function)
|
|
192
|
+
], TaAccess.prototype, "signIn", void 0);
|
|
164
193
|
exports.TaAccess = TaAccess = __decorate([
|
|
165
194
|
(0, core_1.Component)([exports.TA_ACCESS, node_1.RpcWebSocketGuard, node_2.Middleware, node_2.ServerAware, core_1.ApplicationLifecycle])
|
|
166
195
|
], TaAccess);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExecEnvironmentFactory } from '@celljs/ta-exec';
|
|
2
|
-
import { type RpcExtensionUIResponse, type TaAttachResult, type TaClientToolResult, type TaCommandResult, type TaForkFileResult, type TaNavigateResult, type TaOpenSessionOptions, type TaPromptInput, type TaPromptReceipt, TaServer, type TaServerInfo, type TaSessionInfo, type ThinkingLevel } from '@celljs/ta-protocol';
|
|
3
|
-
import { TaSessionRegistry } from './host-protocol';
|
|
2
|
+
import { type RpcExtensionUIResponse, type TaAttachOptions, type TaAttachResult, type TaClientToolResult, type TaCommandResult, type TaForkFileResult, type TaMessagePage, type TaNavigateResult, type TaOpenSessionOptions, type TaPromptInput, type TaPromptReceipt, type TaSavedSessionInfo, TaServer, type TaServerInfo, type TaSessionInfo, type ThinkingLevel } from '@celljs/ta-protocol';
|
|
3
|
+
import { TaSessionCatalog, TaSessionRegistry } from './host-protocol';
|
|
4
4
|
import { RemoteHosts } from './remote/remote-protocol';
|
|
5
5
|
import type { TaSession } from './ta-session';
|
|
6
6
|
import { TaWorkingDirectory } from './working-directory';
|
|
@@ -14,20 +14,25 @@ export declare class TaServerImpl implements TaServer {
|
|
|
14
14
|
protected readonly environments: ExecEnvironmentFactory;
|
|
15
15
|
protected readonly workingDirectory: TaWorkingDirectory;
|
|
16
16
|
protected readonly remoteHosts: RemoteHosts;
|
|
17
|
+
protected readonly catalog: TaSessionCatalog;
|
|
17
18
|
getServerInfo(): Promise<TaServerInfo>;
|
|
18
19
|
setWorkingDirectory(cwd: string): Promise<TaServerInfo>;
|
|
19
20
|
openSession(options: TaOpenSessionOptions): Promise<TaSessionInfo>;
|
|
20
21
|
closeSession(sessionId: string): Promise<void>;
|
|
21
22
|
listSessions(): Promise<TaSessionInfo[]>;
|
|
22
|
-
|
|
23
|
+
listSavedSessions(): Promise<TaSavedSessionInfo[]>;
|
|
24
|
+
attach(sessionId: string, afterSeq?: number, options?: TaAttachOptions): Promise<TaAttachResult>;
|
|
25
|
+
getEarlierMessages(sessionId: string, before: number | undefined, timestamp: number | undefined, budget: number): Promise<TaMessagePage>;
|
|
23
26
|
detach(sessionId: string): Promise<void>;
|
|
24
27
|
respondUi(sessionId: string, response: RpcExtensionUIResponse): Promise<boolean>;
|
|
28
|
+
claimClientTool(sessionId: string, id: string): Promise<boolean>;
|
|
25
29
|
respondClientTool(sessionId: string, result: TaClientToolResult): Promise<boolean>;
|
|
26
30
|
prompt(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
27
31
|
steer(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
28
32
|
followUp(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
29
33
|
abort(sessionId: string): Promise<void>;
|
|
30
34
|
clearQueue(sessionId: string): Promise<TaCommandResult<'clear_queue'>>;
|
|
35
|
+
removeQueued(sessionId: string, kind: 'steering' | 'followUp', index: number): Promise<boolean>;
|
|
31
36
|
newSession(sessionId: string, parentSession?: string): Promise<TaCommandResult<'new_session'>>;
|
|
32
37
|
getState(sessionId: string): Promise<TaCommandResult<'get_state'>>;
|
|
33
38
|
setModel(sessionId: string, provider: string, modelId: string): Promise<TaCommandResult<'set_model'>>;
|