@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
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Server } from 'node:http';
|
|
2
2
|
import { type Application, ApplicationLifecycle } from '@celljs/core';
|
|
3
|
-
import {
|
|
3
|
+
import { ExecEnvironmentFactory } from '@celljs/ta-exec';
|
|
4
|
+
import { type TaPackageShare, type TaRelayDevice, type TaRelayInfo, TaRelayServer } from '@celljs/ta-protocol';
|
|
4
5
|
import { RelayHost, RelayStore } from '@celljs/ta-relay/lib/node';
|
|
5
6
|
import { ServerAware } from '@celljs/web/lib/node';
|
|
7
|
+
import { WebExtensionCatalog } from './host-protocol.js';
|
|
6
8
|
import { type TaAccess } from './ta-access.js';
|
|
7
9
|
/** The id of {@link RelayBridge}, for TaRelayServerImpl. */
|
|
8
10
|
export declare const RELAY_BRIDGE: unique symbol;
|
|
@@ -20,11 +22,17 @@ export declare class RelayBridge implements ServerAware, ApplicationLifecycle<Ap
|
|
|
20
22
|
refresh(): void;
|
|
21
23
|
setServer(server: Server): Promise<void>;
|
|
22
24
|
onStop(): Promise<void>;
|
|
25
|
+
/** A package as it goes by a link: a gzipped tar of its directory, without node_modules and .git. */
|
|
26
|
+
static pack(root: string): Promise<Uint8Array>;
|
|
23
27
|
protected start(server: Server): void;
|
|
24
28
|
}
|
|
25
29
|
/** `ta pair` for clients: the devices of relay.json, which RelayBridge serves. Their keys never leave, but in the link of a new one. */
|
|
26
30
|
export declare class TaRelayServerImpl implements TaRelayServer {
|
|
27
31
|
protected readonly bridge: RelayBridge;
|
|
32
|
+
protected readonly catalog: WebExtensionCatalog;
|
|
33
|
+
protected readonly environments: ExecEnvironmentFactory;
|
|
34
|
+
sharePackage(id: string): Promise<TaPackageShare>;
|
|
35
|
+
unsharePackage(id: string): Promise<void>;
|
|
28
36
|
getRelay(): Promise<TaRelayInfo>;
|
|
29
37
|
pair(relay: string, name: string): Promise<{
|
|
30
38
|
link: string;
|
package/esm/node/relay-bridge.js
CHANGED
|
@@ -7,13 +7,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
+
var RelayBridge_1;
|
|
10
11
|
import { unwatchFile, watchFile } from 'node:fs';
|
|
12
|
+
import { basename } from 'node:path';
|
|
11
13
|
import { ApplicationLifecycle, Autowired, Component } from '@celljs/core';
|
|
12
14
|
import { Rpc } from '@celljs/rpc';
|
|
15
|
+
import { ExecEnvironmentFactory } from '@celljs/ta-exec';
|
|
16
|
+
import { PackageArchive } from '@celljs/ta-harness/lib/node/package-archive';
|
|
13
17
|
import { TaBrand } from '@celljs/ta-harness/lib/node/ta-brand';
|
|
14
18
|
import { TA_WEBSOCKET_PATH, TaRelayServer } from '@celljs/ta-protocol';
|
|
15
|
-
import { RELAY_DEFAULT_URL, RelayHost, RelayPairingUtil, RelayStore } from '@celljs/ta-relay/lib/node';
|
|
19
|
+
import { RELAY_DEFAULT_URL, RELAY_SHARE_MAX_BYTES, RelayHost, RelayPairingUtil, RelayShareUtil, RelayStore } from '@celljs/ta-relay/lib/node';
|
|
16
20
|
import { ServerAware } from '@celljs/web/lib/node';
|
|
21
|
+
import { WebExtensionCatalog } from './host-protocol.js';
|
|
17
22
|
import { TA_ACCESS } from './ta-access.js';
|
|
18
23
|
import { TaErrors } from './ta-errors.js';
|
|
19
24
|
/** The id of {@link RelayBridge}, for TaRelayServerImpl. */
|
|
@@ -25,7 +30,7 @@ const WATCH_INTERVAL_MS = 2000;
|
|
|
25
30
|
* keeps a connection out to the relay and gives each device a connection of its own to this server.
|
|
26
31
|
* Without one it does nothing.
|
|
27
32
|
*/
|
|
28
|
-
let RelayBridge = class RelayBridge {
|
|
33
|
+
let RelayBridge = RelayBridge_1 = class RelayBridge {
|
|
29
34
|
constructor() {
|
|
30
35
|
this.store = new RelayStore(TaBrand.agentDir());
|
|
31
36
|
}
|
|
@@ -53,10 +58,14 @@ let RelayBridge = class RelayBridge {
|
|
|
53
58
|
unwatchFile(this.store.file);
|
|
54
59
|
(_a = this.host) === null || _a === void 0 ? void 0 : _a.stop();
|
|
55
60
|
}
|
|
61
|
+
/** A package as it goes by a link: a gzipped tar of its directory, without node_modules and .git. */
|
|
62
|
+
static async pack(root) {
|
|
63
|
+
return PackageArchive.pack(basename(root), PackageArchive.collect(root));
|
|
64
|
+
}
|
|
56
65
|
start(server) {
|
|
57
66
|
const { port } = server.address();
|
|
58
67
|
const localUrl = `ws://127.0.0.1:${port}${TA_WEBSOCKET_PATH}?token=${encodeURIComponent(this.access.token)}`;
|
|
59
|
-
const host = new RelayHost({ store: this.store, localUrl });
|
|
68
|
+
const host = new RelayHost({ store: this.store, localUrl, sharePackage: share => RelayBridge_1.pack(share.root) });
|
|
60
69
|
this.host = host;
|
|
61
70
|
host.start();
|
|
62
71
|
watchFile(this.store.file, { interval: WATCH_INTERVAL_MS }, () => host.refresh());
|
|
@@ -66,13 +75,36 @@ __decorate([
|
|
|
66
75
|
Autowired(TA_ACCESS),
|
|
67
76
|
__metadata("design:type", Function)
|
|
68
77
|
], RelayBridge.prototype, "access", void 0);
|
|
69
|
-
RelayBridge = __decorate([
|
|
78
|
+
RelayBridge = RelayBridge_1 = __decorate([
|
|
70
79
|
Component([RELAY_BRIDGE, ServerAware, ApplicationLifecycle])
|
|
71
80
|
], RelayBridge);
|
|
72
81
|
export { RelayBridge };
|
|
73
82
|
const device = ({ id, name, createdAt }) => ({ id, name, createdAt });
|
|
74
83
|
/** `ta pair` for clients: the devices of relay.json, which RelayBridge serves. Their keys never leave, but in the link of a new one. */
|
|
75
84
|
let TaRelayServerImpl = class TaRelayServerImpl {
|
|
85
|
+
sharePackage(id) {
|
|
86
|
+
return TaErrors.guard(async () => {
|
|
87
|
+
const pkg = await this.catalog.packageOf(await this.environments.defaultCwd(), id);
|
|
88
|
+
if (pkg.origin === 'builtin') {
|
|
89
|
+
throw TaErrors.invalidArgument(`${pkg.name} comes with Ta: everyone has it already.`, 'Share a package of your own, or one you installed.');
|
|
90
|
+
}
|
|
91
|
+
// Packed once now: what is too large is told at once, not when the other computer asks.
|
|
92
|
+
const size = (await RelayBridge.pack(pkg.root)).length;
|
|
93
|
+
if (size > RELAY_SHARE_MAX_BYTES) {
|
|
94
|
+
throw TaErrors.invalidArgument(`${pkg.name} is ${(size / 1024 / 1024).toFixed(1)} MB packed, more than the ${RELAY_SHARE_MAX_BYTES / 1024 / 1024} MB a link takes.`, 'Publish it to npm or Git and share that, or export it as a file.');
|
|
95
|
+
}
|
|
96
|
+
const { link, share } = this.bridge.store.shareRoot(pkg.root, pkg.name);
|
|
97
|
+
this.bridge.refresh();
|
|
98
|
+
return { link: RelayShareUtil.link(link), expiresAt: share.expiresAt, maxBytes: RELAY_SHARE_MAX_BYTES };
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
unsharePackage(id) {
|
|
102
|
+
return TaErrors.guard(async () => {
|
|
103
|
+
const pkg = await this.catalog.packageOf(await this.environments.defaultCwd(), id);
|
|
104
|
+
this.bridge.store.unshareRoot(pkg.root);
|
|
105
|
+
this.bridge.refresh();
|
|
106
|
+
});
|
|
107
|
+
}
|
|
76
108
|
async getRelay() {
|
|
77
109
|
const { url, devices } = this.bridge.store.read();
|
|
78
110
|
return { relay: url, defaultRelay: RELAY_DEFAULT_URL, online: this.bridge.online, devices: devices.map(device) };
|
|
@@ -98,6 +130,14 @@ __decorate([
|
|
|
98
130
|
Autowired(RELAY_BRIDGE),
|
|
99
131
|
__metadata("design:type", RelayBridge)
|
|
100
132
|
], TaRelayServerImpl.prototype, "bridge", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
Autowired(WebExtensionCatalog),
|
|
135
|
+
__metadata("design:type", Object)
|
|
136
|
+
], TaRelayServerImpl.prototype, "catalog", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
Autowired(ExecEnvironmentFactory),
|
|
139
|
+
__metadata("design:type", Object)
|
|
140
|
+
], TaRelayServerImpl.prototype, "environments", void 0);
|
|
101
141
|
TaRelayServerImpl = __decorate([
|
|
102
142
|
Rpc(TaRelayServer)
|
|
103
143
|
], TaRelayServerImpl);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type CodingAgentOptions } from '@celljs/ai-coding-agent';
|
|
2
|
+
import type { TaSavedSessionInfo } from '@celljs/ta-protocol';
|
|
3
|
+
import { TaSessionCatalog } from './host-protocol.js';
|
|
4
|
+
import { PiDirectories } from './remote/remote-protocol.js';
|
|
5
|
+
/** What a list shows of a session file, with the directory pi worked in, before it is a location. */
|
|
6
|
+
export type SessionSummary = Omit<TaSavedSessionInfo, 'sessionFile' | 'cwd'> & {
|
|
7
|
+
piCwd: string;
|
|
8
|
+
};
|
|
9
|
+
/** What ta's methods read of pi's SessionManager to mark a session. */
|
|
10
|
+
interface MarkableSession {
|
|
11
|
+
getEntries(): readonly {
|
|
12
|
+
type: string;
|
|
13
|
+
customType?: string;
|
|
14
|
+
data?: unknown;
|
|
15
|
+
}[];
|
|
16
|
+
appendCustomEntry(customType: string, data?: unknown): string;
|
|
17
|
+
}
|
|
18
|
+
export declare namespace SessionCatalogUtil {
|
|
19
|
+
/** pi's custom entry that names the group of the package that opened the session (TaOpenSessionOptions.group). */
|
|
20
|
+
const GROUP_ENTRY = "ta-group";
|
|
21
|
+
/**
|
|
22
|
+
* Writes the group in the session, once: after the session closes, its file still says that its package
|
|
23
|
+
* 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.
|
|
24
|
+
*/
|
|
25
|
+
function markGroup(session: MarkableSession, group: string): void;
|
|
26
|
+
/** pi's custom entry that keeps the role a session was opened with (TaOpenSessionOptions.appendSystemPrompt). */
|
|
27
|
+
const ROLE_ENTRY = "ta-role";
|
|
28
|
+
/**
|
|
29
|
+
* Writes the role of the session when it is not the one written last: opened again from its file
|
|
30
|
+
* without one (by a package that relays a message to it, or from the list of conversations), it keeps it.
|
|
31
|
+
*/
|
|
32
|
+
function markRole(session: MarkableSession, role: string): void;
|
|
33
|
+
/** The role the last of the entries keeps. */
|
|
34
|
+
function roleOf(entries: readonly {
|
|
35
|
+
type: string;
|
|
36
|
+
customType?: string;
|
|
37
|
+
data?: unknown;
|
|
38
|
+
}[]): string | undefined;
|
|
39
|
+
/** The group the last of the entries names. */
|
|
40
|
+
function groupOf(entries: readonly {
|
|
41
|
+
type: string;
|
|
42
|
+
customType?: string;
|
|
43
|
+
data?: unknown;
|
|
44
|
+
}[]): string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* What a list of conversations shows of the text of a pi session file, as pi's `/resume` reads it:
|
|
47
|
+
* undefined for a file that does not start with a session header.
|
|
48
|
+
*/
|
|
49
|
+
function summarize(text: string, modifiedAt: number): SessionSummary | undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The session files of pi in its agent directory, one directory per working directory, as pi's `/resume`
|
|
53
|
+
* lists them. A file is read again only when it changed since the last list.
|
|
54
|
+
*/
|
|
55
|
+
export declare class DefaultTaSessionCatalog implements TaSessionCatalog {
|
|
56
|
+
protected readonly codingAgentOptions?: CodingAgentOptions;
|
|
57
|
+
protected readonly directories: PiDirectories;
|
|
58
|
+
/** By file: its size and time when read, and what it held. */
|
|
59
|
+
protected readonly cache: Map<string, {
|
|
60
|
+
version: string;
|
|
61
|
+
summary?: SessionSummary;
|
|
62
|
+
}>;
|
|
63
|
+
list(): Promise<TaSavedSessionInfo[]>;
|
|
64
|
+
/** Where pi keeps the sessions it creates (SessionManager.create without a directory). */
|
|
65
|
+
protected sessionsDir(): Promise<string>;
|
|
66
|
+
protected files(root: string): Promise<string[]>;
|
|
67
|
+
protected summary(file: string): Promise<SessionSummary | undefined>;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
@@ -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
|
|
@@ -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);
|
|
@@ -54,10 +54,7 @@ export declare class TaSettingsStoreImpl implements TaSettingsStore {
|
|
|
54
54
|
trust(): void;
|
|
55
55
|
}>;
|
|
56
56
|
protected read(file: string): Promise<Record<string, unknown>>;
|
|
57
|
-
protected models(): Promise<
|
|
58
|
-
models: string[];
|
|
59
|
-
modelNames: Record<string, string>;
|
|
60
|
-
}>;
|
|
57
|
+
protected models(): Promise<Pick<TaSettingsSnapshot, 'models' | 'modelNames' | 'providerNames'>>;
|
|
61
58
|
protected reloadSessions(scope: TaSettingsScope, cwd: string): Promise<void>;
|
|
62
59
|
}
|
|
63
60
|
export {};
|
|
@@ -204,7 +204,7 @@ let TaSettingsStoreImpl = class TaSettingsStoreImpl {
|
|
|
204
204
|
}
|
|
205
205
|
async get(cwd) {
|
|
206
206
|
const { userFile, projectFile, trusted } = await this.files(cwd);
|
|
207
|
-
const [user, project, { models, modelNames }] = 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()]);
|
|
208
208
|
return {
|
|
209
209
|
user: TaSettingsUtil.read(user),
|
|
210
210
|
project: TaSettingsUtil.read(project),
|
|
@@ -214,6 +214,7 @@ let TaSettingsStoreImpl = class TaSettingsStoreImpl {
|
|
|
214
214
|
projectTrusted: trusted !== false,
|
|
215
215
|
models,
|
|
216
216
|
modelNames,
|
|
217
|
+
providerNames,
|
|
217
218
|
};
|
|
218
219
|
}
|
|
219
220
|
update(scope, changes, cwd) {
|
|
@@ -282,10 +283,17 @@ let TaSettingsStoreImpl = class TaSettingsStoreImpl {
|
|
|
282
283
|
modelNames[`${model.provider}/${model.id}`] = model.name;
|
|
283
284
|
}
|
|
284
285
|
}
|
|
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 };
|
|
286
294
|
}
|
|
287
295
|
catch (_a) {
|
|
288
|
-
return { models: [], modelNames: {} };
|
|
296
|
+
return { models: [], modelNames: {}, providerNames: {} };
|
|
289
297
|
}
|
|
290
298
|
}
|
|
291
299
|
async reloadSessions(scope, cwd) {
|
|
@@ -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 {};
|