@celljs/ta-host 4.8.0 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +33 -5
- package/README.md +33 -5
- package/cell.schema.json +4 -0
- package/cell.yml +2 -0
- package/esm/node/client-tool-broker.d.ts +11 -3
- package/esm/node/client-tool-broker.js +23 -3
- package/esm/node/host-protocol.d.ts +22 -1
- package/esm/node/host-protocol.js +1 -0
- package/esm/node/index.d.ts +4 -0
- package/esm/node/index.js +4 -0
- package/esm/node/live-run.d.ts +22 -0
- package/esm/node/live-run.js +58 -0
- package/esm/node/message-page.d.ts +17 -0
- package/esm/node/message-page.js +71 -0
- package/esm/node/package-server-impl.d.ts +9 -1
- package/esm/node/package-server-impl.js +16 -1
- package/esm/node/relay-bridge.d.ts +9 -1
- package/esm/node/relay-bridge.js +44 -4
- package/esm/node/session-catalog.d.ts +69 -0
- package/esm/node/session-catalog.js +211 -0
- package/esm/node/session-info-util.d.ts +4 -1
- package/esm/node/session-info-util.js +8 -3
- package/esm/node/settings-store.d.ts +1 -4
- package/esm/node/settings-store.js +11 -3
- package/esm/node/sign-in/access-server-impl.d.ts +19 -0
- package/esm/node/sign-in/access-server-impl.js +82 -0
- package/esm/node/sign-in/access-store.d.ts +65 -0
- package/esm/node/sign-in/access-store.js +175 -0
- package/esm/node/sign-in/index.d.ts +7 -0
- package/esm/node/sign-in/index.js +8 -0
- package/esm/node/sign-in/sign-in-flow.d.ts +58 -0
- package/esm/node/sign-in/sign-in-flow.js +104 -0
- package/esm/node/sign-in/sign-in-middleware.d.ts +10 -0
- package/esm/node/sign-in/sign-in-middleware.js +48 -0
- package/esm/node/sign-in/sign-in-pages.d.ts +31 -0
- package/esm/node/sign-in/sign-in-pages.js +118 -0
- package/esm/node/sign-in/sign-in-provider.d.ts +135 -0
- package/esm/node/sign-in/sign-in-provider.js +225 -0
- package/esm/node/sign-in/ta-sign-in.d.ts +10 -0
- package/esm/node/sign-in/ta-sign-in.js +32 -0
- package/esm/node/ta-access.d.ts +7 -0
- package/esm/node/ta-access.js +30 -1
- package/esm/node/ta-server-impl.d.ts +8 -3
- package/esm/node/ta-server-impl.js +25 -6
- package/esm/node/ta-session-factory.d.ts +1 -1
- package/esm/node/ta-session-factory.js +14 -4
- package/esm/node/ta-session-registry.d.ts +2 -0
- package/esm/node/ta-session-registry.js +23 -3
- package/esm/node/ta-session.d.ts +24 -2
- package/esm/node/ta-session.js +83 -6
- package/esm/node/temporary-packages.d.ts +46 -0
- package/esm/node/temporary-packages.js +114 -0
- package/esm/node/temporary-purge.d.ts +13 -0
- package/esm/node/temporary-purge.js +51 -0
- package/esm/node/web-extension-catalog.d.ts +28 -1
- package/esm/node/web-extension-catalog.js +173 -5
- package/esm/node/web-extension-util.d.ts +5 -1
- package/esm/node/web-extension-util.js +36 -5
- package/esm/node/workspace-service.js +1 -1
- package/lib/node/client-tool-broker.d.ts +11 -3
- package/lib/node/client-tool-broker.js +23 -3
- package/lib/node/host-protocol.d.ts +22 -1
- package/lib/node/host-protocol.js +2 -1
- package/lib/node/index.d.ts +4 -0
- package/lib/node/index.js +4 -0
- package/lib/node/live-run.d.ts +23 -0
- package/lib/node/live-run.js +62 -0
- package/lib/node/message-page.d.ts +18 -0
- package/lib/node/message-page.js +74 -0
- package/lib/node/package-server-impl.d.ts +9 -1
- package/lib/node/package-server-impl.js +15 -0
- package/lib/node/relay-bridge.d.ts +9 -1
- package/lib/node/relay-bridge.js +43 -3
- package/lib/node/session-catalog.d.ts +70 -0
- package/lib/node/session-catalog.js +214 -0
- package/lib/node/session-info-util.d.ts +4 -1
- package/lib/node/session-info-util.js +7 -2
- package/lib/node/settings-store.d.ts +1 -4
- package/lib/node/settings-store.js +11 -3
- package/lib/node/sign-in/access-server-impl.d.ts +20 -0
- package/lib/node/sign-in/access-server-impl.js +85 -0
- package/lib/node/sign-in/access-store.d.ts +66 -0
- package/lib/node/sign-in/access-store.js +179 -0
- package/lib/node/sign-in/index.d.ts +8 -0
- package/lib/node/sign-in/index.js +24 -0
- package/lib/node/sign-in/sign-in-flow.d.ts +59 -0
- package/lib/node/sign-in/sign-in-flow.js +108 -0
- package/lib/node/sign-in/sign-in-middleware.d.ts +11 -0
- package/lib/node/sign-in/sign-in-middleware.js +51 -0
- package/lib/node/sign-in/sign-in-pages.d.ts +32 -0
- package/lib/node/sign-in/sign-in-pages.js +121 -0
- package/lib/node/sign-in/sign-in-provider.d.ts +136 -0
- package/lib/node/sign-in/sign-in-provider.js +232 -0
- package/lib/node/sign-in/ta-sign-in.d.ts +11 -0
- package/lib/node/sign-in/ta-sign-in.js +35 -0
- package/lib/node/ta-access.d.ts +7 -0
- package/lib/node/ta-access.js +30 -1
- package/lib/node/ta-server-impl.d.ts +8 -3
- package/lib/node/ta-server-impl.js +24 -5
- package/lib/node/ta-session-factory.d.ts +1 -1
- package/lib/node/ta-session-factory.js +14 -4
- package/lib/node/ta-session-registry.d.ts +2 -0
- package/lib/node/ta-session-registry.js +23 -3
- package/lib/node/ta-session.d.ts +24 -2
- package/lib/node/ta-session.js +83 -6
- package/lib/node/temporary-packages.d.ts +47 -0
- package/lib/node/temporary-packages.js +118 -0
- package/lib/node/temporary-purge.d.ts +14 -0
- package/lib/node/temporary-purge.js +54 -0
- package/lib/node/web-extension-catalog.d.ts +28 -1
- package/lib/node/web-extension-catalog.js +172 -4
- package/lib/node/web-extension-util.d.ts +5 -1
- package/lib/node/web-extension-util.js +36 -5
- package/lib/node/workspace-service.js +1 -1
- package/package.json +17 -12
- package/esm/node/auth-server-impl.js.map +0 -1
- package/esm/node/client-channel.js.map +0 -1
- package/esm/node/client-tool-broker.js.map +0 -1
- package/esm/node/event-log.js.map +0 -1
- package/esm/node/exec-environment-factory.js.map +0 -1
- package/esm/node/extension-data-notifier.js.map +0 -1
- package/esm/node/extension-data.js.map +0 -1
- package/esm/node/extension-providers.js.map +0 -1
- package/esm/node/host-protocol.js.map +0 -1
- package/esm/node/index.js.map +0 -1
- package/esm/node/module.js.map +0 -1
- package/esm/node/package-host-extension.js.map +0 -1
- package/esm/node/package-hosts.js.map +0 -1
- package/esm/node/package-server-impl.js.map +0 -1
- package/esm/node/package-switch.js.map +0 -1
- package/esm/node/receipt-book.js.map +0 -1
- package/esm/node/relay-bridge.js.map +0 -1
- package/esm/node/remote/index.js.map +0 -1
- package/esm/node/remote/pi-directories.js.map +0 -1
- package/esm/node/remote/port-forwards.js.map +0 -1
- package/esm/node/remote/remote-hosts.js.map +0 -1
- package/esm/node/remote/remote-protocol.js.map +0 -1
- package/esm/node/remote/remote-server-impl.js.map +0 -1
- package/esm/node/remote-ui-context.js.map +0 -1
- package/esm/node/session-files.js.map +0 -1
- package/esm/node/session-info-util.js.map +0 -1
- package/esm/node/session-storage/file-session-storage.js.map +0 -1
- package/esm/node/session-storage/index.js.map +0 -1
- package/esm/node/session-storage/session-storage-protocol.js.map +0 -1
- package/esm/node/session-storage/stored-session.js.map +0 -1
- package/esm/node/settings-server-impl.js.map +0 -1
- package/esm/node/settings-store.js.map +0 -1
- package/esm/node/ta-access.js.map +0 -1
- package/esm/node/ta-errors.js.map +0 -1
- package/esm/node/ta-event-util.js.map +0 -1
- package/esm/node/ta-server-impl.js.map +0 -1
- package/esm/node/ta-session-factory.js.map +0 -1
- package/esm/node/ta-session-registry.js.map +0 -1
- package/esm/node/ta-session.js.map +0 -1
- package/esm/node/terminal-protocol.js.map +0 -1
- package/esm/node/terminal-service.js.map +0 -1
- package/esm/node/terminal-util.js.map +0 -1
- package/esm/node/web-extension-catalog.js.map +0 -1
- package/esm/node/web-extension-util.js.map +0 -1
- package/esm/node/working-directory.js.map +0 -1
- package/esm/node/workspace-files.js.map +0 -1
- package/esm/node/workspace-protocol.js.map +0 -1
- package/esm/node/workspace-server-impl.js.map +0 -1
- package/esm/node/workspace-service.js.map +0 -1
- package/esm/node/workspace-util.js.map +0 -1
- package/lib/node/auth-server-impl.d.ts.map +0 -1
- package/lib/node/auth-server-impl.js.map +0 -1
- package/lib/node/auth-server-impl.spec.d.ts +0 -2
- package/lib/node/auth-server-impl.spec.d.ts.map +0 -1
- package/lib/node/auth-server-impl.spec.js +0 -47
- package/lib/node/auth-server-impl.spec.js.map +0 -1
- package/lib/node/client-channel.d.ts.map +0 -1
- package/lib/node/client-channel.js.map +0 -1
- package/lib/node/client-channel.spec.d.ts +0 -2
- package/lib/node/client-channel.spec.d.ts.map +0 -1
- package/lib/node/client-channel.spec.js +0 -106
- package/lib/node/client-channel.spec.js.map +0 -1
- package/lib/node/client-tool-broker.d.ts.map +0 -1
- package/lib/node/client-tool-broker.js.map +0 -1
- package/lib/node/client-tool-broker.spec.d.ts +0 -2
- package/lib/node/client-tool-broker.spec.d.ts.map +0 -1
- package/lib/node/client-tool-broker.spec.js +0 -49
- package/lib/node/client-tool-broker.spec.js.map +0 -1
- package/lib/node/event-log.d.ts.map +0 -1
- package/lib/node/event-log.js.map +0 -1
- package/lib/node/event-log.spec.d.ts +0 -2
- package/lib/node/event-log.spec.d.ts.map +0 -1
- package/lib/node/event-log.spec.js +0 -48
- package/lib/node/event-log.spec.js.map +0 -1
- package/lib/node/exec-environment-factory.d.ts.map +0 -1
- package/lib/node/exec-environment-factory.js.map +0 -1
- package/lib/node/extension-data-notifier.d.ts.map +0 -1
- package/lib/node/extension-data-notifier.js.map +0 -1
- package/lib/node/extension-data-notifier.spec.d.ts +0 -2
- package/lib/node/extension-data-notifier.spec.d.ts.map +0 -1
- package/lib/node/extension-data-notifier.spec.js +0 -35
- package/lib/node/extension-data-notifier.spec.js.map +0 -1
- package/lib/node/extension-data.d.ts.map +0 -1
- package/lib/node/extension-data.js.map +0 -1
- package/lib/node/extension-data.spec.d.ts +0 -2
- package/lib/node/extension-data.spec.d.ts.map +0 -1
- package/lib/node/extension-data.spec.js +0 -99
- package/lib/node/extension-data.spec.js.map +0 -1
- package/lib/node/extension-providers.d.ts.map +0 -1
- package/lib/node/extension-providers.js.map +0 -1
- package/lib/node/host-protocol.d.ts.map +0 -1
- package/lib/node/host-protocol.js.map +0 -1
- package/lib/node/index.d.ts.map +0 -1
- package/lib/node/index.js.map +0 -1
- package/lib/node/module.d.ts.map +0 -1
- package/lib/node/module.js.map +0 -1
- package/lib/node/package-host-extension.d.ts.map +0 -1
- package/lib/node/package-host-extension.js.map +0 -1
- package/lib/node/package-hosts.d.ts.map +0 -1
- package/lib/node/package-hosts.js.map +0 -1
- package/lib/node/package-hosts.spec.d.ts +0 -2
- package/lib/node/package-hosts.spec.d.ts.map +0 -1
- package/lib/node/package-hosts.spec.js +0 -53
- package/lib/node/package-hosts.spec.js.map +0 -1
- package/lib/node/package-server-impl.d.ts.map +0 -1
- package/lib/node/package-server-impl.js.map +0 -1
- package/lib/node/package-switch.d.ts.map +0 -1
- package/lib/node/package-switch.js.map +0 -1
- package/lib/node/receipt-book.d.ts.map +0 -1
- package/lib/node/receipt-book.js.map +0 -1
- package/lib/node/receipt-book.spec.d.ts +0 -2
- package/lib/node/receipt-book.spec.d.ts.map +0 -1
- package/lib/node/receipt-book.spec.js +0 -39
- package/lib/node/receipt-book.spec.js.map +0 -1
- package/lib/node/relay-bridge.d.ts.map +0 -1
- package/lib/node/relay-bridge.js.map +0 -1
- package/lib/node/remote/index.d.ts.map +0 -1
- package/lib/node/remote/index.js.map +0 -1
- package/lib/node/remote/pi-directories.d.ts.map +0 -1
- package/lib/node/remote/pi-directories.js.map +0 -1
- package/lib/node/remote/port-forwards.d.ts.map +0 -1
- package/lib/node/remote/port-forwards.js.map +0 -1
- package/lib/node/remote/remote-hosts.d.ts.map +0 -1
- package/lib/node/remote/remote-hosts.js.map +0 -1
- package/lib/node/remote/remote-protocol.d.ts.map +0 -1
- package/lib/node/remote/remote-protocol.js.map +0 -1
- package/lib/node/remote/remote-server-impl.d.ts.map +0 -1
- package/lib/node/remote/remote-server-impl.js.map +0 -1
- package/lib/node/remote/remote.spec.d.ts +0 -2
- package/lib/node/remote/remote.spec.d.ts.map +0 -1
- package/lib/node/remote/remote.spec.js +0 -130
- package/lib/node/remote/remote.spec.js.map +0 -1
- package/lib/node/remote-ui-context.d.ts.map +0 -1
- package/lib/node/remote-ui-context.js.map +0 -1
- package/lib/node/remote-ui-context.spec.d.ts +0 -2
- package/lib/node/remote-ui-context.spec.d.ts.map +0 -1
- package/lib/node/remote-ui-context.spec.js +0 -85
- package/lib/node/remote-ui-context.spec.js.map +0 -1
- package/lib/node/session-files.d.ts.map +0 -1
- package/lib/node/session-files.js.map +0 -1
- package/lib/node/session-files.spec.d.ts +0 -2
- package/lib/node/session-files.spec.d.ts.map +0 -1
- package/lib/node/session-files.spec.js +0 -51
- package/lib/node/session-files.spec.js.map +0 -1
- package/lib/node/session-info-util.d.ts.map +0 -1
- package/lib/node/session-info-util.js.map +0 -1
- package/lib/node/session-info-util.spec.d.ts +0 -2
- package/lib/node/session-info-util.spec.d.ts.map +0 -1
- package/lib/node/session-info-util.spec.js +0 -22
- package/lib/node/session-info-util.spec.js.map +0 -1
- package/lib/node/session-storage/file-session-storage.d.ts.map +0 -1
- package/lib/node/session-storage/file-session-storage.js.map +0 -1
- package/lib/node/session-storage/file-session-storage.spec.d.ts +0 -2
- package/lib/node/session-storage/file-session-storage.spec.d.ts.map +0 -1
- package/lib/node/session-storage/file-session-storage.spec.js +0 -70
- package/lib/node/session-storage/file-session-storage.spec.js.map +0 -1
- package/lib/node/session-storage/index.d.ts.map +0 -1
- package/lib/node/session-storage/index.js.map +0 -1
- package/lib/node/session-storage/session-storage-protocol.d.ts.map +0 -1
- package/lib/node/session-storage/session-storage-protocol.js.map +0 -1
- package/lib/node/session-storage/stored-session.d.ts.map +0 -1
- package/lib/node/session-storage/stored-session.js.map +0 -1
- package/lib/node/session-storage/stored-session.spec.d.ts +0 -2
- package/lib/node/session-storage/stored-session.spec.d.ts.map +0 -1
- package/lib/node/session-storage/stored-session.spec.js +0 -73
- package/lib/node/session-storage/stored-session.spec.js.map +0 -1
- package/lib/node/settings-server-impl.d.ts.map +0 -1
- package/lib/node/settings-server-impl.js.map +0 -1
- package/lib/node/settings-store.d.ts.map +0 -1
- package/lib/node/settings-store.js.map +0 -1
- package/lib/node/settings-store.spec.d.ts +0 -2
- package/lib/node/settings-store.spec.d.ts.map +0 -1
- package/lib/node/settings-store.spec.js +0 -148
- package/lib/node/settings-store.spec.js.map +0 -1
- package/lib/node/ta-access.d.ts.map +0 -1
- package/lib/node/ta-access.js.map +0 -1
- package/lib/node/ta-access.spec.d.ts +0 -2
- package/lib/node/ta-access.spec.d.ts.map +0 -1
- package/lib/node/ta-access.spec.js +0 -33
- package/lib/node/ta-access.spec.js.map +0 -1
- package/lib/node/ta-errors.d.ts.map +0 -1
- package/lib/node/ta-errors.js.map +0 -1
- package/lib/node/ta-errors.spec.d.ts +0 -2
- package/lib/node/ta-errors.spec.d.ts.map +0 -1
- package/lib/node/ta-errors.spec.js +0 -25
- package/lib/node/ta-errors.spec.js.map +0 -1
- package/lib/node/ta-event-util.d.ts.map +0 -1
- package/lib/node/ta-event-util.js.map +0 -1
- package/lib/node/ta-event-util.spec.d.ts +0 -2
- package/lib/node/ta-event-util.spec.d.ts.map +0 -1
- package/lib/node/ta-event-util.spec.js +0 -28
- package/lib/node/ta-event-util.spec.js.map +0 -1
- package/lib/node/ta-server-impl.d.ts.map +0 -1
- package/lib/node/ta-server-impl.js.map +0 -1
- package/lib/node/ta-session-factory.d.ts.map +0 -1
- package/lib/node/ta-session-factory.js.map +0 -1
- package/lib/node/ta-session-registry.d.ts.map +0 -1
- package/lib/node/ta-session-registry.js.map +0 -1
- package/lib/node/ta-session.d.ts.map +0 -1
- package/lib/node/ta-session.js.map +0 -1
- package/lib/node/terminal-protocol.d.ts.map +0 -1
- package/lib/node/terminal-protocol.js.map +0 -1
- package/lib/node/terminal-service.d.ts.map +0 -1
- package/lib/node/terminal-service.js.map +0 -1
- package/lib/node/terminal-service.spec.d.ts +0 -2
- package/lib/node/terminal-service.spec.d.ts.map +0 -1
- package/lib/node/terminal-service.spec.js +0 -110
- package/lib/node/terminal-service.spec.js.map +0 -1
- package/lib/node/terminal-util.d.ts.map +0 -1
- package/lib/node/terminal-util.js.map +0 -1
- package/lib/node/terminal-util.spec.d.ts +0 -2
- package/lib/node/terminal-util.spec.d.ts.map +0 -1
- package/lib/node/terminal-util.spec.js +0 -95
- package/lib/node/terminal-util.spec.js.map +0 -1
- package/lib/node/web-extension-catalog.d.ts.map +0 -1
- package/lib/node/web-extension-catalog.js.map +0 -1
- package/lib/node/web-extension-catalog.spec.d.ts +0 -2
- package/lib/node/web-extension-catalog.spec.d.ts.map +0 -1
- package/lib/node/web-extension-catalog.spec.js +0 -157
- package/lib/node/web-extension-catalog.spec.js.map +0 -1
- package/lib/node/web-extension-util.d.ts.map +0 -1
- package/lib/node/web-extension-util.js.map +0 -1
- package/lib/node/working-directory.d.ts.map +0 -1
- package/lib/node/working-directory.js.map +0 -1
- package/lib/node/workspace-files.d.ts.map +0 -1
- package/lib/node/workspace-files.js.map +0 -1
- package/lib/node/workspace-files.spec.d.ts +0 -2
- package/lib/node/workspace-files.spec.d.ts.map +0 -1
- package/lib/node/workspace-files.spec.js +0 -133
- package/lib/node/workspace-files.spec.js.map +0 -1
- package/lib/node/workspace-protocol.d.ts.map +0 -1
- package/lib/node/workspace-protocol.js.map +0 -1
- package/lib/node/workspace-server-impl.d.ts.map +0 -1
- package/lib/node/workspace-server-impl.js.map +0 -1
- package/lib/node/workspace-service.d.ts.map +0 -1
- package/lib/node/workspace-service.js.map +0 -1
- package/lib/node/workspace-service.spec.d.ts +0 -2
- package/lib/node/workspace-service.spec.d.ts.map +0 -1
- package/lib/node/workspace-service.spec.js +0 -113
- package/lib/node/workspace-service.spec.js.map +0 -1
- package/lib/node/workspace-util.d.ts.map +0 -1
- package/lib/node/workspace-util.js.map +0 -1
- package/lib/node/workspace-util.spec.d.ts +0 -2
- package/lib/node/workspace-util.spec.d.ts.map +0 -1
- package/lib/node/workspace-util.spec.js +0 -44
- package/lib/node/workspace-util.spec.js.map +0 -1
- package/src/node/auth-server-impl.spec.ts +0 -49
- package/src/node/auth-server-impl.ts +0 -258
- package/src/node/client-channel.spec.ts +0 -117
- package/src/node/client-channel.ts +0 -94
- package/src/node/client-tool-broker.spec.ts +0 -53
- package/src/node/client-tool-broker.ts +0 -106
- package/src/node/event-log.spec.ts +0 -52
- package/src/node/event-log.ts +0 -59
- package/src/node/exec-environment-factory.ts +0 -66
- package/src/node/extension-data-notifier.spec.ts +0 -34
- package/src/node/extension-data-notifier.ts +0 -124
- package/src/node/extension-data.spec.ts +0 -105
- package/src/node/extension-data.ts +0 -180
- package/src/node/extension-providers.ts +0 -49
- package/src/node/host-protocol.ts +0 -62
- package/src/node/index.ts +0 -39
- package/src/node/module.ts +0 -4
- package/src/node/package-host-extension.ts +0 -23
- package/src/node/package-hosts.spec.ts +0 -54
- package/src/node/package-hosts.ts +0 -204
- package/src/node/package-server-impl.ts +0 -87
- package/src/node/package-switch.ts +0 -80
- package/src/node/receipt-book.spec.ts +0 -41
- package/src/node/receipt-book.ts +0 -40
- package/src/node/relay-bridge.ts +0 -94
- package/src/node/remote/index.ts +0 -5
- package/src/node/remote/pi-directories.ts +0 -49
- package/src/node/remote/port-forwards.ts +0 -148
- package/src/node/remote/remote-hosts.ts +0 -170
- package/src/node/remote/remote-protocol.ts +0 -57
- package/src/node/remote/remote-server-impl.ts +0 -60
- package/src/node/remote/remote.spec.ts +0 -142
- package/src/node/remote-ui-context.spec.ts +0 -93
- package/src/node/remote-ui-context.ts +0 -197
- package/src/node/session-files.spec.ts +0 -52
- package/src/node/session-files.ts +0 -41
- package/src/node/session-info-util.spec.ts +0 -23
- package/src/node/session-info-util.ts +0 -55
- package/src/node/session-storage/file-session-storage.spec.ts +0 -72
- package/src/node/session-storage/file-session-storage.ts +0 -145
- package/src/node/session-storage/index.ts +0 -3
- package/src/node/session-storage/session-storage-protocol.ts +0 -81
- package/src/node/session-storage/stored-session.spec.ts +0 -80
- package/src/node/session-storage/stored-session.ts +0 -149
- package/src/node/settings-server-impl.ts +0 -42
- package/src/node/settings-store.spec.ts +0 -158
- package/src/node/settings-store.ts +0 -327
- package/src/node/ta-access.spec.ts +0 -36
- package/src/node/ta-access.ts +0 -156
- package/src/node/ta-errors.spec.ts +0 -25
- package/src/node/ta-errors.ts +0 -75
- package/src/node/ta-event-util.spec.ts +0 -29
- package/src/node/ta-event-util.ts +0 -23
- package/src/node/ta-server-impl.ts +0 -341
- package/src/node/ta-session-factory.ts +0 -216
- package/src/node/ta-session-registry.ts +0 -75
- package/src/node/ta-session.ts +0 -241
- package/src/node/terminal-protocol.ts +0 -18
- package/src/node/terminal-service.spec.ts +0 -119
- package/src/node/terminal-service.ts +0 -291
- package/src/node/terminal-util.spec.ts +0 -109
- package/src/node/terminal-util.ts +0 -197
- package/src/node/web-extension-catalog.spec.ts +0 -172
- package/src/node/web-extension-catalog.ts +0 -177
- package/src/node/web-extension-util.ts +0 -144
- package/src/node/working-directory.ts +0 -71
- package/src/node/workspace-files.spec.ts +0 -145
- package/src/node/workspace-files.ts +0 -256
- package/src/node/workspace-protocol.ts +0 -24
- package/src/node/workspace-server-impl.ts +0 -108
- package/src/node/workspace-service.spec.ts +0 -123
- package/src/node/workspace-service.ts +0 -235
- package/src/node/workspace-util.spec.ts +0 -47
- package/src/node/workspace-util.ts +0 -103
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessagePage = void 0;
|
|
4
|
+
/** The roles of the messages of one turn of the model, after the message that asked. */
|
|
5
|
+
const TURN_ROLES = new Set(['assistant', 'toolResult']);
|
|
6
|
+
/** Sizes of the messages already measured: they do not change once written. */
|
|
7
|
+
const sizes = new WeakMap();
|
|
8
|
+
/**
|
|
9
|
+
* The parts of a long conversation a client loads one at a time, the latest first: about so many bytes
|
|
10
|
+
* of JSON each, as the client gets them.
|
|
11
|
+
*/
|
|
12
|
+
var MessagePage;
|
|
13
|
+
(function (MessagePage) {
|
|
14
|
+
function size(message) {
|
|
15
|
+
let known = sizes.get(message);
|
|
16
|
+
if (known === undefined) {
|
|
17
|
+
known = JSON.stringify(message).length;
|
|
18
|
+
sizes.set(message, known);
|
|
19
|
+
}
|
|
20
|
+
return known;
|
|
21
|
+
}
|
|
22
|
+
MessagePage.size = size;
|
|
23
|
+
function role(message) {
|
|
24
|
+
return message === null || message === void 0 ? void 0 : message.role;
|
|
25
|
+
}
|
|
26
|
+
function timestamp(message) {
|
|
27
|
+
return message === null || message === void 0 ? void 0 : message.timestamp;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Where the messages before `end` that fit in `budget` start: at least one; back to the message that
|
|
31
|
+
* asked for their turn if that takes no more than twice the budget, so that a turn shows whole.
|
|
32
|
+
*/
|
|
33
|
+
function start(messages, end, budget) {
|
|
34
|
+
var _a;
|
|
35
|
+
let start = end;
|
|
36
|
+
let used = 0;
|
|
37
|
+
while (start > 0 && (start === end || used + size(messages[start - 1]) <= budget)) {
|
|
38
|
+
start--;
|
|
39
|
+
used += size(messages[start]);
|
|
40
|
+
}
|
|
41
|
+
while (start > 0 && TURN_ROLES.has((_a = role(messages[start])) !== null && _a !== void 0 ? _a : '') && used + size(messages[start - 1]) <= budget * 2) {
|
|
42
|
+
start--;
|
|
43
|
+
used += size(messages[start]);
|
|
44
|
+
}
|
|
45
|
+
return start;
|
|
46
|
+
}
|
|
47
|
+
MessagePage.start = start;
|
|
48
|
+
/** The latest part of a conversation, or all of it without a budget. */
|
|
49
|
+
function recent(conversation, budget) {
|
|
50
|
+
if (!budget || budget <= 0) {
|
|
51
|
+
return conversation;
|
|
52
|
+
}
|
|
53
|
+
const from = start(conversation.messages, conversation.messages.length, budget);
|
|
54
|
+
return from === 0 ? conversation : { ...conversation, messages: conversation.messages.slice(from), start: from };
|
|
55
|
+
}
|
|
56
|
+
MessagePage.recent = recent;
|
|
57
|
+
/** The part before message `before`, found again by its timestamp if messages came or went before it. */
|
|
58
|
+
function before(messages, before, stamp, budget) {
|
|
59
|
+
let end = before !== null && before !== void 0 ? before : messages.length;
|
|
60
|
+
if (before !== undefined && (before > messages.length || timestamp(messages[before]) !== stamp)) {
|
|
61
|
+
end = messages.length - 1;
|
|
62
|
+
while (end >= 0 && (stamp === undefined || timestamp(messages[end]) !== stamp)) {
|
|
63
|
+
end--;
|
|
64
|
+
}
|
|
65
|
+
if (end < 0) {
|
|
66
|
+
return { messages: [], start: 0, found: false };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const from = start(messages, end, Math.max(1, budget));
|
|
70
|
+
return { messages: messages.slice(from, end), start: from, found: true };
|
|
71
|
+
}
|
|
72
|
+
MessagePage.before = before;
|
|
73
|
+
})(MessagePage || (exports.MessagePage = MessagePage = {}));
|
|
74
|
+
//# sourceMappingURL=message-page.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExecEnvironmentFactory } from '@celljs/ta-exec';
|
|
2
|
-
import { type TaPackageInfo, TaPackageServer, type TaSettingsScope, type TaWebExtensionInfo, type TaWebExtensionSource } from '@celljs/ta-protocol';
|
|
2
|
+
import { type TaPackageInfo, TaPackageServer, type TaSettingsScope, type TaTemporaryFrom, type TaWebExtensionInfo, type TaWebExtensionSource } from '@celljs/ta-protocol';
|
|
3
3
|
import { ExtensionDataStore } from './extension-data';
|
|
4
4
|
import { ExtensionDataNotifier } from './extension-data-notifier';
|
|
5
5
|
import { WebExtensionCatalog } from './host-protocol';
|
|
@@ -21,6 +21,14 @@ export declare class TaPackageServerImpl implements TaPackageServer {
|
|
|
21
21
|
callPackageHost(name: string, method: string, params?: unknown[]): Promise<unknown>;
|
|
22
22
|
getExtensionData(name: string, key: string, cwd?: string): Promise<unknown>;
|
|
23
23
|
setExtensionData(name: string, key: string, value: unknown, cwd?: string): Promise<void>;
|
|
24
|
+
openTemporaryPackage(source: string, from: TaTemporaryFrom): Promise<TaWebExtensionInfo[]>;
|
|
25
|
+
updateTemporaryPackage(id: string, change: {
|
|
26
|
+
used?: boolean;
|
|
27
|
+
kept?: boolean;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
installTemporaryPackage(id: string): Promise<void>;
|
|
30
|
+
getTemporaryRetention(): Promise<number>;
|
|
31
|
+
setTemporaryRetention(days: number): Promise<void>;
|
|
24
32
|
protected cwd(cwd?: string): Promise<string>;
|
|
25
33
|
}
|
|
26
34
|
//# sourceMappingURL=package-server-impl.d.ts.map
|
|
@@ -66,6 +66,21 @@ let TaPackageServerImpl = class TaPackageServerImpl {
|
|
|
66
66
|
setExtensionData(name, key, value, cwd) {
|
|
67
67
|
return ta_errors_1.TaErrors.guard(() => this.extensionData.set(name, key, value, cwd));
|
|
68
68
|
}
|
|
69
|
+
openTemporaryPackage(source, from) {
|
|
70
|
+
return ta_errors_1.TaErrors.guard(async () => this.webExtensions.openTemporary(await this.cwd(), source, from));
|
|
71
|
+
}
|
|
72
|
+
updateTemporaryPackage(id, change) {
|
|
73
|
+
return ta_errors_1.TaErrors.guard(async () => this.webExtensions.updateTemporary(await this.cwd(), id, change !== null && change !== void 0 ? change : {}));
|
|
74
|
+
}
|
|
75
|
+
installTemporaryPackage(id) {
|
|
76
|
+
return ta_errors_1.TaErrors.guard(async () => this.webExtensions.installTemporary(await this.cwd(), id));
|
|
77
|
+
}
|
|
78
|
+
getTemporaryRetention() {
|
|
79
|
+
return ta_errors_1.TaErrors.guard(async () => this.webExtensions.temporaryRetention);
|
|
80
|
+
}
|
|
81
|
+
setTemporaryRetention(days) {
|
|
82
|
+
return ta_errors_1.TaErrors.guard(async () => this.webExtensions.setTemporaryRetention(days));
|
|
83
|
+
}
|
|
69
84
|
async cwd(cwd) {
|
|
70
85
|
return cwd || (await this.environments.defaultCwd());
|
|
71
86
|
}
|
|
@@ -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';
|
|
6
8
|
import { type TaAccess } from './ta-access';
|
|
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/lib/node/relay-bridge.js
CHANGED
|
@@ -8,15 +8,20 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var RelayBridge_1;
|
|
11
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
13
|
exports.TaRelayServerImpl = exports.RelayBridge = exports.RELAY_BRIDGE = void 0;
|
|
13
14
|
const node_fs_1 = require("node:fs");
|
|
15
|
+
const node_path_1 = require("node:path");
|
|
14
16
|
const core_1 = require("@celljs/core");
|
|
15
17
|
const rpc_1 = require("@celljs/rpc");
|
|
18
|
+
const ta_exec_1 = require("@celljs/ta-exec");
|
|
19
|
+
const package_archive_1 = require("@celljs/ta-harness/lib/node/package-archive");
|
|
16
20
|
const ta_brand_1 = require("@celljs/ta-harness/lib/node/ta-brand");
|
|
17
21
|
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
18
22
|
const node_1 = require("@celljs/ta-relay/lib/node");
|
|
19
23
|
const node_2 = require("@celljs/web/lib/node");
|
|
24
|
+
const host_protocol_1 = require("./host-protocol");
|
|
20
25
|
const ta_access_1 = require("./ta-access");
|
|
21
26
|
const ta_errors_1 = require("./ta-errors");
|
|
22
27
|
/** The id of {@link RelayBridge}, for TaRelayServerImpl. */
|
|
@@ -28,7 +33,7 @@ const WATCH_INTERVAL_MS = 2000;
|
|
|
28
33
|
* keeps a connection out to the relay and gives each device a connection of its own to this server.
|
|
29
34
|
* Without one it does nothing.
|
|
30
35
|
*/
|
|
31
|
-
let RelayBridge = class RelayBridge {
|
|
36
|
+
let RelayBridge = RelayBridge_1 = class RelayBridge {
|
|
32
37
|
constructor() {
|
|
33
38
|
this.store = new node_1.RelayStore(ta_brand_1.TaBrand.agentDir());
|
|
34
39
|
}
|
|
@@ -56,10 +61,14 @@ let RelayBridge = class RelayBridge {
|
|
|
56
61
|
(0, node_fs_1.unwatchFile)(this.store.file);
|
|
57
62
|
(_a = this.host) === null || _a === void 0 ? void 0 : _a.stop();
|
|
58
63
|
}
|
|
64
|
+
/** A package as it goes by a link: a gzipped tar of its directory, without node_modules and .git. */
|
|
65
|
+
static async pack(root) {
|
|
66
|
+
return package_archive_1.PackageArchive.pack((0, node_path_1.basename)(root), package_archive_1.PackageArchive.collect(root));
|
|
67
|
+
}
|
|
59
68
|
start(server) {
|
|
60
69
|
const { port } = server.address();
|
|
61
70
|
const localUrl = `ws://127.0.0.1:${port}${ta_protocol_1.TA_WEBSOCKET_PATH}?token=${encodeURIComponent(this.access.token)}`;
|
|
62
|
-
const host = new node_1.RelayHost({ store: this.store, localUrl });
|
|
71
|
+
const host = new node_1.RelayHost({ store: this.store, localUrl, sharePackage: share => RelayBridge_1.pack(share.root) });
|
|
63
72
|
this.host = host;
|
|
64
73
|
host.start();
|
|
65
74
|
(0, node_fs_1.watchFile)(this.store.file, { interval: WATCH_INTERVAL_MS }, () => host.refresh());
|
|
@@ -70,12 +79,35 @@ __decorate([
|
|
|
70
79
|
(0, core_1.Autowired)(ta_access_1.TA_ACCESS),
|
|
71
80
|
__metadata("design:type", Function)
|
|
72
81
|
], RelayBridge.prototype, "access", void 0);
|
|
73
|
-
exports.RelayBridge = RelayBridge = __decorate([
|
|
82
|
+
exports.RelayBridge = RelayBridge = RelayBridge_1 = __decorate([
|
|
74
83
|
(0, core_1.Component)([exports.RELAY_BRIDGE, node_2.ServerAware, core_1.ApplicationLifecycle])
|
|
75
84
|
], RelayBridge);
|
|
76
85
|
const device = ({ id, name, createdAt }) => ({ id, name, createdAt });
|
|
77
86
|
/** `ta pair` for clients: the devices of relay.json, which RelayBridge serves. Their keys never leave, but in the link of a new one. */
|
|
78
87
|
let TaRelayServerImpl = class TaRelayServerImpl {
|
|
88
|
+
sharePackage(id) {
|
|
89
|
+
return ta_errors_1.TaErrors.guard(async () => {
|
|
90
|
+
const pkg = await this.catalog.packageOf(await this.environments.defaultCwd(), id);
|
|
91
|
+
if (pkg.origin === 'builtin') {
|
|
92
|
+
throw ta_errors_1.TaErrors.invalidArgument(`${pkg.name} comes with Ta: everyone has it already.`, 'Share a package of your own, or one you installed.');
|
|
93
|
+
}
|
|
94
|
+
// Packed once now: what is too large is told at once, not when the other computer asks.
|
|
95
|
+
const size = (await RelayBridge.pack(pkg.root)).length;
|
|
96
|
+
if (size > node_1.RELAY_SHARE_MAX_BYTES) {
|
|
97
|
+
throw ta_errors_1.TaErrors.invalidArgument(`${pkg.name} is ${(size / 1024 / 1024).toFixed(1)} MB packed, more than the ${node_1.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.');
|
|
98
|
+
}
|
|
99
|
+
const { link, share } = this.bridge.store.shareRoot(pkg.root, pkg.name);
|
|
100
|
+
this.bridge.refresh();
|
|
101
|
+
return { link: node_1.RelayShareUtil.link(link), expiresAt: share.expiresAt, maxBytes: node_1.RELAY_SHARE_MAX_BYTES };
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
unsharePackage(id) {
|
|
105
|
+
return ta_errors_1.TaErrors.guard(async () => {
|
|
106
|
+
const pkg = await this.catalog.packageOf(await this.environments.defaultCwd(), id);
|
|
107
|
+
this.bridge.store.unshareRoot(pkg.root);
|
|
108
|
+
this.bridge.refresh();
|
|
109
|
+
});
|
|
110
|
+
}
|
|
79
111
|
async getRelay() {
|
|
80
112
|
const { url, devices } = this.bridge.store.read();
|
|
81
113
|
return { relay: url, defaultRelay: node_1.RELAY_DEFAULT_URL, online: this.bridge.online, devices: devices.map(device) };
|
|
@@ -102,6 +134,14 @@ __decorate([
|
|
|
102
134
|
(0, core_1.Autowired)(exports.RELAY_BRIDGE),
|
|
103
135
|
__metadata("design:type", RelayBridge)
|
|
104
136
|
], TaRelayServerImpl.prototype, "bridge", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
(0, core_1.Autowired)(host_protocol_1.WebExtensionCatalog),
|
|
139
|
+
__metadata("design:type", Object)
|
|
140
|
+
], TaRelayServerImpl.prototype, "catalog", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
(0, core_1.Autowired)(ta_exec_1.ExecEnvironmentFactory),
|
|
143
|
+
__metadata("design:type", Object)
|
|
144
|
+
], TaRelayServerImpl.prototype, "environments", void 0);
|
|
105
145
|
exports.TaRelayServerImpl = TaRelayServerImpl = __decorate([
|
|
106
146
|
(0, rpc_1.Rpc)(ta_protocol_1.TaRelayServer)
|
|
107
147
|
], TaRelayServerImpl);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type CodingAgentOptions } from '@celljs/ai-coding-agent';
|
|
2
|
+
import type { TaSavedSessionInfo } from '@celljs/ta-protocol';
|
|
3
|
+
import { TaSessionCatalog } from './host-protocol';
|
|
4
|
+
import { PiDirectories } from './remote/remote-protocol';
|
|
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 {};
|
|
70
|
+
//# sourceMappingURL=session-catalog.d.ts.map
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DefaultTaSessionCatalog = exports.SessionCatalogUtil = void 0;
|
|
13
|
+
const promises_1 = require("node:fs/promises");
|
|
14
|
+
const node_path_1 = require("node:path");
|
|
15
|
+
const ai_coding_agent_1 = require("@celljs/ai-coding-agent");
|
|
16
|
+
const core_1 = require("@celljs/core");
|
|
17
|
+
const host_protocol_1 = require("./host-protocol");
|
|
18
|
+
const remote_protocol_1 = require("./remote/remote-protocol");
|
|
19
|
+
const session_info_util_1 = require("./session-info-util");
|
|
20
|
+
/** Files read at once. */
|
|
21
|
+
const BATCH = 16;
|
|
22
|
+
var SessionCatalogUtil;
|
|
23
|
+
(function (SessionCatalogUtil) {
|
|
24
|
+
/** pi's custom entry that names the group of the package that opened the session (TaOpenSessionOptions.group). */
|
|
25
|
+
SessionCatalogUtil.GROUP_ENTRY = 'ta-group';
|
|
26
|
+
/**
|
|
27
|
+
* Writes the group in the session, once: after the session closes, its file still says that its package
|
|
28
|
+
* 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.
|
|
29
|
+
*/
|
|
30
|
+
function markGroup(session, group) {
|
|
31
|
+
if (groupOf(session.getEntries()) !== group) {
|
|
32
|
+
session.appendCustomEntry(SessionCatalogUtil.GROUP_ENTRY, { group });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
SessionCatalogUtil.markGroup = markGroup;
|
|
36
|
+
/** pi's custom entry that keeps the role a session was opened with (TaOpenSessionOptions.appendSystemPrompt). */
|
|
37
|
+
SessionCatalogUtil.ROLE_ENTRY = 'ta-role';
|
|
38
|
+
/**
|
|
39
|
+
* Writes the role of the session when it is not the one written last: opened again from its file
|
|
40
|
+
* without one (by a package that relays a message to it, or from the list of conversations), it keeps it.
|
|
41
|
+
*/
|
|
42
|
+
function markRole(session, role) {
|
|
43
|
+
if (roleOf(session.getEntries()) !== role) {
|
|
44
|
+
session.appendCustomEntry(SessionCatalogUtil.ROLE_ENTRY, { role });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
SessionCatalogUtil.markRole = markRole;
|
|
48
|
+
/** The role the last of the entries keeps. */
|
|
49
|
+
function roleOf(entries) {
|
|
50
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
51
|
+
const { type, customType, data } = entries[i];
|
|
52
|
+
if (type === 'custom' && customType === SessionCatalogUtil.ROLE_ENTRY) {
|
|
53
|
+
const role = data === null || data === void 0 ? void 0 : data.role;
|
|
54
|
+
return typeof role === 'string' && role ? role : undefined;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
SessionCatalogUtil.roleOf = roleOf;
|
|
60
|
+
/** The group the last of the entries names. */
|
|
61
|
+
function groupOf(entries) {
|
|
62
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
63
|
+
const { type, customType, data } = entries[i];
|
|
64
|
+
if (type === 'custom' && customType === SessionCatalogUtil.GROUP_ENTRY) {
|
|
65
|
+
const group = data === null || data === void 0 ? void 0 : data.group;
|
|
66
|
+
return typeof group === 'string' && group ? group : undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
SessionCatalogUtil.groupOf = groupOf;
|
|
72
|
+
/**
|
|
73
|
+
* What a list of conversations shows of the text of a pi session file, as pi's `/resume` reads it:
|
|
74
|
+
* undefined for a file that does not start with a session header.
|
|
75
|
+
*/
|
|
76
|
+
function summarize(text, modifiedAt) {
|
|
77
|
+
let header;
|
|
78
|
+
let sessionName;
|
|
79
|
+
let firstMessage;
|
|
80
|
+
let messageCount = 0;
|
|
81
|
+
let updatedAt;
|
|
82
|
+
const marks = [];
|
|
83
|
+
for (const line of text.split('\n')) {
|
|
84
|
+
const entry = parse(line);
|
|
85
|
+
if (!entry) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (!header) {
|
|
89
|
+
if (entry.type !== 'session') {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
header = entry;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (entry.type === 'session_info') {
|
|
96
|
+
sessionName = typeof entry.name === 'string' ? entry.name.trim() || undefined : undefined;
|
|
97
|
+
}
|
|
98
|
+
else if (entry.type === 'custom') {
|
|
99
|
+
marks.push(entry);
|
|
100
|
+
}
|
|
101
|
+
else if (entry.type === 'message' && entry.message && typeof entry.message === 'object') {
|
|
102
|
+
const message = entry.message;
|
|
103
|
+
messageCount++;
|
|
104
|
+
firstMessage !== null && firstMessage !== void 0 ? firstMessage : (firstMessage = session_info_util_1.SessionInfoUtil.firstMessage([message]));
|
|
105
|
+
if (typeof message.timestamp === 'number') {
|
|
106
|
+
updatedAt = Math.max(updatedAt !== null && updatedAt !== void 0 ? updatedAt : 0, message.timestamp);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (!header || typeof header.id !== 'string') {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
const started = typeof header.timestamp === 'string' ? Date.parse(header.timestamp) : Number.NaN;
|
|
114
|
+
const createdAt = Number.isNaN(started) ? modifiedAt : started;
|
|
115
|
+
return {
|
|
116
|
+
piSessionId: header.id,
|
|
117
|
+
piCwd: typeof header.cwd === 'string' ? header.cwd : '',
|
|
118
|
+
sessionName,
|
|
119
|
+
firstMessage,
|
|
120
|
+
messageCount,
|
|
121
|
+
createdAt,
|
|
122
|
+
updatedAt: updatedAt !== null && updatedAt !== void 0 ? updatedAt : createdAt,
|
|
123
|
+
group: groupOf(marks),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
SessionCatalogUtil.summarize = summarize;
|
|
127
|
+
function parse(line) {
|
|
128
|
+
if (!line.trim()) {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
const entry = JSON.parse(line);
|
|
133
|
+
return entry && typeof entry === 'object' && typeof entry.type === 'string' ? entry : undefined;
|
|
134
|
+
}
|
|
135
|
+
catch (_a) {
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
})(SessionCatalogUtil || (exports.SessionCatalogUtil = SessionCatalogUtil = {}));
|
|
140
|
+
/**
|
|
141
|
+
* The session files of pi in its agent directory, one directory per working directory, as pi's `/resume`
|
|
142
|
+
* lists them. A file is read again only when it changed since the last list.
|
|
143
|
+
*/
|
|
144
|
+
let DefaultTaSessionCatalog = class DefaultTaSessionCatalog {
|
|
145
|
+
constructor() {
|
|
146
|
+
/** By file: its size and time when read, and what it held. */
|
|
147
|
+
this.cache = new Map();
|
|
148
|
+
}
|
|
149
|
+
async list() {
|
|
150
|
+
const files = await this.files(await this.sessionsDir());
|
|
151
|
+
const sessions = [];
|
|
152
|
+
for (let i = 0; i < files.length; i += BATCH) {
|
|
153
|
+
await Promise.all(files.slice(i, i + BATCH).map(async (file) => {
|
|
154
|
+
const summary = await this.summary(file);
|
|
155
|
+
if (summary) {
|
|
156
|
+
const { piCwd, ...info } = summary;
|
|
157
|
+
sessions.push({ ...info, sessionFile: file, cwd: piCwd && this.directories.fromPi(piCwd) });
|
|
158
|
+
}
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
161
|
+
const listed = new Set(files);
|
|
162
|
+
for (const file of this.cache.keys()) {
|
|
163
|
+
if (!listed.has(file)) {
|
|
164
|
+
this.cache.delete(file);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return sessions.sort((a, b) => b.updatedAt - a.updatedAt);
|
|
168
|
+
}
|
|
169
|
+
/** Where pi keeps the sessions it creates (SessionManager.create without a directory). */
|
|
170
|
+
async sessionsDir() {
|
|
171
|
+
var _a;
|
|
172
|
+
var _b;
|
|
173
|
+
const agentDir = (_b = (_a = this.codingAgentOptions) === null || _a === void 0 ? void 0 : _a.agentDir) !== null && _b !== void 0 ? _b : (await ai_coding_agent_1.PiSdkUtil.load()).getAgentDir();
|
|
174
|
+
return (0, node_path_1.join)(agentDir, 'sessions');
|
|
175
|
+
}
|
|
176
|
+
async files(root) {
|
|
177
|
+
const dirs = await (0, promises_1.readdir)(root, { withFileTypes: true }).catch(() => []);
|
|
178
|
+
const files = await Promise.all(dirs
|
|
179
|
+
.filter(dir => dir.isDirectory())
|
|
180
|
+
.map(async (dir) => {
|
|
181
|
+
const names = await (0, promises_1.readdir)((0, node_path_1.join)(root, dir.name)).catch(() => []);
|
|
182
|
+
return names.filter(name => name.endsWith('.jsonl')).map(name => (0, node_path_1.join)(root, dir.name, name));
|
|
183
|
+
}));
|
|
184
|
+
return files.flat();
|
|
185
|
+
}
|
|
186
|
+
async summary(file) {
|
|
187
|
+
const stats = await (0, promises_1.stat)(file).catch(() => undefined);
|
|
188
|
+
if (!(stats === null || stats === void 0 ? void 0 : stats.isFile())) {
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
const version = `${stats.size}:${stats.mtimeMs}`;
|
|
192
|
+
const cached = this.cache.get(file);
|
|
193
|
+
if ((cached === null || cached === void 0 ? void 0 : cached.version) === version) {
|
|
194
|
+
return cached.summary;
|
|
195
|
+
}
|
|
196
|
+
const text = await (0, promises_1.readFile)(file, 'utf8').catch(() => undefined);
|
|
197
|
+
const summary = text === undefined ? undefined : SessionCatalogUtil.summarize(text, stats.mtimeMs);
|
|
198
|
+
this.cache.set(file, { version, summary });
|
|
199
|
+
return summary;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
exports.DefaultTaSessionCatalog = DefaultTaSessionCatalog;
|
|
203
|
+
__decorate([
|
|
204
|
+
(0, core_1.Value)(ai_coding_agent_1.CODING_AGENT_OPTIONS),
|
|
205
|
+
__metadata("design:type", Object)
|
|
206
|
+
], DefaultTaSessionCatalog.prototype, "codingAgentOptions", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
(0, core_1.Autowired)(remote_protocol_1.PiDirectories),
|
|
209
|
+
__metadata("design:type", Object)
|
|
210
|
+
], DefaultTaSessionCatalog.prototype, "directories", void 0);
|
|
211
|
+
exports.DefaultTaSessionCatalog = DefaultTaSessionCatalog = __decorate([
|
|
212
|
+
(0, core_1.Component)(host_protocol_1.TaSessionCatalog)
|
|
213
|
+
], DefaultTaSessionCatalog);
|
|
214
|
+
//# 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;
|
|
@@ -6,13 +6,18 @@ const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
|
6
6
|
var SessionInfoUtil;
|
|
7
7
|
(function (SessionInfoUtil) {
|
|
8
8
|
const LENGTH = 120;
|
|
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) {
|
|
11
14
|
for (const message of messages) {
|
|
12
15
|
if (message.role !== 'user') {
|
|
13
16
|
continue;
|
|
14
17
|
}
|
|
15
|
-
const
|
|
18
|
+
const said = ta_protocol_1.TaMessageContext.strip(text(message.content));
|
|
19
|
+
const skill = ta_protocol_1.TaSkillUse.parse(said);
|
|
20
|
+
const line = (skill ? ta_protocol_1.TaSkillUse.command(skill) : said)
|
|
16
21
|
.split('\n')
|
|
17
22
|
.map(part => part.trim())
|
|
18
23
|
.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 {};
|
|
@@ -207,7 +207,7 @@ let TaSettingsStoreImpl = class TaSettingsStoreImpl {
|
|
|
207
207
|
}
|
|
208
208
|
async get(cwd) {
|
|
209
209
|
const { userFile, projectFile, trusted } = await this.files(cwd);
|
|
210
|
-
const [user, project, { models, modelNames }] = await Promise.all([this.read(userFile), this.read(projectFile), this.models()]);
|
|
210
|
+
const [user, project, { models, modelNames, providerNames }] = await Promise.all([this.read(userFile), this.read(projectFile), this.models()]);
|
|
211
211
|
return {
|
|
212
212
|
user: TaSettingsUtil.read(user),
|
|
213
213
|
project: TaSettingsUtil.read(project),
|
|
@@ -217,6 +217,7 @@ let TaSettingsStoreImpl = class TaSettingsStoreImpl {
|
|
|
217
217
|
projectTrusted: trusted !== false,
|
|
218
218
|
models,
|
|
219
219
|
modelNames,
|
|
220
|
+
providerNames,
|
|
220
221
|
};
|
|
221
222
|
}
|
|
222
223
|
update(scope, changes, cwd) {
|
|
@@ -285,10 +286,17 @@ let TaSettingsStoreImpl = class TaSettingsStoreImpl {
|
|
|
285
286
|
modelNames[`${model.provider}/${model.id}`] = model.name;
|
|
286
287
|
}
|
|
287
288
|
}
|
|
288
|
-
|
|
289
|
+
const used = new Set(available.map(model => model.provider));
|
|
290
|
+
const providerNames = {};
|
|
291
|
+
for (const provider of runtime.getProviders()) {
|
|
292
|
+
if (used.has(provider.id) && provider.name && provider.name !== provider.id) {
|
|
293
|
+
providerNames[provider.id] = provider.name;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return { models: available.map(model => `${model.provider}/${model.id}`), modelNames, providerNames };
|
|
289
297
|
}
|
|
290
298
|
catch (_a) {
|
|
291
|
-
return { models: [], modelNames: {} };
|
|
299
|
+
return { models: [], modelNames: {}, providerNames: {} };
|
|
292
300
|
}
|
|
293
301
|
}
|
|
294
302
|
async reloadSessions(scope, cwd) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RpcConnectionManager } from '@celljs/rpc/lib/node';
|
|
2
|
+
import { type TaAccessInfo, TaAccessServer } from '@celljs/ta-protocol';
|
|
3
|
+
import { type TaAccess } from '../ta-access';
|
|
4
|
+
import { type TaSignIn } from './ta-sign-in';
|
|
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
|
+
}
|
|
20
|
+
//# sourceMappingURL=access-server-impl.d.ts.map
|