@celljs/ta-host 4.7.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 +34 -4
- package/README.md +33 -3
- package/cell.schema.json +4 -0
- package/cell.yml +2 -0
- package/esm/node/auth-server-impl.d.ts +2 -0
- package/esm/node/auth-server-impl.js +7 -0
- package/esm/node/client-tool-broker.d.ts +11 -3
- package/esm/node/client-tool-broker.js +23 -3
- package/esm/node/extension-providers.d.ts +22 -0
- package/esm/node/extension-providers.js +52 -0
- package/esm/node/host-protocol.d.ts +22 -1
- package/esm/node/host-protocol.js +1 -0
- package/esm/node/index.d.ts +6 -0
- package/esm/node/index.js +6 -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-host-extension.d.ts +4 -2
- package/esm/node/package-host-extension.js +4 -3
- package/esm/node/package-hosts.d.ts +2 -2
- package/esm/node/package-hosts.js +2 -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/remote-ui-context.d.ts +6 -1
- package/esm/node/remote-ui-context.js +31 -3
- package/esm/node/session-catalog.d.ts +69 -0
- package/esm/node/session-catalog.js +211 -0
- package/esm/node/session-files.d.ts +18 -0
- package/esm/node/session-files.js +32 -0
- package/esm/node/session-info-util.d.ts +4 -1
- package/esm/node/session-info-util.js +8 -3
- package/esm/node/settings-server-impl.d.ts +1 -0
- package/esm/node/settings-server-impl.js +8 -0
- package/esm/node/settings-store.d.ts +3 -1
- package/esm/node/settings-store.js +25 -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 +4 -1
- package/esm/node/ta-session-factory.js +30 -7
- 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 +84 -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/terminal-service.d.ts +18 -2
- package/esm/node/terminal-service.js +45 -9
- package/esm/node/terminal-util.d.ts +14 -0
- package/esm/node/terminal-util.js +30 -1
- 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-protocol.d.ts +2 -0
- package/esm/node/workspace-server-impl.d.ts +2 -1
- package/esm/node/workspace-server-impl.js +13 -1
- package/esm/node/workspace-service.d.ts +1 -0
- package/esm/node/workspace-service.js +13 -1
- package/lib/node/auth-server-impl.d.ts +2 -0
- package/lib/node/auth-server-impl.js +7 -0
- package/lib/node/client-tool-broker.d.ts +11 -3
- package/lib/node/client-tool-broker.js +23 -3
- package/lib/node/extension-providers.d.ts +23 -0
- package/lib/node/extension-providers.js +55 -0
- package/lib/node/host-protocol.d.ts +22 -1
- package/lib/node/host-protocol.js +2 -1
- package/lib/node/index.d.ts +6 -0
- package/lib/node/index.js +6 -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-host-extension.d.ts +4 -2
- package/lib/node/package-host-extension.js +4 -3
- package/lib/node/package-hosts.d.ts +2 -2
- package/lib/node/package-hosts.js +2 -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/remote-ui-context.d.ts +6 -1
- package/lib/node/remote-ui-context.js +31 -3
- package/lib/node/session-catalog.d.ts +70 -0
- package/lib/node/session-catalog.js +214 -0
- package/lib/node/session-files.d.ts +19 -0
- package/lib/node/session-files.js +36 -0
- package/lib/node/session-info-util.d.ts +4 -1
- package/lib/node/session-info-util.js +7 -2
- package/lib/node/settings-server-impl.d.ts +1 -0
- package/lib/node/settings-server-impl.js +8 -0
- package/lib/node/settings-store.d.ts +3 -1
- package/lib/node/settings-store.js +25 -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 +4 -1
- package/lib/node/ta-session-factory.js +30 -7
- 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 +84 -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/terminal-service.d.ts +18 -2
- package/lib/node/terminal-service.js +44 -8
- package/lib/node/terminal-util.d.ts +14 -0
- package/lib/node/terminal-util.js +30 -1
- 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-protocol.d.ts +2 -0
- package/lib/node/workspace-server-impl.d.ts +2 -1
- package/lib/node/workspace-server-impl.js +12 -0
- package/lib/node/workspace-service.d.ts +1 -0
- package/lib/node/workspace-service.js +13 -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/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-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/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 -62
- package/lib/node/remote-ui-context.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 -146
- 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 -79
- 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 -71
- 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 -104
- 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 -252
- 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/host-protocol.ts +0 -62
- package/src/node/index.ts +0 -37
- package/src/node/module.ts +0 -4
- package/src/node/package-host-extension.ts +0 -20
- package/src/node/package-hosts.spec.ts +0 -54
- package/src/node/package-hosts.ts +0 -202
- 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 -68
- package/src/node/remote-ui-context.ts +0 -168
- 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 -33
- package/src/node/settings-store.spec.ts +0 -156
- package/src/node/settings-store.ts +0 -314
- 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 -203
- package/src/node/ta-session-registry.ts +0 -75
- package/src/node/ta-session.ts +0 -240
- package/src/node/terminal-protocol.ts +0 -18
- package/src/node/terminal-service.spec.ts +0 -84
- package/src/node/terminal-service.ts +0 -259
- package/src/node/terminal-util.spec.ts +0 -78
- package/src/node/terminal-util.ts +0 -166
- 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 -22
- package/src/node/workspace-server-impl.ts +0 -90
- package/src/node/workspace-service.spec.ts +0 -113
- package/src/node/workspace-service.ts +0 -223
- package/src/node/workspace-util.spec.ts +0 -47
- package/src/node/workspace-util.ts +0 -103
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { readdir, readFile, stat } from 'node:fs/promises';
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import { CODING_AGENT_OPTIONS, PiSdkUtil } from '@celljs/ai-coding-agent';
|
|
13
|
+
import { Autowired, Component, Value } from '@celljs/core';
|
|
14
|
+
import { TaSessionCatalog } from './host-protocol.js';
|
|
15
|
+
import { PiDirectories } from './remote/remote-protocol.js';
|
|
16
|
+
import { SessionInfoUtil } from './session-info-util.js';
|
|
17
|
+
/** Files read at once. */
|
|
18
|
+
const BATCH = 16;
|
|
19
|
+
export var SessionCatalogUtil;
|
|
20
|
+
(function (SessionCatalogUtil) {
|
|
21
|
+
/** pi's custom entry that names the group of the package that opened the session (TaOpenSessionOptions.group). */
|
|
22
|
+
SessionCatalogUtil.GROUP_ENTRY = 'ta-group';
|
|
23
|
+
/**
|
|
24
|
+
* Writes the group in the session, once: after the session closes, its file still says that its package
|
|
25
|
+
* opens it, with a role of its own. A custom entry is pi's way to keep the state of an extension: the model never reads it.
|
|
26
|
+
*/
|
|
27
|
+
function markGroup(session, group) {
|
|
28
|
+
if (groupOf(session.getEntries()) !== group) {
|
|
29
|
+
session.appendCustomEntry(SessionCatalogUtil.GROUP_ENTRY, { group });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
SessionCatalogUtil.markGroup = markGroup;
|
|
33
|
+
/** pi's custom entry that keeps the role a session was opened with (TaOpenSessionOptions.appendSystemPrompt). */
|
|
34
|
+
SessionCatalogUtil.ROLE_ENTRY = 'ta-role';
|
|
35
|
+
/**
|
|
36
|
+
* Writes the role of the session when it is not the one written last: opened again from its file
|
|
37
|
+
* without one (by a package that relays a message to it, or from the list of conversations), it keeps it.
|
|
38
|
+
*/
|
|
39
|
+
function markRole(session, role) {
|
|
40
|
+
if (roleOf(session.getEntries()) !== role) {
|
|
41
|
+
session.appendCustomEntry(SessionCatalogUtil.ROLE_ENTRY, { role });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
SessionCatalogUtil.markRole = markRole;
|
|
45
|
+
/** The role the last of the entries keeps. */
|
|
46
|
+
function roleOf(entries) {
|
|
47
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
48
|
+
const { type, customType, data } = entries[i];
|
|
49
|
+
if (type === 'custom' && customType === SessionCatalogUtil.ROLE_ENTRY) {
|
|
50
|
+
const role = data === null || data === void 0 ? void 0 : data.role;
|
|
51
|
+
return typeof role === 'string' && role ? role : undefined;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
SessionCatalogUtil.roleOf = roleOf;
|
|
57
|
+
/** The group the last of the entries names. */
|
|
58
|
+
function groupOf(entries) {
|
|
59
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
60
|
+
const { type, customType, data } = entries[i];
|
|
61
|
+
if (type === 'custom' && customType === SessionCatalogUtil.GROUP_ENTRY) {
|
|
62
|
+
const group = data === null || data === void 0 ? void 0 : data.group;
|
|
63
|
+
return typeof group === 'string' && group ? group : undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
SessionCatalogUtil.groupOf = groupOf;
|
|
69
|
+
/**
|
|
70
|
+
* What a list of conversations shows of the text of a pi session file, as pi's `/resume` reads it:
|
|
71
|
+
* undefined for a file that does not start with a session header.
|
|
72
|
+
*/
|
|
73
|
+
function summarize(text, modifiedAt) {
|
|
74
|
+
let header;
|
|
75
|
+
let sessionName;
|
|
76
|
+
let firstMessage;
|
|
77
|
+
let messageCount = 0;
|
|
78
|
+
let updatedAt;
|
|
79
|
+
const marks = [];
|
|
80
|
+
for (const line of text.split('\n')) {
|
|
81
|
+
const entry = parse(line);
|
|
82
|
+
if (!entry) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (!header) {
|
|
86
|
+
if (entry.type !== 'session') {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
header = entry;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (entry.type === 'session_info') {
|
|
93
|
+
sessionName = typeof entry.name === 'string' ? entry.name.trim() || undefined : undefined;
|
|
94
|
+
}
|
|
95
|
+
else if (entry.type === 'custom') {
|
|
96
|
+
marks.push(entry);
|
|
97
|
+
}
|
|
98
|
+
else if (entry.type === 'message' && entry.message && typeof entry.message === 'object') {
|
|
99
|
+
const message = entry.message;
|
|
100
|
+
messageCount++;
|
|
101
|
+
firstMessage !== null && firstMessage !== void 0 ? firstMessage : (firstMessage = SessionInfoUtil.firstMessage([message]));
|
|
102
|
+
if (typeof message.timestamp === 'number') {
|
|
103
|
+
updatedAt = Math.max(updatedAt !== null && updatedAt !== void 0 ? updatedAt : 0, message.timestamp);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (!header || typeof header.id !== 'string') {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
const started = typeof header.timestamp === 'string' ? Date.parse(header.timestamp) : Number.NaN;
|
|
111
|
+
const createdAt = Number.isNaN(started) ? modifiedAt : started;
|
|
112
|
+
return {
|
|
113
|
+
piSessionId: header.id,
|
|
114
|
+
piCwd: typeof header.cwd === 'string' ? header.cwd : '',
|
|
115
|
+
sessionName,
|
|
116
|
+
firstMessage,
|
|
117
|
+
messageCount,
|
|
118
|
+
createdAt,
|
|
119
|
+
updatedAt: updatedAt !== null && updatedAt !== void 0 ? updatedAt : createdAt,
|
|
120
|
+
group: groupOf(marks),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
SessionCatalogUtil.summarize = summarize;
|
|
124
|
+
function parse(line) {
|
|
125
|
+
if (!line.trim()) {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
const entry = JSON.parse(line);
|
|
130
|
+
return entry && typeof entry === 'object' && typeof entry.type === 'string' ? entry : undefined;
|
|
131
|
+
}
|
|
132
|
+
catch (_a) {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
})(SessionCatalogUtil || (SessionCatalogUtil = {}));
|
|
137
|
+
/**
|
|
138
|
+
* The session files of pi in its agent directory, one directory per working directory, as pi's `/resume`
|
|
139
|
+
* lists them. A file is read again only when it changed since the last list.
|
|
140
|
+
*/
|
|
141
|
+
let DefaultTaSessionCatalog = class DefaultTaSessionCatalog {
|
|
142
|
+
constructor() {
|
|
143
|
+
/** By file: its size and time when read, and what it held. */
|
|
144
|
+
this.cache = new Map();
|
|
145
|
+
}
|
|
146
|
+
async list() {
|
|
147
|
+
const files = await this.files(await this.sessionsDir());
|
|
148
|
+
const sessions = [];
|
|
149
|
+
for (let i = 0; i < files.length; i += BATCH) {
|
|
150
|
+
await Promise.all(files.slice(i, i + BATCH).map(async (file) => {
|
|
151
|
+
const summary = await this.summary(file);
|
|
152
|
+
if (summary) {
|
|
153
|
+
const { piCwd, ...info } = summary;
|
|
154
|
+
sessions.push({ ...info, sessionFile: file, cwd: piCwd && this.directories.fromPi(piCwd) });
|
|
155
|
+
}
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
const listed = new Set(files);
|
|
159
|
+
for (const file of this.cache.keys()) {
|
|
160
|
+
if (!listed.has(file)) {
|
|
161
|
+
this.cache.delete(file);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return sessions.sort((a, b) => b.updatedAt - a.updatedAt);
|
|
165
|
+
}
|
|
166
|
+
/** Where pi keeps the sessions it creates (SessionManager.create without a directory). */
|
|
167
|
+
async sessionsDir() {
|
|
168
|
+
var _a;
|
|
169
|
+
var _b;
|
|
170
|
+
const agentDir = (_b = (_a = this.codingAgentOptions) === null || _a === void 0 ? void 0 : _a.agentDir) !== null && _b !== void 0 ? _b : (await PiSdkUtil.load()).getAgentDir();
|
|
171
|
+
return join(agentDir, 'sessions');
|
|
172
|
+
}
|
|
173
|
+
async files(root) {
|
|
174
|
+
const dirs = await readdir(root, { withFileTypes: true }).catch(() => []);
|
|
175
|
+
const files = await Promise.all(dirs
|
|
176
|
+
.filter(dir => dir.isDirectory())
|
|
177
|
+
.map(async (dir) => {
|
|
178
|
+
const names = await readdir(join(root, dir.name)).catch(() => []);
|
|
179
|
+
return names.filter(name => name.endsWith('.jsonl')).map(name => join(root, dir.name, name));
|
|
180
|
+
}));
|
|
181
|
+
return files.flat();
|
|
182
|
+
}
|
|
183
|
+
async summary(file) {
|
|
184
|
+
const stats = await stat(file).catch(() => undefined);
|
|
185
|
+
if (!(stats === null || stats === void 0 ? void 0 : stats.isFile())) {
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
const version = `${stats.size}:${stats.mtimeMs}`;
|
|
189
|
+
const cached = this.cache.get(file);
|
|
190
|
+
if ((cached === null || cached === void 0 ? void 0 : cached.version) === version) {
|
|
191
|
+
return cached.summary;
|
|
192
|
+
}
|
|
193
|
+
const text = await readFile(file, 'utf8').catch(() => undefined);
|
|
194
|
+
const summary = text === undefined ? undefined : SessionCatalogUtil.summarize(text, stats.mtimeMs);
|
|
195
|
+
this.cache.set(file, { version, summary });
|
|
196
|
+
return summary;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
__decorate([
|
|
200
|
+
Value(CODING_AGENT_OPTIONS),
|
|
201
|
+
__metadata("design:type", Object)
|
|
202
|
+
], DefaultTaSessionCatalog.prototype, "codingAgentOptions", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
Autowired(PiDirectories),
|
|
205
|
+
__metadata("design:type", Object)
|
|
206
|
+
], DefaultTaSessionCatalog.prototype, "directories", void 0);
|
|
207
|
+
DefaultTaSessionCatalog = __decorate([
|
|
208
|
+
Component(TaSessionCatalog)
|
|
209
|
+
], DefaultTaSessionCatalog);
|
|
210
|
+
export { DefaultTaSessionCatalog };
|
|
211
|
+
//# sourceMappingURL=session-catalog.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ExecEnvironment } from '@celljs/ta-exec';
|
|
2
|
+
import { ExecOperations } from '@celljs/ta-harness';
|
|
3
|
+
import type { TaSessionFiles } from '@celljs/ta-protocol';
|
|
4
|
+
/**
|
|
5
|
+
* The files of a session on its execution environment. `piCwd` is the directory pi works in for it
|
|
6
|
+
* (PiDirectories): pi's tools resolve paths there, and ExecOperations maps them into the environment.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ExecSessionFiles implements TaSessionFiles {
|
|
9
|
+
protected readonly environment: ExecEnvironment;
|
|
10
|
+
protected readonly piCwd: string;
|
|
11
|
+
protected readonly operations: ExecOperations;
|
|
12
|
+
constructor(environment: ExecEnvironment, piCwd: string);
|
|
13
|
+
/** As pi's tools resolve a path of their arguments: without a leading `@`, `~` the home directory, against pi's directory. */
|
|
14
|
+
resolve(path: string): string;
|
|
15
|
+
read(path: string): Promise<Uint8Array | undefined>;
|
|
16
|
+
write(path: string, data: Uint8Array): Promise<void>;
|
|
17
|
+
remove(path: string): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { homedir } from 'node:os';
|
|
2
|
+
import { dirname, posix, resolve } from 'node:path';
|
|
3
|
+
import { ExecOperations } from '@celljs/ta-harness';
|
|
4
|
+
/**
|
|
5
|
+
* The files of a session on its execution environment. `piCwd` is the directory pi works in for it
|
|
6
|
+
* (PiDirectories): pi's tools resolve paths there, and ExecOperations maps them into the environment.
|
|
7
|
+
*/
|
|
8
|
+
export class ExecSessionFiles {
|
|
9
|
+
constructor(environment, piCwd) {
|
|
10
|
+
this.environment = environment;
|
|
11
|
+
this.piCwd = piCwd;
|
|
12
|
+
this.operations = new ExecOperations(environment, piCwd);
|
|
13
|
+
}
|
|
14
|
+
/** As pi's tools resolve a path of their arguments: without a leading `@`, `~` the home directory, against pi's directory. */
|
|
15
|
+
resolve(path) {
|
|
16
|
+
const bare = path.startsWith('@') ? path.slice(1) : path;
|
|
17
|
+
const expanded = bare === '~' || bare.startsWith('~/') ? homedir() + bare.slice(1) : bare;
|
|
18
|
+
return this.operations.map(resolve(this.piCwd, expanded));
|
|
19
|
+
}
|
|
20
|
+
async read(path) {
|
|
21
|
+
const stat = await this.environment.stat(path);
|
|
22
|
+
return stat && !stat.isDirectory ? this.environment.readFile(path) : undefined;
|
|
23
|
+
}
|
|
24
|
+
async write(path, data) {
|
|
25
|
+
await this.environment.mkdir(this.environment.local ? dirname(path) : posix.dirname(path));
|
|
26
|
+
await this.environment.writeFile(path, data);
|
|
27
|
+
}
|
|
28
|
+
remove(path) {
|
|
29
|
+
return this.environment.remove(path, { recursive: false });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=session-files.js.map
|
|
@@ -6,7 +6,10 @@ interface MessageLike {
|
|
|
6
6
|
}
|
|
7
7
|
/** What a list of conversations shows of one: its first message, as pi's session list does, and when it last changed. */
|
|
8
8
|
export declare namespace SessionInfoUtil {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* The first line of the first message of the user that has text, without its context, cut to a title's length;
|
|
11
|
+
* a skill the user ran is `/skill:name` and what follows, not the skill's file.
|
|
12
|
+
*/
|
|
10
13
|
function firstMessage(messages: readonly MessageLike[]): string | undefined;
|
|
11
14
|
/** The time of the last message that has one, else `fallback`. */
|
|
12
15
|
function updatedAt(messages: readonly MessageLike[], fallback: number): number;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import { TaMessageContext } from '@celljs/ta-protocol';
|
|
1
|
+
import { TaMessageContext, TaSkillUse } from '@celljs/ta-protocol';
|
|
2
2
|
/** What a list of conversations shows of one: its first message, as pi's session list does, and when it last changed. */
|
|
3
3
|
export var SessionInfoUtil;
|
|
4
4
|
(function (SessionInfoUtil) {
|
|
5
5
|
const LENGTH = 120;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* The first line of the first message of the user that has text, without its context, cut to a title's length;
|
|
8
|
+
* a skill the user ran is `/skill:name` and what follows, not the skill's file.
|
|
9
|
+
*/
|
|
7
10
|
function firstMessage(messages) {
|
|
8
11
|
for (const message of messages) {
|
|
9
12
|
if (message.role !== 'user') {
|
|
10
13
|
continue;
|
|
11
14
|
}
|
|
12
|
-
const
|
|
15
|
+
const said = TaMessageContext.strip(text(message.content));
|
|
16
|
+
const skill = TaSkillUse.parse(said);
|
|
17
|
+
const line = (skill ? TaSkillUse.command(skill) : said)
|
|
13
18
|
.split('\n')
|
|
14
19
|
.map(part => part.trim())
|
|
15
20
|
.find(Boolean);
|
|
@@ -7,5 +7,6 @@ export declare class TaSettingsServerImpl implements TaSettingsServer {
|
|
|
7
7
|
protected readonly settings: TaSettingsStore;
|
|
8
8
|
getSettings(cwd?: string): Promise<TaSettingsSnapshot>;
|
|
9
9
|
updateSettings(scope: TaSettingsScope, changes: Record<string, unknown>, cwd?: string): Promise<TaSettingsSnapshot>;
|
|
10
|
+
setLanguage(language: string): Promise<void>;
|
|
10
11
|
protected cwd(cwd?: string): Promise<string>;
|
|
11
12
|
}
|
|
@@ -26,6 +26,14 @@ let TaSettingsServerImpl = class TaSettingsServerImpl {
|
|
|
26
26
|
return this.settings.update(scope, changes, await this.cwd(cwd));
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
+
setLanguage(language) {
|
|
30
|
+
return TaErrors.guard(async () => {
|
|
31
|
+
if (typeof language !== 'string' || !/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(language)) {
|
|
32
|
+
throw TaErrors.invalidArgument(`${String(language)} is not a language tag.`, 'Pass a tag such as zh-CN or en-US.');
|
|
33
|
+
}
|
|
34
|
+
process.env.TA_LANGUAGE = language;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
29
37
|
async cwd(cwd) {
|
|
30
38
|
return cwd || (await this.environments.defaultCwd());
|
|
31
39
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CodingAgentOptions, ModelRuntimeProvider } from '@celljs/ai-coding-agent';
|
|
2
2
|
import { type TaSettingSpec, type TaSettingsScope, type TaSettingsSnapshot } from '@celljs/ta-protocol';
|
|
3
|
+
import { ExtensionProviders } from './extension-providers.js';
|
|
3
4
|
import { TaSessionRegistry } from './host-protocol.js';
|
|
4
5
|
import { PiDirectories } from './remote/remote-protocol.js';
|
|
5
6
|
export declare const TaSettingsStore: unique symbol;
|
|
@@ -35,6 +36,7 @@ export declare class TaSettingsStoreImpl implements TaSettingsStore {
|
|
|
35
36
|
protected readonly codingAgentOptions?: CodingAgentOptions;
|
|
36
37
|
protected readonly modelRuntimeProvider: ModelRuntimeProvider;
|
|
37
38
|
protected readonly sessions: TaSessionRegistry;
|
|
39
|
+
protected readonly extensionProviders: ExtensionProviders;
|
|
38
40
|
protected readonly directories: PiDirectories;
|
|
39
41
|
/** One write at a time, so that two changes of one file both stay. */
|
|
40
42
|
protected writing: Promise<unknown>;
|
|
@@ -52,7 +54,7 @@ export declare class TaSettingsStoreImpl implements TaSettingsStore {
|
|
|
52
54
|
trust(): void;
|
|
53
55
|
}>;
|
|
54
56
|
protected read(file: string): Promise<Record<string, unknown>>;
|
|
55
|
-
protected models(): Promise<
|
|
57
|
+
protected models(): Promise<Pick<TaSettingsSnapshot, 'models' | 'modelNames' | 'providerNames'>>;
|
|
56
58
|
protected reloadSessions(scope: TaSettingsScope, cwd: string): Promise<void>;
|
|
57
59
|
}
|
|
58
60
|
export {};
|
|
@@ -12,6 +12,7 @@ import { dirname, join } from 'node:path';
|
|
|
12
12
|
import { CODING_AGENT_OPTIONS, ModelRuntimeProvider, PiSdkUtil } from '@celljs/ai-coding-agent';
|
|
13
13
|
import { Autowired, Component, Value } from '@celljs/core';
|
|
14
14
|
import { TA_SETTINGS } from '@celljs/ta-protocol';
|
|
15
|
+
import { ExtensionProviders } from './extension-providers.js';
|
|
15
16
|
import { TaSessionRegistry } from './host-protocol.js';
|
|
16
17
|
import { PiDirectories } from './remote/remote-protocol.js';
|
|
17
18
|
import { TaErrors } from './ta-errors.js';
|
|
@@ -203,7 +204,7 @@ let TaSettingsStoreImpl = class TaSettingsStoreImpl {
|
|
|
203
204
|
}
|
|
204
205
|
async get(cwd) {
|
|
205
206
|
const { userFile, projectFile, trusted } = await this.files(cwd);
|
|
206
|
-
const [user, project, models] = await Promise.all([this.read(userFile), this.read(projectFile), this.models()]);
|
|
207
|
+
const [user, project, { models, modelNames, providerNames }] = await Promise.all([this.read(userFile), this.read(projectFile), this.models()]);
|
|
207
208
|
return {
|
|
208
209
|
user: TaSettingsUtil.read(user),
|
|
209
210
|
project: TaSettingsUtil.read(project),
|
|
@@ -212,6 +213,8 @@ let TaSettingsStoreImpl = class TaSettingsStoreImpl {
|
|
|
212
213
|
projectFile,
|
|
213
214
|
projectTrusted: trusted !== false,
|
|
214
215
|
models,
|
|
216
|
+
modelNames,
|
|
217
|
+
providerNames,
|
|
215
218
|
};
|
|
216
219
|
}
|
|
217
220
|
update(scope, changes, cwd) {
|
|
@@ -272,10 +275,25 @@ let TaSettingsStoreImpl = class TaSettingsStoreImpl {
|
|
|
272
275
|
async models() {
|
|
273
276
|
try {
|
|
274
277
|
const runtime = await this.modelRuntimeProvider.provide();
|
|
275
|
-
|
|
278
|
+
await this.extensionProviders.ensure();
|
|
279
|
+
const available = await runtime.getAvailable();
|
|
280
|
+
const modelNames = {};
|
|
281
|
+
for (const model of available) {
|
|
282
|
+
if (model.name && model.name !== model.id) {
|
|
283
|
+
modelNames[`${model.provider}/${model.id}`] = model.name;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
const used = new Set(available.map(model => model.provider));
|
|
287
|
+
const providerNames = {};
|
|
288
|
+
for (const provider of runtime.getProviders()) {
|
|
289
|
+
if (used.has(provider.id) && provider.name && provider.name !== provider.id) {
|
|
290
|
+
providerNames[provider.id] = provider.name;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return { models: available.map(model => `${model.provider}/${model.id}`), modelNames, providerNames };
|
|
276
294
|
}
|
|
277
295
|
catch (_a) {
|
|
278
|
-
return [];
|
|
296
|
+
return { models: [], modelNames: {}, providerNames: {} };
|
|
279
297
|
}
|
|
280
298
|
}
|
|
281
299
|
async reloadSessions(scope, cwd) {
|
|
@@ -302,6 +320,10 @@ __decorate([
|
|
|
302
320
|
Autowired(TaSessionRegistry),
|
|
303
321
|
__metadata("design:type", Object)
|
|
304
322
|
], TaSettingsStoreImpl.prototype, "sessions", void 0);
|
|
323
|
+
__decorate([
|
|
324
|
+
Autowired(ExtensionProviders),
|
|
325
|
+
__metadata("design:type", Object)
|
|
326
|
+
], TaSettingsStoreImpl.prototype, "extensionProviders", void 0);
|
|
305
327
|
__decorate([
|
|
306
328
|
Autowired(PiDirectories),
|
|
307
329
|
__metadata("design:type", Object)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RpcConnectionManager } from '@celljs/rpc/lib/node';
|
|
2
|
+
import { type TaAccessInfo, TaAccessServer } from '@celljs/ta-protocol';
|
|
3
|
+
import { type TaAccess } from '../ta-access.js';
|
|
4
|
+
import { type TaSignIn } from './ta-sign-in.js';
|
|
5
|
+
/** Who may sign in with an account, for anyone in; a browser that loses its sign-in is cut off at once. */
|
|
6
|
+
export declare class TaAccessServerImpl implements TaAccessServer {
|
|
7
|
+
protected readonly signIn: TaSignIn;
|
|
8
|
+
protected readonly access: TaAccess;
|
|
9
|
+
protected readonly connections: RpcConnectionManager;
|
|
10
|
+
getAccess(): Promise<TaAccessInfo>;
|
|
11
|
+
bindUrl(provider: string): Promise<string>;
|
|
12
|
+
allow(account: string, name?: string): Promise<void>;
|
|
13
|
+
dismiss(account: string): Promise<void>;
|
|
14
|
+
disallow(account: string): Promise<void>;
|
|
15
|
+
signOut(signInId: string): Promise<void>;
|
|
16
|
+
/** Connections whose token no longer lets in; the client finds itself signed out when it reconnects. */
|
|
17
|
+
protected cutOff(): void;
|
|
18
|
+
protected tokenOf(request: unknown): string | undefined;
|
|
19
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Autowired } from '@celljs/core';
|
|
11
|
+
import { Rpc } from '@celljs/rpc';
|
|
12
|
+
import { RpcConnectionManager, RpcContext } from '@celljs/rpc/lib/node';
|
|
13
|
+
import { TaAccessServer } from '@celljs/ta-protocol';
|
|
14
|
+
import { TA_ACCESS, TaAccessUtil } from '../ta-access.js';
|
|
15
|
+
import { TaErrors } from '../ta-errors.js';
|
|
16
|
+
import { AccessUtil } from './access-store.js';
|
|
17
|
+
import { TA_SIGN_IN } from './ta-sign-in.js';
|
|
18
|
+
const ACCOUNT = /^[a-z][a-z0-9-]*:\S+$/;
|
|
19
|
+
/** Who may sign in with an account, for anyone in; a browser that loses its sign-in is cut off at once. */
|
|
20
|
+
let TaAccessServerImpl = class TaAccessServerImpl {
|
|
21
|
+
async getAccess() {
|
|
22
|
+
var _a;
|
|
23
|
+
const providers = this.signIn.providers.map(({ id, name }) => ({ id, name }));
|
|
24
|
+
return { providers, canManage: true, ...this.signIn.store.info(this.tokenOf((_a = RpcContext.connection()) === null || _a === void 0 ? void 0 : _a.request)) };
|
|
25
|
+
}
|
|
26
|
+
bindUrl(provider) {
|
|
27
|
+
return TaErrors.guard(async () => {
|
|
28
|
+
if (typeof provider !== 'string' || !this.signIn.provider(provider)) {
|
|
29
|
+
throw TaErrors.invalidArgument(`ta serve offers no sign-in with ${provider}.`, 'Pick one of the providers of getAccess.');
|
|
30
|
+
}
|
|
31
|
+
return this.signIn.bindUrl(provider);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
allow(account, name) {
|
|
35
|
+
return TaErrors.guard(async () => {
|
|
36
|
+
if (typeof account !== 'string' || !ACCOUNT.test(account.trim())) {
|
|
37
|
+
throw TaErrors.invalidArgument(`${account} is not an account.`, 'Write it <provider>:<login or address>, such as github:octocat.');
|
|
38
|
+
}
|
|
39
|
+
this.signIn.store.allow(account.trim(), typeof name === 'string' ? name : undefined);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async dismiss(account) {
|
|
43
|
+
this.signIn.store.dismiss(String(account));
|
|
44
|
+
}
|
|
45
|
+
async disallow(account) {
|
|
46
|
+
this.signIn.store.disallow(AccessUtil.normalize(String(account)));
|
|
47
|
+
this.cutOff();
|
|
48
|
+
}
|
|
49
|
+
async signOut(signInId) {
|
|
50
|
+
this.signIn.store.signOut(String(signInId));
|
|
51
|
+
this.cutOff();
|
|
52
|
+
}
|
|
53
|
+
/** Connections whose token no longer lets in; the client finds itself signed out when it reconnects. */
|
|
54
|
+
cutOff() {
|
|
55
|
+
for (const connection of this.connections.connections) {
|
|
56
|
+
const token = this.tokenOf(connection.request);
|
|
57
|
+
if (token && !TaAccessUtil.equals(token, this.access.token) && !this.signIn.store.check(token)) {
|
|
58
|
+
connection.close(1008, 'Signed out');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
tokenOf(request) {
|
|
63
|
+
return request ? TaAccessUtil.tokenOf(request) : undefined;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
__decorate([
|
|
67
|
+
Autowired(TA_SIGN_IN),
|
|
68
|
+
__metadata("design:type", Function)
|
|
69
|
+
], TaAccessServerImpl.prototype, "signIn", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
Autowired(TA_ACCESS),
|
|
72
|
+
__metadata("design:type", Function)
|
|
73
|
+
], TaAccessServerImpl.prototype, "access", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
Autowired(RpcConnectionManager),
|
|
76
|
+
__metadata("design:type", Object)
|
|
77
|
+
], TaAccessServerImpl.prototype, "connections", void 0);
|
|
78
|
+
TaAccessServerImpl = __decorate([
|
|
79
|
+
Rpc(TaAccessServer)
|
|
80
|
+
], TaAccessServerImpl);
|
|
81
|
+
export { TaAccessServerImpl };
|
|
82
|
+
//# sourceMappingURL=access-server-impl.js.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { TaAccessInfo, TaAccessRequest } from '@celljs/ta-protocol';
|
|
2
|
+
import type { SignInAccount } from './sign-in-provider.js';
|
|
3
|
+
/** A browser signed in: only the hash of its token is kept. */
|
|
4
|
+
export interface StoredSignIn {
|
|
5
|
+
id: string;
|
|
6
|
+
hash: string;
|
|
7
|
+
account: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
avatar?: string;
|
|
10
|
+
createdAt: number;
|
|
11
|
+
lastUsedAt: number;
|
|
12
|
+
device?: string;
|
|
13
|
+
}
|
|
14
|
+
interface AddedAccount {
|
|
15
|
+
id: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
avatar?: string;
|
|
18
|
+
addedAt: number;
|
|
19
|
+
}
|
|
20
|
+
interface AccessFile {
|
|
21
|
+
accounts: AddedAccount[];
|
|
22
|
+
requests: TaAccessRequest[];
|
|
23
|
+
signIns: StoredSignIn[];
|
|
24
|
+
}
|
|
25
|
+
export declare namespace AccessUtil {
|
|
26
|
+
/** Logins and addresses are the same whatever their case; the ids of WeChat and `sub`s are not. */
|
|
27
|
+
function normalize(account: string): string;
|
|
28
|
+
/** `google:*@corp.com` lets in every address of the domain; anything else, one account. */
|
|
29
|
+
function matches(pattern: string, account: string): boolean;
|
|
30
|
+
/** TA_ALLOWED_USERS: accounts separated by commas, spaces or new lines. */
|
|
31
|
+
function parseList(list: string | undefined): string[];
|
|
32
|
+
function hash(token: string): string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Who may sign in with an account, and the browsers signed in: `access.json` of the agent directory, which
|
|
36
|
+
* only this user reads, beside the accounts of TA_ALLOWED_USERS. A sign-in lets its browser in while its
|
|
37
|
+
* account is let in: removing the account signs its browsers out.
|
|
38
|
+
*/
|
|
39
|
+
export declare class AccessStore {
|
|
40
|
+
readonly file: string;
|
|
41
|
+
protected readonly fromEnv: string[];
|
|
42
|
+
protected data?: AccessFile;
|
|
43
|
+
protected readonly touched: Map<string, number>;
|
|
44
|
+
constructor(file: string, fromEnv?: string[]);
|
|
45
|
+
/** Whether the account is let in, by TA_ALLOWED_USERS or here. */
|
|
46
|
+
allows(account: string): boolean;
|
|
47
|
+
/** Anyone let in at all: otherwise an account that signs in can only ask. */
|
|
48
|
+
get open(): boolean;
|
|
49
|
+
/** A new sign-in of an account let in: the token for its browser, which only it keeps. */
|
|
50
|
+
signIn(account: SignInAccount, device?: string, now?: number): string;
|
|
51
|
+
/** The sign-in of a token, while its account is let in. */
|
|
52
|
+
check(token: string, now?: number): StoredSignIn | undefined;
|
|
53
|
+
/** Someone not let in signed in: the owner sees it, and lets them in with a tap. */
|
|
54
|
+
request(account: SignInAccount, now?: number): void;
|
|
55
|
+
allow(account: string, name?: string, now?: number): void;
|
|
56
|
+
dismiss(account: string): void;
|
|
57
|
+
/** An account added here no longer lets in; its sign-ins go too, unless TA_ALLOWED_USERS lets it in. */
|
|
58
|
+
disallow(account: string): void;
|
|
59
|
+
signOut(signInId: string): void;
|
|
60
|
+
info(currentToken?: string, now?: number): Omit<TaAccessInfo, 'providers'>;
|
|
61
|
+
protected read(): AccessFile;
|
|
62
|
+
/** Whole or not at all: a new file put in the place of the old. */
|
|
63
|
+
protected write(): void;
|
|
64
|
+
}
|
|
65
|
+
export {};
|