@celljs/ta-host 4.8.0 → 4.9.1
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 +213 -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 +124 -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 +216 -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 +127 -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,142 +0,0 @@
|
|
|
1
|
-
import { afterAll, describe, expect, it } from 'bun:test';
|
|
2
|
-
import { existsSync, mkdtempSync } from 'node:fs';
|
|
3
|
-
import { createServer } from 'node:net';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
import type { RpcConnection } from '@celljs/rpc/lib/node';
|
|
7
|
-
import { type ExecEnvironment, type ExecSocket, LocalExecEnvironment } from '@celljs/ta-exec';
|
|
8
|
-
import type { TaRemoteEvent } from '@celljs/ta-protocol';
|
|
9
|
-
import { DefaultPiDirectories } from './pi-directories';
|
|
10
|
-
import { DefaultPortForwards } from './port-forwards';
|
|
11
|
-
import { DefaultRemoteHosts } from './remote-hosts';
|
|
12
|
-
|
|
13
|
-
const root = mkdtempSync(join(tmpdir(), 'ta-remote-'));
|
|
14
|
-
|
|
15
|
-
function directories(execUrl = ''): DefaultPiDirectories {
|
|
16
|
-
return Object.assign(new DefaultPiDirectories(), { codingAgentOptions: { agentDir: root }, execOptions: { url: execUrl } });
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
describe('DefaultPiDirectories', () => {
|
|
20
|
-
it('keeps a directory of this machine', () => {
|
|
21
|
-
expect(directories().toPi('/work/app')).toBe('/work/app');
|
|
22
|
-
expect(directories().fromPi('/work/app')).toBe('/work/app');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('gives a directory of another machine one here, and back', () => {
|
|
26
|
-
const dirs = directories();
|
|
27
|
-
const cwd = dirs.toPi('ssh://me@dev:2222/srv/app');
|
|
28
|
-
expect(cwd).toBe(join(root, 'remote', 'ssh', 'me@dev:2222', 'srv', 'app'));
|
|
29
|
-
expect(existsSync(cwd)).toBe(true);
|
|
30
|
-
expect(dirs.fromPi(cwd)).toBe('ssh://me@dev:2222/srv/app');
|
|
31
|
-
expect(dirs.fromPi(dirs.toPi('ssh://dev/'))).toBe('ssh://dev/');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('gives every directory one here with an exec server', () => {
|
|
35
|
-
const dirs = directories('ws://exec');
|
|
36
|
-
const cwd = dirs.toPi('/srv/app');
|
|
37
|
-
expect(cwd).toBe(join(root, 'remote', 'exec', 'srv', 'app'));
|
|
38
|
-
expect(dirs.fromPi(cwd)).toBe('/srv/app');
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe('DefaultRemoteHosts', () => {
|
|
43
|
-
it('asks every client that watches, and the first answer counts', async () => {
|
|
44
|
-
const events: TaRemoteEvent[][] = [[], []];
|
|
45
|
-
const connections = events.map(
|
|
46
|
-
received =>
|
|
47
|
-
({
|
|
48
|
-
closed: false,
|
|
49
|
-
onClose: () => undefined,
|
|
50
|
-
client: () => ({ onRemoteEvent: async (event: TaRemoteEvent) => void received.push(event) }),
|
|
51
|
-
}) as unknown as RpcConnection,
|
|
52
|
-
);
|
|
53
|
-
const hosts = new DefaultRemoteHosts();
|
|
54
|
-
expect(hosts.watch(connections[0])).toEqual([]);
|
|
55
|
-
const asked = (hosts as unknown as { ask: DefaultRemoteHosts['ask'] }).ask.call(hosts, 'dev', { kind: 'secret', message: 'Password:' });
|
|
56
|
-
const [prompt] = hosts.watch(connections[1]);
|
|
57
|
-
expect(prompt).toMatchObject({ host: 'dev', kind: 'secret', message: 'Password:' });
|
|
58
|
-
expect(events[0]).toEqual([{ type: 'prompt', prompt }]);
|
|
59
|
-
expect(hosts.answer(prompt.promptId, 's3cret')).toBe(true);
|
|
60
|
-
expect(hosts.answer(prompt.promptId, 'again')).toBe(false);
|
|
61
|
-
expect(await asked).toBe('s3cret');
|
|
62
|
-
expect(events[1]).toEqual([{ type: 'prompt_closed', promptId: prompt.promptId }]);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('refuses a host that ssh would read as an option', () => {
|
|
66
|
-
expect(() => new DefaultRemoteHosts().client('-oProxyCommand=x')).toThrow();
|
|
67
|
-
expect(() => new DefaultRemoteHosts().add('-oProxyCommand=x')).toThrow();
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('keeps the hosts added, the latest first, and forgets one removed', async () => {
|
|
71
|
-
let recent: string[] = [];
|
|
72
|
-
const hosts = Object.assign(new DefaultRemoteHosts(), {
|
|
73
|
-
workingDirectory: {
|
|
74
|
-
recentHosts: () => recent,
|
|
75
|
-
addRecentHost: (host: string) => (recent = [host, ...recent.filter(other => other !== host)]),
|
|
76
|
-
removeRecentHost: (host: string) => (recent = recent.filter(other => other !== host)),
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
hosts.add('dev');
|
|
80
|
-
hosts.add('me@prod:2222');
|
|
81
|
-
expect(hosts.list().filter(host => host.source === 'recent')).toEqual([
|
|
82
|
-
{ host: 'me@prod:2222', source: 'recent', connected: false },
|
|
83
|
-
{ host: 'dev', source: 'recent', connected: false },
|
|
84
|
-
]);
|
|
85
|
-
await hosts.remove('dev');
|
|
86
|
-
expect(recent).toEqual(['me@prod:2222']);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
describe('DefaultPortForwards', () => {
|
|
91
|
-
/** A machine whose connections are those of this one, as the server of Ta makes them there. */
|
|
92
|
-
class Remote extends LocalExecEnvironment {
|
|
93
|
-
async connect(port: number): Promise<ExecSocket> {
|
|
94
|
-
const { connect } = await import('node:net');
|
|
95
|
-
const socket = connect(port, '127.0.0.1');
|
|
96
|
-
await new Promise((resolve, reject) => socket.once('connect', resolve).once('error', reject));
|
|
97
|
-
return {
|
|
98
|
-
write: data => socket.write(data),
|
|
99
|
-
end: () => socket.end(),
|
|
100
|
-
onData: listener => socket.on('data', listener),
|
|
101
|
-
onClose: listener => socket.once('close', listener),
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
const forwards = new DefaultPortForwards();
|
|
106
|
-
const local = new LocalExecEnvironment(root);
|
|
107
|
-
const remote = new Remote(root);
|
|
108
|
-
Object.assign(forwards, {
|
|
109
|
-
environments: { create: (cwd: string): ExecEnvironment => (cwd.startsWith('ssh://') ? remote : local) },
|
|
110
|
-
hosts: { onDisconnect: () => () => undefined },
|
|
111
|
-
});
|
|
112
|
-
afterAll(() => forwards.onStop());
|
|
113
|
-
|
|
114
|
-
it('keeps a port of this machine as it is', async () => {
|
|
115
|
-
expect(await forwards.forward('/work', 3000)).toEqual({ host: '', remotePort: 3000, localPort: 3000 });
|
|
116
|
-
await expect(forwards.forward('/work', 70000)).rejects.toThrow();
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
it('opens a port of another machine here, and carries data both ways', async () => {
|
|
120
|
-
const server = createServer(socket => socket.on('data', data => socket.end(`echo:${data}`)));
|
|
121
|
-
await new Promise<void>(resolve => server.listen(0, '127.0.0.1', resolve));
|
|
122
|
-
const port = (server.address() as { port: number }).port;
|
|
123
|
-
try {
|
|
124
|
-
const forwarded = await forwards.forward('ssh://dev/srv', port);
|
|
125
|
-
expect(forwarded.host).toBe('dev');
|
|
126
|
-
expect(forwarded.localPort).not.toBe(port);
|
|
127
|
-
expect(await forwards.forward('ssh://dev/srv', port)).toEqual(forwarded);
|
|
128
|
-
expect(forwards.list()).toEqual([forwarded]);
|
|
129
|
-
const { connect } = await import('node:net');
|
|
130
|
-
const client = connect(forwarded.localPort, '127.0.0.1');
|
|
131
|
-
const received: Buffer[] = [];
|
|
132
|
-
client.on('data', data => received.push(data));
|
|
133
|
-
client.write('hi');
|
|
134
|
-
await new Promise(resolve => client.once('close', resolve));
|
|
135
|
-
expect(Buffer.concat(received).toString()).toBe('echo:hi');
|
|
136
|
-
await forwards.close('dev', port);
|
|
137
|
-
expect(forwards.list()).toEqual([]);
|
|
138
|
-
} finally {
|
|
139
|
-
server.close();
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
});
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import type { TaEvent } from '@celljs/ta-protocol';
|
|
3
|
-
import { RemoteUiContext } from './remote-ui-context';
|
|
4
|
-
|
|
5
|
-
function setup() {
|
|
6
|
-
const events: any[] = [];
|
|
7
|
-
return { ui: new RemoteUiContext((event: TaEvent) => events.push(event)), events };
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
describe('RemoteUiContext', () => {
|
|
11
|
-
it('publishes a dialog and resolves with the first answer', async () => {
|
|
12
|
-
const { ui, events } = setup();
|
|
13
|
-
const answer = ui.confirm('Sure?', 'Really');
|
|
14
|
-
expect(events[0]).toMatchObject({ type: 'extension_ui_request', method: 'confirm', title: 'Sure?' });
|
|
15
|
-
expect(ui.pendingRequests).toHaveLength(1);
|
|
16
|
-
expect(ui.respond({ type: 'extension_ui_response', id: events[0].id, confirmed: true })).toBe(true);
|
|
17
|
-
expect(ui.respond({ type: 'extension_ui_response', id: events[0].id, confirmed: false })).toBe(false);
|
|
18
|
-
expect(await answer).toBe(true);
|
|
19
|
-
expect(events[1]).toEqual({ type: 'ui_request_resolved', id: events[0].id });
|
|
20
|
-
expect(ui.pendingRequests).toEqual([]);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('gives the extension its default at the timeout, or when aborted', async () => {
|
|
24
|
-
const { ui, events } = setup();
|
|
25
|
-
expect(await ui.confirm('t', 'm', { timeout: 10 })).toBe(false);
|
|
26
|
-
expect(events.at(-1).type).toBe('ui_request_resolved');
|
|
27
|
-
const controller = new AbortController();
|
|
28
|
-
const selected = ui.select('t', ['a'], { signal: controller.signal });
|
|
29
|
-
controller.abort();
|
|
30
|
-
expect(await selected).toBeUndefined();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('treats a cancelled answer as no answer', async () => {
|
|
34
|
-
const { ui, events } = setup();
|
|
35
|
-
const value = ui.input('t');
|
|
36
|
-
ui.respond({ type: 'extension_ui_response', id: events[0].id, cancelled: true });
|
|
37
|
-
expect(await value).toBeUndefined();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('ends open dialogs when the session closes', async () => {
|
|
41
|
-
const { ui } = setup();
|
|
42
|
-
const answer = ui.editor('t');
|
|
43
|
-
ui.cancelAll();
|
|
44
|
-
expect(await answer).toBeUndefined();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('sends what needs no answer and forgets it', () => {
|
|
48
|
-
const { ui, events } = setup();
|
|
49
|
-
ui.notify('hello', 'info');
|
|
50
|
-
ui.setStatus('k', 'v');
|
|
51
|
-
expect(events.map(event => event.method)).toEqual(['notify', 'setStatus']);
|
|
52
|
-
expect(ui.pendingRequests).toEqual([]);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('sends only widgets a client can draw', () => {
|
|
56
|
-
const { ui, events } = setup();
|
|
57
|
-
ui.setWidget('w', () => undefined);
|
|
58
|
-
expect(events).toEqual([]);
|
|
59
|
-
ui.setWidget('w', ['line']);
|
|
60
|
-
expect(events[0]).toMatchObject({ method: 'setWidget', widgetLines: ['line'] });
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('leaves styled text plain', () => {
|
|
64
|
-
const { ui } = setup();
|
|
65
|
-
expect(ui.theme.fg('accent', 'text')).toBe('text');
|
|
66
|
-
expect(ui.theme.bold('text')).toBe('text');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('keeps its methods when pi copies it, as it does when it binds extensions', () => {
|
|
70
|
-
const { ui, events } = setup();
|
|
71
|
-
// pi's runner copies the context so: only own properties survive.
|
|
72
|
-
const copy: Pick<RemoteUiContext, 'notify' | 'setStatus'> = Object.assign({}, ui);
|
|
73
|
-
copy.notify('Saved', 'warning');
|
|
74
|
-
copy.setStatus('k', 'v');
|
|
75
|
-
expect(events.map(event => event.method)).toEqual(['notify', 'setStatus']);
|
|
76
|
-
expect(events[0]).toMatchObject({ type: 'extension_ui_request', message: 'Saved', notifyType: 'warning' });
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('keeps what the extensions show now, for a client that attaches later', () => {
|
|
80
|
-
const { ui } = setup();
|
|
81
|
-
ui.setStatus('wx', '[WeChat] ⏳ signing in');
|
|
82
|
-
ui.setStatus('wx', '[WeChat] ✅ connected');
|
|
83
|
-
ui.setStatus('git', 'clean');
|
|
84
|
-
ui.setStatus('git', undefined);
|
|
85
|
-
ui.setWidget('todo', ['- a', '- b'], { placement: 'belowEditor' });
|
|
86
|
-
ui.setWidget('gone', ['x']);
|
|
87
|
-
ui.setWidget('gone', undefined);
|
|
88
|
-
expect(ui.shownRequests).toMatchObject([
|
|
89
|
-
{ method: 'setStatus', statusKey: 'wx', statusText: '[WeChat] ✅ connected' },
|
|
90
|
-
{ method: 'setWidget', widgetKey: 'todo', widgetLines: ['- a', '- b'], widgetPlacement: 'belowEditor' },
|
|
91
|
-
]);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import type { RpcExtensionUIRequest, RpcExtensionUIResponse, TaEvent } from '@celljs/ta-protocol';
|
|
3
|
-
|
|
4
|
-
type ExtensionUIContext = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' }}).ExtensionUIContext;
|
|
5
|
-
type DialogOptions = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' }}).ExtensionUIDialogOptions;
|
|
6
|
-
type Theme = ExtensionUIContext['theme'];
|
|
7
|
-
|
|
8
|
-
interface PendingDialog {
|
|
9
|
-
request: RpcExtensionUIRequest;
|
|
10
|
-
settle(response: RpcExtensionUIResponse | undefined): void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
type DialogRequest = RpcExtensionUIRequest extends infer R ? (R extends { id: string } ? Omit<R, 'id' | 'type'> : never) : never;
|
|
14
|
-
|
|
15
|
-
const TEXT_STYLES = new Set(['fg', 'bg', 'bold', 'italic', 'underline', 'strikethrough', 'inverse']);
|
|
16
|
-
|
|
17
|
-
/** Clients draw their own UI: an extension's styled text reaches them without ANSI codes. */
|
|
18
|
-
const PLAIN_THEME = new Proxy(
|
|
19
|
-
{},
|
|
20
|
-
{
|
|
21
|
-
get: (_target, name) => (TEXT_STYLES.has(String(name)) ? (...args: string[]) => args[args.length - 1] : () => ''),
|
|
22
|
-
},
|
|
23
|
-
) as Theme;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* pi's extension UI for clients that are not this process. It has the shape of pi's RPC mode, with one
|
|
27
|
-
* difference: a dialog goes to every attached client, the first answer counts, and the others are told.
|
|
28
|
-
* A dialog nobody answers ends at its timeout, as the extension asked.
|
|
29
|
-
*/
|
|
30
|
-
export class RemoteUiContext implements ExtensionUIContext {
|
|
31
|
-
protected readonly pending = new Map<string, PendingDialog>();
|
|
32
|
-
/** The last status and widget of each key, for clients that attach later. */
|
|
33
|
-
protected readonly shown = new Map<string, RpcExtensionUIRequest>();
|
|
34
|
-
|
|
35
|
-
readonly theme = PLAIN_THEME;
|
|
36
|
-
|
|
37
|
-
constructor(protected readonly publish: (event: TaEvent) => void) {
|
|
38
|
-
// pi copies the context it is given (`{ ...ui }`), which keeps only own properties: the methods go on the object.
|
|
39
|
-
for (let proto = Object.getPrototypeOf(this); proto && proto !== Object.prototype; proto = Object.getPrototypeOf(proto)) {
|
|
40
|
-
for (const name of Object.getOwnPropertyNames(proto)) {
|
|
41
|
-
const method = Object.getOwnPropertyDescriptor(proto, name)?.value;
|
|
42
|
-
if (name !== 'constructor' && typeof method === 'function' && !Object.getOwnPropertyDescriptor(this, name)) {
|
|
43
|
-
Object.defineProperty(this, name, { value: method.bind(this), enumerable: true, writable: true, configurable: true });
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
get pendingRequests(): RpcExtensionUIRequest[] {
|
|
50
|
-
return [...this.pending.values()].map(dialog => dialog.request);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** What the extensions show now with `setStatus` and `setWidget`. */
|
|
54
|
-
get shownRequests(): RpcExtensionUIRequest[] {
|
|
55
|
-
return [...this.shown.values()];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** False when the dialog was answered before or ended. */
|
|
59
|
-
respond(response: RpcExtensionUIResponse): boolean {
|
|
60
|
-
const dialog = this.pending.get(response.id);
|
|
61
|
-
dialog?.settle(response);
|
|
62
|
-
return dialog !== undefined;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/** Ends the open dialogs as if they timed out: the extensions go on, with their defaults. */
|
|
66
|
-
cancelAll(): void {
|
|
67
|
-
for (const dialog of [...this.pending.values()]) {
|
|
68
|
-
dialog.settle(undefined);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
select(title: string, options: string[], opts?: DialogOptions): Promise<string | undefined> {
|
|
73
|
-
return this.dialog({ method: 'select', title, options, timeout: opts?.timeout }, opts, undefined, r => ('value' in r ? r.value : undefined));
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
confirm(title: string, message: string, opts?: DialogOptions): Promise<boolean> {
|
|
77
|
-
return this.dialog({ method: 'confirm', title, message, timeout: opts?.timeout }, opts, false, r => ('confirmed' in r ? r.confirmed : false));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
input(title: string, placeholder?: string, opts?: DialogOptions): Promise<string | undefined> {
|
|
81
|
-
return this.dialog({ method: 'input', title, placeholder, timeout: opts?.timeout }, opts, undefined, r => ('value' in r ? r.value : undefined));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
editor(title: string, prefill?: string): Promise<string | undefined> {
|
|
85
|
-
return this.dialog({ method: 'editor', title, prefill }, undefined, undefined, r => ('value' in r ? r.value : undefined));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
notify(message: string, type?: 'info' | 'warning' | 'error'): void {
|
|
89
|
-
this.tell({ method: 'notify', message, notifyType: type });
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
setStatus(key: string, text: string | undefined): void {
|
|
93
|
-
const request = this.tell({ method: 'setStatus', statusKey: key, statusText: text });
|
|
94
|
-
this.keep(`status:${key}`, text ? request : undefined);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
setWidget(key: string, content: unknown, options?: { placement?: 'aboveEditor' | 'belowEditor' }): void {
|
|
98
|
-
// Clients cannot run a component factory; pi's RPC mode ignores those too.
|
|
99
|
-
if (content === undefined || Array.isArray(content)) {
|
|
100
|
-
const request = this.tell({ method: 'setWidget', widgetKey: key, widgetLines: content, widgetPlacement: options?.placement });
|
|
101
|
-
this.keep(`widget:${key}`, content?.length ? request : undefined);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
setTitle(title: string): void {
|
|
106
|
-
this.tell({ method: 'setTitle', title });
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
setEditorText(text: string): void {
|
|
110
|
-
this.tell({ method: 'set_editor_text', text });
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
pasteToEditor(text: string): void {
|
|
114
|
-
this.setEditorText(text);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
getEditorText(): string {
|
|
118
|
-
return '';
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// What needs a terminal in this process does nothing, as in pi's RPC mode.
|
|
122
|
-
onTerminalInput(): () => void {
|
|
123
|
-
return () => undefined;
|
|
124
|
-
}
|
|
125
|
-
setWorkingMessage(): void {}
|
|
126
|
-
setWorkingVisible(): void {}
|
|
127
|
-
setWorkingIndicator(): void {}
|
|
128
|
-
setHiddenThinkingLabel(): void {}
|
|
129
|
-
setFooter(): void {}
|
|
130
|
-
setHeader(): void {}
|
|
131
|
-
addAutocompleteProvider(): void {}
|
|
132
|
-
setEditorComponent(): void {}
|
|
133
|
-
getEditorComponent(): undefined {
|
|
134
|
-
return undefined;
|
|
135
|
-
}
|
|
136
|
-
async custom(): Promise<never> {
|
|
137
|
-
return undefined as never;
|
|
138
|
-
}
|
|
139
|
-
getAllThemes(): [] {
|
|
140
|
-
return [];
|
|
141
|
-
}
|
|
142
|
-
getTheme(): undefined {
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
145
|
-
setTheme(): { success: boolean; error: string } {
|
|
146
|
-
return { success: false, error: 'Clients of ta serve choose their own theme.' };
|
|
147
|
-
}
|
|
148
|
-
getToolsExpanded(): boolean {
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
setToolsExpanded(): void {}
|
|
152
|
-
|
|
153
|
-
protected tell(request: DialogRequest): RpcExtensionUIRequest {
|
|
154
|
-
const full = { type: 'extension_ui_request', id: randomUUID(), ...request } as RpcExtensionUIRequest;
|
|
155
|
-
this.publish(full);
|
|
156
|
-
return full;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
protected keep(key: string, request: RpcExtensionUIRequest | undefined): void {
|
|
160
|
-
if (request) {
|
|
161
|
-
this.shown.set(key, request);
|
|
162
|
-
} else {
|
|
163
|
-
this.shown.delete(key);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
protected dialog<T>(
|
|
168
|
-
request: DialogRequest,
|
|
169
|
-
options: DialogOptions | undefined,
|
|
170
|
-
fallback: T,
|
|
171
|
-
parse: (response: Exclude<RpcExtensionUIResponse, { cancelled: true }>) => T,
|
|
172
|
-
): Promise<T> {
|
|
173
|
-
if (options?.signal?.aborted) {
|
|
174
|
-
return Promise.resolve(fallback);
|
|
175
|
-
}
|
|
176
|
-
const id = randomUUID();
|
|
177
|
-
return new Promise<T>(resolve => {
|
|
178
|
-
const settle = (response: RpcExtensionUIResponse | undefined) => {
|
|
179
|
-
clearTimeout(timer);
|
|
180
|
-
options?.signal?.removeEventListener('abort', onAbort);
|
|
181
|
-
this.pending.delete(id);
|
|
182
|
-
this.publish({ type: 'ui_request_resolved', id });
|
|
183
|
-
resolve(
|
|
184
|
-
!response || ('cancelled' in response && response.cancelled)
|
|
185
|
-
? fallback
|
|
186
|
-
: parse(response as Exclude<RpcExtensionUIResponse, { cancelled: true }>),
|
|
187
|
-
);
|
|
188
|
-
};
|
|
189
|
-
const onAbort = () => settle(undefined);
|
|
190
|
-
const timer = options?.timeout ? setTimeout(onAbort, options.timeout) : undefined;
|
|
191
|
-
options?.signal?.addEventListener('abort', onAbort, { once: true });
|
|
192
|
-
const full = { type: 'extension_ui_request', id, ...request } as RpcExtensionUIRequest;
|
|
193
|
-
this.pending.set(id, { request: full, settle });
|
|
194
|
-
this.publish(full);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { afterAll, describe, expect, it } from 'bun:test';
|
|
2
|
-
import { mkdirSync, mkdtempSync, readFileSync, rmSync } from 'node:fs';
|
|
3
|
-
import { homedir, tmpdir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import { type ExecEnvironment, LocalExecEnvironment } from '@celljs/ta-exec';
|
|
6
|
-
import { ExecSessionFiles } from './session-files';
|
|
7
|
-
|
|
8
|
-
describe('ExecSessionFiles', () => {
|
|
9
|
-
const dir = mkdtempSync(join(tmpdir(), 'ta-session-files-'));
|
|
10
|
-
afterAll(() => rmSync(dir, { recursive: true, force: true }));
|
|
11
|
-
|
|
12
|
-
it("resolves paths as pi's tools do", () => {
|
|
13
|
-
const files = new ExecSessionFiles(new LocalExecEnvironment(dir), dir);
|
|
14
|
-
expect(files.resolve('src/a.ts')).toBe(join(dir, 'src', 'a.ts'));
|
|
15
|
-
expect(files.resolve('@src/a.ts')).toBe(join(dir, 'src', 'a.ts'));
|
|
16
|
-
expect(files.resolve('~/notes.md')).toBe(join(homedir(), 'notes.md'));
|
|
17
|
-
expect(files.resolve('.')).toBe(dir);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('reads, writes with the directories it needs, and removes', async () => {
|
|
21
|
-
const files = new ExecSessionFiles(new LocalExecEnvironment(dir), dir);
|
|
22
|
-
const path = files.resolve('deep/down/a.txt');
|
|
23
|
-
expect(await files.read(path)).toBeUndefined();
|
|
24
|
-
await files.write(path, new TextEncoder().encode('hi'));
|
|
25
|
-
expect(readFileSync(path, 'utf8')).toBe('hi');
|
|
26
|
-
expect(new TextDecoder().decode(await files.read(path))).toBe('hi');
|
|
27
|
-
mkdirSync(join(dir, 'folder'));
|
|
28
|
-
expect(await files.read(files.resolve('folder'))).toBeUndefined();
|
|
29
|
-
await files.remove(path);
|
|
30
|
-
expect(await files.read(path)).toBeUndefined();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('maps the directory pi works in for another machine into that machine', async () => {
|
|
34
|
-
const written: string[] = [];
|
|
35
|
-
const remote = {
|
|
36
|
-
cwd: '/home/me/app',
|
|
37
|
-
local: false,
|
|
38
|
-
mkdir: async (path: string) => {
|
|
39
|
-
written.push(`mkdir ${path}`);
|
|
40
|
-
},
|
|
41
|
-
writeFile: async (path: string) => {
|
|
42
|
-
written.push(`write ${path}`);
|
|
43
|
-
},
|
|
44
|
-
} as unknown as ExecEnvironment;
|
|
45
|
-
const piCwd = join(dir, 'remote', 'host-app');
|
|
46
|
-
const files = new ExecSessionFiles(remote, piCwd);
|
|
47
|
-
expect(files.resolve('src/a.ts')).toBe('/home/me/app/src/a.ts');
|
|
48
|
-
expect(files.resolve('.')).toBe('/home/me/app');
|
|
49
|
-
await files.write('/home/me/app/src/a.ts', new Uint8Array());
|
|
50
|
-
expect(written).toEqual(['mkdir /home/me/app/src', 'write /home/me/app/src/a.ts']);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { homedir } from 'node:os';
|
|
2
|
-
import { dirname, posix, resolve } from 'node:path';
|
|
3
|
-
import type { ExecEnvironment } from '@celljs/ta-exec';
|
|
4
|
-
import { ExecOperations } from '@celljs/ta-harness';
|
|
5
|
-
import type { TaSessionFiles } from '@celljs/ta-protocol';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The files of a session on its execution environment. `piCwd` is the directory pi works in for it
|
|
9
|
-
* (PiDirectories): pi's tools resolve paths there, and ExecOperations maps them into the environment.
|
|
10
|
-
*/
|
|
11
|
-
export class ExecSessionFiles implements TaSessionFiles {
|
|
12
|
-
protected readonly operations: ExecOperations;
|
|
13
|
-
|
|
14
|
-
constructor(
|
|
15
|
-
protected readonly environment: ExecEnvironment,
|
|
16
|
-
protected readonly piCwd: string,
|
|
17
|
-
) {
|
|
18
|
-
this.operations = new ExecOperations(environment, piCwd);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** As pi's tools resolve a path of their arguments: without a leading `@`, `~` the home directory, against pi's directory. */
|
|
22
|
-
resolve(path: string): string {
|
|
23
|
-
const bare = path.startsWith('@') ? path.slice(1) : path;
|
|
24
|
-
const expanded = bare === '~' || bare.startsWith('~/') ? homedir() + bare.slice(1) : bare;
|
|
25
|
-
return this.operations.map(resolve(this.piCwd, expanded));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async read(path: string): Promise<Uint8Array | undefined> {
|
|
29
|
-
const stat = await this.environment.stat(path);
|
|
30
|
-
return stat && !stat.isDirectory ? this.environment.readFile(path) : undefined;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async write(path: string, data: Uint8Array): Promise<void> {
|
|
34
|
-
await this.environment.mkdir(this.environment.local ? dirname(path) : posix.dirname(path));
|
|
35
|
-
await this.environment.writeFile(path, data);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
remove(path: string): Promise<void> {
|
|
39
|
-
return this.environment.remove(path, { recursive: false });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import { SessionInfoUtil } from './session-info-util';
|
|
3
|
-
|
|
4
|
-
describe('SessionInfoUtil', () => {
|
|
5
|
-
it('takes the first line with text of the first message of the user', () => {
|
|
6
|
-
expect(
|
|
7
|
-
SessionInfoUtil.firstMessage([
|
|
8
|
-
{ role: 'custom', content: 'not the user' },
|
|
9
|
-
{ role: 'user', content: [{ type: 'image' }] },
|
|
10
|
-
{ role: 'user', content: [{ type: 'image' }, { type: 'text', text: '\n Fix the login page \nand its tests' }] },
|
|
11
|
-
{ role: 'user', content: 'later' },
|
|
12
|
-
]),
|
|
13
|
-
).toBe('Fix the login page');
|
|
14
|
-
expect(SessionInfoUtil.firstMessage([{ role: 'user', content: 'x'.repeat(200) }])).toHaveLength(120);
|
|
15
|
-
expect(SessionInfoUtil.firstMessage([{ role: 'assistant', content: 'hi' }])).toBeUndefined();
|
|
16
|
-
expect(SessionInfoUtil.firstMessage([{ role: 'user', content: '<context>\n[#web]\n</context>\n@dev hi' }])).toBe('@dev hi');
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('dates a conversation by its last message, or when it was opened', () => {
|
|
20
|
-
expect(SessionInfoUtil.updatedAt([{ role: 'user', timestamp: 5 }, { role: 'assistant', timestamp: 9 }, { role: 'custom' }], 7)).toBe(9);
|
|
21
|
-
expect(SessionInfoUtil.updatedAt([], 7)).toBe(7);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { TaMessageContext } from '@celljs/ta-protocol';
|
|
2
|
-
|
|
3
|
-
/** What these functions read of pi's messages. */
|
|
4
|
-
interface MessageLike {
|
|
5
|
-
role: string;
|
|
6
|
-
content?: unknown;
|
|
7
|
-
timestamp?: number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/** What a list of conversations shows of one: its first message, as pi's session list does, and when it last changed. */
|
|
11
|
-
export namespace SessionInfoUtil {
|
|
12
|
-
const LENGTH = 120;
|
|
13
|
-
|
|
14
|
-
/** The first line of the first message of the user that has text, without its context, cut to a title's length. */
|
|
15
|
-
export function firstMessage(messages: readonly MessageLike[]): string | undefined {
|
|
16
|
-
for (const message of messages) {
|
|
17
|
-
if (message.role !== 'user') {
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
const line = TaMessageContext.strip(text(message.content))
|
|
21
|
-
.split('\n')
|
|
22
|
-
.map(part => part.trim())
|
|
23
|
-
.find(Boolean);
|
|
24
|
-
if (line) {
|
|
25
|
-
return line.length > LENGTH ? `${line.slice(0, LENGTH - 1)}…` : line;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** The time of the last message that has one, else `fallback`. */
|
|
32
|
-
export function updatedAt(messages: readonly MessageLike[], fallback: number): number {
|
|
33
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
34
|
-
const { timestamp } = messages[i];
|
|
35
|
-
if (typeof timestamp === 'number') {
|
|
36
|
-
return timestamp;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return fallback;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** The text of the content of a message. */
|
|
43
|
-
export function text(content: unknown): string {
|
|
44
|
-
if (typeof content === 'string') {
|
|
45
|
-
return content;
|
|
46
|
-
}
|
|
47
|
-
if (!Array.isArray(content)) {
|
|
48
|
-
return '';
|
|
49
|
-
}
|
|
50
|
-
return content
|
|
51
|
-
.filter((part): part is { type: 'text'; text: string } => part?.type === 'text' && typeof part.text === 'string')
|
|
52
|
-
.map(part => part.text)
|
|
53
|
-
.join('\n');
|
|
54
|
-
}
|
|
55
|
-
}
|