@songsid/agend 2.4.0-alpha.1 → 2.4.0-alpha.3
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.md +1 -1
- package/README.zh-TW.md +1 -1
- package/dist/account-isolation.d.ts +6 -0
- package/dist/account-isolation.js +40 -0
- package/dist/account-isolation.js.map +1 -0
- package/dist/accounts-signout.d.ts +15 -2
- package/dist/accounts-signout.js +52 -4
- package/dist/accounts-signout.js.map +1 -1
- package/dist/accounts-view.d.ts +114 -27
- package/dist/accounts-view.js +123 -60
- package/dist/accounts-view.js.map +1 -1
- package/dist/agent-cli-instructions.md +9 -7
- package/dist/agent-cli.js +47 -20
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-endpoint.js +23 -8
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/agent-list-output.d.ts +23 -0
- package/dist/agent-list-output.js +53 -0
- package/dist/agent-list-output.js.map +1 -0
- package/dist/agent-runtime-change.js +4 -4
- package/dist/agent-runtime-change.js.map +1 -1
- package/dist/agent-whats-new.js +4 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/antigravity-first-run.d.ts +4 -0
- package/dist/antigravity-first-run.js +57 -0
- package/dist/antigravity-first-run.js.map +1 -0
- package/dist/antigravity-identity.d.ts +6 -0
- package/dist/antigravity-identity.js +27 -0
- package/dist/antigravity-identity.js.map +1 -0
- package/dist/antigravity-store.d.ts +22 -0
- package/dist/antigravity-store.js +79 -0
- package/dist/antigravity-store.js.map +1 -0
- package/dist/auth-api.js +7 -1
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/agy-onboarding.d.ts +14 -0
- package/dist/backend/agy-onboarding.js +114 -0
- package/dist/backend/agy-onboarding.js.map +1 -0
- package/dist/backend/antigravity.d.ts +15 -0
- package/dist/backend/antigravity.js +44 -4
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/claude-code.js +4 -0
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/credential-profile.d.ts +22 -3
- package/dist/backend/credential-profile.js +61 -9
- package/dist/backend/credential-profile.js.map +1 -1
- package/dist/backend/types.d.ts +6 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-availability.d.ts +7 -1
- package/dist/backend-availability.js +39 -1
- package/dist/backend-availability.js.map +1 -1
- package/dist/browser-backend-signins.d.ts +16 -2
- package/dist/browser-backend-signins.js +17 -9
- package/dist/browser-backend-signins.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +10 -10
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/claude-auth-status.d.ts +1 -0
- package/dist/claude-auth-status.js +25 -0
- package/dist/claude-auth-status.js.map +1 -1
- package/dist/cli-capability.d.ts +104 -19
- package/dist/cli-capability.js +3 -1
- package/dist/cli-capability.js.map +1 -1
- package/dist/cli-caps-module.d.ts +14 -0
- package/dist/cli-caps-module.js +8 -1
- package/dist/cli-caps-module.js.map +1 -1
- package/dist/cli-registry-check.js +114 -18
- package/dist/cli-registry-check.js.map +1 -1
- package/dist/cli-registry.d.ts +116 -12
- package/dist/cli-registry.js +16 -1
- package/dist/cli-registry.js.map +1 -1
- package/dist/cli-spec-antigravity.d.ts +53 -11
- package/dist/cli-spec-antigravity.js +44 -13
- package/dist/cli-spec-antigravity.js.map +1 -1
- package/dist/cli-spec-claude-code.d.ts +14 -1
- package/dist/cli-spec-claude-code.js +5 -4
- package/dist/cli-spec-claude-code.js.map +1 -1
- package/dist/cli-spec-codex.d.ts +8 -0
- package/dist/cli-spec-codex.js +4 -3
- package/dist/cli-spec-codex.js.map +1 -1
- package/dist/cli-spec-grok.d.ts +4 -0
- package/dist/cli-spec-grok.js +2 -1
- package/dist/cli-spec-grok.js.map +1 -1
- package/dist/cli-spec-kiro-cli.d.ts +7 -0
- package/dist/cli-spec-kiro-cli.js +3 -2
- package/dist/cli-spec-kiro-cli.js.map +1 -1
- package/dist/cli-spec-muse.d.ts +4 -0
- package/dist/cli-spec-muse.js +2 -1
- package/dist/cli-spec-muse.js.map +1 -1
- package/dist/cli-spec-opencode.d.ts +1 -0
- package/dist/cli-spec-opencode.js +1 -0
- package/dist/cli-spec-opencode.js.map +1 -1
- package/dist/config-validator.js +47 -7
- package/dist/config-validator.js.map +1 -1
- package/dist/credential-store-proof.d.ts +6 -0
- package/dist/credential-store-proof.js +30 -0
- package/dist/credential-store-proof.js.map +1 -0
- package/dist/daemon.d.ts +3 -0
- package/dist/daemon.js +6 -2
- package/dist/daemon.js.map +1 -1
- package/dist/decision-list.d.ts +5 -4
- package/dist/decision-list.js +22 -8
- package/dist/decision-list.js.map +1 -1
- package/dist/fleet-manager.d.ts +53 -5
- package/dist/fleet-manager.js +301 -115
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.js +6 -6
- package/dist/fleet-windows-runtime.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +32 -4
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +42 -6
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +14 -6
- package/dist/general-knowledge/skills/fleet-health/SKILL.md +16 -0
- package/dist/general-knowledge/skills/hub/SKILL.md +361 -0
- package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -1
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +184 -36
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +5 -1
- package/dist/general-role.d.ts +1 -1
- package/dist/general-role.js +1 -0
- package/dist/general-role.js.map +1 -1
- package/dist/hub/audit/index.js +12 -5
- package/dist/hub/audit/index.js.map +1 -1
- package/dist/hub/buttons.d.ts +3 -0
- package/dist/hub/buttons.js +11 -11
- package/dist/hub/buttons.js.map +1 -1
- package/dist/hub/catalog.d.ts +18 -5
- package/dist/hub/catalog.js +119 -36
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.d.ts +6 -0
- package/dist/hub/client.js +6 -1
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +2 -0
- package/dist/hub/compose/member.js +26 -2
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +6 -0
- package/dist/hub/compose/server.js +11 -4
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/directory/directory.d.ts +1 -1
- package/dist/hub/directory/directory.js +51 -0
- package/dist/hub/directory/directory.js.map +1 -1
- package/dist/hub/directory/types.d.ts +14 -0
- package/dist/hub/directory/types.js.map +1 -1
- package/dist/hub/enrolment-code.d.ts +126 -0
- package/dist/hub/enrolment-code.js +266 -0
- package/dist/hub/enrolment-code.js.map +1 -0
- package/dist/hub/grant-access.d.ts +11 -0
- package/dist/hub/grant-access.js +113 -0
- package/dist/hub/grant-access.js.map +1 -0
- package/dist/hub/grant-search.d.ts +9 -0
- package/dist/hub/grant-search.js +92 -0
- package/dist/hub/grant-search.js.map +1 -0
- package/dist/hub/group-policy/admin-impact.d.ts +2 -0
- package/dist/hub/group-policy/admin-impact.js +14 -4
- package/dist/hub/group-policy/admin-impact.js.map +1 -1
- package/dist/hub/group-policy/admin-inventory.js +7 -7
- package/dist/hub/group-policy/admin-inventory.js.map +1 -1
- package/dist/hub/group-policy/authorization.d.ts +20 -3
- package/dist/hub/group-policy/authorization.js +132 -27
- package/dist/hub/group-policy/authorization.js.map +1 -1
- package/dist/hub/group-policy/impact-inventory.js +23 -7
- package/dist/hub/group-policy/impact-inventory.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +44 -6
- package/dist/hub/group-policy/resources.js +75 -30
- package/dist/hub/group-policy/resources.js.map +1 -1
- package/dist/hub/group-policy/store.d.ts +24 -3
- package/dist/hub/group-policy/store.js +136 -77
- package/dist/hub/group-policy/store.js.map +1 -1
- package/dist/hub/group-policy/welcome.js.map +1 -1
- package/dist/hub/http/compose.js +68 -16
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +18 -0
- package/dist/hub/http/core.js +108 -7
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +8 -0
- package/dist/hub/http/schema.js +11 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/init/text.js +2 -2
- package/dist/hub/init/text.js.map +1 -1
- package/dist/hub/init/web.d.ts +7 -0
- package/dist/hub/init/web.js +6 -1
- package/dist/hub/init/web.js.map +1 -1
- package/dist/hub/join/local.d.ts +32 -0
- package/dist/hub/join/local.js +98 -10
- package/dist/hub/join/local.js.map +1 -1
- package/dist/hub/join/receipt.d.ts +1 -0
- package/dist/hub/join/receipt.js +1 -1
- package/dist/hub/join/receipt.js.map +1 -1
- package/dist/hub/join/service.d.ts +94 -6
- package/dist/hub/join/service.js +214 -44
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/join/store.d.ts +2 -1
- package/dist/hub/join/store.js +7 -7
- package/dist/hub/join/store.js.map +1 -1
- package/dist/hub/member/exposure-api.d.ts +2 -0
- package/dist/hub/member/exposure-api.js +3 -2
- package/dist/hub/member/exposure-api.js.map +1 -1
- package/dist/hub/member/exposures.d.ts +4 -0
- package/dist/hub/member/exposures.js +12 -2
- package/dist/hub/member/exposures.js.map +1 -1
- package/dist/hub/member/pairing-api.js +4 -1
- package/dist/hub/member/pairing-api.js.map +1 -1
- package/dist/hub/member/pairing-notices.js +8 -6
- package/dist/hub/member/pairing-notices.js.map +1 -1
- package/dist/hub/pairing-notices.d.ts +5 -2
- package/dist/hub/pairing-notices.js +38 -13
- package/dist/hub/pairing-notices.js.map +1 -1
- package/dist/hub/pairing.d.ts +10 -2
- package/dist/hub/pairing.js +37 -16
- package/dist/hub/pairing.js.map +1 -1
- package/dist/hub/policy.d.ts +1 -1
- package/dist/hub/policy.js +19 -6
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/protocol.d.ts +60 -0
- package/dist/hub/protocol.js +9 -2
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/quota.d.ts +2 -1
- package/dist/hub/quota.js +2 -2
- package/dist/hub/quota.js.map +1 -1
- package/dist/hub/roles/authority.d.ts +45 -0
- package/dist/hub/roles/authority.js +199 -0
- package/dist/hub/roles/authority.js.map +1 -0
- package/dist/hub/roles/change.d.ts +18 -0
- package/dist/hub/roles/change.js +76 -0
- package/dist/hub/roles/change.js.map +1 -0
- package/dist/hub/roles/convert.d.ts +11 -0
- package/dist/hub/roles/convert.js +27 -0
- package/dist/hub/roles/convert.js.map +1 -0
- package/dist/hub/roles/cutover-inventory.d.ts +14 -0
- package/dist/hub/roles/cutover-inventory.js +42 -0
- package/dist/hub/roles/cutover-inventory.js.map +1 -0
- package/dist/hub/roles/cutover.d.ts +32 -0
- package/dist/hub/roles/cutover.js +184 -0
- package/dist/hub/roles/cutover.js.map +1 -0
- package/dist/hub/roles/delegation.d.ts +24 -0
- package/dist/hub/roles/delegation.js +111 -0
- package/dist/hub/roles/delegation.js.map +1 -0
- package/dist/hub/roles/evaluate.d.ts +50 -0
- package/dist/hub/roles/evaluate.js +96 -0
- package/dist/hub/roles/evaluate.js.map +1 -0
- package/dist/hub/roles/expiry.d.ts +46 -0
- package/dist/hub/roles/expiry.js +180 -0
- package/dist/hub/roles/expiry.js.map +1 -0
- package/dist/hub/roles/mode-effects.d.ts +5 -0
- package/dist/hub/roles/mode-effects.js +21 -0
- package/dist/hub/roles/mode-effects.js.map +1 -0
- package/dist/hub/roles/model.d.ts +171 -0
- package/dist/hub/roles/model.js +79 -0
- package/dist/hub/roles/model.js.map +1 -0
- package/dist/hub/roles/read.d.ts +29 -0
- package/dist/hub/roles/read.js +47 -0
- package/dist/hub/roles/read.js.map +1 -0
- package/dist/hub/roles/writer.d.ts +80 -0
- package/dist/hub/roles/writer.js +427 -0
- package/dist/hub/roles/writer.js.map +1 -0
- package/dist/hub/rooms.d.ts +8 -0
- package/dist/hub/rooms.js +47 -27
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/server.d.ts +3 -0
- package/dist/hub/server.js +18 -2
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/sessions.js +5 -1
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/settings-directory-decision.d.ts +2 -2
- package/dist/hub/settings-directory-decision.js +7 -5
- package/dist/hub/settings-directory-decision.js.map +1 -1
- package/dist/hub/settings-directory-proof.js +3 -1
- package/dist/hub/settings-directory-proof.js.map +1 -1
- package/dist/hub/settings-directory-recovery.js +3 -3
- package/dist/hub/settings-directory-recovery.js.map +1 -1
- package/dist/hub/sharing.d.ts +10 -0
- package/dist/hub/sharing.js +74 -0
- package/dist/hub/sharing.js.map +1 -0
- package/dist/hub/store.js +6 -2
- package/dist/hub/store.js.map +1 -1
- package/dist/hub/types.d.ts +29 -5
- package/dist/hub/web-origin.d.ts +80 -0
- package/dist/hub/web-origin.js +163 -0
- package/dist/hub/web-origin.js.map +1 -0
- package/dist/hub-pairing-summary.js +1 -1
- package/dist/hub-pairing-summary.js.map +1 -1
- package/dist/human-delivery-receipts.js +2 -2
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/instance-config-impact.js +4 -0
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.d.ts +13 -1
- package/dist/instance-lifecycle.js +36 -10
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +8 -2
- package/dist/instructions.js +28 -6
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +12 -8
- package/dist/locale.js.map +1 -1
- package/dist/log-service.d.ts +62 -6
- package/dist/log-service.js +135 -28
- package/dist/log-service.js.map +1 -1
- package/dist/log-steps-agy-grok.d.ts +74 -0
- package/dist/log-steps-agy-grok.js +440 -0
- package/dist/log-steps-agy-grok.js.map +1 -0
- package/dist/log-steps.d.ts +62 -3
- package/dist/log-steps.js +188 -22
- package/dist/log-steps.js.map +1 -1
- package/dist/log-transcript-paths.d.ts +29 -0
- package/dist/log-transcript-paths.js +109 -0
- package/dist/log-transcript-paths.js.map +1 -0
- package/dist/login-controller.d.ts +17 -3
- package/dist/login-controller.js +57 -5
- package/dist/login-controller.js.map +1 -1
- package/dist/login-flows.d.ts +24 -2
- package/dist/login-flows.js +53 -22
- package/dist/login-flows.js.map +1 -1
- package/dist/login-url.js +3 -0
- package/dist/login-url.js.map +1 -1
- package/dist/login-window-lock.d.ts +20 -8
- package/dist/login-window-lock.js +35 -16
- package/dist/login-window-lock.js.map +1 -1
- package/dist/machine-accounts.d.ts +42 -12
- package/dist/machine-accounts.js +144 -46
- package/dist/machine-accounts.js.map +1 -1
- package/dist/machine-signins.d.ts +35 -13
- package/dist/machine-signins.js +57 -27
- package/dist/machine-signins.js.map +1 -1
- package/dist/native-instance-input.js +4 -4
- package/dist/native-instance-input.js.map +1 -1
- package/dist/native-instance-registry.d.ts +3 -3
- package/dist/native-instance-registry.js +11 -10
- package/dist/native-instance-registry.js.map +1 -1
- package/dist/outbound-handlers.d.ts +14 -0
- package/dist/outbound-handlers.js +68 -20
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +18 -0
- package/dist/outbound-schemas.js +22 -4
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/profile-signins.d.ts +7 -0
- package/dist/profile-signins.js +2 -1
- package/dist/profile-signins.js.map +1 -1
- package/dist/runtime-build-info.js +6 -2
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-cli.js +33 -11
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client.d.ts +18 -2
- package/dist/runtime-client.js +84 -21
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-credential-profiles.d.ts +36 -4
- package/dist/runtime-credential-profiles.js +82 -16
- package/dist/runtime-credential-profiles.js.map +1 -1
- package/dist/runtime-profile-ownership.d.ts +2 -2
- package/dist/runtime-profile-ownership.js +3 -3
- package/dist/runtime-profile-ownership.js.map +1 -1
- package/dist/runtime-protocol.d.ts +5 -3
- package/dist/runtime-protocol.js +4 -0
- package/dist/runtime-protocol.js.map +1 -1
- package/dist/runtime-remote-accounts.d.ts +72 -5
- package/dist/runtime-remote-accounts.js +293 -52
- package/dist/runtime-remote-accounts.js.map +1 -1
- package/dist/runtime-remote-setup.d.ts +2 -2
- package/dist/runtime-remote-setup.js +2 -2
- package/dist/runtime-remote-setup.js.map +1 -1
- package/dist/runtime-signin-transport.d.ts +22 -4
- package/dist/runtime-signin-transport.js +50 -12
- package/dist/runtime-signin-transport.js.map +1 -1
- package/dist/runtime-signin.d.ts +42 -0
- package/dist/runtime-signin.js +105 -9
- package/dist/runtime-signin.js.map +1 -1
- package/dist/runtime-windows-bridge.js +6 -1
- package/dist/runtime-windows-bridge.js.map +1 -1
- package/dist/scheduler/task-board.d.ts +1 -0
- package/dist/scheduler/task-board.js +10 -1
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/settings-api.d.ts +34 -0
- package/dist/settings-api.js +184 -6
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +38 -1
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.js +14 -0
- package/dist/settings-effect.js.map +1 -1
- package/dist/signin-keepalive.d.ts +31 -2
- package/dist/signin-keepalive.js +123 -12
- package/dist/signin-keepalive.js.map +1 -1
- package/dist/structured-signin-transport.d.ts +2 -2
- package/dist/structured-signin-transport.js +27 -6
- package/dist/structured-signin-transport.js.map +1 -1
- package/dist/structured-signin.d.ts +16 -2
- package/dist/structured-signin.js +59 -4
- package/dist/structured-signin.js.map +1 -1
- package/dist/task-board-tool.d.ts +0 -13
- package/dist/task-board-tool.js +42 -6
- package/dist/task-board-tool.js.map +1 -1
- package/dist/tool-progress.d.ts +7 -0
- package/dist/tool-progress.js +21 -9
- package/dist/tool-progress.js.map +1 -1
- package/dist/tool-receipt-output.d.ts +151 -0
- package/dist/tool-receipt-output.js +50 -0
- package/dist/tool-receipt-output.js.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/ui/accounts-keepalive.js +15 -6
- package/dist/ui/accounts-manage.js +25 -5
- package/dist/ui/accounts-view.js +40 -26
- package/dist/ui/agent-details-settings.js +2 -2
- package/dist/ui/agent-page-strings.js +2 -2
- package/dist/ui/agent-proposals.js +22 -2
- package/dist/ui/agent-runtime-settings.js +3 -3
- package/dist/ui/backend-signin.js +49 -16
- package/dist/ui/chat-activity-groups.js +225 -0
- package/dist/ui/chat-activity.js +355 -0
- package/dist/ui/chat-popout-header.js +35 -0
- package/dist/ui/chat-popout-transport.js +80 -0
- package/dist/ui/chat-popout.js +63 -0
- package/dist/ui/chat-quote.js +3 -1
- package/dist/ui/chat-store.js +45 -4
- package/dist/ui/chat-workspace-gestures.js +177 -0
- package/dist/ui/chat-workspace-navigation.js +34 -10
- package/dist/ui/chat-workspace.js +96 -32
- package/dist/ui/cli-caps.js +7 -7
- package/dist/ui/credential-profile-select.js +32 -19
- package/dist/ui/host-install.js +2 -2
- package/dist/ui/hub-agent-copy.js +7 -7
- package/dist/ui/hub-chat-store.js +8 -4
- package/dist/ui/hub-chat-strings.js +3 -3
- package/dist/ui/hub-client.js +113 -18
- package/dist/ui/hub-company-join-strings.js +12 -10
- package/dist/ui/hub-company-join.js +52 -39
- package/dist/ui/hub-confirm-place.js +44 -0
- package/dist/ui/hub-directory-editor-strings.js +3 -3
- package/dist/ui/hub-directory-notice-strings.js +1 -1
- package/dist/ui/hub-enrolment-code-strings.js +44 -0
- package/dist/ui/hub-enrolment-code.js +159 -0
- package/dist/ui/hub-grant-picker.js +100 -0
- package/dist/ui/hub-group-search.js +82 -0
- package/dist/ui/hub-group-strings.js +8 -8
- package/dist/ui/hub-join-approval.js +31 -0
- package/dist/ui/hub-join-code-input.js +66 -0
- package/dist/ui/hub-join-one-strings.js +2 -2
- package/dist/ui/hub-join-queue.js +62 -0
- package/dist/ui/hub-join-steps.js +234 -0
- package/dist/ui/hub-joincode-flow-strings.js +22 -0
- package/dist/ui/hub-owner-strings.js +9 -9
- package/dist/ui/hub-pairing-progress-strings.js +1 -1
- package/dist/ui/hub-quick-pairing.js +8 -4
- package/dist/ui/hub-quick-strings.js +11 -11
- package/dist/ui/hub-share-refused.js +17 -0
- package/dist/ui/hub-strings.js +61 -61
- package/dist/ui/hub-this-hub.js +2 -2
- package/dist/ui/hub-welcome.js +26 -5
- package/dist/ui/image-annotate.js +283 -0
- package/dist/ui/image-lightbox.js +26 -6
- package/dist/ui/log-row.js +327 -0
- package/dist/ui/machine-signin.js +47 -14
- package/dist/ui/panel-chat.js +151 -12
- package/dist/ui/panel-details.js +14 -6
- package/dist/ui/panel-fleet.js +2 -2
- package/dist/ui/panel-hub.js +94 -21
- package/dist/ui/panel-log.js +9 -154
- package/dist/ui/panel-settings.js +50 -13
- package/dist/ui/search-dialog.js +1 -0
- package/dist/ui/settings-access-overview.js +1 -1
- package/dist/ui/settings-hub-browser-certificate.js +3 -3
- package/dist/ui/settings-hub-company-join.js +42 -30
- package/dist/ui/settings-hub-connection.js +8 -5
- package/dist/ui/settings-hub-membership.js +3 -3
- package/dist/ui/settings-hub-section.js +3 -1
- package/dist/ui/settings-hub-setup-strings.js +6 -6
- package/dist/ui/settings-hub-setup.js +44 -6
- package/dist/ui/settings-hub-web-address.js +233 -0
- package/dist/ui/settings-hub.js +41 -10
- package/dist/ui/settings-layout.js +6 -4
- package/dist/ui/settings-public-session-strings.js +37 -0
- package/dist/ui/settings-registry.js +4 -0
- package/dist/ui/settings-strings.js +2 -2
- package/dist/ui/shared/accounts-keepalive.css +8 -0
- package/dist/ui/shared/accounts-usage-pool.css +10 -0
- package/dist/ui/shared/accounts.css +9 -0
- package/dist/ui/shared/app-shell.js +16 -10
- package/dist/ui/shared/app.css +233 -35
- package/dist/ui/shared/app.js +8 -1
- package/dist/ui/shared/chat-render.js +11 -2
- package/dist/ui/shared/chat-thread.js +20 -3
- package/dist/ui/shared/chat-work-bar.css +7 -0
- package/dist/ui/shared/chat-workspace-model.js +39 -9
- package/dist/ui/shared/hub-grant-picker.css +4 -0
- package/dist/ui/shared/hub-owner.css +8 -0
- package/dist/ui/shared/hub-sharing.css +4 -0
- package/dist/ui/shared/identity-color.js +9 -3
- package/dist/ui/shared/image-annotate.css +45 -0
- package/dist/ui/shared/instance-nav.js +59 -22
- package/dist/ui/shared/pane-geometry.js +29 -0
- package/dist/ui/shared/signin.js +2 -2
- package/dist/ui/shared/tokens.css +14 -0
- package/dist/ui/shared/ui-menu.js +22 -7
- package/dist/ui/shared/view-strings.js +2 -2
- package/dist/ui/signin.html +1 -1
- package/dist/ui/structured-signin.js +29 -9
- package/dist/ui/usage-pool.js +76 -0
- package/dist/usage/agent-output.d.ts +144 -0
- package/dist/usage/agent-output.js +75 -0
- package/dist/usage/agent-output.js.map +1 -0
- package/dist/usage/provider-alerts.d.ts +6 -0
- package/dist/usage/provider-alerts.js +6 -0
- package/dist/usage/provider-alerts.js.map +1 -1
- package/dist/usage/providers.d.ts +2 -2
- package/dist/usage/providers.js +60 -18
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/usage-api.d.ts +12 -0
- package/dist/usage/usage-api.js +39 -0
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/web-api.d.ts +3 -0
- package/dist/web-api.js +61 -16
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +13 -4
- package/dist/web-backend-login.js +7 -4
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-chat-history.d.ts +11 -0
- package/dist/web-chat-history.js +9 -1
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-guest-access.js +2 -2
- package/dist/web-guest-access.js.map +1 -1
- package/dist/web-session.d.ts +31 -3
- package/dist/web-session.js +25 -4
- package/dist/web-session.js.map +1 -1
- package/dist/web-settings-patch.d.ts +8 -2
- package/dist/web-settings-patch.js +22 -10
- package/dist/web-settings-patch.js.map +1 -1
- package/dist/windows-cli-providers.js +5 -1
- package/dist/windows-cli-providers.js.map +1 -1
- package/dist/windows-cli-worker.d.ts +33 -1
- package/dist/windows-cli-worker.js +150 -10
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/windows-cli.d.ts +7 -1
- package/dist/windows-cli.js +19 -2
- package/dist/windows-cli.js.map +1 -1
- package/dist/workflow-templates/default.md +2 -2
- package/package.json +1 -1
package/dist/ui/hub-strings.js
CHANGED
|
@@ -11,18 +11,18 @@ register("hub", {
|
|
|
11
11
|
myFleet: "My fleet", hub: "Hub", openHubTab: "Open {0} in a new tab", switcher: "Workspace",
|
|
12
12
|
// The Hub's own pages
|
|
13
13
|
askTitle: "Ask", askEmpty: "No agents you can ask yet", askHint: "When an owner shares an agent with you, it appears here with who allowed it.",
|
|
14
|
-
exposuresTitle: "My
|
|
14
|
+
exposuresTitle: "My shared agents", exposuresEmpty: "You don't share any agents yet",
|
|
15
15
|
exposuresHint: "Share an agent from your own fleet: Settings → Hub → Connect to a Hub.",
|
|
16
16
|
adminTitle: "Administration",
|
|
17
|
-
// The Hub workspace (S3b): sign-in, Ask, My
|
|
17
|
+
// The Hub workspace (S3b): sign-in, Ask, My shared agents, Administration
|
|
18
18
|
signedOutHub: "Not signed in", signOut: "Sign out", signInTitle: "Sign in to the Hub",
|
|
19
|
-
signInLead: "Use your
|
|
19
|
+
signInLead: "Use your company account. Your password goes to the directory only and is never kept.",
|
|
20
20
|
login: "Account", password: "Password", signIn: "Sign in",
|
|
21
21
|
errSignIn: "That account and password didn't work.", errDirectory: "The directory can't be reached right now. Try again later.",
|
|
22
22
|
errBusyHub: "Too many requests just now. Wait a moment and try again.", errConflictHub: "This changed meanwhile. It has been reloaded; check it and try again.",
|
|
23
|
-
errNotFound: "Not found, or not available to you.", errDenied: "You're not allowed to do that (or no longer).", errUnreachableHub: "The Hub can't be reached.",
|
|
23
|
+
errNotFound: "Not found, or not available to you.", errDenied: "You're not allowed to do that (or no longer).", approveOwnerDenied: "{0} can't connect a Fleet right now: they aren't in the allowed groups, or they've been blocked from connecting.", errUnreachableHub: "The Hub can't be reached.",
|
|
24
24
|
askableTitle: "Agents you can ask", allowedBy: "Shared by {0} · until {1}", ask: "Ask", roomsTitle: "Your conversations", openRoom: "Open", back: "Back",
|
|
25
|
-
roomNote: "You're asking as yourself
|
|
25
|
+
roomNote: "You're asking as yourself: the owner sees that you asked. The agent answers within what its owner allows.",
|
|
26
26
|
roomShared: "Everyone who asks this agent shares its one conversation, so it may remember what others asked. Don't send anything other askers shouldn't see.",
|
|
27
27
|
agentPolicy: "Shared as a representative agent: questions go into its ordinary conversation, with the tools its fleet's Settings allow.",
|
|
28
28
|
expiredText: "This text was removed under the Hub's retention policy.", roomClosed: "This conversation is closed: the access it used was withdrawn.",
|
|
@@ -31,21 +31,21 @@ register("hub", {
|
|
|
31
31
|
stageNotAnswered: "Not answered", stageUncertain: "Outcome unknown; the owner has been told",
|
|
32
32
|
pairingsTitle: "Pairing requests for you", pairingsLead: "Confirm only if this fingerprint matches the one your fleet's Settings shows.",
|
|
33
33
|
confirmPairing: "Confirm", confirmPairingAsk: "Does your fleet show this fingerprint?\n{0}", confirmed: "Confirmed",
|
|
34
|
-
state_published: "Shared", state_withdrawn: "Withdrawn", state_frozen: "
|
|
34
|
+
state_published: "Shared", state_withdrawn: "Withdrawn", state_frozen: "Sharing stopped on the Hub", revision: "revision {0}", until: "until {0}",
|
|
35
35
|
noGrants: "Nobody can ask it yet.", grantLogin: "Allow this account to ask", grantDays: "For", days: "{0} days", allow: "Allow",
|
|
36
|
-
freeze: "Stop
|
|
36
|
+
freeze: "Stop sharing", freezeAsk: "Stop sharing {0}? No one can ask it any more. To share it again, it has to be shared again from its fleet, and everyone has to be allowed to ask again.",
|
|
37
37
|
revoke: "Revoke", revokeAsk: "Revoke {0}'s access? Their conversation closes.",
|
|
38
|
-
adminOnly: "Only the Hub administrator can see this", adminOnlyHint: "
|
|
38
|
+
adminOnly: "Only the Hub administrator can see this", adminOnlyHint: "Connected fleets and pairing codes are managed here.",
|
|
39
39
|
pairTitle: "Pair a fleet", pairLead: "Create a one-time code for a person who has signed in to this Hub. It works once, for ten minutes.",
|
|
40
40
|
pairOwner: "Owner's account", pairCreate: "Create code", pairCode: "Give this code to {0}, for their fleet's Settings:",
|
|
41
41
|
pendingPairings: "Pairing requests", codeUnused: "Code not used yet", ownerConfirmed: "Owner confirmed", ownerWaiting: "Waiting for the owner's confirmation",
|
|
42
42
|
approved: "Approved", approve: "Approve", approveAsk: "Approve the fleet with this fingerprint?\n{0}",
|
|
43
|
-
fleetsTitle: "
|
|
44
|
-
noFleets: "No
|
|
43
|
+
fleetsTitle: "Connected fleets", fleetActive: "Active", fleetRevoked: "Revoked", revokeFleetAsk: "Revoke {0}'s fleet? It disconnects and everything it shares is withdrawn.", revokeFleetNamedAsk: "Revoke {1}'s fleet “{0}”? It disconnects and everything it shares is withdrawn.",
|
|
44
|
+
noFleets: "No fleet is connected yet.",
|
|
45
45
|
// Settings → Connect to a Hub
|
|
46
46
|
title: "Connect to a Hub",
|
|
47
|
-
lead: "A Hub lets people in your
|
|
48
|
-
address: "Hub address", addressPh: "https://", addressHint: "The https:// address your Hub administrator gave you.", code: "
|
|
47
|
+
lead: "A Hub lets people in your organization ask agents you choose to share. Your fleet stays yours: you decide which agents are shared and who may ask them.",
|
|
48
|
+
address: "Hub address", addressPh: "https://", addressHint: "The https:// address your Hub administrator gave you.", code: "Pairing code", connect: "Connect",
|
|
49
49
|
errAddress: "Enter the Hub's https:// address.", errCode: "Enter the pairing code exactly as it was given.",
|
|
50
50
|
errBusy: "This fleet is already connected or waiting for approval.", errUnreachable: "Could not reach the Hub at that address.",
|
|
51
51
|
errRefused: "The Hub refused this code.", errFailed: "That didn't work. Try again.",
|
|
@@ -58,23 +58,23 @@ register("hub", {
|
|
|
58
58
|
disconnectAsk: "Disconnect from {0}? Every agent you share there is withdrawn.",
|
|
59
59
|
disconnectPending: "Disconnected here. The Hub hasn't confirmed it yet; it will be told when it can be reached.",
|
|
60
60
|
keyTitle: "The Hub's key changed",
|
|
61
|
-
keyLead: "Nothing connects until you
|
|
62
|
-
keyApproved: "Approved key", keyOffered: "Key the Hub presents now", repair: "
|
|
61
|
+
keyLead: "Nothing connects until you reconnect. If you didn't expect this, ask your Hub administrator before reconnecting.",
|
|
62
|
+
keyApproved: "Approved key", keyOffered: "Key the Hub presents now", repair: "Reconnect",
|
|
63
63
|
heldTitle: "On hold", holdClear: "Start over",
|
|
64
|
-
hold_unknown_outcome: "The last
|
|
65
|
-
hold_expired: "The
|
|
66
|
-
offlineRecovery: "A temporary outage reconnects automatically. If the Hub was restored or no longer
|
|
67
|
-
hold_rejected: "The Hub cannot resume this fleet’s saved connection. It may have been restored to an older state or no longer
|
|
68
|
-
hold_refused: "The Hub refused the
|
|
64
|
+
hold_unknown_outcome: "The last connection step's result is unknown. Nothing runs until it is checked.",
|
|
65
|
+
hold_expired: "The connection request expired.", hold_unsaved: "This fleet couldn't save its Hub settings. Nothing connects until they can be saved.",
|
|
66
|
+
offlineRecovery: "A temporary outage reconnects automatically. If the Hub was restored or no longer recognizes this fleet, reconnect.",
|
|
67
|
+
hold_rejected: "The Hub cannot resume this fleet’s saved connection. It may have been restored to an older state or no longer recognize this fleet. Reconnect it.",
|
|
68
|
+
hold_refused: "The Hub refused the connection.", hold_revoked: "The Hub revoked this fleet's connection.", hold_other: "The connection is on hold.",
|
|
69
69
|
sharedTitle: "Shared agents",
|
|
70
70
|
sharedLead: "Every agent is private unless you share it. Only an agent that can run in a restricted, read-only mode can be shared.",
|
|
71
|
-
share: "Share {0}", notEnforceable: "Can't be shared yet: restricted mode isn't available for it.", frozen: "
|
|
72
|
-
policy: "Shares {0} · tools: {1}", noAgents: "This fleet has no agents yet.",
|
|
71
|
+
share: "Share {0}", notEnforceable: "Can't be shared yet: restricted mode isn't available for it.", frozen: "Sharing stopped on the Hub",
|
|
72
|
+
policy: "Shares {0} · tools: {1}", noAgents: "This fleet has no agents to share yet.",
|
|
73
73
|
// S3c (S-55): the owner's picker and the confirmation it waits for.
|
|
74
74
|
pickView: "Data view", pickTools: "Tools", shareNow: "Share", pickCancel: "Cancel", pickNone: "Choose a data view and at least one tool.",
|
|
75
|
-
waitingConfirm: "Waiting for your confirmation", pendingSent: "Sent for confirmation:
|
|
75
|
+
waitingConfirm: "Waiting for your confirmation", pendingSent: "Sent for confirmation: finish it on the confirm card to share it.",
|
|
76
76
|
errLimit: "At most 64 agents can be shared.", notAvailable: "Not available on this AgEnD version.",
|
|
77
|
-
hubStillNeeded: "Still needed on the Hub:", ownerStepHub: "Your confirmation: sign in to the Hub, open My
|
|
77
|
+
hubStillNeeded: "Still needed on the Hub:", ownerStepHub: "Your confirmation: sign in to the Hub, open My shared agents and confirm this fingerprint.",
|
|
78
78
|
adminStepHub: "The Hub administrator's approval of this fingerprint.", hubProgressHidden: "This page can't see their progress; it connects once both are done.",
|
|
79
79
|
localMatch: "It matches the Hub's screen", localConfirmed: "You confirmed this fingerprint here.",
|
|
80
80
|
hold_disconnected: "Disconnected here. The Hub still lists this fleet until its administrator revokes it.", startOver: "Start over",
|
|
@@ -83,75 +83,75 @@ register("hub", {
|
|
|
83
83
|
},
|
|
84
84
|
"zh-TW": {
|
|
85
85
|
allowOnHub: "允許他人提問…",
|
|
86
|
-
preview: "
|
|
86
|
+
preview: "預覽:這個版本還不能真正連接 Hub,這裡的操作不會離開這個頁面。",
|
|
87
87
|
myFleet: "我的 Fleet", hub: "Hub", openHubTab: "在新分頁開啟 {0}", switcher: "工作區",
|
|
88
88
|
askTitle: "提問", askEmpty: "目前還沒有你可以提問的 Agent", askHint: "有人把 Agent 開放給你之後,它會出現在這裡,並註明是誰授權的。",
|
|
89
|
-
exposuresTitle: "
|
|
90
|
-
exposuresHint: "請在自己的 Fleet
|
|
89
|
+
exposuresTitle: "我分享的 Agent", exposuresEmpty: "你還沒有分享任何 Agent",
|
|
90
|
+
exposuresHint: "請在自己的 Fleet 分享 Agent:設定 → Hub。",
|
|
91
91
|
adminTitle: "管理",
|
|
92
92
|
signedOutHub: "尚未登入", signOut: "登出", signInTitle: "登入 Hub",
|
|
93
|
-
signInLead: "
|
|
93
|
+
signInLead: "請使用公司帳號登入。密碼只送給目錄服務驗證,不會被保存。",
|
|
94
94
|
login: "帳號", password: "密碼", signIn: "登入",
|
|
95
95
|
errSignIn: "帳號或密碼不正確。", errDirectory: "目前無法連到目錄服務,請稍後再試。",
|
|
96
96
|
errBusyHub: "請求太頻繁,請稍候再試。", errConflictHub: "這個項目剛剛有變更,已重新載入,請確認後再試一次。",
|
|
97
|
-
errNotFound: "找不到,或你無法使用。", errDenied: "你沒有權限(或權限已被撤回)。", errUnreachableHub: "無法連到 Hub。",
|
|
97
|
+
errNotFound: "找不到,或你無法使用。", errDenied: "你沒有權限(或權限已被撤回)。", approveOwnerDenied: "{0} 目前不能連接 Fleet(不在允許的範圍,或已被禁止連接)。", errUnreachableHub: "無法連到 Hub。",
|
|
98
98
|
askableTitle: "你可以提問的 Agent", allowedBy: "由 {0} 開放 · 到 {1}", ask: "提問", roomsTitle: "你的對話", openRoom: "開啟", back: "返回",
|
|
99
|
-
roomNote: "
|
|
99
|
+
roomNote: "你是以自己的身分提問:對方會看到是你問的;Agent 用擁有者允許的範圍回答。",
|
|
100
100
|
roomShared: "所有向這個 Agent 提問的人共用它的同一段對話,它可能記得其他人問過的內容。請勿傳送不該讓其他提問者看到的內容。",
|
|
101
|
-
agentPolicy: "以代表 Agent
|
|
101
|
+
agentPolicy: "以代表 Agent 分享:提問會送到它平常的對話,使用它所在 Fleet 設定允許的工具。",
|
|
102
102
|
expiredText: "這段文字已依 Hub 的保存期限刪除。", roomClosed: "這段對話已關閉:它使用的權限已被撤回。",
|
|
103
103
|
question: "問題", questionPh: "輸入問題…", send: "送出",
|
|
104
104
|
stageQueued: "等待擁有者的 Fleet", stageDelivered: "已送達", stageWorking: "處理中", stageAnswered: "已回答",
|
|
105
105
|
stageNotAnswered: "未回答", stageUncertain: "結果不明,已通知擁有者",
|
|
106
106
|
pairingsTitle: "給你的配對請求", pairingsLead: "請確認這個指紋和你 Fleet 設定頁顯示的相同,再按確認。",
|
|
107
107
|
confirmPairing: "確認", confirmPairingAsk: "你的 Fleet 顯示的是這個指紋嗎?\n{0}", confirmed: "已確認",
|
|
108
|
-
state_published: "
|
|
108
|
+
state_published: "分享中", state_withdrawn: "已撤回", state_frozen: "已在 Hub 停止分享", revision: "第 {0} 版", until: "到 {0}",
|
|
109
109
|
noGrants: "目前沒有人可以提問。", grantLogin: "允許這個帳號提問", grantDays: "期間", days: "{0} 天", allow: "允許",
|
|
110
|
-
freeze: "
|
|
110
|
+
freeze: "停止分享", freezeAsk: "要停止分享 {0} 嗎?之後沒有人能再向它提問。要再分享,必須回到它的 Fleet 重新分享,而且每個人都要重新允許提問。",
|
|
111
111
|
revoke: "撤銷", revokeAsk: "要撤銷 {0} 的權限嗎?對方的對話會關閉。",
|
|
112
|
-
adminOnly: "只有 Hub 管理員可以查看", adminOnlyHint: "
|
|
113
|
-
pairTitle: "配對 Fleet", pairLead: "為已登入過這個 Hub
|
|
112
|
+
adminOnly: "只有 Hub 管理員可以查看", adminOnlyHint: "已連接的 Fleet 與配對碼在這裡管理。",
|
|
113
|
+
pairTitle: "配對 Fleet", pairLead: "為已登入過這個 Hub 的人建立配對碼,只能使用一次,十分鐘內有效。",
|
|
114
114
|
pairOwner: "擁有者帳號", pairCreate: "建立配對碼", pairCode: "請把這組配對碼交給 {0},在對方 Fleet 的設定頁輸入:",
|
|
115
115
|
pendingPairings: "配對請求", codeUnused: "配對碼尚未使用", ownerConfirmed: "擁有者已確認", ownerWaiting: "等待擁有者確認",
|
|
116
116
|
approved: "已核准", approve: "核准", approveAsk: "要核准這個指紋的 Fleet 嗎?\n{0}",
|
|
117
|
-
fleetsTitle: "
|
|
118
|
-
noFleets: "
|
|
119
|
-
title: "
|
|
120
|
-
lead: "Hub
|
|
121
|
-
address: "Hub 位址", addressPh: "https://", addressHint: "Hub 管理員給你的 https:// 位址。", code: "
|
|
117
|
+
fleetsTitle: "已連接的 Fleet", fleetActive: "使用中", fleetRevoked: "已撤銷", revokeFleetAsk: "要撤銷 {0} 的 Fleet 嗎?它的連接會結束,分享的內容都會撤回。", revokeFleetNamedAsk: "要撤銷 {1} 的 Fleet「{0}」嗎?它的連接會結束,分享的內容都會撤回。",
|
|
118
|
+
noFleets: "還沒有已連接的 Fleet。",
|
|
119
|
+
title: "連接 Hub",
|
|
120
|
+
lead: "Hub 讓組織裡的人可以向你選擇分享的 Agent 提問。你的 Fleet 仍然屬於你:要分享哪些 Agent、誰可以提問,都由你決定。",
|
|
121
|
+
address: "Hub 位址", addressPh: "https://", addressHint: "Hub 管理員給你的 https:// 位址。", code: "配對碼", connect: "連接",
|
|
122
122
|
errAddress: "請輸入 Hub 的 https:// 位址。", errCode: "請完整輸入配對碼。",
|
|
123
|
-
errBusy: "這個 Fleet
|
|
123
|
+
errBusy: "這個 Fleet 已經連接,或正在等待核准。", errUnreachable: "無法連到這個位址的 Hub。",
|
|
124
124
|
errRefused: "Hub 拒絕了這個配對碼。", errFailed: "沒有成功,請再試一次。",
|
|
125
125
|
pendingTitle: "等待核准", pairingFp: "配對指紋",
|
|
126
126
|
pendingCompare: "請和 Hub 畫面上的指紋比對,兩者相同後再到 Hub 確認。",
|
|
127
127
|
pendingSteps: "還需要:", ownerStep: "你用自己的 Hub 帳號確認", adminStep: "Hub 管理員核准",
|
|
128
128
|
done: "已完成", waiting: "等待中", expires: "{0} 到期", cancel: "取消請求", showFull: "顯示完整指紋", hideFull: "收合",
|
|
129
|
-
pairedTitle: "
|
|
130
|
-
openHub: "開啟 Hub", disconnect: "
|
|
131
|
-
disconnectAsk: "
|
|
129
|
+
pairedTitle: "已連接 {0}", online: "在線", offline: "離線,正在重新連線", hubKeyFp: "Hub 金鑰指紋",
|
|
130
|
+
openHub: "開啟 Hub", disconnect: "移除連接",
|
|
131
|
+
disconnectAsk: "要移除與 {0} 的連接嗎?你在那裡分享的 Agent 都會撤回。",
|
|
132
132
|
disconnectPending: "已在這裡中斷。Hub 尚未確認,連得上時會再通知它。",
|
|
133
133
|
keyTitle: "Hub 的金鑰已變更",
|
|
134
|
-
keyLead: "
|
|
135
|
-
keyApproved: "已核准的金鑰", keyOffered: "Hub 目前提供的金鑰", repair: "
|
|
134
|
+
keyLead: "重新連接前不會連接。若你沒有預期這個變更,請先詢問 Hub 管理員,再重新連接。",
|
|
135
|
+
keyApproved: "已核准的金鑰", keyOffered: "Hub 目前提供的金鑰", repair: "重新連接",
|
|
136
136
|
heldTitle: "暫停中", holdClear: "重新開始",
|
|
137
|
-
hold_unknown_outcome: "
|
|
138
|
-
hold_expired: "
|
|
139
|
-
offlineRecovery: "暫時離線會自動重新連線。若 Hub 已還原,或不再接受這個 Fleet
|
|
140
|
-
hold_rejected: "Hub 無法繼續使用這個 Fleet 儲存的連接。Hub 可能已還原至較舊的狀態,或不再接受這個 Fleet
|
|
141
|
-
hold_refused: "Hub
|
|
142
|
-
sharedTitle: "
|
|
143
|
-
sharedLead: "每個 Agent
|
|
144
|
-
share: "
|
|
145
|
-
policy: "
|
|
146
|
-
pickView: "資料檢視", pickTools: "工具", shareNow: "
|
|
147
|
-
waitingConfirm: "等待你的確認", pendingSent: "
|
|
148
|
-
errLimit: "
|
|
149
|
-
hubStillNeeded: "還需要在 Hub 完成:", ownerStepHub: "你的確認:登入 Hub
|
|
150
|
-
adminStepHub: "Hub 管理員核准這個指紋。", hubProgressHidden: "這個頁面看不到 Hub
|
|
137
|
+
hold_unknown_outcome: "最後一個連接步驟的結果不明,確認之前不會執行任何工作。",
|
|
138
|
+
hold_expired: "連接請求已過期。", hold_unsaved: "這個 Fleet 無法儲存 Hub 設定,可以儲存之前不會連接。",
|
|
139
|
+
offlineRecovery: "暫時離線會自動重新連線。若 Hub 已還原,或不再接受這個 Fleet,請重新連接。",
|
|
140
|
+
hold_rejected: "Hub 無法繼續使用這個 Fleet 儲存的連接。Hub 可能已還原至較舊的狀態,或不再接受這個 Fleet;請重新連接。",
|
|
141
|
+
hold_refused: "Hub 拒絕了這次連接。", hold_revoked: "Hub 已撤銷這個 Fleet 的連接。", hold_other: "連接已暫停。",
|
|
142
|
+
sharedTitle: "分享的 Agent",
|
|
143
|
+
sharedLead: "每個 Agent 預設都不分享。只有能在受限、唯讀模式下執行的 Agent 才能分享。",
|
|
144
|
+
share: "分享 {0}", notEnforceable: "暫時無法分享:這個 Agent 還不能使用受限模式。", frozen: "已在 Hub 停止分享",
|
|
145
|
+
policy: "分享 {0} · 工具:{1}", noAgents: "這個 Fleet 還沒有可以分享的 Agent。",
|
|
146
|
+
pickView: "資料檢視", pickTools: "工具", shareNow: "分享", pickCancel: "取消", pickNone: "請選擇一個資料檢視和至少一個工具。",
|
|
147
|
+
waitingConfirm: "等待你的確認", pendingSent: "已送出確認:請在確認卡完成,才會分享。",
|
|
148
|
+
errLimit: "最多只能分享 64 個 Agent。", notAvailable: "這個 AgEnD 版本無法使用此功能。",
|
|
149
|
+
hubStillNeeded: "還需要在 Hub 完成:", ownerStepHub: "你的確認:登入 Hub,在「我分享的 Agent」確認這個指紋。",
|
|
150
|
+
adminStepHub: "Hub 管理員核准這個指紋。", hubProgressHidden: "這個頁面看不到 Hub 那邊的進度,兩項都完成後就會連接。",
|
|
151
151
|
localMatch: "和 Hub 畫面上的一致", localConfirmed: "你已在這裡確認這個指紋。",
|
|
152
|
-
hold_disconnected: "
|
|
152
|
+
hold_disconnected: "已在這裡移除連接。Hub 管理員撤銷之前,Hub 上仍會列出這個 Fleet。", startOver: "重新開始",
|
|
153
153
|
errConflict: "這份清單在其他分頁有變更,已重新載入,請再試一次。", errUnsaved: "無法儲存這個變更。",
|
|
154
|
-
errNotPaired: "
|
|
154
|
+
errNotPaired: "請先連接 Hub。", withdrawPending: "已在這裡撤回,連得上 Hub 時會再通知它。",
|
|
155
155
|
},
|
|
156
156
|
});
|
|
157
157
|
/** hub.* words: hw("pairedTitle", name). */
|
package/dist/ui/hub-this-hub.js
CHANGED
|
@@ -16,7 +16,7 @@ register("hubThisHub", {
|
|
|
16
16
|
name: "Hub name", noName: "No name", namePlaceholder: "No name: shown as AgEnD Hub", nameHint: "Up to 64 characters.",
|
|
17
17
|
save: "Save name", removeName: "Remove name", saving: "Saving…",
|
|
18
18
|
saved: "Saved. The Hub is reloading with its new name.", removed: "Name removed. The Hub is reloading.",
|
|
19
|
-
hubId: "Hub ID", memberKey: "Member key fingerprint", memberKeyHint: "People compare this when they
|
|
19
|
+
hubId: "Hub ID", memberKey: "Member key fingerprint", memberKeyHint: "People compare this when they connect a fleet with a pairing code.",
|
|
20
20
|
issuerKey: "Issuer key", version: "AgEnD version", unknown: "Unknown",
|
|
21
21
|
install: "Installed as", install_dedicated: "Dedicated: this computer runs only the Hub", "install_same-user-pilot": "Beside a fleet, under the same user",
|
|
22
22
|
installHint: "Chosen when the Hub was set up.",
|
|
@@ -35,7 +35,7 @@ register("hubThisHub", {
|
|
|
35
35
|
name: "Hub 名稱", noName: "沒有名稱", namePlaceholder: "沒有名稱:顯示為 AgEnD Hub", nameHint: "最多 64 個字元。",
|
|
36
36
|
save: "儲存名稱", removeName: "移除名稱", saving: "儲存中…",
|
|
37
37
|
saved: "已儲存。Hub 正在以新名稱重新載入。", removed: "已移除名稱。Hub 正在重新載入。",
|
|
38
|
-
hubId: "Hub ID", memberKey: "成員金鑰指紋", memberKeyHint: "
|
|
38
|
+
hubId: "Hub ID", memberKey: "成員金鑰指紋", memberKeyHint: "有人用配對碼把 Fleet 連接到這個 Hub 時,會比對這組指紋。",
|
|
39
39
|
issuerKey: "簽發金鑰", version: "AgEnD 版本", unknown: "不明",
|
|
40
40
|
install: "安裝方式", install_dedicated: "專用:這台電腦只執行 Hub", "install_same-user-pilot": "與 Fleet 共用同一個使用者",
|
|
41
41
|
installHint: "在設定 Hub 時選定。",
|
package/dist/ui/hub-welcome.js
CHANGED
|
@@ -11,6 +11,8 @@ import { hubClient, hubName } from "./hub-client.js";
|
|
|
11
11
|
import { hg } from "./hub-group-strings.js";
|
|
12
12
|
import { hr } from "./hub-read-strings.js";
|
|
13
13
|
import { OwnedFleetRevoke, QuickPairingGuide } from "./hub-quick-pairing.js";
|
|
14
|
+
import { joinSentence, otherWaysLabel } from "./hub-join-steps.js";
|
|
15
|
+
import { CompanyJoinAdminCard } from "./hub-company-join.js";
|
|
14
16
|
|
|
15
17
|
const FLEET_STATUS = { active: "fleetActive", suspended: "fleetPaused", revoked: "fleetRevoked", unknown: "fleetUnknown" };
|
|
16
18
|
|
|
@@ -26,7 +28,7 @@ export function reasonText(entry, fallback) {
|
|
|
26
28
|
* `onChats` opens the chat list (the caller's own navigation). `askable` is how many agents are shared with this person
|
|
27
29
|
* (the catalog's own count), so a new owner with nothing shared reads "No agents have been shared with you yet".
|
|
28
30
|
*/
|
|
29
|
-
export function HubWelcome({ name, quick = false, onChats = () => navigate("/ui/hub?chats=1") }) {
|
|
31
|
+
export function HubWelcome({ name, quick = false, onChats = () => navigate("/ui/hub?chats=1"), admin = false, features = [] }) {
|
|
30
32
|
const c = hubClient();
|
|
31
33
|
const [w, setW] = useState(null), [askable, setAskable] = useState(null), [error, setError] = useState(null);
|
|
32
34
|
const live = useRef(true), generation = useRef(0), retry = useRef(null);
|
|
@@ -57,6 +59,21 @@ export function HubWelcome({ name, quick = false, onChats = () => navigate("/ui/
|
|
|
57
59
|
live.current = false; generation.current++; clearTimeout(retry.current);
|
|
58
60
|
}; }, []);
|
|
59
61
|
const refresh = async () => { const r = await c.welcome(); if (live.current && r.ok) setW(r); };
|
|
62
|
+
// Hub UX U2 (spec 1.2): an administrator, while no Fleet is connected to this Hub, sees 「讓同仁加入」 here — never the
|
|
63
|
+
// "your Hub admin pairs fleets for you" line. An older panel passes no `admin`: the person view, as before.
|
|
64
|
+
const companyJoin = Array.isArray(features) && features.includes("company-join-v1");
|
|
65
|
+
const [hubEmpty, setHubEmpty] = useState(false);
|
|
66
|
+
// #3698 r1 (Fable): the session's company-join-v1 says joining is composed, not that it is switched on. The sentence follows the
|
|
67
|
+
// switch as a Fleet sees it — the public metadata's features — and until that says on (or on an older client), the earlier line.
|
|
68
|
+
const [joinOn, setJoinOn] = useState(false);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (!companyJoin || typeof c.joinMetadata !== "function") return;
|
|
71
|
+
c.joinMetadata().then((r) => { if (live.current) setJoinOn(!!r && r.ok === true && Array.isArray(r.features) && r.features.includes("company-join-v1")); }, () => {});
|
|
72
|
+
}, [companyJoin]);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (!admin || !companyJoin || typeof c.adminOverview !== "function") return;
|
|
75
|
+
c.adminOverview().then((r) => { if (live.current && r && r.ok) setHubEmpty(!(r.fleets || []).some((f) => f.status === "active")); }, () => {});
|
|
76
|
+
}, [admin, companyJoin]);
|
|
60
77
|
// The chats' panel header already names the page ("Chats"): the welcome greets in its lead, not with a second title
|
|
61
78
|
// stacked under the first (Argon #7). The Hub's name stays beside the greeting.
|
|
62
79
|
const head = html`<p class="s-page-lead hub-page-lead hub-welcome-lead"><strong>${hg("welcomeTitle", name || "")}</strong>${hubName() ? html` <span class="s-scope">${hubName()}</span>` : null}<br />${hg("welcomeLead")}</p>`;
|
|
@@ -90,13 +107,17 @@ export function HubWelcome({ name, quick = false, onChats = () => navigate("/ui/
|
|
|
90
107
|
${connectOk && max > 0 ? html`<p class="note" data-welcome="fleets">${hg("connectFleets", used, max)}</p>` : null}
|
|
91
108
|
${fleets.length ? html`<ul class="hub-welcome-fleets">${fleets.map((f) => html`<li key=${f.id}><span class="hub-fp-full">${f.label || f.id}</span> <span class=${`tag${f.status === "active" ? " ok" : f.status === "suspended" || f.status === "unknown" ? " warn" : ""}`} data-fleet-status=${f.status}>${hg(FLEET_STATUS[f.status] || "fleetUnknown")}</span>
|
|
92
109
|
${quickOn ? html`<${OwnedFleetRevoke} fleet=${f} onRevoked=${load} />` : null}</li>`)}</ul>` : null}
|
|
93
|
-
${legacy ? html`<p class="note">${hg("
|
|
94
|
-
: !connectOk ? html`<p class="note">${chat.state === "allow" && connect.reason === "no-group" ? hg("connectNotIncluded") : reasonText(connect, "contactAdmin")}</p>`
|
|
110
|
+
${!legacy && !connectOk ? html`<p class="note">${chat.state === "allow" && connect.reason === "no-group" ? hg("connectNotIncluded") : reasonText(connect, "contactAdmin")}</p>`
|
|
95
111
|
: atLimit ? html`<p class="note" data-welcome="limit">${hg("connectLimit")}</p>`
|
|
96
|
-
:
|
|
97
|
-
|
|
112
|
+
// Spec 1.2: the primary text is step 3's sentence (company join on this Hub); without it, the pairing-code line as before —
|
|
113
|
+
// never to an administrator.
|
|
114
|
+
: companyJoin && joinOn && joinSentence(location.origin) ? html`<p class="note hub-join-sentence" data-welcome="sentence">${joinSentence(location.origin)}</p>`
|
|
115
|
+
: !admin && (legacy || !quickOn) ? html`<p class="note">${hg("connectManual")}</p>` : null}
|
|
116
|
+
${quickOn ? html`<details class="s-ui-disclosure hub-welcome-other"><summary>${otherWaysLabel()}</summary><div class="s-disclosure-body">
|
|
117
|
+
<${QuickPairingGuide} allowed=${connectOk && !atLimit} publishAllowed=${w.publish?.state === "allow"} onConnected=${refresh} /></div></details>` : null}
|
|
98
118
|
</section>
|
|
99
119
|
</div>
|
|
100
120
|
${!legacy && w.publish && w.publish.state !== "allow" && connectOk ? html`<p class="note" data-welcome="publish">${hg("publishNot")}</p>` : null}
|
|
121
|
+
${admin && companyJoin && hubEmpty ? html`<div class="hub-welcome-admin"><${CompanyJoinAdminCard} entry=${true} groups=${true} /></div>` : null}
|
|
101
122
|
</div>`;
|
|
102
123
|
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
// #3727 (M-2973): mark up a chat image and quote it to the agent. The image viewer's 「標註」 opens this editor in the
|
|
2
|
+
// viewer's own dialog: the picture on a canvas, and on top of it pen strokes, boxes, arrows and text in a few colours,
|
|
3
|
+
// with undo, redo and clear. 「引用給 Agent」 hands back the marked-up picture as a NEW PNG file (the original file is
|
|
4
|
+
// only read, never changed); the chat puts it in a composer as an attachment with a reply to the original message.
|
|
5
|
+
//
|
|
6
|
+
// Browser-only: the picture is the chat's own same-origin file (/ui/file/<hex>), drawn and encoded here — no server
|
|
7
|
+
// call, no other origin. No style attribute (#1300): classes only; the stylesheet is linked by this module (an older
|
|
8
|
+
// app.css lacks it). Pointer events, so a mouse, a pen and a finger draw the same way.
|
|
9
|
+
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
10
|
+
import { register, t } from "/assets/app-i18n.js";
|
|
11
|
+
import { Icon } from "/assets/ui-icons.js";
|
|
12
|
+
|
|
13
|
+
export const annotateV1 = true;
|
|
14
|
+
register("annotate", {
|
|
15
|
+
en: {
|
|
16
|
+
title: "Annotate: {0}", titleNoName: "Annotate image", tools: "Tools", colours: "Colour",
|
|
17
|
+
pen: "Pen (P)", box: "Box (B)", arrow: "Arrow (A)", text: "Text (T)", undo: "Undo (Ctrl+Z)", redo: "Redo (Ctrl+Shift+Z)", clear: "Clear",
|
|
18
|
+
red: "Red", yellow: "Yellow", blue: "Blue", white: "White",
|
|
19
|
+
textField: "Text", textShort: "Type, then Enter", textHint: "Click the picture where the text goes, type it here, then press Enter.", textAdd: "Add",
|
|
20
|
+
close: "Close without sending", loading: "Loading the picture…",
|
|
21
|
+
failedLoad: "The picture could not be loaded for annotating.", failedSave: "The annotated picture could not be made.",
|
|
22
|
+
canvas: "Picture to annotate. Choose a tool, then draw on it.",
|
|
23
|
+
},
|
|
24
|
+
"zh-TW": {
|
|
25
|
+
title: "標註:{0}", titleNoName: "標註圖片", tools: "工具", colours: "顏色",
|
|
26
|
+
pen: "畫筆(P)", box: "方框(B)", arrow: "箭頭(A)", text: "文字(T)", undo: "復原(Ctrl+Z)", redo: "重做(Ctrl+Shift+Z)", clear: "清除",
|
|
27
|
+
red: "紅", yellow: "黃", blue: "藍", white: "白",
|
|
28
|
+
textField: "文字", textShort: "輸入後按 Enter", textHint: "先點圖片上要放文字的地方,在這裡輸入,再按 Enter。", textAdd: "加入",
|
|
29
|
+
close: "關閉,不送出", loading: "正在載入圖片…",
|
|
30
|
+
failedLoad: "無法載入這張圖片來標註。", failedSave: "無法產生標註後的圖片。",
|
|
31
|
+
canvas: "要標註的圖片。選一個工具,然後在上面畫。",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const COLOURS = [["red", "#e5484d"], ["yellow", "#ffc53d"], ["blue", "#3e8eff"], ["white", "#ffffff"]];
|
|
36
|
+
export const TOOLS = ["pen", "box", "arrow", "text"];
|
|
37
|
+
const KEYS = { p: "pen", b: "box", a: "arrow", t: "text" };
|
|
38
|
+
/** The longest side a marked-up picture is drawn at (a larger original is scaled down; a smaller one is kept). */
|
|
39
|
+
export const MAX_SIDE = 2560;
|
|
40
|
+
|
|
41
|
+
/** Canvas size for a picture of w × h: its own size, scaled down to MAX_SIDE on its longest side. */
|
|
42
|
+
export function canvasSize(w, h) {
|
|
43
|
+
const k = Math.min(1, MAX_SIDE / Math.max(1, w, h));
|
|
44
|
+
return { w: Math.max(1, Math.round(w * k)), h: Math.max(1, Math.round(h * k)) };
|
|
45
|
+
}
|
|
46
|
+
/** Stroke width for a canvas of w × h: readable on a phone screenshot and on a wide one. */
|
|
47
|
+
export const strokeWidth = (w, h) => Math.max(3, Math.round(Math.max(w, h) / 320));
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The marks as a history: `shapes` in drawing order (a "clear" is one too, so it can be undone) and `redo`, what undo
|
|
51
|
+
* took back. Pure, so the order of undo / redo / clear is tested without a canvas.
|
|
52
|
+
*/
|
|
53
|
+
export function history() {
|
|
54
|
+
let shapes = [], redo = [];
|
|
55
|
+
return {
|
|
56
|
+
get shapes() { return shapes; },
|
|
57
|
+
/** What is drawn: everything after the last clear. */
|
|
58
|
+
visible() { const at = shapes.map(s => s.tool).lastIndexOf("clear"); return shapes.slice(at + 1); },
|
|
59
|
+
add(shape) { shapes = [...shapes, shape]; redo = []; },
|
|
60
|
+
clear() { if (this.visible().length) this.add({ tool: "clear" }); },
|
|
61
|
+
undo() { if (!shapes.length) return false; redo = [...redo, shapes[shapes.length - 1]]; shapes = shapes.slice(0, -1); return true; },
|
|
62
|
+
redo() { if (!redo.length) return false; shapes = [...shapes, redo[redo.length - 1]]; redo = redo.slice(0, -1); return true; },
|
|
63
|
+
get canUndo() { return shapes.length > 0; },
|
|
64
|
+
get canRedo() { return redo.length > 0; },
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Draw one mark. `lw`: the stroke width for this canvas. */
|
|
69
|
+
export function drawShape(ctx, s, base) {
|
|
70
|
+
const lw = s.lw ?? base; // a mark keeps the width it was drawn with
|
|
71
|
+
ctx.save();
|
|
72
|
+
ctx.lineCap = "round"; ctx.lineJoin = "round"; ctx.lineWidth = lw; ctx.strokeStyle = s.colour; ctx.fillStyle = s.colour;
|
|
73
|
+
if (s.tool === "pen" && s.points.length) {
|
|
74
|
+
ctx.beginPath(); ctx.moveTo(s.points[0][0], s.points[0][1]);
|
|
75
|
+
for (const [x, y] of s.points.slice(1)) ctx.lineTo(x, y);
|
|
76
|
+
if (s.points.length === 1) ctx.lineTo(s.points[0][0] + 0.01, s.points[0][1]); // a dot
|
|
77
|
+
ctx.stroke();
|
|
78
|
+
} else if (s.tool === "box") {
|
|
79
|
+
ctx.strokeRect(Math.min(s.x0, s.x1), Math.min(s.y0, s.y1), Math.abs(s.x1 - s.x0), Math.abs(s.y1 - s.y0));
|
|
80
|
+
} else if (s.tool === "arrow") {
|
|
81
|
+
const angle = Math.atan2(s.y1 - s.y0, s.x1 - s.x0), head = lw * 4;
|
|
82
|
+
ctx.beginPath(); ctx.moveTo(s.x0, s.y0); ctx.lineTo(s.x1, s.y1); ctx.stroke();
|
|
83
|
+
ctx.beginPath(); ctx.moveTo(s.x1, s.y1);
|
|
84
|
+
ctx.lineTo(s.x1 - head * Math.cos(angle - Math.PI / 6), s.y1 - head * Math.sin(angle - Math.PI / 6));
|
|
85
|
+
ctx.lineTo(s.x1 - head * Math.cos(angle + Math.PI / 6), s.y1 - head * Math.sin(angle + Math.PI / 6));
|
|
86
|
+
ctx.closePath(); ctx.fill();
|
|
87
|
+
} else if (s.tool === "text" && s.text) {
|
|
88
|
+
ctx.font = `bold ${s.size ?? lw * 6}px system-ui, sans-serif`; ctx.textBaseline = "top";
|
|
89
|
+
// A dark outline, so a light colour reads on a light picture and the reverse.
|
|
90
|
+
ctx.lineWidth = Math.max(2, lw * 0.8); ctx.strokeStyle = s.colour === "#ffffff" ? "#000000" : "rgba(0,0,0,0.65)";
|
|
91
|
+
ctx.strokeText(s.text, s.x, s.y); ctx.fillText(s.text, s.x, s.y);
|
|
92
|
+
}
|
|
93
|
+
ctx.restore();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** The marked-up picture's file name: the original's, before its extension, plus "-annotated.png". */
|
|
97
|
+
export function annotatedName(name) {
|
|
98
|
+
const base = String(name || "image").replace(/\.[A-Za-z0-9]{1,5}$/, "").replace(/[\\/:*?"<>|\x00-\x1f]/g, "_").slice(0, 80) || "image";
|
|
99
|
+
return `${base}-annotated.png`;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Prism on #3735: the editor's colours are tokens (tokens.css). A tab whose cached tokens.css predates them would draw
|
|
104
|
+
* transparent swatches and lose the selected tool, so the editor's root sets any of them that resolve to nothing —
|
|
105
|
+
* CSSOM on its own element (#1300), the same values as tokens.css; a current tokens.css wins (nothing is set).
|
|
106
|
+
*/
|
|
107
|
+
export const MEDIA_TOKENS = [["--media-ink", "#ffffff"], ["--media-bar", "rgba(0, 0, 0, 0.75)"], ["--media-panel", "rgba(0, 0, 0, 0.6)"],
|
|
108
|
+
["--media-btn", "rgba(255, 255, 255, 0.12)"], ["--media-btn-on", "rgba(255, 255, 255, 0.32)"], ["--media-line", "rgba(255, 255, 255, 0.35)"],
|
|
109
|
+
...COLOURS.map(([k, v]) => [`--mark-${k}`, v])];
|
|
110
|
+
export function fillMissingTokens(el) {
|
|
111
|
+
if (!el || typeof getComputedStyle !== "function") return;
|
|
112
|
+
const computed = getComputedStyle(el);
|
|
113
|
+
for (const [name, value] of MEDIA_TOKENS) if (!computed.getPropertyValue(name).trim()) el.style.setProperty(name, value);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** The stylesheet, once per document. */
|
|
117
|
+
export function linkAnnotateCss(doc = typeof document !== "undefined" ? document : null) {
|
|
118
|
+
if (!doc || !doc.head || doc.querySelector('link[data-annotate-css="1"]')) return;
|
|
119
|
+
const link = doc.createElement("link");
|
|
120
|
+
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/image-annotate.css"); link.setAttribute("data-annotate-css", "1");
|
|
121
|
+
doc.head.appendChild(link);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The editor, inside the viewer's dialog. `src`, `name`: the picture. `targets`: [{ key, label, quote(file) }] — the first
|
|
126
|
+
* is this chat's composer, a second the other pane's; quote() answers true when the file went in. `onClose`: ✕ / Esc
|
|
127
|
+
* (the dialog's own cancel), and after a quote.
|
|
128
|
+
*/
|
|
129
|
+
export function AnnotateEditor({ src, name, targets = [], onClose, onError }) {
|
|
130
|
+
const canvas = useRef(null), base = useRef(null), hist = useRef(history()), drag = useRef(null), textField = useRef(null);
|
|
131
|
+
const [size, setSize] = useState(null); // { w, h, lw } once the picture has loaded
|
|
132
|
+
const [failed, setFailed] = useState(false);
|
|
133
|
+
const [tool, setTool] = useState("pen");
|
|
134
|
+
const [colour, setColour] = useState(COLOURS[0][1]);
|
|
135
|
+
const [textAt, setTextAt] = useState(null); // where a text mark goes: [x, y] on the canvas
|
|
136
|
+
const [text, setText] = useState("");
|
|
137
|
+
const [, setTick] = useState(0);
|
|
138
|
+
const [busy, setBusy] = useState(false);
|
|
139
|
+
const refresh = () => setTick(n => n + 1);
|
|
140
|
+
// Prism on #3735: an export (toBlob is asynchronous) belongs to the live editor. Closing it, or the editor going
|
|
141
|
+
// away, retires one in flight: its file is never handed to a composer afterwards.
|
|
142
|
+
const live = useRef({ alive: true, op: 0 });
|
|
143
|
+
const close = () => { live.current.op++; onClose?.(); };
|
|
144
|
+
useEffect(() => () => { live.current.alive = false; live.current.op++; }, []);
|
|
145
|
+
useEffect(() => { linkAnnotateCss(); }, []);
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
const img = new Image();
|
|
148
|
+
img.decoding = "async";
|
|
149
|
+
img.onload = () => {
|
|
150
|
+
const { w, h } = canvasSize(img.naturalWidth, img.naturalHeight);
|
|
151
|
+
base.current = img; setSize({ w, h, lw: strokeWidth(w, h) });
|
|
152
|
+
};
|
|
153
|
+
img.onerror = () => setFailed(true);
|
|
154
|
+
img.src = src; // the chat's own file: same origin, so the canvas can be read back
|
|
155
|
+
return () => { img.onload = null; img.onerror = null; };
|
|
156
|
+
}, [src]);
|
|
157
|
+
const paint = (extra, forExport = false) => {
|
|
158
|
+
const c = canvas.current, s = size;
|
|
159
|
+
if (!c || !s || !base.current) return;
|
|
160
|
+
const ctx = c.getContext("2d");
|
|
161
|
+
ctx.clearRect(0, 0, s.w, s.h);
|
|
162
|
+
ctx.drawImage(base.current, 0, 0, s.w, s.h);
|
|
163
|
+
for (const shape of hist.current.visible()) drawShape(ctx, shape, s.lw);
|
|
164
|
+
if (extra) drawShape(ctx, extra, s.lw);
|
|
165
|
+
if (textAt && !forExport) { // where the text will go: a small cross (never in the file)
|
|
166
|
+
ctx.save(); ctx.strokeStyle = colour; ctx.lineWidth = Math.max(2, s.lw / 2);
|
|
167
|
+
ctx.beginPath(); ctx.moveTo(textAt[0] - s.lw * 2, textAt[1]); ctx.lineTo(textAt[0] + s.lw * 2, textAt[1]);
|
|
168
|
+
ctx.moveTo(textAt[0], textAt[1] - s.lw * 2); ctx.lineTo(textAt[0], textAt[1] + s.lw * 2); ctx.stroke(); ctx.restore();
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
useEffect(() => { paint(); });
|
|
172
|
+
/** Canvas pixels per screen pixel now (a phone shows a big picture small): a mark is at least 3 screen px wide, and
|
|
173
|
+
* text at least 20 screen px tall, whatever the picture's own size. */
|
|
174
|
+
const perScreenPx = () => { const c = canvas.current, r = c?.getBoundingClientRect(); return c && r && r.width > 0 ? c.width / r.width : 1; };
|
|
175
|
+
const markWidth = () => Math.max(size.lw, Math.round(3 * perScreenPx()));
|
|
176
|
+
const textSize = () => Math.max(size.lw * 6, Math.round(20 * perScreenPx()));
|
|
177
|
+
const point = (e) => {
|
|
178
|
+
const c = canvas.current, r = c.getBoundingClientRect();
|
|
179
|
+
return [((e.clientX - r.left) / Math.max(1, r.width)) * c.width, ((e.clientY - r.top) / Math.max(1, r.height)) * c.height];
|
|
180
|
+
};
|
|
181
|
+
const onDown = (e) => {
|
|
182
|
+
if (!size || (e.button ?? 0) !== 0) return;
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
const [x, y] = point(e);
|
|
185
|
+
if (tool === "text") { setTextAt([x, y]); textField.current?.focus(); return; }
|
|
186
|
+
canvas.current.setPointerCapture?.(e.pointerId);
|
|
187
|
+
const lw = markWidth();
|
|
188
|
+
drag.current = tool === "pen" ? { tool, colour, lw, points: [[x, y]] } : { tool, colour, lw, x0: x, y0: y, x1: x, y1: y };
|
|
189
|
+
paint(drag.current);
|
|
190
|
+
};
|
|
191
|
+
const onMove = (e) => {
|
|
192
|
+
const d = drag.current;
|
|
193
|
+
if (!d) return;
|
|
194
|
+
e.preventDefault();
|
|
195
|
+
const [x, y] = point(e);
|
|
196
|
+
if (d.tool === "pen") d.points.push([x, y]); else { d.x1 = x; d.y1 = y; }
|
|
197
|
+
paint(d);
|
|
198
|
+
};
|
|
199
|
+
const onUp = () => {
|
|
200
|
+
const d = drag.current;
|
|
201
|
+
drag.current = null;
|
|
202
|
+
if (!d) return;
|
|
203
|
+
const tiny = d.tool !== "pen" && Math.hypot(d.x1 - d.x0, d.y1 - d.y0) < 3;
|
|
204
|
+
if (!tiny) hist.current.add(d);
|
|
205
|
+
refresh();
|
|
206
|
+
};
|
|
207
|
+
const addText = () => {
|
|
208
|
+
const value = text.trim();
|
|
209
|
+
if (!value || !textAt) return;
|
|
210
|
+
hist.current.add({ tool: "text", colour, lw: markWidth(), size: textSize(), x: textAt[0], y: textAt[1], text: value.slice(0, 200) });
|
|
211
|
+
setText(""); setTextAt(null);
|
|
212
|
+
};
|
|
213
|
+
const undo = () => { if (hist.current.undo()) refresh(); };
|
|
214
|
+
const redo = () => { if (hist.current.redo()) refresh(); };
|
|
215
|
+
const clear = () => { hist.current.clear(); setTextAt(null); refresh(); };
|
|
216
|
+
const quote = async (target) => {
|
|
217
|
+
const c = canvas.current;
|
|
218
|
+
if (!c || busy) return;
|
|
219
|
+
const op = ++live.current.op, current = () => live.current.alive && live.current.op === op;
|
|
220
|
+
setBusy(true);
|
|
221
|
+
try {
|
|
222
|
+
paint(null, true); // without the text cross
|
|
223
|
+
const blob = await new Promise((resolve) => c.toBlob(resolve, "image/png"));
|
|
224
|
+
if (!current()) return; // closed or gone while encoding: nothing is added anywhere
|
|
225
|
+
if (!blob) throw new Error("no image");
|
|
226
|
+
const file = new File([blob], annotatedName(name), { type: "image/png" });
|
|
227
|
+
// The editor's own liveness travels with the file: a target that waits (the other pane's Chat mounting) checks it
|
|
228
|
+
// at its commit, so closing the editor meanwhile cancels the quote and the attachment there (Prism on #3735 r2).
|
|
229
|
+
if (await target.quote(file, current) && current()) onClose?.();
|
|
230
|
+
} catch { if (current()) onError?.(t("annotate.failedSave")); }
|
|
231
|
+
finally { if (live.current.alive) setBusy(false); }
|
|
232
|
+
};
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
const onKey = (e) => {
|
|
235
|
+
const typing = e.target && (e.target.tagName === "INPUT" || e.target.tagName === "TEXTAREA");
|
|
236
|
+
const mod = e.ctrlKey || e.metaKey;
|
|
237
|
+
if (mod && !e.altKey && (e.key === "z" || e.key === "Z")) { if (typing && !e.shiftKey && text) return; e.preventDefault(); if (e.shiftKey) redo(); else undo(); return; }
|
|
238
|
+
if (mod && !e.altKey && (e.key === "y" || e.key === "Y")) { e.preventDefault(); redo(); return; }
|
|
239
|
+
if (typing || mod || e.altKey) return;
|
|
240
|
+
const k = KEYS[e.key.toLowerCase()];
|
|
241
|
+
if (k) { e.preventDefault(); setTool(k); if (k !== "text") setTextAt(null); return; }
|
|
242
|
+
const n = Number(e.key);
|
|
243
|
+
if (n >= 1 && n <= COLOURS.length) { e.preventDefault(); setColour(COLOURS[n - 1][1]); }
|
|
244
|
+
};
|
|
245
|
+
document.addEventListener("keydown", onKey);
|
|
246
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
247
|
+
});
|
|
248
|
+
const label = name ? t("annotate.title", name) : t("annotate.titleNoName");
|
|
249
|
+
return html`<div class="an" data-trust="annotate" role="group" aria-label=${label} ref=${fillMissingTokens}>
|
|
250
|
+
<div class="an-bar">
|
|
251
|
+
<span class="an-name" title=${name}>${label}</span>
|
|
252
|
+
<span class="an-tools" role="radiogroup" aria-label=${t("annotate.tools")}>
|
|
253
|
+
${TOOLS.map((k) => html`<button type="button" role="radio" aria-checked=${tool === k ? "true" : "false"} class=${`btn btn-sm an-tool an-tool-${k}${tool === k ? " on" : ""}`}
|
|
254
|
+
title=${t(`annotate.${k}`)} aria-label=${t(`annotate.${k}`)} onClick=${() => { setTool(k); if (k !== "text") setTextAt(null); }}><span class="an-glyph" aria-hidden="true">${{ pen: "✎", box: "▭", arrow: "↗", text: "T" }[k]}</span></button>`)}
|
|
255
|
+
</span>
|
|
256
|
+
<span class="an-colours" role="radiogroup" aria-label=${t("annotate.colours")}>
|
|
257
|
+
${COLOURS.map(([k, v], i) => html`<button type="button" role="radio" aria-checked=${colour === v ? "true" : "false"} class=${`an-colour${colour === v ? " on" : ""}`}
|
|
258
|
+
title=${`${t(`annotate.${k}`)} (${i + 1})`} aria-label=${t(`annotate.${k}`)} onClick=${() => setColour(v)}><span class=${`an-dot an-colour-${k}`} aria-hidden="true"></span></button>`)}
|
|
259
|
+
</span>
|
|
260
|
+
<span class="an-history">
|
|
261
|
+
<button type="button" class="btn btn-sm an-undo" disabled=${!hist.current.canUndo} title=${t("annotate.undo")} aria-label=${t("annotate.undo")} onClick=${undo}>↶</button>
|
|
262
|
+
<button type="button" class="btn btn-sm an-redo" disabled=${!hist.current.canRedo} title=${t("annotate.redo")} aria-label=${t("annotate.redo")} onClick=${redo}>↷</button>
|
|
263
|
+
<button type="button" class="btn btn-sm an-clear" disabled=${!hist.current.visible().length} onClick=${clear}>${t("annotate.clear")}</button>
|
|
264
|
+
</span>
|
|
265
|
+
<button type="button" class="icon-btn an-close" title=${t("annotate.close")} aria-label=${t("annotate.close")} onClick=${close}><${Icon} name="close" /></button>
|
|
266
|
+
</div>
|
|
267
|
+
${tool === "text" ? html`<form class="an-text" onSubmit=${(e) => { e.preventDefault(); addText(); }}>
|
|
268
|
+
<label class="an-text-label"><span>${t("annotate.textField")}</span>
|
|
269
|
+
<input ref=${textField} type="text" maxlength="200" value=${text} placeholder=${t("annotate.textShort")} title=${t("annotate.textHint")} onInput=${(e) => setText(e.target.value)} /></label>
|
|
270
|
+
<button type="submit" class="btn btn-sm" disabled=${!text.trim() || !textAt}>${t("annotate.textAdd")}</button>
|
|
271
|
+
</form>` : null}
|
|
272
|
+
<div class="an-stage">
|
|
273
|
+
${failed ? html`<p class="an-note" role="alert">${t("annotate.failedLoad")}</p>`
|
|
274
|
+
: size ? html`<canvas ref=${canvas} class=${`an-canvas an-cursor-${tool}`} width=${size.w} height=${size.h} role="img" aria-label=${t("annotate.canvas")}
|
|
275
|
+
onPointerDown=${onDown} onPointerMove=${onMove} onPointerUp=${onUp} onPointerCancel=${onUp} />`
|
|
276
|
+
: html`<p class="an-note" role="status">${t("annotate.loading")}</p>`}
|
|
277
|
+
</div>
|
|
278
|
+
<div class="an-actions">
|
|
279
|
+
${targets.map((target, i) => html`<button type="button" class=${`btn ${i === 0 ? "btn-primary" : ""} an-quote`} disabled=${!size || busy}
|
|
280
|
+
data-target=${target.key} onClick=${() => quote(target)}>${target.label}</button>`)}
|
|
281
|
+
</div>
|
|
282
|
+
</div>`;
|
|
283
|
+
}
|