@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
|
@@ -14,12 +14,19 @@ declare class Terminal {
|
|
|
14
14
|
owner?: RpcConnection;
|
|
15
15
|
orphanTimer?: ReturnType<typeof setTimeout>;
|
|
16
16
|
pending: string;
|
|
17
|
+
/** The last output, for a page that takes the shell again after its own went (a reload). */
|
|
18
|
+
history: string;
|
|
17
19
|
flushTimer?: ReturnType<typeof setTimeout>;
|
|
18
20
|
sending: boolean;
|
|
19
21
|
/** The code the shell ended with, as it said, or as its process did. */
|
|
20
22
|
exitCode?: number;
|
|
21
23
|
/** Its process ended. */
|
|
22
24
|
exited: boolean;
|
|
25
|
+
/** The size its view asked for last; it waits for the name of the terminal when that is not known yet. */
|
|
26
|
+
size?: {
|
|
27
|
+
cols: number;
|
|
28
|
+
rows: number;
|
|
29
|
+
};
|
|
23
30
|
/** Its client knows it ended: nothing more goes. */
|
|
24
31
|
ended: boolean;
|
|
25
32
|
readonly decoder: TextDecoder;
|
|
@@ -31,19 +38,26 @@ export declare class DefaultTaTerminals implements TaTerminals, ApplicationLifec
|
|
|
31
38
|
protected readonly environments: ExecEnvironmentFactory;
|
|
32
39
|
protected readonly terminals: Map<string, Terminal>;
|
|
33
40
|
protected readonly watched: WeakSet<RpcConnection>;
|
|
34
|
-
|
|
41
|
+
/** By machine: `''` for this one (or the exec server), else the host of `ssh://`. */
|
|
42
|
+
protected readonly platforms: Map<string, Promise<TerminalPlatform>>;
|
|
35
43
|
protected nextId: number;
|
|
36
44
|
open(connection: RpcConnection, options: TaOpenTerminalOptions & {
|
|
37
45
|
cwd: string;
|
|
38
46
|
}): Promise<TaTerminalInfo>;
|
|
39
47
|
write(connection: RpcConnection, terminalId: string, data: string): void;
|
|
40
48
|
resize(connection: RpcConnection, terminalId: string, cols: number, rows: number): Promise<void>;
|
|
49
|
+
/** A view sizes its shell as soon as it shows, often before the shell named its terminal: the size waits for it. */
|
|
50
|
+
protected applySize(terminal: Terminal): Promise<void>;
|
|
41
51
|
close(connection: RpcConnection, terminalId: string): Promise<void>;
|
|
42
52
|
list(connection: RpcConnection): TaTerminalInfo[];
|
|
43
53
|
onStop(): Promise<void>;
|
|
44
54
|
closeAll(): Promise<void>;
|
|
45
55
|
/** The shell of this connection, or one nobody has: it becomes this connection's. */
|
|
46
56
|
protected require(connection: RpcConnection, terminalId: string): Terminal;
|
|
57
|
+
/**
|
|
58
|
+
* A connection takes a shell nobody has. What its page shows went with the page: it gets the last
|
|
59
|
+
* output again, after a reset, so that a page that kept its screen does not show it twice.
|
|
60
|
+
*/
|
|
47
61
|
protected adopt(terminal: Terminal, connection: RpcConnection): void;
|
|
48
62
|
protected watch(connection: RpcConnection): void;
|
|
49
63
|
protected output(terminal: Terminal, text: string): void;
|
|
@@ -54,6 +68,8 @@ export declare class DefaultTaTerminals implements TaTerminals, ApplicationLifec
|
|
|
54
68
|
protected exited(terminal: Terminal, exitCode: number | null): void;
|
|
55
69
|
/** Hangs up its terminal, which ends what runs there, then the wrapper. */
|
|
56
70
|
protected end(terminal: Terminal): Promise<void>;
|
|
57
|
-
|
|
71
|
+
/** The machine of a location: its shell, `script` and system are those of that machine. */
|
|
72
|
+
protected machine(location: string): string;
|
|
73
|
+
protected detect(env: ExecEnvironment, machine: string): Promise<TerminalPlatform>;
|
|
58
74
|
}
|
|
59
75
|
export {};
|
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
};
|
|
12
12
|
import { ApplicationLifecycle, Autowired, Component } from '@celljs/core';
|
|
13
13
|
import { ExecEnvironmentFactory } from '@celljs/ta-exec';
|
|
14
|
-
import { TaClient } from '@celljs/ta-protocol';
|
|
14
|
+
import { TaClient, TaLocation } from '@celljs/ta-protocol';
|
|
15
15
|
import { TaErrors } from './ta-errors.js';
|
|
16
16
|
import { TaTerminals } from './terminal-protocol.js';
|
|
17
17
|
import { PipeDiscipline, TerminalUtil, TtyMarker } from './terminal-util.js';
|
|
@@ -30,6 +30,8 @@ class Terminal {
|
|
|
30
30
|
this.platform = platform;
|
|
31
31
|
this.process = process;
|
|
32
32
|
this.pending = '';
|
|
33
|
+
/** The last output, for a page that takes the shell again after its own went (a reload). */
|
|
34
|
+
this.history = '';
|
|
33
35
|
this.sending = false;
|
|
34
36
|
/** Its process ended. */
|
|
35
37
|
this.exited = false;
|
|
@@ -45,6 +47,8 @@ let DefaultTaTerminals = class DefaultTaTerminals {
|
|
|
45
47
|
constructor() {
|
|
46
48
|
this.terminals = new Map();
|
|
47
49
|
this.watched = new WeakSet();
|
|
50
|
+
/** By machine: `''` for this one (or the exec server), else the host of `ssh://`. */
|
|
51
|
+
this.platforms = new Map();
|
|
48
52
|
this.nextId = 0;
|
|
49
53
|
}
|
|
50
54
|
async open(connection, options) {
|
|
@@ -53,7 +57,7 @@ let DefaultTaTerminals = class DefaultTaTerminals {
|
|
|
53
57
|
if (!(stat === null || stat === void 0 ? void 0 : stat.isDirectory)) {
|
|
54
58
|
throw TaErrors.invalidArgument(`${options.cwd} is not a directory.`, 'Open the terminal in a directory that exists.');
|
|
55
59
|
}
|
|
56
|
-
const platform = await this.detect(env);
|
|
60
|
+
const platform = await this.detect(env, this.machine(options.cwd));
|
|
57
61
|
const launch = TerminalUtil.launch(platform, TerminalUtil.size(options.cols, DEFAULT_COLS), TerminalUtil.size(options.rows, DEFAULT_ROWS));
|
|
58
62
|
// `pty`: false when the shell runs on pipes, so that the view can say why some programs behave otherwise.
|
|
59
63
|
const info = { terminalId: `t${++this.nextId}`, cwd: options.cwd, shell: platform.shell, pty: launch.pty };
|
|
@@ -80,8 +84,13 @@ let DefaultTaTerminals = class DefaultTaTerminals {
|
|
|
80
84
|
}
|
|
81
85
|
async resize(connection, terminalId, cols, rows) {
|
|
82
86
|
const terminal = this.require(connection, terminalId);
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
terminal.size = { cols: TerminalUtil.size(cols, DEFAULT_COLS), rows: TerminalUtil.size(rows, DEFAULT_ROWS) };
|
|
88
|
+
await this.applySize(terminal);
|
|
89
|
+
}
|
|
90
|
+
/** A view sizes its shell as soon as it shows, often before the shell named its terminal: the size waits for it. */
|
|
91
|
+
async applySize(terminal) {
|
|
92
|
+
if (terminal.marker.tty && terminal.size) {
|
|
93
|
+
const command = TerminalUtil.resizeCommand(terminal.platform, terminal.marker.tty, terminal.size.cols, terminal.size.rows);
|
|
85
94
|
await terminal.env.exec(command, { timeout: 5000 });
|
|
86
95
|
}
|
|
87
96
|
}
|
|
@@ -117,10 +126,15 @@ let DefaultTaTerminals = class DefaultTaTerminals {
|
|
|
117
126
|
}
|
|
118
127
|
return terminal;
|
|
119
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* A connection takes a shell nobody has. What its page shows went with the page: it gets the last
|
|
131
|
+
* output again, after a reset, so that a page that kept its screen does not show it twice.
|
|
132
|
+
*/
|
|
120
133
|
adopt(terminal, connection) {
|
|
121
134
|
clearTimeout(terminal.orphanTimer);
|
|
122
135
|
terminal.orphanTimer = undefined;
|
|
123
136
|
terminal.owner = connection;
|
|
137
|
+
terminal.pending = terminal.history ? `${TerminalUtil.RESET}${terminal.history}` : terminal.pending;
|
|
124
138
|
this.watch(connection);
|
|
125
139
|
this.schedule(terminal);
|
|
126
140
|
}
|
|
@@ -142,7 +156,11 @@ let DefaultTaTerminals = class DefaultTaTerminals {
|
|
|
142
156
|
var _a;
|
|
143
157
|
const { text: rest, exitCode } = TerminalUtil.takeExitCode(text);
|
|
144
158
|
(_a = terminal.exitCode) !== null && _a !== void 0 ? _a : (terminal.exitCode = exitCode);
|
|
159
|
+
const named = terminal.marker.tty !== undefined;
|
|
145
160
|
const shown = terminal.marker.feed(rest);
|
|
161
|
+
if (!named && terminal.marker.tty !== undefined) {
|
|
162
|
+
void this.applySize(terminal).catch(() => undefined);
|
|
163
|
+
}
|
|
146
164
|
this.queue(terminal, terminal.discipline ? terminal.discipline.output(shown) : shown);
|
|
147
165
|
}
|
|
148
166
|
queue(terminal, text) {
|
|
@@ -151,8 +169,9 @@ let DefaultTaTerminals = class DefaultTaTerminals {
|
|
|
151
169
|
}
|
|
152
170
|
terminal.pending += text;
|
|
153
171
|
if (terminal.pending.length > MAX_PENDING_CHARS) {
|
|
154
|
-
terminal.pending = terminal.pending
|
|
172
|
+
terminal.pending = TerminalUtil.tail(terminal.pending, MAX_PENDING_CHARS);
|
|
155
173
|
}
|
|
174
|
+
terminal.history = TerminalUtil.tail(terminal.history + text, MAX_PENDING_CHARS);
|
|
156
175
|
this.schedule(terminal);
|
|
157
176
|
}
|
|
158
177
|
schedule(terminal) {
|
|
@@ -213,9 +232,23 @@ let DefaultTaTerminals = class DefaultTaTerminals {
|
|
|
213
232
|
}
|
|
214
233
|
terminal.process.kill();
|
|
215
234
|
}
|
|
216
|
-
|
|
235
|
+
/** The machine of a location: its shell, `script` and system are those of that machine. */
|
|
236
|
+
machine(location) {
|
|
217
237
|
var _a;
|
|
218
|
-
|
|
238
|
+
var _b;
|
|
239
|
+
try {
|
|
240
|
+
return (_b = (_a = TaLocation.parse(location)) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : '';
|
|
241
|
+
}
|
|
242
|
+
catch (_c) {
|
|
243
|
+
return '';
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
detect(env, machine) {
|
|
247
|
+
let platform = this.platforms.get(machine);
|
|
248
|
+
if (platform) {
|
|
249
|
+
return platform;
|
|
250
|
+
}
|
|
251
|
+
platform = (async () => {
|
|
219
252
|
var _a;
|
|
220
253
|
let output = '';
|
|
221
254
|
const decoder = new TextDecoder();
|
|
@@ -225,8 +258,11 @@ let DefaultTaTerminals = class DefaultTaTerminals {
|
|
|
225
258
|
});
|
|
226
259
|
const fallback = env.local && process.platform === 'win32' ? ((_a = process.env.ComSpec) !== null && _a !== void 0 ? _a : 'cmd.exe') : '/bin/sh';
|
|
227
260
|
return exitCode === 0 ? TerminalUtil.parsePlatform(output, fallback) : { system: '', script: false, shell: fallback };
|
|
228
|
-
})()
|
|
229
|
-
|
|
261
|
+
})();
|
|
262
|
+
// A machine that could not answer is asked again next time.
|
|
263
|
+
platform.catch(() => this.platforms.delete(machine));
|
|
264
|
+
this.platforms.set(machine, platform);
|
|
265
|
+
return platform;
|
|
230
266
|
}
|
|
231
267
|
};
|
|
232
268
|
__decorate([
|
|
@@ -15,6 +15,20 @@ export interface TerminalLaunch {
|
|
|
15
15
|
* shell runs on pipes, and {@link PipeDiscipline} does what the terminal would.
|
|
16
16
|
*/
|
|
17
17
|
export declare namespace TerminalUtil {
|
|
18
|
+
/** A full reset of the terminal (RIS): its screen, scrollback and modes. */
|
|
19
|
+
const RESET = "\u001Bc";
|
|
20
|
+
/**
|
|
21
|
+
* At most `max` characters of the end of `text`, from the start of a line when it is cut, so that it
|
|
22
|
+
* does not start inside a control sequence or a character.
|
|
23
|
+
*/
|
|
24
|
+
function tail(text: string, max: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* A shell started by ssh or by an app of the desktop often has no locale (`C`): it then reads
|
|
27
|
+
* Chinese, typed or pasted, as bytes it cannot show (`<ffffffff>`), and programs print `?`. When
|
|
28
|
+
* the locale is not UTF-8, the shell gets one for its characters (LC_CTYPE, and LC_ALL when set):
|
|
29
|
+
* C.UTF-8 where the system has it, else en_US.UTF-8; its messages and formats stay as they were.
|
|
30
|
+
*/
|
|
31
|
+
const UTF8_LOCALE: string;
|
|
18
32
|
/** The command that tells the platform: three lines. */
|
|
19
33
|
const PROBE = "uname -s; command -v script; printf %s \"$SHELL\"";
|
|
20
34
|
function parsePlatform(output: string, fallbackShell: string): TerminalPlatform;
|
|
@@ -14,6 +14,33 @@ const TTY_SEARCH_CHARS = 4096;
|
|
|
14
14
|
*/
|
|
15
15
|
export var TerminalUtil;
|
|
16
16
|
(function (TerminalUtil) {
|
|
17
|
+
/** A full reset of the terminal (RIS): its screen, scrollback and modes. */
|
|
18
|
+
TerminalUtil.RESET = '\x1bc';
|
|
19
|
+
/**
|
|
20
|
+
* At most `max` characters of the end of `text`, from the start of a line when it is cut, so that it
|
|
21
|
+
* does not start inside a control sequence or a character.
|
|
22
|
+
*/
|
|
23
|
+
function tail(text, max) {
|
|
24
|
+
if (text.length <= max) {
|
|
25
|
+
return text;
|
|
26
|
+
}
|
|
27
|
+
const cut = text.slice(-max);
|
|
28
|
+
const line = cut.indexOf('\n');
|
|
29
|
+
return line < 0 ? cut : cut.slice(line + 1);
|
|
30
|
+
}
|
|
31
|
+
TerminalUtil.tail = tail;
|
|
32
|
+
/**
|
|
33
|
+
* A shell started by ssh or by an app of the desktop often has no locale (`C`): it then reads
|
|
34
|
+
* Chinese, typed or pasted, as bytes it cannot show (`<ffffffff>`), and programs print `?`. When
|
|
35
|
+
* the locale is not UTF-8, the shell gets one for its characters (LC_CTYPE, and LC_ALL when set):
|
|
36
|
+
* C.UTF-8 where the system has it, else en_US.UTF-8; its messages and formats stay as they were.
|
|
37
|
+
*/
|
|
38
|
+
TerminalUtil.UTF8_LOCALE = [
|
|
39
|
+
'case "${LC_ALL:-${LC_CTYPE:-$LANG}}" in *[Uu][Tt][Ff]-8*|*[Uu][Tt][Ff]8*) ;; *)',
|
|
40
|
+
"ta_utf8=$(locale -a 2>/dev/null | grep -i -x -m 1 -E 'c\\.utf-?8|en_us\\.utf-?8'); ta_utf8=${ta_utf8:-en_US.UTF-8};",
|
|
41
|
+
'[ -n "$LC_ALL" ] && export LC_ALL="$ta_utf8"; export LC_CTYPE="$ta_utf8"; unset ta_utf8;;',
|
|
42
|
+
'esac',
|
|
43
|
+
].join(' ');
|
|
17
44
|
/** The command that tells the platform: three lines. */
|
|
18
45
|
TerminalUtil.PROBE = 'uname -s; command -v script; printf %s "$SHELL"';
|
|
19
46
|
function parsePlatform(output, fallbackShell) {
|
|
@@ -31,8 +58,10 @@ export var TerminalUtil;
|
|
|
31
58
|
const boot = [
|
|
32
59
|
// macOS's bash 3.2 otherwise asks to switch to zsh on each start.
|
|
33
60
|
'export TERM=xterm-256color BASH_SILENCE_DEPRECATION_WARNING=1',
|
|
34
|
-
|
|
61
|
+
TerminalUtil.UTF8_LOCALE,
|
|
62
|
+
// Sized before it says its name: a resize that waited for the name comes after this size.
|
|
35
63
|
`stty cols ${cols} rows ${rows} 2>/dev/null`,
|
|
64
|
+
`printf '\\033]1337;ta-tty=%s\\007' "$(tty)"`,
|
|
36
65
|
`exec ${quote(platform.shell)} -i`,
|
|
37
66
|
].join('; ');
|
|
38
67
|
let script;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type CodingAgentOptions, type PiSdk } from '@celljs/ai-coding-agent';
|
|
2
|
-
import type { TaPackageInfo, TaSettingsScope, TaWebExtensionInfo, TaWebExtensionSource } from '@celljs/ta-protocol';
|
|
2
|
+
import type { TaPackageInfo, TaSettingsScope, TaTemporaryFrom, TaTemporaryInfo, TaWebExtensionInfo, TaWebExtensionSource } from '@celljs/ta-protocol';
|
|
3
3
|
import { WebExtensionCatalog } from './host-protocol.js';
|
|
4
4
|
import { PiDirectories } from './remote/remote-protocol.js';
|
|
5
|
+
import { type TemporaryRecord, TemporaryStore } from './temporary-packages.js';
|
|
5
6
|
import { type WebExtensionPackage } from './web-extension-util.js';
|
|
6
7
|
type PackageManager = InstanceType<PiSdk['DefaultPackageManager']>;
|
|
7
8
|
type SettingsManager = ReturnType<PiSdk['SettingsManager']['create']>;
|
|
@@ -11,6 +12,8 @@ interface Loaded {
|
|
|
11
12
|
settings: SettingsManager;
|
|
12
13
|
trusted: boolean;
|
|
13
14
|
projectDir: string;
|
|
15
|
+
/** pi's, a directory of this machine. */
|
|
16
|
+
cwd: string;
|
|
14
17
|
}
|
|
15
18
|
/**
|
|
16
19
|
* Finds packages, and their web extensions, where pi finds extensions: in the packages that come with ta, in the packages of
|
|
@@ -22,6 +25,24 @@ export declare class WebExtensionCatalogImpl implements WebExtensionCatalog {
|
|
|
22
25
|
protected readonly directories: PiDirectories;
|
|
23
26
|
packages(cwd: string): Promise<TaPackageInfo[]>;
|
|
24
27
|
install(cwd: string, source: string, scope: TaSettingsScope): Promise<void>;
|
|
28
|
+
openTemporary(cwd: string, source: string, from: TaTemporaryFrom): Promise<TaWebExtensionInfo[]>;
|
|
29
|
+
updateTemporary(cwd: string, id: string, change: {
|
|
30
|
+
used?: boolean;
|
|
31
|
+
kept?: boolean;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
installTemporary(cwd: string, id: string): Promise<void>;
|
|
34
|
+
/** Removes the temporary packages unused for longer than the retention, not kept; how many went. */
|
|
35
|
+
purgeTemporary(cwd: string): Promise<number>;
|
|
36
|
+
get temporaryRetention(): number;
|
|
37
|
+
setTemporaryRetention(days: number): void;
|
|
38
|
+
protected temporary(): TemporaryStore;
|
|
39
|
+
packageOf(cwd: string, id: string): Promise<TaPackageInfo>;
|
|
40
|
+
/** A package another computer shared by a link, put in Ta's own temporary directory (RelayShareUtil). */
|
|
41
|
+
protected fetchShare(link: string): Promise<string>;
|
|
42
|
+
protected fetch(manager: PackageManager, source: string): Promise<string>;
|
|
43
|
+
protected findTemporary(cwd: string, id: string): Promise<WebExtensionPackage>;
|
|
44
|
+
/** Ta's own directory is deleted, what pi fetched removed, a path of the user's only forgotten. */
|
|
45
|
+
protected dropTemporary(record: TemporaryRecord, manager: PackageManager): Promise<void>;
|
|
25
46
|
removePackage(cwd: string, id: string): Promise<void>;
|
|
26
47
|
list(cwd: string): Promise<TaWebExtensionInfo[]>;
|
|
27
48
|
read(cwd: string, id: string): Promise<TaWebExtensionSource>;
|
|
@@ -37,4 +58,10 @@ export declare class WebExtensionCatalogImpl implements WebExtensionCatalog {
|
|
|
37
58
|
protected resolve(manager: PackageManager): Promise<import("@earendil-works/pi-coding-agent").ResolvedPaths>;
|
|
38
59
|
protected load(location: string): Promise<Loaded>;
|
|
39
60
|
}
|
|
61
|
+
export declare namespace TemporaryUtil {
|
|
62
|
+
/** A source of the file system, as pi takes it: not `npm:`, `git:` or a URL. */
|
|
63
|
+
function isPath(source: string): boolean;
|
|
64
|
+
function expand(path: string): string;
|
|
65
|
+
function info({ source, from, openedAt, usedAt, kept }: TemporaryRecord): TaTemporaryInfo;
|
|
66
|
+
}
|
|
40
67
|
export {};
|
|
@@ -7,16 +7,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import { rmSync } from 'node:fs';
|
|
11
|
-
import { join } from 'node:path';
|
|
10
|
+
import { existsSync, mkdirSync, renameSync, rmSync } from 'node:fs';
|
|
11
|
+
import { basename, isAbsolute, join, resolve } from 'node:path';
|
|
12
12
|
import { CODING_AGENT_OPTIONS, PiSdkUtil } from '@celljs/ai-coding-agent';
|
|
13
13
|
import { Autowired, Component, Value } from '@celljs/core';
|
|
14
|
+
import { PackageArchive } from '@celljs/ta-harness/lib/node/package-archive';
|
|
14
15
|
import { TaBrand } from '@celljs/ta-harness/lib/node/ta-brand';
|
|
15
16
|
import { TaPackages } from '@celljs/ta-harness/lib/node/ta-packages';
|
|
17
|
+
import { RelayShareUtil } from '@celljs/ta-relay/lib/node';
|
|
16
18
|
import { WebExtensionCatalog } from './host-protocol.js';
|
|
17
19
|
import { PackageSwitch } from './package-switch.js';
|
|
18
20
|
import { PiDirectories } from './remote/remote-protocol.js';
|
|
19
21
|
import { TaErrors } from './ta-errors.js';
|
|
22
|
+
import { TemporaryStore } from './temporary-packages.js';
|
|
20
23
|
import { WebExtensionUtil } from './web-extension-util.js';
|
|
21
24
|
/**
|
|
22
25
|
* Finds packages, and their web extensions, where pi finds extensions: in the packages that come with ta, in the packages of
|
|
@@ -38,6 +41,138 @@ let WebExtensionCatalogImpl = class WebExtensionCatalogImpl {
|
|
|
38
41
|
throw TaErrors.invalidArgument(`The project ${cwd} is not trusted.`, 'Trust it first, or install the package for the user.');
|
|
39
42
|
}
|
|
40
43
|
await manager.installAndPersist(trimmed, { local: scope === 'project' });
|
|
44
|
+
if (scope === 'user') {
|
|
45
|
+
const root = manager.getInstalledPath(trimmed, 'user');
|
|
46
|
+
const record = this.temporary().find(candidate => candidate.source === trimmed || (!!root && resolve(candidate.root) === resolve(root)));
|
|
47
|
+
if (record) {
|
|
48
|
+
this.temporary().forget(record.root);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async openTemporary(cwd, source, from) {
|
|
53
|
+
const trimmed = typeof source === 'string' ? source.trim() : '';
|
|
54
|
+
if (!trimmed || /[\r\n]/.test(trimmed) || !['market', 'link', 'agent'].includes(from)) {
|
|
55
|
+
throw TaErrors.invalidArgument('A temporary package needs a source of one line and where it came from.', 'Pass npm:<name>, git:<repository>, a URL of a repository or a path, and market, link or agent.');
|
|
56
|
+
}
|
|
57
|
+
const loaded = await this.load(cwd);
|
|
58
|
+
const open = loaded.packages.find(pkg => { var _a; return pkg.source === trimmed || (pkg.origin === 'temporary' && ((_a = pkg.temporary) === null || _a === void 0 ? void 0 : _a.source) === trimmed); });
|
|
59
|
+
if (open) {
|
|
60
|
+
if (open.origin === 'temporary') {
|
|
61
|
+
this.temporary().update(open.root, { used: true });
|
|
62
|
+
}
|
|
63
|
+
return WebExtensionUtil.describe(open);
|
|
64
|
+
}
|
|
65
|
+
const root = RelayShareUtil.is(trimmed)
|
|
66
|
+
? await this.fetchShare(trimmed)
|
|
67
|
+
: TemporaryUtil.isPath(trimmed)
|
|
68
|
+
? resolve(loaded.cwd, TemporaryUtil.expand(trimmed))
|
|
69
|
+
: await this.fetch(loaded.manager, trimmed);
|
|
70
|
+
if (!existsSync(join(root, 'package.json'))) {
|
|
71
|
+
throw TaErrors.invalidArgument(`${trimmed} is not a package: ${root} has no package.json.`, 'Pass the directory of a package, or a source of npm or Git.');
|
|
72
|
+
}
|
|
73
|
+
const record = this.temporary().add(root, trimmed, from);
|
|
74
|
+
const infos = WebExtensionUtil.describe({ root, scope: 'user', origin: 'temporary', source: trimmed, temporary: TemporaryUtil.info(record) });
|
|
75
|
+
if (infos.length === 0) {
|
|
76
|
+
await this.dropTemporary(record, loaded.manager);
|
|
77
|
+
throw TaErrors.invalidArgument(`${trimmed} has no web extension, so it cannot open without installing.`, 'Install it instead: what it has runs in conversations.');
|
|
78
|
+
}
|
|
79
|
+
return infos;
|
|
80
|
+
}
|
|
81
|
+
async updateTemporary(cwd, id, change) {
|
|
82
|
+
const pkg = await this.findTemporary(cwd, id);
|
|
83
|
+
this.temporary().update(pkg.root, { used: (change === null || change === void 0 ? void 0 : change.used) === true, kept: typeof (change === null || change === void 0 ? void 0 : change.kept) === 'boolean' ? change.kept : undefined });
|
|
84
|
+
}
|
|
85
|
+
async installTemporary(cwd, id) {
|
|
86
|
+
const pkg = await this.findTemporary(cwd, id);
|
|
87
|
+
const store = this.temporary();
|
|
88
|
+
const record = store.find(candidate => candidate.root === pkg.root);
|
|
89
|
+
if (record && store.owns(record.root)) {
|
|
90
|
+
const target = join(this.agentDir(), 'extensions', basename(record.root));
|
|
91
|
+
if (existsSync(target)) {
|
|
92
|
+
throw TaErrors.invalidArgument(`A package is in ${target} already.`, 'Remove that one first, or rename the directory of this one.');
|
|
93
|
+
}
|
|
94
|
+
mkdirSync(join(this.agentDir(), 'extensions'), { recursive: true });
|
|
95
|
+
renameSync(record.root, target);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const loaded = await this.load(cwd);
|
|
99
|
+
loaded.manager.addSourceToSettings(pkg.source, { local: false });
|
|
100
|
+
await loaded.settings.flush();
|
|
101
|
+
}
|
|
102
|
+
store.forget(pkg.root);
|
|
103
|
+
}
|
|
104
|
+
/** Removes the temporary packages unused for longer than the retention, not kept; how many went. */
|
|
105
|
+
async purgeTemporary(cwd) {
|
|
106
|
+
const expired = this.temporary().expired();
|
|
107
|
+
if (expired.length === 0) {
|
|
108
|
+
return 0;
|
|
109
|
+
}
|
|
110
|
+
const { manager } = await this.load(cwd);
|
|
111
|
+
for (const record of expired) {
|
|
112
|
+
await this.dropTemporary(record, manager).catch(error => console.warn(`Could not remove the temporary package ${record.root}:`, error));
|
|
113
|
+
}
|
|
114
|
+
return expired.length;
|
|
115
|
+
}
|
|
116
|
+
get temporaryRetention() {
|
|
117
|
+
return this.temporary().retentionDays;
|
|
118
|
+
}
|
|
119
|
+
setTemporaryRetention(days) {
|
|
120
|
+
if (!Number.isInteger(days) || days < 0 || days > 3650) {
|
|
121
|
+
throw TaErrors.invalidArgument(`${String(days)} is not a number of days.`, 'Pass a whole number of days from 0 (never) to 3650.');
|
|
122
|
+
}
|
|
123
|
+
this.temporary().retentionDays = days;
|
|
124
|
+
}
|
|
125
|
+
temporary() {
|
|
126
|
+
return new TemporaryStore(this.agentDir());
|
|
127
|
+
}
|
|
128
|
+
async packageOf(cwd, id) {
|
|
129
|
+
const { packages } = await this.load(cwd);
|
|
130
|
+
const pkg = packages.find(candidate => WebExtensionUtil.describePackage(candidate).id === id || WebExtensionUtil.describe(candidate).some(info => info.id === id));
|
|
131
|
+
if (!pkg) {
|
|
132
|
+
throw TaErrors.invalidArgument(`No package has the id ${id}.`, 'listPackages lists the ones there are; the package may have moved or gone.');
|
|
133
|
+
}
|
|
134
|
+
return WebExtensionUtil.describePackage(pkg);
|
|
135
|
+
}
|
|
136
|
+
/** A package another computer shared by a link, put in Ta's own temporary directory (RelayShareUtil). */
|
|
137
|
+
async fetchShare(link) {
|
|
138
|
+
var _a;
|
|
139
|
+
const { share } = RelayShareUtil.parse(link);
|
|
140
|
+
const { data } = await RelayShareUtil.fetch(link);
|
|
141
|
+
const { top, files } = PackageArchive.unpack(data);
|
|
142
|
+
const name = (_a = PackageArchive.nameOf(files)) !== null && _a !== void 0 ? _a : top;
|
|
143
|
+
// The share in the name: two shares of packages of one name do not take each other's place.
|
|
144
|
+
const root = join(this.temporary().directory, `${PackageArchive.directoryName(name)}-${share.slice(0, 8).toLowerCase()}`);
|
|
145
|
+
mkdirSync(this.temporary().directory, { recursive: true });
|
|
146
|
+
PackageArchive.extract(files, root);
|
|
147
|
+
return root;
|
|
148
|
+
}
|
|
149
|
+
async fetch(manager, source) {
|
|
150
|
+
await manager.install(source, { local: false });
|
|
151
|
+
const root = manager.getInstalledPath(source, 'user');
|
|
152
|
+
if (!root) {
|
|
153
|
+
throw TaErrors.invalidArgument(`${source} installed nowhere pi can find.`, 'Check the source: npm:<name>, git:<repository> or a URL of a repository.');
|
|
154
|
+
}
|
|
155
|
+
return root;
|
|
156
|
+
}
|
|
157
|
+
async findTemporary(cwd, id) {
|
|
158
|
+
const { packages } = await this.load(cwd);
|
|
159
|
+
const pkg = packages.find(candidate => candidate.origin === 'temporary' &&
|
|
160
|
+
(WebExtensionUtil.describePackage(candidate).id === id || WebExtensionUtil.describe(candidate).some(info => info.id === id)));
|
|
161
|
+
if (!pkg) {
|
|
162
|
+
throw TaErrors.invalidArgument(`No temporary package has the id ${id}.`, 'listPackages lists the ones there are; it may have been installed, removed or cleared.');
|
|
163
|
+
}
|
|
164
|
+
return pkg;
|
|
165
|
+
}
|
|
166
|
+
/** Ta's own directory is deleted, what pi fetched removed, a path of the user's only forgotten. */
|
|
167
|
+
async dropTemporary(record, manager) {
|
|
168
|
+
const store = this.temporary();
|
|
169
|
+
if (store.owns(record.root)) {
|
|
170
|
+
rmSync(record.root, { recursive: true, force: true });
|
|
171
|
+
}
|
|
172
|
+
else if (!TemporaryUtil.isPath(record.source)) {
|
|
173
|
+
await manager.remove(record.source, { local: false });
|
|
174
|
+
}
|
|
175
|
+
store.forget(record.root);
|
|
41
176
|
}
|
|
42
177
|
async removePackage(cwd, id) {
|
|
43
178
|
const { packages, manager } = await this.load(cwd);
|
|
@@ -66,7 +201,7 @@ let WebExtensionCatalogImpl = class WebExtensionCatalogImpl {
|
|
|
66
201
|
return;
|
|
67
202
|
}
|
|
68
203
|
const loaded = await this.load(cwd);
|
|
69
|
-
const pkg = loaded.packages.find(candidate => candidate.origin !== 'builtin' && WebExtensionUtil.describePackage(candidate).id === nameOrId);
|
|
204
|
+
const pkg = loaded.packages.find(candidate => candidate.origin !== 'builtin' && candidate.origin !== 'temporary' && WebExtensionUtil.describePackage(candidate).id === nameOrId);
|
|
70
205
|
if (!pkg) {
|
|
71
206
|
throw TaErrors.invalidArgument(`${nameOrId} is neither a package that comes with Ta nor the id of a package.`, 'Pass the name of a built-in package, or an id of listPackages.');
|
|
72
207
|
}
|
|
@@ -84,6 +219,11 @@ let WebExtensionCatalogImpl = class WebExtensionCatalogImpl {
|
|
|
84
219
|
const { name } = WebExtensionUtil.describePackage(pkg);
|
|
85
220
|
throw TaErrors.invalidArgument(`${name} comes with Ta and cannot be removed.`, 'Turn it off with setPackageEnabled instead.');
|
|
86
221
|
}
|
|
222
|
+
if (pkg.origin === 'temporary') {
|
|
223
|
+
const record = this.temporary().find(candidate => candidate.root === pkg.root);
|
|
224
|
+
await this.dropTemporary(record !== null && record !== void 0 ? record : { root: pkg.root, source: pkg.source, from: 'agent', openedAt: 0, usedAt: 0, kept: false }, manager);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
87
227
|
if (pkg.origin === 'directory') {
|
|
88
228
|
rmSync(pkg.root, { recursive: true, force: true });
|
|
89
229
|
return;
|
|
@@ -139,16 +279,27 @@ let WebExtensionCatalogImpl = class WebExtensionCatalogImpl {
|
|
|
139
279
|
}
|
|
140
280
|
}
|
|
141
281
|
}
|
|
282
|
+
// Opened without installing: unless installed meanwhile, as a package of the setting.
|
|
283
|
+
const store = new TemporaryStore(agentDir);
|
|
284
|
+
for (const record of store.list()) {
|
|
285
|
+
const installed = found.get(record.root);
|
|
286
|
+
if (installed && installed.origin !== 'temporary') {
|
|
287
|
+
store.forget(record.root);
|
|
288
|
+
}
|
|
289
|
+
else if (!installed) {
|
|
290
|
+
found.set(record.root, { root: record.root, scope: 'user', origin: 'temporary', source: record.source, temporary: TemporaryUtil.info(record) });
|
|
291
|
+
}
|
|
292
|
+
}
|
|
142
293
|
// The others are on while pi loads any of theirs, or, with only a web extension, unless turned off in ta.json.
|
|
143
294
|
const resolved = await this.resolve(manager);
|
|
144
295
|
const webOff = TaPackages.disabledWeb(agentDir);
|
|
145
296
|
for (const pkg of found.values()) {
|
|
146
|
-
if (pkg.origin !== 'builtin') {
|
|
297
|
+
if (pkg.origin !== 'builtin' && pkg.origin !== 'temporary') {
|
|
147
298
|
const resources = PackageSwitch.resourcesOf(resolved, pkg.root);
|
|
148
299
|
pkg.enabled = resources.length > 0 ? PackageSwitch.isEnabled(resources) : !webOff.has(pkg.root);
|
|
149
300
|
}
|
|
150
301
|
}
|
|
151
|
-
return { packages: [...found.values()], manager, settings: settingsManager, trusted, projectDir: join(cwd, sdk.CONFIG_DIR_NAME) };
|
|
302
|
+
return { packages: [...found.values()], manager, settings: settingsManager, trusted, projectDir: join(cwd, sdk.CONFIG_DIR_NAME), cwd };
|
|
152
303
|
}
|
|
153
304
|
};
|
|
154
305
|
__decorate([
|
|
@@ -163,4 +314,21 @@ WebExtensionCatalogImpl = __decorate([
|
|
|
163
314
|
Component(WebExtensionCatalog)
|
|
164
315
|
], WebExtensionCatalogImpl);
|
|
165
316
|
export { WebExtensionCatalogImpl };
|
|
317
|
+
export var TemporaryUtil;
|
|
318
|
+
(function (TemporaryUtil) {
|
|
319
|
+
/** A source of the file system, as pi takes it: not `npm:`, `git:` or a URL. */
|
|
320
|
+
function isPath(source) {
|
|
321
|
+
return !/^(npm:|git:|[a-z][a-z0-9+.-]*:\/\/|git@)/i.test(source) && (isAbsolute(source) || /^(\.{1,2}[\\/]|~[\\/]?|[a-zA-Z]:[\\/])/.test(source));
|
|
322
|
+
}
|
|
323
|
+
TemporaryUtil.isPath = isPath;
|
|
324
|
+
function expand(path) {
|
|
325
|
+
var _a, _b;
|
|
326
|
+
return path.startsWith('~') ? join((_b = (_a = process.env.HOME) !== null && _a !== void 0 ? _a : process.env.USERPROFILE) !== null && _b !== void 0 ? _b : '', path.slice(1)) : path;
|
|
327
|
+
}
|
|
328
|
+
TemporaryUtil.expand = expand;
|
|
329
|
+
function info({ source, from, openedAt, usedAt, kept }) {
|
|
330
|
+
return { source, from, openedAt, usedAt, kept };
|
|
331
|
+
}
|
|
332
|
+
TemporaryUtil.info = info;
|
|
333
|
+
})(TemporaryUtil || (TemporaryUtil = {}));
|
|
166
334
|
//# sourceMappingURL=web-extension-catalog.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TaPackageInfo, TaWebExtensionInfo } from '@celljs/ta-protocol';
|
|
1
|
+
import type { TaPackageInfo, TaTemporaryInfo, TaWebExtensionInfo } from '@celljs/ta-protocol';
|
|
2
2
|
/** Where a package is and how pi came to load it. */
|
|
3
3
|
export interface WebExtensionPackage {
|
|
4
4
|
root: string;
|
|
@@ -7,6 +7,8 @@ export interface WebExtensionPackage {
|
|
|
7
7
|
source: string;
|
|
8
8
|
/** False for a built-in package that is turned off; default true. */
|
|
9
9
|
enabled?: boolean;
|
|
10
|
+
/** For a temporary package (TemporaryStore). */
|
|
11
|
+
temporary?: TaTemporaryInfo;
|
|
10
12
|
}
|
|
11
13
|
/** Reads the web extensions of packages: `pi.web` of their `package.json`, else the modules in `web/`. */
|
|
12
14
|
export declare namespace WebExtensionUtil {
|
|
@@ -18,4 +20,6 @@ export declare namespace WebExtensionUtil {
|
|
|
18
20
|
function hash(code: string): string;
|
|
19
21
|
/** The subdirectories of an `extensions/` directory that are packages, as pi finds them there. */
|
|
20
22
|
function packageDirectories(directory: string): string[];
|
|
23
|
+
/** The name of the package in its package.json, else of its directory. */
|
|
24
|
+
function nameOf(root: string): string;
|
|
21
25
|
}
|
|
@@ -11,23 +11,28 @@ export var WebExtensionUtil;
|
|
|
11
11
|
(function (WebExtensionUtil) {
|
|
12
12
|
function describe(pkg) {
|
|
13
13
|
const manifest = readManifest(pkg.root);
|
|
14
|
-
return entries(pkg.root, manifest).map(entry => { var _a, _b; return ({
|
|
14
|
+
return entries(pkg.root, manifest).map(entry => { var _a, _b; var _c, _d; return ({
|
|
15
15
|
id: id(pkg, entry),
|
|
16
|
-
name: (
|
|
16
|
+
name: (_c = manifest === null || manifest === void 0 ? void 0 : manifest.name) !== null && _c !== void 0 ? _c : basename(pkg.root),
|
|
17
17
|
description: manifest === null || manifest === void 0 ? void 0 : manifest.description,
|
|
18
18
|
version: manifest === null || manifest === void 0 ? void 0 : manifest.version,
|
|
19
19
|
scope: pkg.scope,
|
|
20
20
|
origin: pkg.origin,
|
|
21
|
-
enabled: (
|
|
21
|
+
enabled: (_d = pkg.enabled) !== null && _d !== void 0 ? _d : true,
|
|
22
22
|
source: pkg.source,
|
|
23
23
|
entry,
|
|
24
24
|
hash: hash(readFileSync(join(pkg.root, entry), 'utf8')),
|
|
25
|
+
title: text((_a = manifest === null || manifest === void 0 ? void 0 : manifest.pi) === null || _a === void 0 ? void 0 : _a.title),
|
|
26
|
+
icon: icon(manifest),
|
|
27
|
+
activation: pkg.temporary || ((_b = manifest === null || manifest === void 0 ? void 0 : manifest.pi) === null || _b === void 0 ? void 0 : _b.webActivation) === 'open' ? 'open' : 'startup',
|
|
28
|
+
...(pkg.temporary ? { temporary: pkg.temporary } : {}),
|
|
25
29
|
}); });
|
|
26
30
|
}
|
|
27
31
|
WebExtensionUtil.describe = describe;
|
|
28
32
|
/** The package itself, whatever it holds. */
|
|
29
33
|
function describePackage(pkg) {
|
|
30
34
|
var _a, _b;
|
|
35
|
+
var _c, _d;
|
|
31
36
|
const manifest = readManifest(pkg.root);
|
|
32
37
|
const resources = PI_RESOURCES.filter(type => holds(pkg.root, manifest, type));
|
|
33
38
|
if (entries(pkg.root, manifest).length > 0) {
|
|
@@ -35,15 +40,19 @@ export var WebExtensionUtil;
|
|
|
35
40
|
}
|
|
36
41
|
return {
|
|
37
42
|
id: createHash('sha256').update(`${pkg.scope}\0${pkg.root}`).digest('hex').slice(0, 16),
|
|
38
|
-
name: (
|
|
43
|
+
name: (_c = manifest === null || manifest === void 0 ? void 0 : manifest.name) !== null && _c !== void 0 ? _c : basename(pkg.root),
|
|
44
|
+
title: text((_a = manifest === null || manifest === void 0 ? void 0 : manifest.pi) === null || _a === void 0 ? void 0 : _a.title),
|
|
45
|
+
summary: text((_b = manifest === null || manifest === void 0 ? void 0 : manifest.pi) === null || _b === void 0 ? void 0 : _b.summary),
|
|
46
|
+
icon: icon(manifest),
|
|
39
47
|
description: manifest === null || manifest === void 0 ? void 0 : manifest.description,
|
|
40
48
|
version: manifest === null || manifest === void 0 ? void 0 : manifest.version,
|
|
41
49
|
scope: pkg.scope,
|
|
42
50
|
origin: pkg.origin,
|
|
43
|
-
enabled: (
|
|
51
|
+
enabled: (_d = pkg.enabled) !== null && _d !== void 0 ? _d : true,
|
|
44
52
|
source: pkg.source,
|
|
45
53
|
root: pkg.root,
|
|
46
54
|
resources,
|
|
55
|
+
...(pkg.temporary ? { temporary: pkg.temporary } : {}),
|
|
47
56
|
};
|
|
48
57
|
}
|
|
49
58
|
WebExtensionUtil.describePackage = describePackage;
|
|
@@ -77,6 +86,17 @@ export var WebExtensionUtil;
|
|
|
77
86
|
function id(pkg, entry) {
|
|
78
87
|
return createHash('sha256').update(`${pkg.scope}\0${pkg.root}\0${entry}`).digest('hex').slice(0, 16);
|
|
79
88
|
}
|
|
89
|
+
function icon(manifest) {
|
|
90
|
+
var _a;
|
|
91
|
+
return typeof ((_a = manifest === null || manifest === void 0 ? void 0 : manifest.pi) === null || _a === void 0 ? void 0 : _a.icon) === 'string' && manifest.pi.icon !== '' ? manifest.pi.icon : undefined;
|
|
92
|
+
}
|
|
93
|
+
/** The name of the package in its package.json, else of its directory. */
|
|
94
|
+
function nameOf(root) {
|
|
95
|
+
var _a;
|
|
96
|
+
var _b;
|
|
97
|
+
return (_b = (_a = readManifest(root)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : basename(root);
|
|
98
|
+
}
|
|
99
|
+
WebExtensionUtil.nameOf = nameOf;
|
|
80
100
|
function readManifest(root) {
|
|
81
101
|
try {
|
|
82
102
|
return JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
|
|
@@ -85,6 +105,17 @@ export var WebExtensionUtil;
|
|
|
85
105
|
return undefined;
|
|
86
106
|
}
|
|
87
107
|
}
|
|
108
|
+
/** `pi.title` or `pi.summary`: a string, or strings by language; what is neither is left out. */
|
|
109
|
+
function text(value) {
|
|
110
|
+
if (typeof value === 'string') {
|
|
111
|
+
return value.trim() || undefined;
|
|
112
|
+
}
|
|
113
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
const languages = Object.entries(value).filter((entry) => typeof entry[1] === 'string' && entry[1].trim() !== '');
|
|
117
|
+
return languages.length > 0 ? Object.fromEntries(languages) : undefined;
|
|
118
|
+
}
|
|
88
119
|
/** As pi finds them: what `pi` of package.json declares, else the directory of that name. */
|
|
89
120
|
function holds(root, manifest, type) {
|
|
90
121
|
if (manifest === null || manifest === void 0 ? void 0 : manifest.pi) {
|