@celljs/ta 4.15.2 → 4.17.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 +1 -0
- package/README.md +1 -0
- package/dist/cli.mjs +2227 -203
- package/dist/gateway.mjs +2391 -291
- package/dist/pi/CHANGELOG.md +19 -0
- package/dist/pi/package.json +1 -1
- package/dist/pi/packages/ta-3d/extension/index.mjs +1 -0
- package/dist/pi/packages/ta-3d/package.json +2 -1
- package/dist/pi/packages/ta-agents/README.en.md +14 -2
- package/dist/pi/packages/ta-agents/README.md +14 -2
- package/dist/pi/packages/ta-agents/extension/index.mjs +286 -111
- package/dist/pi/packages/ta-agents/host/index.mjs +662 -0
- package/dist/pi/packages/ta-agents/lib/acp-protocol.d.ts +2 -0
- package/dist/pi/packages/ta-agents/lib/acp-protocol.js +5 -0
- package/dist/pi/packages/ta-agents/lib/agent-catalog.d.ts +36 -2
- package/dist/pi/packages/ta-agents/lib/agent-catalog.js +76 -6
- package/dist/pi/packages/ta-agents/lib/agent-installer.d.ts +55 -0
- package/dist/pi/packages/ta-agents/lib/agent-installer.js +140 -0
- package/dist/pi/packages/ta-agents/lib/agent-installs.d.ts +25 -0
- package/dist/pi/packages/ta-agents/lib/agent-installs.js +64 -0
- package/dist/pi/packages/ta-agents/lib/agent-prompt.d.ts +6 -0
- package/dist/pi/packages/ta-agents/lib/agent-prompt.js +9 -0
- package/dist/pi/packages/ta-agents/lib/agent-refresh.d.ts +11 -0
- package/dist/pi/packages/ta-agents/lib/agent-refresh.js +37 -0
- package/dist/pi/packages/ta-agents/lib/agent-session.d.ts +0 -2
- package/dist/pi/packages/ta-agents/lib/agent-session.js +3 -6
- package/dist/pi/packages/ta-agents/lib/agent-turn.d.ts +7 -2
- package/dist/pi/packages/ta-agents/lib/agent-turn.js +8 -4
- package/dist/pi/packages/ta-agents/lib/agents-protocol.d.ts +26 -0
- package/dist/pi/packages/ta-agents/lib/agents-protocol.js +11 -0
- package/dist/pi/packages/ta-agents/lib/agents-settings.d.ts +10 -0
- package/dist/pi/packages/ta-agents/lib/agents-settings.js +165 -0
- package/dist/pi/packages/ta-agents/lib/extension.d.ts +3 -1
- package/dist/pi/packages/ta-agents/lib/extension.js +17 -4
- package/dist/pi/packages/ta-agents/lib/host.d.ts +35 -0
- package/dist/pi/packages/ta-agents/lib/host.js +96 -0
- package/dist/pi/packages/ta-agents/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-agents/lib/react.js +8 -0
- package/dist/pi/packages/ta-agents/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-agents/lib/style.js +30 -0
- package/dist/pi/packages/ta-agents/lib/texts.d.ts +18 -0
- package/dist/pi/packages/ta-agents/lib/texts.js +18 -0
- package/dist/pi/packages/ta-agents/lib/web-words.d.ts +30 -0
- package/dist/pi/packages/ta-agents/lib/web-words.js +98 -0
- package/dist/pi/packages/ta-agents/lib/web.d.ts +4 -0
- package/dist/pi/packages/ta-agents/lib/web.js +14 -0
- package/dist/pi/packages/ta-agents/package.json +21 -5
- package/dist/pi/packages/ta-agents/web/index.js +385 -0
- package/dist/pi/packages/ta-app-use/README.en.md +28 -0
- package/dist/pi/packages/ta-app-use/README.md +28 -0
- package/dist/pi/packages/ta-app-use/extension/index.mjs +534 -0
- package/dist/pi/packages/ta-app-use/host/index.mjs +136 -0
- package/dist/pi/packages/ta-app-use/lib/app-host.d.ts +32 -0
- package/dist/pi/packages/ta-app-use/lib/app-host.js +79 -0
- package/dist/pi/packages/ta-app-use/lib/app-protocol.d.ts +23 -0
- package/dist/pi/packages/ta-app-use/lib/app-protocol.js +9 -0
- package/dist/pi/packages/ta-app-use/lib/app-util.d.ts +18 -0
- package/dist/pi/packages/ta-app-use/lib/app-util.js +71 -0
- package/dist/pi/packages/ta-app-use/lib/extension.d.ts +80 -0
- package/dist/pi/packages/ta-app-use/lib/extension.js +125 -0
- package/dist/pi/packages/ta-app-use/lib/host.d.ts +7 -0
- package/dist/pi/packages/ta-app-use/lib/host.js +16 -0
- package/dist/pi/packages/ta-app-use/lib/i18n.d.ts +38 -0
- package/dist/pi/packages/ta-app-use/lib/i18n.js +130 -0
- package/dist/pi/packages/ta-app-use/lib/index.d.ts +9 -0
- package/dist/pi/packages/ta-app-use/lib/index.js +93 -0
- package/dist/pi/packages/ta-app-use/lib/screen-cursor.d.ts +33 -0
- package/dist/pi/packages/ta-app-use/lib/screen-cursor.js +134 -0
- package/dist/pi/packages/ta-app-use/lib/screen-dom.d.ts +19 -0
- package/dist/pi/packages/ta-app-use/lib/screen-dom.js +184 -0
- package/dist/pi/packages/ta-app-use/lib/screen-driver.d.ts +46 -0
- package/dist/pi/packages/ta-app-use/lib/screen-driver.js +174 -0
- package/dist/pi/packages/ta-app-use/lib/screen-protocol.d.ts +67 -0
- package/dist/pi/packages/ta-app-use/lib/screen-protocol.js +8 -0
- package/dist/pi/packages/ta-app-use/lib/screen-text.d.ts +13 -0
- package/dist/pi/packages/ta-app-use/lib/screen-text.js +69 -0
- package/dist/pi/packages/ta-app-use/lib/screen-window.d.ts +68 -0
- package/dist/pi/packages/ta-app-use/lib/screen-window.js +376 -0
- package/dist/pi/packages/ta-app-use/lib/tool-line.d.ts +11 -0
- package/dist/pi/packages/ta-app-use/lib/tool-line.js +69 -0
- package/dist/pi/packages/ta-app-use/package.json +63 -0
- package/dist/pi/packages/ta-app-use/web/index.js +1520 -0
- package/dist/pi/packages/ta-bots/README.en.md +1 -0
- package/dist/pi/packages/ta-bots/README.md +1 -0
- package/dist/pi/packages/ta-bots/extension/index.mjs +25 -22
- package/dist/pi/packages/ta-bots/host/index.mjs +726 -151
- package/dist/pi/packages/ta-bots/lib/bot-service.d.ts +9 -1
- package/dist/pi/packages/ta-bots/lib/bot-service.js +49 -8
- package/dist/pi/packages/ta-bots/lib/channel-protocol.d.ts +2 -0
- package/dist/pi/packages/ta-bots/lib/extension.d.ts +2 -2
- package/dist/pi/packages/ta-bots/lib/extension.js +28 -24
- package/dist/pi/packages/ta-bots/lib/index.js +4 -0
- package/dist/pi/packages/ta-bots/lib/page.d.ts +7 -1
- package/dist/pi/packages/ta-bots/lib/page.js +17 -0
- package/dist/pi/packages/ta-bots/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-bots/lib/style.js +1 -1
- package/dist/pi/packages/ta-bots/lib/wecom-channel.js +1 -1
- package/dist/pi/packages/ta-bots/lib/weixin-api.d.ts +1 -0
- package/dist/pi/packages/ta-bots/lib/weixin-channel.js +2 -1
- package/dist/pi/packages/ta-bots/package.json +1 -1
- package/dist/pi/packages/ta-bots/web/index.js +13 -2
- package/dist/pi/packages/ta-call/README.en.md +9 -0
- package/dist/pi/packages/ta-call/README.md +9 -0
- package/dist/pi/packages/ta-call/extension/index.mjs +474 -0
- package/dist/pi/packages/ta-call/host/index.mjs +899 -0
- package/dist/pi/packages/ta-call/lib/call-host.d.ts +127 -0
- package/dist/pi/packages/ta-call/lib/call-host.js +377 -0
- package/dist/pi/packages/ta-call/lib/call-protocol.d.ts +33 -0
- package/dist/pi/packages/ta-call/lib/call-protocol.js +10 -0
- package/dist/pi/packages/ta-call/lib/call-util.d.ts +50 -0
- package/dist/pi/packages/ta-call/lib/call-util.js +250 -0
- package/dist/pi/packages/ta-call/lib/extension.d.ts +20 -0
- package/dist/pi/packages/ta-call/lib/extension.js +114 -0
- package/dist/pi/packages/ta-call/lib/host.d.ts +7 -0
- package/dist/pi/packages/ta-call/lib/host.js +20 -0
- package/dist/pi/packages/ta-call/lib/i18n.d.ts +16 -0
- package/dist/pi/packages/ta-call/lib/i18n.js +38 -0
- package/dist/pi/packages/ta-call/lib/index.d.ts +7 -0
- package/dist/pi/packages/ta-call/lib/index.js +60 -0
- package/dist/pi/packages/ta-call/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-call/lib/react.js +8 -0
- package/dist/pi/packages/ta-call/package.json +64 -0
- package/dist/pi/packages/ta-call/web/index.js +552 -0
- package/dist/pi/packages/ta-changes/extension/index.mjs +1 -0
- package/dist/pi/packages/ta-changes/lib/card.js +4 -1
- package/dist/pi/packages/ta-changes/package.json +1 -1
- package/dist/pi/packages/ta-changes/web/index.js +2 -0
- package/dist/pi/packages/ta-channels/extension/index.mjs +155 -194
- package/dist/pi/packages/ta-channels/host/index.mjs +2039 -1503
- package/dist/pi/packages/ta-channels/lib/agent-menu.js +2 -1
- package/dist/pi/packages/ta-channels/lib/channel-menu.d.ts +1 -1
- package/dist/pi/packages/ta-channels/lib/channel-menu.js +2 -2
- package/dist/pi/packages/ta-channels/lib/channels-text.d.ts +38 -0
- package/dist/pi/packages/ta-channels/lib/channels-text.js +173 -0
- package/dist/pi/packages/ta-channels/lib/channels-util.d.ts +0 -48
- package/dist/pi/packages/ta-channels/lib/channels-util.js +1 -223
- package/dist/pi/packages/ta-channels/lib/create.js +5 -1
- package/dist/pi/packages/ta-channels/lib/i18n-ja.d.ts +3 -0
- package/dist/pi/packages/ta-channels/lib/i18n-ja.js +182 -0
- package/dist/pi/packages/ta-channels/lib/i18n-zh-tw.d.ts +3 -0
- package/dist/pi/packages/ta-channels/lib/i18n-zh-tw.js +182 -0
- package/dist/pi/packages/ta-channels/lib/i18n-zh.d.ts +3 -0
- package/dist/pi/packages/ta-channels/lib/i18n-zh.js +182 -0
- package/dist/pi/packages/ta-channels/lib/i18n.js +4 -535
- package/dist/pi/packages/ta-channels/lib/index.js +2 -1
- package/dist/pi/packages/ta-channels/lib/notice-util.d.ts +15 -0
- package/dist/pi/packages/ta-channels/lib/notice-util.js +61 -0
- package/dist/pi/packages/ta-channels/lib/notice.d.ts +1 -1
- package/dist/pi/packages/ta-channels/lib/notice.js +5 -4
- package/dist/pi/packages/ta-channels/lib/room.js +4 -3
- package/dist/pi/packages/ta-channels/lib/sidebar-head.d.ts +6 -0
- package/dist/pi/packages/ta-channels/lib/sidebar-head.js +67 -0
- package/dist/pi/packages/ta-channels/lib/sidebar-hooks.d.ts +51 -0
- package/dist/pi/packages/ta-channels/lib/sidebar-hooks.js +230 -0
- package/dist/pi/packages/ta-channels/lib/sidebar-rows.d.ts +71 -0
- package/dist/pi/packages/ta-channels/lib/sidebar-rows.js +105 -0
- package/dist/pi/packages/ta-channels/lib/sidebar.d.ts +0 -4
- package/dist/pi/packages/ta-channels/lib/sidebar.js +35 -396
- package/dist/pi/packages/ta-channels/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-channels/lib/style.js +0 -1
- package/dist/pi/packages/ta-channels/lib/tasks.js +2 -1
- package/dist/pi/packages/ta-channels/lib/team-store.d.ts +78 -0
- package/dist/pi/packages/ta-channels/lib/team-store.js +261 -0
- package/dist/pi/packages/ta-channels/lib/team-tools.js +3 -2
- package/dist/pi/packages/ta-channels/lib/team.d.ts +3 -76
- package/dist/pi/packages/ta-channels/lib/team.js +5 -254
- package/dist/pi/packages/ta-channels/package.json +1 -1
- package/dist/pi/packages/ta-channels/web/index.js +889 -809
- package/dist/pi/packages/ta-computer-use/package.json +1 -1
- package/dist/pi/packages/ta-cron/README.en.md +19 -3
- package/dist/pi/packages/ta-cron/README.md +19 -3
- package/dist/pi/packages/ta-cron/extension/index.mjs +396 -111
- package/dist/pi/packages/ta-cron/host/index.mjs +633 -49
- package/dist/pi/packages/ta-cron/lib/chat-task.d.ts +5 -3
- package/dist/pi/packages/ta-cron/lib/chat-task.js +15 -10
- package/dist/pi/packages/ta-cron/lib/commands.d.ts +7 -4
- package/dist/pi/packages/ta-cron/lib/commands.js +26 -47
- package/dist/pi/packages/ta-cron/lib/cron-expression.d.ts +8 -0
- package/dist/pi/packages/ta-cron/lib/cron-expression.js +43 -1
- package/dist/pi/packages/ta-cron/lib/cron-protocol.d.ts +54 -7
- package/dist/pi/packages/ta-cron/lib/cron-protocol.js +16 -2
- package/dist/pi/packages/ta-cron/lib/editor.d.ts +3 -0
- package/dist/pi/packages/ta-cron/lib/editor.js +106 -36
- package/dist/pi/packages/ta-cron/lib/extension.js +1 -1
- package/dist/pi/packages/ta-cron/lib/form-util.d.ts +16 -6
- package/dist/pi/packages/ta-cron/lib/form-util.js +40 -28
- package/dist/pi/packages/ta-cron/lib/host.js +17 -1
- package/dist/pi/packages/ta-cron/lib/i18n.d.ts +39 -5
- package/dist/pi/packages/ta-cron/lib/i18n.js +160 -24
- package/dist/pi/packages/ta-cron/lib/index.js +4 -0
- package/dist/pi/packages/ta-cron/lib/page.d.ts +3 -2
- package/dist/pi/packages/ta-cron/lib/page.js +13 -2
- package/dist/pi/packages/ta-cron/lib/schedule-util.d.ts +4 -0
- package/dist/pi/packages/ta-cron/lib/schedule-util.js +52 -4
- package/dist/pi/packages/ta-cron/lib/scheduler.d.ts +56 -6
- package/dist/pi/packages/ta-cron/lib/scheduler.js +209 -27
- package/dist/pi/packages/ta-cron/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-cron/lib/style.js +50 -21
- package/dist/pi/packages/ta-cron/lib/task-list.d.ts +23 -0
- package/dist/pi/packages/ta-cron/lib/task-list.js +70 -0
- package/dist/pi/packages/ta-cron/lib/task-row.d.ts +19 -0
- package/dist/pi/packages/ta-cron/lib/task-row.js +246 -0
- package/dist/pi/packages/ta-cron/lib/task-util.d.ts +10 -6
- package/dist/pi/packages/ta-cron/lib/task-util.js +53 -19
- package/dist/pi/packages/ta-cron/lib/task-watchers.d.ts +30 -0
- package/dist/pi/packages/ta-cron/lib/task-watchers.js +90 -0
- package/dist/pi/packages/ta-cron/lib/tasks-view.d.ts +3 -2
- package/dist/pi/packages/ta-cron/lib/tasks-view.js +48 -193
- package/dist/pi/packages/ta-cron/lib/tool-line.js +4 -0
- package/dist/pi/packages/ta-cron/lib/tool.d.ts +7 -0
- package/dist/pi/packages/ta-cron/lib/tool.js +18 -8
- package/dist/pi/packages/ta-cron/lib/when.d.ts +39 -0
- package/dist/pi/packages/ta-cron/lib/when.js +231 -0
- package/dist/pi/packages/ta-cron/package.json +2 -1
- package/dist/pi/packages/ta-cron/web/index.js +1091 -340
- package/dist/pi/packages/ta-extensions/lib/market-detail.js +9 -5
- package/dist/pi/packages/ta-extensions/lib/page.js +1 -1
- package/dist/pi/packages/ta-extensions/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-extensions/lib/style.js +1 -1
- package/dist/pi/packages/ta-extensions/package.json +1 -1
- package/dist/pi/packages/ta-extensions/skills/ta-package/SKILL.md +9 -7
- package/dist/pi/packages/ta-extensions/web/index.js +777 -237
- package/dist/pi/packages/ta-feedback/README.en.md +10 -0
- package/dist/pi/packages/ta-feedback/README.md +10 -0
- package/dist/pi/packages/ta-feedback/extension/index.mjs +451 -0
- package/dist/pi/packages/ta-feedback/host/index.mjs +1187 -0
- package/dist/pi/packages/ta-feedback/lib/extension.d.ts +31 -0
- package/dist/pi/packages/ta-feedback/lib/extension.js +160 -0
- package/dist/pi/packages/ta-feedback/lib/feedback-git.d.ts +25 -0
- package/dist/pi/packages/ta-feedback/lib/feedback-git.js +44 -0
- package/dist/pi/packages/ta-feedback/lib/feedback-host.d.ts +133 -0
- package/dist/pi/packages/ta-feedback/lib/feedback-host.js +668 -0
- package/dist/pi/packages/ta-feedback/lib/feedback-protocol.d.ts +127 -0
- package/dist/pi/packages/ta-feedback/lib/feedback-protocol.js +41 -0
- package/dist/pi/packages/ta-feedback/lib/feedback-util.d.ts +79 -0
- package/dist/pi/packages/ta-feedback/lib/feedback-util.js +252 -0
- package/dist/pi/packages/ta-feedback/lib/feedback-view.d.ts +11 -0
- package/dist/pi/packages/ta-feedback/lib/feedback-view.js +244 -0
- package/dist/pi/packages/ta-feedback/lib/host.d.ts +8 -0
- package/dist/pi/packages/ta-feedback/lib/host.js +19 -0
- package/dist/pi/packages/ta-feedback/lib/i18n.d.ts +69 -0
- package/dist/pi/packages/ta-feedback/lib/i18n.js +250 -0
- package/dist/pi/packages/ta-feedback/lib/index.d.ts +8 -0
- package/dist/pi/packages/ta-feedback/lib/index.js +88 -0
- package/dist/pi/packages/ta-feedback/lib/page.d.ts +35 -0
- package/dist/pi/packages/ta-feedback/lib/page.js +135 -0
- package/dist/pi/packages/ta-feedback/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-feedback/lib/react.js +8 -0
- package/dist/pi/packages/ta-feedback/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-feedback/lib/style.js +71 -0
- package/dist/pi/packages/ta-feedback/package.json +65 -0
- package/dist/pi/packages/ta-feedback/web/index.js +939 -0
- package/dist/pi/packages/ta-games/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-games/lib/style.js +1 -1
- package/dist/pi/packages/ta-games/package.json +1 -1
- package/dist/pi/packages/ta-games/web/index.js +1 -1
- package/dist/pi/packages/ta-glance/README.en.md +2 -0
- package/dist/pi/packages/ta-glance/README.md +2 -0
- package/dist/pi/packages/ta-glance/extension/index.mjs +135 -27
- package/dist/pi/packages/ta-glance/lib/card.js +155 -35
- package/dist/pi/packages/ta-glance/lib/glance-json.d.ts +1 -1
- package/dist/pi/packages/ta-glance/lib/glance-json.js +8 -1
- package/dist/pi/packages/ta-glance/lib/glance-prompt.d.ts +1 -1
- package/dist/pi/packages/ta-glance/lib/glance-prompt.js +9 -6
- package/dist/pi/packages/ta-glance/lib/glance-protocol.d.ts +43 -4
- package/dist/pi/packages/ta-glance/lib/glance-protocol.js +39 -1
- package/dist/pi/packages/ta-glance/lib/glance-spec.js +125 -23
- package/dist/pi/packages/ta-glance/lib/glance-speech.d.ts +13 -0
- package/dist/pi/packages/ta-glance/lib/glance-speech.js +45 -0
- package/dist/pi/packages/ta-glance/lib/glance-util.d.ts +13 -0
- package/dist/pi/packages/ta-glance/lib/glance-util.js +28 -0
- package/dist/pi/packages/ta-glance/lib/i18n.d.ts +5 -0
- package/dist/pi/packages/ta-glance/lib/i18n.js +20 -0
- package/dist/pi/packages/ta-glance/lib/index.js +11 -1
- package/dist/pi/packages/ta-glance/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-glance/lib/style.js +82 -5
- package/dist/pi/packages/ta-glance/package.json +2 -1
- package/dist/pi/packages/ta-glance/web/index.js +508 -62
- package/dist/pi/packages/ta-initiative/extension/index.mjs +3 -2
- package/dist/pi/packages/ta-initiative/host/index.mjs +1 -1
- package/dist/pi/packages/ta-initiative/lib/chat-proposals.js +1 -1
- package/dist/pi/packages/ta-initiative/lib/index.js +1 -0
- package/dist/pi/packages/ta-initiative/lib/material-util.js +1 -1
- package/dist/pi/packages/ta-initiative/lib/settings.js +2 -1
- package/dist/pi/packages/ta-initiative/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-initiative/lib/style.js +1 -1
- package/dist/pi/packages/ta-initiative/package.json +1 -1
- package/dist/pi/packages/ta-initiative/web/index.js +5 -3
- package/dist/pi/packages/ta-launcher/package.json +1 -1
- package/dist/pi/packages/ta-manual/lib/manual-util.d.ts +1 -1
- package/dist/pi/packages/ta-manual/lib/pictures-c.js +15 -0
- package/dist/pi/packages/ta-manual/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-manual/lib/style.js +1 -1
- package/dist/pi/packages/ta-manual/lib/topics-a.d.ts +3 -0
- package/dist/pi/packages/ta-manual/lib/topics-a.js +295 -0
- package/dist/pi/packages/ta-manual/lib/topics-model.d.ts +46 -0
- package/dist/pi/packages/ta-manual/lib/topics-model.js +21 -0
- package/dist/pi/packages/ta-manual/lib/topics.d.ts +1 -44
- package/dist/pi/packages/ta-manual/lib/topics.js +28 -318
- package/dist/pi/packages/ta-manual/package.json +1 -1
- package/dist/pi/packages/ta-manual/skills/ta-manual/SKILL.md +12 -10
- package/dist/pi/packages/ta-manual/web/index.js +97 -24
- package/dist/pi/packages/ta-moments/extension/index.mjs +740 -194
- package/dist/pi/packages/ta-moments/host/index.mjs +1393 -834
- package/dist/pi/packages/ta-moments/lib/index.js +3 -1
- package/dist/pi/packages/ta-moments/lib/moments-host-base.d.ts +96 -0
- package/dist/pi/packages/ta-moments/lib/moments-host-base.js +276 -0
- package/dist/pi/packages/ta-moments/lib/moments-host-pictures.d.ts +22 -0
- package/dist/pi/packages/ta-moments/lib/moments-host-pictures.js +167 -0
- package/dist/pi/packages/ta-moments/lib/moments-host.d.ts +4 -84
- package/dist/pi/packages/ta-moments/lib/moments-host.js +13 -426
- package/dist/pi/packages/ta-moments/lib/page.js +3 -3
- package/dist/pi/packages/ta-moments/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-moments/lib/style.js +1 -1
- package/dist/pi/packages/ta-moments/lib/talk-host-base.d.ts +71 -0
- package/dist/pi/packages/ta-moments/lib/talk-host-base.js +171 -0
- package/dist/pi/packages/ta-moments/lib/talk-host.d.ts +3 -62
- package/dist/pi/packages/ta-moments/lib/talk-host.js +14 -169
- package/dist/pi/packages/ta-moments/package.json +1 -1
- package/dist/pi/packages/ta-moments/web/index.js +686 -147
- package/dist/pi/packages/ta-nearby/extension/index.mjs +9 -0
- package/dist/pi/packages/ta-nearby/host/index.mjs +1073 -1018
- package/dist/pi/packages/ta-nearby/lib/index.js +8 -5
- package/dist/pi/packages/ta-nearby/lib/nearby-home.d.ts +13 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-home.js +91 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-meet-view.d.ts +12 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-meet-view.js +113 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-page.d.ts +6 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-page.js +157 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-service-base.d.ts +161 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-service-base.js +343 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-service-meet.d.ts +41 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-service-meet.js +297 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-service.d.ts +6 -167
- package/dist/pi/packages/ta-nearby/lib/nearby-service.js +38 -638
- package/dist/pi/packages/ta-nearby/lib/nearby-show-view.d.ts +6 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-show-view.js +88 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-spot.d.ts +6 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-spot.js +25 -3
- package/dist/pi/packages/ta-nearby/lib/page.d.ts +27 -20
- package/dist/pi/packages/ta-nearby/lib/page.js +15 -417
- package/dist/pi/packages/ta-nearby/lib/server-texts.d.ts +1 -1
- package/dist/pi/packages/ta-nearby/lib/server-texts.js +9 -1
- package/dist/pi/packages/ta-nearby/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-nearby/lib/style.js +1 -1
- package/dist/pi/packages/ta-nearby/package.json +1 -1
- package/dist/pi/packages/ta-nearby/web/index.js +370 -362
- package/dist/pi/packages/ta-notify/extension/index.mjs +1 -0
- package/dist/pi/packages/ta-notify/lib/settings.js +1 -0
- package/dist/pi/packages/ta-notify/package.json +1 -1
- package/dist/pi/packages/ta-notify/web/index.js +1 -0
- package/dist/pi/packages/ta-plot/extension/index.mjs +1 -0
- package/dist/pi/packages/ta-plot/package.json +2 -1
- package/dist/pi/packages/ta-recall/extension/index.mjs +1 -0
- package/dist/pi/packages/ta-recall/host/index.mjs +1 -0
- package/dist/pi/packages/ta-recall/lib/settings.js +1 -0
- package/dist/pi/packages/ta-recall/package.json +1 -1
- package/dist/pi/packages/ta-recall/web/index.js +2 -0
- package/dist/pi/packages/ta-rooms/extension/index.mjs +1 -0
- package/dist/pi/packages/ta-rooms/host/index.mjs +497 -492
- package/dist/pi/packages/ta-rooms/lib/double-agents.js +6 -6
- package/dist/pi/packages/ta-rooms/lib/double-grants.js +10 -10
- package/dist/pi/packages/ta-rooms/lib/double-host.js +6 -5
- package/dist/pi/packages/ta-rooms/lib/double-tasks-base.d.ts +55 -0
- package/dist/pi/packages/ta-rooms/lib/double-tasks-base.js +279 -0
- package/dist/pi/packages/ta-rooms/lib/double-tasks.d.ts +3 -45
- package/dist/pi/packages/ta-rooms/lib/double-tasks.js +14 -282
- package/dist/pi/packages/ta-rooms/lib/double-user.js +2 -2
- package/dist/pi/packages/ta-rooms/lib/friend-notices.js +2 -2
- package/dist/pi/packages/ta-rooms/lib/i18n.d.ts +1 -0
- package/dist/pi/packages/ta-rooms/lib/i18n.js +8 -4
- package/dist/pi/packages/ta-rooms/lib/index.js +18 -2
- package/dist/pi/packages/ta-rooms/lib/members-view.js +37 -3
- package/dist/pi/packages/ta-rooms/lib/page.d.ts +36 -1
- package/dist/pi/packages/ta-rooms/lib/page.js +76 -1
- package/dist/pi/packages/ta-rooms/lib/room-view.js +22 -17
- package/dist/pi/packages/ta-rooms/lib/rooms-home.js +1 -0
- package/dist/pi/packages/ta-rooms/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-rooms/lib/style.js +32 -6
- package/dist/pi/packages/ta-rooms/package.json +1 -1
- package/dist/pi/packages/ta-rooms/web/index.js +223 -38
- package/dist/pi/packages/ta-secrets/README.en.md +22 -0
- package/dist/pi/packages/ta-secrets/README.md +22 -0
- package/dist/pi/packages/ta-secrets/extension/index.mjs +462 -0
- package/dist/pi/packages/ta-secrets/host/index.mjs +1341 -0
- package/dist/pi/packages/ta-secrets/lib/command-prelude.d.ts +36 -0
- package/dist/pi/packages/ta-secrets/lib/command-prelude.js +66 -0
- package/dist/pi/packages/ta-secrets/lib/extension.d.ts +28 -0
- package/dist/pi/packages/ta-secrets/lib/extension.js +156 -0
- package/dist/pi/packages/ta-secrets/lib/host.d.ts +4 -0
- package/dist/pi/packages/ta-secrets/lib/host.js +15 -0
- package/dist/pi/packages/ta-secrets/lib/i18n.d.ts +47 -0
- package/dist/pi/packages/ta-secrets/lib/i18n.js +166 -0
- package/dist/pi/packages/ta-secrets/lib/index.d.ts +8 -0
- package/dist/pi/packages/ta-secrets/lib/index.js +28 -0
- package/dist/pi/packages/ta-secrets/lib/personal-info.d.ts +26 -0
- package/dist/pi/packages/ta-secrets/lib/personal-info.js +108 -0
- package/dist/pi/packages/ta-secrets/lib/proxy-certs.d.ts +40 -0
- package/dist/pi/packages/ta-secrets/lib/proxy-certs.js +200 -0
- package/dist/pi/packages/ta-secrets/lib/proxy-scenario.d.ts +6 -0
- package/dist/pi/packages/ta-secrets/lib/proxy-scenario.js +91 -0
- package/dist/pi/packages/ta-secrets/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-secrets/lib/react.js +8 -0
- package/dist/pi/packages/ta-secrets/lib/scrubber.d.ts +20 -0
- package/dist/pi/packages/ta-secrets/lib/scrubber.js +70 -0
- package/dist/pi/packages/ta-secrets/lib/secrets-protocol.d.ts +106 -0
- package/dist/pi/packages/ta-secrets/lib/secrets-protocol.js +134 -0
- package/dist/pi/packages/ta-secrets/lib/server-texts.d.ts +14 -0
- package/dist/pi/packages/ta-secrets/lib/server-texts.js +62 -0
- package/dist/pi/packages/ta-secrets/lib/settings.d.ts +4 -0
- package/dist/pi/packages/ta-secrets/lib/settings.js +179 -0
- package/dist/pi/packages/ta-secrets/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-secrets/lib/style.js +32 -0
- package/dist/pi/packages/ta-secrets/lib/vault-fixture.d.ts +8 -0
- package/dist/pi/packages/ta-secrets/lib/vault-fixture.js +22 -0
- package/dist/pi/packages/ta-secrets/lib/vault-proxy.d.ts +94 -0
- package/dist/pi/packages/ta-secrets/lib/vault-proxy.js +357 -0
- package/dist/pi/packages/ta-secrets/lib/vault-service.d.ts +111 -0
- package/dist/pi/packages/ta-secrets/lib/vault-service.js +429 -0
- package/dist/pi/packages/ta-secrets/lib/vault-store.d.ts +48 -0
- package/dist/pi/packages/ta-secrets/lib/vault-store.js +107 -0
- package/dist/pi/packages/ta-secrets/package.json +67 -0
- package/dist/pi/packages/ta-secrets/web/index.js +579 -0
- package/dist/pi/packages/ta-share/extension/index.mjs +1 -0
- package/dist/pi/packages/ta-share/host/index.mjs +172 -21
- package/dist/pi/packages/ta-share/lib/i18n.d.ts +1 -0
- package/dist/pi/packages/ta-share/lib/i18n.js +4 -0
- package/dist/pi/packages/ta-share/lib/index.js +1 -1
- package/dist/pi/packages/ta-share/lib/share-dialog.js +1 -0
- package/dist/pi/packages/ta-share/lib/share-protocol.d.ts +2 -0
- package/dist/pi/packages/ta-share/lib/share-service.d.ts +11 -1
- package/dist/pi/packages/ta-share/lib/share-service.js +62 -4
- package/dist/pi/packages/ta-share/lib/snapshot.d.ts +8 -2
- package/dist/pi/packages/ta-share/lib/snapshot.js +93 -7
- package/dist/pi/packages/ta-share/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-share/lib/style.js +1 -1
- package/dist/pi/packages/ta-share/package.json +1 -1
- package/dist/pi/packages/ta-share/web/index.js +7 -2
- package/dist/pi/packages/ta-sync/host/index.mjs +1154 -755
- package/dist/pi/packages/ta-sync/lib/host.js +3 -0
- package/dist/pi/packages/ta-sync/lib/index.js +6 -2
- package/dist/pi/packages/ta-sync/lib/migrate-archive.d.ts +8 -6
- package/dist/pi/packages/ta-sync/lib/migrate-archive.js +24 -28
- package/dist/pi/packages/ta-sync/lib/migrate-i18n.d.ts +10 -0
- package/dist/pi/packages/ta-sync/lib/migrate-i18n.js +40 -0
- package/dist/pi/packages/ta-sync/lib/migrate-paths.d.ts +24 -0
- package/dist/pi/packages/ta-sync/lib/migrate-paths.js +230 -0
- package/dist/pi/packages/ta-sync/lib/migrate-protocol.d.ts +18 -0
- package/dist/pi/packages/ta-sync/lib/migrate-service.d.ts +11 -1
- package/dist/pi/packages/ta-sync/lib/migrate-service.js +28 -1
- package/dist/pi/packages/ta-sync/lib/move-panel.d.ts +9 -1
- package/dist/pi/packages/ta-sync/lib/move-panel.js +69 -5
- package/dist/pi/packages/ta-sync/lib/server-texts.d.ts +1 -0
- package/dist/pi/packages/ta-sync/lib/server-texts.js +9 -0
- package/dist/pi/packages/ta-sync/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-sync/lib/style.js +8 -1
- package/dist/pi/packages/ta-sync/lib/sync-service-base.d.ts +78 -0
- package/dist/pi/packages/ta-sync/lib/sync-service-base.js +224 -0
- package/dist/pi/packages/ta-sync/lib/sync-service-space.d.ts +36 -0
- package/dist/pi/packages/ta-sync/lib/sync-service-space.js +210 -0
- package/dist/pi/packages/ta-sync/lib/sync-service.d.ts +3 -99
- package/dist/pi/packages/ta-sync/lib/sync-service.js +2 -412
- package/dist/pi/packages/ta-sync/package.json +1 -1
- package/dist/pi/packages/ta-sync/web/index.js +138 -5
- package/dist/pi/packages/ta-sync-cloud/package.json +1 -1
- package/dist/pi/packages/ta-team/extension/index.mjs +1 -0
- package/dist/pi/packages/ta-team/host/index.mjs +1 -0
- package/dist/pi/packages/ta-team/lib/dialogs.d.ts +0 -2
- package/dist/pi/packages/ta-team/lib/dialogs.js +0 -227
- package/dist/pi/packages/ta-team/lib/i18n-ja.d.ts +3 -0
- package/dist/pi/packages/ta-team/lib/i18n-ja.js +211 -0
- package/dist/pi/packages/ta-team/lib/i18n-zh-tw.d.ts +3 -0
- package/dist/pi/packages/ta-team/lib/i18n-zh-tw.js +211 -0
- package/dist/pi/packages/ta-team/lib/i18n-zh.d.ts +3 -0
- package/dist/pi/packages/ta-team/lib/i18n-zh.js +211 -0
- package/dist/pi/packages/ta-team/lib/i18n.d.ts +1 -2
- package/dist/pi/packages/ta-team/lib/i18n.js +6 -624
- package/dist/pi/packages/ta-team/lib/index.js +3 -1
- package/dist/pi/packages/ta-team/lib/join-dialog.d.ts +3 -0
- package/dist/pi/packages/ta-team/lib/join-dialog.js +234 -0
- package/dist/pi/packages/ta-team/lib/members-tab.js +2 -1
- package/dist/pi/packages/ta-team/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-team/lib/style.js +1 -1
- package/dist/pi/packages/ta-team/package.json +1 -1
- package/dist/pi/packages/ta-team/web/index.js +2095 -2086
- package/dist/pi/packages/ta-usage/README.en.md +6 -0
- package/dist/pi/packages/ta-usage/README.md +6 -0
- package/dist/pi/packages/ta-usage/host/index.mjs +220 -0
- package/dist/pi/packages/ta-usage/lib/host.d.ts +4 -0
- package/dist/pi/packages/ta-usage/lib/host.js +9 -0
- package/dist/pi/packages/ta-usage/lib/i18n.d.ts +30 -0
- package/dist/pi/packages/ta-usage/lib/i18n.js +98 -0
- package/dist/pi/packages/ta-usage/lib/index.d.ts +4 -0
- package/dist/pi/packages/ta-usage/lib/index.js +20 -0
- package/dist/pi/packages/ta-usage/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-usage/lib/react.js +8 -0
- package/dist/pi/packages/ta-usage/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-usage/lib/style.js +53 -0
- package/dist/pi/packages/ta-usage/lib/usage-host.d.ts +25 -0
- package/dist/pi/packages/ta-usage/lib/usage-host.js +70 -0
- package/dist/pi/packages/ta-usage/lib/usage-protocol.d.ts +55 -0
- package/dist/pi/packages/ta-usage/lib/usage-protocol.js +7 -0
- package/dist/pi/packages/ta-usage/lib/usage-util.d.ts +18 -0
- package/dist/pi/packages/ta-usage/lib/usage-util.js +159 -0
- package/dist/pi/packages/ta-usage/lib/usage-view.d.ts +9 -0
- package/dist/pi/packages/ta-usage/lib/usage-view.js +91 -0
- package/dist/pi/packages/ta-usage/package.json +61 -0
- package/dist/pi/packages/ta-usage/web/index.js +471 -0
- package/dist/pi/packages/ta-voice/README.en.md +8 -0
- package/dist/pi/packages/ta-voice/README.md +8 -0
- package/dist/pi/packages/ta-voice/host/index.mjs +662 -0
- package/dist/pi/packages/ta-voice/lib/doubao-frames.d.ts +44 -0
- package/dist/pi/packages/ta-voice/lib/doubao-frames.js +116 -0
- package/dist/pi/packages/ta-voice/lib/doubao-realtime.d.ts +35 -0
- package/dist/pi/packages/ta-voice/lib/doubao-realtime.js +172 -0
- package/dist/pi/packages/ta-voice/lib/host.d.ts +20 -0
- package/dist/pi/packages/ta-voice/lib/host.js +120 -0
- package/dist/pi/packages/ta-voice/lib/openai-realtime.d.ts +73 -0
- package/dist/pi/packages/ta-voice/lib/openai-realtime.js +257 -0
- package/dist/pi/packages/ta-voice/lib/realtime-socket.d.ts +23 -0
- package/dist/pi/packages/ta-voice/lib/realtime-socket.js +80 -0
- package/dist/pi/packages/ta-voice/package.json +67 -0
- package/dist/pi/packages/ta-workspace/README.md +1 -1
- package/dist/pi/packages/ta-workspace/README.zh-cn.md +1 -1
- package/dist/pi/packages/ta-workspace/lib/browser-common.d.ts +4 -0
- package/dist/pi/packages/ta-workspace/lib/browser-common.js +1 -0
- package/dist/pi/packages/ta-workspace/lib/browser-pick.d.ts +49 -0
- package/dist/pi/packages/ta-workspace/lib/browser-pick.js +166 -0
- package/dist/pi/packages/ta-workspace/lib/browser-webview.js +16 -1
- package/dist/pi/packages/ta-workspace/lib/i18n-en.d.ts +3 -0
- package/dist/pi/packages/ta-workspace/lib/i18n-en.js +215 -0
- package/dist/pi/packages/ta-workspace/lib/i18n-ja.d.ts +3 -0
- package/dist/pi/packages/ta-workspace/lib/i18n-ja.js +215 -0
- package/dist/pi/packages/ta-workspace/lib/i18n-zh-tw.d.ts +3 -0
- package/dist/pi/packages/ta-workspace/lib/i18n-zh-tw.js +215 -0
- package/dist/pi/packages/ta-workspace/lib/i18n.d.ts +7 -3
- package/dist/pi/packages/ta-workspace/lib/i18n.js +11 -621
- package/dist/pi/packages/ta-workspace/package.json +1 -1
- package/dist/pi/packages/ta-workspace/web/index.js +1504 -770
- package/dist/public/assets/{abnfDiagram-S7VZAUFO-Dd51Bqbx.js → abnfDiagram-S7VZAUFO-w8qXXVn-.js} +1 -1
- package/dist/public/assets/{architecture-WOLXFQ4H-BbG3_x7_.js → architecture-WOLXFQ4H-B-FHaYwY.js} +1 -1
- package/dist/public/assets/{architectureDiagram-YGSQEFNW-DbJO4t8I.js → architectureDiagram-YGSQEFNW-DTnoGaaX.js} +1 -1
- package/dist/public/assets/{blockDiagram-APKKGZFW-BwtrHF1f.js → blockDiagram-APKKGZFW-CyeBzv-v.js} +1 -1
- package/dist/public/assets/{browser-D2BcOPKG.js → browser-Cb38iiEE.js} +1 -1
- package/dist/public/assets/{browser-CTbeNBsA.js → browser-DXexCqIh.js} +2 -2
- package/dist/public/assets/{c4Diagram-KJ2TOQU5-CfBe5A0H.js → c4Diagram-KJ2TOQU5-CJJqDqyQ.js} +1 -1
- package/dist/public/assets/{chunk-6MUBBAK2-C7R0mhrg.js → chunk-6MUBBAK2-DbvUMdNm.js} +1 -1
- package/dist/public/assets/{chunk-AXFCVDMN-VQgQruZT.js → chunk-AXFCVDMN-D4hlZGtj.js} +1 -1
- package/dist/public/assets/{chunk-BG4553SI-CkUi_vD5.js → chunk-BG4553SI-VNa9Q9On.js} +1 -1
- package/dist/public/assets/{chunk-DQASFODM-BAQq7ktk.js → chunk-DQASFODM-BtlEbc_V.js} +1 -1
- package/dist/public/assets/{chunk-HFQBQIA3-B1oF8lB7.js → chunk-HFQBQIA3-CAYSo4CJ.js} +1 -1
- package/dist/public/assets/{chunk-KQLB2F66-DE5amcgT.js → chunk-KQLB2F66-CyKdg6hW.js} +1 -1
- package/dist/public/assets/{chunk-KS47KZWR-ev9S_csp.js → chunk-KS47KZWR-BMogCB2r.js} +1 -1
- package/dist/public/assets/{chunk-LEVMRMFU-ziqnRvTG.js → chunk-LEVMRMFU-Y9wr-8qB.js} +1 -1
- package/dist/public/assets/{chunk-M57EVK23-DaqPdEKA.js → chunk-M57EVK23-DL3IAQKR.js} +1 -1
- package/dist/public/assets/{chunk-OY52VR5R-DFOG8j6z.js → chunk-OY52VR5R-CJBFHdg6.js} +1 -1
- package/dist/public/assets/{chunk-QB3YPZ4I-eg35JLLN.js → chunk-QB3YPZ4I-CyuWKZZv.js} +1 -1
- package/dist/public/assets/{chunk-R3KSYZAL-J73nie-R.js → chunk-R3KSYZAL-DxvGhfpm.js} +1 -1
- package/dist/public/assets/{chunk-STOXU5M4-B8EvDZvB.js → chunk-STOXU5M4-Cpdl6bfz.js} +1 -1
- package/dist/public/assets/{chunk-TU62E6Q5-DyCM007V.js → chunk-TU62E6Q5-CIxOg6QF.js} +1 -1
- package/dist/public/assets/{chunk-X4PVCEUW-BBGeCNmA.js → chunk-X4PVCEUW-DCFSCRBh.js} +1 -1
- package/dist/public/assets/{chunk-XXDRQBXY-CAtJ2Wph.js → chunk-XXDRQBXY-B2R8Cxf7.js} +1 -1
- package/dist/public/assets/{classDiagram-v2-L25IHNXF-DhQM6yHy.js → classDiagram-v2-L25IHNXF-B7W9HSbj.js} +1 -1
- package/dist/public/assets/{client-C8gi9Fk2.js → client-D75LfyFa.js} +1 -1
- package/dist/public/assets/{common-DrZR0tgm.js → common-CjqTomRQ.js} +1 -1
- package/dist/public/assets/{cose-bilkent-JH36ORCC-AqIcHabu.js → cose-bilkent-JH36ORCC-CXSLFyCH.js} +1 -1
- package/dist/public/assets/cynefin-EF2NZ3EQ-BIcbDns7.js +1 -0
- package/dist/public/assets/{cynefinDiagram-L36ESFBY-7SyXzhRd.js → cynefinDiagram-L36ESFBY-DTv0Kn1r.js} +1 -1
- package/dist/public/assets/{d3-selection-DsahLieG.js → d3-selection-g4Hl3_NH.js} +1 -1
- package/dist/public/assets/{dagre-SPEB5RXH-DalaGtMS.js → dagre-SPEB5RXH-BujVqk5R.js} +1 -1
- package/dist/public/assets/{diagram-3B7GL73J-BcY-qB9G.js → diagram-3B7GL73J-Ds-VnLzP.js} +1 -1
- package/dist/public/assets/{diagram-DNEMPZML-NV7fbe0h.js → diagram-DNEMPZML-BBoIIK-a.js} +1 -1
- package/dist/public/assets/{diagram-L3MUGCDN-BPx4GHoj.js → diagram-L3MUGCDN-Glgd5N_n.js} +1 -1
- package/dist/public/assets/{diagram-LA4NIPWU-BeUxqmw1.js → diagram-LA4NIPWU-B4EODdUU.js} +1 -1
- package/dist/public/assets/{diagram-MHCOC4E2-Dlg1S5na.js → diagram-MHCOC4E2-pzDDXO2J.js} +1 -1
- package/dist/public/assets/{diagram-XPFHEONP-DQhRoMkK.js → diagram-XPFHEONP-l--gwSuK.js} +1 -1
- package/dist/public/assets/{dist-CQU8zJh_.js → dist-C0u3lAFR.js} +1 -1
- package/dist/public/assets/{ebnfDiagram-UZSYDL2S-gVEs3Um2.js → ebnfDiagram-UZSYDL2S-BVfPeaVX.js} +1 -1
- package/dist/public/assets/{editor.api-SQ1snuat.js → editor.api-BMcewI3C.js} +1 -1
- package/dist/public/assets/{elk-XV6XMXQE-CHtlrPwu.js → elk-XV6XMXQE-BFJtUnG9.js} +1 -1
- package/dist/public/assets/{erDiagram-EYBAPDEH-B0xok726.js → erDiagram-EYBAPDEH-BWxMtfIc.js} +1 -1
- package/dist/public/assets/{eventmodeling-K75KTNOO-CFwphA0e.js → eventmodeling-K75KTNOO-YwYgBgCX.js} +1 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-Dah4--NW.js +1 -0
- package/dist/public/assets/{freemarker2-DJKO-X2B.js → freemarker2-B8HquI7K.js} +1 -1
- package/dist/public/assets/{ganttDiagram-23REXITY-B5wVGN1A.js → ganttDiagram-23REXITY-CBqv7wbi.js} +1 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-BwDfrSZS.js +1 -0
- package/dist/public/assets/{gitGraphDiagram-STJD7YCW-DEjNU1R_.js → gitGraphDiagram-STJD7YCW-BLSf23f_.js} +1 -1
- package/dist/public/assets/{handlebars-ChVN7JPd.js → handlebars-P1qmNq4N.js} +1 -1
- package/dist/public/assets/{html-CQ0znKSa.js → html-Ceswbytr.js} +1 -1
- package/dist/public/assets/{index-CLlacdXR.js → index-10isUUN4.js} +2 -2
- package/dist/public/assets/info-OHQRW6UA-Ch8aMV1p.js +1 -0
- package/dist/public/assets/{infoDiagram-KBXO4MBG-CJtrS72M.js → infoDiagram-KBXO4MBG-LvOtgUlm.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-M35NCXHK-qYI1QBsK.js → ishikawaDiagram-M35NCXHK-CwUZOvcm.js} +1 -1
- package/dist/public/assets/{javascript-B-DHbkyI.js → javascript-B3FXC8qR.js} +1 -1
- package/dist/public/assets/{journeyDiagram-OPLOXDXO-BOQ2y2ZZ.js → journeyDiagram-OPLOXDXO-5j1KtwTt.js} +1 -1
- package/dist/public/assets/{jsonMode-XuGC5N_z.js → jsonMode-CrCyxNQI.js} +1 -1
- package/dist/public/assets/{kanban-definition-BZKZHSQY-BJ64tKdP.js → kanban-definition-BZKZHSQY-BKAB5id1.js} +1 -1
- package/dist/public/assets/{liquid-B0Ujylzc.js → liquid-CXZRIgp2.js} +1 -1
- package/dist/public/assets/{mdx-B19-V510.js → mdx-Dm3uNczM.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-Scb01iBq.js → mermaid-parser.core-C755A-rX.js} +3 -3
- package/dist/public/assets/{mermaid.core-BMuvs7us.js → mermaid.core-CQrYmFAR.js} +4 -4
- package/dist/public/assets/{mindmap-definition-I2QAS2VK-BYfOS3XN.js → mindmap-definition-I2QAS2VK-DNJQKYbK.js} +1 -1
- package/dist/public/assets/module-9otB6_kX.js +1 -0
- package/dist/public/assets/{module-Cm_mLwAQ.js → module-C3jC5acf.js} +1 -1
- package/dist/public/assets/module-C_MyFORb.js +1 -0
- package/dist/public/assets/module-Cjpl4gva.js +1 -0
- package/dist/public/assets/{module-DUYj4E8T.js → module-D8yH9xCl.js} +1 -1
- package/dist/public/assets/module-DlHjBjOg.js +1 -0
- package/dist/public/assets/module-QsLiJaR6.js +1 -0
- package/dist/public/assets/module-aaW5Ri2L.js +2771 -0
- package/dist/public/assets/module-gSy9fKBo.js +1 -0
- package/dist/public/assets/{monaco-Bbe2os7m.js → monaco-BS7JBNW4.js} +3 -3
- package/dist/public/assets/packet-JDAUHWVQ-LqMrrc60.js +1 -0
- package/dist/public/assets/{pegDiagram-FD4XPPHP-D-Vlq9Gm.js → pegDiagram-FD4XPPHP-BzbBCWht.js} +1 -1
- package/dist/public/assets/pie-XZMESJXO-BWzABXQU.js +1 -0
- package/dist/public/assets/{pieDiagram-J4AKIIQI-_-94-aMD.js → pieDiagram-J4AKIIQI-Bf_LDukL.js} +1 -1
- package/dist/public/assets/{python-CWnMIOYq.js → python-jgOUhB-F.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-XTYBLID2-BhFUbUYz.js → quadrantDiagram-XTYBLID2-CdMHWnKX.js} +1 -1
- package/dist/public/assets/radar-ABXABTNO-CR4kNiUj.js +1 -0
- package/dist/public/assets/railroad-I3PHUGI6-BAkWtkGC.js +1 -0
- package/dist/public/assets/{railroad-abnf-LNEFI6M7-yUa9GGCQ.js → railroad-abnf-LNEFI6M7-DQGYaRbc.js} +1 -1
- package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-xY4YiL8M.js → railroad-ebnf-DWYD2UWJ-D6Ljza0U.js} +1 -1
- package/dist/public/assets/{railroad-peg-JR7BVNR7-BYFYCUAQ.js → railroad-peg-JR7BVNR7-Du9hL1Gf.js} +1 -1
- package/dist/public/assets/{railroadDiagram-MRQ6NCDL-C9FVhj0k.js → railroadDiagram-MRQ6NCDL-CS_JnlGN.js} +1 -1
- package/dist/public/assets/{razor-bDtpN6EJ.js → razor-BWj90God.js} +1 -1
- package/dist/public/assets/{requirementDiagram-Y7LWUY3S-DLmAg-6C.js → requirementDiagram-Y7LWUY3S-Cq8rRz2y.js} +1 -1
- package/dist/public/assets/{resolver-0zC31mg5.js → resolver-BPuspqws.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-WGJFYUXA-Bl5IpDk4.js → sankeyDiagram-WGJFYUXA-aK7jRBVK.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-5NDRBG5M-Z-N0OiT_.js → sequenceDiagram-5NDRBG5M-BxcIyc38.js} +1 -1
- package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-ctKQz8Mo.js → stateDiagram-v2-FJ4FJNEA-Ctletlj4.js} +1 -1
- package/dist/public/assets/{swimlanes-UMQ2AFYF-CWLKnALg.js → swimlanes-UMQ2AFYF-DaD55xd2.js} +1 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-CytCT4x3.js +8 -0
- package/dist/public/assets/{timeline-definition-SEUHKTQE-DP8Ph_d6.js → timeline-definition-SEUHKTQE-Ce19CDiJ.js} +1 -1
- package/dist/public/assets/treeView-D4JQ5SDB-DvzNkX4G.js +1 -0
- package/dist/public/assets/treemap-SAJKECNS-BuUeBmMd.js +1 -0
- package/dist/public/assets/{typescript-CGpNlLbn.js → typescript-RgyfxmPQ.js} +1 -1
- package/dist/public/assets/{usecaseDiagram-AFA6YXN4-DvFjNj3J.js → usecaseDiagram-AFA6YXN4-CAVEBKQS.js} +1 -1
- package/dist/public/assets/{vennDiagram-NNMJR3RB-3m2F2H-I.js → vennDiagram-NNMJR3RB-DHyJxlHv.js} +1 -1
- package/dist/public/assets/wardley-7MLQ67FV-DSfdKACG.js +1 -0
- package/dist/public/assets/{wardleyDiagram-S7YFUSEH-CsMntu16.js → wardleyDiagram-S7YFUSEH-C-FCHxR7.js} +1 -1
- package/dist/public/assets/{xml-ByiLoakX.js → xml-DiA1T3iN.js} +1 -1
- package/dist/public/assets/{xychartDiagram-GGNKY7IX-C80rxvM0.js → xychartDiagram-GGNKY7IX-BlnHU6Gz.js} +1 -1
- package/dist/public/assets/{yaml-Cz2Af5Rj.js → yaml-dnCcfJBR.js} +1 -1
- package/dist/public/ext/index.json +1 -0
- package/dist/public/ext/ta-3d.js +660 -0
- package/dist/public/ext/ta-glance.js +1611 -0
- package/dist/public/ext/ta-plot.js +1320 -0
- package/dist/public/index.html +2 -2
- package/dist/serve/index.mjs +17829 -14233
- package/package.json +45 -39
- package/dist/public/assets/cynefin-EF2NZ3EQ-yFytgtiy.js +0 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-Cwye_DsX.js +0 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-BYzb--zb.js +0 -1
- package/dist/public/assets/info-OHQRW6UA-na0qX3JP.js +0 -1
- package/dist/public/assets/module-B3SKdB70.js +0 -1
- package/dist/public/assets/module-DDH-aU6z.js +0 -1
- package/dist/public/assets/module-DOrYVZ7B.js +0 -2615
- package/dist/public/assets/module-DRofmFJn.js +0 -1
- package/dist/public/assets/module-MaD4hvv4.js +0 -1
- package/dist/public/assets/module-ZDJutm0b.js +0 -1
- package/dist/public/assets/module-qoBVcE5h.js +0 -1
- package/dist/public/assets/packet-JDAUHWVQ-jhCd70vR.js +0 -1
- package/dist/public/assets/pie-XZMESJXO-DV0NJFsI.js +0 -1
- package/dist/public/assets/radar-ABXABTNO-Co-Hlf34.js +0 -1
- package/dist/public/assets/railroad-I3PHUGI6-DKMPEjDD.js +0 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-CU76xJSu.js +0 -8
- package/dist/public/assets/treeView-D4JQ5SDB-JMMnu_MW.js +0 -1
- package/dist/public/assets/treemap-SAJKECNS-CPlAD3X1.js +0 -1
- package/dist/public/assets/wardley-7MLQ67FV-Dhc8wpLp.js +0 -1
|
@@ -0,0 +1,1341 @@
|
|
|
1
|
+
// web-src/proxy-certs.ts
|
|
2
|
+
import { generateKeyPairSync, randomBytes } from "node:crypto";
|
|
3
|
+
import { mkdtemp, readFile as readFile2, rm, writeFile as writeFile2 } from "node:fs/promises";
|
|
4
|
+
import { isIP } from "node:net";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { join as join2 } from "node:path";
|
|
7
|
+
import * as tls from "node:tls";
|
|
8
|
+
|
|
9
|
+
// web-src/vault-store.ts
|
|
10
|
+
import { spawn } from "node:child_process";
|
|
11
|
+
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
12
|
+
import { dirname, join } from "node:path";
|
|
13
|
+
var VaultStores;
|
|
14
|
+
((VaultStores) => {
|
|
15
|
+
VaultStores.SERVICE = "Ta secrets";
|
|
16
|
+
function of(agentDir, env = process.env, platform = process.platform) {
|
|
17
|
+
return platform === "darwin" && env.TA_SECRETS_STORE !== "file" ? new MacKeychain : new FileVault(join(agentDir, "secrets", "vault.json"));
|
|
18
|
+
}
|
|
19
|
+
VaultStores.of = of;
|
|
20
|
+
function run(command, args, input) {
|
|
21
|
+
return new Promise((resolve) => {
|
|
22
|
+
const child = spawn(command, args, { stdio: ["pipe", "pipe", "pipe"] });
|
|
23
|
+
let stdout = "";
|
|
24
|
+
let stderr = "";
|
|
25
|
+
child.stdout.on("data", (chunk) => {
|
|
26
|
+
stdout += chunk;
|
|
27
|
+
});
|
|
28
|
+
child.stderr.on("data", (chunk) => {
|
|
29
|
+
stderr += chunk;
|
|
30
|
+
});
|
|
31
|
+
child.on("error", (error) => resolve({ code: -1, stdout, stderr: error.message }));
|
|
32
|
+
child.on("close", (code) => resolve({ code: code ?? -1, stdout, stderr }));
|
|
33
|
+
child.stdin.end(input ?? "");
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
VaultStores.run = run;
|
|
37
|
+
})(VaultStores ||= {});
|
|
38
|
+
|
|
39
|
+
class MacKeychain {
|
|
40
|
+
service;
|
|
41
|
+
kind = "keychain";
|
|
42
|
+
constructor(service = VaultStores.SERVICE) {
|
|
43
|
+
this.service = service;
|
|
44
|
+
}
|
|
45
|
+
async get(name) {
|
|
46
|
+
const found = await VaultStores.run("security", ["find-generic-password", "-s", this.service, "-a", name, "-w"]);
|
|
47
|
+
return found.code === 0 ? Buffer.from(found.stdout.trim(), "base64").toString("utf8") : undefined;
|
|
48
|
+
}
|
|
49
|
+
async set(name, value) {
|
|
50
|
+
const data = Buffer.from(value, "utf8").toString("base64");
|
|
51
|
+
const done = await VaultStores.run("security", ["-i"], `add-generic-password -U -s "${this.service}" -a "${name}" -l "${this.service}: ${name}" -w "${data}"
|
|
52
|
+
`);
|
|
53
|
+
if (await this.get(name) !== value) {
|
|
54
|
+
throw new Error(`The keychain did not keep ${name}: ${done.stderr.trim() || "unknown error"}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async remove(name) {
|
|
58
|
+
await VaultStores.run("security", ["delete-generic-password", "-s", this.service, "-a", name]);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
class FileVault {
|
|
63
|
+
path;
|
|
64
|
+
kind = "file";
|
|
65
|
+
queue = Promise.resolve();
|
|
66
|
+
constructor(path) {
|
|
67
|
+
this.path = path;
|
|
68
|
+
}
|
|
69
|
+
async get(name) {
|
|
70
|
+
const data = (await this.read())[name];
|
|
71
|
+
return typeof data === "string" ? Buffer.from(data, "base64").toString("utf8") : undefined;
|
|
72
|
+
}
|
|
73
|
+
set(name, value) {
|
|
74
|
+
return this.change((values) => {
|
|
75
|
+
values[name] = Buffer.from(value, "utf8").toString("base64");
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
remove(name) {
|
|
79
|
+
return this.change((values) => {
|
|
80
|
+
delete values[name];
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
async read() {
|
|
84
|
+
try {
|
|
85
|
+
const values = JSON.parse(await readFile(this.path, "utf8"));
|
|
86
|
+
return values && typeof values === "object" && !Array.isArray(values) ? values : {};
|
|
87
|
+
} catch {
|
|
88
|
+
return {};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
change(apply) {
|
|
92
|
+
const next = this.queue.then(async () => {
|
|
93
|
+
const values = await this.read();
|
|
94
|
+
apply(values);
|
|
95
|
+
await mkdir(dirname(this.path), { recursive: true, mode: 448 });
|
|
96
|
+
const temporary = `${this.path}.${process.pid}.${Date.now()}.tmp`;
|
|
97
|
+
await writeFile(temporary, `${JSON.stringify(values, null, 2)}
|
|
98
|
+
`, { mode: 384 });
|
|
99
|
+
await rename(temporary, this.path);
|
|
100
|
+
});
|
|
101
|
+
this.queue = next.catch(() => {
|
|
102
|
+
return;
|
|
103
|
+
});
|
|
104
|
+
return next;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// web-src/proxy-certs.ts
|
|
109
|
+
var CONFIG = `[req]
|
|
110
|
+
distinguished_name = dn
|
|
111
|
+
prompt = no
|
|
112
|
+
[dn]
|
|
113
|
+
CN = Ta vault proxy
|
|
114
|
+
[ca]
|
|
115
|
+
basicConstraints = critical,CA:TRUE,pathlen:0
|
|
116
|
+
keyUsage = critical,keyCertSign,cRLSign
|
|
117
|
+
subjectKeyIdentifier = hash
|
|
118
|
+
`;
|
|
119
|
+
|
|
120
|
+
class ProxyCerts {
|
|
121
|
+
openssl;
|
|
122
|
+
folder;
|
|
123
|
+
authority;
|
|
124
|
+
leaves = new Map;
|
|
125
|
+
bundled;
|
|
126
|
+
constructor(openssl = process.env.TA_SECRETS_OPENSSL || "openssl") {
|
|
127
|
+
this.openssl = openssl;
|
|
128
|
+
}
|
|
129
|
+
async ca() {
|
|
130
|
+
return (await this.made()).cert;
|
|
131
|
+
}
|
|
132
|
+
async cacertFile() {
|
|
133
|
+
const file = join2(await this.dir(), "ca-only.pem");
|
|
134
|
+
await writeFile2(file, await this.ca(), { mode: 384 });
|
|
135
|
+
return file;
|
|
136
|
+
}
|
|
137
|
+
leaf(host) {
|
|
138
|
+
let leaf = this.leaves.get(host);
|
|
139
|
+
if (!leaf) {
|
|
140
|
+
leaf = this.sign(host);
|
|
141
|
+
this.leaves.set(host, leaf);
|
|
142
|
+
leaf.catch(() => this.leaves.delete(host));
|
|
143
|
+
}
|
|
144
|
+
return leaf;
|
|
145
|
+
}
|
|
146
|
+
madeFor(host) {
|
|
147
|
+
return this.leaves.has(host);
|
|
148
|
+
}
|
|
149
|
+
bundle() {
|
|
150
|
+
this.bundled ??= (async () => {
|
|
151
|
+
const getCA = tls.getCACertificates;
|
|
152
|
+
const system = (() => {
|
|
153
|
+
try {
|
|
154
|
+
return getCA?.("system") ?? [];
|
|
155
|
+
} catch {
|
|
156
|
+
return [];
|
|
157
|
+
}
|
|
158
|
+
})();
|
|
159
|
+
const extra = await Promise.all([process.env.NODE_EXTRA_CA_CERTS, process.env.SSL_CERT_FILE].filter(Boolean).map((file2) => readFile2(file2, "utf8").catch(() => "")));
|
|
160
|
+
const all = [...new Set([...tls.rootCertificates, ...system].map((cert) => cert.trim()))];
|
|
161
|
+
const file = join2(await this.dir(), "bundle.pem");
|
|
162
|
+
await writeFile2(file, `${[...all, ...extra.map((text) => text.trim()).filter(Boolean), (await this.ca()).trim()].join(`
|
|
163
|
+
`)}
|
|
164
|
+
`, { mode: 384 });
|
|
165
|
+
return file;
|
|
166
|
+
})();
|
|
167
|
+
this.bundled.catch(() => {
|
|
168
|
+
this.bundled = undefined;
|
|
169
|
+
});
|
|
170
|
+
return this.bundled;
|
|
171
|
+
}
|
|
172
|
+
async dispose() {
|
|
173
|
+
const folder = this.folder;
|
|
174
|
+
this.folder = undefined;
|
|
175
|
+
this.authority = undefined;
|
|
176
|
+
this.bundled = undefined;
|
|
177
|
+
this.leaves.clear();
|
|
178
|
+
if (folder) {
|
|
179
|
+
await rm(await folder, { recursive: true, force: true }).catch(() => {
|
|
180
|
+
return;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
dir() {
|
|
185
|
+
this.folder ??= mkdtemp(join2(tmpdir(), "ta-vault-proxy-"));
|
|
186
|
+
return this.folder;
|
|
187
|
+
}
|
|
188
|
+
made() {
|
|
189
|
+
this.authority ??= (async () => {
|
|
190
|
+
const dir = await this.dir();
|
|
191
|
+
const key = join2(dir, "ca.key");
|
|
192
|
+
const cert = join2(dir, "ca.pem");
|
|
193
|
+
const config = join2(dir, "ca.cnf");
|
|
194
|
+
await writeFile2(key, ProxyCerts.key(), { mode: 384 });
|
|
195
|
+
await writeFile2(config, CONFIG, { mode: 384 });
|
|
196
|
+
await this.run(["req", "-x509", "-new", "-key", key, "-out", cert, "-days", "365", "-sha256", "-config", config, "-extensions", "ca"]);
|
|
197
|
+
return { key: await readFile2(key, "utf8"), cert: await readFile2(cert, "utf8") };
|
|
198
|
+
})();
|
|
199
|
+
this.authority.catch(() => {
|
|
200
|
+
this.authority = undefined;
|
|
201
|
+
});
|
|
202
|
+
return this.authority;
|
|
203
|
+
}
|
|
204
|
+
async sign(host) {
|
|
205
|
+
await this.made();
|
|
206
|
+
const dir = await this.dir();
|
|
207
|
+
const stem = join2(dir, `leaf-${randomBytes(6).toString("hex")}`);
|
|
208
|
+
const key = ProxyCerts.key();
|
|
209
|
+
const san = isIP(host) ? `IP:${host}` : `DNS:${host}`;
|
|
210
|
+
await writeFile2(`${stem}.key`, key, { mode: 384 });
|
|
211
|
+
await writeFile2(`${stem}.cnf`, CONFIG.replace("CN = Ta vault proxy", `CN = ${host.replace(/[^A-Za-z0-9.:-]/g, "")}`), { mode: 384 });
|
|
212
|
+
await writeFile2(`${stem}.ext`, `[leaf]
|
|
213
|
+
basicConstraints = critical,CA:FALSE
|
|
214
|
+
keyUsage = critical,digitalSignature
|
|
215
|
+
extendedKeyUsage = serverAuth
|
|
216
|
+
subjectAltName = ${san}
|
|
217
|
+
`, { mode: 384 });
|
|
218
|
+
await this.run(["req", "-new", "-key", `${stem}.key`, "-out", `${stem}.csr`, "-config", `${stem}.cnf`]);
|
|
219
|
+
await this.run([
|
|
220
|
+
"x509",
|
|
221
|
+
"-req",
|
|
222
|
+
"-in",
|
|
223
|
+
`${stem}.csr`,
|
|
224
|
+
"-CA",
|
|
225
|
+
join2(dir, "ca.pem"),
|
|
226
|
+
"-CAkey",
|
|
227
|
+
join2(dir, "ca.key"),
|
|
228
|
+
"-set_serial",
|
|
229
|
+
`0x1${randomBytes(15).toString("hex")}`,
|
|
230
|
+
"-days",
|
|
231
|
+
"90",
|
|
232
|
+
"-sha256",
|
|
233
|
+
"-extfile",
|
|
234
|
+
`${stem}.ext`,
|
|
235
|
+
"-extensions",
|
|
236
|
+
"leaf",
|
|
237
|
+
"-out",
|
|
238
|
+
`${stem}.pem`
|
|
239
|
+
]);
|
|
240
|
+
const cert = await readFile2(`${stem}.pem`, "utf8");
|
|
241
|
+
await Promise.all([".key", ".csr", ".cnf", ".ext", ".pem"].map((suffix) => rm(stem + suffix, { force: true })));
|
|
242
|
+
return { key, cert };
|
|
243
|
+
}
|
|
244
|
+
async run(args) {
|
|
245
|
+
const done = await VaultStores.run(this.openssl, args);
|
|
246
|
+
if (done.code !== 0) {
|
|
247
|
+
throw new Error(`openssl ${args[0]} failed: ${done.stderr.trim().split(`
|
|
248
|
+
`)[0] || done.code}`);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
static key() {
|
|
252
|
+
return generateKeyPairSync("ec", {
|
|
253
|
+
namedCurve: "prime256v1",
|
|
254
|
+
privateKeyEncoding: { type: "pkcs8", format: "pem" },
|
|
255
|
+
publicKeyEncoding: { type: "spki", format: "pem" }
|
|
256
|
+
}).privateKey;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// web-src/vault-proxy.ts
|
|
261
|
+
import { randomBytes as randomBytes2, timingSafeEqual } from "node:crypto";
|
|
262
|
+
import { createServer, request as httpRequest } from "node:http";
|
|
263
|
+
import { request as httpsRequest } from "node:https";
|
|
264
|
+
import { connect, isIP as isIP2 } from "node:net";
|
|
265
|
+
import * as tls2 from "node:tls";
|
|
266
|
+
var SESSION_MS = 2 * 3600000;
|
|
267
|
+
|
|
268
|
+
class VaultProxy {
|
|
269
|
+
options;
|
|
270
|
+
server;
|
|
271
|
+
listening;
|
|
272
|
+
inner;
|
|
273
|
+
sessions = new Map;
|
|
274
|
+
targets = new WeakMap;
|
|
275
|
+
constructor(options) {
|
|
276
|
+
this.options = options;
|
|
277
|
+
this.inner = createServer((request, response) => this.forwardTls(request, response));
|
|
278
|
+
this.inner.on("clientError", (_error, socket) => socket.destroy());
|
|
279
|
+
}
|
|
280
|
+
start() {
|
|
281
|
+
this.listening ??= new Promise((resolve, reject) => {
|
|
282
|
+
const server = createServer((request, response) => this.forwardPlain(request, response));
|
|
283
|
+
server.on("connect", (request, socket, head) => void this.connectTo(request, socket, head));
|
|
284
|
+
server.on("clientError", (_error, socket) => socket.destroy());
|
|
285
|
+
server.once("error", reject);
|
|
286
|
+
server.listen(0, "127.0.0.1", () => {
|
|
287
|
+
this.server = server;
|
|
288
|
+
const address = server.address();
|
|
289
|
+
resolve(typeof address === "object" && address ? address.port : 0);
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
this.listening.catch(() => {
|
|
293
|
+
this.listening = undefined;
|
|
294
|
+
});
|
|
295
|
+
return this.listening;
|
|
296
|
+
}
|
|
297
|
+
async open(secrets, conversation) {
|
|
298
|
+
const port = await this.start();
|
|
299
|
+
const now = Date.now();
|
|
300
|
+
for (const [key, session] of this.sessions) {
|
|
301
|
+
if (session.expires < now) {
|
|
302
|
+
this.sessions.delete(key);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
const token = randomBytes2(18).toString("base64url");
|
|
306
|
+
this.sessions.set(token, { token: Buffer.from(token), secrets, expires: now + SESSION_MS, conversation, told: new Set });
|
|
307
|
+
return `http://ta:${token}@127.0.0.1:${port}`;
|
|
308
|
+
}
|
|
309
|
+
bundle() {
|
|
310
|
+
return this.options.certs.bundle();
|
|
311
|
+
}
|
|
312
|
+
async dispose() {
|
|
313
|
+
this.sessions.clear();
|
|
314
|
+
await this.options.certs.dispose();
|
|
315
|
+
const server = this.server;
|
|
316
|
+
this.server = undefined;
|
|
317
|
+
this.listening = undefined;
|
|
318
|
+
if (server) {
|
|
319
|
+
server.closeAllConnections?.();
|
|
320
|
+
await new Promise((resolve) => server.close(() => resolve()));
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
session(request) {
|
|
324
|
+
const header = request.headers["proxy-authorization"];
|
|
325
|
+
const match = typeof header === "string" ? /^Basic\s+(.+)$/i.exec(header.trim()) : null;
|
|
326
|
+
const decoded = match ? Buffer.from(match[1], "base64").toString("utf8") : "";
|
|
327
|
+
const token = decoded.slice(decoded.indexOf(":") + 1);
|
|
328
|
+
const session = this.sessions.get(token);
|
|
329
|
+
return session && session.expires > Date.now() && timingSafeEqual(session.token, Buffer.from(token)) ? session : undefined;
|
|
330
|
+
}
|
|
331
|
+
async connectTo(request, socket, head) {
|
|
332
|
+
socket.on("error", () => socket.destroy());
|
|
333
|
+
const session = this.session(request);
|
|
334
|
+
if (!session) {
|
|
335
|
+
socket.end(`HTTP/1.1 407 Proxy Authentication Required\r
|
|
336
|
+
Proxy-Authenticate: Basic realm="Ta vault"\r
|
|
337
|
+
Content-Length: 0\r
|
|
338
|
+
\r
|
|
339
|
+
`);
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
const target = VaultProxy.target(request.url ?? "");
|
|
343
|
+
if (!target) {
|
|
344
|
+
socket.end(`HTTP/1.1 400 Bad Request\r
|
|
345
|
+
Content-Length: 0\r
|
|
346
|
+
\r
|
|
347
|
+
`);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (head.length) {
|
|
351
|
+
socket.unshift(head);
|
|
352
|
+
}
|
|
353
|
+
if (VaultProxy.boundTo(session, target.host, target.port).length) {
|
|
354
|
+
try {
|
|
355
|
+
const leaf = await this.options.certs.leaf(target.host);
|
|
356
|
+
socket.write(`HTTP/1.1 200 Connection Established\r
|
|
357
|
+
\r
|
|
358
|
+
`);
|
|
359
|
+
const secure = new tls2.TLSSocket(socket, { isServer: true, key: leaf.key, cert: leaf.cert, ALPNProtocols: ["http/1.1"] });
|
|
360
|
+
secure.on("error", () => secure.destroy());
|
|
361
|
+
this.targets.set(secure, { ...target, session });
|
|
362
|
+
this.inner.emit("connection", secure);
|
|
363
|
+
} catch {
|
|
364
|
+
socket.end(`HTTP/1.1 502 Bad Gateway\r
|
|
365
|
+
Content-Length: 0\r
|
|
366
|
+
\r
|
|
367
|
+
`);
|
|
368
|
+
}
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
try {
|
|
372
|
+
const upstream = await this.reach(target.host, target.port);
|
|
373
|
+
upstream.on("error", () => socket.destroy());
|
|
374
|
+
socket.write(`HTTP/1.1 200 Connection Established\r
|
|
375
|
+
\r
|
|
376
|
+
`);
|
|
377
|
+
socket.pipe(upstream).pipe(socket);
|
|
378
|
+
socket.on("close", () => upstream.destroy());
|
|
379
|
+
} catch {
|
|
380
|
+
socket.end(`HTTP/1.1 502 Bad Gateway\r
|
|
381
|
+
Content-Length: 0\r
|
|
382
|
+
\r
|
|
383
|
+
`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
forwardTls(request, response) {
|
|
387
|
+
const target = this.targets.get(request.socket);
|
|
388
|
+
if (!target) {
|
|
389
|
+
response.writeHead(502).end();
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (!(request.url ?? "/").startsWith("/")) {
|
|
393
|
+
response.writeHead(400).end();
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
const secrets = VaultProxy.boundTo(target.session, target.host, target.port);
|
|
397
|
+
const used = new Set;
|
|
398
|
+
const put = (text) => VaultProxy.put(text, secrets, used);
|
|
399
|
+
const headers = {};
|
|
400
|
+
for (const [key, value] of Object.entries(request.headers)) {
|
|
401
|
+
if (value !== undefined && key !== "proxy-authorization" && key !== "proxy-connection") {
|
|
402
|
+
headers[key] = Array.isArray(value) ? value.map(put) : key === "authorization" ? VaultProxy.putAuthorization(value, secrets, used) : put(value);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
headers.host = VaultProxy.authority(target.host, target.port);
|
|
406
|
+
const path = put(request.url ?? "/");
|
|
407
|
+
if (used.size) {
|
|
408
|
+
this.tell(target, [...used], `${request.method} ${(request.url ?? "/").split("?")[0]}`);
|
|
409
|
+
}
|
|
410
|
+
this.secure(target.host, target.port).then((socket) => {
|
|
411
|
+
const upstream = httpsRequest({ host: target.host, port: target.port, method: request.method, path, headers, createConnection: () => socket }, (answer) => {
|
|
412
|
+
response.writeHead(answer.statusCode ?? 502, answer.headers);
|
|
413
|
+
answer.pipe(response);
|
|
414
|
+
});
|
|
415
|
+
upstream.on("error", () => response.headersSent ? response.destroy() : response.writeHead(502).end());
|
|
416
|
+
request.pipe(upstream);
|
|
417
|
+
}, () => response.writeHead(502).end());
|
|
418
|
+
}
|
|
419
|
+
forwardPlain(request, response) {
|
|
420
|
+
let url;
|
|
421
|
+
try {
|
|
422
|
+
url = new URL(request.url ?? "");
|
|
423
|
+
} catch {
|
|
424
|
+
response.writeHead(400).end();
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
if (!this.session(request)) {
|
|
428
|
+
response.writeHead(407, { "proxy-authenticate": 'Basic realm="Ta vault"' }).end();
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const headers = { ...request.headers };
|
|
432
|
+
delete headers["proxy-authorization"];
|
|
433
|
+
delete headers["proxy-connection"];
|
|
434
|
+
const upstream = httpRequest(url, { method: request.method, headers, agent: false }, (answer) => {
|
|
435
|
+
response.writeHead(answer.statusCode ?? 502, answer.headers);
|
|
436
|
+
answer.pipe(response);
|
|
437
|
+
});
|
|
438
|
+
upstream.on("error", () => response.headersSent ? response.destroy() : response.writeHead(502).end());
|
|
439
|
+
request.pipe(upstream);
|
|
440
|
+
}
|
|
441
|
+
tell(target, names, request) {
|
|
442
|
+
const key = `${target.host}:${target.port}`;
|
|
443
|
+
if (target.session.told.has(key)) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
target.session.told.add(key);
|
|
447
|
+
this.options.onUse?.({
|
|
448
|
+
names,
|
|
449
|
+
host: target.port === 443 ? target.host : key,
|
|
450
|
+
request,
|
|
451
|
+
...target.session.conversation ? { conversation: target.session.conversation } : {}
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
async secure(host, port) {
|
|
455
|
+
const socket = await this.reach(host, port);
|
|
456
|
+
return new Promise((resolve, reject) => {
|
|
457
|
+
const secure = tls2.connect({
|
|
458
|
+
socket,
|
|
459
|
+
host,
|
|
460
|
+
...isIP2(host) ? {} : { servername: host },
|
|
461
|
+
...this.options.trust?.length ? { ca: [...tls2.rootCertificates, ...this.options.trust] } : {},
|
|
462
|
+
ALPNProtocols: ["http/1.1"]
|
|
463
|
+
});
|
|
464
|
+
secure.once("secureConnect", () => resolve(secure));
|
|
465
|
+
secure.once("error", reject);
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
reach(host, port) {
|
|
469
|
+
if (this.options.connect) {
|
|
470
|
+
return this.options.connect(host, port);
|
|
471
|
+
}
|
|
472
|
+
const env = this.options.env ?? process.env;
|
|
473
|
+
const upstream = env.HTTPS_PROXY || env.https_proxy || env.ALL_PROXY || env.all_proxy;
|
|
474
|
+
if (upstream && !VaultProxy.bypassed(host, env.NO_PROXY ?? env.no_proxy ?? "")) {
|
|
475
|
+
return VaultProxy.tunnel(upstream, host, port);
|
|
476
|
+
}
|
|
477
|
+
return new Promise((resolve, reject) => {
|
|
478
|
+
const socket = connect(port, host);
|
|
479
|
+
socket.once("connect", () => resolve(socket));
|
|
480
|
+
socket.once("error", reject);
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
static tunnel(proxy, host, port) {
|
|
484
|
+
return new Promise((resolve, reject) => {
|
|
485
|
+
let url;
|
|
486
|
+
try {
|
|
487
|
+
url = new URL(proxy.includes("://") ? proxy : `http://${proxy}`);
|
|
488
|
+
} catch (error) {
|
|
489
|
+
reject(error);
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
const socket = connect(Number(url.port) || 80, url.hostname);
|
|
493
|
+
const auth = url.username ? `Proxy-Authorization: Basic ${Buffer.from(`${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`).toString("base64")}\r
|
|
494
|
+
` : "";
|
|
495
|
+
let answer = Buffer.alloc(0);
|
|
496
|
+
const onData = (chunk) => {
|
|
497
|
+
answer = Buffer.concat([answer, chunk]);
|
|
498
|
+
const end = answer.indexOf(`\r
|
|
499
|
+
\r
|
|
500
|
+
`);
|
|
501
|
+
if (end < 0) {
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
socket.off("data", onData);
|
|
505
|
+
if (!/^HTTP\/1\.[01] 200/.test(answer.toString("latin1", 0, end))) {
|
|
506
|
+
socket.destroy();
|
|
507
|
+
reject(new Error(`The proxy refused ${host}:${port}`));
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
const rest = answer.subarray(end + 4);
|
|
511
|
+
if (rest.length) {
|
|
512
|
+
socket.unshift(rest);
|
|
513
|
+
}
|
|
514
|
+
resolve(socket);
|
|
515
|
+
};
|
|
516
|
+
socket.on("data", onData);
|
|
517
|
+
socket.once("error", reject);
|
|
518
|
+
socket.once("connect", () => socket.write(`CONNECT ${host}:${port} HTTP/1.1\r
|
|
519
|
+
Host: ${host}:${port}\r
|
|
520
|
+
${auth}\r
|
|
521
|
+
`));
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
static bypassed(host, noProxy) {
|
|
525
|
+
return noProxy.split(/[\s,]+/).map((entry) => entry.trim().toLowerCase().replace(/:\d+$/, "")).filter(Boolean).some((entry) => entry === "*" || host === entry.replace(/^\./, "") || host.endsWith(entry.startsWith(".") ? entry : `.${entry}`));
|
|
526
|
+
}
|
|
527
|
+
static target(authority) {
|
|
528
|
+
const match = /^\[?([^\]]+?)\]?:(\d{1,5})$/.exec(authority);
|
|
529
|
+
const port = match ? Number(match[2]) : 0;
|
|
530
|
+
return match && port > 0 && port < 65536 ? { host: match[1].toLowerCase(), port } : undefined;
|
|
531
|
+
}
|
|
532
|
+
static authority(host, port) {
|
|
533
|
+
const name = host.includes(":") ? `[${host}]` : host;
|
|
534
|
+
return port === 443 ? name : `${name}:${port}`;
|
|
535
|
+
}
|
|
536
|
+
static boundTo(session, host, port) {
|
|
537
|
+
return session.secrets.filter((secret) => secret.hosts.some((bound) => bound === (port === 443 ? host : `${host}:${port}`) || bound === `${host}:${port}`));
|
|
538
|
+
}
|
|
539
|
+
static put(text, secrets, used) {
|
|
540
|
+
let out = text;
|
|
541
|
+
for (const secret of secrets) {
|
|
542
|
+
if (out.includes(secret.placeholder)) {
|
|
543
|
+
out = out.split(secret.placeholder).join(secret.value);
|
|
544
|
+
used.add(secret.name);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return out;
|
|
548
|
+
}
|
|
549
|
+
static putAuthorization(value, secrets, used) {
|
|
550
|
+
const basic = /^(Basic\s+)(\S+)$/i.exec(value);
|
|
551
|
+
if (!basic) {
|
|
552
|
+
return VaultProxy.put(value, secrets, used);
|
|
553
|
+
}
|
|
554
|
+
const decoded = Buffer.from(basic[2], "base64").toString("utf8");
|
|
555
|
+
const put = VaultProxy.put(decoded, secrets, used);
|
|
556
|
+
return put === decoded ? value : basic[1] + Buffer.from(put, "utf8").toString("base64");
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// web-src/vault-service.ts
|
|
561
|
+
import { createHmac, randomBytes as randomBytes3 } from "node:crypto";
|
|
562
|
+
import { mkdtemp as mkdtemp2, readFile as readFile3, rm as rm2, writeFile as writeFile3 } from "node:fs/promises";
|
|
563
|
+
import { homedir, tmpdir as tmpdir2 } from "node:os";
|
|
564
|
+
import { join as join3, resolve, sep } from "node:path";
|
|
565
|
+
|
|
566
|
+
// ../ta-protocol/esm/common/redactor.js
|
|
567
|
+
var REDACTED = "[redacted]";
|
|
568
|
+
var WHOLE = [
|
|
569
|
+
["PRIVATE_KEY", /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g],
|
|
570
|
+
["API_KEY", /\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{20,}/g],
|
|
571
|
+
["GITHUB_TOKEN", /\bgh[pousr]_[A-Za-z0-9]{30,}\b/g],
|
|
572
|
+
["GITHUB_TOKEN", /\bgithub_pat_[A-Za-z0-9_]{40,}\b/g],
|
|
573
|
+
["GITLAB_TOKEN", /\bglpat-[A-Za-z0-9_-]{20,}\b/g],
|
|
574
|
+
["SLACK_TOKEN", /\bxox[abprs]-[A-Za-z0-9-]{10,}\b/g],
|
|
575
|
+
["AWS_ACCESS_KEY_ID", /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g],
|
|
576
|
+
["GOOGLE_API_KEY", /\bAIza[0-9A-Za-z_-]{35}\b/g],
|
|
577
|
+
["JWT", /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g]
|
|
578
|
+
];
|
|
579
|
+
var NAMED = [
|
|
580
|
+
/(\bBearer\s+)[A-Za-z0-9._~+/-]{16,}=*/gi,
|
|
581
|
+
/(\b[A-Za-z0-9_.-]*(?:password|passwd|pwd|secret|token|api[_-]?key|access[_-]?key|private[_-]?key)[A-Za-z0-9_.-]*["']?\s*[:=]\s*["']?)([^\s"'`,;]{6,})/gi,
|
|
582
|
+
/(:\/\/[^\s:/@]+:)([^\s@/]{3,})(@)/g
|
|
583
|
+
];
|
|
584
|
+
|
|
585
|
+
class Redactor {
|
|
586
|
+
constructor() {
|
|
587
|
+
this.count = 0;
|
|
588
|
+
}
|
|
589
|
+
text(text) {
|
|
590
|
+
let out = text;
|
|
591
|
+
for (const [, pattern] of WHOLE) {
|
|
592
|
+
out = out.replace(pattern, () => this.hide());
|
|
593
|
+
}
|
|
594
|
+
out = out.replace(NAMED[0], (_match, before) => before + this.hide());
|
|
595
|
+
out = out.replace(NAMED[1], (match, before, value) => Redactor.placeholder(value) ? match : before + this.hide());
|
|
596
|
+
out = out.replace(NAMED[2], (_match, before, _value, after) => before + this.hide() + after);
|
|
597
|
+
return out;
|
|
598
|
+
}
|
|
599
|
+
value(value, max) {
|
|
600
|
+
if (typeof value === "string") {
|
|
601
|
+
return Redactor.cut(this.text(value), max);
|
|
602
|
+
}
|
|
603
|
+
if (Array.isArray(value)) {
|
|
604
|
+
return value.map((item) => this.value(item, max));
|
|
605
|
+
}
|
|
606
|
+
if (value && typeof value === "object") {
|
|
607
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, this.value(item, max)]));
|
|
608
|
+
}
|
|
609
|
+
return value;
|
|
610
|
+
}
|
|
611
|
+
static spans(text) {
|
|
612
|
+
var _a;
|
|
613
|
+
var _b;
|
|
614
|
+
const found = [];
|
|
615
|
+
for (const [kind, pattern] of WHOLE) {
|
|
616
|
+
for (const match of text.matchAll(pattern)) {
|
|
617
|
+
found.push({ start: match.index, end: match.index + match[0].length, kind });
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
for (const match of text.matchAll(NAMED[0])) {
|
|
621
|
+
found.push({ start: match.index + match[1].length, end: match.index + match[0].length, kind: "BEARER_TOKEN" });
|
|
622
|
+
}
|
|
623
|
+
for (const match of text.matchAll(NAMED[1])) {
|
|
624
|
+
if (!Redactor.placeholder(match[2])) {
|
|
625
|
+
const start = match.index + match[1].length;
|
|
626
|
+
const name = (_b = (_a = /[A-Za-z0-9_.-]+/.exec(match[1])) === null || _a === undefined ? undefined : _a[0]) !== null && _b !== undefined ? _b : "SECRET";
|
|
627
|
+
found.push({ start, end: start + match[2].length, kind: name.replace(/[^A-Za-z0-9]+/g, "_").toUpperCase() });
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
for (const match of text.matchAll(NAMED[2])) {
|
|
631
|
+
const start = match.index + match[1].length;
|
|
632
|
+
found.push({ start, end: start + match[2].length, kind: "URL_PASSWORD" });
|
|
633
|
+
}
|
|
634
|
+
found.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
635
|
+
const spans = [];
|
|
636
|
+
for (const span of found) {
|
|
637
|
+
const last = spans.at(-1);
|
|
638
|
+
if (!last || span.start >= last.end) {
|
|
639
|
+
spans.push(span);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return spans;
|
|
643
|
+
}
|
|
644
|
+
static cut(text, max) {
|
|
645
|
+
return text.length > max ? `${text.slice(0, max)}…` : text;
|
|
646
|
+
}
|
|
647
|
+
hide() {
|
|
648
|
+
this.count++;
|
|
649
|
+
return REDACTED;
|
|
650
|
+
}
|
|
651
|
+
static placeholder(value) {
|
|
652
|
+
return /^(?:\$|<|\{|\[redacted|process\.env|os\.environ|xxx|\*{3})/i.test(value) || /^(?:true|false|null|undefined|none|string|number)$/i.test(value);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
// web-src/command-prelude.ts
|
|
657
|
+
var CommandPrelude;
|
|
658
|
+
((CommandPrelude) => {
|
|
659
|
+
function quote(value) {
|
|
660
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
661
|
+
}
|
|
662
|
+
CommandPrelude.quote = quote;
|
|
663
|
+
function usesGit(command) {
|
|
664
|
+
return /(^|[\s;&|(`])git\s+-?[A-Za-z]/.test(command);
|
|
665
|
+
}
|
|
666
|
+
CommandPrelude.usesGit = usesGit;
|
|
667
|
+
function usesSsh(command) {
|
|
668
|
+
return /(^|[\s;&|(`/])(ssh|scp|sftp|rsync|git)(\s|$)/.test(command);
|
|
669
|
+
}
|
|
670
|
+
CommandPrelude.usesSsh = usesSsh;
|
|
671
|
+
function gitHelper(name, user) {
|
|
672
|
+
return `!f() { test "$1" = get || return 0; printf 'username=%s\\npassword=%s\\n' ${quote(user)} "$TA_SECRET_${name}"; }; f`;
|
|
673
|
+
}
|
|
674
|
+
CommandPrelude.gitHelper = gitHelper;
|
|
675
|
+
function script(parts) {
|
|
676
|
+
const lines = [];
|
|
677
|
+
for (const [name, value] of parts.env) {
|
|
678
|
+
lines.push(`export TA_SECRET_${name}=${quote(value)}`);
|
|
679
|
+
}
|
|
680
|
+
if (parts.git.length) {
|
|
681
|
+
lines.push("ta_git=${GIT_CONFIG_COUNT:-0}");
|
|
682
|
+
const config = (key, value) => {
|
|
683
|
+
lines.push(`export "GIT_CONFIG_KEY_$ta_git"=${quote(key)} "GIT_CONFIG_VALUE_$ta_git"=${quote(value)}`, "ta_git=$((ta_git + 1))");
|
|
684
|
+
};
|
|
685
|
+
for (const one of parts.git) {
|
|
686
|
+
const key = `credential.https://${one.host}.helper`;
|
|
687
|
+
config(key, "");
|
|
688
|
+
config(key, gitHelper(one.name, one.user));
|
|
689
|
+
}
|
|
690
|
+
lines.push("export GIT_CONFIG_COUNT=$ta_git GIT_TERMINAL_PROMPT=0", "unset ta_git");
|
|
691
|
+
}
|
|
692
|
+
if (parts.proxy) {
|
|
693
|
+
const url = quote(parts.proxy.url);
|
|
694
|
+
const bundle = quote(parts.proxy.bundle);
|
|
695
|
+
lines.push(`export HTTPS_PROXY=${url} https_proxy=${url} HTTP_PROXY=${url} http_proxy=${url} NODE_USE_ENV_PROXY=1`, "export NO_PROXY='localhost,127.0.0.1,::1' no_proxy='localhost,127.0.0.1,::1'", `export SSL_CERT_FILE=${bundle} CURL_CA_BUNDLE=${bundle} REQUESTS_CA_BUNDLE=${bundle} NODE_EXTRA_CA_CERTS=${bundle} GIT_SSL_CAINFO=${bundle} DENO_CERT=${bundle}`, "unset ALL_PROXY all_proxy");
|
|
696
|
+
}
|
|
697
|
+
if (parts.keys.length) {
|
|
698
|
+
lines.push('eval "$(ssh-agent -s -t 1800)" >/dev/null');
|
|
699
|
+
for (const key of parts.keys) {
|
|
700
|
+
lines.push(`ssh-add -q ${quote(key)} </dev/null >/dev/null 2>&1`);
|
|
701
|
+
}
|
|
702
|
+
lines.push("trap 'ssh-agent -k >/dev/null 2>&1' EXIT");
|
|
703
|
+
}
|
|
704
|
+
lines.push("true");
|
|
705
|
+
return `${lines.join(`
|
|
706
|
+
`)}
|
|
707
|
+
`;
|
|
708
|
+
}
|
|
709
|
+
CommandPrelude.script = script;
|
|
710
|
+
})(CommandPrelude ||= {});
|
|
711
|
+
|
|
712
|
+
// web-src/personal-info.ts
|
|
713
|
+
var EMAIL = /(?<![\w.%+-])[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,24}(?![\w-])/g;
|
|
714
|
+
var PHONE = /(?<![\w+])(?:(?:\+?86[ -]?)?1[3-9]\d(?:[ -]?\d{4}){2}|\+[1-9]\d{0,2}[ -]?\d{2,4}(?:[ -]?\d{2,4}){1,3})(?![\w])/g;
|
|
715
|
+
var ID_NUMBER = /(?<![\w])\d{17}[\dXx](?![\w])/g;
|
|
716
|
+
var BANK_CARD = /(?<![\w-])\d{4}(?:[ -]?\d{4}){2}(?:[ -]?\d{1,4}){1,2}(?![\w-])/g;
|
|
717
|
+
var NOT_PERSONAL = /^(?:no-?reply|noreply|donotreply|git|root|admin|bot)@|@(?:example\.(?:com|org|net)|test|localhost|users\.noreply\.github\.com)$/i;
|
|
718
|
+
var PersonalInfo;
|
|
719
|
+
((PersonalInfo) => {
|
|
720
|
+
function spans(text) {
|
|
721
|
+
const found = [];
|
|
722
|
+
const add = (pattern, kind, keep) => {
|
|
723
|
+
for (const match of text.matchAll(pattern)) {
|
|
724
|
+
if (keep(match[0])) {
|
|
725
|
+
found.push({ start: match.index, end: match.index + match[0].length, kind, hint: mask(kind, match[0]) });
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
add(EMAIL, "EMAIL", (value) => !NOT_PERSONAL.test(value));
|
|
730
|
+
add(ID_NUMBER, "ID_NUMBER", idNumber);
|
|
731
|
+
add(BANK_CARD, "BANK_CARD", bankCard);
|
|
732
|
+
add(PHONE, "PHONE", phone);
|
|
733
|
+
found.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
734
|
+
const spans2 = [];
|
|
735
|
+
for (const span of found) {
|
|
736
|
+
const last = spans2.at(-1);
|
|
737
|
+
if (!last || span.start >= last.end) {
|
|
738
|
+
spans2.push(span);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
return spans2;
|
|
742
|
+
}
|
|
743
|
+
PersonalInfo.spans = spans;
|
|
744
|
+
function digits(value) {
|
|
745
|
+
return value.replace(/\D/g, "");
|
|
746
|
+
}
|
|
747
|
+
PersonalInfo.digits = digits;
|
|
748
|
+
function idNumber(value) {
|
|
749
|
+
if (!/^\d{17}[\dXx]$/.test(value)) {
|
|
750
|
+
return false;
|
|
751
|
+
}
|
|
752
|
+
const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
|
|
753
|
+
const sum = weights.reduce((total, weight, index) => total + weight * Number(value[index]), 0);
|
|
754
|
+
if ("10X98765432"[sum % 11] !== value[17].toUpperCase()) {
|
|
755
|
+
return false;
|
|
756
|
+
}
|
|
757
|
+
const year = Number(value.slice(6, 10));
|
|
758
|
+
const month = Number(value.slice(10, 12));
|
|
759
|
+
const day = Number(value.slice(12, 14));
|
|
760
|
+
const birth = new Date(Date.UTC(year, month - 1, day));
|
|
761
|
+
return year >= 1900 && birth.getTime() <= Date.now() && birth.getUTCMonth() === month - 1 && birth.getUTCDate() === day;
|
|
762
|
+
}
|
|
763
|
+
PersonalInfo.idNumber = idNumber;
|
|
764
|
+
function bankCard(value) {
|
|
765
|
+
const number = digits(value);
|
|
766
|
+
if (number.length < 15 || number.length > 19 || !/^(?:4|5[1-5]|2[2-7]|62|3[47]|35|6011|65)/.test(number)) {
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
769
|
+
let sum = 0;
|
|
770
|
+
for (let index = 0;index < number.length; index++) {
|
|
771
|
+
let digit = Number(number[number.length - 1 - index]);
|
|
772
|
+
if (index % 2 === 1) {
|
|
773
|
+
digit *= 2;
|
|
774
|
+
if (digit > 9) {
|
|
775
|
+
digit -= 9;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
sum += digit;
|
|
779
|
+
}
|
|
780
|
+
return sum % 10 === 0;
|
|
781
|
+
}
|
|
782
|
+
PersonalInfo.bankCard = bankCard;
|
|
783
|
+
function phone(value) {
|
|
784
|
+
const number = digits(value);
|
|
785
|
+
return value.startsWith("+") ? number.length >= 8 && number.length <= 15 : /^(?:86)?1[3-9]\d{9}$/.test(number);
|
|
786
|
+
}
|
|
787
|
+
PersonalInfo.phone = phone;
|
|
788
|
+
function mask(kind, value) {
|
|
789
|
+
if (kind === "EMAIL") {
|
|
790
|
+
const [local, domain] = value.split("@");
|
|
791
|
+
return `${local.slice(0, 1)}***@${domain}`;
|
|
792
|
+
}
|
|
793
|
+
const number = kind === "ID_NUMBER" ? value.toUpperCase() : digits(value);
|
|
794
|
+
if (kind === "PHONE") {
|
|
795
|
+
const china = number.length === 13 && number.startsWith("86");
|
|
796
|
+
const local = china ? number.slice(2) : number;
|
|
797
|
+
return `${value.startsWith("+") && !china ? "+" : ""}${local.slice(0, 3)}****${local.slice(-4)}`;
|
|
798
|
+
}
|
|
799
|
+
if (kind === "ID_NUMBER") {
|
|
800
|
+
return `${number.slice(0, 4)}**********${number.slice(-4)}`;
|
|
801
|
+
}
|
|
802
|
+
return `**** ${number.slice(-4)}`;
|
|
803
|
+
}
|
|
804
|
+
PersonalInfo.mask = mask;
|
|
805
|
+
})(PersonalInfo ||= {});
|
|
806
|
+
|
|
807
|
+
// web-src/secrets-protocol.ts
|
|
808
|
+
var NAME = "@celljs/ta-secrets";
|
|
809
|
+
var REQUEST_TOOL = "request_secret";
|
|
810
|
+
var ENV_PREFIX = "TA_SECRET_";
|
|
811
|
+
var Keys;
|
|
812
|
+
((Keys) => {
|
|
813
|
+
Keys.ENTRIES = "entries";
|
|
814
|
+
Keys.CAPTURE = "capture";
|
|
815
|
+
Keys.PERSONAL = "personal";
|
|
816
|
+
Keys.USES = "uses";
|
|
817
|
+
})(Keys ||= {});
|
|
818
|
+
var MAX_USES = 100;
|
|
819
|
+
var SecretNames;
|
|
820
|
+
((SecretNames) => {
|
|
821
|
+
SecretNames.MAX = 48;
|
|
822
|
+
function normalize(name) {
|
|
823
|
+
return name.trim().replace(/^\$?\{?TA_SECRET_/i, "").replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "").toUpperCase().slice(0, SecretNames.MAX);
|
|
824
|
+
}
|
|
825
|
+
SecretNames.normalize = normalize;
|
|
826
|
+
function valid(name) {
|
|
827
|
+
return /^[A-Z0-9][A-Z0-9_]*$/.test(name) && name.length <= SecretNames.MAX;
|
|
828
|
+
}
|
|
829
|
+
SecretNames.valid = valid;
|
|
830
|
+
function env(name) {
|
|
831
|
+
return ENV_PREFIX + name;
|
|
832
|
+
}
|
|
833
|
+
SecretNames.env = env;
|
|
834
|
+
function handle(name) {
|
|
835
|
+
return `$${env(name)}`;
|
|
836
|
+
}
|
|
837
|
+
SecretNames.handle = handle;
|
|
838
|
+
function references(command) {
|
|
839
|
+
return [...new Set([...command.matchAll(/\bTA_SECRET_([A-Z0-9_]+)/g)].map((match) => match[1]))];
|
|
840
|
+
}
|
|
841
|
+
SecretNames.references = references;
|
|
842
|
+
function free(base, taken) {
|
|
843
|
+
const name = normalize(base) || "SECRET";
|
|
844
|
+
if (!taken.has(name)) {
|
|
845
|
+
return name;
|
|
846
|
+
}
|
|
847
|
+
for (let n = 2;; n++) {
|
|
848
|
+
const next = `${name.slice(0, SecretNames.MAX - String(n).length - 1)}_${n}`;
|
|
849
|
+
if (!taken.has(next)) {
|
|
850
|
+
return next;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
SecretNames.free = free;
|
|
855
|
+
function looksSecret(value) {
|
|
856
|
+
if (/[()[\]{}<>]/.test(value)) {
|
|
857
|
+
return false;
|
|
858
|
+
}
|
|
859
|
+
return /[0-9]/.test(value) && /[A-Za-z]/.test(value) || value.length >= 20;
|
|
860
|
+
}
|
|
861
|
+
SecretNames.looksSecret = looksSecret;
|
|
862
|
+
function hosts(value) {
|
|
863
|
+
const items = Array.isArray(value) ? value : typeof value === "string" ? value.split(/[\s,;]+/) : [];
|
|
864
|
+
const hosts2 = items.map((item) => String(item).trim().toLowerCase().replace(/^[a-z]+:\/\//, "").replace(/^[^@/]*@/, "").replace(/\/.*$/, "")).filter((host) => /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d{1,5})?$/.test(host));
|
|
865
|
+
return [...new Set(hosts2)];
|
|
866
|
+
}
|
|
867
|
+
SecretNames.hosts = hosts;
|
|
868
|
+
function defaultHosts(name) {
|
|
869
|
+
return /GITHUB/.test(name) ? ["github.com", "api.github.com"] : /GITLAB/.test(name) ? ["gitlab.com"] : /GITEE/.test(name) ? ["gitee.com"] : [];
|
|
870
|
+
}
|
|
871
|
+
SecretNames.defaultHosts = defaultHosts;
|
|
872
|
+
function gitUser(entry, host) {
|
|
873
|
+
return entry.gitUser || (host === "gitlab.com" || host.startsWith("gitlab.") ? "oauth2" : "x-access-token");
|
|
874
|
+
}
|
|
875
|
+
SecretNames.gitUser = gitUser;
|
|
876
|
+
function privateKey(value) {
|
|
877
|
+
return /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*-----END [A-Z0-9 ]*PRIVATE KEY-----/.test(value);
|
|
878
|
+
}
|
|
879
|
+
SecretNames.privateKey = privateKey;
|
|
880
|
+
function uses(value) {
|
|
881
|
+
return Array.isArray(value) ? value.filter((use) => !!use && typeof use === "object" && typeof use.at === "number" && Array.isArray(use.names)) : [];
|
|
882
|
+
}
|
|
883
|
+
SecretNames.uses = uses;
|
|
884
|
+
function entries(value) {
|
|
885
|
+
if (!Array.isArray(value)) {
|
|
886
|
+
return [];
|
|
887
|
+
}
|
|
888
|
+
return value.map((entry) => entry && typeof entry === "object" && Array.isArray(entry.git) && !entry.hosts ? (({ git, ...rest }) => ({ ...rest, hosts: git }))(entry) : entry).filter((entry) => !!entry && typeof entry === "object" && typeof entry.name === "string" && valid(entry.name));
|
|
889
|
+
}
|
|
890
|
+
SecretNames.entries = entries;
|
|
891
|
+
})(SecretNames ||= {});
|
|
892
|
+
|
|
893
|
+
// web-src/scrubber.ts
|
|
894
|
+
var MIN_SCRUBBED = 6;
|
|
895
|
+
function escapeRegExp(text) {
|
|
896
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
class Scrubber {
|
|
900
|
+
names = new Map;
|
|
901
|
+
pattern;
|
|
902
|
+
constructor(values, aliases = new Map) {
|
|
903
|
+
for (const [name, value] of [...values, ...aliases]) {
|
|
904
|
+
for (const variant of Scrubber.variants(value)) {
|
|
905
|
+
if (variant.length >= MIN_SCRUBBED && !this.names.has(variant)) {
|
|
906
|
+
this.names.set(variant, name);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
const all = [...this.names.keys()].sort((a, b) => b.length - a.length);
|
|
911
|
+
this.pattern = all.length ? new RegExp(all.map(escapeRegExp).join("|"), "g") : undefined;
|
|
912
|
+
}
|
|
913
|
+
get empty() {
|
|
914
|
+
return !this.pattern;
|
|
915
|
+
}
|
|
916
|
+
nameOf(text) {
|
|
917
|
+
return this.names.get(text);
|
|
918
|
+
}
|
|
919
|
+
text(text) {
|
|
920
|
+
return this.pattern ? text.replace(this.pattern, (found) => SecretNames.handle(this.names.get(found))) : text;
|
|
921
|
+
}
|
|
922
|
+
value(value) {
|
|
923
|
+
if (!this.pattern) {
|
|
924
|
+
return value;
|
|
925
|
+
}
|
|
926
|
+
if (typeof value === "string") {
|
|
927
|
+
return this.text(value);
|
|
928
|
+
}
|
|
929
|
+
if (Array.isArray(value)) {
|
|
930
|
+
const items = value.map((item) => this.value(item));
|
|
931
|
+
return items.some((item, index) => item !== value[index]) ? items : value;
|
|
932
|
+
}
|
|
933
|
+
if (value && typeof value === "object") {
|
|
934
|
+
if (value.type === "image") {
|
|
935
|
+
return value;
|
|
936
|
+
}
|
|
937
|
+
let changed = false;
|
|
938
|
+
const entries = Object.entries(value).map(([key, item]) => {
|
|
939
|
+
const next = this.value(item);
|
|
940
|
+
changed ||= next !== item;
|
|
941
|
+
return [key, next];
|
|
942
|
+
});
|
|
943
|
+
return changed ? Object.fromEntries(entries) : value;
|
|
944
|
+
}
|
|
945
|
+
return value;
|
|
946
|
+
}
|
|
947
|
+
static variants(value) {
|
|
948
|
+
const json = JSON.stringify(value).slice(1, -1);
|
|
949
|
+
return [...new Set([value, Buffer.from(value, "utf8").toString("base64"), encodeURIComponent(value), json])];
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
// web-src/vault-service.ts
|
|
954
|
+
var PRELUDE_MS = 60000;
|
|
955
|
+
|
|
956
|
+
class Vault {
|
|
957
|
+
host;
|
|
958
|
+
vaultStore;
|
|
959
|
+
proxy;
|
|
960
|
+
values;
|
|
961
|
+
scrubbing;
|
|
962
|
+
queue = Promise.resolve();
|
|
963
|
+
placeholderKey = randomBytes3(32);
|
|
964
|
+
constructor(host, vaultStore, proxy) {
|
|
965
|
+
this.host = host;
|
|
966
|
+
this.vaultStore = vaultStore;
|
|
967
|
+
this.proxy = proxy;
|
|
968
|
+
}
|
|
969
|
+
forget() {
|
|
970
|
+
this.values = undefined;
|
|
971
|
+
this.scrubbing = undefined;
|
|
972
|
+
this.proxy?.dispose();
|
|
973
|
+
}
|
|
974
|
+
get store() {
|
|
975
|
+
return this.vaultStore.kind;
|
|
976
|
+
}
|
|
977
|
+
async list() {
|
|
978
|
+
return SecretNames.entries(await this.host.getExtensionData(NAME, Keys.ENTRIES));
|
|
979
|
+
}
|
|
980
|
+
add(input) {
|
|
981
|
+
return this.serial(async () => {
|
|
982
|
+
const name = SecretNames.normalize(String(input?.name ?? ""));
|
|
983
|
+
const value = typeof input?.value === "string" ? input.value.replace(/\r?\n$/, "") : "";
|
|
984
|
+
if (!SecretNames.valid(name)) {
|
|
985
|
+
throw new Error("A secret needs a name of letters, digits and _, as GITHUB_TOKEN.");
|
|
986
|
+
}
|
|
987
|
+
if (!value) {
|
|
988
|
+
throw new Error("A secret needs a value.");
|
|
989
|
+
}
|
|
990
|
+
await this.vaultStore.set(name, SecretNames.privateKey(value) && !value.endsWith(`
|
|
991
|
+
`) ? `${value}
|
|
992
|
+
` : value);
|
|
993
|
+
const entries = await this.list();
|
|
994
|
+
const before = entries.find((entry2) => entry2.name === name);
|
|
995
|
+
const ssh = SecretNames.privateKey(value);
|
|
996
|
+
const hosts = ssh ? [] : input.hosts !== undefined ? SecretNames.hosts(input.hosts) : before?.hosts ?? SecretNames.defaultHosts(name);
|
|
997
|
+
const gitUser = input.gitUser?.trim() || before?.gitUser;
|
|
998
|
+
const entry = {
|
|
999
|
+
name,
|
|
1000
|
+
kind: input.kind === "personal" ? "personal" : "credential",
|
|
1001
|
+
...input.note?.trim() ? { note: input.note.trim().slice(0, 200) } : before?.note ? { note: before.note } : {},
|
|
1002
|
+
source: input.source ?? "typed",
|
|
1003
|
+
createdAt: Date.now(),
|
|
1004
|
+
...hosts.length ? { hosts } : {},
|
|
1005
|
+
...hosts.length && gitUser ? { gitUser: gitUser.slice(0, 100) } : {},
|
|
1006
|
+
...ssh ? { ssh: true } : {},
|
|
1007
|
+
...input.kind === "personal" && input.hint ? { hint: String(input.hint).slice(0, 60) } : {}
|
|
1008
|
+
};
|
|
1009
|
+
await this.save([...entries.filter((one) => one.name !== name), entry]);
|
|
1010
|
+
(await this.loaded()).set(name, entry.ssh && !value.endsWith(`
|
|
1011
|
+
`) ? `${value}
|
|
1012
|
+
` : value);
|
|
1013
|
+
this.scrubbing = undefined;
|
|
1014
|
+
return entry;
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
remove(name) {
|
|
1018
|
+
return this.serial(async () => {
|
|
1019
|
+
const entries = await this.list();
|
|
1020
|
+
const left = entries.filter((entry) => entry.name !== name);
|
|
1021
|
+
await this.vaultStore.remove(name);
|
|
1022
|
+
(await this.loaded()).delete(name);
|
|
1023
|
+
this.scrubbing = undefined;
|
|
1024
|
+
if (left.length === entries.length) {
|
|
1025
|
+
return false;
|
|
1026
|
+
}
|
|
1027
|
+
await this.save(left);
|
|
1028
|
+
return true;
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
async capturing() {
|
|
1032
|
+
return await this.host.getExtensionData(NAME, Keys.CAPTURE) !== false;
|
|
1033
|
+
}
|
|
1034
|
+
async setCapturing(on) {
|
|
1035
|
+
await this.host.setExtensionData(NAME, Keys.CAPTURE, on === true);
|
|
1036
|
+
}
|
|
1037
|
+
async capturingPersonal() {
|
|
1038
|
+
return await this.host.getExtensionData(NAME, Keys.PERSONAL) !== false;
|
|
1039
|
+
}
|
|
1040
|
+
async setCapturingPersonal(on) {
|
|
1041
|
+
await this.host.setExtensionData(NAME, Keys.PERSONAL, on === true);
|
|
1042
|
+
}
|
|
1043
|
+
async capture(text) {
|
|
1044
|
+
let out = (await this.scrubber()).text(text);
|
|
1045
|
+
const names = [];
|
|
1046
|
+
const take = async (spans, personal) => {
|
|
1047
|
+
for (const span of [...spans].reverse()) {
|
|
1048
|
+
const value = out.slice(span.start, span.end);
|
|
1049
|
+
const known = (await this.scrubber()).nameOf(value);
|
|
1050
|
+
const name = known ?? (await this.add({
|
|
1051
|
+
name: await this.freeName(span.kind),
|
|
1052
|
+
value,
|
|
1053
|
+
source: "pasted",
|
|
1054
|
+
...personal ? { kind: "personal", hint: span.hint, hosts: [] } : {}
|
|
1055
|
+
})).name;
|
|
1056
|
+
names.unshift(name);
|
|
1057
|
+
out = out.slice(0, span.start) + SecretNames.handle(name) + out.slice(span.end);
|
|
1058
|
+
}
|
|
1059
|
+
};
|
|
1060
|
+
if (await this.capturing()) {
|
|
1061
|
+
await take(Redactor.spans(out).filter((span) => {
|
|
1062
|
+
const value = out.slice(span.start, span.end);
|
|
1063
|
+
return !value.startsWith("$TA_SECRET_") && (WHOLE_KINDS.has(span.kind) || SecretNames.looksSecret(value));
|
|
1064
|
+
}), false);
|
|
1065
|
+
}
|
|
1066
|
+
if (await this.capturingPersonal()) {
|
|
1067
|
+
await take(PersonalInfo.spans(out), true);
|
|
1068
|
+
}
|
|
1069
|
+
return { text: out, names: [...new Set(names)] };
|
|
1070
|
+
}
|
|
1071
|
+
async fill(input, tool, conversation) {
|
|
1072
|
+
const personal = new Map((await this.list()).filter((entry) => entry.kind === "personal").map((entry) => [entry.name, entry]));
|
|
1073
|
+
const values = await this.loaded();
|
|
1074
|
+
const used = new Set;
|
|
1075
|
+
const put = (text) => text.replace(/\$\{?TA_SECRET_([A-Z0-9_]+)\}?/g, (whole, name) => {
|
|
1076
|
+
if (!personal.has(name) || !values.has(name)) {
|
|
1077
|
+
return whole;
|
|
1078
|
+
}
|
|
1079
|
+
used.add(name);
|
|
1080
|
+
return values.get(name);
|
|
1081
|
+
});
|
|
1082
|
+
const walk = (value) => {
|
|
1083
|
+
if (typeof value === "string") {
|
|
1084
|
+
return put(value);
|
|
1085
|
+
}
|
|
1086
|
+
if (Array.isArray(value)) {
|
|
1087
|
+
for (let index = 0;index < value.length; index++) {
|
|
1088
|
+
value[index] = walk(value[index]);
|
|
1089
|
+
}
|
|
1090
|
+
return value;
|
|
1091
|
+
}
|
|
1092
|
+
if (value && typeof value === "object") {
|
|
1093
|
+
for (const key of Object.keys(value)) {
|
|
1094
|
+
value[key] = walk(value[key]);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
return value;
|
|
1098
|
+
};
|
|
1099
|
+
walk(input);
|
|
1100
|
+
if (used.size) {
|
|
1101
|
+
this.record([...used], ["tool"], tool, conversation);
|
|
1102
|
+
}
|
|
1103
|
+
return [...used];
|
|
1104
|
+
}
|
|
1105
|
+
async scrubber() {
|
|
1106
|
+
if (!this.scrubbing) {
|
|
1107
|
+
const values = await this.loaded();
|
|
1108
|
+
const aliases = new Map((await this.list()).filter((entry) => entry.hosts?.length && values.has(entry.name)).map((entry) => [entry.name, this.placeholder(entry.name)]));
|
|
1109
|
+
this.scrubbing = new Scrubber(values, this.proxy ? aliases : new Map);
|
|
1110
|
+
}
|
|
1111
|
+
return this.scrubbing;
|
|
1112
|
+
}
|
|
1113
|
+
async importKey(name, path, note) {
|
|
1114
|
+
const file = path.trim().replace(/^~(?=$|[\\/])/, homedir());
|
|
1115
|
+
const value = await readFile3(resolve(file), "utf8").catch(() => {
|
|
1116
|
+
throw new Error(`There is no file to read at ${path}.`);
|
|
1117
|
+
});
|
|
1118
|
+
if (!SecretNames.privateKey(value)) {
|
|
1119
|
+
throw new Error(`${path} holds no private key.`);
|
|
1120
|
+
}
|
|
1121
|
+
return this.add({ name, value, note, source: "asked" });
|
|
1122
|
+
}
|
|
1123
|
+
isRemote(cwd) {
|
|
1124
|
+
const root = this.host.agentDir ? join3(this.host.agentDir, "remote") : undefined;
|
|
1125
|
+
return !!root && !!cwd && (cwd === root || cwd.startsWith(root + sep));
|
|
1126
|
+
}
|
|
1127
|
+
async prepare(command, place = {}) {
|
|
1128
|
+
const named = SecretNames.references(command);
|
|
1129
|
+
const git = CommandPrelude.usesGit(command);
|
|
1130
|
+
const ssh = CommandPrelude.usesSsh(command);
|
|
1131
|
+
if (!named.length && !git && !ssh) {
|
|
1132
|
+
return {};
|
|
1133
|
+
}
|
|
1134
|
+
if (this.isRemote(place.cwd)) {
|
|
1135
|
+
return named.length ? { block: "The vault gives secrets only to commands of this computer, and this conversation works on a remote host. Tell the user." } : {};
|
|
1136
|
+
}
|
|
1137
|
+
const entries = await this.list();
|
|
1138
|
+
const values = await this.loaded();
|
|
1139
|
+
const byName = new Map(entries.map((entry) => [entry.name, entry]));
|
|
1140
|
+
const missing = named.filter((name) => !values.has(name));
|
|
1141
|
+
if (missing.length) {
|
|
1142
|
+
return {
|
|
1143
|
+
block: `The vault has no ${missing.map(SecretNames.handle).join(", ")}. Ask the user for it with ${REQUEST_TOOL}, or use one the vault has.`
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
const keysNamed = named.filter((name) => byName.get(name)?.ssh);
|
|
1147
|
+
if (keysNamed.length) {
|
|
1148
|
+
return {
|
|
1149
|
+
block: `${keysNamed.join(", ")}: an SSH key is no variable. ssh, scp, rsync and git get it by themselves; run them without naming it.`
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
const credentials = git ? entries.filter((entry) => entry.hosts?.length && values.has(entry.name)).flatMap((entry) => (entry.hosts ?? []).map((host) => ({ name: entry.name, host, user: SecretNames.gitUser(entry, host) }))) : [];
|
|
1153
|
+
const keys = ssh ? entries.filter((entry) => entry.ssh && values.has(entry.name)) : [];
|
|
1154
|
+
if (!named.length && !credentials.length && !keys.length) {
|
|
1155
|
+
return {};
|
|
1156
|
+
}
|
|
1157
|
+
const env = new Map;
|
|
1158
|
+
const proxied = [];
|
|
1159
|
+
for (const name of [...named, ...credentials.map((one) => one.name)]) {
|
|
1160
|
+
const hosts = byName.get(name)?.hosts ?? [];
|
|
1161
|
+
if (hosts.length && this.proxy) {
|
|
1162
|
+
if (!env.has(name)) {
|
|
1163
|
+
const placeholder = this.placeholder(name);
|
|
1164
|
+
proxied.push({ name, placeholder, value: values.get(name), hosts });
|
|
1165
|
+
env.set(name, placeholder);
|
|
1166
|
+
}
|
|
1167
|
+
} else {
|
|
1168
|
+
env.set(name, values.get(name));
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
let proxy;
|
|
1172
|
+
if (proxied.length && this.proxy) {
|
|
1173
|
+
try {
|
|
1174
|
+
proxy = { url: await this.proxy.open(proxied, place.conversation), bundle: await this.proxy.bundle() };
|
|
1175
|
+
} catch (error) {
|
|
1176
|
+
return {
|
|
1177
|
+
block: `The proxy that keeps ${proxied.map((one) => one.name).join(", ")} to ${proxied.length > 1 ? "their" : "its"} hosts cannot start (${error instanceof Error ? error.message : String(error)}). Tell the user.`
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
const folder = await mkdtemp2(join3(tmpdir2(), "ta-secrets-"));
|
|
1182
|
+
const keyFiles = [];
|
|
1183
|
+
for (const [index, entry] of keys.entries()) {
|
|
1184
|
+
const file2 = join3(folder, `key-${index}`);
|
|
1185
|
+
await writeFile3(file2, values.get(entry.name), { mode: 384 });
|
|
1186
|
+
keyFiles.push(file2);
|
|
1187
|
+
}
|
|
1188
|
+
const file = join3(folder, "prelude");
|
|
1189
|
+
await writeFile3(file, CommandPrelude.script({ env, git: credentials, keys: keyFiles, proxy }), { mode: 384 });
|
|
1190
|
+
setTimeout(() => void rm2(folder, { recursive: true, force: true }), PRELUDE_MS).unref?.();
|
|
1191
|
+
const bound = new Set(proxied.map((one) => one.name));
|
|
1192
|
+
const how = [
|
|
1193
|
+
...named.some((name) => !bound.has(name)) ? ["env"] : [],
|
|
1194
|
+
...named.some((name) => bound.has(name)) ? ["http"] : [],
|
|
1195
|
+
...credentials.length ? ["git"] : [],
|
|
1196
|
+
...keys.length ? ["ssh"] : []
|
|
1197
|
+
];
|
|
1198
|
+
const names = [...new Set([...named, ...credentials.map((one) => one.name), ...keys.map((entry) => entry.name)])];
|
|
1199
|
+
this.record(names, how, command, place.conversation);
|
|
1200
|
+
return { prelude: `. ${CommandPrelude.quote(file)}; rm -rf ${CommandPrelude.quote(folder)}
|
|
1201
|
+
`, names };
|
|
1202
|
+
}
|
|
1203
|
+
async uses() {
|
|
1204
|
+
return SecretNames.uses(await this.host.getExtensionData(NAME, Keys.USES));
|
|
1205
|
+
}
|
|
1206
|
+
async prompt() {
|
|
1207
|
+
const entries = await this.list();
|
|
1208
|
+
const kept = entries.length ? entries.map((entry) => `- ${Vault.described(entry)}`).join(`
|
|
1209
|
+
`) : "- none yet";
|
|
1210
|
+
return [
|
|
1211
|
+
`The user's secrets (tokens, passwords, keys, personal details) are kept in Ta's vault, never in this conversation. Each has a name: in a bash command write it as an environment variable, quoted ("$TA_SECRET_GITHUB_TOKEN"), and Ta gives that command its value. You never see a value: where one would show (output, a file read back) you see its name instead.`,
|
|
1212
|
+
"Use a secret only for what the user wants it for: never print it, write it into a file of the project or send it anywhere else. A secret the user sent in a message was taken into the vault and named in its place.",
|
|
1213
|
+
"Some are for git or SSH, as listed: git over https to their hosts, and ssh, scp, rsync and git over SSH, get them by themselves, with nothing to name; never put a token into a URL or a remote.",
|
|
1214
|
+
"Personal details of the user (phone numbers, emails, ID numbers, bank cards) are kept so too, listed with their masked hint: write the name where the detail goes, in a command or in any tool's arguments (a file written, a form, a message), and Ta puts the detail in as the tool runs. Never ask the user to repeat one.",
|
|
1215
|
+
"A secret bound to hosts reaches only them: a command naming it holds a placeholder, and its HTTPS requests go through Ta's proxy, which puts the value into the headers and the URL for those hosts alone (not into a body). Use it in a header or a query of a request to them, with curl, git or a program that follows HTTPS_PROXY; anything else sees only the placeholder.",
|
|
1216
|
+
`When you need a secret the vault lacks, call ${REQUEST_TOOL}: the user types it into Ta, not into the conversation. Never ask the user to paste a secret into the chat.`,
|
|
1217
|
+
"Kept now:",
|
|
1218
|
+
kept
|
|
1219
|
+
].join(`
|
|
1220
|
+
`);
|
|
1221
|
+
}
|
|
1222
|
+
async freeName(kind) {
|
|
1223
|
+
return SecretNames.free(kind, new Set((await this.list()).map((entry) => entry.name)));
|
|
1224
|
+
}
|
|
1225
|
+
placeholder(name) {
|
|
1226
|
+
return `ta-vault-${createHmac("sha256", this.placeholderKey).update(name).digest("hex").slice(0, 24)}`;
|
|
1227
|
+
}
|
|
1228
|
+
static described(entry) {
|
|
1229
|
+
const note = entry.note ? `: ${entry.note}` : "";
|
|
1230
|
+
if (entry.ssh) {
|
|
1231
|
+
return `SSH key ${entry.name}${note} (ssh, scp, rsync and git over SSH get it by themselves; it is no variable)`;
|
|
1232
|
+
}
|
|
1233
|
+
if (entry.kind === "personal") {
|
|
1234
|
+
return `${SecretNames.handle(entry.name)}: ${entry.note ? `${entry.note}, ` : ""}a personal detail${entry.hint ? ` (${entry.hint})` : ""}`;
|
|
1235
|
+
}
|
|
1236
|
+
const hosts = entry.hosts?.length ? ` (only to ${entry.hosts.join(", ")}: through the proxy, and git over https gets it there by itself)` : "";
|
|
1237
|
+
return `${SecretNames.handle(entry.name)}${note}${hosts}`;
|
|
1238
|
+
}
|
|
1239
|
+
recordRequest(use) {
|
|
1240
|
+
const [method, path = "/"] = use.request.split(" ");
|
|
1241
|
+
return this.record(use.names, ["http"], `${method} https://${use.host}${path}`, use.conversation);
|
|
1242
|
+
}
|
|
1243
|
+
record(names, how, command, conversation) {
|
|
1244
|
+
return this.serial(async () => {
|
|
1245
|
+
const at = Date.now();
|
|
1246
|
+
const entries = await this.list();
|
|
1247
|
+
await this.save(entries.map((entry) => names.includes(entry.name) ? { ...entry, usedAt: at, uses: (entry.uses ?? 0) + 1 } : entry));
|
|
1248
|
+
const text = Redactor.cut((await this.scrubber()).text(command).replace(/\s+/g, " ").trim(), 160);
|
|
1249
|
+
const use = { at, names: [...names], how, command: text, ...conversation ? { conversation: conversation.slice(0, 80) } : {} };
|
|
1250
|
+
await this.host.setExtensionData(NAME, Keys.USES, [...await this.uses(), use].slice(-MAX_USES));
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
loaded() {
|
|
1254
|
+
if (!this.values) {
|
|
1255
|
+
this.values = this.list().then(async (entries) => {
|
|
1256
|
+
const values = new Map;
|
|
1257
|
+
for (const entry of entries) {
|
|
1258
|
+
const value = await this.vaultStore.get(entry.name);
|
|
1259
|
+
if (value !== undefined) {
|
|
1260
|
+
values.set(entry.name, value);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
return values;
|
|
1264
|
+
});
|
|
1265
|
+
this.values.catch(() => {
|
|
1266
|
+
this.values = undefined;
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
return this.values;
|
|
1270
|
+
}
|
|
1271
|
+
async save(entries) {
|
|
1272
|
+
await this.host.setExtensionData(NAME, Keys.ENTRIES, entries.sort((a, b) => a.name.localeCompare(b.name)));
|
|
1273
|
+
}
|
|
1274
|
+
serial(work) {
|
|
1275
|
+
const next = this.queue.then(work);
|
|
1276
|
+
this.queue = next.catch(() => {
|
|
1277
|
+
return;
|
|
1278
|
+
});
|
|
1279
|
+
return next;
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
var WHOLE_KINDS = new Set([
|
|
1283
|
+
"PRIVATE_KEY",
|
|
1284
|
+
"API_KEY",
|
|
1285
|
+
"GITHUB_TOKEN",
|
|
1286
|
+
"GITLAB_TOKEN",
|
|
1287
|
+
"SLACK_TOKEN",
|
|
1288
|
+
"AWS_ACCESS_KEY_ID",
|
|
1289
|
+
"GOOGLE_API_KEY",
|
|
1290
|
+
"JWT",
|
|
1291
|
+
"BEARER_TOKEN",
|
|
1292
|
+
"URL_PASSWORD"
|
|
1293
|
+
]);
|
|
1294
|
+
|
|
1295
|
+
class VaultService {
|
|
1296
|
+
vault;
|
|
1297
|
+
constructor(vault) {
|
|
1298
|
+
this.vault = vault;
|
|
1299
|
+
}
|
|
1300
|
+
async info() {
|
|
1301
|
+
return { store: this.vault.store };
|
|
1302
|
+
}
|
|
1303
|
+
list() {
|
|
1304
|
+
return this.vault.list();
|
|
1305
|
+
}
|
|
1306
|
+
add(input) {
|
|
1307
|
+
return this.vault.add(input);
|
|
1308
|
+
}
|
|
1309
|
+
remove(name) {
|
|
1310
|
+
return this.vault.remove(name);
|
|
1311
|
+
}
|
|
1312
|
+
capturing() {
|
|
1313
|
+
return this.vault.capturing();
|
|
1314
|
+
}
|
|
1315
|
+
uses() {
|
|
1316
|
+
return this.vault.uses();
|
|
1317
|
+
}
|
|
1318
|
+
setCapturing(on) {
|
|
1319
|
+
return this.vault.setCapturing(on);
|
|
1320
|
+
}
|
|
1321
|
+
capturingPersonal() {
|
|
1322
|
+
return this.vault.capturingPersonal();
|
|
1323
|
+
}
|
|
1324
|
+
setCapturingPersonal(on) {
|
|
1325
|
+
return this.vault.setCapturingPersonal(on);
|
|
1326
|
+
}
|
|
1327
|
+
dispose() {
|
|
1328
|
+
this.vault.forget();
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
// web-src/host.ts
|
|
1333
|
+
function activate(host) {
|
|
1334
|
+
let vault;
|
|
1335
|
+
const proxy = new VaultProxy({ certs: new ProxyCerts, onUse: (use) => void vault?.recordRequest(use) });
|
|
1336
|
+
vault = new Vault(host, VaultStores.of(host.agentDir), proxy);
|
|
1337
|
+
return new VaultService(vault);
|
|
1338
|
+
}
|
|
1339
|
+
export {
|
|
1340
|
+
activate as default
|
|
1341
|
+
};
|