@celljs/ta-host 4.7.0 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +34 -4
- package/README.md +33 -3
- package/cell.schema.json +4 -0
- package/cell.yml +2 -0
- package/esm/node/auth-server-impl.d.ts +2 -0
- package/esm/node/auth-server-impl.js +7 -0
- package/esm/node/client-tool-broker.d.ts +11 -3
- package/esm/node/client-tool-broker.js +23 -3
- package/esm/node/extension-providers.d.ts +22 -0
- package/esm/node/extension-providers.js +52 -0
- package/esm/node/host-protocol.d.ts +22 -1
- package/esm/node/host-protocol.js +1 -0
- package/esm/node/index.d.ts +6 -0
- package/esm/node/index.js +6 -0
- package/esm/node/live-run.d.ts +22 -0
- package/esm/node/live-run.js +58 -0
- package/esm/node/message-page.d.ts +17 -0
- package/esm/node/message-page.js +71 -0
- package/esm/node/package-host-extension.d.ts +4 -2
- package/esm/node/package-host-extension.js +4 -3
- package/esm/node/package-hosts.d.ts +2 -2
- package/esm/node/package-hosts.js +2 -0
- package/esm/node/package-server-impl.d.ts +9 -1
- package/esm/node/package-server-impl.js +16 -1
- package/esm/node/relay-bridge.d.ts +9 -1
- package/esm/node/relay-bridge.js +44 -4
- package/esm/node/remote-ui-context.d.ts +6 -1
- package/esm/node/remote-ui-context.js +31 -3
- package/esm/node/session-catalog.d.ts +69 -0
- package/esm/node/session-catalog.js +211 -0
- package/esm/node/session-files.d.ts +18 -0
- package/esm/node/session-files.js +32 -0
- package/esm/node/session-info-util.d.ts +4 -1
- package/esm/node/session-info-util.js +8 -3
- package/esm/node/settings-server-impl.d.ts +1 -0
- package/esm/node/settings-server-impl.js +8 -0
- package/esm/node/settings-store.d.ts +3 -1
- package/esm/node/settings-store.js +25 -3
- package/esm/node/sign-in/access-server-impl.d.ts +19 -0
- package/esm/node/sign-in/access-server-impl.js +82 -0
- package/esm/node/sign-in/access-store.d.ts +65 -0
- package/esm/node/sign-in/access-store.js +175 -0
- package/esm/node/sign-in/index.d.ts +7 -0
- package/esm/node/sign-in/index.js +8 -0
- package/esm/node/sign-in/sign-in-flow.d.ts +58 -0
- package/esm/node/sign-in/sign-in-flow.js +104 -0
- package/esm/node/sign-in/sign-in-middleware.d.ts +10 -0
- package/esm/node/sign-in/sign-in-middleware.js +48 -0
- package/esm/node/sign-in/sign-in-pages.d.ts +31 -0
- package/esm/node/sign-in/sign-in-pages.js +118 -0
- package/esm/node/sign-in/sign-in-provider.d.ts +135 -0
- package/esm/node/sign-in/sign-in-provider.js +225 -0
- package/esm/node/sign-in/ta-sign-in.d.ts +10 -0
- package/esm/node/sign-in/ta-sign-in.js +32 -0
- package/esm/node/ta-access.d.ts +7 -0
- package/esm/node/ta-access.js +30 -1
- package/esm/node/ta-server-impl.d.ts +8 -3
- package/esm/node/ta-server-impl.js +25 -6
- package/esm/node/ta-session-factory.d.ts +4 -1
- package/esm/node/ta-session-factory.js +30 -7
- package/esm/node/ta-session-registry.d.ts +2 -0
- package/esm/node/ta-session-registry.js +23 -3
- package/esm/node/ta-session.d.ts +24 -2
- package/esm/node/ta-session.js +84 -6
- package/esm/node/temporary-packages.d.ts +46 -0
- package/esm/node/temporary-packages.js +114 -0
- package/esm/node/temporary-purge.d.ts +13 -0
- package/esm/node/temporary-purge.js +51 -0
- package/esm/node/terminal-service.d.ts +18 -2
- package/esm/node/terminal-service.js +45 -9
- package/esm/node/terminal-util.d.ts +14 -0
- package/esm/node/terminal-util.js +30 -1
- package/esm/node/web-extension-catalog.d.ts +28 -1
- package/esm/node/web-extension-catalog.js +173 -5
- package/esm/node/web-extension-util.d.ts +5 -1
- package/esm/node/web-extension-util.js +36 -5
- package/esm/node/workspace-protocol.d.ts +2 -0
- package/esm/node/workspace-server-impl.d.ts +2 -1
- package/esm/node/workspace-server-impl.js +13 -1
- package/esm/node/workspace-service.d.ts +1 -0
- package/esm/node/workspace-service.js +13 -1
- package/lib/node/auth-server-impl.d.ts +2 -0
- package/lib/node/auth-server-impl.js +7 -0
- package/lib/node/client-tool-broker.d.ts +11 -3
- package/lib/node/client-tool-broker.js +23 -3
- package/lib/node/extension-providers.d.ts +23 -0
- package/lib/node/extension-providers.js +55 -0
- package/lib/node/host-protocol.d.ts +22 -1
- package/lib/node/host-protocol.js +2 -1
- package/lib/node/index.d.ts +6 -0
- package/lib/node/index.js +6 -0
- package/lib/node/live-run.d.ts +23 -0
- package/lib/node/live-run.js +62 -0
- package/lib/node/message-page.d.ts +18 -0
- package/lib/node/message-page.js +74 -0
- package/lib/node/package-host-extension.d.ts +4 -2
- package/lib/node/package-host-extension.js +4 -3
- package/lib/node/package-hosts.d.ts +2 -2
- package/lib/node/package-hosts.js +2 -0
- package/lib/node/package-server-impl.d.ts +9 -1
- package/lib/node/package-server-impl.js +15 -0
- package/lib/node/relay-bridge.d.ts +9 -1
- package/lib/node/relay-bridge.js +43 -3
- package/lib/node/remote-ui-context.d.ts +6 -1
- package/lib/node/remote-ui-context.js +31 -3
- package/lib/node/session-catalog.d.ts +70 -0
- package/lib/node/session-catalog.js +214 -0
- package/lib/node/session-files.d.ts +19 -0
- package/lib/node/session-files.js +36 -0
- package/lib/node/session-info-util.d.ts +4 -1
- package/lib/node/session-info-util.js +7 -2
- package/lib/node/settings-server-impl.d.ts +1 -0
- package/lib/node/settings-server-impl.js +8 -0
- package/lib/node/settings-store.d.ts +3 -1
- package/lib/node/settings-store.js +25 -3
- package/lib/node/sign-in/access-server-impl.d.ts +20 -0
- package/lib/node/sign-in/access-server-impl.js +85 -0
- package/lib/node/sign-in/access-store.d.ts +66 -0
- package/lib/node/sign-in/access-store.js +179 -0
- package/lib/node/sign-in/index.d.ts +8 -0
- package/lib/node/sign-in/index.js +24 -0
- package/lib/node/sign-in/sign-in-flow.d.ts +59 -0
- package/lib/node/sign-in/sign-in-flow.js +108 -0
- package/lib/node/sign-in/sign-in-middleware.d.ts +11 -0
- package/lib/node/sign-in/sign-in-middleware.js +51 -0
- package/lib/node/sign-in/sign-in-pages.d.ts +32 -0
- package/lib/node/sign-in/sign-in-pages.js +121 -0
- package/lib/node/sign-in/sign-in-provider.d.ts +136 -0
- package/lib/node/sign-in/sign-in-provider.js +232 -0
- package/lib/node/sign-in/ta-sign-in.d.ts +11 -0
- package/lib/node/sign-in/ta-sign-in.js +35 -0
- package/lib/node/ta-access.d.ts +7 -0
- package/lib/node/ta-access.js +30 -1
- package/lib/node/ta-server-impl.d.ts +8 -3
- package/lib/node/ta-server-impl.js +24 -5
- package/lib/node/ta-session-factory.d.ts +4 -1
- package/lib/node/ta-session-factory.js +30 -7
- package/lib/node/ta-session-registry.d.ts +2 -0
- package/lib/node/ta-session-registry.js +23 -3
- package/lib/node/ta-session.d.ts +24 -2
- package/lib/node/ta-session.js +84 -6
- package/lib/node/temporary-packages.d.ts +47 -0
- package/lib/node/temporary-packages.js +118 -0
- package/lib/node/temporary-purge.d.ts +14 -0
- package/lib/node/temporary-purge.js +54 -0
- package/lib/node/terminal-service.d.ts +18 -2
- package/lib/node/terminal-service.js +44 -8
- package/lib/node/terminal-util.d.ts +14 -0
- package/lib/node/terminal-util.js +30 -1
- package/lib/node/web-extension-catalog.d.ts +28 -1
- package/lib/node/web-extension-catalog.js +172 -4
- package/lib/node/web-extension-util.d.ts +5 -1
- package/lib/node/web-extension-util.js +36 -5
- package/lib/node/workspace-protocol.d.ts +2 -0
- package/lib/node/workspace-server-impl.d.ts +2 -1
- package/lib/node/workspace-server-impl.js +12 -0
- package/lib/node/workspace-service.d.ts +1 -0
- package/lib/node/workspace-service.js +13 -1
- package/package.json +17 -12
- package/esm/node/auth-server-impl.js.map +0 -1
- package/esm/node/client-channel.js.map +0 -1
- package/esm/node/client-tool-broker.js.map +0 -1
- package/esm/node/event-log.js.map +0 -1
- package/esm/node/exec-environment-factory.js.map +0 -1
- package/esm/node/extension-data-notifier.js.map +0 -1
- package/esm/node/extension-data.js.map +0 -1
- package/esm/node/host-protocol.js.map +0 -1
- package/esm/node/index.js.map +0 -1
- package/esm/node/module.js.map +0 -1
- package/esm/node/package-host-extension.js.map +0 -1
- package/esm/node/package-hosts.js.map +0 -1
- package/esm/node/package-server-impl.js.map +0 -1
- package/esm/node/package-switch.js.map +0 -1
- package/esm/node/receipt-book.js.map +0 -1
- package/esm/node/relay-bridge.js.map +0 -1
- package/esm/node/remote/index.js.map +0 -1
- package/esm/node/remote/pi-directories.js.map +0 -1
- package/esm/node/remote/port-forwards.js.map +0 -1
- package/esm/node/remote/remote-hosts.js.map +0 -1
- package/esm/node/remote/remote-protocol.js.map +0 -1
- package/esm/node/remote/remote-server-impl.js.map +0 -1
- package/esm/node/remote-ui-context.js.map +0 -1
- package/esm/node/session-info-util.js.map +0 -1
- package/esm/node/session-storage/file-session-storage.js.map +0 -1
- package/esm/node/session-storage/index.js.map +0 -1
- package/esm/node/session-storage/session-storage-protocol.js.map +0 -1
- package/esm/node/session-storage/stored-session.js.map +0 -1
- package/esm/node/settings-server-impl.js.map +0 -1
- package/esm/node/settings-store.js.map +0 -1
- package/esm/node/ta-access.js.map +0 -1
- package/esm/node/ta-errors.js.map +0 -1
- package/esm/node/ta-event-util.js.map +0 -1
- package/esm/node/ta-server-impl.js.map +0 -1
- package/esm/node/ta-session-factory.js.map +0 -1
- package/esm/node/ta-session-registry.js.map +0 -1
- package/esm/node/ta-session.js.map +0 -1
- package/esm/node/terminal-protocol.js.map +0 -1
- package/esm/node/terminal-service.js.map +0 -1
- package/esm/node/terminal-util.js.map +0 -1
- package/esm/node/web-extension-catalog.js.map +0 -1
- package/esm/node/web-extension-util.js.map +0 -1
- package/esm/node/working-directory.js.map +0 -1
- package/esm/node/workspace-files.js.map +0 -1
- package/esm/node/workspace-protocol.js.map +0 -1
- package/esm/node/workspace-server-impl.js.map +0 -1
- package/esm/node/workspace-service.js.map +0 -1
- package/esm/node/workspace-util.js.map +0 -1
- package/lib/node/auth-server-impl.d.ts.map +0 -1
- package/lib/node/auth-server-impl.js.map +0 -1
- package/lib/node/auth-server-impl.spec.d.ts +0 -2
- package/lib/node/auth-server-impl.spec.d.ts.map +0 -1
- package/lib/node/auth-server-impl.spec.js +0 -47
- package/lib/node/auth-server-impl.spec.js.map +0 -1
- package/lib/node/client-channel.d.ts.map +0 -1
- package/lib/node/client-channel.js.map +0 -1
- package/lib/node/client-channel.spec.d.ts +0 -2
- package/lib/node/client-channel.spec.d.ts.map +0 -1
- package/lib/node/client-channel.spec.js +0 -106
- package/lib/node/client-channel.spec.js.map +0 -1
- package/lib/node/client-tool-broker.d.ts.map +0 -1
- package/lib/node/client-tool-broker.js.map +0 -1
- package/lib/node/client-tool-broker.spec.d.ts +0 -2
- package/lib/node/client-tool-broker.spec.d.ts.map +0 -1
- package/lib/node/client-tool-broker.spec.js +0 -49
- package/lib/node/client-tool-broker.spec.js.map +0 -1
- package/lib/node/event-log.d.ts.map +0 -1
- package/lib/node/event-log.js.map +0 -1
- package/lib/node/event-log.spec.d.ts +0 -2
- package/lib/node/event-log.spec.d.ts.map +0 -1
- package/lib/node/event-log.spec.js +0 -48
- package/lib/node/event-log.spec.js.map +0 -1
- package/lib/node/exec-environment-factory.d.ts.map +0 -1
- package/lib/node/exec-environment-factory.js.map +0 -1
- package/lib/node/extension-data-notifier.d.ts.map +0 -1
- package/lib/node/extension-data-notifier.js.map +0 -1
- package/lib/node/extension-data-notifier.spec.d.ts +0 -2
- package/lib/node/extension-data-notifier.spec.d.ts.map +0 -1
- package/lib/node/extension-data-notifier.spec.js +0 -35
- package/lib/node/extension-data-notifier.spec.js.map +0 -1
- package/lib/node/extension-data.d.ts.map +0 -1
- package/lib/node/extension-data.js.map +0 -1
- package/lib/node/extension-data.spec.d.ts +0 -2
- package/lib/node/extension-data.spec.d.ts.map +0 -1
- package/lib/node/extension-data.spec.js +0 -99
- package/lib/node/extension-data.spec.js.map +0 -1
- package/lib/node/host-protocol.d.ts.map +0 -1
- package/lib/node/host-protocol.js.map +0 -1
- package/lib/node/index.d.ts.map +0 -1
- package/lib/node/index.js.map +0 -1
- package/lib/node/module.d.ts.map +0 -1
- package/lib/node/module.js.map +0 -1
- package/lib/node/package-host-extension.d.ts.map +0 -1
- package/lib/node/package-host-extension.js.map +0 -1
- package/lib/node/package-hosts.d.ts.map +0 -1
- package/lib/node/package-hosts.js.map +0 -1
- package/lib/node/package-hosts.spec.d.ts +0 -2
- package/lib/node/package-hosts.spec.d.ts.map +0 -1
- package/lib/node/package-hosts.spec.js +0 -53
- package/lib/node/package-hosts.spec.js.map +0 -1
- package/lib/node/package-server-impl.d.ts.map +0 -1
- package/lib/node/package-server-impl.js.map +0 -1
- package/lib/node/package-switch.d.ts.map +0 -1
- package/lib/node/package-switch.js.map +0 -1
- package/lib/node/receipt-book.d.ts.map +0 -1
- package/lib/node/receipt-book.js.map +0 -1
- package/lib/node/receipt-book.spec.d.ts +0 -2
- package/lib/node/receipt-book.spec.d.ts.map +0 -1
- package/lib/node/receipt-book.spec.js +0 -39
- package/lib/node/receipt-book.spec.js.map +0 -1
- package/lib/node/relay-bridge.d.ts.map +0 -1
- package/lib/node/relay-bridge.js.map +0 -1
- package/lib/node/remote/index.d.ts.map +0 -1
- package/lib/node/remote/index.js.map +0 -1
- package/lib/node/remote/pi-directories.d.ts.map +0 -1
- package/lib/node/remote/pi-directories.js.map +0 -1
- package/lib/node/remote/port-forwards.d.ts.map +0 -1
- package/lib/node/remote/port-forwards.js.map +0 -1
- package/lib/node/remote/remote-hosts.d.ts.map +0 -1
- package/lib/node/remote/remote-hosts.js.map +0 -1
- package/lib/node/remote/remote-protocol.d.ts.map +0 -1
- package/lib/node/remote/remote-protocol.js.map +0 -1
- package/lib/node/remote/remote-server-impl.d.ts.map +0 -1
- package/lib/node/remote/remote-server-impl.js.map +0 -1
- package/lib/node/remote/remote.spec.d.ts +0 -2
- package/lib/node/remote/remote.spec.d.ts.map +0 -1
- package/lib/node/remote/remote.spec.js +0 -130
- package/lib/node/remote/remote.spec.js.map +0 -1
- package/lib/node/remote-ui-context.d.ts.map +0 -1
- package/lib/node/remote-ui-context.js.map +0 -1
- package/lib/node/remote-ui-context.spec.d.ts +0 -2
- package/lib/node/remote-ui-context.spec.d.ts.map +0 -1
- package/lib/node/remote-ui-context.spec.js +0 -62
- package/lib/node/remote-ui-context.spec.js.map +0 -1
- package/lib/node/session-info-util.d.ts.map +0 -1
- package/lib/node/session-info-util.js.map +0 -1
- package/lib/node/session-info-util.spec.d.ts +0 -2
- package/lib/node/session-info-util.spec.d.ts.map +0 -1
- package/lib/node/session-info-util.spec.js +0 -22
- package/lib/node/session-info-util.spec.js.map +0 -1
- package/lib/node/session-storage/file-session-storage.d.ts.map +0 -1
- package/lib/node/session-storage/file-session-storage.js.map +0 -1
- package/lib/node/session-storage/file-session-storage.spec.d.ts +0 -2
- package/lib/node/session-storage/file-session-storage.spec.d.ts.map +0 -1
- package/lib/node/session-storage/file-session-storage.spec.js +0 -70
- package/lib/node/session-storage/file-session-storage.spec.js.map +0 -1
- package/lib/node/session-storage/index.d.ts.map +0 -1
- package/lib/node/session-storage/index.js.map +0 -1
- package/lib/node/session-storage/session-storage-protocol.d.ts.map +0 -1
- package/lib/node/session-storage/session-storage-protocol.js.map +0 -1
- package/lib/node/session-storage/stored-session.d.ts.map +0 -1
- package/lib/node/session-storage/stored-session.js.map +0 -1
- package/lib/node/session-storage/stored-session.spec.d.ts +0 -2
- package/lib/node/session-storage/stored-session.spec.d.ts.map +0 -1
- package/lib/node/session-storage/stored-session.spec.js +0 -73
- package/lib/node/session-storage/stored-session.spec.js.map +0 -1
- package/lib/node/settings-server-impl.d.ts.map +0 -1
- package/lib/node/settings-server-impl.js.map +0 -1
- package/lib/node/settings-store.d.ts.map +0 -1
- package/lib/node/settings-store.js.map +0 -1
- package/lib/node/settings-store.spec.d.ts +0 -2
- package/lib/node/settings-store.spec.d.ts.map +0 -1
- package/lib/node/settings-store.spec.js +0 -146
- package/lib/node/settings-store.spec.js.map +0 -1
- package/lib/node/ta-access.d.ts.map +0 -1
- package/lib/node/ta-access.js.map +0 -1
- package/lib/node/ta-access.spec.d.ts +0 -2
- package/lib/node/ta-access.spec.d.ts.map +0 -1
- package/lib/node/ta-access.spec.js +0 -33
- package/lib/node/ta-access.spec.js.map +0 -1
- package/lib/node/ta-errors.d.ts.map +0 -1
- package/lib/node/ta-errors.js.map +0 -1
- package/lib/node/ta-errors.spec.d.ts +0 -2
- package/lib/node/ta-errors.spec.d.ts.map +0 -1
- package/lib/node/ta-errors.spec.js +0 -25
- package/lib/node/ta-errors.spec.js.map +0 -1
- package/lib/node/ta-event-util.d.ts.map +0 -1
- package/lib/node/ta-event-util.js.map +0 -1
- package/lib/node/ta-event-util.spec.d.ts +0 -2
- package/lib/node/ta-event-util.spec.d.ts.map +0 -1
- package/lib/node/ta-event-util.spec.js +0 -28
- package/lib/node/ta-event-util.spec.js.map +0 -1
- package/lib/node/ta-server-impl.d.ts.map +0 -1
- package/lib/node/ta-server-impl.js.map +0 -1
- package/lib/node/ta-session-factory.d.ts.map +0 -1
- package/lib/node/ta-session-factory.js.map +0 -1
- package/lib/node/ta-session-registry.d.ts.map +0 -1
- package/lib/node/ta-session-registry.js.map +0 -1
- package/lib/node/ta-session.d.ts.map +0 -1
- package/lib/node/ta-session.js.map +0 -1
- package/lib/node/terminal-protocol.d.ts.map +0 -1
- package/lib/node/terminal-protocol.js.map +0 -1
- package/lib/node/terminal-service.d.ts.map +0 -1
- package/lib/node/terminal-service.js.map +0 -1
- package/lib/node/terminal-service.spec.d.ts +0 -2
- package/lib/node/terminal-service.spec.d.ts.map +0 -1
- package/lib/node/terminal-service.spec.js +0 -79
- package/lib/node/terminal-service.spec.js.map +0 -1
- package/lib/node/terminal-util.d.ts.map +0 -1
- package/lib/node/terminal-util.js.map +0 -1
- package/lib/node/terminal-util.spec.d.ts +0 -2
- package/lib/node/terminal-util.spec.d.ts.map +0 -1
- package/lib/node/terminal-util.spec.js +0 -71
- package/lib/node/terminal-util.spec.js.map +0 -1
- package/lib/node/web-extension-catalog.d.ts.map +0 -1
- package/lib/node/web-extension-catalog.js.map +0 -1
- package/lib/node/web-extension-catalog.spec.d.ts +0 -2
- package/lib/node/web-extension-catalog.spec.d.ts.map +0 -1
- package/lib/node/web-extension-catalog.spec.js +0 -157
- package/lib/node/web-extension-catalog.spec.js.map +0 -1
- package/lib/node/web-extension-util.d.ts.map +0 -1
- package/lib/node/web-extension-util.js.map +0 -1
- package/lib/node/working-directory.d.ts.map +0 -1
- package/lib/node/working-directory.js.map +0 -1
- package/lib/node/workspace-files.d.ts.map +0 -1
- package/lib/node/workspace-files.js.map +0 -1
- package/lib/node/workspace-files.spec.d.ts +0 -2
- package/lib/node/workspace-files.spec.d.ts.map +0 -1
- package/lib/node/workspace-files.spec.js +0 -133
- package/lib/node/workspace-files.spec.js.map +0 -1
- package/lib/node/workspace-protocol.d.ts.map +0 -1
- package/lib/node/workspace-protocol.js.map +0 -1
- package/lib/node/workspace-server-impl.d.ts.map +0 -1
- package/lib/node/workspace-server-impl.js.map +0 -1
- package/lib/node/workspace-service.d.ts.map +0 -1
- package/lib/node/workspace-service.js.map +0 -1
- package/lib/node/workspace-service.spec.d.ts +0 -2
- package/lib/node/workspace-service.spec.d.ts.map +0 -1
- package/lib/node/workspace-service.spec.js +0 -104
- package/lib/node/workspace-service.spec.js.map +0 -1
- package/lib/node/workspace-util.d.ts.map +0 -1
- package/lib/node/workspace-util.js.map +0 -1
- package/lib/node/workspace-util.spec.d.ts +0 -2
- package/lib/node/workspace-util.spec.d.ts.map +0 -1
- package/lib/node/workspace-util.spec.js +0 -44
- package/lib/node/workspace-util.spec.js.map +0 -1
- package/src/node/auth-server-impl.spec.ts +0 -49
- package/src/node/auth-server-impl.ts +0 -252
- package/src/node/client-channel.spec.ts +0 -117
- package/src/node/client-channel.ts +0 -94
- package/src/node/client-tool-broker.spec.ts +0 -53
- package/src/node/client-tool-broker.ts +0 -106
- package/src/node/event-log.spec.ts +0 -52
- package/src/node/event-log.ts +0 -59
- package/src/node/exec-environment-factory.ts +0 -66
- package/src/node/extension-data-notifier.spec.ts +0 -34
- package/src/node/extension-data-notifier.ts +0 -124
- package/src/node/extension-data.spec.ts +0 -105
- package/src/node/extension-data.ts +0 -180
- package/src/node/host-protocol.ts +0 -62
- package/src/node/index.ts +0 -37
- package/src/node/module.ts +0 -4
- package/src/node/package-host-extension.ts +0 -20
- package/src/node/package-hosts.spec.ts +0 -54
- package/src/node/package-hosts.ts +0 -202
- package/src/node/package-server-impl.ts +0 -87
- package/src/node/package-switch.ts +0 -80
- package/src/node/receipt-book.spec.ts +0 -41
- package/src/node/receipt-book.ts +0 -40
- package/src/node/relay-bridge.ts +0 -94
- package/src/node/remote/index.ts +0 -5
- package/src/node/remote/pi-directories.ts +0 -49
- package/src/node/remote/port-forwards.ts +0 -148
- package/src/node/remote/remote-hosts.ts +0 -170
- package/src/node/remote/remote-protocol.ts +0 -57
- package/src/node/remote/remote-server-impl.ts +0 -60
- package/src/node/remote/remote.spec.ts +0 -142
- package/src/node/remote-ui-context.spec.ts +0 -68
- package/src/node/remote-ui-context.ts +0 -168
- package/src/node/session-info-util.spec.ts +0 -23
- package/src/node/session-info-util.ts +0 -55
- package/src/node/session-storage/file-session-storage.spec.ts +0 -72
- package/src/node/session-storage/file-session-storage.ts +0 -145
- package/src/node/session-storage/index.ts +0 -3
- package/src/node/session-storage/session-storage-protocol.ts +0 -81
- package/src/node/session-storage/stored-session.spec.ts +0 -80
- package/src/node/session-storage/stored-session.ts +0 -149
- package/src/node/settings-server-impl.ts +0 -33
- package/src/node/settings-store.spec.ts +0 -156
- package/src/node/settings-store.ts +0 -314
- package/src/node/ta-access.spec.ts +0 -36
- package/src/node/ta-access.ts +0 -156
- package/src/node/ta-errors.spec.ts +0 -25
- package/src/node/ta-errors.ts +0 -75
- package/src/node/ta-event-util.spec.ts +0 -29
- package/src/node/ta-event-util.ts +0 -23
- package/src/node/ta-server-impl.ts +0 -341
- package/src/node/ta-session-factory.ts +0 -203
- package/src/node/ta-session-registry.ts +0 -75
- package/src/node/ta-session.ts +0 -240
- package/src/node/terminal-protocol.ts +0 -18
- package/src/node/terminal-service.spec.ts +0 -84
- package/src/node/terminal-service.ts +0 -259
- package/src/node/terminal-util.spec.ts +0 -78
- package/src/node/terminal-util.ts +0 -166
- package/src/node/web-extension-catalog.spec.ts +0 -172
- package/src/node/web-extension-catalog.ts +0 -177
- package/src/node/web-extension-util.ts +0 -144
- package/src/node/working-directory.ts +0 -71
- package/src/node/workspace-files.spec.ts +0 -145
- package/src/node/workspace-files.ts +0 -256
- package/src/node/workspace-protocol.ts +0 -22
- package/src/node/workspace-server-impl.ts +0 -90
- package/src/node/workspace-service.spec.ts +0 -113
- package/src/node/workspace-service.ts +0 -223
- package/src/node/workspace-util.spec.ts +0 -47
- package/src/node/workspace-util.ts +0 -103
package/README.en.md
CHANGED
|
@@ -8,22 +8,27 @@ The server-side component of `ta serve`. It is functionally equivalent to Codex'
|
|
|
8
8
|
| --- | --- |
|
|
9
9
|
| `TaServerImpl` | `@Rpc(TaServer)`, handles sessions and pi RPC commands. Each command is forwarded to `AgentSession` / `AgentSessionRuntime` following pi's `rpc-mode` approach (pi only exports `runRpcMode` bound to stdio, so each command is mapped here; verify against pi's `rpc-mode` when upgrading pi). |
|
|
10
10
|
| `TaWorkspaceServerImpl` / `TaTerminalServerImpl` / `TaSettingsServerImpl` / `TaPackageServerImpl` / `TaAuthServerImpl` / `RelayBridge` | Other services on the same WebSocket; each forwards to the component below. `TaAccess` rejects HTTP-style calls (`POST /api/<service>` returns 404). |
|
|
11
|
+
| `TaSettingsServerImpl.setLanguage` | Ta's pages tell the server their language (`zh-CN`, `en-US`), which becomes `TA_LANGUAGE` of the process; the pi packages of the server (ta-agents, ta-cron, ta-bots, ta-computer-use, `/bug`) speak it. The client that set it last wins |
|
|
12
|
+
| `ExtensionProvidersImpl` | Model providers that pi packages register with `pi.registerProvider` (the agents of `@celljs/ta-agents`, for example) are in the shared model runtime only once extensions loaded. Before any session, `TaAuthServerImpl.listProviders`, the model list of the settings and `openSession` with a `model` first load the user's extensions once, in the home directory (project resources not trusted), so that no sign-in is asked for and a new conversation can pick their models. About 7 MB more than without, measured, and only on the first call |
|
|
11
13
|
| `TaAuthServerImpl` | `@Rpc(TaAuthServer)`: runs pi's `/login` flow on the server (OAuth login page, device code, or API key). It sends only the page to open and fields for the user to fill to the initiating connection (`TaClient.onAuthEvent`); the user's answer is sent back via `answer`. The `logout` method deletes stored credentials. Credentials are written to the server-side pi's `auth.json` and shared across all sessions; they are never sent back to the client. |
|
|
12
14
|
| `RelayBridge` | `@Rpc(TaRelayServer)`: reads `relay.json` from the agent directory. When paired devices exist, it connects to Relay and opens a connection to `/api/ws` on this machine for each device (see [@celljs/ta-relay](../ta-relay/README.md)). The `pair` and `unpair` commands work the same as `ta pair`. If no Relay is provided, it uses `https://relay.cellbang.com`. |
|
|
13
15
|
| `TaWorkingDirectory` | The working directory set by `setWorkingDirectory`, recorded in `ta.json` in the agent directory (`workingDirectory`), persists across restarts. Open sessions are unaffected. |
|
|
14
16
|
| `TaSessionRegistry` | Manages open sessions. Rejects requests when exceeding `maxSessions`, closes sessions that are idle (no clients, not running, no pending dialogs) for longer than `idleTimeoutMs`. Session files are retained. |
|
|
15
|
-
| `TaSessionFactory` | Assembles sessions the same way the pi command does: project trust, settings, extensions, themes. All sessions share one model runtime. Can be replaced by `rebind`. |
|
|
17
|
+
| `TaSessionFactory` | Assembles sessions the same way the pi command does: project trust, settings, extensions, themes. All sessions share one model runtime. Opened again from its file alone, a session keeps the role (`ta-role`) and group (`ta-group`) written in it. Can be replaced by `rebind`. |
|
|
16
18
|
| `TaSession` | One open session: event log, acknowledgments, connected clients. After `newSession`/`fork`/`switchSession` the id remains unchanged and broadcasts `session_replaced`. The `navigateTree` command (pi's `/tree`) also broadcasts when switching branches within the same session. |
|
|
17
19
|
| `RemoteUiContext` | The pi extension's `ctx.ui`: dialogs are broadcast to all clients. The first response takes effect; if timed out, the default value from the extension is used. |
|
|
18
20
|
| `EventLog` / `ClientChannel` | Each session retains recent events in bytes for reconnection recovery. Each client merges into a frame every 30ms and sends the next frame after the client acknowledges. Clients that fall too far behind are disconnected to force reconnection. |
|
|
19
|
-
| `TaAccess` | Validates tokens (WebSocket handshake and HTTP), listens on localhost and validates the `Host` header to prevent DNS rebinding, writes `serve.json`. The token and port are saved to `serve-state.json` and reused on the next startup. |
|
|
21
|
+
| `TaAccess` | Validates tokens (WebSocket handshake and HTTP), listens on localhost and validates the `Host` header to prevent DNS rebinding, writes `serve.json`. The token and port are saved to `serve-state.json` and reused on the next startup. It also takes the tokens of browsers signed in with an account (`TaSignIn`). Listening on an address of the network (not this machine), it prints at start the link that signs in with the token (`TA_PUBLIC_URL`, else `http://localhost:<port>`; without the token when it comes from `TA_SERVE_TOKEN`) and the ways to sign in with an account |
|
|
22
|
+
| `TaSignIn` / `SignInMiddleware` / `TaAccessServerImpl` | Signing in with an account, see "Signing In with Accounts" below. The flow (`SignInFlow`) and the pages (`SignInPages`) need no Cell: [`ta gateway`](../ta-gateway/README.en.md) uses the same |
|
|
20
23
|
| `WebExtensionCatalog`(`WebExtensionCatalogImpl`) | `listWebExtensions` / `readWebExtension` / `removeWebExtension`: finds web extensions in packages using pi's package loading method (`packages` setting and `extensions/` directory, project packages only when trusted). Reads only declared, in-package files that are under 2 MB. |
|
|
24
|
+
| Temporary packages (`openTemporaryPackage` / `updateTemporaryPackage` / `installTemporaryPackage` / `get`, `setTemporaryRetention`) | Packages opened without installing (`TemporaryStore`, see docs/design/ta-launcher.md): a source of npm or Git is fetched with `install` of pi's package manager but not added to the `packages` setting, a path is only noted, and what an agent makes is in `temporary/<name>/` of the agent directory; `temporary.json` notes each (its source, when it was opened and used, whether it is kept in Mine). They are listed with `origin: 'temporary'` and `activation: 'open'`, and only their web part runs. `installTemporaryPackage` adds the source to the `packages` setting (moves what an agent made to `extensions/`); `removePackage` / `removeWebExtension` delete Ta's own directory, remove what pi fetched, and only forget a path of the user. `TemporaryPurge` clears, 30 seconds after the start and every 12 hours, those unused for longer than the retention (30 days by default, 0 for never) and not kept in Mine. |
|
|
25
|
+
| Sharing (`TaRelayServer.sharePackage` / `unsharePackage`) | A link of an extension of this computer: packed first to check it is at most 8 MB, noted in relay.json for 7 days; `RelayBridge` packs it when the other side asks and sends it end to end through the relay ([@celljs/ta-relay](../ta-relay/README.en.md)); `openTemporaryPackage` fetches such a link and unpacks it in `temporary/` |
|
|
21
26
|
| Packages (`listPackages` / `installPackage` / `removePackage`) | Lists all packages loaded by pi (with or without web extensions) and includes `resources` (`extensions`, `web`, `skills`, `prompts`, `themes`). The `installPackage` command works the same as `ta install` (`project` is `-l`, only for trusted projects). The `removePackage` command works the same as `removeWebExtension` and removes by package id. |
|
|
22
27
|
| Package host service (`callPackageHost`) | Calls methods on objects returned by the built-in package `pi.host` (arguments and return values are JSON), for use by its web extensions. Methods that cannot be called are `dispose`, `constructor`, methods starting with `_`, or methods built into objects. |
|
|
23
28
|
| Toggles (`setPackageEnabled`) | Ta's built-in pi packages ([`TaPackages`](../ta-harness/README.md)) are toggled by name and listed with `origin: 'builtin'`. They can only be toggled, not removed. The toggle state is saved to `ta.json` in the agent directory (`disabledPackages`). Other packages are toggled by the id from `listPackages` and work the same as `ta config`, writing each resource individually to pi's settings (`PackageSwitch`: paths in `extensions/` are written as `+path` / `-path` to the `extensions` list, items in `packages` are written to that item's filter). The terminal `ta` recognizes this as well. Packages with no pi loading and only web extensions are recorded in `ta.json`'s `disabledWeb`. `enabled`: set to true when pi loads any resource from it (for web-only packages check `disabledWeb`). Disabled packages' web extensions are not loaded. Takes effect after session `reload`. |
|
|
24
29
|
| `TaSettingsStore`(`TaSettingsStoreImpl`) | `getSettings` / `updateSettings`: ta's settings (keys listed in `TA_SETTINGS`) are pi's `settings.json`, user-level in the agent directory, project-level in `<cwd>/.ta/`. Changes only the provided keys (set to `null` to delete; an empty object deletes the file thereafter). Preserves other content and uses atomic writes via temporary file. Only one write happens at a time. During writes, it acquires the same file lock as pi (`<file>.lock` directory, considered stale after 10 seconds), so the terminal `ta` changing settings simultaneously does not overwrite (pi rereads within the lock and only writes back the keys it changed). Does not overwrite unreadable files. At project level, pi requests trust for projects that have not been trusted (with extensions, skills, etc.). Writing without requiring trust is treated as trusting (otherwise pi will not read). After writing, it notifies related sessions' `SettingsManager` to reload (model and reasoning level take effect for new sessions). |
|
|
25
30
|
| `ExtensionDataStore`(`ExtensionDataStoreImpl`) | `getExtensionData` / `setExtensionData`: data stored on the server for packages (web extensions' `pi.storage`). One file per package at `<agentDir>/extension-data/<package name>.json` (mode 0600), with serial writes to the same file. Set values to `null` to delete keys. 4 MB limit per package. When `cwd` is provided, it is data for that directory at `extension-data/directories/<dir name>-<hash>/<package name>.json`. The hash includes the execution environment, so same-name directories do not interfere when running remotely. Notifications include `cwd`. |
|
|
26
|
-
| `ClientToolBroker` | Client tools (`clientTools`): each is a pi tool that broadcasts `client_tool_request` on call and
|
|
31
|
+
| `ClientToolBroker` | Client tools (`clientTools`): each is a pi tool that broadcasts `client_tool_request` on call. The first client to take it with `claimClientTool` runs it and answers with `respondClientTool`, so a call runs once, not once per page; if that client leaves the session before answering, the request goes out again to the others. Ends with failure if the run is aborted or the session closes. |
|
|
27
32
|
| `DefaultExecEnvironmentFactory` | Tools execute based on directory: `ssh://<host>/<path>` runs on that host (`RemoteHosts`); local paths run locally; when `ta.exec.url` is configured, tools run on `ta exec-server` (see @celljs/ta-exec). The environment's `cwd` is the path in that environment; all paths resolve by it. A custom `ExecEnvironmentFactory` can also be used via `rebind`. |
|
|
28
33
|
| `RemoteHosts` / `TaRemoteServerImpl` | `@Rpc(TaRemoteServer)`: hosts for `ssh://` directories, each with an `SshHost` (uses system `ssh` and its config; auto-installs Node.js and the server on first use), connects on first call and reconnects after disconnection. Provides `listHosts` (Hosts from `~/.ssh/config` without wildcards and known to ssh, plus from `ta.json`'s `remoteHosts`), `addHost` / `removeHost` (remember or forget a host), `resolveLocation` (expand location without path to home directory), `watch` / `answer` (when ssh needs password, confirmation, or new host, asks all pages; first response wins), `disconnect`. Pushes connection steps and changes to `TaClient.onRemoteEvent`. |
|
|
29
34
|
| `PortForwards` | `forwardPort`: opens ports from the host of a remote directory on localhost's `127.0.0.1` (trying to reuse the same port number), with each connection forwarded through the execution environment's `connect`. Local directories are returned as-is. |
|
|
@@ -38,6 +43,7 @@ ta:
|
|
|
38
43
|
host:
|
|
39
44
|
maxSessions: 32
|
|
40
45
|
idleTimeoutMs: 600000
|
|
46
|
+
closeTimeoutMs: 5000 # how long closing a session waits for its run to stop and extensions to shut down; the file is released anyway
|
|
41
47
|
eventBufferBytes: 524288 # per-session event amount for recovery
|
|
42
48
|
clientBacklogBytes: 8388608 # per-client backlog allowed
|
|
43
49
|
exec:
|
|
@@ -51,6 +57,30 @@ ta:
|
|
|
51
57
|
|
|
52
58
|
When [@celljs/ta-web](../ta-web/README.md) is installed, the `/` path on the same port serves the Web client: GET requests for page files do not require a token (they contain no data), and all calls under `/api` require a token. When listening on localhost, both validate the `Host` header.
|
|
53
59
|
|
|
60
|
+
## Signing In with Accounts
|
|
61
|
+
|
|
62
|
+
When `ta serve` runs in the cloud or on a server, besides the token, people can sign in with GitHub, Google, WeChat or an OpenID Connect provider of the operator. The ways to sign in (offered when both the id and the secret are set) and who may sign in are configured in the environment of `ta serve`:
|
|
63
|
+
|
|
64
|
+
| Variable | Purpose |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `TA_PUBLIC_URL` | The address at which browsers reach `ta serve`, such as `https://ta.example.com`. The callback of each provider is `<TA_PUBLIC_URL>/sign-in/<github\|google\|wechat\|oidc>/callback`, to register with the provider. Without it, it is worked out from the `Host` of the request and the `X-Forwarded-Proto` / `X-Forwarded-Host` of a reverse proxy |
|
|
67
|
+
| `TA_GITHUB_CLIENT_ID` / `TA_GITHUB_CLIENT_SECRET` | A GitHub OAuth App; the account is `github:<login>`. `TA_GITHUB_URL` points to a GitHub Enterprise Server |
|
|
68
|
+
| `TA_GOOGLE_CLIENT_ID` / `TA_GOOGLE_CLIENT_SECRET` | A Google OAuth client (web application); the account is `google:<email>`, verified addresses only |
|
|
69
|
+
| `TA_WECHAT_APP_ID` / `TA_WECHAT_APP_SECRET` | A website app of the WeChat Open Platform (sign-in by scanning); the account is `wechat:<unionid>`, or the openid when the app has no unionid |
|
|
70
|
+
| `TA_OIDC_ISSUER` / `TA_OIDC_CLIENT_ID` / `TA_OIDC_CLIENT_SECRET` / `TA_OIDC_NAME` | Any OpenID Connect provider (Microsoft Entra, Okta, Keycloak, Authing...), its endpoints found at `<issuer>/.well-known/openid-configuration`; the account is `oidc:<verified email>`, else `oidc:<sub>`; `TA_OIDC_NAME` is the name on the button |
|
|
71
|
+
| `TA_ALLOWED_USERS` | The accounts that may sign in, separated by commas or spaces, such as `github:octocat,google:*@example.com` (`*@<domain>` lets in a whole domain). They can also be added under Settings, Access in the web client |
|
|
72
|
+
|
|
73
|
+
The flow:
|
|
74
|
+
|
|
75
|
+
- The sign-in page gets the ways to sign in from `GET /sign-in` (`TaSignInWays`), a button each. `GET /sign-in/<way>` goes to the provider (the state in an HttpOnly cookie sent to `/sign-in` only, with PKCE for GitHub, Google and OIDC), which comes back with a code to `/sign-in/<way>/callback`; a state works once, for 10 minutes, from the browser that started it.
|
|
76
|
+
- An account let in gets a token of its own for that browser, sent back to `/#token=<token>` (as with `ta serve --web`, after the `#`). An account not let in is sent back to `/#sign-in=denied&account=<account>` and becomes a request, which anyone signed in lets in with a tap under Settings, Access (`TaAccessServer.allow`).
|
|
77
|
+
- The owner, in with the token, can "Sign in with your account" under Settings, Access (`bindUrl`: a link that works once, for 5 minutes): the account signed in with is let in, and signs in by itself from then on, on any device.
|
|
78
|
+
- Only the hash of a browser's token is kept, with the accounts let in and the requests, in `access.json` of the agent directory (mode 0600). When an account is removed (or no longer in `TA_ALLOWED_USERS`), or a browser is signed out, its token stops working and its WebSocket is closed at once.
|
|
79
|
+
|
|
80
|
+
These are pages the browser goes to, not calls, so they are not on the WebSocket; the rest (`getAccess` / `bindUrl` / `allow` / `dismiss` / `disallow` / `signOut`) is `TaAccessServer` on the same WebSocket. Whoever is in, with the token or an account let in, may do the same.
|
|
81
|
+
|
|
82
|
+
Known limitation: the website apps of WeChat only sign in by scanning, so WeChat in a phone's browser shows a code to scan with another device; on a phone, use GitHub or Google, or pairing (`ta pair`).
|
|
83
|
+
|
|
54
84
|
## Session Storage (Cloud)
|
|
55
85
|
|
|
56
86
|
`ta serve` locally uses pi's session files, relying on session locks to ensure only one process writes at a time. In the cloud there may be multiple `ta serve` replicas, any of which may take over a session. In this case, the session is stored in `TaSessionStorage`:
|
|
@@ -65,4 +95,4 @@ Which cloud storage to use has not yet been decided, so `TaSessionFactory` has n
|
|
|
65
95
|
|
|
66
96
|
- When there are no available models (model service not signed in, no model selected), pi's error will mention the `/login` command and its documentation path in the terminal. This is changed here to `CELL_TA_NOT_SIGNED_IN` with a prompt to sign in first using `TaAuthServer`.
|
|
67
97
|
- The deduplication table, event log, and pending dialogs are all in memory. After service restart, dialogs become invalid (extensions receive the default value), and clients should call `getMessages` first to verify before deciding to resend.
|
|
68
|
-
- When executing remotely, pi's resources (`AGENTS.md`, project `.ta/` settings and skills) still read from the same paths on the host machine. Project resources on the execution machine rely on a custom ResourceLoader (not yet implemented).
|
|
98
|
+
- When executing remotely, pi's resources (`AGENTS.md`, project `.ta/` settings and skills) still read from the same paths on the host machine. Project resources on the execution machine rely on a custom ResourceLoader (not yet implemented).
|
package/README.md
CHANGED
|
@@ -8,22 +8,27 @@
|
|
|
8
8
|
| --- | --- |
|
|
9
9
|
| `TaServerImpl` | `@Rpc(TaServer)`,会话与 pi 的 RPC 命令,各命令照 pi `rpc-mode` 的做法转给 `AgentSession` / `AgentSessionRuntime`(pi 只导出绑在 stdio 上的 `runRpcMode`,所以这里逐条对应;升级 pi 时对照它的 `rpc-mode` 检查) |
|
|
10
10
|
| `TaWorkspaceServerImpl` / `TaTerminalServerImpl` / `TaSettingsServerImpl` / `TaPackageServerImpl` / `TaAuthServerImpl` / `RelayBridge` | 同一条 WebSocket 上的其他服务,各自转给下面的组件;`TaAccess` 拒绝 HTTP 形式的调用(`POST /api/<服务>` 返回 404) |
|
|
11
|
+
| `TaSettingsServerImpl.setLanguage` | Ta 页面告诉服务端它的语言(`zh-CN`、`en-US`),写进进程的 `TA_LANGUAGE`,服务端的 pi 包(ta-agents、ta-cron、ta-bots、ta-computer-use、`/bug`)按它说话;最后设置的客户端为准 |
|
|
12
|
+
| `ExtensionProvidersImpl` | pi 包用 `pi.registerProvider` 注册的模型服务(比如 `@celljs/ta-agents` 的外部 Agent),要等扩展加载后才在共享的模型运行时里。还没有会话时,`TaAuthServerImpl.listProviders`、设置的模型列表、带 `model` 的 `openSession` 会先在家目录下加载一次用户的扩展(不信任项目资源),这样不会因为没登录模型服务而要求登录,新对话也能选到它们的模型。实测比不加载多约 7 MB,只在第一次调用时发生 |
|
|
11
13
|
| `TaAuthServerImpl` | `@Rpc(TaAuthServer)`:在服务端跑 pi 的 `/login` 流程(OAuth 的登录页或设备码,或 API Key),把要打开的页面、要用户填的内容只发给发起登录的连接(`TaClient.onAuthEvent`),用户的回答用 `answer` 送回;`logout` 删掉存下的凭据。凭据写进服务端 pi 的 `auth.json`,所有会话共用,不会发回客户端 |
|
|
12
14
|
| `RelayBridge` | `@Rpc(TaRelayServer)`:读 agent 目录的 `relay.json`,有配对的设备时连上 Relay,并替每台设备开一条到本机 `/api/ws` 的连接(见 [@celljs/ta-relay](../ta-relay/README.md));`pair` / `unpair` 与 `ta pair` 相同,没给 Relay 时用 `https://relay.cellbang.com` |
|
|
13
15
|
| `TaWorkingDirectory` | `setWorkingDirectory` 设的工作目录,记在 agent 目录的 `ta.json`(`workingDirectory`),跨重启保留;已经打开的会话不受影响 |
|
|
14
16
|
| `TaSessionRegistry` | 打开的会话;超过 `maxSessions` 拒绝,空闲(无客户端、无运行、无待答对话框)超过 `idleTimeoutMs` 关闭,会话文件保留 |
|
|
15
|
-
| `TaSessionFactory` | 像 pi
|
|
17
|
+
| `TaSessionFactory` | 像 pi 命令那样装配会话:项目信任、设置、扩展、主题;所有会话共用一个模型运行时。只按会话文件重新打开时,沿用文件里记下的角色(`ta-role`)和分组(`ta-group`)。可 `rebind` 替换 |
|
|
16
18
|
| `TaSession` | 一个打开的会话:事件日志、回执、已连接的客户端;`newSession`/`fork`/`switchSession` 后 id 不变,并发 `session_replaced`;`navigateTree`(pi 的 `/tree`)在同一会话里换分支后也发 |
|
|
17
19
|
| `RemoteUiContext` | pi 扩展的 `ctx.ui`:对话框广播给所有客户端,第一个回答生效,超时按扩展给的默认值 |
|
|
18
20
|
| `EventLog` / `ClientChannel` | 每个会话按字节保留最近的事件供重连补发;每个客户端每 30ms 合并成一帧,等客户端应答后再发下一帧,落后过多则断开让其重连 |
|
|
19
|
-
| `TaAccess` | token 校验(WebSocket 握手与 HTTP)、监听本机时校验 `Host` 防 DNS rebinding、写 `serve.json`;token 与端口记进 `serve-state.json
|
|
21
|
+
| `TaAccess` | token 校验(WebSocket 握手与 HTTP)、监听本机时校验 `Host` 防 DNS rebinding、写 `serve.json`;token 与端口记进 `serve-state.json`,下次启动沿用。还接受用账号登录的浏览器的 token(`TaSignIn`)。监听网络地址(不是本机)时,启动后打印带 token 的登录链接(`TA_PUBLIC_URL`,没有时用 `http://localhost:<端口>`;token 来自 `TA_SERVE_TOKEN` 时不打印 token)和可用的账号登录方式 |
|
|
22
|
+
| `TaSignIn` / `SignInMiddleware` / `TaAccessServerImpl` | 用账号登录,见下文「账号登录」。流程(`SignInFlow`)和跳转页(`SignInPages`)不依赖 Cell,[`ta gateway`](../ta-gateway/README.md) 用的是同一份 |
|
|
20
23
|
| `WebExtensionCatalog`(`WebExtensionCatalogImpl`) | `listWebExtensions` / `readWebExtension` / `removeWebExtension`:按 pi 加载包的方式(`packages` 设置与 `extensions/` 目录,项目的只在受信任时)找出包里的 Web 扩展(`package.json` 的 `pi.web`,或 `web/` 下的模块);只读声明过、在包内、不超过 2 MB 的文件 |
|
|
21
24
|
| 包(`listPackages` / `installPackage` / `removePackage`) | 列出 pi 加载的所有包(不论有没有 Web 扩展),带 `resources`(`extensions`、`web`、`skills`、`prompts`、`themes`);`installPackage` 与 `ta install` 相同(`project` 即 `-l`,只在受信任的项目);`removePackage` 与 `removeWebExtension` 相同,按包的 id |
|
|
25
|
+
| 临时包(`openTemporaryPackage` / `updateTemporaryPackage` / `installTemporaryPackage` / `get`、`setTemporaryRetention`) | 不安装、打开即用的包(`TemporaryStore`,见 docs/design/ta-launcher.md):npm、Git 来源用 pi 包管理器的 `install` 拉下来但不写进 `packages` 设置,本地路径只记录,Agent 做的放在 agent 目录的 `temporary/<名字>/`;记录在 `temporary.json`(来源、打开和使用时间、是否收进"我的")。以 `origin: 'temporary'`、`activation: 'open'` 列出,只运行 Web 部分。`installTemporaryPackage` 把来源加进 `packages` 设置(Agent 做的移到 `extensions/`);`removePackage` / `removeWebExtension` 删掉 Ta 自己的目录、移除 pi 拉下来的包,用户的路径只是忘掉。`TemporaryPurge` 在启动 30 秒后和每 12 小时清掉超过保留天数(默认 30 天,0 为从不)没用过、也没收进"我的"的 |
|
|
26
|
+
| 分享(`TaRelayServer.sharePackage` / `unsharePackage`) | 本机扩展的分享链接:先打包检查不超过 8 MB,在 relay.json 记一条 7 天的分享,`RelayBridge` 在对方来取时打包、经中继端到端发送([@celljs/ta-relay](../ta-relay/README.md));`openTemporaryPackage` 收到这种链接时取回、解包到 `temporary/` |
|
|
22
27
|
| 包的服务端(`callPackageHost`) | 调用内置包 `pi.host` 返回的对象上的方法(参数、返回值都是 JSON),供它的 Web 扩展使用;`dispose`、`constructor`、`_` 开头的和对象自带的方法不能调用 |
|
|
23
28
|
| 开关(`setPackageEnabled`) | Ta 自带的 pi 包([`TaPackages`](../ta-harness/README.md))按名字开关,以 `origin: 'builtin'` 列出,只能开关、不能移除,开关存在 agent 目录的 `ta.json`(`disabledPackages`)。其他包按 `listPackages` 的 id 开关,和 `ta config` 一样逐个资源写进 pi 的设置(`PackageSwitch`:`extensions/` 里的写 `+路径` / `-路径` 到 `extensions` 等列表,`packages` 里的写进该条目的过滤),所以终端里的 `ta` 也认;pi 什么都不加载、只有 Web 扩展的包记在 `ta.json` 的 `disabledWeb`。`enabled`:pi 加载它的任一资源时为开(只有 Web 扩展的看 `disabledWeb`),关掉的包的 Web 扩展不加载。会话 `reload` 后生效 |
|
|
24
29
|
| `TaSettingsStore`(`TaSettingsStoreImpl`) | `getSettings` / `updateSettings`:ta 的设置(`TA_SETTINGS` 列出的键)就是 pi 的 `settings.json`,用户层在 agent 目录、项目层在 `<cwd>/.ta/`;只改给出的键(`null` 删除,空对象随之删掉),其余内容原样保留,整文件经临时文件写入、同一时间只写一次,写时持有与 pi 相同的文件锁(`<文件>.lock` 目录,超过 10 秒视为失效),所以终端里的 `ta` 同时改设置不会互相覆盖(pi 在锁内重读文件、只写回它改过的键);读不了的文件不覆盖。项目层:pi 会询问信任的项目(有扩展、技能等)未被信任时拒绝写入,没有需要询问的内容时写入即记为信任(否则 pi 不读)。写入后让相关会话的 `SettingsManager` 重新加载(模型与思考强度对新会话生效) |
|
|
25
30
|
| `ExtensionDataStore`(`ExtensionDataStoreImpl`) | `getExtensionData` / `setExtensionData`:包存在服务器上的小数据(Web 扩展的 `pi.storage`),每个包一个 `<agentDir>/extension-data/<包名>.json`(权限 0600),同一文件串行写入;值为 `null` 删除该键;每个包上限 4 MB。带 `cwd` 时是该目录的数据(`pi.storage.directory(cwd)`),存在 `extension-data/directories/<目录名>-<哈希>/<包名>.json`,哈希含执行环境,远程执行时同名目录互不影响;变更通知带上 `cwd` |
|
|
26
|
-
| `ClientToolBroker` | 客户端工具(`clientTools`):每个是 pi 的一个工具,调用时广播 `client_tool_request
|
|
31
|
+
| `ClientToolBroker` | 客户端工具(`clientTools`):每个是 pi 的一个工具,调用时广播 `client_tool_request`;第一个用 `claimClientTool` 认领的客户端执行并用 `respondClientTool` 回答,所以同一次调用只执行一次,不会每个页面各执行一遍;认领者没回答就离开会话时,请求重新广播给其他客户端;run 中止或会话关闭时以失败结束 |
|
|
27
32
|
| `DefaultExecEnvironmentFactory` | 按目录给执行环境:`ssh://<host>/<path>` 在那台主机上(`RemoteHosts`),本机路径在本机,配了 `ta.exec.url` 时在 `ta exec-server` 上(见 @celljs/ta-exec)。返回的环境的 `cwd` 是环境里的路径,路径都按它解析。也可 `rebind` 自己的 `ExecEnvironmentFactory` |
|
|
28
33
|
| `RemoteHosts` / `TaRemoteServerImpl` | `@Rpc(TaRemoteServer)`:`ssh://` 目录的主机,每台一个 `SshHost`(用系统 `ssh` 和它的配置,首次自动装 Node.js 和服务器),第一次调用时连接、断线后下次调用重连。`listHosts`(`~/.ssh/config` 里没有通配符、ssh 能用的 Host,和 `ta.json` 的 `remoteHosts`)、`addHost` / `removeHost`(记下或忘掉一台主机)、`resolveLocation`(不带路径的位置换成家目录)、`watch` / `answer`(ssh 要密码、口令、确认新主机时问所有页面,第一个回答生效)、`disconnect`;连接步骤和连上断开都推给 `TaClient.onRemoteEvent` |
|
|
29
34
|
| `PortForwards` | `forwardPort`:远端目录所在主机的端口在本机 `127.0.0.1` 上打开(尽量同一个端口号),每个连接经执行环境的 `connect` 转发;本机目录原样返回 |
|
|
@@ -38,6 +43,7 @@ ta:
|
|
|
38
43
|
host:
|
|
39
44
|
maxSessions: 32
|
|
40
45
|
idleTimeoutMs: 600000
|
|
46
|
+
closeTimeoutMs: 5000 # 关闭会话时等运行停下、扩展收尾的上限,之后照样释放会话文件
|
|
41
47
|
eventBufferBytes: 524288 # 每个会话可补发的事件量
|
|
42
48
|
clientBacklogBytes: 8388608 # 每个客户端允许积压的量
|
|
43
49
|
exec:
|
|
@@ -51,6 +57,30 @@ ta:
|
|
|
51
57
|
|
|
52
58
|
装了 [@celljs/ta-web](../ta-web/README.md) 时同一端口的 `/` 是 Web 客户端:GET 页面文件不需要 token(不含数据),`/api` 下的调用都要 token,监听本机时两者都校验 `Host`。
|
|
53
59
|
|
|
60
|
+
## 账号登录
|
|
61
|
+
|
|
62
|
+
`ta serve` 放在云端或服务器上时,除了 token,还可以用 GitHub、Google、微信或运营方自己的 OpenID Connect 账号登录。在 `ta serve` 的环境变量里配置登录方式(id 和密钥都有才提供),以及谁可以登录:
|
|
63
|
+
|
|
64
|
+
| 环境变量 | 作用 |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `TA_PUBLIC_URL` | 浏览器访问 `ta serve` 的地址,如 `https://ta.example.com`。各家的回调地址是 `<TA_PUBLIC_URL>/sign-in/<github\|google\|wechat\|oidc>/callback`,要在服务商那里登记。没有时按请求的 `Host` 和反向代理的 `X-Forwarded-Proto` / `X-Forwarded-Host` 推算 |
|
|
67
|
+
| `TA_GITHUB_CLIENT_ID` / `TA_GITHUB_CLIENT_SECRET` | GitHub 的 OAuth App;账号是 `github:<用户名>`。`TA_GITHUB_URL` 指向 GitHub Enterprise Server |
|
|
68
|
+
| `TA_GOOGLE_CLIENT_ID` / `TA_GOOGLE_CLIENT_SECRET` | Google 的 OAuth 客户端(Web 应用);账号是 `google:<邮箱>`,只认验证过的邮箱 |
|
|
69
|
+
| `TA_WECHAT_APP_ID` / `TA_WECHAT_APP_SECRET` | 微信开放平台的网站应用(扫码登录);账号是 `wechat:<unionid>`,应用没有 unionid 时是 openid |
|
|
70
|
+
| `TA_OIDC_ISSUER` / `TA_OIDC_CLIENT_ID` / `TA_OIDC_CLIENT_SECRET` / `TA_OIDC_NAME` | 任意 OpenID Connect 服务(Microsoft Entra、Okta、Keycloak、Authing……),从 `<issuer>/.well-known/openid-configuration` 找到端点;账号是 `oidc:<验证过的邮箱>`,没有时是 `oidc:<sub>`;`TA_OIDC_NAME` 是按钮上的名字 |
|
|
71
|
+
| `TA_ALLOWED_USERS` | 允许登录的账号,逗号或空格分隔,如 `github:octocat,google:*@example.com`(`*@<域名>` 允许整个域名)。也可以在 Web 客户端的 设置 → 访问 里添加 |
|
|
72
|
+
|
|
73
|
+
流程:
|
|
74
|
+
|
|
75
|
+
- 登录页 `GET /sign-in` 得到登录方式(`TaSignInWays`),每种一个按钮。`GET /sign-in/<方式>` 跳到服务商(state 写进只发往 `/sign-in` 的 HttpOnly cookie,GitHub、Google、OIDC 带 PKCE),服务商带着 code 回到 `/sign-in/<方式>/callback`;state 只能用一次、10 分钟内有效、必须是同一个浏览器发起的。
|
|
76
|
+
- 账号被允许:生成这个浏览器自己的 token,跳回 `/#token=<token>`(和 `ta serve --web` 一样,token 在 `#` 之后)。没被允许:跳回 `/#sign-in=denied&account=<账号>`,并记成一条请求,已登录的人在 设置 → 访问 里一点就能允许(`TaAccessServer.allow`)。
|
|
77
|
+
- 主人用 token 进来后,可以在 设置 → 访问 里「用你的账号登录」(`bindUrl`:一次性、5 分钟有效的链接),登录用的账号随即被允许,以后在任何设备上都能直接用它登录。
|
|
78
|
+
- 浏览器的 token 只存哈希,和允许的账号、请求一起记在 agent 目录的 `access.json`(权限 0600)。账号被移除(或不再在 `TA_ALLOWED_USERS` 里)、浏览器被退出登录时,它的 token 立即失效,已连着的 WebSocket 当即断开。
|
|
79
|
+
|
|
80
|
+
这些是浏览器要跳转的页面,不是调用,所以不在 WebSocket 上;其余的管理(`getAccess` / `bindUrl` / `allow` / `dismiss` / `disallow` / `signOut`)是同一条 WebSocket 上的 `TaAccessServer`。用 token 或允许的账号进来的人权限相同。
|
|
81
|
+
|
|
82
|
+
已知限制:微信的网站应用只有扫码登录,手机浏览器里点微信登录会显示一个二维码(要用另一台设备扫);在手机上可以用 GitHub、Google,或用配对(`ta pair`)。
|
|
83
|
+
|
|
54
84
|
## 会话存储(云端)
|
|
55
85
|
|
|
56
86
|
`ta serve` 在本机用 pi 的会话文件,靠会话锁保证同一时间只有一个进程写。云端可能有多个 `ta serve` 副本,任何一个都可能接手会话,这时会话放在 `TaSessionStorage` 里:
|
package/cell.schema.json
CHANGED
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"type": "integer",
|
|
18
18
|
"description": "A session with no client attached and no work is closed after this; its file stays."
|
|
19
19
|
},
|
|
20
|
+
"closeTimeoutMs": {
|
|
21
|
+
"type": "integer",
|
|
22
|
+
"description": "A session closing waits this long for its run to stop and its extensions to shut down, then lets its file go."
|
|
23
|
+
},
|
|
20
24
|
"eventBufferBytes": {
|
|
21
25
|
"type": "integer",
|
|
22
26
|
"description": "Latest events kept per session, for clients that reconnect."
|
package/cell.yml
CHANGED
|
@@ -8,6 +8,8 @@ ta:
|
|
|
8
8
|
maxSessions: 32
|
|
9
9
|
# A session nobody is attached to and that is not working is closed after this; its file stays.
|
|
10
10
|
idleTimeoutMs: 600000
|
|
11
|
+
# A session closing waits this long for its run to stop and its extensions to shut down, then lets its file go.
|
|
12
|
+
closeTimeoutMs: 5000
|
|
11
13
|
# Per session: what a client that reconnects can catch up on.
|
|
12
14
|
eventBufferBytes: 524288
|
|
13
15
|
# Per client: a client this far behind is disconnected, and catches up when it reconnects.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type CodingAgentOptions, ModelRuntimeProvider } from '@celljs/ai-coding-agent';
|
|
2
2
|
import { type RpcConnection } from '@celljs/rpc/lib/node';
|
|
3
3
|
import { type TaAuthEvent, type TaAuthProvider, TaAuthServer, type TaAuthType } from '@celljs/ta-protocol';
|
|
4
|
+
import { ExtensionProviders } from './extension-providers.js';
|
|
4
5
|
import { TaSessionRegistry } from './host-protocol.js';
|
|
5
6
|
type ModelRuntime = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).ModelRuntime;
|
|
6
7
|
type AuthInteraction = Parameters<ModelRuntime['login']>[2];
|
|
@@ -37,6 +38,7 @@ export declare namespace AuthServerUtil {
|
|
|
37
38
|
export declare class TaAuthServerImpl implements TaAuthServer {
|
|
38
39
|
protected readonly modelRuntimeProvider: ModelRuntimeProvider;
|
|
39
40
|
protected readonly sessions: TaSessionRegistry;
|
|
41
|
+
protected readonly extensionProviders: ExtensionProviders;
|
|
40
42
|
protected readonly codingAgentOptions?: CodingAgentOptions;
|
|
41
43
|
protected readonly logins: Map<string, Login>;
|
|
42
44
|
protected readonly watched: WeakSet<RpcConnection>;
|
|
@@ -13,6 +13,7 @@ import { Autowired, Value } from '@celljs/core';
|
|
|
13
13
|
import { Rpc } from '@celljs/rpc';
|
|
14
14
|
import { RpcContext } from '@celljs/rpc/lib/node';
|
|
15
15
|
import { TaAuthServer, TaClient } from '@celljs/ta-protocol';
|
|
16
|
+
import { ExtensionProviders } from './extension-providers.js';
|
|
16
17
|
import { TaSessionRegistry } from './host-protocol.js';
|
|
17
18
|
import { TaErrors } from './ta-errors.js';
|
|
18
19
|
/** pi's message when a sign-in is cancelled; the client says so in its own words. */
|
|
@@ -126,6 +127,8 @@ let TaAuthServerImpl = class TaAuthServerImpl {
|
|
|
126
127
|
listProviders() {
|
|
127
128
|
return TaErrors.guard(async () => {
|
|
128
129
|
const runtime = await this.modelRuntimeProvider.provide();
|
|
130
|
+
// Those of pi packages count, as in a session: an agent of ta-agents needs no sign-in here.
|
|
131
|
+
await this.extensionProviders.ensure();
|
|
129
132
|
const stored = new Set((await runtime.listCredentials()).map(credential => credential.providerId));
|
|
130
133
|
return AuthServerUtil.providers(runtime, stored);
|
|
131
134
|
});
|
|
@@ -236,6 +239,10 @@ __decorate([
|
|
|
236
239
|
Autowired(TaSessionRegistry),
|
|
237
240
|
__metadata("design:type", Object)
|
|
238
241
|
], TaAuthServerImpl.prototype, "sessions", void 0);
|
|
242
|
+
__decorate([
|
|
243
|
+
Autowired(ExtensionProviders),
|
|
244
|
+
__metadata("design:type", Object)
|
|
245
|
+
], TaAuthServerImpl.prototype, "extensionProviders", void 0);
|
|
239
246
|
__decorate([
|
|
240
247
|
Value(CODING_AGENT_OPTIONS),
|
|
241
248
|
__metadata("design:type", Object)
|
|
@@ -3,12 +3,16 @@ type ToolDefinition = import('@earendil-works/pi-coding-agent', { with: { 'resol
|
|
|
3
3
|
interface PendingCall {
|
|
4
4
|
request: TaClientToolRequest;
|
|
5
5
|
settle(result: TaClientToolResult | undefined): void;
|
|
6
|
+
/** The client that took it to run (claim). */
|
|
7
|
+
runner?: object;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
8
10
|
* The tools a session's clients run. Each is a tool of pi whose `execute` publishes the call and waits
|
|
9
|
-
* for a client's answer: the model, codemode and extensions see it like any other tool.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* for a client's answer: the model, codemode and extensions see it like any other tool. The call goes to
|
|
12
|
+
* every attached client, and the first that claims it runs it: a tool that does something (opens a
|
|
13
|
+
* session) runs once, not once per page. A client that leaves before it answers lets the call go: it is
|
|
14
|
+
* published again for the others. A call ends without a result when the run is aborted or the session
|
|
15
|
+
* closes.
|
|
12
16
|
*/
|
|
13
17
|
export declare class ClientToolBroker {
|
|
14
18
|
protected readonly definitions: TaClientToolDefinition[];
|
|
@@ -21,6 +25,10 @@ export declare class ClientToolBroker {
|
|
|
21
25
|
connect(publish: (event: TaEvent) => void): void;
|
|
22
26
|
/** The tools for pi. */
|
|
23
27
|
tools(): ToolDefinition[];
|
|
28
|
+
/** Whether `runner` runs the call: the first to ask does, and nobody else while it is there. */
|
|
29
|
+
claim(id: string, runner: object): boolean;
|
|
30
|
+
/** `runner` left the session: the calls it took and did not answer go to the others again. */
|
|
31
|
+
release(runner: object): void;
|
|
24
32
|
/** False when nobody waits for this call. */
|
|
25
33
|
respond(result: TaClientToolResult): boolean;
|
|
26
34
|
cancelAll(): void;
|
|
@@ -2,9 +2,11 @@ import { TaErrors } from './ta-errors.js';
|
|
|
2
2
|
const TOOL_NAME = /^[A-Za-z][\w-]*$/;
|
|
3
3
|
/**
|
|
4
4
|
* The tools a session's clients run. Each is a tool of pi whose `execute` publishes the call and waits
|
|
5
|
-
* for a client's answer: the model, codemode and extensions see it like any other tool.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* for a client's answer: the model, codemode and extensions see it like any other tool. The call goes to
|
|
6
|
+
* every attached client, and the first that claims it runs it: a tool that does something (opens a
|
|
7
|
+
* session) runs once, not once per page. A client that leaves before it answers lets the call go: it is
|
|
8
|
+
* published again for the others. A call ends without a result when the run is aborted or the session
|
|
9
|
+
* closes.
|
|
8
10
|
*/
|
|
9
11
|
export class ClientToolBroker {
|
|
10
12
|
/** Throws CELL_TA_INVALID_ARGUMENT for a definition pi could not take. */
|
|
@@ -40,6 +42,24 @@ export class ClientToolBroker {
|
|
|
40
42
|
execute: (toolCallId, input, signal) => this.call(definition.name, toolCallId, input, signal),
|
|
41
43
|
}));
|
|
42
44
|
}
|
|
45
|
+
/** Whether `runner` runs the call: the first to ask does, and nobody else while it is there. */
|
|
46
|
+
claim(id, runner) {
|
|
47
|
+
const call = this.pending.get(id);
|
|
48
|
+
if (!call || (call.runner && call.runner !== runner)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
call.runner = runner;
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
/** `runner` left the session: the calls it took and did not answer go to the others again. */
|
|
55
|
+
release(runner) {
|
|
56
|
+
for (const call of this.pending.values()) {
|
|
57
|
+
if (call.runner === runner) {
|
|
58
|
+
call.runner = undefined;
|
|
59
|
+
this.publish(call.request);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
43
63
|
/** False when nobody waits for this call. */
|
|
44
64
|
respond(result) {
|
|
45
65
|
const call = this.pending.get(result.id);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type CodingAgentOptions, ModelRuntimeProvider } from '@celljs/ai-coding-agent';
|
|
2
|
+
export declare const ExtensionProviders: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* The model providers that pi packages register (`pi.registerProvider`), before any session: pi registers
|
|
5
|
+
* them in the model runtime that the sessions of ta serve share when it loads a session's extensions, so
|
|
6
|
+
* until a session opened, a client would see none of them (no sign-in, no model to pick).
|
|
7
|
+
*/
|
|
8
|
+
export interface ExtensionProviders {
|
|
9
|
+
/** Loads the extensions of the user once, for the providers they register; later calls wait for that. */
|
|
10
|
+
ensure(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare class ExtensionProvidersImpl implements ExtensionProviders {
|
|
13
|
+
protected readonly codingAgentOptions?: CodingAgentOptions;
|
|
14
|
+
protected readonly modelRuntimeProvider: ModelRuntimeProvider;
|
|
15
|
+
protected loading?: Promise<void>;
|
|
16
|
+
ensure(): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* pi's services of a directory without a project (the home directory, its project resources not
|
|
19
|
+
* trusted): the built-in packages and those of the user's settings, as a session loads them.
|
|
20
|
+
*/
|
|
21
|
+
protected load(): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { homedir } from 'node:os';
|
|
11
|
+
import { CODING_AGENT_OPTIONS, ModelRuntimeProvider, PiSdkUtil } from '@celljs/ai-coding-agent';
|
|
12
|
+
import { Autowired, Component, Value } from '@celljs/core';
|
|
13
|
+
import { TaPackages } from '@celljs/ta-harness';
|
|
14
|
+
export const ExtensionProviders = Symbol('ExtensionProviders');
|
|
15
|
+
let ExtensionProvidersImpl = class ExtensionProvidersImpl {
|
|
16
|
+
ensure() {
|
|
17
|
+
var _a;
|
|
18
|
+
(_a = this.loading) !== null && _a !== void 0 ? _a : (this.loading = this.load().catch(() => undefined));
|
|
19
|
+
return this.loading;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* pi's services of a directory without a project (the home directory, its project resources not
|
|
23
|
+
* trusted): the built-in packages and those of the user's settings, as a session loads them.
|
|
24
|
+
*/
|
|
25
|
+
async load() {
|
|
26
|
+
var _a;
|
|
27
|
+
var _b;
|
|
28
|
+
const sdk = await PiSdkUtil.load();
|
|
29
|
+
const agentDir = (_b = (_a = this.codingAgentOptions) === null || _a === void 0 ? void 0 : _a.agentDir) !== null && _b !== void 0 ? _b : sdk.getAgentDir();
|
|
30
|
+
const cwd = homedir();
|
|
31
|
+
await sdk.createAgentSessionServices({
|
|
32
|
+
cwd,
|
|
33
|
+
agentDir,
|
|
34
|
+
settingsManager: sdk.SettingsManager.create(cwd, agentDir, { projectTrusted: false }),
|
|
35
|
+
modelRuntime: await this.modelRuntimeProvider.provide(),
|
|
36
|
+
resourceLoaderOptions: TaPackages.loaderOptions(agentDir),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
__decorate([
|
|
41
|
+
Value(CODING_AGENT_OPTIONS),
|
|
42
|
+
__metadata("design:type", Object)
|
|
43
|
+
], ExtensionProvidersImpl.prototype, "codingAgentOptions", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
Autowired(ModelRuntimeProvider),
|
|
46
|
+
__metadata("design:type", Object)
|
|
47
|
+
], ExtensionProvidersImpl.prototype, "modelRuntimeProvider", void 0);
|
|
48
|
+
ExtensionProvidersImpl = __decorate([
|
|
49
|
+
Component(ExtensionProviders)
|
|
50
|
+
], ExtensionProvidersImpl);
|
|
51
|
+
export { ExtensionProvidersImpl };
|
|
52
|
+
//# sourceMappingURL=extension-providers.js.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { RpcConnection } from '@celljs/rpc/lib/node';
|
|
2
|
-
import type { TaOpenSessionOptions, TaPackageInfo, TaSettingsScope, TaWebExtensionInfo, TaWebExtensionSource } from '@celljs/ta-protocol';
|
|
2
|
+
import type { TaOpenSessionOptions, TaPackageInfo, TaSavedSessionInfo, TaSettingsScope, TaTemporaryFrom, TaWebExtensionInfo, TaWebExtensionSource } from '@celljs/ta-protocol';
|
|
3
3
|
import type { ClientChannel } from './client-channel.js';
|
|
4
4
|
import type { TaSession } from './ta-session.js';
|
|
5
5
|
export declare const TaSessionFactory: unique symbol;
|
|
6
6
|
export declare const TaSessionRegistry: unique symbol;
|
|
7
|
+
export declare const TaSessionCatalog: unique symbol;
|
|
7
8
|
export declare const WebExtensionCatalog: unique symbol;
|
|
8
9
|
export declare const TA_HOST_OPTIONS = "ta.host";
|
|
9
10
|
export declare const TA_EXEC_OPTIONS = "ta.exec";
|
|
@@ -11,6 +12,8 @@ export declare const TA_EXEC_OPTIONS = "ta.exec";
|
|
|
11
12
|
export interface TaHostOptions {
|
|
12
13
|
maxSessions: number;
|
|
13
14
|
idleTimeoutMs: number;
|
|
15
|
+
/** How long a closing session waits for its run to stop and its extensions to shut down. */
|
|
16
|
+
closeTimeoutMs: number;
|
|
14
17
|
eventBufferBytes: number;
|
|
15
18
|
clientBacklogBytes: number;
|
|
16
19
|
}
|
|
@@ -35,6 +38,11 @@ export interface TaSessionRegistry {
|
|
|
35
38
|
closeAll(): Promise<void>;
|
|
36
39
|
channel(connection: RpcConnection): ClientChannel;
|
|
37
40
|
}
|
|
41
|
+
/** The conversations pi keeps in its session files, open or not. */
|
|
42
|
+
export interface TaSessionCatalog {
|
|
43
|
+
/** The latest first. */
|
|
44
|
+
list(): Promise<TaSavedSessionInfo[]>;
|
|
45
|
+
}
|
|
38
46
|
/** The packages pi loads in a directory, and their web extensions. */
|
|
39
47
|
export interface WebExtensionCatalog {
|
|
40
48
|
packages(cwd: string): Promise<TaPackageInfo[]>;
|
|
@@ -52,4 +60,17 @@ export interface WebExtensionCatalog {
|
|
|
52
60
|
* id, in pi's settings as `pi config` does (PackageSwitch), or in ta's when pi loads nothing of it.
|
|
53
61
|
*/
|
|
54
62
|
setEnabled(cwd: string, nameOrId: string, enabled: boolean): Promise<void>;
|
|
63
|
+
/** A package of {@link packages} by its id, or the id of one of its web extensions. */
|
|
64
|
+
packageOf(cwd: string, id: string): Promise<TaPackageInfo>;
|
|
65
|
+
/** Opens a package without installing it (TemporaryStore); its web extensions. */
|
|
66
|
+
openTemporary(cwd: string, source: string, from: TaTemporaryFrom): Promise<TaWebExtensionInfo[]>;
|
|
67
|
+
updateTemporary(cwd: string, id: string, change: {
|
|
68
|
+
used?: boolean;
|
|
69
|
+
kept?: boolean;
|
|
70
|
+
}): Promise<void>;
|
|
71
|
+
installTemporary(cwd: string, id: string): Promise<void>;
|
|
72
|
+
/** Removes the temporary packages unused too long; how many went. */
|
|
73
|
+
purgeTemporary(cwd: string): Promise<number>;
|
|
74
|
+
readonly temporaryRetention: number;
|
|
75
|
+
setTemporaryRetention(days: number): void;
|
|
55
76
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const TaSessionFactory = Symbol('TaSessionFactory');
|
|
2
2
|
export const TaSessionRegistry = Symbol('TaSessionRegistry');
|
|
3
|
+
export const TaSessionCatalog = Symbol('TaSessionCatalog');
|
|
3
4
|
export const WebExtensionCatalog = Symbol('WebExtensionCatalog');
|
|
4
5
|
export const TA_HOST_OPTIONS = 'ta.host';
|
|
5
6
|
export const TA_EXEC_OPTIONS = 'ta.exec';
|
package/esm/node/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './event-log.js';
|
|
|
5
5
|
export * from './exec-environment-factory.js';
|
|
6
6
|
export * from './extension-data.js';
|
|
7
7
|
export * from './extension-data-notifier.js';
|
|
8
|
+
export * from './extension-providers.js';
|
|
8
9
|
export * from './host-protocol.js';
|
|
9
10
|
export * from './package-host-extension.js';
|
|
10
11
|
export * from './package-hosts.js';
|
|
@@ -13,10 +14,13 @@ export * from './receipt-book.js';
|
|
|
13
14
|
export * from './relay-bridge.js';
|
|
14
15
|
export * from './remote/index.js';
|
|
15
16
|
export * from './remote-ui-context.js';
|
|
17
|
+
export * from './session-catalog.js';
|
|
18
|
+
export * from './session-files.js';
|
|
16
19
|
export * from './session-info-util.js';
|
|
17
20
|
export * from './session-storage/index.js';
|
|
18
21
|
export * from './settings-server-impl.js';
|
|
19
22
|
export * from './settings-store.js';
|
|
23
|
+
export * from './sign-in/index.js';
|
|
20
24
|
export * from './ta-access.js';
|
|
21
25
|
export * from './ta-errors.js';
|
|
22
26
|
export * from './ta-event-util.js';
|
|
@@ -24,6 +28,8 @@ export * from './ta-server-impl.js';
|
|
|
24
28
|
export * from './ta-session.js';
|
|
25
29
|
export * from './ta-session-factory.js';
|
|
26
30
|
export * from './ta-session-registry.js';
|
|
31
|
+
export * from './temporary-packages.js';
|
|
32
|
+
export * from './temporary-purge.js';
|
|
27
33
|
export * from './terminal-protocol.js';
|
|
28
34
|
export * from './terminal-service.js';
|
|
29
35
|
export * from './terminal-util.js';
|
package/esm/node/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from './event-log.js';
|
|
|
5
5
|
export * from './exec-environment-factory.js';
|
|
6
6
|
export * from './extension-data.js';
|
|
7
7
|
export * from './extension-data-notifier.js';
|
|
8
|
+
export * from './extension-providers.js';
|
|
8
9
|
export * from './host-protocol.js';
|
|
9
10
|
export * from './package-host-extension.js';
|
|
10
11
|
export * from './package-hosts.js';
|
|
@@ -13,10 +14,13 @@ export * from './receipt-book.js';
|
|
|
13
14
|
export * from './relay-bridge.js';
|
|
14
15
|
export * from './remote/index.js';
|
|
15
16
|
export * from './remote-ui-context.js';
|
|
17
|
+
export * from './session-catalog.js';
|
|
18
|
+
export * from './session-files.js';
|
|
16
19
|
export * from './session-info-util.js';
|
|
17
20
|
export * from './session-storage/index.js';
|
|
18
21
|
export * from './settings-server-impl.js';
|
|
19
22
|
export * from './settings-store.js';
|
|
23
|
+
export * from './sign-in/index.js';
|
|
20
24
|
export * from './ta-access.js';
|
|
21
25
|
export * from './ta-errors.js';
|
|
22
26
|
export * from './ta-event-util.js';
|
|
@@ -24,6 +28,8 @@ export * from './ta-server-impl.js';
|
|
|
24
28
|
export * from './ta-session.js';
|
|
25
29
|
export * from './ta-session-factory.js';
|
|
26
30
|
export * from './ta-session-registry.js';
|
|
31
|
+
export * from './temporary-packages.js';
|
|
32
|
+
export * from './temporary-purge.js';
|
|
27
33
|
export * from './terminal-protocol.js';
|
|
28
34
|
export * from './terminal-service.js';
|
|
29
35
|
export * from './terminal-util.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TaConversation, TaMessage, TaToolRun } from '@celljs/ta-protocol';
|
|
2
|
+
type AgentSessionEvent = import('@earendil-works/pi-coding-agent', { with: { 'resolution-mode': 'import' } }).AgentSessionEvent;
|
|
3
|
+
/**
|
|
4
|
+
* The run of now as the events sent so far left it, for a client that attaches without them. pi's
|
|
5
|
+
* messages lack the one the model is writing, and run ahead of the events by the one pi is delivering:
|
|
6
|
+
* pi updates its state first, then waits for the extensions before it emits. So this keeps, from the
|
|
7
|
+
* events as they go out, the messages they ended, the message they started, and the calls of tools.
|
|
8
|
+
*/
|
|
9
|
+
export declare class LiveRun {
|
|
10
|
+
/** How many of pi's messages the events sent have ended. */
|
|
11
|
+
protected ended: number;
|
|
12
|
+
/** The message being written, as its last event had it. */
|
|
13
|
+
protected writing?: TaMessage;
|
|
14
|
+
protected tools: Record<string, TaToolRun>;
|
|
15
|
+
/** pi's messages are those of the events sent: at the start, and when the conversation is another or compacted. */
|
|
16
|
+
reset(messages: readonly TaMessage[]): void;
|
|
17
|
+
/** An event of pi as it is sent, with pi's messages of that moment. */
|
|
18
|
+
observe(event: AgentSessionEvent, messages: readonly TaMessage[]): void;
|
|
19
|
+
/** The conversation of the events sent; idle, pi's messages are all sent. */
|
|
20
|
+
conversation(messages: readonly TaMessage[], running: boolean): TaConversation;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run of now as the events sent so far left it, for a client that attaches without them. pi's
|
|
3
|
+
* messages lack the one the model is writing, and run ahead of the events by the one pi is delivering:
|
|
4
|
+
* pi updates its state first, then waits for the extensions before it emits. So this keeps, from the
|
|
5
|
+
* events as they go out, the messages they ended, the message they started, and the calls of tools.
|
|
6
|
+
*/
|
|
7
|
+
export class LiveRun {
|
|
8
|
+
constructor() {
|
|
9
|
+
/** How many of pi's messages the events sent have ended. */
|
|
10
|
+
this.ended = 0;
|
|
11
|
+
this.tools = {};
|
|
12
|
+
}
|
|
13
|
+
/** pi's messages are those of the events sent: at the start, and when the conversation is another or compacted. */
|
|
14
|
+
reset(messages) {
|
|
15
|
+
this.ended = messages.length;
|
|
16
|
+
this.writing = undefined;
|
|
17
|
+
this.tools = {};
|
|
18
|
+
}
|
|
19
|
+
/** An event of pi as it is sent, with pi's messages of that moment. */
|
|
20
|
+
observe(event, messages) {
|
|
21
|
+
switch (event.type) {
|
|
22
|
+
case 'agent_start':
|
|
23
|
+
case 'agent_settled':
|
|
24
|
+
case 'compaction_end':
|
|
25
|
+
this.reset(messages);
|
|
26
|
+
break;
|
|
27
|
+
case 'message_start':
|
|
28
|
+
case 'message_update':
|
|
29
|
+
this.writing = event.message;
|
|
30
|
+
break;
|
|
31
|
+
case 'message_end':
|
|
32
|
+
this.writing = undefined;
|
|
33
|
+
this.ended = messages.length;
|
|
34
|
+
break;
|
|
35
|
+
case 'tool_execution_start': {
|
|
36
|
+
const { parentToolCallId } = event;
|
|
37
|
+
const run = { toolName: event.toolName, args: event.args, status: 'running' };
|
|
38
|
+
this.tools[event.toolCallId] = parentToolCallId ? { ...run, parentToolCallId } : run;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case 'tool_execution_update':
|
|
42
|
+
this.tools[event.toolCallId] = { ...this.tools[event.toolCallId], result: event.partialResult };
|
|
43
|
+
break;
|
|
44
|
+
case 'tool_execution_end':
|
|
45
|
+
this.tools[event.toolCallId] = { ...this.tools[event.toolCallId], result: event.result, status: event.isError ? 'error' : 'done' };
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** The conversation of the events sent; idle, pi's messages are all sent. */
|
|
50
|
+
conversation(messages, running) {
|
|
51
|
+
if (!running) {
|
|
52
|
+
return { messages: [...messages], tools: {} };
|
|
53
|
+
}
|
|
54
|
+
const ended = messages.slice(0, this.ended);
|
|
55
|
+
return { messages: this.writing ? [...ended, this.writing] : ended, tools: { ...this.tools } };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=live-run.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TaConversation, TaMessage, TaMessagePage } from '@celljs/ta-protocol';
|
|
2
|
+
/**
|
|
3
|
+
* The parts of a long conversation a client loads one at a time, the latest first: about so many bytes
|
|
4
|
+
* of JSON each, as the client gets them.
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace MessagePage {
|
|
7
|
+
function size(message: TaMessage): number;
|
|
8
|
+
/**
|
|
9
|
+
* Where the messages before `end` that fit in `budget` start: at least one; back to the message that
|
|
10
|
+
* asked for their turn if that takes no more than twice the budget, so that a turn shows whole.
|
|
11
|
+
*/
|
|
12
|
+
function start(messages: readonly TaMessage[], end: number, budget: number): number;
|
|
13
|
+
/** The latest part of a conversation, or all of it without a budget. */
|
|
14
|
+
function recent(conversation: TaConversation, budget: number | undefined): TaConversation;
|
|
15
|
+
/** The part before message `before`, found again by its timestamp if messages came or went before it. */
|
|
16
|
+
function before(messages: readonly TaMessage[], before: number | undefined, stamp: number | undefined, budget: number): TaMessagePage;
|
|
17
|
+
}
|