@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,6 +1,6 @@
|
|
|
1
1
|
import { ExecEnvironmentFactory } from '@celljs/ta-exec';
|
|
2
|
-
import { type RpcExtensionUIResponse, type TaAttachResult, type TaClientToolResult, type TaCommandResult, type TaForkFileResult, type TaNavigateResult, type TaOpenSessionOptions, type TaPromptInput, type TaPromptReceipt, TaServer, type TaServerInfo, type TaSessionInfo, type ThinkingLevel } from '@celljs/ta-protocol';
|
|
3
|
-
import { TaSessionRegistry } from './host-protocol';
|
|
2
|
+
import { type RpcExtensionUIResponse, type TaAttachOptions, type TaAttachResult, type TaClientToolResult, type TaCommandResult, type TaForkFileResult, type TaMessagePage, type TaNavigateResult, type TaOpenSessionOptions, type TaPromptInput, type TaPromptReceipt, type TaSavedSessionInfo, TaServer, type TaServerInfo, type TaSessionInfo, type ThinkingLevel } from '@celljs/ta-protocol';
|
|
3
|
+
import { TaSessionCatalog, TaSessionRegistry } from './host-protocol';
|
|
4
4
|
import { RemoteHosts } from './remote/remote-protocol';
|
|
5
5
|
import type { TaSession } from './ta-session';
|
|
6
6
|
import { TaWorkingDirectory } from './working-directory';
|
|
@@ -14,20 +14,25 @@ export declare class TaServerImpl implements TaServer {
|
|
|
14
14
|
protected readonly environments: ExecEnvironmentFactory;
|
|
15
15
|
protected readonly workingDirectory: TaWorkingDirectory;
|
|
16
16
|
protected readonly remoteHosts: RemoteHosts;
|
|
17
|
+
protected readonly catalog: TaSessionCatalog;
|
|
17
18
|
getServerInfo(): Promise<TaServerInfo>;
|
|
18
19
|
setWorkingDirectory(cwd: string): Promise<TaServerInfo>;
|
|
19
20
|
openSession(options: TaOpenSessionOptions): Promise<TaSessionInfo>;
|
|
20
21
|
closeSession(sessionId: string): Promise<void>;
|
|
21
22
|
listSessions(): Promise<TaSessionInfo[]>;
|
|
22
|
-
|
|
23
|
+
listSavedSessions(): Promise<TaSavedSessionInfo[]>;
|
|
24
|
+
attach(sessionId: string, afterSeq?: number, options?: TaAttachOptions): Promise<TaAttachResult>;
|
|
25
|
+
getEarlierMessages(sessionId: string, before: number | undefined, timestamp: number | undefined, budget: number): Promise<TaMessagePage>;
|
|
23
26
|
detach(sessionId: string): Promise<void>;
|
|
24
27
|
respondUi(sessionId: string, response: RpcExtensionUIResponse): Promise<boolean>;
|
|
28
|
+
claimClientTool(sessionId: string, id: string): Promise<boolean>;
|
|
25
29
|
respondClientTool(sessionId: string, result: TaClientToolResult): Promise<boolean>;
|
|
26
30
|
prompt(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
27
31
|
steer(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
28
32
|
followUp(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
29
33
|
abort(sessionId: string): Promise<void>;
|
|
30
34
|
clearQueue(sessionId: string): Promise<TaCommandResult<'clear_queue'>>;
|
|
35
|
+
removeQueued(sessionId: string, kind: 'steering' | 'followUp', index: number): Promise<boolean>;
|
|
31
36
|
newSession(sessionId: string, parentSession?: string): Promise<TaCommandResult<'new_session'>>;
|
|
32
37
|
getState(sessionId: string): Promise<TaCommandResult<'get_state'>>;
|
|
33
38
|
setModel(sessionId: string, provider: string, modelId: string): Promise<TaCommandResult<'set_model'>>;
|
|
@@ -59,8 +59,17 @@ let TaServerImpl = class TaServerImpl {
|
|
|
59
59
|
async listSessions() {
|
|
60
60
|
return this.sessions.list().map(session => session.info());
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
return this.
|
|
62
|
+
listSavedSessions() {
|
|
63
|
+
return this.guard(async () => {
|
|
64
|
+
const open = new Set(this.sessions.list().flatMap(session => { var _a; return (_a = session.pi.sessionFile) !== null && _a !== void 0 ? _a : []; }));
|
|
65
|
+
return this.catalog.list(open);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
attach(sessionId, afterSeq, options) {
|
|
69
|
+
return this.on(sessionId, session => session.attach(this.sessions.channel(node_1.RpcContext.requireConnection()), afterSeq !== null && afterSeq !== void 0 ? afterSeq : undefined, options !== null && options !== void 0 ? options : undefined));
|
|
70
|
+
}
|
|
71
|
+
getEarlierMessages(sessionId, before, timestamp, budget) {
|
|
72
|
+
return this.on(sessionId, session => session.earlierMessages(before !== null && before !== void 0 ? before : undefined, timestamp !== null && timestamp !== void 0 ? timestamp : undefined, budget));
|
|
64
73
|
}
|
|
65
74
|
detach(sessionId) {
|
|
66
75
|
return this.on(sessionId, session => session.detach(this.sessions.channel(node_1.RpcContext.requireConnection())));
|
|
@@ -68,6 +77,9 @@ let TaServerImpl = class TaServerImpl {
|
|
|
68
77
|
respondUi(sessionId, response) {
|
|
69
78
|
return this.on(sessionId, session => session.respondUi(response));
|
|
70
79
|
}
|
|
80
|
+
claimClientTool(sessionId, id) {
|
|
81
|
+
return this.on(sessionId, session => session.claimClientTool(this.sessions.channel(node_1.RpcContext.requireConnection()), id));
|
|
82
|
+
}
|
|
71
83
|
respondClientTool(sessionId, result) {
|
|
72
84
|
return this.on(sessionId, session => session.respondClientTool(result));
|
|
73
85
|
}
|
|
@@ -86,6 +98,9 @@ let TaServerImpl = class TaServerImpl {
|
|
|
86
98
|
clearQueue(sessionId) {
|
|
87
99
|
return this.on(sessionId, ({ pi }) => pi.clearQueue());
|
|
88
100
|
}
|
|
101
|
+
removeQueued(sessionId, kind, index) {
|
|
102
|
+
return this.on(sessionId, session => session.removeQueued(kind, index));
|
|
103
|
+
}
|
|
89
104
|
newSession(sessionId, parentSession) {
|
|
90
105
|
return this.on(sessionId, ({ runtime }) => runtime.newSession(parentSession ? { parentSession } : undefined));
|
|
91
106
|
}
|
|
@@ -261,11 +276,11 @@ let TaServerImpl = class TaServerImpl {
|
|
|
261
276
|
}));
|
|
262
277
|
}
|
|
263
278
|
reload(sessionId) {
|
|
264
|
-
return this.on(sessionId,
|
|
265
|
-
if (pi.isStreaming) {
|
|
279
|
+
return this.on(sessionId, session => {
|
|
280
|
+
if (session.pi.isStreaming) {
|
|
266
281
|
throw ta_errors_1.TaErrors.invalidArgument('The session is working.', 'Reload it once the run has ended, or abort the run first.');
|
|
267
282
|
}
|
|
268
|
-
return
|
|
283
|
+
return session.reload();
|
|
269
284
|
});
|
|
270
285
|
}
|
|
271
286
|
on(sessionId, command) {
|
|
@@ -292,6 +307,10 @@ __decorate([
|
|
|
292
307
|
(0, core_1.Autowired)(remote_protocol_1.RemoteHosts),
|
|
293
308
|
__metadata("design:type", Object)
|
|
294
309
|
], TaServerImpl.prototype, "remoteHosts", void 0);
|
|
310
|
+
__decorate([
|
|
311
|
+
(0, core_1.Autowired)(host_protocol_1.TaSessionCatalog),
|
|
312
|
+
__metadata("design:type", Object)
|
|
313
|
+
], TaServerImpl.prototype, "catalog", void 0);
|
|
295
314
|
exports.TaServerImpl = TaServerImpl = __decorate([
|
|
296
315
|
(0, rpc_1.Rpc)(ta_protocol_1.TaServer)
|
|
297
316
|
], TaServerImpl);
|
|
@@ -26,7 +26,7 @@ export declare class DefaultTaSessionFactory implements TaSessionFactory {
|
|
|
26
26
|
protected readonly packageHosts: PackageHosts;
|
|
27
27
|
protected readonly directories: PiDirectories;
|
|
28
28
|
protected readonly extensionProviders: ExtensionProviders;
|
|
29
|
-
create(
|
|
29
|
+
create(requested: TaOpenSessionOptions, requestClose: (session: TaSession) => void): Promise<TaSession>;
|
|
30
30
|
protected openSessionManager(sdk: PiSdk, options: TaOpenSessionOptions): SessionManager;
|
|
31
31
|
/**
|
|
32
32
|
* For another machine, its context files (AGENTS.md...) instead of those pi finds above the directory
|
|
@@ -21,6 +21,7 @@ const host_protocol_1 = require("./host-protocol");
|
|
|
21
21
|
const package_host_extension_1 = require("./package-host-extension");
|
|
22
22
|
const package_hosts_1 = require("./package-hosts");
|
|
23
23
|
const remote_protocol_1 = require("./remote/remote-protocol");
|
|
24
|
+
const session_catalog_1 = require("./session-catalog");
|
|
24
25
|
const session_files_1 = require("./session-files");
|
|
25
26
|
const ta_errors_1 = require("./ta-errors");
|
|
26
27
|
const ta_session_1 = require("./ta-session");
|
|
@@ -30,16 +31,24 @@ let DefaultTaSessionFactory = class DefaultTaSessionFactory {
|
|
|
30
31
|
this.extensions = [];
|
|
31
32
|
this.tools = [];
|
|
32
33
|
}
|
|
33
|
-
async create(
|
|
34
|
+
async create(requested, requestClose) {
|
|
34
35
|
var _a;
|
|
35
|
-
var _b;
|
|
36
|
-
const clientTools = new client_tool_broker_1.ClientToolBroker(
|
|
36
|
+
var _b, _c, _d;
|
|
37
|
+
const clientTools = new client_tool_broker_1.ClientToolBroker(requested.clientTools);
|
|
37
38
|
const sdk = await ai_coding_agent_1.PiSdkUtil.load();
|
|
38
39
|
const agentDir = (_b = (_a = this.codingAgentOptions) === null || _a === void 0 ? void 0 : _a.agentDir) !== null && _b !== void 0 ? _b : sdk.getAgentDir();
|
|
39
40
|
const modelRuntime = await this.modelRuntimeProvider.provide();
|
|
40
41
|
// `options.cwd` is a location; pi works in a directory of this machine (PiDirectories). A session
|
|
41
42
|
// file works where its header says, as pi's `--session` does, whatever `cwd` the caller gave.
|
|
42
|
-
const sessionManager = this.openSessionManager(sdk, { ...
|
|
43
|
+
const sessionManager = this.openSessionManager(sdk, { ...requested, cwd: this.directories.toPi(requested.cwd) });
|
|
44
|
+
// Opened again from its file without its role or group (a package relaying a message to it, the list of
|
|
45
|
+
// conversations): those it was opened with before.
|
|
46
|
+
const entries = requested.sessionFile ? sessionManager.getEntries() : [];
|
|
47
|
+
const options = {
|
|
48
|
+
...requested,
|
|
49
|
+
appendSystemPrompt: (_c = requested.appendSystemPrompt) !== null && _c !== void 0 ? _c : session_catalog_1.SessionCatalogUtil.roleOf(entries),
|
|
50
|
+
group: (_d = requested.group) !== null && _d !== void 0 ? _d : session_catalog_1.SessionCatalogUtil.groupOf(entries),
|
|
51
|
+
};
|
|
43
52
|
const piCwd = options.sessionFile ? sessionManager.getCwd() : this.directories.toPi(options.cwd);
|
|
44
53
|
const lock = new ta_harness_1.SessionLock();
|
|
45
54
|
const sessionFile = sessionManager.getSessionFile();
|
|
@@ -85,6 +94,7 @@ let DefaultTaSessionFactory = class DefaultTaSessionFactory {
|
|
|
85
94
|
options: this.options,
|
|
86
95
|
requestClose,
|
|
87
96
|
group: options.group,
|
|
97
|
+
role: options.appendSystemPrompt,
|
|
88
98
|
locate: cwd => this.directories.fromPi(cwd),
|
|
89
99
|
});
|
|
90
100
|
await session.start();
|
|
@@ -10,6 +10,8 @@ export declare class DefaultTaSessionRegistry implements TaSessionRegistry {
|
|
|
10
10
|
protected readonly channels: WeakMap<RpcConnection, ClientChannel>;
|
|
11
11
|
/** Sessions being created count against the limit too. */
|
|
12
12
|
protected opening: number;
|
|
13
|
+
/** The closes under way, by session file: out of the list already, their files locked until they end. */
|
|
14
|
+
protected readonly closing: Map<string, Promise<void>>;
|
|
13
15
|
open(options: TaOpenSessionOptions): Promise<TaSession>;
|
|
14
16
|
require(sessionId: string): TaSession;
|
|
15
17
|
list(): TaSession[];
|
|
@@ -20,8 +20,15 @@ let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
|
20
20
|
this.channels = new WeakMap();
|
|
21
21
|
/** Sessions being created count against the limit too. */
|
|
22
22
|
this.opening = 0;
|
|
23
|
+
/** The closes under way, by session file: out of the list already, their files locked until they end. */
|
|
24
|
+
this.closing = new Map();
|
|
23
25
|
}
|
|
24
26
|
async open(options) {
|
|
27
|
+
// A conversation closed a moment ago (idle, or by another client) opens once it is closed, not refused.
|
|
28
|
+
const closing = options.sessionFile && this.closing.get(options.sessionFile);
|
|
29
|
+
if (closing) {
|
|
30
|
+
await closing.catch(() => undefined);
|
|
31
|
+
}
|
|
25
32
|
if (this.sessions.size + this.opening >= this.options.maxSessions) {
|
|
26
33
|
throw ta_errors_1.TaErrors.tooManySessions(this.options.maxSessions);
|
|
27
34
|
}
|
|
@@ -47,9 +54,22 @@ let DefaultTaSessionRegistry = class DefaultTaSessionRegistry {
|
|
|
47
54
|
}
|
|
48
55
|
async close(sessionId) {
|
|
49
56
|
const session = this.sessions.get(sessionId);
|
|
50
|
-
if (session) {
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
if (!session) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
this.sessions.delete(sessionId);
|
|
61
|
+
const file = session.pi.sessionFile;
|
|
62
|
+
const closing = session.close();
|
|
63
|
+
if (file) {
|
|
64
|
+
this.closing.set(file, closing);
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
await closing;
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
if (file && this.closing.get(file) === closing) {
|
|
71
|
+
this.closing.delete(file);
|
|
72
|
+
}
|
|
53
73
|
}
|
|
54
74
|
}
|
|
55
75
|
async closeAll() {
|
package/lib/node/ta-session.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { SessionLock } from '@celljs/ta-harness';
|
|
2
|
-
import type { RpcExtensionUIResponse, TaAttachResult, TaClientToolResult, TaEvent, TaNavigateResult, TaPromptInput, TaPromptReceipt, TaSessionInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { RpcExtensionUIResponse, TaAttachOptions, TaAttachResult, TaClientToolResult, TaEvent, TaMessagePage, TaNavigateResult, TaPromptInput, TaPromptReceipt, TaSessionInfo } from '@celljs/ta-protocol';
|
|
3
3
|
import type { ClientChannel } from './client-channel';
|
|
4
4
|
import type { ClientToolBroker } from './client-tool-broker';
|
|
5
5
|
import { EventLog } from './event-log';
|
|
6
6
|
import type { TaHostOptions } from './host-protocol';
|
|
7
|
+
import { LiveRun } from './live-run';
|
|
7
8
|
import { ReceiptBook } from './receipt-book';
|
|
8
9
|
import { RemoteUiContext } from './remote-ui-context';
|
|
9
10
|
type AgentSessionRuntime = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).AgentSessionRuntime;
|
|
@@ -19,6 +20,8 @@ export interface TaSessionContext {
|
|
|
19
20
|
requestClose(session: TaSession): void;
|
|
20
21
|
/** TaOpenSessionOptions.group. */
|
|
21
22
|
group?: string;
|
|
23
|
+
/** TaOpenSessionOptions.appendSystemPrompt: kept in the session file, for when it opens again from it. */
|
|
24
|
+
role?: string;
|
|
22
25
|
/** The location of the directory pi works in (PiDirectories.fromPi); default: that directory. */
|
|
23
26
|
locate?(cwd: string): string;
|
|
24
27
|
}
|
|
@@ -35,6 +38,7 @@ export declare class TaSession {
|
|
|
35
38
|
protected readonly log: EventLog;
|
|
36
39
|
protected readonly receipts: ReceiptBook;
|
|
37
40
|
protected readonly channels: Set<ClientChannel>;
|
|
41
|
+
protected readonly live: LiveRun;
|
|
38
42
|
protected unsubscribe?: () => void;
|
|
39
43
|
protected idleTimer?: ReturnType<typeof setTimeout>;
|
|
40
44
|
protected started: boolean;
|
|
@@ -44,16 +48,34 @@ export declare class TaSession {
|
|
|
44
48
|
get cwd(): string;
|
|
45
49
|
start(): Promise<void>;
|
|
46
50
|
info(): TaSessionInfo;
|
|
47
|
-
attach(channel: ClientChannel, afterSeq?: number): TaAttachResult;
|
|
51
|
+
attach(channel: ClientChannel, afterSeq?: number, options?: TaAttachOptions): TaAttachResult;
|
|
52
|
+
earlierMessages(before: number | undefined, timestamp: number | undefined, budget: number): TaMessagePage;
|
|
48
53
|
detach(channel: ClientChannel): void;
|
|
49
54
|
respondUi(response: RpcExtensionUIResponse): boolean;
|
|
55
|
+
/** Only a client attached runs a call: one that left would hold it for nobody. */
|
|
56
|
+
claimClientTool(channel: ClientChannel, id: string): boolean;
|
|
50
57
|
respondClientTool(result: TaClientToolResult): boolean;
|
|
51
58
|
prompt(input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
52
59
|
steer(input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
53
60
|
followUp(input: TaPromptInput): Promise<TaPromptReceipt>;
|
|
61
|
+
/**
|
|
62
|
+
* Takes one waiting message out of the queue. pi only clears the whole of it, so this reaches into its
|
|
63
|
+
* two lists: the texts it shows and the messages its agent will take, which keep their images.
|
|
64
|
+
*/
|
|
65
|
+
removeQueued(kind: 'steering' | 'followUp', index: number): boolean;
|
|
54
66
|
/** pi's runtime says nothing of a move in the tree: the clients are told to read the conversation again. */
|
|
55
67
|
navigateTree(targetId: string, options?: Parameters<AgentSession['navigateTree']>[1]): Promise<TaNavigateResult>;
|
|
68
|
+
/** As pi's `/reload`; the clients are told to read the commands again, which pi says nothing of. */
|
|
69
|
+
reload(): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Ends the session, and unlocks its file whatever happens: a lock left behind is held by this live process,
|
|
72
|
+
* and refuses its conversation (CELL_TA_SESSION_LOCKED) until ta serve restarts. A run that does not stop
|
|
73
|
+
* (a tool that ignores the abort, a stream that hangs) or an extension slow to shut down is given
|
|
74
|
+
* `closeTimeoutMs`; then pi is cut off from its agent, so that nothing more goes into the file.
|
|
75
|
+
*/
|
|
56
76
|
close(): Promise<void>;
|
|
77
|
+
/** False when `work` takes longer than closeTimeoutMs. */
|
|
78
|
+
protected within(work: Promise<void>): Promise<boolean>;
|
|
57
79
|
protected accept(input: TaPromptInput, run: () => Promise<PromptDisposition>): Promise<TaPromptReceipt>;
|
|
58
80
|
/** Connects this object to the session the runtime has now: at the start and after each replacement. */
|
|
59
81
|
protected bind(): Promise<void>;
|
package/lib/node/ta-session.js
CHANGED
|
@@ -3,8 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TaSession = void 0;
|
|
4
4
|
const node_crypto_1 = require("node:crypto");
|
|
5
5
|
const event_log_1 = require("./event-log");
|
|
6
|
+
const live_run_1 = require("./live-run");
|
|
7
|
+
const message_page_1 = require("./message-page");
|
|
6
8
|
const receipt_book_1 = require("./receipt-book");
|
|
7
9
|
const remote_ui_context_1 = require("./remote-ui-context");
|
|
10
|
+
const session_catalog_1 = require("./session-catalog");
|
|
8
11
|
const session_info_util_1 = require("./session-info-util");
|
|
9
12
|
const ta_event_util_1 = require("./ta-event-util");
|
|
10
13
|
/**
|
|
@@ -18,6 +21,7 @@ class TaSession {
|
|
|
18
21
|
this.createdAt = Date.now();
|
|
19
22
|
this.receipts = new receipt_book_1.ReceiptBook();
|
|
20
23
|
this.channels = new Set();
|
|
24
|
+
this.live = new live_run_1.LiveRun();
|
|
21
25
|
this.started = false;
|
|
22
26
|
this.runtime = context.runtime;
|
|
23
27
|
this.log = new event_log_1.EventLog(this.id, context.options.eventBufferBytes);
|
|
@@ -57,13 +61,16 @@ class TaSession {
|
|
|
57
61
|
group: this.context.group,
|
|
58
62
|
};
|
|
59
63
|
}
|
|
60
|
-
attach(channel, afterSeq) {
|
|
64
|
+
attach(channel, afterSeq, options = {}) {
|
|
61
65
|
this.channels.add(channel);
|
|
62
66
|
this.watchIdle();
|
|
63
67
|
const { events, gap } = afterSeq === undefined ? { events: [], gap: false } : this.log.since(afterSeq);
|
|
64
68
|
return {
|
|
65
69
|
info: this.info(),
|
|
66
70
|
events,
|
|
71
|
+
conversation: afterSeq === undefined || gap
|
|
72
|
+
? message_page_1.MessagePage.recent(this.live.conversation(this.pi.messages, this.pi.isStreaming), options.recentBytes)
|
|
73
|
+
: undefined,
|
|
67
74
|
pendingUi: this.ui.pendingRequests,
|
|
68
75
|
shownUi: this.ui.shownRequests,
|
|
69
76
|
pendingClientTools: this.context.clientTools.pendingRequests,
|
|
@@ -71,14 +78,22 @@ class TaSession {
|
|
|
71
78
|
gap,
|
|
72
79
|
};
|
|
73
80
|
}
|
|
81
|
+
earlierMessages(before, timestamp, budget) {
|
|
82
|
+
return message_page_1.MessagePage.before(this.live.conversation(this.pi.messages, this.pi.isStreaming).messages, before, timestamp, budget);
|
|
83
|
+
}
|
|
74
84
|
detach(channel) {
|
|
75
85
|
if (this.channels.delete(channel)) {
|
|
86
|
+
this.context.clientTools.release(channel);
|
|
76
87
|
this.watchIdle();
|
|
77
88
|
}
|
|
78
89
|
}
|
|
79
90
|
respondUi(response) {
|
|
80
91
|
return this.ui.respond(response);
|
|
81
92
|
}
|
|
93
|
+
/** Only a client attached runs a call: one that left would hold it for nobody. */
|
|
94
|
+
claimClientTool(channel, id) {
|
|
95
|
+
return this.channels.has(channel) && this.context.clientTools.claim(id, channel);
|
|
96
|
+
}
|
|
82
97
|
respondClientTool(result) {
|
|
83
98
|
return this.context.clientTools.respond(result);
|
|
84
99
|
}
|
|
@@ -102,14 +117,48 @@ class TaSession {
|
|
|
102
117
|
followUp(input) {
|
|
103
118
|
return this.accept(input, () => this.pi.followUp(input.message, input.images, { source: 'rpc' }));
|
|
104
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Takes one waiting message out of the queue. pi only clears the whole of it, so this reaches into its
|
|
122
|
+
* two lists: the texts it shows and the messages its agent will take, which keep their images.
|
|
123
|
+
*/
|
|
124
|
+
removeQueued(kind, index) {
|
|
125
|
+
const pi = this.pi;
|
|
126
|
+
const texts = kind === 'steering' ? pi._steeringMessages : pi._followUpMessages;
|
|
127
|
+
const queue = kind === 'steering' ? pi.agent.steeringQueue : pi.agent.followUpQueue;
|
|
128
|
+
const text = texts === null || texts === void 0 ? void 0 : texts[index];
|
|
129
|
+
if (text === undefined || !Array.isArray(queue === null || queue === void 0 ? void 0 : queue.messages)) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
// The agent takes from the front and pi forgets a text when its message starts: match by the text.
|
|
133
|
+
const at = queue.messages.findIndex(message => { var _a, _b; return ((_b = (_a = message.content) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.text) === text; });
|
|
134
|
+
if (at === -1) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
queue.messages = queue.messages.filter((_, i) => i !== at);
|
|
138
|
+
texts.splice(index, 1);
|
|
139
|
+
pi._emitQueueUpdate();
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
105
142
|
/** pi's runtime says nothing of a move in the tree: the clients are told to read the conversation again. */
|
|
106
143
|
async navigateTree(targetId, options) {
|
|
107
144
|
const { cancelled, editorText } = await this.pi.navigateTree(targetId, options);
|
|
108
145
|
if (!cancelled) {
|
|
146
|
+
this.live.reset(this.pi.messages);
|
|
109
147
|
this.publish({ type: 'session_replaced', info: this.info() });
|
|
110
148
|
}
|
|
111
149
|
return { cancelled, editorText };
|
|
112
150
|
}
|
|
151
|
+
/** As pi's `/reload`; the clients are told to read the commands again, which pi says nothing of. */
|
|
152
|
+
async reload() {
|
|
153
|
+
await this.pi.reload();
|
|
154
|
+
this.publish({ type: 'session_reloaded' });
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Ends the session, and unlocks its file whatever happens: a lock left behind is held by this live process,
|
|
158
|
+
* and refuses its conversation (CELL_TA_SESSION_LOCKED) until ta serve restarts. A run that does not stop
|
|
159
|
+
* (a tool that ignores the abort, a stream that hangs) or an extension slow to shut down is given
|
|
160
|
+
* `closeTimeoutMs`; then pi is cut off from its agent, so that nothing more goes into the file.
|
|
161
|
+
*/
|
|
113
162
|
async close() {
|
|
114
163
|
var _a;
|
|
115
164
|
clearTimeout(this.idleTimer);
|
|
@@ -118,11 +167,31 @@ class TaSession {
|
|
|
118
167
|
this.publish({ type: 'session_closed' });
|
|
119
168
|
this.channels.clear();
|
|
120
169
|
(_a = this.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
121
|
-
|
|
122
|
-
|
|
170
|
+
try {
|
|
171
|
+
if (this.pi.isStreaming) {
|
|
172
|
+
// Its failure is no reason to keep the session: dispose below aborts the run as well.
|
|
173
|
+
await this.within(this.pi.abort().catch(() => undefined));
|
|
174
|
+
}
|
|
175
|
+
if (!(await this.within(this.runtime.dispose()))) {
|
|
176
|
+
this.pi.dispose();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
finally {
|
|
180
|
+
this.context.lock.releaseAll();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/** False when `work` takes longer than closeTimeoutMs. */
|
|
184
|
+
async within(work) {
|
|
185
|
+
let timer;
|
|
186
|
+
const late = new Promise(resolve => {
|
|
187
|
+
timer = setTimeout(() => resolve(false), this.context.options.closeTimeoutMs);
|
|
188
|
+
});
|
|
189
|
+
try {
|
|
190
|
+
return await Promise.race([work.then(() => true), late]);
|
|
191
|
+
}
|
|
192
|
+
finally {
|
|
193
|
+
clearTimeout(timer);
|
|
123
194
|
}
|
|
124
|
-
await this.runtime.dispose();
|
|
125
|
-
this.context.lock.releaseAll();
|
|
126
195
|
}
|
|
127
196
|
async accept(input, run) {
|
|
128
197
|
const duplicate = this.receipts.take(input);
|
|
@@ -143,6 +212,12 @@ class TaSession {
|
|
|
143
212
|
var _a;
|
|
144
213
|
(_a = this.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
145
214
|
const { pi, runtime } = this;
|
|
215
|
+
if (this.context.group) {
|
|
216
|
+
session_catalog_1.SessionCatalogUtil.markGroup(pi.sessionManager, this.context.group);
|
|
217
|
+
}
|
|
218
|
+
if (this.context.role) {
|
|
219
|
+
session_catalog_1.SessionCatalogUtil.markRole(pi.sessionManager, this.context.role);
|
|
220
|
+
}
|
|
146
221
|
await pi.bindExtensions({
|
|
147
222
|
uiContext: this.ui,
|
|
148
223
|
mode: 'rpc',
|
|
@@ -152,12 +227,14 @@ class TaSession {
|
|
|
152
227
|
fork: async (entryId, options) => ({ cancelled: (await runtime.fork(entryId, options)).cancelled }),
|
|
153
228
|
navigateTree: async (targetId, options) => ({ cancelled: (await this.navigateTree(targetId, options)).cancelled }),
|
|
154
229
|
switchSession: (sessionPath, options) => runtime.switchSession(sessionPath, options),
|
|
155
|
-
reload: () =>
|
|
230
|
+
reload: () => this.reload(),
|
|
156
231
|
},
|
|
157
232
|
shutdownHandler: () => this.context.requestClose(this),
|
|
158
233
|
onError: error => this.publish({ type: 'extension_error', extensionPath: error.extensionPath, event: error.event, error: error.error }),
|
|
159
234
|
});
|
|
235
|
+
this.live.reset(pi.messages);
|
|
160
236
|
this.unsubscribe = pi.subscribe(event => {
|
|
237
|
+
this.live.observe(event, pi.messages);
|
|
161
238
|
this.publish(ta_event_util_1.TaEventUtil.toWire(event));
|
|
162
239
|
if (event.type === 'agent_settled') {
|
|
163
240
|
this.watchIdle();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { TaTemporaryFrom, TaTemporaryInfo } from '@celljs/ta-protocol';
|
|
2
|
+
/** A package opened without installing: where it is, and what Ta knows of it. */
|
|
3
|
+
export interface TemporaryRecord extends TaTemporaryInfo {
|
|
4
|
+
root: string;
|
|
5
|
+
}
|
|
6
|
+
interface TemporaryFile {
|
|
7
|
+
/** After how many days unused a package not kept goes; 0 never. */
|
|
8
|
+
retentionDays?: number;
|
|
9
|
+
packages?: TemporaryRecord[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The temporary packages of an agent directory (`ta-launcher.md`): `temporary.json` lists them, and
|
|
13
|
+
* `temporary/` holds the directories Ta owns (made by an agent), which are temporary without a record
|
|
14
|
+
* too. Read and written whole: it is small, and only `ta serve` writes it.
|
|
15
|
+
*/
|
|
16
|
+
export declare class TemporaryStore {
|
|
17
|
+
protected readonly agentDir: string;
|
|
18
|
+
protected readonly now: () => number;
|
|
19
|
+
static readonly FILE = "temporary.json";
|
|
20
|
+
static readonly DIRECTORY = "temporary";
|
|
21
|
+
static readonly DEFAULT_RETENTION_DAYS = 30;
|
|
22
|
+
static readonly DAY_MS: number;
|
|
23
|
+
constructor(agentDir: string, now?: () => number);
|
|
24
|
+
/** Where an agent makes a temporary package: `<agent dir>/temporary`. */
|
|
25
|
+
get directory(): string;
|
|
26
|
+
/** Whether Ta owns the directory, so that removing the package deletes it. */
|
|
27
|
+
owns(root: string): boolean;
|
|
28
|
+
/** Those whose directory is there: the records, and the directories of `temporary/` without one (made by an agent). */
|
|
29
|
+
list(): TemporaryRecord[];
|
|
30
|
+
find(match: (record: TemporaryRecord) => boolean): TemporaryRecord | undefined;
|
|
31
|
+
/** Notes a package opened from `source`, or that it was opened again. */
|
|
32
|
+
add(root: string, source: string, from: TaTemporaryFrom): TemporaryRecord;
|
|
33
|
+
update(root: string, change: {
|
|
34
|
+
used?: boolean;
|
|
35
|
+
kept?: boolean;
|
|
36
|
+
}): void;
|
|
37
|
+
forget(root: string): void;
|
|
38
|
+
get retentionDays(): number;
|
|
39
|
+
set retentionDays(days: number);
|
|
40
|
+
/** Those not kept and unused (since they were opened, when never used) for longer than the retention. */
|
|
41
|
+
expired(): TemporaryRecord[];
|
|
42
|
+
protected save(packages: TemporaryRecord[]): void;
|
|
43
|
+
protected read(): TemporaryFile;
|
|
44
|
+
protected write(file: TemporaryFile): void;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=temporary-packages.d.ts.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TemporaryStore = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const web_extension_util_1 = require("./web-extension-util");
|
|
7
|
+
/**
|
|
8
|
+
* The temporary packages of an agent directory (`ta-launcher.md`): `temporary.json` lists them, and
|
|
9
|
+
* `temporary/` holds the directories Ta owns (made by an agent), which are temporary without a record
|
|
10
|
+
* too. Read and written whole: it is small, and only `ta serve` writes it.
|
|
11
|
+
*/
|
|
12
|
+
class TemporaryStore {
|
|
13
|
+
constructor(agentDir, now = Date.now) {
|
|
14
|
+
this.agentDir = agentDir;
|
|
15
|
+
this.now = now;
|
|
16
|
+
}
|
|
17
|
+
/** Where an agent makes a temporary package: `<agent dir>/temporary`. */
|
|
18
|
+
get directory() {
|
|
19
|
+
return (0, node_path_1.join)(this.agentDir, TemporaryStore.DIRECTORY);
|
|
20
|
+
}
|
|
21
|
+
/** Whether Ta owns the directory, so that removing the package deletes it. */
|
|
22
|
+
owns(root) {
|
|
23
|
+
const path = (0, node_path_1.relative)(this.directory, (0, node_path_1.resolve)(root));
|
|
24
|
+
return path !== '' && !path.startsWith('..') && !path.includes(node_path_1.sep) && !path.startsWith(node_path_1.sep);
|
|
25
|
+
}
|
|
26
|
+
/** Those whose directory is there: the records, and the directories of `temporary/` without one (made by an agent). */
|
|
27
|
+
list() {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const file = this.read();
|
|
30
|
+
const records = ((_a = file.packages) !== null && _a !== void 0 ? _a : []).filter(record => (0, node_fs_1.existsSync)((0, node_path_1.join)(record.root, 'package.json')));
|
|
31
|
+
const known = new Set(records.map(record => (0, node_path_1.resolve)(record.root)));
|
|
32
|
+
const now = this.now();
|
|
33
|
+
for (const root of web_extension_util_1.WebExtensionUtil.packageDirectories(this.directory)) {
|
|
34
|
+
if (!known.has((0, node_path_1.resolve)(root))) {
|
|
35
|
+
records.push({ root, source: root, from: 'agent', openedAt: now, usedAt: 0, kept: false });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (records.length !== ((_b = file.packages) !== null && _b !== void 0 ? _b : []).length || records.some((record, index) => { var _a; return record !== ((_a = file.packages) === null || _a === void 0 ? void 0 : _a[index]); })) {
|
|
39
|
+
this.write({ ...file, packages: records });
|
|
40
|
+
}
|
|
41
|
+
return records;
|
|
42
|
+
}
|
|
43
|
+
find(match) {
|
|
44
|
+
return this.list().find(match);
|
|
45
|
+
}
|
|
46
|
+
/** Notes a package opened from `source`, or that it was opened again. */
|
|
47
|
+
add(root, source, from) {
|
|
48
|
+
var _a;
|
|
49
|
+
const now = this.now();
|
|
50
|
+
const records = this.list();
|
|
51
|
+
const found = records.find(record => (0, node_path_1.resolve)(record.root) === (0, node_path_1.resolve)(root));
|
|
52
|
+
// A directory of temporary/ seen before its record (list() notes it as an agent's) takes where it came from.
|
|
53
|
+
const known = found && !(found.from === 'agent' && found.source === found.root && from !== 'agent');
|
|
54
|
+
const record = known ? { ...found, usedAt: now } : { root, source, from, openedAt: now, usedAt: now, kept: (_a = found === null || found === void 0 ? void 0 : found.kept) !== null && _a !== void 0 ? _a : false };
|
|
55
|
+
this.save(found ? records.map(other => (other === found ? record : other)) : [...records, record]);
|
|
56
|
+
return record;
|
|
57
|
+
}
|
|
58
|
+
update(root, change) {
|
|
59
|
+
const records = this.list();
|
|
60
|
+
this.save(records.map(record => { var _a; return (0, node_path_1.resolve)(record.root) === (0, node_path_1.resolve)(root)
|
|
61
|
+
? { ...record, usedAt: change.used ? this.now() : record.usedAt, kept: (_a = change.kept) !== null && _a !== void 0 ? _a : record.kept }
|
|
62
|
+
: record; }));
|
|
63
|
+
}
|
|
64
|
+
forget(root) {
|
|
65
|
+
this.save(this.list().filter(record => (0, node_path_1.resolve)(record.root) !== (0, node_path_1.resolve)(root)));
|
|
66
|
+
}
|
|
67
|
+
get retentionDays() {
|
|
68
|
+
const days = this.read().retentionDays;
|
|
69
|
+
return typeof days === 'number' && Number.isInteger(days) && days >= 0 ? days : TemporaryStore.DEFAULT_RETENTION_DAYS;
|
|
70
|
+
}
|
|
71
|
+
set retentionDays(days) {
|
|
72
|
+
this.write({ ...this.read(), retentionDays: days });
|
|
73
|
+
}
|
|
74
|
+
/** Those not kept and unused (since they were opened, when never used) for longer than the retention. */
|
|
75
|
+
expired() {
|
|
76
|
+
const days = this.retentionDays;
|
|
77
|
+
if (days === 0) {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
const before = this.now() - days * TemporaryStore.DAY_MS;
|
|
81
|
+
return this.list().filter(record => !record.kept && Math.max(record.usedAt, record.openedAt) < before);
|
|
82
|
+
}
|
|
83
|
+
save(packages) {
|
|
84
|
+
this.write({ ...this.read(), packages });
|
|
85
|
+
}
|
|
86
|
+
read() {
|
|
87
|
+
var _a;
|
|
88
|
+
try {
|
|
89
|
+
const value = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(this.agentDir, TemporaryStore.FILE), 'utf8'));
|
|
90
|
+
return value && typeof value === 'object' ? { ...value, packages: ((_a = value.packages) !== null && _a !== void 0 ? _a : []).filter(isRecord) } : {};
|
|
91
|
+
}
|
|
92
|
+
catch (_b) {
|
|
93
|
+
return {};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
write(file) {
|
|
97
|
+
(0, node_fs_1.mkdirSync)(this.agentDir, { recursive: true });
|
|
98
|
+
const path = (0, node_path_1.join)(this.agentDir, TemporaryStore.FILE);
|
|
99
|
+
(0, node_fs_1.writeFileSync)(`${path}.tmp`, `${JSON.stringify(file, undefined, 2)}\n`);
|
|
100
|
+
(0, node_fs_1.renameSync)(`${path}.tmp`, path);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.TemporaryStore = TemporaryStore;
|
|
104
|
+
TemporaryStore.FILE = 'temporary.json';
|
|
105
|
+
TemporaryStore.DIRECTORY = 'temporary';
|
|
106
|
+
TemporaryStore.DEFAULT_RETENTION_DAYS = 30;
|
|
107
|
+
TemporaryStore.DAY_MS = 24 * 60 * 60 * 1000;
|
|
108
|
+
function isRecord(value) {
|
|
109
|
+
const record = value;
|
|
110
|
+
return (!!record &&
|
|
111
|
+
typeof record.root === 'string' &&
|
|
112
|
+
typeof record.source === 'string' &&
|
|
113
|
+
(record.from === 'market' || record.from === 'link' || record.from === 'agent') &&
|
|
114
|
+
typeof record.openedAt === 'number' &&
|
|
115
|
+
typeof record.usedAt === 'number' &&
|
|
116
|
+
typeof record.kept === 'boolean');
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=temporary-packages.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Application, ApplicationLifecycle } from '@celljs/core';
|
|
2
|
+
import { ExecEnvironmentFactory } from '@celljs/ta-exec';
|
|
3
|
+
import { WebExtensionCatalog } from './host-protocol';
|
|
4
|
+
/** Clears the temporary packages not kept and unused for longer than their retention (TemporaryStore). */
|
|
5
|
+
export declare class TemporaryPurge implements ApplicationLifecycle<Application> {
|
|
6
|
+
protected readonly catalog: WebExtensionCatalog;
|
|
7
|
+
protected readonly environments: ExecEnvironmentFactory;
|
|
8
|
+
protected first?: ReturnType<typeof setTimeout>;
|
|
9
|
+
protected timer?: ReturnType<typeof setInterval>;
|
|
10
|
+
onStart(): void;
|
|
11
|
+
onStop(): void;
|
|
12
|
+
purge(): Promise<number>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=temporary-purge.d.ts.map
|