@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
|
@@ -252,13 +252,13 @@ export function useAgentSettings({ name, lease, enabled, navKey }) {
|
|
|
252
252
|
// ── The nav ──
|
|
253
253
|
|
|
254
254
|
/** The categories in the shared Settings `.s-nav`: "Status" (Overview) and "Settings" (the rest), an icon in front of every item. */
|
|
255
|
-
export function AgentCategoryNav({ name, kind, cat, dirty }) {
|
|
255
|
+
export function AgentCategoryNav({ name, kind, cat, dirty, children }) {
|
|
256
256
|
const pane = paneContext.usePane?.();
|
|
257
257
|
const id = (key) => pane ? `pane-${pane.id}-${key}` : key;
|
|
258
258
|
const cats = categoriesOf(kind);
|
|
259
259
|
const item = (id) => html`<a key=${id} href=${categoryPath(name, id)} class=${`seg-item${cat === id ? " active" : ""}`} aria-current=${cat === id ? "page" : undefined} title=${categoryLabel(kind, id)}>
|
|
260
260
|
<${Icon} name=${CATEGORY_ICONS[id]} size=${16} /><span>${categoryLabel(kind, id)}</span>${dirty && dirty.has(id) ? html`<span class="count" role="img" aria-label=${pt("unsavedDot")} title=${pt("unsavedDot")}>●</span>` : null}</a>`;
|
|
261
|
-
return html`<nav data-trust="panel-navigation" class="seg s-nav" aria-label=${pt("title")}
|
|
261
|
+
return html`<nav data-trust="panel-navigation" class="seg s-nav" aria-label=${pt("title")}>${children}<div class="s-nav-groups">
|
|
262
262
|
<div class="s-nav-group" role="group" aria-labelledby=${id("ap-grp-status")}><span class="s-nav-head" id=${id("ap-grp-status")}>${pt("groupStatus")}</span>${item("overview")}</div>
|
|
263
263
|
<div class="s-nav-group" role="group" aria-labelledby=${id("ap-grp-settings")}><span class="s-nav-head" id=${id("ap-grp-settings")}>${pt("groupSettings")}</span>${cats.slice(1).map(item)}</div></div></nav>`;
|
|
264
264
|
}
|
|
@@ -44,7 +44,7 @@ register("agentPage", {
|
|
|
44
44
|
tip_lightweight: "Loads fewer tools and less guidance to save tokens; fits an agent that only does simple work.",
|
|
45
45
|
tip_channel: "Which Discord or Telegram connection's channel this agent receives and sends messages in. Unbound means web chat only.",
|
|
46
46
|
tip_general: "Make this agent the General: it receives the bound connection's general messages and hands work to other agents.",
|
|
47
|
-
tip_toolProgress: "Whether progress
|
|
47
|
+
tip_toolProgress: "Whether progress shows while the AI uses tools — in the channel's progress message and, for a signed-in admin, in the web chat's activity block above each reply: off none, standard a summary of each step, verbose adds the commands and arguments.",
|
|
48
48
|
tip_visibility: "How much of this agent's messages with other agents shows in the channel: full all of it, summary one line, hidden nothing. They are always delivered.",
|
|
49
49
|
tip_emojis: "Only affects Discord and Telegram channels; the web chat never posts emoji.",
|
|
50
50
|
emojisWhat: "What this is: after this agent receives a message you sent in Discord or Telegram, AgEnD puts an emoji on that message to report progress (👀 received, ⏳ queued, ✅ delivered, ❌ failed, plus a prefix on progress messages and badges for photos and files). The web chat does not do this. The AI is also told to avoid these symbols, so changing them restarts the agent. Empty uses the platform's default.",
|
|
@@ -111,7 +111,7 @@ register("agentPage", {
|
|
|
111
111
|
tip_lightweight: "載入較少的工具與說明,省 token,適合只做單純工作的 Agent。",
|
|
112
112
|
tip_channel: "這個 Agent 在哪個 Discord/Telegram 連線的頻道裡收發訊息。「未綁定」表示只能在網頁聊天。",
|
|
113
113
|
tip_general: "讓這個 Agent 當 General——負責接收綁定連線的一般訊息並派工給其他 Agent。",
|
|
114
|
-
tip_toolProgress: "AI
|
|
114
|
+
tip_toolProgress: "AI 用工具時是否顯示進度——頻道裡的進度訊息,以及登入的 admin 在網頁聊天每則回覆上方的活動區塊:off 不顯示、standard 每一步的摘要、verbose 再加上指令與參數。",
|
|
115
115
|
tip_visibility: "此 Agent 與其他 Agent 往來的訊息,在頻道裡顯示多少:full 全部、summary 摘要、hidden 隱藏。訊息一律會送達。",
|
|
116
116
|
tip_emojis: "只影響 Discord 與 Telegram 頻道;網頁聊天室不會貼 emoji。",
|
|
117
117
|
emojisWhat: "這是什麼:Agent 收到你在 Discord/Telegram 發的訊息後,AgEnD 會在那則訊息上貼 emoji 回報進度(👀 收到、⏳ 排隊、✅ 已送達、❌ 失敗,另有進度訊息的前綴與照片/附件章)。網頁聊天室不會貼。AI 也會被告知避開這些符號,所以改了要重啟 Agent。留空 = 用平台預設。",
|
|
@@ -16,6 +16,10 @@ let installed = false, reading = null, again = false;
|
|
|
16
16
|
// that failed (the network, a 5xx, an answer that is not a list) leaves `loaded` behind, so the next status frame (the
|
|
17
17
|
// same revision included) or the bounded retry reads again; never a revision taken as read before a read succeeded.
|
|
18
18
|
let observed = null, loaded = null, retries = 0, retryTimer = null;
|
|
19
|
+
// M-2505 (#1580's rule): a page that leaves (pagehide) keeps no timer behind it — a retry waiting then (or one a read
|
|
20
|
+
// still out would start) is held, not run, and one restored from the back-forward cache (pageshow, persisted) reads at
|
|
21
|
+
// once. Before this, the retry outlived the page: a test's fixture had removed fetch when it fired (alpha CI 42210637320).
|
|
22
|
+
let away = false, heldRetry = false, listening = false;
|
|
19
23
|
const RETRY_MS = 5000, RETRY_MAX = 5;
|
|
20
24
|
|
|
21
25
|
/** Read the list again (one read at a time; a change meanwhile reads once more). Resolves true when it was read. */
|
|
@@ -34,7 +38,10 @@ export function refreshProposals() {
|
|
|
34
38
|
.catch(() => {
|
|
35
39
|
// Not read: try again a few times on its own (a page whose stream sends no more status frames), and at any status
|
|
36
40
|
// frame meanwhile (its revision is still ahead of `loaded`).
|
|
37
|
-
if (retries < RETRY_MAX && !retryTimer) {
|
|
41
|
+
if (retries < RETRY_MAX && !retryTimer) {
|
|
42
|
+
if (away) heldRetry = true;
|
|
43
|
+
else { retries++; retryTimer = setTimeout(() => { retryTimer = null; void refreshProposals(); }, RETRY_MS); }
|
|
44
|
+
}
|
|
38
45
|
return false;
|
|
39
46
|
})
|
|
40
47
|
.finally(() => {
|
|
@@ -55,6 +62,19 @@ export function refreshProposals() {
|
|
|
55
62
|
export function installProposals() {
|
|
56
63
|
if (installed) return;
|
|
57
64
|
installed = true;
|
|
65
|
+
const win = typeof window !== "undefined" ? window : null;
|
|
66
|
+
if (!listening && win && typeof win.addEventListener === "function") { // once per page (reset re-installs)
|
|
67
|
+
listening = true;
|
|
68
|
+
win.addEventListener("pagehide", () => {
|
|
69
|
+
away = true;
|
|
70
|
+
if (retryTimer) { clearTimeout(retryTimer); retryTimer = null; heldRetry = true; }
|
|
71
|
+
});
|
|
72
|
+
win.addEventListener("pageshow", (e) => {
|
|
73
|
+
if (!e || !e.persisted || !away) return;
|
|
74
|
+
away = false;
|
|
75
|
+
if (heldRetry) { heldRetry = false; void refreshProposals(); }
|
|
76
|
+
});
|
|
77
|
+
}
|
|
58
78
|
const on = appStore.get().streamOn;
|
|
59
79
|
if (typeof on === "function") {
|
|
60
80
|
on("agent_proposals", () => { void refreshProposals(); });
|
|
@@ -85,6 +105,6 @@ export async function decideProposal(id, decision) {
|
|
|
85
105
|
|
|
86
106
|
/** For tests: as on a fresh page. */
|
|
87
107
|
export function resetProposals() {
|
|
88
|
-
installed = false; reading = null; again = false; observed = null; loaded = null; retries = 0;
|
|
108
|
+
installed = false; reading = null; again = false; observed = null; loaded = null; retries = 0; away = false; heldRetry = false;
|
|
89
109
|
if (retryTimer) { clearTimeout(retryTimer); retryTimer = null; }
|
|
90
110
|
}
|
|
@@ -7,7 +7,7 @@ import {sectionPath} from "/assets/app-route.js";
|
|
|
7
7
|
import {Dialog} from "/assets/ui-dialog.js";
|
|
8
8
|
import {CliPicker,CliProductMark,cliLabel} from "./cli-picker.js";
|
|
9
9
|
import {RuntimePicker,tr} from "./agent-runtime.js";
|
|
10
|
-
import {ClaudeAccountSelect} from "./credential-profile-select.js";
|
|
10
|
+
import {ClaudeAccountSelect, accountCli} from "./credential-profile-select.js";
|
|
11
11
|
import {useRuntimeCatalog,runtimeCliChoices} from "./runtime-catalog.js";
|
|
12
12
|
import {useWindowsCliCatalog} from "./windows-cli-catalog.js";
|
|
13
13
|
import {useBackendRows} from "./settings-catalog.js";
|
|
@@ -51,7 +51,7 @@ export function AgentRuntimeChangeDialog({name,inst,onClose,onChanged,idPrefix="
|
|
|
51
51
|
const submit=async()=>{
|
|
52
52
|
if(claim.current||uncertain||!source||!f.fresh||!targetReady||(!allowedRead&&f.access==="read-only"))return;
|
|
53
53
|
claim.current=true;setBusy(true);setError("");
|
|
54
|
-
const body={requestId:crypto.randomUUID(),expectedRevision:source.revision,runtime:f.runtime,...(f.machineId?{machineId:f.machineId}:{}),backend:f.backend,model:f.model.trim(),directory:f.directory.trim(),sandbox:f.access,adapter:windows?f.adapter:"exec",startNewConversation:true,...(windows&&f.machineId&&f.backend
|
|
54
|
+
const body={requestId:crypto.randomUUID(),expectedRevision:source.revision,runtime:f.runtime,...(f.machineId?{machineId:f.machineId}:{}),backend:f.backend,model:f.model.trim(),directory:f.directory.trim(),sandbox:f.access,adapter:windows?f.adapter:"exec",startNewConversation:true,...(windows&&f.machineId&&accountCli(f.backend)&&f.credentialProfile?{credentialProfile:f.credentialProfile}:{})};
|
|
55
55
|
try{const response=await lease.fetch(`/ui/instances/${encodeURIComponent(name)}/runtime`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(body)}),value=await response.json();if(!lease.current())return;
|
|
56
56
|
if(!response.ok||value?.ok!==true)throw Error(value.error||text("failed"));onChanged?.();onClose();
|
|
57
57
|
}catch(e){if(lease.current()){setError(e.message);setUncertain(true);}}
|
|
@@ -60,7 +60,7 @@ export function AgentRuntimeChangeDialog({name,inst,onClose,onChanged,idPrefix="
|
|
|
60
60
|
const close=()=>{if(!claim.current)onClose();};
|
|
61
61
|
return html`<${Dialog} title=${text("title")} cls="agent-runtime-change-dialog" busy=${busy} onClose=${close} wide=${true} actions=${html`<button type="button" class="btn" disabled=${busy} onClick=${close}>${text("cancel")}</button>${step===2?html`<button type="button" class="btn" disabled=${busy||uncertain} onClick=${()=>setStep(1)}>${text("back")}</button>`:null}<button type="button" class="btn btn-primary" disabled=${busy||uncertain||!source||!targetReady||(step===2&&(!f.fresh||!allowedRead&&f.access==="read-only"))} onClick=${step===1?()=>setStep(2):submit}>${text(step===1?"next":"apply")}</button>`}>
|
|
62
62
|
<div class="form agent-runtime-change" aria-busy=${busy}><p>${text("lead")}</p>${!source&&!error?html`<${Skeleton} variant="rows" lines=${3} label=${text("loading")} />`:null}
|
|
63
|
-
${source&&step===1?html`<${RuntimePicker} value=${f.runtime} onChange=${runtime=>choose(runtime)} windowsEnabled=${windowsCli===true} machineId=${f.machineId} machines=${machines} onMachineChange=${id=>choose("windows",id)} onRefresh=${machinesState.refresh} loaded=${!!machinesState.data && !machinesState.error}/><div class="field"><label>${tr("backend")}</label><${CliPicker} value=${f.backend} choices=${choices} label=${tr("backend")} onChange=${backend=>setForm(old=>({...old,backend,model:"",credentialProfile:backend===
|
|
63
|
+
${source&&step===1?html`<${RuntimePicker} value=${f.runtime} onChange=${runtime=>choose(runtime)} windowsEnabled=${windowsCli===true} machineId=${f.machineId} machines=${machines} onMachineChange=${id=>choose("windows",id)} onRefresh=${machinesState.refresh} loaded=${!!machinesState.data && !machinesState.error}/><div class="field"><label>${tr("backend")}</label><${CliPicker} value=${f.backend} choices=${choices} label=${tr("backend")} onChange=${backend=>setForm(old=>({...old,backend,model:"",credentialProfile:backend===old.backend&&accountCli(backend)?old.credentialProfile:"",fresh:false}))}/></div>${removedBackendReplacement(f.backend)?html`<p class="note" role="status">${text("removed",f.backend,removedBackendReplacement(f.backend))}</p>`:null}${!choices.length?html`<p class="note">${text("noCli")}</p>`:null}`:null}
|
|
64
64
|
${source&&step===2?html`<h3>${text("configure")}</h3><p><strong>${machine?.name||(windows?tr("windows"):tr("wsl"))}</strong> · ${cliLabel(f.backend)}</p><label class="field"><span>${tr("directory")}</span><input value=${f.directory} disabled=${busy||uncertain} onInput=${event=>set("directory",event.target.value)}/></label><p class="note">${text("directoryHint")}</p><div class="field"><label for=${`${idPrefix}runtime-change-model`}>${t("settings.model")}</label><${ModelSelect} id=${`${idPrefix}runtime-change-model`} disabled=${busy||uncertain} value=${f.model} onChange=${value=>set("model",value)} backend=${f.backend} instance=${!windows&&source.runtime==="wsl"&&source.backend===f.backend?name:undefined} runtime=${f.runtime} machineId=${f.machineId} profile=${f.credentialProfile} inherit=${t("settings.modelCliDefault")}/></div>
|
|
65
65
|
${windows?html`<label class="field"><span>${tr("access")}</span><select value=${f.access} disabled=${busy||uncertain} onChange=${event=>set("access",event.target.value)}><option value="read-only" disabled=${!allowedRead}>${tr("read")}</option><option value="workspace-write">${tr("write")}</option></select></label>${!allowedRead?html`<p class="note" role="status">${tr("noReadOnly")}</p>`:null}<label class="field"><span>${tr("adapter")}</span><select value=${f.adapter} disabled=${busy||uncertain} onChange=${event=>set("adapter",event.target.value)}><option value="exec">${tr("adapterExec")}</option><option value="pane" disabled=${!["codex","claude-code"].includes(f.backend)}>${tr("adapterPane")}</option></select></label>${f.machineId?html`<${ClaudeAccountSelect} id=${`${idPrefix}runtime-change-claude-account`} machine=${machine} backend=${f.backend} value=${f.credentialProfile} onChange=${value=>set("credentialProfile",value)} disabled=${busy||uncertain||machine?.status!=="online"} changeNote=${true}/>`:null}`:null}
|
|
66
66
|
<p class="note">${text("freshHint")}</p><p class="note">${text("stopped")}</p><label class="check"><input type="checkbox" checked=${f.fresh} disabled=${busy||uncertain} onChange=${event=>set("fresh",event.target.checked)}/><span>${text("fresh")}</span></label>`:null}
|
|
@@ -46,6 +46,8 @@ register("signin", {
|
|
|
46
46
|
ended: "The authorization ended.",
|
|
47
47
|
cancelSignIn: "Cancel connecting",
|
|
48
48
|
cancelled: "Connecting cancelled.",
|
|
49
|
+
cancelOther: "Cancel that connection and continue",
|
|
50
|
+
busy: "Your {0} account is already being connected. Cancel that connection first, then try again.",
|
|
49
51
|
running: "Connecting your {0} account (started on {1}).",
|
|
50
52
|
open: "Open",
|
|
51
53
|
expired: "That took too long — start again.",
|
|
@@ -56,6 +58,7 @@ register("signin", {
|
|
|
56
58
|
listTitle: "AI accounts",
|
|
57
59
|
browserRunning: "Connecting your {0} account on this machine",
|
|
58
60
|
consoleFallback: "Use console fallback",
|
|
61
|
+
consoleFallbackNote: "Using the console takes the only terminal sign-in. Until it finishes or you cancel it, Grok and any other AI that connects through the terminal has to wait.",
|
|
59
62
|
defaultAccount: "Default connection",
|
|
60
63
|
listHint: "Connect AI accounts: each AI account connected on this machine, and each credential profile an agent uses. Connecting finishes on the provider's official website.",
|
|
61
64
|
stUsable: "connected",
|
|
@@ -98,6 +101,8 @@ register("signin", {
|
|
|
98
101
|
ended: "授權流程已結束。",
|
|
99
102
|
cancelSignIn: "取消連接",
|
|
100
103
|
cancelled: "已取消連接。",
|
|
104
|
+
cancelOther: "取消那個連接並繼續",
|
|
105
|
+
busy: "正在連接 {0} 帳號。請先取消那個連接,再重試。",
|
|
101
106
|
running: "正在連接 {0} 帳號(從 {1} 啟動)。",
|
|
102
107
|
open: "開啟",
|
|
103
108
|
expired: "等太久了——請重新開始。",
|
|
@@ -108,6 +113,7 @@ register("signin", {
|
|
|
108
113
|
listTitle: "AI 帳號",
|
|
109
114
|
browserRunning: "正在這台機器連接 {0} 帳號",
|
|
110
115
|
consoleFallback: "改用主控台備援",
|
|
116
|
+
consoleFallbackNote: "改用主控台會佔用唯一的終端登入。在它完成或你取消之前,Grok 和其他走終端登入的 AI 都要等。",
|
|
111
117
|
defaultAccount: "預設連接",
|
|
112
118
|
listHint: "連接 AI 帳號:這台機器上連接的每個 AI 帳號,以及 Agent 使用的每個憑證設定檔。連接時會前往供應商官方網站完成授權。",
|
|
113
119
|
stUsable: "已連接",
|
|
@@ -246,7 +252,9 @@ export function BrowserSignInDialog({ backend, profile, backends, onClose }) {
|
|
|
246
252
|
let cards, last = "";
|
|
247
253
|
// Ridge #3321 S01: "Sign in again" asks in the dashboard's own confirmation (its title names the CLI), not the browser's.
|
|
248
254
|
const ask = (message, cli) => confirmDialog({ title: t("signin.reloginTitle", cli), message, confirmLabel: t("signin.reloginGo") });
|
|
249
|
-
cards = mountStructuredSignIns(root.current, { endpoint, lang, ask, dashboard: true, ...(single ? { dialog: true, focus: backend } : {}), started: id => { run.current = id; },
|
|
255
|
+
cards = mountStructuredSignIns(root.current, { endpoint, lang, ask, dashboard: true, codeHint: b => !!capsOf(b)?.codeHint, ...(single ? { dialog: true, focus: backend } : {}), started: id => { run.current = id; },
|
|
256
|
+
// The dialog was closed while its start was still in flight and the server made the run after all: nobody sees it, so it is ended here — by its id, so no other run is touched.
|
|
257
|
+
abandoned: id => { if (profile || single) void post(endpoint, { operation: "cancel", id }).then(() => refreshSignIn()); }, changed: next => {
|
|
250
258
|
if (!profile) {
|
|
251
259
|
if (backends) { if (backends.some(b => !next.selected.includes(b))) void cards.addBackends(backends); }
|
|
252
260
|
else if (!next.selected.includes(backend)) void cards.addBackend(backend);
|
|
@@ -257,7 +265,9 @@ export function BrowserSignInDialog({ backend, profile, backends, onClose }) {
|
|
|
257
265
|
const unlisten = onLang(() => cards.relabel());
|
|
258
266
|
return () => {
|
|
259
267
|
unlisten(); cards.dispose();
|
|
260
|
-
|
|
268
|
+
// AGEND-203: the default account's too (single dialog) — a sign-in left running behind a closed dialog held this backend's window until its ten minutes were up. The installer's
|
|
269
|
+
// multi-backend list keeps its runs: that page is where they are meant to continue.
|
|
270
|
+
if ((profile || single) && run.current) void post(endpoint, { operation: "cancel", id: run.current }).then(() => refreshSignIn()); // that run only; nothing to end once it is over: the server answers with what is there
|
|
261
271
|
};
|
|
262
272
|
}, [backend, profile, backends]);
|
|
263
273
|
const fallback = async (chosen = backend) => {
|
|
@@ -265,19 +275,21 @@ export function BrowserSignInDialog({ backend, profile, backends, onClose }) {
|
|
|
265
275
|
// account's: only the run this dialog started is ended (none started here: nothing to end, and one another tab runs is left alone); the default account's, as before.
|
|
266
276
|
const own = profile ? run.current : null;
|
|
267
277
|
if (!profile || own) {
|
|
268
|
-
|
|
278
|
+
// AGEND-215: with no run id of its own, only a run on the backend this dialog is for (the one chosen) — never whichever structured run another backend has.
|
|
279
|
+
const result = await post(endpoint, own ? { operation: "cancel", id: own } : { operation: "cancel", ...(profile ? {} : { backend: chosen }) });
|
|
269
280
|
if (!result.ok) { toast(tn("failed")); return; }
|
|
270
281
|
run.current = null; // ended here: closing this dialog has nothing left to end
|
|
271
282
|
}
|
|
272
283
|
showDialog(SignInDialog, { backend: chosen, ...(profile && chosen === backend ? { profile } : {}) });
|
|
273
284
|
};
|
|
274
285
|
const actions = html`<div class="signin-browser-actions">
|
|
275
|
-
${backends ? backends.filter(b => b
|
|
286
|
+
${backends ? backends.filter(b => capsOf(b)?.chatSignIn).map(b => html`<button type="button" class="btn" onClick=${() => fallback(b)}>${b} · ${tn("consoleFallback")}</button>`) : null}
|
|
276
287
|
<button type="button" class="btn" onClick=${close}>${tn("close")}</button></div>`;
|
|
277
288
|
const account = backend ? `${cliLabel(backend)} · ${profile || tn("defaultAccount")}` : "";
|
|
278
289
|
return html`<${Dialog} title=${backends ? tn("listTitle") : tn("title", account)} onClose=${close} actions=${actions}>
|
|
279
290
|
<div class="signin-browser" ref=${root}></div>
|
|
280
|
-
${single ? html`<p class="note"><button type="button" class="btn btn-sm btn-ghost" onClick=${() => fallback(backend)}>${tn("consoleFallback")}</button></p>` : null}
|
|
291
|
+
${single && capsOf(backend)?.chatSignIn ? html`<p class="note"><button type="button" class="btn btn-sm btn-ghost" onClick=${() => fallback(backend)}>${tn("consoleFallback")}</button></p>` : null}
|
|
292
|
+
${single && capsOf(backend)?.chatSignIn ? html`<p class="note" data-signin-console-note>${tn("consoleFallbackNote")}</p>` : null}
|
|
281
293
|
</${Dialog}>`;
|
|
282
294
|
}
|
|
283
295
|
|
|
@@ -287,15 +299,21 @@ export function SignInDialog({ backend, profile, resume = false, onClose }) {
|
|
|
287
299
|
const [busy, setBusy] = useState(false);
|
|
288
300
|
const shown = shownOf(backend, profile);
|
|
289
301
|
const dismiss = onClose || closeDialog;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
if (gone) return;
|
|
302
|
+
const check = () => {
|
|
303
|
+
setStep({ kind: "checking" });
|
|
304
|
+
return post("/ui/backend-login/check", { backend, ...(profile ? { profile } : {}) }).then((r) => {
|
|
305
|
+
if (gone.current) return;
|
|
295
306
|
if (r.body && r.body.confirm) setStep({ kind: "confirm", confirm: r.body.confirm });
|
|
296
|
-
else setStep({ kind: "message", text: (r.body && (r.body.message || (r.body.error && errorText(r.body.error)))) || tn("failed")
|
|
307
|
+
else setStep({ kind: "message", text: (r.body && (r.body.message || (r.body.error && errorText(r.body.error)))) || tn("failed"),
|
|
308
|
+
...(r.body && r.body.busy && typeof r.body.busy.backend === "string" ? { busy: r.body.busy.backend } : {}) });
|
|
297
309
|
});
|
|
298
|
-
|
|
310
|
+
};
|
|
311
|
+
const gone = useRef(false);
|
|
312
|
+
useEffect(() => {
|
|
313
|
+
if (resume) return undefined;
|
|
314
|
+
gone.current = false;
|
|
315
|
+
void check();
|
|
316
|
+
return () => { gone.current = true; };
|
|
299
317
|
}, []);
|
|
300
318
|
const login = s.login;
|
|
301
319
|
const close = () => {
|
|
@@ -318,11 +336,22 @@ export function SignInDialog({ backend, profile, resume = false, onClose }) {
|
|
|
318
336
|
const r = await post("/ui/backend-login/start", { confirm: step.confirm.id, ...(tunnel ? { tunnel: true } : {}) });
|
|
319
337
|
setBusy(false);
|
|
320
338
|
if (r.body && r.body.login) { signInStore.set({ login: r.body.login }); setStep({ kind: "login" }); return; }
|
|
321
|
-
setStep({ kind: "message", text: (r.body && (r.body.message || (r.body.error && errorText(r.body.error)))) || tn("failed")
|
|
339
|
+
setStep({ kind: "message", text: (r.body && (r.body.message || (r.body.error && errorText(r.body.error)))) || tn("failed"),
|
|
340
|
+
...(r.body && r.body.busy && typeof r.body.busy.backend === "string" ? { busy: r.body.busy.backend } : {}) });
|
|
322
341
|
};
|
|
342
|
+
// AGEND-203: a start refused because another sign-in runs offers to end THAT one (by its backend), then asks again — no chat command to type.
|
|
343
|
+
const cancelOther = async () => {
|
|
344
|
+
setBusy(true);
|
|
345
|
+
await post("/ui/backend-login/cancel", { backend: step.busy });
|
|
346
|
+
setBusy(false);
|
|
347
|
+
void refreshSignIn();
|
|
348
|
+
await check();
|
|
349
|
+
};
|
|
350
|
+
// AGEND-215: the sign-in THIS dialog shows — by its own backend. Two sign-ins can run at once (structured Claude Code beside a terminal Grok); a body without one ends
|
|
351
|
+
// whichever the server finds first, which is not necessarily the one on screen. (Without a sign-in on screen there is no backend: this dialog's own.)
|
|
323
352
|
const cancelRun = async () => {
|
|
324
353
|
setBusy(true);
|
|
325
|
-
const r = await post("/ui/backend-login/cancel", {});
|
|
354
|
+
const r = await post("/ui/backend-login/cancel", { backend: (login && login.backend) || backend });
|
|
326
355
|
setBusy(false);
|
|
327
356
|
toast((r.body && r.body.message) || tn("cancelled"));
|
|
328
357
|
void refreshSignIn();
|
|
@@ -342,8 +371,12 @@ export function SignInDialog({ backend, profile, resume = false, onClose }) {
|
|
|
342
371
|
${c.publicLink ? html`<button type="button" class="btn" onClick=${() => start(true)}>${tn("goPublic")}</button>` : null}
|
|
343
372
|
<button type="button" class="btn btn-primary" onClick=${() => start(false)}>${tn("go")}</button>`;
|
|
344
373
|
} else if (step.kind === "message") {
|
|
345
|
-
|
|
346
|
-
|
|
374
|
+
// A refusal because another sign-in runs is worded here, in the page's language (the server's sentence follows ITS language, not this browser's).
|
|
375
|
+
body = html`<p class="signin-message">${step.busy ? tn("busy", shownOf(step.busy)) : step.text}</p>`;
|
|
376
|
+
actions = step.busy
|
|
377
|
+
? html`<button type="button" class="btn" disabled=${busy} onClick=${close}>${tn("close")}</button>
|
|
378
|
+
<button type="button" class="btn btn-danger" disabled=${busy} onClick=${cancelOther}>${tn("cancelOther")}</button>`
|
|
379
|
+
: html`<button type="button" class="btn btn-primary" onClick=${close}>${tn("close")}</button>`;
|
|
347
380
|
} else if (!login) {
|
|
348
381
|
body = html`<p class="signin-note">${tn("ended")}</p>`;
|
|
349
382
|
actions = html`<button type="button" class="btn btn-primary" onClick=${close}>${tn("close")}</button>`;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
// AGEND-181: which steps belong above which chat reply — a pure function, no DOM, no fetch.
|
|
2
|
+
//
|
|
3
|
+
// Input: the chat ledger's rows (`rows`: role user/agent/…, `anchor`, `text`, `ts`) and the instance's steps in file order
|
|
4
|
+
// (log-steps.ts; the same list the Log tab shows). Output: groups of steps, each placed on a ledger row or at the end:
|
|
5
|
+
//
|
|
6
|
+
// • a turn starts at a user step and runs to the next one; `turn_end` closes it;
|
|
7
|
+
// • inside a turn every `reply` tool call closes a segment: the steps since the previous reply (or the turn's start) are
|
|
8
|
+
// what produced THAT reply — thinking, intermediate text, tool calls; the `reply` row itself is the bubble below;
|
|
9
|
+
// • steps after the turn's last reply (the CLI often says one more thing that is never sent) stay on that reply's
|
|
10
|
+
// group as `trailing` once the turn ended; before that they are the live group at the end of the thread.
|
|
11
|
+
//
|
|
12
|
+
// A segment is placed on its reply's row by the most exact thing that matches, and says which (`level`):
|
|
13
|
+
// id the reply call's result `messageId` equals the row's `anchor` (what afterReplyRouted records). A call that names
|
|
14
|
+
// an id and finds no such row is never matched by text or time (R4): its segment stays unattached (`none`) or live;
|
|
15
|
+
// text the start of the call's text equals the start of an agent row's text — rows taken in order, never back (a
|
|
16
|
+
// monotonic cursor: two replies that say the same short thing each get their own row) — and inside the call's own
|
|
17
|
+
// turn, as for `time` (R4: an in-flight reply must not take the row of the next user's reply that says the same);
|
|
18
|
+
// time an unclaimed agent row written within TIME_SLACK_MS of the call, and inside the call's own turn (from its user
|
|
19
|
+
// row to the next user row; with no user row to tell, from the turn's first step to the next turn's);
|
|
20
|
+
// turn the turn has no `reply` at all (a backend that has none): its steps go above the last agent row between its
|
|
21
|
+
// user row and the next user row;
|
|
22
|
+
// none nothing matched: an "activity" group of its own, between the rows by time. Never attached to a guess.
|
|
23
|
+
// A `reply` call that failed or was interrupted sent nothing: it claims no row (a retry that worked would lose its row to
|
|
24
|
+
// it); its steps join the next segment, and the failed call shows there as an ordinary tool step.
|
|
25
|
+
// What a step must be to be shown (AGEND-197): a text with nothing in it — blank, or only punctuation (the `.` Claude Code
|
|
26
|
+
// writes after its `reply` call, which is the turn's close-out, not a thought) — is not a step; a turn left with no shown
|
|
27
|
+
// step has no group at all. Text after the last reply with substance stays in that reply's group (the same block as the
|
|
28
|
+
// turn's other steps), and only until its reply row arrives is it ever the live group.
|
|
29
|
+
// A page labels `text`, `time`, `turn` and `none` as inferred. A reply call seen a moment before its row arrives is
|
|
30
|
+
// `live` (placed at the end) so the group does not jump when the row comes.
|
|
31
|
+
//
|
|
32
|
+
// Keys: `act:<turn>:<n>` (n: the segment's number in its turn) — the same key while a segment is live and after its
|
|
33
|
+
// reply arrives, so the page keeps the node (no remount, no scroll jump). A turn the transcript gave no id for is named
|
|
34
|
+
// by its first user step (else its first step): an id of the transcript, not a position in the window, which moves when
|
|
35
|
+
// older steps load or the window is cut.
|
|
36
|
+
|
|
37
|
+
export const TIME_SLACK_MS = 5000;
|
|
38
|
+
/** A reply call this recent, with no row yet, is assumed to be about to get one. */
|
|
39
|
+
export const AWAIT_ROW_MS = 15000;
|
|
40
|
+
/** The steps a timeline shows (the rest — the user's prompt, the turn's end, compaction notes — are bubbles or noise). */
|
|
41
|
+
const SHOWN = new Set(["thinking", "assistant", "tool", "error"]);
|
|
42
|
+
const REPLY_TOOL = /^(?:mcp__agend[\w-]*__|agend[\w-]*:)?reply$/;
|
|
43
|
+
const REPLY_TEXT = 200;
|
|
44
|
+
|
|
45
|
+
/** A text step with words in it: not blank, not only punctuation (letters, digits and symbols such as emoji count). */
|
|
46
|
+
export const hasSubstance = (s) => s.kind !== "assistant" || /[^\s\p{P}]/u.test(String(s.body == null ? "" : s.body));
|
|
47
|
+
|
|
48
|
+
export const rowKeyOf = (x) => `${x.boot}-${x.id}`;
|
|
49
|
+
export const isReplyStep = (s) => s.kind === "tool" && typeof s.tool === "string" && REPLY_TOOL.test(s.tool);
|
|
50
|
+
/** A reply call that sent nothing (its result was an error, or the turn was interrupted before it finished). */
|
|
51
|
+
const isLostReply = (s) => s.status === "failed" || s.status === "interrupted";
|
|
52
|
+
|
|
53
|
+
const rowTs = (x) => { const t = Date.parse(x.ts); return Number.isFinite(t) ? t : 0; };
|
|
54
|
+
const head = (text) => String(text == null ? "" : text).slice(0, REPLY_TEXT);
|
|
55
|
+
|
|
56
|
+
/** Runs of steps with the same `turn` (the transcript's own id for it), in file order. */
|
|
57
|
+
function turnsOf(steps) {
|
|
58
|
+
const out = [];
|
|
59
|
+
for (const s of steps) {
|
|
60
|
+
const last = out[out.length - 1];
|
|
61
|
+
if (last && last.turn === s.turn) last.steps.push(s);
|
|
62
|
+
else out.push({ turn: s.turn, steps: [s] });
|
|
63
|
+
}
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @param rows ledger rows in order
|
|
69
|
+
* @param steps steps in file order
|
|
70
|
+
* @param opts { now?: ms, complete?: boolean — the steps reach back to the transcript's start (false: the first turn may
|
|
71
|
+
* lack its beginning), busy?: boolean — the page knows the agent is working now (a turn with no step
|
|
72
|
+
* to show yet still gets its live line), instance? }
|
|
73
|
+
* @returns { groups: Group[], live: Group|null }
|
|
74
|
+
* Group = { key, turn, n, level, rowKey: string|null, items: Step[], trailing: Step[], ts: number, from, to (ms: when the
|
|
75
|
+
* work for the reply began — the turn's start, or the previous reply's call — and when it ended; `to` 0 while live), partial?: true,
|
|
76
|
+
* ended: the segment is complete (false: live), turnEnded: the turn is over — only then are `trailing` steps "never sent" }
|
|
77
|
+
* `groups` are in thread order; `rowKey` is the row a group sits above (null: between rows by `ts`, or live at the end).
|
|
78
|
+
*/
|
|
79
|
+
export function groupSteps(rows, steps, opts = {}) {
|
|
80
|
+
const now = opts.now ?? Date.now();
|
|
81
|
+
const agents = rows.map((x, i) => ({ x, i })).filter((r) => r.x.role === "agent");
|
|
82
|
+
const users = rows.map((x, i) => ({ x, i })).filter((r) => r.x.role === "user");
|
|
83
|
+
const taken = new Set();
|
|
84
|
+
let cursor = 0; // an index into `rows`: text matches never go back past it
|
|
85
|
+
const turns = turnsOf(steps);
|
|
86
|
+
const groups = [];
|
|
87
|
+
let live = null;
|
|
88
|
+
// Prism #3709 R4: the rows some reply call names by its explicit id. A call that names none yet (its result not seen) may
|
|
89
|
+
// still be matched by its words or its time — but never onto a row another call has proved to be its own.
|
|
90
|
+
const named = new Set();
|
|
91
|
+
for (const s of steps) if (isReplyStep(s) && s.anchor && s.anchor.messageId) named.add(s.anchor.messageId);
|
|
92
|
+
const free = (c) => !(c.x.anchor && named.has(c.x.anchor));
|
|
93
|
+
|
|
94
|
+
const claim = (r, level) => { taken.add(r.i); if (r.i + 1 > cursor) cursor = r.i + 1; return { rowKey: rowKeyOf(r.x), level }; };
|
|
95
|
+
/** The agent row a `reply` call produced, by the most exact match that holds. */
|
|
96
|
+
const place = (replyStep, inTurn) => {
|
|
97
|
+
const a = replyStep.anchor || {};
|
|
98
|
+
if (a.messageId) {
|
|
99
|
+
// An explicit id is the whole answer: a miss means its row is not here (yet, or any more) — it never falls back to
|
|
100
|
+
// the words or the time, which would hang this turn's work on another reply. Unproved: unattached / live.
|
|
101
|
+
const r = agents.find((c) => !taken.has(c.i) && c.x.anchor === a.messageId);
|
|
102
|
+
return r ? claim(r, "id") : null;
|
|
103
|
+
}
|
|
104
|
+
if (a.replyText) {
|
|
105
|
+
const r = agents.find((c) => c.i >= cursor && !taken.has(c.i) && free(c) && inTurn(c) && c.x.text !== undefined && head(c.x.text) === a.replyText);
|
|
106
|
+
if (r) return claim(r, "text");
|
|
107
|
+
}
|
|
108
|
+
if (replyStep.ts) {
|
|
109
|
+
let best = null, bestD = TIME_SLACK_MS + 1;
|
|
110
|
+
for (const c of agents) {
|
|
111
|
+
if (taken.has(c.i) || !free(c) || !inTurn(c)) continue;
|
|
112
|
+
const d = Math.abs(rowTs(c.x) - replyStep.ts);
|
|
113
|
+
if (d < bestD) { best = c; bestD = d; }
|
|
114
|
+
}
|
|
115
|
+
if (best) return claim(best, "time");
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/** The newest group already placed for this turn (a reply whose row is there), if any. */
|
|
121
|
+
const lastPlacedOf = (turnId) => [...groups].reverse().find((g) => g.turn === turnId);
|
|
122
|
+
|
|
123
|
+
turns.forEach((turn, ti) => {
|
|
124
|
+
const first = turn.steps.find((s) => s.kind === "user");
|
|
125
|
+
const ended = turn.steps.some((s) => s.kind === "turn_end");
|
|
126
|
+
const lastTurn = ti === turns.length - 1;
|
|
127
|
+
const userRow = first && first.anchor && first.anchor.messageId
|
|
128
|
+
? users.find((r) => r.x.anchor === first.anchor.messageId) || null : null;
|
|
129
|
+
const tkey = turn.turn || `~${(first || turn.steps[0]).id}`;
|
|
130
|
+
// Which agent rows can belong to this turn's replies by time: between its user row and the next user row; with no
|
|
131
|
+
// user row to go by, between the turn's first step and the next turn's first (rows keep their own clock).
|
|
132
|
+
const next = userRow ? users.find((r) => r.i > userRow.i) : null;
|
|
133
|
+
const t0 = ((turn.steps[0] && turn.steps[0].ts) || 0) - TIME_SLACK_MS;
|
|
134
|
+
const t1 = (turns[ti + 1] && turns[ti + 1].steps[0] && turns[ti + 1].steps[0].ts) || Infinity;
|
|
135
|
+
const inTurn = userRow
|
|
136
|
+
? (c) => c.i > userRow.i && (!next || c.i < next.i)
|
|
137
|
+
: (c) => { const t = rowTs(c.x); return t >= t0 && t < t1; };
|
|
138
|
+
// When the work for a reply began: the turn's start for its first reply, else the previous reply's call.
|
|
139
|
+
let seg = [], n = 0, replied = 0, from = (first && first.ts) || (turn.steps[0] && turn.steps[0].ts) || 0;
|
|
140
|
+
const segs = [];
|
|
141
|
+
const flush = (replyStep) => { segs.push({ n: n++, items: seg, reply: replyStep, from }); from = replyStep.ts || from; seg = []; };
|
|
142
|
+
for (const s of turn.steps) {
|
|
143
|
+
if (s.kind === "user" || s.kind === "turn_end" || s.kind === "state") continue;
|
|
144
|
+
if (isReplyStep(s) && !isLostReply(s)) { replied++; flush(s); continue; }
|
|
145
|
+
if (SHOWN.has(s.kind) && hasSubstance(s)) seg.push(s);
|
|
146
|
+
}
|
|
147
|
+
const tail = seg; // after the last reply (or the whole turn when it had none)
|
|
148
|
+
const partial = ti === 0 && opts.complete === false && !first;
|
|
149
|
+
// A turn with no reply at all that has ended: its steps go above the last agent row after its user row (`turn`).
|
|
150
|
+
if (!replied && ended && tail.length && userRow) {
|
|
151
|
+
const cand = agents.filter((r) => inTurn(r) && !taken.has(r.i));
|
|
152
|
+
const last = cand[cand.length - 1];
|
|
153
|
+
if (last) {
|
|
154
|
+
taken.add(last.i);
|
|
155
|
+
groups.push({ key: `act:${tkey}:0`, turn: turn.turn, n: 0, level: "turn", rowKey: rowKeyOf(last.x), items: tail, trailing: [], ts: tail[0].ts || 0, from, to: tail[tail.length - 1].ts || 0, ended: true, turnEnded: true, ...(partial ? { partial: true } : {}) });
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
segs.forEach((sg) => {
|
|
160
|
+
const where = place(sg.reply, inTurn);
|
|
161
|
+
const ts = (sg.items[0] && sg.items[0].ts) || sg.reply.ts || 0;
|
|
162
|
+
const base = { key: `act:${tkey}:${sg.n}`, turn: turn.turn, n: sg.n, items: sg.items, trailing: [], ts, from: sg.from, to: sg.reply.ts || 0, ended: true, turnEnded: ended, ...(partial && sg.n === 0 ? { partial: true } : {}) };
|
|
163
|
+
if (where) { groups.push({ ...base, ...where }); return; }
|
|
164
|
+
const awaiting = lastTurn && (sg.reply.status === "running" || (sg.reply.ts && now - sg.reply.ts < AWAIT_ROW_MS));
|
|
165
|
+
if (!awaiting) { groups.push({ ...base, level: "none", rowKey: null }); return; }
|
|
166
|
+
if (live) groups.push({ ...live, level: "none", ended: true });
|
|
167
|
+
live = { ...base, level: "live", rowKey: null, ended: false };
|
|
168
|
+
});
|
|
169
|
+
if (!tail.length) {
|
|
170
|
+
// nothing shown yet, but the agent is working on this turn (the page says so: `busy`). Some CLIs write a
|
|
171
|
+
// thought only when it ends — grok's first record of a turn is the prompt, and a long thought leaves no other record
|
|
172
|
+
// for minutes — so without this the chat showed no block at all while the agent was plainly thinking. An EMPTY live
|
|
173
|
+
// group: the "Working…" line and its elapsed time, nothing guessed. Same key as the group the first step will make
|
|
174
|
+
// (no remount). Only the newest turn, only while it has not ended, only while the page knows the agent is busy: a
|
|
175
|
+
// turn that never wrote its end (a crash, an interrupt) is never a spinner on its own.
|
|
176
|
+
if (opts.busy && !ended && lastTurn && !live && first) {
|
|
177
|
+
live = { key: `act:${tkey}:${n}`, turn: turn.turn, n, level: "live", rowKey: null, items: [], trailing: [], ts: from, from, to: 0, ended: false, turnEnded: false };
|
|
178
|
+
}
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
// What came after the last reply.
|
|
182
|
+
if (!ended && lastTurn) {
|
|
183
|
+
// Still going. A reply whose row has not arrived yet is the live group, and this is more work after it.
|
|
184
|
+
if (live) live.trailing = tail;
|
|
185
|
+
else if (lastPlacedOf(turn.turn) && tail.every((x) => x.kind === "assistant")) {
|
|
186
|
+
// Only words after a reply whose row is already there: the close-out of that reply's group, not a new live block
|
|
187
|
+
// below the reply (which would then jump back up when the turn ends).
|
|
188
|
+
const g = lastPlacedOf(turn.turn);
|
|
189
|
+
g.trailing = tail; g.to = tail[tail.length - 1].ts || g.to;
|
|
190
|
+
}
|
|
191
|
+
else live = { key: `act:${tkey}:${n}`, turn: turn.turn, n, level: "live", rowKey: null, items: tail, trailing: [], ts: tail[0].ts || 0, from, to: 0, ended: false, turnEnded: false, ...(partial && !segs.length ? { partial: true } : {}) };
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
// Ended (or an earlier turn that never saw its end): they ride on the last reply's group, shown as never sent.
|
|
195
|
+
const lastPlaced = lastPlacedOf(turn.turn);
|
|
196
|
+
if (lastPlaced) { lastPlaced.trailing = tail; lastPlaced.to = tail[tail.length - 1].ts || lastPlaced.to; return; }
|
|
197
|
+
groups.push({ key: `act:${tkey}:${n}`, turn: turn.turn, n, level: "none", rowKey: null, items: tail, trailing: [], ts: tail[0].ts || 0, from, to: tail[tail.length - 1].ts || 0, ended: true, turnEnded: ended, ...(partial && !segs.length ? { partial: true } : {}) });
|
|
198
|
+
});
|
|
199
|
+
if (live && opts.busy) { live.busy = true; if (opts.phase) live.phase = opts.phase; } // the page knows the agent is working: this live group is shown even when it holds nothing to show yet; grok's phase (reasoning, a tool…) is what the live line says
|
|
200
|
+
return { groups, live };
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* The ledger rows with each group as a synthetic `{ role: "activity" }` row before the reply it belongs to; a group
|
|
205
|
+
* with no row (`none`, by its time) between the rows; the live group last. The rows themselves are never changed.
|
|
206
|
+
*/
|
|
207
|
+
export function composeRows(rows, { groups, live }) {
|
|
208
|
+
const before = new Map();
|
|
209
|
+
const loose = [];
|
|
210
|
+
for (const g of groups) {
|
|
211
|
+
if (g.rowKey) { const l = before.get(g.rowKey) || []; l.push(g); before.set(g.rowKey, l); } else loose.push(g);
|
|
212
|
+
}
|
|
213
|
+
const act = (g) => ({ role: "activity", boot: "act", id: g.key, group: g, ts: g.ts ? new Date(g.ts).toISOString() : "" });
|
|
214
|
+
const out = [];
|
|
215
|
+
const looseLeft = loose.slice().sort((a, b) => a.ts - b.ts);
|
|
216
|
+
for (const x of rows) {
|
|
217
|
+
const t = rowTs(x);
|
|
218
|
+
while (looseLeft.length && t && looseLeft[0].ts && looseLeft[0].ts < t) out.push(act(looseLeft.shift()));
|
|
219
|
+
for (const g of before.get(rowKeyOf(x)) || []) out.push(act(g));
|
|
220
|
+
out.push(x);
|
|
221
|
+
}
|
|
222
|
+
for (const g of looseLeft) out.push(act(g));
|
|
223
|
+
if (live) out.push(act(live));
|
|
224
|
+
return out;
|
|
225
|
+
}
|