@celljs/ta 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 +42 -3
- package/README.md +41 -2
- package/bin/ta.mjs +1 -1
- package/dist/cli.mjs +611 -22
- package/dist/gateway.mjs +2812 -0
- package/dist/pi/CHANGELOG.md +51 -0
- package/dist/pi/package.json +1 -1
- package/dist/pi/packages/ta-agents/README.en.md +68 -0
- package/dist/pi/packages/ta-agents/README.md +68 -0
- package/dist/pi/packages/ta-agents/extension/index.mjs +1756 -0
- package/dist/pi/packages/ta-agents/lib/acp-agent.d.ts +52 -0
- package/dist/pi/packages/ta-agents/lib/acp-agent.js +218 -0
- package/dist/pi/packages/ta-agents/lib/acp-protocol.d.ts +153 -0
- package/dist/pi/packages/ta-agents/lib/acp-protocol.js +45 -0
- package/dist/pi/packages/ta-agents/lib/agent-bindings.d.ts +45 -0
- package/dist/pi/packages/ta-agents/lib/agent-bindings.js +135 -0
- package/dist/pi/packages/ta-agents/lib/agent-catalog.d.ts +50 -0
- package/dist/pi/packages/ta-agents/lib/agent-catalog.js +143 -0
- package/dist/pi/packages/ta-agents/lib/agent-prompt.d.ts +18 -0
- package/dist/pi/packages/ta-agents/lib/agent-prompt.js +86 -0
- package/dist/pi/packages/ta-agents/lib/agent-session.d.ts +71 -0
- package/dist/pi/packages/ta-agents/lib/agent-session.js +220 -0
- package/dist/pi/packages/ta-agents/lib/agent-streamer.d.ts +41 -0
- package/dist/pi/packages/ta-agents/lib/agent-streamer.js +172 -0
- package/dist/pi/packages/ta-agents/lib/agent-tool.d.ts +22 -0
- package/dist/pi/packages/ta-agents/lib/agent-tool.js +88 -0
- package/dist/pi/packages/ta-agents/lib/agent-turn.d.ts +115 -0
- package/dist/pi/packages/ta-agents/lib/agent-turn.js +343 -0
- package/dist/pi/packages/ta-agents/lib/extension.d.ts +26 -0
- package/dist/pi/packages/ta-agents/lib/extension.js +247 -0
- package/dist/pi/packages/ta-agents/lib/json-rpc.d.ts +41 -0
- package/dist/pi/packages/ta-agents/lib/json-rpc.js +145 -0
- package/dist/pi/packages/ta-agents/lib/message-stream.d.ts +31 -0
- package/dist/pi/packages/ta-agents/lib/message-stream.js +134 -0
- package/dist/pi/packages/ta-agents/lib/pi-types.d.ts +20 -0
- package/dist/pi/packages/ta-agents/lib/pi-types.js +3 -0
- package/dist/pi/packages/ta-agents/lib/texts.d.ts +36 -0
- package/dist/pi/packages/ta-agents/lib/texts.js +43 -0
- package/dist/pi/packages/ta-agents/package.json +61 -0
- package/dist/pi/packages/ta-bots/README.en.md +46 -0
- package/dist/pi/packages/ta-bots/README.md +46 -0
- package/dist/pi/packages/ta-bots/extension/index.mjs +629 -0
- package/dist/pi/packages/ta-bots/host/index.mjs +2313 -0
- package/dist/pi/packages/ta-bots/lib/bot-service.d.ts +96 -0
- package/dist/pi/packages/ta-bots/lib/bot-service.js +391 -0
- package/dist/pi/packages/ta-bots/lib/bot-store.d.ts +42 -0
- package/dist/pi/packages/ta-bots/lib/bot-store.js +97 -0
- package/dist/pi/packages/ta-bots/lib/bots-protocol.d.ts +131 -0
- package/dist/pi/packages/ta-bots/lib/bots-protocol.js +46 -0
- package/dist/pi/packages/ta-bots/lib/bots-view.d.ts +7 -0
- package/dist/pi/packages/ta-bots/lib/bots-view.js +84 -0
- package/dist/pi/packages/ta-bots/lib/channel-protocol.d.ts +58 -0
- package/dist/pi/packages/ta-bots/lib/channel-protocol.js +37 -0
- package/dist/pi/packages/ta-bots/lib/composer.d.ts +21 -0
- package/dist/pi/packages/ta-bots/lib/composer.js +104 -0
- package/dist/pi/packages/ta-bots/lib/connect-dialog.d.ts +18 -0
- package/dist/pi/packages/ta-bots/lib/connect-dialog.js +198 -0
- package/dist/pi/packages/ta-bots/lib/extension.d.ts +34 -0
- package/dist/pi/packages/ta-bots/lib/extension.js +207 -0
- package/dist/pi/packages/ta-bots/lib/host.d.ts +8 -0
- package/dist/pi/packages/ta-bots/lib/host.js +15 -0
- package/dist/pi/packages/ta-bots/lib/i18n.d.ts +87 -0
- package/dist/pi/packages/ta-bots/lib/i18n.js +175 -0
- package/dist/pi/packages/ta-bots/lib/index.d.ts +9 -0
- package/dist/pi/packages/ta-bots/lib/index.js +40 -0
- package/dist/pi/packages/ta-bots/lib/login-book.d.ts +17 -0
- package/dist/pi/packages/ta-bots/lib/login-book.js +55 -0
- package/dist/pi/packages/ta-bots/lib/media-crypto.d.ts +19 -0
- package/dist/pi/packages/ta-bots/lib/media-crypto.js +70 -0
- package/dist/pi/packages/ta-bots/lib/message.d.ts +13 -0
- package/dist/pi/packages/ta-bots/lib/message.js +74 -0
- package/dist/pi/packages/ta-bots/lib/page.d.ts +54 -0
- package/dist/pi/packages/ta-bots/lib/page.js +131 -0
- package/dist/pi/packages/ta-bots/lib/pictures.d.ts +3 -0
- package/dist/pi/packages/ta-bots/lib/pictures.js +21 -0
- package/dist/pi/packages/ta-bots/lib/qr-image.d.ts +16 -0
- package/dist/pi/packages/ta-bots/lib/qr-image.js +70 -0
- package/dist/pi/packages/ta-bots/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-bots/lib/react.js +8 -0
- package/dist/pi/packages/ta-bots/lib/server-texts.d.ts +12 -0
- package/dist/pi/packages/ta-bots/lib/server-texts.js +45 -0
- package/dist/pi/packages/ta-bots/lib/session-bridge.d.ts +43 -0
- package/dist/pi/packages/ta-bots/lib/session-bridge.js +118 -0
- package/dist/pi/packages/ta-bots/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-bots/lib/style.js +114 -0
- package/dist/pi/packages/ta-bots/lib/test-fakes.d.ts +37 -0
- package/dist/pi/packages/ta-bots/lib/test-fakes.js +94 -0
- package/dist/pi/packages/ta-bots/lib/text-util.d.ts +16 -0
- package/dist/pi/packages/ta-bots/lib/text-util.js +158 -0
- package/dist/pi/packages/ta-bots/lib/web-socket-client.d.ts +38 -0
- package/dist/pi/packages/ta-bots/lib/web-socket-client.js +213 -0
- package/dist/pi/packages/ta-bots/lib/wecom-channel.d.ts +38 -0
- package/dist/pi/packages/ta-bots/lib/wecom-channel.js +222 -0
- package/dist/pi/packages/ta-bots/lib/wecom-login.d.ts +34 -0
- package/dist/pi/packages/ta-bots/lib/wecom-login.js +84 -0
- package/dist/pi/packages/ta-bots/lib/wecom-socket.d.ts +74 -0
- package/dist/pi/packages/ta-bots/lib/wecom-socket.js +214 -0
- package/dist/pi/packages/ta-bots/lib/weixin-api.d.ts +112 -0
- package/dist/pi/packages/ta-bots/lib/weixin-api.js +171 -0
- package/dist/pi/packages/ta-bots/lib/weixin-channel.d.ts +49 -0
- package/dist/pi/packages/ta-bots/lib/weixin-channel.js +258 -0
- package/dist/pi/packages/ta-bots/lib/weixin-login.d.ts +31 -0
- package/dist/pi/packages/ta-bots/lib/weixin-login.js +110 -0
- package/dist/pi/packages/ta-bots/package.json +55 -0
- package/dist/pi/packages/ta-bots/web/index.js +1241 -0
- package/dist/pi/packages/ta-changes/README.en.md +21 -0
- package/dist/pi/packages/ta-changes/README.md +21 -0
- package/dist/pi/packages/ta-changes/extension/index.mjs +296 -0
- package/dist/pi/packages/ta-changes/host/index.mjs +309 -0
- package/dist/pi/packages/ta-changes/lib/blob-store.d.ts +16 -0
- package/dist/pi/packages/ta-changes/lib/blob-store.js +69 -0
- package/dist/pi/packages/ta-changes/lib/card.d.ts +12 -0
- package/dist/pi/packages/ta-changes/lib/card.js +149 -0
- package/dist/pi/packages/ta-changes/lib/changes-protocol.d.ts +76 -0
- package/dist/pi/packages/ta-changes/lib/changes-protocol.js +20 -0
- package/dist/pi/packages/ta-changes/lib/changes-service.d.ts +20 -0
- package/dist/pi/packages/ta-changes/lib/changes-service.js +70 -0
- package/dist/pi/packages/ta-changes/lib/changes-util.d.ts +21 -0
- package/dist/pi/packages/ta-changes/lib/changes-util.js +44 -0
- package/dist/pi/packages/ta-changes/lib/diff-tab.d.ts +4 -0
- package/dist/pi/packages/ta-changes/lib/diff-tab.js +45 -0
- package/dist/pi/packages/ta-changes/lib/extension.d.ts +21 -0
- package/dist/pi/packages/ta-changes/lib/extension.js +106 -0
- package/dist/pi/packages/ta-changes/lib/host.d.ts +7 -0
- package/dist/pi/packages/ta-changes/lib/host.js +16 -0
- package/dist/pi/packages/ta-changes/lib/i18n.d.ts +30 -0
- package/dist/pi/packages/ta-changes/lib/i18n.js +61 -0
- package/dist/pi/packages/ta-changes/lib/index.d.ts +8 -0
- package/dist/pi/packages/ta-changes/lib/index.js +28 -0
- package/dist/pi/packages/ta-changes/lib/line-diff.d.ts +11 -0
- package/dist/pi/packages/ta-changes/lib/line-diff.js +69 -0
- package/dist/pi/packages/ta-changes/lib/page.d.ts +29 -0
- package/dist/pi/packages/ta-changes/lib/page.js +106 -0
- package/dist/pi/packages/ta-changes/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-changes/lib/react.js +8 -0
- package/dist/pi/packages/ta-changes/lib/recorder.d.ts +25 -0
- package/dist/pi/packages/ta-changes/lib/recorder.js +117 -0
- package/dist/pi/packages/ta-changes/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-changes/lib/style.js +46 -0
- package/dist/pi/packages/ta-changes/package.json +55 -0
- package/dist/pi/packages/ta-changes/web/index.js +463 -0
- package/dist/pi/packages/ta-channels/README.en.md +3 -2
- package/dist/pi/packages/ta-channels/README.md +3 -2
- package/dist/pi/packages/ta-channels/extension/index.mjs +109 -8
- package/dist/pi/packages/ta-channels/host/index.mjs +281 -5
- package/dist/pi/packages/ta-channels/lib/agent-menu.d.ts +2 -0
- package/dist/pi/packages/ta-channels/lib/agent-menu.js +19 -6
- package/dist/pi/packages/ta-channels/lib/channel-menu.d.ts +2 -0
- package/dist/pi/packages/ta-channels/lib/channel-menu.js +15 -12
- package/dist/pi/packages/ta-channels/lib/channels-model.d.ts +10 -0
- package/dist/pi/packages/ta-channels/lib/channels-util.d.ts +10 -0
- package/dist/pi/packages/ta-channels/lib/channels-util.js +29 -2
- package/dist/pi/packages/ta-channels/lib/channels.d.ts +2 -0
- package/dist/pi/packages/ta-channels/lib/channels.js +1 -0
- package/dist/pi/packages/ta-channels/lib/create.js +2 -2
- package/dist/pi/packages/ta-channels/lib/extension.d.ts +5 -0
- package/dist/pi/packages/ta-channels/lib/extension.js +25 -2
- package/dist/pi/packages/ta-channels/lib/i18n.d.ts +40 -9
- package/dist/pi/packages/ta-channels/lib/i18n.js +81 -19
- package/dist/pi/packages/ta-channels/lib/index.d.ts +3 -2
- package/dist/pi/packages/ta-channels/lib/index.js +14 -2
- package/dist/pi/packages/ta-channels/lib/members.js +10 -5
- package/dist/pi/packages/ta-channels/lib/more-menu.d.ts +5 -1
- package/dist/pi/packages/ta-channels/lib/more-menu.js +55 -9
- package/dist/pi/packages/ta-channels/lib/room.d.ts +11 -2
- package/dist/pi/packages/ta-channels/lib/room.js +47 -6
- package/dist/pi/packages/ta-channels/lib/sidebar.d.ts +5 -1
- package/dist/pi/packages/ta-channels/lib/sidebar.js +189 -31
- package/dist/pi/packages/ta-channels/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-channels/lib/style.js +136 -73
- package/dist/pi/packages/ta-channels/lib/tasks.d.ts +48 -0
- package/dist/pi/packages/ta-channels/lib/tasks.js +226 -0
- package/dist/pi/packages/ta-channels/lib/team-ask.d.ts +21 -0
- package/dist/pi/packages/ta-channels/lib/team-ask.js +73 -0
- package/dist/pi/packages/ta-channels/lib/team-tools.d.ts +6 -1
- package/dist/pi/packages/ta-channels/lib/team-tools.js +5 -4
- package/dist/pi/packages/ta-channels/lib/team.d.ts +5 -1
- package/dist/pi/packages/ta-channels/lib/team.js +10 -4
- package/dist/pi/packages/ta-channels/lib/views.d.ts +18 -3
- package/dist/pi/packages/ta-channels/lib/views.js +45 -9
- package/dist/pi/packages/ta-channels/package.json +11 -2
- package/dist/pi/packages/ta-channels/web/index.js +996 -205
- package/dist/pi/packages/ta-computer-use/extension/index.mjs +4 -2
- package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.d.ts +2 -1
- package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.js +9 -3
- package/dist/pi/packages/ta-computer-use/package.json +11 -2
- package/dist/pi/packages/ta-cron/README.en.md +48 -0
- package/dist/pi/packages/ta-cron/README.md +48 -0
- package/dist/pi/packages/ta-cron/extension/index.mjs +856 -0
- package/dist/pi/packages/ta-cron/host/index.mjs +884 -0
- package/dist/pi/packages/ta-cron/lib/commands.d.ts +61 -0
- package/dist/pi/packages/ta-cron/lib/commands.js +250 -0
- package/dist/pi/packages/ta-cron/lib/cron-expression.d.ts +39 -0
- package/dist/pi/packages/ta-cron/lib/cron-expression.js +146 -0
- package/dist/pi/packages/ta-cron/lib/cron-protocol.d.ts +160 -0
- package/dist/pi/packages/ta-cron/lib/cron-protocol.js +38 -0
- package/dist/pi/packages/ta-cron/lib/editor.d.ts +17 -0
- package/dist/pi/packages/ta-cron/lib/editor.js +143 -0
- package/dist/pi/packages/ta-cron/lib/extension.d.ts +27 -0
- package/dist/pi/packages/ta-cron/lib/extension.js +142 -0
- package/dist/pi/packages/ta-cron/lib/form-util.d.ts +39 -0
- package/dist/pi/packages/ta-cron/lib/form-util.js +121 -0
- package/dist/pi/packages/ta-cron/lib/host.d.ts +7 -0
- package/dist/pi/packages/ta-cron/lib/host.js +14 -0
- package/dist/pi/packages/ta-cron/lib/i18n.d.ts +88 -0
- package/dist/pi/packages/ta-cron/lib/i18n.js +173 -0
- package/dist/pi/packages/ta-cron/lib/index.d.ts +8 -0
- package/dist/pi/packages/ta-cron/lib/index.js +48 -0
- package/dist/pi/packages/ta-cron/lib/next-card.d.ts +9 -0
- package/dist/pi/packages/ta-cron/lib/next-card.js +35 -0
- package/dist/pi/packages/ta-cron/lib/notifier.d.ts +6 -0
- package/dist/pi/packages/ta-cron/lib/notifier.js +50 -0
- package/dist/pi/packages/ta-cron/lib/page.d.ts +42 -0
- package/dist/pi/packages/ta-cron/lib/page.js +116 -0
- package/dist/pi/packages/ta-cron/lib/pictures.d.ts +6 -0
- package/dist/pi/packages/ta-cron/lib/pictures.js +46 -0
- package/dist/pi/packages/ta-cron/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-cron/lib/react.js +8 -0
- package/dist/pi/packages/ta-cron/lib/reply.d.ts +6 -0
- package/dist/pi/packages/ta-cron/lib/reply.js +53 -0
- package/dist/pi/packages/ta-cron/lib/schedule-util.d.ts +25 -0
- package/dist/pi/packages/ta-cron/lib/schedule-util.js +223 -0
- package/dist/pi/packages/ta-cron/lib/scheduler.d.ts +78 -0
- package/dist/pi/packages/ta-cron/lib/scheduler.js +329 -0
- package/dist/pi/packages/ta-cron/lib/server-texts.d.ts +7 -0
- package/dist/pi/packages/ta-cron/lib/server-texts.js +24 -0
- package/dist/pi/packages/ta-cron/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-cron/lib/style.js +123 -0
- package/dist/pi/packages/ta-cron/lib/task-store.d.ts +25 -0
- package/dist/pi/packages/ta-cron/lib/task-store.js +60 -0
- package/dist/pi/packages/ta-cron/lib/task-util.d.ts +18 -0
- package/dist/pi/packages/ta-cron/lib/task-util.js +167 -0
- package/dist/pi/packages/ta-cron/lib/tasks-view.d.ts +10 -0
- package/dist/pi/packages/ta-cron/lib/tasks-view.js +204 -0
- package/dist/pi/packages/ta-cron/lib/tool.d.ts +85 -0
- package/dist/pi/packages/ta-cron/lib/tool.js +127 -0
- package/dist/pi/packages/ta-cron/package.json +55 -0
- package/dist/pi/packages/ta-cron/web/index.js +1953 -0
- package/dist/pi/packages/ta-extensions/README.en.md +4 -1
- package/dist/pi/packages/ta-extensions/README.md +4 -1
- package/dist/pi/packages/ta-extensions/host/index.mjs +64 -61
- package/dist/pi/packages/ta-extensions/lib/actions.d.ts +2 -0
- package/dist/pi/packages/ta-extensions/lib/actions.js +9 -1
- package/dist/pi/packages/ta-extensions/lib/host.d.ts +0 -8
- package/dist/pi/packages/ta-extensions/lib/host.js +7 -49
- package/dist/pi/packages/ta-extensions/lib/i18n.d.ts +8 -0
- package/dist/pi/packages/ta-extensions/lib/i18n.js +20 -4
- package/dist/pi/packages/ta-extensions/lib/index.js +2 -0
- package/dist/pi/packages/ta-extensions/lib/market-detail.js +14 -2
- package/dist/pi/packages/ta-extensions/lib/market-style.d.ts +1 -1
- package/dist/pi/packages/ta-extensions/lib/market-style.js +18 -18
- package/dist/pi/packages/ta-extensions/lib/page.js +22 -11
- package/dist/pi/packages/ta-extensions/lib/pictures.d.ts +3 -1
- package/dist/pi/packages/ta-extensions/lib/pictures.js +28 -32
- package/dist/pi/packages/ta-extensions/lib/search.d.ts +10 -0
- package/dist/pi/packages/ta-extensions/lib/search.js +139 -0
- package/dist/pi/packages/ta-extensions/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-extensions/lib/style.js +15 -34
- package/dist/pi/packages/ta-extensions/package.json +12 -2
- package/dist/pi/packages/ta-extensions/skills/ta-package/SKILL.md +12 -7
- package/dist/pi/packages/ta-extensions/web/index.js +488 -120
- package/dist/pi/packages/ta-launcher/README.en.md +15 -0
- package/dist/pi/packages/ta-launcher/README.md +15 -0
- package/dist/pi/packages/ta-launcher/lib/actions.d.ts +31 -0
- package/dist/pi/packages/ta-launcher/lib/actions.js +134 -0
- package/dist/pi/packages/ta-launcher/lib/i18n.d.ts +38 -0
- package/dist/pi/packages/ta-launcher/lib/i18n.js +77 -0
- package/dist/pi/packages/ta-launcher/lib/index.d.ts +8 -0
- package/dist/pi/packages/ta-launcher/lib/index.js +48 -0
- package/dist/pi/packages/ta-launcher/lib/launcher-util.d.ts +19 -0
- package/dist/pi/packages/ta-launcher/lib/launcher-util.js +47 -0
- package/dist/pi/packages/ta-launcher/lib/launcher-view.d.ts +20 -0
- package/dist/pi/packages/ta-launcher/lib/launcher-view.js +99 -0
- package/dist/pi/packages/ta-launcher/lib/mine-store.d.ts +22 -0
- package/dist/pi/packages/ta-launcher/lib/mine-store.js +60 -0
- package/dist/pi/packages/ta-launcher/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-launcher/lib/react.js +8 -0
- package/dist/pi/packages/ta-launcher/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-launcher/lib/style.js +48 -0
- package/dist/pi/packages/ta-launcher/package.json +49 -0
- package/dist/pi/packages/ta-launcher/web/index.js +553 -0
- package/dist/pi/packages/ta-workspace/README.md +6 -6
- package/dist/pi/packages/ta-workspace/README.zh-cn.md +6 -6
- package/dist/pi/packages/ta-workspace/lib/browser-agent.d.ts +36 -0
- package/dist/pi/packages/ta-workspace/lib/browser-agent.js +396 -0
- package/dist/pi/packages/ta-workspace/lib/browser-common.d.ts +48 -0
- package/dist/pi/packages/ta-workspace/lib/browser-common.js +180 -0
- package/dist/pi/packages/ta-workspace/lib/browser-import.d.ts +5 -0
- package/dist/pi/packages/ta-workspace/lib/browser-import.js +97 -0
- package/dist/pi/packages/ta-workspace/lib/browser-webview.d.ts +7 -0
- package/dist/pi/packages/ta-workspace/lib/browser-webview.js +202 -0
- package/dist/pi/packages/ta-workspace/lib/browser.d.ts +1 -7
- package/dist/pi/packages/ta-workspace/lib/browser.js +14 -154
- package/dist/pi/packages/ta-workspace/lib/common.d.ts +8 -5
- package/dist/pi/packages/ta-workspace/lib/common.js +53 -14
- package/dist/pi/packages/ta-workspace/lib/explorer-excluded.d.ts +3 -0
- package/dist/pi/packages/ta-workspace/lib/explorer-excluded.js +39 -0
- package/dist/pi/packages/ta-workspace/lib/explorer-transfer.d.ts +31 -0
- package/dist/pi/packages/ta-workspace/lib/explorer-transfer.js +156 -0
- package/dist/pi/packages/ta-workspace/lib/explorer.js +121 -18
- package/dist/pi/packages/ta-workspace/lib/i18n.d.ts +47 -0
- package/dist/pi/packages/ta-workspace/lib/i18n.js +106 -12
- package/dist/pi/packages/ta-workspace/lib/index.js +7 -1
- package/dist/pi/packages/ta-workspace/lib/open-files.js +1 -1
- package/dist/pi/packages/ta-workspace/lib/preview.js +6 -2
- package/dist/pi/packages/ta-workspace/lib/scm.js +4 -4
- package/dist/pi/packages/ta-workspace/lib/search.js +1 -1
- package/dist/pi/packages/ta-workspace/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-workspace/lib/style.js +130 -56
- package/dist/pi/packages/ta-workspace/lib/terminal.d.ts +25 -3
- package/dist/pi/packages/ta-workspace/lib/terminal.js +327 -119
- package/dist/pi/packages/ta-workspace/lib/util/browser-snapshot.d.ts +52 -0
- package/dist/pi/packages/ta-workspace/lib/util/browser-snapshot.js +207 -0
- package/dist/pi/packages/ta-workspace/lib/util/terminal.d.ts +25 -0
- package/dist/pi/packages/ta-workspace/lib/util/terminal.js +55 -0
- package/dist/pi/packages/ta-workspace/lib/util/upload.d.ts +34 -0
- package/dist/pi/packages/ta-workspace/lib/util/upload.js +109 -0
- package/dist/pi/packages/ta-workspace/lib/util/workspace.d.ts +19 -2
- package/dist/pi/packages/ta-workspace/lib/util/workspace.js +50 -3
- package/dist/pi/packages/ta-workspace/lib/util/zip.d.ts +20 -0
- package/dist/pi/packages/ta-workspace/lib/util/zip.js +128 -0
- package/dist/pi/packages/ta-workspace/lib/workspace-client.d.ts +12 -1
- package/dist/pi/packages/ta-workspace/lib/workspace-client.js +101 -0
- package/dist/pi/packages/ta-workspace/package.json +11 -2
- package/dist/pi/packages/ta-workspace/web/index.js +2695 -799
- package/dist/public/assets/{abnfDiagram-S7VZAUFO-D1ZeYB9c.js → abnfDiagram-S7VZAUFO-C1tb6dM5.js} +1 -1
- package/dist/public/assets/{architecture-WOLXFQ4H-RV_x_iFj.js → architecture-WOLXFQ4H-DN1Va8BF.js} +1 -1
- package/dist/public/assets/{architectureDiagram-YGSQEFNW-BGOmzcpZ.js → architectureDiagram-YGSQEFNW-BmK2SYtQ.js} +1 -1
- package/dist/public/assets/{blockDiagram-APKKGZFW-BkoflIym.js → blockDiagram-APKKGZFW-DvLrLzTm.js} +1 -1
- package/dist/public/assets/{browser-Cl9_lr0X.js → browser-DAv3ly6M.js} +1 -1
- package/dist/public/assets/{c4Diagram-KJ2TOQU5-CfrQTIEs.js → c4Diagram-KJ2TOQU5-CrQlWwrG.js} +1 -1
- package/dist/public/assets/{chunk-6MUBBAK2-C-VxnXsG.js → chunk-6MUBBAK2-CHKMsuY_.js} +1 -1
- package/dist/public/assets/{chunk-AXFCVDMN-aqbxPiaN.js → chunk-AXFCVDMN-CWJ7Np6s.js} +1 -1
- package/dist/public/assets/{chunk-BG4553SI-DDgvFLBP.js → chunk-BG4553SI-3v5XbQGM.js} +1 -1
- package/dist/public/assets/{chunk-DQASFODM-CItpjfW5.js → chunk-DQASFODM-2CC-yiCz.js} +1 -1
- package/dist/public/assets/{chunk-HFQBQIA3-BATYGV1I.js → chunk-HFQBQIA3-D2hzQPAy.js} +1 -1
- package/dist/public/assets/{chunk-KQLB2F66-BVAqVjgq.js → chunk-KQLB2F66-SifAZs2r.js} +1 -1
- package/dist/public/assets/{chunk-KS47KZWR-Bk0_a-eE.js → chunk-KS47KZWR-BP0C0VCC.js} +1 -1
- package/dist/public/assets/{chunk-LEVMRMFU-DsFG_U8r.js → chunk-LEVMRMFU-B1f5vw5b.js} +1 -1
- package/dist/public/assets/{chunk-M57EVK23-BgeE81Y7.js → chunk-M57EVK23-B2MCJt7Y.js} +1 -1
- package/dist/public/assets/{chunk-OY52VR5R-2Rp6C2LJ.js → chunk-OY52VR5R-cDpZJMk4.js} +1 -1
- package/dist/public/assets/{chunk-QB3YPZ4I-BhcIp-Bl.js → chunk-QB3YPZ4I-BE0we2xc.js} +1 -1
- package/dist/public/assets/{chunk-R3KSYZAL-i9n2AYPG.js → chunk-R3KSYZAL-D9wOfqqH.js} +1 -1
- package/dist/public/assets/{chunk-STOXU5M4-DOSqSu65.js → chunk-STOXU5M4-BIaVsc0K.js} +1 -1
- package/dist/public/assets/{chunk-TU62E6Q5-BDA8bjy3.js → chunk-TU62E6Q5-BZc0OZEM.js} +1 -1
- package/dist/public/assets/{chunk-X4PVCEUW-Cs-r9l_d.js → chunk-X4PVCEUW-Bngfwwzm.js} +1 -1
- package/dist/public/assets/{chunk-XXDRQBXY-DEcanQFC.js → chunk-XXDRQBXY-C5FQ6XHK.js} +1 -1
- package/dist/public/assets/{classDiagram-v2-L25IHNXF-BS8XxKRR.js → classDiagram-v2-L25IHNXF-_om54nmt.js} +1 -1
- package/dist/public/assets/{cose-bilkent-JH36ORCC--RPleOJ8.js → cose-bilkent-JH36ORCC-Dwpeee_6.js} +1 -1
- package/dist/public/assets/cynefin-EF2NZ3EQ-CW_93VVD.js +1 -0
- package/dist/public/assets/{cynefinDiagram-L36ESFBY-DZHM2oEU.js → cynefinDiagram-L36ESFBY-DP5_y9Dq.js} +1 -1
- package/dist/public/assets/{d3-selection-D2iIEb1P.js → d3-selection-DFiMlEmn.js} +1 -1
- package/dist/public/assets/{dagre-SPEB5RXH-h_G5ukMB.js → dagre-SPEB5RXH-DYwsk6gk.js} +1 -1
- package/dist/public/assets/{diagram-3B7GL73J-BnThWj9P.js → diagram-3B7GL73J-Dq_nT3AZ.js} +1 -1
- package/dist/public/assets/{diagram-DNEMPZML-DHCMo8sZ.js → diagram-DNEMPZML-ChURW6y9.js} +1 -1
- package/dist/public/assets/{diagram-L3MUGCDN-DxJZnIKT.js → diagram-L3MUGCDN-CgVp4Rto.js} +1 -1
- package/dist/public/assets/{diagram-LA4NIPWU-Cn0SGxqL.js → diagram-LA4NIPWU-vrqLMDby.js} +1 -1
- package/dist/public/assets/{diagram-MHCOC4E2-BafBOkBk.js → diagram-MHCOC4E2-lvfOr5ij.js} +1 -1
- package/dist/public/assets/{diagram-XPFHEONP-D7UnEMcU.js → diagram-XPFHEONP-oQ18TeVp.js} +1 -1
- package/dist/public/assets/{dist-CN9JBoER.js → dist-BOxxmveI.js} +1 -1
- package/dist/public/assets/{ebnfDiagram-UZSYDL2S-Us1rkKwp.js → ebnfDiagram-UZSYDL2S-C7_tlZCS.js} +1 -1
- package/dist/public/assets/{editor.api-S_CuXudU.js → editor.api-CoZ8MEuz.js} +1 -1
- package/dist/public/assets/{elk-XV6XMXQE-Czvqrn49.js → elk-XV6XMXQE-Dkt5-ikg.js} +1 -1
- package/dist/public/assets/{erDiagram-EYBAPDEH-C0g3K15f.js → erDiagram-EYBAPDEH-27kh3zlx.js} +1 -1
- package/dist/public/assets/{eventmodeling-K75KTNOO-DIcU7mQ5.js → eventmodeling-K75KTNOO-CxVEejjN.js} +1 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-BRowRdve.js +1 -0
- package/dist/public/assets/{freemarker2-CkAEBjHO.js → freemarker2-D6CwPIXh.js} +1 -1
- package/dist/public/assets/{ganttDiagram-23REXITY-CIkKvihz.js → ganttDiagram-23REXITY-C-amlwpX.js} +1 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-BGmojXlx.js +1 -0
- package/dist/public/assets/{gitGraphDiagram-STJD7YCW-BxM3589j.js → gitGraphDiagram-STJD7YCW-DKhzI0Xz.js} +1 -1
- package/dist/public/assets/{handlebars-CPBNiVZ2.js → handlebars-mxNr68Gm.js} +1 -1
- package/dist/public/assets/{html-CJBVALoy.js → html-Bze6s9R9.js} +1 -1
- package/dist/public/assets/{index-CBMmE3BQ.js → index-BhQUc9PU.js} +2 -2
- package/dist/public/assets/info-OHQRW6UA-CRRVgGj2.js +1 -0
- package/dist/public/assets/{infoDiagram-KBXO4MBG-BIcStK_t.js → infoDiagram-KBXO4MBG-WHuWjEDO.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-M35NCXHK-CpV2hKA6.js → ishikawaDiagram-M35NCXHK-DFHUwD0J.js} +1 -1
- package/dist/public/assets/{javascript-dv6GQsa3.js → javascript-4NMPu7y1.js} +1 -1
- package/dist/public/assets/{journeyDiagram-OPLOXDXO-B_vnmdId.js → journeyDiagram-OPLOXDXO-C7gV6zEr.js} +1 -1
- package/dist/public/assets/{jsonMode-DG_orhvz.js → jsonMode-B1JEHPMp.js} +1 -1
- package/dist/public/assets/{kanban-definition-BZKZHSQY-q5uWw99H.js → kanban-definition-BZKZHSQY-DlRu_d2Q.js} +1 -1
- package/dist/public/assets/{liquid-CD-LM2Kh.js → liquid-B7sIf4NX.js} +1 -1
- package/dist/public/assets/{mdx-C9mfI8up.js → mdx-CAN0qez6.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-DNe1duhT.js → mermaid-parser.core-BGmotBhf.js} +3 -3
- package/dist/public/assets/{mermaid.core-B1AcqJgl.js → mermaid.core-Cl6SS3cM.js} +4 -4
- package/dist/public/assets/{mindmap-definition-I2QAS2VK-CwYG3Fl3.js → mindmap-definition-I2QAS2VK-DiQ8Feqr.js} +1 -1
- package/dist/public/assets/module-1nDbf1AK.js +1761 -0
- package/dist/public/assets/module-BkKfSTDV.js +1 -0
- package/dist/public/assets/{monaco-C0ktZo3r.js → monaco-CwCjTWAO.js} +3 -3
- package/dist/public/assets/packet-JDAUHWVQ-DUlqTCWQ.js +1 -0
- package/dist/public/assets/{pegDiagram-FD4XPPHP-DxtA4QDS.js → pegDiagram-FD4XPPHP-XhCpv6BX.js} +1 -1
- package/dist/public/assets/pie-XZMESJXO-2RgP4ScO.js +1 -0
- package/dist/public/assets/{pieDiagram-J4AKIIQI-CfcIi0Vn.js → pieDiagram-J4AKIIQI-DUVzuXUd.js} +1 -1
- package/dist/public/assets/{python-DCA1j2QE.js → python-DsoF66Sp.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-XTYBLID2-BxkJdurF.js → quadrantDiagram-XTYBLID2-Ddobf0z0.js} +1 -1
- package/dist/public/assets/radar-ABXABTNO-Dap8k-yH.js +1 -0
- package/dist/public/assets/railroad-I3PHUGI6-Ds10NBze.js +1 -0
- package/dist/public/assets/{railroad-abnf-LNEFI6M7--H3g5ywg.js → railroad-abnf-LNEFI6M7-DkrNo-Gf.js} +1 -1
- package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-C2LAUFu6.js → railroad-ebnf-DWYD2UWJ-DaB7gY8P.js} +1 -1
- package/dist/public/assets/{railroad-peg-JR7BVNR7-Kq_ZXQMl.js → railroad-peg-JR7BVNR7-D_QG87QV.js} +1 -1
- package/dist/public/assets/{railroadDiagram-MRQ6NCDL-i4xIvHJV.js → railroadDiagram-MRQ6NCDL-x-nUoBjv.js} +1 -1
- package/dist/public/assets/{razor-CEeNaFx5.js → razor-DSrcJyQe.js} +1 -1
- package/dist/public/assets/{requirementDiagram-Y7LWUY3S-CYNXjuJm.js → requirementDiagram-Y7LWUY3S-kNNcbsty.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-WGJFYUXA-CRQiHcW6.js → sankeyDiagram-WGJFYUXA-ClC12Odk.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-5NDRBG5M-BSDVFsi2.js → sequenceDiagram-5NDRBG5M-DDQITP2g.js} +1 -1
- package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-uyUAaysl.js → stateDiagram-v2-FJ4FJNEA-N1t_36oh.js} +1 -1
- package/dist/public/assets/{swimlanes-UMQ2AFYF-DdEjQumY.js → swimlanes-UMQ2AFYF-DSt9fFYE.js} +1 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-BHAN4SQO.js +8 -0
- package/dist/public/assets/{timeline-definition-SEUHKTQE-DZl-TXXh.js → timeline-definition-SEUHKTQE-CfymOw_s.js} +1 -1
- package/dist/public/assets/treeView-D4JQ5SDB-f1hLUBjI.js +1 -0
- package/dist/public/assets/treemap-SAJKECNS-_NPRpuUC.js +1 -0
- package/dist/public/assets/{typescript-DrF8YGbQ.js → typescript-J7rF-zX8.js} +1 -1
- package/dist/public/assets/{usecaseDiagram-AFA6YXN4-DkG3gLrp.js → usecaseDiagram-AFA6YXN4-CK_mRc2_.js} +1 -1
- package/dist/public/assets/{vennDiagram-NNMJR3RB-B_lj8x7-.js → vennDiagram-NNMJR3RB-DW8xR6IJ.js} +1 -1
- package/dist/public/assets/wardley-7MLQ67FV-CLBqtefx.js +1 -0
- package/dist/public/assets/{wardleyDiagram-S7YFUSEH-B1VFrC5a.js → wardleyDiagram-S7YFUSEH-Css55Zq5.js} +1 -1
- package/dist/public/assets/{xml-DfL-Brke.js → xml-CJeviG_a.js} +1 -1
- package/dist/public/assets/xterm-BrP-ENHg.css +1 -0
- package/dist/public/assets/xterm-wtHqjrNn.js +85 -0
- package/dist/public/assets/{xychartDiagram-GGNKY7IX-CM2CpXu9.js → xychartDiagram-GGNKY7IX-BnhK9cFS.js} +1 -1
- package/dist/public/assets/{yaml-CpmxRjjF.js → yaml-Gw3uo6rF.js} +1 -1
- package/dist/public/index.html +35 -6
- package/dist/public/launch.svg +49 -0
- package/dist/serve/index.mjs +8862 -5822
- package/package.json +24 -18
- package/dist/pi/packages/ta-channels/lib/agent-menu.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/agent-menu.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/channel-menu.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/channel-menu.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/channels-model.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/channels-model.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/channels-util.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/channels-util.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/channels.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/channels.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/create.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/create.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/extension.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/extension.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/faces.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/faces.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/host.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/host.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/i18n.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/i18n.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/index.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/index.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/members.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/members.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/more-menu.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/more-menu.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/react.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/react.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/room.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/room.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/sidebar.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/sidebar.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/style.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/style.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/team-tools.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/team-tools.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/team.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/team.js.map +0 -1
- package/dist/pi/packages/ta-channels/lib/views.d.ts.map +0 -1
- package/dist/pi/packages/ta-channels/lib/views.js.map +0 -1
- package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.d.ts.map +0 -1
- package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.js.map +0 -1
- package/dist/pi/packages/ta-computer-use/lib/cua-driver-daemon.d.ts.map +0 -1
- package/dist/pi/packages/ta-computer-use/lib/cua-driver-daemon.js.map +0 -1
- package/dist/pi/packages/ta-computer-use/lib/cua-driver.d.ts.map +0 -1
- package/dist/pi/packages/ta-computer-use/lib/cua-driver.js.map +0 -1
- package/dist/pi/packages/ta-computer-use/lib/extension.d.ts.map +0 -1
- package/dist/pi/packages/ta-computer-use/lib/extension.js.map +0 -1
- package/dist/pi/packages/ta-computer-use/lib/pi-types.d.ts.map +0 -1
- package/dist/pi/packages/ta-computer-use/lib/pi-types.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/actions.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/actions.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/archive.d.ts +0 -30
- package/dist/pi/packages/ta-extensions/lib/archive.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/archive.js +0 -213
- package/dist/pi/packages/ta-extensions/lib/archive.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/context.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/context.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/extensions-util.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/extensions-util.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/host.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/host.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/i18n.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/i18n.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/import-dialog.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/import-dialog.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/index.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/index.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market-detail.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market-detail.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market-parts.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market-parts.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market-store.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market-store.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market-style.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market-style.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market-util.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market-util.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market-view.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market-view.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/market.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/page.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/page.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/pictures.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/pictures.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/react.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/react.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/signal.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/signal.js.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/style.d.ts.map +0 -1
- package/dist/pi/packages/ta-extensions/lib/style.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/browser.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/browser.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/common.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/common.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/editors.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/editors.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/explorer.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/explorer.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/file-icon.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/file-icon.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/host.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/host.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/i18n.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/i18n.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/index.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/index.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/open-files.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/open-files.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/preview.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/preview.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/react.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/react.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/scm.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/scm.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/search.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/search.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/style.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/style.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/terminal.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/terminal.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/ansi.d.ts +0 -72
- package/dist/pi/packages/ta-workspace/lib/util/ansi.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/ansi.js +0 -434
- package/dist/pi/packages/ta-workspace/lib/util/ansi.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/file-icon.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/file-icon.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/git.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/git.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/keys.d.ts +0 -14
- package/dist/pi/packages/ta-workspace/lib/util/keys.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/keys.js +0 -52
- package/dist/pi/packages/ta-workspace/lib/util/keys.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/preview.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/preview.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/search.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/search.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/seti-font.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/seti-font.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/seti.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/seti.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/workspace.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/util/workspace.js.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/workspace-client.d.ts.map +0 -1
- package/dist/pi/packages/ta-workspace/lib/workspace-client.js.map +0 -1
- package/dist/pi/packages/ta-workspace/scripts/seti.ts +0 -173
- package/dist/public/assets/cynefin-EF2NZ3EQ-CXQC7Jwi.js +0 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-D5Z_jzJ0.js +0 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-CvdLb7m6.js +0 -1
- package/dist/public/assets/info-OHQRW6UA-BLs8wjUC.js +0 -1
- package/dist/public/assets/module-BLLqRvli.js +0 -1099
- package/dist/public/assets/module-BZPCnGxA.js +0 -1
- package/dist/public/assets/packet-JDAUHWVQ-jwWITUaQ.js +0 -1
- package/dist/public/assets/pie-XZMESJXO-CeTVZZgy.js +0 -1
- package/dist/public/assets/radar-ABXABTNO-BGI8J8LU.js +0 -1
- package/dist/public/assets/railroad-I3PHUGI6-CFkpx3Pr.js +0 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-BJsun6CT.js +0 -8
- package/dist/public/assets/treeView-D4JQ5SDB-CL1mG6td.js +0 -1
- package/dist/public/assets/treemap-SAJKECNS-Bk3Z1uEC.js +0 -1
- package/dist/public/assets/wardley-7MLQ67FV-1E8i3qpD.js +0 -1
|
@@ -0,0 +1,884 @@
|
|
|
1
|
+
// web-src/cron-protocol.ts
|
|
2
|
+
var NAME = "@celljs/ta-cron";
|
|
3
|
+
var RUN_MARK = "<ta-cron-run>";
|
|
4
|
+
var Keys;
|
|
5
|
+
((Keys) => {
|
|
6
|
+
Keys.TASKS = "tasks";
|
|
7
|
+
Keys.LATEST = "latest";
|
|
8
|
+
function runs(taskId) {
|
|
9
|
+
return `runs/${taskId}`;
|
|
10
|
+
}
|
|
11
|
+
Keys.runs = runs;
|
|
12
|
+
})(Keys ||= {});
|
|
13
|
+
var Limits;
|
|
14
|
+
((Limits) => {
|
|
15
|
+
Limits.RUNS_KEPT = 20;
|
|
16
|
+
Limits.SUMMARY_MAX = 4000;
|
|
17
|
+
Limits.MIN_INTERVAL_MS = 60000;
|
|
18
|
+
Limits.RUN_TIMEOUT_MS = 30 * 60000;
|
|
19
|
+
Limits.GRACE_MS = 5 * 60000;
|
|
20
|
+
Limits.PARALLEL_RUNS = 3;
|
|
21
|
+
})(Limits ||= {});
|
|
22
|
+
|
|
23
|
+
// web-src/cron-expression.ts
|
|
24
|
+
var FIELDS = [
|
|
25
|
+
{ name: "minute", min: 0, max: 59 },
|
|
26
|
+
{ name: "hour", min: 0, max: 23 },
|
|
27
|
+
{ name: "day of month", min: 1, max: 31 },
|
|
28
|
+
{ name: "month", min: 1, max: 12, names: ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"] },
|
|
29
|
+
{ name: "day of week", min: 0, max: 7, names: ["sun", "mon", "tue", "wed", "thu", "fri", "sat"] }
|
|
30
|
+
];
|
|
31
|
+
var NICKNAMES = {
|
|
32
|
+
"@yearly": "0 0 1 1 *",
|
|
33
|
+
"@annually": "0 0 1 1 *",
|
|
34
|
+
"@monthly": "0 0 1 * *",
|
|
35
|
+
"@weekly": "0 0 * * 0",
|
|
36
|
+
"@daily": "0 0 * * *",
|
|
37
|
+
"@midnight": "0 0 * * *",
|
|
38
|
+
"@hourly": "0 * * * *"
|
|
39
|
+
};
|
|
40
|
+
var MAX_STEPS = 200000;
|
|
41
|
+
|
|
42
|
+
class CronExpression {
|
|
43
|
+
source;
|
|
44
|
+
minutes;
|
|
45
|
+
hours;
|
|
46
|
+
days;
|
|
47
|
+
months;
|
|
48
|
+
weekdays;
|
|
49
|
+
anyDay;
|
|
50
|
+
anyWeekday;
|
|
51
|
+
constructor(source, minutes, hours, days, months, weekdays, anyDay, anyWeekday) {
|
|
52
|
+
this.source = source;
|
|
53
|
+
this.minutes = minutes;
|
|
54
|
+
this.hours = hours;
|
|
55
|
+
this.days = days;
|
|
56
|
+
this.months = months;
|
|
57
|
+
this.weekdays = weekdays;
|
|
58
|
+
this.anyDay = anyDay;
|
|
59
|
+
this.anyWeekday = anyWeekday;
|
|
60
|
+
}
|
|
61
|
+
static parse(text) {
|
|
62
|
+
const source = text.trim().replace(/\s+/g, " ");
|
|
63
|
+
const expanded = NICKNAMES[source.toLowerCase()] ?? source;
|
|
64
|
+
const parts = expanded.split(" ");
|
|
65
|
+
if (parts.length !== 5) {
|
|
66
|
+
throw new Error(`A cron expression has five fields (minute hour day month weekday), or is one of ${Object.keys(NICKNAMES).join(", ")}: ${JSON.stringify(text)} has ${parts.length}.`);
|
|
67
|
+
}
|
|
68
|
+
const sets = parts.map((part, index) => CronExpression.field(part, FIELDS[index]));
|
|
69
|
+
const weekdays = sets[4];
|
|
70
|
+
if (weekdays.delete(7)) {
|
|
71
|
+
weekdays.add(0);
|
|
72
|
+
}
|
|
73
|
+
return new CronExpression(source, sets[0], sets[1], sets[2], sets[3], weekdays, parts[2] === "*", parts[4] === "*");
|
|
74
|
+
}
|
|
75
|
+
static isValid(text) {
|
|
76
|
+
try {
|
|
77
|
+
CronExpression.parse(text);
|
|
78
|
+
return true;
|
|
79
|
+
} catch {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
static field(text, field) {
|
|
84
|
+
const values = new Set;
|
|
85
|
+
for (const item of text.toLowerCase().split(",")) {
|
|
86
|
+
const [range, stepText, extra] = item.split("/");
|
|
87
|
+
const step = stepText === undefined ? 1 : Number(stepText);
|
|
88
|
+
if (extra !== undefined || !Number.isInteger(step) || step < 1) {
|
|
89
|
+
throw new Error(`${JSON.stringify(item)} is not a valid ${field.name}: a step is a whole number from 1.`);
|
|
90
|
+
}
|
|
91
|
+
let from;
|
|
92
|
+
let to;
|
|
93
|
+
if (range === "*") {
|
|
94
|
+
from = field.min;
|
|
95
|
+
to = field.max;
|
|
96
|
+
} else {
|
|
97
|
+
const [first, last, more] = range.split("-");
|
|
98
|
+
if (more !== undefined) {
|
|
99
|
+
throw new Error(`${JSON.stringify(item)} is not a valid ${field.name}.`);
|
|
100
|
+
}
|
|
101
|
+
from = CronExpression.value(first, field);
|
|
102
|
+
to = last === undefined ? stepText === undefined ? from : field.max : CronExpression.value(last, field);
|
|
103
|
+
}
|
|
104
|
+
if (from > to) {
|
|
105
|
+
throw new Error(`${JSON.stringify(item)} is not a valid ${field.name}: the range goes backwards.`);
|
|
106
|
+
}
|
|
107
|
+
for (let value = from;value <= to; value += step) {
|
|
108
|
+
values.add(value);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return values;
|
|
112
|
+
}
|
|
113
|
+
static value(text, field) {
|
|
114
|
+
const named = field.names?.indexOf(text) ?? -1;
|
|
115
|
+
const value = named >= 0 ? named + (field.min === 1 ? 1 : 0) : /^\d+$/.test(text) ? Number(text) : Number.NaN;
|
|
116
|
+
if (!(value >= field.min && value <= field.max)) {
|
|
117
|
+
throw new Error(`${JSON.stringify(text)} is not a valid ${field.name}: from ${field.min} to ${field.max}.`);
|
|
118
|
+
}
|
|
119
|
+
return value;
|
|
120
|
+
}
|
|
121
|
+
next(after) {
|
|
122
|
+
const time = new Date(after.getTime());
|
|
123
|
+
time.setSeconds(0, 0);
|
|
124
|
+
time.setMinutes(time.getMinutes() + 1);
|
|
125
|
+
for (let step = 0;step < MAX_STEPS; step++) {
|
|
126
|
+
if (!this.months.has(time.getMonth() + 1)) {
|
|
127
|
+
time.setMonth(time.getMonth() + 1, 1);
|
|
128
|
+
time.setHours(0, 0, 0, 0);
|
|
129
|
+
} else if (!this.matchesDay(time)) {
|
|
130
|
+
time.setDate(time.getDate() + 1);
|
|
131
|
+
time.setHours(0, 0, 0, 0);
|
|
132
|
+
} else if (!this.hours.has(time.getHours())) {
|
|
133
|
+
time.setHours(time.getHours() + 1, 0, 0, 0);
|
|
134
|
+
} else if (!this.minutes.has(time.getMinutes())) {
|
|
135
|
+
time.setMinutes(time.getMinutes() + 1, 0, 0);
|
|
136
|
+
} else {
|
|
137
|
+
return time;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
matchesDay(time) {
|
|
143
|
+
const day = this.days.has(time.getDate());
|
|
144
|
+
const weekday = this.weekdays.has(time.getDay());
|
|
145
|
+
if (this.anyDay || this.anyWeekday) {
|
|
146
|
+
return day && weekday;
|
|
147
|
+
}
|
|
148
|
+
return day || weekday;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// web-src/schedule-util.ts
|
|
153
|
+
var THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
154
|
+
var NOTIFY_LEVELS = ["always", "error", "never"];
|
|
155
|
+
var UNITS = {
|
|
156
|
+
s: 1000,
|
|
157
|
+
sec: 1000,
|
|
158
|
+
m: 60000,
|
|
159
|
+
min: 60000,
|
|
160
|
+
h: 3600000,
|
|
161
|
+
hr: 3600000,
|
|
162
|
+
d: 86400000,
|
|
163
|
+
w: 7 * 86400000
|
|
164
|
+
};
|
|
165
|
+
var Duration;
|
|
166
|
+
((Duration) => {
|
|
167
|
+
const PART = /(\d+)\s*(sec|min|hr|s|m|h|d|w)/gy;
|
|
168
|
+
function parse(text) {
|
|
169
|
+
const source = text.trim().toLowerCase();
|
|
170
|
+
if (!source) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
PART.lastIndex = 0;
|
|
174
|
+
let total = 0;
|
|
175
|
+
let match;
|
|
176
|
+
let end = 0;
|
|
177
|
+
while (match = PART.exec(source)) {
|
|
178
|
+
total += Number(match[1]) * UNITS[match[2]];
|
|
179
|
+
end = PART.lastIndex;
|
|
180
|
+
}
|
|
181
|
+
return end === source.length && total > 0 ? total : undefined;
|
|
182
|
+
}
|
|
183
|
+
Duration.parse = parse;
|
|
184
|
+
function format(ms) {
|
|
185
|
+
const parts = [];
|
|
186
|
+
let rest = Math.round(ms / 1000);
|
|
187
|
+
for (const [unit, size] of [
|
|
188
|
+
["d", 86400],
|
|
189
|
+
["h", 3600],
|
|
190
|
+
["m", 60],
|
|
191
|
+
["s", 1]
|
|
192
|
+
]) {
|
|
193
|
+
if (rest >= size) {
|
|
194
|
+
parts.push(`${Math.floor(rest / size)}${unit}`);
|
|
195
|
+
rest %= size;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return parts.join("") || "0s";
|
|
199
|
+
}
|
|
200
|
+
Duration.format = format;
|
|
201
|
+
})(Duration ||= {});
|
|
202
|
+
var EN_DAYS = ["Sundays", "Mondays", "Tuesdays", "Wednesdays", "Thursdays", "Fridays", "Saturdays"];
|
|
203
|
+
var ZH_DAYS = ["日", "一", "二", "三", "四", "五", "六"];
|
|
204
|
+
var WORDS = {
|
|
205
|
+
en: {
|
|
206
|
+
once: (time) => `Once, ${time}`,
|
|
207
|
+
every: (amount, unit) => amount === 1 ? `Every ${unit}` : `Every ${amount} ${unit}s`,
|
|
208
|
+
everyRaw: (duration) => `Every ${duration}`,
|
|
209
|
+
daily: (time) => `Daily at ${time}`,
|
|
210
|
+
weekdays: (time) => `Weekdays at ${time}`,
|
|
211
|
+
weekly: (day, time) => `${EN_DAYS[day]} at ${time}`,
|
|
212
|
+
monthly: (day, time) => `Monthly on day ${day} at ${time}`,
|
|
213
|
+
hourly: (minute) => minute === 0 ? "Hourly" : `Hourly at :${pad(minute)}`,
|
|
214
|
+
cron: (expression) => `Cron ${expression}`
|
|
215
|
+
},
|
|
216
|
+
zh: {
|
|
217
|
+
once: (time) => `${time} 运行一次`,
|
|
218
|
+
every: (amount, unit) => `每 ${amount === 1 ? "" : `${amount} `}${{ minute: "分钟", hour: "小时", day: "天" }[unit]}`.replace("每 天", "每天"),
|
|
219
|
+
everyRaw: (duration) => `每 ${duration}`,
|
|
220
|
+
daily: (time) => `每天 ${time}`,
|
|
221
|
+
weekdays: (time) => `工作日 ${time}`,
|
|
222
|
+
weekly: (day, time) => `每周${ZH_DAYS[day]} ${time}`,
|
|
223
|
+
monthly: (day, time) => `每月 ${day} 日 ${time}`,
|
|
224
|
+
hourly: (minute) => minute === 0 ? "每小时" : `每小时第 ${minute} 分`,
|
|
225
|
+
cron: (expression) => `cron ${expression}`
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
function pad(value) {
|
|
229
|
+
return String(value).padStart(2, "0");
|
|
230
|
+
}
|
|
231
|
+
var ScheduleUtil;
|
|
232
|
+
((ScheduleUtil) => {
|
|
233
|
+
function check(value) {
|
|
234
|
+
const schedule = value ?? {};
|
|
235
|
+
switch (schedule.kind) {
|
|
236
|
+
case "once": {
|
|
237
|
+
const at = new Date(String(schedule.at ?? ""));
|
|
238
|
+
if (typeof schedule.at !== "string" || Number.isNaN(at.getTime())) {
|
|
239
|
+
throw new Error("A task that runs once needs `at`, a time such as 2026-11-12T09:00 (local time) or an ISO time.");
|
|
240
|
+
}
|
|
241
|
+
return { kind: "once", at: at.toISOString() };
|
|
242
|
+
}
|
|
243
|
+
case "interval": {
|
|
244
|
+
const every = typeof schedule.every === "string" ? schedule.every.trim() : "";
|
|
245
|
+
const ms = Duration.parse(every);
|
|
246
|
+
if (ms === undefined) {
|
|
247
|
+
throw new Error("An interval needs `every`, a duration such as 30m, 2h or 1d.");
|
|
248
|
+
}
|
|
249
|
+
if (ms < Limits.MIN_INTERVAL_MS) {
|
|
250
|
+
throw new Error(`An interval is at least 1m; ${every} is shorter.`);
|
|
251
|
+
}
|
|
252
|
+
return { kind: "interval", every: Duration.format(ms) };
|
|
253
|
+
}
|
|
254
|
+
case "cron": {
|
|
255
|
+
const expression = typeof schedule.expression === "string" ? schedule.expression : "";
|
|
256
|
+
return { kind: "cron", expression: CronExpression.parse(expression).source };
|
|
257
|
+
}
|
|
258
|
+
default:
|
|
259
|
+
throw new Error('A schedule is { kind: "once", at }, { kind: "interval", every } or { kind: "cron", expression }.');
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
ScheduleUtil.check = check;
|
|
263
|
+
function next(schedule, now) {
|
|
264
|
+
switch (schedule.kind) {
|
|
265
|
+
case "once": {
|
|
266
|
+
const at = new Date(schedule.at);
|
|
267
|
+
return at.getTime() > now.getTime() ? at : undefined;
|
|
268
|
+
}
|
|
269
|
+
case "interval":
|
|
270
|
+
return new Date(now.getTime() + (Duration.parse(schedule.every) ?? Limits.MIN_INTERVAL_MS));
|
|
271
|
+
case "cron":
|
|
272
|
+
return CronExpression.parse(schedule.expression).next(now);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
ScheduleUtil.next = next;
|
|
276
|
+
function repeats(schedule) {
|
|
277
|
+
return schedule.kind !== "once";
|
|
278
|
+
}
|
|
279
|
+
ScheduleUtil.repeats = repeats;
|
|
280
|
+
function notifyLevel(task) {
|
|
281
|
+
return task.notify ?? (repeats(task.schedule) ? "error" : "always");
|
|
282
|
+
}
|
|
283
|
+
ScheduleUtil.notifyLevel = notifyLevel;
|
|
284
|
+
function shouldNotify(level, failed) {
|
|
285
|
+
return level === "always" || level === "error" && failed;
|
|
286
|
+
}
|
|
287
|
+
ScheduleUtil.shouldNotify = shouldNotify;
|
|
288
|
+
function clock(time, now = new Date) {
|
|
289
|
+
const day = `${time.getMonth() + 1}/${time.getDate()}`;
|
|
290
|
+
const year = time.getFullYear() === now.getFullYear() ? "" : `${time.getFullYear()}/`;
|
|
291
|
+
return `${year}${day} ${pad(time.getHours())}:${pad(time.getMinutes())}`;
|
|
292
|
+
}
|
|
293
|
+
ScheduleUtil.clock = clock;
|
|
294
|
+
function describe(schedule, language, now = new Date) {
|
|
295
|
+
const words = WORDS[language.startsWith("zh") ? "zh" : "en"];
|
|
296
|
+
switch (schedule.kind) {
|
|
297
|
+
case "once":
|
|
298
|
+
return words.once(clock(new Date(schedule.at), now));
|
|
299
|
+
case "interval":
|
|
300
|
+
return describeInterval(schedule.every, words);
|
|
301
|
+
case "cron":
|
|
302
|
+
return describeCron(schedule.expression, words);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
ScheduleUtil.describe = describe;
|
|
306
|
+
function describeInterval(every, words) {
|
|
307
|
+
const ms = Duration.parse(every) ?? 0;
|
|
308
|
+
for (const [unit, size] of [
|
|
309
|
+
["day", 86400000],
|
|
310
|
+
["hour", 3600000],
|
|
311
|
+
["minute", 60000]
|
|
312
|
+
]) {
|
|
313
|
+
if (ms >= size && ms % size === 0) {
|
|
314
|
+
return words.every(ms / size, unit);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return words.everyRaw(every);
|
|
318
|
+
}
|
|
319
|
+
function describeCron(expression, words) {
|
|
320
|
+
const fields = (NICKNAMES[expression.toLowerCase()] ?? expression).split(" ");
|
|
321
|
+
const [minute, hour, day, month, weekday] = fields;
|
|
322
|
+
const number = (text) => /^\d+$/.test(text) ? Number(text) : undefined;
|
|
323
|
+
const m = number(minute);
|
|
324
|
+
const h = number(hour);
|
|
325
|
+
const time = m !== undefined && h !== undefined ? `${pad(h)}:${pad(m)}` : undefined;
|
|
326
|
+
if (month === "*") {
|
|
327
|
+
if (time && day === "*" && weekday === "*") {
|
|
328
|
+
return words.daily(time);
|
|
329
|
+
}
|
|
330
|
+
if (time && day === "*" && weekday === "1-5") {
|
|
331
|
+
return words.weekdays(time);
|
|
332
|
+
}
|
|
333
|
+
const d = number(weekday);
|
|
334
|
+
if (time && day === "*" && d !== undefined && d <= 7) {
|
|
335
|
+
return words.weekly(d % 7, time);
|
|
336
|
+
}
|
|
337
|
+
const date = number(day);
|
|
338
|
+
if (time && date !== undefined && weekday === "*") {
|
|
339
|
+
return words.monthly(date, time);
|
|
340
|
+
}
|
|
341
|
+
if (m !== undefined && hour === "*" && day === "*" && weekday === "*") {
|
|
342
|
+
return words.hourly(m);
|
|
343
|
+
}
|
|
344
|
+
const everyMinutes = /^\*\/(\d+)$/.exec(minute);
|
|
345
|
+
if (everyMinutes && hour === "*" && day === "*" && weekday === "*") {
|
|
346
|
+
return words.every(Number(everyMinutes[1]), "minute");
|
|
347
|
+
}
|
|
348
|
+
const everyHours = /^\*\/(\d+)$/.exec(hour);
|
|
349
|
+
if (m === 0 && everyHours && day === "*" && weekday === "*") {
|
|
350
|
+
return words.every(Number(everyHours[1]), "hour");
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return words.cron(expression);
|
|
354
|
+
}
|
|
355
|
+
})(ScheduleUtil ||= {});
|
|
356
|
+
|
|
357
|
+
// web-src/task-store.ts
|
|
358
|
+
class TaskStore {
|
|
359
|
+
host;
|
|
360
|
+
writing = Promise.resolve();
|
|
361
|
+
constructor(host) {
|
|
362
|
+
this.host = host;
|
|
363
|
+
}
|
|
364
|
+
async tasks() {
|
|
365
|
+
const value = await this.host.getExtensionData(NAME, Keys.TASKS);
|
|
366
|
+
return Array.isArray(value) ? value.filter(TaskStore.isTask) : [];
|
|
367
|
+
}
|
|
368
|
+
saveTasks(tasks) {
|
|
369
|
+
const copy = tasks.map((task) => ({ ...task }));
|
|
370
|
+
return this.queue(() => this.host.setExtensionData(NAME, Keys.TASKS, copy));
|
|
371
|
+
}
|
|
372
|
+
async runs(taskId) {
|
|
373
|
+
await this.writing.catch(() => {
|
|
374
|
+
return;
|
|
375
|
+
});
|
|
376
|
+
const value = await this.host.getExtensionData(NAME, Keys.runs(taskId));
|
|
377
|
+
return Array.isArray(value) ? value : [];
|
|
378
|
+
}
|
|
379
|
+
saveRun(run) {
|
|
380
|
+
const copy = { ...run };
|
|
381
|
+
return this.queue(async () => {
|
|
382
|
+
const value = await this.host.getExtensionData(NAME, Keys.runs(run.taskId));
|
|
383
|
+
const runs = Array.isArray(value) ? value : [];
|
|
384
|
+
const index = runs.findIndex((other) => other.id === run.id);
|
|
385
|
+
const next = index >= 0 ? runs.map((other) => other.id === run.id ? copy : other) : [copy, ...runs];
|
|
386
|
+
await this.host.setExtensionData(NAME, Keys.runs(run.taskId), next.slice(0, Limits.RUNS_KEPT));
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
removeRuns(taskId) {
|
|
390
|
+
return this.queue(() => this.host.setExtensionData(NAME, Keys.runs(taskId), null));
|
|
391
|
+
}
|
|
392
|
+
finished(finished) {
|
|
393
|
+
return this.queue(() => this.host.setExtensionData(NAME, Keys.LATEST, finished));
|
|
394
|
+
}
|
|
395
|
+
async flush() {
|
|
396
|
+
await this.writing.catch(() => {
|
|
397
|
+
return;
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
queue(write) {
|
|
401
|
+
const next = this.writing.catch(() => {
|
|
402
|
+
return;
|
|
403
|
+
}).then(write);
|
|
404
|
+
this.writing = next;
|
|
405
|
+
return next;
|
|
406
|
+
}
|
|
407
|
+
static isTask(value) {
|
|
408
|
+
const task = value;
|
|
409
|
+
return typeof task?.id === "string" && typeof task.prompt === "string" && typeof task.schedule === "object" && typeof task.cwd === "string";
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// web-src/task-util.ts
|
|
414
|
+
var PROMPT_MAX = 20000;
|
|
415
|
+
var NAME_MAX = 80;
|
|
416
|
+
var PREFIX_MIN = 4;
|
|
417
|
+
var TaskUtil;
|
|
418
|
+
((TaskUtil) => {
|
|
419
|
+
function newId(prefix) {
|
|
420
|
+
const bytes = new Uint8Array(4);
|
|
421
|
+
crypto.getRandomValues(bytes);
|
|
422
|
+
return `${prefix}_${Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
423
|
+
}
|
|
424
|
+
TaskUtil.newId = newId;
|
|
425
|
+
function create(input, cwd, now) {
|
|
426
|
+
const prompt = checkPrompt(input?.prompt);
|
|
427
|
+
const schedule = ScheduleUtil.check(input.schedule);
|
|
428
|
+
const at = now.toISOString();
|
|
429
|
+
const task = {
|
|
430
|
+
id: newId("task"),
|
|
431
|
+
name: checkName(input.name) ?? defaultName(prompt),
|
|
432
|
+
prompt,
|
|
433
|
+
schedule,
|
|
434
|
+
cwd: checkCwd(input.cwd) ?? cwd,
|
|
435
|
+
enabled: input.enabled !== false,
|
|
436
|
+
runCount: 0,
|
|
437
|
+
failCount: 0,
|
|
438
|
+
createdAt: at,
|
|
439
|
+
updatedAt: at
|
|
440
|
+
};
|
|
441
|
+
setOptional(task, input);
|
|
442
|
+
return arm(task, now);
|
|
443
|
+
}
|
|
444
|
+
TaskUtil.create = create;
|
|
445
|
+
function patch(task, patch2, now) {
|
|
446
|
+
const next = { ...task, updatedAt: now.toISOString() };
|
|
447
|
+
if (patch2.prompt !== undefined) {
|
|
448
|
+
next.prompt = checkPrompt(patch2.prompt);
|
|
449
|
+
}
|
|
450
|
+
if (patch2.name !== undefined) {
|
|
451
|
+
next.name = checkName(patch2.name) ?? defaultName(next.prompt);
|
|
452
|
+
}
|
|
453
|
+
if (patch2.cwd !== undefined) {
|
|
454
|
+
next.cwd = checkCwd(patch2.cwd) ?? task.cwd;
|
|
455
|
+
}
|
|
456
|
+
setOptional(next, patch2);
|
|
457
|
+
if (patch2.enabled !== undefined) {
|
|
458
|
+
next.enabled = patch2.enabled === true;
|
|
459
|
+
}
|
|
460
|
+
if (patch2.schedule !== undefined) {
|
|
461
|
+
next.schedule = ScheduleUtil.check(patch2.schedule);
|
|
462
|
+
}
|
|
463
|
+
const rearm = patch2.schedule !== undefined || next.enabled && !task.enabled;
|
|
464
|
+
return rearm ? arm(next, now) : next;
|
|
465
|
+
}
|
|
466
|
+
TaskUtil.patch = patch;
|
|
467
|
+
function arm(task, now) {
|
|
468
|
+
if (!task.enabled) {
|
|
469
|
+
return task;
|
|
470
|
+
}
|
|
471
|
+
const next = ScheduleUtil.next(task.schedule, now);
|
|
472
|
+
if (!next) {
|
|
473
|
+
throw new Error(task.schedule.kind === "once" ? `The time of ${task.name} (${task.schedule.at}) has passed: give it a time to come.` : `The rule of ${task.name} never comes round: check the cron expression.`);
|
|
474
|
+
}
|
|
475
|
+
return { ...task, nextRunAt: next.toISOString() };
|
|
476
|
+
}
|
|
477
|
+
TaskUtil.arm = arm;
|
|
478
|
+
function find(tasks, ref) {
|
|
479
|
+
const text = typeof ref === "string" ? ref.trim() : "";
|
|
480
|
+
const found = tasks.find((task) => task.id === text) ?? tasks.find((task) => task.name === text) ?? (text.length >= PREFIX_MIN ? only(tasks.filter((task) => task.id.startsWith(text))) : undefined);
|
|
481
|
+
if (!found) {
|
|
482
|
+
const known = tasks.length ? tasks.map((task) => `${task.id} (${task.name})`).join(", ") : "none yet";
|
|
483
|
+
throw new Error(`No task is ${JSON.stringify(text)}. The tasks: ${known}.`);
|
|
484
|
+
}
|
|
485
|
+
return found;
|
|
486
|
+
}
|
|
487
|
+
TaskUtil.find = find;
|
|
488
|
+
function systemPrompt(task, now) {
|
|
489
|
+
return [
|
|
490
|
+
RUN_MARK,
|
|
491
|
+
`This conversation is a scheduled run of the task "${task.name}" (${ScheduleUtil.describe(task.schedule, "en", now)}), started by the Ta service at ${now.toISOString()}.`,
|
|
492
|
+
"Nobody watches it while it runs: do the work without asking the user anything, and end with a short summary of what you found or did, which the user reads first.",
|
|
493
|
+
"</ta-cron-run>"
|
|
494
|
+
].join(`
|
|
495
|
+
`);
|
|
496
|
+
}
|
|
497
|
+
TaskUtil.systemPrompt = systemPrompt;
|
|
498
|
+
function only(tasks) {
|
|
499
|
+
return tasks.length === 1 ? tasks[0] : undefined;
|
|
500
|
+
}
|
|
501
|
+
function setOptional(task, input) {
|
|
502
|
+
if (input.model !== undefined) {
|
|
503
|
+
task.model = checkModel(input.model);
|
|
504
|
+
}
|
|
505
|
+
if (input.thinking !== undefined) {
|
|
506
|
+
task.thinking = checkThinking(input.thinking);
|
|
507
|
+
}
|
|
508
|
+
if (input.notify !== undefined) {
|
|
509
|
+
task.notify = checkNotify(input.notify);
|
|
510
|
+
}
|
|
511
|
+
for (const key of ["model", "thinking", "notify"]) {
|
|
512
|
+
if (task[key] === undefined) {
|
|
513
|
+
delete task[key];
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
function checkPrompt(value) {
|
|
518
|
+
const prompt = typeof value === "string" ? value.trim() : "";
|
|
519
|
+
if (!prompt) {
|
|
520
|
+
throw new Error("A task needs a prompt: what Ta should do each time it runs.");
|
|
521
|
+
}
|
|
522
|
+
if (prompt.length > PROMPT_MAX) {
|
|
523
|
+
throw new Error(`A prompt is at most ${PROMPT_MAX} characters; keep long instructions in a file and name it.`);
|
|
524
|
+
}
|
|
525
|
+
return prompt;
|
|
526
|
+
}
|
|
527
|
+
function checkName(value) {
|
|
528
|
+
const name = typeof value === "string" ? value.trim() : "";
|
|
529
|
+
return name ? name.slice(0, NAME_MAX) : undefined;
|
|
530
|
+
}
|
|
531
|
+
function defaultName(prompt) {
|
|
532
|
+
const line = prompt.split(`
|
|
533
|
+
`)[0].trim();
|
|
534
|
+
return line.length > 40 ? `${line.slice(0, 39)}…` : line;
|
|
535
|
+
}
|
|
536
|
+
function checkCwd(value) {
|
|
537
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
538
|
+
}
|
|
539
|
+
function checkModel(value) {
|
|
540
|
+
const model = typeof value === "string" ? value.trim() : "";
|
|
541
|
+
return model || undefined;
|
|
542
|
+
}
|
|
543
|
+
function checkThinking(value) {
|
|
544
|
+
const level = typeof value === "string" ? value.trim() : "";
|
|
545
|
+
if (level && !THINKING_LEVELS.includes(level)) {
|
|
546
|
+
throw new Error(`A thinking level is one of ${THINKING_LEVELS.join(", ")}; not ${JSON.stringify(level)}.`);
|
|
547
|
+
}
|
|
548
|
+
return level || undefined;
|
|
549
|
+
}
|
|
550
|
+
function checkNotify(value) {
|
|
551
|
+
if (value === "" || value === null) {
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
if (!NOTIFY_LEVELS.includes(value)) {
|
|
555
|
+
throw new Error(`notify is one of ${NOTIFY_LEVELS.join(", ")}; not ${JSON.stringify(value)}.`);
|
|
556
|
+
}
|
|
557
|
+
return value;
|
|
558
|
+
}
|
|
559
|
+
function missed(task, now) {
|
|
560
|
+
return task.schedule.kind === "once" && !!task.nextRunAt && now.getTime() - new Date(task.nextRunAt).getTime() > Limits.GRACE_MS;
|
|
561
|
+
}
|
|
562
|
+
TaskUtil.missed = missed;
|
|
563
|
+
})(TaskUtil ||= {});
|
|
564
|
+
|
|
565
|
+
// web-src/scheduler.ts
|
|
566
|
+
class CronScheduler {
|
|
567
|
+
host;
|
|
568
|
+
tasks = [];
|
|
569
|
+
store;
|
|
570
|
+
options;
|
|
571
|
+
active = new Map;
|
|
572
|
+
waiting = [];
|
|
573
|
+
working = 0;
|
|
574
|
+
lingering = new Set;
|
|
575
|
+
timer;
|
|
576
|
+
ticking = false;
|
|
577
|
+
disposed = false;
|
|
578
|
+
constructor(host, options = {}) {
|
|
579
|
+
this.host = host;
|
|
580
|
+
this.store = new TaskStore(host);
|
|
581
|
+
this.options = { now: () => new Date, tickMs: 60000, pollMs: 1000, timeoutMs: Limits.RUN_TIMEOUT_MS, parallel: Limits.PARALLEL_RUNS, ...options };
|
|
582
|
+
}
|
|
583
|
+
async start() {
|
|
584
|
+
this.tasks = await this.store.tasks();
|
|
585
|
+
const now = this.options.now();
|
|
586
|
+
for (const task of this.tasks) {
|
|
587
|
+
if (task.lastStatus === "running") {
|
|
588
|
+
await this.reclaim(task, now);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
for (const task of [...this.tasks]) {
|
|
592
|
+
if (task.enabled && TaskUtil.missed(task, now)) {
|
|
593
|
+
await this.miss(task, now);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
await this.store.saveTasks(this.tasks);
|
|
597
|
+
this.arm();
|
|
598
|
+
}
|
|
599
|
+
async dispose() {
|
|
600
|
+
this.disposed = true;
|
|
601
|
+
clearTimeout(this.timer);
|
|
602
|
+
await this.store.flush();
|
|
603
|
+
}
|
|
604
|
+
async list() {
|
|
605
|
+
return this.tasks.map((task) => ({ ...task }));
|
|
606
|
+
}
|
|
607
|
+
async get(ref) {
|
|
608
|
+
return { ...TaskUtil.find(this.tasks, ref) };
|
|
609
|
+
}
|
|
610
|
+
async runs(ref, limit = Limits.RUNS_KEPT) {
|
|
611
|
+
const task = TaskUtil.find(this.tasks, ref);
|
|
612
|
+
return (await this.store.runs(task.id)).slice(0, Math.max(1, limit));
|
|
613
|
+
}
|
|
614
|
+
async add(input) {
|
|
615
|
+
const cwd = (await this.host.getServerInfo()).cwd;
|
|
616
|
+
const task = TaskUtil.create(input, cwd, this.options.now());
|
|
617
|
+
await this.save([...this.tasks, task]);
|
|
618
|
+
return { ...task };
|
|
619
|
+
}
|
|
620
|
+
async update(ref, patch) {
|
|
621
|
+
const task = TaskUtil.find(this.tasks, ref);
|
|
622
|
+
const next = TaskUtil.patch(task, patch ?? {}, this.options.now());
|
|
623
|
+
await this.replace(next);
|
|
624
|
+
return { ...next };
|
|
625
|
+
}
|
|
626
|
+
setEnabled(ref, enabled) {
|
|
627
|
+
return this.update(ref, { enabled: enabled === true });
|
|
628
|
+
}
|
|
629
|
+
async remove(ref) {
|
|
630
|
+
const task = TaskUtil.find(this.tasks, ref);
|
|
631
|
+
await this.drop([task]);
|
|
632
|
+
return task;
|
|
633
|
+
}
|
|
634
|
+
async clear(cwd) {
|
|
635
|
+
const gone = this.tasks.filter((task) => !cwd || task.cwd === cwd);
|
|
636
|
+
await this.drop(gone);
|
|
637
|
+
return gone;
|
|
638
|
+
}
|
|
639
|
+
async run(ref) {
|
|
640
|
+
const task = TaskUtil.find(this.tasks, ref);
|
|
641
|
+
if (this.active.has(task.id)) {
|
|
642
|
+
throw new Error(`${task.name} is running now; wait for its run to end.`);
|
|
643
|
+
}
|
|
644
|
+
return this.begin(task, "manual", this.options.now());
|
|
645
|
+
}
|
|
646
|
+
isRun(sessionId) {
|
|
647
|
+
return [...this.active.values()].some((active) => active.sessionId === sessionId);
|
|
648
|
+
}
|
|
649
|
+
arm() {
|
|
650
|
+
clearTimeout(this.timer);
|
|
651
|
+
if (this.disposed || this.ticking) {
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
const now = this.options.now().getTime();
|
|
655
|
+
let delay = this.options.tickMs;
|
|
656
|
+
for (const task of this.tasks) {
|
|
657
|
+
if (task.enabled && task.nextRunAt) {
|
|
658
|
+
delay = Math.min(delay, Math.max(0, new Date(task.nextRunAt).getTime() - now));
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
this.timer = setTimeout(() => void this.tick().catch((error) => console.error(`${NAME}: ${message(error)}`)), delay);
|
|
662
|
+
this.timer.unref?.();
|
|
663
|
+
}
|
|
664
|
+
async tick() {
|
|
665
|
+
if (this.disposed) {
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
this.ticking = true;
|
|
669
|
+
try {
|
|
670
|
+
const now = this.options.now();
|
|
671
|
+
for (const { id } of [...this.tasks]) {
|
|
672
|
+
const task = this.tasks.find((other) => other.id === id);
|
|
673
|
+
if (!task?.enabled || !task.nextRunAt || new Date(task.nextRunAt).getTime() > now.getTime()) {
|
|
674
|
+
continue;
|
|
675
|
+
}
|
|
676
|
+
if (this.active.has(task.id)) {
|
|
677
|
+
await this.replace(this.advance(task, now));
|
|
678
|
+
} else {
|
|
679
|
+
await this.begin(task, "schedule", now);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
await this.sweep();
|
|
683
|
+
} finally {
|
|
684
|
+
this.ticking = false;
|
|
685
|
+
this.arm();
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
advance(task, now) {
|
|
689
|
+
if (!ScheduleUtil.repeats(task.schedule)) {
|
|
690
|
+
const { nextRunAt: _done, ...rest } = task;
|
|
691
|
+
return { ...rest, enabled: false };
|
|
692
|
+
}
|
|
693
|
+
const next = ScheduleUtil.next(task.schedule, now);
|
|
694
|
+
return { ...task, nextRunAt: next?.toISOString() };
|
|
695
|
+
}
|
|
696
|
+
async begin(task, trigger, now) {
|
|
697
|
+
const run = { id: TaskUtil.newId("run"), taskId: task.id, trigger, status: "running", startedAt: now.toISOString(), cwd: task.cwd };
|
|
698
|
+
const started = trigger === "schedule" ? this.advance(task, now) : task;
|
|
699
|
+
await this.replace({ ...started, lastRunAt: run.startedAt, lastStatus: "running" });
|
|
700
|
+
await this.store.saveRun(run);
|
|
701
|
+
const active = { run, task: { ...task } };
|
|
702
|
+
this.active.set(task.id, active);
|
|
703
|
+
this.waiting.push(active);
|
|
704
|
+
this.pump();
|
|
705
|
+
return { ...run };
|
|
706
|
+
}
|
|
707
|
+
pump() {
|
|
708
|
+
while (this.working < this.options.parallel && this.waiting.length > 0 && !this.disposed) {
|
|
709
|
+
const active = this.waiting.shift();
|
|
710
|
+
this.working++;
|
|
711
|
+
this.execute(active).catch((error) => console.error(`${NAME}: ${message(error)}`)).finally(() => {
|
|
712
|
+
this.working--;
|
|
713
|
+
this.pump();
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
async execute(active) {
|
|
718
|
+
const { task, run } = active;
|
|
719
|
+
if (active.dropped) {
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
try {
|
|
723
|
+
const now = this.options.now();
|
|
724
|
+
const { sessionId } = await this.host.openSession({
|
|
725
|
+
cwd: task.cwd,
|
|
726
|
+
group: NAME,
|
|
727
|
+
appendSystemPrompt: TaskUtil.systemPrompt(task, now),
|
|
728
|
+
...task.model ? { model: task.model } : {},
|
|
729
|
+
...task.thinking ? { thinkingLevel: task.thinking } : {}
|
|
730
|
+
});
|
|
731
|
+
active.sessionId = sessionId;
|
|
732
|
+
await this.host.setSessionName(sessionId, `${task.name} · ${ScheduleUtil.clock(now)}`).catch(() => {
|
|
733
|
+
return;
|
|
734
|
+
});
|
|
735
|
+
const state = await this.host.getState(sessionId);
|
|
736
|
+
run.sessionFile = state.sessionFile;
|
|
737
|
+
await this.store.saveRun(run);
|
|
738
|
+
await this.host.prompt(sessionId, { clientMessageId: run.id, message: task.prompt });
|
|
739
|
+
await this.settled(active, state.messageCount);
|
|
740
|
+
const { text } = await this.host.getLastAssistantText(sessionId);
|
|
741
|
+
if (!text?.trim()) {
|
|
742
|
+
throw new Error("The run ended without an answer; the model may have failed. Open its conversation to see.");
|
|
743
|
+
}
|
|
744
|
+
await this.finish(active, { status: "success", summary: clip(text.trim()) });
|
|
745
|
+
} catch (error) {
|
|
746
|
+
await this.finish(active, { status: "error", error: message(error), ...error instanceof TimeoutError ? { reason: "timeout" } : {} });
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
async settled(active, before) {
|
|
750
|
+
const sessionId = active.sessionId;
|
|
751
|
+
const start = Date.now();
|
|
752
|
+
for (;; ) {
|
|
753
|
+
if (active.dropped || this.disposed) {
|
|
754
|
+
throw new Error("The task was removed while it ran.");
|
|
755
|
+
}
|
|
756
|
+
const state = await this.host.getState(sessionId);
|
|
757
|
+
if (!state.isStreaming && state.pendingMessageCount === 0 && state.messageCount > before) {
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
if (Date.now() - start > this.options.timeoutMs) {
|
|
761
|
+
await this.host.abort(sessionId).catch(() => {
|
|
762
|
+
return;
|
|
763
|
+
});
|
|
764
|
+
throw new TimeoutError(`The run took longer than ${Math.round(this.options.timeoutMs / 60000)} minutes and was stopped.`);
|
|
765
|
+
}
|
|
766
|
+
await new Promise((resolve) => setTimeout(resolve, this.options.pollMs));
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
async finish(active, end) {
|
|
770
|
+
this.active.delete(active.task.id);
|
|
771
|
+
const sessionId = active.sessionId;
|
|
772
|
+
if (sessionId) {
|
|
773
|
+
this.lingering.add(sessionId);
|
|
774
|
+
}
|
|
775
|
+
if (active.dropped || this.disposed) {
|
|
776
|
+
await this.sweep();
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
const run = { ...active.run, ...end, endedAt: this.options.now().toISOString() };
|
|
780
|
+
await this.store.saveRun(run);
|
|
781
|
+
const current = this.tasks.find((task) => task.id === active.task.id);
|
|
782
|
+
if (current) {
|
|
783
|
+
const failed = run.status === "error";
|
|
784
|
+
await this.replace({
|
|
785
|
+
...current,
|
|
786
|
+
lastStatus: run.status,
|
|
787
|
+
runCount: current.runCount + 1,
|
|
788
|
+
failCount: current.failCount + (failed ? 1 : 0)
|
|
789
|
+
});
|
|
790
|
+
await this.store.finished({ run, taskName: current.name, notify: ScheduleUtil.shouldNotify(ScheduleUtil.notifyLevel(current), failed) });
|
|
791
|
+
}
|
|
792
|
+
await this.sweep();
|
|
793
|
+
}
|
|
794
|
+
async sweep() {
|
|
795
|
+
if (this.lingering.size === 0) {
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
const open = new Map((await this.host.listSessions()).map((info) => [info.sessionId, info]));
|
|
799
|
+
for (const sessionId of [...this.lingering]) {
|
|
800
|
+
const info = open.get(sessionId);
|
|
801
|
+
if (!info) {
|
|
802
|
+
this.lingering.delete(sessionId);
|
|
803
|
+
} else if (info.attached === 0 && !info.isStreaming) {
|
|
804
|
+
this.lingering.delete(sessionId);
|
|
805
|
+
await this.host.closeSession(sessionId).catch(() => {
|
|
806
|
+
return;
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
async reclaim(task, now) {
|
|
812
|
+
for (const run of await this.store.runs(task.id)) {
|
|
813
|
+
if (run.status === "running") {
|
|
814
|
+
await this.store.saveRun({
|
|
815
|
+
...run,
|
|
816
|
+
status: "error",
|
|
817
|
+
reason: "interrupted",
|
|
818
|
+
error: "The Ta service stopped before the run ended.",
|
|
819
|
+
endedAt: now.toISOString()
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
this.tasks = this.tasks.map((other) => other.id === task.id ? { ...other, lastStatus: "error", failCount: other.failCount + 1 } : other);
|
|
824
|
+
}
|
|
825
|
+
async miss(task, now) {
|
|
826
|
+
const run = {
|
|
827
|
+
id: TaskUtil.newId("run"),
|
|
828
|
+
taskId: task.id,
|
|
829
|
+
trigger: "schedule",
|
|
830
|
+
status: "missed",
|
|
831
|
+
startedAt: task.nextRunAt ?? now.toISOString(),
|
|
832
|
+
endedAt: now.toISOString(),
|
|
833
|
+
error: "The Ta service was not running at its time; run it by hand if it is still wanted.",
|
|
834
|
+
cwd: task.cwd
|
|
835
|
+
};
|
|
836
|
+
await this.store.saveRun(run);
|
|
837
|
+
const { nextRunAt: _gone, ...rest } = task;
|
|
838
|
+
this.tasks = this.tasks.map((other) => other.id === task.id ? { ...rest, enabled: false, lastStatus: "missed", lastRunAt: run.startedAt } : other);
|
|
839
|
+
await this.store.finished({ run, taskName: task.name, notify: ScheduleUtil.notifyLevel(task) !== "never" });
|
|
840
|
+
}
|
|
841
|
+
async drop(tasks) {
|
|
842
|
+
const ids = new Set(tasks.map((task) => task.id));
|
|
843
|
+
for (const id of ids) {
|
|
844
|
+
const active = this.active.get(id);
|
|
845
|
+
if (active) {
|
|
846
|
+
active.dropped = true;
|
|
847
|
+
if (active.sessionId) {
|
|
848
|
+
await this.host.abort(active.sessionId).catch(() => {
|
|
849
|
+
return;
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
await this.store.removeRuns(id);
|
|
854
|
+
}
|
|
855
|
+
await this.save(this.tasks.filter((task) => !ids.has(task.id)));
|
|
856
|
+
}
|
|
857
|
+
replace(task) {
|
|
858
|
+
return this.save(this.tasks.map((other) => other.id === task.id ? task : other));
|
|
859
|
+
}
|
|
860
|
+
async save(tasks) {
|
|
861
|
+
this.tasks = tasks;
|
|
862
|
+
await this.store.saveTasks(tasks);
|
|
863
|
+
this.arm();
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
class TimeoutError extends Error {
|
|
868
|
+
}
|
|
869
|
+
function clip(text) {
|
|
870
|
+
return text.length > Limits.SUMMARY_MAX ? `${text.slice(0, Limits.SUMMARY_MAX - 1)}…` : text;
|
|
871
|
+
}
|
|
872
|
+
function message(error) {
|
|
873
|
+
return error instanceof Error ? error.message : String(error);
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
// web-src/host.ts
|
|
877
|
+
async function activate(host) {
|
|
878
|
+
const scheduler = new CronScheduler(host);
|
|
879
|
+
await scheduler.start();
|
|
880
|
+
return scheduler;
|
|
881
|
+
}
|
|
882
|
+
export {
|
|
883
|
+
activate as default
|
|
884
|
+
};
|