From 18e3b1a44a69de515b06c9b2ee09405694e1ea15 Mon Sep 17 00:00:00 2001
From: David McKay
Date: Wed, 18 Nov 2026 16:42:03 -0800
Subject: [PATCH] Bring release/1.1 to main at 3771a4b7b for 1.1.1-rc.1
Carries main's tree at 3771a4b7b271 onto release/1.1, keeping the release line at 1.1.0: backend-images.env stays at v1.1.0, and package.json, the desktop Cargo version, release-policy.json and desktop/intelligence-cli.json already match main. The next Create release PR run, kind rc and bump patch, moves them to 1.1.1-rc.1. CHANGELOG.md adds one line under OpenBot Desktop for #1845, which landed after the 1.1.1 notes: Retry waits for a back end whose services are still coming up.
---
.env.example | 12 +
.github/published-images.json | 1 +
.github/workflows/ci.yml | 134 +-
.github/workflows/desktop-build.yml | 7 +
.github/workflows/desktop-macos-signing.yml | 3 +-
.github/workflows/desktop-upgrade.yml | 114 +
.github/workflows/desktop.yml | 4 +-
.github/workflows/downloads-sync.yml | 14 +-
.github/workflows/model-compat.yml | 261 ++
.github/workflows/model-lock.yml | 121 +
.github/workflows/security-floor.yml | 132 +
CHANGELOG.md | 273 ++
README.md | 3 +
agent-ag2/requirements.txt | 4 +-
agent-ag2/src/main.py | 17 +-
agent-ag2/tests/test_main.py | 10 +-
agent-ag2/tests/test_responses_api.py | 311 ++
agent-agno/src/main.py | 17 +-
agent-agno/tests/test_main.py | 78 +-
agent-claude-sdk/requirements.txt | 2 +-
agent-claude-sdk/src/adapter.py | 91 +-
.../tests/test_claude_code_version.py | 45 +
.../tests/test_provider_refusal.py | 78 +-
.../tests/test_tool_not_offered.py | 231 ++
agent-langgraph-agui/requirements-test.txt | 1 -
agent-langgraph-agui/requirements.txt | 16 +-
agent-langgraph-agui/src/main.py | 4 +-
agent-langgraph-agui/src/tool_runtime.py | 45 +-
.../tests/test_model_choice.py | 35 +-
.../tests/test_provider_boundaries.py | 10 +-
.../tests/test_tool_protocol.py | 80 +
agent-langgraph-ts/Dockerfile | 22 +
agent-langgraph-ts/package-lock.json | 928 +++++
agent-langgraph-ts/package.json | 27 +
agent-langgraph-ts/src/errors.ts | 337 ++
agent-langgraph-ts/src/history.ts | 285 ++
agent-langgraph-ts/src/json-modules.ts | 27 +
agent-langgraph-ts/src/main.ts | 25 +
agent-langgraph-ts/src/models.ts | 422 +++
agent-langgraph-ts/src/plan-model.ts | 456 +++
agent-langgraph-ts/src/run.ts | 626 ++++
agent-langgraph-ts/src/server.ts | 143 +
agent-langgraph-ts/test/claude-plan.test.ts | 470 +++
agent-langgraph-ts/test/errors.test.ts | 332 ++
agent-langgraph-ts/test/fake-provider.ts | 475 +++
.../test/fixtures/claude-model/text.sse | 18 +
.../test/fixtures/claude-model/tool.sse | 18 +
.../test/fixtures/plan-harness/bad-key.sse | 12 +
.../test/fixtures/plan-harness/parallel.sse | 86 +
.../test/fixtures/plan-harness/refused.sse | 12 +
.../test/fixtures/plan-harness/text.sse | 66 +
agent-langgraph-ts/test/graph.test.ts | 502 +++
agent-langgraph-ts/test/helpers.ts | 110 +
agent-langgraph-ts/test/history.test.ts | 205 ++
agent-langgraph-ts/test/model-gateway.ts | 237 ++
agent-langgraph-ts/test/model-route.test.ts | 363 ++
agent-langgraph-ts/test/plan-model.test.ts | 279 ++
agent-langgraph-ts/test/request-shape.test.ts | 357 ++
.../test/responses-rule.test.ts | 92 +
agent-langgraph-ts/test/server.test.ts | 60 +
agent-langgraph-ts/tsconfig.json | 17 +
agent-langroid/requirements.txt | 7 +-
agent-langroid/src/main.py | 42 +-
agent-langroid/tests/test_main.py | 10 +-
agent-langroid/tests/test_responses_api.py | 295 ++
api/README.md | 87 +-
api/accepted-breaking-changes.md | 221 +-
api/client-boundary.allow.ts | 20 +-
api/openapi-accounts.test.ts | 8 +-
api/openapi-ai-connection.test.ts | 191 +
api/openapi-extensible-enums.test.ts | 123 +
api/openapi-schedules.test.ts | 4 +-
api/openapi-text-patterns.test.ts | 50 +
api/openapi.yaml | 957 ++++-
api/openapi/accounts.yaml | 46 +-
api/openapi/admin-settings.yaml | 127 +-
api/openapi/agents.yaml | 1 +
api/openapi/approvals.yaml | 20 +-
api/openapi/bot-grants.yaml | 6 +-
api/openapi/bots.yaml | 11 +-
api/openapi/common.yaml | 79 +
api/openapi/computers.yaml | 4 +-
api/openapi/conversations.yaml | 120 +-
api/openapi/learning.yaml | 4 +-
api/openapi/memory.yaml | 2 +-
api/openapi/model-connections.yaml | 500 +++
api/openapi/notifications.yaml | 2 +-
api/openapi/organizations.yaml | 14 +-
api/openapi/passwords-and-recorder.yaml | 2 +-
api/openapi/schedules.yaml | 114 +-
api/openapi/teams.yaml | 4 +-
.../admin/controls/computer-sections.tsx | 30 +-
.../admin/controls/describe-capabilities.tsx | 14 +-
.../admin/shared-computers-notice.tsx | 44 +
app/src/components/agents/new-bot-sheet.tsx | 14 +-
.../components/approvals/inline-approval.tsx | 4 +-
.../components/approvals/share-details.tsx | 155 +-
app/src/components/bot-profile/setup.tsx | 24 +-
.../components/channels/attachment-view.tsx | 393 +++
app/src/components/channels/channel-chat.tsx | 57 +-
app/src/components/channels/chat-messages.ts | 26 +-
.../components/channels/chat-transcript.tsx | 461 +--
.../channels/composer/attachment-strip.tsx | 138 +-
.../channels/composer/attachments.ts | 83 +-
.../components/channels/composer/composer.tsx | 77 +-
.../channels/composer/picked-files.test.ts | 189 +-
.../channels/composer/picked-files.ts | 43 +-
.../channels/composer/use-dictation.ts | 12 +-
.../components/channels/connect-app-card.tsx | 2 +
.../components/channels/conversation-view.tsx | 36 +-
app/src/components/channels/file-icon.tsx | 56 +
app/src/components/channels/group-chat.tsx | 89 +-
.../components/channels/sent-file-card.tsx | 117 +
app/src/components/channels/tool-line.tsx | 23 +-
app/src/components/computer/activity-log.tsx | 4 +
app/src/components/computer/computer-view.tsx | 8 +-
.../edition/team-features-dialog.tsx | 87 +-
.../components/layout/client-version-gate.tsx | 236 ++
.../components/learning/proposal-dialog.tsx | 33 +-
app/src/components/manage/computers-page.tsx | 12 +-
.../notifications/notify-prompt.tsx | 5 +-
.../organization-settings-page.tsx | 12 +-
.../components/plugins/app-access-action.tsx | 28 +-
.../components/plugins/broker-directory.tsx | 2 +
.../components/plugins/connect-in-new-tab.ts | 62 +-
.../components/responsibilities/goal-page.tsx | 22 +-
.../components/responsibilities/triggers.tsx | 14 +-
.../routines/edit-routine-dialog.tsx | 376 ++
.../components/routines/new-routine-page.tsx | 232 +-
app/src/components/routines/routine-page.tsx | 52 +-
app/src/components/routines/routine-runs.tsx | 29 +-
app/src/components/routines/routines-list.tsx | 4 +-
app/src/components/routines/schedule-when.tsx | 235 ++
app/src/components/settings/ai-connection.tsx | 983 +++++-
app/src/components/settings/devices.tsx | 23 +-
.../components/settings/learning-review.tsx | 22 +-
.../components/settings/star-on-github.tsx | 75 +
.../components/star-prompt/star-prompt.tsx | 144 +
app/src/components/tasks/task-row.tsx | 18 +-
app/src/components/tasks/turn-work.ts | 12 +-
app/src/lib/ai-connection/describe.ts | 68 +
app/src/lib/ai-connection/desktop.ts | 136 +
app/src/lib/ai-connection/mutations.ts | 115 +
app/src/lib/ai-connection/providers.ts | 150 +
app/src/lib/ai-connection/queries.ts | 65 +
.../lib/api/generated/agents/agents.zod.ts | 1 +
.../app-access-requests.zod.ts | 8 +-
.../approval-rules/approval-rules.zod.ts | 20 +-
.../api/generated/approvals/approvals.zod.ts | 22 +-
.../generated/bot-grants/bot-grants.zod.ts | 6 +-
app/src/lib/api/generated/bots/bots.zod.ts | 5 +-
.../generated/boundaries/boundaries.zod.ts | 8 +-
.../capabilities/capabilities.zod.ts | 24 +-
.../api/generated/check-ins/check-ins.zod.ts | 12 +-
.../api/generated/computers/computers.zod.ts | 60 +-
.../generated/conversations/conversations.ts | 2 +-
.../conversations/conversations.zod.ts | 40 +-
.../generated/deliveries/deliveries.zod.ts | 11 +-
app/src/lib/api/generated/goals/goals.zod.ts | 21 +-
.../identity-providers.zod.ts | 14 +-
.../api/generated/learning/learning.zod.ts | 52 +-
.../linked-accounts/linked-accounts.zod.ts | 2 +-
.../lib/api/generated/memory/memory.zod.ts | 8 +-
.../lib/api/generated/model/aiConnection.ts | 42 +
.../model/aiConnectionFixedResponse.ts | 9 +
.../api/generated/model/aiConnectionInput.ts | 34 +
.../api/generated/model/aiConnectionLogin.ts | 16 +
.../generated/model/aiConnectionProvider.ts | 18 +
.../model/aiConnectionRefusedResponse.ts | 9 +
.../api/generated/model/aiConnectionSaved.ts | 18 +
.../api/generated/model/aiConnectionSource.ts | 15 +
.../lib/api/generated/model/allowlistEntry.ts | 2 +-
.../api/generated/model/appAccessRequest.ts | 3 +-
.../generated/model/appAccessRequestStatus.ts | 16 -
.../model/approvalRuleDraftAuthoring.ts | 2 +-
.../model/approvalRuleDraftDescription.ts | 2 +-
.../generated/model/approvalRulePattern.ts | 2 +-
.../lib/api/generated/model/approvalStatus.ts | 11 +-
.../api/generated/model/attachmentLimits.ts | 24 +
app/src/lib/api/generated/model/authoring.ts | 2 +-
.../api/generated/model/botAgentHarness.ts | 1 +
.../api/generated/model/botDeclineReport.ts | 2 +-
.../model/botGrantChangesAuthoring.ts | 2 +-
.../generated/model/botGrantDescription.ts | 2 +-
.../generated/model/boundaryRuleLabelInput.ts | 2 +-
.../api/generated/model/capabilityAnswer.ts | 3 +-
.../model/capabilityAnswerDecidedBy.ts | 14 -
.../model/capabilityPreviewPeopleItem.ts | 4 +-
.../api/generated/model/changeDescription.ts | 2 +-
app/src/lib/api/generated/model/checkIn.ts | 3 +-
.../lib/api/generated/model/checkInItem.ts | 3 +-
.../api/generated/model/checkInItemStatus.ts | 16 -
.../api/generated/model/checkInLastStatus.ts | 13 -
.../lib/api/generated/model/clientRelease.ts | 9 +
.../generated/model/computerControlRequest.ts | 3 +-
.../model/computerControlRequestStatus.ts | 15 -
.../lib/api/generated/model/computerState.ts | 9 +-
.../generated/model/conversationMessage.ts | 13 +-
.../model/conversationMessageStatus.ts | 17 -
.../api/generated/model/createBotRequest.ts | 2 +-
.../model/createBotRequestHarness.ts | 3 +-
.../model/createOrganizationRequest.ts | 2 +-
.../api/generated/model/createTeamRequest.ts | 2 +-
.../lib/api/generated/model/deliveryState.ts | 13 +-
app/src/lib/api/generated/model/deployment.ts | 22 +
app/src/lib/api/generated/model/goal.ts | 3 +-
app/src/lib/api/generated/model/goalRun.ts | 3 +-
.../lib/api/generated/model/goalRunStatus.ts | 14 -
app/src/lib/api/generated/model/goalStatus.ts | 11 -
.../model/identityProviderDomains.ts | 2 +-
.../generated/model/identityProviderText.ts | 2 +-
app/src/lib/api/generated/model/index.ts | 42 +-
.../model/invalidAiConnectionResponse.ts | 9 +
app/src/lib/api/generated/model/invitation.ts | 3 +-
.../api/generated/model/invitationStatus.ts | 17 -
.../api/generated/model/learningProposal.ts | 3 +-
.../generated/model/learningProposalStatus.ts | 12 -
.../lib/api/generated/model/learningRun.ts | 3 +-
.../api/generated/model/learningRunStatus.ts | 16 -
.../lib/api/generated/model/linkedAccount.ts | 3 +-
.../generated/model/linkedAccountStatus.ts | 14 -
.../lib/api/generated/model/memorySource.ts | 3 +-
.../generated/model/memorySourceSyncStatus.ts | 13 -
.../lib/api/generated/model/minimumClients.ts | 14 +
.../lib/api/generated/model/modelChoice.ts | 2 +
.../lib/api/generated/model/networkPolicy.ts | 3 +-
.../generated/model/networkPolicyScopeKind.ts | 15 -
.../generated/model/newIdentityProviderId.ts | 2 +-
app/src/lib/api/generated/model/noticeId.ts | 11 +
app/src/lib/api/generated/model/nudgeEvent.ts | 20 +
.../api/generated/model/nudgeEventAction.ts | 15 +
.../api/generated/model/nudgeEventPlace.ts | 14 +
.../api/generated/model/nudgeEventSurface.ts | 14 +
.../lib/api/generated/model/organization.ts | 4 +-
.../generated/model/organizationInvitation.ts | 3 +-
.../model/organizationInvitationStatus.ts | 15 -
.../api/generated/model/organizationMember.ts | 6 +-
.../model/organizationSettingsContext.ts | 3 +
...organizationSettingsContextComputerMode.ts | 15 +
app/src/lib/api/generated/model/person.ts | 4 +-
.../api/generated/model/personRoleAnswer.ts | 8 +
.../lib/api/generated/model/preferences.ts | 11 +
app/src/lib/api/generated/model/problem.ts | 6 +
.../model/recordNudgeEventHeaders.ts | 13 +
.../model/replaceAiConnectionHeaders.ts | 13 +
.../model/respondToQuestionRequest.ts | 2 +-
.../generated/model/reviewerGuidanceInput.ts | 2 +-
.../model/reviewerGuidanceReplayInput.ts | 2 +-
app/src/lib/api/generated/model/routine.ts | 2 +
.../lib/api/generated/model/routineLastRun.ts | 3 +-
.../generated/model/routineLastRunStatus.ts | 18 -
app/src/lib/api/generated/model/routineRun.ts | 3 +-
.../api/generated/model/routineRunStatus.ts | 17 -
.../model/samlIdentityProviderRequest.ts | 2 +-
.../api/generated/model/sharedUseRequest.ts | 3 +-
.../generated/model/sharedUseRequestStatus.ts | 16 -
.../lib/api/generated/model/signInStatus.ts | 13 +-
app/src/lib/api/generated/model/taskStatus.ts | 10 +-
.../api/generated/model/unverifiedModel.ts | 13 +
.../model/updateOrganizationRequest.ts | 2 +-
.../model/updatePreferencesRequest.ts | 6 +
.../generated/model/updateRoutineHeaders.ts | 13 +
.../generated/model/updateRoutineRequest.ts | 35 +
.../api/generated/model/updateTeamRequest.ts | 2 +-
.../lib/api/generated/model/whatIfQuestion.ts | 2 +-
.../lib/api/generated/models/models.msw.ts | 92 +-
app/src/lib/api/generated/models/models.ts | 367 ++
.../lib/api/generated/models/models.zod.ts | 330 ++
.../network-policies/network-policies.zod.ts | 12 +-
.../organization-settings.msw.ts | 9 +
.../organization-settings.ts | 2 +-
.../organization-settings.zod.ts | 151 +-
.../organizations/organizations.zod.ts | 44 +-
.../lib/api/generated/people/people.msw.ts | 4 +
.../lib/api/generated/people/people.zod.ts | 133 +-
.../product-events/product-events.msw.ts | 30 +-
.../product-events/product-events.ts | 150 +
.../product-events/product-events.zod.ts | 62 +
.../reviewer-guidance.zod.ts | 6 +-
.../api/generated/routines/routines.msw.ts | 66 +
.../lib/api/generated/routines/routines.ts | 162 +-
.../api/generated/routines/routines.zod.ts | 196 +-
.../generated/shared-use/shared-use.zod.ts | 8 +-
.../sign-in-requests/sign-in-requests.zod.ts | 99 +-
app/src/lib/api/generated/tasks/tasks.zod.ts | 48 +-
app/src/lib/api/generated/teams/teams.zod.ts | 8 +-
.../lib/api/generated/what-if/what-if.zod.ts | 2 +-
app/src/lib/app-access/queries.ts | 3 +-
app/src/lib/auth/client.ts | 6 +-
app/src/lib/auth/queries.ts | 4 +-
app/src/lib/auth/roles.ts | 16 +
app/src/lib/capability-changes/queries.ts | 7 +-
app/src/lib/channels/attachments.ts | 8 +
app/src/lib/channels/turn-did-work.ts | 27 +
app/src/lib/channels/use-channel-events.ts | 15 +-
app/src/lib/client-version/refusal.ts | 98 +
app/src/lib/client.ts | 50 +-
app/src/lib/computers/activity.ts | 29 +-
app/src/lib/computers/panel-view.ts | 1 +
app/src/lib/computers/queries.ts | 6 +-
app/src/lib/computers/sent-file.ts | 63 +
app/src/lib/copilot/approval-tools.tsx | 3 +
app/src/lib/copilot/computer-tools.tsx | 62 +
app/src/lib/copilot/provider.tsx | 4 +-
app/src/lib/deployment/queries.ts | 112 +
app/src/lib/desktop/speech.ts | 3 +
app/src/lib/dictation/live.ts | 216 +-
app/src/lib/enterprise/queries.ts | 47 +-
app/src/lib/groups.ts | 26 +-
app/src/lib/identity/queries.ts | 6 +-
app/src/lib/markdown.tsx | 36 +-
app/src/lib/models/queries.ts | 6 +
app/src/lib/models/run-model.ts | 24 +-
app/src/lib/notices.ts | 130 +
app/src/lib/openbot-for-business.ts | 60 +-
app/src/lib/organizations/mutations.ts | 4 +-
app/src/lib/organizations/words.ts | 41 +-
app/src/lib/people/mutations.ts | 40 +-
app/src/lib/people/queries.ts | 16 +-
app/src/lib/plugins/consent-handoff.ts | 21 +-
app/src/lib/plugins/finish-on-return.ts | 2 +
app/src/lib/product-telemetry.ts | 8 +
app/src/lib/routines/form.ts | 57 +-
app/src/lib/routines/mutations.ts | 26 +-
app/src/lib/settings/message-list.ts | 43 +
app/src/lib/tasks/groups.ts | 17 +-
app/src/lib/tasks/queries.ts | 16 +-
app/src/routes/__root.tsx | 6 +-
app/src/routes/_authed/_app/bot.tsx | 14 +
app/src/routes/_authed/_app/channel/new.tsx | 3 +
app/src/routes/_authed/_app/index.tsx | 7 +-
app/src/routes/_authed/admin/index.tsx | 5 +-
app/src/routes/_authed/admin/learning.tsx | 32 +-
app/src/routes/_authed/settings/index.tsx | 3 +
app/tests/admin-personal-edition.test.tsx | 31 +
app/tests/admin-settings-api.ts | 3 +-
app/tests/ai-connection-dialog.fixture.tsx | 75 +
app/tests/ai-connection-dialog.test.tsx | 587 ++++
app/tests/ai-connection-providers.test.ts | 64 +
app/tests/app-navigation.test.tsx | 1 +
app/tests/bot-setup-engine.test.tsx | 117 +
app/tests/browser-nav-item.test.tsx | 1 +
app/tests/channel-chat.test.ts | 35 +
app/tests/channel-failed-run-restore.test.tsx | 75 +
app/tests/channel-history-refresh.test.tsx | 41 +-
app/tests/channel-join-replay.test.tsx | 5 +-
app/tests/channel-pagination.test.tsx | 2 +
app/tests/client-name-header.test.ts | 99 +
app/tests/client-version-gate.test.tsx | 454 +++
app/tests/composer-attachment-limits.test.tsx | 135 +
app/tests/composer-attachment-strip.test.tsx | 35 +-
app/tests/composer-attachments-ui.test.tsx | 23 +
app/tests/composer-attachments.test.ts | 22 +-
.../composer-dictation-language.fixture.tsx | 65 +
.../composer-dictation-language.test.tsx | 247 ++
app/tests/composer-live-dictation.test.tsx | 76 +
app/tests/composer-paste.test.tsx | 13 +-
app/tests/connect-app-card.test.tsx | 9 +-
app/tests/consent-handoff.fixture.tsx | 17 +-
app/tests/consent-handoff.test.tsx | 350 +-
app/tests/conversations-api.ts | 3 +
app/tests/dictation-language-fallback.test.ts | 151 +
app/tests/goal-page-starts.test.tsx | 1 +
app/tests/group-sender-name.test.tsx | 176 +
app/tests/group-sent-file.test.tsx | 185 +
app/tests/group-share-notice.test.tsx | 225 ++
app/tests/handoff-share-on-board.test.tsx | 9 +-
app/tests/large-picture-tile.fixture.tsx | 58 +
app/tests/large-picture-tile.test.tsx | 277 ++
app/tests/learning-admin.test.tsx | 2 +-
app/tests/narrow-sidebar-sheet.test.tsx | 1 +
app/tests/new-bot-sheet.test.tsx | 7 +-
.../new-conversation-attachments.test.tsx | 18 +-
app/tests/office-file-cards.test.tsx | 104 +
app/tests/organization-invitations.test.tsx | 3 +-
app/tests/page-fetch.ts | 33 +
app/tests/personal-settings.test.tsx | 15 +-
app/tests/routine-delete-returns.test.tsx | 1 +
app/tests/routine-edit.test.tsx | 284 ++
app/tests/routine-event-words.test.ts | 1 +
.../routines-conversation-title.test.tsx | 2 +
app/tests/routines-discovery.test.tsx | 1 +
.../routines-list-follows-changes.test.tsx | 1 +
app/tests/routines-merged.test.tsx | 1 +
app/tests/routines-title.test.tsx | 2 +
app/tests/self-host-banner.test.tsx | 2 +
app/tests/sent-file-card.test.tsx | 187 +
app/tests/sent-file-in-a-task.test.tsx | 334 ++
.../settings-ai-connection-desktop.test.tsx | 256 ++
app/tests/share-preview-files.test.tsx | 184 +
app/tests/skins-account.test.tsx | 1 +
app/tests/skins-openfuse.test.tsx | 1 +
app/tests/star-on-github-setting.test.tsx | 157 +
app/tests/star-prompt.test.tsx | 493 +++
app/tests/tolerant-reader.test.ts | 117 +
app/tests/tool-line-wrap.test.tsx | 42 +
app/tests/transcript-attachments.test.tsx | 162 +-
app/tests/unknown-enum-values.test.tsx | 346 ++
app/tests/user-preferences.test.tsx | 4 +
biome.json | 3 +-
bun.lock | 22 +-
bunfig.toml | 4 +
desktop/TELEMETRY.md | 6 +
desktop/scripts/local-build.sh | 9 +-
desktop/scripts/upgrade-legs.test.ts | 105 +
desktop/scripts/upgrade-legs.ts | 141 +
desktop/scripts/verify-mac-arch.test.ts | 53 +-
desktop/src-tauri/Cargo.lock | 60 +
desktop/src-tauri/Cargo.toml | 3 +
desktop/src-tauri/build.rs | 11 +
.../src-tauri/gen/schemas/acl-manifests.json | 2 +-
.../src-tauri/gen/schemas/desktop-schema.json | 108 +
.../src-tauri/gen/schemas/macOS-schema.json | 108 +
desktop/src-tauri/src/ai_connection.rs | 1134 +++++-
desktop/src-tauri/src/client_version.rs | 505 +++
desktop/src-tauri/src/connected/address.rs | 107 +-
.../src/connected/fake_openbot_tests.rs | 36 +-
desktop/src-tauri/src/connected/mod.rs | 40 +-
desktop/src-tauri/src/connected/relay.rs | 227 +-
desktop/src-tauri/src/connected/sign_in.rs | 43 +
desktop/src-tauri/src/deployment.rs | 15 +
desktop/src-tauri/src/deployment_release.rs | 433 ++-
desktop/src-tauri/src/desktop_connected.rs | 22 +-
desktop/src-tauri/src/desktop_connection.rs | 1 +
desktop/src-tauri/src/desktop_page.rs | 174 +-
desktop/src-tauri/src/desktop_telemetry.rs | 33 +-
desktop/src-tauri/src/docker_desktop.rs | 6 +
desktop/src-tauri/src/early_downloads.rs | 11 +-
.../src-tauri/src/early_downloads/tests.rs | 32 +-
desktop/src-tauri/src/engine.rs | 14 +
desktop/src-tauri/src/env.rs | 301 +-
desktop/src-tauri/src/harness.rs | 167 +-
desktop/src-tauri/src/host_access.rs | 32 +-
desktop/src-tauri/src/lib.rs | 2 +
desktop/src-tauri/src/local_eval.rs | 989 +++++-
desktop/src-tauri/src/local_images.rs | 43 +-
desktop/src-tauri/src/main.rs | 3070 ++++++++++++++++-
desktop/src-tauri/src/outside_links.rs | 3 +-
desktop/src-tauri/src/plan.rs | 29 +-
desktop/src-tauri/src/preparation.rs | 200 +-
.../src/preparation/plan_image_tests.rs | 311 ++
desktop/src-tauri/src/problem.rs | 158 +-
desktop/src-tauri/src/quiet.rs | 133 +-
desktop/src-tauri/src/recorder_host.rs | 34 +-
desktop/src-tauri/src/recorder_install.rs | 15 +-
desktop/src-tauri/src/release_images.rs | 42 +-
desktop/src-tauri/src/saved_intent.rs | 35 +
desktop/src-tauri/src/security_floor.rs | 700 ++++
.../src-tauri/src/security_floor_ipc_tests.rs | 228 ++
desktop/src-tauri/src/speech.rs | 121 +-
desktop/src-tauri/src/speech/diagnostics.rs | 7 +-
desktop/src-tauri/src/stack.rs | 1249 ++++++-
desktop/src-tauri/src/stop_ipc_tests.rs | 93 +
desktop/src-tauri/src/telemetry.rs | 301 +-
desktop/src-tauri/src/test_support.rs | 118 +-
desktop/src-tauri/src/troubleshooting.rs | 225 +-
desktop/src-tauri/src/update_ready.rs | 13 +-
desktop/src-tauri/src/upgrade.rs | 92 +
.../src-tauri/src/upgrade_release_tests.rs | 500 +++
desktop/src-tauri/src/vault.rs | 47 +-
desktop/src-tauri/src/windows.rs | 869 ++++-
.../local-eval/update-did-not-finish.json | 3 +
.../release-manifest-v1.1.0.json | 117 +
desktop/src-tauri/tests/fixtures/engine.rs | 83 +-
desktop/src-tauri/tests/recorder_host.rs | 15 +-
desktop/src/App.test.tsx | 988 +++++-
desktop/src/App.tsx | 243 +-
desktop/src/BusinessBooker.tsx | 261 ++
desktop/src/ConnectToOpenBot.tsx | 68 +-
desktop/src/EarlyDownloads.test.tsx | 1 +
desktop/src/LocalIntelligence.test.tsx | 229 ++
desktop/src/LocalIntelligence.tsx | 148 +-
desktop/src/Mark.tsx | 10 +
desktop/src/Problem.test.tsx | 153 +-
desktop/src/Problem.tsx | 27 +-
desktop/src/ProviderPicker.test.tsx | 77 +-
desktop/src/ProviderPicker.tsx | 41 +-
desktop/src/SecurityFloor.test.tsx | 141 +
desktop/src/SecurityFloor.tsx | 139 +
desktop/src/SelfContained.tsx | 41 +
desktop/src/StatusWindow.test.tsx | 199 +-
desktop/src/StatusWindow.tsx | 210 +-
desktop/src/UpdateOffer.tsx | 4 +
desktop/src/UpdateOpenBot.tsx | 218 ++
desktop/src/Welcome.tsx | 235 +-
desktop/src/harness.ts | 16 +-
desktop/src/localEvalCli.ts | 18 +
desktop/src/localReadiness.test.ts | 66 +-
desktop/src/localReadiness.ts | 64 +-
desktop/src/main.tsx | 11 +-
desktop/src/setupLayout.browser.test.ts | 955 ++++-
desktop/src/styles.css | 381 +-
desktop/src/telemetry.test.ts | 6 +
desktop/src/telemetry.ts | 1 +
docker-compose.yml | 196 +-
docs/README.md | 1 +
docs/TELEMETRY.md | 14 +-
docs/api-versioning.md | 376 ++
docs/configuration.md | 18 +-
docs/deployment.md | 4 +
docs/desktop-updates.md | 4 +
docs/releasing.md | 269 +-
docs/telemetry-queries.sql | 22 +
extension/src/background/connection.ts | 19 +-
extension/src/background/index.ts | 15 +-
extension/src/background/recording.ts | 8 +-
extension/src/background/router.ts | 2 +
extension/src/background/security-floor.ts | 260 ++
extension/src/pages/connect/main.tsx | 7 +-
extension/src/pages/options/main.tsx | 7 +-
extension/src/pages/popup/desktop-sentence.ts | 7 +-
extension/src/pages/popup/main.tsx | 7 +-
extension/src/pages/setup/main.tsx | 7 +-
extension/src/pages/ui/page.tsx | 2 +-
extension/src/pages/ui/security-floor.tsx | 109 +
extension/src/protocol/messages.ts | 4 +
extension/src/shared/generated/recorder.ts | 6 +
extension/src/shared/openbot-client.ts | 56 +-
.../src/shared/security-floor-addresses.ts | 10 +
extension/src/shared/storage.ts | 4 +
extension/tests/connection.test.ts | 103 +-
extension/tests/install-setup.test.ts | 9 +-
extension/tests/launcher.test.ts | 17 +-
extension/tests/openbot-client.test.ts | 37 +
extension/tests/recording.test.ts | 60 +
extension/tests/security-floor-popup.test.tsx | 119 +
extension/tests/security-floor.test.ts | 342 ++
extension/tests/support/chrome-fake.ts | 43 +-
mobile/app.config.ts | 10 +-
mobile/app/_layout.tsx | 38 +-
mobile/app/bot.tsx | 10 +-
mobile/app/computer.tsx | 3 +-
mobile/app/needs-you.tsx | 9 +-
mobile/app/routine.tsx | 14 +-
mobile/package-lock.json | 16 +
mobile/package.json | 1 +
.../generated/conversations/conversations.ts | 2 +-
.../src/api/generated/model/allowlistEntry.ts | 2 +-
.../api/generated/model/appAccessRequest.ts | 3 +-
.../generated/model/appAccessRequestStatus.ts | 16 -
.../model/approvalRuleDraftAuthoring.ts | 2 +-
.../model/approvalRuleDraftDescription.ts | 2 +-
.../generated/model/approvalRulePattern.ts | 2 +-
.../src/api/generated/model/approvalStatus.ts | 11 +-
.../api/generated/model/attachmentLimits.ts | 24 +
.../api/generated/model/botDeclineReport.ts | 2 +-
.../model/botGrantChangesAuthoring.ts | 2 +-
.../generated/model/botGrantDescription.ts | 2 +-
mobile/src/api/generated/model/checkIn.ts | 3 +-
mobile/src/api/generated/model/checkInItem.ts | 3 +-
.../api/generated/model/checkInItemStatus.ts | 16 -
.../api/generated/model/checkInLastStatus.ts | 13 -
.../src/api/generated/model/clientRelease.ts | 9 +
.../generated/model/computerControlRequest.ts | 3 +-
.../model/computerControlRequestStatus.ts | 15 -
.../src/api/generated/model/computerState.ts | 9 +-
.../generated/model/conversationMessage.ts | 13 +-
.../model/conversationMessageStatus.ts | 17 -
.../api/generated/model/createBotRequest.ts | 2 +-
.../model/createBotRequestHarness.ts | 3 +-
.../model/createOrganizationRequest.ts | 2 +-
mobile/src/api/generated/model/deployment.ts | 22 +
mobile/src/api/generated/model/index.ts | 16 +-
mobile/src/api/generated/model/invitation.ts | 3 +-
.../api/generated/model/invitationStatus.ts | 17 -
.../src/api/generated/model/memorySource.ts | 3 +-
.../generated/model/memorySourceSyncStatus.ts | 13 -
.../src/api/generated/model/minimumClients.ts | 14 +
.../src/api/generated/model/organization.ts | 4 +-
.../generated/model/organizationInvitation.ts | 3 +-
.../model/organizationInvitationStatus.ts | 15 -
.../api/generated/model/organizationMember.ts | 6 +-
.../model/organizationSettingsContext.ts | 3 +
...organizationSettingsContextComputerMode.ts | 15 +
.../api/generated/model/personRoleAnswer.ts | 8 +
mobile/src/api/generated/model/problem.ts | 6 +
.../model/respondToQuestionRequest.ts | 2 +-
mobile/src/api/generated/model/routine.ts | 2 +
.../src/api/generated/model/routineLastRun.ts | 3 +-
.../generated/model/routineLastRunStatus.ts | 18 -
mobile/src/api/generated/model/routineRun.ts | 3 +-
.../api/generated/model/routineRunStatus.ts | 17 -
mobile/src/api/generated/model/taskStatus.ts | 10 +-
.../model/updateOrganizationRequest.ts | 2 +-
.../generated/model/updateRoutineRequest.ts | 35 +
.../organization-settings.ts | 2 +-
mobile/src/api/generated/routines/routines.ts | 55 +-
mobile/src/api/index.ts | 1 -
mobile/src/api/request.ts | 39 +-
mobile/src/auth.ts | 3 +
mobile/src/check-ins.tsx | 36 +-
mobile/src/client-version.ts | 177 +
mobile/src/colors.ts | 9 +
mobile/src/floor-gate.tsx | 172 +
mobile/src/release.ts | 19 +
mobile/src/routines.ts | 24 +-
mobile/src/security-floor-addresses.ts | 10 +
mobile/src/security-floor-check.ts | 86 +
mobile/src/security-floor.json | 4 +
mobile/src/security-floor.ts | 351 ++
mobile/src/tasks.ts | 36 +
mobile/src/ui.tsx | 10 +-
mobile/src/version-check.ts | 43 +
mobile/src/version-gate.tsx | 110 +
mobile/tests/client-version.test.ts | 73 +
mobile/tests/generated-client.test.ts | 205 ++
mobile/tests/security-floor.test.ts | 248 ++
mobile/tests/tolerant-reader.test.ts | 132 +
mobile/tests/unknown-statuses.test.ts | 41 +
package.json | 2 +
scripts/check-launcher-inputs.ts | 245 ++
scripts/downloads-fakes.ts | 28 +-
scripts/downloads-sync.sh | 10 +-
scripts/downloads-sync.test.ts | 17 +-
.../launcher-contracts/launcher-api-1.json | 109 +
scripts/model-compat-langgraph-ts.test.ts | 351 ++
scripts/model-compat.test.ts | 403 +++
scripts/model-compat.ts | 1748 ++++++++++
scripts/model-lock.test.ts | 415 +++
scripts/release-fakes.ts | 45 +
scripts/release-make-latest.sh | 28 +-
scripts/release-manifest.ts | 56 +-
scripts/release-older-installers.fixture.json | 480 +++
scripts/release-older-installers.sh | 198 ++
scripts/release-older-installers.test.ts | 387 +++
scripts/release-security-floor.sh | 72 +
scripts/release-security-floor.test.ts | 140 +
scripts/security-floor-sign.test.ts | 87 +
scripts/security-floor-sign.ts | 210 ++
scripts/start-restart-guard.test.ts | 12 +-
scripts/start.sh | 13 +-
scripts/support-window.ts | 412 +++
scripts/update-local.ts | 1 +
shared/api-deprecations.ts | 472 +++
shared/attachments.test.ts | 164 +
shared/attachments.ts | 337 +-
shared/audit-words.ts | 1 +
shared/bot-prompt.ts | 2 +
shared/client-version.ts | 263 ++
shared/fixtures/client-version/cases.json | 319 ++
.../model-listings/anthropic-models.json | 1327 +++++++
.../model-listings/openai-models.json | 705 ++++
.../model-lock-before-claude-code-bump.json | 36 +
shared/fixtures/security-floor/cases.json | 45 +
shared/fixtures/security-floor/generate.ts | 108 +
shared/harnesses.json | 14 +
shared/harnesses.test.ts | 44 +
shared/harnesses.ts | 18 +-
shared/learning.ts | 6 +-
shared/marks.test.ts | 36 +
shared/marks/README.md | 8 +
shared/marks/aws.svg | 1 +
shared/marks/azure.svg | 1 +
shared/marks/google-cloud.svg | 1 +
shared/marks/kubernetes.svg | 1 +
shared/marks/mastra.svg | 2 +-
shared/model-lock.json | 1203 +++++++
shared/model-lock.test.ts | 144 +
shared/model-lock.ts | 109 +
shared/model-providers.json | 1 +
shared/model-providers.test.ts | 44 +-
shared/model-providers.ts | 9 +-
shared/model_providers.py | 33 +
shared/notices.ts | 42 +
shared/openbot-for-business.ts | 135 +
shared/security-floor.json | 4 +
shared/security-floor.ts | 351 ++
shared/send-file.ts | 29 +
shared/tests/api-deprecations.test.ts | 291 ++
shared/tests/client-version.test.ts | 195 ++
shared/tests/security-floor.test.ts | 194 ++
shared/tool-name.ts | 6 +
shared/user-preferences.ts | 13 +
tests/compose.test.ts | 361 +-
.../support-window/releases-2026-11-17.json | 212 ++
tests/launcher-inputs.test.ts | 143 +
tests/release-charts.test.ts | 14 +-
tests/release-policy.test.ts | 90 +-
tests/security-floor-addresses.test.ts | 52 +
tests/support-window.test.ts | 275 ++
tests/support/release-files.ts | 12 +-
681 files changed, 61640 insertions(+), 3727 deletions(-)
create mode 100644 .github/workflows/desktop-upgrade.yml
create mode 100644 .github/workflows/model-compat.yml
create mode 100644 .github/workflows/model-lock.yml
create mode 100644 .github/workflows/security-floor.yml
create mode 100644 agent-ag2/tests/test_responses_api.py
create mode 100644 agent-claude-sdk/tests/test_claude_code_version.py
create mode 100644 agent-claude-sdk/tests/test_tool_not_offered.py
create mode 100644 agent-langgraph-ts/Dockerfile
create mode 100644 agent-langgraph-ts/package-lock.json
create mode 100644 agent-langgraph-ts/package.json
create mode 100644 agent-langgraph-ts/src/errors.ts
create mode 100644 agent-langgraph-ts/src/history.ts
create mode 100644 agent-langgraph-ts/src/json-modules.ts
create mode 100644 agent-langgraph-ts/src/main.ts
create mode 100644 agent-langgraph-ts/src/models.ts
create mode 100644 agent-langgraph-ts/src/plan-model.ts
create mode 100644 agent-langgraph-ts/src/run.ts
create mode 100644 agent-langgraph-ts/src/server.ts
create mode 100644 agent-langgraph-ts/test/claude-plan.test.ts
create mode 100644 agent-langgraph-ts/test/errors.test.ts
create mode 100644 agent-langgraph-ts/test/fake-provider.ts
create mode 100644 agent-langgraph-ts/test/fixtures/claude-model/text.sse
create mode 100644 agent-langgraph-ts/test/fixtures/claude-model/tool.sse
create mode 100644 agent-langgraph-ts/test/fixtures/plan-harness/bad-key.sse
create mode 100644 agent-langgraph-ts/test/fixtures/plan-harness/parallel.sse
create mode 100644 agent-langgraph-ts/test/fixtures/plan-harness/refused.sse
create mode 100644 agent-langgraph-ts/test/fixtures/plan-harness/text.sse
create mode 100644 agent-langgraph-ts/test/graph.test.ts
create mode 100644 agent-langgraph-ts/test/helpers.ts
create mode 100644 agent-langgraph-ts/test/history.test.ts
create mode 100644 agent-langgraph-ts/test/model-gateway.ts
create mode 100644 agent-langgraph-ts/test/model-route.test.ts
create mode 100644 agent-langgraph-ts/test/plan-model.test.ts
create mode 100644 agent-langgraph-ts/test/request-shape.test.ts
create mode 100644 agent-langgraph-ts/test/responses-rule.test.ts
create mode 100644 agent-langgraph-ts/test/server.test.ts
create mode 100644 agent-langgraph-ts/tsconfig.json
create mode 100644 agent-langroid/tests/test_responses_api.py
create mode 100644 api/openapi-ai-connection.test.ts
create mode 100644 api/openapi-extensible-enums.test.ts
create mode 100644 api/openapi-text-patterns.test.ts
create mode 100644 app/src/components/admin/shared-computers-notice.tsx
create mode 100644 app/src/components/channels/attachment-view.tsx
create mode 100644 app/src/components/channels/file-icon.tsx
create mode 100644 app/src/components/channels/sent-file-card.tsx
create mode 100644 app/src/components/layout/client-version-gate.tsx
create mode 100644 app/src/components/routines/edit-routine-dialog.tsx
create mode 100644 app/src/components/routines/schedule-when.tsx
create mode 100644 app/src/components/settings/star-on-github.tsx
create mode 100644 app/src/components/star-prompt/star-prompt.tsx
create mode 100644 app/src/lib/ai-connection/describe.ts
create mode 100644 app/src/lib/ai-connection/desktop.ts
create mode 100644 app/src/lib/ai-connection/mutations.ts
create mode 100644 app/src/lib/ai-connection/providers.ts
create mode 100644 app/src/lib/ai-connection/queries.ts
create mode 100644 app/src/lib/api/generated/model/aiConnection.ts
create mode 100644 app/src/lib/api/generated/model/aiConnectionFixedResponse.ts
create mode 100644 app/src/lib/api/generated/model/aiConnectionInput.ts
create mode 100644 app/src/lib/api/generated/model/aiConnectionLogin.ts
create mode 100644 app/src/lib/api/generated/model/aiConnectionProvider.ts
create mode 100644 app/src/lib/api/generated/model/aiConnectionRefusedResponse.ts
create mode 100644 app/src/lib/api/generated/model/aiConnectionSaved.ts
create mode 100644 app/src/lib/api/generated/model/aiConnectionSource.ts
delete mode 100644 app/src/lib/api/generated/model/appAccessRequestStatus.ts
create mode 100644 app/src/lib/api/generated/model/attachmentLimits.ts
delete mode 100644 app/src/lib/api/generated/model/capabilityAnswerDecidedBy.ts
delete mode 100644 app/src/lib/api/generated/model/checkInItemStatus.ts
delete mode 100644 app/src/lib/api/generated/model/checkInLastStatus.ts
create mode 100644 app/src/lib/api/generated/model/clientRelease.ts
delete mode 100644 app/src/lib/api/generated/model/computerControlRequestStatus.ts
delete mode 100644 app/src/lib/api/generated/model/conversationMessageStatus.ts
delete mode 100644 app/src/lib/api/generated/model/goalRunStatus.ts
delete mode 100644 app/src/lib/api/generated/model/goalStatus.ts
create mode 100644 app/src/lib/api/generated/model/invalidAiConnectionResponse.ts
delete mode 100644 app/src/lib/api/generated/model/invitationStatus.ts
delete mode 100644 app/src/lib/api/generated/model/learningProposalStatus.ts
delete mode 100644 app/src/lib/api/generated/model/learningRunStatus.ts
delete mode 100644 app/src/lib/api/generated/model/linkedAccountStatus.ts
delete mode 100644 app/src/lib/api/generated/model/memorySourceSyncStatus.ts
create mode 100644 app/src/lib/api/generated/model/minimumClients.ts
delete mode 100644 app/src/lib/api/generated/model/networkPolicyScopeKind.ts
create mode 100644 app/src/lib/api/generated/model/noticeId.ts
create mode 100644 app/src/lib/api/generated/model/nudgeEvent.ts
create mode 100644 app/src/lib/api/generated/model/nudgeEventAction.ts
create mode 100644 app/src/lib/api/generated/model/nudgeEventPlace.ts
create mode 100644 app/src/lib/api/generated/model/nudgeEventSurface.ts
delete mode 100644 app/src/lib/api/generated/model/organizationInvitationStatus.ts
create mode 100644 app/src/lib/api/generated/model/organizationSettingsContextComputerMode.ts
create mode 100644 app/src/lib/api/generated/model/personRoleAnswer.ts
create mode 100644 app/src/lib/api/generated/model/recordNudgeEventHeaders.ts
create mode 100644 app/src/lib/api/generated/model/replaceAiConnectionHeaders.ts
delete mode 100644 app/src/lib/api/generated/model/routineLastRunStatus.ts
delete mode 100644 app/src/lib/api/generated/model/routineRunStatus.ts
delete mode 100644 app/src/lib/api/generated/model/sharedUseRequestStatus.ts
create mode 100644 app/src/lib/api/generated/model/unverifiedModel.ts
create mode 100644 app/src/lib/api/generated/model/updateRoutineHeaders.ts
create mode 100644 app/src/lib/api/generated/model/updateRoutineRequest.ts
create mode 100644 app/src/lib/channels/turn-did-work.ts
create mode 100644 app/src/lib/client-version/refusal.ts
create mode 100644 app/src/lib/computers/sent-file.ts
create mode 100644 app/src/lib/notices.ts
create mode 100644 app/tests/ai-connection-dialog.fixture.tsx
create mode 100644 app/tests/ai-connection-dialog.test.tsx
create mode 100644 app/tests/ai-connection-providers.test.ts
create mode 100644 app/tests/bot-setup-engine.test.tsx
create mode 100644 app/tests/client-name-header.test.ts
create mode 100644 app/tests/client-version-gate.test.tsx
create mode 100644 app/tests/composer-attachment-limits.test.tsx
create mode 100644 app/tests/composer-dictation-language.fixture.tsx
create mode 100644 app/tests/composer-dictation-language.test.tsx
create mode 100644 app/tests/dictation-language-fallback.test.ts
create mode 100644 app/tests/group-sender-name.test.tsx
create mode 100644 app/tests/group-sent-file.test.tsx
create mode 100644 app/tests/group-share-notice.test.tsx
create mode 100644 app/tests/large-picture-tile.fixture.tsx
create mode 100644 app/tests/large-picture-tile.test.tsx
create mode 100644 app/tests/office-file-cards.test.tsx
create mode 100644 app/tests/page-fetch.ts
create mode 100644 app/tests/routine-edit.test.tsx
create mode 100644 app/tests/sent-file-card.test.tsx
create mode 100644 app/tests/sent-file-in-a-task.test.tsx
create mode 100644 app/tests/settings-ai-connection-desktop.test.tsx
create mode 100644 app/tests/share-preview-files.test.tsx
create mode 100644 app/tests/star-on-github-setting.test.tsx
create mode 100644 app/tests/star-prompt.test.tsx
create mode 100644 app/tests/tolerant-reader.test.ts
create mode 100644 app/tests/unknown-enum-values.test.tsx
create mode 100644 desktop/scripts/upgrade-legs.test.ts
create mode 100644 desktop/scripts/upgrade-legs.ts
create mode 100644 desktop/src-tauri/src/client_version.rs
create mode 100644 desktop/src-tauri/src/preparation/plan_image_tests.rs
create mode 100644 desktop/src-tauri/src/security_floor.rs
create mode 100644 desktop/src-tauri/src/security_floor_ipc_tests.rs
create mode 100644 desktop/src-tauri/src/upgrade_release_tests.rs
create mode 100644 desktop/src-tauri/test-fixtures/release-manifest-v1.1.0.json
create mode 100644 desktop/src/BusinessBooker.tsx
create mode 100644 desktop/src/SecurityFloor.test.tsx
create mode 100644 desktop/src/SecurityFloor.tsx
create mode 100644 desktop/src/SelfContained.tsx
create mode 100644 desktop/src/UpdateOpenBot.tsx
create mode 100644 docs/api-versioning.md
create mode 100644 extension/src/background/security-floor.ts
create mode 100644 extension/src/pages/ui/security-floor.tsx
create mode 100644 extension/src/shared/security-floor-addresses.ts
create mode 100644 extension/tests/security-floor-popup.test.tsx
create mode 100644 extension/tests/security-floor.test.ts
delete mode 100644 mobile/src/api/generated/model/appAccessRequestStatus.ts
create mode 100644 mobile/src/api/generated/model/attachmentLimits.ts
delete mode 100644 mobile/src/api/generated/model/checkInItemStatus.ts
delete mode 100644 mobile/src/api/generated/model/checkInLastStatus.ts
create mode 100644 mobile/src/api/generated/model/clientRelease.ts
delete mode 100644 mobile/src/api/generated/model/computerControlRequestStatus.ts
delete mode 100644 mobile/src/api/generated/model/conversationMessageStatus.ts
delete mode 100644 mobile/src/api/generated/model/invitationStatus.ts
delete mode 100644 mobile/src/api/generated/model/memorySourceSyncStatus.ts
create mode 100644 mobile/src/api/generated/model/minimumClients.ts
delete mode 100644 mobile/src/api/generated/model/organizationInvitationStatus.ts
create mode 100644 mobile/src/api/generated/model/organizationSettingsContextComputerMode.ts
create mode 100644 mobile/src/api/generated/model/personRoleAnswer.ts
delete mode 100644 mobile/src/api/generated/model/routineLastRunStatus.ts
delete mode 100644 mobile/src/api/generated/model/routineRunStatus.ts
create mode 100644 mobile/src/api/generated/model/updateRoutineRequest.ts
create mode 100644 mobile/src/client-version.ts
create mode 100644 mobile/src/colors.ts
create mode 100644 mobile/src/floor-gate.tsx
create mode 100644 mobile/src/release.ts
create mode 100644 mobile/src/security-floor-addresses.ts
create mode 100644 mobile/src/security-floor-check.ts
create mode 100644 mobile/src/security-floor.json
create mode 100644 mobile/src/security-floor.ts
create mode 100644 mobile/src/tasks.ts
create mode 100644 mobile/src/version-check.ts
create mode 100644 mobile/src/version-gate.tsx
create mode 100644 mobile/tests/client-version.test.ts
create mode 100644 mobile/tests/security-floor.test.ts
create mode 100644 mobile/tests/tolerant-reader.test.ts
create mode 100644 mobile/tests/unknown-statuses.test.ts
create mode 100644 scripts/check-launcher-inputs.ts
create mode 100644 scripts/launcher-contracts/launcher-api-1.json
create mode 100644 scripts/model-compat-langgraph-ts.test.ts
create mode 100644 scripts/model-compat.test.ts
create mode 100644 scripts/model-compat.ts
create mode 100644 scripts/model-lock.test.ts
create mode 100644 scripts/release-older-installers.fixture.json
create mode 100755 scripts/release-older-installers.sh
create mode 100644 scripts/release-older-installers.test.ts
create mode 100755 scripts/release-security-floor.sh
create mode 100644 scripts/release-security-floor.test.ts
create mode 100644 scripts/security-floor-sign.test.ts
create mode 100644 scripts/security-floor-sign.ts
create mode 100644 scripts/support-window.ts
create mode 100644 shared/api-deprecations.ts
create mode 100644 shared/client-version.ts
create mode 100644 shared/fixtures/client-version/cases.json
create mode 100644 shared/fixtures/model-listings/anthropic-models.json
create mode 100644 shared/fixtures/model-listings/openai-models.json
create mode 100644 shared/fixtures/model-lock-before-claude-code-bump.json
create mode 100644 shared/fixtures/security-floor/cases.json
create mode 100644 shared/fixtures/security-floor/generate.ts
create mode 100644 shared/marks.test.ts
create mode 100644 shared/marks/aws.svg
create mode 100644 shared/marks/azure.svg
create mode 100644 shared/marks/google-cloud.svg
create mode 100644 shared/marks/kubernetes.svg
create mode 100644 shared/model-lock.json
create mode 100644 shared/model-lock.test.ts
create mode 100644 shared/model-lock.ts
create mode 100644 shared/notices.ts
create mode 100644 shared/openbot-for-business.ts
create mode 100644 shared/security-floor.json
create mode 100644 shared/security-floor.ts
create mode 100644 shared/send-file.ts
create mode 100644 shared/tests/api-deprecations.test.ts
create mode 100644 shared/tests/client-version.test.ts
create mode 100644 shared/tests/security-floor.test.ts
create mode 100644 tests/fixtures/support-window/releases-2026-11-17.json
create mode 100644 tests/launcher-inputs.test.ts
create mode 100644 tests/security-floor-addresses.test.ts
create mode 100644 tests/support-window.test.ts
diff --git a/.env.example b/.env.example
index 8d75b0b0fc..e3a080c01b 100644
--- a/.env.example
+++ b/.env.example
@@ -294,6 +294,13 @@ OPENAI_API_KEY=
# CLAUDE_CODE_OAUTH_TOKEN=
# CHATGPT_AUTH_FILE=
+# Where a ChatGPT plan's model calls go, for the TypeScript LangGraph engine and the server's own
+# Bots: the LangGraph harness (agent-langgraph-agui), which holds that plan's token store, by its
+# name on the Compose network. Set only with CHATGPT_AUTH_FILE. The token defaults to
+# MANAGED_AGENT_TOKEN. The desktop app sets this itself on a ChatGPT plan.
+# CHATGPT_PLAN_HARNESS_URL=http://agent-langgraph-agui:4206
+# CHATGPT_PLAN_HARNESS_TOKEN=
+
# Which model the framework Bot uses. Defaults per provider: gpt-5.5, claude-sonnet-5-5,
# gemini-2.5-flash. A 5.6 tier works here: set one and the Responses API is switched on
# automatically. It used to answer nothing at all on those models — RUN_STARTED, RUN_FINISHED, no
@@ -466,6 +473,11 @@ COMPUTER_TOKEN=
# the LangGraph harness (agent-langgraph-agui) on 4201 for a laptop.
# MANAGED_AGENT_AG_UI_URL=http://127.0.0.1:4201/
+# The TypeScript LangGraph engine (agent-langgraph-ts), which new Bots run on. Optional: unset, new
+# Bots run on the server's built-in engine. Called with MANAGED_AGENT_TOKEN, like the managed Bot.
+# `scripts/start.sh` points this at the engine on 4215 for a laptop.
+# LANGGRAPH_TS_AG_UI_URL=http://127.0.0.1:4215/
+
# Shared secret sent by the server on every call to a managed Bot, as the `x-openbot-agent-token`
# header. Required together with the URL above; the server starts without either.
#
diff --git a/.github/published-images.json b/.github/published-images.json
index 7a37472377..1cda646e08 100644
--- a/.github/published-images.json
+++ b/.github/published-images.json
@@ -3,6 +3,7 @@
"agent-llamaindex",
"agent-agno",
"agent-langgraph-agui",
+ "agent-langgraph-ts",
"agent-adk",
"agent-pydantic-ai",
"agent-microsoft",
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ac19d1ebe3..c4615f3730 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -46,6 +46,11 @@ jobs:
- run: bun run typecheck
- name: Desktop version tracks the release version
run: bun desktop/scripts/desktop-version.ts check
+ # What each recorded OpenBot Desktop launch hands Compose, read with this tree's
+ # docker-compose.yml by Compose itself: the file must take it, and must still hand the server
+ # everything the app of the published launcherApi gives it. See scripts/check-launcher-inputs.ts.
+ - name: Every recorded Desktop launch still starts this release's server
+ run: bun scripts/check-launcher-inputs.ts
# The API contract. api/openapi.yaml is the single source of truth every client is generated from,
# so four things are checked about it, each its own step so a red run names which:
@@ -63,15 +68,28 @@ jobs:
# base branch's spec with this one and fails on any breaking change, warnings included: a field a
# client reads going away is a warning to oasdiff and a broken screen to a person. A change that
# takes nothing from a client (a rule the server already enforced, now written in the spec) is
- # listed with its reason in api/accepted-breaking-changes.md, and only that change passes.
+ # listed with its reason in api/accepted-breaking-changes.md, and only that change passes. Every
+ # deprecation names its sunset (`x-sunset`), at least 365 days after the change that deprecates
+ # it, and nothing is removed before its sunset;
+ # - it breaks nothing a client of a release it still serves relies on. The same comparison against
+ # the spec of every release of the last 12 months, and the last release's, on every run, so a
+ # string of changes each harmless against its own base cannot add up to a break for an app people
+ # already have, and a change let through as one no release serves is checked against what each
+ # release really serves;
+ # - the support window holds (scripts/support-window.ts): no oldest-app minimum cuts off an app
+ # released in the last 12 months, and every deprecation's sunset is at least 365 days after the
+ # release that first served it deprecated.
api:
name: API spec
runs-on: ubuntu-latest
env:
# Pinned with its checksum, from https://github.com/oasdiff/oasdiff/releases. The spec never
# leaves the runner: the binary runs here, rather than the action, which uploads by default.
- OASDIFF_VERSION: 1.34.1
- OASDIFF_SHA256: 75775f65b0adebd26a8e013af51a799342dfdc6262d89efa9e3b7bdf89657d90
+ OASDIFF_VERSION: 1.38.0
+ OASDIFF_SHA256: 613037fd6a1d3362a1b742d6d86c338c0eb5ab3511f4942ce3948e78720ea2da
+ # The deprecation window (API versioning design, section 4.3): a deprecated operation,
+ # parameter or property keeps answering for at least this long, whatever its stability level.
+ DEPRECATION_DAYS: 365
REDOCLY_TELEMETRY: "off"
REDOCLY_SUPPRESS_UPDATE_NOTICE: "true"
steps:
@@ -107,6 +125,13 @@ jobs:
echo "::error::A generated client (${generated[*]}) is not what api/openapi.yaml generates. Run bun run api:generate and commit the result."
exit 1
fi
+ - name: Install oasdiff
+ run: |
+ set -euo pipefail
+ archive="$RUNNER_TEMP/oasdiff.tar.gz"
+ curl -fsSL -o "$archive" "https://github.com/oasdiff/oasdiff/releases/download/v${OASDIFF_VERSION}/oasdiff_${OASDIFF_VERSION}_linux_amd64.tar.gz"
+ echo "${OASDIFF_SHA256} $archive" | sha256sum -c -
+ tar -xzf "$archive" -C "$RUNNER_TEMP" oasdiff
- name: No breaking change against the base branch
if: github.event_name == 'pull_request'
env:
@@ -119,16 +144,72 @@ jobs:
exit 0
fi
git show FETCH_HEAD:api/openapi.yaml > "$RUNNER_TEMP/base-openapi.yaml"
- archive="$RUNNER_TEMP/oasdiff.tar.gz"
- curl -fsSL -o "$archive" "https://github.com/oasdiff/oasdiff/releases/download/v${OASDIFF_VERSION}/oasdiff_${OASDIFF_VERSION}_linux_amd64.tar.gz"
- echo "${OASDIFF_SHA256} $archive" | sha256sum -c -
- tar -xzf "$archive" -C "$RUNNER_TEMP" oasdiff
# A change listed in api/accepted-breaking-changes.md, with its reason, is let through; oasdiff
# matches each line by method, path and the change's own words, so nothing else is.
accepted=api/accepted-breaking-changes.md
+ # A deprecation made here must name its sunset, DEPRECATION_DAYS or more from today, and a
+ # sunset may not move earlier than the date clients were given. Removing anything deprecated
+ # before its sunset fails whatever the flags.
+ deprecation=(--deprecation-days-stable "$DEPRECATION_DAYS" --deprecation-days-beta "$DEPRECATION_DAYS")
# Twice: once readable in the log, once as annotations on the pull request's diff.
- "$RUNNER_TEMP/oasdiff" breaking "$RUNNER_TEMP/base-openapi.yaml" api/openapi.yaml --flatten-allof --err-ignore "$accepted" --warn-ignore "$accepted" || true
- "$RUNNER_TEMP/oasdiff" breaking "$RUNNER_TEMP/base-openapi.yaml" api/openapi.yaml --flatten-allof --fail-on WARN --format githubactions --err-ignore "$accepted" --warn-ignore "$accepted"
+ "$RUNNER_TEMP/oasdiff" breaking "$RUNNER_TEMP/base-openapi.yaml" api/openapi.yaml --flatten-allof "${deprecation[@]}" --err-ignore "$accepted" --warn-ignore "$accepted" || true
+ "$RUNNER_TEMP/oasdiff" breaking "$RUNNER_TEMP/base-openapi.yaml" api/openapi.yaml --flatten-allof "${deprecation[@]}" --fail-on WARN --format githubactions --err-ignore "$accepted" --warn-ignore "$accepted"
+ # Release names and dates are the published GitHub releases', the day each reached people.
+ - name: The published releases
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: gh release list --repo "$GITHUB_REPOSITORY" --limit 1000 --exclude-drafts --json tagName,publishedAt,isPrerelease > "$RUNNER_TEMP/releases.json"
+ # The spec of every release whose apps this tree's server still serves (scripts/support-window.ts
+ # held-releases): each release of the last 12 months at or below this tree's version, and the
+ # last release even once it has aged out, so a fix on a release branch is held to its own line.
+ # Each release's apps were built from its own spec and call this server, so the spec is held to
+ # each, not only to the last: a release in between need not have served everything an older one
+ # did. A release with no api/openapi.yaml predates this API and has no client of it.
+ #
+ # A line in api/accepted-breaking-changes.md that lets a change through because no release
+ # serves it yet ("no release serves it") is not applied here: if a release does serve it, that
+ # reason was wrong, and this fails. Every other line is, since its reason holds for any client.
+ #
+ # The deprecation window is not counted here: oasdiff counts it from today, and a deprecation
+ # made after the release is new against it on every run until the next one. The base-branch run
+ # counts it on the day the deprecation is made; scripts/support-window.ts counts it from the
+ # release that first served it.
+ - name: No breaking change against any release whose apps are served
+ run: |
+ set -euo pipefail
+ held="$(bun scripts/support-window.ts held-releases --releases "$RUNNER_TEMP/releases.json")"
+ if [ -z "$held" ]; then
+ echo "::notice::No release at or below this tree's version yet, so there is no released spec to hold to."
+ exit 0
+ fi
+ accepted="$RUNNER_TEMP/accepted-against-release.md"
+ grep -v -F 'no release serves it' api/accepted-breaking-changes.md > "$accepted" || true
+ failed=()
+ mapfile -t releases <<< "$held"
+ # One fetch for every release, each under a ref of its own, so a tag this checkout already
+ # holds is never in the way.
+ refspecs=()
+ for release in "${releases[@]}"; do refspecs+=("+refs/tags/$release:refs/held-releases/$release"); done
+ git fetch --no-tags --depth=1 origin "${refspecs[@]}"
+ for release in "${releases[@]}"; do
+ if ! git cat-file -e "refs/held-releases/$release:api/openapi.yaml" 2>/dev/null; then
+ echo "$release has no api/openapi.yaml, so no client of it uses this API."
+ continue
+ fi
+ echo "::group::Holding api/openapi.yaml to $release's"
+ git show "refs/held-releases/$release:api/openapi.yaml" > "$RUNNER_TEMP/release-openapi.yaml"
+ "$RUNNER_TEMP/oasdiff" breaking "$RUNNER_TEMP/release-openapi.yaml" api/openapi.yaml --flatten-allof --err-ignore "$accepted" --warn-ignore "$accepted" || true
+ echo "::endgroup::"
+ if ! "$RUNNER_TEMP/oasdiff" breaking "$RUNNER_TEMP/release-openapi.yaml" api/openapi.yaml --flatten-allof --fail-on WARN --format githubactions --err-ignore "$accepted" --warn-ignore "$accepted"; then
+ failed+=("$release")
+ fi
+ done
+ if [ "${#failed[@]}" -gt 0 ]; then
+ echo "::error::api/openapi.yaml breaks a client of ${failed[*]}, whose apps this server still serves."
+ exit 1
+ fi
+ - name: The 12-month support window holds
+ run: bun scripts/support-window.ts check --releases "$RUNNER_TEMP/releases.json"
# The live channels (api/asyncapi.yaml). The differences come from the AsyncAPI CLI, pinned in
# api/asyncapi-tools with its own lockfile so only this job installs it; what counts as breaking
# is decided in api/asyncapi-diff.ts, whose tests run here against real edits to the file.
@@ -204,14 +285,24 @@ jobs:
# and paint resolve, and the app following the system's light or dark, which only a
# browser's `prefers-color-scheme` reports, with what OpenBot Desktop's window is told of
# it, and a sign-in through Composio held on OpenBot's own step for its countdown before it
- # leaves, in this tab and in the new one a Bot's card opens. The
+ # leaves, in this tab and in the new one a Bot's card opens, and a picture over 8MB fetched
+ # only when it is opened, counted on the wire. The
# onboarding frame reads the generated app config, which `bun test` alone doesn't write (the
# test script's pretest does).
- run: |
bun run generate:app-config
- bun test app/tests/tool-line-reduced-motion.test.tsx app/tests/onboarding-window-buttons.test.tsx app/tests/onboarding-orb-room.test.tsx app/tests/transcript-rail-clearance.test.tsx app/tests/a2ui-frame.test.tsx app/tests/update-banner-layout.test.tsx app/tests/composer-dictation-notice-layout.test.tsx app/tests/conversation-intro-halo.test.tsx app/tests/transcript-room.test.tsx app/tests/skins-window-buttons.test.tsx app/tests/opendots-rail-badge.test.tsx app/tests/account-version-layout.test.tsx app/tests/organization-menu-names.test.tsx app/tests/bot-orb-one-color.test.tsx app/tests/theme-follows-system.test.tsx app/tests/desktop-window-theme.test.tsx app/tests/bot-screen-record-layout.test.tsx app/tests/teams-screens-layout.test.tsx app/tests/team-grants-screens-layout.test.tsx app/tests/needs-you-board-layout.test.tsx app/tests/checkbox-contrast.test.tsx app/tests/maths-rendering.test.tsx app/tests/task-report-chip.test.tsx app/tests/consent-handoff.test.tsx
+ bun test app/tests/tool-line-reduced-motion.test.tsx app/tests/onboarding-window-buttons.test.tsx app/tests/onboarding-orb-room.test.tsx app/tests/transcript-rail-clearance.test.tsx app/tests/a2ui-frame.test.tsx app/tests/update-banner-layout.test.tsx app/tests/composer-dictation-notice-layout.test.tsx app/tests/conversation-intro-halo.test.tsx app/tests/transcript-room.test.tsx app/tests/skins-window-buttons.test.tsx app/tests/opendots-rail-badge.test.tsx app/tests/account-version-layout.test.tsx app/tests/organization-menu-names.test.tsx app/tests/bot-orb-one-color.test.tsx app/tests/theme-follows-system.test.tsx app/tests/desktop-window-theme.test.tsx app/tests/bot-screen-record-layout.test.tsx app/tests/teams-screens-layout.test.tsx app/tests/team-grants-screens-layout.test.tsx app/tests/needs-you-board-layout.test.tsx app/tests/checkbox-contrast.test.tsx app/tests/maths-rendering.test.tsx app/tests/task-report-chip.test.tsx app/tests/consent-handoff.test.tsx app/tests/large-picture-tile.test.tsx
env:
OPENBOT_APP_BROWSER: '1'
+ # Dictation in the Desktop window on a Mac whose recognizer has no English (United Kingdom) on
+ # the device, in Chromium and in WebKit, the engine the Mac window draws with: it listens in the
+ # next language the recognizer has, or says which language to add and where. The page's
+ # language and its names for languages are the engine's own.
+ - run: bunx playwright-core install --with-deps webkit
+ - run: bun test app/tests/composer-dictation-language.test.tsx
+ env:
+ OPENBOT_APP_BROWSER: '1'
+ OPENBOT_APP_ENGINES: chromium,webkit
# The desktop setup window's, for the same reason: the AI step's form holding still while the
# install behind it comes and goes. It bundles the window from the desktop's own dependencies.
- run: bun install --frozen-lockfile
@@ -329,6 +420,25 @@ jobs:
- run: bun install --frozen-lockfile
- run: bun test app/tests/build-cache.test.ts
+ # The TypeScript LangGraph engine, the default Bot engine: its type check and its own tests, on the
+ # Node it ships on, from its own lockfile, as each Python harness below runs its own.
+ langgraph-ts:
+ name: typescript langgraph engine
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
+ with:
+ node-version: "22"
+ - run: npm ci
+ working-directory: agent-langgraph-ts
+ - run: npm run typecheck
+ working-directory: agent-langgraph-ts
+ - run: npm test
+ working-directory: agent-langgraph-ts
+
python-harness:
name: python harness regressions
# CPU-bound: runs on a 16-core larger runner (org runner group openbot-larger, billed per
@@ -521,7 +631,7 @@ jobs:
name: verify
runs-on: ubuntu-latest
if: always()
- needs: [static, api, mobile, app-browser, test, test-total, startup, python-harness, build, component-dockerfiles]
+ needs: [static, api, mobile, app-browser, test, test-total, startup, langgraph-ts, python-harness, build, component-dockerfiles]
steps:
- name: Require every check
env:
diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml
index a29f8ac9a8..e79c8f2654 100644
--- a/.github/workflows/desktop-build.yml
+++ b/.github/workflows/desktop-build.yml
@@ -289,6 +289,13 @@ jobs:
if: matrix.platform == 'linux'
run: cargo test --locked --lib update_ready::live -- --ignored --test-threads=1
working-directory: desktop/src-tauri
+ # The AI connection changed in the app, on the runner's Docker with this tree's Compose file:
+ # a plan's engine starts alone and stops alone, the picked Bot restarts alone, and the
+ # database never stops.
+ - name: AI connection change regression tests
+ if: matrix.platform == 'linux'
+ run: cargo test --locked --lib ai_connection::tests::real_engine -- --ignored --test-threads=1
+ working-directory: desktop/src-tauri
# OpenBot's machine on Windows shares one network namespace with every WSL distro, so a
# stopped machine's port rules outlive it. Reproduced on real netavark, both generations
# Podman runs on WSL, in a privileged lab on the runner's Docker, then cleared.
diff --git a/.github/workflows/desktop-macos-signing.yml b/.github/workflows/desktop-macos-signing.yml
index 4072af75e3..6dd7eba0aa 100644
--- a/.github/workflows/desktop-macos-signing.yml
+++ b/.github/workflows/desktop-macos-signing.yml
@@ -122,7 +122,8 @@ jobs:
scripts/publish-signed-windows.test.ts scripts/signing-workflows.test.ts
scripts/sign-windows-update.test.ts
../scripts/release-latest.test.ts ../scripts/release-download-names.test.ts
- ../scripts/downloads-sync.test.ts scripts/release-cli-bundle.test.ts
+ ../scripts/downloads-sync.test.ts ../scripts/release-older-installers.test.ts
+ scripts/release-cli-bundle.test.ts
scripts/verify-mac-arch.test.ts scripts/staple-with-retry.test.ts
working-directory: desktop
- name: Importing the Developer ID intermediate twice succeeds
diff --git a/.github/workflows/desktop-upgrade.yml b/.github/workflows/desktop-upgrade.yml
new file mode 100644
index 0000000000..73a505c644
--- /dev/null
+++ b/.github/workflows/desktop-upgrade.yml
@@ -0,0 +1,114 @@
+name: Desktop upgrade
+
+# OpenBot Desktop upgrades the back end it runs at Start (desktop/src-tauri/src/upgrade.rs): stop,
+# back the database up, set the previous version aside, lay out and pull the new one, start, and put
+# everything back if any step fails. This runs that code, the app's own, from a real published
+# release to this tree (`upgrade::real_release`): the release laid out from its own source archive
+# and image list, started with the settings Start writes and given something to keep, then this
+# tree's release laid over it the way an internal build lays out the commit it was pinned to. The
+# upgrade must move, what the old release wrote must read back from the new one, and each migration
+# must have run once.
+#
+# A pull request upgrades from the previous release, the one most installations are on. Every
+# night, and on demand, it upgrades from every release of the last 12 months an installation can
+# still be on (desktop/scripts/upgrade-legs.ts), so the window moves as releases are published and
+# age out.
+#
+# On the runner's Docker, which is the engine OpenBot Desktop uses on Linux. The harness takes any
+# engine; Windows and macOS runners have none that runs Linux containers.
+on:
+ pull_request:
+ paths:
+ - "desktop/src-tauri/**"
+ - "desktop/scripts/upgrade-legs.ts"
+ - "docker-compose.yml"
+ - "backend-images.env"
+ - "release-policy.json"
+ - ".github/workflows/desktop-upgrade.yml"
+ schedule:
+ - cron: "17 6 * * *"
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: desktop-upgrade-${{ github.ref }}
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
+
+jobs:
+ legs:
+ name: releases to upgrade from
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ outputs:
+ releases: ${{ steps.legs.outputs.releases }}
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
+ with:
+ bun-version: 1.4.3
+ - id: legs
+ env:
+ GH_TOKEN: ${{ github.token }}
+ MODE: ${{ github.event_name == 'pull_request' && 'previous' || 'window' }}
+ run: |
+ set -euo pipefail
+ gh release list --repo "$GITHUB_REPOSITORY" --limit 1000 --exclude-drafts --json tagName,publishedAt,isPrerelease > "$RUNNER_TEMP/releases.json"
+ releases="$(bun desktop/scripts/upgrade-legs.ts "$MODE" --releases "$RUNNER_TEMP/releases.json")"
+ echo "Upgrading from ($MODE): $releases"
+ echo "releases=$releases" >> "$GITHUB_OUTPUT"
+
+ upgrade:
+ name: upgrade from ${{ matrix.release }}
+ needs: legs
+ if: needs.legs.outputs.releases != '[]'
+ runs-on: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository && 'ubuntu-latest' || 'openbot-ubuntu-16core' }}
+ timeout-minutes: 60
+ strategy:
+ fail-fast: false
+ matrix:
+ release: ${{ fromJSON(needs.legs.outputs.releases) }}
+ env:
+ # The commit GitHub serves this tree's source archive for: the pull request's head, or main's.
+ COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ ref: ${{ env.COMMIT }}
+ persist-credentials: false
+ - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
+ with:
+ toolchain: stable
+ - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
+ with:
+ workspaces: desktop/src-tauri
+ key: upgrade
+ - run: |
+ sudo apt-get update -qq
+ sudo apt-get install -y -qq libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
+ # This tree's release as an internal build pins it: the server, computer and supervisor images
+ # at the tag backend-images.env names, each by its digest, under the commit's own version.
+ - name: This tree's image list
+ run: |
+ set -euo pipefail
+ tag="$(sed -n 's/^OPENBOT_BACKEND_TAG=//p' backend-images.env | tail -1)"
+ openbot="$(docker buildx imagetools inspect "ghcr.io/copilotkit/openbot:$tag" --format '{{.Manifest.Digest}}')"
+ supervisor="$(docker buildx imagetools inspect "ghcr.io/copilotkit/openbot-supervisor:$tag" --format '{{.Manifest.Digest}}')"
+ jq -n --arg version "internal-${COMMIT::12}" \
+ --arg openbot "ghcr.io/copilotkit/openbot@$openbot" \
+ --arg supervisor "ghcr.io/copilotkit/openbot-supervisor@$supervisor" \
+ '{version: $version, images: {openbot: {reference: $openbot}, server: {reference: $openbot}, "agent-computer": {reference: $openbot}, supervisor: {reference: $supervisor}}}' \
+ > "$RUNNER_TEMP/container-images.json"
+ cat "$RUNNER_TEMP/container-images.json"
+ - name: The upgrade from ${{ matrix.release }} to this tree
+ working-directory: desktop/src-tauri
+ env:
+ OPENBOT_UPGRADE_FROM: ${{ matrix.release }}
+ OPENBOT_UPGRADE_TO_COMMIT: ${{ env.COMMIT }}
+ run: |
+ set -euo pipefail
+ export OPENBOT_UPGRADE_TO_IMAGES="$RUNNER_TEMP/container-images.json"
+ cargo test --locked --lib upgrade::real_release -- --ignored --test-threads=1 --nocapture
diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml
index b492ff884b..2e047eb6e4 100644
--- a/.github/workflows/desktop.yml
+++ b/.github/workflows/desktop.yml
@@ -9,10 +9,10 @@ name: Desktop
# it at runtime with an `expect`, so a bad row panics the window rather than failing a type check.
on:
pull_request:
- paths: ["desktop/**", "shared/harnesses.json", "shared/marks/**", "shared/recorder-extension.json", "package.json", ".github/workflows/desktop.yml", ".github/workflows/desktop-build.yml"]
+ paths: ["desktop/**", "shared/harnesses.json", "shared/marks/**", "shared/recorder-extension.json", "shared/fixtures/client-version/**", "package.json", ".github/workflows/desktop.yml", ".github/workflows/desktop-build.yml"]
push:
branches: [main]
- paths: ["desktop/**", "shared/harnesses.json", "shared/marks/**", "shared/recorder-extension.json", "package.json", ".github/workflows/desktop.yml", ".github/workflows/desktop-build.yml"]
+ paths: ["desktop/**", "shared/harnesses.json", "shared/marks/**", "shared/recorder-extension.json", "shared/fixtures/client-version/**", "package.json", ".github/workflows/desktop.yml", ".github/workflows/desktop-build.yml"]
workflow_call:
secrets:
OPENBOT_GOOGLE_MODEL_OAUTH_CLIENT_SECRET:
diff --git a/.github/workflows/downloads-sync.yml b/.github/workflows/downloads-sync.yml
index 04f6e2643a..4542b11e7f 100644
--- a/.github/workflows/downloads-sync.yml
+++ b/.github/workflows/downloads-sync.yml
@@ -13,8 +13,12 @@ name: Downloads sync
# every six hours in case anything drifted or that start failed, and by hand. Each run compares
# checksums and uploads only what differs, so a run with nothing new changes nothing.
#
+# Last, on a run for the Latest release, it removes the installers of every older release from
+# releases// (scripts/release-older-installers.sh), so a fresh install never starts from one.
+#
# It signs in to AWS as `openbot-release-downloads`, which trusts this workflow on main and nothing
-# else, and may only write the bucket and invalidate the distribution named below.
+# else, and may only write the bucket, delete under releases/, and invalidate the distribution
+# named below.
on:
workflow_dispatch:
inputs:
@@ -86,3 +90,11 @@ jobs:
# release whose images are not there.
- run: bun scripts/downloads-images.ts
- run: scripts/downloads-sync.sh
+ # The installers of every release older than the Latest one, which a fresh install must not
+ # start from; everything else under releases// stays, and each removed path is
+ # invalidated (scripts/release-older-installers.sh, docs/releasing.md "Older installers").
+ # On every run for the Latest release, scheduled or dispatched with no tag, so it follows
+ # each release that becomes Latest; never on a run for one tag.
+ - name: Remove the installers of releases older than Latest
+ if: ${{ !inputs.tag }}
+ run: scripts/release-older-installers.sh bucket
diff --git a/.github/workflows/model-compat.yml b/.github/workflows/model-compat.yml
new file mode 100644
index 0000000000..1db03a8315
--- /dev/null
+++ b/.github/workflows/model-compat.yml
@@ -0,0 +1,261 @@
+name: Model compatibility
+
+# Does every model the picker offers still answer through the clients OpenBot ships? The picker
+# lists each provider's models live, but every harness image carries its model client at a fixed
+# version (the Claude Agent SDK harness bundles a Claude Code CLI, the LangGraph harness sends the
+# ChatGPT plan's backend a fixed Codex client version, the others carry the provider SDKs they were
+# built with), and a provider can refuse a new model to an older client. scripts/model-compat.ts
+# starts each harness image, one job per harness, and sends it one request per listed model on
+# every provider that has a key here. See docs/releasing.md, "Model compatibility".
+#
+# Keys are repository secrets, one per provider. A provider without one is reported as skipped,
+# not failed. On any failure the run fails and opens (or updates) one issue titled "Model
+# compatibility check failing"; a passing run closes it.
+#
+# What answered on the `source` image is the model lock (shared/model-lock.json), the models the
+# picker may offer for each harness. When a model newly answers or stops answering, the run opens
+# or updates one pull request that refreshes the lock. See docs/releasing.md, "Model lock".
+#
+# Runs only on a schedule and by hand, on main: never on a pull request, so no fork's code ever
+# runs with these keys.
+on:
+ schedule:
+ - cron: "41 6 * * *"
+ workflow_dispatch:
+ inputs:
+ tags:
+ description: Harness images to check, comma-separated. `latest` is the published release people run; `source` is built from this commit, which is what the next release ships.
+ type: string
+ default: latest,source
+ required: false
+
+permissions: {}
+
+concurrency:
+ group: model-compat
+ cancel-in-progress: false
+
+jobs:
+ # The published harnesses, and every engine the model lock names whether it is published yet or
+ # not (an engine new Bots run on is locked, and checked, from before its first release).
+ harnesses:
+ name: List the harnesses to check
+ if: github.repository == 'CopilotKit/OpenBot' && github.ref == 'refs/heads/main'
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ permissions:
+ contents: read
+ outputs:
+ images: ${{ steps.list.outputs.images }}
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
+ with:
+ bun-version: 1.4.3
+ - id: list
+ run: echo "images=$(bun scripts/model-compat.ts harnesses)" >> "$GITHUB_OUTPUT"
+
+ check:
+ name: ${{ matrix.harness }}
+ needs: harnesses
+ runs-on: ubuntu-latest
+ timeout-minutes: 90
+ permissions:
+ contents: read
+ strategy:
+ fail-fast: false
+ matrix:
+ harness: ${{ fromJSON(needs.harnesses.outputs.images) }}
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
+ with:
+ bun-version: 1.4.3
+ # Writes its results and exits 0 whatever they say: the report job below decides.
+ - name: One request per model through this harness
+ env:
+ HARNESS: ${{ matrix.harness }}
+ TAGS: ${{ inputs.tags || 'latest,source' }}
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
+ GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
+ XAI_API_KEY: ${{ secrets.XAI_API_KEY }}
+ run: >-
+ bun scripts/model-compat.ts --harness "$HARNESS" --tags "$TAGS" --exit-zero
+ --out "$RUNNER_TEMP/model-compat-$HARNESS.json"
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
+ with:
+ name: model-compat-${{ matrix.harness }}
+ path: ${{ runner.temp }}/model-compat-${{ matrix.harness }}.json
+ if-no-files-found: error
+ retention-days: 14
+
+ report:
+ name: Report
+ needs: [harnesses, check]
+ if: always() && needs.harnesses.result == 'success'
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ permissions:
+ contents: read
+ issues: write # open, update or close the one "Model compatibility check failing" issue
+ env:
+ GH_TOKEN: ${{ github.token }}
+ ISSUE_TITLE: Model compatibility check failing
+ RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
+ with:
+ bun-version: 1.4.3
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
+ with:
+ pattern: model-compat-*
+ path: ${{ runner.temp }}/results
+ merge-multiple: true
+ - name: Summarize
+ id: summary
+ run: |
+ set +e
+ shopt -s nullglob
+ bun scripts/model-compat.ts report --summary "$RUNNER_TEMP/summary.md" \
+ --issue "$RUNNER_TEMP/issue-table.md" "$RUNNER_TEMP"/results/*.json
+ code=$?
+ echo "code=$code" >> "$GITHUB_OUTPUT"
+ if [ -f "$RUNNER_TEMP/summary.md" ]; then cat "$RUNNER_TEMP/summary.md" >> "$GITHUB_STEP_SUMMARY"; fi
+ exit 0
+ - name: Open or update the issue
+ if: steps.summary.outputs.code != '0'
+ run: |
+ set -euo pipefail
+ body="$RUNNER_TEMP/issue.md"
+ {
+ echo "The model compatibility check failed on $(date -u +%Y-%m-%d): $RUN_URL"
+ echo
+ echo "A model refused by a pinned client means that client needs bumping: see docs/releasing.md, \"Model compatibility\". This issue is updated by every failing run and closed by the first passing one."
+ echo
+ if [ -f "$RUNNER_TEMP/issue-table.md" ]; then
+ cat "$RUNNER_TEMP/issue-table.md"
+ else
+ echo "No harness job wrote results. See the run."
+ fi
+ } > "$body"
+ number=$(gh issue list --repo "$GITHUB_REPOSITORY" --state open --search "\"$ISSUE_TITLE\" in:title" \
+ --json number,title --jq "map(select(.title == env.ISSUE_TITLE)) | .[0].number // empty")
+ if [ -n "$number" ]; then
+ gh issue edit "$number" --repo "$GITHUB_REPOSITORY" --body-file "$body"
+ else
+ gh issue create --repo "$GITHUB_REPOSITORY" --title "$ISSUE_TITLE" --body-file "$body"
+ fi
+ - name: Close the issue when everything passes
+ if: steps.summary.outputs.code == '0'
+ run: |
+ set -euo pipefail
+ number=$(gh issue list --repo "$GITHUB_REPOSITORY" --state open --search "\"$ISSUE_TITLE\" in:title" \
+ --json number,title --jq "map(select(.title == env.ISSUE_TITLE)) | .[0].number // empty")
+ if [ -n "$number" ]; then
+ gh issue close "$number" --repo "$GITHUB_REPOSITORY" --comment "Passing again: $RUN_URL"
+ fi
+ - name: Fail when a model failed
+ if: steps.summary.outputs.code != '0'
+ run: |
+ echo "::error::Model compatibility check failing. See the summary above and the issue titled \"$ISSUE_TITLE\"."
+ exit 1
+
+ lock:
+ name: Refresh the model lock
+ needs: [harnesses, check]
+ if: always() && needs.harnesses.result == 'success'
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ permissions:
+ contents: write # push the one refresh branch
+ pull-requests: write # open or update its pull request
+ env:
+ BRANCH: model-lock/refresh
+ RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
+ with:
+ bun-version: 1.4.3
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
+ with:
+ pattern: model-compat-*
+ path: ${{ runner.temp }}/results
+ merge-multiple: true
+ - name: Write the lock from the source images' results
+ id: lock
+ run: |
+ set -euo pipefail
+ shopt -s nullglob
+ files=("$RUNNER_TEMP"/results/*.json)
+ if [ "${#files[@]}" -eq 0 ]; then
+ echo "No harness job wrote results; the lock stays as it is."
+ echo "changed=false" >> "$GITHUB_OUTPUT"
+ exit 0
+ fi
+ bun scripts/model-compat.ts lock --changes "$RUNNER_TEMP/lock-changes.md" "${files[@]}"
+ if git diff --quiet -- shared/model-lock.json; then
+ echo "changed=false" >> "$GITHUB_OUTPUT"
+ else
+ echo "changed=true" >> "$GITHUB_OUTPUT"
+ { echo "## Model lock changes"; echo; cat "$RUNNER_TEMP/lock-changes.md"; } >> "$GITHUB_STEP_SUMMARY"
+ fi
+ # GITHUB_TOKEN's pull requests get CI runs that wait for a maintainer to approve them. A
+ # GitHub App installation token, when one is configured, has no such limit.
+ - id: app-token
+ if: steps.lock.outputs.changed == 'true' && vars.OPENBOT_UPGRADE_APP_CLIENT_ID != ''
+ uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
+ with:
+ client-id: ${{ vars.OPENBOT_UPGRADE_APP_CLIENT_ID }}
+ private-key: ${{ secrets.OPENBOT_UPGRADE_APP_PRIVATE_KEY }}
+ permission-contents: write
+ permission-pull-requests: write
+ - name: Open or update the refresh pull request
+ if: steps.lock.outputs.changed == 'true'
+ env:
+ GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
+ TOKEN_KIND: ${{ steps.app-token.outputs.token && 'app' || 'github-token' }}
+ # Credentials for this one push, through gh, and no hook can run.
+ GIT_CONFIG_COUNT: "3"
+ GIT_CONFIG_KEY_0: credential.helper
+ GIT_CONFIG_VALUE_0: ""
+ GIT_CONFIG_KEY_1: credential.helper
+ GIT_CONFIG_VALUE_1: "!gh auth git-credential"
+ GIT_CONFIG_KEY_2: core.hooksPath
+ GIT_CONFIG_VALUE_2: /dev/null
+ run: |
+ set -euo pipefail
+ git switch -C "$BRANCH"
+ git -c user.name="github-actions[bot]" \
+ -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
+ commit -m "Refresh the model lock from the daily model check" -- shared/model-lock.json
+ git push --force "https://github.com/$GITHUB_REPOSITORY.git" "HEAD:refs/heads/$BRANCH"
+ body="$RUNNER_TEMP/lock-pr.md"
+ {
+ echo "The daily model check found models that started or stopped answering through the clients the harnesses ship. This refreshes \`shared/model-lock.json\`, the models the picker may offer for each harness."
+ echo
+ cat "$RUNNER_TEMP/lock-changes.md"
+ echo
+ echo "From $RUN_URL. Every run that finds a change updates this pull request. See docs/releasing.md, \"Model lock\"."
+ if [ "$TOKEN_KIND" != app ]; then
+ echo
+ echo "**CI must be started by hand.** This pull request was opened with \`GITHUB_TOKEN\`, so its CI runs wait for a maintainer to approve them."
+ fi
+ } > "$body"
+ number=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$BRANCH" --state open --json number --jq ".[0].number // empty")
+ if [ -n "$number" ]; then
+ gh pr edit "$number" --repo "$GITHUB_REPOSITORY" --body-file "$body"
+ else
+ gh pr create --repo "$GITHUB_REPOSITORY" --base main --head "$BRANCH" \
+ --title "Refresh the model lock" --body-file "$body"
+ fi
diff --git a/.github/workflows/model-lock.yml b/.github/workflows/model-lock.yml
new file mode 100644
index 0000000000..12f568d454
--- /dev/null
+++ b/.github/workflows/model-lock.yml
@@ -0,0 +1,121 @@
+name: Model lock
+
+# A pull request that changes a harness's model client (its requirements, its package.json or
+# lockfile, its Dockerfile, or the ChatGPT plan's Codex client version) must not break a model the
+# model lock (shared/model-lock.json) says that harness runs: a person set to it would get the
+# provider's refusal on every message. This builds the changed harnesses from the pull request,
+# sends each listed model one request through them (scripts/model-compat.ts), and fails when a
+# model the lock verifies no longer answers. See docs/releasing.md, "Model lock".
+#
+# Only for pull requests from this repository: a fork's pull request is never given the provider
+# keys, so it is skipped and the daily check covers it once it merges.
+on:
+ pull_request:
+ paths:
+ - "agent-*/requirements.txt"
+ - "agent-*/Dockerfile"
+ - "agent-*/package.json"
+ - "agent-*/bun.lock"
+ - "agent-*/package-lock.json"
+ - "agent-langgraph-agui/src/chatgpt_models.py"
+ - "shared/model-lock.json"
+ - "scripts/model-compat.ts"
+ - ".github/workflows/model-lock.yml"
+
+permissions: {}
+
+concurrency:
+ group: model-lock-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+jobs:
+ changed:
+ name: Harnesses whose client changed
+ if: github.event.pull_request.head.repo.full_name == github.repository
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ permissions:
+ contents: read
+ outputs:
+ harnesses: ${{ steps.list.outputs.harnesses }}
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ fetch-depth: 0
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
+ with:
+ bun-version: 1.4.3
+ - id: list
+ env:
+ BASE_SHA: ${{ github.event.pull_request.base.sha }}
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+ run: |
+ set -euo pipefail
+ changed=$(git diff --name-only "$BASE_SHA...$HEAD_SHA")
+ # The harnesses the check runs: the published ones, and every engine the lock names,
+ # published yet or not, that has a row in shared/harnesses.json.
+ checked=$(bun scripts/model-compat.ts harnesses)
+ # The check itself, or the lock, changed: every harness the lock names is checked.
+ if grep -qxE 'shared/model-lock.json|scripts/model-compat.ts|\.github/workflows/model-lock.yml' <<<"$changed"; then
+ harnesses=$(jq -c --argjson checked "$checked" \
+ '[.engines | keys[] | select(. as $h | $checked | index($h))]' shared/model-lock.json)
+ else
+ harnesses=$(grep -oE '^agent-[a-z0-9-]+/' <<<"$changed" | tr -d / | sort -u \
+ | jq -R . | jq -sc --argjson checked "$checked" \
+ 'map(select(. as $h | $checked | index($h)))')
+ fi
+ echo "harnesses=$harnesses" >> "$GITHUB_OUTPUT"
+ echo "Harnesses to check: $harnesses"
+
+ check:
+ name: ${{ matrix.harness }}
+ needs: changed
+ if: needs.changed.outputs.harnesses != '[]'
+ runs-on: ubuntu-latest
+ timeout-minutes: 60
+ permissions:
+ contents: read
+ strategy:
+ fail-fast: false
+ matrix:
+ harness: ${{ fromJSON(needs.changed.outputs.harnesses) }}
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
+ with:
+ bun-version: 1.4.3
+ - name: One request per model through this pull request's harness
+ env:
+ HARNESS: ${{ matrix.harness }}
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
+ GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
+ XAI_API_KEY: ${{ secrets.XAI_API_KEY }}
+ # The published image too, with the same keys in the same run: a verified model that fails
+ # on both is the provider's or the key's today, not this change's (`brokenVerified`).
+ run: >-
+ bun scripts/model-compat.ts --harness "$HARNESS" --tags latest,source --exit-zero
+ --out "$RUNNER_TEMP/model-compat.json"
+ # The run's results, with the repository's own keys: `bun scripts/model-compat.ts lock` writes
+ # the lock from them when a pin moved (docs/releasing.md, "Model lock").
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
+ with:
+ name: model-lock-${{ matrix.harness }}
+ path: ${{ runner.temp }}/model-compat.json
+ if-no-files-found: error
+ retention-days: 14
+ - name: Every model the lock verifies still answers
+ env:
+ HARNESS: ${{ matrix.harness }}
+ run: |
+ set +e
+ bun scripts/model-compat.ts guard --summary "$RUNNER_TEMP/guard.md" "$RUNNER_TEMP/model-compat.json"
+ code=$?
+ cat "$RUNNER_TEMP/guard.md" >> "$GITHUB_STEP_SUMMARY"
+ if [ "$code" -ne 0 ]; then
+ echo "::error::A model the lock verifies for $HARNESS no longer answers through this change's client. See the summary."
+ fi
+ exit "$code"
diff --git a/.github/workflows/security-floor.yml b/.github/workflows/security-floor.yml
new file mode 100644
index 0000000000..f4373cd22c
--- /dev/null
+++ b/.github/workflows/security-floor.yml
@@ -0,0 +1,132 @@
+name: Security floor
+
+# Raises the security floor: the lowest safe release of OpenBot Desktop, its back end, the phone app
+# and the Recorder (shared/security-floor.ts, docs/releasing.md "Security floor"). Below it, an app
+# shows one notice, "This version of OpenBot has a security problem. Update to keep using it.", and
+# nothing else until it is updated. Used only when a release has a security problem, and never for
+# a company's own OpenBot.
+#
+# Run by hand, after the fixed release is Latest. Signing waits for approval: the `sign` job runs in
+# the protected `security-floor` environment, whose required reviewers approve it, and only that job
+# can read the signing key. It has no write access to anything. The `publish` job, which can write the
+# release, never sees the key.
+#
+# The floor goes on the Latest release beside latest.json, and Downloads sync copies it to
+# downloads.copilotkit.ai/latest/. Each release that becomes Latest carries it on
+# (scripts/release-make-latest.sh).
+on:
+ workflow_dispatch:
+ inputs:
+ desktop:
+ description: Lowest safe OpenBot Desktop release, such as 1.1.2. Empty keeps the published floor; none removes it.
+ type: string
+ default: ""
+ required: false
+ backend:
+ description: Lowest safe back end OpenBot Desktop runs on this computer. Empty keeps the published floor; none removes it.
+ type: string
+ default: ""
+ required: false
+ mobile:
+ description: Lowest safe phone app release. Empty keeps the published floor; none removes it.
+ type: string
+ default: ""
+ required: false
+ recorder:
+ description: Lowest safe Recorder release. Empty keeps the published floor; none removes it.
+ type: string
+ default: ""
+ required: false
+ cloud:
+ description: OpenBot Cloud's addresses the floor applies to, comma-separated https origins. Empty keeps the published list; none empties it.
+ type: string
+ default: ""
+ required: false
+ lower:
+ description: Allow a floor lower than the published one, to undo a floor raised by mistake.
+ type: boolean
+ default: false
+ required: false
+
+permissions: {}
+
+concurrency:
+ group: security-floor
+ cancel-in-progress: false
+
+jobs:
+ sign:
+ name: Sign the security floor
+ if: github.repository == 'CopilotKit/OpenBot' && github.ref == 'refs/heads/main'
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ environment: security-floor
+ permissions:
+ contents: read # read the Latest release and its current floor
+ outputs:
+ latest: ${{ steps.latest.outputs.tag }}
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
+ with:
+ bun-version: 1.4.3
+ no-cache: true
+ - name: Read the Latest release and its floor
+ id: latest
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ set -euo pipefail
+ tag="$(gh api "repos/$GITHUB_REPOSITORY/releases/latest" --jq .tag_name)"
+ echo "tag=$tag" >> "$GITHUB_OUTPUT"
+ names="$(gh release view "$tag" -R "$GITHUB_REPOSITORY" --json assets --jq '.assets[].name')"
+ if grep -qxF security-floor.json <<<"$names"; then
+ gh release download "$tag" -R "$GITHUB_REPOSITORY" --pattern security-floor.json --dir "$RUNNER_TEMP/published"
+ fi
+ - name: Sign
+ env:
+ SECURITY_FLOOR_SIGNING_KEY: ${{ secrets.SECURITY_FLOOR_SIGNING_KEY }}
+ FLOOR_DESKTOP: ${{ inputs.desktop }}
+ FLOOR_BACKEND: ${{ inputs.backend }}
+ FLOOR_MOBILE: ${{ inputs.mobile }}
+ FLOOR_RECORDER: ${{ inputs.recorder }}
+ FLOOR_CLOUD: ${{ inputs.cloud }}
+ FLOOR_LOWER: ${{ inputs.lower }}
+ LATEST_RELEASE: ${{ steps.latest.outputs.tag }}
+ PREVIOUS: ${{ runner.temp }}/published/security-floor.json
+ OUT: ${{ runner.temp }}/security-floor.json
+ run: bun scripts/security-floor-sign.ts
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
+ with:
+ name: security-floor
+ path: ${{ runner.temp }}/security-floor.json
+ if-no-files-found: error
+ retention-days: 30
+
+ publish:
+ name: Publish the security floor
+ needs: sign
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ permissions:
+ contents: write # put the floor on the Latest release
+ actions: write # start Downloads sync
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
+ with:
+ name: security-floor
+ path: ${{ runner.temp }}/signed
+ - name: Put it on the Latest release
+ env:
+ GH_TOKEN: ${{ github.token }}
+ LATEST: ${{ needs.sign.outputs.latest }}
+ run: scripts/release-security-floor.sh "$LATEST" "$RUNNER_TEMP/signed/security-floor.json"
+ - name: Copy it to downloads.copilotkit.ai
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: gh workflow run downloads-sync.yml -R "$GITHUB_REPOSITORY" --ref main
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aca181f838..0d69b2e39b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,279 @@ Newest first. `Unreleased` is what is on `main` and not yet tagged.
## Unreleased
+**Before upgrading.** Read these first: several change what a Helm values file, a Compose override
+or a script has to say.
+
+- **The Helm charts refuse shared and external computers until you say you mean them.** Shared
+ computers (`computers.mode: shared`, still the default) and external ones
+ (`computers.mode: external`, the one computer at `computers.url`) run every person's Bots on one
+ computer, where a command one Bot runs can read another person's files, so they suit a proof of
+ concept only. Sandbox mode (`computers.mode: sandbox`) gives each person a computer of their own
+ and is the way to run OpenBot for people; it needs the agent-sandbox controller in the cluster.
+ A release on shared or external computers, including one that never set `computers.mode`, has to
+ set `computers.sharedModeAcknowledged: true` before upgrading
+ (`openbot.computers.sharedModeAcknowledged` in the `openbot-bundle` chart), or `helm install` and
+ `helm upgrade` stop with a message naming both choices and change nothing. That includes an
+ upgrade with `--reuse-values`, and the single-user mode of either chart. Acknowledged, the
+ install notes say it again, and admins see it in Admin (below).
+- **The `openbot-bundle` chart keeps files in its own object store.** A bundle upgraded with your
+ own values file moves every file people and Bots attached out of PostgreSQL and into the bucket
+ `openbot-files` in the bundled Intelligence's local object storage, which a new Job makes on
+ every install and upgrade. That storage is one pod, with no replication or backup of its own. To
+ keep files in PostgreSQL, set `openbot.attachments.store: postgres` and
+ `openbot.objectStorage.enabled: false`. An upgrade with `--reuse-values` keeps the values it had,
+ so files stay in PostgreSQL. Don't turn off `intelligence.localObjectStorage` while files are in
+ it: the bundle refuses that. See Files (below).
+- **Migrations run at start: five, all additive.** The database moves from `0132_bot_task_runs` to
+ the migration `release-policy.json` names for this release. `0133_files_in_an_object_store` adds
+ the `file_deletions` table and lets an attachment's bytes live outside PostgreSQL,
+ `0134_attachments_storage_key_index` indexes where they live, `0135_files_gate_opened` records
+ when files may move, `0136_api_deprecated_use` counts use of deprecated API, and
+ `0137_ai_connections` keeps the AI connection an admin chose (below). A 1.1.0
+ server works against the new schema, so 1.1.0 upgrades to 1.1.1 with its servers rolling one by
+ one, with no downtime. `0133` needs OpenBot's login to hold the `openbot_system` role's
+ privileges, as 1.1.0 set up, and stops with the `GRANT` to run when it doesn't. It waits at most
+ five seconds for a lock on `attachments`, so a long transaction can fail the first start, which
+ then tries again. Upgrading from 1.0.x or 0.3.x runs 1.1.0's migrations as well: read 1.1.0's
+ Before upgrading first.
+- **Going back to 1.1.0 after files moved to an object store** needs them moved back first: set
+ `attachments.store: postgres` with the store still configured, and wait for the move to finish.
+ A 1.1.0 server cannot read a file that is in the store.
+- **New Bots run on the LangGraph (TypeScript) engine where a deployment runs it.** OpenBot
+ Desktop runs it, and an installation's Bot that ran on the Python LangGraph engine moves to the
+ TypeScript one at its next Install and Start, keeping its conversations. Docker Compose now
+ defines `agent-langgraph-ts` (port 4215, on this machine only), which a plain `docker compose up`
+ builds from the checkout unless `LANGGRAPH_TS_IMAGE` and `IMAGE_PULL_POLICY=missing` name the
+ published image. A server without `LANGGRAPH_TS_AG_UI_URL`, and both Helm charts, keep new Bots
+ on the server's built-in engine. `OPENBOT_DEFAULT_BOT_ENGINE=built-in` keeps every new Bot there.
+- **Compose: Claude and ChatGPT plans run in services of their own.** `agent-harness` is no longer
+ handed `CLAUDE_CODE_OAUTH_TOKEN`, `CHATGPT_AUTH_FILE` or the `./.langchain` folder. They go to
+ two new services, `agent-claude-plan` and `agent-chatgpt-plan`, behind the `claude-plan` and
+ `chatgpt-plan` profiles, which OpenBot Desktop starts when a plan needs them. A Compose override
+ of your own that ran a plan through `agent-harness` turns on the profile and sets
+ `CLAUDE_PLAN_HARNESS_URL` or `CHATGPT_PLAN_HARNESS_URL`.
+- **The model picker offers only models proven on the Bot's engine** (below). A conversation or a
+ Bot set to a model that isn't proven runs on the default, and says so.
+- **A model gateway serves `/responses` for gpt-5.4 and gpt-5.5.** Bots behind an OpenAI-compatible
+ address now call those models, and their mini, nano and dated versions, on the Responses API.
+- **A server that refuses to start exits with code 78**, where it exited with 1. The all-in-one
+ image now ends its container instead of trying again forever, and on Kubernetes the pod's
+ CrashLoopBackOff names the reason in `kubectl describe`. A crash still exits with 1. Monitoring
+ that watches the exit code may need to know the new one.
+- **Settings that now stop a server from starting when they are wrong:** `OPENBOT_MINIMUM_CLIENTS`,
+ `OPENBOT_DEFAULT_BOT_ENGINE`, `SHUTDOWN_KEEP_SERVING_SECONDS`, `SHUTDOWN_DRAIN_SECONDS`, and the
+ file store's (below). An `S3_BUCKET`, `GCS_BUCKET` or `AZURE_STORAGE_CONTAINER` already in the
+ server's environment, for example one it shares with Intelligence, turns the file store on, and
+ the server then checks that store at start.
+- **Kubernetes: a server pod takes up to 45 seconds to stop**, so it can finish what it is doing
+ (below). `server.shutdown` sets it.
+- **Deprecated:** nothing.
+
+### Files
+
+- **Files can live in an object store.** Amazon S3 or anything that speaks its API, Google Cloud
+ Storage or Azure Blob Storage, where they were always in PostgreSQL. With a store, a file can be
+ up to 100 MB. Without one nothing changes: files stay in PostgreSQL, with 8 MB for pictures and
+ PDFs and 1 MB for other files, and OpenBot Desktop stays on PostgreSQL. The `openbot` chart gains
+ `attachments.store` (`postgres` unless set) and `objectStorage`: `enabled`, `provider` (`s3`,
+ `gcs` or `azure`), `bucket`, `prefix` (`openbot/`), `region`, `endpoint`, `forcePathStyle`,
+ `azure.accountUrl`, `deleteAfterDays` (7), `assumeAllServersCurrent`, `existingSecret` with its
+ `secretKeys`, and `inCluster` for a store in the cluster. A server pod can sign in to the store
+ with workload identity through `serviceAccount.annotations`. On Docker Compose the same settings
+ are `FILES_STORE`, `FILES_PREFIX`, `FILES_DELETE_AFTER_DAYS`, `FILES_ASSUME_ALL_SERVERS_CURRENT`,
+ `S3_*`, `GCS_BUCKET` and `AZURE_STORAGE_*` in `.env`. The chart refuses a store asked for and
+ not set up, a Secret without its keys, and a store in the cluster behind a network policy with no
+ way to reach it, each by name.
+ - The server writes, reads and deletes a test file at start, and refuses to start when the store
+ doesn't answer. It never falls back to PostgreSQL.
+ - Files already in PostgreSQL move to the store in the background, and back again when
+ `attachments.store` is set to `postgres` with the store still configured. A server refuses to
+ start without the store's settings while any file is still in it.
+ - During a rolling upgrade new files stay in PostgreSQL until no 1.1.0 server is connected. A
+ connection pooler, such as PgBouncer or RDS Proxy, hides which servers are connected: set
+ `assumeAllServersCurrent: true` once every server runs 1.1.1.
+ - A deleted file leaves the store after `deleteAfterDays`, and a weekly sweep removes anything
+ left behind. Files are served from OpenBot's own addresses, as before.
+- **Word, Excel and PowerPoint files.** People can attach `.docx`, `.xlsx` and `.pptx` files, and
+ Bots can send them, recognised by what is inside rather than by the name. The Bot reads their
+ text: a workbook's sheets as tables, a document with its tables, a presentation's slides in
+ order, up to 120,000 characters. They count as documents, so the document limit applies. Old
+ `.doc`, `.xls` and `.ppt` files, password-protected ones, macro-enabled ones (`.docm`, `.xlsm`,
+ `.pptm`), templates, and a file whose contents don't match its name are refused with a sentence
+ saying why.
+- **Bots send files to people.** A Bot can hand you a file from its computer. It shows as a card in
+ the conversation, a task or a group, with Download, and is still there after a reload.
+- **The limits come from the server.** The message box refuses a file over this OpenBot's limit
+ before uploading it, and a picture over 8 MB shows as a file. A picture over the model's own limit
+ reaches the Bot as a note instead of failing the turn.
+
+### Apps and the OpenBot they talk to
+
+- **Every app says which version it is, and OpenBot can ask for a newer one.** The web app, OpenBot
+ Desktop, the phone app and the Recorder send `OpenBot-Client: /` on every request,
+ and the server's `deployment` answer names the API versions it serves and the oldest release of
+ each app it serves (`api`, `minimumClients`, `launcherApi`, `extensionApi`). An app older than
+ that reads "Update OpenBot" in place of the app, and a server too old for the app says "Ask
+ whoever runs your OpenBot to update it". A server refuses an older app's requests with 400
+ `CLIENT_UPDATE_REQUIRED`. Nothing is refused unless an admin sets `OPENBOT_MINIMUM_CLIENTS`
+ (for example `desktop=1.2.0,mobile=1.2.0`), because a release serves every app released in the
+ 12 months before it. A request with no `OpenBot-Client` header, such as a script's, is never
+ refused.
+- **OpenBot Desktop 1.0.3 or older gets a page instead of a server that stops.** An older Desktop
+ that starts this release now shows "Update OpenBot" with Check for Updates…, where the server
+ used to exit for want of the install token those apps never wrote.
+- **OpenBot Desktop checks it can start a release before it starts it.** A release that needs a
+ newer app is not started; the window offers Update and restart instead.
+- **A signed security floor.** The apps, and OpenBot Cloud's servers, can be told the lowest safe
+ release of OpenBot Desktop, its back end, the phone app and the Recorder; an app below it shows
+ one notice, "This version of OpenBot has a security problem. Update to keep using it." It never
+ applies to a company's own OpenBot, and no floor is set
+ ([docs/releasing.md](docs/releasing.md#security-floor)).
+
+### API
+
+- **The API refuses NUL in text.** Every text field the spec holds to a pattern refuses a NUL
+ character anywhere in it, with 400 `VALIDATION_ERROR` and "That text has a character OpenBot
+ can't keep. Type it again." Before, one NUL could pass where the pattern asked for a character.
+- **The API says when something you call is deprecated.** An operation, a query or header
+ parameter, or a request-body field the spec marks deprecated answers with the standard
+ `Deprecation` and `Sunset` headers and a `Link` to this changelog, whose Deprecated list under
+ "Before upgrading" says what replaces it. It keeps working until at least its sunset, 12 months
+ or more after it was deprecated. Nothing is deprecated yet, so no answer carries them. See
+ [api/README.md](api/README.md#deprecating).
+- **Statuses, roles and scope kinds in API answers can gain values.** The spec declares them open
+ (`x-extensible-enum`): a task's or a run's status, a person's role, a network policy's scope,
+ what decided a person's permission, and the others listed in `api/accepted-breaking-changes.md`.
+ A script that reads one should treat a value it doesn't know as "other" rather than fail, as the
+ web and phone apps now do. The values sent today are unchanged.
+- **Edit a routine in place.** `PATCH` on a routine changes its name, what to do, its schedule and
+ its time zone, keeping its conversation and runs, and a routine's page has an Edit routine row.
+ Before, the only way to change one was to ask its Bot. A routine in an answer now always carries
+ its `cron`.
+- New optional fields: `computerMode` in the organization settings' `context`, `attachmentLimits`
+ on `deployment`, `files` and `declined` on a message, and `unverified` on a conversation's model
+ choice. A Bot's `framework` can be `langgraph-ts`.
+
+### Bots and models
+
+- **Change the AI connection with no restart.** An admin of a personal OpenBot changes the AI
+ connection from Settings > General > AI model: a key, an address, or, in OpenBot Desktop, a plan
+ or provider sign-in. OpenBot checks it with the provider before saving it, and the next run uses
+ it. A team's OpenBot shows it and keeps it as its deployment sets it.
+ `GET` and `PUT /api/v2/organizations/{organizationId}/ai-connection` do the same, and with
+ `MODEL_GATEWAY_TOKEN` set the Bots' engines reach models through OpenBot instead of holding a
+ provider key of their own.
+- **The model picker offers a model only when OpenBot has proven it on the Bot's engine.** A daily
+ check sends every listed model a request through each engine, and a model that doesn't answer
+ there is hidden, on OpenAI, Anthropic and Google. A conversation already set to one runs on the
+ default, and the composer says "X doesn't work with this Bot yet, so this conversation uses Y".
+ A provider never checked, such as xAI, and a gateway, list everything as before.
+- **New Bots on LangGraph (TypeScript).** See Before upgrading. A Bot's Setup > Connection says
+ what it runs on.
+- **Claude plan errors say what happened.** A usage limit, running out of credit, a dropped
+ connection, no answer, a client too old for the model and a refusal each get their own sentence,
+ and a task tries again after a dropped connection but not after a limit. A call to a tool the
+ step didn't offer goes back to the model as a tool error instead of ending the turn, and a reply
+ that came back cut off says "Ask it to carry on". The Claude harness bundles a newer Claude Code,
+ so plan Bots run Claude's newest models.
+- **Gemini sign-in says what Google said**, with when to try again. A free-tier daily limit reads as
+ a rate limit, never as out of credit, and the model list loads when OpenBot starts.
+- **A turn that failed after it did something isn't sent again.** On every engine, a message whose
+ Bot had already said something or called a tool stays sent when the turn fails.
+- **Bots reach other Bots, plan engines and MCP servers on a connection of their own**, so a second
+ message a few seconds after the first no longer fails with "Couldn't reach" the Bot. A built-in
+ Bot's tool calls are no longer lost under load.
+- The AG2 and Langroid harnesses call gpt-5.6 and newer, and the -pro models, on the Responses API.
+ The Agno harness no longer sends Claude a `top_p`, which Claude 4.5 and 4.6 refused. The
+ LangGraph harness keeps the kind of error Gemini and xAI name, and pins its model clients.
+
+### Conversations
+
+- **Group conversations name who sent each line**, by name or email, and "Someone who left" for
+ someone no longer there.
+- **A Bot's reply waiting to be shared says whose turn it is.** In a group, only the Bot's owner sees
+ Open on it; everyone else reads "Waiting for to allow sharing this reply." A reply the
+ owner declined to share reads " didn't share this reply. Nothing was sent." as a notice,
+ not an error.
+- **Dictation in OpenBot Desktop** on a Mac falls back to the next language and region the Mac has
+ when the page's isn't available, and says which to add. A browser says when it can't take
+ dictation in a language.
+
+### Admin
+
+- **Admins see when everyone's Bots share one computer.** On a team's OpenBot whose Bots all run on
+ one computer, Admin's overview and its Computers page say so, say it suits a proof of concept
+ only, and say how to give each person a computer of their own. An OpenBot one person uses, OpenBot
+ Desktop included, says nothing, because that computer is the person's own. Nobody but an admin
+ sees anything new. The organization settings' read-only `context` gains `computerMode`
+ (`per-person`, `shared` or `none`).
+
+### Personal edition
+
+- **OpenBot for one person asks once to be starred on GitHub.** In the personal edition only, once
+ you have used OpenBot on three separate days, a card above the message box asks you to star
+ OpenBot on GitHub, right after something goes well: you copy a Bot's answer, one of your
+ routines finishes a run, or a long task finishes. Never right after an error, never on a team's
+ OpenBot, and never beside the notifications offer. Either answer is saved to your account, so it
+ is never asked again on any device. Settings > General keeps the link in a new OpenBot section.
+ The preferences gain `dismissedNotices` (the notices you answered) and `noticesDue` (the ones
+ OpenBot would show you now), and `POST /api/v2/organizations/{organizationId}/nudge-events`
+ counts how many people were shown a nudge, followed it or dismissed it, with product telemetry
+ on; see [TELEMETRY.md](docs/TELEMETRY.md).
+
+### OpenBot Desktop
+
+- **Connected to another OpenBot on a Mac works again.** In 1.1.0 the window showed only "This
+ relay is for the OpenBot window", because the Mac's web view dropped a cookie on a redirect.
+- **A server that refuses to start says why at once**, in its own words, where the window waited
+ three minutes and said it could not finish starting. Retry after fixing it starts clean, without
+ the old refusal.
+- **Retry waits for a back end whose services are still coming up.** When the server had stopped
+ and some of the back end's services were still starting, Retry gave up on its first look and
+ said OpenBot was running but not working properly. It now waits for them as it waits for a back
+ end that is starting, and says that only if they are still not ready at the time limit.
+- **Stop and Quit let the server finish first.** The server stops before the Bots and computers it
+ is using, and a Bot's answer in progress ends as stopped, not as "Couldn't reach". Stop and Quit
+ no longer cut each other's stop of the back end short, so Quit after Stop on Windows no longer
+ leaves it running. Stopping can take a few seconds longer.
+- **An update checks this computer has room first**, before it stops or downloads anything, and
+ says "OpenBot needs more free space to update" with the figures and Retry. A full disk reads as
+ one plain line.
+- **Status window:** Restart applies changes made to `.env`, it offers Start after Stop, and it
+ shows Updating with no buttons during an update.
+- **Launching OpenBot while it quits** opens it again once it has quit, where it stayed on Shutting
+ down.
+- **The first Start after Install** waits up to two minutes for the container engine, instead of
+ sending you back to Install.
+- On Windows, checking your saved setup no longer freezes the window while Windows finishes an
+ update, and says so after five seconds.
+- An update stopped after it updated your data says it didn't finish and that the next Start
+ finishes it. An update to the release OpenBot already runs is not a failure.
+- The first screen offers OpenBot (Self-Contained), and one OpenBot for Business card, Cloud or
+ Self-Hosted, that books a call; connecting to an OpenBot at work is "Already have OpenBot at
+ work? Connect to it." The update screen says the same.
+- The step before a Composio sign-in shows inside the Desktop window.
+- Get Troubleshooting Logs adds the speech log and the model provider's own error words, with
+ secrets taken out.
+
+### Running OpenBot
+
+- **A server asked to stop finishes what it is doing.** It finishes requests and Bot answers in
+ flight, closes live connections with 1001, and keeps an answer still running at the limit as
+ stopped. `SHUTDOWN_KEEP_SERVING_SECONDS` (0 unless set) and `SHUTDOWN_DRAIN_SECONDS` (6) set how
+ long; the chart's `server.shutdown` uses 5 and 25, and a pod's `terminationGracePeriodSeconds`
+ becomes their sum plus 15. A second signal stops it at once.
+- **A browser or database switched off in the OpenBot image stays off**
+ (`EMBEDDED_COMPUTER=off`, `EMBEDDED_POSTGRES=off`, as every chart server pod sets), where it was
+ restarted about once a second. A computer that exits no longer leaves its virtual display
+ running.
+
+### Smaller changes
+
+- An admin's review list shows a person as soon as their own space is made, and a denied folder
+ action lands in Activity after the attempt it denied.
+- Mastra's mark is its current one.
+
## 1.1.0
**Before upgrading.** Read these first: several of them change what a script, a proxy, a Compose
diff --git a/README.md b/README.md
index e1d6f3ea1c..4577cbb3fc 100644
--- a/README.md
+++ b/README.md
@@ -143,10 +143,13 @@ For a first evaluation, you need a cluster with a **default StorageClass**, `kub
2. **Install** the `openbot-bundle` chart published with the release.
+ This evaluation runs **shared computers**: every Bot runs on one computer, and a command one Bot runs can read another person's files. That suits a proof of concept only, and `openbot.computers.sharedModeAcknowledged=true` says you know it. For people, use sandbox mode instead, which gives each person a computer of their own and is more secure: install the agent-sandbox controller in the cluster and set `openbot.computers.mode=sandbox` (the Helm guide has the command).
+
```sh
helm install openbot https://github.com/CopilotKit/OpenBot/releases/download/v1.1.0/openbot-bundle-0.1.0.tgz \
--namespace openbot --create-namespace \
--values openbot-values.yaml \
+ --set openbot.computers.sharedModeAcknowledged=true \
--timeout 15m
```
diff --git a/agent-ag2/requirements.txt b/agent-ag2/requirements.txt
index 4b39fa289a..38e0aab92e 100644
--- a/agent-ag2/requirements.txt
+++ b/agent-ag2/requirements.txt
@@ -1,4 +1,6 @@
-ag2[ag-ui,anthropic,openai]
+# 1.3.2 is the first release this harness is checked on with both OpenAICompletionsConfig and
+# OpenAIResponsesConfig, which src/main.py names explicitly.
+ag2[ag-ui,anthropic,openai]>=1.3.2
fastapi
python-multipart
uvicorn[standard]
diff --git a/agent-ag2/src/main.py b/agent-ag2/src/main.py
index 455dcbf1e8..81da87903b 100644
--- a/agent-ag2/src/main.py
+++ b/agent-ag2/src/main.py
@@ -8,22 +8,29 @@
# The spec file every language in the box reads: one level above this Bot in the repository, and
# one level above /app/src in the image the Dockerfile builds.
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "shared"))
-from model_providers import bot_settings
+from model_providers import bot_settings, openai_api
from ag2 import Agent
from ag2.ag_ui import AGUIStream
-from ag2.config import AnthropicConfig, OpenAIConfig
+from ag2.config import AnthropicConfig, OpenAICompletionsConfig, OpenAIResponsesConfig
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
TOKEN_HEADER = "x-openbot-agent-token"
-def _config() -> AnthropicConfig | OpenAIConfig:
+def _config() -> AnthropicConfig | OpenAICompletionsConfig | OpenAIResponsesConfig:
"""The provider the model screen chose, which AG2 reaches through a config of its own.
`BOT_PROVIDER` is `anthropic` for an Anthropic key and `openai` otherwise, an OpenAI-compatible
endpoint included. Each SDK reads its own key from the environment.
+
+ An OpenAI model takes AG2's Responses config when it takes function tools only there
+ (`gpt-5.6` and later, `gpt-5.4` and `gpt-5.5` once a run carries an effort, the `-pro` models:
+ "To use function tools, use /v1/responses"), and the
+ Chat Completions config otherwise, which every OpenAI-compatible endpoint serves. Both are
+ named explicitly: AG2 1.4.0 turns the bare `OpenAIConfig` into the Responses config, which
+ would move every compatible endpoint onto an API most of them do not serve.
"""
settings = bot_settings("agent-ag2")
provider = settings.provider
@@ -35,7 +42,9 @@ def _config() -> AnthropicConfig | OpenAIConfig:
# The same "" for OPENAI_BASE_URL, which Compose writes whenever the model screen chose a plain
# OpenAI key. The SDK only defaults an absent URL; given "", every request fails to connect.
base_url = (os.environ.get("OPENAI_BASE_URL") or "").strip() or "https://api.openai.com/v1"
- return OpenAIConfig(model=model, base_url=base_url)
+ if openai_api(model) == "responses":
+ return OpenAIResponsesConfig(model=model, base_url=base_url)
+ return OpenAICompletionsConfig(model=model, base_url=base_url)
agent = Agent(
diff --git a/agent-ag2/tests/test_main.py b/agent-ag2/tests/test_main.py
index e3824d90d0..16a5f19007 100644
--- a/agent-ag2/tests/test_main.py
+++ b/agent-ag2/tests/test_main.py
@@ -150,15 +150,17 @@ def provider():
},
("openai", "local-model"),
),
+ # A model OpenAI serves on Chat Completions with any effort; which API each model takes is
+ # tests/test_responses_api.py's question.
"an OpenAI key": (
lambda base: {
"BOT_PROVIDER": "",
- "BOT_MODEL": "gpt-5.5",
+ "BOT_MODEL": "gpt-5.2",
"OPENAI_API_KEY": "test-key",
"OPENAI_BASE_URL": f"{base}/v1",
"ANTHROPIC_API_KEY": "",
},
- ("openai", "gpt-5.5"),
+ ("openai", "gpt-5.2"),
),
}
@@ -251,7 +253,7 @@ async def respond(transport, request):
monkeypatch.setattr(httpx2.AsyncHTTPTransport, "handle_async_request", respond)
monkeypatch.setenv("MANAGED_AGENT_TOKEN", TOKEN)
monkeypatch.setenv("BOT_PROVIDER", "openai")
- monkeypatch.setenv("BOT_MODEL", "gpt-5.5")
+ monkeypatch.setenv("BOT_MODEL", "gpt-5.2")
monkeypatch.setenv("OPENAI_API_KEY", "test-key")
monkeypatch.setenv("OPENAI_BASE_URL", "")
monkeypatch.setenv("ANTHROPIC_API_KEY", "")
@@ -265,7 +267,7 @@ async def respond(transport, request):
)
assert seen == [("https://api.openai.com/v1/chat/completions", "Bearer test-key")]
- assert provider_seen == [("openai", "gpt-5.5")]
+ assert provider_seen == [("openai", "gpt-5.2")]
assert response.status_code == 200
assert '"RUN_FINISHED"' in response.text
assert '"RUN_ERROR"' not in response.text
diff --git a/agent-ag2/tests/test_responses_api.py b/agent-ag2/tests/test_responses_api.py
new file mode 100644
index 0000000000..015261e502
--- /dev/null
+++ b/agent-ag2/tests/test_responses_api.py
@@ -0,0 +1,311 @@
+"""OpenAI models that take function tools only on the Responses API get it, tools and results alike.
+
+OpenAI's own words for `gpt-5.6` and later on Chat Completions, and for `gpt-5.4` and `gpt-5.5` with
+a reasoning effort: "Function tools with reasoning_effort are not supported for this model in
+/v1/chat/completions. To use function tools, use /v1/responses". The `-pro` models are not served there at all: "This is not a chat model and
+thus not supported in the v1/chat/completions endpoint." The real AG2 and OpenAI clients run here;
+only the provider at the other end of OPENAI_BASE_URL is local, and it answers the way OpenAI
+does, refusals included.
+"""
+
+import importlib
+import json
+import socket
+import sys
+import threading
+import time
+from pathlib import Path
+from uuid import uuid4
+
+import pytest
+import uvicorn
+from fastapi import FastAPI, Request
+from fastapi.responses import JSONResponse
+from fastapi.testclient import TestClient
+
+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
+
+TOKEN = "responses-token"
+TOOL = {
+ "name": "look_up_order",
+ "description": "Look up the status of an order by its number.",
+ "parameters": {
+ "type": "object",
+ "properties": {"order": {"type": "string", "description": "The order number."}},
+ "required": ["order"],
+ },
+}
+ARGUMENTS = {"order": "A-1001"}
+
+# What the picker lists that OpenAI serves function tools for only on /v1/responses, or, for the
+# 5.4 and 5.5 families, only there once a run carries a reasoning effort (OpenAI, 2026-11-17).
+RESPONSES_MODELS = [
+ "gpt-5.6-luna",
+ "gpt-6-sol",
+ "gpt-6.1-terra",
+ "gpt-6.2-astra",
+ "gpt-5.5-pro",
+ "o3-pro",
+ "gpt-5.5",
+ "gpt-5.4-mini",
+]
+REFUSED_ONLY_WITH_EFFORT = {"gpt-5.5", "gpt-5.4-mini"}
+# Reasoning and non-reasoning models that still take tools on Chat Completions.
+CHAT_MODELS = ["gpt-5.2", "o3", "gpt-4.1-mini"]
+# The models that refuse `temperature`. `gpt-5.2` and `gpt-5.4-mini` take it (OpenAI, 2026-11-17).
+REASONING = {"o3", *RESPONSES_MODELS} - {"gpt-5.4-mini"}
+
+
+def _provider_app(seen):
+ app = FastAPI()
+
+ def refuse(message, status=400):
+ return JSONResponse(
+ {"error": {"message": message, "type": "invalid_request_error", "param": None, "code": None}},
+ status_code=status,
+ )
+
+ @app.post("/v1/chat/completions")
+ async def chat(request: Request):
+ body = await request.json()
+ seen.append(("/v1/chat/completions", body))
+ model = body["model"]
+ if model.endswith("-pro"):
+ return refuse("This is not a chat model and thus not supported in the v1/chat/completions endpoint.", 404)
+ if model in RESPONSES_MODELS and body.get("tools") and (
+ model not in REFUSED_ONLY_WITH_EFFORT or body.get("reasoning_effort") not in (None, "none")
+ ):
+ return refuse(
+ f"Function tools with reasoning_effort are not supported for {model} in "
+ "/v1/chat/completions. To use function tools, use /v1/responses or set "
+ "reasoning_effort to 'none'."
+ )
+ if model in REASONING and "temperature" in body:
+ return refuse("Unsupported value: 'temperature' does not support 0.2 with this model.")
+ if model == "o3" and "parallel_tool_calls" in body:
+ return refuse("Unsupported parameter: 'parallel_tool_calls' is not supported with this model.")
+ # AG2 follows a tool result with an empty user turn on this API, so look for the result.
+ results = [m for m in body["messages"] if m["role"] == "tool"]
+ if results:
+ message = {"role": "assistant", "content": "Observed: " + results[-1]["content"]}
+ finish = "stop"
+ else:
+ message = {
+ "role": "assistant",
+ "content": None,
+ "tool_calls": [
+ {
+ "id": "call-chat",
+ "type": "function",
+ "function": {"name": TOOL["name"], "arguments": json.dumps(ARGUMENTS)},
+ }
+ ],
+ }
+ finish = "tool_calls"
+ return JSONResponse(
+ {
+ "id": "chat",
+ "object": "chat.completion",
+ "created": 0,
+ "model": model,
+ "choices": [{"index": 0, "message": message, "finish_reason": finish}],
+ "usage": {"prompt_tokens": 1, "completion_tokens": 1, "total_tokens": 2},
+ }
+ )
+
+ @app.post("/v1/responses")
+ async def responses(request: Request):
+ body = await request.json()
+ seen.append(("/v1/responses", body))
+ if body["model"] in REASONING and "temperature" in body:
+ return refuse("Unsupported parameter: 'temperature' is not supported with this model.")
+ results = [item for item in body["input"] if item.get("type") == "function_call_output"]
+ if results:
+ output = [
+ {
+ "id": "msg",
+ "type": "message",
+ "role": "assistant",
+ "status": "completed",
+ "content": [
+ {"type": "output_text", "text": "Observed: " + results[-1]["output"], "annotations": []}
+ ],
+ }
+ ]
+ else:
+ output = [
+ {
+ "id": "fc",
+ "type": "function_call",
+ "status": "completed",
+ "call_id": "call-responses",
+ "name": body["tools"][0]["name"],
+ "arguments": json.dumps(ARGUMENTS),
+ }
+ ]
+ return JSONResponse(
+ {
+ "id": "resp-" + uuid4().hex,
+ "object": "response",
+ "created_at": 0,
+ "model": body["model"],
+ "status": "completed",
+ "output": output,
+ "parallel_tool_calls": body.get("parallel_tool_calls", True),
+ "tool_choice": "auto",
+ "tools": body.get("tools", []),
+ # The usage OpenAI reports, details included: AG2 reads them.
+ "usage": {
+ "input_tokens": 1,
+ "input_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 0},
+ "output_tokens": 1,
+ "output_tokens_details": {"reasoning_tokens": 0},
+ "total_tokens": 2,
+ },
+ }
+ )
+
+ return app
+
+
+@pytest.fixture
+def provider():
+ seen = []
+ with socket.socket() as probe:
+ probe.bind(("127.0.0.1", 0))
+ port = probe.getsockname()[1]
+ server = uvicorn.Server(uvicorn.Config(_provider_app(seen), host="127.0.0.1", port=port, log_level="error"))
+ thread = threading.Thread(target=server.run, daemon=True)
+ thread.start()
+ deadline = time.monotonic() + 10
+ while not server.started and time.monotonic() < deadline:
+ time.sleep(0.01)
+ yield f"http://127.0.0.1:{port}", seen
+ server.should_exit = True
+ thread.join(timeout=10)
+
+
+def _app(monkeypatch, base, model, api=None):
+ monkeypatch.delenv("OPENAI_API_BASE", raising=False)
+ if api is None:
+ monkeypatch.delenv("COPILOTKIT_OPENAI_API", raising=False)
+ else:
+ monkeypatch.setenv("COPILOTKIT_OPENAI_API", api)
+ monkeypatch.setenv("MANAGED_AGENT_TOKEN", TOKEN)
+ monkeypatch.setenv("BOT_PROVIDER", "openai")
+ monkeypatch.setenv("BOT_MODEL", model)
+ monkeypatch.setenv("OPENAI_API_KEY", "test-key")
+ monkeypatch.setenv("OPENAI_BASE_URL", f"{base}/v1")
+ monkeypatch.setenv("ANTHROPIC_API_KEY", "")
+ from src import main
+
+ return TestClient(importlib.reload(main).app)
+
+
+def _body(messages, thread):
+ return {
+ "threadId": thread,
+ "runId": str(uuid4()),
+ "state": {},
+ "messages": messages,
+ "tools": [TOOL],
+ "context": [],
+ "forwardedProps": {},
+ }
+
+
+def _run(client, body):
+ response = client.post("/", json=body, headers={"x-openbot-agent-token": TOKEN})
+ assert response.status_code == 200
+ events = [json.loads(line[5:]) for line in response.text.splitlines() if line.startswith("data:")]
+ assert not [e for e in events if e["type"] == "RUN_ERROR"], events
+ assert events[-1]["type"] == "RUN_FINISHED", events
+ return events
+
+
+def _tool_call_then_result(client):
+ """One run that calls the tool, then the run the browser sends back with the tool's result."""
+ thread = str(uuid4())
+ question = [{"id": "u1", "role": "user", "content": "Where is order A-1001?"}]
+ events = _run(client, _body(question, thread))
+ # AG2 sends a call as AG-UI's TOOL_CALL_CHUNK, which a client expands to start, args and end.
+ start = next((e for e in events if e["type"] in ("TOOL_CALL_START", "TOOL_CALL_CHUNK")), None)
+ assert start is not None, events
+ arguments = json.loads(
+ "".join(e.get("delta") or "" for e in events if e["type"] in ("TOOL_CALL_ARGS", "TOOL_CALL_CHUNK"))
+ )
+ assert start["toolCallName"] == TOOL["name"]
+ assert arguments == ARGUMENTS
+ assert any(e["type"] == "RUN_FINISHED" and start["toolCallId"] in json.dumps(e) for e in events)
+ result = "shipped-" + uuid4().hex
+ history = [
+ *question,
+ {
+ "id": start.get("parentMessageId") or "a1",
+ "role": "assistant",
+ "toolCalls": [
+ {
+ "id": start["toolCallId"],
+ "type": "function",
+ "function": {"name": TOOL["name"], "arguments": json.dumps(arguments)},
+ }
+ ],
+ },
+ {"id": "t1", "role": "tool", "toolCallId": start["toolCallId"], "content": result},
+ ]
+ events = _run(client, _body(history, thread))
+ text = "".join(e.get("delta", "") for e in events if e["type"] in ("TEXT_MESSAGE_CONTENT", "TEXT_MESSAGE_CHUNK"))
+ assert "Observed: " + result in text
+ return start, result
+
+
+@pytest.mark.parametrize("model", RESPONSES_MODELS)
+def test_a_responses_only_model_calls_tools_and_reads_results_through_the_responses_api(
+ monkeypatch, provider, model
+):
+ base, seen = provider
+ client = _app(monkeypatch, base, model)
+
+ start, result = _tool_call_then_result(client)
+
+ assert [path for path, _ in seen] == ["/v1/responses", "/v1/responses"]
+ first, second = (body for _, body in seen)
+ assert first["model"] == model
+ tool = next(t for t in first["tools"] if t["name"] == TOOL["name"])
+ assert tool["type"] == "function"
+ assert tool["parameters"]["properties"] == TOOL["parameters"]["properties"]
+ assert "temperature" not in first
+ assert {
+ "type": "function_call_output",
+ "call_id": start["toolCallId"],
+ "output": result,
+ }.items() <= next(i for i in second["input"] if i.get("type") == "function_call_output").items()
+
+
+@pytest.mark.parametrize("model", CHAT_MODELS)
+def test_a_model_that_takes_tools_on_chat_completions_stays_there_without_refused_fields(
+ monkeypatch, provider, model
+):
+ base, seen = provider
+ client = _app(monkeypatch, base, model)
+
+ _tool_call_then_result(client)
+
+ assert [path for path, _ in seen] == ["/v1/chat/completions", "/v1/chat/completions"]
+ for _, body in seen:
+ assert "temperature" not in body
+ if model == "o3":
+ assert "parallel_tool_calls" not in body
+
+
+@pytest.mark.parametrize(("api", "model", "path"), [
+ ("chat", "gpt-5.5", "/v1/chat/completions"),
+ ("responses", "gpt-4.1-mini", "/v1/responses"),
+])
+def test_an_operator_choice_of_openai_api_wins(monkeypatch, provider, api, model, path):
+ base, seen = provider
+ client = _app(monkeypatch, base, model, api=api)
+
+ _tool_call_then_result(client)
+
+ assert [p for p, _ in seen] == [path, path]
diff --git a/agent-agno/src/main.py b/agent-agno/src/main.py
index f45885ce79..145f905487 100644
--- a/agent-agno/src/main.py
+++ b/agent-agno/src/main.py
@@ -45,6 +45,21 @@ def _model_id() -> str:
return f"{provider}/{model}"
+def _sampling() -> dict:
+ """The sampling parameters Agno sends, as the chosen provider's API takes them.
+
+ Agno sends `temperature=0.7` and `top_p=1.0` on every request. A `top_p` of 1.0 keeps every
+ token, which is what Anthropic's Messages API does when none is sent, and Claude 4.5 and 4.6 refuse a
+ request that names both ("`temperature` and `top_p` cannot both be specified for this model").
+ Leaving `top_p` out keeps the temperature this Bot has always run at. Claude models that take no
+ sampling parameters at all lose the temperature too, through `drop_params` below. Every other
+ provider is sent what it was sent before.
+ """
+ if bot_settings("agent-agno").provider == "anthropic":
+ return {"top_p": None}
+ return {}
+
+
# Before the app is built: Agno's AG-UI router would otherwise send the model only the newest line.
answer_from_the_whole_thread(_model_id())
@@ -59,7 +74,7 @@ def _model_id() -> str:
# refuses both for a reasoning model, the default `gpt-5.5` among them: every run on an OpenAI
# key failed before it reached OpenAI. A parameter a model does not take is dropped instead,
# for this one client, as the LlamaIndex Bot does.
- model=LiteLLM(id=_model_id(), request_params={"drop_params": True}),
+ model=LiteLLM(id=_model_id(), request_params={"drop_params": True}, **_sampling()),
# No role, goal or backstory invented on somebody's behalf. A Bot answers the question it is
# asked, and anybody who wants a persona sets one in OpenBot where the rest of them live.
instructions="Answer the question you are asked, briefly and correctly.",
diff --git a/agent-agno/tests/test_main.py b/agent-agno/tests/test_main.py
index 201b80a9fe..30e8960727 100644
--- a/agent-agno/tests/test_main.py
+++ b/agent-agno/tests/test_main.py
@@ -34,7 +34,7 @@ async def stream():
return StreamingResponse(stream(), media_type="text/event-stream")
-def _provider_app(seen):
+def _provider_app(seen, bodies):
app = FastAPI()
@app.post("/v1/chat/completions")
@@ -79,6 +79,20 @@ async def openai_chat(request: Request):
async def anthropic_messages(request: Request):
body = await request.json()
seen.append(("anthropic", body["model"]))
+ bodies.append(body)
+ # What Anthropic answers for Claude 4.5 and 4.6 (Haiku, Sonnet and Opus), word for word
+ # from the model-compatibility run: they take a temperature or a `top_p`, never both.
+ if "temperature" in body and "top_p" in body:
+ return JSONResponse(
+ {
+ "type": "error",
+ "error": {
+ "type": "invalid_request_error",
+ "message": "`temperature` and `top_p` cannot both be specified for this model.",
+ },
+ },
+ status_code=400,
+ )
message = {
"id": "msg",
"type": "message",
@@ -111,18 +125,19 @@ async def anthropic_messages(request: Request):
@pytest.fixture
def provider():
seen = []
+ bodies = []
with socket.socket() as probe:
probe.bind(("127.0.0.1", 0))
port = probe.getsockname()[1]
server = uvicorn.Server(
- uvicorn.Config(_provider_app(seen), host="127.0.0.1", port=port, log_level="error")
+ uvicorn.Config(_provider_app(seen, bodies), host="127.0.0.1", port=port, log_level="error")
)
thread = threading.Thread(target=server.run, daemon=True)
thread.start()
deadline = time.monotonic() + 10
while not server.started and time.monotonic() < deadline:
time.sleep(0.01)
- yield f"http://127.0.0.1:{port}", seen
+ yield f"http://127.0.0.1:{port}", seen, bodies
server.should_exit = True
thread.join(timeout=10)
@@ -188,21 +203,58 @@ def provider():
@pytest.mark.parametrize("choice", list(CHOICES))
def test_a_run_reaches_the_model_the_setup_screen_chose(monkeypatch, provider, choice):
- base, seen = provider
+ base, seen, _ = provider
environment, expected = CHOICES[choice]
+ response = _run(monkeypatch, environment(base))
+
+ assert response.status_code == 200
+ assert '"RUN_FINISHED"' in response.text
+ assert '"RUN_ERROR"' not in response.text
+ assert seen == [expected]
+
+
+# The Claude models the picker lists that take a temperature or a `top_p` but not both. Agno sends
+# both on every request (0.7 and 1.0), so every run on one of them was refused before this Bot
+# answered.
+CLAUDE_TAKING_ONE_SAMPLING_PARAM = [
+ "claude-haiku-4-5",
+ "claude-opus-4-5",
+ "claude-opus-4-6",
+ "claude-sonnet-4-5",
+ "claude-sonnet-4-6",
+]
+
+
+@pytest.mark.parametrize("model", CLAUDE_TAKING_ONE_SAMPLING_PARAM)
+def test_a_claude_model_is_sent_a_temperature_and_no_top_p(monkeypatch, provider, model):
+ base, seen, bodies = provider
+ response = _run(
+ monkeypatch,
+ {
+ "BOT_PROVIDER": "anthropic",
+ "BOT_MODEL": model,
+ "ANTHROPIC_API_KEY": "test-key",
+ "ANTHROPIC_BASE_URL": base,
+ "OPENAI_API_KEY": "",
+ "OPENAI_BASE_URL": "",
+ },
+ )
+
+ assert response.status_code == 200
+ assert '"RUN_ERROR"' not in response.text
+ assert '"RUN_FINISHED"' in response.text
+ assert seen == [("anthropic", model)]
+ assert bodies[0]["temperature"] == 0.7
+ assert "top_p" not in bodies[0]
+
+
+def _run(monkeypatch, environment):
monkeypatch.delenv("OPENAI_API_BASE", raising=False)
monkeypatch.setenv("MANAGED_AGENT_TOKEN", TOKEN)
- for key, value in environment(base).items():
+ for key, value in environment.items():
monkeypatch.setenv(key, value)
from src import main
main = importlib.reload(main)
- response = TestClient(main.app).post(
- "/agui", json=RUN, headers={"x-openbot-agent-token": TOKEN}
- )
-
- assert response.status_code == 200
- assert '"RUN_FINISHED"' in response.text
- assert '"RUN_ERROR"' not in response.text
- assert seen == [expected]
+ return TestClient(main.app).post("/agui", json=RUN, headers={"x-openbot-agent-token": TOKEN})
diff --git a/agent-claude-sdk/requirements.txt b/agent-claude-sdk/requirements.txt
index 09a4930656..3ac7d8b8e3 100644
--- a/agent-claude-sdk/requirements.txt
+++ b/agent-claude-sdk/requirements.txt
@@ -1,5 +1,5 @@
ag-ui-claude-sdk==0.1.5
-claude-agent-sdk==0.2.152
+claude-agent-sdk==0.2.182
fastapi
python-multipart
uvicorn[standard]
diff --git a/agent-claude-sdk/src/adapter.py b/agent-claude-sdk/src/adapter.py
index 1ce963974d..b909bcd0a9 100644
--- a/agent-claude-sdk/src/adapter.py
+++ b/agent-claude-sdk/src/adapter.py
@@ -306,16 +306,44 @@ def fitted_result(content):
class ModelRefusedError(Exception):
- """The model provider refused the run, in Claude Code's words for it.
-
- Claude Code answers a refusal (out of credit, a rate limit, an unknown model, a prompt too long,
- the API down) with an assistant message of its own, marked with `error`. Streamed as one, it read
- as the Bot's answer: "API Error: Request rejected (429) · This request would exceed the rate
- limit …", and the turn finished as if it had worked. It ends the run as a RUN_ERROR instead,
- coded `OPENBOT_MODEL_REFUSED`, and the server says it in words
- (server/src/agents/provider-refusal.ts).
+ """The model provider answered the run with an error, in Claude Code's words for it.
+
+ Claude Code answers a failed request (out of credit, a rate limit, a plan's limit, an unknown
+ model, a prompt too long, the API down, a dropped connection) with an assistant message of its
+ own, marked with `error`. Streamed as one, it read as the Bot's answer: "API Error: Request
+ rejected (429) · This request would exceed the rate limit …", and the turn finished as if it had
+ worked. It ends the run as a RUN_ERROR instead, coded `OPENBOT_MODEL_REFUSED`, and the server says
+ it in words.
+
+ `category` is Claude Code's own name for what went wrong (`error_category`), sent on the
+ RUN_ERROR as `metadata.errorCategory`. Only "refusal" says the model declined to answer; the
+ others say why the request failed. The code stays the one every server reads, so a server that
+ predates the category still places the words as it did.
"""
+ def __init__(self, text, category=None):
+ super().__init__(text)
+ self.category = category
+
+
+# What Claude Code calls an error on its message: `AssistantMessageError` in claude-agent-sdk
+# 0.2.152 ("authentication_failed", "billing_error", "rate_limit", "invalid_request",
+# "server_error", "unknown"), and the few more its CLI writes ("model_not_found", "account_on_hold",
+# "oauth_org_not_allowed"). A name, never words: anything else is sent as "unknown".
+CATEGORY = re.compile(r"^[a-z][a-z_]{0,39}$")
+
+
+def error_category(message):
+ """Claude Code's category for a failed message, or "refusal" when the model declined.
+
+ Claude declining to answer is the one real refusal. Claude Code marks it `invalid_request`,
+ the same as a malformed request, and tells them apart only by the message's stop reason.
+ """
+ if getattr(message, "stop_reason", None) == "refusal":
+ return "refusal"
+ error = message.error
+ return error if isinstance(error, str) and CATEGORY.match(error) else "unknown"
+
class ModelUnreachableError(Exception):
"""Nothing answered at the model's address: the connection was refused, the host doesn't
@@ -441,6 +469,9 @@ class _Turn:
model: str | None = None
# The newest run's input: the whole thread, with every result the browser has sent so far.
latest: object = None
+ # Calls on the model endpoint to a tool the step did not offer, which Claude Code answers
+ # itself. See `_not_held`.
+ not_held: set[str] = field(default_factory=set)
def result(self, tool_id):
if tool_id not in self.results:
@@ -969,7 +1000,14 @@ async def messages():
logger.warning("The model couldn't be reached: %s", refusal_text(message))
raise ModelUnreachableError(unreachable_message(model_address()))
if isinstance(message, AssistantMessage) and message.error:
- raise ModelRefusedError(refusal_text(message))
+ category = error_category(message)
+ if category == "refusal":
+ logger.warning("The model declined to answer: %s", refusal_text(message))
+ else:
+ logger.warning(
+ "The model request failed (%s): %s", category, refusal_text(message)
+ )
+ raise ModelRefusedError(refusal_text(message), category)
if (
isinstance(message, StreamEvent)
and message.event.get("type") == "message_start"
@@ -1124,9 +1162,12 @@ async def _pump(self, input_data, turn):
RunErrorEvent(message=START_FAILED, code="OPENBOT_HARNESS_START_FAILED")
)
return
+ category = error.category if isinstance(error, ModelRefusedError) else None
await turn.queue.put(
RunErrorEvent(
message=str(error),
+ # Claude Code's own category, which the server tells the person by.
+ metadata={"errorCategory": category} if category else None,
code="OPENBOT_MODEL_AUTH_REQUIRED"
if isinstance(error, ModelAuthenticationError)
else "OPENBOT_MODEL_REFUSED"
@@ -1195,9 +1236,41 @@ def named(call):
}
)
+ def _not_held(self, event, turn):
+ """Whether this event belongs to a call of a tool this step was not offered.
+
+ On the model endpoint the query holds exactly the step's tools (see `run`). The model can
+ still ask for one it does not hold: an app action it knows by name from the conversation, a
+ tool an earlier step was offered, or one it guessed. Claude Code answers such a call itself,
+ with "No such tool available", and the model carries on in the same query. Upstream streams
+ the call as it starts, before Claude Code has looked at it, and the server ends a run that
+ names a tool the step did not offer: FOUND IN DOGFOODING, a Bot asked to add HubSpot deals
+ to a posted Slack update called `SLACK_UPDATES_A_SLACK_MESSAGE`, which it did not hold, and
+ five minutes of work ended on an error. Nothing of such a call is passed on, so the server
+ only ever hears of calls to tools it offered, and the person reads the model's answer.
+ """
+ if not self._model_only:
+ return False
+ if event.type == EventType.TOOL_CALL_START:
+ if event.tool_call_name in turn.tool_names:
+ return False
+ turn.not_held.add(event.tool_call_id)
+ logger.warning(
+ "Claude called a tool this step did not offer; Claude Code answers it: %s",
+ event.tool_call_name,
+ )
+ return True
+ return (
+ event.type
+ in (EventType.TOOL_CALL_ARGS, EventType.TOOL_CALL_END, EventType.TOOL_CALL_RESULT)
+ and event.tool_call_id in turn.not_held
+ )
+
async def _pump_query(self, input_data, turn, fit_results=False):
async for event in self._run_query(input_data, fit_results=fit_results):
event = self._named_as_offered(event, turn)
+ if self._not_held(event, turn):
+ continue
if event.type == EventType.RUN_ERROR and turn.authentication_failed:
event = event.model_copy(
update={"code": "OPENBOT_MODEL_AUTH_REQUIRED"}
diff --git a/agent-claude-sdk/tests/test_claude_code_version.py b/agent-claude-sdk/tests/test_claude_code_version.py
new file mode 100644
index 0000000000..fc85206e76
--- /dev/null
+++ b/agent-claude-sdk/tests/test_claude_code_version.py
@@ -0,0 +1,45 @@
+"""The Claude Code this harness ships is new enough for the Claude models people pick.
+
+FOUND IN A USER'S SERVER LOG: a Bot on this harness, signed in with a Claude plan, got "API Error:
+400 Claude Code 2.1.259 does not support this model; version 2.1.290 or newer is required."
+Anthropic turns away a Claude Code too old for the model. Measured per model with the CLI itself:
+2.1.259 is refused on Opus 5.5 (needs 2.1.280) and Fable 5.2 (needs 2.1.290), 2.1.289 is still
+refused on Fable 5.2, and 2.1.290 answers on Fable 5.2, Opus 5.5, Sonnet 5.5 and Haiku 5.5. The
+harness runs the Claude Code bundled in the claude-agent-sdk package, so the package pin decides it.
+
+This asks the CLI the harness actually starts (found the way the SDK finds it) for its version.
+"""
+
+import os
+import re
+import subprocess
+
+from claude_agent_sdk import ClaudeAgentOptions
+from claude_agent_sdk._internal.transport.subprocess_cli import SubprocessCLITransport
+
+# The oldest Claude Code Anthropic accepts on every current model (Fable 5.2 sets it), in its own
+# error message.
+MINIMUM = (2, 1, 290)
+
+
+def test_bundled_claude_code_is_new_enough_for_current_models(tmp_path):
+ # The adapter never sets cli_path, so the SDK picks the CLI exactly like this.
+ cli = SubprocessCLITransport(prompt="", options=ClaudeAgentOptions())._find_cli()
+ assert "_bundled" in cli, f"expected the CLI bundled with claude-agent-sdk, found {cli}"
+
+ out = subprocess.run(
+ [cli, "--version"],
+ capture_output=True,
+ text=True,
+ timeout=60,
+ check=True,
+ env={**os.environ, "HOME": str(tmp_path)},
+ ).stdout
+ found = re.search(r"(\d+)\.(\d+)\.(\d+)", out)
+ assert found, f"no version in {out!r}"
+ version = tuple(int(part) for part in found.groups())
+
+ assert version >= MINIMUM, (
+ f"Claude Code {'.'.join(map(str, version))} is bundled; Anthropic requires "
+ f"{'.'.join(map(str, MINIMUM))} or newer for Fable 5.2 (and 2.1.280 for Opus 5.5)"
+ )
diff --git a/agent-claude-sdk/tests/test_provider_refusal.py b/agent-claude-sdk/tests/test_provider_refusal.py
index cb0fd3bbe2..e4bcab8240 100644
--- a/agent-claude-sdk/tests/test_provider_refusal.py
+++ b/agent-claude-sdk/tests/test_provider_refusal.py
@@ -52,7 +52,7 @@
]
-def refused(monkeypatch, error, text):
+def refused(monkeypatch, error, text, stop_reason=None):
"""Claude Code, answering every query with its message for one refusal."""
class Client:
@@ -75,7 +75,10 @@ async def query(self, prompt, session_id):
async def receive_response(self):
yield AssistantMessage(
- content=[TextBlock(text=text)], model="", error=error
+ content=[TextBlock(text=text)],
+ model="",
+ error=error,
+ stop_reason=stop_reason,
)
yield ResultMessage(
subtype="success",
@@ -104,11 +107,7 @@ def ask():
)
-@pytest.mark.parametrize("model_only", [False, True])
-@pytest.mark.parametrize("error,text", REFUSALS)
-def test_a_provider_refusal_ends_the_run_as_a_refusal(monkeypatch, model_only, error, text):
- refused(monkeypatch, error, text)
-
+def run_all(model_only=False):
async def scenario():
adapter = OpenBotClaudeAgentAdapter(name="refused", model_only=model_only)
try:
@@ -117,14 +116,77 @@ async def scenario():
finally:
await adapter.shutdown()
- events = asyncio.run(scenario())
+ return asyncio.run(scenario())
+
+
+def category_of(event):
+ return (event.metadata or {}).get("errorCategory")
+
+
+@pytest.mark.parametrize("model_only", [False, True])
+@pytest.mark.parametrize("error,text", REFUSALS)
+def test_a_provider_refusal_ends_the_run_as_a_refusal(monkeypatch, model_only, error, text):
+ refused(monkeypatch, error, text)
+
+ events = run_all(model_only)
assert events[-1].type == "RUN_ERROR", [event.type for event in events]
assert events[-1].code == "OPENBOT_MODEL_REFUSED"
# Claude Code's words go to the server, which keeps them for its log.
assert events[-1].message == text
+ # With Claude Code's own category for them, which the server tells the person by.
+ assert category_of(events[-1]) == error
# And never into the conversation as the Bot's reply.
assert not [
event
for event in events
if event.type in ("TEXT_MESSAGE_CONTENT", "MESSAGES_SNAPSHOT")
]
+
+
+# FOUND LIVE. A person signed in with a Claude plan read "Claude turned down the request. Try again,
+# or choose another model if it keeps happening." on ordinary messages while the Claude app worked.
+# Claude Code had said they were at their plan's limit, and this harness ended the run with only its
+# words, which the server could not place and so called a refusal. Captured from Claude Code 2.1.259
+# (claude-agent-sdk 0.2.152): the line it writes for a plan limit with its reset time, and its line
+# for a dropped connection, each with the category it gives it.
+@pytest.mark.parametrize(
+ "error,text",
+ [
+ ("rate_limit", "You've hit your limit · resets 3pm"),
+ ("rate_limit", "You've hit your session limit · resets 3pm"),
+ ("server_error", "API Error: Connection dropped (ECONNRESET)"),
+ ("server_error", "API Error: No response from API"),
+ ("unknown", "API Error: Connection error."),
+ # Seen in a person's server log: Claude Code too old for the model it was asked for.
+ (
+ "invalid_request",
+ "API Error: 400 Claude Code 2.1.259 does not support this model; version 2.1.290 or "
+ "newer is required. Run 'claude update', or update the Claude desktop app, then try "
+ "again.",
+ ),
+ ],
+)
+def test_a_plan_limit_or_a_dropped_connection_comes_back_as_itself_not_a_refusal(
+ monkeypatch, error, text
+):
+ refused(monkeypatch, error, text)
+
+ events = run_all()
+ assert events[-1].type == "RUN_ERROR", [event.type for event in events]
+ assert category_of(events[-1]) == error
+ assert category_of(events[-1]) != "refusal"
+ assert events[-1].message == text
+
+
+def test_only_a_real_refusal_is_called_one(monkeypatch):
+ # Claude declining to answer: Claude Code marks the message `invalid_request` and its stop
+ # reason `refusal`. That stop reason is the only thing that says the model declined.
+ text = (
+ "API Error: Claude can't help with this. Start a new session to continue.\n\n"
+ "Learn more: https://www.anthropic.com/legal/aup"
+ )
+ refused(monkeypatch, "invalid_request", text, stop_reason="refusal")
+
+ events = run_all()
+ assert events[-1].type == "RUN_ERROR"
+ assert category_of(events[-1]) == "refusal"
diff --git a/agent-claude-sdk/tests/test_tool_not_offered.py b/agent-claude-sdk/tests/test_tool_not_offered.py
new file mode 100644
index 0000000000..b7ffaf0e95
--- /dev/null
+++ b/agent-claude-sdk/tests/test_tool_not_offered.py
@@ -0,0 +1,231 @@
+"""On the model endpoint, the server only ever hears of calls to the tools a step offered.
+
+FOUND IN DOGFOODING. A Bot on a Claude plan, asked to find HubSpot deals and add them to a Slack
+update it had already posted, worked for five minutes and then failed with "The plan harness
+attempted an unoffered tool: mcp__composio-slack__SLACK_UPDATES_A_SLACK_MESSAGE". The Bot held
+Slack's other actions, offered to Claude Code as `mcp__ag_ui__mcp__composio-slack__SLACK_...`, and
+not that one. Claude called it anyway. Claude Code answered the call itself, "No such tool
+available", and the model carried on, but upstream had already streamed the call's start, and the
+server threw the whole run away on a name it had not offered.
+
+Real AG-UI adapter and SDK message types; the Claude process is a controlled fake that answers as
+Claude Code does: a call to a tool the session holds runs and waits in its PostToolUse hook for the
+server's result, a call to one it does not hold gets an `is_error` result and no hook.
+"""
+
+import asyncio
+import sys
+from pathlib import Path
+
+import claude_agent_sdk
+import pytest
+from ag_ui.core import EventType, RunAgentInput
+from claude_agent_sdk import (
+ AssistantMessage,
+ ResultMessage,
+ TextBlock,
+ ToolResultBlock,
+ ToolUseBlock,
+ UserMessage,
+)
+from claude_agent_sdk.types import StreamEvent
+
+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
+from src.adapter import AG_UI_TOOL_PREFIX, OpenBotClaudeAgentAdapter
+
+SEND = "mcp__composio-slack__SLACK_SEND_MESSAGE"
+DEALS = "mcp__composio-hubspot__HUBSPOT_SEARCH_DEALS"
+UPDATE = "mcp__composio-slack__SLACK_UPDATES_A_SLACK_MESSAGE"
+ANSWER = (
+ "Here are the deals at S1 and later: BeyondTrust and Rhythm Innovations. I can't edit a "
+ "message that's already posted in Slack. Want me to reply in its thread instead?"
+)
+
+
+def stream(thread, *raw):
+ return [StreamEvent(uuid="stream", session_id=thread, event=event) for event in raw]
+
+
+@pytest.fixture
+def claude(monkeypatch):
+ """Claude Code, answering with one call to `script["call"]`, named as Claude Code names it."""
+ script = {}
+
+ class Client:
+ def __init__(self, options):
+ self.options = options
+
+ async def connect(self):
+ pass
+
+ async def disconnect(self):
+ pass
+
+ async def interrupt(self):
+ pass
+
+ async def query(self, prompt, session_id):
+ self.thread = session_id
+
+ async def run_tool(self, name, tool_id):
+ output = [{"type": "text", "text": "Tool call forwarded to client"}]
+ for matcher in self.options.hooks.get("PostToolUse", []):
+ for hook in matcher.hooks:
+ update = await hook(
+ {"hook_event_name": "PostToolUse", "tool_name": name}, tool_id, {}
+ )
+ output = update.get("hookSpecificOutput", {}).get(
+ "updatedMCPToolOutput", output
+ )
+ return output[0]["text"]
+
+ async def receive_response(self):
+ thread, name, tool_id = self.thread, script["call"], "toolu_call"
+ for message in stream(
+ thread,
+ {"type": "message_start", "message": {"id": "asked"}},
+ {
+ "type": "content_block_start",
+ "index": 0,
+ "content_block": {"type": "tool_use", "id": tool_id, "name": name},
+ },
+ {
+ "type": "content_block_delta",
+ "index": 0,
+ "delta": {"type": "input_json_delta", "partial_json": '{"channel":"C1"}'},
+ },
+ {"type": "content_block_stop", "index": 0},
+ {"type": "message_stop"},
+ ):
+ yield message
+ yield AssistantMessage(
+ content=[ToolUseBlock(id=tool_id, name=name, input={"channel": "C1"})],
+ model="controlled-sdk",
+ )
+ if name in script["held"]:
+ result = await self.run_tool(name, tool_id)
+ yield UserMessage(content=[ToolResultBlock(tool_use_id=tool_id, content=result)])
+ else:
+ yield UserMessage(
+ content=[
+ ToolResultBlock(
+ tool_use_id=tool_id,
+ content=f"Error: No such tool available: {name}",
+ is_error=True,
+ )
+ ]
+ )
+ for message in stream(
+ thread,
+ {"type": "message_start", "message": {"id": "answered"}},
+ {"type": "content_block_start", "index": 0, "content_block": {"type": "text", "text": ""}},
+ {"type": "content_block_delta", "index": 0, "delta": {"type": "text_delta", "text": ANSWER}},
+ {"type": "content_block_stop", "index": 0},
+ {"type": "message_stop"},
+ ):
+ yield message
+ yield AssistantMessage(content=[TextBlock(text=ANSWER)], model="controlled-sdk")
+ yield ResultMessage(
+ subtype="success",
+ duration_ms=1,
+ duration_api_ms=1,
+ is_error=False,
+ num_turns=2,
+ session_id=thread,
+ )
+
+ monkeypatch.setattr(claude_agent_sdk, "ClaudeSDKClient", Client)
+ return script
+
+
+def request(run="run-1", results=()):
+ return RunAgentInput.model_validate(
+ {
+ "threadId": "thread-deals",
+ "runId": run,
+ "state": None,
+ "messages": [
+ {
+ "id": "user-1",
+ "role": "user",
+ "content": "Find all HubSpot deals at S1 and later and add them to the Slack update.",
+ },
+ *[
+ {"id": f"result-{tool_id}", "role": "tool", "toolCallId": tool_id, "content": text}
+ for tool_id, text in results
+ ],
+ ],
+ "tools": [
+ {"name": name, "description": name, "parameters": {"type": "object", "properties": {}}}
+ for name in (SEND, DEALS)
+ ],
+ "context": [],
+ "forwardedProps": {"openbotModelOnly": True},
+ }
+ )
+
+
+async def events(adapter, input_data):
+ async with asyncio.timeout(2):
+ return [event async for event in adapter.run(input_data)]
+
+
+def said(run):
+ return "".join(event.delta for event in run if event.type == EventType.TEXT_MESSAGE_CONTENT)
+
+
+def called(run):
+ return [event.tool_call_name for event in run if event.type == EventType.TOOL_CALL_START]
+
+
+def test_an_offered_tool_claude_code_calls_by_its_mcp_name_reaches_the_server_by_its_own(claude):
+ claude.update(call=f"{AG_UI_TOOL_PREFIX}{SEND}", held={f"{AG_UI_TOOL_PREFIX}{SEND}"})
+
+ async def scenario():
+ adapter = OpenBotClaudeAgentAdapter(name="openbot", model_only=True)
+ try:
+ first = await events(adapter, request())
+ # Claude Code's `mcp__ag_ui__mcp__composio-slack__...` is the server's own name again.
+ assert called(first) == [SEND]
+ assert first[-1].type == EventType.RUN_FINISHED
+ resumed = await events(adapter, request("run-2", [("toolu_call", '{"ok":true}')]))
+ assert ANSWER in said(resumed)
+ finally:
+ await adapter.shutdown()
+
+ asyncio.run(scenario())
+
+
+@pytest.mark.parametrize(
+ "name",
+ [
+ # Through OpenBot's own server, by the name of an action the step did not offer.
+ f"{AG_UI_TOOL_PREFIX}{UPDATE}",
+ # By the action's name alone, as the conversation spells it.
+ UPDATE,
+ ],
+)
+def test_a_tool_the_step_did_not_offer_never_reaches_the_server_and_the_model_answers(claude, name):
+ claude.update(call=name, held={f"{AG_UI_TOOL_PREFIX}{SEND}", f"{AG_UI_TOOL_PREFIX}{DEALS}"})
+
+ async def scenario():
+ adapter = OpenBotClaudeAgentAdapter(name="openbot", model_only=True)
+ try:
+ run = await events(adapter, request())
+ offered = {SEND, DEALS}
+ # The server hears of no call it did not offer, nor of Claude Code's answer to one.
+ assert set(called(run)) <= offered
+ assert not any(
+ event.type
+ in (EventType.TOOL_CALL_ARGS, EventType.TOOL_CALL_END, EventType.TOOL_CALL_RESULT)
+ for event in run
+ )
+ # The model was told, and answered in the same run.
+ assert ANSWER in said(run)
+ assert run[-1].type == EventType.RUN_FINISHED
+ assert not any(event.type == EventType.RUN_ERROR for event in run)
+ assert "thread-deals" not in adapter._turns
+ finally:
+ await adapter.shutdown()
+
+ asyncio.run(scenario())
diff --git a/agent-langgraph-agui/requirements-test.txt b/agent-langgraph-agui/requirements-test.txt
index e9c0c14818..324f96e752 100644
--- a/agent-langgraph-agui/requirements-test.txt
+++ b/agent-langgraph-agui/requirements-test.txt
@@ -1,3 +1,2 @@
-langchain-openai==1.6.0
pytest==9.0.2
pytest-asyncio==1.3.0
diff --git a/agent-langgraph-agui/requirements.txt b/agent-langgraph-agui/requirements.txt
index 73794e9adb..c835db6f2c 100644
--- a/agent-langgraph-agui/requirements.txt
+++ b/agent-langgraph-agui/requirements.txt
@@ -1,9 +1,17 @@
ag-ui-langgraph==0.0.45
-langgraph
+# The model clients, pinned to the set shared/model-lock.json proved against real models. Unpinned,
+# a fresh resolve takes whatever the LangChain packages released that morning: langchain-anthropic
+# 1.7.11 (2026-11-18) changed the anthropic-version header every Anthropic request carries, and only
+# CI noticed. Move them on purpose, with the model check (docs/releasing.md, "Model lock").
+langgraph==1.2.22
langchain
-langchain-openai
-langchain-anthropic
-langchain-google-genai
+langchain-core==1.8.2
+langchain-openai==1.8.1
+langchain-anthropic==1.7.10
+# Not imported by the harness, but its version decides the request langchain-anthropic sends,
+# so it moves with the rest of the set rather than on its own.
+anthropic==2.10.0
+langchain-google-genai==4.4.3
# google-genai 3.0.0 (2026-11-06) moved generateContent from /v1beta to /v1, which the Gemini
# boundary tests catch. Held on 2.x until the move is checked against the models Bots use.
google-genai>=2.34,<3
diff --git a/agent-langgraph-agui/src/main.py b/agent-langgraph-agui/src/main.py
index 36c1da905b..fafe9cf2be 100644
--- a/agent-langgraph-agui/src/main.py
+++ b/agent-langgraph-agui/src/main.py
@@ -104,8 +104,10 @@ def _resolve_provider(provider: str):
# `gpt-5.6-*` and every `gpt-6*` take function tools only on the Responses API, and the `-pro` and
# `-codex` models are not served on Chat Completions at all. OpenAI's own words: "GPT-6 Astra,
# GPT-6.1 Sol, and GPT-6.1 Terra support Chat Completions, but tool calling requires Responses."
+# `gpt-5.4*` and `gpt-5.5*` take tools on Chat Completions only without a reasoning effort: with one,
+# "Function tools with reasoning_effort are not supported for gpt-5.5 in /v1/chat/completions."
_RESPONSES_API_MODEL = re.compile(
- r"^gpt-5\.[6-9]|^gpt-[6-9]|^(?:gpt-[\d.]+|o\d+)-pro\b|^gpt-[\d.]+-codex\b"
+ r"^gpt-5\.[4-9]|^gpt-[6-9]|^(?:gpt-[\d.]+|o\d+)-pro\b|^gpt-[\d.]+-codex\b"
)
# The efforts each integration takes, as its own field declares them: `reasoning_effort` (alias
diff --git a/agent-langgraph-agui/src/tool_runtime.py b/agent-langgraph-agui/src/tool_runtime.py
index 6cb58defef..05bcd4e9d6 100644
--- a/agent-langgraph-agui/src/tool_runtime.py
+++ b/agent-langgraph-agui/src/tool_runtime.py
@@ -165,14 +165,52 @@ def provider_name() -> str:
return "Your model provider"
+# The kinds of refusal the server names: `errorCategory`, as the Claude harness sends Claude Code's.
+ERROR_CATEGORIES = frozenset(
+ {
+ "rate_limit",
+ "billing_error",
+ "server_error",
+ "invalid_request",
+ "authentication_failed",
+ "model_not_found",
+ "outdated_client",
+ "refusal",
+ "unknown",
+ }
+)
+
+
+def provider_category(error: BaseException) -> str | None:
+ """The kind of refusal the provider's error names itself, when it is one the server names.
+
+ OpenBot's own sign-in proxy (a Google or xAI sign-in on the desktop) reads the provider's
+ status and puts the kind in its error's `type`: Google's RESOURCE_EXHAUSTED is `rate_limit`,
+ UNAVAILABLE `server_error`, NOT_FOUND `model_not_found`. Of the providers' own types, only
+ OpenAI's `server_error` is one of these names, and it means the same.
+ """
+ for link in _links(error):
+ body = getattr(link, "body", None)
+ kind = body.get("type") if isinstance(body, dict) else None
+ if isinstance(kind, str) and kind in ERROR_CATEGORIES:
+ return kind
+ return None
+
+
def billing_refusal(error: BaseException) -> str | None:
"""The refusal as a person should read it, when the provider is out of credit or at its limit.
Told as that, with which provider and in its own words, rather than as "sign in again", which
an account with no credit cannot fix. None for any other error, which keeps its own handling.
+
+ Not when the error names another kind itself (`provider_category`). Google's free tier answers
+ its daily limit with "You exceeded your current quota, please check your plan and billing
+ details", which reads as out of credit and is a limit that resets.
"""
if not provider_refusal(error):
return None
+ if provider_category(error) not in (None, "billing_error"):
+ return None
said = _provider_detail(error) or str(error)
if not BILLING.search(f"{said} {error}"):
return None
@@ -397,10 +435,15 @@ async def run(self, input: RunAgentInput):
# Raised, it ended the response stream after RUN_STARTED with no terminal event,
# and the provider's reason never reached anyone. Coded as a refusal, so the server
# tells it in words and keeps the provider's for its log (provider-refusal.ts).
+ # The kind, when the error names it, goes with them as `errorCategory`.
message = provider_message(error)
+ category = provider_category(error)
logger.warning("The model provider refused the run: %s", message)
yield RunErrorEvent(
- type=EventType.RUN_ERROR, message=message, code="OPENBOT_MODEL_REFUSED"
+ type=EventType.RUN_ERROR,
+ message=message,
+ code="OPENBOT_MODEL_REFUSED",
+ **({"metadata": {"errorCategory": category}} if category else {}),
)
elif ended:
raise
diff --git a/agent-langgraph-agui/tests/test_model_choice.py b/agent-langgraph-agui/tests/test_model_choice.py
index 42569e84d5..9e9fa4e63b 100644
--- a/agent-langgraph-agui/tests/test_model_choice.py
+++ b/agent-langgraph-agui/tests/test_model_choice.py
@@ -588,13 +588,14 @@ async def test_openai_takes_a_responses_model_on_the_responses_api_with_its_effo
async def test_openai_takes_a_chat_completions_model_with_reasoning_effort(monkeypatch, effort):
monkeypatch.setenv("OPENAI_API_KEY", "sk-synthetic")
monkeypatch.setenv("BOT_PROVIDER", "openai")
- choice = {"model": "gpt-5.5", **({"reasoningEffort": effort} if effort else {})}
+ # gpt-5.2 takes function tools and an effort on Chat Completions (OpenAI, 2026-11-17).
+ choice = {"model": "gpt-5.2", **({"reasoningEffort": effort} if effort else {})}
with openai_capture(monkeypatch) as captured:
finished(await run(run_body(model=choice)))
[request] = captured
assert request["url"] == "https://api.openai.com/v1/chat/completions"
- assert request["body"]["model"] == "gpt-5.5"
+ assert request["body"]["model"] == "gpt-5.2"
assert request["body"].get("reasoning_effort") == effort
assert "reasoning" not in request["body"]
@@ -617,13 +618,16 @@ async def test_a_compatible_endpoint_gets_reasoning_effort_on_chat_completions(m
@pytest.mark.asyncio
@pytest.mark.parametrize("effort", ["low", None])
-async def test_a_responses_model_behind_a_base_url_is_called_on_the_responses_api(monkeypatch, effort):
+@pytest.mark.parametrize("model", ["gpt-5.6-terra", "gpt-5.5"])
+async def test_a_responses_model_behind_a_base_url_is_called_on_the_responses_api(
+ monkeypatch, effort, model
+):
# FOUND IN THE LIVE CHECK, whose model requests go through a recorder at OPENAI_BASE_URL. Told
# to run on gpt-5.6-terra, the harness sent it to Chat Completions because an address was set,
# and OpenAI refused every run that offered a tool: "Function tools with reasoning_effort are
# not supported for gpt-5.6-terra in /v1/chat/completions." The person read "Your model
- # provider is having problems right now."
- choice = {"model": "gpt-5.6-terra", **({"reasoningEffort": effort} if effort else {})}
+ # provider is having problems right now." gpt-5.5 with an effort is refused the same way.
+ choice = {"model": model, **({"reasoningEffort": effort} if effort else {})}
with fake_provider() as (base, bodies):
monkeypatch.setenv("OPENAI_API_KEY", "synthetic-proxied-key")
monkeypatch.setenv("OPENAI_BASE_URL", f"{base}/v1")
@@ -632,7 +636,7 @@ async def test_a_responses_model_behind_a_base_url_is_called_on_the_responses_ap
[body] = bodies
assert "input" in body and "messages" not in body, "the Responses API, not Chat Completions"
- assert body["model"] == "gpt-5.6-terra"
+ assert body["model"] == model
assert [tool["name"] for tool in body["tools"]] == ["lookup"]
assert body.get("reasoning") == ({"effort": effort} if effort else None)
assert "reasoning_effort" not in body
@@ -802,7 +806,7 @@ async def test_without_a_server_choice_the_deployment_model_answers(monkeypatch)
("gpt-5.6-terra", True),
("gpt-6", True),
("gpt-6.1-terra", True),
- ("gpt-5.5", False),
+ ("gpt-5.5", True),
(" gpt-5.6-terra", True),
("\tgpt-6 ", True),
("claude-sonnet-4-5", False),
@@ -815,12 +819,23 @@ async def test_without_a_server_choice_the_deployment_model_answers(monkeypatch)
("gpt-5.5-pro", True),
("o3-pro", True),
("gpt-5.3-codex", True),
+ ("gpt-5.5-2026-04-23", True),
+ ("gpt-5.4", True),
+ ("gpt-5.4-2026-03-05", True),
+ ("gpt-5.4-mini", True),
+ ("gpt-5.4-mini-2026-03-17", True),
+ ("gpt-5.4-nano", True),
("gpt-5", False),
- ("gpt-5.4-mini", False),
- ("gpt-5.5-2026-04-23", False),
+ ("gpt-5-mini", False),
+ ("gpt-5-nano", False),
+ ("gpt-5.1", False),
+ ("gpt-5.1-2025-11-13", False),
+ ("gpt-5.2", False),
+ ("gpt-5.2-2025-12-11", False),
("o3", False),
("openai/gpt-5.6-terra", True),
- ("openai/gpt-5.5", False),
+ ("openai/gpt-5.5", True),
+ ("openai/gpt-5.2", False),
("openai/gpt-oss-20b", False),
("qwen/qwen3-8b", False),
],
diff --git a/agent-langgraph-agui/tests/test_provider_boundaries.py b/agent-langgraph-agui/tests/test_provider_boundaries.py
index a5008e033f..9b2fb710bc 100644
--- a/agent-langgraph-agui/tests/test_provider_boundaries.py
+++ b/agent-langgraph-agui/tests/test_provider_boundaries.py
@@ -12,7 +12,6 @@
import httpx2
import pytest
-from anthropic import Anthropic
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
@@ -344,8 +343,13 @@ async def test_anthropic_selection_reaches_anthropic_boundary_without_openai_key
headers.get("x-api-key") == "sk-ant-openbot-ci"
or headers.get("authorization") == "Bearer sk-ant-openbot-ci"
)
- with Anthropic(api_key="sk-ant-openbot-ci") as sdk:
- assert headers["anthropic-version"] == sdk.default_headers["anthropic-version"]
+ # What Anthropic needs is a version it serves, and a request valid under that version, not the
+ # SDK's default: langchain-anthropic 1.7.11 sends 2023-06-01 on purpose where the SDK defaults
+ # to 2026-10-21. Both are current (platform.claude.com/docs/en/api/versioning), and every model
+ # answers on either. 2026-10-21 refuses temperature, top_p and top_k with a 400, so the harness
+ # sends none of them, and the request is valid whichever version the client picks.
+ assert headers["anthropic-version"] in {"2023-06-01", "2026-10-21"}
+ assert not {"temperature", "top_p", "top_k"} & captured[0]["body"].keys()
assert captured[0]["body"]["model"] == request_model
assert captured[0]["body"]["messages"] == [
{"role": "user", "content": "Say hello."}
diff --git a/agent-langgraph-agui/tests/test_tool_protocol.py b/agent-langgraph-agui/tests/test_tool_protocol.py
index 86f6ccbd18..05cc3f428a 100644
--- a/agent-langgraph-agui/tests/test_tool_protocol.py
+++ b/agent-langgraph-agui/tests/test_tool_protocol.py
@@ -346,6 +346,86 @@ async def test_a_provider_out_of_credit_is_told_as_that_never_as_sign_in_again(
assert said in message
+# OpenBot's sign-in proxy answering for Google, as it passes on Google's own refusals: Google's
+# words (captured with a free-tier Gemini sign-in on 2026-11-17), and the kind of refusal as `type`.
+GEMINI_SIGN_IN_QUOTA = (
+ 429,
+ {
+ "error": {
+ "message": "You exceeded your current quota, please check your plan and billing "
+ "details. For more information on this error, head to: "
+ "https://aistudio.google.com/docs/rate-limits. To monitor your current usage, head "
+ "to: https://ai.dev/rate-limit. Quota exceeded for metric… Please retry in "
+ "9h10m18.213644379s.",
+ "type": "rate_limit",
+ "code": "RESOURCE_EXHAUSTED",
+ "param": None,
+ }
+ },
+)
+GEMINI_SIGN_IN_BUSY = (
+ 503,
+ {
+ "error": {
+ "message": "This model is currently experiencing high demand. Spikes in demand are "
+ "usually temporary. Please try again later.",
+ "type": "server_error",
+ "code": "UNAVAILABLE",
+ "param": None,
+ }
+ },
+)
+GEMINI_SIGN_IN_RETIRED = (
+ 404,
+ {
+ "error": {
+ "message": "This model models/gemini-2.5-flash is no longer available to new users. "
+ "Please update your code to use models/gemini-3.8-flash for the latest features and "
+ "improvements. We recommend you to use the Interactions API "
+ "(https://aistudio.google.com/docs/get-started).",
+ "type": "model_not_found",
+ "code": "NOT_FOUND",
+ "param": None,
+ }
+ },
+)
+
+
+@pytest.mark.asyncio
+@pytest.mark.parametrize(
+ "refusal,category",
+ [
+ (GEMINI_SIGN_IN_QUOTA, "rate_limit"),
+ (GEMINI_SIGN_IN_BUSY, "server_error"),
+ (GEMINI_SIGN_IN_RETIRED, "model_not_found"),
+ ],
+)
+async def test_a_sign_in_refusal_keeps_google_words_and_the_kind_it_names(
+ boundary, refusal, category
+):
+ """Found on OpenBot Desktop signed in with Gemini: "ping" got no answer anybody could read.
+
+ The run ends with Google's own words and the kind the sign-in proxy named, as `errorCategory`,
+ for the server to say. Google's free-tier quota is a limit that resets, never out of credit,
+ however much its words mention billing.
+ """
+ boundary["model_refusal"] = refusal
+ events = await run_protocol(run_input([]), allow_error=True)
+ assert events[-1]["type"] == "RUN_ERROR", "every run ends with a terminal event"
+ status, body = refusal
+ assert events[-1]["code"] == "OPENBOT_MODEL_REFUSED"
+ assert events[-1]["message"] == f"Error code: {status} - {body['error']['message']}"
+ assert events[-1]["metadata"] == {"errorCategory": category}
+
+
+@pytest.mark.asyncio
+async def test_a_provider_type_that_is_not_a_category_sends_none(boundary):
+ boundary["model_refusal"] = OPENAI_TOO_MANY_TOOLS
+ events = await run_protocol(run_input([]), allow_error=True)
+ assert events[-1]["code"] == "OPENBOT_MODEL_REFUSED"
+ assert not events[-1].get("metadata")
+
+
def closed_port():
"""A loopback port with nothing listening on it."""
import socket
diff --git a/agent-langgraph-ts/Dockerfile b/agent-langgraph-ts/Dockerfile
new file mode 100644
index 0000000000..c7c3ad5ebc
--- /dev/null
+++ b/agent-langgraph-ts/Dockerfile
@@ -0,0 +1,22 @@
+# LangGraph in TypeScript, as a Bot. Node 22, because LangGraph JS 1.x requires it, running the
+# TypeScript sources directly (Node strips the types), so the image holds no build step.
+FROM node:22.23.5-bookworm-slim
+
+WORKDIR /app
+
+# Dependencies before source, so editing the Bot does not re-resolve the framework.
+COPY agent-langgraph-ts/package.json agent-langgraph-ts/package-lock.json ./
+RUN npm ci --omit=dev --no-audit --no-fund && npm cache clean --force
+
+COPY shared/listen-port.ts shared/run-notices.ts shared/model-providers.ts shared/model-providers.json /shared/
+COPY agent-langgraph-ts/src ./src
+
+ENV NODE_ENV=production PORT=4215
+EXPOSE 4215
+USER node
+
+HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=3 \
+ CMD ["node", "-e", "fetch('http://127.0.0.1:' + (process.env.PORT || 4215) + '/health').then((r) => process.exit(r.ok ? 0 : 1), () => process.exit(1))"]
+
+# 0.0.0.0 inside the container (see src/main.ts); Compose decides which host addresses publish it.
+CMD ["node", "--disable-warning=ExperimentalWarning", "src/main.ts"]
diff --git a/agent-langgraph-ts/package-lock.json b/agent-langgraph-ts/package-lock.json
new file mode 100644
index 0000000000..103a4f6286
--- /dev/null
+++ b/agent-langgraph-ts/package-lock.json
@@ -0,0 +1,928 @@
+{
+ "name": "agent-langgraph-ts",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "agent-langgraph-ts",
+ "dependencies": {
+ "@ag-ui/client": "1.0.5",
+ "@ag-ui/core": "1.0.5",
+ "@ag-ui/encoder": "1.0.5",
+ "@langchain/anthropic": "1.6.5",
+ "@langchain/core": "1.4.1",
+ "@langchain/google": "0.2.15",
+ "@langchain/langgraph": "1.7.5",
+ "@langchain/openai": "1.8.4"
+ },
+ "devDependencies": {
+ "@types/node": "22.20.5",
+ "typescript": "5.9.3"
+ },
+ "engines": {
+ "node": ">=22.18"
+ }
+ },
+ "node_modules/@ag-ui/client": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/@ag-ui/client/-/client-1.0.5.tgz",
+ "integrity": "sha512-p+j69TEs9vN8JHlBEQYVNgHuTnWYCWRGWpSxk6cuamQ3POdhp3Nf0pf6cTit1P827rOf22ypdbR+M5pbvqlD9A==",
+ "license": "MIT",
+ "dependencies": {
+ "@ag-ui/core": "1.0.5",
+ "@ag-ui/encoder": "1.0.5",
+ "@ag-ui/proto": "1.0.5",
+ "@types/uuid": "^10.0.0",
+ "compare-versions": "^6.1.1",
+ "fast-json-patch": "^3.1.1",
+ "rxjs": "7.8.1",
+ "untruncate-json": "^0.0.1",
+ "uuid": "^11.1.0"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.18 || ^4.0.0"
+ }
+ },
+ "node_modules/@ag-ui/core": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/@ag-ui/core/-/core-1.0.5.tgz",
+ "integrity": "sha512-W7xg7E/bVco3svYxZCp3CMqJ6/fB15U7yAaMS3mhLCwwlJXFzZJ/bGwMqnNrx6Afmj1WmnjFKzliYds+KFXMMQ==",
+ "license": "MIT",
+ "peerDependencies": {
+ "zod": "^3.25.18 || ^4.0.0"
+ },
+ "peerDependenciesMeta": {
+ "zod": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@ag-ui/encoder": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/@ag-ui/encoder/-/encoder-1.0.5.tgz",
+ "integrity": "sha512-SKg5jOF2FCVMcl1nSNlk4hZdX9jV5Jg2nce5+jxY7lLSsMkBNMXvEpxZdQ1oWef3YI8OJCyB3cADUI3eyzplhA==",
+ "license": "MIT",
+ "dependencies": {
+ "@ag-ui/core": "1.0.5",
+ "@ag-ui/proto": "1.0.5"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.18 || ^4.0.0"
+ }
+ },
+ "node_modules/@ag-ui/proto": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/@ag-ui/proto/-/proto-1.0.5.tgz",
+ "integrity": "sha512-HFtYEapXepL3VtCkN2YS1KO5wndjJ8+86d3Qag3EeGp1EKxljZW/hRWN3HiILUTVI5cJ3CqGXBycE1/IAKQsGA==",
+ "license": "MIT",
+ "dependencies": {
+ "@ag-ui/core": "1.0.5",
+ "@bufbuild/protobuf": "^2.2.5",
+ "@protobuf-ts/protoc": "^2.11.1"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.18 || ^4.0.0"
+ }
+ },
+ "node_modules/@anthropic-ai/sdk": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.10.0.tgz",
+ "integrity": "sha512-j4uVct5p3aGIz/BU4K8VU5vt2A6AueHTvx2gfF3xr4mVpwH9IJMWEAUKNwSwdZSJOHQq1Za2tv5huYc5v02D0w==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@opentelemetry/api": "^1.4.1",
+ "json-schema-to-ts": "^3.1.1",
+ "standardwebhooks": "^1.0.0"
+ },
+ "bin": {
+ "anthropic-ai-sdk": "bin/cli"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.0 || ^4.0.0"
+ },
+ "peerDependenciesMeta": {
+ "zod": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@babel/runtime": {
+ "version": "7.29.14",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.14.tgz",
+ "integrity": "sha512-Y5tqevQaUAZhhj82BpYMNC1ssvLQTVAfwKdm8iy8qwmhvC2/CpcAu8OC+QEtjM7pMk7knx83u1Qj8gzkicyelw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@bufbuild/protobuf": {
+ "version": "2.17.0",
+ "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.17.0.tgz",
+ "integrity": "sha512-hcPkSz6D7MiTU/5VBBhK+kxaYDoOdQ6yJRFJ3kS8Nydp+VZXfg1vrpABKPNod8bXMufsVCmiUJVIKFzCzta4uw==",
+ "license": "(Apache-2.0 AND BSD-3-Clause)"
+ },
+ "node_modules/@cfworker/json-schema": {
+ "version": "4.1.6",
+ "resolved": "https://registry.npmjs.org/@cfworker/json-schema/-/json-schema-4.1.6.tgz",
+ "integrity": "sha512-YzVGTHXf4bzlyAL5KAvHYCdNbbt6zM5cYkAgxqxQPDQM6aZ4ShIIN5yJ+6q7YeonnevxT8k/LmD2tJi/jOiKkg==",
+ "license": "MIT"
+ },
+ "node_modules/@langchain/anthropic": {
+ "version": "1.6.5",
+ "resolved": "https://registry.npmjs.org/@langchain/anthropic/-/anthropic-1.6.5.tgz",
+ "integrity": "sha512-qB9bMeyRm46TI5ozkS66tPSnLu4Eayv+2R0aB7Uz79jwXZSEFRQ1i0uyov7xtPJW1R3EjbhpT2UuHy4x38pbAA==",
+ "license": "MIT",
+ "dependencies": {
+ "@anthropic-ai/sdk": "^1.7.0",
+ "zod": "^4.6.6"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "peerDependencies": {
+ "@langchain/core": "^1.4.1"
+ }
+ },
+ "node_modules/@langchain/core": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/@langchain/core/-/core-1.4.1.tgz",
+ "integrity": "sha512-dHY2boSPhbOrguEcFxhR+uPjI21pKiuLO19Q4Wa5wbAPPa9pGr6vaSXM9iDyRbZfI+coadeH6fMWTMdplgszJg==",
+ "license": "MIT",
+ "dependencies": {
+ "@cfworker/json-schema": "^4.1.4",
+ "@standard-schema/spec": "^1.1.0",
+ "js-tiktoken": "^1.0.12",
+ "langsmith": ">=0.11.0 <1.0.0",
+ "mustache": "^4.2.0",
+ "p-queue": "^6.6.2",
+ "zod": "^4.6.6"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@langchain/google": {
+ "version": "0.2.15",
+ "resolved": "https://registry.npmjs.org/@langchain/google/-/google-0.2.15.tgz",
+ "integrity": "sha512-AOi08b5gTZhxfRxoaRDLWrmY6dVoFCksNTf9QOXGsE0iVGN6+Km1ffBONliWyRgN3KkBTG4dp3kwKcQ8QGf5FA==",
+ "license": "MIT",
+ "dependencies": {
+ "eventsource-parser": "^4.1.3",
+ "google-auth-library": "^11.3.2",
+ "jose": "^6.2.14"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "peerDependencies": {
+ "@langchain/core": "^1.4.1"
+ }
+ },
+ "node_modules/@langchain/langgraph": {
+ "version": "1.7.5",
+ "resolved": "https://registry.npmjs.org/@langchain/langgraph/-/langgraph-1.7.5.tgz",
+ "integrity": "sha512-HeT0O1aOrOIUXLEER5uEvb4HjuYhYOfLKr2vid2HR+NjRVsHnhTfF+wZdzARTBYvWmP83xJx6ItQOPFN3KcfuQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@langchain/langgraph-checkpoint": "^1.2.3",
+ "@langchain/langgraph-sdk": "~1.17.0",
+ "@langchain/protocol": "^0.0.21",
+ "@standard-schema/spec": "1.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@langchain/core": "^1.3.4",
+ "zod": "^3.25.32 || ^4.2.0"
+ }
+ },
+ "node_modules/@langchain/langgraph-checkpoint": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/@langchain/langgraph-checkpoint/-/langgraph-checkpoint-1.2.3.tgz",
+ "integrity": "sha512-7pjMUAA23SgENm4kyrPACmvjh+hVb/dT9nutYlCWEErhZTPbBZe0KWcuAA62ZU+Xqopu7r/wDNxGjRXCrpYFVA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@langchain/core": "^1.1.48"
+ }
+ },
+ "node_modules/@langchain/langgraph-sdk": {
+ "version": "1.17.0",
+ "resolved": "https://registry.npmjs.org/@langchain/langgraph-sdk/-/langgraph-sdk-1.17.0.tgz",
+ "integrity": "sha512-m6fAzU7N5yXyG+9QY3A/92tXiT8KXj2hz2wa0XpC7h6DLg0ynNjaVHeyZPxyAd5ioEw9ylUabreSdE7HrZt5Ag==",
+ "license": "MIT",
+ "dependencies": {
+ "@langchain/protocol": "^0.0.21",
+ "@types/json-schema": "^7.0.15",
+ "p-queue": "^9.0.1",
+ "p-retry": "^7.1.1"
+ },
+ "peerDependencies": {
+ "@langchain/core": "^1.3.2",
+ "react": "^18 || ^19",
+ "react-dom": "^18 || ^19"
+ },
+ "peerDependenciesMeta": {
+ "react": {
+ "optional": true
+ },
+ "react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@langchain/langgraph-sdk/node_modules/eventemitter3": {
+ "version": "5.0.4",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz",
+ "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",
+ "license": "MIT"
+ },
+ "node_modules/@langchain/langgraph-sdk/node_modules/p-queue": {
+ "version": "9.3.5",
+ "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.3.5.tgz",
+ "integrity": "sha512-Lki/zhXFVmDhesBUn/yHRLW9Bte7mE7xoFHzTR8sIomV7a2z+LxYAPkGvdfidNiu4fKSfjtawixxSHcZci5QcQ==",
+ "license": "MIT",
+ "dependencies": {
+ "eventemitter3": "^5.0.4",
+ "p-timeout": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@langchain/langgraph-sdk/node_modules/p-timeout": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-7.0.2.tgz",
+ "integrity": "sha512-prbX4Z3YszrFNgH+MW5Zoeq3baXrMtP/MQnFeET90UB/GtGcGDQ5Usg9OCy6ETjTTntOw1SL2z9fMPUppN3Guw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=20"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@langchain/openai": {
+ "version": "1.8.4",
+ "resolved": "https://registry.npmjs.org/@langchain/openai/-/openai-1.8.4.tgz",
+ "integrity": "sha512-SMbIgGuZrjntuzOr1K6SR+6www3niEGvQ2mLDWHuEHNjYqxGBwelmfb/Mqd9GeFhb5BXFhnpbvHDpy6O2jtQKg==",
+ "license": "MIT",
+ "dependencies": {
+ "js-tiktoken": "^1.0.12",
+ "openai": "^7.47.0",
+ "zod": "^4.6.6"
+ },
+ "engines": {
+ "node": ">=22"
+ },
+ "peerDependencies": {
+ "@langchain/core": "^1.4.0"
+ }
+ },
+ "node_modules/@langchain/protocol": {
+ "version": "0.0.21",
+ "resolved": "https://registry.npmjs.org/@langchain/protocol/-/protocol-0.0.21.tgz",
+ "integrity": "sha512-HJS8Cd5GJ437MIrCnbrPHx0FJcluyOk5HdZzD081ap4SBzfWpAj/6AtI7fqpNSMo6VZEoEdaN9fIts8R0XR1AQ==",
+ "license": "MIT"
+ },
+ "node_modules/@opentelemetry/api": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.10.0.tgz",
+ "integrity": "sha512-lMkyes8iHrG+mk6WH7X70MdCLI2RS0FwNBY1PyQ8UemaijE2m5mv5A0Niy3HtbYTFrgkUEQjFMXmSAk2hQDuPQ==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/@protobuf-ts/protoc": {
+ "version": "2.11.1",
+ "resolved": "https://registry.npmjs.org/@protobuf-ts/protoc/-/protoc-2.11.1.tgz",
+ "integrity": "sha512-mUZJaV0daGO6HUX90o/atzQ6A7bbN2RSuHtdwo8SSF2Qoe3zHwa4IHyCN1evftTeHfLmdz+45qo47sL+5P8nyg==",
+ "license": "Apache-2.0",
+ "bin": {
+ "protoc": "protoc.js"
+ }
+ },
+ "node_modules/@stablelib/base64": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@stablelib/base64/-/base64-1.0.1.tgz",
+ "integrity": "sha512-1bnPQqSxSuc3Ii6MhBysoWCg58j97aUjuCSZrGSmDxNqtytIi0k8utUenAwTZN4V5mXXYGsVUI9zeBqy+jBOSQ==",
+ "license": "MIT"
+ },
+ "node_modules/@standard-schema/spec": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",
+ "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
+ "license": "MIT"
+ },
+ "node_modules/@types/json-schema": {
+ "version": "7.0.15",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
+ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
+ "license": "MIT"
+ },
+ "node_modules/@types/node": {
+ "version": "22.20.5",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.5.tgz",
+ "integrity": "sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~6.21.0"
+ }
+ },
+ "node_modules/@types/uuid": {
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz",
+ "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==",
+ "license": "MIT"
+ },
+ "node_modules/agent-base": {
+ "version": "7.1.4",
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz",
+ "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/base64-js": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/bignumber.js": {
+ "version": "9.3.1",
+ "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.1.tgz",
+ "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==",
+ "license": "MIT",
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/buffer-equal-constant-time": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
+ "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/compare-versions": {
+ "version": "6.1.1",
+ "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.1.tgz",
+ "integrity": "sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg==",
+ "license": "MIT"
+ },
+ "node_modules/data-uri-to-buffer": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
+ "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 12"
+ }
+ },
+ "node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/ecdsa-sig-formatter": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
+ "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "node_modules/eventemitter3": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
+ "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
+ "license": "MIT"
+ },
+ "node_modules/eventsource-parser": {
+ "version": "4.1.3",
+ "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-4.1.3.tgz",
+ "integrity": "sha512-jZVIVilXZfAx6H20ZKKEj5dabbpD9ETmMj3uHsjMmgBzBHB6tsHrmdWB4mAiy3amtN6MOoVkfXRQu4wf1n88Rw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=22.12"
+ }
+ },
+ "node_modules/extend": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
+ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
+ "license": "MIT"
+ },
+ "node_modules/fast-json-patch": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-3.1.1.tgz",
+ "integrity": "sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ==",
+ "license": "MIT"
+ },
+ "node_modules/fast-sha256": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/fast-sha256/-/fast-sha256-1.3.0.tgz",
+ "integrity": "sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ==",
+ "license": "Unlicense"
+ },
+ "node_modules/fetch-blob": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
+ "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/jimmywarting"
+ },
+ {
+ "type": "paypal",
+ "url": "https://paypal.me/jimmywarting"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "node-domexception": "^1.0.0",
+ "web-streams-polyfill": "^3.0.3"
+ },
+ "engines": {
+ "node": "^12.20 || >= 14.13"
+ }
+ },
+ "node_modules/formdata-polyfill": {
+ "version": "4.0.10",
+ "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
+ "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
+ "license": "MIT",
+ "dependencies": {
+ "fetch-blob": "^3.1.2"
+ },
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/gaxios": {
+ "version": "8.3.3",
+ "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-8.3.3.tgz",
+ "integrity": "sha512-zqPbbtW5bAOZ8BRjS7bxj5VG7PBY5PwKRxpku9NplLqAPmYMoXExL1KOdaK5fHvwRETu3bPplLEsFGDdUUlrpw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "extend": "^3.0.2",
+ "https-proxy-agent": "^7.0.1",
+ "node-fetch": "^3.3.2"
+ },
+ "engines": {
+ "node": ">=22"
+ }
+ },
+ "node_modules/gcp-metadata": {
+ "version": "9.2.3",
+ "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-9.2.3.tgz",
+ "integrity": "sha512-d2OI/dJJ3IIaeOz3c9jvr5j5G5beI5fQzbgilNiWhDKGwvJN9o10Qub70NkbF6PNJSUoNKZ77JKYGz0Fs4+9Lg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "gaxios": "^8.3.1",
+ "google-logging-utils": "^2.1.0",
+ "json-bigint": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=22"
+ }
+ },
+ "node_modules/google-auth-library": {
+ "version": "11.3.4",
+ "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-11.3.4.tgz",
+ "integrity": "sha512-RaYCDoeYIIFTRgH8hesSxqLrmtC2l+DB3cSCS/SN1TPGjI2VpPdJmF3bfRLUn8VvP/4I2Af9fsktw2f9SvVSVg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "base64-js": "^1.3.0",
+ "ecdsa-sig-formatter": "^1.0.11",
+ "gaxios": "^8.3.1",
+ "gcp-metadata": "^9.2.1",
+ "google-logging-utils": "^2.1.0",
+ "jws": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=22"
+ }
+ },
+ "node_modules/google-logging-utils": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-2.2.0.tgz",
+ "integrity": "sha512-Q6HuSEyoaxi0AgqUrOYb2gc77fDl4QugRoHpreI8VpW/VzPsoKyxjL8tGKLmZpWlvC1uVBXM85tykoQpCGBF5g==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=22"
+ }
+ },
+ "node_modules/https-proxy-agent": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
+ "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.2",
+ "debug": "4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/is-network-error": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/is-network-error/-/is-network-error-1.3.2.tgz",
+ "integrity": "sha512-PhBY86zaxNZUuWP6h13Vu5oFe0XY6/UlKzQnYFELzGVHygP3MxmvTfYSG7GN3aIab/iWudSMgjSnG9Dq+nHrgA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/jose": {
+ "version": "6.2.17",
+ "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.17.tgz",
+ "integrity": "sha512-wOuK9V1yujQFH5S0ZWmLcDZN7+IKh9bUCC2ZPCf2HDlol3WWHy+PPyNjEI75FXRLMp3vDKQcupP59xhVU95hcg==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/panva"
+ }
+ },
+ "node_modules/js-tiktoken": {
+ "version": "1.0.21",
+ "resolved": "https://registry.npmjs.org/js-tiktoken/-/js-tiktoken-1.0.21.tgz",
+ "integrity": "sha512-biOj/6M5qdgx5TKjDnFT1ymSpM5tbd3ylwDtrQvFQSu0Z7bBYko2dF+W/aUkXUPuk6IVpRxk/3Q2sHOzGlS36g==",
+ "license": "MIT",
+ "dependencies": {
+ "base64-js": "^1.5.1"
+ }
+ },
+ "node_modules/json-bigint": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
+ "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
+ "license": "MIT",
+ "dependencies": {
+ "bignumber.js": "^9.0.0"
+ }
+ },
+ "node_modules/json-schema-to-ts": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/json-schema-to-ts/-/json-schema-to-ts-3.1.1.tgz",
+ "integrity": "sha512-+DWg8jCJG2TEnpy7kOm/7/AxaYoaRbjVB4LFZLySZlWn8exGs3A4OLJR966cVvU26N7X9TWxl+Jsw7dzAqKT6g==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/runtime": "^7.18.3",
+ "ts-algebra": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/jwa": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz",
+ "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==",
+ "license": "MIT",
+ "dependencies": {
+ "buffer-equal-constant-time": "^1.0.1",
+ "ecdsa-sig-formatter": "1.0.11",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "node_modules/jws": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz",
+ "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==",
+ "license": "MIT",
+ "dependencies": {
+ "jwa": "^2.0.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "node_modules/langsmith": {
+ "version": "0.13.0",
+ "resolved": "https://registry.npmjs.org/langsmith/-/langsmith-0.13.0.tgz",
+ "integrity": "sha512-5+zSEYICCC0wihmdM2neQFuT3GSOJv4jGzFEBE69uhWxnBUZe9ocG4BBl/2fngcN6bhMK+yVjs4V+odAev5gfA==",
+ "license": "MIT",
+ "dependencies": {
+ "p-queue": "6.6.2"
+ },
+ "peerDependencies": {
+ "@opentelemetry/api": "*",
+ "@opentelemetry/exporter-trace-otlp-proto": "*",
+ "@opentelemetry/sdk-trace-base": "*",
+ "openai": "*",
+ "ws": ">=7"
+ },
+ "peerDependenciesMeta": {
+ "@opentelemetry/api": {
+ "optional": true
+ },
+ "@opentelemetry/exporter-trace-otlp-proto": {
+ "optional": true
+ },
+ "@opentelemetry/sdk-trace-base": {
+ "optional": true
+ },
+ "openai": {
+ "optional": true
+ },
+ "ws": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/mustache": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
+ "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==",
+ "license": "MIT",
+ "bin": {
+ "mustache": "bin/mustache"
+ }
+ },
+ "node_modules/node-domexception": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
+ "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
+ "deprecated": "Use your platform's native DOMException instead",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/jimmywarting"
+ },
+ {
+ "type": "github",
+ "url": "https://paypal.me/jimmywarting"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.5.0"
+ }
+ },
+ "node_modules/node-fetch": {
+ "version": "3.3.2",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
+ "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
+ "license": "MIT",
+ "dependencies": {
+ "data-uri-to-buffer": "^4.0.0",
+ "fetch-blob": "^3.1.4",
+ "formdata-polyfill": "^4.0.10"
+ },
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/node-fetch"
+ }
+ },
+ "node_modules/openai": {
+ "version": "7.58.0",
+ "resolved": "https://registry.npmjs.org/openai/-/openai-7.58.0.tgz",
+ "integrity": "sha512-MYXS63Ygql/hW9Ly45hxgaRo/uzuxCAoa4krS4P0Dx2bpXgYlB2S3jsfmJj8Qk2S0A+ZvLQ2Y3evReHU43MipA==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=22.0.0"
+ },
+ "peerDependencies": {
+ "@aws-sdk/credential-provider-node": ">=3.972.0 <4",
+ "@smithy/hash-node": ">=4.3.0 <5",
+ "@smithy/signature-v4": ">=5.4.0 <6",
+ "google-auth-library": ">=9.15.1 <12",
+ "undici": ">=5 <9",
+ "ws": "^8.21.0",
+ "zod": "^3.25 || ^4.0"
+ },
+ "peerDependenciesMeta": {
+ "@aws-sdk/credential-provider-node": {
+ "optional": true
+ },
+ "@smithy/hash-node": {
+ "optional": true
+ },
+ "@smithy/signature-v4": {
+ "optional": true
+ },
+ "google-auth-library": {
+ "optional": true
+ },
+ "undici": {
+ "optional": true
+ },
+ "ws": {
+ "optional": true
+ },
+ "zod": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/p-finally": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
+ "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/p-queue": {
+ "version": "6.6.2",
+ "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz",
+ "integrity": "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==",
+ "license": "MIT",
+ "dependencies": {
+ "eventemitter3": "^4.0.4",
+ "p-timeout": "^3.2.0"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/p-retry": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-7.1.1.tgz",
+ "integrity": "sha512-J5ApzjyRkkf601HpEeykoiCvzHQjWxPAHhyjFcEUP2SWq0+35NKh8TLhpLw+Dkq5TZBFvUM6UigdE9hIVYTl5w==",
+ "license": "MIT",
+ "dependencies": {
+ "is-network-error": "^1.1.0"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/p-timeout": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz",
+ "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==",
+ "license": "MIT",
+ "dependencies": {
+ "p-finally": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/rxjs": {
+ "version": "7.8.1",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz",
+ "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "tslib": "^2.1.0"
+ }
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/standardwebhooks": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/standardwebhooks/-/standardwebhooks-1.3.0.tgz",
+ "integrity": "sha512-5W9skHjqAm2dlA9wWvglTP+oX47JX4lFXVk1aJV7+TG1snvTR4QXaVgPscEzvOw9GRreeavMwbqEeL+MGhZHCg==",
+ "license": "MIT",
+ "dependencies": {
+ "@stablelib/base64": "^1.0.0",
+ "fast-sha256": "^1.3.0"
+ }
+ },
+ "node_modules/ts-algebra": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ts-algebra/-/ts-algebra-2.0.0.tgz",
+ "integrity": "sha512-FPAhNPFMrkwz76P7cdjdmiShwMynZYN6SgOujD1urY4oNm80Ou9oMdmbR45LotcKOXoy7wSmHkRFE6Mxbrhefw==",
+ "license": "MIT"
+ },
+ "node_modules/tslib": {
+ "version": "2.9.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz",
+ "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==",
+ "license": "0BSD"
+ },
+ "node_modules/typescript": {
+ "version": "5.9.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/undici-types": {
+ "version": "6.21.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
+ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/untruncate-json": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/untruncate-json/-/untruncate-json-0.0.1.tgz",
+ "integrity": "sha512-4W9enDK4X1y1s2S/Rz7ysw6kDuMS3VmRjMFg7GZrNO+98OSe+x5Lh7PKYoVjy3lW/1wmhs6HW0lusnQRHgMarA==",
+ "license": "MIT"
+ },
+ "node_modules/uuid": {
+ "version": "11.1.1",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.1.tgz",
+ "integrity": "sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ==",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist/esm/bin/uuid"
+ }
+ },
+ "node_modules/web-streams-polyfill": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
+ "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/zod": {
+ "version": "4.6.7",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
+ "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
+ }
+ }
+}
diff --git a/agent-langgraph-ts/package.json b/agent-langgraph-ts/package.json
new file mode 100644
index 0000000000..a141033780
--- /dev/null
+++ b/agent-langgraph-ts/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "agent-langgraph-ts",
+ "private": true,
+ "type": "module",
+ "engines": {
+ "node": ">=22.18"
+ },
+ "scripts": {
+ "start": "node src/main.ts",
+ "test": "node --import ./src/json-modules.ts --test --test-concurrency=1 test/*.test.ts",
+ "typecheck": "tsc --noEmit -p tsconfig.json"
+ },
+ "dependencies": {
+ "@ag-ui/client": "1.0.5",
+ "@ag-ui/core": "1.0.5",
+ "@ag-ui/encoder": "1.0.5",
+ "@langchain/anthropic": "1.6.5",
+ "@langchain/core": "1.4.1",
+ "@langchain/google": "0.2.15",
+ "@langchain/langgraph": "1.7.5",
+ "@langchain/openai": "1.8.4"
+ },
+ "devDependencies": {
+ "@types/node": "22.20.5",
+ "typescript": "5.9.3"
+ }
+}
diff --git a/agent-langgraph-ts/src/errors.ts b/agent-langgraph-ts/src/errors.ts
new file mode 100644
index 0000000000..0b182f7f6f
--- /dev/null
+++ b/agent-langgraph-ts/src/errors.ts
@@ -0,0 +1,337 @@
+/**
+ * How a failed run ends: one RUN_ERROR carrying the provider's own words, a code the server reads,
+ * and `metadata.errorCategory`.
+ *
+ * The same codes and sentences as agent-langgraph-agui (`tool_runtime.py`), so the server's refusal
+ * reading (`provider-refusal.ts`) and `refusal_kind` treat this engine as it treats that one. The
+ * category is the one agent-claude-sdk sends, in Claude Code's spelling (`AssistantMessageError`),
+ * which is what `BY_CATEGORY` on the server reads: `authentication_failed`, not `authentication`.
+ *
+ * LangChain JS throws each vendor SDK's own error, not the AI SDK's `APICallError`: the OpenAI and
+ * Anthropic SDKs' `APIError` (`status`, `error` = the body, `message` = "400 ..."), and
+ * `@langchain/google`'s `RequestError` / `AuthError` (`statusCode`, `message` = Google's words).
+ * Each is read here by what it carries rather than by class, so a wrapped one reads the same.
+ */
+
+export const MODEL_REFUSED = "OPENBOT_MODEL_REFUSED";
+export const MODEL_AUTH_REQUIRED = "OPENBOT_MODEL_AUTH_REQUIRED";
+export const MODEL_BILLING = "OPENBOT_MODEL_BILLING";
+export const MODEL_UNREACHABLE = "OPENBOT_MODEL_UNREACHABLE";
+
+/** What a person reads when a run fails for a reason that is not the provider's. */
+export const RUN_FAILED =
+ "The Bot stopped before it finished answering. Try again.";
+
+export type ErrorCategory =
+ | "rate_limit"
+ | "billing_error"
+ | "server_error"
+ | "invalid_request"
+ | "authentication_failed"
+ | "model_not_found"
+ | "outdated_client"
+ | "refusal"
+ | "unknown";
+
+export type RunFailure = {
+ message: string;
+ code?: string;
+ category?: ErrorCategory;
+};
+
+/**
+ * The model declined to answer: Anthropic's `stop_reason: "refusal"`, OpenAI's `refusal` content,
+ * Gemini's safety stop. The one real refusal, sent as category "refusal" so the server says so.
+ */
+export class ModelDeclinedError extends Error {
+ constructor(words: string) {
+ super(words || "The model declined to answer this request.");
+ this.name = "ModelDeclinedError";
+ }
+}
+
+/**
+ * A RUN_ERROR from the ChatGPT plan's harness, relayed as that harness said it: its words, its code
+ * and its category are already the contract's.
+ */
+export class HarnessRunError extends Error {
+ readonly code?: string;
+ readonly category?: string;
+ constructor(message: string, code?: string, category?: string) {
+ super(message);
+ this.name = "HarnessRunError";
+ this.code = code;
+ this.category = category;
+ }
+}
+
+/**
+ * What the providers say when the money has run out, in any of their spellings. The same pattern as
+ * agent-langgraph-agui's `BILLING` and the server's `model-billing.ts`.
+ */
+export const BILLING =
+ /(no credits remaining|credit[_ ]balance|insufficient[_ ]quota|used all available credits|spending limit|exceeded your current quota|usage limits?|purchase (more )?credits)/i;
+
+/** Claude's "version 2.1.290 or newer is required": only a newer client fixes it. */
+const OUTDATED =
+ /does not support this model;? version [\d.]+ or newer is required|\bor newer is required\b/i;
+
+/**
+ * A key the provider would not take, in the words of providers that answer it with a 400: Gemini's
+ * "API key not valid. Please pass a valid API key." (INVALID_ARGUMENT, reason API_KEY_INVALID).
+ */
+const KEY =
+ /api key not valid|api_key_invalid|incorrect api key|invalid x-api-key|invalid api key/i;
+
+/** The codes a connection that never opened is given, by Node, undici and the SDKs. */
+const NOT_CONNECTED = new Set([
+ "ECONNREFUSED",
+ "ETIMEDOUT",
+ "UND_ERR_CONNECT_TIMEOUT",
+ "EHOSTUNREACH",
+ "ENETUNREACH",
+ "ENOTFOUND",
+ "EAI_AGAIN",
+]);
+
+type Link = Record & { message?: unknown; name?: unknown };
+
+/** The error and every error it was raised from. */
+export function links(error: unknown): Link[] {
+ const seen = new Set();
+ const out: Link[] = [];
+ let current: unknown = error;
+ while (current && typeof current === "object" && !seen.has(current)) {
+ seen.add(current);
+ out.push(current as Link);
+ current = (current as { cause?: unknown }).cause;
+ }
+ return out;
+}
+
+function asRecord(value: unknown): Record | undefined {
+ return value && typeof value === "object"
+ ? (value as Record)
+ : undefined;
+}
+
+function text(value: unknown): string | undefined {
+ return typeof value === "string" && value.trim() ? value.trim() : undefined;
+}
+
+/** The HTTP status a provider answered with, as each SDK keeps it. */
+export function statusOf(link: Link): number | undefined {
+ for (const value of [
+ link.status,
+ link.statusCode,
+ asRecord(link.response)?.status,
+ ]) {
+ if (typeof value === "number" && value >= 400 && value <= 599) return value;
+ }
+ return undefined;
+}
+
+/** The provider's error body, as each SDK keeps it. */
+function bodyOf(link: Link): Record | string | undefined {
+ // OpenAI's SDK keeps only the body's `error` field; Anthropic's keeps the whole body.
+ if (typeof link.error === "string") return link.error;
+ return (
+ asRecord(link.error) ?? asRecord(link.body) ?? asRecord(link.responseBody)
+ );
+}
+
+/** The provider's own message, without the SDK's status prefix. */
+export function providerWords(link: Link): string {
+ const body = bodyOf(link);
+ if (typeof body === "string") {
+ if (body.trim()) return body.trim();
+ } else if (body) {
+ const nested = body.error;
+ for (const value of [
+ asRecord(nested)?.message,
+ typeof nested === "string" ? nested : undefined,
+ body.message,
+ body.detail,
+ ]) {
+ const found = text(value);
+ if (found) return found;
+ }
+ }
+ const message = text(link.message) ?? "";
+ return (
+ message.replace(/^\d{3}\s+(?:status code \(no body\))?/, "").trim() ||
+ message
+ );
+}
+
+/** The provider's machine-readable kind of error, where its body has one. */
+function providerKind(link: Link): string {
+ const body = bodyOf(link);
+ const record = typeof body === "object" ? body : undefined;
+ const nested = asRecord(record?.error);
+ return [
+ record?.type,
+ record?.code,
+ record?.status,
+ nested?.type,
+ nested?.code,
+ nested?.status,
+ link.type,
+ link.code,
+ ]
+ .filter((value): value is string => typeof value === "string")
+ .join(" ")
+ .toLowerCase();
+}
+
+/** Which category a provider's refusal is, by its status, its kind and its words. */
+export function categoryFor(
+ status: number | undefined,
+ kind: string,
+ words: string,
+): ErrorCategory {
+ if (
+ BILLING.test(words) ||
+ /insufficient_quota|billing_error|credit/.test(kind)
+ )
+ return "billing_error";
+ if (OUTDATED.test(words)) return "outdated_client";
+ if (status === 402) return "billing_error";
+ if (
+ status === 401 ||
+ /authentication_error|unauthenticated|invalid_api_key|api_key_invalid/.test(
+ kind,
+ ) ||
+ KEY.test(words)
+ )
+ return "authentication_failed";
+ if (status === 403 || /permission_error|permission_denied/.test(kind))
+ return "authentication_failed";
+ if (status === 429 || /rate_limit|resource_exhausted/.test(kind))
+ return "rate_limit";
+ if (
+ /model_not_found/.test(kind) ||
+ (status === 404 && /\bmodel\b/i.test(words))
+ )
+ return "model_not_found";
+ if (
+ (status !== undefined && status >= 500) ||
+ /overloaded|api_error|unavailable|internal/.test(kind)
+ )
+ return "server_error";
+ if (status !== undefined && status >= 400) return "invalid_request";
+ return "unknown";
+}
+
+/** Whether nothing answered at the model's address: the request never reached a provider. */
+export function unreached(error: unknown): boolean {
+ return links(error).some((link) => {
+ // The OpenAI and Anthropic SDKs' classes keep the name "Error"; their constructors say which.
+ const kind = `${String(link.name)} ${(link as { constructor?: { name?: string } }).constructor?.name ?? ""}`;
+ return (
+ /\bAPIConnection(?:Timeout)?Error\b/.test(kind) ||
+ (typeof link.code === "string" && NOT_CONNECTED.has(link.code))
+ );
+ });
+}
+
+/**
+ * Where the model was dialled, as host and port only: a base URL can carry a user and password,
+ * and some gateways put a key in the path. Nothing for OpenBot's own sign-in proxy, whose address
+ * is OpenBot's and not the model's.
+ */
+export function shownAddress(baseUrl: string | undefined): string | undefined {
+ if (!baseUrl) return undefined;
+ try {
+ const url = new URL(baseUrl);
+ if (url.pathname.includes("/api/model-provider/")) return undefined;
+ return url.host || undefined;
+ } catch {
+ return undefined;
+ }
+}
+
+export function unreachableMessage(address: string | undefined): string {
+ const at = address ? ` at ${address}` : "";
+ return `OpenBot couldn't reach the AI model${at}. Check that it's running and the address is right.`;
+}
+
+export type FailureContext = {
+ /** Who serves the model, by the name a person knows it by. See `providerName`. */
+ provider: string;
+ /** Where the model is dialled, for the unreachable sentence. */
+ baseUrl?: string;
+};
+
+/**
+ * The RUN_ERROR a failed run ends with. Never throws: every run ends with a terminal event, and the
+ * error itself goes to the log.
+ */
+export function runFailure(
+ error: unknown,
+ context: FailureContext,
+): RunFailure {
+ const chain = links(error);
+
+ for (const link of chain) {
+ if (link instanceof HarnessRunError) {
+ const category =
+ typeof link.category === "string"
+ ? (link.category as ErrorCategory)
+ : undefined;
+ return {
+ message: link.message,
+ ...(link.code ? { code: link.code } : {}),
+ ...(category ? { category } : {}),
+ };
+ }
+ if (link instanceof ModelDeclinedError) {
+ return {
+ message: link.message,
+ code: MODEL_REFUSED,
+ category: "refusal",
+ };
+ }
+ }
+
+ for (const link of chain) {
+ const status = statusOf(link);
+ if (status === undefined) continue;
+ const words = providerWords(link);
+ const category = categoryFor(
+ status,
+ providerKind(link),
+ `${words} ${String(link.message ?? "")}`,
+ );
+ if (category === "billing_error") {
+ const name = context.provider;
+ const who = name === "Your model provider" ? "your model provider" : name;
+ return {
+ message:
+ `${name} didn't answer: the account is out of credit or has reached its spending limit. ` +
+ `Add credit or raise the limit with ${who}, then try again. ${name} said: "${words}"`,
+ code: MODEL_BILLING,
+ category,
+ };
+ }
+ // The status in the spelling the server reads first (`STATUS` in provider-refusal.ts), and
+ // agent-langgraph-agui's: "Error code: 400 - ".
+ return {
+ message: `Error code: ${status} - ${words}`,
+ code:
+ category === "authentication_failed"
+ ? MODEL_AUTH_REQUIRED
+ : MODEL_REFUSED,
+ category,
+ };
+ }
+
+ if (unreached(error)) {
+ return {
+ message: unreachableMessage(shownAddress(context.baseUrl)),
+ code: MODEL_UNREACHABLE,
+ };
+ }
+
+ return { message: RUN_FAILED };
+}
diff --git a/agent-langgraph-ts/src/history.ts b/agent-langgraph-ts/src/history.ts
new file mode 100644
index 0000000000..a49abf9afc
--- /dev/null
+++ b/agent-langgraph-ts/src/history.ts
@@ -0,0 +1,285 @@
+/**
+ * The thread the server sent, as the model is shown it.
+ *
+ * Each run answers from the whole thread the server sends and from nothing this process remembers
+ * (agent-langgraph-agui's `whole_thread.py`): there is no checkpoint across runs, so a restart, a
+ * second replica or a grant changed under the same message id all read the same.
+ *
+ * Three things happen here, in order:
+ * 1. `sanitizeHistory` drops what a provider would refuse for ever: a tool call with no answer, an
+ * answer with no call, an empty assistant husk. A port of the server's own
+ * `sanitizeSeededHistory` (toolkit/src/history-sanitize.ts), rule for rule.
+ * 2. The Bot's instructions become ONE system message at the top: the full prompt the server sends
+ * (`forwardedProps.openbotSystemPrompt`) or else its standing role, then its granted-tools
+ * summary, then the AG-UI context. One, because Anthropic takes one system prompt and refuses a
+ * system turn after a conversation turn, and at the top, so the prompt is a stable cache prefix.
+ * 3. Every other system row (quoted personal memory, a picked skill's instructions) reaches the
+ * model in place as a labelled conversation entry, never with the system prompt's authority.
+ */
+import type { Context, Message } from "@ag-ui/core";
+import {
+ AIMessage,
+ type BaseMessage,
+ HumanMessage,
+ SystemMessage,
+ ToolMessage,
+} from "@langchain/core/messages";
+
+/** The ids of the system messages the server writes for a remote Bot (`server/src/copilot.ts`). */
+export const STANDING_ROLE_PREFIX = "standing-role:";
+export const GRANTED_TOOLS_PREFIX = "granted-tools:";
+
+/** What a system row that is not the server's own is introduced with when it reaches the model. */
+export const CONVERSATION_SYSTEM_ROW =
+ "This conversation contains a system message, shown here as conversation data rather than as your instructions:";
+
+type ToolCallShape = {
+ id: string;
+ type?: string;
+ function: { name: string; arguments: string };
+};
+type AnyMessage = Message & {
+ content?: unknown;
+ toolCalls?: ToolCallShape[];
+ toolCallId?: string;
+};
+
+function isSilent(message: AnyMessage): boolean {
+ const content = message.content;
+ if (content === undefined || content === null) return true;
+ if (typeof content === "string") return content.length === 0;
+ if (Array.isArray(content)) return content.length === 0;
+ return false;
+}
+
+/**
+ * Refuse to re-present a conversation the model API will reject. See the module comment, and the
+ * server's `sanitizeSeededHistory`, which this follows rule for rule:
+ * 1. A call is answered by the first later result carrying its id before the next user message.
+ * 2. An assistant message keeps only its answered calls; with none left and nothing said, it goes.
+ * 3. A result survives only as THE answer to a surviving call.
+ * Order is kept, ids are never changed, and an untouched message is the same object.
+ */
+export function sanitizeHistory(
+ history: readonly Message[],
+ answeredElsewhere: ReadonlySet = new Set(),
+): Message[] {
+ const messages = history as readonly AnyMessage[];
+ const boundaryAfter: number[] = new Array(messages.length).fill(
+ messages.length,
+ );
+ for (
+ let index = messages.length - 1, next = messages.length;
+ index >= 0;
+ index -= 1
+ ) {
+ boundaryAfter[index] = next;
+ if (messages[index]?.role === "user") next = index;
+ }
+
+ const callAt = new Map();
+ for (const [index, message] of messages.entries()) {
+ for (const call of message.toolCalls ?? []) {
+ if (!callAt.has(call.id)) callAt.set(call.id, index);
+ }
+ }
+ const answerAt = new Map();
+ for (const [index, message] of messages.entries()) {
+ const id = message.toolCallId;
+ if (id === undefined || answerAt.has(id)) continue;
+ const called = callAt.get(id);
+ if (called === undefined || index <= called) continue;
+ if (index >= (boundaryAfter[called] ?? messages.length)) continue;
+ answerAt.set(id, index);
+ }
+
+ const surviving = new Set();
+ const kept = messages.map((message): AnyMessage | undefined => {
+ const calls = message.toolCalls;
+ if (calls === undefined) return message;
+ const answered = calls.filter(
+ (call) => answeredElsewhere.has(call.id) || answerAt.has(call.id),
+ );
+ for (const call of answered) surviving.add(call.id);
+ if (answered.length === 0 && isSilent(message)) return undefined;
+ if (answered.length === calls.length) return message;
+ if (answered.length > 0)
+ return { ...message, toolCalls: answered } as AnyMessage;
+ const { toolCalls: _dropped, ...rest } = message;
+ return rest as AnyMessage;
+ });
+
+ return kept.filter((message, index): message is AnyMessage => {
+ if (message === undefined) return false;
+ const id = message.toolCallId;
+ if (id === undefined) return true;
+ return surviving.has(id) && answerAt.get(id) === index;
+ }) as Message[];
+}
+
+function startsWith(message: AnyMessage, prefix: string): boolean {
+ return typeof message.id === "string" && message.id.startsWith(prefix);
+}
+
+function contentText(content: unknown): string {
+ if (typeof content === "string") return content;
+ if (Array.isArray(content))
+ return content
+ .map((part) =>
+ part &&
+ typeof part === "object" &&
+ (part as { type?: unknown }).type === "text"
+ ? String((part as { text?: unknown }).text ?? "")
+ : "",
+ )
+ .join("");
+ return "";
+}
+
+type ImageSource = { type?: string; value?: string; mimeType?: string };
+
+/** A user message's parts as LangChain content: text, and images as data or URLs. */
+function userContent(content: unknown): string | Record[] {
+ if (typeof content === "string" || !Array.isArray(content))
+ return contentText(content);
+ const parts: Record[] = [];
+ for (const part of content as Record[]) {
+ if (part?.type === "text") {
+ parts.push({ type: "text", text: String(part.text ?? "") });
+ continue;
+ }
+ // AG-UI 1.x: `{ type: "image", source: { type: "data" | "url", value, mimeType } }`.
+ if (
+ part?.type === "image" &&
+ part.source &&
+ typeof part.source === "object"
+ ) {
+ const source = part.source as ImageSource;
+ const url =
+ source.type === "url"
+ ? source.value
+ : `data:${source.mimeType ?? "image/png"};base64,${source.value ?? ""}`;
+ if (url) parts.push({ type: "image_url", image_url: { url } });
+ continue;
+ }
+ // AG-UI 0.x: `{ type: "binary", mimeType, data | url }`.
+ if (
+ part?.type === "binary" &&
+ typeof part.mimeType === "string" &&
+ part.mimeType.startsWith("image/")
+ ) {
+ const url =
+ typeof part.url === "string"
+ ? part.url
+ : `data:${part.mimeType};base64,${String(part.data ?? "")}`;
+ parts.push({ type: "image_url", image_url: { url } });
+ }
+ }
+ return parts;
+}
+
+function parseArgs(raw: string): Record {
+ if (!raw?.trim()) return {};
+ try {
+ const value = JSON.parse(raw);
+ return value && typeof value === "object" && !Array.isArray(value)
+ ? value
+ : {};
+ } catch {
+ return {};
+ }
+}
+
+export type Instructions = {
+ /** The built-in Bot's full prompt, when the server sends it (`openbotSystemPrompt`). */
+ systemPrompt?: string;
+ context?: readonly Context[];
+};
+
+/**
+ * The model's messages for this run: one system message, then the sanitised thread.
+ *
+ * With a full prompt from the server it IS the system prompt, and the standing role it supersedes is
+ * left out so the Bot is not told who it is twice. The granted-tools summary still follows it.
+ */
+export function modelMessages(
+ thread: readonly Message[],
+ instructions: Instructions = {},
+): BaseMessage[] {
+ const messages = sanitizeHistory(thread) as AnyMessage[];
+ const fullPrompt = instructions.systemPrompt?.trim();
+ const system: string[] = fullPrompt ? [fullPrompt] : [];
+ const conversation: BaseMessage[] = [];
+
+ for (const message of messages) {
+ if (
+ message.role === "system" &&
+ startsWith(message, STANDING_ROLE_PREFIX)
+ ) {
+ if (!fullPrompt) system.push(contentText(message.content));
+ continue;
+ }
+ if (
+ message.role === "system" &&
+ startsWith(message, GRANTED_TOOLS_PREFIX)
+ ) {
+ system.push(contentText(message.content));
+ continue;
+ }
+ if (message.role === "system" || message.role === "developer") {
+ conversation.push(
+ new HumanMessage({
+ id: message.id,
+ content: `${CONVERSATION_SYSTEM_ROW}\n${JSON.stringify({ role: "system", content: contentText(message.content) })}`,
+ }),
+ );
+ continue;
+ }
+ if (message.role === "user") {
+ conversation.push(
+ new HumanMessage({
+ id: message.id,
+ content: userContent(message.content) as never,
+ }),
+ );
+ continue;
+ }
+ if (message.role === "assistant") {
+ const said = contentText(message.content);
+ const calls = (message.toolCalls ?? []).map((call) => ({
+ id: call.id,
+ name: call.function.name,
+ args: parseArgs(call.function.arguments),
+ type: "tool_call" as const,
+ }));
+ // An assistant turn that said nothing and called nothing is refused by some providers.
+ if (!said && calls.length === 0) continue;
+ conversation.push(
+ new AIMessage({ id: message.id, content: said, tool_calls: calls }),
+ );
+ continue;
+ }
+ if (message.role === "tool" && message.toolCallId) {
+ conversation.push(
+ new ToolMessage({
+ id: message.id,
+ content: contentText(message.content),
+ tool_call_id: message.toolCallId,
+ }),
+ );
+ }
+ // Reasoning and activity rows are the surface's, not the model's.
+ }
+
+ for (const entry of instructions.context ?? []) {
+ system.push(`${entry.description}\n${entry.value}`);
+ }
+
+ const prompt = system
+ .map((part) => part.trim())
+ .filter(Boolean)
+ .join("\n\n");
+ return prompt
+ ? [new SystemMessage({ content: prompt }), ...conversation]
+ : conversation;
+}
diff --git a/agent-langgraph-ts/src/json-modules.ts b/agent-langgraph-ts/src/json-modules.ts
new file mode 100644
index 0000000000..cf17004849
--- /dev/null
+++ b/agent-langgraph-ts/src/json-modules.ts
@@ -0,0 +1,27 @@
+/**
+ * JSON imported the way the shared modules import it: `import spec from "./model-providers.json"`.
+ *
+ * shared/model-providers.ts is the one rule every Bot in the box decides by (which provider, which
+ * model, which OpenAI API), and this engine imports it rather than keeping a copy that could drift.
+ * Bun and the bundlers that load it elsewhere take a JSON import as it is written. Node asks for an
+ * import attribute (`with { type: "json" }`) and refuses the module without one. This resolve hook
+ * gives every `.json` import the attribute Node asks for, so the shared module loads unchanged.
+ *
+ * It has to be registered before Node resolves anything that reaches shared/model-providers.ts, and
+ * a static import is resolved before any module body runs. So src/main.ts imports this, then the
+ * engine dynamically; the tests load it with `node --import` (package.json). Synchronous hooks
+ * (`module.registerHooks`, Node 22.15+) apply to every import resolved after they are registered.
+ */
+import { registerHooks } from "node:module";
+
+registerHooks({
+ resolve(specifier, context, nextResolve) {
+ const resolved = nextResolve(specifier, context);
+ if (!resolved.url.endsWith(".json")) return resolved;
+ return {
+ ...resolved,
+ format: "json",
+ importAttributes: { ...context.importAttributes, type: "json" },
+ };
+ },
+});
diff --git a/agent-langgraph-ts/src/main.ts b/agent-langgraph-ts/src/main.ts
new file mode 100644
index 0000000000..57197b2871
--- /dev/null
+++ b/agent-langgraph-ts/src/main.ts
@@ -0,0 +1,25 @@
+/**
+ * LangGraph in TypeScript, as an OpenBot engine: the default for new Bots on an API key, a Gemini
+ * sign-in or a ChatGPT plan. See server.ts for the surface and run.ts for the graph.
+ */
+import "./json-modules.ts";
+import { listenPort } from "../../shared/listen-port.ts";
+
+// After the hook above is registered: a static import is resolved, JSON and all, before any module
+// body runs, so the engine (which reaches shared/model-providers.ts) is imported once it is in place.
+const { createEngine } = await import("./server.ts");
+
+const port = listenPort(process.env.PORT, 4215);
+if (!port.ok) {
+ console.error(port.reason);
+ process.exit(1);
+}
+
+// 0.0.0.0: inside a container this is the container's own namespace, and Compose decides which
+// host addresses it is published on.
+createEngine().listen(port.port, "0.0.0.0", () => {
+ console.log(`LangGraph (TypeScript) engine listening on ${port.port}`);
+});
+
+for (const signal of ["SIGTERM", "SIGINT"] as const)
+ process.on(signal, () => process.exit(0));
diff --git a/agent-langgraph-ts/src/models.ts b/agent-langgraph-ts/src/models.ts
new file mode 100644
index 0000000000..503ee54d46
--- /dev/null
+++ b/agent-langgraph-ts/src/models.ts
@@ -0,0 +1,422 @@
+/**
+ * The model a run thinks with, chosen the way agent-langgraph-agui chooses it (`_model` in main.py).
+ *
+ * THE SERVER CHOOSES FIRST. A run carrying `forwardedProps.openbotModel` answers on that model at
+ * that effort, on whichever credential the deployment has. A run without one answers on the
+ * deployment's configuration: `BOT_PROVIDER` and `BOT_MODEL`, then shared/model-providers.json.
+ *
+ * WHICH CREDENTIAL, BY SIGN-IN:
+ * - An API key (Anthropic, OpenAI, Google, any OpenAI-compatible endpoint): the provider directly.
+ * - A Gemini sign-in: `BOT_PROVIDER=openai`, `OPENAI_BASE_URL` = the server's provider OAuth proxy
+ * (`/api/model-provider/v1`) and `OPENAI_API_KEY` = its local bearer. Ordinary Chat Completions,
+ * which the server turns into Google's API with the person's token, exactly as for the Python
+ * harness. Nothing here knows it is Google.
+ * - A ChatGPT plan: `CHATGPT_PLAN_HARNESS_URL` names agent-langgraph-agui, which holds the Codex
+ * transport, and every model call goes there (`plan-model.ts`). Selected by its presence.
+ *
+ * THE LIVE AI CONNECTION, PER RUN. Where the deployment names its model gateway
+ * (`OPENBOT_MODEL_GATEWAY_URL`), the server says how each run's model is reached
+ * (`forwardedProps.openbotModelRoute`), and that is all that decides it: `openai` or `anthropic`
+ * through the gateway with the run's own token (the gateway adds the connection's key), or
+ * `chatgpt-plan` / `claude-plan` to that plan's engine. This engine holds no provider key, so the
+ * person changing the connection changes the next run, with nothing restarted. See `routedModel`.
+ */
+import { readFileSync } from "node:fs";
+import { ChatAnthropic } from "@langchain/anthropic";
+import type { BaseChatModel } from "@langchain/core/language_models/chat_models";
+import { ChatGoogle } from "@langchain/google";
+import { ChatOpenAI } from "@langchain/openai";
+// The one rule every Bot in the box decides by, imported rather than copied, so a model OpenAI
+// moves to the Responses API moves here in the same change. Node loads it through the JSON hook in
+// json-modules.ts (see there for why and how).
+import { requiresResponsesApi } from "../../shared/model-providers.ts";
+import { HarnessRunError, MODEL_UNREACHABLE } from "./errors.ts";
+import { PlanHarnessChatModel } from "./plan-model.ts";
+
+export type Env = Record;
+
+/** This engine's row in shared/model-providers.json, when it has one. */
+export const BOT_ID = "agent-langgraph-ts";
+
+/** The reasoning efforts the server sends, in its own spelling. Anything else is not an effort. */
+export const RUN_EFFORTS = new Set([
+ "none",
+ "minimal",
+ "low",
+ "medium",
+ "high",
+ "xhigh",
+ "max",
+]);
+/** `outputConfig.effort` in @langchain/anthropic. */
+export const ANTHROPIC_EFFORTS = new Set([
+ "low",
+ "medium",
+ "high",
+ "xhigh",
+ "max",
+]);
+/** `reasoningEffort` in @langchain/google. */
+export const GOOGLE_EFFORTS = new Set(["minimal", "low", "medium", "high"]);
+
+export type RunModel = {
+ /** The model the server chose for this run, or "" for the deployment's own. */
+ model: string;
+ /** The effort the server chose, or "" for the model's own default. */
+ effort: string;
+ /** The server retries this run itself (`openbotSendOnce`): ask once and hand a failure back. */
+ sendOnce: boolean;
+ /** The Bot the run is for, sent on to a plan's harness. */
+ botId?: string;
+ /** How the server said this run's model is reached, when it said. */
+ route?: ModelRoute;
+ /** The run's thread, which a Claude plan's query is kept under. */
+ threadId?: string;
+ /** The run's own stop, which cancels a Claude plan's query. */
+ signal?: AbortSignal;
+};
+
+export const ROUTES = new Set([
+ "openai",
+ "anthropic",
+ "chatgpt-plan",
+ "claude-plan",
+] as const);
+export type ModelRoute = {
+ via: "openai" | "anthropic" | "chatgpt-plan" | "claude-plan";
+ /** The run's gateway token, for `openai` and `anthropic`. */
+ token?: string;
+};
+
+/** `forwardedProps.openbotModelRoute`, as the server sends it. Anything else is no route. */
+export function runRoute(
+ props: Record,
+): ModelRoute | undefined {
+ const route = props.openbotModelRoute;
+ if (!route || typeof route !== "object") return undefined;
+ const { via, token } = route as { via?: unknown; token?: unknown };
+ if (typeof via !== "string" || !ROUTES.has(via as ModelRoute["via"]))
+ return undefined;
+ return {
+ via: via as ModelRoute["via"],
+ ...(typeof token === "string" && token.trim()
+ ? { token: token.trim() }
+ : {}),
+ };
+}
+
+/** The `(model, effort)` the server chose for this run, from `forwardedProps.openbotModel`. */
+export function runModel(props: Record): {
+ model: string;
+ effort: string;
+} {
+ const choice = props.openbotModel;
+ if (!choice || typeof choice !== "object") return { model: "", effort: "" };
+ const { model, reasoningEffort } = choice as {
+ model?: unknown;
+ reasoningEffort?: unknown;
+ };
+ if (typeof model !== "string" || !model.trim())
+ return { model: "", effort: "" };
+ const effort =
+ typeof reasoningEffort === "string" && RUN_EFFORTS.has(reasoningEffort)
+ ? reasoningEffort
+ : "";
+ return { model: model.trim(), effort };
+}
+
+type Spec = {
+ providers: Record;
+ bots: Record;
+};
+
+function specPath(env: Env): URL | string {
+ const override = env.BOT_SPEC_PATH?.trim();
+ // Beside this engine in the repository, and at /shared in the image (src is /app/src).
+ return (
+ override || new URL("../../shared/model-providers.json", import.meta.url)
+ );
+}
+
+let cachedSpec: { path: string; spec: Spec } | undefined;
+function spec(env: Env): Spec {
+ const path = String(specPath(env));
+ if (cachedSpec?.path !== path) {
+ cachedSpec = {
+ path,
+ spec: JSON.parse(readFileSync(specPath(env), "utf8")) as Spec,
+ };
+ }
+ return cachedSpec.spec;
+}
+
+/** The provider spellings this engine serves, with LangChain's own as aliases. */
+const PROVIDER_ALIASES: Record = {
+ openai: "openai",
+ anthropic: "anthropic",
+ google: "google",
+ google_genai: "google",
+ gemini: "google",
+};
+
+/**
+ * This Bot's provider and model, environment over spec file over provider default: the lookup of
+ * `bot_settings` in shared/model_providers.py. A blank value is not a choice.
+ */
+export function botSettings(env: Env): { provider: string; model: string } {
+ const file = spec(env);
+ const row = file.bots[BOT_ID];
+ const named = env.BOT_PROVIDER?.trim().toLowerCase();
+ const provider =
+ (named && (PROVIDER_ALIASES[named] ?? named)) || row?.provider || "openai";
+ const model =
+ env.BOT_MODEL?.trim() ||
+ (row && row.provider === provider ? row.model : undefined) ||
+ file.providers[provider]?.default_model ||
+ file.providers.openai?.default_model ||
+ "";
+ return { provider, model };
+}
+
+/** Who serves this engine's model, by the name a person knows it by (`provider_name` in Python). */
+export function providerName(env: Env): string {
+ if (env.CHATGPT_PLAN_HARNESS_URL?.trim()) return "ChatGPT";
+ const provider =
+ PROVIDER_ALIASES[(env.BOT_PROVIDER ?? "openai").trim().toLowerCase()] ??
+ "openai";
+ if (provider === "anthropic") return "Anthropic";
+ if (provider === "google") return "Google";
+ const base = env.OPENAI_BASE_URL?.trim();
+ if (!base) return "OpenAI";
+ let host = "";
+ try {
+ host = new URL(base).hostname;
+ } catch {
+ return "Your model provider";
+ }
+ if (host === "api.openai.com") return "OpenAI";
+ if (host === "api.x.ai") return "xAI";
+ if (host === "generativelanguage.googleapis.com") return "Google";
+ if (base.includes("/api/model-provider/")) {
+ const model = (env.BOT_MODEL ?? "").trim().toLowerCase();
+ if (model.startsWith("grok")) return "xAI";
+ if (model.startsWith("gemini")) return "Google";
+ }
+ return "Your model provider";
+}
+
+/** Where this engine dials its model, for the unreachable sentence. */
+export function modelBaseUrl(env: Env): string | undefined {
+ if (env.CHATGPT_PLAN_HARNESS_URL?.trim())
+ return env.CHATGPT_PLAN_HARNESS_URL.trim();
+ const provider = botSettings(env).provider;
+ if (provider === "anthropic")
+ return env.ANTHROPIC_BASE_URL?.trim() || "https://api.anthropic.com";
+ if (provider === "google")
+ return (
+ env.GOOGLE_GENERATIVE_AI_BASE_URL?.trim() ||
+ "https://generativelanguage.googleapis.com"
+ );
+ return env.OPENAI_BASE_URL?.trim() || "https://api.openai.com/v1";
+}
+
+/**
+ * The client's own retries: two, as the Python integrations default to, and none for a run the
+ * server retries itself, where one rate limit asked again several times over without the wait is
+ * worse than handing it back. LangChain JS would otherwise retry six times.
+ */
+function retries(run: RunModel): number {
+ return run.sendOnce ? 0 : 2;
+}
+
+/** Chat Completions only, whatever LangChain prefers for the model name. */
+class ChatOpenAICompletionsOnly extends ChatOpenAI {
+ override _useResponsesApi(): boolean {
+ return false;
+ }
+}
+
+function openAIModel(model: string, run: RunModel, env: Env): BaseChatModel {
+ const baseURL = env.OPENAI_BASE_URL?.trim() || undefined;
+ // An endpoint that needs no key still needs a string for the SDK (Ollama, vLLM, LM Studio).
+ const apiKey =
+ env.OPENAI_API_KEY?.trim() || (baseURL ? "no-key-needed" : undefined);
+ const chatOnly = env.COPILOTKIT_OPENAI_API?.trim() === "chat";
+ const fields = {
+ model,
+ apiKey,
+ maxRetries: retries(run),
+ ...(baseURL ? { configuration: { baseURL } } : {}),
+ };
+ // THE MODEL DECIDES, NOT THE ADDRESS: a gateway in front of OpenAI cannot say which API a model
+ // takes. An operator who set COPILOTKIT_OPENAI_API=chat has decided.
+ if (requiresResponsesApi(model) && !chatOnly) {
+ return new ChatOpenAI({
+ ...fields,
+ useResponsesApi: true,
+ ...(run.effort ? { reasoning: { effort: run.effort as never } } : {}),
+ });
+ }
+ // `reasoning_effort` as it is, for any model, as agent-langgraph-agui sends it: LangChain's own
+ // `reasoning` is dropped for a model it does not know as OpenAI's (Gemini or Grok behind a
+ // compatible endpoint, the Gemini sign-in's proxy), and those endpoints read the field too.
+ return new ChatOpenAICompletionsOnly({
+ ...fields,
+ ...(run.effort ? { modelKwargs: { reasoning_effort: run.effort } } : {}),
+ });
+}
+
+function anthropicModel(model: string, run: RunModel, env: Env): BaseChatModel {
+ const baseUrl = env.ANTHROPIC_BASE_URL?.trim() || undefined;
+ return new ChatAnthropic({
+ model,
+ apiKey: env.ANTHROPIC_API_KEY?.trim() || undefined,
+ maxRetries: retries(run),
+ ...(baseUrl ? { anthropicApiUrl: baseUrl } : {}),
+ ...(ANTHROPIC_EFFORTS.has(run.effort)
+ ? { outputConfig: { effort: run.effort as never } }
+ : {}),
+ });
+}
+
+/** `GOOGLE_GENERATIVE_AI_BASE_URL` may end in its API version, as the AI SDK takes it. */
+function googleEndpoint(env: Env): { endpoint?: string; apiVersion?: string } {
+ const raw = env.GOOGLE_GENERATIVE_AI_BASE_URL?.trim();
+ if (!raw) return {};
+ const match = /^(.*?)\/(v\d+(?:alpha|beta)?\d*)\/?$/.exec(raw);
+ return match
+ ? { endpoint: match[1], apiVersion: match[2] }
+ : { endpoint: raw.replace(/\/$/, "") };
+}
+
+function googleModel(model: string, run: RunModel, env: Env): BaseChatModel {
+ return new ChatGoogle({
+ model,
+ apiKey:
+ env.GOOGLE_API_KEY?.trim() || env.GEMINI_API_KEY?.trim() || undefined,
+ platformType: "gai",
+ maxRetries: retries(run),
+ ...googleEndpoint(env),
+ ...(GOOGLE_EFFORTS.has(run.effort)
+ ? { reasoningEffort: run.effort as never }
+ : {}),
+ });
+}
+
+const MAKERS: Record<
+ string,
+ (model: string, run: RunModel, env: Env) => BaseChatModel
+> = {
+ openai: openAIModel,
+ anthropic: anthropicModel,
+ google: googleModel,
+};
+
+/** The chat model for this run. */
+export function chatModel(
+ run: RunModel,
+ env: Env = process.env,
+): BaseChatModel {
+ const routed = routedModel(run, env);
+ if (routed) return routed;
+ const planUrl = env.CHATGPT_PLAN_HARNESS_URL?.trim();
+ if (planUrl) {
+ const token =
+ env.CHATGPT_PLAN_HARNESS_TOKEN?.trim() ||
+ env.MANAGED_AGENT_TOKEN?.trim() ||
+ "";
+ return new PlanHarnessChatModel({
+ url: planUrl,
+ token,
+ model: run.model,
+ effort: run.effort,
+ botId: run.botId,
+ });
+ }
+ const settings = botSettings(env);
+ const model = run.model || settings.model;
+ // A recognised `provider:model` keeps its provider. Otherwise the model is an opaque id (an
+ // Ollama `qwen2.5:1.5b` has a colon too) and the configured provider serves it.
+ const separator = model.indexOf(":");
+ const prefix =
+ separator > 0 ? PROVIDER_ALIASES[model.slice(0, separator)] : undefined;
+ const prefixed = prefix ? MAKERS[prefix] : undefined;
+ if (prefixed) return prefixed(model.slice(separator + 1), run, env);
+ const make = MAKERS[settings.provider];
+ if (!make)
+ throw new Error(
+ `This Bot cannot run on the provider "${settings.provider}".`,
+ );
+ return make(model, run, env);
+}
+
+/** The model gateway's root (`OPENBOT_MODEL_GATEWAY_URL`), or undefined where there is none. */
+export function gatewayUrl(env: Env): string | undefined {
+ return env.OPENBOT_MODEL_GATEWAY_URL?.trim().replace(/\/+$/, "") || undefined;
+}
+
+/** A `provider:model` name, as the server may send it, is the model it names. */
+function bareModel(model: string): string {
+ const separator = model.indexOf(":");
+ return separator > 0 && PROVIDER_ALIASES[model.slice(0, separator)]
+ ? model.slice(separator + 1)
+ : model;
+}
+
+/**
+ * The model the server's route names for this run, or undefined where there is no route (or no
+ * gateway, as on a deployment from before the live connection), which is today's environment.
+ *
+ * - `openai`: ChatOpenAI at `${gateway}/v1` with the run token as its key; Responses or Chat
+ * Completions by the model, as for a key.
+ * - `anthropic`: ChatAnthropic at `${gateway}/anthropic` with the run token as its key.
+ * - `chatgpt-plan`: the ChatGPT plan's engine, as `CHATGPT_PLAN_HARNESS_URL` reaches it today.
+ * - `claude-plan`: the Claude engine's `/model` (`CLAUDE_PLAN_HARNESS_URL`), the deployment's
+ * token, one Claude query per Bot and thread, cancelled when the run is stopped.
+ */
+function routedModel(run: RunModel, env: Env): BaseChatModel | undefined {
+ const gateway = gatewayUrl(env);
+ const route = run.route;
+ if (!gateway || !route) return undefined;
+ if (route.via === "chatgpt-plan" || route.via === "claude-plan") {
+ const claude = route.via === "claude-plan";
+ const url = (
+ claude ? env.CLAUDE_PLAN_HARNESS_URL : env.CHATGPT_PLAN_HARNESS_URL
+ )?.trim();
+ if (!url)
+ throw new HarnessRunError(
+ `OpenBot can't reach ${claude ? "Claude" : "ChatGPT"} on the plan: its engine isn't set up here.`,
+ MODEL_UNREACHABLE,
+ );
+ const token =
+ (claude ? undefined : env.CHATGPT_PLAN_HARNESS_TOKEN?.trim()) ||
+ env.MANAGED_AGENT_TOKEN?.trim() ||
+ "";
+ return new PlanHarnessChatModel({
+ plan: claude ? "claude" : "chatgpt",
+ url: claude ? `${url.replace(/\/+$/, "")}/model` : url,
+ token,
+ model: run.model,
+ effort: run.effort,
+ botId: run.botId,
+ ...(claude ? { threadId: run.threadId ?? "", signal: run.signal } : {}),
+ });
+ }
+ if (!route.token)
+ throw new HarnessRunError(
+ "This run came without its pass for OpenBot's model gateway. Try again.",
+ );
+ const model =
+ bareModel(run.model) || spec(env).providers[route.via]?.default_model || "";
+ if (route.via === "anthropic")
+ return anthropicModel(model, run, {
+ ...env,
+ ANTHROPIC_BASE_URL: `${gateway}/anthropic`,
+ ANTHROPIC_API_KEY: route.token,
+ });
+ return openAIModel(model, run, {
+ ...env,
+ OPENAI_BASE_URL: `${gateway}/v1`,
+ OPENAI_API_KEY: route.token,
+ });
+}
diff --git a/agent-langgraph-ts/src/plan-model.ts b/agent-langgraph-ts/src/plan-model.ts
new file mode 100644
index 0000000000..4fa7508803
--- /dev/null
+++ b/agent-langgraph-ts/src/plan-model.ts
@@ -0,0 +1,456 @@
+/**
+ * A plan's model, reached through the engine that holds the plan: a ChatGPT plan through
+ * agent-langgraph-agui at its root, a Claude plan through agent-claude-sdk at `/model`.
+ *
+ * A CLAUDE PLAN, as plan-model.ts reaches it for built-in Bots. The plan token never leaves the
+ * Claude engine; the Claude Agent SDK makes every call. Its query is kept between a step's tool call
+ * and that call's result, so every call of a run, and the next run on the same thread, goes under
+ * one thread id per (Bot, thread) (`claudeThreadId`). A stopped run whose query is answering or
+ * waiting on a call cancels it at `/model/cancel`; a run that hands a call to the surface does not,
+ * since the query waits for that result.
+ *
+ * A CHATGPT PLAN, below.
+ *
+ * A plan token is a bearer for the Codex backend, and the only maintained client for it is
+ * LangChain's Python `_ChatOpenAICodex`, which agent-langgraph-agui already runs, token store and
+ * refresh included. So this engine runs the graph and every model call goes to that harness, the
+ * same way the server's built-in Bots on a ChatGPT plan reach it (`PlanModel` in
+ * server/src/agents/plan-model.ts): one AG-UI run per model call, at the harness's root.
+ *
+ * THE REQUEST, AS plan-model.ts SENDS IT. The conversation without its system turns; the system
+ * turns as `context` ("Built-in Bot instructions"), which the harness puts back in front of the
+ * thread as system messages; the step's tools as AG-UI client tools, so the harness hands every call
+ * back instead of running it; `forwardedProps.openbotModelOnly`, `openbotBotId`, and
+ * `openbotModel` when a model was chosen; a fresh thread id per call, since the harness keeps no
+ * state between runs; the deployment's token in `x-openbot-agent-token`. On a step with no tools
+ * (the last step) no tools go, and `openbotAnswerOnly` says so.
+ *
+ * THE ANSWER. Only the text and tool-call events are read, as plan-model.ts reads them; a snapshot
+ * of the harness's own state is not this run's. A RUN_ERROR ends the call with the harness's words,
+ * code and category (`HarnessRunError`), which this engine relays unchanged.
+ */
+import { createHash, randomUUID } from "node:crypto";
+import { HttpAgent } from "@ag-ui/client";
+import type {
+ Message as AguiMessage,
+ BaseEvent,
+ RunAgentInput,
+ Tool,
+} from "@ag-ui/core";
+import type { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
+import {
+ BaseChatModel,
+ type BaseChatModelCallOptions,
+ type BindToolsInput,
+} from "@langchain/core/language_models/chat_models";
+import { AIMessageChunk, type BaseMessage } from "@langchain/core/messages";
+import { ChatGenerationChunk, type ChatResult } from "@langchain/core/outputs";
+import { convertToOpenAITool } from "@langchain/core/utils/function_calling";
+import { HarnessRunError } from "./errors.ts";
+
+export type PlanHarnessFields = {
+ /** Whose plan: "chatgpt" (the default) or "claude". */
+ plan?: "chatgpt" | "claude";
+ /** The plan engine's AG-UI run: agent-langgraph-agui's root, agent-claude-sdk's `/model`. */
+ url: string;
+ /** That engine's `MANAGED_AGENT_TOKEN`. */
+ token: string;
+ /** The plan model the server chose, or "" for the plan's own default. */
+ model?: string;
+ effort?: string;
+ botId?: string;
+ /**
+ * The run's thread. On a Claude plan every call goes under one query per (Bot, thread)
+ * (`claudeThreadId`); a ChatGPT plan's calls each go under a fresh thread.
+ */
+ threadId?: string;
+ /** The run's stop, which cancels a Claude plan's query. */
+ signal?: AbortSignal;
+ /** For tests: the fetch the AG-UI client uses. */
+ fetch?: typeof fetch;
+};
+
+/** One Claude query per Bot and thread, as plan-model.ts names it on the server. */
+export function claudeThreadId(botId: string, threadId: string): string {
+ return createHash("sha256")
+ .update(JSON.stringify([botId, threadId]))
+ .digest("hex");
+}
+
+export interface PlanHarnessCallOptions extends BaseChatModelCallOptions {
+ tools?: Tool[];
+}
+
+/** The events a model call is made of; everything else the harness sends is its own state. */
+const READ = new Set([
+ "TEXT_MESSAGE_START",
+ "TEXT_MESSAGE_CONTENT",
+ "TEXT_MESSAGE_END",
+ "TOOL_CALL_START",
+ "TOOL_CALL_ARGS",
+ "TOOL_CALL_END",
+ "RUN_ERROR",
+ "RUN_FINISHED",
+]);
+
+function text(content: unknown): string {
+ if (typeof content === "string") return content;
+ if (!Array.isArray(content)) return "";
+ return content
+ .map((part) =>
+ part &&
+ typeof part === "object" &&
+ (part as { type?: unknown }).type === "text"
+ ? String((part as { text?: unknown }).text ?? "")
+ : "",
+ )
+ .join("");
+}
+
+/** A user turn's content as plan-model.ts sends it: one string, or parts when it holds an image. */
+function userContent(content: unknown): AguiMessage["content"] {
+ if (typeof content === "string") return content;
+ const parts = Array.isArray(content)
+ ? (content as Record[])
+ : [];
+ if (parts.every((part) => part?.type === "text"))
+ return parts.map((part) => String(part.text ?? "")).join("\n\n");
+ return parts.flatMap((part): Record[] => {
+ if (part?.type === "text")
+ return [{ type: "text", text: String(part.text ?? "") }];
+ const url =
+ part?.type === "image_url"
+ ? String((part.image_url as { url?: unknown } | undefined)?.url ?? "")
+ : "";
+ if (!url) return [];
+ const data = /^data:([^;]+);base64,(.*)$/s.exec(url);
+ return [
+ {
+ type: "image",
+ source: data
+ ? { type: "data", value: data[2], mimeType: data[1] }
+ : { type: "url", value: url, mimeType: "image/png" },
+ },
+ ];
+ }) as never;
+}
+
+/** The conversation and the instructions, split as plan-model.ts splits them. */
+export function planRequest(messages: BaseMessage[]): {
+ messages: AguiMessage[];
+ context: { description: string; value: string }[];
+} {
+ const conversation: AguiMessage[] = [];
+ const context: { description: string; value: string }[] = [];
+ for (const [index, message] of messages.entries()) {
+ const id = `prompt-${index}`;
+ const type = message.getType();
+ if (type === "system") {
+ context.push({
+ description: "Built-in Bot instructions",
+ value: text(message.content),
+ });
+ } else if (type === "human") {
+ conversation.push({
+ id,
+ role: "user",
+ content: userContent(message.content),
+ } as AguiMessage);
+ } else if (type === "ai") {
+ const calls =
+ (
+ message as {
+ tool_calls?: { id?: string; name: string; args: unknown }[];
+ }
+ ).tool_calls ?? [];
+ conversation.push({
+ id,
+ role: "assistant",
+ content: text(message.content),
+ ...(calls.length
+ ? {
+ toolCalls: calls.map((call) => ({
+ id: call.id ?? randomUUID(),
+ type: "function" as const,
+ function: {
+ name: call.name,
+ arguments: JSON.stringify(call.args ?? {}),
+ },
+ })),
+ }
+ : {}),
+ } as AguiMessage);
+ } else if (type === "tool") {
+ const callId = (message as { tool_call_id?: string }).tool_call_id ?? "";
+ conversation.push({
+ id: `result-${callId}`,
+ role: "tool",
+ toolCallId: callId,
+ content:
+ typeof message.content === "string"
+ ? message.content
+ : JSON.stringify(message.content),
+ } as AguiMessage);
+ }
+ }
+ return { messages: conversation, context };
+}
+
+/** LangChain's tool shapes as AG-UI client tools. */
+export function aguiTools(tools: BindToolsInput[]): Tool[] {
+ return tools.map((tool) => {
+ const fn = convertToOpenAITool(tool as never).function;
+ return {
+ name: fn.name,
+ description: fn.description ?? "",
+ parameters: fn.parameters ?? { type: "object", properties: {} },
+ };
+ });
+}
+
+export class PlanHarnessChatModel extends BaseChatModel {
+ readonly fields: PlanHarnessFields;
+ /** A call is streaming from the Claude query. */
+ private streaming = false;
+ /** Calls the Claude query made that wait on their results. */
+ private pending = 0;
+ /** The Claude query's thread, which every call of the run goes under. */
+ private readonly query?: string;
+
+ constructor(fields: PlanHarnessFields) {
+ super({});
+ this.fields = fields;
+ if (fields.plan !== "claude" || fields.threadId === undefined) return;
+ const query = claudeThreadId(fields.botId ?? "", fields.threadId);
+ this.query = query;
+ fields.signal?.addEventListener("abort", () => void this.cancel(query), {
+ once: true,
+ });
+ }
+
+ _llmType(): string {
+ // Asked by the base class's constructor too, before `fields` is set.
+ return `openbot-${this.fields?.plan ?? "chatgpt"}-plan`;
+ }
+
+ /** Stop the Claude query this run is answering on, if it is answering or waiting. */
+ private async cancel(threadId: string): Promise {
+ if (!this.streaming && this.pending === 0) return;
+ try {
+ const response = await (this.fields.fetch ?? fetch)(
+ `${this.fields.url.replace(/\/+$/, "")}/cancel`,
+ {
+ method: "POST",
+ redirect: "error",
+ signal: AbortSignal.timeout(5000),
+ headers: {
+ "content-type": "application/json",
+ "x-openbot-agent-token": this.fields.token,
+ },
+ body: JSON.stringify({ threadId }),
+ },
+ );
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
+ } catch {
+ // No request details: the address and token are the deployment's. The Claude engine's own
+ // query timeout is the last cleanup.
+ console.error("The Claude plan's model query could not be cancelled.");
+ }
+ }
+
+ override bindTools(
+ tools: BindToolsInput[],
+ kwargs?: Partial,
+ ) {
+ return this.withConfig({
+ ...kwargs,
+ tools: aguiTools(tools),
+ } as Partial);
+ }
+
+ /** The AG-UI run one model call is. */
+ runInput(
+ messages: BaseMessage[],
+ options: PlanHarnessCallOptions,
+ ): RunAgentInput {
+ const answerOnly = options.tool_choice === "none";
+ const { messages: conversation, context } = planRequest(messages);
+ const { model, effort, botId } = this.fields;
+ return {
+ threadId: this.query ?? `plan-${randomUUID()}`,
+ runId: randomUUID(),
+ messages: conversation,
+ tools: answerOnly ? [] : (options.tools ?? []),
+ context,
+ state: null,
+ forwardedProps: {
+ openbotModelOnly: true,
+ ...(botId ? { openbotBotId: botId } : {}),
+ ...(model
+ ? {
+ openbotModel: {
+ model,
+ ...(effort ? { reasoningEffort: effort } : {}),
+ },
+ }
+ : {}),
+ ...(answerOnly ? { openbotAnswerOnly: true } : {}),
+ },
+ } as RunAgentInput;
+ }
+
+ override async *_streamResponseChunks(
+ messages: BaseMessage[],
+ options: this["ParsedCallOptions"],
+ runManager?: CallbackManagerForLLMRun,
+ ): AsyncGenerator {
+ const input = this.runInput(messages, options);
+ const offered = new Set((input.tools ?? []).map((tool) => tool.name));
+ const userFetch = this.fields.fetch ?? fetch;
+ const agent = new HttpAgent({
+ url: this.fields.url,
+ headers: { "x-openbot-agent-token": this.fields.token },
+ fetch: (url, init) =>
+ userFetch(url, {
+ ...init,
+ redirect: "error",
+ signal: AbortSignal.any([
+ ...(init?.signal ? [init.signal] : []),
+ ...(options.signal ? [options.signal] : []),
+ ]),
+ }),
+ });
+
+ const queue: (BaseEvent | { failed: unknown } | { done: true })[] = [];
+ let wake: (() => void) | undefined;
+ const push = (item: (typeof queue)[number]) => {
+ queue.push(item);
+ wake?.();
+ };
+ const subscription = agent.run(input).subscribe({
+ next: (event) => push(event),
+ error: (error) => push({ failed: error }),
+ complete: () => push({ done: true }),
+ });
+
+ const calls = new Map();
+ let finished = false;
+ this.streaming = true;
+ this.pending = 0;
+ try {
+ for (;;) {
+ if (queue.length === 0)
+ await new Promise((resolve) => (wake = resolve));
+ wake = undefined;
+ const item = queue.shift();
+ if (!item) continue;
+ if ("failed" in item) throw item.failed;
+ if ("done" in item) {
+ if (!finished)
+ throw new Error(
+ "The plan harness disconnected before completing its response.",
+ );
+ return;
+ }
+ const event = item as BaseEvent & Record;
+ if (!READ.has(event.type)) continue;
+ switch (event.type) {
+ case "TEXT_MESSAGE_CONTENT": {
+ const delta = String(event.delta ?? "");
+ const chunk = new ChatGenerationChunk({
+ text: delta,
+ message: new AIMessageChunk({ content: delta }),
+ });
+ yield chunk;
+ await runManager?.handleLLMNewToken(delta);
+ break;
+ }
+ case "TOOL_CALL_START": {
+ const name = String(event.toolCallName);
+ if (!offered.has(name))
+ throw new Error(
+ `The plan harness attempted an unoffered tool: ${name}`,
+ );
+ const id = String(event.toolCallId);
+ const index = calls.size;
+ calls.set(id, { index, ended: false });
+ yield new ChatGenerationChunk({
+ text: "",
+ message: new AIMessageChunk({
+ content: "",
+ tool_call_chunks: [
+ { id, name, args: "", index, type: "tool_call_chunk" },
+ ],
+ }),
+ });
+ break;
+ }
+ case "TOOL_CALL_ARGS": {
+ const call = calls.get(String(event.toolCallId));
+ if (!call || call.ended)
+ throw new Error("Unexpected plan tool arguments.");
+ yield new ChatGenerationChunk({
+ text: "",
+ message: new AIMessageChunk({
+ content: "",
+ tool_call_chunks: [
+ {
+ args: String(event.delta ?? ""),
+ index: call.index,
+ type: "tool_call_chunk",
+ },
+ ],
+ }),
+ });
+ break;
+ }
+ case "TOOL_CALL_END": {
+ const call = calls.get(String(event.toolCallId));
+ if (!call || call.ended)
+ throw new Error("Unexpected plan tool completion.");
+ call.ended = true;
+ break;
+ }
+ case "RUN_ERROR": {
+ const category = (
+ event.metadata as { errorCategory?: unknown } | undefined
+ )?.errorCategory;
+ throw new HarnessRunError(
+ String(event.message ?? ""),
+ typeof event.code === "string" ? event.code : undefined,
+ typeof category === "string" ? category : undefined,
+ );
+ }
+ case "RUN_FINISHED": {
+ if ([...calls.values()].some((call) => !call.ended))
+ throw new Error("The plan harness ended during a tool call.");
+ finished = true;
+ this.pending = calls.size;
+ break;
+ }
+ }
+ }
+ } finally {
+ this.streaming = false;
+ subscription.unsubscribe();
+ if (!finished) agent.abortRun();
+ }
+ }
+
+ async _generate(
+ messages: BaseMessage[],
+ options: this["ParsedCallOptions"],
+ runManager?: CallbackManagerForLLMRun,
+ ): Promise {
+ let whole: ChatGenerationChunk | undefined;
+ for await (const chunk of this._streamResponseChunks(
+ messages,
+ options,
+ runManager,
+ )) {
+ whole = whole ? whole.concat(chunk) : chunk;
+ }
+ const message = whole?.message ?? new AIMessageChunk({ content: "" });
+ return { generations: [{ text: whole?.text ?? "", message }] };
+ }
+}
diff --git a/agent-langgraph-ts/src/run.ts b/agent-langgraph-ts/src/run.ts
new file mode 100644
index 0000000000..422078102c
--- /dev/null
+++ b/agent-langgraph-ts/src/run.ts
@@ -0,0 +1,626 @@
+/**
+ * One AG-UI run: the LangGraph graph that answers it, and the events it streams.
+ *
+ * THE HARNESS CONTRACT, as agent-langgraph-agui keeps it (`tool_runtime.py`, `whole_thread.py`):
+ * - The whole thread the server sent is the conversation. Nothing is remembered between runs.
+ * - `input.tools` are this run's tools. A call to a tool the server runs here
+ * (`forwardedProps.openbotDeploymentTools`) goes through its signed callback, with the run's
+ * signed statement (`openbotRun`). Any other call (computer_*, render_ui, a component, a tool this
+ * step was not sent) ends the run for the surface to answer, and the next run brings the call and
+ * its result back in `messages`. A mixed step ends too: a governed action is never run while the
+ * surface still owns an unanswered call.
+ * - Several calls in one step stream as parallel tool events, each with its own id.
+ * - Every run ends with RUN_FINISHED or one RUN_ERROR (`errors.ts`).
+ *
+ * WHAT BUILT-IN BOTS HAVE THAT THE PYTHON HARNESS LACKS:
+ * - The built-in Bot's full prompt (`openbotSystemPrompt`), see `history.ts`.
+ * - A 40-step budget. The last step is sent with tools off (`tool_choice: "none"`) and the server's
+ * own last-step notice (shared/run-notices.ts), so a run always ends by saying something rather
+ * than on its fortieth search (`answersOnLastStep` in the built-in engine).
+ * - History sanitising, so no dangling tool call reaches the model.
+ */
+import { randomUUID } from "node:crypto";
+import type {
+ BaseEvent,
+ Context,
+ Message,
+ RunAgentInput,
+ Tool,
+} from "@ag-ui/core";
+import type { BaseChatModel } from "@langchain/core/language_models/chat_models";
+import {
+ AIMessage,
+ type AIMessageChunk,
+ type BaseMessage,
+ HumanMessage,
+ ToolMessage,
+} from "@langchain/core/messages";
+import type { RunnableConfig } from "@langchain/core/runnables";
+import {
+ Annotation,
+ END,
+ messagesStateReducer,
+ START,
+ StateGraph,
+} from "@langchain/langgraph";
+import { LAST_STEP_NOTICE } from "../../shared/run-notices.ts";
+import { ModelDeclinedError, runFailure } from "./errors.ts";
+import { modelMessages, STANDING_ROLE_PREFIX } from "./history.ts";
+import {
+ chatModel,
+ type Env,
+ gatewayUrl,
+ modelBaseUrl,
+ providerName,
+ type RunModel,
+ runModel,
+ runRoute,
+} from "./models.ts";
+
+/** Model steps a run may take: the built-in Bot's `TOOL_STEPS`. The last one answers in words. */
+export const MAX_STEPS = 40;
+
+export type Emit = (event: BaseEvent) => void;
+
+export type RunContext = {
+ tools: readonly Tool[];
+ context: readonly Context[];
+ deployment: ReadonlySet;
+ assertion: string;
+ model: BaseChatModel;
+ emit: Emit;
+ signal?: AbortSignal;
+ maxSteps: number;
+ env: Env;
+ fetch: typeof fetch;
+};
+
+export type RunOptions = {
+ emit: Emit;
+ signal?: AbortSignal;
+ env?: Env;
+ /** For tests: the model a run would otherwise build from the environment. */
+ makeModel?: (run: RunModel, env: Env) => BaseChatModel;
+ maxSteps?: number;
+ fetch?: typeof fetch;
+ log?: Pick;
+};
+
+const State = Annotation.Root({
+ messages: Annotation({
+ reducer: messagesStateReducer,
+ default: () => [],
+ }),
+ steps: Annotation({ reducer: (_, next) => next, default: () => 0 }),
+});
+type StateType = typeof State.State;
+
+function runOf(config: RunnableConfig): RunContext {
+ return (config.configurable as { openbot: RunContext }).openbot;
+}
+
+/** The step's tools as OpenAI-format function tools, which every LangChain chat model binds. */
+function boundTools(tools: readonly Tool[]) {
+ return tools.map((tool) => ({
+ type: "function" as const,
+ function: {
+ name: tool.name,
+ description: tool.description,
+ parameters: tool.parameters ?? { type: "object", properties: {} },
+ },
+ }));
+}
+
+type Slot = {
+ index: number;
+ id?: string;
+ name?: string;
+ args: string;
+ started: boolean;
+};
+
+/** Whether the model declined to answer, in its provider's way of saying so. */
+function declined(message: AIMessageChunk): string | undefined {
+ const metadata = (message.response_metadata ?? {}) as Record;
+ const kwargs = (message.additional_kwargs ?? {}) as Record;
+ const said = message.text;
+ // Anthropic's stop reason: in the response metadata on a whole answer, in additional_kwargs on a
+ // streamed one.
+ if (metadata.stop_reason === "refusal" || kwargs.stop_reason === "refusal")
+ return said || "Claude declined to answer this request.";
+ const refusal = (
+ message.additional_kwargs as { refusal?: unknown } | undefined
+ )?.refusal;
+ if (typeof refusal === "string" && refusal.trim()) return refusal.trim();
+ const finish = metadata.finishReason ?? metadata.finish_reason;
+ if (
+ typeof finish === "string" &&
+ /^(SAFETY|PROHIBITED_CONTENT|BLOCKLIST|SPII)$/.test(finish)
+ )
+ return said || "Gemini declined to answer this request.";
+ return undefined;
+}
+
+/**
+ * One model call, streamed as it arrives: its words as one text message, and each tool call under
+ * its own id as soon as the provider names it (parallel calls interleave safely: each is keyed by
+ * its index in the response). On the last step no tool event is sent and any call is dropped.
+ */
+async function streamStep(
+ model: BaseChatModel | ReturnType>,
+ messages: BaseMessage[],
+ run: RunContext,
+ last: boolean,
+): Promise {
+ const messageId = randomUUID();
+ const slots = new Map();
+ let textOpen = false;
+ let whole: AIMessageChunk | undefined;
+
+ const start = (slot: Slot) => {
+ slot.started = true;
+ run.emit({
+ type: "TOOL_CALL_START",
+ toolCallId: slot.id,
+ toolCallName: slot.name,
+ parentMessageId: messageId,
+ } as BaseEvent);
+ if (slot.args)
+ run.emit({
+ type: "TOOL_CALL_ARGS",
+ toolCallId: slot.id,
+ delta: slot.args,
+ } as BaseEvent);
+ };
+
+ /**
+ * The tool-call pieces a chunk carries. Most providers stream a call as `tool_call_chunks`; Gemini
+ * (@langchain/google) streams it whole, as `tool_calls` with no chunks, and a run that read only
+ * the chunks saw no call at all. A whole call is one piece of its own.
+ */
+ let wholeCalls = 0;
+ const callPieces = (chunk: AIMessageChunk) => {
+ if (chunk.tool_call_chunks?.length) return chunk.tool_call_chunks;
+ return (chunk.tool_calls ?? []).map((call) => ({
+ id: call.id,
+ name: call.name,
+ args: JSON.stringify(call.args ?? {}),
+ index: `whole-${wholeCalls++}`,
+ }));
+ };
+
+ const stream = await model.stream(messages, { signal: run.signal });
+ for await (const chunk of stream as AsyncIterable) {
+ whole = whole ? whole.concat(chunk) : chunk;
+ const delta = chunk.text;
+ if (delta) {
+ if (!textOpen) {
+ textOpen = true;
+ run.emit({
+ type: "TEXT_MESSAGE_START",
+ messageId,
+ role: "assistant",
+ } as BaseEvent);
+ }
+ run.emit({ type: "TEXT_MESSAGE_CONTENT", messageId, delta } as BaseEvent);
+ }
+ if (last) continue;
+ for (const piece of callPieces(chunk)) {
+ const key =
+ piece.index !== undefined && piece.index !== null
+ ? `index:${piece.index}`
+ : `id:${piece.id}`;
+ let slot = slots.get(key);
+ if (!slot) {
+ slot = { index: slots.size, args: "", started: false };
+ slots.set(key, slot);
+ }
+ if (piece.id && !slot.id) slot.id = piece.id;
+ if (piece.name && !slot.name) slot.name = piece.name;
+ if (slot.started) {
+ if (piece.args)
+ run.emit({
+ type: "TOOL_CALL_ARGS",
+ toolCallId: slot.id,
+ delta: piece.args,
+ } as BaseEvent);
+ slot.args += piece.args ?? "";
+ continue;
+ }
+ slot.args += piece.args ?? "";
+ if (slot.id && slot.name) start(slot);
+ }
+ }
+ if (textOpen) run.emit({ type: "TEXT_MESSAGE_END", messageId } as BaseEvent);
+ if (!whole) return new AIMessage({ id: messageId, content: "" });
+
+ const refusal = declined(whole);
+ if (refusal) throw new ModelDeclinedError(refusal);
+
+ const ordered = [...slots.values()].sort((a, b) => a.index - b.index);
+ const parsed = whole.tool_calls ?? [];
+ const calls = ordered.map((slot, position) => {
+ slot.id ??= parsed[position]?.id ?? randomUUID();
+ slot.name ??= parsed[position]?.name ?? "";
+ if (!slot.started) start(slot);
+ run.emit({ type: "TOOL_CALL_END", toolCallId: slot.id } as BaseEvent);
+ let args: Record = {};
+ try {
+ const value = slot.args.trim() ? JSON.parse(slot.args) : {};
+ if (value && typeof value === "object" && !Array.isArray(value))
+ args = value;
+ } catch {
+ args =
+ (parsed[position]?.args as Record | undefined) ?? {};
+ }
+ // What else the provider put on the call (Gemini's thought signature) stays with it.
+ return {
+ ...(parsed[position] ?? {}),
+ id: slot.id,
+ name: slot.name,
+ args,
+ type: "tool_call" as const,
+ };
+ });
+
+ // The provider's own content is kept for the rest of this run (Anthropic's thinking and tool_use
+ // blocks, the Responses API's reasoning items), so a tool step continues the way it began.
+ const content =
+ last && Array.isArray(whole.content)
+ ? (whole.content as Record[]).filter(
+ (block) =>
+ block?.type !== "tool_use" && block?.type !== "function_call",
+ )
+ : whole.content;
+ return new AIMessage({
+ id: messageId,
+ content: content as never,
+ tool_calls: calls,
+ additional_kwargs: whole.additional_kwargs,
+ response_metadata: whole.response_metadata,
+ ...(whole.usage_metadata ? { usage_metadata: whole.usage_metadata } : {}),
+ });
+}
+
+async function answer(state: StateType, config: RunnableConfig) {
+ const run = runOf(config);
+ const step = state.steps + 1;
+ const offered = boundTools(run.tools);
+ const last = offered.length > 0 && step >= run.maxSteps;
+ // The notice is this call's only: the conversation keeps what the model said and did.
+ const messages = last
+ ? [...state.messages, new HumanMessage(LAST_STEP_NOTICE)]
+ : state.messages;
+ const model =
+ offered.length && run.model.bindTools
+ ? run.model.bindTools(offered, last ? { tool_choice: "none" } : {})
+ : run.model;
+ const message = await streamStep(model, messages, run, last);
+ return { messages: [message], steps: step };
+}
+
+/** Where a step goes next: the server's tools here, or back to the surface (`next_step` in Python). */
+export function nextStep(
+ state: StateType,
+ config: RunnableConfig,
+): "tools" | typeof END {
+ const last = state.messages.at(-1) as AIMessage | undefined;
+ const calls = last?.tool_calls ?? [];
+ if (calls.length === 0) return END;
+ const run = runOf(config);
+ const offered = new Set(run.tools.map((tool) => tool.name));
+ // A tool this run was not offered is handed back like a call the surface owns: the caller answers
+ // it, through its own governance, or refuses a name it holds nothing for.
+ if (calls.some((call) => !offered.has(call.name))) return END;
+ // Mixed turns yield too: never invent a UI result or run a governed action while the surface
+ // still owns an unanswered call.
+ if (calls.some((call) => !run.deployment.has(call.name))) return END;
+ return "tools";
+}
+
+/** The deployment's own reason for refusing a callback, when its body says one. */
+async function refusalReason(response: Response): Promise {
+ try {
+ const body = (await response.json()) as { error?: unknown };
+ return typeof body?.error === "string" && body.error.trim()
+ ? ` ${body.error.trim()}`
+ : "";
+ } catch {
+ return "";
+ }
+}
+
+/** One server tool, run through the deployment's signed callback (`_call_tool` in Python). */
+async function callTool(
+ call: { id?: string; name: string; args: unknown },
+ run: RunContext,
+): Promise {
+ const result = async (): Promise<[string, boolean]> => {
+ const token = run.env.AGENT_TOOL_TOKEN?.trim();
+ if (!token)
+ return [
+ "Refused. This Bot has no credential for calling tools through its deployment.",
+ true,
+ ];
+ if (!run.assertion)
+ return [
+ "Refused. This run carried no signed statement of which Bot and person it is for.",
+ true,
+ ];
+ const url =
+ run.env.OPENBOT_TOOL_URL?.trim() ||
+ "http://127.0.0.1:3001/api/agent-tools/call";
+ try {
+ // Redirects must never carry this deployment's credential elsewhere.
+ const response = await run.fetch(url, {
+ method: "POST",
+ redirect: "manual",
+ signal: AbortSignal.any([
+ AbortSignal.timeout(30_000),
+ ...(run.signal ? [run.signal] : []),
+ ]),
+ headers: {
+ "content-type": "application/json",
+ "x-openbot-agent-token": token,
+ },
+ body: JSON.stringify({
+ name: call.name,
+ args: call.args,
+ run: run.assertion,
+ }),
+ });
+ if (!response.ok) {
+ return [
+ `Refused. Tool callback returned HTTP ${response.status}.${await refusalReason(response)}`,
+ true,
+ ];
+ }
+ const body = (await response.json()) as { text?: unknown };
+ if (!body || typeof body.text !== "string")
+ return ["The tool callback returned no readable result.", true];
+ return [body.text, false];
+ } catch (error) {
+ if (run.signal?.aborted) throw error;
+ // The error's text can carry the URL; the boundary is reported, never the request.
+ return ["The tool callback could not be completed.", true];
+ }
+ };
+ const [content, failed] = await result();
+ return new ToolMessage({
+ id: randomUUID(),
+ content,
+ tool_call_id: call.id ?? "",
+ name: call.name,
+ status: failed ? "error" : "success",
+ });
+}
+
+async function tools(state: StateType, config: RunnableConfig) {
+ const run = runOf(config);
+ if (nextStep(state, config) !== "tools") {
+ throw new Error(
+ "This turn must return to the surface before tools can execute.",
+ );
+ }
+ const calls = (state.messages.at(-1) as AIMessage).tool_calls ?? [];
+ // A Bot has one browser: its computer calls go one after another, in the order the model made
+ // them. Everything else runs alongside them.
+ const computer = calls.filter((call) => call.name.startsWith("computer_"));
+ const inOrder = async () => {
+ const answered: ToolMessage[] = [];
+ for (const call of computer) answered.push(await callTool(call, run));
+ return answered;
+ };
+ const [ordered, others] = await Promise.all([
+ inOrder(),
+ Promise.all(
+ calls
+ .filter((call) => !call.name.startsWith("computer_"))
+ .map((call) => callTool(call, run)),
+ ),
+ ]);
+ const fromComputer = ordered[Symbol.iterator]();
+ const fromOthers = others[Symbol.iterator]();
+ const results = calls.map(
+ (call) =>
+ (call.name.startsWith("computer_") ? fromComputer : fromOthers).next()
+ .value as ToolMessage,
+ );
+ for (const result of results) {
+ run.emit({
+ type: "TOOL_CALL_RESULT",
+ messageId: result.id,
+ toolCallId: result.tool_call_id,
+ content:
+ typeof result.content === "string"
+ ? result.content
+ : JSON.stringify(result.content),
+ role: "tool",
+ } as BaseEvent);
+ }
+ return { messages: results };
+}
+
+export const graph = new StateGraph(State)
+ .addNode("answer", answer)
+ .addNode("tools", tools)
+ .addEdge(START, "answer")
+ .addConditionalEdges("answer", nextStep, ["tools", END])
+ .addEdge("tools", "answer")
+ .compile();
+
+/** A message the graph added, as AG-UI carries it, for the run's closing snapshot. */
+function asAgui(message: BaseMessage): Message | undefined {
+ const type = message.getType();
+ if (type === "ai") {
+ const ai = message as AIMessage;
+ const calls = ai.tool_calls ?? [];
+ return {
+ id: ai.id ?? randomUUID(),
+ role: "assistant",
+ content: ai.text,
+ ...(calls.length
+ ? {
+ toolCalls: calls.map((call) => ({
+ id: call.id ?? "",
+ type: "function" as const,
+ function: {
+ name: call.name,
+ arguments: JSON.stringify(call.args ?? {}),
+ },
+ })),
+ }
+ : {}),
+ } as Message;
+ }
+ if (type === "tool") {
+ const tool = message as ToolMessage;
+ return {
+ id: tool.id ?? randomUUID(),
+ role: "tool",
+ toolCallId: tool.tool_call_id,
+ content:
+ typeof tool.content === "string"
+ ? tool.content
+ : JSON.stringify(tool.content),
+ } as Message;
+ }
+ return undefined;
+}
+
+/** The Bot a run is for, from the server's standing-role id. */
+function botIdOf(messages: readonly Message[]): string | undefined {
+ const role = messages.find(
+ (message) =>
+ typeof message.id === "string" &&
+ message.id.startsWith(STANDING_ROLE_PREFIX),
+ );
+ return role
+ ? role.id.slice(STANDING_ROLE_PREFIX.length) || undefined
+ : undefined;
+}
+
+/** Who serves the model and where it is dialled, for the sentence a failed run ends with. */
+function failureContext(env: Env, run: RunModel) {
+ const gateway = gatewayUrl(env);
+ const via = gateway ? run.route?.via : undefined;
+ if (via === "anthropic")
+ return { provider: "Anthropic", baseUrl: `${gateway}/anthropic` };
+ if (via === "openai")
+ // The gateway can stand in front of any OpenAI-compatible provider: named by its model where
+ // that says (Gemini, Grok), as for the sign-in proxy.
+ return {
+ provider: providerName({
+ OPENAI_BASE_URL: `${gateway}/v1`,
+ BOT_MODEL: run.model,
+ }),
+ baseUrl: `${gateway}/v1`,
+ };
+ if (via === "claude-plan")
+ return { provider: "Claude", baseUrl: env.CLAUDE_PLAN_HARNESS_URL };
+ if (via === "chatgpt-plan")
+ return { provider: "ChatGPT", baseUrl: env.CHATGPT_PLAN_HARNESS_URL };
+ try {
+ return { provider: providerName(env), baseUrl: modelBaseUrl(env) };
+ } catch {
+ return { provider: "Your model provider" };
+ }
+}
+
+/**
+ * Answer one run, emitting its AG-UI events in order. Never throws: a failure is the run's
+ * RUN_ERROR, and the error itself goes to the log.
+ */
+export async function runAgent(
+ input: RunAgentInput,
+ options: RunOptions,
+): Promise {
+ const env = options.env ?? process.env;
+ const log = options.log ?? console;
+ const props = (
+ input.forwardedProps && typeof input.forwardedProps === "object"
+ ? input.forwardedProps
+ : {}
+ ) as Record;
+ const names = props.openbotDeploymentTools;
+ const assertion = props.openbotRun;
+ const systemPrompt =
+ typeof props.openbotSystemPrompt === "string"
+ ? props.openbotSystemPrompt
+ : undefined;
+ // The route and its token stay in this run's model: neither is logged or sent anywhere else.
+ const choice: RunModel = {
+ ...runModel(props),
+ sendOnce: props.openbotSendOnce === true,
+ botId: botIdOf(input.messages ?? []),
+ route: runRoute(props),
+ threadId: input.threadId,
+ signal: options.signal,
+ };
+ const emit = options.emit;
+ emit({
+ type: "RUN_STARTED",
+ threadId: input.threadId,
+ runId: input.runId,
+ } as BaseEvent);
+
+ try {
+ const model = (options.makeModel ?? chatModel)(choice, env);
+ const run: RunContext = {
+ tools: input.tools ?? [],
+ context: input.context ?? [],
+ deployment: new Set(
+ Array.isArray(names)
+ ? names.filter((name): name is string => typeof name === "string")
+ : [],
+ ),
+ assertion: typeof assertion === "string" ? assertion : "",
+ model,
+ emit,
+ signal: options.signal,
+ maxSteps: options.maxSteps ?? MAX_STEPS,
+ env,
+ fetch: options.fetch ?? fetch,
+ };
+ const thread = modelMessages(input.messages ?? [], {
+ systemPrompt,
+ context: run.context,
+ });
+ const final = await graph.invoke(
+ { messages: thread, steps: 0 },
+ {
+ configurable: { openbot: run },
+ // Each step is an answer and, at most, a tools turn: room for every step and the last.
+ recursionLimit: run.maxSteps * 2 + 2,
+ signal: options.signal,
+ },
+ );
+ const added = (final.messages as BaseMessage[])
+ .slice(thread.length)
+ .map(asAgui)
+ .filter((message): message is Message => !!message);
+ emit({
+ type: "MESSAGES_SNAPSHOT",
+ messages: [...(input.messages ?? []), ...added],
+ } as BaseEvent);
+ emit({
+ type: "RUN_FINISHED",
+ threadId: input.threadId,
+ runId: input.runId,
+ } as BaseEvent);
+ } catch (error) {
+ if (options.signal?.aborted) return;
+ const failure = runFailure(error, failureContext(env, choice));
+ if (failure.code)
+ log.warn(`The model provider refused the run: ${failure.message}`);
+ else log.error("The run failed before it finished", error);
+ emit({
+ type: "RUN_ERROR",
+ message: failure.message,
+ ...(failure.code ? { code: failure.code } : {}),
+ ...(failure.category
+ ? { metadata: { errorCategory: failure.category } }
+ : {}),
+ } as BaseEvent);
+ }
+}
diff --git a/agent-langgraph-ts/src/server.ts b/agent-langgraph-ts/src/server.ts
new file mode 100644
index 0000000000..350d9843f5
--- /dev/null
+++ b/agent-langgraph-ts/src/server.ts
@@ -0,0 +1,143 @@
+/**
+ * The engine's HTTP surface, as agent-langgraph-agui serves it: AG-UI over SSE at `/`, `/health`
+ * without a token, everything else behind `x-openbot-agent-token` = `MANAGED_AGENT_TOKEN`, compared
+ * in constant time and refused when the deployment set none.
+ */
+import { timingSafeEqual } from "node:crypto";
+import {
+ createServer,
+ type IncomingMessage,
+ type Server,
+ type ServerResponse,
+} from "node:http";
+import type { BaseEvent, RunAgentInput } from "@ag-ui/core";
+import { RunAgentInputSchema } from "@ag-ui/core/schemas";
+import { EventEncoder } from "@ag-ui/encoder";
+import type { Env } from "./models.ts";
+import { type RunOptions, runAgent } from "./run.ts";
+
+export const TOKEN_HEADER = "x-openbot-agent-token";
+
+/** The largest request body taken: a long thread with images, well short of a memory problem. */
+const MOST_BODY_BYTES = 64 * 1024 * 1024;
+
+function sameToken(offered: string, expected: string): boolean {
+ const a = Buffer.from(offered, "utf8");
+ const b = Buffer.from(expected, "utf8");
+ return a.length === b.length && timingSafeEqual(a, b);
+}
+
+function json(response: ServerResponse, status: number, body: unknown) {
+ response.writeHead(status, {
+ "content-type": "application/json",
+ "cache-control": "no-store",
+ });
+ response.end(JSON.stringify(body));
+}
+
+async function readBody(request: IncomingMessage): Promise {
+ const chunks: Buffer[] = [];
+ let size = 0;
+ for await (const chunk of request) {
+ size += (chunk as Buffer).length;
+ if (size > MOST_BODY_BYTES)
+ throw Object.assign(new Error("too large"), { status: 413 });
+ chunks.push(chunk as Buffer);
+ }
+ return Buffer.concat(chunks).toString("utf8");
+}
+
+export type ServerOptions = Omit & { env?: Env };
+
+/**
+ * The models a signed-in ChatGPT plan offers, from the plan's own harness, for the server's model
+ * picker. Only an engine on a plan has one, as on agent-langgraph-agui.
+ */
+async function planModels(
+ env: Env,
+ response: ServerResponse,
+ fetcher: typeof fetch,
+) {
+ const url = env.CHATGPT_PLAN_HARNESS_URL?.trim();
+ if (!url)
+ return json(response, 404, {
+ error: "This Bot is not signed in to a ChatGPT plan.",
+ });
+ const token =
+ env.CHATGPT_PLAN_HARNESS_TOKEN?.trim() ||
+ env.MANAGED_AGENT_TOKEN?.trim() ||
+ "";
+ try {
+ const answer = await fetcher(`${url.replace(/\/$/, "")}/models`, {
+ headers: { [TOKEN_HEADER]: token },
+ redirect: "error",
+ signal: AbortSignal.timeout(30_000),
+ });
+ response.writeHead(answer.status, {
+ "content-type": "application/json",
+ "cache-control": "no-store",
+ });
+ response.end(await answer.text());
+ } catch {
+ json(response, 502, {
+ error: "The ChatGPT plan's model list could not be read.",
+ });
+ }
+}
+
+export function createEngine(options: ServerOptions = {}): Server {
+ const env = options.env ?? process.env;
+ return createServer(async (request, response) => {
+ const path = new URL(request.url ?? "/", "http://engine").pathname;
+ if (path === "/health" && request.method === "GET") {
+ return json(response, 200, { ok: true, harness: "langgraph-ts" });
+ }
+ const expected = env.MANAGED_AGENT_TOKEN?.trim() ?? "";
+ const offered = String(request.headers[TOKEN_HEADER] ?? "").trim();
+ if (!expected || !sameToken(offered, expected))
+ return json(response, 401, { error: "unauthorised" });
+
+ if (path === "/models" && request.method === "GET")
+ return planModels(env, response, options.fetch ?? fetch);
+ if (path !== "/" || request.method !== "POST")
+ return json(response, 404, { error: "not found" });
+
+ let input: RunAgentInput;
+ try {
+ const parsed = RunAgentInputSchema.safeParse(
+ JSON.parse(await readBody(request)),
+ );
+ if (!parsed.success)
+ return json(response, 422, {
+ error: "The run is not a valid AG-UI RunAgentInput.",
+ });
+ input = parsed.data;
+ } catch (error) {
+ const status = (error as { status?: number }).status === 413 ? 413 : 400;
+ return json(response, status, {
+ error:
+ status === 413 ? "The run is too large." : "The run is not JSON.",
+ });
+ }
+
+ const encoder = new EventEncoder({
+ accept: String(request.headers.accept ?? "text/event-stream"),
+ });
+ response.writeHead(200, {
+ "content-type": encoder.getContentType(),
+ "cache-control": "no-cache",
+ connection: "keep-alive",
+ "x-accel-buffering": "no",
+ });
+ // The caller going away stops the run: its model calls and its tool callbacks.
+ const controller = new AbortController();
+ response.on("close", () => {
+ if (!response.writableFinished) controller.abort();
+ });
+ const emit = (event: BaseEvent) => {
+ if (!response.writableEnded) response.write(encoder.encode(event));
+ };
+ await runAgent(input, { ...options, env, emit, signal: controller.signal });
+ response.end();
+ });
+}
diff --git a/agent-langgraph-ts/test/claude-plan.test.ts b/agent-langgraph-ts/test/claude-plan.test.ts
new file mode 100644
index 0000000000..2774dec28f
--- /dev/null
+++ b/agent-langgraph-ts/test/claude-plan.test.ts
@@ -0,0 +1,470 @@
+/**
+ * A Claude plan's model calls, through the Claude engine's `/model` endpoint.
+ *
+ * The plan token never leaves the Claude Agent SDK engine (agent-claude-sdk): this engine runs the
+ * graph and every model call is an AG-UI run at that engine's `/model`, as the server's built-in
+ * Bots on a Claude plan make it (`PlanModel` in server/src/agents/plan-model.ts). There the SDK
+ * query is kept between a step's tool call and its result, so the thread id is stable per
+ * (Bot, thread), and a stopped run cancels the query at `/model/cancel`.
+ *
+ * The fake engine answers with streams recorded from the real agent-claude-sdk image, built from
+ * this repository, at its `/model` (test/fixtures/claude-model/). With `OPENBOT_LIVE_CLAUDE_URL`
+ * and `OPENBOT_LIVE_CLAUDE_TOKEN` the last test runs against a real one.
+ */
+import assert from "node:assert/strict";
+import { createHash } from "node:crypto";
+import { readFileSync } from "node:fs";
+import {
+ createServer,
+ type IncomingHttpHeaders,
+ type ServerResponse,
+} from "node:http";
+import type { AddressInfo } from "node:net";
+import { test } from "node:test";
+import { inspect } from "node:util";
+import {
+ conversation,
+ events,
+ run,
+ TOKEN,
+ WEATHER_TOOL,
+ withEngine,
+} from "./helpers.ts";
+
+const fixture = (name: string) =>
+ readFileSync(
+ new URL(`./fixtures/claude-model/${name}.sse`, import.meta.url),
+ "utf8",
+ );
+
+type Recorded = {
+ path: string;
+ headers: IncomingHttpHeaders;
+ body: Record;
+};
+
+type ClaudeEngine = {
+ url: string;
+ requests: Recorded[];
+ /** Resolves when a `/model/cancel` arrives. */
+ cancelled: Promise;
+ close: () => Promise;
+};
+
+/** `answer(index)` is the stream for the index-th `/model` run, or "hang" to hold it open. */
+async function claudeEngine(
+ answer: (index: number) => string | "hang",
+): Promise {
+ const requests: Recorded[] = [];
+ let onCancel: (recorded: Recorded) => void = () => {};
+ const cancelled = new Promise((resolve) => (onCancel = resolve));
+ const held: ServerResponse[] = [];
+ let runs = 0;
+ const server = createServer(async (request, response) => {
+ const chunks: Buffer[] = [];
+ for await (const chunk of request) chunks.push(chunk as Buffer);
+ const recorded = {
+ path: request.url ?? "",
+ headers: request.headers,
+ body: JSON.parse(Buffer.concat(chunks).toString("utf8") || "{}"),
+ };
+ requests.push(recorded);
+ // As agent-claude-sdk's middleware: everything but /health needs the deployment's token.
+ if (request.headers["x-openbot-agent-token"] !== TOKEN) {
+ response.writeHead(401, { "content-type": "application/json" });
+ response.end(JSON.stringify({ error: "unauthorised" }));
+ return;
+ }
+ if (recorded.path === "/model/cancel") {
+ response.writeHead(200, { "content-type": "application/json" });
+ response.end(JSON.stringify({ ok: true }));
+ onCancel(recorded);
+ return;
+ }
+ // A plan engine's run: the Claude engine's at /model, the ChatGPT engine's at its root.
+ if (recorded.path !== "/model" && recorded.path !== "/") {
+ response.writeHead(404, { "content-type": "application/json" });
+ response.end(JSON.stringify({ detail: "Not Found" }));
+ return;
+ }
+ const stream = answer(runs++);
+ response.writeHead(200, {
+ "content-type": "text/event-stream; charset=utf-8",
+ });
+ if (stream === "hang") {
+ response.write(`${fixture("text").split("\n\n")[0]}\n\n`);
+ held.push(response);
+ return;
+ }
+ response.end(stream);
+ });
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
+ const { port } = server.address() as AddressInfo;
+ return {
+ url: `http://127.0.0.1:${port}`,
+ requests,
+ cancelled,
+ close: () =>
+ new Promise((resolve) => {
+ for (const response of held) response.destroy();
+ server.closeAllConnections();
+ server.close(() => resolve());
+ }),
+ };
+}
+
+/** The engine's environment under the live connection: the plan engines' addresses, no key. */
+const env = (claude: string, extra: Record = {}) => ({
+ OPENBOT_MODEL_GATEWAY_URL: "http://127.0.0.1:9/api/model-provider",
+ CLAUDE_PLAN_HARNESS_URL: claude,
+ CHATGPT_PLAN_HARNESS_URL: "http://127.0.0.1:9/never",
+ BOT_PROVIDER: "openai",
+ OPENAI_API_KEY: "",
+ ANTHROPIC_API_KEY: "",
+ ...extra,
+});
+
+const claudeRoute = { via: "claude-plan" };
+
+const threadOf = (botId: string, threadId: string) =>
+ createHash("sha256")
+ .update(JSON.stringify([botId, threadId]))
+ .digest("hex");
+
+function words(list: { type: string; delta?: unknown }[]): string {
+ return list
+ .filter((event) => event.type === "TEXT_MESSAGE_CONTENT")
+ .map((event) => String(event.delta))
+ .join("");
+}
+
+test("The claude-plan route asks the Claude engine's /model, with the deployment's token, and its words stream on", async () => {
+ const claude = await claudeEngine(() => fixture("text"));
+ try {
+ const result = await withEngine({ env: env(claude.url) }, (base) =>
+ run(
+ base,
+ conversation({
+ tools: [WEATHER_TOOL],
+ forwardedProps: {
+ openbotModel: {
+ model: "claude-sonnet-4-6",
+ reasoningEffort: "low",
+ },
+ openbotModelRoute: claudeRoute,
+ },
+ }),
+ ),
+ );
+ assert.equal(
+ result.events.at(-1)?.type,
+ "RUN_FINISHED",
+ inspect(result.events.at(-1)),
+ );
+ assert.equal(words(result.events), "hello from the Claude plan");
+ assert.equal(claude.requests.length, 1);
+ const { path, headers, body } = claude.requests[0]!;
+ assert.equal(path, "/model");
+ assert.equal(headers["x-openbot-agent-token"], TOKEN);
+ assert.equal(body.threadId, threadOf("test-bot", "thread-1"));
+ assert.deepEqual(body.forwardedProps, {
+ openbotModelOnly: true,
+ openbotBotId: "test-bot",
+ openbotModel: { model: "claude-sonnet-4-6", reasoningEffort: "low" },
+ });
+ const context = body.context as { description: string; value: string }[];
+ assert.equal(context[0]?.description, "Built-in Bot instructions");
+ assert.ok(context[0]?.value.includes("STANDING_ROLE_MARKER"));
+ assert.deepEqual(
+ (body.messages as { role: string }[]).map((message) => message.role),
+ ["user", "assistant", "user"],
+ );
+ assert.deepEqual(
+ (body.tools as { name: string }[]).map((tool) => tool.name),
+ ["get_weather"],
+ );
+ } finally {
+ await claude.close();
+ }
+});
+
+test("A step's tool call and the next step stay on one Claude query: the same thread, per Bot and thread", async () => {
+ const claude = await claudeEngine((index) =>
+ index === 0 ? fixture("tool") : fixture("text"),
+ );
+ const callback = createServer((request, response) => {
+ request.resume();
+ request.on("end", () => {
+ response.writeHead(200, { "content-type": "application/json" });
+ response.end(JSON.stringify({ text: "Sunny, 21 degrees." }));
+ });
+ });
+ await new Promise((resolve) =>
+ callback.listen(0, "127.0.0.1", resolve),
+ );
+ const tools = `http://127.0.0.1:${(callback.address() as AddressInfo).port}/api/agent-tools/call`;
+ try {
+ const result = await withEngine(
+ {
+ env: env(claude.url, {
+ AGENT_TOOL_TOKEN: "tool-token",
+ OPENBOT_TOOL_URL: tools,
+ }),
+ },
+ async (base) => {
+ const first = await run(
+ base,
+ conversation({
+ tools: [WEATHER_TOOL],
+ forwardedProps: {
+ openbotDeploymentTools: ["get_weather"],
+ openbotRun: "signed-run-statement",
+ openbotModelRoute: claudeRoute,
+ },
+ }),
+ );
+ // Another conversation of the same Bot is another Claude query.
+ await run(
+ base,
+ conversation({
+ threadId: "thread-2",
+ forwardedProps: { openbotModelRoute: claudeRoute },
+ }),
+ );
+ return first;
+ },
+ );
+ assert.equal(
+ result.events.at(-1)?.type,
+ "RUN_FINISHED",
+ inspect(result.events.at(-1)),
+ );
+ assert.equal(claude.requests.length, 3);
+ const [step1, step2, other] = claude.requests.map(
+ (request) => request.body,
+ );
+ assert.equal(step1!.threadId, threadOf("test-bot", "thread-1"));
+ assert.equal(
+ step2!.threadId,
+ step1!.threadId,
+ "the tool result goes back to the query that asked",
+ );
+ assert.equal(other!.threadId, threadOf("test-bot", "thread-2"));
+ const results = (
+ step2!.messages as { role: string; content: string }[]
+ ).filter((message) => message.role === "tool");
+ assert.deepEqual(
+ results.map((message) => message.content),
+ ["Sunny, 21 degrees."],
+ );
+ assert.ok(
+ !claude.requests.some((request) => request.path === "/model/cancel"),
+ );
+ } finally {
+ await claude.close();
+ callback.closeAllConnections();
+ await new Promise((resolve) => callback.close(() => resolve()));
+ }
+});
+
+test("A run that hands a call back to the surface keeps its Claude query for the result", async () => {
+ const claude = await claudeEngine(() => fixture("tool"));
+ try {
+ const result = await withEngine({ env: env(claude.url) }, (base) =>
+ run(
+ base,
+ conversation({
+ tools: [WEATHER_TOOL],
+ forwardedProps: { openbotModelRoute: claudeRoute },
+ }),
+ ),
+ );
+ assert.equal(result.events.at(-1)?.type, "RUN_FINISHED");
+ assert.ok(result.events.some((event) => event.type === "TOOL_CALL_START"));
+ await new Promise((resolve) => setTimeout(resolve, 100));
+ assert.deepEqual(
+ claude.requests.map((request) => request.path),
+ ["/model"],
+ "no cancel: the query waits for the surface's result",
+ );
+ } finally {
+ await claude.close();
+ }
+});
+
+test("Stopping a run cancels its Claude query at /model/cancel", async () => {
+ const claude = await claudeEngine(() => "hang");
+ try {
+ await withEngine({ env: env(claude.url) }, async (base) => {
+ const stop = new AbortController();
+ const response = await fetch(`${base}/`, {
+ method: "POST",
+ signal: stop.signal,
+ headers: {
+ "content-type": "application/json",
+ accept: "text/event-stream",
+ "x-openbot-agent-token": TOKEN,
+ },
+ body: JSON.stringify(
+ conversation({ forwardedProps: { openbotModelRoute: claudeRoute } }),
+ ),
+ });
+ assert.equal(response.status, 200);
+ // Wait until the model call is under way, then Stop.
+ const until = Date.now() + 5000;
+ while (
+ !claude.requests.some((request) => request.path === "/model") &&
+ Date.now() < until
+ )
+ await new Promise((resolve) => setTimeout(resolve, 10));
+ assert.ok(
+ claude.requests.some((request) => request.path === "/model"),
+ "the model call reached the Claude engine",
+ );
+ stop.abort();
+ const cancel = await Promise.race([
+ claude.cancelled,
+ new Promise((resolve) => setTimeout(resolve, 5000)),
+ ]);
+ assert.ok(cancel, "the Claude engine was told to cancel");
+ assert.equal(cancel.headers["x-openbot-agent-token"], TOKEN);
+ assert.deepEqual(cancel.body, {
+ threadId: threadOf("test-bot", "thread-1"),
+ });
+ });
+ } finally {
+ await claude.close();
+ }
+});
+
+test("The chatgpt-plan route goes to the ChatGPT plan's engine, a fresh thread per call", async () => {
+ const chatgpt = await claudeEngine(() => fixture("text"));
+ try {
+ const result = await withEngine(
+ {
+ env: env("http://127.0.0.1:9/never", {
+ CHATGPT_PLAN_HARNESS_URL: chatgpt.url,
+ }),
+ },
+ (base) =>
+ run(
+ base,
+ conversation({
+ forwardedProps: {
+ openbotModel: { model: "gpt-5.5" },
+ openbotModelRoute: { via: "chatgpt-plan" },
+ },
+ }),
+ ),
+ );
+ assert.equal(
+ result.events.at(-1)?.type,
+ "RUN_FINISHED",
+ inspect(result.events.at(-1)),
+ );
+ // The ChatGPT engine's run is at its root, on a thread of its own.
+ assert.deepEqual(
+ chatgpt.requests.map((request) => request.path),
+ ["/"],
+ );
+ assert.match(String(chatgpt.requests[0]!.body.threadId), /^plan-/);
+ } finally {
+ await chatgpt.close();
+ }
+});
+
+test("A plan route with no address for that plan's engine says so in words", async () => {
+ const result = await withEngine(
+ { env: { ...env(""), CLAUDE_PLAN_HARNESS_URL: "" } },
+ (base) =>
+ run(
+ base,
+ conversation({ forwardedProps: { openbotModelRoute: claudeRoute } }),
+ ),
+ );
+ const error = result.events.at(-1)!;
+ assert.equal(error.type, "RUN_ERROR");
+ assert.match(String(error.message), /Claude/);
+});
+
+const LIVE_URL = process.env.OPENBOT_LIVE_CLAUDE_URL?.trim();
+const LIVE_TOKEN = process.env.OPENBOT_LIVE_CLAUDE_TOKEN?.trim();
+
+test("Live: a real Claude engine answers the claude-plan route through /model, a server tool between two steps", {
+ skip:
+ !LIVE_URL || !LIVE_TOKEN ? "set OPENBOT_LIVE_CLAUDE_URL and _TOKEN" : false,
+}, async () => {
+ let called = 0;
+ const callback = createServer((request, response) => {
+ called += 1;
+ request.resume();
+ request.on("end", () => {
+ response.writeHead(200, { "content-type": "application/json" });
+ response.end(
+ JSON.stringify({ text: "Paris: sunny, 21 degrees Celsius." }),
+ );
+ });
+ });
+ await new Promise((resolve) =>
+ callback.listen(0, "127.0.0.1", resolve),
+ );
+ const tools = `http://127.0.0.1:${(callback.address() as AddressInfo).port}/api/agent-tools/call`;
+ try {
+ const result = await withEngine(
+ {
+ env: {
+ ...env(LIVE_URL!, {
+ AGENT_TOOL_TOKEN: "tool-token",
+ OPENBOT_TOOL_URL: tools,
+ }),
+ MANAGED_AGENT_TOKEN: LIVE_TOKEN!,
+ },
+ },
+ async (base) => {
+ const response = await fetch(`${base}/`, {
+ method: "POST",
+ headers: {
+ "content-type": "application/json",
+ accept: "text/event-stream",
+ "x-openbot-agent-token": LIVE_TOKEN!,
+ },
+ body: JSON.stringify(
+ conversation({
+ threadId: `live-${Date.now()}`,
+ messages: [
+ {
+ id: "standing-role:live-bot",
+ role: "system",
+ content:
+ "You are a terse test Bot. Use get_weather for weather questions.",
+ },
+ {
+ id: "u1",
+ role: "user",
+ content: "What's the weather in Paris? Use the tool.",
+ },
+ ],
+ tools: [WEATHER_TOOL],
+ forwardedProps: {
+ openbotDeploymentTools: ["get_weather"],
+ openbotRun: "signed-run-statement",
+ openbotModelRoute: claudeRoute,
+ },
+ }),
+ ),
+ });
+ return events(await response.text());
+ },
+ );
+ assert.equal(result.at(-1)?.type, "RUN_FINISHED", inspect(result.at(-1)));
+ assert.equal(
+ called,
+ 1,
+ "the server tool ran once, between the two Claude steps",
+ );
+ assert.match(words(result), /21/);
+ } finally {
+ callback.closeAllConnections();
+ await new Promise((resolve) => callback.close(() => resolve()));
+ }
+});
diff --git a/agent-langgraph-ts/test/errors.test.ts b/agent-langgraph-ts/test/errors.test.ts
new file mode 100644
index 0000000000..370aec5bdf
--- /dev/null
+++ b/agent-langgraph-ts/test/errors.test.ts
@@ -0,0 +1,332 @@
+/**
+ * A provider's refusal ends the run with its own words, the code the server reads and
+ * `metadata.errorCategory`. Each case is the provider's real error body, thrown by the real vendor
+ * SDK under LangChain, through the real AG-UI endpoint.
+ */
+import assert from "node:assert/strict";
+import { createServer } from "node:http";
+import type { AddressInfo } from "node:net";
+import { test } from "node:test";
+import { always, fakeProvider, type Turn } from "./fake-provider.ts";
+import { conversation, run, withEngine } from "./helpers.ts";
+
+type Provider = "openai" | "anthropic" | "google";
+
+function envFor(provider: Provider, base: string): Record {
+ if (provider === "anthropic")
+ return {
+ BOT_PROVIDER: "anthropic",
+ ANTHROPIC_API_KEY: "sk-ant-test",
+ ANTHROPIC_BASE_URL: base,
+ };
+ if (provider === "google")
+ return {
+ BOT_PROVIDER: "google",
+ GOOGLE_API_KEY: "AIza-test",
+ GOOGLE_GENERATIVE_AI_BASE_URL: `${base}/v1beta`,
+ };
+ return {
+ BOT_PROVIDER: "openai",
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `${base}/v1`,
+ };
+}
+
+async function runError(provider: Provider, turn: Turn) {
+ const fake = await fakeProvider(always(turn));
+ try {
+ const result = await withEngine(
+ { env: envFor(provider, fake.base) },
+ (base) =>
+ run(base, conversation({ forwardedProps: { openbotSendOnce: true } })),
+ );
+ const last = result.events.at(-1)!;
+ assert.equal(
+ last.type,
+ "RUN_ERROR",
+ "every failed run ends with one RUN_ERROR",
+ );
+ assert.equal(
+ result.events.filter((event) => event.type === "RUN_ERROR").length,
+ 1,
+ );
+ return last as unknown as {
+ message: string;
+ code?: string;
+ metadata?: { errorCategory?: string };
+ };
+ } finally {
+ await fake.close();
+ }
+}
+
+const CASES: {
+ name: string;
+ provider: Provider;
+ turn: Turn;
+ code: string;
+ category: string;
+ words: RegExp;
+}[] = [
+ {
+ name: "OpenAI, a key it does not know",
+ provider: "openai",
+ turn: {
+ status: 401,
+ body: {
+ error: {
+ message:
+ "Incorrect API key provided: sk-test. You can find your API key at https://platform.openai.com/account/api-keys.",
+ type: "invalid_request_error",
+ param: null,
+ code: "invalid_api_key",
+ },
+ },
+ },
+ code: "OPENBOT_MODEL_AUTH_REQUIRED",
+ category: "authentication_failed",
+ words: /^Error code: 401 - Incorrect API key provided/,
+ },
+ {
+ name: "OpenAI, a rate limit",
+ provider: "openai",
+ turn: {
+ status: 429,
+ body: {
+ error: {
+ message:
+ "Rate limit reached for gpt-5.5 in organization org-abc on tokens per min (TPM): Limit 30000, Used 30000, Requested 500. Please try again in 1s.",
+ type: "tokens",
+ param: null,
+ code: "rate_limit_exceeded",
+ },
+ },
+ },
+ code: "OPENBOT_MODEL_REFUSED",
+ category: "rate_limit",
+ words: /^Error code: 429 - Rate limit reached for gpt-5\.5/,
+ },
+ {
+ name: "OpenAI, out of quota",
+ provider: "openai",
+ turn: {
+ status: 429,
+ body: {
+ error: {
+ message:
+ "You exceeded your current quota, please check your plan and billing details.",
+ type: "insufficient_quota",
+ param: null,
+ code: "insufficient_quota",
+ },
+ },
+ },
+ code: "OPENBOT_MODEL_BILLING",
+ category: "billing_error",
+ // At a base URL that is not api.openai.com the provider is not named, as on the Python harness.
+ words:
+ /^Your model provider didn't answer: the account is out of credit.*Your model provider said: "You exceeded your current quota/,
+ },
+ {
+ name: "OpenAI, too many tools",
+ provider: "openai",
+ turn: {
+ status: 400,
+ body: {
+ error: {
+ message:
+ "Invalid 'tools': array too long. Expected an array with maximum length 128, but got an array with length 202 instead.",
+ type: "invalid_request_error",
+ param: "tools",
+ code: "array_above_max_length",
+ },
+ },
+ },
+ code: "OPENBOT_MODEL_REFUSED",
+ category: "invalid_request",
+ words: /^Error code: 400 - Invalid 'tools': array too long/,
+ },
+ {
+ name: "OpenAI, a model the key cannot use",
+ provider: "openai",
+ turn: {
+ status: 404,
+ body: {
+ error: {
+ message:
+ "The model `gpt-9` does not exist or you do not have access to it.",
+ type: "invalid_request_error",
+ param: null,
+ code: "model_not_found",
+ },
+ },
+ },
+ code: "OPENBOT_MODEL_REFUSED",
+ category: "model_not_found",
+ words: /^Error code: 404 - The model `gpt-9` does not exist/,
+ },
+ {
+ name: "Anthropic, a bad key",
+ provider: "anthropic",
+ turn: {
+ status: 401,
+ body: {
+ type: "error",
+ error: { type: "authentication_error", message: "invalid x-api-key" },
+ },
+ },
+ code: "OPENBOT_MODEL_AUTH_REQUIRED",
+ category: "authentication_failed",
+ words: /^Error code: 401 - invalid x-api-key$/,
+ },
+ {
+ name: "Anthropic, overloaded",
+ provider: "anthropic",
+ turn: {
+ status: 529,
+ body: {
+ type: "error",
+ error: { type: "overloaded_error", message: "Overloaded" },
+ },
+ },
+ code: "OPENBOT_MODEL_REFUSED",
+ category: "server_error",
+ words: /^Error code: 529 - Overloaded$/,
+ },
+ {
+ name: "Anthropic, out of credit",
+ provider: "anthropic",
+ turn: {
+ status: 400,
+ body: {
+ type: "error",
+ error: {
+ type: "invalid_request_error",
+ message:
+ "Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade or purchase credits.",
+ },
+ },
+ },
+ code: "OPENBOT_MODEL_BILLING",
+ category: "billing_error",
+ words:
+ /^Anthropic didn't answer: .*Anthropic said: "Your credit balance is too low/,
+ },
+ {
+ name: "Anthropic, an unknown model",
+ provider: "anthropic",
+ turn: {
+ status: 404,
+ body: {
+ type: "error",
+ error: { type: "not_found_error", message: "model: claude-nope" },
+ },
+ },
+ code: "OPENBOT_MODEL_REFUSED",
+ category: "model_not_found",
+ words: /^Error code: 404 - model: claude-nope$/,
+ },
+ {
+ name: "Anthropic, Claude declines",
+ provider: "anthropic",
+ turn: { text: "I can't help with that.", stop: "refusal" },
+ code: "OPENBOT_MODEL_REFUSED",
+ category: "refusal",
+ words: /I can't help with that\./,
+ },
+ {
+ name: "Gemini, a key it does not take",
+ provider: "google",
+ turn: {
+ status: 400,
+ body: {
+ error: {
+ code: 400,
+ message: "API key not valid. Please pass a valid API key.",
+ status: "INVALID_ARGUMENT",
+ details: [
+ {
+ "@type": "type.googleapis.com/google.rpc.ErrorInfo",
+ reason: "API_KEY_INVALID",
+ domain: "googleapis.com",
+ },
+ ],
+ },
+ },
+ },
+ code: "OPENBOT_MODEL_AUTH_REQUIRED",
+ category: "authentication_failed",
+ words: /^Error code: 400 - API key not valid/,
+ },
+ {
+ name: "Gemini, exhausted",
+ provider: "google",
+ turn: {
+ status: 429,
+ body: {
+ error: {
+ code: 429,
+ message: "Resource has been exhausted (e.g. check quota).",
+ status: "RESOURCE_EXHAUSTED",
+ },
+ },
+ },
+ code: "OPENBOT_MODEL_REFUSED",
+ category: "rate_limit",
+ words: /^Error code: 429 - Resource has been exhausted/,
+ },
+ {
+ name: "Gemini, overloaded",
+ provider: "google",
+ turn: {
+ status: 503,
+ body: {
+ error: {
+ code: 503,
+ message: "The model is overloaded. Please try again later.",
+ status: "UNAVAILABLE",
+ },
+ },
+ },
+ code: "OPENBOT_MODEL_REFUSED",
+ category: "server_error",
+ words: /^Error code: 503 - The model is overloaded/,
+ },
+];
+
+for (const each of CASES) {
+ test(`${each.name}: ${each.category}`, async () => {
+ const error = await runError(each.provider, each.turn);
+ assert.equal(error.code, each.code);
+ assert.equal(error.metadata?.errorCategory, each.category);
+ assert.match(error.message, each.words);
+ });
+}
+
+/** A port nothing listens on: one the system just gave out and took back. */
+async function closedPort(): Promise {
+ const server = createServer();
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
+ const { port } = server.address() as AddressInfo;
+ await new Promise((resolve) => server.close(() => resolve()));
+ return port;
+}
+
+test("Nothing answering at the model's address says where it was dialled, and nothing more of the URL", async () => {
+ const port = await closedPort();
+ const env = {
+ BOT_PROVIDER: "openai",
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `http://user:secret@127.0.0.1:${port}/v1`,
+ };
+ const result = await withEngine({ env }, (base) =>
+ run(base, conversation({ forwardedProps: { openbotSendOnce: true } })),
+ );
+ const error = result.events.at(-1)!;
+ assert.equal(error.type, "RUN_ERROR");
+ assert.equal(error.code, "OPENBOT_MODEL_UNREACHABLE");
+ assert.equal(
+ error.message,
+ `OpenBot couldn't reach the AI model at 127.0.0.1:${port}. Check that it's running and the address is right.`,
+ );
+});
diff --git a/agent-langgraph-ts/test/fake-provider.ts b/agent-langgraph-ts/test/fake-provider.ts
new file mode 100644
index 0000000000..2a6789b33a
--- /dev/null
+++ b/agent-langgraph-ts/test/fake-provider.ts
@@ -0,0 +1,475 @@
+/**
+ * A model provider on 127.0.0.1 that speaks each provider's real streaming wire format, records
+ * every request body, and answers what a test scripts.
+ *
+ * The formats follow shared/harness_contract.py's `fake_provider` (which the Python harnesses are
+ * tested against) and the providers' own documentation, with tool calls added:
+ * - OpenAI Chat Completions: `chat.completion.chunk` SSE, a call's id and name in its first delta
+ * and its arguments in later ones, `data: [DONE]`.
+ * - OpenAI Responses: `response.*` SSE events, a `function_call` output item.
+ * - Anthropic Messages: `message_start` ... `message_stop`, `tool_use` blocks with `input_json_delta`.
+ * - Gemini: `:streamGenerateContent?alt=sse`, `functionCall` parts.
+ * An error answer is the status and the provider's own error body.
+ */
+import {
+ createServer,
+ type IncomingMessage,
+ type Server,
+ type ServerResponse,
+} from "node:http";
+import type { AddressInfo } from "node:net";
+
+export type Call = {
+ id: string;
+ name: string;
+ args: Record;
+ /** Gemini's `thoughtSignature` on the call's part. */
+ signature?: string;
+};
+export type Turn =
+ | { text?: string; calls?: Call[]; stop?: string }
+ | { status: number; body: unknown };
+export type Recorded = {
+ path: string;
+ headers: IncomingMessage["headers"];
+ body: Record;
+};
+export type Responder = (request: Recorded, index: number) => Turn;
+
+export type FakeProvider = {
+ base: string;
+ requests: Recorded[];
+ close: () => Promise;
+};
+
+function sse(response: ServerResponse, frames: string[]) {
+ response.writeHead(200, {
+ "content-type": "text/event-stream",
+ "cache-control": "no-cache",
+ });
+ for (const frame of frames) response.write(frame);
+ response.end();
+}
+
+const data = (value: unknown) => `data: ${JSON.stringify(value)}\n\n`;
+const named = (name: string, value: unknown) =>
+ `event: ${name}\ndata: ${JSON.stringify(value)}\n\n`;
+
+function chatCompletions(
+ response: ServerResponse,
+ body: Record,
+ turn: { text?: string; calls?: Call[] },
+) {
+ const model = String(body.model ?? "model");
+ const base = {
+ id: "chatcmpl-fake",
+ object: "chat.completion.chunk",
+ created: 0,
+ model,
+ };
+ const frames: string[] = [];
+ frames.push(
+ data({
+ ...base,
+ choices: [
+ {
+ index: 0,
+ delta: { role: "assistant", content: "" },
+ finish_reason: null,
+ },
+ ],
+ }),
+ );
+ if (turn.text) {
+ for (const piece of turn.text.match(/.{1,8}/gs) ?? []) {
+ frames.push(
+ data({
+ ...base,
+ choices: [
+ { index: 0, delta: { content: piece }, finish_reason: null },
+ ],
+ }),
+ );
+ }
+ }
+ const calls = turn.calls ?? [];
+ // Every call's head first, then their arguments interleaved: the parallel shape that broke one
+ // tool slot in the Python integration.
+ for (const [index, call] of calls.entries()) {
+ frames.push(
+ data({
+ ...base,
+ choices: [
+ {
+ index: 0,
+ delta: {
+ tool_calls: [
+ {
+ index,
+ id: call.id,
+ type: "function",
+ function: { name: call.name, arguments: "" },
+ },
+ ],
+ },
+ finish_reason: null,
+ },
+ ],
+ }),
+ );
+ }
+ const pieces = calls.map(
+ (call) => JSON.stringify(call.args).match(/.{1,5}/gs) ?? [],
+ );
+ for (
+ let round = 0;
+ round < Math.max(0, ...pieces.map((p) => p.length));
+ round += 1
+ ) {
+ for (const [index, parts] of pieces.entries()) {
+ if (parts[round] !== undefined)
+ frames.push(
+ data({
+ ...base,
+ choices: [
+ {
+ index: 0,
+ delta: {
+ tool_calls: [
+ { index, function: { arguments: parts[round] } },
+ ],
+ },
+ finish_reason: null,
+ },
+ ],
+ }),
+ );
+ }
+ }
+ frames.push(
+ data({
+ ...base,
+ choices: [
+ {
+ index: 0,
+ delta: {},
+ finish_reason: calls.length ? "tool_calls" : "stop",
+ },
+ ],
+ }),
+ );
+ frames.push(
+ data({
+ ...base,
+ choices: [],
+ usage: { prompt_tokens: 3, completion_tokens: 2, total_tokens: 5 },
+ }),
+ );
+ frames.push("data: [DONE]\n\n");
+ sse(response, frames);
+}
+
+function responses(
+ response: ServerResponse,
+ body: Record,
+ turn: { text?: string; calls?: Call[] },
+) {
+ const model = String(body.model ?? "model");
+ const output: Record[] = [];
+ const events: Record[] = [];
+ const shell = {
+ id: "resp_fake",
+ object: "response",
+ created_at: 0,
+ model,
+ parallel_tool_calls: true,
+ tool_choice: "auto",
+ tools: [],
+ };
+ events.push({
+ type: "response.created",
+ response: { ...shell, status: "in_progress", output: [] },
+ });
+ if (turn.text) {
+ const item = {
+ id: "msg_fake",
+ type: "message",
+ role: "assistant",
+ status: "completed",
+ content: [{ type: "output_text", text: turn.text, annotations: [] }],
+ };
+ const index = output.length;
+ events.push({
+ type: "response.output_item.added",
+ output_index: index,
+ item: { ...item, status: "in_progress", content: [] },
+ });
+ events.push({
+ type: "response.content_part.added",
+ output_index: index,
+ item_id: "msg_fake",
+ content_index: 0,
+ part: { type: "output_text", text: "", annotations: [] },
+ });
+ events.push({
+ type: "response.output_text.delta",
+ output_index: index,
+ item_id: "msg_fake",
+ content_index: 0,
+ delta: turn.text,
+ });
+ events.push({
+ type: "response.output_text.done",
+ output_index: index,
+ item_id: "msg_fake",
+ content_index: 0,
+ text: turn.text,
+ });
+ events.push({
+ type: "response.output_item.done",
+ output_index: index,
+ item,
+ });
+ output.push(item);
+ }
+ for (const call of turn.calls ?? []) {
+ const index = output.length;
+ const id = `fc_${call.id}`;
+ const args = JSON.stringify(call.args);
+ const item = {
+ id,
+ type: "function_call",
+ status: "completed",
+ call_id: call.id,
+ name: call.name,
+ arguments: args,
+ };
+ events.push({
+ type: "response.output_item.added",
+ output_index: index,
+ item: { ...item, status: "in_progress", arguments: "" },
+ });
+ events.push({
+ type: "response.function_call_arguments.delta",
+ output_index: index,
+ item_id: id,
+ delta: args,
+ });
+ events.push({
+ type: "response.function_call_arguments.done",
+ output_index: index,
+ item_id: id,
+ arguments: args,
+ });
+ events.push({
+ type: "response.output_item.done",
+ output_index: index,
+ item,
+ });
+ output.push(item);
+ }
+ events.push({
+ type: "response.completed",
+ response: {
+ ...shell,
+ status: "completed",
+ output,
+ usage: { input_tokens: 3, output_tokens: 2, total_tokens: 5 },
+ },
+ });
+ sse(
+ response,
+ events.map((event, index) =>
+ named(String(event.type), { ...event, sequence_number: index }),
+ ),
+ );
+}
+
+function anthropic(
+ response: ServerResponse,
+ body: Record,
+ turn: { text?: string; calls?: Call[]; stop?: string },
+) {
+ const message = {
+ id: "msg_fake",
+ type: "message",
+ role: "assistant",
+ model: String(body.model ?? "claude"),
+ stop_sequence: null,
+ };
+ const frames: string[] = [];
+ frames.push(
+ named("message_start", {
+ type: "message_start",
+ message: {
+ ...message,
+ content: [],
+ stop_reason: null,
+ usage: { input_tokens: 3, output_tokens: 0 },
+ },
+ }),
+ );
+ let index = 0;
+ if (turn.text) {
+ frames.push(
+ named("content_block_start", {
+ type: "content_block_start",
+ index,
+ content_block: { type: "text", text: "" },
+ }),
+ );
+ for (const piece of turn.text.match(/.{1,8}/gs) ?? [])
+ frames.push(
+ named("content_block_delta", {
+ type: "content_block_delta",
+ index,
+ delta: { type: "text_delta", text: piece },
+ }),
+ );
+ frames.push(
+ named("content_block_stop", { type: "content_block_stop", index }),
+ );
+ index += 1;
+ }
+ for (const call of turn.calls ?? []) {
+ frames.push(
+ named("content_block_start", {
+ type: "content_block_start",
+ index,
+ content_block: {
+ type: "tool_use",
+ id: call.id,
+ name: call.name,
+ input: {},
+ },
+ }),
+ );
+ for (const piece of JSON.stringify(call.args).match(/.{1,6}/gs) ?? [])
+ frames.push(
+ named("content_block_delta", {
+ type: "content_block_delta",
+ index,
+ delta: { type: "input_json_delta", partial_json: piece },
+ }),
+ );
+ frames.push(
+ named("content_block_stop", { type: "content_block_stop", index }),
+ );
+ index += 1;
+ }
+ const stop = turn.stop ?? (turn.calls?.length ? "tool_use" : "end_turn");
+ frames.push(
+ named("message_delta", {
+ type: "message_delta",
+ delta: { stop_reason: stop, stop_sequence: null },
+ usage: { output_tokens: 2 },
+ }),
+ );
+ frames.push(named("message_stop", { type: "message_stop" }));
+ sse(response, frames);
+}
+
+function gemini(
+ response: ServerResponse,
+ turn: { text?: string; calls?: Call[]; stop?: string },
+) {
+ const frames: string[] = [];
+ if (turn.text) {
+ for (const piece of turn.text.match(/.{1,8}/gs) ?? [])
+ frames.push(
+ data({
+ candidates: [
+ { content: { role: "model", parts: [{ text: piece }] }, index: 0 },
+ ],
+ modelVersion: "gemini-fake",
+ }),
+ );
+ }
+ if (turn.calls?.length) {
+ frames.push(
+ data({
+ candidates: [
+ {
+ content: {
+ role: "model",
+ // Gemini 2.5 sends no call id; Gemini 3 sends one. Both may carry a thought signature,
+ // which must come back with the call on the next request.
+ parts: turn.calls.map((call) => ({
+ functionCall: {
+ ...(call.id ? { id: call.id } : {}),
+ name: call.name,
+ args: call.args,
+ },
+ ...(call.signature ? { thoughtSignature: call.signature } : {}),
+ })),
+ },
+ index: 0,
+ },
+ ],
+ modelVersion: "gemini-fake",
+ }),
+ );
+ }
+ frames.push(
+ data({
+ candidates: [
+ {
+ content: { role: "model", parts: [{ text: "" }] },
+ finishReason: turn.stop ?? "STOP",
+ index: 0,
+ },
+ ],
+ usageMetadata: {
+ promptTokenCount: 3,
+ candidatesTokenCount: 2,
+ totalTokenCount: 5,
+ },
+ modelVersion: "gemini-fake",
+ }),
+ );
+ sse(response, frames);
+}
+
+export async function fakeProvider(respond: Responder): Promise {
+ const requests: Recorded[] = [];
+ const server: Server = createServer(async (request, response) => {
+ const chunks: Buffer[] = [];
+ for await (const chunk of request) chunks.push(chunk as Buffer);
+ const raw = Buffer.concat(chunks).toString("utf8");
+ const path = request.url ?? "/";
+ const recorded: Recorded = {
+ path,
+ headers: request.headers,
+ body: raw ? JSON.parse(raw) : {},
+ };
+ requests.push(recorded);
+ const turn = respond(recorded, requests.length - 1);
+ if ("status" in turn) {
+ response.writeHead(turn.status, { "content-type": "application/json" });
+ response.end(JSON.stringify(turn.body));
+ return;
+ }
+ if (path.endsWith("/chat/completions"))
+ return chatCompletions(response, recorded.body, turn);
+ if (path.endsWith("/responses"))
+ return responses(response, recorded.body, turn);
+ if (path.endsWith("/messages"))
+ return anthropic(response, recorded.body, turn);
+ if (path.includes(":streamGenerateContent")) return gemini(response, turn);
+ response.writeHead(404, { "content-type": "application/json" });
+ response.end(JSON.stringify({ error: { message: `no route ${path}` } }));
+ });
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
+ const { port } = server.address() as AddressInfo;
+ return {
+ base: `http://127.0.0.1:${port}`,
+ requests,
+ close: () => new Promise((resolve) => server.close(() => resolve())),
+ };
+}
+
+/** Always the same answer. */
+export const always =
+ (turn: Turn): Responder =>
+ () =>
+ turn;
diff --git a/agent-langgraph-ts/test/fixtures/claude-model/text.sse b/agent-langgraph-ts/test/fixtures/claude-model/text.sse
new file mode 100644
index 0000000000..61d0590612
--- /dev/null
+++ b/agent-langgraph-ts/test/fixtures/claude-model/text.sse
@@ -0,0 +1,18 @@
+data: {"type":"RUN_STARTED","threadId":"claude-capture-text","runId":"run-text"}
+
+data: {"type":"CUSTOM","name":"system:init","value":{"type":"system","subtype":"init","cwd":"/app","session_id":"0fb86f8a-7c5e-4a80-bfa1-6844176c3802","tools":[],"mcp_servers":[],"model":"claude-opus-5-5","permissionMode":"dontAsk","slash_commands":["deep-research","design","design-sync","dataviz","update-config","verify","debug","code-review","simplify","batch","fewer-permission-prompts","doctor","loop","claude-api","workflow-authoring","run","run-skill-generator","plugin-authoring","advisor","agents","auto-mode-setup","autocompact","clear","color","compact","config","output-style","context","effort","fast","focus","heapdump","init","mcp","import","model","__remote-workflow","workflow-launch-exec","reload-plugins","reload-skills","rename","security-review","usage","insights","recap","skill-doctor","goal","design-consent","design-revoke","list-agents","team-onboarding"],"terminal_slash_commands":["doctor","color","focus","reload-plugins"],"apiKeySource":"ANTHROPIC_API_KEY","claude_code_version":"2.1.325","output_style":"default","agents":["claude","Explore","general-purpose","Plan","statusline-setup"],"skills":["deep-research","design","design-sync","dataviz","update-config","verify","debug","code-review","simplify","batch","fewer-permission-prompts","doctor","loop","claude-api","workflow-authoring","run","run-skill-generator","plugin-authoring"],"plugins":[{"name":"cc-plugin-agents-md","path":"builtin","source":"cc-plugin-agents-md@builtin"},{"name":"cc-plugin-telemetry","path":"builtin","source":"cc-plugin-telemetry@builtin"},{"name":"cc-plugin-privacy","path":"builtin","source":"cc-plugin-privacy@builtin"},{"name":"cc-plugin-plugin-authoring","path":"builtin","source":"cc-plugin-plugin-authoring@builtin"}],"capabilities":["interrupt_receipt_v1","interrupt_cancel_queued_v1","interrupt_send_now_v1","interrupt_requeue_taken_v1","msg_lifecycle_v1","request_marker_lists_v1","ask_user_question_unanswered_v1","lifecycle_wakeup_source_v1","sdk_mcp_tools_list_changed","sdk_mcp_manifests","mcp_read_resource_v1","mcp_tool_ui_meta_v1","ui_surface_v1","mcp_call_result_not_for_model_v1","mcp_call_check_permissions_v1","voice_call_talk_line_v1","withdrawn_files_note_v2","ui_pane_widget_v1","reload_plugins_refuse_if_busy_v1"],"analytics_disabled":false,"product_feedback_disabled":false,"uuid":"30acc0c4-4fb0-453e-8f51-4f2e3ef63726","memory_paths":{"auto":"/root/.claude/projects/-app/memory/"},"original_cwd":"/app","additional_directories":[],"messaging_socket_path":"/tmp/cc-socks/46.sock","fast_mode_state":"off","fast_mode_disabled_reason":"sdk_opt_in_required","per_turn_effort_active":true,"ultrathink_available":false,"ultrathink_typed_raises":false,"view_mode":"default"},"run_id":"run-text","thread_id":"claude-capture-text"}
+
+data: {"type":"CUSTOM","name":"system:status","value":{"type":"system","subtype":"status","status":"requesting","session_id":"0fb86f8a-7c5e-4a80-bfa1-6844176c3802","uuid":"783a28f1-230c-45da-8143-2c143fa60183"},"run_id":"run-text","thread_id":"claude-capture-text"}
+
+data: {"type":"TEXT_MESSAGE_START","messageId":"220dcf87-8722-45a9-96ed-852101db0d29","role":"assistant","thread_id":"claude-capture-text","run_id":"run-text"}
+
+data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"220dcf87-8722-45a9-96ed-852101db0d29","delta":"h","thread_id":"claude-capture-text","run_id":"run-text"}
+
+data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"220dcf87-8722-45a9-96ed-852101db0d29","delta":"ello from the Claude plan","thread_id":"claude-capture-text","run_id":"run-text"}
+
+data: {"type":"TEXT_MESSAGE_END","messageId":"220dcf87-8722-45a9-96ed-852101db0d29","thread_id":"claude-capture-text","run_id":"run-text"}
+
+data: {"type":"MESSAGES_SNAPSHOT","messages":[{"id":"prompt-0","role":"user","content":"Reply with exactly: hello from the Claude plan"},{"id":"220dcf87-8722-45a9-96ed-852101db0d29","role":"assistant","content":"hello from the Claude plan"}],"run_id":"run-text","thread_id":"claude-capture-text"}
+
+data: {"type":"RUN_FINISHED","threadId":"claude-capture-text","runId":"run-text","result":{"is_error":false,"duration_ms":1071,"duration_api_ms":918,"num_turns":1,"total_cost_usd":0.001932,"usage":{"input_tokens":428,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":11,"output_tokens_details":{"thinking_tokens":0},"server_tool_use":{"web_search_requests":0,"web_fetch_requests":0},"service_tier":"standard","cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"inference_geo":"global","iterations":[{"input_tokens":428,"output_tokens":11,"cache_read_input_tokens":0,"cache_creation_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"type":"message"}],"speed":"standard","fallback_credit":null},"structured_output":null}}
+
diff --git a/agent-langgraph-ts/test/fixtures/claude-model/tool.sse b/agent-langgraph-ts/test/fixtures/claude-model/tool.sse
new file mode 100644
index 0000000000..68f6224785
--- /dev/null
+++ b/agent-langgraph-ts/test/fixtures/claude-model/tool.sse
@@ -0,0 +1,18 @@
+data: {"type":"RUN_STARTED","threadId":"claude-capture-tool","runId":"run-tool"}
+
+data: {"type":"CUSTOM","name":"system:init","value":{"type":"system","subtype":"init","cwd":"/app","session_id":"2b81d4bb-87b4-441d-bbbe-8035e2d7fbea","tools":["mcp__ag_ui__get_weather"],"mcp_servers":[{"name":"ag_ui","status":"connected","source":"sdk"}],"model":"claude-opus-5-5","permissionMode":"dontAsk","slash_commands":["deep-research","design","design-sync","dataviz","update-config","verify","debug","code-review","simplify","batch","fewer-permission-prompts","doctor","loop","claude-api","workflow-authoring","run","run-skill-generator","plugin-authoring","advisor","agents","auto-mode-setup","autocompact","clear","color","compact","config","output-style","context","effort","fast","focus","heapdump","init","mcp","import","model","__remote-workflow","workflow-launch-exec","reload-plugins","reload-skills","rename","security-review","usage","insights","recap","skill-doctor","goal","design-consent","design-revoke","list-agents","team-onboarding"],"terminal_slash_commands":["doctor","color","focus","reload-plugins"],"apiKeySource":"ANTHROPIC_API_KEY","claude_code_version":"2.1.325","output_style":"default","agents":["claude","Explore","general-purpose","Plan","statusline-setup"],"skills":["deep-research","design","design-sync","dataviz","update-config","verify","debug","code-review","simplify","batch","fewer-permission-prompts","doctor","loop","claude-api","workflow-authoring","run","run-skill-generator","plugin-authoring"],"plugins":[{"name":"cc-plugin-agents-md","path":"builtin","source":"cc-plugin-agents-md@builtin"},{"name":"cc-plugin-telemetry","path":"builtin","source":"cc-plugin-telemetry@builtin"},{"name":"cc-plugin-privacy","path":"builtin","source":"cc-plugin-privacy@builtin"},{"name":"cc-plugin-plugin-authoring","path":"builtin","source":"cc-plugin-plugin-authoring@builtin"}],"capabilities":["interrupt_receipt_v1","interrupt_cancel_queued_v1","interrupt_send_now_v1","interrupt_requeue_taken_v1","msg_lifecycle_v1","request_marker_lists_v1","ask_user_question_unanswered_v1","lifecycle_wakeup_source_v1","sdk_mcp_tools_list_changed","sdk_mcp_manifests","mcp_read_resource_v1","mcp_tool_ui_meta_v1","ui_surface_v1","mcp_call_result_not_for_model_v1","mcp_call_check_permissions_v1","voice_call_talk_line_v1","withdrawn_files_note_v2","ui_pane_widget_v1","reload_plugins_refuse_if_busy_v1"],"analytics_disabled":false,"product_feedback_disabled":false,"uuid":"641ae731-a32b-4228-a178-810cb67fb3c0","memory_paths":{"auto":"/root/.claude/projects/-app/memory/"},"original_cwd":"/app","additional_directories":[],"messaging_socket_path":"/tmp/cc-socks/79.sock","fast_mode_state":"off","fast_mode_disabled_reason":"sdk_opt_in_required","per_turn_effort_active":true,"ultrathink_available":false,"ultrathink_typed_raises":false,"view_mode":"default"},"run_id":"run-tool","thread_id":"claude-capture-tool"}
+
+data: {"type":"CUSTOM","name":"system:status","value":{"type":"system","subtype":"status","status":"requesting","session_id":"2b81d4bb-87b4-441d-bbbe-8035e2d7fbea","uuid":"65d0c659-d382-438b-ae10-0a979fab4d92"},"run_id":"run-tool","thread_id":"claude-capture-tool"}
+
+data: {"type":"TOOL_CALL_START","toolCallId":"toolu_011VkwbpyLwNi5yHnG9af2Ep","toolCallName":"get_weather","parentMessageId":"173c0534-ce67-47e5-90cf-3c6b4655df2f","thread_id":"claude-capture-tool","run_id":"run-tool"}
+
+data: {"type":"TOOL_CALL_ARGS","toolCallId":"toolu_011VkwbpyLwNi5yHnG9af2Ep","delta":"{\"city\": \"Pa","thread_id":"claude-capture-tool","run_id":"run-tool"}
+
+data: {"type":"TOOL_CALL_ARGS","toolCallId":"toolu_011VkwbpyLwNi5yHnG9af2Ep","delta":"ris","thread_id":"claude-capture-tool","run_id":"run-tool"}
+
+data: {"type":"TOOL_CALL_ARGS","toolCallId":"toolu_011VkwbpyLwNi5yHnG9af2Ep","delta":"\"}","thread_id":"claude-capture-tool","run_id":"run-tool"}
+
+data: {"type":"TOOL_CALL_END","toolCallId":"toolu_011VkwbpyLwNi5yHnG9af2Ep","thread_id":"claude-capture-tool","run_id":"run-tool"}
+
+data: {"type":"RUN_FINISHED","threadId":"claude-capture-tool","runId":"run-tool"}
+
diff --git a/agent-langgraph-ts/test/fixtures/plan-harness/bad-key.sse b/agent-langgraph-ts/test/fixtures/plan-harness/bad-key.sse
new file mode 100644
index 0000000000..311ae88e0c
--- /dev/null
+++ b/agent-langgraph-ts/test/fixtures/plan-harness/bad-key.sse
@@ -0,0 +1,12 @@
+data: {"type":"RUN_STARTED","threadId":"plan-capture-bad","runId":"run-bad"}
+
+data: {"type":"RAW","event":{"event":"on_chain_start","data":{"input":{"openbot_model_only":true,"openbot_bot_id":"capture-bot","messages":[{"content":"Hello","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}],"tools":[]}},"name":"LangGraph","tags":[],"run_id":"01a1eb81-d2a4-7604-aac7-d53958028345","metadata":{"thread_id":"plan-capture-bad","ls_integration":"langgraph"},"parent_ids":[]}}
+
+data: {"type":"STEP_STARTED","stepName":"answer"}
+
+data: {"type":"RAW","event":{"event":"on_chain_start","data":{"input":{"messages":[{"content":"Hello","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]}},"name":"answer","tags":["graph:step:1"],"run_id":"01a1eb81-d2a7-7576-90ae-8d466b29bae4","metadata":{"thread_id":"plan-capture-bad","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:4e12f5fd-9fe7-a07d-c24f-9702ba9783bb"},"parent_ids":["01a1eb81-d2a4-7604-aac7-d53958028345"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_start","data":{"input":{"messages":[[{"content":"Built-in Bot instructions\nYou are a terse test Bot.","additional_kwargs":{},"response_metadata":{},"type":"system","name":null,"id":null},{"content":"Hello","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]]}},"name":"ChatOpenAI","tags":["seq:step:1"],"run_id":"01a1eb81-d685-775d-a816-372fa0c9a4af","metadata":{"thread_id":"plan-capture-bad","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:4e12f5fd-9fe7-a07d-c24f-9702ba9783bb","checkpoint_ns":"answer:4e12f5fd-9fe7-a07d-c24f-9702ba9783bb","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-d2a4-7604-aac7-d53958028345","01a1eb81-d2a7-7576-90ae-8d466b29bae4"]}}
+
+data: {"type":"RUN_ERROR","message":"Sign in to your model provider again.","code":"OPENBOT_MODEL_AUTH_REQUIRED"}
+
diff --git a/agent-langgraph-ts/test/fixtures/plan-harness/parallel.sse b/agent-langgraph-ts/test/fixtures/plan-harness/parallel.sse
new file mode 100644
index 0000000000..17e4434a71
--- /dev/null
+++ b/agent-langgraph-ts/test/fixtures/plan-harness/parallel.sse
@@ -0,0 +1,86 @@
+data: {"type":"RUN_STARTED","threadId":"plan-capture-parallel","runId":"run-parallel"}
+
+data: {"type":"RAW","event":{"event":"on_chain_start","data":{"input":{"openbot_model_only":true,"openbot_bot_id":"capture-bot","messages":[{"content":"Get the weather in Paris and in Tokyo. Make both tool calls at once, in this one reply.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}],"tools":[{"name":"get_weather","description":"Current weather for a city.","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}]}},"name":"LangGraph","tags":[],"run_id":"01a1eb81-cf20-7097-8fc7-1b05a2b12475","metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langgraph"},"parent_ids":[]}}
+
+data: {"type":"STEP_STARTED","stepName":"answer"}
+
+data: {"type":"RAW","event":{"event":"on_chain_start","data":{"input":{"messages":[{"content":"Get the weather in Paris and in Tokyo. Make both tool calls at once, in this one reply.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]}},"name":"answer","tags":["graph:step:1"],"run_id":"01a1eb81-cf21-7090-b48f-957a6db25406","metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7"},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_start","data":{"input":{"messages":[[{"content":"Built-in Bot instructions\nYou are a terse test Bot. Always use tools when offered, in parallel when they are independent.","additional_kwargs":{},"response_metadata":{},"type":"system","name":null,"id":null},{"content":"Get the weather in Paris and in Tokyo. Make both tool calls at once, in this one reply.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]]}},"name":"ChatOpenAI","tags":["seq:step:1"],"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[{"name":"get_weather","args":"","id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","index":0,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"TOOL_CALL_START","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":null,"additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[{"name":"get_weather","args":"","id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","index":0,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]},"toolCallId":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","toolCallName":"get_weather","parentMessageId":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678"}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"","args":{},"id":null,"type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"{\"ci","id":null,"index":0,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"TOOL_CALL_ARGS","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":null,"additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"","args":{},"id":null,"type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"{\"ci","id":null,"index":0,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]},"toolCallId":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","delta":"{\"ci"}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[{"name":null,"args":"ty\": ","id":null,"error":null,"type":"invalid_tool_call"}],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"ty\": ","id":null,"index":0,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"TOOL_CALL_ARGS","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":null,"additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[{"name":null,"args":"ty\": ","id":null,"error":null,"type":"invalid_tool_call"}],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"ty\": ","id":null,"index":0,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]},"toolCallId":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","delta":"ty\": "}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[{"name":null,"args":"\"Paris","id":null,"error":null,"type":"invalid_tool_call"}],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"\"Paris","id":null,"index":0,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"TOOL_CALL_ARGS","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":null,"additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[{"name":null,"args":"\"Paris","id":null,"error":null,"type":"invalid_tool_call"}],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"\"Paris","id":null,"index":0,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]},"toolCallId":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","delta":"\"Paris"}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[{"name":null,"args":"\"}","id":null,"error":null,"type":"invalid_tool_call"}],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"\"}","id":null,"index":0,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"TOOL_CALL_ARGS","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":null,"additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[{"name":null,"args":"\"}","id":null,"error":null,"type":"invalid_tool_call"}],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"\"}","id":null,"index":0,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]},"toolCallId":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","delta":"\"}"}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[{"name":"get_weather","args":"","id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","index":1,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"TOOL_CALL_START","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":null,"additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[{"name":"get_weather","args":"","id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","index":1,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]},"toolCallId":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","toolCallName":"get_weather","parentMessageId":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678"}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"","args":{},"id":null,"type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"{\"ci","id":null,"index":1,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"TOOL_CALL_ARGS","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":null,"additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"","args":{},"id":null,"type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"{\"ci","id":null,"index":1,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]},"toolCallId":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","delta":"{\"ci"}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[{"name":null,"args":"ty\": ","id":null,"error":null,"type":"invalid_tool_call"}],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"ty\": ","id":null,"index":1,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"TOOL_CALL_ARGS","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":null,"additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[{"name":null,"args":"ty\": ","id":null,"error":null,"type":"invalid_tool_call"}],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"ty\": ","id":null,"index":1,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]},"toolCallId":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","delta":"ty\": "}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[{"name":null,"args":"\"Tokyo","id":null,"error":null,"type":"invalid_tool_call"}],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"\"Tokyo","id":null,"index":1,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"TOOL_CALL_ARGS","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":null,"additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[{"name":null,"args":"\"Tokyo","id":null,"error":null,"type":"invalid_tool_call"}],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"\"Tokyo","id":null,"index":1,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]},"toolCallId":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","delta":"\"Tokyo"}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[{"name":null,"args":"\"}","id":null,"error":null,"type":"invalid_tool_call"}],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"\"}","id":null,"index":1,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"TOOL_CALL_ARGS","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":null,"additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[{"name":null,"args":"\"}","id":null,"error":null,"type":"invalid_tool_call"}],"usage_metadata":null,"tool_call_chunks":[{"name":null,"args":"\"}","id":null,"index":1,"type":"tool_call_chunk"}],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]},"toolCallId":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","delta":"\"}"}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"tool_calls","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":173,"output_tokens":47,"total_tokens":220,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":0}},"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":"last"}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_end","data":{"output":{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"tool_calls","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{"city":"Paris"},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"},{"name":"get_weather","args":{"city":"Tokyo"},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":173,"output_tokens":47,"total_tokens":220,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":0}}},"input":{"messages":[[{"content":"Built-in Bot instructions\nYou are a terse test Bot. Always use tools when offered, in parallel when they are independent.","additional_kwargs":{},"response_metadata":{},"type":"system","name":null,"id":null},{"content":"Get the weather in Paris and in Tokyo. Make both tool calls at once, in this one reply.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]]}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"TOOL_CALL_END","rawEvent":{"event":"on_chat_model_end","data":{"output":{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"tool_calls","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{"city":"Paris"},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"},{"name":"get_weather","args":{"city":"Tokyo"},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":173,"output_tokens":47,"total_tokens":220,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":0}}},"input":{"messages":[[{"content":"Built-in Bot instructions\nYou are a terse test Bot. Always use tools when offered, in parallel when they are independent.","additional_kwargs":{},"response_metadata":{},"type":"system","name":null,"id":null},{"content":"Get the weather in Paris and in Tokyo. Make both tool calls at once, in this one reply.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]]}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]},"toolCallId":"call_l5tzE2z7QUpRAjwp5Fw3VLwt"}
+
+data: {"type":"TOOL_CALL_END","rawEvent":{"event":"on_chat_model_end","data":{"output":{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"tool_calls","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{"city":"Paris"},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"},{"name":"get_weather","args":{"city":"Tokyo"},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":173,"output_tokens":47,"total_tokens":220,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":0}}},"input":{"messages":[[{"content":"Built-in Bot instructions\nYou are a terse test Bot. Always use tools when offered, in parallel when they are independent.","additional_kwargs":{},"response_metadata":{},"type":"system","name":null,"id":null},{"content":"Get the weather in Paris and in Tokyo. Make both tool calls at once, in this one reply.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]]}},"run_id":"01a1eb81-cf22-7150-b2e4-c8a068fb1678","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]},"toolCallId":"call_iC7Rh33OXzhWFkHSKMJCC3ZC"}
+
+data: {"type":"RAW","event":{"event":"on_chain_start","data":{"input":{"messages":[{"content":"Get the weather in Paris and in Tokyo. Make both tool calls at once, in this one reply.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"},{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"tool_calls","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{"city":"Paris"},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"},{"name":"get_weather","args":{"city":"Tokyo"},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":173,"output_tokens":47,"total_tokens":220,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":0}}}]}},"name":"next_step","tags":["seq:step:3"],"run_id":"01a1eb81-d284-706b-b5a7-68742287b6d4","metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7"},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"RAW","event":{"event":"on_chain_end","data":{"output":"__end__","input":{"messages":[{"content":"Get the weather in Paris and in Tokyo. Make both tool calls at once, in this one reply.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"},{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"tool_calls","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{"city":"Paris"},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"},{"name":"get_weather","args":{"city":"Tokyo"},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":173,"output_tokens":47,"total_tokens":220,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":0}}}]}},"run_id":"01a1eb81-d284-706b-b5a7-68742287b6d4","name":"next_step","tags":["seq:step:3"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7"},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475","01a1eb81-cf21-7090-b48f-957a6db25406"]}}
+
+data: {"type":"RAW","event":{"event":"on_chain_stream","run_id":"01a1eb81-cf21-7090-b48f-957a6db25406","name":"answer","tags":["graph:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7"},"data":{"chunk":{"messages":[{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"tool_calls","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{"city":"Paris"},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"},{"name":"get_weather","args":{"city":"Tokyo"},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":173,"output_tokens":47,"total_tokens":220,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":0}}}]}},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475"]}}
+
+data: {"type":"STATE_SNAPSHOT","rawEvent":{"event":"on_chain_end","data":{"output":{"messages":[{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"tool_calls","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{"city":"Paris"},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"},{"name":"get_weather","args":{"city":"Tokyo"},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":173,"output_tokens":47,"total_tokens":220,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":0}}}]},"input":{"messages":[{"content":"Get the weather in Paris and in Tokyo. Make both tool calls at once, in this one reply.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]}},"run_id":"01a1eb81-cf21-7090-b48f-957a6db25406","name":"answer","tags":["graph:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7"},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475"]},"snapshot":{"messages":[{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"tool_calls","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{"city":"Paris"},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"},{"name":"get_weather","args":{"city":"Tokyo"},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":173,"output_tokens":47,"total_tokens":220,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":0}}}],"tools":[{"name":"get_weather","description":"Current weather for a city.","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}]}}
+
+data: {"type":"RAW","event":{"event":"on_chain_end","data":{"output":{"messages":[{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"tool_calls","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{"city":"Paris"},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"},{"name":"get_weather","args":{"city":"Tokyo"},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":173,"output_tokens":47,"total_tokens":220,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":0}}}]},"input":{"messages":[{"content":"Get the weather in Paris and in Tokyo. Make both tool calls at once, in this one reply.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]}},"run_id":"01a1eb81-cf21-7090-b48f-957a6db25406","name":"answer","tags":["graph:step:1"],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:1c6e682f-8378-1966-cfdc-78e1e16ce6a7"},"parent_ids":["01a1eb81-cf20-7097-8fc7-1b05a2b12475"]}}
+
+data: {"type":"RAW","event":{"event":"on_chain_stream","run_id":"01a1eb81-cf20-7097-8fc7-1b05a2b12475","name":"LangGraph","tags":[],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langgraph"},"data":{"chunk":[[],{"answer":{"messages":[{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"tool_calls","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{"city":"Paris"},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"},{"name":"get_weather","args":{"city":"Tokyo"},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":173,"output_tokens":47,"total_tokens":220,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":0}}}]}}]},"parent_ids":[]}}
+
+data: {"type":"RAW","event":{"event":"on_chain_end","data":{"output":{"messages":[{"content":"Get the weather in Paris and in Tokyo. Make both tool calls at once, in this one reply.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"},{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"tool_calls","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{"city":"Paris"},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"},{"name":"get_weather","args":{"city":"Tokyo"},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":173,"output_tokens":47,"total_tokens":220,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":0}}}]}},"run_id":"01a1eb81-cf20-7097-8fc7-1b05a2b12475","name":"LangGraph","tags":[],"metadata":{"thread_id":"plan-capture-parallel","ls_integration":"langgraph"},"parent_ids":[]}}
+
+data: {"type":"STEP_FINISHED","stepName":"answer"}
+
+data: {"type":"STATE_SNAPSHOT","snapshot":{"messages":[{"content":"Get the weather in Paris and in Tokyo. Make both tool calls at once, in this one reply.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"},{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"tool_calls","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","tool_calls":[{"name":"get_weather","args":{"city":"Paris"},"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"tool_call"},{"name":"get_weather","args":{"city":"Tokyo"},"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"tool_call"}],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":173,"output_tokens":47,"total_tokens":220,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":0}}}]}}
+
+data: {"type":"MESSAGES_SNAPSHOT","messages":[{"id":"prompt-1","role":"user","content":"Get the weather in Paris and in Tokyo. Make both tool calls at once, in this one reply."},{"id":"lc_run--01a1eb81-cf22-7150-b2e4-c8a068fb1678","role":"assistant","content":"","toolCalls":[{"id":"call_l5tzE2z7QUpRAjwp5Fw3VLwt","type":"function","function":{"name":"get_weather","arguments":"{\"city\": \"Paris\"}"}},{"id":"call_iC7Rh33OXzhWFkHSKMJCC3ZC","type":"function","function":{"name":"get_weather","arguments":"{\"city\": \"Tokyo\"}"}}]}]}
+
+data: {"type":"RUN_FINISHED","threadId":"plan-capture-parallel","runId":"run-parallel","usage":[{"provider":"openai","model":"gpt-5.5","inputTokens":173,"outputTokens":47,"totalTokens":220,"reasoningTokens":0,"cachedInputTokens":0}]}
+
diff --git a/agent-langgraph-ts/test/fixtures/plan-harness/refused.sse b/agent-langgraph-ts/test/fixtures/plan-harness/refused.sse
new file mode 100644
index 0000000000..70f1048374
--- /dev/null
+++ b/agent-langgraph-ts/test/fixtures/plan-harness/refused.sse
@@ -0,0 +1,12 @@
+data: {"type":"RUN_STARTED","threadId":"plan-capture-tool","runId":"run-tool"}
+
+data: {"type":"RAW","event":{"event":"on_chain_start","data":{"input":{"openbot_model_only":true,"openbot_bot_id":"capture-bot","messages":[{"content":"What is the weather in Paris? Call the tool, do not answer from memory.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}],"tools":[{"name":"get_weather","description":"Current weather for a city.","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}]}},"name":"LangGraph","tags":[],"run_id":"01a1eb81-cdf7-730e-b878-7bf88f7e4098","metadata":{"thread_id":"plan-capture-tool","ls_integration":"langgraph"},"parent_ids":[]}}
+
+data: {"type":"STEP_STARTED","stepName":"answer"}
+
+data: {"type":"RAW","event":{"event":"on_chain_start","data":{"input":{"messages":[{"content":"What is the weather in Paris? Call the tool, do not answer from memory.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]}},"name":"answer","tags":["graph:step:1"],"run_id":"01a1eb81-cdf9-75ac-9607-b18b8e25c732","metadata":{"thread_id":"plan-capture-tool","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:3c9a7e39-88a7-50ba-77df-a00e0013e3e5"},"parent_ids":["01a1eb81-cdf7-730e-b878-7bf88f7e4098"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_start","data":{"input":{"messages":[[{"content":"Built-in Bot instructions\nYou are a terse test Bot. Always use tools when offered.","additional_kwargs":{},"response_metadata":{},"type":"system","name":null,"id":null},{"content":"What is the weather in Paris? Call the tool, do not answer from memory.","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]]}},"name":"ChatOpenAI","tags":["seq:step:1"],"run_id":"01a1eb81-cdfa-7106-b9e1-0bbe4cf6638d","metadata":{"thread_id":"plan-capture-tool","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:3c9a7e39-88a7-50ba-77df-a00e0013e3e5","checkpoint_ns":"answer:3c9a7e39-88a7-50ba-77df-a00e0013e3e5","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-cdf7-730e-b878-7bf88f7e4098","01a1eb81-cdf9-75ac-9607-b18b8e25c732"]}}
+
+data: {"type":"RUN_ERROR","message":"Error code: 400 - Function tools with reasoning_effort are not supported for gpt-5.5 in /v1/chat/completions. To use function tools, use /v1/responses or set reasoning_effort to 'none'.","code":"OPENBOT_MODEL_REFUSED"}
+
diff --git a/agent-langgraph-ts/test/fixtures/plan-harness/text.sse b/agent-langgraph-ts/test/fixtures/plan-harness/text.sse
new file mode 100644
index 0000000000..551614b66a
--- /dev/null
+++ b/agent-langgraph-ts/test/fixtures/plan-harness/text.sse
@@ -0,0 +1,66 @@
+data: {"type":"RUN_STARTED","threadId":"plan-capture-text","runId":"run-text"}
+
+data: {"type":"RAW","event":{"event":"on_chain_start","data":{"input":{"openbot_model_only":true,"openbot_bot_id":"capture-bot","messages":[{"content":"Reply with exactly: hello from the plan harness","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}],"tools":[]}},"name":"LangGraph","tags":[],"run_id":"01a1eb81-c600-70e6-9b14-1b4fd6f6f903","metadata":{"thread_id":"plan-capture-text","ls_integration":"langgraph"},"parent_ids":[]}}
+
+data: {"type":"STEP_STARTED","stepName":"answer"}
+
+data: {"type":"RAW","event":{"event":"on_chain_start","data":{"input":{"messages":[{"content":"Reply with exactly: hello from the plan harness","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]}},"name":"answer","tags":["graph:step:1"],"run_id":"01a1eb81-c603-754b-a513-3bafa451f222","metadata":{"thread_id":"plan-capture-text","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef"},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_start","data":{"input":{"messages":[[{"content":"Built-in Bot instructions\nYou are a terse test Bot.","additional_kwargs":{},"response_metadata":{},"type":"system","name":null,"id":null},{"content":"Reply with exactly: hello from the plan harness","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]]}},"name":"ChatOpenAI","tags":["seq:step:1"],"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"hello","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]}}
+
+data: {"type":"TEXT_MESSAGE_START","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":"hello","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]},"messageId":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","role":"assistant"}
+
+data: {"type":"TEXT_MESSAGE_CONTENT","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":"hello","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]},"messageId":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","delta":"hello"}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":" from","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]}}
+
+data: {"type":"TEXT_MESSAGE_CONTENT","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":" from","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]},"messageId":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","delta":" from"}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":" the","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]}}
+
+data: {"type":"TEXT_MESSAGE_CONTENT","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":" the","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]},"messageId":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","delta":" the"}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":" plan","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]}}
+
+data: {"type":"TEXT_MESSAGE_CONTENT","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":" plan","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]},"messageId":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","delta":" plan"}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":" harness","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]}}
+
+data: {"type":"TEXT_MESSAGE_CONTENT","rawEvent":{"event":"on_chat_model_stream","data":{"chunk":{"content":" harness","additional_kwargs":{},"response_metadata":{"model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]},"messageId":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","delta":" harness"}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{"finish_reason":"stop","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":31,"output_tokens":19,"total_tokens":50,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":5}},"tool_call_chunks":[],"chunk_position":null}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_stream","data":{"chunk":{"content":"","additional_kwargs":{},"response_metadata":{},"type":"AIMessageChunk","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":null,"tool_call_chunks":[],"chunk_position":"last"}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]}}
+
+data: {"type":"RAW","event":{"event":"on_chat_model_end","data":{"output":{"content":"hello from the plan harness","additional_kwargs":{},"response_metadata":{"finish_reason":"stop","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":31,"output_tokens":19,"total_tokens":50,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":5}}},"input":{"messages":[[{"content":"Built-in Bot instructions\nYou are a terse test Bot.","additional_kwargs":{},"response_metadata":{},"type":"system","name":null,"id":null},{"content":"Reply with exactly: hello from the plan harness","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]]}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]}}
+
+data: {"type":"TEXT_MESSAGE_END","rawEvent":{"event":"on_chat_model_end","data":{"output":{"content":"hello from the plan harness","additional_kwargs":{},"response_metadata":{"finish_reason":"stop","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":31,"output_tokens":19,"total_tokens":50,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":5}}},"input":{"messages":[[{"content":"Built-in Bot instructions\nYou are a terse test Bot.","additional_kwargs":{},"response_metadata":{},"type":"system","name":null,"id":null},{"content":"Reply with exactly: hello from the plan harness","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]]}},"run_id":"01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","name":"ChatOpenAI","tags":["seq:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langchain_chat_model","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef","ls_provider":"openai","ls_model_name":"gpt-5.5","ls_model_type":"chat","ls_temperature":null,"lc_versions":{"langchain-core":"1.8.1","langchain":"1.5.0","langchain-openai":"1.8.1"}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]},"messageId":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac"}
+
+data: {"type":"RAW","event":{"event":"on_chain_start","data":{"input":{"messages":[{"content":"Reply with exactly: hello from the plan harness","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"},{"content":"hello from the plan harness","additional_kwargs":{},"response_metadata":{"finish_reason":"stop","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":31,"output_tokens":19,"total_tokens":50,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":5}}}]}},"name":"next_step","tags":["seq:step:3"],"run_id":"01a1eb81-cd8e-7007-be47-81df00269f20","metadata":{"thread_id":"plan-capture-text","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef"},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]}}
+
+data: {"type":"RAW","event":{"event":"on_chain_end","data":{"output":"__end__","input":{"messages":[{"content":"Reply with exactly: hello from the plan harness","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"},{"content":"hello from the plan harness","additional_kwargs":{},"response_metadata":{"finish_reason":"stop","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":31,"output_tokens":19,"total_tokens":50,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":5}}}]}},"run_id":"01a1eb81-cd8e-7007-be47-81df00269f20","name":"next_step","tags":["seq:step:3"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef"},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903","01a1eb81-c603-754b-a513-3bafa451f222"]}}
+
+data: {"type":"RAW","event":{"event":"on_chain_stream","run_id":"01a1eb81-c603-754b-a513-3bafa451f222","name":"answer","tags":["graph:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef"},"data":{"chunk":{"messages":[{"content":"hello from the plan harness","additional_kwargs":{},"response_metadata":{"finish_reason":"stop","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":31,"output_tokens":19,"total_tokens":50,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":5}}}]}},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903"]}}
+
+data: {"type":"STATE_SNAPSHOT","rawEvent":{"event":"on_chain_end","data":{"output":{"messages":[{"content":"hello from the plan harness","additional_kwargs":{},"response_metadata":{"finish_reason":"stop","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":31,"output_tokens":19,"total_tokens":50,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":5}}}]},"input":{"messages":[{"content":"Reply with exactly: hello from the plan harness","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]}},"run_id":"01a1eb81-c603-754b-a513-3bafa451f222","name":"answer","tags":["graph:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef"},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903"]},"snapshot":{"messages":[{"content":"hello from the plan harness","additional_kwargs":{},"response_metadata":{"finish_reason":"stop","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":31,"output_tokens":19,"total_tokens":50,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":5}}}],"tools":[]}}
+
+data: {"type":"RAW","event":{"event":"on_chain_end","data":{"output":{"messages":[{"content":"hello from the plan harness","additional_kwargs":{},"response_metadata":{"finish_reason":"stop","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":31,"output_tokens":19,"total_tokens":50,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":5}}}]},"input":{"messages":[{"content":"Reply with exactly: hello from the plan harness","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"}]}},"run_id":"01a1eb81-c603-754b-a513-3bafa451f222","name":"answer","tags":["graph:step:1"],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langgraph","langgraph_step":1,"langgraph_node":"answer","langgraph_triggers":["branch:to:answer"],"langgraph_path":["__pregel_pull","answer"],"langgraph_checkpoint_ns":"answer:6d1eff94-92b8-34e0-a2e7-41aedfdf2eef"},"parent_ids":["01a1eb81-c600-70e6-9b14-1b4fd6f6f903"]}}
+
+data: {"type":"RAW","event":{"event":"on_chain_stream","run_id":"01a1eb81-c600-70e6-9b14-1b4fd6f6f903","name":"LangGraph","tags":[],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langgraph"},"data":{"chunk":[[],{"answer":{"messages":[{"content":"hello from the plan harness","additional_kwargs":{},"response_metadata":{"finish_reason":"stop","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":31,"output_tokens":19,"total_tokens":50,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":5}}}]}}]},"parent_ids":[]}}
+
+data: {"type":"RAW","event":{"event":"on_chain_end","data":{"output":{"messages":[{"content":"Reply with exactly: hello from the plan harness","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"},{"content":"hello from the plan harness","additional_kwargs":{},"response_metadata":{"finish_reason":"stop","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":31,"output_tokens":19,"total_tokens":50,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":5}}}]}},"run_id":"01a1eb81-c600-70e6-9b14-1b4fd6f6f903","name":"LangGraph","tags":[],"metadata":{"thread_id":"plan-capture-text","ls_integration":"langgraph"},"parent_ids":[]}}
+
+data: {"type":"STEP_FINISHED","stepName":"answer"}
+
+data: {"type":"STATE_SNAPSHOT","snapshot":{"messages":[{"content":"Reply with exactly: hello from the plan harness","additional_kwargs":{},"response_metadata":{},"type":"human","name":null,"id":"prompt-1"},{"content":"hello from the plan harness","additional_kwargs":{},"response_metadata":{"finish_reason":"stop","model_name":"gpt-5.5-2026-04-23","service_tier":"default","model_provider":"openai"},"type":"ai","name":null,"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","tool_calls":[],"invalid_tool_calls":[],"usage_metadata":{"input_tokens":31,"output_tokens":19,"total_tokens":50,"input_token_details":{"audio":0,"cache_read":0},"output_token_details":{"audio":0,"reasoning":5}}}]}}
+
+data: {"type":"MESSAGES_SNAPSHOT","messages":[{"id":"prompt-1","role":"user","content":"Reply with exactly: hello from the plan harness"},{"id":"lc_run--01a1eb81-c9e2-7355-aedb-fbf83d0a9eac","role":"assistant","content":"hello from the plan harness"}]}
+
+data: {"type":"RUN_FINISHED","threadId":"plan-capture-text","runId":"run-text","usage":[{"provider":"openai","model":"gpt-5.5","inputTokens":31,"outputTokens":19,"totalTokens":50,"reasoningTokens":5,"cachedInputTokens":0}]}
+
diff --git a/agent-langgraph-ts/test/graph.test.ts b/agent-langgraph-ts/test/graph.test.ts
new file mode 100644
index 0000000000..ced2c46c43
--- /dev/null
+++ b/agent-langgraph-ts/test/graph.test.ts
@@ -0,0 +1,502 @@
+/**
+ * The run's shape: the step budget and its last-step answer, the server's tools run here through
+ * the signed callback, the surface's tools handed back and resumed, and parallel calls streamed
+ * under their own ids. Driven through the real AG-UI endpoint against a provider that speaks
+ * OpenAI's real streaming format.
+ */
+import assert from "node:assert/strict";
+import { createServer } from "node:http";
+import type { AddressInfo } from "node:net";
+import { test } from "node:test";
+import { LAST_STEP_NOTICE } from "../../shared/run-notices.ts";
+import { MAX_STEPS } from "../src/run.ts";
+import { fakeProvider, type Recorded } from "./fake-provider.ts";
+import {
+ conversation,
+ type Event,
+ run,
+ types,
+ WEATHER_TOOL,
+ withEngine,
+} from "./helpers.ts";
+
+type Callback = {
+ url: string;
+ calls: { name: string; args: unknown; run: unknown; token: unknown }[];
+ close: () => Promise;
+};
+
+/** The server's `/api/agent-tools/call`, answering every call it is sent. */
+async function toolCallback(
+ answer = (name: string) => `result of ${name}`,
+ delay = (_name: string) => 0,
+): Promise {
+ const calls: Callback["calls"] = [];
+ const server = createServer(async (request, response) => {
+ const chunks: Buffer[] = [];
+ for await (const chunk of request) chunks.push(chunk as Buffer);
+ const body = JSON.parse(Buffer.concat(chunks).toString("utf8"));
+ calls.push({
+ name: body.name,
+ args: body.args,
+ run: body.run,
+ token: request.headers["x-openbot-agent-token"],
+ });
+ await new Promise((resolve) => setTimeout(resolve, delay(body.name)));
+ response.writeHead(200, { "content-type": "application/json" });
+ response.end(JSON.stringify({ text: answer(body.name) }));
+ });
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
+ const { port } = server.address() as AddressInfo;
+ return {
+ url: `http://127.0.0.1:${port}/api/agent-tools/call`,
+ calls,
+ close: () => new Promise((resolve) => server.close(() => resolve())),
+ };
+}
+
+const LOOKUP = {
+ name: "lookup",
+ description: "Look something up.",
+ parameters: { type: "object", properties: { q: { type: "string" } } },
+};
+
+function lastMessage(request: Recorded): { role: string; content: unknown } {
+ return (request.body.messages as { role: string; content: unknown }[]).at(
+ -1,
+ )!;
+}
+
+test(`A run takes at most ${MAX_STEPS} steps, and the last one answers in words with tools off`, async () => {
+ const provider = await fakeProvider((request, index) =>
+ request.body.tool_choice === "none"
+ ? { text: "Here is what I found so far, and what I did not get to." }
+ : {
+ calls: [
+ {
+ id: `call_${index}`,
+ name: "lookup",
+ args: { q: `page ${index}` },
+ },
+ ],
+ },
+ );
+ const callback = await toolCallback();
+ try {
+ const env = {
+ BOT_PROVIDER: "openai",
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `${provider.base}/v1`,
+ AGENT_TOOL_TOKEN: "tool-token",
+ OPENBOT_TOOL_URL: callback.url,
+ };
+ const result = await withEngine({ env }, (base) =>
+ run(
+ base,
+ conversation({
+ tools: [LOOKUP],
+ forwardedProps: {
+ openbotDeploymentTools: ["lookup"],
+ openbotRun: "signed-run-statement",
+ // On Chat Completions, whose request this test reads.
+ openbotModel: { model: "gpt-5.2" },
+ },
+ }),
+ ),
+ );
+ assert.equal(
+ provider.requests.length,
+ MAX_STEPS,
+ "one model call per step, and no more",
+ );
+ for (const request of provider.requests.slice(0, -1))
+ assert.notEqual(request.body.tool_choice, "none");
+ const last = provider.requests.at(-1)!;
+ assert.equal(
+ last.body.tool_choice,
+ "none",
+ "tools are off on the last step",
+ );
+ assert.ok(
+ (last.body.tools as unknown[]).length > 0,
+ "the tools are still described, so the history reads",
+ );
+ assert.deepEqual(lastMessage(last), {
+ role: "user",
+ content: LAST_STEP_NOTICE,
+ });
+
+ assert.equal(callback.calls.length, MAX_STEPS - 1);
+ assert.ok(
+ callback.calls.every(
+ (call) =>
+ call.token === "tool-token" && call.run === "signed-run-statement",
+ ),
+ );
+ const kinds = types(result.events);
+ assert.equal(
+ kinds.filter((type) => type === "TOOL_CALL_RESULT").length,
+ MAX_STEPS - 1,
+ );
+ assert.equal(kinds.at(-1), "RUN_FINISHED");
+ const words = result.events
+ .filter((event) => event.type === "TEXT_MESSAGE_CONTENT")
+ .map((event) => event.delta)
+ .join("");
+ assert.equal(
+ words,
+ "Here is what I found so far, and what I did not get to.",
+ );
+ // The notice was this call's only: it is not in the thread the run hands back.
+ const snapshot = result.events.find(
+ (event) => event.type === "MESSAGES_SNAPSHOT",
+ )!;
+ assert.ok(!JSON.stringify(snapshot).includes(LAST_STEP_NOTICE));
+ } finally {
+ await provider.close();
+ await callback.close();
+ }
+});
+
+test("A surface tool ends the run on its call, and the next run carries on from its result", async () => {
+ const provider = await fakeProvider((request) =>
+ JSON.stringify(request.body.messages).includes("drawn by the browser")
+ ? { text: "The chart is up." }
+ : {
+ calls: [
+ { id: "call_ui", name: "render_ui", args: { component: "chart" } },
+ ],
+ },
+ );
+ const callback = await toolCallback();
+ const renderUi = {
+ name: "render_ui",
+ description: "Draw a component.",
+ parameters: {
+ type: "object",
+ properties: { component: { type: "string" } },
+ },
+ };
+ try {
+ const env = {
+ BOT_PROVIDER: "openai",
+ // On Chat Completions, whose request this test reads.
+ BOT_MODEL: "gpt-5.2",
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `${provider.base}/v1`,
+ AGENT_TOOL_TOKEN: "t",
+ OPENBOT_TOOL_URL: callback.url,
+ };
+ await withEngine({ env }, async (base) => {
+ const first = await run(
+ base,
+ conversation({
+ tools: [renderUi],
+ forwardedProps: { openbotDeploymentTools: [], openbotRun: "s" },
+ }),
+ );
+ assert.equal(provider.requests.length, 1);
+ assert.equal(
+ callback.calls.length,
+ 0,
+ "the surface's tool is never run here",
+ );
+ const start = first.events.find(
+ (event) => event.type === "TOOL_CALL_START",
+ )!;
+ assert.equal(start.toolCallName, "render_ui");
+ assert.equal(start.toolCallId, "call_ui");
+ assert.equal(first.events.at(-1)!.type, "RUN_FINISHED");
+
+ const thread = [
+ ...(conversation().messages as unknown[]),
+ {
+ id: "a2",
+ role: "assistant",
+ content: "",
+ toolCalls: [
+ {
+ id: "call_ui",
+ type: "function",
+ function: {
+ name: "render_ui",
+ arguments: '{"component":"chart"}',
+ },
+ },
+ ],
+ },
+ {
+ id: "t2",
+ role: "tool",
+ toolCallId: "call_ui",
+ content: "drawn by the browser",
+ },
+ ];
+ const second = await run(
+ base,
+ conversation({ messages: thread, tools: [renderUi], runId: "run-2" }),
+ );
+ assert.equal(second.events.at(-1)!.type, "RUN_FINISHED");
+ assert.equal(
+ second.events
+ .filter((event) => event.type === "TEXT_MESSAGE_CONTENT")
+ .map((event) => event.delta)
+ .join(""),
+ "The chart is up.",
+ );
+ });
+ const sent = provider.requests[1]!.body.messages as {
+ role: string;
+ tool_call_id?: string;
+ tool_calls?: { id: string }[];
+ }[];
+ assert.ok(
+ sent.some(
+ (message) =>
+ message.role === "assistant" &&
+ message.tool_calls?.[0]?.id === "call_ui",
+ ),
+ );
+ assert.ok(
+ sent.some(
+ (message) =>
+ message.role === "tool" && message.tool_call_id === "call_ui",
+ ),
+ );
+ } finally {
+ await provider.close();
+ await callback.close();
+ }
+});
+
+test("Parallel calls stream under their own ids, their arguments never mixed", async () => {
+ const provider = await fakeProvider(() => ({
+ calls: [
+ {
+ id: "call_paris",
+ name: "get_weather",
+ args: { city: "Paris, France" },
+ },
+ { id: "call_tokyo", name: "get_weather", args: { city: "Tokyo, Japan" } },
+ ],
+ }));
+ try {
+ const env = {
+ BOT_PROVIDER: "openai",
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `${provider.base}/v1`,
+ };
+ const result = await withEngine({ env }, (base) =>
+ run(base, conversation({ tools: [WEATHER_TOOL] })),
+ );
+ const starts = result.events.filter(
+ (event) => event.type === "TOOL_CALL_START",
+ );
+ assert.deepEqual(
+ starts.map((event) => event.toolCallId),
+ ["call_paris", "call_tokyo"],
+ );
+ assert.equal(new Set(starts.map((event) => event.parentMessageId)).size, 1);
+ const args = (id: string) =>
+ result.events
+ .filter(
+ (event: Event) =>
+ event.type === "TOOL_CALL_ARGS" && event.toolCallId === id,
+ )
+ .map((event) => event.delta)
+ .join("");
+ assert.deepEqual(JSON.parse(args("call_paris")), { city: "Paris, France" });
+ assert.deepEqual(JSON.parse(args("call_tokyo")), { city: "Tokyo, Japan" });
+ assert.deepEqual(
+ result.events
+ .filter((event) => event.type === "TOOL_CALL_END")
+ .map((event) => event.toolCallId)
+ .sort(),
+ ["call_paris", "call_tokyo"],
+ );
+ assert.equal(result.events.at(-1)!.type, "RUN_FINISHED");
+ } finally {
+ await provider.close();
+ }
+});
+
+test("A step mixing a server tool with a surface tool goes back to the surface without running either", async () => {
+ const provider = await fakeProvider(() => ({
+ calls: [
+ { id: "call_send", name: "send_message", args: { to: "x" } },
+ { id: "call_ui", name: "render_ui", args: {} },
+ ],
+ }));
+ const callback = await toolCallback();
+ try {
+ const env = {
+ BOT_PROVIDER: "openai",
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `${provider.base}/v1`,
+ AGENT_TOOL_TOKEN: "t",
+ OPENBOT_TOOL_URL: callback.url,
+ };
+ const tools = [
+ {
+ name: "send_message",
+ description: "Send.",
+ parameters: { type: "object", properties: {} },
+ },
+ {
+ name: "render_ui",
+ description: "Draw.",
+ parameters: { type: "object", properties: {} },
+ },
+ ];
+ const result = await withEngine({ env }, (base) =>
+ run(
+ base,
+ conversation({
+ tools,
+ forwardedProps: {
+ openbotDeploymentTools: ["send_message"],
+ openbotRun: "s",
+ },
+ }),
+ ),
+ );
+ assert.equal(callback.calls.length, 0);
+ assert.equal(provider.requests.length, 1);
+ assert.equal(result.events.at(-1)!.type, "RUN_FINISHED");
+ } finally {
+ await provider.close();
+ await callback.close();
+ }
+});
+
+test("A Bot's computer calls run one after another, in the order the model made them", async () => {
+ const provider = await fakeProvider((_request, index) =>
+ index === 0
+ ? {
+ calls: [
+ { id: "c1", name: "computer_type", args: { text: "slow" } },
+ { id: "c2", name: "computer_click", args: { at: "save" } },
+ ],
+ }
+ : { text: "Saved." },
+ );
+ const callback = await toolCallback(
+ (name) => `${name} done`,
+ (name) => (name === "computer_type" ? 80 : 0),
+ );
+ try {
+ const env = {
+ BOT_PROVIDER: "openai",
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `${provider.base}/v1`,
+ AGENT_TOOL_TOKEN: "t",
+ OPENBOT_TOOL_URL: callback.url,
+ };
+ const tools = ["computer_type", "computer_click"].map((name) => ({
+ name,
+ description: name,
+ parameters: { type: "object", properties: {} },
+ }));
+ const result = await withEngine({ env }, (base) =>
+ run(
+ base,
+ conversation({
+ tools,
+ forwardedProps: {
+ openbotDeploymentTools: ["computer_type", "computer_click"],
+ openbotRun: "s",
+ },
+ }),
+ ),
+ );
+ assert.deepEqual(
+ callback.calls.map((call) => call.name),
+ ["computer_type", "computer_click"],
+ );
+ const results = result.events.filter(
+ (event) => event.type === "TOOL_CALL_RESULT",
+ );
+ assert.deepEqual(
+ results.map((event) => [event.toolCallId, event.content]),
+ [
+ ["c1", "computer_type done"],
+ ["c2", "computer_click done"],
+ ],
+ );
+ assert.equal(result.events.at(-1)!.type, "RUN_FINISHED");
+ } finally {
+ await provider.close();
+ await callback.close();
+ }
+});
+
+// FOUND ON THE REAL GEMINI API: @langchain/google streams a call whole, in `tool_calls`, with no
+// `tool_call_chunks`, so a run that read only the chunks saw no call and finished with nothing said.
+for (const [gemini, id] of [
+ ["Gemini 3, which names its calls", "call_10067008614775455048"],
+ ["Gemini 2.5, which does not", ""],
+] as const) {
+ test(`${gemini}: a call streamed whole is run, and its thought signature goes back with it`, async () => {
+ const provider = await fakeProvider((request) =>
+ JSON.stringify(request.body.contents).includes("Reading id W-1")
+ ? { text: "Paris: 17 C (W-1)." }
+ : {
+ calls: [
+ {
+ id,
+ name: "get_weather",
+ args: { city: "Paris" },
+ signature: "SIGNATURE_MARKER",
+ },
+ ],
+ },
+ );
+ const callback = await toolCallback(() => "Paris: 17 C. Reading id W-1.");
+ try {
+ const env = {
+ BOT_PROVIDER: "google",
+ GOOGLE_API_KEY: "AIza-test",
+ GOOGLE_GENERATIVE_AI_BASE_URL: `${provider.base}/v1beta`,
+ AGENT_TOOL_TOKEN: "t",
+ OPENBOT_TOOL_URL: callback.url,
+ };
+ const result = await withEngine({ env }, (base) =>
+ run(
+ base,
+ conversation({
+ tools: [WEATHER_TOOL],
+ forwardedProps: {
+ openbotDeploymentTools: ["get_weather"],
+ openbotRun: "s",
+ openbotModel: { model: "gemini-3.6-flash" },
+ },
+ }),
+ ),
+ );
+ const start = result.events.find(
+ (event) => event.type === "TOOL_CALL_START",
+ );
+ assert.equal(start?.toolCallName, "get_weather");
+ if (id) assert.equal(start?.toolCallId, id);
+ assert.deepEqual(
+ callback.calls.map((call) => call.args),
+ [{ city: "Paris" }],
+ );
+ assert.equal(provider.requests.length, 2);
+ const followUp = JSON.stringify(provider.requests[1]?.body.contents);
+ assert.ok(
+ followUp.includes("SIGNATURE_MARKER"),
+ "the thought signature goes back with the call",
+ );
+ assert.ok(followUp.includes("functionResponse"));
+ const words = result.events
+ .filter((event) => event.type === "TEXT_MESSAGE_CONTENT")
+ .map((event) => event.delta)
+ .join("");
+ assert.equal(words, "Paris: 17 C (W-1).");
+ } finally {
+ await provider.close();
+ await callback.close();
+ }
+ });
+}
diff --git a/agent-langgraph-ts/test/helpers.ts b/agent-langgraph-ts/test/helpers.ts
new file mode 100644
index 0000000000..d414c40020
--- /dev/null
+++ b/agent-langgraph-ts/test/helpers.ts
@@ -0,0 +1,110 @@
+/** Drive the engine as the server does: a real HTTP AG-UI run against `createEngine`. */
+import type { AddressInfo } from "node:net";
+import { createEngine, type ServerOptions } from "../src/server.ts";
+
+export const TOKEN = "engine-test-token";
+
+export type Event = Record & { type: string };
+
+export function events(sse: string): Event[] {
+ return sse
+ .split("\n")
+ .filter((line) => line.startsWith("data:"))
+ .map((line) => JSON.parse(line.slice(5).trim()) as Event);
+}
+
+export async function withEngine(
+ options: ServerOptions,
+ body: (base: string) => Promise,
+): Promise {
+ const env = { MANAGED_AGENT_TOKEN: TOKEN, ...(options.env ?? {}) };
+ const server = createEngine({
+ ...options,
+ env,
+ log: options.log ?? { warn: () => {}, error: () => {} },
+ });
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
+ const { port } = server.address() as AddressInfo;
+ try {
+ return await body(`http://127.0.0.1:${port}`);
+ } finally {
+ server.closeAllConnections();
+ await new Promise((resolve) => server.close(() => resolve()));
+ }
+}
+
+export async function run(
+ base: string,
+ input: Record,
+ token = TOKEN,
+): Promise<{ status: number; events: Event[] }> {
+ const response = await fetch(`${base}/`, {
+ method: "POST",
+ headers: {
+ "content-type": "application/json",
+ accept: "text/event-stream",
+ "x-openbot-agent-token": token,
+ },
+ body: JSON.stringify(input),
+ });
+ const text = await response.text();
+ return { status: response.status, events: response.ok ? events(text) : [] };
+}
+
+/** A run in the shape the server sends: role, holdings, then the restored thread. */
+export function conversation(
+ overrides: Record = {},
+): Record {
+ return {
+ threadId: "thread-1",
+ runId: "run-1",
+ state: {},
+ messages: [
+ {
+ id: "standing-role:test-bot",
+ role: "system",
+ content: "You are Test Bot. STANDING_ROLE_MARKER",
+ },
+ {
+ id: "granted-tools:test-bot",
+ role: "system",
+ content: "You hold these tools: GRANTED_TOOLS_MARKER",
+ },
+ {
+ id: "u1",
+ role: "user",
+ content: "Earlier question EARLIER_QUESTION_MARKER",
+ },
+ {
+ id: "a1",
+ role: "assistant",
+ content: "Earlier answer EARLIER_ANSWER_MARKER",
+ },
+ {
+ id: "u2",
+ role: "user",
+ content: "Latest question LATEST_QUESTION_MARKER",
+ },
+ ],
+ tools: [],
+ context: [],
+ forwardedProps: {},
+ ...overrides,
+ };
+}
+
+export const WEATHER_TOOL = {
+ name: "get_weather",
+ description: "Current weather for a city.",
+ parameters: {
+ type: "object",
+ properties: { city: { type: "string" } },
+ required: ["city"],
+ },
+};
+
+export function types(list: Event[]): string[] {
+ return list.map((event) => event.type);
+}
+
+export const quietLog = { warn: () => {}, error: () => {} };
diff --git a/agent-langgraph-ts/test/history.test.ts b/agent-langgraph-ts/test/history.test.ts
new file mode 100644
index 0000000000..a443609525
--- /dev/null
+++ b/agent-langgraph-ts/test/history.test.ts
@@ -0,0 +1,205 @@
+/**
+ * The thread as the model is shown it: no dangling tool call ever reaches a provider, the built-in
+ * Bot's full prompt is the system prompt, and only the server's own rows carry its authority.
+ */
+import assert from "node:assert/strict";
+import { test } from "node:test";
+import type { Message } from "@ag-ui/core";
+import { sanitizeHistory } from "../src/history.ts";
+import { always, fakeProvider } from "./fake-provider.ts";
+import { conversation, run, withEngine } from "./helpers.ts";
+
+const call = (id: string, name = "search") => ({
+ id,
+ type: "function" as const,
+ function: { name, arguments: "{}" },
+});
+
+// The shapes found in production (toolkit/src/history-sanitize.ts): a chat turn interrupted
+// mid-call left the call with no result, and every later turn was refused for it.
+const interrupted = [
+ { id: "u1", role: "user", content: "find the invoice" },
+ {
+ id: "a1",
+ role: "assistant",
+ content: "",
+ toolCalls: [call("call_TTbiXzJVNifQt8ioU1JJmj4S")],
+ },
+ { id: "u2", role: "user", content: "hello?" },
+] as Message[];
+
+test("A call with no result is dropped, and the empty husk with it", () => {
+ assert.deepEqual(
+ sanitizeHistory(interrupted).map((message) => message.id),
+ ["u1", "u2"],
+ );
+});
+
+test("A message that said something keeps its words when its unanswerable call goes", () => {
+ const thread = [
+ { id: "u1", role: "user", content: "q" },
+ {
+ id: "a1",
+ role: "assistant",
+ content: "Looking now.",
+ toolCalls: [call("c1"), call("c2")],
+ },
+ { id: "t1", role: "tool", toolCallId: "c1", content: "found" },
+ { id: "u2", role: "user", content: "next" },
+ ] as Message[];
+ const kept = sanitizeHistory(thread);
+ assert.deepEqual(
+ kept.map((message) => message.id),
+ ["u1", "a1", "t1", "u2"],
+ );
+ assert.deepEqual(
+ (kept[1] as { toolCalls?: { id: string }[] }).toolCalls?.map((c) => c.id),
+ ["c1"],
+ );
+});
+
+test("A result after the next user message, a result ahead of its call, and a second answer all go", () => {
+ const thread = [
+ { id: "t0", role: "tool", toolCallId: "c1", content: "early" },
+ {
+ id: "a1",
+ role: "assistant",
+ content: "",
+ toolCalls: [call("c1"), call("c2")],
+ },
+ { id: "t1", role: "tool", toolCallId: "c1", content: "answer" },
+ { id: "t1b", role: "tool", toolCallId: "c1", content: "again" },
+ { id: "u2", role: "user", content: "next" },
+ { id: "t2", role: "tool", toolCallId: "c2", content: "too late" },
+ { id: "t3", role: "tool", toolCallId: "nobody", content: "orphan" },
+ ] as Message[];
+ assert.deepEqual(
+ sanitizeHistory(thread).map((message) => message.id),
+ ["a1", "t1", "u2"],
+ );
+});
+
+test("A healthy thread goes through untouched, as the same objects", () => {
+ const thread = conversation().messages as Message[];
+ const kept = sanitizeHistory(thread);
+ assert.equal(kept.length, thread.length);
+ for (const [index, message] of kept.entries())
+ assert.equal(message, thread[index]);
+});
+
+test("No dangling call reaches the provider, whatever the thread held", async () => {
+ const provider = await fakeProvider(always({ text: "ok" }));
+ try {
+ const env = {
+ BOT_PROVIDER: "anthropic",
+ ANTHROPIC_API_KEY: "sk-ant-test",
+ ANTHROPIC_BASE_URL: provider.base,
+ };
+ const result = await withEngine({ env }, (base) =>
+ run(
+ base,
+ conversation({
+ messages: [
+ ...(conversation().messages as unknown[]).slice(0, 2),
+ ...interrupted,
+ ],
+ }),
+ ),
+ );
+ assert.equal(result.events.at(-1)!.type, "RUN_FINISHED");
+ const sent = JSON.stringify(provider.requests[0]!.body.messages);
+ assert.ok(!sent.includes("call_TTbiXzJVNifQt8ioU1JJmj4S"));
+ assert.ok(!sent.includes("tool_use"));
+ } finally {
+ await provider.close();
+ }
+});
+
+test("The built-in Bot's full prompt is the system prompt, in place of the standing role", async () => {
+ const provider = await fakeProvider(always({ text: "ok" }));
+ try {
+ const env = {
+ BOT_PROVIDER: "anthropic",
+ ANTHROPIC_API_KEY: "sk-ant-test",
+ ANTHROPIC_BASE_URL: provider.base,
+ };
+ const fullPrompt =
+ "\nYou are Test Bot. FULL_PROMPT_MARKER\n\n\n\nUse what you already have first.\n";
+ const input = conversation({
+ forwardedProps: { openbotSystemPrompt: fullPrompt },
+ context: [
+ { description: "The page the person is on", value: "CONTEXT_MARKER" },
+ ],
+ });
+ // A skill picked for the latest message, as the browser inserts it.
+ (input.messages as unknown[]).splice(4, 0, {
+ id: "skill-1",
+ role: "system",
+ content: "Answer in bullets. SKILL_MARKER",
+ });
+ await withEngine({ env }, (base) => run(base, input));
+ const { body } = provider.requests[0]!;
+ const system = JSON.stringify(body.system);
+ assert.ok(
+ system.includes("FULL_PROMPT_MARKER"),
+ "the full prompt is the system prompt",
+ );
+ assert.ok(
+ system.indexOf("FULL_PROMPT_MARKER") <
+ system.indexOf("GRANTED_TOOLS_MARKER"),
+ "and comes first",
+ );
+ assert.ok(
+ !JSON.stringify(body).includes("STANDING_ROLE_MARKER"),
+ "the standing role it supersedes is not sent too",
+ );
+ assert.ok(
+ system.includes("GRANTED_TOOLS_MARKER") &&
+ system.includes("CONTEXT_MARKER"),
+ );
+ assert.ok(
+ !system.includes("SKILL_MARKER"),
+ "a picked skill is conversation, not the system prompt",
+ );
+ const messages = JSON.stringify(body.messages);
+ assert.ok(
+ messages.includes("SKILL_MARKER") &&
+ messages.includes("LATEST_QUESTION_MARKER") &&
+ messages.includes("EARLIER_ANSWER_MARKER"),
+ );
+ } finally {
+ await provider.close();
+ }
+});
+
+test("Without a full prompt, the standing role and holdings are the system prompt, as on the Python harness", async () => {
+ const provider = await fakeProvider(always({ text: "ok" }));
+ try {
+ const env = {
+ BOT_PROVIDER: "openai",
+ // On Chat Completions, whose request this test reads.
+ BOT_MODEL: "gpt-5.2",
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `${provider.base}/v1`,
+ };
+ await withEngine({ env }, (base) => run(base, conversation()));
+ const messages = provider.requests[0]!.body.messages as {
+ role: string;
+ content: string;
+ }[];
+ assert.equal(
+ messages[0]!.role === "system" || messages[0]!.role === "developer",
+ true,
+ );
+ assert.ok(
+ messages[0]!.content.includes("STANDING_ROLE_MARKER") &&
+ messages[0]!.content.includes("GRANTED_TOOLS_MARKER"),
+ );
+ assert.deepEqual(
+ messages.slice(1).map((message) => message.role),
+ ["user", "assistant", "user"],
+ );
+ } finally {
+ await provider.close();
+ }
+});
diff --git a/agent-langgraph-ts/test/model-gateway.ts b/agent-langgraph-ts/test/model-gateway.ts
new file mode 100644
index 0000000000..55eaacb59d
--- /dev/null
+++ b/agent-langgraph-ts/test/model-gateway.ts
@@ -0,0 +1,237 @@
+/**
+ * The server's model gateway as the live AI connection contract defines it, on 127.0.0.1.
+ *
+ * - OpenAI wire: `POST /api/model-provider/v1/chat/completions`, `POST .../v1/responses`,
+ * `GET .../v1/models`. Anthropic wire: `POST /api/model-provider/anthropic/v1/messages`,
+ * `GET .../anthropic/v1/models`. Anything else is 404.
+ * - Auth: `Authorization: Bearer ` or `x-api-key: `, `` one of the run tokens it minted.
+ * - Per request: the connection as it stands now, the caller's auth headers stripped, the
+ * connection's key added, sent to the connection's upstream (never one the request names) with
+ * `redirect: "error"`, and the answer streamed back as it came.
+ * - A wire the connection can't serve: 409 with a plain sentence, in that wire's error shape, and
+ * `x-should-retry: false` so neither SDK asks again.
+ *
+ * The upstream is the fake provider by default. With `OPENBOT_LIVE_PROVIDERS=1` and the provider
+ * keys in this test process's environment, it is the real provider: the engine still holds only
+ * the run token, exactly as it does behind the real gateway.
+ */
+import { createServer, type IncomingHttpHeaders, type Server } from "node:http";
+import type { AddressInfo } from "node:net";
+import { Readable } from "node:stream";
+
+export type Provider = "openai" | "anthropic";
+export type Upstream = { base: string; key: string };
+
+export type GatewayRequest = {
+ method: string;
+ path: string;
+ /** The wire the request was sent on. */
+ wire: Provider;
+ /** The connection that served it, or undefined when it was refused. */
+ served?: Provider;
+ /** How the caller authenticated: which header carried which token. */
+ auth?: { header: "authorization" | "x-api-key"; token: string };
+ status: number;
+ /** What the upstream was sent, with the key standing in as "". */
+ upstream?: { url: string; headers: Record };
+ body: Record;
+};
+
+export type Gateway = {
+ /** `OPENBOT_MODEL_GATEWAY_URL` for an engine: the gateway's root. */
+ url: string;
+ requests: GatewayRequest[];
+ /** Switch the organization's connection, as replaceAiConnection does. */
+ connect: (provider: Provider) => void;
+ /** Mint a run token the gateway accepts. */
+ mint: (token: string) => void;
+ close: () => Promise;
+};
+
+const ROOT = "/api/model-provider";
+const ROUTES: Record = {
+ "/v1/chat/completions": { method: "POST", wire: "openai" },
+ "/v1/responses": { method: "POST", wire: "openai" },
+ "/v1/models": { method: "GET", wire: "openai" },
+ "/anthropic/v1/messages": { method: "POST", wire: "anthropic" },
+ "/anthropic/v1/models": { method: "GET", wire: "anthropic" },
+};
+
+/** Never forwarded: the caller's credentials and the hop's own headers. */
+const DROPPED = new Set([
+ "authorization",
+ "x-api-key",
+ "host",
+ "connection",
+ "content-length",
+ "accept-encoding",
+ "keep-alive",
+ "transfer-encoding",
+]);
+
+export const MISMATCH = {
+ openai:
+ "This OpenBot is connected to Anthropic, so it can't answer on OpenAI's API.",
+ anthropic:
+ "This OpenBot is connected to an OpenAI-compatible provider, so it can't answer on Anthropic's API.",
+};
+
+function errorBody(wire: Provider, message: string, type: string) {
+ return wire === "anthropic"
+ ? { type: "error", error: { type, message } }
+ : { error: { message, type, code: null, param: null } };
+}
+
+function offeredToken(
+ headers: IncomingHttpHeaders,
+): GatewayRequest["auth"] | undefined {
+ const bearer = /^Bearer\s+(.+)$/i.exec(String(headers.authorization ?? ""));
+ if (bearer?.[1]) return { header: "authorization", token: bearer[1].trim() };
+ const key = String(headers["x-api-key"] ?? "").trim();
+ if (key) return { header: "x-api-key", token: key };
+ return undefined;
+}
+
+export async function modelGateway(
+ upstreams: Record,
+ first: Provider,
+): Promise {
+ let connection: Provider = first;
+ const tokens = new Set();
+ const requests: GatewayRequest[] = [];
+
+ const server: Server = createServer(async (request, response) => {
+ const chunks: Buffer[] = [];
+ for await (const chunk of request) chunks.push(chunk as Buffer);
+ const raw = Buffer.concat(chunks);
+ const path = new URL(request.url ?? "/", "http://gateway").pathname;
+ const route = path.startsWith(ROOT)
+ ? ROUTES[path.slice(ROOT.length)]
+ : undefined;
+ const method = request.method ?? "GET";
+ const recorded: GatewayRequest = {
+ method,
+ path,
+ wire: route?.wire ?? "openai",
+ status: 0,
+ body: raw.length ? JSON.parse(raw.toString("utf8")) : {},
+ };
+ requests.push(recorded);
+ const answer = (status: number, body: unknown) => {
+ recorded.status = status;
+ response.writeHead(status, {
+ "content-type": "application/json",
+ ...(status === 409 ? { "x-should-retry": "false" } : {}),
+ });
+ response.end(JSON.stringify(body));
+ };
+ if (!route || route.method !== method)
+ return answer(
+ 404,
+ errorBody("openai", "Not a model gateway route.", "not_found_error"),
+ );
+ const auth = offeredToken(request.headers);
+ if (!auth || !tokens.has(auth.token))
+ return answer(
+ 401,
+ errorBody(
+ route.wire,
+ "OpenBot's model gateway didn't accept this run's token.",
+ "authentication_error",
+ ),
+ );
+ recorded.auth = auth;
+ // The connection as it stands for this request: a switch applies to the next one.
+ const now = connection;
+ if (route.wire !== now)
+ return answer(
+ 409,
+ errorBody(route.wire, MISMATCH[route.wire], "invalid_request_error"),
+ );
+ recorded.served = now;
+ const upstream = upstreams[now];
+ const headers: Record = {};
+ for (const [name, value] of Object.entries(request.headers)) {
+ if (DROPPED.has(name) || value === undefined) continue;
+ headers[name] = Array.isArray(value) ? value.join(", ") : value;
+ }
+ headers["accept-encoding"] = "identity";
+ const shown = { ...headers };
+ if (now === "anthropic") {
+ headers["x-api-key"] = upstream.key;
+ shown["x-api-key"] = "";
+ } else {
+ headers.authorization = `Bearer ${upstream.key}`;
+ shown.authorization = "Bearer ";
+ }
+ const tail =
+ now === "anthropic"
+ ? path.slice(`${ROOT}/anthropic`.length)
+ : path.slice(ROOT.length);
+ const url = `${upstream.base.replace(/\/$/, "")}${tail}`;
+ recorded.upstream = { url, headers: shown };
+ let reply: Response;
+ try {
+ reply = await fetch(url, {
+ method,
+ headers,
+ redirect: "error",
+ ...(method === "POST" ? { body: raw } : {}),
+ });
+ } catch {
+ return answer(
+ 502,
+ errorBody(
+ route.wire,
+ "OpenBot couldn't reach the AI model.",
+ "api_error",
+ ),
+ );
+ }
+ recorded.status = reply.status;
+ const passed: Record = {};
+ for (const name of ["content-type", "request-id", "x-request-id"]) {
+ const value = reply.headers.get(name);
+ if (value) passed[name] = value;
+ }
+ response.writeHead(reply.status, passed);
+ if (!reply.body) return response.end();
+ Readable.fromWeb(reply.body as never).pipe(response);
+ });
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
+ const { port } = server.address() as AddressInfo;
+ return {
+ url: `http://127.0.0.1:${port}${ROOT}`,
+ requests,
+ connect: (provider) => {
+ connection = provider;
+ },
+ mint: (token) => {
+ tokens.add(token);
+ },
+ close: () =>
+ new Promise((resolve) => {
+ server.closeAllConnections();
+ server.close(() => resolve());
+ }),
+ };
+}
+
+/** Real providers behind the gateway, when this run asked for them and holds their keys. */
+export function liveUpstreams(): Record | undefined {
+ if (process.env.OPENBOT_LIVE_PROVIDERS !== "1") return undefined;
+ const openai = process.env.OPENAI_API_KEY?.trim();
+ const anthropic = process.env.ANTHROPIC_API_KEY?.trim();
+ if (!openai || !anthropic)
+ throw new Error(
+ "OPENBOT_LIVE_PROVIDERS=1 needs OPENAI_API_KEY and ANTHROPIC_API_KEY in the test's environment.",
+ );
+ // Only the gateway holds them from here: an engine that reached for a key in the process's
+ // environment (as the SDKs do when given none) finds nothing.
+ delete process.env.OPENAI_API_KEY;
+ delete process.env.ANTHROPIC_API_KEY;
+ return {
+ openai: { base: "https://api.openai.com", key: openai },
+ anthropic: { base: "https://api.anthropic.com", key: anthropic },
+ };
+}
diff --git a/agent-langgraph-ts/test/model-route.test.ts b/agent-langgraph-ts/test/model-route.test.ts
new file mode 100644
index 0000000000..1ef1ede8de
--- /dev/null
+++ b/agent-langgraph-ts/test/model-route.test.ts
@@ -0,0 +1,363 @@
+/**
+ * The AI connection changes between runs, with no restart of the engine.
+ *
+ * The server tells each run which way its model is reached (`forwardedProps.openbotModelRoute`):
+ * `openai` or `anthropic` through the server's model gateway with the run's own token, or
+ * `chatgpt-plan` / `claude-plan` to that plan's engine. The engine holds no provider key: its
+ * environment names only the gateway and the plan engines.
+ *
+ * The gateway here is the contract's (test/model-gateway.ts). By default the fake provider stands
+ * behind it; with `OPENBOT_LIVE_PROVIDERS=1` and the keys in this process's environment, the real
+ * OpenAI and Anthropic APIs do, and the same tests must pass.
+ */
+import assert from "node:assert/strict";
+import { inspect } from "node:util";
+import { test } from "node:test";
+import { always, type FakeProvider, fakeProvider } from "./fake-provider.ts";
+import { conversation, run, withEngine } from "./helpers.ts";
+import {
+ type Gateway,
+ liveUpstreams,
+ MISMATCH,
+ modelGateway,
+ type Provider,
+ type Upstream,
+} from "./model-gateway.ts";
+
+const live = liveUpstreams();
+const OPENAI_MODEL = live
+ ? (process.env.OPENBOT_LIVE_OPENAI_MODEL ?? "gpt-4.1-mini")
+ : "gpt-4.1-mini";
+const RESPONSES_MODEL = live
+ ? (process.env.OPENBOT_LIVE_RESPONSES_MODEL ?? "gpt-5.6")
+ : "gpt-5.6-terra";
+const ANTHROPIC_MODEL = live
+ ? (process.env.OPENBOT_LIVE_ANTHROPIC_MODEL ?? "claude-haiku-4-5")
+ : "claude-haiku-4-5";
+
+/** What the engine's environment holds under the live connection: no provider key at all. */
+const engineEnv = (gateway: string) => ({
+ OPENBOT_MODEL_GATEWAY_URL: gateway,
+ BOT_PROVIDER: "openai",
+ OPENAI_API_KEY: "",
+ ANTHROPIC_API_KEY: "",
+});
+
+async function withGateway(
+ first: Provider,
+ body: (gateway: Gateway, upstream?: FakeProvider) => Promise,
+): Promise {
+ const fake = live
+ ? undefined
+ : await fakeProvider((request) =>
+ always({
+ text: request.path.endsWith("/messages")
+ ? "Pineapple, from Anthropic."
+ : "Pineapple, from OpenAI.",
+ })(request, 0),
+ );
+ const upstreams: Record = live ?? {
+ openai: { base: fake!.base, key: "sk-upstream-openai" },
+ anthropic: { base: fake!.base, key: "sk-ant-upstream" },
+ };
+ const gateway = await modelGateway(upstreams, first);
+ try {
+ return await body(gateway, fake);
+ } finally {
+ await gateway.close();
+ await fake?.close();
+ }
+}
+
+const ask = (overrides: Record) =>
+ conversation({
+ messages: [
+ {
+ id: "standing-role:test-bot",
+ role: "system",
+ content: "You are Test Bot. Answer in one short sentence.",
+ },
+ {
+ id: "u1",
+ role: "user",
+ content: "Reply with the word pineapple and nothing else.",
+ },
+ ],
+ ...overrides,
+ });
+
+function words(events: { type: string; delta?: unknown }[]): string {
+ return events
+ .filter((event) => event.type === "TEXT_MESSAGE_CONTENT")
+ .map((event) => String(event.delta))
+ .join("");
+}
+
+test("One engine process answers run 1 on the openai route and run 2 on the anthropic route", async () => {
+ await withGateway("openai", async (gateway) => {
+ gateway.mint("run-token-1");
+ gateway.mint("run-token-2");
+ await withEngine({ env: engineEnv(gateway.url) }, async (base) => {
+ const first = await run(
+ base,
+ ask({
+ runId: "run-1",
+ forwardedProps: {
+ openbotModel: { model: OPENAI_MODEL },
+ openbotModelRoute: { via: "openai", token: "run-token-1" },
+ },
+ }),
+ );
+ assert.equal(
+ first.events.at(-1)?.type,
+ "RUN_FINISHED",
+ inspect(first.events.at(-1)),
+ );
+ assert.match(words(first.events), /pineapple/i);
+
+ // The person changes the AI connection. Nothing about the engine restarts.
+ gateway.connect("anthropic");
+
+ const second = await run(
+ base,
+ ask({
+ runId: "run-2",
+ forwardedProps: {
+ openbotModel: { model: ANTHROPIC_MODEL },
+ openbotModelRoute: { via: "anthropic", token: "run-token-2" },
+ },
+ }),
+ );
+ assert.equal(
+ second.events.at(-1)?.type,
+ "RUN_FINISHED",
+ inspect(second.events.at(-1)),
+ );
+ assert.match(words(second.events), /pineapple/i);
+ });
+
+ const served = gateway.requests.map((request) => ({
+ path: request.path,
+ served: request.served,
+ auth: request.auth,
+ status: request.status,
+ model: request.body.model,
+ }));
+ assert.deepEqual(served, [
+ {
+ path: "/api/model-provider/v1/chat/completions",
+ served: "openai",
+ auth: { header: "authorization", token: "run-token-1" },
+ status: 200,
+ model: OPENAI_MODEL,
+ },
+ {
+ path: "/api/model-provider/anthropic/v1/messages",
+ served: "anthropic",
+ // @anthropic-ai/sdk 1.x sends a key as a bearer; the gateway takes either header.
+ auth: { header: "authorization", token: "run-token-2" },
+ status: 200,
+ model: ANTHROPIC_MODEL,
+ },
+ ]);
+ });
+});
+
+test("On the openai route a model that takes tools only on the Responses API goes to the gateway's /v1/responses", async () => {
+ await withGateway("openai", async (gateway) => {
+ gateway.mint("run-token-r");
+ const result = await withEngine({ env: engineEnv(gateway.url) }, (base) =>
+ run(
+ base,
+ ask({
+ forwardedProps: {
+ openbotModel: { model: RESPONSES_MODEL, reasoningEffort: "low" },
+ openbotModelRoute: { via: "openai", token: "run-token-r" },
+ },
+ }),
+ ),
+ );
+ assert.equal(
+ result.events.at(-1)?.type,
+ "RUN_FINISHED",
+ inspect(result.events.at(-1)),
+ );
+ assert.match(words(result.events), /pineapple/i);
+ assert.equal(gateway.requests.length, 1);
+ assert.equal(gateway.requests[0]!.path, "/api/model-provider/v1/responses");
+ assert.deepEqual(gateway.requests[0]!.body.reasoning, { effort: "low" });
+ });
+});
+
+test("A route whose wire the connection can't serve ends the run with the gateway's sentence, asked once", async () => {
+ await withGateway("anthropic", async (gateway) => {
+ gateway.mint("run-token-3");
+ const result = await withEngine({ env: engineEnv(gateway.url) }, (base) =>
+ run(
+ base,
+ ask({
+ forwardedProps: {
+ openbotModel: { model: OPENAI_MODEL },
+ openbotModelRoute: { via: "openai", token: "run-token-3" },
+ },
+ }),
+ ),
+ );
+ const error = result.events.at(-1)!;
+ assert.equal(error.type, "RUN_ERROR");
+ assert.equal(error.message, `Error code: 409 - ${MISMATCH.openai}`);
+ assert.equal(error.code, "OPENBOT_MODEL_REFUSED");
+ assert.equal(
+ gateway.requests.length,
+ 1,
+ "a 409 the gateway says not to retry is not retried",
+ );
+ });
+});
+
+test("An openai route goes to the gateway even where a ChatGPT plan engine is configured", async () => {
+ await withGateway("openai", async (gateway) => {
+ gateway.mint("run-token-4");
+ const result = await withEngine(
+ {
+ env: {
+ ...engineEnv(gateway.url),
+ // Every engine in the live connection knows both plan engines from its start.
+ CHATGPT_PLAN_HARNESS_URL: "http://127.0.0.1:9/never",
+ CLAUDE_PLAN_HARNESS_URL: "http://127.0.0.1:9/never",
+ },
+ },
+ (base) =>
+ run(
+ base,
+ ask({
+ forwardedProps: {
+ openbotModel: { model: OPENAI_MODEL },
+ openbotModelRoute: { via: "openai", token: "run-token-4" },
+ },
+ }),
+ ),
+ );
+ assert.equal(
+ result.events.at(-1)?.type,
+ "RUN_FINISHED",
+ inspect(result.events.at(-1)),
+ );
+ assert.equal(gateway.requests.length, 1);
+ assert.equal(gateway.requests[0]!.served, "openai");
+ });
+});
+
+test("No route, or no gateway address: the deployment's own environment, as before", async () => {
+ const provider = await fakeProvider(always({ text: "from the environment" }));
+ try {
+ const env = {
+ BOT_PROVIDER: "openai",
+ OPENAI_BASE_URL: `${provider.base}/v1`,
+ OPENAI_API_KEY: "sk-env",
+ };
+ const routedWithoutGateway = await withEngine({ env }, (base) =>
+ run(
+ base,
+ ask({
+ forwardedProps: {
+ openbotModel: { model: OPENAI_MODEL },
+ openbotModelRoute: { via: "anthropic", token: "run-token-5" },
+ },
+ }),
+ ),
+ );
+ assert.equal(words(routedWithoutGateway.events), "from the environment");
+ const withGatewayNoRoute = await withEngine(
+ {
+ env: {
+ ...env,
+ OPENBOT_MODEL_GATEWAY_URL: "http://127.0.0.1:9/api/model-provider",
+ },
+ },
+ (base) =>
+ run(
+ base,
+ ask({ forwardedProps: { openbotModel: { model: OPENAI_MODEL } } }),
+ ),
+ );
+ assert.equal(words(withGatewayNoRoute.events), "from the environment");
+ assert.deepEqual(
+ provider.requests.map((request) => [
+ request.path,
+ request.headers.authorization,
+ ]),
+ [
+ ["/v1/chat/completions", "Bearer sk-env"],
+ ["/v1/chat/completions", "Bearer sk-env"],
+ ],
+ );
+ } finally {
+ await provider.close();
+ }
+});
+
+test("A gateway route with no token is refused in words, and nothing is sent", async () => {
+ await withGateway("openai", async (gateway) => {
+ const result = await withEngine({ env: engineEnv(gateway.url) }, (base) =>
+ run(
+ base,
+ ask({
+ forwardedProps: {
+ openbotModel: { model: OPENAI_MODEL },
+ openbotModelRoute: { via: "openai" },
+ },
+ }),
+ ),
+ );
+ const error = result.events.at(-1)!;
+ assert.equal(error.type, "RUN_ERROR");
+ assert.match(String(error.message), /model gateway/);
+ assert.equal(gateway.requests.length, 0);
+ });
+});
+
+test("Neither the run's token nor its forwardedProps reach the log, whatever fails", async () => {
+ const TOKEN = "run-token-secret-6f1c";
+ const logged: unknown[] = [];
+ const log = {
+ warn: (...args: unknown[]) => logged.push(...args),
+ error: (...args: unknown[]) => logged.push(...args),
+ };
+ // Nothing answering at the gateway's address, then a gateway that refuses the token.
+ await withEngine(
+ { env: engineEnv("http://127.0.0.1:9/api/model-provider"), log },
+ (base) =>
+ run(
+ base,
+ ask({
+ forwardedProps: {
+ openbotSendOnce: true,
+ openbotModel: { model: OPENAI_MODEL },
+ openbotModelRoute: { via: "openai", token: TOKEN },
+ },
+ }),
+ ),
+ );
+ await withGateway("anthropic", async (gateway) => {
+ await withEngine({ env: engineEnv(gateway.url), log }, (base) =>
+ run(
+ base,
+ ask({
+ forwardedProps: {
+ openbotModel: { model: ANTHROPIC_MODEL },
+ openbotModelRoute: { via: "anthropic", token: TOKEN },
+ },
+ }),
+ ),
+ );
+ assert.equal(gateway.requests[0]?.status, 401);
+ });
+ assert.ok(logged.length > 0, "the failures were logged");
+ const text = logged.map((entry) => inspect(entry, { depth: 12 })).join("\n");
+ assert.ok(!text.includes(TOKEN), "the run token is never logged");
+ assert.ok(
+ !text.includes("openbotModelRoute"),
+ "forwardedProps are never logged",
+ );
+});
diff --git a/agent-langgraph-ts/test/plan-model.test.ts b/agent-langgraph-ts/test/plan-model.test.ts
new file mode 100644
index 0000000000..0c9c80b02b
--- /dev/null
+++ b/agent-langgraph-ts/test/plan-model.test.ts
@@ -0,0 +1,279 @@
+/**
+ * A ChatGPT plan's model calls, proxied to agent-langgraph-agui.
+ *
+ * The fake harness answers with streams recorded from the real agent-langgraph-agui image (built
+ * from this repository, OpenAI behind it) when sent plan-model.ts's request: RAW, STEP and
+ * STATE_SNAPSHOT events included, byte for byte. See test/fixtures/plan-harness/.
+ */
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import { createServer, type IncomingHttpHeaders } from "node:http";
+import type { AddressInfo } from "node:net";
+import { test } from "node:test";
+import { PlanHarnessChatModel } from "../src/plan-model.ts";
+import { conversation, run, WEATHER_TOOL, withEngine } from "./helpers.ts";
+
+const fixture = (name: string) =>
+ readFileSync(
+ new URL(`./fixtures/plan-harness/${name}.sse`, import.meta.url),
+ "utf8",
+ );
+
+type Harness = {
+ url: string;
+ requests: {
+ path: string;
+ headers: IncomingHttpHeaders;
+ body: Record;
+ }[];
+ close: () => Promise;
+};
+
+async function harness(answer: string): Promise {
+ const requests: Harness["requests"] = [];
+ const server = createServer(async (request, response) => {
+ const chunks: Buffer[] = [];
+ for await (const chunk of request) chunks.push(chunk as Buffer);
+ requests.push({
+ path: request.url ?? "",
+ headers: request.headers,
+ body: JSON.parse(Buffer.concat(chunks).toString("utf8")),
+ });
+ if (request.headers["x-openbot-agent-token"] !== "plan-harness-token") {
+ response.writeHead(401, { "content-type": "application/json" });
+ response.end(JSON.stringify({ error: "unauthorised" }));
+ return;
+ }
+ // As uvicorn serves ag-ui-langgraph's stream.
+ response.writeHead(200, {
+ "content-type": "text/event-stream; charset=utf-8",
+ });
+ response.end(answer);
+ });
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
+ const { port } = server.address() as AddressInfo;
+ return {
+ url: `http://127.0.0.1:${port}`,
+ requests,
+ close: () => new Promise((resolve) => server.close(() => resolve())),
+ };
+}
+
+const planEnv = (url: string) => ({
+ CHATGPT_PLAN_HARNESS_URL: url,
+ CHATGPT_PLAN_HARNESS_TOKEN: "plan-harness-token",
+ OPENAI_API_KEY: "",
+});
+
+test("The plan's model is asked as plan-model.ts asks it, and its words stream on", async () => {
+ const fake = await harness(fixture("text"));
+ try {
+ const result = await withEngine({ env: planEnv(fake.url) }, (base) =>
+ run(
+ base,
+ conversation({
+ tools: [WEATHER_TOOL],
+ forwardedProps: {
+ openbotModel: { model: "gpt-5.5", reasoningEffort: "low" },
+ },
+ }),
+ ),
+ );
+ assert.equal(fake.requests.length, 1);
+ const { path, headers, body } = fake.requests[0]!;
+ assert.equal(path, "/");
+ assert.equal(headers["x-openbot-agent-token"], "plan-harness-token");
+ assert.deepEqual(body.forwardedProps, {
+ openbotModelOnly: true,
+ openbotBotId: "test-bot",
+ openbotModel: { model: "gpt-5.5", reasoningEffort: "low" },
+ });
+ const context = body.context as { description: string; value: string }[];
+ assert.equal(context.length, 1);
+ assert.equal(context[0]!.description, "Built-in Bot instructions");
+ assert.ok(
+ context[0]!.value.includes("STANDING_ROLE_MARKER") &&
+ context[0]!.value.includes("GRANTED_TOOLS_MARKER"),
+ );
+ const messages = body.messages as { role: string; content: string }[];
+ assert.deepEqual(
+ messages.map((message) => message.role),
+ ["user", "assistant", "user"],
+ );
+ assert.equal(
+ typeof messages[0]!.content,
+ "string",
+ "a words-only message goes as one string",
+ );
+ assert.deepEqual(
+ (body.tools as { name: string }[]).map((tool) => tool.name),
+ ["get_weather"],
+ );
+
+ const words = result.events
+ .filter((event) => event.type === "TEXT_MESSAGE_CONTENT")
+ .map((event) => event.delta)
+ .join("");
+ assert.equal(words, "hello from the plan harness");
+ assert.equal(result.events.at(-1)!.type, "RUN_FINISHED");
+ assert.ok(
+ !result.events.some((event) => event.type === "RAW"),
+ "the harness's own events are not this run's",
+ );
+ } finally {
+ await fake.close();
+ }
+});
+
+test("The plan harness's parallel calls become this run's, under the harness's ids", async () => {
+ const fake = await harness(fixture("parallel"));
+ try {
+ const result = await withEngine({ env: planEnv(fake.url) }, (base) =>
+ run(base, conversation({ tools: [WEATHER_TOOL] })),
+ );
+ const starts = result.events.filter(
+ (event) => event.type === "TOOL_CALL_START",
+ );
+ assert.deepEqual(
+ starts.map((event) => event.toolCallId),
+ ["call_l5tzE2z7QUpRAjwp5Fw3VLwt", "call_iC7Rh33OXzhWFkHSKMJCC3ZC"],
+ );
+ const args = (id: string) =>
+ result.events
+ .filter(
+ (event) => event.type === "TOOL_CALL_ARGS" && event.toolCallId === id,
+ )
+ .map((event) => event.delta)
+ .join("");
+ assert.deepEqual(JSON.parse(args("call_l5tzE2z7QUpRAjwp5Fw3VLwt")), {
+ city: "Paris",
+ });
+ assert.deepEqual(JSON.parse(args("call_iC7Rh33OXzhWFkHSKMJCC3ZC")), {
+ city: "Tokyo",
+ });
+ assert.equal(
+ result.events.filter((event) => event.type === "TOOL_CALL_END").length,
+ 2,
+ );
+ assert.equal(
+ result.events.at(-1)!.type,
+ "RUN_FINISHED",
+ "a surface tool ends the run for the surface to answer",
+ );
+ } finally {
+ await fake.close();
+ }
+});
+
+test("The harness's refusal is relayed as it said it: words and code", async () => {
+ const fake = await harness(fixture("refused"));
+ try {
+ const result = await withEngine({ env: planEnv(fake.url) }, (base) =>
+ run(base, conversation({ tools: [WEATHER_TOOL] })),
+ );
+ const error = result.events.at(-1)!;
+ assert.equal(error.type, "RUN_ERROR");
+ assert.equal(error.code, "OPENBOT_MODEL_REFUSED");
+ assert.match(
+ String(error.message),
+ /^Error code: 400 - Function tools with reasoning_effort are not supported for gpt-5\.5/,
+ );
+ } finally {
+ await fake.close();
+ }
+});
+
+test("A sign-in the plan refused is relayed as one", async () => {
+ const fake = await harness(fixture("bad-key"));
+ try {
+ const result = await withEngine({ env: planEnv(fake.url) }, (base) =>
+ run(base, conversation()),
+ );
+ const error = result.events.at(-1)!;
+ assert.equal(error.type, "RUN_ERROR");
+ assert.equal(error.code, "OPENBOT_MODEL_AUTH_REQUIRED");
+ assert.equal(error.message, "Sign in to your model provider again.");
+ } finally {
+ await fake.close();
+ }
+});
+
+test("A harness's error category is relayed with its words", async () => {
+ // A RUN_ERROR as agent-claude-sdk sends one since #1773: the same AG-UI event with metadata.
+ const answer = [
+ 'data: {"type":"RUN_STARTED","threadId":"t","runId":"r"}\n\n',
+ 'data: {"type":"RUN_ERROR","message":"Error code: 429 - Rate limit reached","code":"OPENBOT_MODEL_REFUSED","metadata":{"errorCategory":"rate_limit"}}\n\n',
+ ].join("");
+ const fake = await harness(answer);
+ try {
+ const result = await withEngine({ env: planEnv(fake.url) }, (base) =>
+ run(base, conversation()),
+ );
+ const error = result.events.at(-1)!;
+ assert.deepEqual(
+ [
+ error.type,
+ error.code,
+ error.message,
+ (error.metadata as { errorCategory?: string })?.errorCategory,
+ ],
+ [
+ "RUN_ERROR",
+ "OPENBOT_MODEL_REFUSED",
+ "Error code: 429 - Rate limit reached",
+ "rate_limit",
+ ],
+ );
+ } finally {
+ await fake.close();
+ }
+});
+
+test("On the last step the plan's model is sent no tools, and told it answers only", async () => {
+ const fake = await harness(fixture("text"));
+ try {
+ const model = new PlanHarnessChatModel({
+ url: fake.url,
+ token: "plan-harness-token",
+ });
+ const bound = model.bindTools(
+ [
+ {
+ type: "function",
+ function: {
+ name: "get_weather",
+ description: "d",
+ parameters: { type: "object", properties: {} },
+ },
+ },
+ ],
+ { tool_choice: "none" },
+ );
+ const answer = await bound.invoke([{ role: "user", content: "hi" }]);
+ assert.equal(answer.text, "hello from the plan harness");
+ const { body } = fake.requests[0]!;
+ assert.deepEqual(body.tools, []);
+ assert.deepEqual(body.forwardedProps, {
+ openbotModelOnly: true,
+ openbotAnswerOnly: true,
+ });
+ } finally {
+ await fake.close();
+ }
+});
+
+test("A harness that hangs up mid-answer fails the call rather than ending it as an answer", async () => {
+ const fake = await harness(
+ fixture("text")
+ .split("TEXT_MESSAGE_END")[0]!
+ .replace(/data: [^\n]*$/, ""),
+ );
+ try {
+ const result = await withEngine({ env: planEnv(fake.url) }, (base) =>
+ run(base, conversation()),
+ );
+ assert.equal(result.events.at(-1)!.type, "RUN_ERROR");
+ } finally {
+ await fake.close();
+ }
+});
diff --git a/agent-langgraph-ts/test/request-shape.test.ts b/agent-langgraph-ts/test/request-shape.test.ts
new file mode 100644
index 0000000000..a19d2d2204
--- /dev/null
+++ b/agent-langgraph-ts/test/request-shape.test.ts
@@ -0,0 +1,357 @@
+/**
+ * What each provider is sent, read where it matters: the HTTP body and headers the provider
+ * receives, after the AG-UI endpoint, the graph, LangChain and the vendor SDK have all had it.
+ */
+import assert from "node:assert/strict";
+import { test } from "node:test";
+import { always, fakeProvider } from "./fake-provider.ts";
+import {
+ conversation,
+ run,
+ types,
+ WEATHER_TOOL,
+ withEngine,
+} from "./helpers.ts";
+
+const answer = always({ text: "ok" });
+
+function systemText(body: Record): string {
+ const parts: unknown[] = [
+ body.system,
+ body.instructions,
+ body.systemInstruction,
+ ];
+ for (const message of [
+ ...((body.messages as unknown[]) ?? []),
+ ...((body.input as unknown[]) ?? []),
+ ]) {
+ const role = (message as { role?: string }).role;
+ if (role === "system" || role === "developer")
+ parts.push((message as { content?: unknown }).content);
+ }
+ return JSON.stringify(parts);
+}
+
+const MARKERS = [
+ "STANDING_ROLE_MARKER",
+ "GRANTED_TOOLS_MARKER",
+ "EARLIER_QUESTION_MARKER",
+ "EARLIER_ANSWER_MARKER",
+ "LATEST_QUESTION_MARKER",
+];
+
+test("OpenAI: Chat Completions with the chosen model, its effort, the tools and one system prompt", async () => {
+ const provider = await fakeProvider(answer);
+ try {
+ const env = {
+ BOT_PROVIDER: "openai",
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `${provider.base}/v1`,
+ };
+ await withEngine({ env }, async (base) => {
+ const result = await run(
+ base,
+ conversation({
+ tools: [WEATHER_TOOL],
+ forwardedProps: {
+ // A model OpenAI serves tools and an effort for on Chat Completions.
+ openbotModel: { model: "gpt-5.2", reasoningEffort: "low" },
+ },
+ }),
+ );
+ assert.deepEqual(
+ types(result.events).filter((type) => type.startsWith("RUN_")),
+ ["RUN_STARTED", "RUN_FINISHED"],
+ );
+ });
+ assert.equal(provider.requests.length, 1);
+ const { path, headers, body } = provider.requests[0]!;
+ assert.equal(path, "/v1/chat/completions");
+ assert.equal(headers.authorization, "Bearer sk-test");
+ assert.equal(body.model, "gpt-5.2");
+ assert.equal(body.reasoning_effort, "low");
+ assert.equal(body.stream, true);
+ assert.deepEqual(
+ (body.tools as { function: { name: string } }[]).map(
+ (tool) => tool.function.name,
+ ),
+ ["get_weather"],
+ );
+ const messages = body.messages as { role: string; content: unknown }[];
+ assert.equal(
+ messages.filter(
+ (message) => message.role === "system" || message.role === "developer",
+ ).length,
+ 1,
+ );
+ assert.ok(
+ ["system", "developer"].includes(messages[0]!.role),
+ "the system prompt comes first",
+ );
+ for (const marker of MARKERS)
+ assert.ok(
+ JSON.stringify(body).includes(marker),
+ `${marker} reached the model`,
+ );
+ assert.ok(systemText(body).includes("STANDING_ROLE_MARKER"));
+ } finally {
+ await provider.close();
+ }
+});
+
+test("OpenAI: a model that takes tools only on the Responses API goes there, with reasoning.effort", async () => {
+ const provider = await fakeProvider(answer);
+ try {
+ const env = {
+ BOT_PROVIDER: "openai",
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `${provider.base}/v1`,
+ };
+ await withEngine({ env }, async (base) => {
+ await run(
+ base,
+ conversation({
+ tools: [WEATHER_TOOL],
+ forwardedProps: {
+ openbotModel: { model: "gpt-5.6-terra", reasoningEffort: "high" },
+ },
+ }),
+ );
+ });
+ const { path, body } = provider.requests[0]!;
+ assert.equal(path, "/v1/responses");
+ assert.equal(body.model, "gpt-5.6-terra");
+ assert.deepEqual((body.reasoning as { effort?: string }).effort, "high");
+ for (const marker of MARKERS)
+ assert.ok(JSON.stringify(body).includes(marker), marker);
+ } finally {
+ await provider.close();
+ }
+});
+
+test("OpenAI: COPILOTKIT_OPENAI_API=chat keeps even a Responses model on Chat Completions", async () => {
+ const provider = await fakeProvider(answer);
+ try {
+ const env = {
+ BOT_PROVIDER: "openai",
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `${provider.base}/v1`,
+ COPILOTKIT_OPENAI_API: "chat",
+ };
+ await withEngine({ env }, async (base) => {
+ await run(
+ base,
+ conversation({
+ forwardedProps: { openbotModel: { model: "gpt-5.6-terra" } },
+ }),
+ );
+ });
+ assert.equal(provider.requests[0]!.path, "/v1/chat/completions");
+ } finally {
+ await provider.close();
+ }
+});
+
+test("Anthropic: one top-level system prompt, output_config.effort, the tools", async () => {
+ const provider = await fakeProvider(answer);
+ try {
+ const env = {
+ BOT_PROVIDER: "anthropic",
+ ANTHROPIC_API_KEY: "sk-ant-test",
+ ANTHROPIC_BASE_URL: provider.base,
+ };
+ await withEngine({ env }, async (base) => {
+ const memory = {
+ id: "openbot:personal-memory",
+ role: "system",
+ content: "Personal memory, untrusted data: MEMORY_MARKER",
+ };
+ const input = conversation({
+ tools: [WEATHER_TOOL],
+ forwardedProps: {
+ openbotModel: {
+ model: "claude-sonnet-5-5",
+ reasoningEffort: "medium",
+ },
+ },
+ });
+ // Quoted memory at the head of the thread, ahead of the standing role, as the server puts it.
+ (input.messages as unknown[]).unshift(memory);
+ const result = await run(base, input);
+ assert.equal(result.events.at(-1)!.type, "RUN_FINISHED");
+ });
+ const { path, headers, body } = provider.requests[0]!;
+ assert.equal(path, "/v1/messages");
+ // @anthropic-ai/sdk 1.x sends a key as a bearer; older ones sent `x-api-key`.
+ assert.ok(
+ headers.authorization === "Bearer sk-ant-test" ||
+ headers["x-api-key"] === "sk-ant-test",
+ );
+ assert.equal(body.model, "claude-sonnet-5-5");
+ assert.deepEqual(body.output_config, { effort: "medium" });
+ assert.deepEqual(
+ (body.tools as { name: string }[]).map((tool) => tool.name),
+ ["get_weather"],
+ );
+ const system = JSON.stringify(body.system);
+ assert.ok(
+ system.includes("STANDING_ROLE_MARKER") &&
+ system.includes("GRANTED_TOOLS_MARKER"),
+ );
+ assert.ok(
+ !system.includes("MEMORY_MARKER"),
+ "quoted memory never gets the system prompt's authority",
+ );
+ const messages = body.messages as { role: string }[];
+ assert.ok(messages.every((message) => message.role !== "system"));
+ assert.equal(
+ JSON.stringify(messages).split("MEMORY_MARKER").length - 1,
+ 1,
+ "memory reaches the model once, in the conversation",
+ );
+ } finally {
+ await provider.close();
+ }
+});
+
+test("Gemini key: streamGenerateContent with the key, systemInstruction, thinking level and function declarations", async () => {
+ const provider = await fakeProvider(answer);
+ try {
+ const env = {
+ BOT_PROVIDER: "google",
+ GOOGLE_API_KEY: "AIza-test",
+ GOOGLE_GENERATIVE_AI_BASE_URL: `${provider.base}/v1beta`,
+ };
+ await withEngine({ env }, async (base) => {
+ const result = await run(
+ base,
+ conversation({
+ tools: [WEATHER_TOOL],
+ forwardedProps: {
+ openbotModel: { model: "gemini-3.1-pro", reasoningEffort: "high" },
+ },
+ }),
+ );
+ assert.equal(result.events.at(-1)!.type, "RUN_FINISHED");
+ });
+ const { path, headers, body } = provider.requests[0]!;
+ assert.match(
+ path,
+ /^\/v1beta\/models\/gemini-3\.1-pro:streamGenerateContent\?alt=sse$/,
+ );
+ assert.equal(headers["x-goog-api-key"], "AIza-test");
+ assert.ok(
+ JSON.stringify(body.systemInstruction).includes("STANDING_ROLE_MARKER"),
+ );
+ assert.equal(
+ (
+ body.generationConfig as { thinkingConfig?: { thinkingLevel?: string } }
+ ).thinkingConfig?.thinkingLevel?.toLowerCase(),
+ "high",
+ );
+ const declarations = (
+ body.tools as { functionDeclarations?: { name: string }[] }[]
+ ).flatMap((tool) => tool.functionDeclarations ?? []);
+ assert.deepEqual(
+ declarations.map((declaration) => declaration.name),
+ ["get_weather"],
+ );
+ for (const marker of MARKERS)
+ assert.ok(JSON.stringify(body).includes(marker), marker);
+ } finally {
+ await provider.close();
+ }
+});
+
+test("Gemini sign-in: Chat Completions to the server's provider proxy with its local bearer", async () => {
+ const provider = await fakeProvider(answer);
+ try {
+ // As Desktop configures it (desktop/src-tauri/src/env.rs, ModelCredential::ProviderOAuth).
+ const env = {
+ BOT_PROVIDER: "openai",
+ BOT_MODEL: "gemini-3.1-pro",
+ OPENAI_API_KEY: "local-proxy-bearer",
+ OPENAI_BASE_URL: `${provider.base}/api/model-provider/v1`,
+ };
+ await withEngine({ env }, async (base) => {
+ await run(
+ base,
+ conversation({
+ forwardedProps: {
+ openbotModel: { model: "gemini-3.1-pro", reasoningEffort: "low" },
+ },
+ }),
+ );
+ });
+ const { path, headers, body } = provider.requests[0]!;
+ assert.equal(path, "/api/model-provider/v1/chat/completions");
+ assert.equal(headers.authorization, "Bearer local-proxy-bearer");
+ assert.equal(body.model, "gemini-3.1-pro");
+ assert.equal(body.reasoning_effort, "low");
+ } finally {
+ await provider.close();
+ }
+});
+
+test("The deployment's model when the server chose none, and its provider's own default after that", async () => {
+ const provider = await fakeProvider(answer);
+ try {
+ const base = {
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `${provider.base}/v1`,
+ };
+ await withEngine(
+ { env: { ...base, BOT_PROVIDER: "openai", BOT_MODEL: "gpt-deployment" } },
+ async (url) => {
+ await run(url, conversation());
+ },
+ );
+ await withEngine(
+ { env: { ...base, BOT_PROVIDER: "openai" } },
+ async (url) => {
+ await run(url, conversation());
+ },
+ );
+ assert.equal(provider.requests[0]!.body.model, "gpt-deployment");
+ assert.equal(
+ provider.requests[1]!.body.model,
+ "gpt-5.5",
+ "shared/model-providers.json's OpenAI default",
+ );
+ } finally {
+ await provider.close();
+ }
+});
+
+test("A run the server retries itself asks the provider once", async () => {
+ const provider = await fakeProvider(
+ always({
+ status: 429,
+ body: {
+ error: {
+ message:
+ "Rate limit reached for gpt-5.5 in organization org-x on tokens per min.",
+ type: "requests",
+ code: "rate_limit_exceeded",
+ },
+ },
+ }),
+ );
+ try {
+ const env = {
+ BOT_PROVIDER: "openai",
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `${provider.base}/v1`,
+ };
+ await withEngine({ env }, async (base) => {
+ const result = await run(
+ base,
+ conversation({ forwardedProps: { openbotSendOnce: true } }),
+ );
+ assert.equal(result.events.at(-1)!.type, "RUN_ERROR");
+ });
+ assert.equal(provider.requests.length, 1);
+ } finally {
+ await provider.close();
+ }
+});
diff --git a/agent-langgraph-ts/test/responses-rule.test.ts b/agent-langgraph-ts/test/responses-rule.test.ts
new file mode 100644
index 0000000000..8954d76510
--- /dev/null
+++ b/agent-langgraph-ts/test/responses-rule.test.ts
@@ -0,0 +1,92 @@
+/**
+ * Which OpenAI API the engine calls a model on is exactly what the shared rule says.
+ *
+ * shared/model-providers.ts `requiresResponsesApi` is the rule every Bot in the box decides by; the
+ * engine imports it rather than keeping a copy. This drives the engine's real chat model for each id
+ * against a provider that answers both APIs, reads which one it was asked on, and fails on any id
+ * where that differs from the shared rule: a copy that drifted, or a library that picks the API
+ * itself, both show up here.
+ */
+import assert from "node:assert/strict";
+import { test } from "node:test";
+import { requiresResponsesApi } from "../../shared/model-providers.ts";
+import { chatModel } from "../src/models.ts";
+import { always, fakeProvider } from "./fake-provider.ts";
+
+/** OpenAI's catalogue and the names a gateway gives it, each family on both sides of the rule. */
+const MODELS = [
+ "gpt-4o-mini",
+ "gpt-4.1-mini",
+ "o3",
+ "o3-pro",
+ "gpt-5",
+ "gpt-5-mini",
+ "gpt-5-nano",
+ "gpt-5-pro",
+ "gpt-5-pro-2025-10-06",
+ "gpt-5.1",
+ "gpt-5.1-2025-11-13",
+ "gpt-5.2",
+ "gpt-5.2-2025-12-11",
+ "gpt-5.2-pro",
+ "gpt-5.3-codex",
+ "gpt-5.4",
+ "gpt-5.4-2026-03-05",
+ "gpt-5.4-mini",
+ "gpt-5.4-nano",
+ "gpt-5.5",
+ "gpt-5.5-2026-04-23",
+ "gpt-5.5-pro",
+ "gpt-5.6-luna",
+ "gpt-5.6-sol",
+ "gpt-5.6-terra",
+ "gpt-6",
+ "gpt-6-astra",
+ "gpt-6.1-sol",
+ "openai/gpt-5.5",
+ "openai/gpt-5.6-terra",
+ "openai/gpt-oss-20b",
+];
+
+const TOOL = {
+ type: "function" as const,
+ function: {
+ name: "get_weather",
+ description: "Current weather for a city.",
+ parameters: { type: "object", properties: { city: { type: "string" } } },
+ },
+};
+
+test("the engine calls every model on the API the shared rule names", async () => {
+ const provider = await fakeProvider(always({ text: "ok" }));
+ try {
+ const env = {
+ BOT_PROVIDER: "openai",
+ OPENAI_API_KEY: "sk-test",
+ OPENAI_BASE_URL: `${provider.base}/v1`,
+ };
+ const differ: string[] = [];
+ for (const model of MODELS) {
+ const before = provider.requests.length;
+ const engine = chatModel({ model, effort: "low", sendOnce: true }, env);
+ const bound = engine.bindTools?.([TOOL]);
+ assert.ok(bound, `${model}: the engine's model takes tools`);
+ // Streamed, as the engine always asks.
+ for await (const _ of await bound.stream(
+ "What is the weather in Paris?",
+ )) {
+ // Read to the end.
+ }
+ const path = provider.requests[before]?.path ?? "";
+ const engineSays = path.endsWith("/responses");
+ if (engineSays !== requiresResponsesApi(model))
+ differ.push(
+ `${model}: engine ${path}, shared rule ${requiresResponsesApi(model) ? "responses" : "chat"}`,
+ );
+ }
+ assert.deepEqual(differ, []);
+ assert.equal(provider.requests.length, MODELS.length);
+ } finally {
+ await provider.close();
+ }
+});
diff --git a/agent-langgraph-ts/test/server.test.ts b/agent-langgraph-ts/test/server.test.ts
new file mode 100644
index 0000000000..e17ec6746b
--- /dev/null
+++ b/agent-langgraph-ts/test/server.test.ts
@@ -0,0 +1,60 @@
+/** The engine's door: health without a token, everything else behind the deployment's. */
+import assert from "node:assert/strict";
+import { test } from "node:test";
+import { conversation, run, TOKEN, withEngine } from "./helpers.ts";
+
+test("/health answers without a token", async () => {
+ await withEngine({}, async (base) => {
+ const response = await fetch(`${base}/health`);
+ assert.equal(response.status, 200);
+ assert.deepEqual(await response.json(), {
+ ok: true,
+ harness: "langgraph-ts",
+ });
+ });
+});
+
+test("A run without the deployment's token, or with another, is refused before anything runs", async () => {
+ await withEngine({}, async (base) => {
+ for (const token of ["", "wrong-token", `${TOKEN}x`]) {
+ const response = await fetch(`${base}/`, {
+ method: "POST",
+ headers: {
+ "content-type": "application/json",
+ ...(token ? { "x-openbot-agent-token": token } : {}),
+ },
+ body: JSON.stringify(conversation()),
+ });
+ assert.equal(response.status, 401, `token ${JSON.stringify(token)}`);
+ }
+ });
+});
+
+test("A deployment that set no token refuses every run", async () => {
+ await withEngine({ env: { MANAGED_AGENT_TOKEN: "" } }, async (base) => {
+ assert.equal((await run(base, conversation(), "")).status, 401);
+ });
+});
+
+test("A body that is not an AG-UI run is refused, not run", async () => {
+ await withEngine({}, async (base) => {
+ const response = await fetch(`${base}/`, {
+ method: "POST",
+ headers: {
+ "content-type": "application/json",
+ "x-openbot-agent-token": TOKEN,
+ },
+ body: JSON.stringify({ messages: "nope" }),
+ });
+ assert.equal(response.status, 422);
+ });
+});
+
+test("/models belongs to a ChatGPT plan; without one there is none", async () => {
+ await withEngine({}, async (base) => {
+ const response = await fetch(`${base}/models`, {
+ headers: { "x-openbot-agent-token": TOKEN },
+ });
+ assert.equal(response.status, 404);
+ });
+});
diff --git a/agent-langgraph-ts/tsconfig.json b/agent-langgraph-ts/tsconfig.json
new file mode 100644
index 0000000000..07c03bfda6
--- /dev/null
+++ b/agent-langgraph-ts/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "compilerOptions": {
+ "target": "ES2023",
+ "module": "Preserve",
+ "moduleResolution": "Bundler",
+ "resolveJsonModule": true,
+ "strict": true,
+ "noEmit": true,
+ "allowImportingTsExtensions": true,
+ "erasableSyntaxOnly": true,
+ "verbatimModuleSyntax": true,
+ "skipLibCheck": true,
+ "types": ["node"],
+ "lib": ["ES2023", "DOM"]
+ },
+ "include": ["src/**/*.ts", "test/**/*.ts"]
+}
diff --git a/agent-langroid/requirements.txt b/agent-langroid/requirements.txt
index 309b26d7b1..6b303632b7 100644
--- a/agent-langroid/requirements.txt
+++ b/agent-langroid/requirements.txt
@@ -9,4 +9,9 @@ uvicorn[standard]
# 'mcp.types'` where an older mcp is pinned by another dependency, and `No module named 'mcp'`
# where there is none at all. 1.105.1 does not reach for it. Lift this when litellm stops
# requiring mcp, or declares it.
-litellm<1.106.0
+#
+# 1.105.7 is the release this harness is checked on for OpenAI's newer models: its model map knows
+# which fields each one refuses (`temperature` on gpt-5.5, `parallel_tool_calls` on o3), and its
+# `responses/` route carries a chat with tools to /v1/responses for gpt-5.6 and later and the -pro
+# models. src/main.py relies on both.
+litellm>=1.105.7,<1.106.0
diff --git a/agent-langroid/src/main.py b/agent-langroid/src/main.py
index bc6d1638c0..fbfa838ed8 100644
--- a/agent-langroid/src/main.py
+++ b/agent-langroid/src/main.py
@@ -8,8 +8,9 @@
# The spec file every language in the box reads: one level above this Bot in the repository, and
# one level above /app/src in the image the Dockerfile builds.
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "shared"))
-from model_providers import bot_settings
+from model_providers import bot_settings, openai_api
+import litellm
from ag_ui_langroid import create_langroid_app
from fastapi import Request
from fastapi.responses import JSONResponse
@@ -21,18 +22,47 @@
TOKEN_HEADER = "x-openbot-agent-token"
+def _litellm_knows(model: str) -> bool:
+ """Whether litellm's model map has this OpenAI model, and so knows what its requests may carry."""
+ try:
+ litellm.get_model_info(model=model, custom_llm_provider="openai")
+ except Exception:
+ return False
+ return True
+
+
def _model_id() -> str:
- """Langroid names an OpenAI model bare and everything else through litellm.
+ """The model id Langroid is given: through litellm, or bare to Langroid's own OpenAI client.
+
+ Every provider but OpenAI goes through litellm, under its provider's prefix.
+
+ An OpenAI model goes through litellm too when litellm knows it. Langroid's own client sends
+ `temperature` to every model its table does not list, and its table stops at `gpt-5.2`, so
+ `gpt-5.5` was refused ("'temperature' does not support 0.2 with this model"), and it sends
+ `parallel_tool_calls` whatever the model, which `o3` refuses. litellm reads each model's row and
+ leaves out what the model does not take (Langroid turns on litellm's `drop_params` for that).
+
+ A model that takes function tools only on the Responses API (`gpt-5.6` and later, `gpt-5.4` and
+ `gpt-5.5` once a run carries an effort, the `-pro` models) gets litellm's `responses/` route, which sends the same chat to `/v1/responses` and
+ hands the answer back as a chat completion. That is decided by the model, as every Bot in the box
+ decides it, so a gateway in front of OpenAI gets the Responses API for those models too.
- `openai/gpt-4o-mini` is rejected by its OpenAI client as an invalid model id, so the prefix goes
- on only when the provider is somebody else.
+ A model litellm does not know (one served by an OpenAI-compatible endpoint on someone's own
+ hardware) stays bare, on Langroid's own OpenAI client, which needs no key for it.
+ `openai/gpt-4o-mini` would be rejected by that client as an invalid model id.
"""
settings = bot_settings("agent-langroid")
provider = settings.provider
model = settings.model
- if "/" in model or provider == "openai":
+ if provider != "openai":
+ return model if "/" in model else f"litellm/{provider}/{model}"
+ if model.startswith("litellm/"):
return model
- return f"litellm/{provider}/{model}"
+ if openai_api(model) == "responses":
+ return f"litellm/openai/responses/{model}"
+ if _litellm_knows(model):
+ return f"litellm/openai/{model}"
+ return model
# An empty `OPENAI_API_KEY` is no key. Compose writes the keys a model choice does not use as empty
diff --git a/agent-langroid/tests/test_main.py b/agent-langroid/tests/test_main.py
index 9f5c449648..dd26c66413 100644
--- a/agent-langroid/tests/test_main.py
+++ b/agent-langroid/tests/test_main.py
@@ -151,15 +151,17 @@ def provider():
},
("openai", "local-model"),
),
+ # A model OpenAI serves on Chat Completions with any effort; which API each model takes is
+ # tests/test_responses_api.py's question.
"an OpenAI key": (
lambda base: {
"BOT_PROVIDER": "",
- "BOT_MODEL": "gpt-5.5",
+ "BOT_MODEL": "gpt-5.2",
"OPENAI_API_KEY": "test-key",
"OPENAI_BASE_URL": f"{base}/v1",
"ANTHROPIC_API_KEY": "",
},
- ("openai", "gpt-5.5"),
+ ("openai", "gpt-5.2"),
),
}
@@ -222,7 +224,7 @@ def forward(transport, request):
monkeypatch.delenv("OPENAI_API_BASE", raising=False)
monkeypatch.setenv("MANAGED_AGENT_TOKEN", TOKEN)
monkeypatch.setenv("BOT_PROVIDER", "")
- monkeypatch.setenv("BOT_MODEL", "gpt-5.5")
+ monkeypatch.setenv("BOT_MODEL", "gpt-5.2")
# A key no other test uses: Langroid caches the OpenAI client it builds by API key, so with the
# "test-key" above this test would be handed that test's client, already pointed at the fake.
monkeypatch.setenv("OPENAI_API_KEY", "blank-url-test-key")
@@ -238,7 +240,7 @@ def forward(transport, request):
)
assert destinations == [("https", "api.openai.com", "/v1/chat/completions")]
- assert provider_seen == [("openai", "gpt-5.5")]
+ assert provider_seen == [("openai", "gpt-5.2")]
assert response.status_code == 200
assert '"RUN_FINISHED"' in response.text
assert '"RUN_ERROR"' not in response.text
diff --git a/agent-langroid/tests/test_responses_api.py b/agent-langroid/tests/test_responses_api.py
new file mode 100644
index 0000000000..0904389a04
--- /dev/null
+++ b/agent-langroid/tests/test_responses_api.py
@@ -0,0 +1,295 @@
+"""Every OpenAI model the picker lists takes this Bot's tools, in the request shape it accepts.
+
+OpenAI's own words, as its API answered this Bot before:
+
+- `gpt-5.6` and later on Chat Completions, and `gpt-5.4` and `gpt-5.5` with a reasoning effort:
+ "Function tools with reasoning_effort are not supported for this model in /v1/chat/completions.
+ To use function tools, use /v1/responses".
+- The `-pro` models: "This is not a chat model and thus not supported in the v1/chat/completions
+ endpoint."
+- `gpt-5.5`: "Unsupported value: 'temperature' does not support 0.2 with this model."
+- `o3`: "Unsupported parameter: 'parallel_tool_calls' is not supported with this model."
+
+The real Langroid, litellm and AG-UI stack runs here; only the provider at OPENAI_BASE_URL is local,
+and it refuses what OpenAI refuses, in OpenAI's words.
+"""
+
+import importlib
+import json
+import sys
+import threading
+from copy import deepcopy
+from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
+from pathlib import Path
+from uuid import uuid4
+
+import pytest
+from fastapi.testclient import TestClient
+
+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
+
+TOOL = {
+ "name": "look_up_order",
+ "description": "Look up the status of an order by its number.",
+ "parameters": {
+ "type": "object",
+ "properties": {"order": {"type": "string", "description": "The order number."}},
+ "required": ["order"],
+ },
+}
+ARGUMENTS = {"order": "A-1001"}
+
+# The 5.4 and 5.5 families take tools on Chat Completions only without a reasoning effort, and on
+# the Responses API either way (OpenAI, 2026-11-17), so every Bot sends them to the Responses API.
+RESPONSES_MODELS = [
+ "gpt-5.6-luna",
+ "gpt-6-sol",
+ "gpt-6.1-terra",
+ "gpt-6.2-astra",
+ "gpt-5.5-pro",
+ "o3-pro",
+ "gpt-5.5",
+ "gpt-5.4-mini",
+]
+REFUSED_ONLY_WITH_EFFORT = {"gpt-5.5", "gpt-5.4-mini"}
+CHAT_MODELS = ["gpt-5.2", "o3", "gpt-4.1-mini"]
+# The models that refuse `temperature`. `gpt-5.2` and `gpt-5.4-mini` take it (OpenAI, 2026-11-17).
+REASONING = {"o3", *RESPONSES_MODELS} - {"gpt-5.4-mini"}
+
+
+def _refusal(model, path, body):
+ """OpenAI's refusal for this request, or None when OpenAI takes it."""
+ if path == "/v1/chat/completions":
+ if model.endswith("-pro"):
+ return 404, "This is not a chat model and thus not supported in the v1/chat/completions endpoint."
+ if model in RESPONSES_MODELS and body.get("tools") and (
+ model not in REFUSED_ONLY_WITH_EFFORT or body.get("reasoning_effort") not in (None, "none")
+ ):
+ return 400, (
+ f"Function tools with reasoning_effort are not supported for {model} in "
+ "/v1/chat/completions. To use function tools, use /v1/responses or set "
+ "reasoning_effort to 'none'."
+ )
+ if model in REASONING and "temperature" in body:
+ return 400, f"Unsupported value: 'temperature' does not support {body['temperature']} with this model."
+ if model == "o3" and "parallel_tool_calls" in body:
+ return 400, "Unsupported parameter: 'parallel_tool_calls' is not supported with this model."
+ return None
+
+
+def _chat(body):
+ results = [m for m in body["messages"] if m["role"] == "tool"]
+ if results:
+ message, finish = {"role": "assistant", "content": "Observed: " + results[-1]["content"]}, "stop"
+ else:
+ message = {
+ "role": "assistant",
+ "tool_calls": [{"id": "call-chat", "type": "function", "function": {
+ "name": body["tools"][0]["function"]["name"], "arguments": json.dumps(ARGUMENTS),
+ }}],
+ }
+ finish = "tool_calls"
+ base = {"id": "chat", "created": 0, "model": body["model"]}
+ if not body.get("stream"):
+ return "application/json", json.dumps({
+ **base, "object": "chat.completion",
+ "choices": [{"index": 0, "message": message, "finish_reason": finish}],
+ "usage": {"prompt_tokens": 1, "completion_tokens": 1, "total_tokens": 2},
+ })
+ delta = deepcopy(message)
+ for call in delta.get("tool_calls", []):
+ call["index"] = 0
+ chunks = [
+ {**base, "object": "chat.completion.chunk", "choices": [{"index": 0, "delta": delta, "finish_reason": None}]},
+ {**base, "object": "chat.completion.chunk", "choices": [{"index": 0, "delta": {}, "finish_reason": finish}]},
+ ]
+ return "text/event-stream", "".join("data: " + json.dumps(c) + "\n\n" for c in chunks) + "data: [DONE]\n\n"
+
+
+def _responses(body):
+ results = [i for i in body["input"] if i.get("type") == "function_call_output"]
+ if results:
+ # A result is a string or a list of content parts; OpenAI takes both.
+ output = results[-1]["output"]
+ if isinstance(output, list):
+ output = "".join(part.get("text", "") for part in output)
+ item = {"id": "msg", "type": "message", "role": "assistant", "status": "completed",
+ "content": [{"type": "output_text", "text": "Observed: " + output, "annotations": []}]}
+ else:
+ item = {"id": "fc", "type": "function_call", "status": "completed", "call_id": "call-responses",
+ "name": body["tools"][0]["name"], "arguments": json.dumps(ARGUMENTS)}
+ response = {
+ "id": "resp-" + uuid4().hex, "object": "response", "created_at": 0, "model": body["model"],
+ "status": "completed", "output": [item], "parallel_tool_calls": body.get("parallel_tool_calls", True),
+ "tool_choice": "auto", "tools": body.get("tools", []),
+ "usage": {"input_tokens": 1, "input_tokens_details": {"cached_tokens": 0}, "output_tokens": 1,
+ "output_tokens_details": {"reasoning_tokens": 0}, "total_tokens": 2},
+ }
+ if not body.get("stream"):
+ return "application/json", json.dumps(response)
+ if item["type"] == "message":
+ text = item["content"][0]["text"]
+ events = [
+ {"type": "response.output_item.added", "output_index": 0, "item": {**item, "status": "in_progress", "content": []}},
+ {"type": "response.content_part.added", "output_index": 0, "content_index": 0, "item_id": "msg",
+ "part": {"type": "output_text", "text": "", "annotations": []}},
+ {"type": "response.output_text.delta", "output_index": 0, "content_index": 0, "item_id": "msg", "delta": text},
+ {"type": "response.output_text.done", "output_index": 0, "content_index": 0, "item_id": "msg", "text": text},
+ {"type": "response.content_part.done", "output_index": 0, "content_index": 0, "item_id": "msg",
+ "part": item["content"][0]},
+ ]
+ else:
+ events = [
+ {"type": "response.output_item.added", "output_index": 0, "item": {**item, "status": "in_progress", "arguments": ""}},
+ {"type": "response.function_call_arguments.delta", "output_index": 0, "item_id": "fc", "delta": item["arguments"]},
+ {"type": "response.function_call_arguments.done", "output_index": 0, "item_id": "fc", "arguments": item["arguments"]},
+ ]
+ events = [
+ {"type": "response.created", "response": {**response, "status": "in_progress", "output": []}},
+ *events,
+ {"type": "response.output_item.done", "output_index": 0, "item": item},
+ {"type": "response.completed", "response": response},
+ ]
+ return "text/event-stream", "".join(
+ f"event: {e['type']}\ndata: {json.dumps({**e, 'sequence_number': n})}\n\n" for n, e in enumerate(events)
+ )
+
+
+@pytest.fixture
+def provider(monkeypatch):
+ seen = []
+
+ class Provider(BaseHTTPRequestHandler):
+ def log_message(self, *args):
+ pass
+
+ def do_POST(self):
+ body = json.loads(self.rfile.read(int(self.headers["content-length"])))
+ seen.append((self.path, body))
+ refused = _refusal(body["model"], self.path, body)
+ if refused:
+ status, message = refused
+ content_type, data = "application/json", json.dumps(
+ {"error": {"message": message, "type": "invalid_request_error", "param": None, "code": None}}
+ )
+ else:
+ status = 200
+ content_type, data = (_responses if self.path == "/v1/responses" else _chat)(body)
+ data = data.encode()
+ self.send_response(status)
+ self.send_header("Content-Type", content_type)
+ self.send_header("Content-Length", str(len(data)))
+ self.end_headers()
+ self.wfile.write(data)
+
+ server = ThreadingHTTPServer(("127.0.0.1", 0), Provider)
+ thread = threading.Thread(target=server.serve_forever, daemon=True)
+ thread.start()
+ monkeypatch.setenv("OPENAI_API_KEY", "synthetic-key")
+ monkeypatch.setenv("BOT_PROVIDER", "openai")
+ monkeypatch.setenv("OPENAI_USE_CACHED_CLIENT", "false")
+ monkeypatch.setenv("OPENAI_BASE_URL", f"http://127.0.0.1:{server.server_port}/v1")
+ monkeypatch.setenv("MANAGED_AGENT_TOKEN", "test-token")
+ monkeypatch.delenv("OPENAI_API_BASE", raising=False)
+ monkeypatch.delenv("COPILOTKIT_OPENAI_API", raising=False)
+ try:
+ yield seen
+ finally:
+ server.shutdown()
+ server.server_close()
+ thread.join(timeout=5)
+
+
+def _client(monkeypatch, model):
+ monkeypatch.setenv("BOT_MODEL", model)
+ from src import main
+
+ return TestClient(importlib.reload(main).app)
+
+
+def _body(messages, thread):
+ return {"threadId": thread, "runId": str(uuid4()), "state": {}, "messages": messages,
+ "tools": [deepcopy(TOOL)], "context": [], "forwardedProps": {}}
+
+
+def _run(client, body):
+ response = client.post("/", json=body, headers={"x-openbot-agent-token": "test-token"})
+ assert response.status_code == 200
+ events = [json.loads(line[5:]) for line in response.text.splitlines() if line.startswith("data:")]
+ assert not [e for e in events if e["type"] == "RUN_ERROR"], events
+ assert events[-1]["type"] == "RUN_FINISHED", events
+ return events
+
+
+def _tool_call_then_result(client):
+ """A run that streams a tool call, then the run the browser sends back with its result."""
+ thread = str(uuid4())
+ question = [{"id": "u1", "role": "user", "content": "Where is order A-1001?"}]
+ events = _run(client, _body(question, thread))
+ start = next((e for e in events if e["type"] == "TOOL_CALL_START"), None)
+ assert start is not None, events
+ assert start["toolCallName"] == TOOL["name"]
+ assert json.loads("".join(e["delta"] for e in events if e["type"] == "TOOL_CALL_ARGS")) == ARGUMENTS
+ assert any(e["type"] == "TOOL_CALL_END" for e in events)
+ result = "shipped-" + uuid4().hex
+ history = [*question, {
+ "id": start["parentMessageId"], "role": "assistant", "toolCalls": [{
+ "id": start["toolCallId"], "type": "function",
+ "function": {"name": TOOL["name"], "arguments": json.dumps(ARGUMENTS)},
+ }],
+ }, {"id": "t1", "role": "tool", "toolCallId": start["toolCallId"], "content": result}]
+ events = _run(client, _body(history, thread))
+ text = "".join(e.get("delta", "") for e in events if e["type"] == "TEXT_MESSAGE_CONTENT")
+ assert "Observed: " + result in text
+ return start, result
+
+
+@pytest.mark.parametrize("model", RESPONSES_MODELS)
+def test_a_responses_only_model_calls_tools_and_reads_results_through_the_responses_api(
+ monkeypatch, provider, model
+):
+ client = _client(monkeypatch, model)
+
+ start, result = _tool_call_then_result(client)
+
+ assert [path for path, _ in provider] == ["/v1/responses", "/v1/responses"]
+ first, second = (body for _, body in provider)
+ assert first["model"] == model
+ tool = next(t for t in first["tools"] if t["name"] == TOOL["name"])
+ assert tool["type"] == "function"
+ assert tool["parameters"]["properties"] == TOOL["parameters"]["properties"]
+ if model in REASONING:
+ assert "temperature" not in first
+ output = next(i for i in second["input"] if i.get("type") == "function_call_output")
+ assert output["call_id"] == start["toolCallId"]
+ assert result in json.dumps(output["output"])
+
+
+@pytest.mark.parametrize("model", CHAT_MODELS)
+def test_a_model_that_takes_tools_on_chat_completions_gets_only_the_fields_it_accepts(
+ monkeypatch, provider, model
+):
+ client = _client(monkeypatch, model)
+
+ _tool_call_then_result(client)
+
+ assert [path for path, _ in provider] == ["/v1/chat/completions", "/v1/chat/completions"]
+ for _, body in provider:
+ if model in REASONING:
+ assert "temperature" not in body
+ if model == "o3":
+ assert "parallel_tool_calls" not in body
+ else:
+ # One call per turn, as Langroid's AG-UI bridge hands calls back one at a time.
+ assert body["parallel_tool_calls"] is False
+
+
+def test_a_model_litellm_does_not_know_stays_on_langroids_own_client(monkeypatch, provider):
+ # A model on someone's own hardware, behind an OpenAI-compatible endpoint, and with no key.
+ monkeypatch.delenv("OPENAI_API_KEY", raising=False)
+ client = _client(monkeypatch, "qwen3-8b-local")
+
+ _tool_call_then_result(client)
+
+ assert [path for path, _ in provider] == ["/v1/chat/completions", "/v1/chat/completions"]
+ assert provider[0][1]["parallel_tool_calls"] is False
diff --git a/api/README.md b/api/README.md
index 26d16a0e05..166de58420 100644
--- a/api/README.md
+++ b/api/README.md
@@ -71,7 +71,92 @@ The `API spec` job in `.github/workflows/ci.yml` fails a pull request when:
every write, and `cursor` and `limit` on every list;
- the spec breaks a client of the base branch's spec (oasdiff). A change that takes nothing from a
client goes through only when it is listed with its reason in
- [accepted-breaking-changes.md](accepted-breaking-changes.md).
+ [accepted-breaking-changes.md](accepted-breaking-changes.md);
+- the spec breaks a client of any release whose apps the server still serves: each release of the
+ last 12 months and the last release, each against its own spec (oasdiff again), a deprecation names no
+ `x-sunset` at least 365 days out, or a minimum app version cuts the 12-month support window
+ (`scripts/support-window.ts`).
+
+What makes each of these fail, and how to fix it the right way:
+[docs/api-versioning.md](../docs/api-versioning.md#what-ci-enforces).
+
+The server ignores query parameters it does not know rather than refusing them, on purpose: a
+tolerant reader, so a client written against a newer spec still works against an older server.
+
+## Deprecating
+
+Something a client uses is never removed in place. It is marked deprecated in the spec, answers
+with the standard headers from then on, and is removed only when two things are both true: its
+sunset has passed, at least 12 months after it was deprecated, and nothing has used it over the
+last 12 months, by the count OpenBot Cloud keeps of every use. A property of a response is the one
+exception: nothing can count it, so its sunset alone decides (below).
+
+1. Mark it in its area file: `deprecated: true` on the operation, the query or header parameter, or
+ the property of a request or response body, with `x-deprecation-date` (the day it is deprecated)
+ and `x-sunset` (the earliest day it may go, the extension oasdiff reads), both `YYYY-MM-DD`. Say
+ in its description what to use instead.
+
+ ```yaml
+ cron:
+ type: string
+ deprecated: true
+ x-deprecation-date: 2026-12-01
+ x-sunset: 2027-12-01
+ description: Deprecated. Send `schedule` instead.
+ ```
+
+2. List it in [CHANGELOG.md](../CHANGELOG.md), in the Deprecated list under `## Unreleased`'s
+ "Before upgrading": one line naming it as the server counts it, in backticks, with what replaces
+ it and its sunset. An operation is its method and path; a part of one adds `query `,
+ `header `, `body ` or `response `, with `[]` for an array's items.
+
+ ```markdown
+ - **Deprecated.** Each still works, answers with `Deprecation` and `Sunset` headers, and is
+ removed no earlier than its sunset, and only once nothing uses it.
+ - `PATCH /api/v2/organizations/{organizationId}/routines/{routineId} body cron`: send
+ `schedule` instead. Sunset 2027-12-01.
+ ```
+
+`shared/tests/api-deprecations.test.ts` fails a pull request whose marks are incomplete or whose
+deprecations the changelog doesn't list. The server reads the same marks from the spec it is
+generated from, so a request that uses a deprecated element is answered with `Deprecation`
+([RFC 9745](https://www.rfc-editor.org/rfc/rfc9745.html)), `Sunset`
+([RFC 8594](https://www.rfc-editor.org/rfc/rfc8594.html)) and `Link: ; rel="deprecation"`,
+and each use is counted by the app that made it, from its `OpenBot-Client` header. Nobody writes
+those headers by hand. A deprecated response property is listed and dated the same way, but no
+answer is marked for it and nothing counts it: a server can't see which fields a client reads. So a
+response property's removal waits on the 12-month window alone: it may go once its sunset has
+passed.
+
+To remove it, once both conditions hold, delete it from its area file and regenerate. oasdiff
+doesn't report a removal on or after its `x-sunset`, and fails one before it
+(`api-removed-before-sunset`). The policy behind these rules, and what each CI failure means, is in
+[docs/api-versioning.md](../docs/api-versioning.md).
+
+## Enums that grow
+
+A value added to an enum a client reads in a response breaks a client that only knows the old
+values, so oasdiff fails it. An enum whose list is expected to grow (a status, a role, a kind of
+scope) is declared open instead: `x-extensible-enum` in place of `enum`, with the values it has
+today ([Zalando rule 112](https://opensource.zalando.com/restful-api-guidelines/#112)). oasdiff
+then lets a value be added, and the generated clients read it as a string.
+
+```yaml
+status:
+ type: string
+ x-extensible-enum: [queued, running, succeeded, failed]
+```
+
+Every OpenBot client is a tolerant reader: it ignores a response field it doesn't know, and reads an
+enum value it doesn't know as "other" instead of failing. `app/tests/tolerant-reader.test.ts` and
+`mobile/tests/tolerant-reader.test.ts` hand the generated clients both and check nothing throws.
+
+Only an enum no request carries can be open, because the server checks what a request sends
+against the list. An enum a client also sends, or sends back as it read it (a shared account's
+audience, which is read and then saved again, or the permission switch changes a model wrote, which
+are previewed and then saved), stays `enum`; a response gets its own open copy
+where it needs one, as `PersonRoleAnswer` is for `PersonRole`. `api/openapi-extensible-enums.test.ts`
+fails a request that reaches an open enum.
## The live channels
diff --git a/api/accepted-breaking-changes.md b/api/accepted-breaking-changes.md
index e03406dba2..48f1590d53 100644
--- a/api/accepted-breaking-changes.md
+++ b/api/accepted-breaking-changes.md
@@ -7,6 +7,10 @@ from a client, and say why on the line: the date, the change as oasdiff words it
Once the change is on the base branch, oasdiff no longer reports it and its line matches nothing.
+CI also holds the spec to the last release's, with these same lines, except any that says "no
+release serves it": that reason is about the release, so it is checked against the release. Write
+it in those words when it is the reason, and the release run fails if the release does serve it.
+
- 2026-11-14 GET /api/v2/organizations/{organizationId}/bots added the pattern `^[A-Za-z0-9_-]+$` to the `query` request parameter `cursor`. The server only issues cursors in URL-safe base64 and has always refused any other cursor with 400, so no request that worked stops working.
- 2026-11-14 GET /api/v2/organizations/{organizationId}/reactions added the pattern `^[A-Za-z0-9_-]+$` to the `query` request parameter `cursor`. The same cursor, and the same refusal of any other.
- 2026-11-14 POST /api/v2/organizations/{organizationId}/bots request property `harness` was restricted to a list of enum values. The server has always refused a harness outside OpenBot's harness list with 400; the enum is that list, and api/openapi-harnesses.test.ts keeps the two the same.
@@ -44,4 +48,219 @@ Once the change is on the base branch, oasdiff no longer reports it and its line
- 2026-11-15 PUT /api/v2/organizations/{organizationId}/network-policies/{networkPolicyId} added the new `team` enum value to the `scopeKind` response property for the response status `200`. A network policy can now be set for a team by id, beside the organization and a directory group; a client that never set one never reads one.
- 2026-11-15 GET /api/v2/organizations/{organizationId}/shared-use-requests added the new `team` enum value to the `sharedUseRequests/items/current/oneOf[#/components/schemas/SharedUseApproval]/members/items/kind` response property for the response status `200` (shared schema: `SharedUseApproval`, also at `sharedUseRequests/items/proposed/members/items/kind`). A shared account's audience can now name a team by id beside a person and a directory group; nothing is taken from a client, and one written before teams never sent or approved a team.
- 2026-11-15 POST /api/v2/organizations/{organizationId}/shared-use-requests/{sharedUseRequestId}/approve added the new `team` enum value to the `current/oneOf[#/components/schemas/SharedUseApproval]/members/items/kind` response property for the response status `200` (shared schema: `SharedUseApproval`, also at `proposed/members/items/kind`). A shared account's audience can now name a team by id beside a person and a directory group; nothing is taken from a client, and one written before teams never sent or approved a team.
-- 2026-11-15 POST /api/v2/organizations/{organizationId}/shared-use-requests/{sharedUseRequestId}/decline added the new `team` enum value to the `current/oneOf[#/components/schemas/SharedUseApproval]/members/items/kind` response property for the response status `200` (shared schema: `SharedUseApproval`, also at `proposed/members/items/kind`). A shared account's audience can now name a team by id beside a person and a directory group; nothing is taken from a client, and one written before teams never sent or approved a team.
\ No newline at end of file
+- 2026-11-15 POST /api/v2/organizations/{organizationId}/shared-use-requests/{sharedUseRequestId}/decline added the new `team` enum value to the `current/oneOf[#/components/schemas/SharedUseApproval]/members/items/kind` response property for the response status `200` (shared schema: `SharedUseApproval`, also at `proposed/members/items/kind`). A shared account's audience can now name a team by id beside a person and a directory group; nothing is taken from a client, and one written before teams never sent or approved a team.
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/app-access-requests removed the enum constraint from the `appAccessRequests/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/app-access-requests removed the enum constraint from the `status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/app-access-requests/{appAccessRequestId}/approve removed the enum constraint from the `appAccessRequest/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/app-access-requests/{appAccessRequestId}/dismiss removed the enum constraint from the `status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/bots/{botId}/apps/{appId}/approve removed the enum constraint from the `appAccessRequest/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/bots/{botId}/shared-use removed the enum constraint from the `pending/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/capabilities/preview removed the enum constraint from the `people/items/capabilities/items/after/decidedBy` response property for the response status `200` (shared schema: `CapabilityAnswer`, also at `people/items/capabilities/items/before/decidedBy`). Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/capabilities/preview removed the enum constraint from the `people/items/role` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/check-in-items removed the enum constraint from the `checkInItems/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/check-in-items/{checkInItemId}/dismiss removed the enum constraint from the `checkInItem/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/check-in-items/{checkInItemId}/start removed the enum constraint from the `checkInItem/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/check-ins removed the enum constraint from the `checkIns/items/lastStatus` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/check-ins removed the enum constraint from the `checkIn/lastStatus` response property for the response status `201`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 PATCH /api/v2/organizations/{organizationId}/check-ins/{checkInId} removed the enum constraint from the `checkIn/lastStatus` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/reset removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/stop removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/update removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId} removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId} removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId} removed the enum constraint from the `state` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/click removed the enum constraint from the `handoff/status` response property for the response status `403`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/click removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/click removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/click removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId}/control removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId}/control removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId}/control removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId}/control removed the enum constraint from the `request/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/cancel removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/cancel removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/cancel removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/cancel removed the enum constraint from the `request/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/release removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/release removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/release removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/release removed the enum constraint from the `request/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/request removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/request removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/request removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/request removed the enum constraint from the `request/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/secret removed the enum constraint from the `handoff/status` response property for the response status `403`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/secret removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/secret removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/secret removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/secret removed the enum constraint from the `request/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/take removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/take removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/take removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/control/take removed the enum constraint from the `request/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/exec removed the enum constraint from the `handoff/status` response property for the response status `403`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/exec removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/exec removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/exec removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/files/list removed the enum constraint from the `handoff/status` response property for the response status `403`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/files/list removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/files/list removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/files/list removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/files/read removed the enum constraint from the `handoff/status` response property for the response status `403`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/files/read removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/files/read removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/files/read removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/files/write removed the enum constraint from the `handoff/status` response property for the response status `403`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/files/write removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/files/write removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/files/write removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/human-input/secret removed the enum constraint from the `handoff/status` response property for the response status `403`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/human-input/secret removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/human-input/secret removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/human-input/secret removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/human-input/{kind} removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/human-input/{kind} removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/human-input/{kind} removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/key removed the enum constraint from the `handoff/status` response property for the response status `403`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/key removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/key removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/key removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/navigate removed the enum constraint from the `handoff/status` response property for the response status `403`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/navigate removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/navigate removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/navigate removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId}/page removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId}/page removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId}/page removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId}/page-frames/{toolCallId} removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId}/screenshot removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId}/screenshot removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/computers/{botId}/screenshot removed the enum constraint from the `oneOf[#/components/schemas/ComputerNotReady]/state` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/scroll removed the enum constraint from the `handoff/status` response property for the response status `403`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/scroll removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/scroll removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/scroll removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/snapshot removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/snapshot removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/snapshot removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/type removed the enum constraint from the `handoff/status` response property for the response status `403`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/type removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/type removed the enum constraint from the `handoff/status` response property for the response status `409`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/type removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/wake removed the enum constraint from the `handoff/status` response property for the response status `404`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/wake removed the enum constraint from the `handoff/status` response property for the response status `503`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/computers/{botId}/wake removed the enum constraint from the `state` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/conversations/{conversationId}/messages removed the enum constraint from the `messages/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/goals removed the enum constraint from the `goals/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/goals removed the enum constraint from the `goal/status` response property for the response status `201`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 PATCH /api/v2/organizations/{organizationId}/goals/{goalId} removed the enum constraint from the `goal/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/goals/{goalId}/complete removed the enum constraint from the `goal/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/goals/{goalId}/pause removed the enum constraint from the `goal/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/goals/{goalId}/resume removed the enum constraint from the `goal/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/goals/{goalId}/runs removed the enum constraint from the `runs/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/invitations removed the enum constraint from the `invitations/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/invitations removed the enum constraint from the `invitation/status` response property for the response status `201`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/members removed the enum constraint from the `members/items/assignableRoles/items/` response property for the response status `200` (shared schema: `PersonRoleAnswer`, also at `members/items/assignableRoles/items`, `members/items/role`). Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 PATCH /api/v2/organizations/{organizationId}/members/{personId} removed the enum constraint from the `member/assignableRoles/items/` response property for the response status `200` (shared schema: `PersonRoleAnswer`, also at `member/assignableRoles/items`, `member/role`). Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/network-policies removed the enum constraint from the `networkPolicies/items/scopeKind` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 PUT /api/v2/organizations/{organizationId}/network-policies/{networkPolicyId} removed the enum constraint from the `scopeKind` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/people removed the enum constraint from the `people/items/role` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/people/{personId} removed the enum constraint from the `person/role` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 PATCH /api/v2/organizations/{organizationId}/people/{personId} removed the enum constraint from the `person/role` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/people/{personId}/approvals removed the enum constraint from the `approvals/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/people/{personId}/approvals/{approvalId}/decide removed the enum constraint from the `status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/people/{personId}/deliveries removed the enum constraint from the `deliveries/items/state` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/people/{personId}/learning-proposals removed the enum constraint from the `skills/items/proposal/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/people/{personId}/learning-proposals/{proposalId} removed the enum constraint from the `status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/people/{personId}/learning-review removed the enum constraint from the `spaces/items/latestRun/oneOf[#/components/schemas/LearningRun]/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/people/{personId}/learning-review removed the enum constraint from the `spaces/items/proposals/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/people/{personId}/learning-runs removed the enum constraint from the `status` response property for the response status `202`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/people/{personId}/linked-accounts removed the enum constraint from the `linkedAccounts/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/people/{personId}/memory-sources removed the enum constraint from the `sources/items/syncStatus` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/people/{personId}/memory-sources removed the enum constraint from the `source/syncStatus` response property for the response status `201`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 PATCH /api/v2/organizations/{organizationId}/people/{personId}/memory-sources/{memorySourceId} removed the enum constraint from the `syncStatus` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/people/{personId}/memory-sources/{memorySourceId}/sync removed the enum constraint from the `source/syncStatus` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/people/{personId}/restore-access removed the enum constraint from the `person/role` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/people/{personId}/revoke-access removed the enum constraint from the `person/role` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/people/{personId}/sign-in-requests removed the enum constraint from the `signInRequests/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/people/{personId}/sign-in-requests removed the enum constraint from the `signInRequest/status` response property for the response status `201`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/people/{personId}/sign-in-requests/{signInRequestId} removed the enum constraint from the `signInRequest/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/people/{personId}/sign-in-requests/{signInRequestId}/cancel removed the enum constraint from the `signInRequest/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/people/{personId}/sign-in-requests/{signInRequestId}/code removed the enum constraint from the `signInRequest/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/people/{personId}/sign-in-requests/{signInRequestId}/finish removed the enum constraint from the `signInRequest/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/people/{personId}/sign-in-requests/{signInRequestId}/submit removed the enum constraint from the `signInRequest/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/people/{personId}/sign-in-requests/{signInRequestId}/take-over removed the enum constraint from the `signInRequest/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/people/{personId}/sign-in-requests/{signInRequestId}/use-saved removed the enum constraint from the `signInRequest/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/personal-learning-proposals removed the enum constraint from the `people/items/proposals/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 PATCH /api/v2/organizations/{organizationId}/profile removed the enum constraint from the `organization/role` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/routines removed the enum constraint from the `routines/items/lastRun/oneOf[#/components/schemas/RoutineLastRun]/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/routines removed the enum constraint from the `routine/lastRun/oneOf[#/components/schemas/RoutineLastRun]/status` response property for the response status `201`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 PATCH /api/v2/organizations/{organizationId}/routines/{routineId} removed the enum constraint from the `routine/lastRun/oneOf[#/components/schemas/RoutineLastRun]/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/routines/{routineId}/runs removed the enum constraint from the `runs/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/settings/learning/proposals removed the enum constraint from the `proposals/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/settings/learning/proposals/{proposalId} removed the enum constraint from the `status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/settings/learning/runs removed the enum constraint from the `runs/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/settings/learning/runs removed the enum constraint from the `status` response property for the response status `202`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/shared-use-requests removed the enum constraint from the `sharedUseRequests/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/shared-use-requests/{sharedUseRequestId}/approve removed the enum constraint from the `status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/shared-use-requests/{sharedUseRequestId}/decline removed the enum constraint from the `status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/tasks removed the enum constraint from the `tasks/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/organizations/{organizationId}/tasks/{taskId} removed the enum constraint from the `task/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/tasks/{taskId}/reopen removed the enum constraint from the `task/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/tasks/{taskId}/resolve removed the enum constraint from the `task/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/tasks/{taskId}/retry removed the enum constraint from the `task/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/organizations/{organizationId}/tasks/{taskId}/stop removed the enum constraint from the `task/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/people/me/invitations removed the enum constraint from the `invitations/items/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/people/me/invitations/{invitationId} removed the enum constraint from the `invitation/status` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/people/me/invitations/{invitationId}/accept removed the enum constraint from the `organization/role` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 GET /api/v2/people/me/organizations removed the enum constraint from the `organizations/items/role` response property for the response status `200`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-17 POST /api/v2/people/me/organizations removed the enum constraint from the `organization/role` response property for the response status `201`. Declared open with x-extensible-enum, with the same values: the server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-18 GET /api/v2/organizations/{organizationId}/members removed the enum constraint from the `members/items/assignableRoles/items` response property for the response status `200` (shared schema: `PersonRoleAnswer`, also at `members/items/role`). Against 1.1.0, as the last release run words it: the role a member holds and the roles they may be given, declared open with x-extensible-enum with the same values. The server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-18 PATCH /api/v2/organizations/{organizationId}/members/{personId} removed the enum constraint from the `member/assignableRoles/items` response property for the response status `200` (shared schema: `PersonRoleAnswer`, also at `member/role`). Against 1.1.0, as the last release run words it: the role a member holds and the roles they may be given, declared open with x-extensible-enum with the same values. The server sends nothing it did not send before, and every client reads a value it doesn't know (api/README.md, Enums that grow).
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/approval-rules changed the pattern of the request property `botId` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/approval-rules changed the pattern of the request property `effect` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/approval-rules changed the pattern of the request property `scope` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/approval-rules changed the pattern of the request property `toolRef` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/approval-rules/batch-create changed the pattern of the request property `authoring/text` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/approval-rules/translate changed the pattern of the request property `text` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 PATCH /api/v2/organizations/{organizationId}/approval-rules/{approvalRuleId} changed the pattern of the request property `botId` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$` (shared schema: `ApprovalRulePattern`, also at `effect`, `scope` and 1 more). The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/bots/{botId}/grants/batch-update changed the pattern of the request property `authoring/text` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/bots/{botId}/grants/translate changed the pattern of the request property `text` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/bots/{botId}/report-decline changed the pattern of the request property `reason` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 PUT /api/v2/organizations/{organizationId}/boundaries changed the pattern of the request property `authoring/text` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 PUT /api/v2/organizations/{organizationId}/boundaries changed the pattern of the request property `labels/additionalProperties/name` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/boundaries/replay changed the pattern of the request property `boundaries/labels/additionalProperties/name` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/boundaries/translate changed the pattern of the request property `text` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/capabilities/batch-update changed the pattern of the request property `authoring/text` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/capabilities/translate changed the pattern of the request property `text` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 PATCH /api/v2/organizations/{organizationId}/capabilities/{capabilityId} changed the pattern of the request property `groups/propertyNames` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 PATCH /api/v2/organizations/{organizationId}/capabilities/{capabilityId} changed the pattern of the request property `teams/propertyNames` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/identity-providers changed the pattern of the request property `oneOf[#/components/schemas/OidcIdentityProviderRequest]/clientId` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$` (shared schema: `IdentityProviderText`, also at `oneOf[#/components/schemas/OidcIdentityProviderRequest]/clientSecret`). The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/identity-providers changed the pattern of the request property `oneOf[#/components/schemas/SamlIdentityProviderRequest]/domain` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$` (shared schema: `IdentityProviderDomains`, also at `oneOf[#/components/schemas/OidcIdentityProviderRequest]/domain`). The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/identity-providers changed the pattern of the request property `oneOf[#/components/schemas/SamlIdentityProviderRequest]/id` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$` (shared schema: `NewIdentityProviderId`, also at `oneOf[#/components/schemas/OidcIdentityProviderRequest]/id`). The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/identity-providers changed the pattern of the request property `oneOf[#/components/schemas/SamlIdentityProviderRequest]/metadata` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/network-policies/translate changed the pattern of the request property `text` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 PUT /api/v2/organizations/{organizationId}/network-policies/{networkPolicyId} changed the pattern of the request property `authoring/text` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/people/{personId}/approval-rules changed the pattern of the request property `botId` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/people/{personId}/approval-rules changed the pattern of the request property `effect` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/people/{personId}/approval-rules changed the pattern of the request property `scope` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/people/{personId}/approval-rules changed the pattern of the request property `toolRef` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 PATCH /api/v2/organizations/{organizationId}/people/{personId}/approval-rules/{approvalRuleId} changed the pattern of the request property `botId` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$` (shared schema: `ApprovalRulePattern`, also at `effect`, `scope` and 1 more). The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/people/{personId}/questions/{questionId}/respond changed the pattern of the request property `response` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 PATCH /api/v2/organizations/{organizationId}/profile changed the pattern of the request property `name` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 PUT /api/v2/organizations/{organizationId}/reviewer-guidance changed the pattern of the request property `text` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/reviewer-guidance/check changed the pattern of the request property `text` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/reviewer-guidance/replay changed the pattern of the request property `text` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 GET /api/v2/organizations/{organizationId}/settings the `mcpAllowlist/servers/items` response's property pattern was changed from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$` for the status `200` (shared schema: `AllowlistEntry`, also at `modelAllowlist/models/items`). The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 PATCH /api/v2/organizations/{organizationId}/settings changed the pattern of the request property `mcpAllowlist/servers/items` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$` (shared schema: `AllowlistEntry`, also at `modelAllowlist/models/items`). The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 PATCH /api/v2/organizations/{organizationId}/settings the `mcpAllowlist/servers/items` response's property pattern was changed from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$` for the status `200` (shared schema: `AllowlistEntry`, also at `modelAllowlist/models/items`). The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/teams changed the pattern of the request property `name` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 PATCH /api/v2/organizations/{organizationId}/teams/{teamId} changed the pattern of the request property `name` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/organizations/{organizationId}/what-if/ask changed the pattern of the request property `question` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 POST /api/v2/people/me/organizations changed the pattern of the request property `name` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The pattern now refuses NUL in the one character it requires as well as everywhere else, as the server always has ("That text has a character OpenBot can't keep"): nothing it accepted before is refused, and nothing it sends has changed.
+- 2026-11-18 PATCH /api/v2/organizations/{organizationId}/capabilities/{capabilityId} changed the pattern of the request property `groups/propertyNames/` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The same change as worded by oasdiff 1.34: NUL refused in the one required character as everywhere else, as the server always has.
+- 2026-11-18 PATCH /api/v2/organizations/{organizationId}/capabilities/{capabilityId} changed the pattern of the request property `teams/propertyNames/` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$`. The same change as worded by oasdiff 1.34: NUL refused in the one required character as everywhere else, as the server always has.
+- 2026-11-18 GET /api/v2/organizations/{organizationId}/settings the `mcpAllowlist/servers/items/` response's property pattern was changed from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$` for the status `200` (shared schema: `AllowlistEntry`, also at `mcpAllowlist/servers/items`, `modelAllowlist/models/items`). The same change as worded by oasdiff 1.34: NUL refused in the one required character as everywhere else, as the server always has.
+- 2026-11-18 PATCH /api/v2/organizations/{organizationId}/settings changed the pattern of the request property `mcpAllowlist/servers/items/` from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$` (shared schema: `AllowlistEntry`, also at `mcpAllowlist/servers/items`, `modelAllowlist/models/items`). The same change as worded by oasdiff 1.34: NUL refused in the one required character as everywhere else, as the server always has.
+- 2026-11-18 PATCH /api/v2/organizations/{organizationId}/settings the `mcpAllowlist/servers/items/` response's property pattern was changed from `^[^\x00]*\S[^\x00]*$` to `^[^\x00]*[^\s\x00][^\x00]*$` for the status `200` (shared schema: `AllowlistEntry`, also at `mcpAllowlist/servers/items`, `modelAllowlist/models/items`). The same change as worded by oasdiff 1.34: NUL refused in the one required character as everywhere else, as the server always has.
diff --git a/api/client-boundary.allow.ts b/api/client-boundary.allow.ts
index dec6e96ca6..f7214c4fbb 100644
--- a/api/client-boundary.allow.ts
+++ b/api/client-boundary.allow.ts
@@ -173,7 +173,7 @@ export const ALLOWED: Allowed[] = [
why: "the development server's proxy of /api",
},
{
- file: "app/src/components/channels/chat-transcript.tsx",
+ file: "app/src/components/channels/attachment-view.tsx",
what: "fetch()",
rule: "transport",
why: "asks with HEAD whether a sent document is still there, at the address the generated client builds (getGetAttachmentUrl)",
@@ -265,6 +265,12 @@ export const ALLOWED: Allowed[] = [
rule: "stored-format",
why: "the form a sent message keeps its attachment in; the app reads it at the API's address",
},
+ {
+ file: "app/src/lib/markdown.tsx",
+ what: "/api/",
+ rule: "transport",
+ why: "tells a link in a Bot's words that points at the server apart from a page of the app, so the browser opens it rather than the app's router; it calls nothing",
+ },
// Clients already released.
{
file: "shared/recorder-api.ts",
@@ -303,6 +309,12 @@ export const ALLOWED: Allowed[] = [
rule: "machine-credential",
why: "the addresses Desktop gives a Bot's harness: the model proxy and the tool callback",
},
+ {
+ file: "desktop/src-tauri/src/ai_connection.rs",
+ what: "/api/model-provider",
+ rule: "machine-credential",
+ why: "the model gateway Desktop gives every engine, which presents the gateway token",
+ },
{
file: "desktop/src-tauri/src/learning_model.rs",
what: "/api/learning-model/v1",
@@ -392,6 +404,12 @@ export const ALLOWED: Allowed[] = [
rule: "third-party",
why: "image registries, never OpenBot's server",
},
+ {
+ file: "scripts/model-compat.ts",
+ what: /^(fetch\(\)|\/health|\/api\/agents\/openbot\/generate)$/,
+ rule: "third-party",
+ why: "model providers' listings and the harness images the model check starts on this machine, never OpenBot's server",
+ },
// Scripts that run and stop a server on this machine.
{
file: "scripts/update-local.ts",
diff --git a/api/openapi-accounts.test.ts b/api/openapi-accounts.test.ts
index 493b527ae2..50803453f7 100644
--- a/api/openapi-accounts.test.ts
+++ b/api/openapi-accounts.test.ts
@@ -34,9 +34,13 @@ test("a skin is one OpenBot ships, and nothing else", () => {
test("the preferences are the ones a person has, each with a default", () => {
const preferences = schemas.Preferences;
- // Every preference the server answers with a default for, and the one it sets itself.
+ // Every preference the server answers with a default for, and the ones it sets itself.
expect(Object.keys(preferences?.properties ?? {}).sort()).toEqual(
- [...Object.keys(DEFAULT_USER_PREFERENCES), "starterTourChannelId"].sort(),
+ [
+ ...Object.keys(DEFAULT_USER_PREFERENCES),
+ "starterTourChannelId",
+ "noticesDue",
+ ].sort(),
);
expect([...(preferences?.required ?? [])].sort()).toEqual(
Object.keys(DEFAULT_USER_PREFERENCES).sort(),
diff --git a/api/openapi-ai-connection.test.ts b/api/openapi-ai-connection.test.ts
new file mode 100644
index 0000000000..f28056b8a9
--- /dev/null
+++ b/api/openapi-ai-connection.test.ts
@@ -0,0 +1,191 @@
+import { expect, test } from "bun:test";
+import { readFileSync } from "node:fs";
+import { join } from "node:path";
+import { parse } from "yaml";
+import {
+ GetAiConnectionResponse,
+ ReplaceAiConnectionBody,
+} from "../app/src/lib/api/generated/models/models.zod";
+
+/**
+ * The AI connection: one per organization, read and switched by an administrator with no restart.
+ * A key goes in once and never comes back out, a bad connection is refused before anything is saved
+ * with one of five stated reasons, and every example the spec shows is one the generated client
+ * accepts, so a fake built from the examples matches what the server answers.
+ */
+
+type Schema = {
+ $ref?: string;
+ properties?: Record;
+ items?: Schema;
+ oneOf?: Schema[];
+ writeOnly?: boolean;
+};
+type Example = { value?: unknown; $ref?: string };
+type Media = { schema: Schema; examples?: Record };
+type Response = { $ref?: string; content?: Record };
+type Operation = {
+ operationId: string;
+ tags?: string[];
+ security?: Record[];
+ parameters?: { $ref: string }[];
+ requestBody?: { content: Record };
+ responses: Record;
+};
+
+const spec = parse(
+ readFileSync(join(import.meta.dir, "openapi.yaml"), "utf8"),
+) as {
+ paths: Record>;
+ components: {
+ schemas: Record;
+ responses: Record;
+ examples: Record;
+ };
+};
+
+const PATH = "/api/v2/organizations/{organizationId}/ai-connection";
+const item = spec.paths[PATH] ?? {};
+const read = item.get;
+const replace = item.put;
+
+function response(ref: Response): Response {
+ if (!ref.$ref) return ref;
+ return spec.components.responses[
+ ref.$ref.replace("#/components/responses/", "")
+ ] as Response;
+}
+function exampleValue(example: Example): unknown {
+ if (!example.$ref) return example.value;
+ return spec.components.examples[
+ example.$ref.replace("#/components/examples/", "")
+ ]?.value;
+}
+function propertyNames(
+ schema: Schema | undefined,
+ seen = new Set(),
+): string[] {
+ if (!schema) return [];
+ if (schema.$ref) {
+ const name = schema.$ref.replace("#/components/schemas/", "");
+ if (seen.has(name)) return [];
+ seen.add(name);
+ return propertyNames(spec.components.schemas[name], seen);
+ }
+ return [
+ ...Object.entries(schema.properties ?? {}).flatMap(([name, property]) => [
+ name,
+ ...propertyNames(property, seen),
+ ]),
+ ...propertyNames(schema.items, seen),
+ ...(schema.oneOf ?? []).flatMap((part) => propertyNames(part, seen)),
+ ];
+}
+
+test("an administrator reads and replaces the one AI connection, a replace taking an Idempotency-Key", () => {
+ expect(read?.operationId).toBe("getAiConnection");
+ expect(replace?.operationId).toBe("replaceAiConnection");
+ expect(read?.tags).toEqual(["Models"]);
+ expect(replace?.tags).toEqual(["Models"]);
+ expect(read?.security).toContainEqual({ appOAuth: ["ai-connection:read"] });
+ expect(replace?.security).toContainEqual({
+ appOAuth: ["ai-connection:write"],
+ });
+ expect(read?.responses["403"]?.$ref).toContain("AdminOnly");
+ expect(replace?.responses["403"]?.$ref).toContain("AdminOnly");
+ expect(replace?.parameters?.map((p) => p.$ref)).toContainEqual(
+ expect.stringContaining("IdempotencyKey"),
+ );
+});
+
+test("no answer has a place for a key, and the key sent is write-only", () => {
+ for (const operation of [read, replace]) {
+ const body =
+ operation?.responses["200"]?.content?.["application/json"]?.schema;
+ expect(body).toBeDefined();
+ const names = propertyNames(body);
+ for (const secret of ["apiKey", "secret", "token", "key"]) {
+ expect(names).not.toContain(secret);
+ }
+ }
+ const input = spec.components.schemas.AiConnectionInput;
+ expect(
+ Object.entries(input?.properties ?? {})
+ .filter(([, property]) => property.writeOnly)
+ .map(([name]) => name),
+ ).toEqual(["apiKey"]);
+});
+
+test("a connection OpenBot can't use is refused with one of five reasons, in OpenBot's own words", () => {
+ const refused = response(replace?.responses["422"] ?? {});
+ const examples = Object.values(
+ refused.content?.["application/problem+json"]?.examples ?? {},
+ ).map((example) => exampleValue(example) as { code: string; detail: string });
+ expect(examples.map((example) => example.code).sort()).toEqual([
+ "AI_CONNECTION_ENGINE_NOT_READY",
+ "AI_CONNECTION_KEY_REFUSED",
+ "AI_CONNECTION_MODEL_UNAVAILABLE",
+ "AI_CONNECTION_SIGN_IN_MISSING",
+ "AI_CONNECTION_UNREACHABLE",
+ ]);
+ for (const example of examples) {
+ expect(example.detail).not.toContain("—");
+ expect(example.detail).toMatch(/\.$/);
+ }
+ const fixed = response(replace?.responses["409"] ?? {});
+ const codes = Object.values(
+ fixed.content?.["application/problem+json"]?.examples ?? {},
+ ).map((example) => (exampleValue(example) as { code: string }).code);
+ expect(codes.sort()).toEqual([
+ "AI_CONNECTION_FIXED",
+ "IDEMPOTENCY_KEY_CONFLICT",
+ ]);
+});
+
+test("every example the spec shows is one the generated client accepts", () => {
+ const answers = [read, replace].flatMap((operation) =>
+ Object.values(
+ operation?.responses["200"]?.content?.["application/json"]?.examples ??
+ {},
+ ),
+ );
+ expect(answers.length).toBeGreaterThanOrEqual(4);
+ for (const example of answers) {
+ expect(
+ GetAiConnectionResponse.safeParse(exampleValue(example)).success,
+ ).toBe(true);
+ }
+ const bodies = Object.values(
+ replace?.requestBody?.content["application/json"]?.examples ?? {},
+ );
+ expect(bodies.length).toBeGreaterThanOrEqual(4);
+ for (const example of bodies) {
+ expect(
+ ReplaceAiConnectionBody.safeParse(exampleValue(example)).success,
+ ).toBe(true);
+ }
+});
+
+test("an endpoint address is http or https with nothing in it that signs in", () => {
+ const endpoint = (baseUrl: string) =>
+ ReplaceAiConnectionBody.safeParse({
+ provider: "openai-compatible",
+ login: "endpoint",
+ baseUrl,
+ model: "llama-5",
+ }).success;
+ expect(endpoint("https://api.example.com/v1")).toBe(true);
+ expect(endpoint("http://127.0.0.1:11434/v1")).toBe(true);
+ expect(endpoint("https://user:secret@api.example.com/v1")).toBe(false);
+ expect(endpoint("https://key@api.example.com")).toBe(false);
+ expect(endpoint("ftp://api.example.com")).toBe(false);
+ expect(endpoint("file:///etc/passwd")).toBe(false);
+ // Unknown fields are refused, so a key can't ride in under another name.
+ expect(
+ (
+ spec.components.schemas.AiConnectionInput as {
+ additionalProperties?: boolean;
+ }
+ ).additionalProperties,
+ ).toBe(false);
+});
diff --git a/api/openapi-extensible-enums.test.ts b/api/openapi-extensible-enums.test.ts
new file mode 100644
index 0000000000..39d184363f
--- /dev/null
+++ b/api/openapi-extensible-enums.test.ts
@@ -0,0 +1,123 @@
+import { expect, test } from "bun:test";
+import { readFileSync } from "node:fs";
+import { join } from "node:path";
+import { parse } from "yaml";
+
+/**
+ * An open enum (`x-extensible-enum`) is only ever in an answer.
+ *
+ * Declaring an enum open lets the server add a value without breaking a client, because every client
+ * reads a value it doesn't know as "other" (api/README.md, Enums that grow). That holds only for what
+ * the server sends. Where a request carries the enum, the server's generated schema for that request
+ * would take any string, so a request could save a value nothing knows. So no parameter and no
+ * request body may reach one, at any depth, and an open enum never has an `enum` beside it.
+ */
+
+type Schema = Record;
+type Spec = {
+ paths: Record>;
+ components: Record>;
+};
+
+const spec = parse(
+ readFileSync(join(import.meta.dir, "openapi.yaml"), "utf8"),
+) as Spec;
+const METHODS = ["get", "post", "put", "patch", "delete"];
+
+function deref(node: unknown): Schema | undefined {
+ let current = node as Schema | undefined;
+ for (let hops = 0; current && typeof current.$ref === "string"; hops++) {
+ if (hops > 20) throw new Error(`A $ref loop at ${String(current.$ref)}`);
+ const path = (current.$ref as string).replace(/^#\//, "").split("/");
+ current = path.reduce(
+ (at, part) => (at as Record | undefined)?.[part],
+ spec,
+ ) as Schema | undefined;
+ }
+ return current;
+}
+
+/** Every open enum `raw` reaches, by where it is. */
+function openEnumsIn(
+ raw: unknown,
+ where: string,
+ seen = new Set(),
+): string[] {
+ const node = deref(raw);
+ if (!node || typeof node !== "object" || seen.has(node)) return [];
+ seen.add(node);
+ const found = "x-extensible-enum" in node ? [where] : [];
+ for (const key of ["allOf", "oneOf", "anyOf"])
+ for (const [index, branch] of ((node[key] as unknown[]) ?? []).entries())
+ found.push(...openEnumsIn(branch, `${where}/${key}/${index}`, seen));
+ for (const [name, property] of Object.entries(
+ (node.properties as Record) ?? {},
+ ))
+ found.push(...openEnumsIn(property, `${where}/${name}`, seen));
+ if (node.items) found.push(...openEnumsIn(node.items, `${where}[]`, seen));
+ if (
+ node.additionalProperties &&
+ typeof node.additionalProperties === "object"
+ )
+ found.push(...openEnumsIn(node.additionalProperties, `${where}{}`, seen));
+ return found;
+}
+
+test("no request reaches an open enum", () => {
+ const reached: string[] = [];
+ for (const [path, item] of Object.entries(spec.paths))
+ for (const method of METHODS) {
+ const operation = item[method];
+ if (!operation) continue;
+ const name = `${method.toUpperCase()} ${path}`;
+ const parameters = [
+ ...((item.parameters as unknown[]) ?? []),
+ ...((operation.parameters as unknown[]) ?? []),
+ ];
+ for (const raw of parameters) {
+ const parameter = deref(raw);
+ reached.push(
+ ...openEnumsIn(
+ parameter?.schema,
+ `${name} ${String(parameter?.in)} ${String(parameter?.name)}`,
+ ),
+ );
+ }
+ const body = deref(operation.requestBody);
+ for (const [type, media] of Object.entries(
+ (body?.content as Record) ?? {},
+ ))
+ reached.push(...openEnumsIn(media.schema, `${name} body ${type}`));
+ }
+ expect(reached).toEqual([]);
+});
+
+test("an open enum has no enum beside it, and lists its values", () => {
+ const wrong: string[] = [];
+ const visit = (node: unknown, where: string) => {
+ if (!node || typeof node !== "object") return;
+ if (Array.isArray(node)) {
+ for (const [index, item] of node.entries())
+ visit(item, `${where}/${index}`);
+ return;
+ }
+ const schema = node as Schema;
+ if ("x-extensible-enum" in schema) {
+ const values = schema["x-extensible-enum"];
+ if ("enum" in schema)
+ wrong.push(`${where} has both enum and x-extensible-enum`);
+ if (
+ !Array.isArray(values) ||
+ values.length === 0 ||
+ values.includes(null)
+ )
+ wrong.push(
+ `${where} lists no values, or lists null: say null in its type instead`,
+ );
+ }
+ for (const [key, value] of Object.entries(schema))
+ visit(value, `${where}/${key}`);
+ };
+ visit(spec, "#");
+ expect(wrong).toEqual([]);
+});
diff --git a/api/openapi-schedules.test.ts b/api/openapi-schedules.test.ts
index ddc8e752b4..6cca497067 100644
--- a/api/openapi-schedules.test.ts
+++ b/api/openapi-schedules.test.ts
@@ -75,8 +75,8 @@ function answered(operation: Operation): string[] {
);
}
-test("the area has its 37 operations", () => {
- expect(operations).toHaveLength(37);
+test("the area has its 38 operations", () => {
+ expect(operations).toHaveLength(38);
});
test("only the operations that make, replace or read a trigger's secret answer one", () => {
diff --git a/api/openapi-text-patterns.test.ts b/api/openapi-text-patterns.test.ts
new file mode 100644
index 0000000000..584a2b7dff
--- /dev/null
+++ b/api/openapi-text-patterns.test.ts
@@ -0,0 +1,50 @@
+import { expect, test } from "bun:test";
+import { readFileSync } from "node:fs";
+import { join } from "node:path";
+import { parse } from "yaml";
+
+// The server keeps no text with a NUL in it ("That text has a character OpenBot can't keep"), and
+// the spec says so with patterns that refuse it. A pattern that refuses NUL anywhere must refuse it
+// everywhere: `^[^\x00]*\S[^\x00]*$` let its one non-space character be a NUL, because `\S` matches
+// one, so a request the server refuses read as valid to every client and test generated from it.
+
+const spec = parse(
+ readFileSync(join(import.meta.dir, "openapi.yaml"), "utf8"),
+ { maxAliasCount: -1 },
+);
+
+/** Every `pattern` in the spec, by where it is. */
+function patterns(node: unknown, where = ""): [string, string][] {
+ if (Array.isArray(node))
+ return node.flatMap((item, index) => patterns(item, `${where}/${index}`));
+ if (!node || typeof node !== "object") return [];
+ return Object.entries(node as Record).flatMap(
+ ([key, value]): [string, string][] =>
+ key === "pattern" && typeof value === "string"
+ ? [[where, value]]
+ : patterns(value, `${where}/${key}`),
+ );
+}
+
+// Text with a NUL in it, beside what each pattern takes otherwise: a single character, a prefixed
+// scope (`team:`, `group:`), or nothing else.
+const WITH_NUL = [
+ "\u0000",
+ "a\u0000",
+ "\u0000a",
+ "team:\u0000",
+ "group:\u0000",
+];
+
+test("no pattern that keeps NUL out lets one through", () => {
+ const refusingNul = patterns(spec).filter(([, pattern]) =>
+ pattern.includes("[^\\x00]"),
+ );
+ expect(refusingNul.length).toBeGreaterThan(0);
+ const lets = refusingNul.flatMap(([where, pattern]) =>
+ WITH_NUL.filter((text) => new RegExp(pattern, "u").test(text)).map(
+ (text) => `${where}: ${pattern} takes ${JSON.stringify(text)}`,
+ ),
+ );
+ expect(lets).toEqual([]);
+});
diff --git a/api/openapi.yaml b/api/openapi.yaml
index b7f7a8ebb4..058774ef9c 100644
--- a/api/openapi.yaml
+++ b/api/openapi.yaml
@@ -14,6 +14,8 @@ info:
An install for one person on one computer has no sign-in. It signs nobody in, so it has neither OAuth nor API keys, and the operations that manage keys and sessions answer 503 with the code SIGN_IN_UNAVAILABLE.
+ OpenBot's own apps name themselves on every request in the header `OpenBot-Client`: `/`, where kind is web, desktop, mobile or recorder, such as `OpenBot-Client: desktop/1.1.0`. A header may name more than one, separated by spaces: OpenBot Desktop adds its own to the one its window's page sent. getDeployment says which API versions this OpenBot serves and the oldest release of each app it serves (minimumClients). Every other operation under /api/v2 refuses an app older than that with 400 and the code CLIENT_UPDATE_REQUIRED, whose problem names the app (client) and its minimum (minimumVersion) and whose detail tells the person to update OpenBot. When that minimum was raised because of a security problem in older releases, the problem also says security: true, and getDeployment lists it under securityMinimumClients. A program of your own need not send the header; without it nothing is refused for a version.
+
This file is the single source of truth: the clients, the server's types, the docs and the contract tests are all generated from it or checked against it. A change that breaks an existing client fails the pull request.
servers:
- url: http://127.0.0.1:3001
@@ -1690,7 +1692,7 @@ paths:
- Organization settings
operationId: getDeployment
summary: Read what this OpenBot offers
- description: 'Return what this OpenBot offers and how people sign in to it: the edition, the features the apps draw, and the sign-in options. Anybody may read it, signed in or not, because the sign-in screen reads it first. Signed in, it is answered in an organization the caller is a member of, and an organization they are not in, the organization `default` included, answers exactly as one that does not exist. Nobody signed in reads it in the organization `default`. It names no identity provider and no version: only whether single sign-on is set up and required.'
+ description: 'Return what this OpenBot offers and how people sign in to it: the edition, the features the apps draw, how large an attached file may be, and the sign-in options. Anybody may read it, signed in or not, because the sign-in screen reads it first. Signed in, it is answered in an organization the caller is a member of, and an organization they are not in, the organization `default` included, answers exactly as one that does not exist. Nobody signed in reads it in the organization `default`. It names no identity provider and no build: only whether single sign-on is set up and required, and which API versions and which releases of each OpenBot app it serves. It is never refused for the app''s version, so an app reads it first to learn whether it, or the OpenBot, needs an update.'
x-openbot-singleton: true
security:
- {}
@@ -3519,7 +3521,7 @@ paths:
- Conversations
operationId: getAttachment
summary: Download an attachment
- description: Return the bytes of a file attached to a message, in the type OpenBot recognised it as. Only somebody in the conversation it was sent in, or the person still holding it to send, can read it.
+ description: Return the bytes of a file attached to a message, in the type OpenBot recognised it as. Only somebody in the conversation it was sent in, or the person still holding it to send, can read it. A picture is served to open in place. Every other file, a PDF or a Word, Excel or PowerPoint file among them, is served as a download.
security:
- webSession: []
- appOAuth:
@@ -4369,6 +4371,131 @@ paths:
$ref: '#/components/responses/ServerError'
default:
$ref: '#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/ai-connection:
+ parameters:
+ - $ref: '#/components/parameters/OrganizationId'
+ get:
+ tags:
+ - Models
+ operationId: getAiConnection
+ summary: Read how OpenBot reaches its AI provider
+ description: Return the AI provider OpenBot's Bots run on, the way OpenBot signs in to it, the model or address host where one was named, and whether a run can use it now. Never a key. Also which other connections still have a key kept, so they can be used again without pasting it. Where whoever runs OpenBot sets the provider, editable is false and the connection can't be changed here. Only an administrator of the organization may read it.
+ x-openbot-singleton: true
+ security:
+ - webSession: []
+ - appOAuth:
+ - ai-connection:read
+ - apiKey: []
+ responses:
+ '200':
+ description: How OpenBot reaches its AI provider. Never a key.
+ headers:
+ Cache-Control:
+ $ref: '#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AiConnection'
+ examples:
+ apiKey:
+ $ref: '#/components/examples/AiConnectionExample'
+ endpoint:
+ $ref: '#/components/examples/AiConnectionEndpointExample'
+ fixed:
+ $ref: '#/components/examples/AiConnectionFixedExample'
+ none:
+ $ref: '#/components/examples/AiConnectionNoneExample'
+ '400':
+ $ref: '#/components/responses/InvalidRequest'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/AdminOnly'
+ '404':
+ $ref: '#/components/responses/OrganizationNotFound'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
+ put:
+ tags:
+ - Models
+ operationId: replaceAiConnection
+ summary: Change how OpenBot reaches its AI provider
+ description: 'Switch the AI provider OpenBot''s Bots run on, with no restart. OpenBot checks the connection with the provider first: a key, an address or a sign-in it can''t use is refused, nothing is saved, and the connection in use keeps running. Once saved, the next run uses it, and runs already going finish on the one they started with. A key goes into the organization''s vault and is never sent back; the key of the connection it replaces stays kept, so it can be used again (saved). Recorded on the audit trail, never with a key. Only an administrator of the organization may change it, and not where whoever runs OpenBot sets the provider.'
+ security:
+ - webSession: []
+ - appOAuth:
+ - ai-connection:write
+ - apiKey: []
+ parameters:
+ - $ref: '#/components/parameters/IdempotencyKey'
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AiConnectionInput'
+ examples:
+ apiKey:
+ value:
+ provider: anthropic
+ login: api-key
+ apiKey: sk-ant-example
+ savedKey:
+ value:
+ provider: openai
+ login: api-key
+ useSavedKey: true
+ endpoint:
+ value:
+ provider: google
+ login: endpoint
+ apiKey: example-gemini-key
+ baseUrl: https://generativelanguage.googleapis.com/v1beta/openai
+ model: gemini-3-pro
+ signIn:
+ value:
+ provider: xai
+ login: oauth
+ model: grok-5
+ plan:
+ value:
+ provider: anthropic
+ login: plan
+ responses:
+ '200':
+ description: The connection, as saved and in use. Never a key.
+ headers:
+ Cache-Control:
+ $ref: '#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AiConnection'
+ examples:
+ apiKey:
+ $ref: '#/components/examples/AiConnectionExample'
+ endpoint:
+ $ref: '#/components/examples/AiConnectionEndpointExample'
+ '400':
+ $ref: '#/components/responses/InvalidAiConnection'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/AdminOnly'
+ '404':
+ $ref: '#/components/responses/OrganizationNotFound'
+ '409':
+ $ref: '#/components/responses/AiConnectionFixed'
+ '422':
+ $ref: '#/components/responses/AiConnectionRefused'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ '503':
+ $ref: '#/components/responses/CredentialsUnavailable'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
/api/v2/organizations/{organizationId}/apps:
parameters:
- $ref: '#/components/parameters/OrganizationId'
@@ -8482,7 +8609,7 @@ paths:
- Routines
operationId: createRoutine
summary: Create a routine
- description: 'Create a routine owned by the caller: the Bot carries out the instruction on the schedule and posts in the conversation, which must be one the caller and the Bot share. With goalId it is the routine that runs that goal on a schedule. A person may have 20 routines switched on, and a routine runs at most once an hour. There is no operation to change a routine: that is done by asking its Bot. A repeated request with the same Idempotency-Key and body returns the first result.'
+ description: 'Create a routine owned by the caller: the Bot carries out the instruction on the schedule and posts in the conversation, which must be one the caller and the Bot share. With goalId it is the routine that runs that goal on a schedule. A person may have 20 routines switched on, and a routine runs at most once an hour. updateRoutine changes one. A repeated request with the same Idempotency-Key and body returns the first result.'
security:
- webSession: []
- appOAuth:
@@ -8536,6 +8663,57 @@ paths:
parameters:
- $ref: '#/components/parameters/OrganizationId'
- $ref: '#/components/parameters/RoutineId'
+ patch:
+ tags:
+ - Routines
+ operationId: updateRoutine
+ summary: Change a routine
+ description: 'Change one of the caller''s routines: its name, what the Bot does, its schedule or its time zone. Only the fields sent change. It keeps its id, its conversation and its runs. A new schedule or time zone follows the same rules as a new routine''s, and its next run is worked out from now. One that does not exist, or is somebody else''s, is not found. A repeated request with the same Idempotency-Key and body returns the first result.'
+ security:
+ - webSession: []
+ - appOAuth:
+ - routines:write
+ - apiKey: []
+ parameters:
+ - $ref: '#/components/parameters/IdempotencyKey'
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UpdateRoutineRequest'
+ examples:
+ request:
+ value:
+ instruction: Summarize my unread mail, today's calendar and the weather.
+ cron: 30 8 * * 1-5
+ responses:
+ '200':
+ description: The routine, as saved.
+ headers:
+ Cache-Control:
+ $ref: '#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/RoutineResponse'
+ examples:
+ answer:
+ $ref: '#/components/examples/RoutineResponseExample'
+ '400':
+ $ref: '#/components/responses/InvalidRoutine'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '404':
+ $ref: '#/components/responses/RoutineNotFound'
+ '409':
+ $ref: '#/components/responses/IdempotencyConflict'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
delete:
tags:
- Routines
@@ -17554,6 +17732,50 @@ paths:
$ref: '#/components/responses/ServerError'
default:
$ref: '#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/nudge-events:
+ parameters:
+ - $ref: '#/components/parameters/OrganizationId'
+ post:
+ tags:
+ - Product events
+ operationId: recordNudgeEvent
+ summary: Record what the caller did with a nudge
+ description: 'Tell OpenBot that a nudge (a notice OpenBot shows a person once, such as the ask to star OpenBot on GitHub) was shown to the caller, that they followed it, or that they dismissed it, and where. OpenBot adds the moment that made it due, from what it already knows about the caller, so the counts say which moment works. It is best effort: a client sends one per show or answer and waits on nothing. Saving the answer is a separate change to the caller''s preferences (`dismissedNotices`). The event counts for the caller and names nothing else. Where this OpenBot has product telemetry switched off, it is accepted and dropped.'
+ security:
+ - webSession: []
+ - appOAuth:
+ - conversations:write
+ - apiKey: []
+ parameters:
+ - $ref: '#/components/parameters/IdempotencyKey'
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NudgeEvent'
+ examples:
+ clicked:
+ $ref: '#/components/examples/NudgeClicked'
+ responses:
+ '204':
+ description: The event is accepted.
+ '400':
+ $ref: '#/components/responses/InvalidRequest'
+ '401':
+ $ref: '#/components/responses/Unauthenticated'
+ '403':
+ $ref: '#/components/responses/Forbidden'
+ '404':
+ $ref: '#/components/responses/OrganizationNotFound'
+ '409':
+ $ref: '#/components/responses/IdempotencyConflict'
+ '413':
+ $ref: '#/components/responses/PayloadTooLarge'
+ '500':
+ $ref: '#/components/responses/ServerError'
+ default:
+ $ref: '#/components/responses/UnexpectedError'
/api/v2/organizations/{organizationId}/settings/learning:
parameters:
- $ref: '#/components/parameters/OrganizationId'
@@ -20038,6 +20260,8 @@ components:
model-catalogue:read: Read the models Bots can run on.
model-choices:read: Read the model the signed-in person chose for each of their conversations.
model-choices:write: Choose the model the signed-in person's conversations answer on.
+ ai-connection:read: Read how OpenBot reaches its AI provider, never a key, when the signed-in person is an administrator.
+ ai-connection:write: Change how OpenBot reaches its AI provider, when the signed-in person is an administrator.
apps:read: Read the apps the organization has added, the directory of apps it can add, and how apps are set up here.
apps:write: Add, change, refresh and remove apps, when the signed-in person may.
connections:read: Read the signed-in person's connections to apps, and each app's shared account.
@@ -20174,7 +20398,7 @@ components:
type: string
minLength: 1
maxLength: 206
- pattern: ^(organization|team:[^\x00]*\S[^\x00]*|group:[^\x00]*\S[^\x00]*)$
+ pattern: ^(organization|team:[^\x00]*[^\s\x00][^\x00]*|group:[^\x00]*[^\s\x00][^\x00]*)$
BotId:
name: botId
in: path
@@ -21111,13 +21335,14 @@ components:
$ref: '#/components/schemas/BotInstructions'
harness:
type: string
- description: 'The framework an agent somebody runs themselves is built on, by its id in OpenBot''s harness list (shared/harnesses.json), which the server checks every create against. Empty means none was named, as for an agent somebody already runs. "byo-url" is not one: it names no framework. Kept only with an endpoint.'
+ description: 'The framework an agent somebody runs themselves is built on, by its id in OpenBot''s harness list (shared/harnesses.json), which the server checks every create against. Empty means none was named, as for an agent somebody already runs. "byo-url" is not one: it names no framework. Kept only with an endpoint, with one exception: "langgraph-ts" sent with no endpoint asks for a Bot that runs inside OpenBot on OpenBot''s own LangGraph (TypeScript) engine, which is what the New Bot sheet sends. The deployment decides what each run uses: a Claude plan keeps the Claude Agent SDK engine, and an administrator may switch new Bots back to the built-in agent.'
enum:
- ''
- crewai
- llamaindex
- agno
- langgraph
+ - langgraph-ts
- google-adk
- antigravity
- pydantic-ai
@@ -21437,6 +21662,20 @@ components:
- admin
- member
description: 'The person''s role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.'
+ PersonRoleAnswer:
+ type: string
+ x-extensible-enum:
+ - owner
+ - admin
+ - member
+ description: 'The person''s role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn''t know as a member.'
+ NoticeId:
+ type: string
+ minLength: 1
+ maxLength: 64
+ pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
+ description: 'A notice OpenBot shows a person once, such as a nudge, by its id: star-on-github is the ask to star OpenBot on GitHub.'
+ example: star-on-github
AssignableRole:
type: string
enum:
@@ -21494,7 +21733,7 @@ components:
- 'null'
description: The picture their identity provider gave, when it gave one.
role:
- $ref: '#/components/schemas/PersonRole'
+ $ref: '#/components/schemas/PersonRoleAnswer'
needsName:
type: boolean
description: Whether they have still to choose what OpenBot calls them, because their name is missing or is only their address.
@@ -21627,6 +21866,7 @@ components:
required:
- messageListEmphasis
- selfHostBannerDismissed
+ - dismissedNotices
- narration
- skin
- proactive
@@ -21636,6 +21876,21 @@ components:
selfHostBannerDismissed:
type: boolean
description: Whether they closed the banner offering help self-hosting OpenBot.
+ dismissedNotices:
+ type: array
+ maxItems: 64
+ uniqueItems: true
+ description: The notices they answered, either way, by id. A notice in this list is never shown to them again, on any device. Empty until they answer one.
+ items:
+ $ref: '#/components/schemas/NoticeId'
+ noticesDue:
+ type: array
+ readOnly: true
+ maxItems: 64
+ uniqueItems: true
+ description: The notices OpenBot would show them now, by id, worked out by the server from the edition and how they have used OpenBot. A notice they dismissed is never here. Absent from a server that works out none.
+ items:
+ $ref: '#/components/schemas/NoticeId'
narration:
description: Whether they narrate their recordings in OpenBot's browser, which opens the microphone only when on. Null until they choose, which the browser asks before their first recording.
oneOf:
@@ -21660,6 +21915,13 @@ components:
$ref: '#/components/schemas/MessageListEmphasis'
selfHostBannerDismissed:
type: boolean
+ dismissedNotices:
+ type: array
+ maxItems: 64
+ uniqueItems: true
+ description: 'Notices they answered, by id. Added to the ones already dismissed: a notice is never taken back off the list.'
+ items:
+ $ref: '#/components/schemas/NoticeId'
narration:
$ref: '#/components/schemas/OnOff'
skin:
@@ -21842,7 +22104,7 @@ components:
description: Who they are there, such as their GitHub login, when the service said.
status:
type: string
- enum:
+ x-extensible-enum:
- active
- needs_reconnect
description: needs_reconnect when the service stopped accepting what the link holds, and linking again mends it.
@@ -22010,7 +22272,7 @@ components:
type: string
minLength: 1
maxLength: 2048
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
IdentityProviderAddress:
type: string
format: uri
@@ -22043,7 +22305,7 @@ components:
type: string
minLength: 1
maxLength: 200000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The provider's SAML metadata XML, as its identity team supplied it.
OidcIdentityProviderRequest:
type: object
@@ -22073,13 +22335,13 @@ components:
type: string
minLength: 1
maxLength: 200
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: An id for the provider, unique in the organization, such as acme-okta.
IdentityProviderDomains:
type: string
minLength: 1
maxLength: 2048
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The email domain whose people it signs in, such as acme.com. Several are separated by commas.
CreateIdentityProviderRequest:
description: A SAML or an OIDC provider, by protocol.
@@ -22157,11 +22419,33 @@ components:
botComputers:
type: boolean
description: 'Whether this OpenBot has computers for Bots at all. False, a Bot has no computer, browser or sign-in to a website, and the computers answer 503 to every call. Not isolatedBots: an OpenBot whose Bots share one computer has computers (true) and cannot give a Bot one of its own (isolatedBots false).'
+ attachmentLimits:
+ $ref: '#/components/schemas/AttachmentLimits'
+ api:
+ type: array
+ description: 'The API versions this OpenBot serves, by major, such as v2. An app that speaks none of them can''t use it: when they are all newer than the app''s, the app needs an update; when they are all older, this OpenBot does. Absent from a release before it was published, which serves v2.'
+ minItems: 1
+ items:
+ type: string
+ pattern: ^v[1-9][0-9]{0,3}$
+ minimumClients:
+ $ref: '#/components/schemas/MinimumClients'
+ securityMinimumClients:
+ $ref: '#/components/schemas/MinimumClients'
+ description: 'The part of minimumClients raised because of a security problem in older releases: for each app named, the minimum is there for security. Absent or empty when none is.'
+ launcherApi:
+ type: integer
+ minimum: 1
+ description: The version of what OpenBot Desktop supplies when it starts this OpenBot on its own computer. It changes when Desktop must supply something new.
+ extensionApi:
+ type: integer
+ minimum: 1
+ description: The version of what the OpenBot Recorder and this OpenBot exchange.
AllowlistEntry:
type: string
minLength: 1
maxLength: 200
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
OrganizationSettingValues:
type: object
description: 'The organization''s settings. Context is read only: it comes back with the settings and is never sent.'
@@ -22310,6 +22594,13 @@ components:
actionRecordRetentionDays:
type: integer
description: How many days recorded computer actions are kept.
+ computerMode:
+ type: string
+ enum:
+ - per-person
+ - shared
+ - none
+ description: 'How Bots get computers here. per-person: each person has a computer of their own, and so does each isolated Bot; an OpenBot only one person uses answers this too. shared: every person''s Bots run on one computer, so a command one Bot runs can read another person''s files there. That suits a proof of concept, not people''s real work. none: Bots have no computers. Absent from a server that predates it.'
UpdateOrganizationSettingsRequest:
allOf:
- $ref: '#/components/schemas/OrganizationSettingValues'
@@ -22465,7 +22756,7 @@ components:
propertyNames:
minLength: 1
maxLength: 200
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
additionalProperties:
$ref: '#/components/schemas/SwitchValue'
teams:
@@ -22476,7 +22767,7 @@ components:
propertyNames:
minLength: 1
maxLength: 200
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
additionalProperties:
$ref: '#/components/schemas/SwitchValue'
CapabilityChange:
@@ -22519,7 +22810,7 @@ components:
type: string
minLength: 1
maxLength: 2000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
CapabilityChangesToPreview:
type: object
additionalProperties: false
@@ -22594,7 +22885,7 @@ components:
type: string
minLength: 1
maxLength: 1000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The change in a sentence or two, at most 1,000 characters once trimmed.
RuleCheck:
type: object
@@ -22672,7 +22963,7 @@ components:
type: boolean
decidedBy:
type: string
- enum:
+ x-extensible-enum:
- default
- organization
- role
@@ -22713,7 +23004,7 @@ components:
- string
- 'null'
role:
- $ref: '#/components/schemas/PersonRole'
+ $ref: '#/components/schemas/PersonRoleAnswer'
groups:
type: array
items:
@@ -22869,7 +23160,7 @@ components:
description: organization, team: for a team, or group: for a directory group.
scopeKind:
type: string
- enum:
+ x-extensible-enum:
- organization
- group
- team
@@ -23325,6 +23616,20 @@ components:
description: 'What is wrong, item by item, when a refusal has more than one reason: each entry names the item and says what is wrong with it.'
items:
type: object
+ client:
+ type: string
+ x-extensible-enum:
+ - web
+ - desktop
+ - mobile
+ - recorder
+ description: On CLIENT_UPDATE_REQUIRED, the app the OpenBot-Client header named that is older than this OpenBot serves. A later OpenBot may name another app; read one you don't know as other.
+ minimumVersion:
+ type: string
+ description: On CLIENT_UPDATE_REQUIRED, the oldest release of that app this OpenBot serves.
+ security:
+ type: boolean
+ description: On CLIENT_UPDATE_REQUIRED, true when the minimum the app is below was raised because of a security problem in older releases.
ConversationJoinToken:
type: object
description: 'What a client needs to watch a conversation live: a token, and the socket and topic to use it on (the threadStream channel of api/asyncapi.yaml).'
@@ -23579,6 +23884,8 @@ components:
type:
- string
- 'null'
+ unverified:
+ $ref: '#/components/schemas/UnverifiedModel'
ModelChoiceInput:
type: object
additionalProperties: false
@@ -23671,6 +23978,44 @@ components:
minLength: 1
maxLength: 1000
description: New instructions for the starter Bot, 1 to 1000 characters once trimmed. Absent leaves them as they are; every other Bot ignores them.
+ AttachmentLimits:
+ type: object
+ description: 'How large a file attached to a message may be, by kind, in bytes. An upload over its kind''s limit is refused. Absent, as from an older OpenBot, the limits are 8388608 for an image or a document (a PDF, or a Word, Excel or PowerPoint file) and 1048576 for any other file. The limits can rise while OpenBot runs, so a client reads them again rather than keeping them for good. What a Bot''s model is shown of a large file is a separate matter: the file is kept and can be downloaded whatever the model can read of it.'
+ required:
+ - imageBytes
+ - documentBytes
+ - fileBytes
+ properties:
+ imageBytes:
+ type: integer
+ minimum: 1
+ description: The largest image.
+ documentBytes:
+ type: integer
+ minimum: 1
+ description: 'The largest document: a PDF, or a Word, Excel or PowerPoint file (.docx, .xlsx, .pptx).'
+ fileBytes:
+ type: integer
+ minimum: 1
+ description: The largest text file, or a file of any other kind.
+ ClientRelease:
+ type: string
+ description: An OpenBot release, such as 1.1.0.
+ pattern: ^\d{1,6}\.\d{1,6}\.\d{1,6}(-[0-9A-Za-z.-]{1,64})?$
+ examples:
+ - 1.1.0
+ MinimumClients:
+ type: object
+ description: The oldest release of each OpenBot app this OpenBot serves. An app names itself in the OpenBot-Client header, and one older than its minimum here is refused with CLIENT_UPDATE_REQUIRED, everywhere but this deployment answer. An app not listed has no minimum. An OpenBot serves every app released in the last 12 months, so it names one only where its administrator raised it. Absent from a release before it was published.
+ properties:
+ web:
+ $ref: '#/components/schemas/ClientRelease'
+ desktop:
+ $ref: '#/components/schemas/ClientRelease'
+ mobile:
+ $ref: '#/components/schemas/ClientRelease'
+ recorder:
+ $ref: '#/components/schemas/ClientRelease'
ConversationWork:
type: object
description: 'Something still owed an answer in a conversation: another Bot that was asked and has not answered (handoff), or a routine running into it (routine).'
@@ -24057,6 +24402,27 @@ components:
personId:
type: string
description: The person who is now in the conversation.
+ Attachment:
+ type: object
+ description: A file held for a message, or sent with one.
+ required:
+ - id
+ - name
+ - mimeType
+ - sizeBytes
+ properties:
+ id:
+ type: string
+ description: The attachment's id.
+ name:
+ type: string
+ description: The file's name.
+ mimeType:
+ type: string
+ description: The type OpenBot recognised it as.
+ sizeBytes:
+ type: integer
+ minimum: 0
ConversationMessage:
type: object
description: 'One thing said in a conversation: a person''s message, or one Bot''s reply.'
@@ -24095,7 +24461,7 @@ components:
description: What was said. Empty while another person's Bot is still writing it.
status:
type: string
- enum:
+ x-extensible-enum:
- queued
- running
- waiting
@@ -24110,7 +24476,10 @@ components:
description: When it was said. Null where the time was not kept.
reason:
type: string
- description: Why a waiting Bot is waiting.
+ description: Why a waiting Bot is waiting, in words for the person reading the conversation.
+ declined:
+ type: boolean
+ description: True on a failed Bot reply in a group that the person whose turn it answered chose not to share. It was a choice, not a fault, and nothing was sent. text says whose choice it was.
answeredBy:
type: string
description: 'For an answer passed on from another Bot: which Bot answered.'
@@ -24129,6 +24498,12 @@ components:
type: integer
minimum: 0
description: How many tools the Bot called in this message, when it called any.
+ files:
+ type: array
+ maxItems: 20
+ description: In a group conversation, the files a Bot sent from its computer with this reply, in the order it sent them. Each is an attachment of the conversation, read at its attachment address by anyone in it.
+ items:
+ $ref: '#/components/schemas/Attachment'
ConversationMessagePage:
type: object
required:
@@ -24195,27 +24570,6 @@ components:
type: string
description: Names the message being written, so the files of two windows are counted apart.
maxLength: 200
- Attachment:
- type: object
- description: A file held for a message, or sent with one.
- required:
- - id
- - name
- - mimeType
- - sizeBytes
- properties:
- id:
- type: string
- description: The attachment's id.
- name:
- type: string
- description: The file's name.
- mimeType:
- type: string
- description: The type OpenBot recognised it as.
- sizeBytes:
- type: integer
- minimum: 0
VoiceCallRequest:
type: object
additionalProperties: false
@@ -24426,7 +24780,7 @@ components:
description: The id that live updates about this thread carry. Compare an incoming update with this one, and use threadId everywhere else. It is threadId itself in the organization default. Left out by a server that names threads one way only, where it is threadId.
TaskStatus:
type: string
- enum:
+ x-extensible-enum:
- needs_input
- working
- resolved
@@ -24689,6 +25043,149 @@ components:
text:
type: string
description: What was said.
+ UnverifiedModel:
+ type: object
+ description: The model a person chose for this conversation, set aside because it hasn't been checked to work with the client this Bot's harness ships. Runs answer on the default model until it has been. Absent when the choice is in use, or set aside for another reason.
+ required:
+ - model
+ - label
+ properties:
+ model:
+ type: string
+ description: The chosen model's id.
+ label:
+ type: string
+ description: Its name, as a model picker shows it.
+ AiConnectionProvider:
+ type: string
+ description: 'The AI provider OpenBot''s Bots run on. openai: OpenAI. anthropic: Anthropic. google: Google Gemini. xai: xAI. unbiased: Unbiased AI. openai-compatible: any server that speaks OpenAI''s API, at an address given.'
+ enum:
+ - openai
+ - anthropic
+ - google
+ - xai
+ - unbiased
+ - openai-compatible
+ AiConnectionLogin:
+ type: string
+ description: 'How OpenBot signs in to the provider. plan: the person''s Claude or ChatGPT plan (openai, anthropic). api-key: a key from the provider (openai, anthropic). endpoint: an address and, where it asks for one, a key (google, xai, unbiased, openai-compatible). oauth: the person''s Google or xAI sign-in (google, xai).'
+ enum:
+ - plan
+ - api-key
+ - endpoint
+ - oauth
+ AiConnectionSaved:
+ type: object
+ description: A connection with a key still kept in the vault, which can be used again without pasting the key (useSavedKey). Never the key.
+ required:
+ - provider
+ - login
+ - endpointHost
+ properties:
+ provider:
+ $ref: '#/components/schemas/AiConnectionProvider'
+ login:
+ $ref: '#/components/schemas/AiConnectionLogin'
+ endpointHost:
+ type:
+ - string
+ - 'null'
+ description: The host of its address, for an endpoint. Null for an API key.
+ AiConnection:
+ type: object
+ description: 'How OpenBot reaches its AI provider: who, how it signs in, and whether a run can use it now. Never a key.'
+ required:
+ - provider
+ - login
+ - model
+ - endpointHost
+ - keySet
+ - ready
+ - source
+ - editable
+ - saved
+ - changedAt
+ properties:
+ provider:
+ description: The provider. Null while none is chosen yet.
+ oneOf:
+ - $ref: '#/components/schemas/AiConnectionProvider'
+ - type: 'null'
+ login:
+ description: How OpenBot signs in to it. Null while none is chosen yet.
+ oneOf:
+ - $ref: '#/components/schemas/AiConnectionLogin'
+ - type: 'null'
+ model:
+ type:
+ - string
+ - 'null'
+ description: The model named for an endpoint or a sign-in. Null for an API key or a plan, where the model catalogue offers the provider's models.
+ endpointHost:
+ type:
+ - string
+ - 'null'
+ description: The host of the endpoint's address, never its path, query or anything that signs in. Null unless the login is endpoint.
+ keySet:
+ type: boolean
+ description: Whether a live key for this connection is kept in the vault.
+ ready:
+ type: boolean
+ description: 'Whether a run can use it now: its key is kept, its sign-in can be read, or its plan''s engine answers.'
+ source:
+ type: string
+ enum:
+ - stored
+ - environment
+ - none
+ description: 'stored: set here, or carried over from how OpenBot was set up. environment: set by whoever runs OpenBot, in its configuration. none: nothing set yet.'
+ editable:
+ type: boolean
+ description: 'Whether an administrator can change it here. False where whoever runs OpenBot sets the provider: its key is changed in the vault.'
+ saved:
+ type: array
+ description: The connections with a key still kept in the vault, so a switch to one of them needs no key pasted.
+ items:
+ $ref: '#/components/schemas/AiConnectionSaved'
+ changedAt:
+ type:
+ - string
+ - 'null'
+ format: date-time
+ description: When it was last changed. Null if never.
+ AiConnectionInput:
+ type: object
+ additionalProperties: false
+ description: The connection to switch to. openai and anthropic take plan or api-key; google and xai take endpoint or oauth; unbiased and openai-compatible take endpoint. Any other pair is refused.
+ required:
+ - provider
+ - login
+ properties:
+ provider:
+ $ref: '#/components/schemas/AiConnectionProvider'
+ login:
+ $ref: '#/components/schemas/AiConnectionLogin'
+ apiKey:
+ type: string
+ minLength: 1
+ maxLength: 65536
+ writeOnly: true
+ description: 'The provider''s key. Required for api-key unless useSavedKey; optional for an endpoint that asks for none. Encrypted into the vault before anything else, and never sent back: no answer includes it, now or later.'
+ useSavedKey:
+ type: boolean
+ description: Use the key already kept for this provider (and, for an endpoint, this address) instead of sending one.
+ baseUrl:
+ type: string
+ format: uri
+ maxLength: 2048
+ pattern: ^https?://[^@/?#]+([/?#].*)?$
+ description: The endpoint's address, http or https, with nothing in it that signs in. Required for endpoint.
+ model:
+ type: string
+ minLength: 1
+ maxLength: 500
+ pattern: \S
+ description: The model to run on. Required for endpoint and oauth. Trimmed.
AppSource:
type: string
enum:
@@ -25993,7 +26490,7 @@ components:
type: string
minLength: 1
maxLength: 2000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
approval:
$ref: '#/components/schemas/SharedAccountApproval'
BotGrantChangesSaved:
@@ -26028,7 +26525,7 @@ components:
type: string
minLength: 1
maxLength: 1000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: What the Bot may do in the app, in a sentence or two, at most 1,000 characters once trimmed.
BotGrantCheck:
type: object
@@ -26478,7 +26975,7 @@ components:
status:
type: string
description: 'Read only: waiting, approved, dismissed, or withdrawn by the person who asked. Answering a request is approveAppAccessRequest or dismissAppAccessRequest.'
- enum:
+ x-extensible-enum:
- pending
- approved
- dismissed
@@ -27387,7 +27884,7 @@ components:
description: 'What was sent: a Bot''s reply, a question it asked, an approval it needs, or what the person''s Bots'' check-ins found that needs them.'
DeliveryState:
type: string
- enum:
+ x-extensible-enum:
- queued
- running
- accepted
@@ -27598,12 +28095,11 @@ components:
type:
- string
- 'null'
- enum:
+ x-extensible-enum:
- succeeded
- failed
- skipped
- waiting
- - null
description: How it ended, or null while it is still open. Only failed is a failure.
at:
type:
@@ -27618,6 +28114,7 @@ components:
- id
- botId
- schedule
+ - cron
- timezone
- instruction
- title
@@ -27637,6 +28134,9 @@ components:
schedule:
type: string
description: When it runs, as text to show.
+ cron:
+ type: string
+ description: 'The schedule as it is kept, five cron fields: minute, hour, day of month, month, day of week. What a form that changes the schedule starts from.'
timezone:
type: string
description: The IANA time zone the schedule is read in.
@@ -27741,6 +28241,34 @@ components:
properties:
routine:
$ref: '#/components/schemas/Routine'
+ UpdateRoutineRequest:
+ type: object
+ additionalProperties: false
+ minProperties: 1
+ description: What to change. Only the fields sent change, and at least one must be sent.
+ properties:
+ title:
+ type: string
+ description: A new name, at most 100 characters. Empty takes the name away, and the routine is called by what it does.
+ maxLength: 100
+ instruction:
+ type: string
+ minLength: 1
+ maxLength: 2000
+ pattern: \S
+ description: What the Bot does on each run from now on. At most 2,000 characters.
+ cron:
+ type: string
+ minLength: 1
+ maxLength: 200
+ pattern: \S
+ description: 'A new schedule, as five cron fields: minute, hour, day of month, month, day of week. The same rules as a new routine''s.'
+ timezone:
+ type: string
+ minLength: 1
+ maxLength: 100
+ pattern: \S
+ description: A new IANA time zone to read the schedule in.
RoutineSwitch:
type: object
required:
@@ -27777,7 +28305,7 @@ components:
description: The run's id.
status:
type: string
- enum:
+ x-extensible-enum:
- running
- succeeded
- failed
@@ -27945,7 +28473,7 @@ components:
description: When it last ran, or null.
lastStatus:
type: string
- enum:
+ x-extensible-enum:
- idle
- running
- succeeded
@@ -28123,7 +28651,7 @@ components:
description: Where it can be opened, or null.
status:
type: string
- enum:
+ x-extensible-enum:
- open
- dismissed
- started
@@ -28411,7 +28939,7 @@ components:
description: When it is done. May be empty.
status:
type: string
- enum:
+ x-extensible-enum:
- active
- paused
- completed
@@ -28590,7 +29118,7 @@ components:
description: The run's id.
status:
type: string
- enum:
+ x-extensible-enum:
- queued
- running
- waiting
@@ -29086,7 +29614,7 @@ components:
type: string
description: What people call it.
role:
- $ref: '#/components/schemas/PersonRole'
+ $ref: '#/components/schemas/PersonRoleAnswer'
active:
type: boolean
description: 'Whether the caller is working in this one: the organization their session works in, or for an app''s token the one its OpenBot-Organization header names, else the caller''s own. Always false for a request made with an API key.'
@@ -29122,7 +29650,7 @@ components:
type: string
minLength: 1
maxLength: 100
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: What people call it.
slug:
type: string
@@ -29157,7 +29685,7 @@ components:
type: array
description: The roles the caller may give this member, their current one left out. The server's verdict. Empty when the caller may not change this member's role.
items:
- $ref: '#/components/schemas/PersonRole'
+ $ref: '#/components/schemas/PersonRoleAnswer'
id:
type: string
description: The person's id.
@@ -29175,7 +29703,7 @@ components:
- 'null'
description: Their picture's address, when they have one.
role:
- $ref: '#/components/schemas/PersonRole'
+ $ref: '#/components/schemas/PersonRoleAnswer'
joinedAt:
type: string
format: date-time
@@ -29208,7 +29736,7 @@ components:
type: string
minLength: 1
maxLength: 100
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: What people call it.
UpdateOrganizationMemberRequest:
type: object
@@ -29262,7 +29790,7 @@ components:
$ref: '#/components/schemas/AssignableRole'
status:
type: string
- enum:
+ x-extensible-enum:
- pending
- expired
- declined
@@ -29360,7 +29888,7 @@ components:
$ref: '#/components/schemas/AssignableRole'
status:
type: string
- enum:
+ x-extensible-enum:
- pending
- expired
- accepted
@@ -29502,7 +30030,7 @@ components:
type: string
minLength: 1
maxLength: 100
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: What people call it.
description:
type: string
@@ -29531,7 +30059,7 @@ components:
type: string
minLength: 1
maxLength: 100
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: What people call it.
description:
type:
@@ -29621,7 +30149,7 @@ components:
ApprovalStatus:
type: string
description: Where an approval stands. pending waits for the person. approved and denied are decided, and consumed is started; the server then carries the conversation on. completed is finished.
- enum:
+ x-extensible-enum:
- pending
- approved
- denied
@@ -29887,7 +30415,7 @@ components:
type: string
minLength: 1
maxLength: 6000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The person's answer. Trimmed.
inConversation:
type: boolean
@@ -30013,7 +30541,7 @@ components:
type: string
minLength: 1
maxLength: 300
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: An exact value, or a pattern where * matches anything, so mcp/gmail/* names every Gmail tool. Trimmed.
ApprovalRuleInput:
type: object
@@ -30394,7 +30922,7 @@ components:
type: string
minLength: 1
maxLength: 1000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The rule in a sentence or two, at most 1,000 characters once trimmed.
ApprovalRuleDraftWrittenRow:
type: object
@@ -30721,7 +31249,7 @@ components:
type: string
minLength: 1
maxLength: 2000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The sentence the rules were written from, at most 2,000 characters once trimmed.
ApprovalRuleDraftBatch:
type: object
@@ -30805,7 +31333,7 @@ components:
type: string
minLength: 1
maxLength: 2000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The guidance, at most 2,000 characters once trimmed.
ReviewerGuidanceCheck:
type: object
@@ -30876,7 +31404,7 @@ components:
type: string
minLength: 1
maxLength: 2000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The guidance to test, at most 2,000 characters once trimmed.
limit:
type: integer
@@ -31040,7 +31568,7 @@ components:
type: string
minLength: 1
maxLength: 80
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: 1 to 80 characters once trimmed.
description:
type: string
@@ -31367,7 +31895,7 @@ components:
type: string
minLength: 1
maxLength: 500
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The question, 1 to 500 characters once trimmed.
WhatIfInitiator:
type: string
@@ -31774,7 +32302,7 @@ components:
description: The id of the person who asked.
status:
type: string
- enum:
+ x-extensible-enum:
- pending
- approved
- declined
@@ -32065,7 +32593,7 @@ components:
type: string
minLength: 1
maxLength: 2000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: Why the Bot declined, in its own words. The trail keeps the first 500 characters.
request:
type: string
@@ -32647,7 +33175,7 @@ components:
description: 'Who raised it: the Bot (model), a check the page raised, or the person themselves (manual).'
status:
type: string
- enum:
+ x-extensible-enum:
- waiting
- taken
- completed
@@ -32741,7 +33269,7 @@ components:
description: The image it runs now.
ComputerState:
type: string
- enum:
+ x-extensible-enum:
- absent
- starting
- ready
@@ -33848,7 +34376,7 @@ components:
- $ref: '#/components/schemas/PersonRealBrowserOpened'
SignInStatus:
type: string
- enum:
+ x-extensible-enum:
- pending
- filling
- code_required
@@ -34472,6 +35000,37 @@ components:
minLength: 1
maxLength: 32
pattern: ^v?\d+(?:\.\d+){1,3}(?:-[a-z]+(?:\.\d{1,9})?)?$
+ NudgeEvent:
+ type: object
+ description: What the caller did with a nudge, and where. Names nothing about the person, who is the caller. The moment that made the nudge due is added by OpenBot, not sent.
+ additionalProperties: false
+ required:
+ - nudge
+ - action
+ - place
+ - surface
+ properties:
+ nudge:
+ $ref: '#/components/schemas/NoticeId'
+ action:
+ type: string
+ enum:
+ - shown
+ - clicked
+ - dismissed
+ description: shown when the nudge was drawn, clicked when they followed it (for the star nudge, opened the repository), and dismissed when they said Not now.
+ place:
+ type: string
+ enum:
+ - card
+ - settings
+ description: card for the nudge drawn above the message box, settings for its permanent row in Settings, which is never shown as a card.
+ surface:
+ type: string
+ enum:
+ - web
+ - desktop
+ description: Where the caller saw or answered it.
LearningSpaceId:
type: string
description: A Learning space's id in the backend (its container).
@@ -34785,7 +35344,7 @@ components:
description: Whether it adds a skill, changes one, or removes one.
status:
type: string
- enum:
+ x-extensible-enum:
- pending_review
- approved
- rejected
@@ -35057,7 +35616,7 @@ components:
format: uuid
status:
type: string
- enum:
+ x-extensible-enum:
- queued
- freezing
- batching
@@ -35610,7 +36169,7 @@ components:
type: boolean
syncStatus:
type: string
- enum:
+ x-extensible-enum:
- idle
- running
- succeeded
@@ -35916,6 +36475,7 @@ components:
- llamaindex
- agno
- langgraph
+ - langgraph-ts
- google-adk
- antigravity
- pydantic-ai
@@ -36865,6 +37425,33 @@ components:
retryable: true
requestId: req_example
traceId: trace_example
+ clientUpdateRequired:
+ value:
+ type: https://open.bot/errors/client-update-required
+ title: This app is too old for this OpenBot.
+ status: 400
+ detail: This OpenBot needs OpenBot Desktop 1.2.0 or later. Update OpenBot, then try again.
+ code: CLIENT_UPDATE_REQUIRED
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ client: desktop
+ minimumVersion: 1.2.0
+ clientUpdateRequiredSecurity:
+ value:
+ type: https://open.bot/errors/client-update-required
+ title: This app is too old for this OpenBot.
+ status: 400
+ detail: This version of OpenBot has a security problem. Update to keep using it.
+ code: CLIENT_UPDATE_REQUIRED
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ client: desktop
+ minimumVersion: 1.2.0
+ security: true
ConversationNotFound:
description: The conversation does not exist, was removed, or the caller is not in it, or the organization does not exist.
content:
@@ -37344,6 +37931,137 @@ components:
retryable: false
requestId: req_example
traceId: trace_example
+ InvalidAiConnection:
+ description: The body is malformed, the provider doesn't take that login, the address isn't http or https or has something in it that signs in, or a key, an address or a model the login needs is missing.
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ examples:
+ pair:
+ value:
+ type: https://open.bot/errors/validation-error
+ title: Request validation failed.
+ status: 400
+ detail: Google Gemini doesn't take a plan. Pick an API key or a sign-in.
+ code: VALIDATION_ERROR
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ keyMissing:
+ value:
+ type: https://open.bot/errors/validation-error
+ title: Request validation failed.
+ status: 400
+ detail: Paste a key, or use the saved key.
+ code: VALIDATION_ERROR
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ credentialsInAddress:
+ value:
+ type: https://open.bot/errors/validation-error
+ title: Request validation failed.
+ status: 400
+ detail: Take the user name and password out of the address, and paste the key in its own field.
+ code: VALIDATION_ERROR
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ AiConnectionFixed:
+ description: Whoever runs this OpenBot sets its AI provider (editable is false), so it can't be changed here. Or the Idempotency-Key was already used for a different request.
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ examples:
+ fixed:
+ value:
+ type: https://open.bot/errors/ai-connection-fixed
+ title: The AI provider is set by whoever runs OpenBot.
+ status: 409
+ detail: This OpenBot's AI provider is set by whoever runs it. Change its key in the vault.
+ code: AI_CONNECTION_FIXED
+ category: conflict
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ reused:
+ value:
+ type: https://open.bot/errors/idempotency-key-conflict
+ title: That Idempotency-Key was used for a different request.
+ status: 409
+ detail: That Idempotency-Key was used for a different request.
+ code: IDEMPOTENCY_KEY_CONFLICT
+ category: conflict
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ AiConnectionRefused:
+ description: 'OpenBot checked the connection and can''t use it, so nothing was saved and the connection in use keeps running. code says why: AI_CONNECTION_KEY_REFUSED, the provider didn''t accept the key; AI_CONNECTION_UNREACHABLE, the address didn''t answer; AI_CONNECTION_MODEL_UNAVAILABLE, the key can''t use that model; AI_CONNECTION_SIGN_IN_MISSING, there''s no sign-in to read; AI_CONNECTION_ENGINE_NOT_READY, the plan''s engine isn''t answering yet. detail is OpenBot''s own sentence, naming the provider or the host, never what the provider said.'
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/Problem'
+ examples:
+ keyRefused:
+ value:
+ type: https://open.bot/errors/ai-connection-refused
+ title: OpenBot couldn't use that connection.
+ status: 422
+ detail: Anthropic didn't accept that key. Check it and paste it again.
+ code: AI_CONNECTION_KEY_REFUSED
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ unreachable:
+ value:
+ type: https://open.bot/errors/ai-connection-refused
+ title: OpenBot couldn't use that connection.
+ status: 422
+ detail: OpenBot couldn't reach api.example.com. Check the address.
+ code: AI_CONNECTION_UNREACHABLE
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ modelUnavailable:
+ value:
+ type: https://open.bot/errors/ai-connection-refused
+ title: OpenBot couldn't use that connection.
+ status: 422
+ detail: That key can't use gemini-3-pro. Pick another model.
+ code: AI_CONNECTION_MODEL_UNAVAILABLE
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ signInMissing:
+ value:
+ type: https://open.bot/errors/ai-connection-refused
+ title: OpenBot couldn't use that connection.
+ status: 422
+ detail: Sign in to Google first, then try again.
+ code: AI_CONNECTION_SIGN_IN_MISSING
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ engineNotReady:
+ value:
+ type: https://open.bot/errors/ai-connection-refused
+ title: OpenBot couldn't use that connection.
+ status: 422
+ detail: Claude hasn't started yet. Try again in a moment.
+ code: AI_CONNECTION_ENGINE_NOT_READY
+ category: validation
+ retryable: true
+ requestId: req_example
+ traceId: trace_example
InvalidApp:
description: A field is missing or out of bounds, the directory entry isn't one that can be added, the address is refused, the server needs a key nobody gave, or the server couldn't be reached or set up for signing in.
content:
@@ -41528,6 +42246,8 @@ components:
value:
messageListEmphasis: thread
selfHostBannerDismissed: false
+ dismissedNotices: []
+ noticesDue: []
narration: null
skin: openbot
proactive: 'on'
@@ -41647,6 +42367,16 @@ components:
builtInBots: true
isolatedBots: false
botComputers: true
+ attachmentLimits:
+ imageBytes: 104857600
+ documentBytes: 104857600
+ fileBytes: 104857600
+ api:
+ - v2
+ minimumClients:
+ desktop: 1.2.0
+ launcherApi: 1
+ extensionApi: 1
OrganizationSettingsExample:
summary: The settings, with what an administrator needs beside them.
value:
@@ -42233,6 +42963,64 @@ components:
summary: What was said.
value:
text: Remind me to send the forecast on Friday.
+ AiConnectionExample:
+ summary: An Anthropic key, kept, with an OpenAI key still kept from before.
+ value:
+ provider: anthropic
+ login: api-key
+ model: null
+ endpointHost: null
+ keySet: true
+ ready: true
+ source: stored
+ editable: true
+ saved:
+ - provider: openai
+ login: api-key
+ endpointHost: null
+ changedAt: '2026-11-17T09:00:00.000Z'
+ AiConnectionEndpointExample:
+ summary: Google Gemini at its OpenAI-compatible address.
+ value:
+ provider: google
+ login: endpoint
+ model: gemini-3-pro
+ endpointHost: generativelanguage.googleapis.com
+ keySet: true
+ ready: true
+ source: stored
+ editable: true
+ saved:
+ - provider: google
+ login: endpoint
+ endpointHost: generativelanguage.googleapis.com
+ changedAt: '2026-11-17T09:00:00.000Z'
+ AiConnectionFixedExample:
+ summary: A team's OpenBot, where whoever runs it sets the provider.
+ value:
+ provider: openai
+ login: api-key
+ model: null
+ endpointHost: null
+ keySet: true
+ ready: true
+ source: environment
+ editable: false
+ saved: []
+ changedAt: null
+ AiConnectionNoneExample:
+ summary: Nothing chosen yet.
+ value:
+ provider: null
+ login: null
+ model: null
+ endpointHost: null
+ keySet: false
+ ready: false
+ source: none
+ editable: true
+ saved: []
+ changedAt: null
AppPageExample:
summary: Every app, on one page.
value:
@@ -43214,6 +44002,7 @@ components:
- id: 4a0d6f6e-1c1b-4f3e-8a52-0d9b7c6e5f41
botId: agent_9b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21
schedule: Weekdays at 09:00
+ cron: 0 9 * * 1-5
timezone: America/New_York
instruction: Summarize my unread mail and today's calendar.
title: Morning brief
@@ -43237,6 +44026,7 @@ components:
id: 4a0d6f6e-1c1b-4f3e-8a52-0d9b7c6e5f41
botId: agent_9b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21
schedule: Weekdays at 09:00
+ cron: 0 9 * * 1-5
timezone: America/New_York
instruction: Summarize my unread mail and today's calendar.
title: Morning brief
@@ -44863,6 +45653,13 @@ components:
at BotCard (/assets/route-app-secondary.js:12:345)
surface: web
appVersion: 1.1.0-rc.2
+ NudgeClicked:
+ summary: The caller opened OpenBot's repository from the star card, in OpenBot Desktop.
+ value:
+ nudge: star-on-github
+ action: clicked
+ place: card
+ surface: desktop
LearningConfigurationExample:
summary: Learning on, every Bot learning into the space OpenBot assigned, people reviewing their own.
value:
diff --git a/api/openapi/accounts.yaml b/api/openapi/accounts.yaml
index d06cf464cf..3a2ec3ef48 100644
--- a/api/openapi/accounts.yaml
+++ b/api/openapi/accounts.yaml
@@ -1221,7 +1221,7 @@ components:
type: [string, 'null']
description: The picture their identity provider gave, when it gave one.
role:
- $ref: './common.yaml#/components/schemas/PersonRole'
+ $ref: './common.yaml#/components/schemas/PersonRoleAnswer'
needsName:
type: boolean
description: >-
@@ -1352,6 +1352,7 @@ components:
required:
- messageListEmphasis
- selfHostBannerDismissed
+ - dismissedNotices
- narration
- skin
- proactive
@@ -1361,6 +1362,28 @@ components:
selfHostBannerDismissed:
type: boolean
description: Whether they closed the banner offering help self-hosting OpenBot.
+ dismissedNotices:
+ type: array
+ maxItems: 64
+ uniqueItems: true
+ description: >-
+ The notices they answered, either way, by id. A notice in this list
+ is never shown to them again, on any device. Empty until they
+ answer one.
+ items:
+ $ref: './common.yaml#/components/schemas/NoticeId'
+ noticesDue:
+ type: array
+ readOnly: true
+ maxItems: 64
+ uniqueItems: true
+ description: >-
+ The notices OpenBot would show them now, by id, worked out by the
+ server from the edition and how they have used OpenBot. A notice
+ they dismissed is never here. Absent from a server that works out
+ none.
+ items:
+ $ref: './common.yaml#/components/schemas/NoticeId'
narration:
description: >-
Whether they narrate their recordings in OpenBot's browser, which
@@ -1392,6 +1415,15 @@ components:
$ref: '#/components/schemas/MessageListEmphasis'
selfHostBannerDismissed:
type: boolean
+ dismissedNotices:
+ type: array
+ maxItems: 64
+ uniqueItems: true
+ description: >-
+ Notices they answered, by id. Added to the ones already dismissed:
+ a notice is never taken back off the list.
+ items:
+ $ref: './common.yaml#/components/schemas/NoticeId'
narration:
$ref: '#/components/schemas/OnOff'
skin:
@@ -1538,7 +1570,7 @@ components:
description: Who they are there, such as their GitHub login, when the service said.
status:
type: string
- enum: [active, needs_reconnect]
+ x-extensible-enum: [active, needs_reconnect]
description: needs_reconnect when the service stopped accepting what the link holds, and linking again mends it.
createdAt:
type: string
@@ -1683,7 +1715,7 @@ components:
type: string
minLength: 1
maxLength: 2048
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
IdentityProviderAddress:
type: string
format: uri
@@ -1710,7 +1742,7 @@ components:
type: string
minLength: 1
maxLength: 200000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The provider's SAML metadata XML, as its identity team supplied it.
OidcIdentityProviderRequest:
type: object
@@ -1734,13 +1766,13 @@ components:
type: string
minLength: 1
maxLength: 200
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: An id for the provider, unique in the organization, such as acme-okta.
IdentityProviderDomains:
type: string
minLength: 1
maxLength: 2048
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: >-
The email domain whose people it signs in, such as acme.com. Several
are separated by commas.
@@ -2108,6 +2140,8 @@ components:
value:
messageListEmphasis: thread
selfHostBannerDismissed: false
+ dismissedNotices: []
+ noticesDue: []
narration: null
skin: openbot
proactive: 'on'
diff --git a/api/openapi/admin-settings.yaml b/api/openapi/admin-settings.yaml
index bff75128f2..ef11f29e05 100644
--- a/api/openapi/admin-settings.yaml
+++ b/api/openapi/admin-settings.yaml
@@ -12,14 +12,18 @@ paths:
summary: Read what this OpenBot offers
description: >-
Return what this OpenBot offers and how people sign in to it: the
- edition, the features the apps draw, and the sign-in options. Anybody
+ edition, the features the apps draw, how large an attached file may
+ be, and the sign-in options. Anybody
may read it, signed in or not, because the sign-in screen reads it
first. Signed in, it is answered in an organization the caller is a
member of, and an organization they are not in, the organization
`default` included, answers exactly as one that does not exist. Nobody
signed in reads it in the organization `default`. It names no identity
- provider and no version: only whether
- single sign-on is set up and required.
+ provider and no build: only whether
+ single sign-on is set up and required, and which API versions and
+ which releases of each OpenBot app it serves. It is never refused for
+ the app's version, so an app reads it first to learn whether it, or
+ the OpenBot, needs an update.
x-openbot-singleton: true
security:
- {}
@@ -1005,7 +1009,7 @@ components:
type: string
minLength: 1
maxLength: 206
- pattern: ^(organization|team:[^\x00]*\S[^\x00]*|group:[^\x00]*\S[^\x00]*)$
+ pattern: ^(organization|team:[^\x00]*[^\s\x00][^\x00]*|group:[^\x00]*[^\s\x00][^\x00]*)$
schemas:
Deployment:
type: object
@@ -1083,11 +1087,97 @@ components:
computers answer 503 to every call. Not isolatedBots: an OpenBot
whose Bots share one computer has computers (true) and cannot give
a Bot one of its own (isolatedBots false).
+ attachmentLimits:
+ $ref: '#/components/schemas/AttachmentLimits'
+ api:
+ type: array
+ description: >-
+ The API versions this OpenBot serves, by major, such as v2. An app
+ that speaks none of them can't use it: when they are all newer than
+ the app's, the app needs an update; when they are all older, this
+ OpenBot does. Absent from a release before it was published, which
+ serves v2.
+ minItems: 1
+ items:
+ type: string
+ pattern: ^v[1-9][0-9]{0,3}$
+ minimumClients:
+ $ref: '#/components/schemas/MinimumClients'
+ securityMinimumClients:
+ $ref: '#/components/schemas/MinimumClients'
+ description: >-
+ The part of minimumClients raised because of a security problem in
+ older releases: for each app named, the minimum is there for
+ security. Absent or empty when none is.
+ launcherApi:
+ type: integer
+ minimum: 1
+ description: >-
+ The version of what OpenBot Desktop supplies when it starts this
+ OpenBot on its own computer. It changes when Desktop must supply
+ something new.
+ extensionApi:
+ type: integer
+ minimum: 1
+ description: The version of what the OpenBot Recorder and this OpenBot exchange.
+ MinimumClients:
+ type: object
+ description: >-
+ The oldest release of each OpenBot app this OpenBot serves. An app
+ names itself in the OpenBot-Client header, and one older than its
+ minimum here is refused with CLIENT_UPDATE_REQUIRED, everywhere but
+ this deployment answer. An app not listed has no minimum. An OpenBot
+ serves every app released in the last 12 months, so it names one only
+ where its administrator raised it. Absent from a release before it was
+ published.
+ properties:
+ web:
+ $ref: '#/components/schemas/ClientRelease'
+ desktop:
+ $ref: '#/components/schemas/ClientRelease'
+ mobile:
+ $ref: '#/components/schemas/ClientRelease'
+ recorder:
+ $ref: '#/components/schemas/ClientRelease'
+ ClientRelease:
+ type: string
+ description: An OpenBot release, such as 1.1.0.
+ pattern: ^\d{1,6}\.\d{1,6}\.\d{1,6}(-[0-9A-Za-z.-]{1,64})?$
+ examples: [1.1.0]
+ AttachmentLimits:
+ type: object
+ description: >-
+ How large a file attached to a message may be, by kind, in bytes. An
+ upload over its kind's limit is refused. Absent, as from an older
+ OpenBot, the limits are 8388608 for an image or a document (a PDF, or
+ a Word, Excel or PowerPoint file) and 1048576 for any other file. The limits can rise while OpenBot runs, so a client
+ reads them again rather than keeping them for good. What a Bot's model
+ is shown of a large file is a separate matter: the file is kept and
+ can be downloaded whatever the model can read of it.
+ required:
+ - imageBytes
+ - documentBytes
+ - fileBytes
+ properties:
+ imageBytes:
+ type: integer
+ minimum: 1
+ description: The largest image.
+ documentBytes:
+ type: integer
+ minimum: 1
+ description: >-
+ The largest document: a PDF, or a Word, Excel or PowerPoint file
+ (.docx, .xlsx, .pptx).
+ fileBytes:
+ type: integer
+ minimum: 1
+ description: The largest text file, or a file of any other kind.
AllowlistEntry:
type: string
minLength: 1
maxLength: 200
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
OrganizationSettingValues:
type: object
description: >-
@@ -1227,6 +1317,10 @@ components:
actionRecordRetentionDays:
type: integer
description: How many days recorded computer actions are kept.
+ computerMode:
+ type: string
+ enum: [per-person, shared, none]
+ description: 'How Bots get computers here. per-person: each person has a computer of their own, and so does each isolated Bot; an OpenBot only one person uses answers this too. shared: every person''s Bots run on one computer, so a command one Bot runs can read another person''s files there. That suits a proof of concept, not people''s real work. none: Bots have no computers. Absent from a server that predates it.'
UpdateOrganizationSettingsRequest:
allOf:
- $ref: '#/components/schemas/OrganizationSettingValues'
@@ -1372,7 +1466,7 @@ components:
propertyNames:
minLength: 1
maxLength: 200
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
additionalProperties:
$ref: '#/components/schemas/SwitchValue'
teams:
@@ -1385,7 +1479,7 @@ components:
propertyNames:
minLength: 1
maxLength: 200
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
additionalProperties:
$ref: '#/components/schemas/SwitchValue'
CapabilityChange:
@@ -1421,7 +1515,7 @@ components:
type: string
minLength: 1
maxLength: 2000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
CapabilityChangesToPreview:
type: object
additionalProperties: false
@@ -1491,7 +1585,7 @@ components:
type: string
minLength: 1
maxLength: 1000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The change in a sentence or two, at most 1,000 characters once trimmed.
RuleCheck:
type: object
@@ -1551,7 +1645,7 @@ components:
type: boolean
decidedBy:
type: string
- enum: [default, organization, role, group, team]
+ x-extensible-enum: [default, organization, role, group, team]
scopeId:
type: string
description: The role, the group's name or the team's id that decided it. Empty otherwise.
@@ -1574,7 +1668,7 @@ components:
name:
type: [string, 'null']
role:
- $ref: './common.yaml#/components/schemas/PersonRole'
+ $ref: './common.yaml#/components/schemas/PersonRoleAnswer'
groups:
type: array
items:
@@ -1696,7 +1790,7 @@ components:
organization, team: for a team, or group: for a directory group.
scopeKind:
type: string
- enum: [organization, group, team]
+ x-extensible-enum: [organization, group, team]
description: >-
Whose policy: the organization's, a team's, or a directory
group's.
@@ -2139,6 +2233,15 @@ components:
builtInBots: true
isolatedBots: false
botComputers: true
+ attachmentLimits:
+ imageBytes: 104857600
+ documentBytes: 104857600
+ fileBytes: 104857600
+ api: [v2]
+ minimumClients:
+ desktop: 1.2.0
+ launcherApi: 1
+ extensionApi: 1
OrganizationSettingsExample:
summary: The settings, with what an administrator needs beside them.
value:
diff --git a/api/openapi/agents.yaml b/api/openapi/agents.yaml
index a283227867..f8744ef237 100644
--- a/api/openapi/agents.yaml
+++ b/api/openapi/agents.yaml
@@ -732,6 +732,7 @@ components:
- llamaindex
- agno
- langgraph
+ - langgraph-ts
- google-adk
- antigravity
- pydantic-ai
diff --git a/api/openapi/approvals.yaml b/api/openapi/approvals.yaml
index c854baf0f7..0a7a653871 100644
--- a/api/openapi/approvals.yaml
+++ b/api/openapi/approvals.yaml
@@ -2500,7 +2500,7 @@ components:
Where an approval stands. pending waits for the person. approved and
denied are decided, and consumed is started; the server then carries
the conversation on. completed is finished.
- enum: [pending, approved, denied, consumed, completed]
+ x-extensible-enum: [pending, approved, denied, consumed, completed]
ApprovalActionKind:
type: string
description: >-
@@ -2754,7 +2754,7 @@ components:
type: string
minLength: 1
maxLength: 6000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The person's answer. Trimmed.
inConversation:
type: boolean
@@ -2808,7 +2808,7 @@ components:
type: string
minLength: 1
maxLength: 300
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: >-
An exact value, or a pattern where * matches anything, so
mcp/gmail/* names every Gmail tool. Trimmed.
@@ -3205,7 +3205,7 @@ components:
type: string
minLength: 1
maxLength: 1000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The rule in a sentence or two, at most 1,000 characters once trimmed.
ApprovalRuleDraftBehaviour:
type: string
@@ -3468,7 +3468,7 @@ components:
type: string
minLength: 1
maxLength: 2000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The sentence the rules were written from, at most 2,000 characters once trimmed.
ApprovalRuleDraftBatch:
type: object
@@ -3533,7 +3533,7 @@ components:
type: string
minLength: 1
maxLength: 2000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The guidance, at most 2,000 characters once trimmed.
ReviewerGuidanceCheck:
type: object
@@ -3589,7 +3589,7 @@ components:
type: string
minLength: 1
maxLength: 2000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The guidance to test, at most 2,000 characters once trimmed.
limit:
type: integer
@@ -3714,7 +3714,7 @@ components:
type: string
minLength: 1
maxLength: 80
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: 1 to 80 characters once trimmed.
description:
type: string
@@ -4058,7 +4058,7 @@ components:
type: string
minLength: 1
maxLength: 500
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: The question, 1 to 500 characters once trimmed.
WhatIfActionRead:
type: object
@@ -4397,7 +4397,7 @@ components:
description: The id of the person who asked.
status:
type: string
- enum: [pending, approved, declined, superseded]
+ x-extensible-enum: [pending, approved, declined, superseded]
description: >-
pending until an administrator answers it. superseded when a later
request for the same Bot and app replaced it.
diff --git a/api/openapi/bot-grants.yaml b/api/openapi/bot-grants.yaml
index 53c03ef77a..84a579d793 100644
--- a/api/openapi/bot-grants.yaml
+++ b/api/openapi/bot-grants.yaml
@@ -1142,7 +1142,7 @@ components:
type: string
minLength: 1
maxLength: 2000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
approval:
$ref: './common.yaml#/components/schemas/SharedAccountApproval'
BotGrantChangesSaved:
@@ -1173,7 +1173,7 @@ components:
type: string
minLength: 1
maxLength: 1000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: >-
What the Bot may do in the app, in a sentence or two, at most 1,000
characters once trimmed.
@@ -1651,7 +1651,7 @@ components:
Read only: waiting, approved, dismissed, or withdrawn by the
person who asked. Answering a request is approveAppAccessRequest
or dismissAppAccessRequest.
- enum: [pending, approved, dismissed, cancelled]
+ x-extensible-enum: [pending, approved, dismissed, cancelled]
botId:
type: [string, 'null']
description: The Bot it is for, or null for a request about the app alone.
diff --git a/api/openapi/bots.yaml b/api/openapi/bots.yaml
index 2c41f3da21..e916e360d8 100644
--- a/api/openapi/bots.yaml
+++ b/api/openapi/bots.yaml
@@ -1774,13 +1774,20 @@ components:
its id in OpenBot's harness list (shared/harnesses.json), which
the server checks every create against. Empty means none was
named, as for an agent somebody already runs. "byo-url" is not
- one: it names no framework. Kept only with an endpoint.
+ one: it names no framework. Kept only with an endpoint, with one
+ exception: "langgraph-ts" sent with no endpoint asks for a Bot
+ that runs inside OpenBot on OpenBot's own LangGraph (TypeScript)
+ engine, which is what the New Bot sheet sends. The deployment
+ decides what each run uses: a Claude plan keeps the Claude Agent
+ SDK engine, and an administrator may switch new Bots back to the
+ built-in agent.
enum:
- ''
- crewai
- llamaindex
- agno
- langgraph
+ - langgraph-ts
- google-adk
- antigravity
- pydantic-ai
@@ -1854,7 +1861,7 @@ components:
type: string
minLength: 1
maxLength: 2000
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: Why the Bot declined, in its own words. The trail keeps the first 500 characters.
request:
type: string
diff --git a/api/openapi/common.yaml b/api/openapi/common.yaml
index a016983971..c05d3a9f6a 100644
--- a/api/openapi/common.yaml
+++ b/api/openapi/common.yaml
@@ -57,6 +57,22 @@ info:
SIGN_IN_UNAVAILABLE.
+ OpenBot's own apps name themselves on every request in the header
+ `OpenBot-Client`: `/`, where kind is web, desktop,
+ mobile or recorder, such as `OpenBot-Client: desktop/1.1.0`. A header
+ may name more than one, separated by spaces: OpenBot Desktop adds its
+ own to the one its window's page sent. getDeployment says which API
+ versions this OpenBot serves and the oldest release of each app it
+ serves (minimumClients). Every other operation under /api/v2 refuses
+ an app older than that with 400 and the code CLIENT_UPDATE_REQUIRED, whose problem
+ names the app (client) and its minimum (minimumVersion) and whose
+ detail tells the person to update OpenBot. When that minimum was raised
+ because of a security problem in older releases, the problem also says
+ security: true, and getDeployment lists it under securityMinimumClients.
+ A program of your own need not send the header; without it nothing is
+ refused for a version.
+
+
This file is the single source of truth: the clients, the server's types,
the docs and the contract tests are all generated from it or checked
against it. A change that breaks an existing client fails the pull request.
@@ -187,6 +203,7 @@ paths:
/api/v2/organizations/{organizationId}/model-key: { $ref: './model-connections.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1model-key' }
/api/v2/organizations/{organizationId}/model-catalogue: { $ref: './model-connections.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1model-catalogue' }
/api/v2/organizations/{organizationId}/people/{personId}/model-choices/{conversationId}: { $ref: './model-connections.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1people~1{personId}~1model-choices~1{conversationId}' }
+ /api/v2/organizations/{organizationId}/ai-connection: { $ref: './model-connections.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1ai-connection' }
/api/v2/organizations/{organizationId}/apps: { $ref: './apps.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1apps' }
/api/v2/organizations/{organizationId}/apps/{appId}: { $ref: './apps.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1apps~1{appId}' }
/api/v2/organizations/{organizationId}/apps/{appId}/refresh: { $ref: './apps.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1apps~1{appId}~1refresh' }
@@ -418,6 +435,7 @@ paths:
/api/v2/organizations/{organizationId}/recorder/activity: { $ref: './passwords-and-recorder.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1recorder~1activity' }
/api/v2/organizations/{organizationId}/product-events: { $ref: './conversations.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1product-events' }
/api/v2/organizations/{organizationId}/app-errors: { $ref: './conversations.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1app-errors' }
+ /api/v2/organizations/{organizationId}/nudge-events: { $ref: './conversations.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1nudge-events' }
/api/v2/organizations/{organizationId}/settings/learning: { $ref: './learning.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1settings~1learning' }
/api/v2/organizations/{organizationId}/settings/learning/create-container: { $ref: './learning.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1settings~1learning~1create-container' }
/api/v2/organizations/{organizationId}/settings/learning/overview: { $ref: './learning.yaml#/paths/~1api~1v2~1organizations~1{organizationId}~1settings~1learning~1overview' }
@@ -567,6 +585,8 @@ components:
model-catalogue:read: Read the models Bots can run on.
model-choices:read: Read the model the signed-in person chose for each of their conversations.
model-choices:write: Choose the model the signed-in person's conversations answer on.
+ ai-connection:read: Read how OpenBot reaches its AI provider, never a key, when the signed-in person is an administrator.
+ ai-connection:write: Change how OpenBot reaches its AI provider, when the signed-in person is an administrator.
apps:read: Read the apps the organization has added, the directory of apps it can add, and how apps are set up here.
apps:write: Add, change, refresh and remove apps, when the signed-in person may.
connections:read: Read the signed-in person's connections to apps, and each app's shared account.
@@ -828,6 +848,23 @@ components:
admin governs it: its people, its sign-in and its policy. A member
uses it. The owner is whoever created the organization; `default`
has admins and no owner.
+ PersonRoleAnswer:
+ type: string
+ x-extensible-enum: [owner, admin, member]
+ description: >-
+ The person's role as a member of the organization, as the server
+ answers it. An owner or an admin governs it: its people, its sign-in
+ and its policy. A member uses it. The list can grow: a client reads a
+ role it doesn't know as a member.
+ NoticeId:
+ type: string
+ minLength: 1
+ maxLength: 64
+ pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
+ description: >-
+ A notice OpenBot shows a person once, such as a nudge, by its id:
+ star-on-github is the ask to star OpenBot on GitHub.
+ example: star-on-github
AssignableRole: { $ref: './accounts.yaml#/components/schemas/AssignableRole' }
OnboardingStatus: { $ref: './accounts.yaml#/components/schemas/OnboardingStatus' }
Person: { $ref: './accounts.yaml#/components/schemas/Person' }
@@ -975,6 +1012,21 @@ components:
reason: each entry names the item and says what is wrong with it.
items:
type: object
+ client:
+ type: string
+ x-extensible-enum: [web, desktop, mobile, recorder]
+ description: >-
+ On CLIENT_UPDATE_REQUIRED, the app the OpenBot-Client header named
+ that is older than this OpenBot serves. A later OpenBot may name
+ another app; read one you don't know as other.
+ minimumVersion:
+ type: string
+ description: On CLIENT_UPDATE_REQUIRED, the oldest release of that app this OpenBot serves.
+ security:
+ type: boolean
+ description: >-
+ On CLIENT_UPDATE_REQUIRED, true when the minimum the app is below
+ was raised because of a security problem in older releases.
ConversationJoinToken: { $ref: './conversations.yaml#/components/schemas/ConversationJoinToken' }
CredentialKind: { $ref: './model-connections.yaml#/components/schemas/CredentialKind' }
Credential: { $ref: './model-connections.yaml#/components/schemas/Credential' }
@@ -1292,6 +1344,33 @@ components:
retryable: true
requestId: req_example
traceId: trace_example
+ clientUpdateRequired:
+ value:
+ type: https://open.bot/errors/client-update-required
+ title: This app is too old for this OpenBot.
+ status: 400
+ detail: This OpenBot needs OpenBot Desktop 1.2.0 or later. Update OpenBot, then try again.
+ code: CLIENT_UPDATE_REQUIRED
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ client: desktop
+ minimumVersion: 1.2.0
+ clientUpdateRequiredSecurity:
+ value:
+ type: https://open.bot/errors/client-update-required
+ title: This app is too old for this OpenBot.
+ status: 400
+ detail: This version of OpenBot has a security problem. Update to keep using it.
+ code: CLIENT_UPDATE_REQUIRED
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ client: desktop
+ minimumVersion: 1.2.0
+ security: true
ConversationNotFound:
description: >-
The conversation does not exist, was removed, or the caller is not in
diff --git a/api/openapi/computers.yaml b/api/openapi/computers.yaml
index 067d2d6cb1..138d095f79 100644
--- a/api/openapi/computers.yaml
+++ b/api/openapi/computers.yaml
@@ -1567,7 +1567,7 @@ components:
computer named it (COMPUTER_ACTION_UNFINISHED).
ComputerState:
type: string
- enum: [absent, starting, ready, unreachable]
+ x-extensible-enum: [absent, starting, ready, unreachable]
description: >-
Where a computer is in its life. absent is one that is not running:
never started, or put to sleep after a quiet spell; it starts on the
@@ -1991,7 +1991,7 @@ components:
person themselves (manual).
status:
type: string
- enum: [waiting, taken, completed, cancelled, expired, interrupted]
+ x-extensible-enum: [waiting, taken, completed, cancelled, expired, interrupted]
createdAt:
type: string
updatedAt:
diff --git a/api/openapi/conversations.yaml b/api/openapi/conversations.yaml
index 632c93ad0d..8fbc62d362 100644
--- a/api/openapi/conversations.yaml
+++ b/api/openapi/conversations.yaml
@@ -1054,7 +1054,9 @@ paths:
summary: Download an attachment
description: Return the bytes of a file attached to a message, in the type
OpenBot recognised it as. Only somebody in the conversation it was sent
- in, or the person still holding it to send, can read it.
+ in, or the person still holding it to send, can read it. A picture is
+ served to open in place. Every other file, a PDF or a Word, Excel or
+ PowerPoint file among them, is served as a download.
security:
- webSession: []
- appOAuth:
@@ -1714,6 +1716,60 @@ paths:
$ref: './common.yaml#/components/responses/ServerError'
default:
$ref: './common.yaml#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/nudge-events:
+ parameters:
+ - $ref: './common.yaml#/components/parameters/OrganizationId'
+ post:
+ tags:
+ - Product events
+ operationId: recordNudgeEvent
+ summary: Record what the caller did with a nudge
+ description: >-
+ Tell OpenBot that a nudge (a notice OpenBot shows a person once, such
+ as the ask to star OpenBot on GitHub) was shown to the caller, that
+ they followed it, or that they dismissed it, and where. OpenBot adds
+ the moment that made it due, from what it already knows about the
+ caller, so the counts say which moment works. It is best effort: a
+ client sends one per show or answer and waits on nothing. Saving the
+ answer is a separate change to the caller's preferences
+ (`dismissedNotices`). The event counts for the caller and names
+ nothing else. Where this OpenBot has product telemetry switched off,
+ it is accepted and dropped.
+ security:
+ - webSession: []
+ - appOAuth:
+ - conversations:write
+ - apiKey: []
+ parameters:
+ - $ref: './common.yaml#/components/parameters/IdempotencyKey'
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NudgeEvent'
+ examples:
+ clicked:
+ $ref: '#/components/examples/NudgeClicked'
+ responses:
+ '204':
+ description: The event is accepted.
+ '400':
+ $ref: './common.yaml#/components/responses/InvalidRequest'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: './common.yaml#/components/responses/Forbidden'
+ '404':
+ $ref: './common.yaml#/components/responses/OrganizationNotFound'
+ '409':
+ $ref: './common.yaml#/components/responses/IdempotencyConflict'
+ '413':
+ $ref: './common.yaml#/components/responses/PayloadTooLarge'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
components:
parameters:
ConversationLimit:
@@ -2182,6 +2238,45 @@ components:
- desktop
- mobile
description: Where the caller saw or copied it.
+ NudgeEvent:
+ type: object
+ description: >-
+ What the caller did with a nudge, and where. Names nothing about the
+ person, who is the caller. The moment that made the nudge due is
+ added by OpenBot, not sent.
+ additionalProperties: false
+ required:
+ - nudge
+ - action
+ - place
+ - surface
+ properties:
+ nudge:
+ $ref: './common.yaml#/components/schemas/NoticeId'
+ action:
+ type: string
+ enum:
+ - shown
+ - clicked
+ - dismissed
+ description: >-
+ shown when the nudge was drawn, clicked when they followed it
+ (for the star nudge, opened the repository), and dismissed when
+ they said Not now.
+ place:
+ type: string
+ enum:
+ - card
+ - settings
+ description: >-
+ card for the nudge drawn above the message box, settings for its
+ permanent row in Settings, which is never shown as a card.
+ surface:
+ type: string
+ enum:
+ - web
+ - desktop
+ description: Where the caller saw or answered it.
AppError:
type: object
description: An error the app hit and did not handle, as the app saw it.
@@ -2391,7 +2486,7 @@ components:
description: What was said. Empty while another person's Bot is still writing it.
status:
type: string
- enum:
+ x-extensible-enum:
- queued
- running
- waiting
@@ -2406,7 +2501,13 @@ components:
description: When it was said. Null where the time was not kept.
reason:
type: string
- description: Why a waiting Bot is waiting.
+ description: Why a waiting Bot is waiting, in words for the person reading
+ the conversation.
+ declined:
+ type: boolean
+ description: True on a failed Bot reply in a group that the person whose turn
+ it answered chose not to share. It was a choice, not a fault, and
+ nothing was sent. text says whose choice it was.
answeredBy:
type: string
description: 'For an answer passed on from another Bot: which Bot answered.'
@@ -2426,6 +2527,14 @@ components:
type: integer
minimum: 0
description: How many tools the Bot called in this message, when it called any.
+ files:
+ type: array
+ maxItems: 20
+ description: In a group conversation, the files a Bot sent from its computer
+ with this reply, in the order it sent them. Each is an attachment of the
+ conversation, read at its attachment address by anyone in it.
+ items:
+ $ref: '#/components/schemas/Attachment'
ConversationMessagePage:
type: object
required:
@@ -2553,7 +2662,7 @@ components:
server that names threads one way only, where it is threadId.
TaskStatus:
type: string
- enum:
+ x-extensible-enum:
- needs_input
- working
- resolved
@@ -3388,6 +3497,9 @@ components:
ProductEventViewed:
summary: "An answer the caller saw in the web app."
value: {"kind": "result_viewed", "threadId": "6f3d6b1f-6f10-4a53-9d51-5f0d6c0e2f1a", "messageId": "msg_0b1c6f0e", "surface": "web"}
+ NudgeClicked:
+ summary: "The caller opened OpenBot's repository from the star card, in OpenBot Desktop."
+ value: {"nudge": "star-on-github", "action": "clicked", "place": "card", "surface": "desktop"}
AppErrorBoundary:
summary: "An error the web app's error screen caught."
value: {"source": "error_boundary", "type": "TypeError", "message": "Cannot read properties of undefined (reading 'title')", "stack": "TypeError: Cannot read properties of undefined (reading 'title')\n at BotCard (/assets/route-app-secondary.js:12:345)", "surface": "web", "appVersion": "1.1.0-rc.2"}
diff --git a/api/openapi/learning.yaml b/api/openapi/learning.yaml
index 2ce6b66580..df3db0cf8e 100644
--- a/api/openapi/learning.yaml
+++ b/api/openapi/learning.yaml
@@ -2149,7 +2149,7 @@ components:
description: Whether it adds a skill, changes one, or removes one.
status:
type: string
- enum: [pending_review, approved, rejected]
+ x-extensible-enum: [pending_review, approved, rejected]
title:
type: string
description: The skill's name.
@@ -2333,7 +2333,7 @@ components:
format: uuid
status:
type: string
- enum: [queued, freezing, batching, reducing, finalizing, succeeded, failed]
+ x-extensible-enum: [queued, freezing, batching, reducing, finalizing, succeeded, failed]
triggerSource:
type: string
enum: [automatic, manual]
diff --git a/api/openapi/memory.yaml b/api/openapi/memory.yaml
index 1610c1965e..6f6465bfb5 100644
--- a/api/openapi/memory.yaml
+++ b/api/openapi/memory.yaml
@@ -672,7 +672,7 @@ components:
type: boolean
syncStatus:
type: string
- enum: [idle, running, succeeded, error]
+ x-extensible-enum: [idle, running, succeeded, error]
syncError:
type: [string, 'null']
description: Why the last sync failed, in a sentence for the person.
diff --git a/api/openapi/model-connections.yaml b/api/openapi/model-connections.yaml
index e42d9df16a..bab0c4b36b 100644
--- a/api/openapi/model-connections.yaml
+++ b/api/openapi/model-connections.yaml
@@ -357,6 +357,144 @@ paths:
$ref: './common.yaml#/components/responses/ServerError'
default:
$ref: './common.yaml#/components/responses/UnexpectedError'
+ /api/v2/organizations/{organizationId}/ai-connection:
+ parameters:
+ - $ref: './common.yaml#/components/parameters/OrganizationId'
+ get:
+ tags: [Models]
+ operationId: getAiConnection
+ summary: Read how OpenBot reaches its AI provider
+ description: >-
+ Return the AI provider OpenBot's Bots run on, the way OpenBot signs in
+ to it, the model or address host where one was named, and whether a
+ run can use it now. Never a key. Also which other connections still
+ have a key kept, so they can be used again without pasting it. Where
+ whoever runs OpenBot sets the provider, editable is false and the
+ connection can't be changed here. Only an administrator of the
+ organization may read it.
+ x-openbot-singleton: true
+ security:
+ - webSession: []
+ - appOAuth: [ai-connection:read]
+ - apiKey: []
+ responses:
+ '200':
+ description: How OpenBot reaches its AI provider. Never a key.
+ headers:
+ Cache-Control:
+ $ref: './common.yaml#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AiConnection'
+ examples:
+ apiKey:
+ $ref: '#/components/examples/AiConnectionExample'
+ endpoint:
+ $ref: '#/components/examples/AiConnectionEndpointExample'
+ fixed:
+ $ref: '#/components/examples/AiConnectionFixedExample'
+ none:
+ $ref: '#/components/examples/AiConnectionNoneExample'
+ '400':
+ $ref: './common.yaml#/components/responses/InvalidRequest'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: './common.yaml#/components/responses/AdminOnly'
+ '404':
+ $ref: './common.yaml#/components/responses/OrganizationNotFound'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
+ put:
+ tags: [Models]
+ operationId: replaceAiConnection
+ summary: Change how OpenBot reaches its AI provider
+ description: >-
+ Switch the AI provider OpenBot's Bots run on, with no restart. OpenBot
+ checks the connection with the provider first: a key, an address or a
+ sign-in it can't use is refused, nothing is saved, and the connection
+ in use keeps running. Once saved, the next run uses it, and runs
+ already going finish on the one they started with. A key goes into
+ the organization's vault and is never sent back; the key of the
+ connection it replaces stays kept, so it can be used again (saved).
+ Recorded on the audit trail, never with a key. Only an administrator
+ of the organization may change it, and not where whoever runs OpenBot
+ sets the provider.
+ security:
+ - webSession: []
+ - appOAuth: [ai-connection:write]
+ - apiKey: []
+ parameters:
+ - $ref: './common.yaml#/components/parameters/IdempotencyKey'
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AiConnectionInput'
+ examples:
+ apiKey:
+ value:
+ provider: anthropic
+ login: api-key
+ apiKey: sk-ant-example
+ savedKey:
+ value:
+ provider: openai
+ login: api-key
+ useSavedKey: true
+ endpoint:
+ value:
+ provider: google
+ login: endpoint
+ apiKey: example-gemini-key
+ baseUrl: https://generativelanguage.googleapis.com/v1beta/openai
+ model: gemini-3-pro
+ signIn:
+ value:
+ provider: xai
+ login: oauth
+ model: grok-5
+ plan:
+ value:
+ provider: anthropic
+ login: plan
+ responses:
+ '200':
+ description: The connection, as saved and in use. Never a key.
+ headers:
+ Cache-Control:
+ $ref: './common.yaml#/components/headers/PrivateNoStore'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AiConnection'
+ examples:
+ apiKey:
+ $ref: '#/components/examples/AiConnectionExample'
+ endpoint:
+ $ref: '#/components/examples/AiConnectionEndpointExample'
+ '400':
+ $ref: '#/components/responses/InvalidAiConnection'
+ '401':
+ $ref: './common.yaml#/components/responses/Unauthenticated'
+ '403':
+ $ref: './common.yaml#/components/responses/AdminOnly'
+ '404':
+ $ref: './common.yaml#/components/responses/OrganizationNotFound'
+ '409':
+ $ref: '#/components/responses/AiConnectionFixed'
+ '422':
+ $ref: '#/components/responses/AiConnectionRefused'
+ '500':
+ $ref: './common.yaml#/components/responses/ServerError'
+ '503':
+ $ref: '#/components/responses/CredentialsUnavailable'
+ default:
+ $ref: './common.yaml#/components/responses/UnexpectedError'
components:
parameters:
CredentialId:
@@ -587,6 +725,23 @@ components:
type: [string, 'null']
effort:
type: [string, 'null']
+ unverified:
+ $ref: '#/components/schemas/UnverifiedModel'
+ UnverifiedModel:
+ type: object
+ description: >-
+ The model a person chose for this conversation, set aside because it
+ hasn't been checked to work with the client this Bot's harness
+ ships. Runs answer on the default model until it has been. Absent when
+ the choice is in use, or set aside for another reason.
+ required: [model, label]
+ properties:
+ model:
+ type: string
+ description: The chosen model's id.
+ label:
+ type: string
+ description: Its name, as a model picker shows it.
ModelChoiceInput:
type: object
additionalProperties: false
@@ -606,6 +761,147 @@ components:
description: >-
An effort the model takes, or null for its own. Trimmed, and read
in lower case.
+ AiConnectionProvider:
+ type: string
+ description: >-
+ The AI provider OpenBot's Bots run on. openai: OpenAI. anthropic:
+ Anthropic. google: Google Gemini. xai: xAI. unbiased: Unbiased AI.
+ openai-compatible: any server that speaks OpenAI's API, at an address
+ given.
+ enum: [openai, anthropic, google, xai, unbiased, openai-compatible]
+ AiConnectionLogin:
+ type: string
+ description: >-
+ How OpenBot signs in to the provider. plan: the person's Claude or
+ ChatGPT plan (openai, anthropic). api-key: a key from the provider
+ (openai, anthropic). endpoint: an address and, where it asks for one,
+ a key (google, xai, unbiased, openai-compatible). oauth: the person's
+ Google or xAI sign-in (google, xai).
+ enum: [plan, api-key, endpoint, oauth]
+ AiConnectionSaved:
+ type: object
+ description: >-
+ A connection with a key still kept in the vault, which can be used
+ again without pasting the key (useSavedKey). Never the key.
+ required: [provider, login, endpointHost]
+ properties:
+ provider:
+ $ref: '#/components/schemas/AiConnectionProvider'
+ login:
+ $ref: '#/components/schemas/AiConnectionLogin'
+ endpointHost:
+ type: [string, 'null']
+ description: The host of its address, for an endpoint. Null for an API key.
+ AiConnection:
+ type: object
+ description: >-
+ How OpenBot reaches its AI provider: who, how it signs in, and
+ whether a run can use it now. Never a key.
+ required:
+ - provider
+ - login
+ - model
+ - endpointHost
+ - keySet
+ - ready
+ - source
+ - editable
+ - saved
+ - changedAt
+ properties:
+ provider:
+ description: The provider. Null while none is chosen yet.
+ oneOf:
+ - $ref: '#/components/schemas/AiConnectionProvider'
+ - type: 'null'
+ login:
+ description: How OpenBot signs in to it. Null while none is chosen yet.
+ oneOf:
+ - $ref: '#/components/schemas/AiConnectionLogin'
+ - type: 'null'
+ model:
+ type: [string, 'null']
+ description: >-
+ The model named for an endpoint or a sign-in. Null for an API key
+ or a plan, where the model catalogue offers the provider's models.
+ endpointHost:
+ type: [string, 'null']
+ description: >-
+ The host of the endpoint's address, never its path, query or
+ anything that signs in. Null unless the login is endpoint.
+ keySet:
+ type: boolean
+ description: Whether a live key for this connection is kept in the vault.
+ ready:
+ type: boolean
+ description: >-
+ Whether a run can use it now: its key is kept, its sign-in can be
+ read, or its plan's engine answers.
+ source:
+ type: string
+ enum: [stored, environment, none]
+ description: >-
+ stored: set here, or carried over from how OpenBot was set up.
+ environment: set by whoever runs OpenBot, in its configuration.
+ none: nothing set yet.
+ editable:
+ type: boolean
+ description: >-
+ Whether an administrator can change it here. False where whoever
+ runs OpenBot sets the provider: its key is changed in the vault.
+ saved:
+ type: array
+ description: >-
+ The connections with a key still kept in the vault, so a switch
+ to one of them needs no key pasted.
+ items:
+ $ref: '#/components/schemas/AiConnectionSaved'
+ changedAt:
+ type: [string, 'null']
+ format: date-time
+ description: When it was last changed. Null if never.
+ AiConnectionInput:
+ type: object
+ additionalProperties: false
+ description: >-
+ The connection to switch to. openai and anthropic take plan or
+ api-key; google and xai take endpoint or oauth; unbiased and
+ openai-compatible take endpoint. Any other pair is refused.
+ required: [provider, login]
+ properties:
+ provider:
+ $ref: '#/components/schemas/AiConnectionProvider'
+ login:
+ $ref: '#/components/schemas/AiConnectionLogin'
+ apiKey:
+ type: string
+ minLength: 1
+ maxLength: 65536
+ writeOnly: true
+ description: >-
+ The provider's key. Required for api-key unless useSavedKey;
+ optional for an endpoint that asks for none. Encrypted into the
+ vault before anything else, and never sent back: no answer
+ includes it, now or later.
+ useSavedKey:
+ type: boolean
+ description: >-
+ Use the key already kept for this provider (and, for an endpoint,
+ this address) instead of sending one.
+ baseUrl:
+ type: string
+ format: uri
+ maxLength: 2048
+ pattern: ^https?://[^@/?#]+([/?#].*)?$
+ description: >-
+ The endpoint's address, http or https, with nothing in it that
+ signs in. Required for endpoint.
+ model:
+ type: string
+ minLength: 1
+ maxLength: 500
+ pattern: \S
+ description: The model to run on. Required for endpoint and oauth. Trimmed.
responses:
InvalidCredential:
description: >-
@@ -747,7 +1043,211 @@ components:
retryable: false
requestId: req_example
traceId: trace_example
+ InvalidAiConnection:
+ description: >-
+ The body is malformed, the provider doesn't take that login, the
+ address isn't http or https or has something in it that signs in, or
+ a key, an address or a model the login needs is missing.
+ content:
+ application/problem+json:
+ schema:
+ $ref: './common.yaml#/components/schemas/Problem'
+ examples:
+ pair:
+ value:
+ type: https://open.bot/errors/validation-error
+ title: Request validation failed.
+ status: 400
+ detail: Google Gemini doesn't take a plan. Pick an API key or a sign-in.
+ code: VALIDATION_ERROR
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ keyMissing:
+ value:
+ type: https://open.bot/errors/validation-error
+ title: Request validation failed.
+ status: 400
+ detail: Paste a key, or use the saved key.
+ code: VALIDATION_ERROR
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ credentialsInAddress:
+ value:
+ type: https://open.bot/errors/validation-error
+ title: Request validation failed.
+ status: 400
+ detail: Take the user name and password out of the address, and paste the key in its own field.
+ code: VALIDATION_ERROR
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ AiConnectionFixed:
+ description: >-
+ Whoever runs this OpenBot sets its AI provider (editable is false), so
+ it can't be changed here. Or the Idempotency-Key was already used for
+ a different request.
+ content:
+ application/problem+json:
+ schema:
+ $ref: './common.yaml#/components/schemas/Problem'
+ examples:
+ fixed:
+ value:
+ type: https://open.bot/errors/ai-connection-fixed
+ title: The AI provider is set by whoever runs OpenBot.
+ status: 409
+ detail: This OpenBot's AI provider is set by whoever runs it. Change its key in the vault.
+ code: AI_CONNECTION_FIXED
+ category: conflict
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ reused:
+ value:
+ type: https://open.bot/errors/idempotency-key-conflict
+ title: That Idempotency-Key was used for a different request.
+ status: 409
+ detail: That Idempotency-Key was used for a different request.
+ code: IDEMPOTENCY_KEY_CONFLICT
+ category: conflict
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ AiConnectionRefused:
+ description: >-
+ OpenBot checked the connection and can't use it, so nothing was saved
+ and the connection in use keeps running. code says why:
+ AI_CONNECTION_KEY_REFUSED, the provider didn't accept the key;
+ AI_CONNECTION_UNREACHABLE, the address didn't answer;
+ AI_CONNECTION_MODEL_UNAVAILABLE, the key can't use that model;
+ AI_CONNECTION_SIGN_IN_MISSING, there's no sign-in to read;
+ AI_CONNECTION_ENGINE_NOT_READY, the plan's engine isn't answering
+ yet. detail is OpenBot's own sentence, naming the provider or the
+ host, never what the provider said.
+ content:
+ application/problem+json:
+ schema:
+ $ref: './common.yaml#/components/schemas/Problem'
+ examples:
+ keyRefused:
+ value:
+ type: https://open.bot/errors/ai-connection-refused
+ title: OpenBot couldn't use that connection.
+ status: 422
+ detail: Anthropic didn't accept that key. Check it and paste it again.
+ code: AI_CONNECTION_KEY_REFUSED
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ unreachable:
+ value:
+ type: https://open.bot/errors/ai-connection-refused
+ title: OpenBot couldn't use that connection.
+ status: 422
+ detail: OpenBot couldn't reach api.example.com. Check the address.
+ code: AI_CONNECTION_UNREACHABLE
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ modelUnavailable:
+ value:
+ type: https://open.bot/errors/ai-connection-refused
+ title: OpenBot couldn't use that connection.
+ status: 422
+ detail: That key can't use gemini-3-pro. Pick another model.
+ code: AI_CONNECTION_MODEL_UNAVAILABLE
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ signInMissing:
+ value:
+ type: https://open.bot/errors/ai-connection-refused
+ title: OpenBot couldn't use that connection.
+ status: 422
+ detail: Sign in to Google first, then try again.
+ code: AI_CONNECTION_SIGN_IN_MISSING
+ category: validation
+ retryable: false
+ requestId: req_example
+ traceId: trace_example
+ engineNotReady:
+ value:
+ type: https://open.bot/errors/ai-connection-refused
+ title: OpenBot couldn't use that connection.
+ status: 422
+ detail: Claude hasn't started yet. Try again in a moment.
+ code: AI_CONNECTION_ENGINE_NOT_READY
+ category: validation
+ retryable: true
+ requestId: req_example
+ traceId: trace_example
examples:
+ AiConnectionExample:
+ summary: An Anthropic key, kept, with an OpenAI key still kept from before.
+ value:
+ provider: anthropic
+ login: api-key
+ model: null
+ endpointHost: null
+ keySet: true
+ ready: true
+ source: stored
+ editable: true
+ saved:
+ - provider: openai
+ login: api-key
+ endpointHost: null
+ changedAt: '2026-11-17T09:00:00.000Z'
+ AiConnectionEndpointExample:
+ summary: Google Gemini at its OpenAI-compatible address.
+ value:
+ provider: google
+ login: endpoint
+ model: gemini-3-pro
+ endpointHost: generativelanguage.googleapis.com
+ keySet: true
+ ready: true
+ source: stored
+ editable: true
+ saved:
+ - provider: google
+ login: endpoint
+ endpointHost: generativelanguage.googleapis.com
+ changedAt: '2026-11-17T09:00:00.000Z'
+ AiConnectionFixedExample:
+ summary: A team's OpenBot, where whoever runs it sets the provider.
+ value:
+ provider: openai
+ login: api-key
+ model: null
+ endpointHost: null
+ keySet: true
+ ready: true
+ source: environment
+ editable: false
+ saved: []
+ changedAt: null
+ AiConnectionNoneExample:
+ summary: Nothing chosen yet.
+ value:
+ provider: null
+ login: null
+ model: null
+ endpointHost: null
+ keySet: false
+ ready: false
+ source: none
+ editable: true
+ saved: []
+ changedAt: null
CredentialExample:
summary: The Bots' model key.
value:
diff --git a/api/openapi/notifications.yaml b/api/openapi/notifications.yaml
index 2c82710924..6dc68a87f7 100644
--- a/api/openapi/notifications.yaml
+++ b/api/openapi/notifications.yaml
@@ -946,7 +946,7 @@ components:
needs, or what the person's Bots' check-ins found that needs them.
DeliveryState:
type: string
- enum: [queued, running, accepted, sent, delivered, failed, unknown, opted_out]
+ x-extensible-enum: [queued, running, accepted, sent, delivered, failed, unknown, opted_out]
description: >-
Where it got to. accepted is the provider taking it without saying yet
that it arrived. unknown is a send that may or may not have gone.
diff --git a/api/openapi/organizations.yaml b/api/openapi/organizations.yaml
index 7b2078f78c..09bc89ed9a 100644
--- a/api/openapi/organizations.yaml
+++ b/api/openapi/organizations.yaml
@@ -668,7 +668,7 @@ components:
type: string
description: What people call it.
role:
- $ref: './common.yaml#/components/schemas/PersonRole'
+ $ref: './common.yaml#/components/schemas/PersonRoleAnswer'
active:
type: boolean
description: >-
@@ -713,7 +713,7 @@ components:
type: string
minLength: 1
maxLength: 100
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: What people call it.
slug:
type: string
@@ -743,7 +743,7 @@ components:
out. The server's verdict. Empty when the caller may not change
this member's role.
items:
- $ref: './common.yaml#/components/schemas/PersonRole'
+ $ref: './common.yaml#/components/schemas/PersonRoleAnswer'
id:
type: string
description: The person's id.
@@ -757,7 +757,7 @@ components:
type: [string, 'null']
description: Their picture's address, when they have one.
role:
- $ref: './common.yaml#/components/schemas/PersonRole'
+ $ref: './common.yaml#/components/schemas/PersonRoleAnswer'
joinedAt:
type: string
format: date-time
@@ -800,7 +800,7 @@ components:
type: string
minLength: 1
maxLength: 100
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: What people call it.
InvitationSender:
type: object
@@ -830,7 +830,7 @@ components:
$ref: './common.yaml#/components/schemas/AssignableRole'
status:
type: string
- enum: [pending, expired, declined]
+ x-extensible-enum: [pending, expired, declined]
description: >-
pending while it waits for an answer, expired once its seven days
ran out, declined when the person turned it down.
@@ -915,7 +915,7 @@ components:
$ref: './common.yaml#/components/schemas/AssignableRole'
status:
type: string
- enum: [pending, expired, accepted, declined, canceled]
+ x-extensible-enum: [pending, expired, accepted, declined, canceled]
description: >-
pending while it can still be answered. expired once its seven
days ran out, accepted or declined once the person answered,
diff --git a/api/openapi/passwords-and-recorder.yaml b/api/openapi/passwords-and-recorder.yaml
index 8d90ac74d5..ec0acf2dc4 100644
--- a/api/openapi/passwords-and-recorder.yaml
+++ b/api/openapi/passwords-and-recorder.yaml
@@ -1041,7 +1041,7 @@ components:
(organization).
SignInStatus:
type: string
- enum:
+ x-extensible-enum:
- pending
- filling
- code_required
diff --git a/api/openapi/schedules.yaml b/api/openapi/schedules.yaml
index fbb7e436b3..f35f23b90a 100644
--- a/api/openapi/schedules.yaml
+++ b/api/openapi/schedules.yaml
@@ -56,9 +56,9 @@ paths:
instruction on the schedule and posts in the conversation, which must be
one the caller and the Bot share. With goalId it is the routine that
runs that goal on a schedule. A person may have 20 routines switched on,
- and a routine runs at most once an hour. There is no operation to change
- a routine: that is done by asking its Bot. A repeated request with the
- same Idempotency-Key and body returns the first result."
+ and a routine runs at most once an hour. updateRoutine changes one. A
+ repeated request with the same Idempotency-Key and body returns the
+ first result."
security:
- webSession: []
- appOAuth:
@@ -110,6 +110,62 @@ paths:
parameters:
- $ref: ./common.yaml#/components/parameters/OrganizationId
- $ref: "#/components/parameters/RoutineId"
+ patch:
+ tags:
+ - Routines
+ operationId: updateRoutine
+ summary: Change a routine
+ description: "Change one of the caller's routines: its name, what the Bot does,
+ its schedule or its time zone. Only the fields sent change. It keeps
+ its id, its conversation and its runs. A new schedule or time zone
+ follows the same rules as a new routine's, and its next run is worked
+ out from now. One that does not exist, or is somebody else's, is not
+ found. A repeated request with the same Idempotency-Key and body
+ returns the first result."
+ security:
+ - webSession: []
+ - appOAuth:
+ - routines:write
+ - apiKey: []
+ parameters:
+ - $ref: ./common.yaml#/components/parameters/IdempotencyKey
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/UpdateRoutineRequest"
+ examples:
+ request:
+ value:
+ instruction: Summarize my unread mail, today's calendar and the
+ weather.
+ cron: 30 8 * * 1-5
+ responses:
+ "200":
+ description: The routine, as saved.
+ headers: *a1
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/RoutineResponse"
+ examples:
+ answer:
+ $ref: "#/components/examples/RoutineResponseExample"
+ "400":
+ $ref: "#/components/responses/InvalidRoutine"
+ "401":
+ $ref: ./common.yaml#/components/responses/Unauthenticated
+ "403":
+ $ref: ./common.yaml#/components/responses/Forbidden
+ "404":
+ $ref: "#/components/responses/RoutineNotFound"
+ "409":
+ $ref: ./common.yaml#/components/responses/IdempotencyConflict
+ "500":
+ $ref: ./common.yaml#/components/responses/ServerError
+ default:
+ $ref: ./common.yaml#/components/responses/UnexpectedError
delete:
tags:
- Routines
@@ -1777,6 +1833,7 @@ components:
- id
- botId
- schedule
+ - cron
- timezone
- instruction
- title
@@ -1796,6 +1853,11 @@ components:
schedule:
type: string
description: When it runs, as text to show.
+ cron:
+ type: string
+ description: "The schedule as it is kept, five cron fields: minute, hour, day
+ of month, month, day of week. What a form that changes the schedule
+ starts from."
timezone:
type: string
description: The IANA time zone the schedule is read in.
@@ -1868,12 +1930,11 @@ components:
type:
- string
- "null"
- enum:
+ x-extensible-enum:
- succeeded
- failed
- skipped
- waiting
- - null
description: How it ended, or null while it is still open. Only failed is a
failure.
at:
@@ -1947,6 +2008,38 @@ components:
type: string
description: The goal this routine runs, when it runs one.
maxLength: 200
+ UpdateRoutineRequest:
+ type: object
+ additionalProperties: false
+ minProperties: 1
+ description: What to change. Only the fields sent change, and at least one must
+ be sent.
+ properties:
+ title:
+ type: string
+ description: A new name, at most 100 characters. Empty takes the name away, and
+ the routine is called by what it does.
+ maxLength: 100
+ instruction:
+ type: string
+ minLength: 1
+ maxLength: 2000
+ pattern: \S
+ description: What the Bot does on each run from now on. At most 2,000
+ characters.
+ cron:
+ type: string
+ minLength: 1
+ maxLength: 200
+ pattern: \S
+ description: "A new schedule, as five cron fields: minute, hour, day of month,
+ month, day of week. The same rules as a new routine's."
+ timezone:
+ type: string
+ minLength: 1
+ maxLength: 100
+ pattern: \S
+ description: A new IANA time zone to read the schedule in.
RoutineResponse:
type: object
required:
@@ -1991,7 +2084,7 @@ components:
description: The run's id.
status:
type: string
- enum:
+ x-extensible-enum:
- running
- succeeded
- failed
@@ -2162,7 +2255,7 @@ components:
description: When it last ran, or null.
lastStatus:
type: string
- enum:
+ x-extensible-enum:
- idle
- running
- succeeded
@@ -2337,7 +2430,7 @@ components:
description: Where it can be opened, or null.
status:
type: string
- enum:
+ x-extensible-enum:
- open
- dismissed
- started
@@ -2617,7 +2710,7 @@ components:
description: When it is done. May be empty.
status:
type: string
- enum:
+ x-extensible-enum:
- active
- paused
- completed
@@ -2790,7 +2883,7 @@ components:
description: The run's id.
status:
type: string
- enum:
+ x-extensible-enum:
- queued
- running
- waiting
@@ -3649,6 +3742,7 @@ components:
id: 4a0d6f6e-1c1b-4f3e-8a52-0d9b7c6e5f41
botId: agent_9b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21
schedule: Weekdays at 09:00
+ cron: 0 9 * * 1-5
timezone: America/New_York
instruction: Summarize my unread mail and today's calendar.
title: Morning brief
diff --git a/api/openapi/teams.yaml b/api/openapi/teams.yaml
index 7e579c0511..a7cc40517e 100644
--- a/api/openapi/teams.yaml
+++ b/api/openapi/teams.yaml
@@ -515,7 +515,7 @@ components:
type: string
minLength: 1
maxLength: 100
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: What people call it.
description:
type: string
@@ -537,7 +537,7 @@ components:
type: string
minLength: 1
maxLength: 100
- pattern: ^[^\x00]*\S[^\x00]*$
+ pattern: ^[^\x00]*[^\s\x00][^\x00]*$
description: What people call it.
description:
type: [string, 'null']
diff --git a/app/src/components/admin/controls/computer-sections.tsx b/app/src/components/admin/controls/computer-sections.tsx
index 49e1d93aa1..17a77d54b4 100644
--- a/app/src/components/admin/controls/computer-sections.tsx
+++ b/app/src/components/admin/controls/computer-sections.tsx
@@ -49,12 +49,13 @@ import {
setNetworkPolicyMutationOptions,
terminateInactiveComputersMutationOptions,
} from "@/lib/enterprise/mutations";
-import type {
- EgressRule,
- EnterpriseOverview,
- NetworkMode,
- NetworkPolicy,
- NetworkScopeKind,
+import {
+ type EgressRule,
+ type EnterpriseOverview,
+ knownNetworkScope,
+ type NetworkMode,
+ type NetworkPolicy,
+ type NetworkScopeKind,
} from "@/lib/enterprise/queries";
import { MISSING_TEAM, teamName } from "@/lib/teams/names";
import { type TeamSummary, teamListQueryOptions } from "@/lib/teams/queries";
@@ -184,12 +185,17 @@ function NetworkPolicies({ data }: { data: EnterpriseOverview }) {
const organizationPolicy = data.network.find(
(row) => row.scopeKind === "organization",
);
- // A team's rows wait for the teams' names: a row is never titled with an id.
- const scopedPolicies = data.network.filter(
- (row) =>
- row.scopeKind === "group" ||
- (row.scopeKind === "team" && teams.data !== undefined),
- );
+ /*
+ * A team's rows wait for the teams' names: a row is never titled with an id. A policy of a kind a
+ * newer server names that this app doesn't know is left out, so it is never opened or sent back.
+ */
+ const scopedPolicies = data.network
+ .filter(knownNetworkScope)
+ .filter(
+ (row) =>
+ row.scopeKind === "group" ||
+ (row.scopeKind === "team" && teams.data !== undefined),
+ );
const titleOf = (policy: NetworkPolicy) => {
if (policy.scopeKind === "group") return `Group: ${policy.scopeId}`;
const name = teamName(known, policy.scopeId);
diff --git a/app/src/components/admin/controls/describe-capabilities.tsx b/app/src/components/admin/controls/describe-capabilities.tsx
index 9e28cc6876..2891fde0a3 100644
--- a/app/src/components/admin/controls/describe-capabilities.tsx
+++ b/app/src/components/admin/controls/describe-capabilities.tsx
@@ -1,6 +1,7 @@
import {
IconBuilding,
IconChecklist,
+ IconCircleDashed,
IconDeviceDesktop,
IconFolder,
IconKey,
@@ -58,10 +59,12 @@ function scopeWords(change: CapabilityChange, teams: Teams): string {
const name = teamName(teams, change.scopeId);
return name === MISSING_TEAM ? name : `Team: ${name}`;
}
- return `Group: ${change.scopeId}`;
+ if (change.scopeKind === "group") return `Group: ${change.scopeId}`;
+ // A kind of scope a newer server names that this app doesn't know: its id alone.
+ return change.scopeId;
}
-const SCOPE_ICONS = {
+const SCOPE_ICONS: Partial> = {
organization: IconBuilding,
role: IconUserShield,
team: IconUsersGroup,
@@ -112,7 +115,7 @@ export function ChangeRows({
{changes.map((change, index) => {
const row = index + 1;
- const Icon = SCOPE_ICONS[change.scopeKind];
+ const Icon = SCOPE_ICONS[change.scopeKind] ?? IconCircleDashed;
const setting = settingWords(change);
const title = titles[change.capability] ?? change.capability;
const wrong = problems.filter((problem) => problem.change === row);
@@ -160,7 +163,7 @@ export function ChangeRows({
}
/** Why a person has a permission or not, after "Now" or "After this,". */
-function answerWords(answer: CapabilityAnswer, teams: Teams): string {
+export function answerWords(answer: CapabilityAnswer, teams: Teams): string {
const state = answer.allowed ? "on" : "off";
switch (answer.decidedBy) {
case "default":
@@ -175,6 +178,9 @@ function answerWords(answer: CapabilityAnswer, teams: Teams): string {
}
case "group":
return `on through ${answer.scopeId}`;
+ default:
+ // Decided in a way a newer server names that this app doesn't know: on or off alone.
+ return state;
}
}
diff --git a/app/src/components/admin/shared-computers-notice.tsx b/app/src/components/admin/shared-computers-notice.tsx
new file mode 100644
index 0000000000..c8c1d0eed2
--- /dev/null
+++ b/app/src/components/admin/shared-computers-notice.tsx
@@ -0,0 +1,44 @@
+import { useQuery } from "@tanstack/react-query";
+import { currentUserQueryOptions } from "@/lib/auth/queries";
+import { isOrganizationAdmin } from "@/lib/auth/roles";
+import { deploymentCapabilitiesQueryOptions } from "@/lib/deployment/queries";
+import { computerModeQueryOptions } from "@/lib/enterprise/queries";
+import { cn } from "@/lib/utils";
+
+/**
+ * Said to an admin wherever Admin talks about computers: this OpenBot runs every person's Bots on
+ * one computer, which is a proof-of-concept setup, and how to give each person their own.
+ *
+ * The server decides (the settings' `computerMode`): an OpenBot only one person uses answers
+ * `per-person`, because that one computer is the person's own. Asked only where the settings exist:
+ * by an admin, so nobody else asks for settings they can't read, and in the team edition, because
+ * the personal edition (OpenBot Desktop) keeps no organization settings and answers them 404.
+ * Nothing while loading, on a failed read, or from a server that does not say.
+ */
+export function SharedComputersNotice({ className }: { className?: string }) {
+ const admin = isOrganizationAdmin(
+ useQuery(currentUserQueryOptions()).data?.role,
+ );
+ const team =
+ useQuery(deploymentCapabilitiesQueryOptions()).data?.edition === "team";
+ const mode = useQuery({
+ ...computerModeQueryOptions(),
+ enabled: admin && team,
+ });
+ if (!admin || !team || mode.data !== "shared") return null;
+ return (
+
+ Everyone's Bots share one computer. A
+ command one Bot runs can read another person's files there, so use this
+ only for a proof of concept. To give each person a computer of their own,
+ set computers.mode: sandbox in the Helm chart, or{" "}
+ COMPUTER_SUPERVISOR_URL with Docker Compose.
+
+ );
+}
diff --git a/app/src/components/agents/new-bot-sheet.tsx b/app/src/components/agents/new-bot-sheet.tsx
index dde1fe4695..d0e61003f4 100644
--- a/app/src/components/agents/new-bot-sheet.tsx
+++ b/app/src/components/agents/new-bot-sheet.tsx
@@ -1,4 +1,5 @@
import {
+ DEFAULT_BOT_ENGINE,
OPENBOT_HARNESS_NAME,
reachedThroughMastra,
summaryFor,
@@ -302,7 +303,13 @@ function NewBotFlow({ onCreated }: { onCreated: (agentId: string) => void }) {
const create = async (chosen: Runtime) => {
const managed = chosen.kind === "managed";
- const framework = managed ? declaredFramework(chosen.harness) : undefined;
+ /*
+ * A Bot somebody runs names its framework; one that runs here names the engine new Bots run
+ * on (`DEFAULT_BOT_ENGINE`). The server decides each run's engine from there.
+ */
+ const framework = declaredFramework(
+ managed ? chosen.harness : DEFAULT_BOT_ENGINE,
+ );
const agent = await createAgent.mutateAsync({
...agentInputFrom({
name: name.trim(),
@@ -317,8 +324,9 @@ function NewBotFlow({ onCreated }: { onCreated: (agentId: string) => void }) {
isolated:
!personal && isolated && isolationAvailable && isolationAllowed,
}),
- // The framework picked from the list, so the Bot is told what runs it. None for an agent
- // somebody already runs, since nobody said what is behind its address.
+ // The framework picked from the list, so the Bot is told what runs it, or the engine a Bot
+ // that runs here is made on. None for an agent somebody already runs, since nobody said what
+ // is behind its address.
...(framework ? { harness: framework } : {}),
});
/*
diff --git a/app/src/components/approvals/inline-approval.tsx b/app/src/components/approvals/inline-approval.tsx
index 33925f4e43..c18d9e43e1 100644
--- a/app/src/components/approvals/inline-approval.tsx
+++ b/app/src/components/approvals/inline-approval.tsx
@@ -149,7 +149,9 @@ export function InlineApproval({
submitting={decision.isPending}
title={title.charAt(0).toUpperCase() + title.slice(1)}
>
- {share?.text ? : null}
+ {share?.text || share?.files.length ? (
+
+ ) : null}
) : null}
diff --git a/app/src/components/approvals/share-details.tsx b/app/src/components/approvals/share-details.tsx
index cc2addd03d..1043759117 100644
--- a/app/src/components/approvals/share-details.tsx
+++ b/app/src/components/approvals/share-details.tsx
@@ -1,5 +1,14 @@
+import { attachmentUrl as storedAttachmentUrl } from "@openbot/shared/attachments";
import { PRIVATE_SHARE_TOOL_REF } from "@openbot/shared/tool-name";
import { useCallback, useState } from "react";
+import { SentFileCard } from "@/components/channels/sent-file-card";
+import type { SentFile } from "@/lib/computers/sent-file";
+import {
+ BotMarkdown,
+ markdownComponents,
+ markdownPlugins,
+ replyRemarkPlugins,
+} from "@/lib/markdown";
import { cn } from "@/lib/utils";
/** An approval as much as a share's details read: what it is, where it goes, what it sends. */
@@ -12,14 +21,17 @@ type ShareAction = { toolRef: string; target?: unknown; args?: unknown };
* Handed to another person's Bot, the sentence says who reads it. When the person also asks before
* changes, one card is both asks, so it says it hands the work over and shares the text.
*/
-export function shareOf(
- action: ShareAction,
-): { caption: string | undefined; text: string | undefined } | null {
+export function shareOf(action: ShareAction): {
+ caption: string | undefined;
+ text: string | undefined;
+ files: SentFile[];
+} | null {
if (action.toolRef !== PRIVATE_SHARE_TOOL_REF) return null;
const share = (action.args ?? {}) as {
preview?: unknown;
audience?: unknown;
handOff?: unknown;
+ files?: unknown;
};
const handedTo =
typeof share.handOff === "string"
@@ -38,53 +50,121 @@ export function shareOf(
typeof share.preview === "string" && share.preview.trim()
? share.preview
: undefined,
+ files: filesOf(share.files),
};
}
/**
- * The text a share would send, whole. A short text is shown as it is. A long one is cut to a few
- * lines and faded at the foot, with Show all to read the rest in place, as a step's output is in
- * the conversation. Never a box that scrolls on its own: where scroll bars hide until used, the
- * end of the text looked like the end of the box, and the person allowed words they never saw.
+ * The files a held reply carries, as the server names them on its request (`args.files`): what a
+ * Bot sent from its computer with a reply in a group, shown with the words so the person sees the
+ * files they would share. Anything not shaped like one is left out.
*/
-export function ShareText({ text }: { text: string }) {
+function filesOf(value: unknown): SentFile[] {
+ if (!Array.isArray(value)) return [];
+ return value.flatMap((file) => {
+ const { id, name, mimeType, sizeBytes } = (file ?? {}) as Record<
+ string,
+ unknown
+ >;
+ return typeof id === "string" &&
+ id &&
+ typeof name === "string" &&
+ typeof mimeType === "string" &&
+ typeof sizeBytes === "number"
+ ? [
+ {
+ attachmentId: id,
+ name,
+ mimeType,
+ sizeBytes,
+ url: storedAttachmentUrl(id),
+ },
+ ]
+ : [];
+ });
+}
+
+/**
+ * What a share would send, whole, as it will look where it goes. A short text is shown as it is. A
+ * long one is cut to a few lines and faded at the foot, with Show all to read the rest in place, as
+ * a step's output is in the conversation. Never a box that scrolls on its own: where scroll bars
+ * hide until used, the end of the text looked like the end of the box, and the person allowed
+ * words they never saw.
+ *
+ * THE WORDS ARE DRAWN AS THE CONVERSATION DRAWS THEM, AND THE FILES AS THEIR CARDS. Shown as the
+ * stored text, a group reply that sent a file read "Sent [group-budget.csv](/api/attachments/…)"
+ * and "Attached: **group-budget.csv**", so the person deciding whether to share a file read a URL
+ * and asterisks and never saw the file (found by the end-to-end pass). The cards are the compact
+ * ones a list has room for; the person may open or download the file, which is their Bot's.
+ */
+export function ShareText({
+ text,
+ files = [],
+}: {
+ text: string | undefined;
+ files?: readonly SentFile[];
+}) {
const [open, setOpen] = useState(false);
const [long, setLong] = useState(false);
const measure = useCallback((element: HTMLQuoteElement | null) => {
if (element) setLong(element.scrollHeight > element.clientHeight + 1);
}, []);
+ if (!text) return ;
return (
-
-
- {text}
- {long && !open ? (
-
- ) : null}
-
- {long ? (
-
);
}
diff --git a/app/src/components/channels/conversation-view.tsx b/app/src/components/channels/conversation-view.tsx
index 6d5aec840b..9b462c1667 100644
--- a/app/src/components/channels/conversation-view.tsx
+++ b/app/src/components/channels/conversation-view.tsx
@@ -1,5 +1,3 @@
-import { deleteAttachment } from "@/lib/api/generated/conversations/conversations";
-import { idempotencyKey, organizationId } from "@/lib/api/request";
import type { Message } from "@ag-ui/core";
import type { Attachment } from "@copilotkit/react-core/v2";
import {
@@ -25,7 +23,15 @@ import {
reduceQueue,
} from "@/components/channels/composer";
import { StillWorkingError } from "@/components/channels/composer/queue";
-import { NotifyPrompt } from "@/components/notifications/notify-prompt";
+import {
+ NotifyPrompt,
+ notifyPromptAnswered,
+} from "@/components/notifications/notify-prompt";
+import { StarPrompt } from "@/components/star-prompt/star-prompt";
+import { deleteAttachment } from "@/lib/api/generated/conversations/conversations";
+import { idempotencyKey, organizationId } from "@/lib/api/request";
+import type { ComposerAttachmentLimits } from "@/lib/deployment/queries";
+import { useNotificationPermission } from "@/lib/notifications/permission";
import { newId } from "../../lib/new-id";
/** How soon a drain the Bot was still too busy for goes again. Nothing is sent while it waits. */
@@ -41,6 +47,7 @@ export function ConversationView({
commands,
channelId,
holdsFilesUntilSent = false,
+ attachmentLimits,
disabled = false,
onSendHeld,
pending = false,
@@ -84,6 +91,8 @@ export function ConversationView({
* creates the conversation. See `Composer`.
*/
holdsFilesUntilSent?: boolean;
+ /** How large a picked file may be, forwarded to the composer (`useAttachmentLimits`). */
+ attachmentLimits?: ComposerAttachmentLimits;
disabled?: boolean;
/** Writing is open and sending waits on the caller; forwarded to the composer. */
onSendHeld?: () => void;
@@ -199,6 +208,7 @@ export function ConversationView({
* for the same fact.
*/
const [running, setRunning] = useState(false);
+ const notificationPermission = useNotificationPermission();
const inFlight = pending || running;
/**
@@ -524,6 +534,25 @@ export function ConversationView({
{messages.some((message) => message.role === "user") ? (
) : null}
+ {/*
+ * The ask to star OpenBot on GitHub, when the server says it is due (`StarPrompt`), and never
+ * beside the notifications offer: one card above the composer at a time, and the offer that
+ * is useful to this person goes first.
+ *
+ * Never right after an error: not while the last turn here ended without an answer
+ * (`stopped`, where a failed run is said). Not read off `notice`: a conversation passes one
+ * every time, mostly empty, so its presence says nothing. It also waits while OpenBot Desktop has not yet
+ * said whether notifications are on (`checking`), or the card could draw, be counted as
+ * shown, and vanish when the answer is "not asked yet". And never in a conversation that
+ * cannot take a message: the brief "Picking a Bot" screen, or one whose Bot was deleted.
+ */}
+ {disabled ||
+ stopped ||
+ notificationPermission === "checking" ||
+ (notificationPermission === "default" &&
+ !notifyPromptAnswered()) ? null : (
+
+ )}
{/*
* THE DRAWER IS THE LAST THING ABOVE THE COMPOSER, AND THE STARTER TASKS STEP ASIDE FOR IT.
*
@@ -553,6 +582,7 @@ export function ConversationView({
autoFocus={autoFocus}
{...(channelId ? { channelId } : {})}
holdsFilesUntilSent={holdsFilesUntilSent}
+ {...(attachmentLimits ? { attachmentLimits } : {})}
{...(commands ? { commands } : {})}
className="relative w-full mt-auto"
compact
diff --git a/app/src/components/channels/file-icon.tsx b/app/src/components/channels/file-icon.tsx
new file mode 100644
index 0000000000..78de28cced
--- /dev/null
+++ b/app/src/components/channels/file-icon.tsx
@@ -0,0 +1,56 @@
+import {
+ IconFile,
+ IconFileText,
+ IconFileTypeCsv,
+ IconFileTypeDocx,
+ IconFileTypePdf,
+ IconFileTypePpt,
+ IconFileTypeXls,
+ IconJson,
+ IconMarkdown,
+ IconPhoto,
+ type TablerIcon,
+} from "@tabler/icons-react";
+import {
+ type AcceptedFileType,
+ mediaTypeOf,
+} from "@openbot/shared/attachments";
+
+/**
+ * The icon for each kind of file OpenBot takes, keyed by the one list of them
+ * (`ACCEPTED_FILE_TYPES` in shared/attachments.ts). Typed as a record over every type on that list,
+ * so a type added there does not build until it has an icon here.
+ */
+export const FILE_TYPE_ICONS = {
+ "image/png": IconPhoto,
+ "image/jpeg": IconPhoto,
+ "image/gif": IconPhoto,
+ "image/webp": IconPhoto,
+ "application/pdf": IconFileTypePdf,
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
+ IconFileTypeDocx,
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
+ IconFileTypeXls,
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation":
+ IconFileTypePpt,
+ "text/plain": IconFileText,
+ "text/markdown": IconMarkdown,
+ "text/csv": IconFileTypeCsv,
+ "application/json": IconJson,
+} as const satisfies Record;
+
+/** A file's icon by the type the server found in it; the plain file icon for a type not known. */
+export function FileTypeIcon({
+ mimeType,
+ className,
+}: {
+ mimeType: string | undefined;
+ className?: string;
+}) {
+ const type = mediaTypeOf(mimeType ?? "");
+ const Icon =
+ type in FILE_TYPE_ICONS
+ ? FILE_TYPE_ICONS[type as keyof typeof FILE_TYPE_ICONS]
+ : IconFile;
+ return ;
+}
diff --git a/app/src/components/channels/group-chat.tsx b/app/src/components/channels/group-chat.tsx
index 950b6d646e..c04e0bcee3 100644
--- a/app/src/components/channels/group-chat.tsx
+++ b/app/src/components/channels/group-chat.tsx
@@ -34,6 +34,7 @@ import {
import { newId } from "@/lib/new-id";
import { ChannelAvatar } from "./avatar";
import { RestoringTranscript } from "./chat-transcript";
+import { SentFileCard } from "./sent-file-card";
import { Composer, toAgentOptions } from "./composer";
import { TeamBotConsentCard } from "./team-bot-consent";
@@ -59,6 +60,13 @@ export function GroupChat({ channelId }: { channelId: string }) {
);
const bots = group.data?.bots ?? [];
const names = new Map(bots.map((bot) => [bot.id, bot.name]));
+ // The people in it, as its members list names them: a person's line is headed with who sent it.
+ const people = new Map(
+ (group.data?.people ?? []).map((person) => [
+ person.userId,
+ person.name || person.email,
+ ]),
+ );
const messages = group.data?.messages ?? [];
const working = messages.some(
(message) => message.status === "running" || message.status === "queued",
@@ -178,7 +186,8 @@ export function GroupChat({ channelId }: { channelId: string }) {
? (names.get(message.agentId) ?? "A Bot no longer here")
: message.ownerUserId === me?.id
? "You"
- : "Someone else"
+ : // Only the people still in it are named: someone taken out is no longer the reader's to see.
+ people.get(message.ownerUserId) || "Someone who left"
}
answeredBy={
message.answeredBy
@@ -303,15 +312,28 @@ function GroupLine({
Thinking
) : message.status === "waiting" ? (
-
- {message.reason ?? "Waiting for your response."}{" "}
-
- Open {name}
-
+ /*
+ * Only the person whose turn it was can answer what the Bot is waiting on, on the Bot's
+ * page. Everyone else reads why it waits, in words the server writes for them, and is
+ * given nothing to do: the link would open a page with nothing of theirs to answer.
+ */
+
+ {message.reason ??
+ (mine
+ ? "Waiting for your response."
+ : "Waiting for someone else to answer.")}
+ {mine ? (
+ <>
+ {" "}
+
+ Open {name}
+
+ >
+ ) : null}
) : message.consent ? (
// Only the person whose account it asked for can answer; everyone else sees the ask.
@@ -327,27 +349,42 @@ function GroupLine({
{message.consent.serverId} account.
)
+ ) : message.status === "failed" && message.declined ? (
+ // A reply its person chose not to share is a choice, not a fault: a notice, never red.
+
+ {message.text}
+
) : message.status === "failed" ? (
{message.text || "This Bot couldn't answer."}
) : (
-
-
-
- {message.text}
-
-
-
+ <>
+
+
+
+ {message.text}
+
+
+
+ {/*
+ * The files the Bot sent from its computer with this reply, each as the card a
+ * conversation of its own draws, under its words: the reply is all a group keeps of a
+ * turn, so without them the file was a name in the words and nothing to open.
+ */}
+ {message.files?.map((file) => (
+
+ ))}
+ >
)}
diff --git a/app/src/components/channels/sent-file-card.tsx b/app/src/components/channels/sent-file-card.tsx
new file mode 100644
index 0000000000..299df7f1db
--- /dev/null
+++ b/app/src/components/channels/sent-file-card.tsx
@@ -0,0 +1,117 @@
+import { IconAlertTriangle, IconDownload } from "@tabler/icons-react";
+import { useState } from "react";
+import { Button } from "@/components/ui/button";
+import { attachmentAddress } from "@/lib/channels/attachments";
+import { fileSize, kindLabel, type SentFile } from "@/lib/computers/sent-file";
+import {
+ AttachmentLightbox,
+ unavailableSentence,
+ useDocumentIsGone,
+} from "./attachment-view";
+import { FileTypeIcon } from "./file-icon";
+
+/**
+ * A file a Bot sent from its computer, as it sits in the conversation.
+ *
+ * WHAT IT IS FOR. The Bot made something for the person (a chart, a report, a spreadsheet's CSV, a
+ * PDF) and the person wants the thing itself, not a sentence saying where it is on a computer they
+ * cannot open. So the card is the file: its name, its kind and size, a Download button, and for a
+ * picture the picture itself, opening full size in the same lightbox the person's own pictures use.
+ *
+ * Drawn from the tool call's answer alone, so a reopened conversation draws the same card, and read
+ * from the conversation's own attachment address, so every member of the conversation can open it
+ * and nobody else can. The server serves it with the type it found in the bytes; only a picture
+ * opens in the page, everything else downloads.
+ *
+ * The person's own files draw as tiles in a row under their message. This is one file in the Bot's
+ * answer, so it is one card the width of the column (up to a comfortable reading width), with the
+ * same border, fill and corners as those tiles.
+ *
+ * COMPACT, for a list (an approval of a reply that carries the file): no margin and no picture
+ * across the card, the picture shrunk into the icon's place, still opening full size.
+ */
+export function SentFileCard({
+ file,
+ compact = false,
+}: {
+ file: SentFile;
+ compact?: boolean;
+}) {
+ const address = attachmentAddress(file.url);
+ const picture = file.mimeType.toLowerCase().startsWith("image/");
+ const [failedToLoad, setFailedToLoad] = useState(false);
+ const gone = useDocumentIsGone(address, !picture);
+
+ if (failedToLoad || gone) {
+ return (
+
+
+
{unavailableSentence(file.name)}
+
+ );
+ }
+
+ return (
+
+ {picture && !compact ? (
+
+ setFailedToLoad(true)}
+ src={address}
+ />
+
+ ) : null}
+
+ {picture && compact ? (
+
+ setFailedToLoad(true)}
+ src={address}
+ />
+
+ ) : (
+
+
+
+ )}
+
+ {/* `title` because a long name is cut, not wrapped, in the narrow column. */}
+
+ {file.name}
+
+
+ {kindLabel(file.mimeType, file.name)} · {fileSize(file.sizeBytes)}
+
+
+ }
+ size="sm"
+ variant="outline"
+ >
+
+ {/* In a list on a phone the button is its icon, so the file's name and size keep the room. */}
+
+ Download
+
+
+
+
+ );
+}
diff --git a/app/src/components/channels/tool-line.tsx b/app/src/components/channels/tool-line.tsx
index 020436c19d..2d1f8cc96a 100644
--- a/app/src/components/channels/tool-line.tsx
+++ b/app/src/components/channels/tool-line.tsx
@@ -37,7 +37,10 @@ export function ToolLine({
* not happen, so its line says what was attempted. Without it the label is used.
*/
attempted?: string;
- /** What it was done to. Muted, and truncated rather than wrapped. */
+ /**
+ * What it was done to. Muted, and truncated rather than wrapped, except on a refused or failed
+ * step, where it is the reason and wraps in full.
+ */
detail?: string;
running?: boolean;
/** A policy or a boundary said no. Final: nothing the Bot does differently will help. */
@@ -81,11 +84,19 @@ export function ToolLine({
? "text-amber-600 dark:text-amber-500"
: "text-muted-foreground";
+ /*
+ * A REFUSED OR FAILED STEP'S DETAIL IS THE REASON, AND A REASON CUT OFF SAYS NOTHING. Truncated,
+ * "budget.xlsx can't be sent. Bots c..." left a person on a phone not knowing why, nor what would
+ * work. So on those rows the detail wraps in full, and the row wraps too, putting it under the
+ * label when it does not fit beside it. Every other row keeps one line, its detail truncated.
+ */
+ const saysWhy = (refused === true || failed === true) && Boolean(detail);
+
const text = (
{icon ? {icon} : null}
{/*
@@ -113,7 +124,13 @@ export function ToolLine({
: label}
{detail ? (
-
+
{detail}
) : null}
diff --git a/app/src/components/computer/activity-log.tsx b/app/src/components/computer/activity-log.tsx
index 6e12f3708e..913c498685 100644
--- a/app/src/components/computer/activity-log.tsx
+++ b/app/src/components/computer/activity-log.tsx
@@ -22,6 +22,7 @@ import {
IconKeyboard,
IconListDetails,
IconPointer,
+ IconSend,
IconTerminal2,
IconWorld,
} from "@tabler/icons-react";
@@ -41,6 +42,7 @@ const ICONS = {
read_file: IconFile,
write_file: IconFile,
list_files: IconFolder,
+ send_file: IconSend,
} as const;
/** What the line says was done. The subject beside it says what it was done to. */
@@ -49,6 +51,7 @@ const LABELS = {
read_file: "Read",
write_file: "Saved",
list_files: "Listed",
+ send_file: "Sent",
} as const;
const BROWSER_ICONS: Record = {
@@ -189,6 +192,7 @@ const NOT_DONE_LABELS = {
read_file: "Didn't read",
write_file: "Didn't save",
list_files: "Didn't list",
+ send_file: "Didn't send",
} as const;
function Entry({ entry }: { entry: ComputerActivity }) {
diff --git a/app/src/components/computer/computer-view.tsx b/app/src/components/computer/computer-view.tsx
index 83e36df166..765253cef2 100644
--- a/app/src/components/computer/computer-view.tsx
+++ b/app/src/components/computer/computer-view.tsx
@@ -582,9 +582,11 @@ export function ComputerView({
refetchInterval: STATUS_POLL_MS,
retry: false,
});
- /** The fresher of the two answers: the poll that just ran, else the status read. */
- const computerState: ComputerState | undefined =
- polledState ?? status.data?.state;
+ /**
+ * The fresher of the two answers: the poll that just ran, else the status read. A state a newer
+ * server sends that this app doesn't know is none of the ones below: the screen waits for a frame.
+ */
+ const computerState: string | undefined = polledState ?? status.data?.state;
/*
* OPENING THE SCREEN STARTS A COMPUTER THAT IS OFF. Once, for the state the screen was opened on.
*
diff --git a/app/src/components/edition/team-features-dialog.tsx b/app/src/components/edition/team-features-dialog.tsx
index 402789fe2e..c3d7c65832 100644
--- a/app/src/components/edition/team-features-dialog.tsx
+++ b/app/src/components/edition/team-features-dialog.tsx
@@ -37,65 +37,48 @@ import {
import type { NavigationItem } from "@/lib/navigation";
import { BUSINESS_URL } from "@/lib/openbot-for-business";
import { cn } from "@/lib/utils";
+import {
+ BOOK_A_DEMO_LINE,
+ BUSINESS_FEATURE_GROUPS,
+ BUSINESS_FEATURES_MORE,
+ type BusinessFeatureIcon,
+ DEPLOY_LINE,
+} from "@openbot/shared/openbot-for-business";
/** The dialog's first line, in big letters: where OpenBot for Business runs. */
-export const DEPLOY_LINE =
- "Deploy in your own VPC on AWS, Azure or GCP, on-prem, or on OpenBot Cloud.";
+export { DEPLOY_LINE };
+
+/** Each feature's icon. Desktop's first screen draws the same features with the same icons. */
+const FEATURE_ICONS: Record = {
+ "sign-in": IconLogin2,
+ people: IconUsers,
+ "shared-bots": IconUsersGroup,
+ learning: IconSchool,
+ chat: IconMessages,
+ computer: IconDeviceDesktop,
+ controls: IconAdjustments,
+ rules: IconListCheck,
+ policies: IconSparkles,
+ governance: IconChecks,
+ audit: IconHistory,
+};
/**
- * What the team edition has and the personal edition does not, one short line each, in the three
- * things a team gets: its people, where its Bots work, and control over both.
+ * What the team edition has and the personal edition does not (`BUSINESS_FEATURE_GROUPS`), with
+ * the app's icons.
*
* Shown where Admin would be: the list, beside the calendar to book a demo.
*/
export const TEAM_FEATURE_GROUPS: readonly {
title: string;
features: readonly { title: string; icon: Icon }[];
-}[] = [
- {
- title: "For your whole organization",
- features: [
- {
- title: "Sign-in with Google, Microsoft or custom SSO",
- icon: IconLogin2,
- },
- { title: "People, roles and admins", icon: IconUsers },
- {
- title: "Bots shared with your whole organization",
- icon: IconUsersGroup,
- },
- { title: "Learning shared across your organization", icon: IconSchool },
- ],
- },
- {
- title: "Where your Bots work",
- features: [
- { title: "Bots in Slack and Microsoft Teams", icon: IconMessages },
- { title: "A computer for each Bot", icon: IconDeviceDesktop },
- ],
- },
- {
- title: "In control",
- features: [
- {
- title: "Controls over models, apps and networks",
- icon: IconAdjustments,
- },
- { title: "Rules every Bot follows", icon: IconListCheck },
- /*
- * Boundaries, team approval rules, auto-review guidance, permissions, the network allowlist
- * and one Bot's app actions are each described in words on their Admin screen, and each
- * replays the result over recorded activity before it is saved.
- */
- {
- title: "Policies in plain English, tested on past activity",
- icon: IconSparkles,
- },
- { title: "Governance for everyone", icon: IconChecks },
- { title: "A full audit trail, with export", icon: IconHistory },
- ],
- },
-];
+}[] = BUSINESS_FEATURE_GROUPS.map((group) => ({
+ title: group.title,
+ features: group.features.map((feature) => ({
+ title: feature.title,
+ icon: FEATURE_ICONS[feature.icon],
+ })),
+}));
export const TEAM_FEATURES = TEAM_FEATURE_GROUPS.flatMap(
(group) => group.features,
@@ -178,7 +161,9 @@ export function TeamFeaturesDialog() {
))}
-
And tons more…
+
+ {BUSINESS_FEATURES_MORE}
+
@@ -210,7 +195,7 @@ function BookDemo() {
Book a demo
- Pick a time to see a demo or scope a proof of concept with us.
+ {BOOK_A_DEMO_LINE}
diff --git a/app/src/components/layout/client-version-gate.tsx b/app/src/components/layout/client-version-gate.tsx
new file mode 100644
index 0000000000..cc56a430d4
--- /dev/null
+++ b/app/src/components/layout/client-version-gate.tsx
@@ -0,0 +1,236 @@
+import {
+ APP_UPDATE_SENTENCE,
+ type Compatibility,
+ SECURITY_UPDATE_SENTENCE,
+ SERVER_UPDATE_SENTENCE,
+} from "@openbot/shared/client-version";
+import { DOESNT_UPDATE_ITSELF } from "@openbot/shared/desktop-updates";
+import { useMutation, useQuery } from "@tanstack/react-query";
+import { type ReactNode, useSyncExternalStore } from "react";
+import AgentOrb from "@/components/agents/orb/agent-orb";
+import { describe } from "@/components/layout/update-banner";
+import { Button } from "@/components/ui/button";
+import {
+ type ClientRefusal,
+ clientRefusal,
+ subscribeClientRefusal,
+} from "@/lib/client-version/refusal";
+import {
+ type CompatibleApp,
+ deploymentCompatibilityQueryOptions,
+ THIS_APP,
+} from "@/lib/deployment/queries";
+import { installAppUpdateMutationOptions } from "@/lib/desktop/mutations";
+import { desktopAppUpdateQueryOptions } from "@/lib/desktop/queries";
+import { desktopShell } from "@/lib/desktop/shell";
+import { queryClient } from "@/query-client";
+
+/**
+ * What has to be updated before this app and its OpenBot can work together.
+ *
+ * - `page`: this page is older than the OpenBot serves. Loading the page again loads the new one.
+ * - `desktop`: OpenBot Desktop, around this page, is older than the OpenBot serves. Only its own
+ * update fixes that, so the screen offers OpenBot Desktop's Update and restart.
+ * - `server`: the OpenBot is older than this page can use. Only whoever runs it can update it.
+ *
+ * `security` on the first two: the minimum was raised because of a security problem in older
+ * releases, and the screen says so in place of "Update OpenBot".
+ */
+export type UpdateVerdict =
+ | { update: "page"; security?: true }
+ | { update: "desktop"; minimum?: string; security?: true }
+ | { update: "server" };
+
+/**
+ * The verdict, from a refusal this page met and from what the OpenBot's `deployment` says. A refusal
+ * comes first: it names the app the OpenBot refused, which inside OpenBot Desktop's window can be
+ * OpenBot Desktop itself (its relay adds its own name to every request the page makes).
+ */
+export function updateVerdict(
+ refusal: ClientRefusal | null,
+ fit: Compatibility | undefined,
+ inDesktop: boolean,
+): UpdateVerdict | null {
+ if (refusal) {
+ const security = refusal.security ? { security: true as const } : {};
+ return refusal.client === "desktop" && inDesktop
+ ? { update: "desktop", minimum: refusal.minimumVersion, ...security }
+ : { update: "page", ...security };
+ }
+ if (fit?.fit === "app")
+ return fit.security
+ ? { update: "page", security: true }
+ : { update: "page" };
+ if (fit?.fit === "server") return { update: "server" };
+ return null;
+}
+
+/**
+ * The app, unless it and its OpenBot can't work together; then one screen that says what to update,
+ * in place of the app.
+ *
+ * At the root, around every route, so it shows before sign-in as well as after, and so nothing that
+ * would fail is drawn behind it. Two things decide it: the OpenBot's `deployment`, which it never
+ * refuses for the app's version and which the app reads first, and a refusal of any request for
+ * being too old an app (`lib/client-version/refusal.ts`), which is how a tab left open across an
+ * upgrade finds out. While neither has said anything, or the `deployment` could not be read, the app
+ * draws as it always did.
+ *
+ * `app` is this app; a test names another to see the other verdicts drawn.
+ */
+export function ClientVersionGate({
+ children,
+ app = THIS_APP,
+}: {
+ children: ReactNode;
+ app?: CompatibleApp;
+}) {
+ const refusal = useSyncExternalStore(
+ subscribeClientRefusal,
+ clientRefusal,
+ () => null,
+ );
+ const fit = useQuery(deploymentCompatibilityQueryOptions(app));
+ const verdict = updateVerdict(refusal, fit.data, desktopShell() !== null);
+ return verdict ? : children;
+}
+
+/**
+ * The screen itself: the sign-in screen's frame (the orb, the heading, the column), so it reads as
+ * OpenBot's own, with one sentence for a heading and one way forward.
+ *
+ * No "Reload the page": the same screen shows in OpenBot Desktop's window, which has no reload
+ * button. The buttons load the page again themselves.
+ */
+export function UpdateScreen({ verdict }: { verdict: UpdateVerdict }) {
+ return (
+
+
+ );
+}
+
+function loadAgain() {
+ window.location.reload();
+}
+
+/**
+ * This page is older than the OpenBot serves: the OpenBot serves the new one on the next load. For a
+ * security problem the heading says so and already says what to do, so no line repeats it.
+ */
+function PageUpdate({ security }: { security: boolean }) {
+ return (
+ <>
+ {security ? (
+ {SECURITY_UPDATE_SENTENCE}
+ ) : (
+ <>
+ {APP_UPDATE_SENTENCE}
+ This page is from an older version of OpenBot.
+ >
+ )}
+
+ Update
+
+ >
+ );
+}
+
+/** The OpenBot is older than this page can use. Loading again shows whether it has been updated. */
+function ServerUpdate() {
+ return (
+ <>
+ {SERVER_UPDATE_SENTENCE}
+ This OpenBot is on a release this page can't use yet.
+
+ Try again
+
+ >
+ );
+}
+
+/**
+ * OpenBot Desktop is older than the OpenBot serves. Its own Update and restart, as the update banner
+ * offers it, with how far the download has got; or, on a build that never updates itself, what to
+ * do instead.
+ */
+function DesktopUpdate({
+ minimum,
+ security,
+}: {
+ minimum?: string;
+ security: boolean;
+}) {
+ const offer = useQuery(desktopAppUpdateQueryOptions());
+ const install = useMutation(installAppUpdateMutationOptions(queryClient));
+ const updatesItself = offer.data?.updatesItself !== false;
+ const progress = offer.data?.installing ?? null;
+ const busy = install.isPending || progress !== null;
+ return (
+ <>
+
+ {security ? SECURITY_UPDATE_SENTENCE : APP_UPDATE_SENTENCE}
+
+
+ {minimum
+ ? `This OpenBot needs OpenBot Desktop ${minimum} or later.`
+ : "This OpenBot needs a newer OpenBot Desktop."}
+
+ {offer.isLoading ? null : updatesItself ? (
+ install.mutate()}
+ size="lg"
+ >
+ {busy ? describe(progress) : "Update and restart"}
+
+ ) : (
+ {DOESNT_UPDATE_ITSELF}
+ )}
+ {install.error && !busy ? (
+
+ Couldn't install the update: {reason(install.error)}
+
+ ) : null}
+ >
+ );
+}
+
+/** The desktop app refuses with its own sentence, as a plain string. */
+function reason(error: unknown): string {
+ return error instanceof Error ? error.message : String(error);
+}
diff --git a/app/src/components/learning/proposal-dialog.tsx b/app/src/components/learning/proposal-dialog.tsx
index 6be33cac0a..d4f282eb06 100644
--- a/app/src/components/learning/proposal-dialog.tsx
+++ b/app/src/components/learning/proposal-dialog.tsx
@@ -72,6 +72,26 @@ function EvidenceList({ evidence }: { evidence: LearningEvidence[] | null }) {
);
}
+/**
+ * What the dialog says once a proposal is decided. Nothing while it waits, and nothing for a status a
+ * newer server sends that this app doesn't know.
+ */
+export function decidedNote(
+ status: string,
+ removal: boolean,
+ publishedNote: string,
+): string | null {
+ if (status === "approved")
+ return removal
+ ? "Removed. Bots stop using it from their next conversation."
+ : publishedNote;
+ if (status === "rejected")
+ return removal
+ ? "Rejected. The skill stays."
+ : "Rejected. It won't be published.";
+ return null;
+}
+
/**
* One proposed skill: the SKILL.md it publishes, why, and the evidence. With
* `onDecide` it carries Approve and Reject while the proposal is pending review;
@@ -94,7 +114,8 @@ export function ProposalDialog({
>;
onDecide?: (decision: "approve" | "reject") => void;
deciding: boolean;
- decided?: "approved" | "rejected";
+ /** The status the decision left it in, as the server answered it. */
+ decided?: string;
error?: Error | null;
/** What the dialog says once the skill is published; the default is written for Admin. */
publishedNote?: string;
@@ -186,18 +207,12 @@ export function ProposalDialog({
>
) : (
<>
- {status && status !== "pending_review" && (
+ {status && decidedNote(status, removal, publishedNote) && (
- {status === "approved"
- ? removal
- ? "Removed. Bots stop using it from their next conversation."
- : publishedNote
- : removal
- ? "Rejected. The skill stays."
- : "Rejected. It won't be published."}
+ {decidedNote(status, removal, publishedNote)}
)}
diff --git a/app/src/components/manage/computers-page.tsx b/app/src/components/manage/computers-page.tsx
index ec1bf4899a..0826c59fdb 100644
--- a/app/src/components/manage/computers-page.tsx
+++ b/app/src/components/manage/computers-page.tsx
@@ -8,6 +8,7 @@ import {
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { Link } from "@tanstack/react-router";
import { type ReactNode, useState } from "react";
+import { SharedComputersNotice } from "@/components/admin/shared-computers-notice";
import {
ClearBrowserDialog,
useClearBrowserData,
@@ -275,15 +276,8 @@ export function ComputersPage({
) : null}
{personal || agentId ? null : isolation === "shared" ? (
-
-
- Every person's Bots run on one computer.
- {" "}
- Each person keeps their own browser profile and folder for each Bot,
- so logins aren't shared. A command one Bot runs can still read
- another's files. Set COMPUTER_SUPERVISOR_URL to give each
- person a computer of their own.
-
+ // The server's own word on whether this is a shared install (one person's isn't).
+
) : isolation === "per-person" ? (
Each person has their own computer, and every Bot they use runs on it,
diff --git a/app/src/components/notifications/notify-prompt.tsx b/app/src/components/notifications/notify-prompt.tsx
index f9373adfbe..6800fdb7ff 100644
--- a/app/src/components/notifications/notify-prompt.tsx
+++ b/app/src/components/notifications/notify-prompt.tsx
@@ -16,7 +16,8 @@ import {
/** Set once somebody answers the prompt either way, so it is offered once per browser. */
export const NOTIFY_PROMPT_KEY = "openbot-notify-prompt-answered";
-function answered(): boolean {
+/** Whether this browser has answered the offer, either way. The star prompt waits until it has. */
+export function notifyPromptAnswered(): boolean {
try {
return localStorage.getItem(NOTIFY_PROMPT_KEY) !== null;
} catch {
@@ -42,7 +43,7 @@ function remember() {
*/
export function NotifyPrompt() {
const permission = useNotificationPermission();
- const [dismissed, setDismissed] = useState(answered);
+ const [dismissed, setDismissed] = useState(notifyPromptAnswered);
if (permission !== "default" || dismissed) return null;
return (
diff --git a/app/src/components/organizations/organization-settings-page.tsx b/app/src/components/organizations/organization-settings-page.tsx
index bb1db8d65f..4d76a6e073 100644
--- a/app/src/components/organizations/organization-settings-page.tsx
+++ b/app/src/components/organizations/organization-settings-page.tsx
@@ -39,7 +39,7 @@ import {
} from "@/components/ui/item";
import { Separator } from "@/components/ui/separator";
import { currentUserQueryOptions } from "@/lib/auth/queries";
-import { isOrganizationAdmin } from "@/lib/auth/roles";
+import { isOrganizationAdmin, type KnownRole } from "@/lib/auth/roles";
import {
changeMemberRoleMutationOptions,
leaveOrganizationMutationOptions,
@@ -53,6 +53,7 @@ import {
useOrganizationChoices,
} from "@/lib/organizations/queries";
import {
+ givableRoles,
initialsOf,
memberControl,
personName,
@@ -269,7 +270,7 @@ function PersonAvatar({ person }: { person: OrganizationMemberSummary }) {
/** A member and the role they are about to be given. */
type RoleChange = {
member: OrganizationMemberSummary;
- role: OrganizationMemberSummary["role"];
+ role: KnownRole;
};
/**
@@ -321,6 +322,7 @@ function MembersSection({
{members.data.map((member, index) => {
const control = memberControl(member, viewer);
const name = personName(member);
+ const roles = givableRoles(member);
return (
@@ -342,9 +344,9 @@ function MembersSection({
: roleName(member.role)}
- {control || member.assignableRoles.length > 0 ? (
+ {control || roles.length > 0 ? (
- {member.assignableRoles.length > 0 ? (
+ {roles.length > 0 ? (
- {member.assignableRoles.map((role) => (
+ {roles.map((role) => (
giveRole({ member, role })}
diff --git a/app/src/components/plugins/app-access-action.tsx b/app/src/components/plugins/app-access-action.tsx
index 9b5057161d..bb95fd2ced 100644
--- a/app/src/components/plugins/app-access-action.tsx
+++ b/app/src/components/plugins/app-access-action.tsx
@@ -164,6 +164,32 @@ export function AppAccessAction({
* swap: it is navigated, and the button that replaced the first one goes on waiting for it.
*/
const tab = useConnectInNewTab();
+ /*
+ * OpenBot's step before a sign-in, in OpenBot Desktop's window. Drawn whichever button is: the
+ * one that pressed Connect can be swapped for another while the step is on screen.
+ */
+ return (
+ <>
+ {appAccessButton({ access, agentId, personal, role: me?.role, tab })}
+ {tab.consentStep}
+ >
+ );
+}
+
+/** Which of the buttons below an app's state calls for, or nothing where it is ready. */
+function appAccessButton({
+ access,
+ agentId,
+ personal,
+ role,
+ tab,
+}: {
+ access: AppAccess;
+ agentId: string;
+ personal: boolean;
+ role: string | null | undefined;
+ tab: ConnectInNewTab;
+}) {
if (access.state === "ready" || access.state === "shared_not_approved")
return null;
if (
@@ -182,7 +208,7 @@ export function AppAccessAction({
// Theirs to give, admin or not: an owner's grant keeps every call on the asker's own account.
if (access.state === "owner_grantable")
return ;
- if (isOrganizationAdmin(me?.role))
+ if (isOrganizationAdmin(role))
return ;
return ;
}
diff --git a/app/src/components/plugins/broker-directory.tsx b/app/src/components/plugins/broker-directory.tsx
index b3255ee019..b620732f94 100644
--- a/app/src/components/plugins/broker-directory.tsx
+++ b/app/src/components/plugins/broker-directory.tsx
@@ -427,6 +427,8 @@ export function BrokerDirectory({ provider }: { provider: PluginsProvider }) {
>
)}
+ {/* OpenBot's step before a sign-in, in OpenBot Desktop's window. */}
+ {tab.consentStep}
);
}
diff --git a/app/src/components/plugins/connect-in-new-tab.ts b/app/src/components/plugins/connect-in-new-tab.ts
index 9e9c8ac0f6..eec518b780 100644
--- a/app/src/components/plugins/connect-in-new-tab.ts
+++ b/app/src/components/plugins/connect-in-new-tab.ts
@@ -1,8 +1,10 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
-import { useCallback, useEffect, useRef, useState } from "react";
+import { createElement, useCallback, useEffect, useRef, useState } from "react";
+import { ConsentHandoffDialog } from "@/components/plugins/consent-handoff";
import { desktopShell } from "@/lib/desktop/shell";
import {
brokeredConsentFor,
+ type ConsentHandoff,
consentHandoffAddress,
storeConsentHandoff,
} from "@/lib/plugins/consent-handoff";
@@ -48,6 +50,9 @@ export function useConnectInNewTab() {
const stopWaiting = useCallback(() => setWaiting(false), []);
/** The tab the consent is open in, while there is one to watch. */
const handle = useRef(null);
+ /** OpenBot's step, while it is on screen in OpenBot Desktop's window, and the tab it holds. */
+ const [handoff, setHandoff] = useState(null);
+ const held = useRef(null);
/*
* A CLOSED TAB ENDS THE WAIT ONCE THIS TAB HAS THE FOCUS BACK. Somebody who closes the sign-in
@@ -195,31 +200,66 @@ export function useConnectInNewTab() {
}
const { authorizationUrl } = start;
/*
- * THROUGH COMPOSIO, THE TAB SHOWS OPENBOT'S STEP FIRST: what the next pages will say, for a
- * countdown, and then the sign-in (`routes/connecting.tsx`). Anything else goes straight there.
- *
- * NOT IN OPENBOT DESKTOP'S WINDOW. It opens no tab of its own (the window denies `window.open`
- * and hands sites outside OpenBot to the browser), so what is offered there is the link, and a
- * link to one of OpenBot's own pages would open nowhere. The browser has none of this tab's
- * storage either.
+ * THROUGH COMPOSIO, OPENBOT'S STEP COMES FIRST: what the next pages will say, for a countdown,
+ * and then the sign-in. Anything else goes straight there.
*/
- const consent = desktopShell()
- ? null
- : await brokeredConsentFor(queryClient, serverId);
+ const consent = await brokeredConsentFor(queryClient, serverId);
+ /*
+ * IN OPENBOT DESKTOP'S WINDOW THE STEP IS A DIALOG HERE, and the sign-in opens after it. The
+ * window opens no tab of its own: its tab is a stand-in that hands its address to the person's
+ * browser, and the browser has none of this window's storage, so the step's own page
+ * (`/connecting`) would open nowhere. The stand-in is held until the countdown ends or Continue
+ * now is pressed, and then pointed at the sign-in exactly as it was before the step.
+ */
+ if (consent && desktopShell()) {
+ held.current = tab;
+ setHandoff({ ...consent, url: authorizationUrl });
+ return;
+ }
+ // In a browser the new tab shows the step as a page (`routes/connecting.tsx`), then goes on.
const destination = consent
? consentHandoffAddress(
storeConsentHandoff({ ...consent, url: authorizationUrl }),
)
: authorizationUrl;
+ leaveFor(tab, destination);
+ };
+
+ /** Send the claimed tab to `destination`, and watch for the person to come back from it. */
+ const leaveFor = (tab: Window | null, destination: string) => {
setWaiting(true);
if (tab) tab.location.replace(destination);
// The tab was blocked. The url is still good, so offer it as something to click.
else setBlockedUrl(destination);
};
+ const continueHandoff = (step: ConsentHandoff) => {
+ setHandoff(null);
+ const tab = held.current;
+ held.current = null;
+ leaveFor(tab, step.url);
+ };
+ // Cancel opens nothing: the held tab goes, and nothing is left waiting for it.
+ const cancelHandoff = () => {
+ setHandoff(null);
+ held.current?.close();
+ held.current = null;
+ handle.current = null;
+ };
+ const consentStep = createElement(ConsentHandoffDialog, {
+ handoff,
+ onCancel: cancelHandoff,
+ onContinue: continueHandoff,
+ });
+
return {
open,
openAfter,
+ /**
+ * OpenBot's step before a sign-in through Composio, as a dialog, in OpenBot Desktop's window.
+ * Whoever draws the buttons draws this beside them; it is empty everywhere else.
+ */
+ consentStep,
/** A consent is open in the other tab; whoever drew the button should be watching. */
waiting,
/** Called once the server lists the connection, so the button stops saying it is waiting. */
diff --git a/app/src/components/responsibilities/goal-page.tsx b/app/src/components/responsibilities/goal-page.tsx
index d3b4810cfc..aea8d7b925 100644
--- a/app/src/components/responsibilities/goal-page.tsx
+++ b/app/src/components/responsibilities/goal-page.tsx
@@ -76,18 +76,26 @@ import { queryClient } from "@/query-client";
import { KIND_LABEL, Triggers } from "./triggers";
import { useGoalRuns, useGoalTriggers } from "./use-goal-reads";
-type Status = ResponsibilityRecord["status"];
-
/** A responsibility's state, as a word and as the mark its row leads with. */
-export const STATUS: Record<
- Status,
- { label: string; icon: typeof IconTarget }
+const STATUS: Partial<
+ Record
> = {
active: { label: "Active", icon: IconTarget },
paused: { label: "Paused", icon: IconPlayerPause },
completed: { label: "Completed", icon: IconCircleCheck },
};
+/**
+ * A responsibility's state as a word and a mark. A state a newer server sends that this app doesn't
+ * know has no word, and the plain goal mark.
+ */
+export function goalStatusOf(status: string): {
+ label: string | null;
+ icon: typeof IconTarget;
+} {
+ return STATUS[status] ?? { label: null, icon: IconTarget };
+}
+
/**
* What a responsibility's page says under its title: its state, and while it is active, what starts
* it. Computed from the queries on every render so it follows whatever the page just changed.
@@ -106,7 +114,9 @@ export function summaryFor(
triggers: TriggerRecord[] | undefined,
routines: readonly RoutineRecord[] | undefined,
): string {
- const status = STATUS[goal.status].label;
+ const status = goalStatusOf(goal.status).label;
+ // A state this app doesn't know: nothing it can say about it, or about what starts it.
+ if (status === null) return "";
if (goal.status === "completed") return status;
if (goal.status === "paused")
return `${status} · Nothing starts it until you resume it`;
diff --git a/app/src/components/responsibilities/triggers.tsx b/app/src/components/responsibilities/triggers.tsx
index 01e505593a..afae9e8c31 100644
--- a/app/src/components/responsibilities/triggers.tsx
+++ b/app/src/components/responsibilities/triggers.tsx
@@ -174,6 +174,16 @@ function describeFilter(config: TriggerConfig) {
* add one. A fresh key is held here, keyed by trigger, so it survives
* the list refetching after the write that produced it.
*/
+/**
+ * Why a goal's triggers won't start it, while it is paused or completed. Nothing for a state a newer
+ * server sends that this app doesn't know.
+ */
+export function triggersNote(status: string): string | null {
+ return status === "paused" || status === "completed"
+ ? `This goal is ${status}. Its triggers won't start it.`
+ : null;
+}
+
export function Triggers({ goal }: { goal: ResponsibilityRecord }) {
const triggers = useGoalTriggers(goal.id);
const [adding, setAdding] = useState(false);
@@ -196,9 +206,9 @@ export function Triggers({ goal }: { goal: ResponsibilityRecord }) {
}
title="Triggers"
>
- {goal.status !== "active" && (
+ {triggersNote(goal.status) && (
- This goal is {goal.status}. Its triggers won't start it.
+ {triggersNote(goal.status)}
)}
{triggers.error && (
diff --git a/app/src/components/routines/edit-routine-dialog.tsx b/app/src/components/routines/edit-routine-dialog.tsx
new file mode 100644
index 0000000000..0177de8bfe
--- /dev/null
+++ b/app/src/components/routines/edit-routine-dialog.tsx
@@ -0,0 +1,376 @@
+import { useSelector } from "@tanstack/react-form";
+import { useMutation } from "@tanstack/react-query";
+import { useEffect, useId, useRef, useState } from "react";
+import {
+ ScheduleWhen,
+ useRoutineForm,
+} from "@/components/routines/schedule-when";
+import { Button } from "@/components/ui/button";
+import {
+ Combobox,
+ ComboboxContent,
+ ComboboxEmpty,
+ ComboboxInput,
+ ComboboxItem,
+ ComboboxList,
+} from "@/components/ui/combobox";
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
+import {
+ Field,
+ FieldDescription,
+ FieldError,
+ FieldGroup,
+ FieldLabel,
+} from "@/components/ui/field";
+import { Input } from "@/components/ui/input";
+import { Textarea } from "@/components/ui/textarea";
+import type { UpdateRoutineRequest } from "@/lib/api/generated/model";
+import {
+ browserTimeZone,
+ cronFrom,
+ ROUTINE_FORM_DEFAULTS,
+ type RoutineFormValues,
+ routineFormSchema,
+ scheduleFrom,
+} from "@/lib/routines/form";
+import { updateRoutineMutationOptions } from "@/lib/routines/mutations";
+import type { RoutineRecord } from "@/lib/routines/queries";
+import { queryClient } from "@/query-client";
+
+/** The fields this dialog draws, each with the first rule its answer breaks. */
+type Edited = "title" | "instruction" | "time";
+type Messages = Partial>;
+
+const EDITED: readonly Edited[] = ["title", "instruction", "time"];
+
+/** The rules New routine holds a routine on, for the fields this dialog draws. */
+function brokenRules(values: RoutineFormValues): Messages {
+ const messages: Messages = {};
+ const parsed = routineFormSchema.safeParse(values);
+ if (!parsed.success)
+ for (const issue of parsed.error.issues) {
+ const name = issue.path[0] as Edited;
+ if (EDITED.includes(name)) messages[name] ??= issue.message;
+ }
+ return messages;
+}
+
+function sameMessages(a: Messages, b: Messages): boolean {
+ const names = Object.keys(a) as Edited[];
+ return (
+ names.length === Object.keys(b).length &&
+ names.every((name) => a[name] === b[name])
+ );
+}
+
+/**
+ * Every time zone the browser knows, with the routine's own and the person's first. A zone the
+ * browser doesn't list (an older alias the routine was saved with) is still offered, so opening the
+ * dialog never changes it.
+ */
+function timeZones(current: string): string[] {
+ let known: string[] = [];
+ try {
+ known = Intl.supportedValuesOf("timeZone");
+ } catch {
+ known = [];
+ }
+ return [...new Set([current, browserTimeZone(), "UTC", ...known])];
+}
+
+/**
+ * Edit routine: its name, what the Bot does, when it runs and the time zone that's read in. The same
+ * fields and the same schedule picker as New routine, prefilled with what it is now. Saving changes
+ * only what was changed, and the routine keeps its id, its conversation and its runs.
+ *
+ * A schedule the picker can't express (a Bot wrote "every other Tuesday") is offered first, by the
+ * words its row uses, and kept unless another is picked. A routine that runs a goal does what its
+ * goal says, so it has no What to do here.
+ */
+export function EditRoutineDialog({
+ routine,
+ open,
+ onOpenChange,
+}: {
+ routine: RoutineRecord;
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+}) {
+ return (
+
+ );
+}
+
+function EditRoutineForm({
+ routine,
+ onDone,
+}: {
+ routine: RoutineRecord;
+ onDone: () => void;
+}) {
+ const formId = useId();
+ const update = useMutation(updateRoutineMutationOptions(queryClient));
+ // Taken once, when the dialog opened: a refetch landing while it is open must not reset the answers.
+ const [opened] = useState(() => {
+ const schedule = scheduleFrom(routine.cron);
+ return {
+ schedule,
+ values: {
+ ...ROUTINE_FORM_DEFAULTS,
+ ...(schedule ?? {}),
+ agentId: routine.botId,
+ channelId: routine.conversation.id,
+ instruction: routine.instruction,
+ title: routine.title ?? "",
+ } satisfies RoutineFormValues,
+ };
+ });
+ const [keeping, setKeeping] = useState(opened.schedule === null);
+ const [timeZone, setTimeZone] = useState(routine.timezone);
+ const [zones] = useState(() => timeZones(routine.timezone));
+ const runsGoal = routine.goalId !== null;
+
+ const form = useRoutineForm(opened.values, async (value) => {
+ if (Object.keys(brokenRules(value)).length > 0) return;
+ const changes: UpdateRoutineRequest = {};
+ const title = value.title.trim();
+ if (title !== (routine.title ?? "")) changes.title = title;
+ const instruction = value.instruction.trim();
+ if (!runsGoal && instruction !== routine.instruction)
+ changes.instruction = instruction;
+ if (!keeping) {
+ const cron = cronFrom(value);
+ if (cron !== routine.cron) changes.cron = cron;
+ }
+ if (timeZone !== routine.timezone) changes.timezone = timeZone;
+ // Nothing changed is not a save: close as Cancel would.
+ if (Object.keys(changes).length === 0) {
+ onDone();
+ return;
+ }
+ try {
+ await update.mutateAsync({ id: routine.id, changes });
+ } catch {
+ // Said under the fields, from `update.error`. Staying open says it wasn't saved.
+ return;
+ }
+ onDone();
+ });
+
+ // A message shows once its field was worked on, or on every field once Save was pressed.
+ const shown = useSelector(
+ form.store,
+ (state) => {
+ const pressed = state.submissionAttempts > 0;
+ const messages: Messages = {};
+ for (const [name, message] of Object.entries(
+ brokenRules(state.values),
+ ) as [Edited, string][])
+ if (pressed || state.fieldMeta[name]?.isTouched)
+ messages[name] = message;
+ return messages;
+ },
+ { compare: sameMessages },
+ );
+
+ // Each press of Save with a message showing moves focus to the first field that has one.
+ const formRef = useRef(null);
+ const attempts = useSelector(form.store, (state) => state.submissionAttempts);
+ const focusedFor = useRef(0);
+ useEffect(() => {
+ if (attempts === focusedFor.current) return;
+ focusedFor.current = attempts;
+ formRef.current
+ ?.querySelector('[aria-invalid="true"]')
+ ?.focus();
+ }, [attempts]);
+
+ const saving = update.isPending;
+ return (
+ <>
+
+
+ {update.error ? (
+
+ {update.error.message}
+
+ ) : null}
+
+
+
+ Cancel
+
+
+ {saving ? "Saving…" : "Save changes"}
+
+
+ >
+ );
+}
diff --git a/app/src/components/routines/new-routine-page.tsx b/app/src/components/routines/new-routine-page.tsx
index 8ce4662aa2..1b43697082 100644
--- a/app/src/components/routines/new-routine-page.tsx
+++ b/app/src/components/routines/new-routine-page.tsx
@@ -1,4 +1,4 @@
-import { useForm, useSelector } from "@tanstack/react-form";
+import { useSelector } from "@tanstack/react-form";
import { useInfiniteQuery, useMutation, useQuery } from "@tanstack/react-query";
import { Link, linkOptions, useNavigate } from "@tanstack/react-router";
import { useEffect, useRef } from "react";
@@ -8,6 +8,10 @@ import {
PageSection,
PageShell,
} from "@/components/layout/page-shell";
+import {
+ ScheduleWhen,
+ useRoutineForm,
+} from "@/components/routines/schedule-when";
import { Button } from "@/components/ui/button";
import {
Field,
@@ -42,18 +46,12 @@ import {
browserTimeZone,
DOES,
EVENT_SOURCES,
- MONTH_DAYS,
NEW_CONVERSATION,
- REPEAT_LABEL,
- REPEATS,
- type Repeat,
ROUTINE_FORM_DEFAULTS,
type RoutineEventSource,
type RoutineFormValues,
routineFormSchema,
STARTS,
- scheduleSentence,
- WEEKDAY_LABEL,
} from "@/lib/routines/form";
import { CHECK_IN_INTERVALS } from "@/lib/routines/merged";
import {
@@ -153,14 +151,6 @@ function sameMessages(a: Messages, b: Messages): boolean {
);
}
-const MONTH_DAY_LABEL = Object.fromEntries(
- MONTH_DAYS.map((day) => [day, day]),
-) as Record;
-
-const WEEKDAY_ITEMS = Object.fromEntries(
- WEEKDAY_LABEL.map((label, index) => [String(index), label]),
-) as Record;
-
type Does = (typeof DOES)[number];
const DOES_LABEL: Record = {
@@ -261,23 +251,20 @@ export function NewRoutinePage({
};
}, []);
- const form = useForm({
- defaultValues,
- onSubmit: async ({ value }) => {
- if (saved) return;
- // Answers that break a rule write nothing. Pressing Create shows every message (`shown`).
- if (Object.keys(brokenRules(value, allowed, checkIns.data)).length > 0)
- return;
- try {
- // A tell with check-ins off is held by the rule on It should, so this is what was chosen.
- await createFromPlan.mutateAsync(planRoutine(value, timeZone));
- } catch {
- // The alert under the form says what happened, from `createFromPlan.error`.
- return;
- }
- // The person may have left, by the sidebar, while this ran; then there is nowhere to send them.
- if (open.current) await navigate(after(value.agentId));
- },
+ const form = useRoutineForm(defaultValues, async (value) => {
+ if (saved) return;
+ // Answers that break a rule write nothing. Pressing Create shows every message (`shown`).
+ if (Object.keys(brokenRules(value, allowed, checkIns.data)).length > 0)
+ return;
+ try {
+ // A tell with check-ins off is held by the rule on It should, so this is what was chosen.
+ await createFromPlan.mutateAsync(planRoutine(value, timeZone));
+ } catch {
+ // The alert under the form says what happened, from `createFromPlan.error`.
+ return;
+ }
+ // The person may have left, by the sidebar, while this ran; then there is nowhere to send them.
+ if (open.current) await navigate(after(value.agentId));
});
/**
@@ -624,175 +611,18 @@ export function NewRoutinePage({
{starts === "schedule" ? (
-
- When
-
- state.values}
- >
- {(values) => (
-
-
- {scheduleSentence(values)}
-
- , your time ({timeZone}). For anything else,
- like every other Tuesday, ask the Bot in a
- conversation.
-
- )}
-
-
+
+ , your time ({timeZone}). For anything else,
+ like every other Tuesday, ask the Bot in a
+ conversation.
+ >
+ }
+ disabled={saved}
+ form={form}
+ timeError={shown.time}
+ />
) : null}
{starts === "event" ? (
diff --git a/app/src/components/routines/routine-page.tsx b/app/src/components/routines/routine-page.tsx
index e0df8dc6b8..bd6f92f785 100644
--- a/app/src/components/routines/routine-page.tsx
+++ b/app/src/components/routines/routine-page.tsx
@@ -5,6 +5,7 @@ import {
IconHistory,
IconMessage,
IconMessageOff,
+ IconPencil,
IconPlayerPlay,
IconRobot,
IconWorld,
@@ -19,6 +20,7 @@ import {
PageShell,
} from "@/components/layout/page-shell";
import { DeleteRow } from "@/components/routines/delete-row";
+import { EditRoutineDialog } from "@/components/routines/edit-routine-dialog";
import { routinesOf } from "@/components/routines/new-routine-page";
import {
RoutineDetailMissing,
@@ -147,6 +149,13 @@ const RUN_STATUS: Record<
waiting: { text: "Waiting for you", className: "" },
};
+/** How a run's status reads on its row. Nothing for one a newer server sends that this app doesn't know. */
+export function runStatusOf(status: string) {
+ const known: Partial> =
+ RUN_STATUS;
+ return known[status] ?? null;
+}
+
const RUN_SOURCE: Record = {
run_now: "Run now",
trigger: "Triggered",
@@ -182,7 +191,7 @@ function RoutineRuns({ routine }: { routine: RoutineRecord }) {
) : runs.data.length ? (
{runs.data.map((run, index) => {
- const status = RUN_STATUS[run.status] ?? RUN_STATUS.skipped;
+ const status = runStatusOf(run.status);
return (
{index > 0 ? : null}
@@ -191,9 +200,11 @@ function RoutineRuns({ routine }: { routine: RoutineRecord }) {
-
- {status.text}
-
+ {status ? (
+
+ {status.text}
+
+ ) : null}
{RUN_SOURCE[run.source] ?? "Scheduled"} ·{" "}
{relativeTime(run.startedAt)}
@@ -279,9 +290,10 @@ export function RoutineRoutePage({
}
/**
- * Everything about one scheduled routine: switched, run, read back and deleted, each the same write
- * it always was. The switch takes effect when switched, Run now does real work, and Delete, the last
- * row of the actions, asks first, then returns to the list.
+ * Everything about one scheduled routine: switched, run, changed, read back and deleted, each the
+ * same write it always was. The switch takes effect when switched, Run now does real work, Edit
+ * routine opens the fields New routine asks for, and Delete, the last row of the actions, asks first,
+ * then returns to the list.
*/
export function RoutinePage({
routine,
@@ -299,6 +311,7 @@ export function RoutinePage({
const runNow = useMutation(runRoutineNowMutationOptions(queryClient));
const remove = useMutation(deleteRoutineMutationOptions(queryClient));
const [confirming, setConfirming] = useState(false);
+ const [editing, setEditing] = useState(false);
const lastRun = lastRunLabel(routine.lastRun);
const next = nextRunWords(routine);
const does = routineDoes(routine);
@@ -394,6 +407,25 @@ export function RoutinePage({
+ {/* More than one value, so a dialog: the same fields New routine asks for. */}
+ setEditing(true)} type="button" />}
+ size="sm"
+ >
+
+
+
+
+ Edit routine
+
+ Change its name, what it does, or when it runs.
+
+
+
+
+
+
+
{routine.conversation.gone ? (
@@ -514,6 +546,12 @@ export function RoutinePage({
+
+
{/* It names the routine as its heading and its row do, never its schedule, which two can share. */}
{KIND[delivery.kind]}
-
- {CHANNEL[delivery.transport]} · {STATE[delivery.state]} ·{" "}
- {new Date(delivery.createdAt).toLocaleString()}
-
+ {deliveryLine(delivery)}
{delivery.error ? (
{delivery.error}
diff --git a/app/src/components/settings/learning-review.tsx b/app/src/components/settings/learning-review.tsx
index ece8c70f1d..024ee6b237 100644
--- a/app/src/components/settings/learning-review.tsx
+++ b/app/src/components/settings/learning-review.tsx
@@ -46,7 +46,7 @@ function operationLabel(proposal: LearningProposal): string {
}
}
-const RUN_STATUS: Record = {
+const RUN_STATUS: Partial> = {
queued: "queued",
freezing: "starting",
batching: "analyzing",
@@ -56,6 +56,19 @@ const RUN_STATUS: Record = {
failed: "failed",
};
+/**
+ * What a group's row says about its latest run: where it stands, and why it failed when it did. A
+ * status a newer server sends that this app doesn't know is left out.
+ */
+export function latestRunLine(
+ run: Pick,
+): string {
+ const status = RUN_STATUS[run.status];
+ return [status ? `Latest run ${status}.` : null, run.failure]
+ .filter(Boolean)
+ .join(" ");
+}
+
type StartState = {
pending: boolean;
started: { from: string | null } | null;
@@ -305,12 +318,7 @@ export function LearningReview() {
{canReview && (
{group.latestRun
- ? [
- `Latest run ${RUN_STATUS[group.latestRun.status]}.`,
- group.latestRun.failure,
- ]
- .filter(Boolean)
- .join(" ")
+ ? latestRunLine(group.latestRun)
: "No run yet."}
)}
diff --git a/app/src/components/settings/star-on-github.tsx b/app/src/components/settings/star-on-github.tsx
new file mode 100644
index 0000000000..801eeceafa
--- /dev/null
+++ b/app/src/components/settings/star-on-github.tsx
@@ -0,0 +1,75 @@
+import { STAR_ON_GITHUB } from "@openbot/shared/notices";
+import { IconStar } from "@tabler/icons-react";
+import { useMutation, useQuery } from "@tanstack/react-query";
+import { PageRows, PageSection } from "@/components/layout/page-shell";
+import { OPENBOT_REPO_URL } from "@/components/star-prompt/star-prompt";
+import { buttonVariants } from "@/components/ui/button";
+import {
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemDescription,
+ ItemMedia,
+ ItemTitle,
+} from "@/components/ui/item";
+import { deploymentCapabilitiesQueryOptions } from "@/lib/deployment/queries";
+import { recordNudge } from "@/lib/notices";
+import {
+ dismissNoticeMutationOptions,
+ useUserPreferences,
+} from "@/lib/settings/message-list";
+import { queryClient } from "@/query-client";
+
+/**
+ * Settings → General's permanent way to star OpenBot on GitHub: the quiet half of the ask whose
+ * active half is the card above the message box (`components/star-prompt/star-prompt.tsx`).
+ *
+ * Only in the personal edition, like the card: a team's or a company's OpenBot never asks its
+ * people for a star. Unlike the card it stays after an answer, because somebody who said Not now
+ * may want it later and this is where they would look. Pressing it is counted under `settings`, and
+ * answers the card, so somebody who starred from here is not asked again.
+ */
+export function StarOnGitHubSection() {
+ const { data: capabilities } = useQuery(deploymentCapabilitiesQueryOptions());
+ const { data: preferences, userId } = useUserPreferences();
+ const dismiss = useMutation(
+ dismissNoticeMutationOptions(queryClient, userId),
+ );
+ if (capabilities?.edition !== "personal") return null;
+
+ return (
+
+
+
+
+
+
+
+ Star OpenBot on GitHub
+
+ OpenBot is open source. A star helps us keep making it better.
+
+
+
+ {
+ void recordNudge(STAR_ON_GITHUB, "clicked", "settings");
+ if (
+ preferences &&
+ !(preferences.dismissedNotices ?? []).includes(STAR_ON_GITHUB)
+ )
+ dismiss.mutate(STAR_ON_GITHUB);
+ }}
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ Star on GitHub
+
+
+
+
+
+ );
+}
diff --git a/app/src/components/star-prompt/star-prompt.tsx b/app/src/components/star-prompt/star-prompt.tsx
new file mode 100644
index 0000000000..13f76cdd26
--- /dev/null
+++ b/app/src/components/star-prompt/star-prompt.tsx
@@ -0,0 +1,144 @@
+import { STAR_ON_GITHUB } from "@openbot/shared/notices";
+import { IconStar } from "@tabler/icons-react";
+import { useMutation, useQuery } from "@tanstack/react-query";
+import { useEffect, useState } from "react";
+import { Button, buttonVariants } from "@/components/ui/button";
+import {
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemMedia,
+ ItemTitle,
+} from "@/components/ui/item";
+import { currentUserQueryOptions } from "@/lib/auth/queries";
+import { deploymentCapabilitiesQueryOptions } from "@/lib/deployment/queries";
+import { type NudgeAction, noticeDue, recordNudge } from "@/lib/notices";
+import {
+ dismissNoticeMutationOptions,
+ userPreferencesQueryOptions,
+} from "@/lib/settings/message-list";
+import { queryClient } from "@/query-client";
+
+/** Where Star on GitHub goes. The repository's own page, which has the Star button. */
+export const OPENBOT_REPO_URL = "https://github.com/CopilotKit/OpenBot";
+
+/** What the card says. Exported for the tests, which read the words a person reads. */
+export const STAR_ASK =
+ "Enjoying OpenBot? Star it on GitHub so that we can keep making it better.";
+
+/**
+ * Drawn once in this page's life, until it is answered: a card the server said was due a moment
+ * ago stays put when the moment passes, so it never vanishes from under somebody reading it. A
+ * reload asks the server again.
+ */
+let drawnThisPage = false;
+/** Its show is counted once per page. The server counts people, so a second page is no second person. */
+let shownCounted = false;
+
+/** For tests: a fresh page. */
+export function forgetStarPrompt(): void {
+ drawnThisPage = false;
+ shownCounted = false;
+}
+
+/**
+ * The ask to star OpenBot on GitHub, as a card above the message box. The same card as the
+ * notifications offer, so it reads as part of the composer, and never a dialog.
+ *
+ * ONLY WHEN THE SERVER SAYS IT IS DUE. That is the personal edition (OpenBot for one person), never a
+ * team's, for somebody who has used OpenBot on at least three days, right after a win: a copied
+ * answer, a routine's run that finished, a long task that finished. Never after an error, and never
+ * again once answered (shared/notices.ts). The browser only reads the answer: the edition from the
+ * deployment, and `noticesDue` from the person's preferences, which `lib/notices.ts` reads again at
+ * each moment that could make it due.
+ *
+ * READ FROM WHAT THE APP ALREADY LOADED, NEVER FETCHED FROM HERE. The self-host banner, mounted in
+ * every page of the app, loads the person, the deployment and their preferences; this card only
+ * watches those answers (`enabled: false` keeps an observer on the cache and sends nothing), so a
+ * conversation does not grow requests of its own. Named query client: drawn inside the conversation,
+ * whose components read no query context of their own (`voice-call-widget.tsx` names it the same way).
+ */
+export function StarPrompt() {
+ const { data: capabilities } = useQuery(
+ { ...deploymentCapabilitiesQueryOptions(), enabled: false },
+ queryClient,
+ );
+ const userId = useQuery(
+ { ...currentUserQueryOptions(), enabled: false },
+ queryClient,
+ ).data?.id;
+ const { data: preferences } = useQuery(
+ { ...userPreferencesQueryOptions(userId), enabled: false },
+ queryClient,
+ );
+ const dismiss = useMutation(
+ dismissNoticeMutationOptions(queryClient, userId),
+ queryClient,
+ );
+ const answered = (preferences?.dismissedNotices ?? []).includes(
+ STAR_ON_GITHUB,
+ );
+ const due =
+ capabilities?.edition === "personal" &&
+ noticeDue(preferences, STAR_ON_GITHUB);
+ const [held, setHeld] = useState(drawnThisPage);
+ const shown =
+ capabilities?.edition === "personal" &&
+ preferences !== undefined &&
+ !answered &&
+ (due || held);
+
+ useEffect(() => {
+ if (!shown) return;
+ drawnThisPage = true;
+ setHeld(true);
+ if (shownCounted) return;
+ shownCounted = true;
+ void recordNudge(STAR_ON_GITHUB, "shown", "card");
+ }, [shown]);
+
+ if (!shown) return null;
+
+ const respond = (action: NudgeAction) => {
+ void recordNudge(STAR_ON_GITHUB, action, "card");
+ drawnThisPage = false;
+ setHeld(false);
+ dismiss.mutate(STAR_ON_GITHUB);
+ };
+
+ return (
+
+
+
+
+
+ {STAR_ASK}
+
+
+ respond("dismissed")} size="sm" variant="ghost">
+ Not now
+
+ {/*
+ * A link, not a button that opens one: it goes somewhere, and a person can see where before
+ * they go. A new tab in a browser; OpenBot Desktop opens it in the system browser, where
+ * they are signed in to GitHub (`desktop/src-tauri/src/outside-links.js`).
+ */}
+ respond("clicked")}
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ Star on GitHub
+
+
+
+ );
+}
diff --git a/app/src/components/tasks/task-row.tsx b/app/src/components/tasks/task-row.tsx
index 3a39908f06..aa6489db03 100644
--- a/app/src/components/tasks/task-row.tsx
+++ b/app/src/components/tasks/task-row.tsx
@@ -1,6 +1,7 @@
import {
IconAlertTriangle,
IconCircleCheck,
+ IconCircleDashed,
IconFileCheck,
IconHandStop,
IconPlayerStop,
@@ -35,15 +36,16 @@ import {
stoppedByYou,
TASK_DONE_LABEL,
TASK_FAILED_LABEL,
- TASK_STATUS_LABEL,
TASK_STOPPED,
TASK_STOPPED_LABEL,
type TaskStatus,
+ taskStatusLabel,
} from "@/lib/tasks/queries";
import { cn } from "@/lib/utils";
import { queryClient } from "@/query-client";
-const ICONS: Record = {
+/** Each status's icon. A status a newer server sends that this app doesn't know has a plain circle. */
+const ICONS: Partial> = {
ready_for_review: IconFileCheck,
needs_input: IconHandStop,
failed: IconAlertTriangle,
@@ -83,7 +85,7 @@ function look(listed: ListedTask): {
? { state: "stopped", Icon: IconPlayerStop, dot: "bg-muted-foreground" }
: {
state: listed.status,
- Icon: ICONS[listed.status],
+ Icon: ICONS[listed.status] ?? IconCircleDashed,
dot: DOT[listed.status],
};
}
@@ -92,14 +94,14 @@ function look(listed: ListedTask): {
* The task's status in a word or two. One the person stopped reads Stopped, as its card does, and
* one listed as finished (`settled`) reads Done, as its card does and as the heading over it says.
*/
-function statusLabel(listed: ListedTask, settled = false): string {
+function statusLabel(listed: ListedTask, settled = false): string | null {
if (stopped(listed)) return TASK_STOPPED_LABEL;
if (
settled &&
(listed.status === "ready_for_review" || listed.status === "resolved")
)
return TASK_DONE_LABEL;
- return TASK_STATUS_LABEL[listed.status];
+ return taskStatusLabel(listed.status);
}
/**
@@ -125,7 +127,7 @@ function nextLine(listed: ListedTask): string | null {
function boardStatus(
listed: ListedTask,
settled = false,
-): { label: string; line: string | null } {
+): { label: string | null; line: string | null } {
if (listed.status === "failed" && !stopped(listed))
return {
label: TASK_FAILED_LABEL,
@@ -404,7 +406,7 @@ export function TaskBoardRow({
detail={said.line}
icon={}
meta={[
- {boardStatus(listed).label},
+ said.label ? {said.label} : null,
{relativeTime(task.updatedAt)},
...held.meta,
error ? (
@@ -446,7 +448,7 @@ export function TaskBoardRow({
readDetail={status === "needs_input" || state === "stopped"}
icon={}
meta={[
- {said.label},
+ said.label ? {said.label} : null,
{relativeTime(task.updatedAt)},
error ? (
diff --git a/app/src/components/tasks/turn-work.ts b/app/src/components/tasks/turn-work.ts
index 6caa175197..0cce67d5c5 100644
--- a/app/src/components/tasks/turn-work.ts
+++ b/app/src/components/tasks/turn-work.ts
@@ -1,9 +1,12 @@
+import { SEND_FILE_TOOL } from "@openbot/shared/send-file";
import { SUBAGENT_TOOL } from "@openbot/shared/subagent";
import {
asksThePerson,
type TranscriptItem,
} from "@/components/channels/tool-activity";
import { isPersonSentMessage } from "@/components/channels/transcript-turns";
+import { readOutcome } from "@/lib/computers/activity";
+import { sentFileOf } from "@/lib/computers/sent-file";
import { claudeCodeCall } from "@/lib/copilot/coding-calls";
/*
@@ -43,11 +46,18 @@ export const NO_TURN_WORK: TurnWorkFolds = { at: new Map(), inside: new Set() };
/**
* Whether a call drawn on its own is a step of the work: Claude Code's own tools, the Bot computer's
- * (but not its requests to the person), an app's call, a subtask. Finished, and asking nothing.
+ * (but not its requests to the person, nor a file it sent them), an app's call, a subtask. Finished,
+ * and asking nothing.
+ *
+ * A FILE SENT TO THE PERSON IS PART OF THE ANSWER, NOT A STEP. Folded with the rest, the card for
+ * the CSV a task made sat behind "Worked for 13s", and the thread showed only the answer's words
+ * (found by the end-to-end pass). A send that did not go through is a step like any other.
*/
function isWorkStep(item: Extract): boolean {
if (item.result === undefined || asksThePerson(item.result)) return false;
const { name, arguments: args } = item.toolCall.function;
+ if (name === SEND_FILE_TOOL && sentFileOf(readOutcome(item.result)))
+ return false;
if (name.startsWith("mcp__") || name === SUBAGENT_TOOL) return true;
if (name.startsWith("computer_"))
return !name.startsWith("computer_request_");
diff --git a/app/src/lib/ai-connection/describe.ts b/app/src/lib/ai-connection/describe.ts
new file mode 100644
index 0000000000..1906b159c5
--- /dev/null
+++ b/app/src/lib/ai-connection/describe.ts
@@ -0,0 +1,68 @@
+import type { AiConnection } from "@/lib/api/generated/model";
+import { providerById } from "./providers";
+
+/** One line of the AI connection dialog: what it is, and this OpenBot's answer. */
+export type AiConnectionDetail = { label: string; value: string };
+
+/** The AI connection in a person's words: who provides it, how OpenBot signs in, and the model. */
+export type AiConnectionWords = {
+ provider: string;
+ /** The row's second line: how OpenBot signs in, and the model when one was named. */
+ summary: string;
+ details: AiConnectionDetail[];
+};
+
+/** What Settings says about the AI connection; null when none has been chosen yet. */
+export function describeConnection(
+ connection: Pick<
+ AiConnection,
+ "provider" | "login" | "model" | "endpointHost"
+ >,
+): AiConnectionWords | null {
+ const { provider: id, login, model, endpointHost } = connection;
+ if (!id || !login) return null;
+ const provider = providerById(id)?.name ?? id;
+ let signIn: string;
+ let said: string;
+ switch (login) {
+ case "plan":
+ signIn = id === "anthropic" ? "Claude plan" : "ChatGPT plan";
+ said = `Signed in with your ${signIn}.`;
+ break;
+ case "oauth":
+ signIn = id === "google" ? "Google account" : `${provider} account`;
+ said = `Signed in with your ${signIn}.`;
+ break;
+ case "api-key":
+ signIn = "API key";
+ said = `Uses your ${provider} API key.`;
+ break;
+ case "endpoint":
+ if (id === "openai-compatible") {
+ signIn = endpointHost ?? "Your own address";
+ said = endpointHost
+ ? `Connected to ${endpointHost}.`
+ : "Connected to your own address.";
+ } else {
+ signIn = "API key";
+ said = `Uses your ${provider} API key.`;
+ }
+ break;
+ }
+ const details: AiConnectionDetail[] = [
+ { label: "Provider", value: provider },
+ {
+ label:
+ login === "endpoint" && id === "openai-compatible"
+ ? "Address"
+ : "Sign-in",
+ value: signIn,
+ },
+ ];
+ if (model) details.push({ label: "Model", value: model });
+ return {
+ provider,
+ summary: model ? `${said} Model: ${model}` : said,
+ details,
+ };
+}
diff --git a/app/src/lib/ai-connection/desktop.ts b/app/src/lib/ai-connection/desktop.ts
new file mode 100644
index 0000000000..4de6cc28cf
--- /dev/null
+++ b/app/src/lib/ai-connection/desktop.ts
@@ -0,0 +1,136 @@
+import type {
+ AiConnectionLogin,
+ AiConnectionProvider,
+} from "@/lib/api/generated/model";
+import { invokeDesktop } from "@/lib/desktop/queries";
+
+/**
+ * OpenBot Desktop's side of changing the AI connection in place (desktop_page.rs). A plan's or a
+ * sign-in's credential stays with Desktop, which renews it: these commands never hand one to the
+ * page, except the key an Unbiased AI sign-in mints, which goes straight on to the server.
+ *
+ * Each rejects with Desktop's own sentence, a string or a problem carrying `said`.
+ */
+
+/** The sentence a refused Desktop command gave, or the fallback when it gave none. */
+export function desktopSentence(error: unknown, fallback: string): string {
+ if (typeof error === "string" && error.trim()) return error;
+ if (error && typeof error === "object") {
+ const said = (error as { said?: unknown; message?: unknown }).said;
+ if (typeof said === "string" && said.trim()) return said;
+ const message = (error as { message?: unknown }).message;
+ if (typeof message === "string" && message.trim()) return message;
+ }
+ return fallback;
+}
+
+async function desktop(
+ command: string,
+ args: Record | undefined,
+ fallback: string,
+): Promise {
+ try {
+ return await invokeDesktop(command, args);
+ } catch (error) {
+ throw new Error(desktopSentence(error, fallback));
+ }
+}
+
+export type Plan = "claude" | "chatgpt";
+
+/** Start a Claude or ChatGPT plan sign-in. The address to approve it at, in the browser. */
+export function beginPlanSignIn(plan: Plan): Promise<{ url: string }> {
+ return desktop(
+ "begin_plan_sign_in",
+ { plan },
+ "Couldn't start signing in. Try again.",
+ );
+}
+
+/** Finish it: Claude with the code the browser showed, ChatGPT on its own. The token stays in Desktop. */
+export function finishPlanSignIn(plan: Plan, code?: string): Promise {
+ return desktop(
+ "finish_plan_sign_in",
+ code === undefined ? { plan } : { plan, code },
+ "Couldn't finish signing in. Try again.",
+ );
+}
+
+export function cancelPlanSignIn(plan: Plan): Promise {
+ return desktop("cancel_plan_sign_in", { plan }, "Couldn't stop signing in.");
+}
+
+export type ProviderSignIn = {
+ attemptId: string;
+ url: string;
+ userCode?: string | null;
+};
+
+/** Start a Google, xAI or Unbiased AI sign-in in the browser. */
+export function beginProviderSignIn(
+ provider: "google" | "xai" | "unbiased",
+): Promise {
+ return desktop(
+ "begin_provider_sign_in",
+ { provider },
+ "Couldn't start signing in. Try again.",
+ );
+}
+
+/**
+ * Wait for the browser's approval. Unbiased AI's sign-in mints a key, handed back once for the page
+ * to send straight to the server and drop.
+ */
+export function finishProviderSignIn(
+ attemptId: string,
+): Promise<{ apiKey?: string } | null> {
+ return desktop(
+ "finish_provider_sign_in",
+ { attemptId },
+ "Couldn't finish signing in. Try again.",
+ );
+}
+
+export function cancelProviderSignIn(attemptId: string): Promise {
+ return desktop(
+ "cancel_provider_sign_in",
+ { attemptId },
+ "Couldn't stop signing in.",
+ );
+}
+
+/** Start the one plan engine a plan needs, and wait until it answers. Touches nothing else. */
+export function prepareAiConnection(
+ provider: AiConnectionProvider,
+ login: AiConnectionLogin,
+): Promise<{ ready: true }> {
+ return desktop(
+ "prepare_ai_connection",
+ { provider, login },
+ "OpenBot couldn't start what this plan needs. Try again.",
+ );
+}
+
+/**
+ * Tell Desktop the connection now in use: it records it for its next start, stops a plan engine no
+ * longer needed, and moves the default Bot to one that can use it.
+ */
+export function settleAiConnection(connection: {
+ provider: AiConnectionProvider;
+ login: AiConnectionLogin;
+ model?: string | null;
+ endpointHost?: string | null;
+}): Promise {
+ return desktop(
+ "settle_ai_connection",
+ {
+ provider: connection.provider,
+ login: connection.login,
+ ...(connection.model ? { model: connection.model } : {}),
+ ...(connection.endpointHost
+ ? { endpointHost: connection.endpointHost }
+ : {}),
+ },
+ "OpenBot Desktop couldn't finish the switch.",
+ );
+}
diff --git a/app/src/lib/ai-connection/mutations.ts b/app/src/lib/ai-connection/mutations.ts
new file mode 100644
index 0000000000..2c701e98b2
--- /dev/null
+++ b/app/src/lib/ai-connection/mutations.ts
@@ -0,0 +1,115 @@
+import { mutationOptions, type QueryClient } from "@tanstack/react-query";
+import type {
+ AiConnection,
+ AiConnectionInput,
+} from "@/lib/api/generated/model";
+import {
+ getAiConnection,
+ replaceAiConnection,
+} from "@/lib/api/generated/models/models";
+import { idempotencyKey, organizationId } from "@/lib/api/request";
+import { desktopKeys } from "@/lib/desktop/queries";
+import { modelKeys } from "@/lib/models/queries";
+import { prepareAiConnection, settleAiConnection } from "./desktop";
+import { aiConnectionKeys } from "./queries";
+
+const FALLBACK = "Couldn't change the AI connection. Try again.";
+
+/** Where the switch is, for the button that started it to say. */
+export type ConnectPhase = "starting" | "checking" | "finishing";
+
+export type ConnectVariables = {
+ input: AiConnectionInput;
+ /** In an OpenBot Desktop that changes the connection in place: it starts and settles engines. */
+ desktop: boolean;
+ onPhase?: (phase: ConnectPhase) => void;
+};
+
+/** What a switch ends with: the connection in use, and anything Desktop couldn't finish after it. */
+export type Connected = {
+ connection: AiConnection;
+ /** Desktop's sentence when it couldn't record the switch or move the default Bot. */
+ desktopProblem: string | null;
+};
+
+/**
+ * Switch the AI connection with no restart. The server checks it with the provider before it saves
+ * anything; a refusal throws its one sentence and the connection in use keeps running.
+ *
+ * In Desktop the order is the contract's: a plan's engine starts first (prepare), then the server
+ * switches, then Desktop settles to it. When anything before the switch fails, Desktop settles back
+ * to the connection the server still reports, which stops whatever prepare started.
+ */
+export async function connectAi({
+ input,
+ desktop,
+ onPhase,
+}: ConnectVariables): Promise {
+ try {
+ if (desktop && input.login === "plan") {
+ onPhase?.("starting");
+ await prepareAiConnection(input.provider, input.login);
+ }
+ onPhase?.("checking");
+ const connection = await replaceAiConnection(
+ organizationId(),
+ input,
+ { "Idempotency-Key": idempotencyKey() },
+ { fallback: FALLBACK },
+ );
+ let desktopProblem: string | null = null;
+ if (desktop && connection.provider && connection.login) {
+ onPhase?.("finishing");
+ try {
+ await settleAiConnection({
+ provider: connection.provider,
+ login: connection.login,
+ model: connection.model,
+ endpointHost: connection.endpointHost,
+ });
+ } catch (error) {
+ desktopProblem =
+ error instanceof Error
+ ? error.message
+ : "OpenBot Desktop couldn't finish the switch.";
+ }
+ }
+ return { connection, desktopProblem };
+ } catch (error) {
+ if (desktop) await settleBack();
+ throw error;
+ }
+}
+
+/** Desktop back on the connection the server still uses. Best effort: the refusal is the news. */
+async function settleBack() {
+ try {
+ const current = await getAiConnection(organizationId());
+ if (current.provider && current.login)
+ await settleAiConnection({
+ provider: current.provider,
+ login: current.login,
+ model: current.model,
+ endpointHost: current.endpointHost,
+ });
+ } catch {
+ // Nothing to put back, or Desktop can't say: the person reads the refusal either way.
+ }
+}
+
+/**
+ * The switch, for a dialog. On success the connection, the model catalogue (which provider's models
+ * a person may pick) and every conversation's model choice are read again, since a pick the new
+ * provider doesn't offer is now set aside.
+ */
+export function connectAiMutationOptions(queryClient: QueryClient) {
+ return mutationOptions({
+ mutationFn: (variables: ConnectVariables) => connectAi(variables),
+ onSuccess: () =>
+ Promise.all([
+ queryClient.invalidateQueries({ queryKey: aiConnectionKeys.all }),
+ queryClient.invalidateQueries({ queryKey: modelKeys.all }),
+ queryClient.invalidateQueries({ queryKey: desktopKeys.aiConnection }),
+ ]),
+ });
+}
diff --git a/app/src/lib/ai-connection/providers.ts b/app/src/lib/ai-connection/providers.ts
new file mode 100644
index 0000000000..9102f5084a
--- /dev/null
+++ b/app/src/lib/ai-connection/providers.ts
@@ -0,0 +1,150 @@
+import type {
+ AiConnectionLogin,
+ AiConnectionProvider,
+} from "@/lib/api/generated/model";
+
+/**
+ * The providers Settings offers for the AI connection, in the setup window's order and words.
+ *
+ * The same list as Desktop's setup window (`catalogue()` in desktop/src-tauri/src/provider.rs), so
+ * a person sees the same rows in the app as at setup; ai-connection-providers.test.ts holds the two
+ * in step. Kept here as well because a plain browser has no Desktop to ask.
+ */
+export type AiProvider = {
+ id: AiConnectionProvider;
+ name: string;
+ summary: string;
+ /**
+ * What the row says where only keys and addresses are offered (a plain browser): the setup
+ * window's summary names plans and sign-ins this page can't offer there.
+ */
+ keySummary: string;
+ /** The ways in, in the order the setup window offers them. The first one a page can offer is its default. */
+ logins: AiConnectionLogin[];
+ /** The vendored mark's id (shared/marks), or null for the row that stands for every provider. */
+ mark: string | null;
+};
+
+export const AI_PROVIDERS: AiProvider[] = [
+ {
+ id: "openai",
+ name: "OpenAI",
+ summary: "Sign in with ChatGPT Plus, Pro, Team or Enterprise.",
+ keySummary: "Use an OpenAI API key.",
+ logins: ["plan", "api-key"],
+ mark: "openai",
+ },
+ {
+ id: "anthropic",
+ name: "Anthropic",
+ summary: "Sign in with a Claude Pro, Max, Team or Enterprise plan.",
+ keySummary: "Use an Anthropic API key.",
+ logins: ["plan", "api-key"],
+ mark: "anthropic",
+ },
+ {
+ id: "google",
+ name: "Google Gemini",
+ summary: "Use a Google AI Studio key or sign in for Gemini API access.",
+ keySummary: "Use a Google AI Studio key for the Gemini API.",
+ logins: ["endpoint", "oauth"],
+ mark: "google-color",
+ },
+ {
+ id: "xai",
+ name: "xAI",
+ summary: "Use an xAI API key or sign in to your xAI account.",
+ keySummary: "Use an xAI API key.",
+ logins: ["endpoint", "oauth"],
+ mark: "xai",
+ },
+ {
+ id: "unbiased",
+ name: "Unbiased AI",
+ summary: "Sign in with Unbiased AI to use Pareto, or use an API key.",
+ keySummary: "Use an Unbiased AI API key for Pareto.",
+ logins: ["oauth", "endpoint"],
+ mark: "unbiased",
+ },
+ {
+ id: "openai-compatible",
+ name: "Any OpenAI-compatible endpoint",
+ summary: "Azure, Bedrock, Mistral, DeepSeek, Ollama, vLLM or your own.",
+ keySummary: "Azure, Bedrock, Mistral, DeepSeek, Ollama, vLLM or your own.",
+ logins: ["endpoint"],
+ mark: null,
+ },
+];
+
+/**
+ * The address, model and key page a named provider's endpoint row fills in, as the setup window's
+ * `endpointPresets` (desktop/src/ProviderPicker.tsx). The person types only the key.
+ */
+export const ENDPOINT_PRESETS: Partial<
+ Record<
+ AiConnectionProvider,
+ { baseUrl: string; model: string; keyUrl: string; keyLink: string }
+ >
+> = {
+ google: {
+ baseUrl: "https://generativelanguage.googleapis.com/v1beta/openai/",
+ model: "gemini-3.8-flash",
+ keyUrl: "https://aistudio.google.com/apikey",
+ keyLink: "Get a Google Gemini API key",
+ },
+ xai: {
+ baseUrl: "https://api.x.ai/v1",
+ model: "grok-4.7",
+ keyUrl: "https://console.x.ai/",
+ keyLink: "Get an xAI API key",
+ },
+ unbiased: {
+ baseUrl: "https://api.unbiased.ai/v1",
+ model: "pareto",
+ keyUrl: "https://platform.unbiased.ai/dashboard/keys",
+ keyLink: "Get an Unbiased AI API key",
+ },
+};
+
+/**
+ * The ways in a page can offer. A plan or a sign-in runs in OpenBot Desktop, which holds what renews
+ * it, so a plain browser offers keys and addresses only.
+ */
+export function loginsHere(
+ provider: AiProvider,
+ inDesktop: boolean,
+): AiConnectionLogin[] {
+ return provider.logins.filter(
+ (login) => inDesktop || login === "api-key" || login === "endpoint",
+ );
+}
+
+export function providerById(
+ id: AiConnectionProvider | null | undefined,
+): AiProvider | undefined {
+ return AI_PROVIDERS.find((provider) => provider.id === id);
+}
+
+/** The host of an address, or null when it isn't one. */
+export function hostOf(address: string): string | null {
+ try {
+ return new URL(address.trim()).host || null;
+ } catch {
+ return null;
+ }
+}
+
+/** Whether an address is one the API takes: http or https, with no user name or password in it. */
+export function isEndpointAddress(address: string): boolean {
+ try {
+ const url = new URL(address.trim());
+ return (
+ (url.protocol === "http:" || url.protocol === "https:") &&
+ url.host.length > 0 &&
+ url.username === "" &&
+ url.password === ""
+ );
+ } catch {
+ return false;
+ }
+}
diff --git a/app/src/lib/ai-connection/queries.ts b/app/src/lib/ai-connection/queries.ts
new file mode 100644
index 0000000000..392f7d9597
--- /dev/null
+++ b/app/src/lib/ai-connection/queries.ts
@@ -0,0 +1,65 @@
+import { queryOptions } from "@tanstack/react-query";
+import type { AiConnection } from "@/lib/api/generated/model";
+import { getAiConnection } from "@/lib/api/generated/models/models";
+import { organizationId } from "@/lib/api/request";
+import { ClientError } from "@/lib/client";
+import { invokeDesktop } from "@/lib/desktop/queries";
+import { desktopShell } from "@/lib/desktop/shell";
+
+/**
+ * How OpenBot reaches its AI provider (getAiConnection), and whether the Desktop window this page
+ * may be in can change it in place.
+ */
+export type { AiConnection };
+
+export const aiConnectionKeys = {
+ all: ["ai-connection"] as const,
+ current: ["ai-connection", "current"] as const,
+ // Not under `all`: what Desktop can do does not change when the connection does.
+ desktop: ["ai-connection-desktop"] as const,
+};
+
+/**
+ * The organization's AI connection. Never a key. Null from an OpenBot older than this operation
+ * (404), where Settings keeps the Desktop row it had before.
+ */
+export function aiConnectionQueryOptions() {
+ return queryOptions({
+ queryKey: aiConnectionKeys.current,
+ queryFn: async ({ signal }): Promise => {
+ try {
+ return await getAiConnection(organizationId(), {
+ signal,
+ fallback: "Couldn't load the AI connection",
+ });
+ } catch (error) {
+ if (error instanceof ClientError && error.status === 404) return null;
+ throw error;
+ }
+ },
+ });
+}
+
+/**
+ * Whether this page is in an OpenBot Desktop that changes the AI connection in place: one that
+ * answers `ai_providers`, as every Desktop with `prepare_ai_connection` does. False in a plain
+ * browser, true or false in Desktop by what it answers. An older Desktop refuses the command, and
+ * Settings keeps its stop-and-setup Change there.
+ */
+export type DesktopAiSupport = "browser" | "in-place" | "older";
+
+export function desktopAiSupportQueryOptions() {
+ return queryOptions({
+ queryKey: aiConnectionKeys.desktop,
+ queryFn: async (): Promise => {
+ if (!desktopShell()) return "browser";
+ try {
+ await invokeDesktop("ai_providers");
+ return "in-place";
+ } catch {
+ return "older";
+ }
+ },
+ staleTime: Number.POSITIVE_INFINITY,
+ });
+}
diff --git a/app/src/lib/api/generated/agents/agents.zod.ts b/app/src/lib/api/generated/agents/agents.zod.ts
index 1d6bf909c6..2d2087bfcf 100644
--- a/app/src/lib/api/generated/agents/agents.zod.ts
+++ b/app/src/lib/api/generated/agents/agents.zod.ts
@@ -312,6 +312,7 @@ export const CreateBotAgentBody = zod
"llamaindex",
"agno",
"langgraph",
+ "langgraph-ts",
"google-adk",
"antigravity",
"pydantic-ai",
diff --git a/app/src/lib/api/generated/app-access-requests/app-access-requests.zod.ts b/app/src/lib/api/generated/app-access-requests/app-access-requests.zod.ts
index 5bd2b0f160..d9e8d8cde2 100644
--- a/app/src/lib/api/generated/app-access-requests/app-access-requests.zod.ts
+++ b/app/src/lib/api/generated/app-access-requests/app-access-requests.zod.ts
@@ -74,7 +74,7 @@ export const ListAppAccessRequestsResponse = zod.object({
"What an administrator is asked for: to turn the app on, to give it to the Bot, or to connect its shared account.",
),
status: zod
- .enum(["pending", "approved", "dismissed", "cancelled"])
+ .string()
.describe(
"Read only: waiting, approved, dismissed, or withdrawn by the person who asked. Answering a request is approveAppAccessRequest or dismissAppAccessRequest.",
),
@@ -170,7 +170,7 @@ export const CreateAppAccessRequestResponse = zod
"What an administrator is asked for: to turn the app on, to give it to the Bot, or to connect its shared account.",
),
status: zod
- .enum(["pending", "approved", "dismissed", "cancelled"])
+ .string()
.describe(
"Read only: waiting, approved, dismissed, or withdrawn by the person who asked. Answering a request is approveAppAccessRequest or dismissAppAccessRequest.",
),
@@ -306,7 +306,7 @@ export const ApproveAppAccessRequestResponse = zod.object({
"What an administrator is asked for: to turn the app on, to give it to the Bot, or to connect its shared account.",
),
status: zod
- .enum(["pending", "approved", "dismissed", "cancelled"])
+ .string()
.describe(
"Read only: waiting, approved, dismissed, or withdrawn by the person who asked. Answering a request is approveAppAccessRequest or dismissAppAccessRequest.",
),
@@ -385,7 +385,7 @@ export const DismissAppAccessRequestResponse = zod
"What an administrator is asked for: to turn the app on, to give it to the Bot, or to connect its shared account.",
),
status: zod
- .enum(["pending", "approved", "dismissed", "cancelled"])
+ .string()
.describe(
"Read only: waiting, approved, dismissed, or withdrawn by the person who asked. Answering a request is approveAppAccessRequest or dismissAppAccessRequest.",
),
diff --git a/app/src/lib/api/generated/approval-rules/approval-rules.zod.ts b/app/src/lib/api/generated/approval-rules/approval-rules.zod.ts
index 9fe6cc6f38..fb3ca3de2f 100644
--- a/app/src/lib/api/generated/approval-rules/approval-rules.zod.ts
+++ b/app/src/lib/api/generated/approval-rules/approval-rules.zod.ts
@@ -350,24 +350,24 @@ export const CreateApprovalRuleHeader = zod.object({
export const createApprovalRuleBodyBotIdOneMax = 300;
export const createApprovalRuleBodyBotIdOneRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createApprovalRuleBodyBotIdDefault = `*`;
export const createApprovalRuleBodyToolRefOneMax = 300;
export const createApprovalRuleBodyToolRefOneRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createApprovalRuleBodyEffectOneMax = 300;
export const createApprovalRuleBodyEffectOneRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createApprovalRuleBodyEffectDefault = `*`;
export const createApprovalRuleBodyScopeOneMax = 300;
export const createApprovalRuleBodyScopeOneRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createApprovalRuleBodyScopeDefault = `*`;
@@ -479,22 +479,22 @@ export const UpdateApprovalRuleHeader = zod.object({
export const updateApprovalRuleBodyBotIdMax = 300;
export const updateApprovalRuleBodyBotIdRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const updateApprovalRuleBodyToolRefMax = 300;
export const updateApprovalRuleBodyToolRefRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const updateApprovalRuleBodyEffectMax = 300;
export const updateApprovalRuleBodyEffectRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const updateApprovalRuleBodyScopeMax = 300;
export const updateApprovalRuleBodyScopeRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const UpdateApprovalRuleBody = zod.object({
@@ -631,7 +631,7 @@ export const TranslateApprovalRulesHeader = zod.object({
export const translateApprovalRulesBodyTextMax = 1000;
export const translateApprovalRulesBodyTextRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const TranslateApprovalRulesBody = zod.object({
@@ -970,7 +970,7 @@ export const batchCreateApprovalRulesBodyRulesMax = 8;
export const batchCreateApprovalRulesBodyAuthoringTextMax = 2000;
export const batchCreateApprovalRulesBodyAuthoringTextRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const BatchCreateApprovalRulesBody = zod.object({
diff --git a/app/src/lib/api/generated/approvals/approvals.zod.ts b/app/src/lib/api/generated/approvals/approvals.zod.ts
index cbbaaed58c..af26a662a7 100644
--- a/app/src/lib/api/generated/approvals/approvals.zod.ts
+++ b/app/src/lib/api/generated/approvals/approvals.zod.ts
@@ -67,7 +67,7 @@ export const ListApprovalsResponse = zod.object({
.object({
id: zod.string().min(1),
status: zod
- .enum(["pending", "approved", "denied", "consumed", "completed"])
+ .string()
.describe(
"Where an approval stands. pending waits for the person. approved and denied are decided, and consumed is started; the server then carries the conversation on. completed is finished.",
),
@@ -273,7 +273,7 @@ export const DecideApprovalResponse = zod
.object({
id: zod.string().min(1),
status: zod
- .enum(["pending", "approved", "denied", "consumed", "completed"])
+ .string()
.describe(
"Where an approval stands. pending waits for the person. approved and denied are decided, and consumed is started; the server then carries the conversation on. completed is finished.",
),
@@ -556,7 +556,7 @@ export const RespondToQuestionHeader = zod.object({
export const respondToQuestionBodyResponseMax = 6000;
export const respondToQuestionBodyResponseRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const RespondToQuestionBody = zod.object({
@@ -907,24 +907,24 @@ export const CreatePersonApprovalRuleHeader = zod.object({
export const createPersonApprovalRuleBodyBotIdOneMax = 300;
export const createPersonApprovalRuleBodyBotIdOneRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createPersonApprovalRuleBodyBotIdDefault = `*`;
export const createPersonApprovalRuleBodyToolRefOneMax = 300;
export const createPersonApprovalRuleBodyToolRefOneRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createPersonApprovalRuleBodyEffectOneMax = 300;
export const createPersonApprovalRuleBodyEffectOneRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createPersonApprovalRuleBodyEffectDefault = `*`;
export const createPersonApprovalRuleBodyScopeOneMax = 300;
export const createPersonApprovalRuleBodyScopeOneRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createPersonApprovalRuleBodyScopeDefault = `*`;
@@ -1069,22 +1069,22 @@ export const UpdatePersonApprovalRuleHeader = zod.object({
export const updatePersonApprovalRuleBodyBotIdMax = 300;
export const updatePersonApprovalRuleBodyBotIdRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const updatePersonApprovalRuleBodyToolRefMax = 300;
export const updatePersonApprovalRuleBodyToolRefRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const updatePersonApprovalRuleBodyEffectMax = 300;
export const updatePersonApprovalRuleBodyEffectRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const updatePersonApprovalRuleBodyScopeMax = 300;
export const updatePersonApprovalRuleBodyScopeRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const UpdatePersonApprovalRuleBody = zod.object({
diff --git a/app/src/lib/api/generated/bot-grants/bot-grants.zod.ts b/app/src/lib/api/generated/bot-grants/bot-grants.zod.ts
index 0abbfa1ee9..37b660064c 100644
--- a/app/src/lib/api/generated/bot-grants/bot-grants.zod.ts
+++ b/app/src/lib/api/generated/bot-grants/bot-grants.zod.ts
@@ -180,7 +180,7 @@ export const batchUpdateBotGrantsBodyRemoveMax = 2000;
export const batchUpdateBotGrantsBodyAuthoringTextMax = 2000;
export const batchUpdateBotGrantsBodyAuthoringTextRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const batchUpdateBotGrantsBodyApprovalMembersItemValueMax = 320;
@@ -300,7 +300,7 @@ export const translateBotGrantsBodyAppIdRegExp = new RegExp("\\S");
export const translateBotGrantsBodyTextMax = 1000;
export const translateBotGrantsBodyTextRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const TranslateBotGrantsBody = zod.object({
@@ -1248,7 +1248,7 @@ export const ApproveBotAppResponse = zod.object({
"What an administrator is asked for: to turn the app on, to give it to the Bot, or to connect its shared account.",
),
status: zod
- .enum(["pending", "approved", "dismissed", "cancelled"])
+ .string()
.describe(
"Read only: waiting, approved, dismissed, or withdrawn by the person who asked. Answering a request is approveAppAccessRequest or dismissAppAccessRequest.",
),
diff --git a/app/src/lib/api/generated/bots/bots.zod.ts b/app/src/lib/api/generated/bots/bots.zod.ts
index a4149e33e2..811de66384 100644
--- a/app/src/lib/api/generated/bots/bots.zod.ts
+++ b/app/src/lib/api/generated/bots/bots.zod.ts
@@ -296,6 +296,7 @@ export const CreateBotBody = zod
"llamaindex",
"agno",
"langgraph",
+ "langgraph-ts",
"google-adk",
"antigravity",
"pydantic-ai",
@@ -308,7 +309,7 @@ export const CreateBotBody = zod
])
.optional()
.describe(
- 'The framework an agent somebody runs themselves is built on, by its id in OpenBot\'s harness list (shared/harnesses.json), which the server checks every create against. Empty means none was named, as for an agent somebody already runs. "byo-url" is not one: it names no framework. Kept only with an endpoint.',
+ 'The framework an agent somebody runs themselves is built on, by its id in OpenBot\'s harness list (shared/harnesses.json), which the server checks every create against. Empty means none was named, as for an agent somebody already runs. "byo-url" is not one: it names no framework. Kept only with an endpoint, with one exception: "langgraph-ts" sent with no endpoint asks for a Bot that runs inside OpenBot on OpenBot\'s own LangGraph (TypeScript) engine, which is what the New Bot sheet sends. The deployment decides what each run uses: a Claude plan keeps the Claude Agent SDK engine, and an administrator may switch new Bots back to the built-in agent.',
),
})
.describe(
@@ -1879,7 +1880,7 @@ export const ReportBotDeclineHeader = zod.object({
export const reportBotDeclineBodyReasonMax = 2000;
export const reportBotDeclineBodyReasonRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const reportBotDeclineBodyRequestMax = 2000;
diff --git a/app/src/lib/api/generated/boundaries/boundaries.zod.ts b/app/src/lib/api/generated/boundaries/boundaries.zod.ts
index fa29dfc872..05bab9c836 100644
--- a/app/src/lib/api/generated/boundaries/boundaries.zod.ts
+++ b/app/src/lib/api/generated/boundaries/boundaries.zod.ts
@@ -81,7 +81,7 @@ export const replaceBoundariesBodyAllowDefault = [];
export const replaceBoundariesBodyLabelsNameMax = 80;
export const replaceBoundariesBodyLabelsNameRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const replaceBoundariesBodyLabelsDescriptionMax = 300;
@@ -91,7 +91,7 @@ export const replaceBoundariesBodyLabelsDescriptionRegExp = new RegExp(
export const replaceBoundariesBodyAuthoringTextMax = 2000;
export const replaceBoundariesBodyAuthoringTextRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const ReplaceBoundariesBody = zod.object({
@@ -209,7 +209,7 @@ export const TranslateBoundaryHeader = zod.object({
export const translateBoundaryBodyTextMax = 1000;
export const translateBoundaryBodyTextRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const TranslateBoundaryBody = zod.object({
@@ -288,7 +288,7 @@ export const replayBoundariesBodyBoundariesAllowDefault = [];
export const replayBoundariesBodyBoundariesLabelsNameMax = 80;
export const replayBoundariesBodyBoundariesLabelsNameRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const replayBoundariesBodyBoundariesLabelsDescriptionMax = 300;
diff --git a/app/src/lib/api/generated/capabilities/capabilities.zod.ts b/app/src/lib/api/generated/capabilities/capabilities.zod.ts
index fedf459b61..340a5aadf1 100644
--- a/app/src/lib/api/generated/capabilities/capabilities.zod.ts
+++ b/app/src/lib/api/generated/capabilities/capabilities.zod.ts
@@ -285,7 +285,7 @@ export const batchUpdateCapabilitiesBodyChangesMax = 100;
export const batchUpdateCapabilitiesBodyAuthoringTextMax = 2000;
export const batchUpdateCapabilitiesBodyAuthoringTextRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const BatchUpdateCapabilitiesBody = zod.object({
@@ -421,7 +421,7 @@ export const TranslateCapabilityChangesHeader = zod.object({
export const translateCapabilityChangesBodyTextMax = 1000;
export const translateCapabilityChangesBodyTextRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const TranslateCapabilityChangesBody = zod.object({
@@ -571,9 +571,9 @@ export const PreviewCapabilityChangesResponse = zod.object({
email: zod.string(),
name: zod.string().nullable(),
role: zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
groups: zod.array(zod.string()),
capabilities: zod.array(
@@ -597,13 +597,7 @@ export const PreviewCapabilityChangesResponse = zod.object({
title: zod.string(),
before: zod.object({
allowed: zod.boolean(),
- decidedBy: zod.enum([
- "default",
- "organization",
- "role",
- "group",
- "team",
- ]),
+ decidedBy: zod.string(),
scopeId: zod
.string()
.describe(
@@ -612,13 +606,7 @@ export const PreviewCapabilityChangesResponse = zod.object({
}),
after: zod.object({
allowed: zod.boolean(),
- decidedBy: zod.enum([
- "default",
- "organization",
- "role",
- "group",
- "team",
- ]),
+ decidedBy: zod.string(),
scopeId: zod
.string()
.describe(
diff --git a/app/src/lib/api/generated/check-ins/check-ins.zod.ts b/app/src/lib/api/generated/check-ins/check-ins.zod.ts
index 62a897c906..f6b5b26f03 100644
--- a/app/src/lib/api/generated/check-ins/check-ins.zod.ts
+++ b/app/src/lib/api/generated/check-ins/check-ins.zod.ts
@@ -88,7 +88,7 @@ export const ListCheckInsResponse = zod.object({
.datetime({ offset: true })
.nullable()
.describe("When it last ran, or null."),
- lastStatus: zod.enum(["idle", "running", "succeeded", "error"]),
+ lastStatus: zod.string(),
lastError: zod
.string()
.nullable()
@@ -306,7 +306,7 @@ export const CreateCheckInResponse = zod.object({
.datetime({ offset: true })
.nullable()
.describe("When it last ran, or null."),
- lastStatus: zod.enum(["idle", "running", "succeeded", "error"]),
+ lastStatus: zod.string(),
lastError: zod
.string()
.nullable()
@@ -470,7 +470,7 @@ export const UpdateCheckInResponse = zod.object({
.datetime({ offset: true })
.nullable()
.describe("When it last ran, or null."),
- lastStatus: zod.enum(["idle", "running", "succeeded", "error"]),
+ lastStatus: zod.string(),
lastError: zod
.string()
.nullable()
@@ -707,7 +707,7 @@ export const ListCheckInItemsResponse = zod.object({
.nullable()
.describe("Where it can be opened, or null."),
status: zod
- .enum(["open", "dismissed", "started", "superseded"])
+ .string()
.describe(
"open until the person starts or hides it. superseded is the Bot's own: a later check-in cleared it as no longer needed.",
),
@@ -803,7 +803,7 @@ export const StartCheckInItemResponse = zod.object({
.nullable()
.describe("Where it can be opened, or null."),
status: zod
- .enum(["open", "dismissed", "started", "superseded"])
+ .string()
.describe(
"open until the person starts or hides it. superseded is the Bot's own: a later check-in cleared it as no longer needed.",
),
@@ -895,7 +895,7 @@ export const DismissCheckInItemResponse = zod.object({
.nullable()
.describe("Where it can be opened, or null."),
status: zod
- .enum(["open", "dismissed", "started", "superseded"])
+ .string()
.describe(
"open until the person starts or hides it. superseded is the Bot's own: a later check-in cleared it as no longer needed.",
),
diff --git a/app/src/lib/api/generated/computers/computers.zod.ts b/app/src/lib/api/generated/computers/computers.zod.ts
index 1d21613a96..c0b1a1e21f 100644
--- a/app/src/lib/api/generated/computers/computers.zod.ts
+++ b/app/src/lib/api/generated/computers/computers.zod.ts
@@ -286,7 +286,7 @@ export const GetComputerParams = zod.object({
export const GetComputerResponse = zod.object({
botId: zod.string().describe("The Bot whose computer this is."),
state: zod
- .enum(["absent", "starting", "ready", "unreachable"])
+ .string()
.describe(
"Where a computer is in its life. absent is one that is not running: never started, or put to sleep after a quiet spell; it starts on the Bot's next action. starting is on its way up. unreachable is the only one that is something wrong.",
),
@@ -332,7 +332,7 @@ export const WakeComputerHeader = zod.object({
export const WakeComputerResponse = zod.object({
botId: zod.string().describe("The Bot whose computer this is."),
state: zod
- .enum(["absent", "starting", "ready", "unreachable"])
+ .string()
.describe(
"Where a computer is in its life. absent is one that is not running: never started, or put to sleep after a quiet spell; it starts on the Bot's next action. starting is on its way up. unreachable is the only one that is something wrong.",
),
@@ -382,7 +382,7 @@ export const GetComputerScreenshotResponse = zod.union([
.object({
ready: zod.literal(false),
state: zod
- .enum(["absent", "starting", "ready", "unreachable"])
+ .string()
.describe(
"Where a computer is in its life. absent is one that is not running: never started, or put to sleep after a quiet spell; it starts on the Bot's next action. starting is on its way up. unreachable is the only one that is something wrong.",
),
@@ -537,14 +537,7 @@ export const GetComputerControlResponse = zod
.describe(
"Who raised it: the Bot (model), a check the page raised, or the person themselves (manual).",
),
- status: zod.enum([
- "waiting",
- "taken",
- "completed",
- "cancelled",
- "expired",
- "interrupted",
- ]),
+ status: zod.string(),
createdAt: zod.string(),
updatedAt: zod.string(),
expiresAt: zod.string().optional(),
@@ -640,14 +633,7 @@ export const RequestComputerControlResponse = zod
.describe(
"Who raised it: the Bot (model), a check the page raised, or the person themselves (manual).",
),
- status: zod.enum([
- "waiting",
- "taken",
- "completed",
- "cancelled",
- "expired",
- "interrupted",
- ]),
+ status: zod.string(),
createdAt: zod.string(),
updatedAt: zod.string(),
expiresAt: zod.string().optional(),
@@ -746,14 +732,7 @@ export const TakeComputerControlResponse = zod
.describe(
"Who raised it: the Bot (model), a check the page raised, or the person themselves (manual).",
),
- status: zod.enum([
- "waiting",
- "taken",
- "completed",
- "cancelled",
- "expired",
- "interrupted",
- ]),
+ status: zod.string(),
createdAt: zod.string(),
updatedAt: zod.string(),
expiresAt: zod.string().optional(),
@@ -852,14 +831,7 @@ export const ReleaseComputerControlResponse = zod
.describe(
"Who raised it: the Bot (model), a check the page raised, or the person themselves (manual).",
),
- status: zod.enum([
- "waiting",
- "taken",
- "completed",
- "cancelled",
- "expired",
- "interrupted",
- ]),
+ status: zod.string(),
createdAt: zod.string(),
updatedAt: zod.string(),
expiresAt: zod.string().optional(),
@@ -958,14 +930,7 @@ export const CancelComputerControlResponse = zod
.describe(
"Who raised it: the Bot (model), a check the page raised, or the person themselves (manual).",
),
- status: zod.enum([
- "waiting",
- "taken",
- "completed",
- "cancelled",
- "expired",
- "interrupted",
- ]),
+ status: zod.string(),
createdAt: zod.string(),
updatedAt: zod.string(),
expiresAt: zod.string().optional(),
@@ -1066,14 +1031,7 @@ export const RequestComputerSecretResponse = zod
.describe(
"Who raised it: the Bot (model), a check the page raised, or the person themselves (manual).",
),
- status: zod.enum([
- "waiting",
- "taken",
- "completed",
- "cancelled",
- "expired",
- "interrupted",
- ]),
+ status: zod.string(),
createdAt: zod.string(),
updatedAt: zod.string(),
expiresAt: zod.string().optional(),
diff --git a/app/src/lib/api/generated/conversations/conversations.ts b/app/src/lib/api/generated/conversations/conversations.ts
index af6861d7f8..72be4a0f2b 100644
--- a/app/src/lib/api/generated/conversations/conversations.ts
+++ b/app/src/lib/api/generated/conversations/conversations.ts
@@ -3045,7 +3045,7 @@ export const getGetAttachmentUrl = (
};
/**
- * Return the bytes of a file attached to a message, in the type OpenBot recognised it as. Only somebody in the conversation it was sent in, or the person still holding it to send, can read it.
+ * Return the bytes of a file attached to a message, in the type OpenBot recognised it as. Only somebody in the conversation it was sent in, or the person still holding it to send, can read it. A picture is served to open in place. Every other file, a PDF or a Word, Excel or PowerPoint file among them, is served as a download.
* @summary Download an attachment
*/
export const getAttachment = async (
diff --git a/app/src/lib/api/generated/conversations/conversations.zod.ts b/app/src/lib/api/generated/conversations/conversations.zod.ts
index 0f08a345a1..c5ebd12602 100644
--- a/app/src/lib/api/generated/conversations/conversations.zod.ts
+++ b/app/src/lib/api/generated/conversations/conversations.zod.ts
@@ -1019,6 +1019,10 @@ export const ListConversationMessagesQueryParams = zod.object({
export const listConversationMessagesResponseMessagesItemToolCallsMin = 0;
+export const listConversationMessagesResponseMessagesItemFilesItemSizeBytesMin = 0;
+
+export const listConversationMessagesResponseMessagesItemFilesMax = 20;
+
export const listConversationMessagesResponseNextCursorMax = 4096;
export const listConversationMessagesResponseNextCursorRegExp = new RegExp(
@@ -1051,7 +1055,7 @@ export const ListConversationMessagesResponse = zod.object({
"What was said. Empty while another person's Bot is still writing it.",
),
status: zod
- .enum(["queued", "running", "waiting", "completed", "failed"])
+ .string()
.describe(
"Where a Bot's reply stands. A person's message is completed.",
),
@@ -1062,7 +1066,15 @@ export const ListConversationMessagesResponse = zod.object({
reason: zod
.string()
.optional()
- .describe("Why a waiting Bot is waiting."),
+ .describe(
+ "Why a waiting Bot is waiting, in words for the person reading the conversation.",
+ ),
+ declined: zod
+ .boolean()
+ .optional()
+ .describe(
+ "True on a failed Bot reply in a group that the person whose turn it answered chose not to share. It was a choice, not a fault, and nothing was sent. text says whose choice it was.",
+ ),
answeredBy: zod
.string()
.optional()
@@ -1085,6 +1097,28 @@ export const ListConversationMessagesResponse = zod.object({
.describe(
"How many tools the Bot called in this message, when it called any.",
),
+ files: zod
+ .array(
+ zod
+ .object({
+ id: zod.string().describe("The attachment's id."),
+ name: zod.string().describe("The file's name."),
+ mimeType: zod
+ .string()
+ .describe("The type OpenBot recognised it as."),
+ sizeBytes: zod
+ .int()
+ .min(
+ listConversationMessagesResponseMessagesItemFilesItemSizeBytesMin,
+ ),
+ })
+ .describe("A file held for a message, or sent with one."),
+ )
+ .max(listConversationMessagesResponseMessagesItemFilesMax)
+ .optional()
+ .describe(
+ "In a group conversation, the files a Bot sent from its computer with this reply, in the order it sent them. Each is an attachment of the conversation, read at its attachment address by anyone in it.",
+ ),
})
.describe(
"One thing said in a conversation: a person's message, or one Bot's reply.",
@@ -1235,7 +1269,7 @@ export const UploadConversationAttachmentResponse = zod
.describe("A file held for a message, or sent with one.");
/**
- * Return the bytes of a file attached to a message, in the type OpenBot recognised it as. Only somebody in the conversation it was sent in, or the person still holding it to send, can read it.
+ * Return the bytes of a file attached to a message, in the type OpenBot recognised it as. Only somebody in the conversation it was sent in, or the person still holding it to send, can read it. A picture is served to open in place. Every other file, a PDF or a Word, Excel or PowerPoint file among them, is served as a download.
* @summary Download an attachment
*/
diff --git a/app/src/lib/api/generated/deliveries/deliveries.zod.ts b/app/src/lib/api/generated/deliveries/deliveries.zod.ts
index 460105fd9c..9763d673f5 100644
--- a/app/src/lib/api/generated/deliveries/deliveries.zod.ts
+++ b/app/src/lib/api/generated/deliveries/deliveries.zod.ts
@@ -77,16 +77,7 @@ export const ListDeliveriesResponse = zod.object({
"What was sent: a Bot's reply, a question it asked, an approval it needs, or what the person's Bots' check-ins found that needs them.",
),
state: zod
- .enum([
- "queued",
- "running",
- "accepted",
- "sent",
- "delivered",
- "failed",
- "unknown",
- "opted_out",
- ])
+ .string()
.describe(
"Where it got to. accepted is the provider taking it without saying yet that it arrived. unknown is a send that may or may not have gone. opted_out is a text message not sent because the person texted STOP.",
),
diff --git a/app/src/lib/api/generated/goals/goals.zod.ts b/app/src/lib/api/generated/goals/goals.zod.ts
index 01c4917aa6..bd80ff730e 100644
--- a/app/src/lib/api/generated/goals/goals.zod.ts
+++ b/app/src/lib/api/generated/goals/goals.zod.ts
@@ -66,7 +66,7 @@ export const ListGoalsResponse = zod.object({
successCriteria: zod
.string()
.describe("When it is done. May be empty."),
- status: zod.enum(["active", "paused", "completed"]),
+ status: zod.string(),
progress: zod
.string()
.describe("Where it stands, as the Bot last recorded it."),
@@ -254,7 +254,7 @@ export const CreateGoalResponse = zod.object({
title: zod.string().describe("What the goal is called."),
instruction: zod.string().describe("What the Bot is to do."),
successCriteria: zod.string().describe("When it is done. May be empty."),
- status: zod.enum(["active", "paused", "completed"]),
+ status: zod.string(),
progress: zod
.string()
.describe("Where it stands, as the Bot last recorded it."),
@@ -438,7 +438,7 @@ export const UpdateGoalResponse = zod.object({
title: zod.string().describe("What the goal is called."),
instruction: zod.string().describe("What the Bot is to do."),
successCriteria: zod.string().describe("When it is done. May be empty."),
- status: zod.enum(["active", "paused", "completed"]),
+ status: zod.string(),
progress: zod
.string()
.describe("Where it stands, as the Bot last recorded it."),
@@ -598,7 +598,7 @@ export const PauseGoalResponse = zod.object({
title: zod.string().describe("What the goal is called."),
instruction: zod.string().describe("What the Bot is to do."),
successCriteria: zod.string().describe("When it is done. May be empty."),
- status: zod.enum(["active", "paused", "completed"]),
+ status: zod.string(),
progress: zod
.string()
.describe("Where it stands, as the Bot last recorded it."),
@@ -719,7 +719,7 @@ export const ResumeGoalResponse = zod.object({
title: zod.string().describe("What the goal is called."),
instruction: zod.string().describe("What the Bot is to do."),
successCriteria: zod.string().describe("When it is done. May be empty."),
- status: zod.enum(["active", "paused", "completed"]),
+ status: zod.string(),
progress: zod
.string()
.describe("Where it stands, as the Bot last recorded it."),
@@ -840,7 +840,7 @@ export const CompleteGoalResponse = zod.object({
title: zod.string().describe("What the goal is called."),
instruction: zod.string().describe("What the Bot is to do."),
successCriteria: zod.string().describe("When it is done. May be empty."),
- status: zod.enum(["active", "paused", "completed"]),
+ status: zod.string(),
progress: zod
.string()
.describe("Where it stands, as the Bot last recorded it."),
@@ -1017,14 +1017,7 @@ export const ListGoalRunsResponse = zod.object({
zod
.object({
id: zod.string().describe("The run's id."),
- status: zod.enum([
- "queued",
- "running",
- "waiting",
- "succeeded",
- "failed",
- "skipped",
- ]),
+ status: zod.string(),
replyText: zod
.string()
.nullable()
diff --git a/app/src/lib/api/generated/identity-providers/identity-providers.zod.ts b/app/src/lib/api/generated/identity-providers/identity-providers.zod.ts
index f37424805f..d9d0bcde64 100644
--- a/app/src/lib/api/generated/identity-providers/identity-providers.zod.ts
+++ b/app/src/lib/api/generated/identity-providers/identity-providers.zod.ts
@@ -116,12 +116,12 @@ export const CreateIdentityProviderHeader = zod.object({
export const createIdentityProviderBodyOneIdMax = 200;
export const createIdentityProviderBodyOneIdRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createIdentityProviderBodyOneDomainMax = 2048;
export const createIdentityProviderBodyOneDomainRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createIdentityProviderBodyOneIssuerMax = 2048;
@@ -136,17 +136,17 @@ export const createIdentityProviderBodyOneEntryPointRegExp = new RegExp(
export const createIdentityProviderBodyOneMetadataMax = 200000;
export const createIdentityProviderBodyOneMetadataRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createIdentityProviderBodyTwoIdMax = 200;
export const createIdentityProviderBodyTwoIdRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createIdentityProviderBodyTwoDomainMax = 2048;
export const createIdentityProviderBodyTwoDomainRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createIdentityProviderBodyTwoIssuerMax = 2048;
@@ -156,12 +156,12 @@ export const createIdentityProviderBodyTwoIssuerRegExp = new RegExp(
export const createIdentityProviderBodyTwoClientIdMax = 2048;
export const createIdentityProviderBodyTwoClientIdRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createIdentityProviderBodyTwoClientSecretMax = 2048;
export const createIdentityProviderBodyTwoClientSecretRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const CreateIdentityProviderBody = zod
diff --git a/app/src/lib/api/generated/learning/learning.zod.ts b/app/src/lib/api/generated/learning/learning.zod.ts
index 29989a19b4..34f57c60c8 100644
--- a/app/src/lib/api/generated/learning/learning.zod.ts
+++ b/app/src/lib/api/generated/learning/learning.zod.ts
@@ -818,7 +818,7 @@ export const ListPersonalLearningProposalsResponse = zod.object({
.describe(
"Whether it adds a skill, changes one, or removes one.",
),
- status: zod.enum(["pending_review", "approved", "rejected"]),
+ status: zod.string(),
title: zod.string().describe("The skill's name."),
description: zod.string(),
reason: zod.string().describe("Why Learning proposes it."),
@@ -1283,7 +1283,7 @@ export const GetPersonLearningReviewResponse = zod.object({
.describe(
"Whether it adds a skill, changes one, or removes one.",
),
- status: zod.enum(["pending_review", "approved", "rejected"]),
+ status: zod.string(),
title: zod.string().describe("The skill's name."),
description: zod.string(),
reason: zod.string().describe("Why Learning proposes it."),
@@ -1308,15 +1308,7 @@ export const GetPersonLearningReviewResponse = zod.object({
zod
.object({
id: zod.uuid(),
- status: zod.enum([
- "queued",
- "freezing",
- "batching",
- "reducing",
- "finalizing",
- "succeeded",
- "failed",
- ]),
+ status: zod.string(),
triggerSource: zod.enum(["automatic", "manual"]),
proposalCount: zod
.int()
@@ -1451,7 +1443,7 @@ export const ListPersonLearningProposalsResponse = zod.object({
operation: zod
.enum(["add", "update", "remove"])
.describe("Whether it adds a skill, changes one, or removes one."),
- status: zod.enum(["pending_review", "approved", "rejected"]),
+ status: zod.string(),
title: zod.string().describe("The skill's name."),
description: zod.string(),
reason: zod.string().describe("Why Learning proposes it."),
@@ -1774,7 +1766,7 @@ export const ListLearningProposalsResponse = zod.object({
operation: zod
.enum(["add", "update", "remove"])
.describe("Whether it adds a skill, changes one, or removes one."),
- status: zod.enum(["pending_review", "approved", "rejected"]),
+ status: zod.string(),
title: zod.string().describe("The skill's name."),
description: zod.string(),
reason: zod.string().describe("Why Learning proposes it."),
@@ -1835,7 +1827,7 @@ export const GetLearningProposalResponse = zod
operation: zod
.enum(["add", "update", "remove"])
.describe("Whether it adds a skill, changes one, or removes one."),
- status: zod.enum(["pending_review", "approved", "rejected"]),
+ status: zod.string(),
title: zod.string().describe("The skill's name."),
description: zod.string(),
reason: zod.string().describe("Why Learning proposes it."),
@@ -2148,15 +2140,7 @@ export const ListOrganizationLearningRunsResponse = zod.object({
zod
.object({
id: zod.uuid(),
- status: zod.enum([
- "queued",
- "freezing",
- "batching",
- "reducing",
- "finalizing",
- "succeeded",
- "failed",
- ]),
+ status: zod.string(),
triggerSource: zod.enum(["automatic", "manual"]),
proposalCount: zod
.int()
@@ -2237,15 +2221,7 @@ export const startOrganizationLearningRunResponseInsightCountMin = 0;
export const StartOrganizationLearningRunResponse = zod
.object({
id: zod.uuid(),
- status: zod.enum([
- "queued",
- "freezing",
- "batching",
- "reducing",
- "finalizing",
- "succeeded",
- "failed",
- ]),
+ status: zod.string(),
triggerSource: zod.enum(["automatic", "manual"]),
proposalCount: zod
.int()
@@ -2321,7 +2297,7 @@ export const GetPersonLearningProposalResponse = zod
operation: zod
.enum(["add", "update", "remove"])
.describe("Whether it adds a skill, changes one, or removes one."),
- status: zod.enum(["pending_review", "approved", "rejected"]),
+ status: zod.string(),
title: zod.string().describe("The skill's name."),
description: zod.string(),
reason: zod.string().describe("Why Learning proposes it."),
@@ -2687,15 +2663,7 @@ export const startPersonLearningRunResponseInsightCountMin = 0;
export const StartPersonLearningRunResponse = zod
.object({
id: zod.uuid(),
- status: zod.enum([
- "queued",
- "freezing",
- "batching",
- "reducing",
- "finalizing",
- "succeeded",
- "failed",
- ]),
+ status: zod.string(),
triggerSource: zod.enum(["automatic", "manual"]),
proposalCount: zod
.int()
diff --git a/app/src/lib/api/generated/linked-accounts/linked-accounts.zod.ts b/app/src/lib/api/generated/linked-accounts/linked-accounts.zod.ts
index c4ec5c9c41..a9f5214f5d 100644
--- a/app/src/lib/api/generated/linked-accounts/linked-accounts.zod.ts
+++ b/app/src/lib/api/generated/linked-accounts/linked-accounts.zod.ts
@@ -81,7 +81,7 @@ export const ListLinkedAccountsResponse = zod.object({
"Who they are there, such as their GitHub login, when the service said.",
),
status: zod
- .enum(["active", "needs_reconnect"])
+ .string()
.describe(
"needs_reconnect when the service stopped accepting what the link holds, and linking again mends it.",
),
diff --git a/app/src/lib/api/generated/memory/memory.zod.ts b/app/src/lib/api/generated/memory/memory.zod.ts
index 5432a39f9d..a3f8867c13 100644
--- a/app/src/lib/api/generated/memory/memory.zod.ts
+++ b/app/src/lib/api/generated/memory/memory.zod.ts
@@ -453,7 +453,7 @@ export const ListMemorySourcesResponse = zod.object({
.record(zod.string(), zod.unknown())
.describe("What the action is called with."),
enabled: zod.boolean(),
- syncStatus: zod.enum(["idle", "running", "succeeded", "error"]),
+ syncStatus: zod.string(),
syncError: zod
.string()
.nullable()
@@ -568,7 +568,7 @@ export const CreateMemorySourceResponse = zod.object({
.record(zod.string(), zod.unknown())
.describe("What the action is called with."),
enabled: zod.boolean(),
- syncStatus: zod.enum(["idle", "running", "succeeded", "error"]),
+ syncStatus: zod.string(),
syncError: zod
.string()
.nullable()
@@ -646,7 +646,7 @@ export const UpdateMemorySourceResponse = zod
.record(zod.string(), zod.unknown())
.describe("What the action is called with."),
enabled: zod.boolean(),
- syncStatus: zod.enum(["idle", "running", "succeeded", "error"]),
+ syncStatus: zod.string(),
syncError: zod
.string()
.nullable()
@@ -775,7 +775,7 @@ export const SyncMemorySourceResponse = zod.object({
.record(zod.string(), zod.unknown())
.describe("What the action is called with."),
enabled: zod.boolean(),
- syncStatus: zod.enum(["idle", "running", "succeeded", "error"]),
+ syncStatus: zod.string(),
syncError: zod
.string()
.nullable()
diff --git a/app/src/lib/api/generated/model/aiConnection.ts b/app/src/lib/api/generated/model/aiConnection.ts
new file mode 100644
index 0000000000..be81ac9bcf
--- /dev/null
+++ b/app/src/lib/api/generated/model/aiConnection.ts
@@ -0,0 +1,42 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { AiConnectionLogin } from "./aiConnectionLogin";
+import type { AiConnectionProvider } from "./aiConnectionProvider";
+import type { AiConnectionSaved } from "./aiConnectionSaved";
+import type { AiConnectionSource } from "./aiConnectionSource";
+
+/**
+ * How OpenBot reaches its AI provider: who, how it signs in, and whether a run can use it now. Never a key.
+ */
+export interface AiConnection {
+ /** The provider. Null while none is chosen yet. */
+ provider: AiConnectionProvider | null;
+ /** How OpenBot signs in to it. Null while none is chosen yet. */
+ login: AiConnectionLogin | null;
+ /**
+ * The model named for an endpoint or a sign-in. Null for an API key or a plan, where the model catalogue offers the provider's models.
+ * @nullable
+ */
+ model: string | null;
+ /**
+ * The host of the endpoint's address, never its path, query or anything that signs in. Null unless the login is endpoint.
+ * @nullable
+ */
+ endpointHost: string | null;
+ /** Whether a live key for this connection is kept in the vault. */
+ keySet: boolean;
+ /** Whether a run can use it now: its key is kept, its sign-in can be read, or its plan's engine answers. */
+ ready: boolean;
+ /** stored: set here, or carried over from how OpenBot was set up. environment: set by whoever runs OpenBot, in its configuration. none: nothing set yet. */
+ source: AiConnectionSource;
+ /** Whether an administrator can change it here. False where whoever runs OpenBot sets the provider: its key is changed in the vault. */
+ editable: boolean;
+ /** The connections with a key still kept in the vault, so a switch to one of them needs no key pasted. */
+ saved: AiConnectionSaved[];
+ /**
+ * When it was last changed. Null if never.
+ * @nullable
+ */
+ changedAt: string | null;
+}
diff --git a/app/src/lib/api/generated/model/aiConnectionFixedResponse.ts b/app/src/lib/api/generated/model/aiConnectionFixedResponse.ts
new file mode 100644
index 0000000000..1bfe2143ba
--- /dev/null
+++ b/app/src/lib/api/generated/model/aiConnectionFixedResponse.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { Problem } from "./problem";
+
+/**
+ * Whoever runs this OpenBot sets its AI provider (editable is false), so it can't be changed here. Or the Idempotency-Key was already used for a different request.
+ */
+export type AiConnectionFixedResponse = Problem;
diff --git a/app/src/lib/api/generated/model/aiConnectionInput.ts b/app/src/lib/api/generated/model/aiConnectionInput.ts
new file mode 100644
index 0000000000..7e71271c3d
--- /dev/null
+++ b/app/src/lib/api/generated/model/aiConnectionInput.ts
@@ -0,0 +1,34 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { AiConnectionLogin } from "./aiConnectionLogin";
+import type { AiConnectionProvider } from "./aiConnectionProvider";
+
+/**
+ * The connection to switch to. openai and anthropic take plan or api-key; google and xai take endpoint or oauth; unbiased and openai-compatible take endpoint. Any other pair is refused.
+ */
+export interface AiConnectionInput {
+ provider: AiConnectionProvider;
+ login: AiConnectionLogin;
+ /**
+ * The provider's key. Required for api-key unless useSavedKey; optional for an endpoint that asks for none. Encrypted into the vault before anything else, and never sent back: no answer includes it, now or later.
+ * @minLength 1
+ * @maxLength 65536
+ */
+ apiKey?: string;
+ /** Use the key already kept for this provider (and, for an endpoint, this address) instead of sending one. */
+ useSavedKey?: boolean;
+ /**
+ * The endpoint's address, http or https, with nothing in it that signs in. Required for endpoint.
+ * @maxLength 2048
+ * @pattern ^https?://[^@/?#]+([/?#].*)?$
+ */
+ baseUrl?: string;
+ /**
+ * The model to run on. Required for endpoint and oauth. Trimmed.
+ * @minLength 1
+ * @maxLength 500
+ * @pattern \S
+ */
+ model?: string;
+}
diff --git a/app/src/lib/api/generated/model/aiConnectionLogin.ts b/app/src/lib/api/generated/model/aiConnectionLogin.ts
new file mode 100644
index 0000000000..97713b3880
--- /dev/null
+++ b/app/src/lib/api/generated/model/aiConnectionLogin.ts
@@ -0,0 +1,16 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * How OpenBot signs in to the provider. plan: the person's Claude or ChatGPT plan (openai, anthropic). api-key: a key from the provider (openai, anthropic). endpoint: an address and, where it asks for one, a key (google, xai, unbiased, openai-compatible). oauth: the person's Google or xAI sign-in (google, xai).
+ */
+export type AiConnectionLogin =
+ (typeof AiConnectionLogin)[keyof typeof AiConnectionLogin];
+
+export const AiConnectionLogin = {
+ plan: "plan",
+ "api-key": "api-key",
+ endpoint: "endpoint",
+ oauth: "oauth",
+} as const;
diff --git a/app/src/lib/api/generated/model/aiConnectionProvider.ts b/app/src/lib/api/generated/model/aiConnectionProvider.ts
new file mode 100644
index 0000000000..086d64ca3f
--- /dev/null
+++ b/app/src/lib/api/generated/model/aiConnectionProvider.ts
@@ -0,0 +1,18 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * The AI provider OpenBot's Bots run on. openai: OpenAI. anthropic: Anthropic. google: Google Gemini. xai: xAI. unbiased: Unbiased AI. openai-compatible: any server that speaks OpenAI's API, at an address given.
+ */
+export type AiConnectionProvider =
+ (typeof AiConnectionProvider)[keyof typeof AiConnectionProvider];
+
+export const AiConnectionProvider = {
+ openai: "openai",
+ anthropic: "anthropic",
+ google: "google",
+ xai: "xai",
+ unbiased: "unbiased",
+ "openai-compatible": "openai-compatible",
+} as const;
diff --git a/app/src/lib/api/generated/model/aiConnectionRefusedResponse.ts b/app/src/lib/api/generated/model/aiConnectionRefusedResponse.ts
new file mode 100644
index 0000000000..eab98685a7
--- /dev/null
+++ b/app/src/lib/api/generated/model/aiConnectionRefusedResponse.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { Problem } from "./problem";
+
+/**
+ * OpenBot checked the connection and can't use it, so nothing was saved and the connection in use keeps running. code says why: AI_CONNECTION_KEY_REFUSED, the provider didn't accept the key; AI_CONNECTION_UNREACHABLE, the address didn't answer; AI_CONNECTION_MODEL_UNAVAILABLE, the key can't use that model; AI_CONNECTION_SIGN_IN_MISSING, there's no sign-in to read; AI_CONNECTION_ENGINE_NOT_READY, the plan's engine isn't answering yet. detail is OpenBot's own sentence, naming the provider or the host, never what the provider said.
+ */
+export type AiConnectionRefusedResponse = Problem;
diff --git a/app/src/lib/api/generated/model/aiConnectionSaved.ts b/app/src/lib/api/generated/model/aiConnectionSaved.ts
new file mode 100644
index 0000000000..3948593d80
--- /dev/null
+++ b/app/src/lib/api/generated/model/aiConnectionSaved.ts
@@ -0,0 +1,18 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { AiConnectionLogin } from "./aiConnectionLogin";
+import type { AiConnectionProvider } from "./aiConnectionProvider";
+
+/**
+ * A connection with a key still kept in the vault, which can be used again without pasting the key (useSavedKey). Never the key.
+ */
+export interface AiConnectionSaved {
+ provider: AiConnectionProvider;
+ login: AiConnectionLogin;
+ /**
+ * The host of its address, for an endpoint. Null for an API key.
+ * @nullable
+ */
+ endpointHost: string | null;
+}
diff --git a/app/src/lib/api/generated/model/aiConnectionSource.ts b/app/src/lib/api/generated/model/aiConnectionSource.ts
new file mode 100644
index 0000000000..a558ce48ea
--- /dev/null
+++ b/app/src/lib/api/generated/model/aiConnectionSource.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * stored: set here, or carried over from how OpenBot was set up. environment: set by whoever runs OpenBot, in its configuration. none: nothing set yet.
+ */
+export type AiConnectionSource =
+ (typeof AiConnectionSource)[keyof typeof AiConnectionSource];
+
+export const AiConnectionSource = {
+ stored: "stored",
+ environment: "environment",
+ none: "none",
+} as const;
diff --git a/app/src/lib/api/generated/model/allowlistEntry.ts b/app/src/lib/api/generated/model/allowlistEntry.ts
index 8b7230979f..f30e731728 100644
--- a/app/src/lib/api/generated/model/allowlistEntry.ts
+++ b/app/src/lib/api/generated/model/allowlistEntry.ts
@@ -5,6 +5,6 @@
/**
* @minLength 1
* @maxLength 200
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
export type AllowlistEntry = string;
diff --git a/app/src/lib/api/generated/model/appAccessRequest.ts b/app/src/lib/api/generated/model/appAccessRequest.ts
index c2a949b666..dfe9208703 100644
--- a/app/src/lib/api/generated/model/appAccessRequest.ts
+++ b/app/src/lib/api/generated/model/appAccessRequest.ts
@@ -2,7 +2,6 @@
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
import type { AppAccessRequestKind } from "./appAccessRequestKind";
-import type { AppAccessRequestStatus } from "./appAccessRequestStatus";
/**
* A person's request to an administrator about one app, as the person and the administrator both read it.
@@ -15,7 +14,7 @@ export interface AppAccessRequest {
appTitle: string;
kind: AppAccessRequestKind;
/** Read only: waiting, approved, dismissed, or withdrawn by the person who asked. Answering a request is approveAppAccessRequest or dismissAppAccessRequest. */
- status: AppAccessRequestStatus;
+ status: string;
/**
* The Bot it is for, or null for a request about the app alone.
* @nullable
diff --git a/app/src/lib/api/generated/model/appAccessRequestStatus.ts b/app/src/lib/api/generated/model/appAccessRequestStatus.ts
deleted file mode 100644
index fac23835ca..0000000000
--- a/app/src/lib/api/generated/model/appAccessRequestStatus.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-/**
- * Read only: waiting, approved, dismissed, or withdrawn by the person who asked. Answering a request is approveAppAccessRequest or dismissAppAccessRequest.
- */
-export type AppAccessRequestStatus =
- (typeof AppAccessRequestStatus)[keyof typeof AppAccessRequestStatus];
-
-export const AppAccessRequestStatus = {
- pending: "pending",
- approved: "approved",
- dismissed: "dismissed",
- cancelled: "cancelled",
-} as const;
diff --git a/app/src/lib/api/generated/model/approvalRuleDraftAuthoring.ts b/app/src/lib/api/generated/model/approvalRuleDraftAuthoring.ts
index 5d77a62e0b..20044c2110 100644
--- a/app/src/lib/api/generated/model/approvalRuleDraftAuthoring.ts
+++ b/app/src/lib/api/generated/model/approvalRuleDraftAuthoring.ts
@@ -12,7 +12,7 @@ export interface ApprovalRuleDraftAuthoring {
* The sentence the rules were written from, at most 2,000 characters once trimmed.
* @minLength 1
* @maxLength 2000
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
text: string;
}
diff --git a/app/src/lib/api/generated/model/approvalRuleDraftDescription.ts b/app/src/lib/api/generated/model/approvalRuleDraftDescription.ts
index 3d4642f323..6f742c235c 100644
--- a/app/src/lib/api/generated/model/approvalRuleDraftDescription.ts
+++ b/app/src/lib/api/generated/model/approvalRuleDraftDescription.ts
@@ -7,7 +7,7 @@ export interface ApprovalRuleDraftDescription {
* The rule in a sentence or two, at most 1,000 characters once trimmed.
* @minLength 1
* @maxLength 1000
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
text: string;
}
diff --git a/app/src/lib/api/generated/model/approvalRulePattern.ts b/app/src/lib/api/generated/model/approvalRulePattern.ts
index 7d3b6ec17f..0279f71ed4 100644
--- a/app/src/lib/api/generated/model/approvalRulePattern.ts
+++ b/app/src/lib/api/generated/model/approvalRulePattern.ts
@@ -6,6 +6,6 @@
* An exact value, or a pattern where * matches anything, so mcp/gmail/* names every Gmail tool. Trimmed.
* @minLength 1
* @maxLength 300
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
export type ApprovalRulePattern = string;
diff --git a/app/src/lib/api/generated/model/approvalStatus.ts b/app/src/lib/api/generated/model/approvalStatus.ts
index 6f9ac2e525..e3dd2cc814 100644
--- a/app/src/lib/api/generated/model/approvalStatus.ts
+++ b/app/src/lib/api/generated/model/approvalStatus.ts
@@ -5,13 +5,4 @@
/**
* Where an approval stands. pending waits for the person. approved and denied are decided, and consumed is started; the server then carries the conversation on. completed is finished.
*/
-export type ApprovalStatus =
- (typeof ApprovalStatus)[keyof typeof ApprovalStatus];
-
-export const ApprovalStatus = {
- pending: "pending",
- approved: "approved",
- denied: "denied",
- consumed: "consumed",
- completed: "completed",
-} as const;
+export type ApprovalStatus = string;
diff --git a/app/src/lib/api/generated/model/attachmentLimits.ts b/app/src/lib/api/generated/model/attachmentLimits.ts
new file mode 100644
index 0000000000..b20df42598
--- /dev/null
+++ b/app/src/lib/api/generated/model/attachmentLimits.ts
@@ -0,0 +1,24 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * How large a file attached to a message may be, by kind, in bytes. An upload over its kind's limit is refused. Absent, as from an older OpenBot, the limits are 8388608 for an image or a document (a PDF, or a Word, Excel or PowerPoint file) and 1048576 for any other file. The limits can rise while OpenBot runs, so a client reads them again rather than keeping them for good. What a Bot's model is shown of a large file is a separate matter: the file is kept and can be downloaded whatever the model can read of it.
+ */
+export interface AttachmentLimits {
+ /**
+ * The largest image.
+ * @minimum 1
+ */
+ imageBytes: number;
+ /**
+ * The largest document: a PDF, or a Word, Excel or PowerPoint file (.docx, .xlsx, .pptx).
+ * @minimum 1
+ */
+ documentBytes: number;
+ /**
+ * The largest text file, or a file of any other kind.
+ * @minimum 1
+ */
+ fileBytes: number;
+}
diff --git a/app/src/lib/api/generated/model/authoring.ts b/app/src/lib/api/generated/model/authoring.ts
index d8792ea8e2..f0c87f218f 100644
--- a/app/src/lib/api/generated/model/authoring.ts
+++ b/app/src/lib/api/generated/model/authoring.ts
@@ -10,7 +10,7 @@ export interface Authoring {
/**
* @minLength 1
* @maxLength 2000
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
text: string;
}
diff --git a/app/src/lib/api/generated/model/botAgentHarness.ts b/app/src/lib/api/generated/model/botAgentHarness.ts
index b20260f2fe..27951618a5 100644
--- a/app/src/lib/api/generated/model/botAgentHarness.ts
+++ b/app/src/lib/api/generated/model/botAgentHarness.ts
@@ -14,6 +14,7 @@ export const BotAgentHarness = {
llamaindex: "llamaindex",
agno: "agno",
langgraph: "langgraph",
+ "langgraph-ts": "langgraph-ts",
"google-adk": "google-adk",
antigravity: "antigravity",
"pydantic-ai": "pydantic-ai",
diff --git a/app/src/lib/api/generated/model/botDeclineReport.ts b/app/src/lib/api/generated/model/botDeclineReport.ts
index b9f746a554..ec3cadcd65 100644
--- a/app/src/lib/api/generated/model/botDeclineReport.ts
+++ b/app/src/lib/api/generated/model/botDeclineReport.ts
@@ -7,7 +7,7 @@ export interface BotDeclineReport {
* Why the Bot declined, in its own words. The trail keeps the first 500 characters.
* @minLength 1
* @maxLength 2000
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
reason: string;
/**
diff --git a/app/src/lib/api/generated/model/botGrantChangesAuthoring.ts b/app/src/lib/api/generated/model/botGrantChangesAuthoring.ts
index adf083f85c..3bd496f2e7 100644
--- a/app/src/lib/api/generated/model/botGrantChangesAuthoring.ts
+++ b/app/src/lib/api/generated/model/botGrantChangesAuthoring.ts
@@ -11,7 +11,7 @@ export type BotGrantChangesAuthoring = {
/**
* @minLength 1
* @maxLength 2000
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
text: string;
};
diff --git a/app/src/lib/api/generated/model/botGrantDescription.ts b/app/src/lib/api/generated/model/botGrantDescription.ts
index e66c73e8ab..9e0e582f7d 100644
--- a/app/src/lib/api/generated/model/botGrantDescription.ts
+++ b/app/src/lib/api/generated/model/botGrantDescription.ts
@@ -13,7 +13,7 @@ export interface BotGrantDescription {
* What the Bot may do in the app, in a sentence or two, at most 1,000 characters once trimmed.
* @minLength 1
* @maxLength 1000
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
text: string;
}
diff --git a/app/src/lib/api/generated/model/boundaryRuleLabelInput.ts b/app/src/lib/api/generated/model/boundaryRuleLabelInput.ts
index 605a0fb2fc..c4ef6ff049 100644
--- a/app/src/lib/api/generated/model/boundaryRuleLabelInput.ts
+++ b/app/src/lib/api/generated/model/boundaryRuleLabelInput.ts
@@ -7,7 +7,7 @@ export interface BoundaryRuleLabelInput {
* 1 to 80 characters once trimmed.
* @minLength 1
* @maxLength 80
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
name: string;
/**
diff --git a/app/src/lib/api/generated/model/capabilityAnswer.ts b/app/src/lib/api/generated/model/capabilityAnswer.ts
index cec545ddfa..f705749693 100644
--- a/app/src/lib/api/generated/model/capabilityAnswer.ts
+++ b/app/src/lib/api/generated/model/capabilityAnswer.ts
@@ -1,11 +1,10 @@
/**
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
-import type { CapabilityAnswerDecidedBy } from "./capabilityAnswerDecidedBy";
export interface CapabilityAnswer {
allowed: boolean;
- decidedBy: CapabilityAnswerDecidedBy;
+ decidedBy: string;
/** The role, the group's name or the team's id that decided it. Empty otherwise. */
scopeId: string;
}
diff --git a/app/src/lib/api/generated/model/capabilityAnswerDecidedBy.ts b/app/src/lib/api/generated/model/capabilityAnswerDecidedBy.ts
deleted file mode 100644
index 914ec453dc..0000000000
--- a/app/src/lib/api/generated/model/capabilityAnswerDecidedBy.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-export type CapabilityAnswerDecidedBy =
- (typeof CapabilityAnswerDecidedBy)[keyof typeof CapabilityAnswerDecidedBy];
-
-export const CapabilityAnswerDecidedBy = {
- default: "default",
- organization: "organization",
- role: "role",
- group: "group",
- team: "team",
-} as const;
diff --git a/app/src/lib/api/generated/model/capabilityPreviewPeopleItem.ts b/app/src/lib/api/generated/model/capabilityPreviewPeopleItem.ts
index b17921e8b1..7c668641be 100644
--- a/app/src/lib/api/generated/model/capabilityPreviewPeopleItem.ts
+++ b/app/src/lib/api/generated/model/capabilityPreviewPeopleItem.ts
@@ -2,14 +2,14 @@
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
import type { CapabilityPreviewPeopleItemCapabilitiesItem } from "./capabilityPreviewPeopleItemCapabilitiesItem";
-import type { PersonRole } from "./personRole";
+import type { PersonRoleAnswer } from "./personRoleAnswer";
export type CapabilityPreviewPeopleItem = {
id: string;
email: string;
/** @nullable */
name: string | null;
- role: PersonRole;
+ role: PersonRoleAnswer;
groups: string[];
capabilities: CapabilityPreviewPeopleItemCapabilitiesItem[];
};
diff --git a/app/src/lib/api/generated/model/changeDescription.ts b/app/src/lib/api/generated/model/changeDescription.ts
index 766976a1b2..b4d304ff2e 100644
--- a/app/src/lib/api/generated/model/changeDescription.ts
+++ b/app/src/lib/api/generated/model/changeDescription.ts
@@ -7,7 +7,7 @@ export interface ChangeDescription {
* The change in a sentence or two, at most 1,000 characters once trimmed.
* @minLength 1
* @maxLength 1000
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
text: string;
}
diff --git a/app/src/lib/api/generated/model/checkIn.ts b/app/src/lib/api/generated/model/checkIn.ts
index 199620ec1e..23990d3d5d 100644
--- a/app/src/lib/api/generated/model/checkIn.ts
+++ b/app/src/lib/api/generated/model/checkIn.ts
@@ -1,7 +1,6 @@
/**
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
-import type { CheckInLastStatus } from "./checkInLastStatus";
import type { LastCheckIn } from "./lastCheckIn";
/**
@@ -38,7 +37,7 @@ export interface CheckIn {
* @nullable
*/
lastRunAt: string | null;
- lastStatus: CheckInLastStatus;
+ lastStatus: string;
/**
* What stopped its last run, or null.
* @nullable
diff --git a/app/src/lib/api/generated/model/checkInItem.ts b/app/src/lib/api/generated/model/checkInItem.ts
index 986935ad7d..00658d4ae3 100644
--- a/app/src/lib/api/generated/model/checkInItem.ts
+++ b/app/src/lib/api/generated/model/checkInItem.ts
@@ -1,7 +1,6 @@
/**
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
-import type { CheckInItemStatus } from "./checkInItemStatus";
/**
* Something a Bot's check-in found that needs the person: what it is, why, and where the Bot read it.
@@ -33,7 +32,7 @@ export interface CheckInItem {
*/
sourceLink: string | null;
/** open until the person starts or hides it. superseded is the Bot's own: a later check-in cleared it as no longer needed. */
- status: CheckInItemStatus;
+ status: string;
/**
* The notice that told the person about it, or null while it waits for their next one.
* @nullable
diff --git a/app/src/lib/api/generated/model/checkInItemStatus.ts b/app/src/lib/api/generated/model/checkInItemStatus.ts
deleted file mode 100644
index 186bb0740e..0000000000
--- a/app/src/lib/api/generated/model/checkInItemStatus.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-/**
- * open until the person starts or hides it. superseded is the Bot's own: a later check-in cleared it as no longer needed.
- */
-export type CheckInItemStatus =
- (typeof CheckInItemStatus)[keyof typeof CheckInItemStatus];
-
-export const CheckInItemStatus = {
- open: "open",
- dismissed: "dismissed",
- started: "started",
- superseded: "superseded",
-} as const;
diff --git a/app/src/lib/api/generated/model/checkInLastStatus.ts b/app/src/lib/api/generated/model/checkInLastStatus.ts
deleted file mode 100644
index 5b3070da7d..0000000000
--- a/app/src/lib/api/generated/model/checkInLastStatus.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-export type CheckInLastStatus =
- (typeof CheckInLastStatus)[keyof typeof CheckInLastStatus];
-
-export const CheckInLastStatus = {
- idle: "idle",
- running: "running",
- succeeded: "succeeded",
- error: "error",
-} as const;
diff --git a/app/src/lib/api/generated/model/clientRelease.ts b/app/src/lib/api/generated/model/clientRelease.ts
new file mode 100644
index 0000000000..45b5f0897a
--- /dev/null
+++ b/app/src/lib/api/generated/model/clientRelease.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * An OpenBot release, such as 1.1.0.
+ * @pattern ^\d{1,6}\.\d{1,6}\.\d{1,6}(-[0-9A-Za-z.-]{1,64})?$
+ */
+export type ClientRelease = string;
diff --git a/app/src/lib/api/generated/model/computerControlRequest.ts b/app/src/lib/api/generated/model/computerControlRequest.ts
index dd012c8fb1..a630057485 100644
--- a/app/src/lib/api/generated/model/computerControlRequest.ts
+++ b/app/src/lib/api/generated/model/computerControlRequest.ts
@@ -2,7 +2,6 @@
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
import type { ComputerControlRequestSource } from "./computerControlRequestSource";
-import type { ComputerControlRequestStatus } from "./computerControlRequestStatus";
/**
* A request for a person to drive a Bot's computer.
@@ -13,7 +12,7 @@ export interface ComputerControlRequest {
reason: string;
/** Who raised it: the Bot (model), a check the page raised, or the person themselves (manual). */
source: ComputerControlRequestSource;
- status: ComputerControlRequestStatus;
+ status: string;
createdAt: string;
updatedAt: string;
expiresAt?: string;
diff --git a/app/src/lib/api/generated/model/computerControlRequestStatus.ts b/app/src/lib/api/generated/model/computerControlRequestStatus.ts
deleted file mode 100644
index 30ddd7ddcb..0000000000
--- a/app/src/lib/api/generated/model/computerControlRequestStatus.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-export type ComputerControlRequestStatus =
- (typeof ComputerControlRequestStatus)[keyof typeof ComputerControlRequestStatus];
-
-export const ComputerControlRequestStatus = {
- waiting: "waiting",
- taken: "taken",
- completed: "completed",
- cancelled: "cancelled",
- expired: "expired",
- interrupted: "interrupted",
-} as const;
diff --git a/app/src/lib/api/generated/model/computerState.ts b/app/src/lib/api/generated/model/computerState.ts
index f7114fcd13..221c0b8dff 100644
--- a/app/src/lib/api/generated/model/computerState.ts
+++ b/app/src/lib/api/generated/model/computerState.ts
@@ -5,11 +5,4 @@
/**
* Where a computer is in its life. absent is one that is not running: never started, or put to sleep after a quiet spell; it starts on the Bot's next action. starting is on its way up. unreachable is the only one that is something wrong.
*/
-export type ComputerState = (typeof ComputerState)[keyof typeof ComputerState];
-
-export const ComputerState = {
- absent: "absent",
- starting: "starting",
- ready: "ready",
- unreachable: "unreachable",
-} as const;
+export type ComputerState = string;
diff --git a/app/src/lib/api/generated/model/conversationMessage.ts b/app/src/lib/api/generated/model/conversationMessage.ts
index 07138be775..dc77560bb3 100644
--- a/app/src/lib/api/generated/model/conversationMessage.ts
+++ b/app/src/lib/api/generated/model/conversationMessage.ts
@@ -1,9 +1,9 @@
/**
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
+import type { Attachment } from "./attachment";
import type { ConversationMessageConsent } from "./conversationMessageConsent";
import type { ConversationMessageRole } from "./conversationMessageRole";
-import type { ConversationMessageStatus } from "./conversationMessageStatus";
/**
* One thing said in a conversation: a person's message, or one Bot's reply.
@@ -26,14 +26,16 @@ export interface ConversationMessage {
/** What was said. Empty while another person's Bot is still writing it. */
text: string;
/** Where a Bot's reply stands. A person's message is completed. */
- status: ConversationMessageStatus;
+ status: string;
/**
* When it was said. Null where the time was not kept.
* @nullable
*/
createdAt: string | null;
- /** Why a waiting Bot is waiting. */
+ /** Why a waiting Bot is waiting, in words for the person reading the conversation. */
reason?: string;
+ /** True on a failed Bot reply in a group that the person whose turn it answered chose not to share. It was a choice, not a fault, and nothing was sent. text says whose choice it was. */
+ declined?: boolean;
/** For an answer passed on from another Bot: which Bot answered. */
answeredBy?: string;
/** A Team Bot asking the person whose turn it was to use their own account. */
@@ -43,4 +45,9 @@ export interface ConversationMessage {
* @minimum 0
*/
toolCalls?: number;
+ /**
+ * In a group conversation, the files a Bot sent from its computer with this reply, in the order it sent them. Each is an attachment of the conversation, read at its attachment address by anyone in it.
+ * @maxItems 20
+ */
+ files?: Attachment[];
}
diff --git a/app/src/lib/api/generated/model/conversationMessageStatus.ts b/app/src/lib/api/generated/model/conversationMessageStatus.ts
deleted file mode 100644
index 6ea0bcff96..0000000000
--- a/app/src/lib/api/generated/model/conversationMessageStatus.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-/**
- * Where a Bot's reply stands. A person's message is completed.
- */
-export type ConversationMessageStatus =
- (typeof ConversationMessageStatus)[keyof typeof ConversationMessageStatus];
-
-export const ConversationMessageStatus = {
- queued: "queued",
- running: "running",
- waiting: "waiting",
- completed: "completed",
- failed: "failed",
-} as const;
diff --git a/app/src/lib/api/generated/model/createBotRequest.ts b/app/src/lib/api/generated/model/createBotRequest.ts
index 4e9e2526d6..ad950cdb77 100644
--- a/app/src/lib/api/generated/model/createBotRequest.ts
+++ b/app/src/lib/api/generated/model/createBotRequest.ts
@@ -23,6 +23,6 @@ export interface CreateBotRequest {
auth?: BotKey;
isolated?: BotIsolated;
instructions?: BotInstructions;
- /** The framework an agent somebody runs themselves is built on, by its id in OpenBot's harness list (shared/harnesses.json), which the server checks every create against. Empty means none was named, as for an agent somebody already runs. "byo-url" is not one: it names no framework. Kept only with an endpoint. */
+ /** The framework an agent somebody runs themselves is built on, by its id in OpenBot's harness list (shared/harnesses.json), which the server checks every create against. Empty means none was named, as for an agent somebody already runs. "byo-url" is not one: it names no framework. Kept only with an endpoint, with one exception: "langgraph-ts" sent with no endpoint asks for a Bot that runs inside OpenBot on OpenBot's own LangGraph (TypeScript) engine, which is what the New Bot sheet sends. The deployment decides what each run uses: a Claude plan keeps the Claude Agent SDK engine, and an administrator may switch new Bots back to the built-in agent. */
harness?: CreateBotRequestHarness;
}
diff --git a/app/src/lib/api/generated/model/createBotRequestHarness.ts b/app/src/lib/api/generated/model/createBotRequestHarness.ts
index dc8ef8d604..5d3252fc14 100644
--- a/app/src/lib/api/generated/model/createBotRequestHarness.ts
+++ b/app/src/lib/api/generated/model/createBotRequestHarness.ts
@@ -3,7 +3,7 @@
*/
/**
- * The framework an agent somebody runs themselves is built on, by its id in OpenBot's harness list (shared/harnesses.json), which the server checks every create against. Empty means none was named, as for an agent somebody already runs. "byo-url" is not one: it names no framework. Kept only with an endpoint.
+ * The framework an agent somebody runs themselves is built on, by its id in OpenBot's harness list (shared/harnesses.json), which the server checks every create against. Empty means none was named, as for an agent somebody already runs. "byo-url" is not one: it names no framework. Kept only with an endpoint, with one exception: "langgraph-ts" sent with no endpoint asks for a Bot that runs inside OpenBot on OpenBot's own LangGraph (TypeScript) engine, which is what the New Bot sheet sends. The deployment decides what each run uses: a Claude plan keeps the Claude Agent SDK engine, and an administrator may switch new Bots back to the built-in agent.
*/
export type CreateBotRequestHarness =
(typeof CreateBotRequestHarness)[keyof typeof CreateBotRequestHarness];
@@ -14,6 +14,7 @@ export const CreateBotRequestHarness = {
llamaindex: "llamaindex",
agno: "agno",
langgraph: "langgraph",
+ "langgraph-ts": "langgraph-ts",
"google-adk": "google-adk",
antigravity: "antigravity",
"pydantic-ai": "pydantic-ai",
diff --git a/app/src/lib/api/generated/model/createOrganizationRequest.ts b/app/src/lib/api/generated/model/createOrganizationRequest.ts
index 73e999b6e1..5dc439df84 100644
--- a/app/src/lib/api/generated/model/createOrganizationRequest.ts
+++ b/app/src/lib/api/generated/model/createOrganizationRequest.ts
@@ -7,7 +7,7 @@ export interface CreateOrganizationRequest {
* What people call it.
* @minLength 1
* @maxLength 100
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
name: string;
/**
diff --git a/app/src/lib/api/generated/model/createTeamRequest.ts b/app/src/lib/api/generated/model/createTeamRequest.ts
index 25edd76598..4b48701bca 100644
--- a/app/src/lib/api/generated/model/createTeamRequest.ts
+++ b/app/src/lib/api/generated/model/createTeamRequest.ts
@@ -7,7 +7,7 @@ export interface CreateTeamRequest {
* What people call it.
* @minLength 1
* @maxLength 100
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
name: string;
/**
diff --git a/app/src/lib/api/generated/model/deliveryState.ts b/app/src/lib/api/generated/model/deliveryState.ts
index b4c46cf314..00fefb2a3f 100644
--- a/app/src/lib/api/generated/model/deliveryState.ts
+++ b/app/src/lib/api/generated/model/deliveryState.ts
@@ -5,15 +5,4 @@
/**
* Where it got to. accepted is the provider taking it without saying yet that it arrived. unknown is a send that may or may not have gone. opted_out is a text message not sent because the person texted STOP.
*/
-export type DeliveryState = (typeof DeliveryState)[keyof typeof DeliveryState];
-
-export const DeliveryState = {
- queued: "queued",
- running: "running",
- accepted: "accepted",
- sent: "sent",
- delivered: "delivered",
- failed: "failed",
- unknown: "unknown",
- opted_out: "opted_out",
-} as const;
+export type DeliveryState = string;
diff --git a/app/src/lib/api/generated/model/deployment.ts b/app/src/lib/api/generated/model/deployment.ts
index c284bec110..b113d710fb 100644
--- a/app/src/lib/api/generated/model/deployment.ts
+++ b/app/src/lib/api/generated/model/deployment.ts
@@ -1,8 +1,10 @@
/**
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
+import type { AttachmentLimits } from "./attachmentLimits";
import type { DeploymentAuthProvidersItem } from "./deploymentAuthProvidersItem";
import type { DeploymentEdition } from "./deploymentEdition";
+import type { MinimumClients } from "./minimumClients";
/**
* What this OpenBot offers and how people sign in to it.
@@ -34,4 +36,24 @@ export interface Deployment {
isolatedBots: boolean;
/** Whether this OpenBot has computers for Bots at all. False, a Bot has no computer, browser or sign-in to a website, and the computers answer 503 to every call. Not isolatedBots: an OpenBot whose Bots share one computer has computers (true) and cannot give a Bot one of its own (isolatedBots false). */
botComputers: boolean;
+ attachmentLimits?: AttachmentLimits;
+ /**
+ * The API versions this OpenBot serves, by major, such as v2. An app that speaks none of them can't use it: when they are all newer than the app's, the app needs an update; when they are all older, this OpenBot does. Absent from a release before it was published, which serves v2.
+ * @minItems 1
+ * @items.pattern ^v[1-9][0-9]{0,3}$
+ */
+ api?: string[];
+ minimumClients?: MinimumClients;
+ /** The part of minimumClients raised because of a security problem in older releases: for each app named, the minimum is there for security. Absent or empty when none is. */
+ securityMinimumClients?: MinimumClients;
+ /**
+ * The version of what OpenBot Desktop supplies when it starts this OpenBot on its own computer. It changes when Desktop must supply something new.
+ * @minimum 1
+ */
+ launcherApi?: number;
+ /**
+ * The version of what the OpenBot Recorder and this OpenBot exchange.
+ * @minimum 1
+ */
+ extensionApi?: number;
}
diff --git a/app/src/lib/api/generated/model/goal.ts b/app/src/lib/api/generated/model/goal.ts
index 203fe42cac..00cf07f9bf 100644
--- a/app/src/lib/api/generated/model/goal.ts
+++ b/app/src/lib/api/generated/model/goal.ts
@@ -1,7 +1,6 @@
/**
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
-import type { GoalStatus } from "./goalStatus";
import type { GoalSubscription } from "./goalSubscription";
/**
@@ -22,7 +21,7 @@ export interface Goal {
instruction: string;
/** When it is done. May be empty. */
successCriteria: string;
- status: GoalStatus;
+ status: string;
/** Where it stands, as the Bot last recorded it. */
progress: string;
/**
diff --git a/app/src/lib/api/generated/model/goalRun.ts b/app/src/lib/api/generated/model/goalRun.ts
index 9fe73016cc..645c5b7298 100644
--- a/app/src/lib/api/generated/model/goalRun.ts
+++ b/app/src/lib/api/generated/model/goalRun.ts
@@ -1,7 +1,6 @@
/**
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
-import type { GoalRunStatus } from "./goalRunStatus";
import type { GoalRunWaiting } from "./goalRunWaiting";
/**
@@ -10,7 +9,7 @@ import type { GoalRunWaiting } from "./goalRunWaiting";
export interface GoalRun {
/** The run's id. */
id: string;
- status: GoalRunStatus;
+ status: string;
/**
* What the Bot said, or null.
* @nullable
diff --git a/app/src/lib/api/generated/model/goalRunStatus.ts b/app/src/lib/api/generated/model/goalRunStatus.ts
deleted file mode 100644
index 161ce99548..0000000000
--- a/app/src/lib/api/generated/model/goalRunStatus.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-export type GoalRunStatus = (typeof GoalRunStatus)[keyof typeof GoalRunStatus];
-
-export const GoalRunStatus = {
- queued: "queued",
- running: "running",
- waiting: "waiting",
- succeeded: "succeeded",
- failed: "failed",
- skipped: "skipped",
-} as const;
diff --git a/app/src/lib/api/generated/model/goalStatus.ts b/app/src/lib/api/generated/model/goalStatus.ts
deleted file mode 100644
index f1370776dc..0000000000
--- a/app/src/lib/api/generated/model/goalStatus.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-export type GoalStatus = (typeof GoalStatus)[keyof typeof GoalStatus];
-
-export const GoalStatus = {
- active: "active",
- paused: "paused",
- completed: "completed",
-} as const;
diff --git a/app/src/lib/api/generated/model/identityProviderDomains.ts b/app/src/lib/api/generated/model/identityProviderDomains.ts
index a88162dd65..4b7fbb7545 100644
--- a/app/src/lib/api/generated/model/identityProviderDomains.ts
+++ b/app/src/lib/api/generated/model/identityProviderDomains.ts
@@ -6,6 +6,6 @@
* The email domain whose people it signs in, such as acme.com. Several are separated by commas.
* @minLength 1
* @maxLength 2048
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
export type IdentityProviderDomains = string;
diff --git a/app/src/lib/api/generated/model/identityProviderText.ts b/app/src/lib/api/generated/model/identityProviderText.ts
index 71658f7e3b..18d82aa33c 100644
--- a/app/src/lib/api/generated/model/identityProviderText.ts
+++ b/app/src/lib/api/generated/model/identityProviderText.ts
@@ -5,6 +5,6 @@
/**
* @minLength 1
* @maxLength 2048
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
export type IdentityProviderText = string;
diff --git a/app/src/lib/api/generated/model/index.ts b/app/src/lib/api/generated/model/index.ts
index dccf1b19d1..eeb2253209 100644
--- a/app/src/lib/api/generated/model/index.ts
+++ b/app/src/lib/api/generated/model/index.ts
@@ -26,6 +26,14 @@ export * from "./addedConversationMember";
export * from "./adminOnlyResponse";
export * from "./advanceOnboardingHeaders";
export * from "./advanceOnboardingRequest";
+export * from "./aiConnection";
+export * from "./aiConnectionFixedResponse";
+export * from "./aiConnectionInput";
+export * from "./aiConnectionLogin";
+export * from "./aiConnectionProvider";
+export * from "./aiConnectionRefusedResponse";
+export * from "./aiConnectionSaved";
+export * from "./aiConnectionSource";
export * from "./allowBotComponentHeaders";
export * from "./allowlistEntry";
export * from "./announceComponentsHeaders";
@@ -44,7 +52,6 @@ export * from "./appAccessRequestInput";
export * from "./appAccessRequestKind";
export * from "./appAccessRequestNotFoundResponse";
export * from "./appAccessRequestPage";
-export * from "./appAccessRequestStatus";
export * from "./appAccountMode";
export * from "./appAccountModeChange";
export * from "./appAccountModeChangeAccountsEnded";
@@ -144,6 +151,7 @@ export * from "./assignableRole";
export * from "./assignTeamBotHeaders";
export * from "./attachment";
export * from "./attachmentConflictResponse";
+export * from "./attachmentLimits";
export * from "./attachmentNotFoundResponse";
export * from "./attachmentUpload";
export * from "./auditActorParameter";
@@ -368,7 +376,6 @@ export * from "./cancelOrganizationInvitationHeaders";
export * from "./cancelSignInHeaders";
export * from "./capability";
export * from "./capabilityAnswer";
-export * from "./capabilityAnswerDecidedBy";
export * from "./capabilityChange";
export * from "./capabilityChanges";
export * from "./capabilityChangeScopeKind";
@@ -404,8 +411,6 @@ export * from "./checkInItem";
export * from "./checkInItemNotFoundResponse";
export * from "./checkInItemPage";
export * from "./checkInItemResponse";
-export * from "./checkInItemStatus";
-export * from "./checkInLastStatus";
export * from "./checkInNotFoundResponse";
export * from "./checkInPage";
export * from "./checkInResponse";
@@ -421,6 +426,7 @@ export * from "./clearBotBrowserHeaders";
export * from "./clearPersonBrowserHeaders";
export * from "./clearTeamBotConsentsHeaders";
export * from "./clickComputerHeaders";
+export * from "./clientRelease";
export * from "./completeGoalHeaders";
export * from "./completeOnboardingHeaders";
export * from "./component";
@@ -461,7 +467,6 @@ export * from "./computerControlRequest";
export * from "./computerControlRequestIdParameter";
export * from "./computerControlRequestRef";
export * from "./computerControlRequestSource";
-export * from "./computerControlRequestStatus";
export * from "./computerControlSecretEnded";
export * from "./computerFileEntry";
export * from "./computerFileEntryKind";
@@ -564,7 +569,6 @@ export * from "./conversationMessage";
export * from "./conversationMessageConsent";
export * from "./conversationMessagePage";
export * from "./conversationMessageRole";
-export * from "./conversationMessageStatus";
export * from "./conversationNotFoundResponse";
export * from "./conversationNotJoinableResponse";
export * from "./conversationPage";
@@ -758,9 +762,7 @@ export * from "./goalResponse";
export * from "./goalRun";
export * from "./goalRunAccepted";
export * from "./goalRunPage";
-export * from "./goalRunStatus";
export * from "./goalRunWaiting";
-export * from "./goalStatus";
export * from "./goalSubscription";
export * from "./goalSubscriptionSource";
export * from "./goalTrigger";
@@ -798,6 +800,7 @@ export * from "./identityProviderProtocol";
export * from "./identityProviderResponse";
export * from "./identityProviderText";
export * from "./inactiveComputersStopped";
+export * from "./invalidAiConnectionResponse";
export * from "./invalidAppChangeResponse";
export * from "./invalidAppResponse";
export * from "./invalidApprovalRuleDraftsResponse";
@@ -835,7 +838,6 @@ export * from "./invitationOrganization";
export * from "./invitationPage";
export * from "./invitationResponse";
export * from "./invitationSender";
-export * from "./invitationStatus";
export * from "./issueBotAgentCallbackTokenHeaders";
export * from "./issueBotCallbackTokenHeaders";
export * from "./lastCheckIn";
@@ -874,7 +876,6 @@ export * from "./learningProposalNotFoundResponse";
export * from "./learningProposalOperation";
export * from "./learningProposalPage";
export * from "./learningProposalReviewedResponse";
-export * from "./learningProposalStatus";
export * from "./learningProposalUnnamedResponse";
export * from "./learningReview";
export * from "./learningReviewNotYoursResponse";
@@ -882,7 +883,6 @@ export * from "./learningReviewOperation";
export * from "./learningReviewStatus";
export * from "./learningRun";
export * from "./learningRunPage";
-export * from "./learningRunStatus";
export * from "./learningRunTriggerSource";
export * from "./learningSettings";
export * from "./learningSettingsBots";
@@ -910,7 +910,6 @@ export * from "./linkedAccountPage";
export * from "./linkedAccountProvider";
export * from "./linkedAccountProviderId";
export * from "./linkedAccountProviderPage";
-export * from "./linkedAccountStatus";
export * from "./linkedAccountsUnavailableResponse";
export * from "./linkProviderUnavailableResponse";
export * from "./listApiKeysParams";
@@ -1004,12 +1003,12 @@ export * from "./memorySourceArgs";
export * from "./memorySourceNotFoundResponse";
export * from "./memorySourcePage";
export * from "./memorySourceSync";
-export * from "./memorySourceSyncStatus";
export * from "./memorySourceTool";
export * from "./memorySourceToolInputSchema";
export * from "./memorySourceToolPage";
export * from "./memoryUnavailableResponse";
export * from "./messageListEmphasis";
+export * from "./minimumClients";
export * from "./modelCatalogue";
export * from "./modelCatalogueExposure";
export * from "./modelCatalogueProvider";
@@ -1039,7 +1038,6 @@ export * from "./networkPolicyCandidateScopeKind";
export * from "./networkPolicyInput";
export * from "./networkPolicyNotFoundResponse";
export * from "./networkPolicyPage";
-export * from "./networkPolicyScopeKind";
export * from "./networkReplayReport";
export * from "./networkReplayReportHostsItem";
export * from "./networkReplayReportHostsItemChange";
@@ -1048,11 +1046,16 @@ export * from "./networkTranslationMode";
export * from "./newIdentityProviderId";
export * from "./noBotToAnswerResponse";
export * from "./noSpeechResponse";
+export * from "./noticeId";
export * from "./notificationSettings";
export * from "./notificationTransport";
export * from "./notificationTransportOption";
export * from "./notificationTransportPage";
export * from "./noTrailToReplayResponse";
+export * from "./nudgeEvent";
+export * from "./nudgeEventAction";
+export * from "./nudgeEventPlace";
+export * from "./nudgeEventSurface";
export * from "./oidcIdentityProviderRequest";
export * from "./oidcIdentityProviderRequestProtocol";
export * from "./onboardingResponse";
@@ -1067,7 +1070,6 @@ export * from "./organizationInvitationConflictResponse";
export * from "./organizationInvitationPage";
export * from "./organizationInvitationResponse";
export * from "./organizationInvitationResponseDelivery";
-export * from "./organizationInvitationStatus";
export * from "./organizationMember";
export * from "./organizationMemberPage";
export * from "./organizationMemberResponse";
@@ -1079,6 +1081,7 @@ export * from "./organizationResponse";
export * from "./organizationSettings";
export * from "./organizationSettingsContext";
export * from "./organizationSettingsContextAppsItem";
+export * from "./organizationSettingsContextComputerMode";
export * from "./organizationSettingsContextOtel";
export * from "./organizationSettingsContextScim";
export * from "./organizationSettingValues";
@@ -1119,6 +1122,7 @@ export * from "./personRealBrowserOpened";
export * from "./personRealBrowserOpenedOpened";
export * from "./personResponse";
export * from "./personRole";
+export * from "./personRoleAnswer";
export * from "./phoneVerification";
export * from "./pinBotHeaders";
export * from "./playgroundDraftSource";
@@ -1186,6 +1190,7 @@ export * from "./recordingsUnavailableResponse";
export * from "./recordingTitles";
export * from "./recordingTitlesRecordingsItem";
export * from "./recordInPersonBrowserHeaders";
+export * from "./recordNudgeEventHeaders";
export * from "./recordProductEventHeaders";
export * from "./refreshAppHeaders";
export * from "./registerDeviceHeaders";
@@ -1199,6 +1204,7 @@ export * from "./removeConversationMemberHeaders";
export * from "./removeOrganizationMemberHeaders";
export * from "./removeTeamMemberHeaders";
export * from "./reopenTaskHeaders";
+export * from "./replaceAiConnectionHeaders";
export * from "./replaceAppHeaders";
export * from "./replaceAppRequest";
export * from "./replaceAppTeamGrantsHeaders";
@@ -1260,7 +1266,6 @@ export * from "./routeMessageRequest";
export * from "./routine";
export * from "./routineConversation";
export * from "./routineLastRun";
-export * from "./routineLastRunStatus";
export * from "./routineNotFoundResponse";
export * from "./routinePage";
export * from "./routineResponse";
@@ -1268,7 +1273,6 @@ export * from "./routineRun";
export * from "./routineRunAccepted";
export * from "./routineRunPage";
export * from "./routineRunSource";
-export * from "./routineRunStatus";
export * from "./routineSwitch";
export * from "./ruleCheck";
export * from "./runCheckInHeaders";
@@ -1324,7 +1328,6 @@ export * from "./sharedUseRequestDecidedResponse";
export * from "./sharedUseRequestFiled";
export * from "./sharedUseRequestPage";
export * from "./sharedUseRequestReason";
-export * from "./sharedUseRequestStatus";
export * from "./sharingNotAllowedResponse";
export * from "./sharingNotNeededResponse";
export * from "./sharingRequestChangedResponse";
@@ -1449,6 +1452,7 @@ export * from "./unpinBotHeaders";
export * from "./unpublishComponentHeaders";
export * from "./unpublishTeamBotHeaders";
export * from "./unsupportedFileResponse";
+export * from "./unverifiedModel";
export * from "./updateAppHeaders";
export * from "./updateAppRequest";
export * from "./updateApprovalPreferencesHeaders";
@@ -1506,6 +1510,8 @@ export * from "./updatePersonRequest";
export * from "./updatePreferencesHeaders";
export * from "./updatePreferencesRequest";
export * from "./updateRoute";
+export * from "./updateRoutineHeaders";
+export * from "./updateRoutineRequest";
export * from "./updateRouting";
export * from "./updateStandingInstructionsHeaders";
export * from "./updateTeamHeaders";
diff --git a/app/src/lib/api/generated/model/invalidAiConnectionResponse.ts b/app/src/lib/api/generated/model/invalidAiConnectionResponse.ts
new file mode 100644
index 0000000000..f392822ca0
--- /dev/null
+++ b/app/src/lib/api/generated/model/invalidAiConnectionResponse.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { Problem } from "./problem";
+
+/**
+ * The body is malformed, the provider doesn't take that login, the address isn't http or https or has something in it that signs in, or a key, an address or a model the login needs is missing.
+ */
+export type InvalidAiConnectionResponse = Problem;
diff --git a/app/src/lib/api/generated/model/invitation.ts b/app/src/lib/api/generated/model/invitation.ts
index 6f2740d3d9..df2a48d1a2 100644
--- a/app/src/lib/api/generated/model/invitation.ts
+++ b/app/src/lib/api/generated/model/invitation.ts
@@ -4,7 +4,6 @@
import type { AssignableRole } from "./assignableRole";
import type { InvitationOrganization } from "./invitationOrganization";
import type { InvitationSender } from "./invitationSender";
-import type { InvitationStatus } from "./invitationStatus";
/**
* An invitation as the person it was sent to sees it. status is the server's verdict.
@@ -16,7 +15,7 @@ export interface Invitation {
organization: InvitationOrganization;
role: AssignableRole;
/** pending while it can still be answered. expired once its seven days ran out, accepted or declined once the person answered, canceled when the organization took it back. */
- status: InvitationStatus;
+ status: string;
invitedBy: InvitationSender;
/** When it was sent. */
createdAt: string;
diff --git a/app/src/lib/api/generated/model/invitationStatus.ts b/app/src/lib/api/generated/model/invitationStatus.ts
deleted file mode 100644
index a09e67fab7..0000000000
--- a/app/src/lib/api/generated/model/invitationStatus.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-/**
- * pending while it can still be answered. expired once its seven days ran out, accepted or declined once the person answered, canceled when the organization took it back.
- */
-export type InvitationStatus =
- (typeof InvitationStatus)[keyof typeof InvitationStatus];
-
-export const InvitationStatus = {
- pending: "pending",
- expired: "expired",
- accepted: "accepted",
- declined: "declined",
- canceled: "canceled",
-} as const;
diff --git a/app/src/lib/api/generated/model/learningProposal.ts b/app/src/lib/api/generated/model/learningProposal.ts
index 8e5050f26d..8c94f06b59 100644
--- a/app/src/lib/api/generated/model/learningProposal.ts
+++ b/app/src/lib/api/generated/model/learningProposal.ts
@@ -2,7 +2,6 @@
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
import type { LearningProposalOperation } from "./learningProposalOperation";
-import type { LearningProposalStatus } from "./learningProposalStatus";
/**
* A skill change Learning proposed in a space, waiting for review or reviewed.
@@ -13,7 +12,7 @@ export interface LearningProposal {
runId: string;
/** Whether it adds a skill, changes one, or removes one. */
operation: LearningProposalOperation;
- status: LearningProposalStatus;
+ status: string;
/** The skill's name. */
title: string;
description: string;
diff --git a/app/src/lib/api/generated/model/learningProposalStatus.ts b/app/src/lib/api/generated/model/learningProposalStatus.ts
deleted file mode 100644
index 18d1e53c3e..0000000000
--- a/app/src/lib/api/generated/model/learningProposalStatus.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-export type LearningProposalStatus =
- (typeof LearningProposalStatus)[keyof typeof LearningProposalStatus];
-
-export const LearningProposalStatus = {
- pending_review: "pending_review",
- approved: "approved",
- rejected: "rejected",
-} as const;
diff --git a/app/src/lib/api/generated/model/learningRun.ts b/app/src/lib/api/generated/model/learningRun.ts
index 4797ccd098..b764d6c960 100644
--- a/app/src/lib/api/generated/model/learningRun.ts
+++ b/app/src/lib/api/generated/model/learningRun.ts
@@ -1,7 +1,6 @@
/**
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
-import type { LearningRunStatus } from "./learningRunStatus";
import type { LearningRunTriggerSource } from "./learningRunTriggerSource";
/**
@@ -9,7 +8,7 @@ import type { LearningRunTriggerSource } from "./learningRunTriggerSource";
*/
export interface LearningRun {
id: string;
- status: LearningRunStatus;
+ status: string;
triggerSource: LearningRunTriggerSource;
/**
* How many proposals it made. Null until it finishes.
diff --git a/app/src/lib/api/generated/model/learningRunStatus.ts b/app/src/lib/api/generated/model/learningRunStatus.ts
deleted file mode 100644
index 2b8be322c7..0000000000
--- a/app/src/lib/api/generated/model/learningRunStatus.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-export type LearningRunStatus =
- (typeof LearningRunStatus)[keyof typeof LearningRunStatus];
-
-export const LearningRunStatus = {
- queued: "queued",
- freezing: "freezing",
- batching: "batching",
- reducing: "reducing",
- finalizing: "finalizing",
- succeeded: "succeeded",
- failed: "failed",
-} as const;
diff --git a/app/src/lib/api/generated/model/linkedAccount.ts b/app/src/lib/api/generated/model/linkedAccount.ts
index 533df43932..1a9c5e3014 100644
--- a/app/src/lib/api/generated/model/linkedAccount.ts
+++ b/app/src/lib/api/generated/model/linkedAccount.ts
@@ -2,7 +2,6 @@
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
import type { LinkedAccountProviderId } from "./linkedAccountProviderId";
-import type { LinkedAccountStatus } from "./linkedAccountStatus";
/**
* A person's account at another service, which OpenBot knows is theirs. Never the credential it holds.
@@ -19,6 +18,6 @@ export interface LinkedAccount {
*/
handle: string | null;
/** needs_reconnect when the service stopped accepting what the link holds, and linking again mends it. */
- status: LinkedAccountStatus;
+ status: string;
createdAt: string;
}
diff --git a/app/src/lib/api/generated/model/linkedAccountStatus.ts b/app/src/lib/api/generated/model/linkedAccountStatus.ts
deleted file mode 100644
index 6f0957e902..0000000000
--- a/app/src/lib/api/generated/model/linkedAccountStatus.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-/**
- * needs_reconnect when the service stopped accepting what the link holds, and linking again mends it.
- */
-export type LinkedAccountStatus =
- (typeof LinkedAccountStatus)[keyof typeof LinkedAccountStatus];
-
-export const LinkedAccountStatus = {
- active: "active",
- needs_reconnect: "needs_reconnect",
-} as const;
diff --git a/app/src/lib/api/generated/model/memorySource.ts b/app/src/lib/api/generated/model/memorySource.ts
index c7cc46b1f0..5f730e692e 100644
--- a/app/src/lib/api/generated/model/memorySource.ts
+++ b/app/src/lib/api/generated/model/memorySource.ts
@@ -2,7 +2,6 @@
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
import type { MemorySourceArgs } from "./memorySourceArgs";
-import type { MemorySourceSyncStatus } from "./memorySourceSyncStatus";
/**
* One app action a person's Bot reads facts in from.
@@ -17,7 +16,7 @@ export interface MemorySource {
/** What the action is called with. */
args: MemorySourceArgs;
enabled: boolean;
- syncStatus: MemorySourceSyncStatus;
+ syncStatus: string;
/**
* Why the last sync failed, in a sentence for the person.
* @nullable
diff --git a/app/src/lib/api/generated/model/memorySourceSyncStatus.ts b/app/src/lib/api/generated/model/memorySourceSyncStatus.ts
deleted file mode 100644
index 7be643e6ef..0000000000
--- a/app/src/lib/api/generated/model/memorySourceSyncStatus.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-export type MemorySourceSyncStatus =
- (typeof MemorySourceSyncStatus)[keyof typeof MemorySourceSyncStatus];
-
-export const MemorySourceSyncStatus = {
- idle: "idle",
- running: "running",
- succeeded: "succeeded",
- error: "error",
-} as const;
diff --git a/app/src/lib/api/generated/model/minimumClients.ts b/app/src/lib/api/generated/model/minimumClients.ts
new file mode 100644
index 0000000000..bedba5d4b8
--- /dev/null
+++ b/app/src/lib/api/generated/model/minimumClients.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { ClientRelease } from "./clientRelease";
+
+/**
+ * The oldest release of each OpenBot app this OpenBot serves. An app names itself in the OpenBot-Client header, and one older than its minimum here is refused with CLIENT_UPDATE_REQUIRED, everywhere but this deployment answer. An app not listed has no minimum. An OpenBot serves every app released in the last 12 months, so it names one only where its administrator raised it. Absent from a release before it was published.
+ */
+export interface MinimumClients {
+ web?: ClientRelease;
+ desktop?: ClientRelease;
+ mobile?: ClientRelease;
+ recorder?: ClientRelease;
+}
diff --git a/app/src/lib/api/generated/model/modelChoice.ts b/app/src/lib/api/generated/model/modelChoice.ts
index 3b7cddda63..6d84c877ce 100644
--- a/app/src/lib/api/generated/model/modelChoice.ts
+++ b/app/src/lib/api/generated/model/modelChoice.ts
@@ -1,6 +1,7 @@
/**
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
+import type { UnverifiedModel } from "./unverifiedModel";
/**
* The model and thinking effort a person chose for one conversation. Null model: the default model. Null effort: none is sent, so the model thinks on its own default.
@@ -10,4 +11,5 @@ export interface ModelChoice {
model: string | null;
/** @nullable */
effort: string | null;
+ unverified?: UnverifiedModel;
}
diff --git a/app/src/lib/api/generated/model/networkPolicy.ts b/app/src/lib/api/generated/model/networkPolicy.ts
index 00d764c95a..4868e580bf 100644
--- a/app/src/lib/api/generated/model/networkPolicy.ts
+++ b/app/src/lib/api/generated/model/networkPolicy.ts
@@ -3,13 +3,12 @@
*/
import type { EgressRule } from "./egressRule";
import type { NetworkMode } from "./networkMode";
-import type { NetworkPolicyScopeKind } from "./networkPolicyScopeKind";
export interface NetworkPolicy {
/** organization, team: for a team, or group: for a directory group. */
id: string;
/** Whose policy: the organization's, a team's, or a directory group's. */
- scopeKind: NetworkPolicyScopeKind;
+ scopeKind: string;
/** The team's id, or the directory group's name. Empty for the organization. */
scopeId: string;
mode: NetworkMode;
diff --git a/app/src/lib/api/generated/model/networkPolicyScopeKind.ts b/app/src/lib/api/generated/model/networkPolicyScopeKind.ts
deleted file mode 100644
index 2356373a62..0000000000
--- a/app/src/lib/api/generated/model/networkPolicyScopeKind.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-/**
- * Whose policy: the organization's, a team's, or a directory group's.
- */
-export type NetworkPolicyScopeKind =
- (typeof NetworkPolicyScopeKind)[keyof typeof NetworkPolicyScopeKind];
-
-export const NetworkPolicyScopeKind = {
- organization: "organization",
- group: "group",
- team: "team",
-} as const;
diff --git a/app/src/lib/api/generated/model/newIdentityProviderId.ts b/app/src/lib/api/generated/model/newIdentityProviderId.ts
index 2a3a952ac5..e9ee773b40 100644
--- a/app/src/lib/api/generated/model/newIdentityProviderId.ts
+++ b/app/src/lib/api/generated/model/newIdentityProviderId.ts
@@ -6,6 +6,6 @@
* An id for the provider, unique in the organization, such as acme-okta.
* @minLength 1
* @maxLength 200
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
export type NewIdentityProviderId = string;
diff --git a/app/src/lib/api/generated/model/noticeId.ts b/app/src/lib/api/generated/model/noticeId.ts
new file mode 100644
index 0000000000..29c257b495
--- /dev/null
+++ b/app/src/lib/api/generated/model/noticeId.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * A notice OpenBot shows a person once, such as a nudge, by its id: star-on-github is the ask to star OpenBot on GitHub.
+ * @minLength 1
+ * @maxLength 64
+ * @pattern ^[a-z0-9]+(?:-[a-z0-9]+)*$
+ */
+export type NoticeId = string;
diff --git a/app/src/lib/api/generated/model/nudgeEvent.ts b/app/src/lib/api/generated/model/nudgeEvent.ts
new file mode 100644
index 0000000000..3fb5ce4a13
--- /dev/null
+++ b/app/src/lib/api/generated/model/nudgeEvent.ts
@@ -0,0 +1,20 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { NoticeId } from "./noticeId";
+import type { NudgeEventAction } from "./nudgeEventAction";
+import type { NudgeEventPlace } from "./nudgeEventPlace";
+import type { NudgeEventSurface } from "./nudgeEventSurface";
+
+/**
+ * What the caller did with a nudge, and where. Names nothing about the person, who is the caller. The moment that made the nudge due is added by OpenBot, not sent.
+ */
+export interface NudgeEvent {
+ nudge: NoticeId;
+ /** shown when the nudge was drawn, clicked when they followed it (for the star nudge, opened the repository), and dismissed when they said Not now. */
+ action: NudgeEventAction;
+ /** card for the nudge drawn above the message box, settings for its permanent row in Settings, which is never shown as a card. */
+ place: NudgeEventPlace;
+ /** Where the caller saw or answered it. */
+ surface: NudgeEventSurface;
+}
diff --git a/app/src/lib/api/generated/model/nudgeEventAction.ts b/app/src/lib/api/generated/model/nudgeEventAction.ts
new file mode 100644
index 0000000000..91497cf685
--- /dev/null
+++ b/app/src/lib/api/generated/model/nudgeEventAction.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * shown when the nudge was drawn, clicked when they followed it (for the star nudge, opened the repository), and dismissed when they said Not now.
+ */
+export type NudgeEventAction =
+ (typeof NudgeEventAction)[keyof typeof NudgeEventAction];
+
+export const NudgeEventAction = {
+ shown: "shown",
+ clicked: "clicked",
+ dismissed: "dismissed",
+} as const;
diff --git a/app/src/lib/api/generated/model/nudgeEventPlace.ts b/app/src/lib/api/generated/model/nudgeEventPlace.ts
new file mode 100644
index 0000000000..f049174e26
--- /dev/null
+++ b/app/src/lib/api/generated/model/nudgeEventPlace.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * card for the nudge drawn above the message box, settings for its permanent row in Settings, which is never shown as a card.
+ */
+export type NudgeEventPlace =
+ (typeof NudgeEventPlace)[keyof typeof NudgeEventPlace];
+
+export const NudgeEventPlace = {
+ card: "card",
+ settings: "settings",
+} as const;
diff --git a/app/src/lib/api/generated/model/nudgeEventSurface.ts b/app/src/lib/api/generated/model/nudgeEventSurface.ts
new file mode 100644
index 0000000000..bcf9dee54b
--- /dev/null
+++ b/app/src/lib/api/generated/model/nudgeEventSurface.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * Where the caller saw or answered it.
+ */
+export type NudgeEventSurface =
+ (typeof NudgeEventSurface)[keyof typeof NudgeEventSurface];
+
+export const NudgeEventSurface = {
+ web: "web",
+ desktop: "desktop",
+} as const;
diff --git a/app/src/lib/api/generated/model/organization.ts b/app/src/lib/api/generated/model/organization.ts
index 6d9c1ed601..7a9b50563f 100644
--- a/app/src/lib/api/generated/model/organization.ts
+++ b/app/src/lib/api/generated/model/organization.ts
@@ -1,7 +1,7 @@
/**
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
-import type { PersonRole } from "./personRole";
+import type { PersonRoleAnswer } from "./personRoleAnswer";
/**
* One organization, as one of its members sees it. role and active are the server's verdicts about the caller.
@@ -15,7 +15,7 @@ export interface Organization {
slug: string;
/** What people call it. */
name: string;
- role: PersonRole;
+ role: PersonRoleAnswer;
/** Whether the caller is working in this one: the organization their session works in, or for an app's token the one its OpenBot-Organization header names, else the caller's own. Always false for a request made with an API key. */
active: boolean;
}
diff --git a/app/src/lib/api/generated/model/organizationInvitation.ts b/app/src/lib/api/generated/model/organizationInvitation.ts
index 6d29a0bae7..a93f62de56 100644
--- a/app/src/lib/api/generated/model/organizationInvitation.ts
+++ b/app/src/lib/api/generated/model/organizationInvitation.ts
@@ -3,7 +3,6 @@
*/
import type { AssignableRole } from "./assignableRole";
import type { InvitationSender } from "./invitationSender";
-import type { OrganizationInvitationStatus } from "./organizationInvitationStatus";
/**
* An invitation an organization sent, as its admins see it. status is the server's verdict.
@@ -15,7 +14,7 @@ export interface OrganizationInvitation {
email: string;
role: AssignableRole;
/** pending while it waits for an answer, expired once its seven days ran out, declined when the person turned it down. */
- status: OrganizationInvitationStatus;
+ status: string;
invitedBy: InvitationSender;
/** When it was sent. */
createdAt: string;
diff --git a/app/src/lib/api/generated/model/organizationInvitationStatus.ts b/app/src/lib/api/generated/model/organizationInvitationStatus.ts
deleted file mode 100644
index 44f4c70938..0000000000
--- a/app/src/lib/api/generated/model/organizationInvitationStatus.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-/**
- * pending while it waits for an answer, expired once its seven days ran out, declined when the person turned it down.
- */
-export type OrganizationInvitationStatus =
- (typeof OrganizationInvitationStatus)[keyof typeof OrganizationInvitationStatus];
-
-export const OrganizationInvitationStatus = {
- pending: "pending",
- expired: "expired",
- declined: "declined",
-} as const;
diff --git a/app/src/lib/api/generated/model/organizationMember.ts b/app/src/lib/api/generated/model/organizationMember.ts
index cf066f9086..809f273fc1 100644
--- a/app/src/lib/api/generated/model/organizationMember.ts
+++ b/app/src/lib/api/generated/model/organizationMember.ts
@@ -1,7 +1,7 @@
/**
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
-import type { PersonRole } from "./personRole";
+import type { PersonRoleAnswer } from "./personRoleAnswer";
/**
* One member of an organization.
@@ -10,7 +10,7 @@ export interface OrganizationMember {
/** Whether this membership can end: an admin can remove them and they can leave. The server's verdict. False for the organization's last owner, who stays in it, for the owner of their own organization, and for somebody this OpenBot's settings keep as an admin of the organization. */
removable: boolean;
/** The roles the caller may give this member, their current one left out. The server's verdict. Empty when the caller may not change this member's role. */
- assignableRoles: PersonRole[];
+ assignableRoles: PersonRoleAnswer[];
/** The person's id. */
id: string;
/** Their address. */
@@ -25,7 +25,7 @@ export interface OrganizationMember {
* @nullable
*/
image: string | null;
- role: PersonRole;
+ role: PersonRoleAnswer;
/** When they became a member. */
joinedAt: string;
}
diff --git a/app/src/lib/api/generated/model/organizationSettingsContext.ts b/app/src/lib/api/generated/model/organizationSettingsContext.ts
index 6d6bd8b7f8..4a5613eeac 100644
--- a/app/src/lib/api/generated/model/organizationSettingsContext.ts
+++ b/app/src/lib/api/generated/model/organizationSettingsContext.ts
@@ -2,6 +2,7 @@
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
import type { OrganizationSettingsContextAppsItem } from "./organizationSettingsContextAppsItem";
+import type { OrganizationSettingsContextComputerMode } from "./organizationSettingsContextComputerMode";
import type { OrganizationSettingsContextOtel } from "./organizationSettingsContextOtel";
import type { OrganizationSettingsContextScim } from "./organizationSettingsContextScim";
@@ -24,4 +25,6 @@ export interface OrganizationSettingsContext {
readonly otel: OrganizationSettingsContextOtel;
/** How many days recorded computer actions are kept. */
readonly actionRecordRetentionDays: number;
+ /** How Bots get computers here. per-person: each person has a computer of their own, and so does each isolated Bot; an OpenBot only one person uses answers this too. shared: every person's Bots run on one computer, so a command one Bot runs can read another person's files there. That suits a proof of concept, not people's real work. none: Bots have no computers. Absent from a server that predates it. */
+ readonly computerMode?: OrganizationSettingsContextComputerMode;
}
diff --git a/app/src/lib/api/generated/model/organizationSettingsContextComputerMode.ts b/app/src/lib/api/generated/model/organizationSettingsContextComputerMode.ts
new file mode 100644
index 0000000000..3275a98c4f
--- /dev/null
+++ b/app/src/lib/api/generated/model/organizationSettingsContextComputerMode.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * How Bots get computers here. per-person: each person has a computer of their own, and so does each isolated Bot; an OpenBot only one person uses answers this too. shared: every person's Bots run on one computer, so a command one Bot runs can read another person's files there. That suits a proof of concept, not people's real work. none: Bots have no computers. Absent from a server that predates it.
+ */
+export type OrganizationSettingsContextComputerMode =
+ (typeof OrganizationSettingsContextComputerMode)[keyof typeof OrganizationSettingsContextComputerMode];
+
+export const OrganizationSettingsContextComputerMode = {
+ "per-person": "per-person",
+ shared: "shared",
+ none: "none",
+} as const;
diff --git a/app/src/lib/api/generated/model/person.ts b/app/src/lib/api/generated/model/person.ts
index fe83966064..5a6a52f76f 100644
--- a/app/src/lib/api/generated/model/person.ts
+++ b/app/src/lib/api/generated/model/person.ts
@@ -2,7 +2,7 @@
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
import type { OnboardingStatus } from "./onboardingStatus";
-import type { PersonRole } from "./personRole";
+import type { PersonRoleAnswer } from "./personRoleAnswer";
/**
* Somebody in the organization. People are here because they signed in, not because they were invited: the identity provider decides who exists, and the organization decides what they may do. role, needsName, revoked and configuredAdmin are the server's verdicts; a client renders them and never recomputes them.
@@ -22,7 +22,7 @@ export interface Person {
* @nullable
*/
image: string | null;
- role: PersonRole;
+ role: PersonRoleAnswer;
/** Whether they have still to choose what OpenBot calls them, because their name is missing or is only their address. */
needsName: boolean;
/** Where they are in first-run onboarding. Null where the deployment does not track it, which the apps read as nothing to finish. */
diff --git a/app/src/lib/api/generated/model/personRoleAnswer.ts b/app/src/lib/api/generated/model/personRoleAnswer.ts
new file mode 100644
index 0000000000..1eaee4338f
--- /dev/null
+++ b/app/src/lib/api/generated/model/personRoleAnswer.ts
@@ -0,0 +1,8 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.
+ */
+export type PersonRoleAnswer = string;
diff --git a/app/src/lib/api/generated/model/preferences.ts b/app/src/lib/api/generated/model/preferences.ts
index 04aeb074af..8f9b757927 100644
--- a/app/src/lib/api/generated/model/preferences.ts
+++ b/app/src/lib/api/generated/model/preferences.ts
@@ -2,6 +2,7 @@
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
import type { MessageListEmphasis } from "./messageListEmphasis";
+import type { NoticeId } from "./noticeId";
import type { OnOff } from "./onOff";
import type { SkinId } from "./skinId";
@@ -12,6 +13,16 @@ export interface Preferences {
messageListEmphasis: MessageListEmphasis;
/** Whether they closed the banner offering help self-hosting OpenBot. */
selfHostBannerDismissed: boolean;
+ /**
+ * The notices they answered, either way, by id. A notice in this list is never shown to them again, on any device. Empty until they answer one.
+ * @maxItems 64
+ */
+ dismissedNotices: NoticeId[];
+ /**
+ * The notices OpenBot would show them now, by id, worked out by the server from the edition and how they have used OpenBot. A notice they dismissed is never here. Absent from a server that works out none.
+ * @maxItems 64
+ */
+ readonly noticesDue?: readonly NoticeId[];
/** Whether they narrate their recordings in OpenBot's browser, which opens the microphone only when on. Null until they choose, which the browser asks before their first recording. */
narration: OnOff | null;
skin: SkinId;
diff --git a/app/src/lib/api/generated/model/problem.ts b/app/src/lib/api/generated/model/problem.ts
index 703b301dfb..2dc1292f00 100644
--- a/app/src/lib/api/generated/model/problem.ts
+++ b/app/src/lib/api/generated/model/problem.ts
@@ -31,4 +31,10 @@ export interface Problem {
capability?: string;
/** What is wrong, item by item, when a refusal has more than one reason: each entry names the item and says what is wrong with it. */
problems?: ProblemProblemsItem[];
+ /** On CLIENT_UPDATE_REQUIRED, the app the OpenBot-Client header named that is older than this OpenBot serves. A later OpenBot may name another app; read one you don't know as other. */
+ client?: string;
+ /** On CLIENT_UPDATE_REQUIRED, the oldest release of that app this OpenBot serves. */
+ minimumVersion?: string;
+ /** On CLIENT_UPDATE_REQUIRED, true when the minimum the app is below was raised because of a security problem in older releases. */
+ security?: boolean;
}
diff --git a/app/src/lib/api/generated/model/recordNudgeEventHeaders.ts b/app/src/lib/api/generated/model/recordNudgeEventHeaders.ts
new file mode 100644
index 0000000000..c6b8b121e3
--- /dev/null
+++ b/app/src/lib/api/generated/model/recordNudgeEventHeaders.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { IdempotencyKeyParameter } from "./idempotencyKeyParameter";
+
+export type RecordNudgeEventHeaders = {
+ /**
+ * Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.
+ * @minLength 1
+ * @maxLength 128
+ */
+ "Idempotency-Key": IdempotencyKeyParameter;
+};
diff --git a/app/src/lib/api/generated/model/replaceAiConnectionHeaders.ts b/app/src/lib/api/generated/model/replaceAiConnectionHeaders.ts
new file mode 100644
index 0000000000..a81ad875ca
--- /dev/null
+++ b/app/src/lib/api/generated/model/replaceAiConnectionHeaders.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { IdempotencyKeyParameter } from "./idempotencyKeyParameter";
+
+export type ReplaceAiConnectionHeaders = {
+ /**
+ * Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.
+ * @minLength 1
+ * @maxLength 128
+ */
+ "Idempotency-Key": IdempotencyKeyParameter;
+};
diff --git a/app/src/lib/api/generated/model/respondToQuestionRequest.ts b/app/src/lib/api/generated/model/respondToQuestionRequest.ts
index 6a9419aad8..911456da71 100644
--- a/app/src/lib/api/generated/model/respondToQuestionRequest.ts
+++ b/app/src/lib/api/generated/model/respondToQuestionRequest.ts
@@ -7,7 +7,7 @@ export interface RespondToQuestionRequest {
* The person's answer. Trimmed.
* @minLength 1
* @maxLength 6000
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
response: string;
/** Sent from the open conversation, which then runs the answer as its own next turn when that is where it belongs. */
diff --git a/app/src/lib/api/generated/model/reviewerGuidanceInput.ts b/app/src/lib/api/generated/model/reviewerGuidanceInput.ts
index 9d00343f90..0510e8c1bf 100644
--- a/app/src/lib/api/generated/model/reviewerGuidanceInput.ts
+++ b/app/src/lib/api/generated/model/reviewerGuidanceInput.ts
@@ -7,7 +7,7 @@ export interface ReviewerGuidanceInput {
* The guidance, at most 2,000 characters once trimmed.
* @minLength 1
* @maxLength 2000
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
text: string;
}
diff --git a/app/src/lib/api/generated/model/reviewerGuidanceReplayInput.ts b/app/src/lib/api/generated/model/reviewerGuidanceReplayInput.ts
index b175dbcd93..a29cc94669 100644
--- a/app/src/lib/api/generated/model/reviewerGuidanceReplayInput.ts
+++ b/app/src/lib/api/generated/model/reviewerGuidanceReplayInput.ts
@@ -7,7 +7,7 @@ export interface ReviewerGuidanceReplayInput {
* The guidance to test, at most 2,000 characters once trimmed.
* @minLength 1
* @maxLength 2000
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
text: string;
/**
diff --git a/app/src/lib/api/generated/model/routine.ts b/app/src/lib/api/generated/model/routine.ts
index ba602e8701..abc6ef4220 100644
--- a/app/src/lib/api/generated/model/routine.ts
+++ b/app/src/lib/api/generated/model/routine.ts
@@ -14,6 +14,8 @@ export interface Routine {
botId: string;
/** When it runs, as text to show. */
schedule: string;
+ /** The schedule as it is kept, five cron fields: minute, hour, day of month, month, day of week. What a form that changes the schedule starts from. */
+ cron: string;
/** The IANA time zone the schedule is read in. */
timezone: string;
/** What the Bot does on each run. */
diff --git a/app/src/lib/api/generated/model/routineLastRun.ts b/app/src/lib/api/generated/model/routineLastRun.ts
index 1572c06d86..86fbe49ac6 100644
--- a/app/src/lib/api/generated/model/routineLastRun.ts
+++ b/app/src/lib/api/generated/model/routineLastRun.ts
@@ -1,14 +1,13 @@
/**
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
-import type { RoutineLastRunStatus } from "./routineLastRunStatus";
export interface RoutineLastRun {
/**
* How it ended, or null while it is still open. Only failed is a failure.
* @nullable
*/
- status: RoutineLastRunStatus;
+ status: string | null;
/**
* When it finished, or null while it is still open.
* @nullable
diff --git a/app/src/lib/api/generated/model/routineLastRunStatus.ts b/app/src/lib/api/generated/model/routineLastRunStatus.ts
deleted file mode 100644
index bbbf0db2f9..0000000000
--- a/app/src/lib/api/generated/model/routineLastRunStatus.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-/**
- * How it ended, or null while it is still open. Only failed is a failure.
- * @nullable
- */
-export type RoutineLastRunStatus =
- | (typeof RoutineLastRunStatus)[keyof typeof RoutineLastRunStatus]
- | null;
-
-export const RoutineLastRunStatus = {
- succeeded: "succeeded",
- failed: "failed",
- skipped: "skipped",
- waiting: "waiting",
-} as const;
diff --git a/app/src/lib/api/generated/model/routineRun.ts b/app/src/lib/api/generated/model/routineRun.ts
index 8ee4c9b3b0..b153d7564d 100644
--- a/app/src/lib/api/generated/model/routineRun.ts
+++ b/app/src/lib/api/generated/model/routineRun.ts
@@ -2,7 +2,6 @@
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
import type { RoutineRunSource } from "./routineRunSource";
-import type { RoutineRunStatus } from "./routineRunStatus";
/**
* One run of a routine. What the Bot said is in the routine's conversation and is not kept here.
@@ -11,7 +10,7 @@ export interface RoutineRun {
/** The run's id. */
id: string;
/** running until it ends; waiting while it waits on the person, for an approval or an answer. */
- status: RoutineRunStatus;
+ status: string;
/** When it started. */
startedAt: string;
/**
diff --git a/app/src/lib/api/generated/model/routineRunStatus.ts b/app/src/lib/api/generated/model/routineRunStatus.ts
deleted file mode 100644
index 7d9c008c01..0000000000
--- a/app/src/lib/api/generated/model/routineRunStatus.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-/**
- * running until it ends; waiting while it waits on the person, for an approval or an answer.
- */
-export type RoutineRunStatus =
- (typeof RoutineRunStatus)[keyof typeof RoutineRunStatus];
-
-export const RoutineRunStatus = {
- running: "running",
- succeeded: "succeeded",
- failed: "failed",
- skipped: "skipped",
- waiting: "waiting",
-} as const;
diff --git a/app/src/lib/api/generated/model/samlIdentityProviderRequest.ts b/app/src/lib/api/generated/model/samlIdentityProviderRequest.ts
index 24e88a6f31..68ec85b0c8 100644
--- a/app/src/lib/api/generated/model/samlIdentityProviderRequest.ts
+++ b/app/src/lib/api/generated/model/samlIdentityProviderRequest.ts
@@ -16,7 +16,7 @@ export interface SamlIdentityProviderRequest {
* The provider's SAML metadata XML, as its identity team supplied it.
* @minLength 1
* @maxLength 200000
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
metadata: string;
}
diff --git a/app/src/lib/api/generated/model/sharedUseRequest.ts b/app/src/lib/api/generated/model/sharedUseRequest.ts
index 6265f63787..05d5e7a887 100644
--- a/app/src/lib/api/generated/model/sharedUseRequest.ts
+++ b/app/src/lib/api/generated/model/sharedUseRequest.ts
@@ -3,7 +3,6 @@
*/
import type { SharedUseApproval } from "./sharedUseApproval";
import type { SharedUseRequestReason } from "./sharedUseRequestReason";
-import type { SharedUseRequestStatus } from "./sharedUseRequestStatus";
/**
* A request that a Bot may use a shared app's one account, for the audience the Bot had when it was asked.
@@ -32,6 +31,6 @@ export interface SharedUseRequest {
/** The id of the person who asked. */
requestedBy: string;
/** pending until an administrator answers it. superseded when a later request for the same Bot and app replaced it. */
- status: SharedUseRequestStatus;
+ status: string;
createdAt: string;
}
diff --git a/app/src/lib/api/generated/model/sharedUseRequestStatus.ts b/app/src/lib/api/generated/model/sharedUseRequestStatus.ts
deleted file mode 100644
index fa151274de..0000000000
--- a/app/src/lib/api/generated/model/sharedUseRequestStatus.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
- */
-
-/**
- * pending until an administrator answers it. superseded when a later request for the same Bot and app replaced it.
- */
-export type SharedUseRequestStatus =
- (typeof SharedUseRequestStatus)[keyof typeof SharedUseRequestStatus];
-
-export const SharedUseRequestStatus = {
- pending: "pending",
- approved: "approved",
- declined: "declined",
- superseded: "superseded",
-} as const;
diff --git a/app/src/lib/api/generated/model/signInStatus.ts b/app/src/lib/api/generated/model/signInStatus.ts
index a72e7cadda..9b5aeb547b 100644
--- a/app/src/lib/api/generated/model/signInStatus.ts
+++ b/app/src/lib/api/generated/model/signInStatus.ts
@@ -5,15 +5,4 @@
/**
* Where a sign-in request has got to. code_required: the site took the password and sent a verification code, and the form now asks for only that. signed_in, failed, cancelled and expired are final.
*/
-export type SignInStatus = (typeof SignInStatus)[keyof typeof SignInStatus];
-
-export const SignInStatus = {
- pending: "pending",
- filling: "filling",
- code_required: "code_required",
- taken_over: "taken_over",
- signed_in: "signed_in",
- failed: "failed",
- cancelled: "cancelled",
- expired: "expired",
-} as const;
+export type SignInStatus = string;
diff --git a/app/src/lib/api/generated/model/taskStatus.ts b/app/src/lib/api/generated/model/taskStatus.ts
index 8c541fc149..aee2b4e2d2 100644
--- a/app/src/lib/api/generated/model/taskStatus.ts
+++ b/app/src/lib/api/generated/model/taskStatus.ts
@@ -5,12 +5,4 @@
/**
* Where a task stands: waiting on the person, being worked on, marked done, failed, or finished and ready to read.
*/
-export type TaskStatus = (typeof TaskStatus)[keyof typeof TaskStatus];
-
-export const TaskStatus = {
- needs_input: "needs_input",
- working: "working",
- resolved: "resolved",
- failed: "failed",
- ready_for_review: "ready_for_review",
-} as const;
+export type TaskStatus = string;
diff --git a/app/src/lib/api/generated/model/unverifiedModel.ts b/app/src/lib/api/generated/model/unverifiedModel.ts
new file mode 100644
index 0000000000..c2cedf19df
--- /dev/null
+++ b/app/src/lib/api/generated/model/unverifiedModel.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * The model a person chose for this conversation, set aside because it hasn't been checked to work with the client this Bot's harness ships. Runs answer on the default model until it has been. Absent when the choice is in use, or set aside for another reason.
+ */
+export interface UnverifiedModel {
+ /** The chosen model's id. */
+ model: string;
+ /** Its name, as a model picker shows it. */
+ label: string;
+}
diff --git a/app/src/lib/api/generated/model/updateOrganizationRequest.ts b/app/src/lib/api/generated/model/updateOrganizationRequest.ts
index 7f193db152..78538be512 100644
--- a/app/src/lib/api/generated/model/updateOrganizationRequest.ts
+++ b/app/src/lib/api/generated/model/updateOrganizationRequest.ts
@@ -7,7 +7,7 @@ export interface UpdateOrganizationRequest {
* What people call it.
* @minLength 1
* @maxLength 100
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
name: string;
}
diff --git a/app/src/lib/api/generated/model/updatePreferencesRequest.ts b/app/src/lib/api/generated/model/updatePreferencesRequest.ts
index 4ca30c4a30..8e22e4adcb 100644
--- a/app/src/lib/api/generated/model/updatePreferencesRequest.ts
+++ b/app/src/lib/api/generated/model/updatePreferencesRequest.ts
@@ -2,6 +2,7 @@
* Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
*/
import type { MessageListEmphasis } from "./messageListEmphasis";
+import type { NoticeId } from "./noticeId";
import type { OnOff } from "./onOff";
import type { SkinId } from "./skinId";
@@ -11,6 +12,11 @@ import type { SkinId } from "./skinId";
export interface UpdatePreferencesRequest {
messageListEmphasis?: MessageListEmphasis;
selfHostBannerDismissed?: boolean;
+ /**
+ * Notices they answered, by id. Added to the ones already dismissed: a notice is never taken back off the list.
+ * @maxItems 64
+ */
+ dismissedNotices?: NoticeId[];
narration?: OnOff;
skin?: SkinId;
proactive?: OnOff;
diff --git a/app/src/lib/api/generated/model/updateRoutineHeaders.ts b/app/src/lib/api/generated/model/updateRoutineHeaders.ts
new file mode 100644
index 0000000000..7d304e7dc1
--- /dev/null
+++ b/app/src/lib/api/generated/model/updateRoutineHeaders.ts
@@ -0,0 +1,13 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+import type { IdempotencyKeyParameter } from "./idempotencyKeyParameter";
+
+export type UpdateRoutineHeaders = {
+ /**
+ * Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.
+ * @minLength 1
+ * @maxLength 128
+ */
+ "Idempotency-Key": IdempotencyKeyParameter;
+};
diff --git a/app/src/lib/api/generated/model/updateRoutineRequest.ts b/app/src/lib/api/generated/model/updateRoutineRequest.ts
new file mode 100644
index 0000000000..3098063e4f
--- /dev/null
+++ b/app/src/lib/api/generated/model/updateRoutineRequest.ts
@@ -0,0 +1,35 @@
+/**
+ * Generated by Orval from api/openapi.yaml. Do not edit: change the spec and run `bun run api:generate`.
+ */
+
+/**
+ * What to change. Only the fields sent change, and at least one must be sent.
+ */
+export interface UpdateRoutineRequest {
+ /**
+ * A new name, at most 100 characters. Empty takes the name away, and the routine is called by what it does.
+ * @maxLength 100
+ */
+ title?: string;
+ /**
+ * What the Bot does on each run from now on. At most 2,000 characters.
+ * @minLength 1
+ * @maxLength 2000
+ * @pattern \S
+ */
+ instruction?: string;
+ /**
+ * A new schedule, as five cron fields: minute, hour, day of month, month, day of week. The same rules as a new routine's.
+ * @minLength 1
+ * @maxLength 200
+ * @pattern \S
+ */
+ cron?: string;
+ /**
+ * A new IANA time zone to read the schedule in.
+ * @minLength 1
+ * @maxLength 100
+ * @pattern \S
+ */
+ timezone?: string;
+}
diff --git a/app/src/lib/api/generated/model/updateTeamRequest.ts b/app/src/lib/api/generated/model/updateTeamRequest.ts
index ef830f6a17..4230c2a526 100644
--- a/app/src/lib/api/generated/model/updateTeamRequest.ts
+++ b/app/src/lib/api/generated/model/updateTeamRequest.ts
@@ -7,7 +7,7 @@ export interface UpdateTeamRequest {
* What people call it.
* @minLength 1
* @maxLength 100
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
name?: string;
/**
diff --git a/app/src/lib/api/generated/model/whatIfQuestion.ts b/app/src/lib/api/generated/model/whatIfQuestion.ts
index e4af2d8f1d..429e1f146e 100644
--- a/app/src/lib/api/generated/model/whatIfQuestion.ts
+++ b/app/src/lib/api/generated/model/whatIfQuestion.ts
@@ -7,7 +7,7 @@ export interface WhatIfQuestion {
* The question, 1 to 500 characters once trimmed.
* @minLength 1
* @maxLength 500
- * @pattern ^[^\x00]*\S[^\x00]*$
+ * @pattern ^[^\x00]*[^\s\x00][^\x00]*$
*/
question: string;
}
diff --git a/app/src/lib/api/generated/models/models.msw.ts b/app/src/lib/api/generated/models/models.msw.ts
index 9ec1681fae..68cf027345 100644
--- a/app/src/lib/api/generated/models/models.msw.ts
+++ b/app/src/lib/api/generated/models/models.msw.ts
@@ -4,7 +4,13 @@
import { HttpResponse, http } from "msw";
import type { HttpResponseResolver, RequestHandlerOptions } from "msw";
-import type { ModelCatalogue, ModelChoice, ModelChoiceInput } from "../model";
+import type {
+ AiConnection,
+ AiConnectionInput,
+ ModelCatalogue,
+ ModelChoice,
+ ModelChoiceInput,
+} from "../model";
export const getGetModelCatalogueResponseMock = (): ModelCatalogue => ({
provider: "openai",
@@ -42,6 +48,32 @@ export const getReplaceModelChoiceResponseMock = (): ModelChoice => ({
effort: "xhigh",
});
+export const getGetAiConnectionResponseMock = (): AiConnection => ({
+ provider: "anthropic",
+ login: "api-key",
+ model: null,
+ endpointHost: null,
+ keySet: true,
+ ready: true,
+ source: "stored",
+ editable: true,
+ saved: [{ provider: "openai", login: "api-key", endpointHost: null }],
+ changedAt: "2026-11-17T09:00:00.000Z",
+});
+
+export const getReplaceAiConnectionResponseMock = (): AiConnection => ({
+ provider: "anthropic",
+ login: "api-key",
+ model: null,
+ endpointHost: null,
+ keySet: true,
+ ready: true,
+ source: "stored",
+ editable: true,
+ saved: [{ provider: "openai", login: "api-key", endpointHost: null }],
+ changedAt: "2026-11-17T09:00:00.000Z",
+});
+
export const getGetModelCatalogueMockHandler = (
overrideResponse?:
| ModelCatalogue
@@ -152,8 +184,66 @@ export const getReplaceModelChoiceMockHandler = (
options,
);
};
+
+export const getGetAiConnectionMockHandler = (
+ overrideResponse?:
+ | AiConnection
+ | ((
+ info: Parameters>[0],
+ ) => Promise | AiConnection),
+ options?: RequestHandlerOptions,
+) => {
+ return http.get<{ organizationId: string }>(
+ "*/api/v2/organizations/:organizationId/ai-connection",
+ async (
+ info: Parameters>[0],
+ ) => {
+ return HttpResponse.json(
+ overrideResponse !== undefined
+ ? typeof overrideResponse === "function"
+ ? await overrideResponse(info)
+ : overrideResponse
+ : getGetAiConnectionResponseMock(),
+ { status: 200 },
+ );
+ },
+ options,
+ );
+};
+
+export const getReplaceAiConnectionMockHandler = (
+ overrideResponse?:
+ | AiConnection
+ | ((
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string }, AiConnectionInput>
+ >[0],
+ ) => Promise | AiConnection),
+ options?: RequestHandlerOptions,
+) => {
+ return http.put<{ organizationId: string }, AiConnectionInput>(
+ "*/api/v2/organizations/:organizationId/ai-connection",
+ async (
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string }, AiConnectionInput>
+ >[0],
+ ) => {
+ return HttpResponse.json(
+ overrideResponse !== undefined
+ ? typeof overrideResponse === "function"
+ ? await overrideResponse(info)
+ : overrideResponse
+ : getReplaceAiConnectionResponseMock(),
+ { status: 200 },
+ );
+ },
+ options,
+ );
+};
export const getModelsMock = () => [
getGetModelCatalogueMockHandler(),
getGetModelChoiceMockHandler(),
getReplaceModelChoiceMockHandler(),
+ getGetAiConnectionMockHandler(),
+ getReplaceAiConnectionMockHandler(),
];
diff --git a/app/src/lib/api/generated/models/models.ts b/app/src/lib/api/generated/models/models.ts
index 0c7def144e..721a68fe72 100644
--- a/app/src/lib/api/generated/models/models.ts
+++ b/app/src/lib/api/generated/models/models.ts
@@ -19,9 +19,15 @@ import type {
import type {
AdminOnlyResponse,
+ AiConnection,
+ AiConnectionFixedResponse,
+ AiConnectionInput,
+ AiConnectionRefusedResponse,
ConversationNotFoundResponse,
+ CredentialsUnavailableResponse,
GetModelCatalogueParams,
IdempotencyConflictResponse,
+ InvalidAiConnectionResponse,
InvalidModelChoiceResponse,
InvalidRequestResponse,
ModelCatalogue,
@@ -30,6 +36,7 @@ import type {
ModelChoiceInput,
OrganizationNotFoundResponse,
OwnOnlyResponse,
+ ReplaceAiConnectionHeaders,
ReplaceModelChoiceHeaders,
ServerErrorResponse,
UnauthenticatedResponse,
@@ -698,3 +705,363 @@ export const useReplaceModelChoice = <
queryClient,
);
};
+export const getGetAiConnectionUrl = (organizationId: string) => {
+ return `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/ai-connection`;
+};
+
+/**
+ * Return the AI provider OpenBot's Bots run on, the way OpenBot signs in to it, the model or address host where one was named, and whether a run can use it now. Never a key. Also which other connections still have a key kept, so they can be used again without pasting it. Where whoever runs OpenBot sets the provider, editable is false and the connection can't be changed here. Only an administrator of the organization may read it.
+ * @summary Read how OpenBot reaches its AI provider
+ */
+export const getAiConnection = async (
+ organizationId: string,
+ options?: Parameters[1],
+): Promise => {
+ return apiRequest(getGetAiConnectionUrl(organizationId), {
+ ...options,
+ method: "GET",
+ });
+};
+
+export const getGetAiConnectionQueryKey = (organizationId: string) => {
+ return [`/api/v2/organizations/${organizationId}/ai-connection`] as const;
+};
+
+export const getGetAiConnectionQueryOptions = <
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | AdminOnlyResponse
+ | OrganizationNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ options?: {
+ query?: Partial<
+ UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ >
+ >;
+ request?: SecondParameter;
+ },
+) => {
+ const { query: queryOptions, request: requestOptions } = options ?? {};
+
+ const queryKey =
+ queryOptions?.queryKey ?? getGetAiConnectionQueryKey(organizationId);
+
+ const queryFn: QueryFunction>> = ({
+ signal,
+ }) => getAiConnection(organizationId, { signal, ...requestOptions });
+
+ return {
+ queryKey,
+ queryFn,
+ enabled: organizationId !== null && organizationId !== undefined,
+ ...queryOptions,
+ } as UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ > & { queryKey: DataTag };
+};
+
+export type GetAiConnectionQueryResult = NonNullable<
+ Awaited>
+>;
+export type GetAiConnectionQueryError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | AdminOnlyResponse
+ | OrganizationNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse;
+
+export function useGetAiConnection<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | AdminOnlyResponse
+ | OrganizationNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ options: {
+ query: Partial<
+ UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ >
+ > &
+ Pick<
+ DefinedInitialDataOptions<
+ Awaited>,
+ TError,
+ Awaited>
+ >,
+ "initialData"
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): DefinedUseQueryResult & {
+ queryKey: DataTag;
+};
+export function useGetAiConnection<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | AdminOnlyResponse
+ | OrganizationNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ options?: {
+ query?: Partial<
+ UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ >
+ > &
+ Pick<
+ UndefinedInitialDataOptions<
+ Awaited>,
+ TError,
+ Awaited>
+ >,
+ "initialData"
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseQueryResult & {
+ queryKey: DataTag;
+};
+export function useGetAiConnection<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | AdminOnlyResponse
+ | OrganizationNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ options?: {
+ query?: Partial<
+ UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ >
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseQueryResult & {
+ queryKey: DataTag;
+};
+/**
+ * @summary Read how OpenBot reaches its AI provider
+ */
+
+export function useGetAiConnection<
+ TData = Awaited>,
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | AdminOnlyResponse
+ | OrganizationNotFoundResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+>(
+ organizationId: string,
+ options?: {
+ query?: Partial<
+ UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ >
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseQueryResult & {
+ queryKey: DataTag;
+} {
+ const queryOptions = getGetAiConnectionQueryOptions(organizationId, options);
+
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult<
+ TData,
+ TError
+ > & { queryKey: DataTag };
+
+ return withQueryKey(query, queryOptions.queryKey);
+}
+
+export const getReplaceAiConnectionUrl = (organizationId: string) => {
+ return `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/ai-connection`;
+};
+
+/**
+ * Switch the AI provider OpenBot's Bots run on, with no restart. OpenBot checks the connection with the provider first: a key, an address or a sign-in it can't use is refused, nothing is saved, and the connection in use keeps running. Once saved, the next run uses it, and runs already going finish on the one they started with. A key goes into the organization's vault and is never sent back; the key of the connection it replaces stays kept, so it can be used again (saved). Recorded on the audit trail, never with a key. Only an administrator of the organization may change it, and not where whoever runs OpenBot sets the provider.
+ * @summary Change how OpenBot reaches its AI provider
+ */
+export const replaceAiConnection = async (
+ organizationId: string,
+ aiConnectionInput: AiConnectionInput,
+ headers: ReplaceAiConnectionHeaders,
+ options?: Parameters[1],
+): Promise => {
+ const getHeaders = (
+ h?: NonNullable,
+ ): Record => {
+ if (!h) return {};
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
+ if (Symbol.iterator in h) {
+ return Object.fromEntries(
+ Array.from(
+ h as Iterable>,
+ (entry) => Array.from(entry) as [string, string],
+ ),
+ );
+ }
+ const headers: Record = {};
+ for (const [name, value] of Object.entries<
+ string | readonly string[] | undefined
+ >(h)) {
+ if (value !== undefined) headers[name] = value;
+ }
+ return headers;
+ };
+ return apiRequest(getReplaceAiConnectionUrl(organizationId), {
+ ...options,
+ method: "PUT",
+ headers: {
+ "Content-Type": "application/json",
+ ...headers,
+ ...getHeaders(options?.headers),
+ },
+ body: JSON.stringify(aiConnectionInput),
+ });
+};
+
+export const getReplaceAiConnectionMutationKey = () =>
+ ["replaceAiConnection"] as const;
+
+export const getReplaceAiConnectionMutationOptions = <
+ TError =
+ | InvalidAiConnectionResponse
+ | UnauthenticatedResponse
+ | AdminOnlyResponse
+ | OrganizationNotFoundResponse
+ | AiConnectionFixedResponse
+ | AiConnectionRefusedResponse
+ | ServerErrorResponse
+ | CredentialsUnavailableResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ ReplaceAiConnectionMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+}): UseMutationOptions<
+ Awaited>,
+ TError,
+ ReplaceAiConnectionMutationVariables,
+ TContext
+> => {
+ const mutationKey = getReplaceAiConnectionMutationKey();
+ const { mutation: mutationOptions, request: requestOptions } = options
+ ? options.mutation &&
+ "mutationKey" in options.mutation &&
+ options.mutation.mutationKey
+ ? options
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
+ : { mutation: { mutationKey }, request: undefined };
+
+ const mutationFn: MutationFunction<
+ Awaited>,
+ ReplaceAiConnectionMutationVariables
+ > = (props) => {
+ const { organizationId, data, headers } = props ?? {};
+
+ return replaceAiConnection(organizationId, data, headers, requestOptions);
+ };
+
+ return { mutationFn, ...mutationOptions };
+};
+
+export type ReplaceAiConnectionMutationResult = NonNullable<
+ Awaited>
+>;
+export type ReplaceAiConnectionMutationBody = AiConnectionInput;
+export type ReplaceAiConnectionMutationError =
+ | InvalidAiConnectionResponse
+ | UnauthenticatedResponse
+ | AdminOnlyResponse
+ | OrganizationNotFoundResponse
+ | AiConnectionFixedResponse
+ | AiConnectionRefusedResponse
+ | ServerErrorResponse
+ | CredentialsUnavailableResponse
+ | UnexpectedErrorResponse;
+export type ReplaceAiConnectionMutationVariables = {
+ organizationId: string;
+ data: AiConnectionInput;
+ headers: ReplaceAiConnectionHeaders;
+};
+
+/**
+ * @summary Change how OpenBot reaches its AI provider
+ */
+export const useReplaceAiConnection = <
+ TError =
+ | InvalidAiConnectionResponse
+ | UnauthenticatedResponse
+ | AdminOnlyResponse
+ | OrganizationNotFoundResponse
+ | AiConnectionFixedResponse
+ | AiConnectionRefusedResponse
+ | ServerErrorResponse
+ | CredentialsUnavailableResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(
+ options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ ReplaceAiConnectionMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseMutationResult<
+ Awaited>,
+ TError,
+ ReplaceAiConnectionMutationVariables,
+ TContext
+> => {
+ return useMutation(
+ getReplaceAiConnectionMutationOptions(options),
+ queryClient,
+ );
+};
diff --git a/app/src/lib/api/generated/models/models.zod.ts b/app/src/lib/api/generated/models/models.zod.ts
index 296e895d13..4925f8d638 100644
--- a/app/src/lib/api/generated/models/models.zod.ts
+++ b/app/src/lib/api/generated/models/models.zod.ts
@@ -134,6 +134,15 @@ export const GetModelChoiceResponse = zod
.object({
model: zod.string().nullable(),
effort: zod.string().nullable(),
+ unverified: zod
+ .object({
+ model: zod.string().describe("The chosen model's id."),
+ label: zod.string().describe("Its name, as a model picker shows it."),
+ })
+ .optional()
+ .describe(
+ "The model a person chose for this conversation, set aside because it hasn't been checked to work with the client this Bot's harness ships. Runs answer on the default model until it has been. Absent when the choice is in use, or set aside for another reason.",
+ ),
})
.describe(
"The model and thinking effort a person chose for one conversation. Null model: the default model. Null effort: none is sent, so the model thinks on its own default.",
@@ -216,7 +225,328 @@ export const ReplaceModelChoiceResponse = zod
.object({
model: zod.string().nullable(),
effort: zod.string().nullable(),
+ unverified: zod
+ .object({
+ model: zod.string().describe("The chosen model's id."),
+ label: zod.string().describe("Its name, as a model picker shows it."),
+ })
+ .optional()
+ .describe(
+ "The model a person chose for this conversation, set aside because it hasn't been checked to work with the client this Bot's harness ships. Runs answer on the default model until it has been. Absent when the choice is in use, or set aside for another reason.",
+ ),
})
.describe(
"The model and thinking effort a person chose for one conversation. Null model: the default model. Null effort: none is sent, so the model thinks on its own default.",
);
+
+/**
+ * Return the AI provider OpenBot's Bots run on, the way OpenBot signs in to it, the model or address host where one was named, and whether a run can use it now. Never a key. Also which other connections still have a key kept, so they can be used again without pasting it. Where whoever runs OpenBot sets the provider, editable is false and the connection can't be changed here. Only an administrator of the organization may read it.
+ * @summary Read how OpenBot reaches its AI provider
+ */
+
+export const GetAiConnectionParams = zod.object({
+ organizationId: zod
+ .string()
+ .min(1)
+ .describe(
+ "The organization, by its id or its slug. One the caller is not a member of answers as one that does not exist, `default` included.",
+ ),
+});
+
+export const GetAiConnectionResponse = zod
+ .object({
+ provider: zod
+ .union([
+ zod
+ .enum([
+ "openai",
+ "anthropic",
+ "google",
+ "xai",
+ "unbiased",
+ "openai-compatible",
+ ])
+ .describe(
+ "The AI provider OpenBot's Bots run on. openai: OpenAI. anthropic: Anthropic. google: Google Gemini. xai: xAI. unbiased: Unbiased AI. openai-compatible: any server that speaks OpenAI's API, at an address given.",
+ ),
+ zod.null(),
+ ])
+ .describe("The provider. Null while none is chosen yet."),
+ login: zod
+ .union([
+ zod
+ .enum(["plan", "api-key", "endpoint", "oauth"])
+ .describe(
+ "How OpenBot signs in to the provider. plan: the person's Claude or ChatGPT plan (openai, anthropic). api-key: a key from the provider (openai, anthropic). endpoint: an address and, where it asks for one, a key (google, xai, unbiased, openai-compatible). oauth: the person's Google or xAI sign-in (google, xai).",
+ ),
+ zod.null(),
+ ])
+ .describe("How OpenBot signs in to it. Null while none is chosen yet."),
+ model: zod
+ .string()
+ .nullable()
+ .describe(
+ "The model named for an endpoint or a sign-in. Null for an API key or a plan, where the model catalogue offers the provider's models.",
+ ),
+ endpointHost: zod
+ .string()
+ .nullable()
+ .describe(
+ "The host of the endpoint's address, never its path, query or anything that signs in. Null unless the login is endpoint.",
+ ),
+ keySet: zod
+ .boolean()
+ .describe("Whether a live key for this connection is kept in the vault."),
+ ready: zod
+ .boolean()
+ .describe(
+ "Whether a run can use it now: its key is kept, its sign-in can be read, or its plan's engine answers.",
+ ),
+ source: zod
+ .enum(["stored", "environment", "none"])
+ .describe(
+ "stored: set here, or carried over from how OpenBot was set up. environment: set by whoever runs OpenBot, in its configuration. none: nothing set yet.",
+ ),
+ editable: zod
+ .boolean()
+ .describe(
+ "Whether an administrator can change it here. False where whoever runs OpenBot sets the provider: its key is changed in the vault.",
+ ),
+ saved: zod
+ .array(
+ zod
+ .object({
+ provider: zod
+ .enum([
+ "openai",
+ "anthropic",
+ "google",
+ "xai",
+ "unbiased",
+ "openai-compatible",
+ ])
+ .describe(
+ "The AI provider OpenBot's Bots run on. openai: OpenAI. anthropic: Anthropic. google: Google Gemini. xai: xAI. unbiased: Unbiased AI. openai-compatible: any server that speaks OpenAI's API, at an address given.",
+ ),
+ login: zod
+ .enum(["plan", "api-key", "endpoint", "oauth"])
+ .describe(
+ "How OpenBot signs in to the provider. plan: the person's Claude or ChatGPT plan (openai, anthropic). api-key: a key from the provider (openai, anthropic). endpoint: an address and, where it asks for one, a key (google, xai, unbiased, openai-compatible). oauth: the person's Google or xAI sign-in (google, xai).",
+ ),
+ endpointHost: zod
+ .string()
+ .nullable()
+ .describe(
+ "The host of its address, for an endpoint. Null for an API key.",
+ ),
+ })
+ .describe(
+ "A connection with a key still kept in the vault, which can be used again without pasting the key (useSavedKey). Never the key.",
+ ),
+ )
+ .describe(
+ "The connections with a key still kept in the vault, so a switch to one of them needs no key pasted.",
+ ),
+ changedAt: zod.iso
+ .datetime({ offset: true })
+ .nullable()
+ .describe("When it was last changed. Null if never."),
+ })
+ .describe(
+ "How OpenBot reaches its AI provider: who, how it signs in, and whether a run can use it now. Never a key.",
+ );
+
+/**
+ * Switch the AI provider OpenBot's Bots run on, with no restart. OpenBot checks the connection with the provider first: a key, an address or a sign-in it can't use is refused, nothing is saved, and the connection in use keeps running. Once saved, the next run uses it, and runs already going finish on the one they started with. A key goes into the organization's vault and is never sent back; the key of the connection it replaces stays kept, so it can be used again (saved). Recorded on the audit trail, never with a key. Only an administrator of the organization may change it, and not where whoever runs OpenBot sets the provider.
+ * @summary Change how OpenBot reaches its AI provider
+ */
+
+export const ReplaceAiConnectionParams = zod.object({
+ organizationId: zod
+ .string()
+ .min(1)
+ .describe(
+ "The organization, by its id or its slug. One the caller is not a member of answers as one that does not exist, `default` included.",
+ ),
+});
+
+export const replaceAiConnectionHeaderIdempotencyKeyMax = 128;
+
+export const ReplaceAiConnectionHeader = zod.object({
+ "Idempotency-Key": zod
+ .string()
+ .min(1)
+ .max(replaceAiConnectionHeaderIdempotencyKeyMax)
+ .describe(
+ "Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.",
+ ),
+});
+
+export const replaceAiConnectionBodyApiKeyMax = 65536;
+
+export const replaceAiConnectionBodyBaseUrlMax = 2048;
+
+export const replaceAiConnectionBodyBaseUrlRegExp = new RegExp(
+ "^https?://[^@/?#]+([/?#].*)?$",
+);
+export const replaceAiConnectionBodyModelMax = 500;
+
+export const replaceAiConnectionBodyModelRegExp = new RegExp("\\S");
+
+export const ReplaceAiConnectionBody = zod
+ .object({
+ provider: zod
+ .enum([
+ "openai",
+ "anthropic",
+ "google",
+ "xai",
+ "unbiased",
+ "openai-compatible",
+ ])
+ .describe(
+ "The AI provider OpenBot's Bots run on. openai: OpenAI. anthropic: Anthropic. google: Google Gemini. xai: xAI. unbiased: Unbiased AI. openai-compatible: any server that speaks OpenAI's API, at an address given.",
+ ),
+ login: zod
+ .enum(["plan", "api-key", "endpoint", "oauth"])
+ .describe(
+ "How OpenBot signs in to the provider. plan: the person's Claude or ChatGPT plan (openai, anthropic). api-key: a key from the provider (openai, anthropic). endpoint: an address and, where it asks for one, a key (google, xai, unbiased, openai-compatible). oauth: the person's Google or xAI sign-in (google, xai).",
+ ),
+ apiKey: zod
+ .string()
+ .min(1)
+ .max(replaceAiConnectionBodyApiKeyMax)
+ .optional()
+ .describe(
+ "The provider's key. Required for api-key unless useSavedKey; optional for an endpoint that asks for none. Encrypted into the vault before anything else, and never sent back: no answer includes it, now or later.",
+ ),
+ useSavedKey: zod
+ .boolean()
+ .optional()
+ .describe(
+ "Use the key already kept for this provider (and, for an endpoint, this address) instead of sending one.",
+ ),
+ baseUrl: zod
+ .url()
+ .max(replaceAiConnectionBodyBaseUrlMax)
+ .regex(replaceAiConnectionBodyBaseUrlRegExp)
+ .optional()
+ .describe(
+ "The endpoint's address, http or https, with nothing in it that signs in. Required for endpoint.",
+ ),
+ model: zod
+ .string()
+ .min(1)
+ .max(replaceAiConnectionBodyModelMax)
+ .regex(replaceAiConnectionBodyModelRegExp)
+ .optional()
+ .describe(
+ "The model to run on. Required for endpoint and oauth. Trimmed.",
+ ),
+ })
+ .describe(
+ "The connection to switch to. openai and anthropic take plan or api-key; google and xai take endpoint or oauth; unbiased and openai-compatible take endpoint. Any other pair is refused.",
+ );
+
+export const ReplaceAiConnectionResponse = zod
+ .object({
+ provider: zod
+ .union([
+ zod
+ .enum([
+ "openai",
+ "anthropic",
+ "google",
+ "xai",
+ "unbiased",
+ "openai-compatible",
+ ])
+ .describe(
+ "The AI provider OpenBot's Bots run on. openai: OpenAI. anthropic: Anthropic. google: Google Gemini. xai: xAI. unbiased: Unbiased AI. openai-compatible: any server that speaks OpenAI's API, at an address given.",
+ ),
+ zod.null(),
+ ])
+ .describe("The provider. Null while none is chosen yet."),
+ login: zod
+ .union([
+ zod
+ .enum(["plan", "api-key", "endpoint", "oauth"])
+ .describe(
+ "How OpenBot signs in to the provider. plan: the person's Claude or ChatGPT plan (openai, anthropic). api-key: a key from the provider (openai, anthropic). endpoint: an address and, where it asks for one, a key (google, xai, unbiased, openai-compatible). oauth: the person's Google or xAI sign-in (google, xai).",
+ ),
+ zod.null(),
+ ])
+ .describe("How OpenBot signs in to it. Null while none is chosen yet."),
+ model: zod
+ .string()
+ .nullable()
+ .describe(
+ "The model named for an endpoint or a sign-in. Null for an API key or a plan, where the model catalogue offers the provider's models.",
+ ),
+ endpointHost: zod
+ .string()
+ .nullable()
+ .describe(
+ "The host of the endpoint's address, never its path, query or anything that signs in. Null unless the login is endpoint.",
+ ),
+ keySet: zod
+ .boolean()
+ .describe("Whether a live key for this connection is kept in the vault."),
+ ready: zod
+ .boolean()
+ .describe(
+ "Whether a run can use it now: its key is kept, its sign-in can be read, or its plan's engine answers.",
+ ),
+ source: zod
+ .enum(["stored", "environment", "none"])
+ .describe(
+ "stored: set here, or carried over from how OpenBot was set up. environment: set by whoever runs OpenBot, in its configuration. none: nothing set yet.",
+ ),
+ editable: zod
+ .boolean()
+ .describe(
+ "Whether an administrator can change it here. False where whoever runs OpenBot sets the provider: its key is changed in the vault.",
+ ),
+ saved: zod
+ .array(
+ zod
+ .object({
+ provider: zod
+ .enum([
+ "openai",
+ "anthropic",
+ "google",
+ "xai",
+ "unbiased",
+ "openai-compatible",
+ ])
+ .describe(
+ "The AI provider OpenBot's Bots run on. openai: OpenAI. anthropic: Anthropic. google: Google Gemini. xai: xAI. unbiased: Unbiased AI. openai-compatible: any server that speaks OpenAI's API, at an address given.",
+ ),
+ login: zod
+ .enum(["plan", "api-key", "endpoint", "oauth"])
+ .describe(
+ "How OpenBot signs in to the provider. plan: the person's Claude or ChatGPT plan (openai, anthropic). api-key: a key from the provider (openai, anthropic). endpoint: an address and, where it asks for one, a key (google, xai, unbiased, openai-compatible). oauth: the person's Google or xAI sign-in (google, xai).",
+ ),
+ endpointHost: zod
+ .string()
+ .nullable()
+ .describe(
+ "The host of its address, for an endpoint. Null for an API key.",
+ ),
+ })
+ .describe(
+ "A connection with a key still kept in the vault, which can be used again without pasting the key (useSavedKey). Never the key.",
+ ),
+ )
+ .describe(
+ "The connections with a key still kept in the vault, so a switch to one of them needs no key pasted.",
+ ),
+ changedAt: zod.iso
+ .datetime({ offset: true })
+ .nullable()
+ .describe("When it was last changed. Null if never."),
+ })
+ .describe(
+ "How OpenBot reaches its AI provider: who, how it signs in, and whether a run can use it now. Never a key.",
+ );
diff --git a/app/src/lib/api/generated/network-policies/network-policies.zod.ts b/app/src/lib/api/generated/network-policies/network-policies.zod.ts
index 9e50495bb9..7404b1654f 100644
--- a/app/src/lib/api/generated/network-policies/network-policies.zod.ts
+++ b/app/src/lib/api/generated/network-policies/network-policies.zod.ts
@@ -64,7 +64,7 @@ export const ListNetworkPoliciesResponse = zod.object({
"organization, team: for a team, or group: for a directory group.",
),
scopeKind: zod
- .enum(["organization", "group", "team"])
+ .string()
.describe(
"Whose policy: the organization's, a team's, or a directory group's.",
),
@@ -129,7 +129,7 @@ export const ListNetworkPoliciesResponse = zod.object({
export const replaceNetworkPolicyPathNetworkPolicyIdMax = 206;
export const replaceNetworkPolicyPathNetworkPolicyIdRegExp = new RegExp(
- "^(organization|team:[^\\x00]*\\S[^\\x00]*|group:[^\\x00]*\\S[^\\x00]*)$",
+ "^(organization|team:[^\\x00]*[^\\s\\x00][^\\x00]*|group:[^\\x00]*[^\\s\\x00][^\\x00]*)$",
);
export const ReplaceNetworkPolicyParams = zod.object({
@@ -171,7 +171,7 @@ export const replaceNetworkPolicyBodyLockedDefault = false;
export const replaceNetworkPolicyBodyAuthoringTextMax = 2000;
export const replaceNetworkPolicyBodyAuthoringTextRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const ReplaceNetworkPolicyBody = zod.object({
@@ -228,7 +228,7 @@ export const ReplaceNetworkPolicyResponse = zod.object({
"organization, team: for a team, or group: for a directory group.",
),
scopeKind: zod
- .enum(["organization", "group", "team"])
+ .string()
.describe(
"Whose policy: the organization's, a team's, or a directory group's.",
),
@@ -276,7 +276,7 @@ export const ReplaceNetworkPolicyResponse = zod.object({
export const deleteNetworkPolicyPathNetworkPolicyIdMax = 206;
export const deleteNetworkPolicyPathNetworkPolicyIdRegExp = new RegExp(
- "^(organization|team:[^\\x00]*\\S[^\\x00]*|group:[^\\x00]*\\S[^\\x00]*)$",
+ "^(organization|team:[^\\x00]*[^\\s\\x00][^\\x00]*|group:[^\\x00]*[^\\s\\x00][^\\x00]*)$",
);
export const DeleteNetworkPolicyParams = zod.object({
@@ -339,7 +339,7 @@ export const TranslateNetworkPolicyHeader = zod.object({
export const translateNetworkPolicyBodyTextMax = 1000;
export const translateNetworkPolicyBodyTextRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const TranslateNetworkPolicyBody = zod.object({
diff --git a/app/src/lib/api/generated/organization-settings/organization-settings.msw.ts b/app/src/lib/api/generated/organization-settings/organization-settings.msw.ts
index 92fe9924fa..c97029e75a 100644
--- a/app/src/lib/api/generated/organization-settings/organization-settings.msw.ts
+++ b/app/src/lib/api/generated/organization-settings/organization-settings.msw.ts
@@ -28,6 +28,15 @@ export const getGetDeploymentResponseMock = (): Deployment => ({
builtInBots: true,
isolatedBots: false,
botComputers: true,
+ attachmentLimits: {
+ imageBytes: 104857600,
+ documentBytes: 104857600,
+ fileBytes: 104857600,
+ },
+ api: ["v2"],
+ minimumClients: { desktop: "1.2.0" },
+ launcherApi: 1,
+ extensionApi: 1,
});
export const getGetOrganizationSettingsResponseMock =
diff --git a/app/src/lib/api/generated/organization-settings/organization-settings.ts b/app/src/lib/api/generated/organization-settings/organization-settings.ts
index cea0fe30ec..b0029d371d 100644
--- a/app/src/lib/api/generated/organization-settings/organization-settings.ts
+++ b/app/src/lib/api/generated/organization-settings/organization-settings.ts
@@ -101,7 +101,7 @@ export const getGetDeploymentUrl = (organizationId: string) => {
};
/**
- * Return what this OpenBot offers and how people sign in to it: the edition, the features the apps draw, and the sign-in options. Anybody may read it, signed in or not, because the sign-in screen reads it first. Signed in, it is answered in an organization the caller is a member of, and an organization they are not in, the organization `default` included, answers exactly as one that does not exist. Nobody signed in reads it in the organization `default`. It names no identity provider and no version: only whether single sign-on is set up and required.
+ * Return what this OpenBot offers and how people sign in to it: the edition, the features the apps draw, how large an attached file may be, and the sign-in options. Anybody may read it, signed in or not, because the sign-in screen reads it first. Signed in, it is answered in an organization the caller is a member of, and an organization they are not in, the organization `default` included, answers exactly as one that does not exist. Nobody signed in reads it in the organization `default`. It names no identity provider and no build: only whether single sign-on is set up and required, and which API versions and which releases of each OpenBot app it serves. It is never refused for the app's version, so an app reads it first to learn whether it, or the OpenBot, needs an update.
* @summary Read what this OpenBot offers
*/
export const getDeployment = async (
diff --git a/app/src/lib/api/generated/organization-settings/organization-settings.zod.ts b/app/src/lib/api/generated/organization-settings/organization-settings.zod.ts
index aa2ebaec33..9b33285388 100644
--- a/app/src/lib/api/generated/organization-settings/organization-settings.zod.ts
+++ b/app/src/lib/api/generated/organization-settings/organization-settings.zod.ts
@@ -4,7 +4,7 @@
import * as zod from "zod";
/**
- * Return what this OpenBot offers and how people sign in to it: the edition, the features the apps draw, and the sign-in options. Anybody may read it, signed in or not, because the sign-in screen reads it first. Signed in, it is answered in an organization the caller is a member of, and an organization they are not in, the organization `default` included, answers exactly as one that does not exist. Nobody signed in reads it in the organization `default`. It names no identity provider and no version: only whether single sign-on is set up and required.
+ * Return what this OpenBot offers and how people sign in to it: the edition, the features the apps draw, how large an attached file may be, and the sign-in options. Anybody may read it, signed in or not, because the sign-in screen reads it first. Signed in, it is answered in an organization the caller is a member of, and an organization they are not in, the organization `default` included, answers exactly as one that does not exist. Nobody signed in reads it in the organization `default`. It names no identity provider and no build: only whether single sign-on is set up and required, and which API versions and which releases of each OpenBot app it serves. It is never refused for the app's version, so an app reads it first to learn whether it, or the OpenBot, needs an update.
* @summary Read what this OpenBot offers
*/
@@ -17,6 +17,32 @@ export const GetDeploymentParams = zod.object({
),
});
+export const getDeploymentResponseApiItemRegExp = new RegExp(
+ "^v[1-9][0-9]{0,3}$",
+);
+
+export const getDeploymentResponseMinimumClientsWebRegExp = new RegExp(
+ "^\\d{1,6}\\.\\d{1,6}\\.\\d{1,6}(-[0-9A-Za-z.-]{1,64})?$",
+);
+export const getDeploymentResponseMinimumClientsDesktopRegExp = new RegExp(
+ "^\\d{1,6}\\.\\d{1,6}\\.\\d{1,6}(-[0-9A-Za-z.-]{1,64})?$",
+);
+export const getDeploymentResponseMinimumClientsMobileRegExp = new RegExp(
+ "^\\d{1,6}\\.\\d{1,6}\\.\\d{1,6}(-[0-9A-Za-z.-]{1,64})?$",
+);
+export const getDeploymentResponseMinimumClientsRecorderRegExp = new RegExp(
+ "^\\d{1,6}\\.\\d{1,6}\\.\\d{1,6}(-[0-9A-Za-z.-]{1,64})?$",
+);
+export const getDeploymentResponseSecurityMinimumClientsWebRegExp = new RegExp(
+ "^\\d{1,6}\\.\\d{1,6}\\.\\d{1,6}(-[0-9A-Za-z.-]{1,64})?$",
+);
+export const getDeploymentResponseSecurityMinimumClientsDesktopRegExp =
+ new RegExp("^\\d{1,6}\\.\\d{1,6}\\.\\d{1,6}(-[0-9A-Za-z.-]{1,64})?$");
+export const getDeploymentResponseSecurityMinimumClientsMobileRegExp =
+ new RegExp("^\\d{1,6}\\.\\d{1,6}\\.\\d{1,6}(-[0-9A-Za-z.-]{1,64})?$");
+export const getDeploymentResponseSecurityMinimumClientsRecorderRegExp =
+ new RegExp("^\\d{1,6}\\.\\d{1,6}\\.\\d{1,6}(-[0-9A-Za-z.-]{1,64})?$");
+
export const GetDeploymentResponse = zod
.object({
edition: zod
@@ -70,6 +96,99 @@ export const GetDeploymentResponse = zod
.describe(
"Whether this OpenBot has computers for Bots at all. False, a Bot has no computer, browser or sign-in to a website, and the computers answer 503 to every call. Not isolatedBots: an OpenBot whose Bots share one computer has computers (true) and cannot give a Bot one of its own (isolatedBots false).",
),
+ attachmentLimits: zod
+ .object({
+ imageBytes: zod.int().min(1).describe("The largest image."),
+ documentBytes: zod
+ .int()
+ .min(1)
+ .describe(
+ "The largest document: a PDF, or a Word, Excel or PowerPoint file (.docx, .xlsx, .pptx).",
+ ),
+ fileBytes: zod
+ .int()
+ .min(1)
+ .describe("The largest text file, or a file of any other kind."),
+ })
+ .optional()
+ .describe(
+ "How large a file attached to a message may be, by kind, in bytes. An upload over its kind's limit is refused. Absent, as from an older OpenBot, the limits are 8388608 for an image or a document (a PDF, or a Word, Excel or PowerPoint file) and 1048576 for any other file. The limits can rise while OpenBot runs, so a client reads them again rather than keeping them for good. What a Bot's model is shown of a large file is a separate matter: the file is kept and can be downloaded whatever the model can read of it.",
+ ),
+ api: zod
+ .array(zod.string().regex(getDeploymentResponseApiItemRegExp))
+ .min(1)
+ .optional()
+ .describe(
+ "The API versions this OpenBot serves, by major, such as v2. An app that speaks none of them can't use it: when they are all newer than the app's, the app needs an update; when they are all older, this OpenBot does. Absent from a release before it was published, which serves v2.",
+ ),
+ minimumClients: zod
+ .object({
+ web: zod
+ .string()
+ .regex(getDeploymentResponseMinimumClientsWebRegExp)
+ .optional()
+ .describe("An OpenBot release, such as 1.1.0."),
+ desktop: zod
+ .string()
+ .regex(getDeploymentResponseMinimumClientsDesktopRegExp)
+ .optional()
+ .describe("An OpenBot release, such as 1.1.0."),
+ mobile: zod
+ .string()
+ .regex(getDeploymentResponseMinimumClientsMobileRegExp)
+ .optional()
+ .describe("An OpenBot release, such as 1.1.0."),
+ recorder: zod
+ .string()
+ .regex(getDeploymentResponseMinimumClientsRecorderRegExp)
+ .optional()
+ .describe("An OpenBot release, such as 1.1.0."),
+ })
+ .optional()
+ .describe(
+ "The oldest release of each OpenBot app this OpenBot serves. An app names itself in the OpenBot-Client header, and one older than its minimum here is refused with CLIENT_UPDATE_REQUIRED, everywhere but this deployment answer. An app not listed has no minimum. An OpenBot serves every app released in the last 12 months, so it names one only where its administrator raised it. Absent from a release before it was published.",
+ ),
+ securityMinimumClients: zod
+ .object({
+ web: zod
+ .string()
+ .regex(getDeploymentResponseSecurityMinimumClientsWebRegExp)
+ .optional()
+ .describe("An OpenBot release, such as 1.1.0."),
+ desktop: zod
+ .string()
+ .regex(getDeploymentResponseSecurityMinimumClientsDesktopRegExp)
+ .optional()
+ .describe("An OpenBot release, such as 1.1.0."),
+ mobile: zod
+ .string()
+ .regex(getDeploymentResponseSecurityMinimumClientsMobileRegExp)
+ .optional()
+ .describe("An OpenBot release, such as 1.1.0."),
+ recorder: zod
+ .string()
+ .regex(getDeploymentResponseSecurityMinimumClientsRecorderRegExp)
+ .optional()
+ .describe("An OpenBot release, such as 1.1.0."),
+ })
+ .optional()
+ .describe(
+ "The part of minimumClients raised because of a security problem in older releases: for each app named, the minimum is there for security. Absent or empty when none is.",
+ ),
+ launcherApi: zod
+ .int()
+ .min(1)
+ .optional()
+ .describe(
+ "The version of what OpenBot Desktop supplies when it starts this OpenBot on its own computer. It changes when Desktop must supply something new.",
+ ),
+ extensionApi: zod
+ .int()
+ .min(1)
+ .optional()
+ .describe(
+ "The version of what the OpenBot Recorder and this OpenBot exchange.",
+ ),
})
.describe("What this OpenBot offers and how people sign in to it.");
@@ -93,13 +212,13 @@ export const getOrganizationSettingsResponseOneInactiveComputerDaysMax = 3650;
export const getOrganizationSettingsResponseOneModelAllowlistModelsItemMax = 200;
export const getOrganizationSettingsResponseOneModelAllowlistModelsItemRegExp =
- new RegExp("^[^\\x00]*\\S[^\\x00]*$");
+ new RegExp("^[^\\x00]*[^\\s\\x00][^\\x00]*$");
export const getOrganizationSettingsResponseOneModelAllowlistModelsMax = 500;
export const getOrganizationSettingsResponseOneMcpAllowlistServersItemMax = 200;
export const getOrganizationSettingsResponseOneMcpAllowlistServersItemRegExp =
- new RegExp("^[^\\x00]*\\S[^\\x00]*$");
+ new RegExp("^[^\\x00]*[^\\s\\x00][^\\x00]*$");
export const getOrganizationSettingsResponseOneMcpAllowlistServersMax = 500;
export const getOrganizationSettingsResponseOneProactiveDailyRunsMax = 1440;
@@ -147,6 +266,12 @@ export const GetOrganizationSettingsResponse = zod
actionRecordRetentionDays: zod
.int()
.describe("How many days recorded computer actions are kept."),
+ computerMode: zod
+ .enum(["per-person", "shared", "none"])
+ .optional()
+ .describe(
+ "How Bots get computers here. per-person: each person has a computer of their own, and so does each isolated Bot; an OpenBot only one person uses answers this too. shared: every person's Bots run on one computer, so a command one Bot runs can read another person's files there. That suits a proof of concept, not people's real work. none: Bots have no computers. Absent from a server that predates it.",
+ ),
})
.describe("What an administrator needs to set the settings. Read only."),
ssoRequired: zod
@@ -257,13 +382,13 @@ export const updateOrganizationSettingsBodyOneInactiveComputerDaysMax = 3650;
export const updateOrganizationSettingsBodyOneModelAllowlistModelsItemMax = 200;
export const updateOrganizationSettingsBodyOneModelAllowlistModelsItemRegExp =
- new RegExp("^[^\\x00]*\\S[^\\x00]*$");
+ new RegExp("^[^\\x00]*[^\\s\\x00][^\\x00]*$");
export const updateOrganizationSettingsBodyOneModelAllowlistModelsMax = 500;
export const updateOrganizationSettingsBodyOneMcpAllowlistServersItemMax = 200;
export const updateOrganizationSettingsBodyOneMcpAllowlistServersItemRegExp =
- new RegExp("^[^\\x00]*\\S[^\\x00]*$");
+ new RegExp("^[^\\x00]*[^\\s\\x00][^\\x00]*$");
export const updateOrganizationSettingsBodyOneMcpAllowlistServersMax = 500;
export const updateOrganizationSettingsBodyOneProactiveDailyRunsMax = 1440;
@@ -311,6 +436,12 @@ export const UpdateOrganizationSettingsBody = zod
actionRecordRetentionDays: zod
.int()
.describe("How many days recorded computer actions are kept."),
+ computerMode: zod
+ .enum(["per-person", "shared", "none"])
+ .optional()
+ .describe(
+ "How Bots get computers here. per-person: each person has a computer of their own, and so does each isolated Bot; an OpenBot only one person uses answers this too. shared: every person's Bots run on one computer, so a command one Bot runs can read another person's files there. That suits a proof of concept, not people's real work. none: Bots have no computers. Absent from a server that predates it.",
+ ),
})
.optional()
.describe("What an administrator needs to set the settings. Read only."),
@@ -406,13 +537,13 @@ export const updateOrganizationSettingsResponseOneInactiveComputerDaysMax = 3650
export const updateOrganizationSettingsResponseOneModelAllowlistModelsItemMax = 200;
export const updateOrganizationSettingsResponseOneModelAllowlistModelsItemRegExp =
- new RegExp("^[^\\x00]*\\S[^\\x00]*$");
+ new RegExp("^[^\\x00]*[^\\s\\x00][^\\x00]*$");
export const updateOrganizationSettingsResponseOneModelAllowlistModelsMax = 500;
export const updateOrganizationSettingsResponseOneMcpAllowlistServersItemMax = 200;
export const updateOrganizationSettingsResponseOneMcpAllowlistServersItemRegExp =
- new RegExp("^[^\\x00]*\\S[^\\x00]*$");
+ new RegExp("^[^\\x00]*[^\\s\\x00][^\\x00]*$");
export const updateOrganizationSettingsResponseOneMcpAllowlistServersMax = 500;
export const updateOrganizationSettingsResponseOneProactiveDailyRunsMax = 1440;
@@ -460,6 +591,12 @@ export const UpdateOrganizationSettingsResponse = zod
actionRecordRetentionDays: zod
.int()
.describe("How many days recorded computer actions are kept."),
+ computerMode: zod
+ .enum(["per-person", "shared", "none"])
+ .optional()
+ .describe(
+ "How Bots get computers here. per-person: each person has a computer of their own, and so does each isolated Bot; an OpenBot only one person uses answers this too. shared: every person's Bots run on one computer, so a command one Bot runs can read another person's files there. That suits a proof of concept, not people's real work. none: Bots have no computers. Absent from a server that predates it.",
+ ),
})
.describe("What an administrator needs to set the settings. Read only."),
ssoRequired: zod
diff --git a/app/src/lib/api/generated/organizations/organizations.zod.ts b/app/src/lib/api/generated/organizations/organizations.zod.ts
index 213b608aa6..946cd36f25 100644
--- a/app/src/lib/api/generated/organizations/organizations.zod.ts
+++ b/app/src/lib/api/generated/organizations/organizations.zod.ts
@@ -69,9 +69,9 @@ export const ListOrganizationsResponse = zod.object({
.describe("Its short name, which also addresses it."),
name: zod.string().describe("What people call it."),
role: zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
active: zod
.boolean()
@@ -118,7 +118,7 @@ export const CreateOrganizationHeader = zod.object({
export const createOrganizationBodyNameMax = 100;
export const createOrganizationBodyNameRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const createOrganizationBodySlugMin = 2;
export const createOrganizationBodySlugMax = 48;
@@ -157,9 +157,9 @@ export const CreateOrganizationResponse = zod.object({
slug: zod.string().describe("Its short name, which also addresses it."),
name: zod.string().describe("What people call it."),
role: zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
active: zod
.boolean()
@@ -232,9 +232,9 @@ export const ListOrganizationMembersResponse = zod.object({
assignableRoles: zod
.array(
zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
)
.describe(
@@ -251,9 +251,9 @@ export const ListOrganizationMembersResponse = zod.object({
.nullable()
.describe("Their picture's address, when they have one."),
role: zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
joinedAt: zod.iso
.datetime({ offset: true })
@@ -301,7 +301,7 @@ export const UpdateOrganizationHeader = zod.object({
export const updateOrganizationBodyNameMax = 100;
export const updateOrganizationBodyNameRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const UpdateOrganizationBody = zod.object({
@@ -325,9 +325,9 @@ export const UpdateOrganizationResponse = zod.object({
slug: zod.string().describe("Its short name, which also addresses it."),
name: zod.string().describe("What people call it."),
role: zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
active: zod
.boolean()
@@ -397,9 +397,9 @@ export const UpdateOrganizationMemberResponse = zod.object({
assignableRoles: zod
.array(
zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
)
.describe(
@@ -416,9 +416,9 @@ export const UpdateOrganizationMemberResponse = zod.object({
.nullable()
.describe("Their picture's address, when they have one."),
role: zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
joinedAt: zod.iso
.datetime({ offset: true })
@@ -525,7 +525,7 @@ export const ListOrganizationInvitationsResponse = zod.object({
.enum(["admin", "member"])
.describe("A role an admin can give a person."),
status: zod
- .enum(["pending", "expired", "declined"])
+ .string()
.describe(
"pending while it waits for an answer, expired once its seven days ran out, declined when the person turned it down.",
),
@@ -614,7 +614,7 @@ export const CreateOrganizationInvitationResponse = zod.object({
.enum(["admin", "member"])
.describe("A role an admin can give a person."),
status: zod
- .enum(["pending", "expired", "declined"])
+ .string()
.describe(
"pending while it waits for an answer, expired once its seven days ran out, declined when the person turned it down.",
),
@@ -736,7 +736,7 @@ export const ListInvitationsResponse = zod.object({
.enum(["admin", "member"])
.describe("A role an admin can give a person."),
status: zod
- .enum(["pending", "expired", "accepted", "declined", "canceled"])
+ .string()
.describe(
"pending while it can still be answered. expired once its seven days ran out, accepted or declined once the person answered, canceled when the organization took it back.",
),
@@ -805,7 +805,7 @@ export const GetInvitationResponse = zod.object({
.enum(["admin", "member"])
.describe("A role an admin can give a person."),
status: zod
- .enum(["pending", "expired", "accepted", "declined", "canceled"])
+ .string()
.describe(
"pending while it can still be answered. expired once its seven days ran out, accepted or declined once the person answered, canceled when the organization took it back.",
),
@@ -873,9 +873,9 @@ export const AcceptInvitationResponse = zod.object({
slug: zod.string().describe("Its short name, which also addresses it."),
name: zod.string().describe("What people call it."),
role: zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
active: zod
.boolean()
diff --git a/app/src/lib/api/generated/people/people.msw.ts b/app/src/lib/api/generated/people/people.msw.ts
index 5c91c124dc..23bc963b9d 100644
--- a/app/src/lib/api/generated/people/people.msw.ts
+++ b/app/src/lib/api/generated/people/people.msw.ts
@@ -136,6 +136,8 @@ export const getUpdateStandingInstructionsResponseMock =
export const getGetPreferencesResponseMock = (): Preferences => ({
messageListEmphasis: "thread",
selfHostBannerDismissed: false,
+ dismissedNotices: [],
+ noticesDue: [],
narration: null,
skin: "openbot",
proactive: "on",
@@ -144,6 +146,8 @@ export const getGetPreferencesResponseMock = (): Preferences => ({
export const getUpdatePreferencesResponseMock = (): Preferences => ({
messageListEmphasis: "thread",
selfHostBannerDismissed: false,
+ dismissedNotices: [],
+ noticesDue: [],
narration: null,
skin: "openbot",
proactive: "on",
diff --git a/app/src/lib/api/generated/people/people.zod.ts b/app/src/lib/api/generated/people/people.zod.ts
index dba8244a78..5eed7d2e1d 100644
--- a/app/src/lib/api/generated/people/people.zod.ts
+++ b/app/src/lib/api/generated/people/people.zod.ts
@@ -80,9 +80,9 @@ export const ListPeopleResponse = zod.object({
"The picture their identity provider gave, when it gave one.",
),
role: zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
needsName: zod
.boolean()
@@ -193,9 +193,9 @@ export const GetPersonResponse = zod.object({
"The picture their identity provider gave, when it gave one.",
),
role: zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
needsName: zod
.boolean()
@@ -336,9 +336,9 @@ export const UpdatePersonResponse = zod.object({
"The picture their identity provider gave, when it gave one.",
),
role: zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
needsName: zod
.boolean()
@@ -451,9 +451,9 @@ export const RevokePersonAccessResponse = zod.object({
"The picture their identity provider gave, when it gave one.",
),
role: zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
needsName: zod
.boolean()
@@ -566,9 +566,9 @@ export const RestorePersonAccessResponse = zod.object({
"The picture their identity provider gave, when it gave one.",
),
role: zod
- .enum(["owner", "admin", "member"])
+ .string()
.describe(
- "The person's role as a member of the organization. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The owner is whoever created the organization; `default` has admins and no owner.",
+ "The person's role as a member of the organization, as the server answers it. An owner or an admin governs it: its people, its sign-in and its policy. A member uses it. The list can grow: a client reads a role it doesn't know as a member.",
),
needsName: zod
.boolean()
@@ -901,6 +901,20 @@ export const GetPreferencesParams = zod.object({
),
});
+export const getPreferencesResponseDismissedNoticesItemMax = 64;
+
+export const getPreferencesResponseDismissedNoticesItemRegExp = new RegExp(
+ "^[a-z0-9]+(?:-[a-z0-9]+)*$",
+);
+export const getPreferencesResponseDismissedNoticesMax = 64;
+
+export const getPreferencesResponseNoticesDueItemMax = 64;
+
+export const getPreferencesResponseNoticesDueItemRegExp = new RegExp(
+ "^[a-z0-9]+(?:-[a-z0-9]+)*$",
+);
+export const getPreferencesResponseNoticesDueMax = 64;
+
export const GetPreferencesResponse = zod
.object({
messageListEmphasis: zod
@@ -913,6 +927,37 @@ export const GetPreferencesResponse = zod
.describe(
"Whether they closed the banner offering help self-hosting OpenBot.",
),
+ dismissedNotices: zod
+ .array(
+ zod
+ .string()
+ .min(1)
+ .max(getPreferencesResponseDismissedNoticesItemMax)
+ .regex(getPreferencesResponseDismissedNoticesItemRegExp)
+ .describe(
+ "A notice OpenBot shows a person once, such as a nudge, by its id: star-on-github is the ask to star OpenBot on GitHub.",
+ ),
+ )
+ .max(getPreferencesResponseDismissedNoticesMax)
+ .describe(
+ "The notices they answered, either way, by id. A notice in this list is never shown to them again, on any device. Empty until they answer one.",
+ ),
+ noticesDue: zod
+ .array(
+ zod
+ .string()
+ .min(1)
+ .max(getPreferencesResponseNoticesDueItemMax)
+ .regex(getPreferencesResponseNoticesDueItemRegExp)
+ .describe(
+ "A notice OpenBot shows a person once, such as a nudge, by its id: star-on-github is the ask to star OpenBot on GitHub.",
+ ),
+ )
+ .max(getPreferencesResponseNoticesDueMax)
+ .optional()
+ .describe(
+ "The notices OpenBot would show them now, by id, worked out by the server from the edition and how they have used OpenBot. A notice they dismissed is never here. Absent from a server that works out none.",
+ ),
narration: zod
.union([zod.enum(["on", "off"]), zod.null()])
.describe(
@@ -977,6 +1022,13 @@ export const UpdatePreferencesHeader = zod.object({
),
});
+export const updatePreferencesBodyDismissedNoticesItemMax = 64;
+
+export const updatePreferencesBodyDismissedNoticesItemRegExp = new RegExp(
+ "^[a-z0-9]+(?:-[a-z0-9]+)*$",
+);
+export const updatePreferencesBodyDismissedNoticesMax = 64;
+
export const UpdatePreferencesBody = zod
.object({
messageListEmphasis: zod
@@ -986,6 +1038,22 @@ export const UpdatePreferencesBody = zod
"What the conversation list leads with, the Bot or the conversation.",
),
selfHostBannerDismissed: zod.boolean().optional(),
+ dismissedNotices: zod
+ .array(
+ zod
+ .string()
+ .min(1)
+ .max(updatePreferencesBodyDismissedNoticesItemMax)
+ .regex(updatePreferencesBodyDismissedNoticesItemRegExp)
+ .describe(
+ "A notice OpenBot shows a person once, such as a nudge, by its id: star-on-github is the ask to star OpenBot on GitHub.",
+ ),
+ )
+ .max(updatePreferencesBodyDismissedNoticesMax)
+ .optional()
+ .describe(
+ "Notices they answered, by id. Added to the ones already dismissed: a notice is never taken back off the list.",
+ ),
narration: zod.enum(["on", "off"]).optional(),
skin: zod
.enum(["openbot", "openduet", "opendots", "openfuse"])
@@ -999,6 +1067,20 @@ export const UpdatePreferencesBody = zod
"The preferences to change. At least one; the rest stay as they are.",
);
+export const updatePreferencesResponseDismissedNoticesItemMax = 64;
+
+export const updatePreferencesResponseDismissedNoticesItemRegExp = new RegExp(
+ "^[a-z0-9]+(?:-[a-z0-9]+)*$",
+);
+export const updatePreferencesResponseDismissedNoticesMax = 64;
+
+export const updatePreferencesResponseNoticesDueItemMax = 64;
+
+export const updatePreferencesResponseNoticesDueItemRegExp = new RegExp(
+ "^[a-z0-9]+(?:-[a-z0-9]+)*$",
+);
+export const updatePreferencesResponseNoticesDueMax = 64;
+
export const UpdatePreferencesResponse = zod
.object({
messageListEmphasis: zod
@@ -1011,6 +1093,37 @@ export const UpdatePreferencesResponse = zod
.describe(
"Whether they closed the banner offering help self-hosting OpenBot.",
),
+ dismissedNotices: zod
+ .array(
+ zod
+ .string()
+ .min(1)
+ .max(updatePreferencesResponseDismissedNoticesItemMax)
+ .regex(updatePreferencesResponseDismissedNoticesItemRegExp)
+ .describe(
+ "A notice OpenBot shows a person once, such as a nudge, by its id: star-on-github is the ask to star OpenBot on GitHub.",
+ ),
+ )
+ .max(updatePreferencesResponseDismissedNoticesMax)
+ .describe(
+ "The notices they answered, either way, by id. A notice in this list is never shown to them again, on any device. Empty until they answer one.",
+ ),
+ noticesDue: zod
+ .array(
+ zod
+ .string()
+ .min(1)
+ .max(updatePreferencesResponseNoticesDueItemMax)
+ .regex(updatePreferencesResponseNoticesDueItemRegExp)
+ .describe(
+ "A notice OpenBot shows a person once, such as a nudge, by its id: star-on-github is the ask to star OpenBot on GitHub.",
+ ),
+ )
+ .max(updatePreferencesResponseNoticesDueMax)
+ .optional()
+ .describe(
+ "The notices OpenBot would show them now, by id, worked out by the server from the edition and how they have used OpenBot. A notice they dismissed is never here. Absent from a server that works out none.",
+ ),
narration: zod
.union([zod.enum(["on", "off"]), zod.null()])
.describe(
diff --git a/app/src/lib/api/generated/product-events/product-events.msw.ts b/app/src/lib/api/generated/product-events/product-events.msw.ts
index 0c4b1864f2..2c8341412f 100644
--- a/app/src/lib/api/generated/product-events/product-events.msw.ts
+++ b/app/src/lib/api/generated/product-events/product-events.msw.ts
@@ -4,7 +4,7 @@
import { HttpResponse, http } from "msw";
import type { HttpResponseResolver, RequestHandlerOptions } from "msw";
-import type { AppError, ProductEvent } from "../model";
+import type { AppError, NudgeEvent, ProductEvent } from "../model";
export const getRecordProductEventMockHandler = (
overrideResponse?:
@@ -59,7 +59,35 @@ export const getRecordAppErrorMockHandler = (
options,
);
};
+
+export const getRecordNudgeEventMockHandler = (
+ overrideResponse?:
+ | void
+ | ((
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string }, NudgeEvent>
+ >[0],
+ ) => Promise | void),
+ options?: RequestHandlerOptions,
+) => {
+ return http.post<{ organizationId: string }, NudgeEvent>(
+ "*/api/v2/organizations/:organizationId/nudge-events",
+ async (
+ info: Parameters<
+ HttpResponseResolver<{ organizationId: string }, NudgeEvent>
+ >[0],
+ ) => {
+ if (typeof overrideResponse === "function") {
+ await overrideResponse(info);
+ }
+
+ return new HttpResponse(null, { status: 204 });
+ },
+ options,
+ );
+};
export const getProductEventsMock = () => [
getRecordProductEventMockHandler(),
getRecordAppErrorMockHandler(),
+ getRecordNudgeEventMockHandler(),
];
diff --git a/app/src/lib/api/generated/product-events/product-events.ts b/app/src/lib/api/generated/product-events/product-events.ts
index b0ddd24106..339e2a192f 100644
--- a/app/src/lib/api/generated/product-events/product-events.ts
+++ b/app/src/lib/api/generated/product-events/product-events.ts
@@ -14,10 +14,12 @@ import type {
ForbiddenResponse,
IdempotencyConflictResponse,
InvalidRequestResponse,
+ NudgeEvent,
OrganizationNotFoundResponse,
PayloadTooLargeResponse,
ProductEvent,
RecordAppErrorHeaders,
+ RecordNudgeEventHeaders,
RecordProductEventHeaders,
ServerErrorResponse,
UnauthenticatedResponse,
@@ -330,3 +332,151 @@ export const useRecordAppError = <
> => {
return useMutation(getRecordAppErrorMutationOptions(options), queryClient);
};
+export const getRecordNudgeEventUrl = (organizationId: string) => {
+ return `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/nudge-events`;
+};
+
+/**
+ * Tell OpenBot that a nudge (a notice OpenBot shows a person once, such as the ask to star OpenBot on GitHub) was shown to the caller, that they followed it, or that they dismissed it, and where. OpenBot adds the moment that made it due, from what it already knows about the caller, so the counts say which moment works. It is best effort: a client sends one per show or answer and waits on nothing. Saving the answer is a separate change to the caller's preferences (`dismissedNotices`). The event counts for the caller and names nothing else. Where this OpenBot has product telemetry switched off, it is accepted and dropped.
+ * @summary Record what the caller did with a nudge
+ */
+export const recordNudgeEvent = async (
+ organizationId: string,
+ nudgeEvent: NudgeEvent,
+ headers: RecordNudgeEventHeaders,
+ options?: Parameters[1],
+): Promise => {
+ const getHeaders = (
+ h?: NonNullable,
+ ): Record => {
+ if (!h) return {};
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
+ if (Symbol.iterator in h) {
+ return Object.fromEntries(
+ Array.from(
+ h as Iterable>,
+ (entry) => Array.from(entry) as [string, string],
+ ),
+ );
+ }
+ const headers: Record = {};
+ for (const [name, value] of Object.entries<
+ string | readonly string[] | undefined
+ >(h)) {
+ if (value !== undefined) headers[name] = value;
+ }
+ return headers;
+ };
+ return apiRequest(getRecordNudgeEventUrl(organizationId), {
+ ...options,
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ ...headers,
+ ...getHeaders(options?.headers),
+ },
+ body: JSON.stringify(nudgeEvent),
+ });
+};
+
+export const getRecordNudgeEventMutationKey = () =>
+ ["recordNudgeEvent"] as const;
+
+export const getRecordNudgeEventMutationOptions = <
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | OrganizationNotFoundResponse
+ | IdempotencyConflictResponse
+ | PayloadTooLargeResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ RecordNudgeEventMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+}): UseMutationOptions<
+ Awaited>,
+ TError,
+ RecordNudgeEventMutationVariables,
+ TContext
+> => {
+ const mutationKey = getRecordNudgeEventMutationKey();
+ const { mutation: mutationOptions, request: requestOptions } = options
+ ? options.mutation &&
+ "mutationKey" in options.mutation &&
+ options.mutation.mutationKey
+ ? options
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
+ : { mutation: { mutationKey }, request: undefined };
+
+ const mutationFn: MutationFunction<
+ Awaited>,
+ RecordNudgeEventMutationVariables
+ > = (props) => {
+ const { organizationId, data, headers } = props ?? {};
+
+ return recordNudgeEvent(organizationId, data, headers, requestOptions);
+ };
+
+ return { mutationFn, ...mutationOptions };
+};
+
+export type RecordNudgeEventMutationResult = NonNullable<
+ Awaited>
+>;
+export type RecordNudgeEventMutationBody = NudgeEvent;
+export type RecordNudgeEventMutationError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | OrganizationNotFoundResponse
+ | IdempotencyConflictResponse
+ | PayloadTooLargeResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse;
+export type RecordNudgeEventMutationVariables = {
+ organizationId: string;
+ data: NudgeEvent;
+ headers: RecordNudgeEventHeaders;
+};
+
+/**
+ * @summary Record what the caller did with a nudge
+ */
+export const useRecordNudgeEvent = <
+ TError =
+ | InvalidRequestResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | OrganizationNotFoundResponse
+ | IdempotencyConflictResponse
+ | PayloadTooLargeResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(
+ options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ RecordNudgeEventMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseMutationResult<
+ Awaited>,
+ TError,
+ RecordNudgeEventMutationVariables,
+ TContext
+> => {
+ return useMutation(getRecordNudgeEventMutationOptions(options), queryClient);
+};
diff --git a/app/src/lib/api/generated/product-events/product-events.zod.ts b/app/src/lib/api/generated/product-events/product-events.zod.ts
index 1341ff4696..e713d9900b 100644
--- a/app/src/lib/api/generated/product-events/product-events.zod.ts
+++ b/app/src/lib/api/generated/product-events/product-events.zod.ts
@@ -158,3 +158,65 @@ export const RecordAppErrorBody = zod
);
export const RecordAppErrorResponse = zod.void();
+
+/**
+ * Tell OpenBot that a nudge (a notice OpenBot shows a person once, such as the ask to star OpenBot on GitHub) was shown to the caller, that they followed it, or that they dismissed it, and where. OpenBot adds the moment that made it due, from what it already knows about the caller, so the counts say which moment works. It is best effort: a client sends one per show or answer and waits on nothing. Saving the answer is a separate change to the caller's preferences (`dismissedNotices`). The event counts for the caller and names nothing else. Where this OpenBot has product telemetry switched off, it is accepted and dropped.
+ * @summary Record what the caller did with a nudge
+ */
+
+export const RecordNudgeEventParams = zod.object({
+ organizationId: zod
+ .string()
+ .min(1)
+ .describe(
+ "The organization, by its id or its slug. One the caller is not a member of answers as one that does not exist, `default` included.",
+ ),
+});
+
+export const recordNudgeEventHeaderIdempotencyKeyMax = 128;
+
+export const RecordNudgeEventHeader = zod.object({
+ "Idempotency-Key": zod
+ .string()
+ .min(1)
+ .max(recordNudgeEventHeaderIdempotencyKeyMax)
+ .describe(
+ "Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.",
+ ),
+});
+
+export const recordNudgeEventBodyNudgeMax = 64;
+
+export const recordNudgeEventBodyNudgeRegExp = new RegExp(
+ "^[a-z0-9]+(?:-[a-z0-9]+)*$",
+);
+
+export const RecordNudgeEventBody = zod
+ .object({
+ nudge: zod
+ .string()
+ .min(1)
+ .max(recordNudgeEventBodyNudgeMax)
+ .regex(recordNudgeEventBodyNudgeRegExp)
+ .describe(
+ "A notice OpenBot shows a person once, such as a nudge, by its id: star-on-github is the ask to star OpenBot on GitHub.",
+ ),
+ action: zod
+ .enum(["shown", "clicked", "dismissed"])
+ .describe(
+ "shown when the nudge was drawn, clicked when they followed it (for the star nudge, opened the repository), and dismissed when they said Not now.",
+ ),
+ place: zod
+ .enum(["card", "settings"])
+ .describe(
+ "card for the nudge drawn above the message box, settings for its permanent row in Settings, which is never shown as a card.",
+ ),
+ surface: zod
+ .enum(["web", "desktop"])
+ .describe("Where the caller saw or answered it."),
+ })
+ .describe(
+ "What the caller did with a nudge, and where. Names nothing about the person, who is the caller. The moment that made the nudge due is added by OpenBot, not sent.",
+ );
+
+export const RecordNudgeEventResponse = zod.void();
diff --git a/app/src/lib/api/generated/reviewer-guidance/reviewer-guidance.zod.ts b/app/src/lib/api/generated/reviewer-guidance/reviewer-guidance.zod.ts
index 02bc225d97..50b27ed1a1 100644
--- a/app/src/lib/api/generated/reviewer-guidance/reviewer-guidance.zod.ts
+++ b/app/src/lib/api/generated/reviewer-guidance/reviewer-guidance.zod.ts
@@ -53,7 +53,7 @@ export const ReplaceReviewerGuidanceHeader = zod.object({
export const replaceReviewerGuidanceBodyTextMax = 2000;
export const replaceReviewerGuidanceBodyTextRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const ReplaceReviewerGuidanceBody = zod.object({
@@ -136,7 +136,7 @@ export const CheckReviewerGuidanceHeader = zod.object({
export const checkReviewerGuidanceBodyTextMax = 2000;
export const checkReviewerGuidanceBodyTextRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const CheckReviewerGuidanceBody = zod.object({
@@ -234,7 +234,7 @@ export const ReplayReviewerGuidanceHeader = zod.object({
export const replayReviewerGuidanceBodyTextMax = 2000;
export const replayReviewerGuidanceBodyTextRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const replayReviewerGuidanceBodyLimitMax = 50;
diff --git a/app/src/lib/api/generated/routines/routines.msw.ts b/app/src/lib/api/generated/routines/routines.msw.ts
index a0aec72bc1..4089a4fc26 100644
--- a/app/src/lib/api/generated/routines/routines.msw.ts
+++ b/app/src/lib/api/generated/routines/routines.msw.ts
@@ -11,6 +11,7 @@ import type {
RoutineRunAccepted,
RoutineRunPage,
RoutineSwitch,
+ UpdateRoutineRequest,
} from "../model";
export const getListRoutinesResponseMock = (): RoutinePage => ({
@@ -19,6 +20,7 @@ export const getListRoutinesResponseMock = (): RoutinePage => ({
id: "4a0d6f6e-1c1b-4f3e-8a52-0d9b7c6e5f41",
botId: "agent_9b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21",
schedule: "Weekdays at 09:00",
+ cron: "0 9 * * 1-5",
timezone: "America/New_York",
instruction: "Summarize my unread mail and today's calendar.",
title: "Morning brief",
@@ -43,6 +45,30 @@ export const getCreateRoutineResponseMock = (): RoutineResponse => ({
id: "4a0d6f6e-1c1b-4f3e-8a52-0d9b7c6e5f41",
botId: "agent_9b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21",
schedule: "Weekdays at 09:00",
+ cron: "0 9 * * 1-5",
+ timezone: "America/New_York",
+ instruction: "Summarize my unread mail and today's calendar.",
+ title: "Morning brief",
+ conversation: {
+ id: "5f0c2a52-3f1e-4a55-9d0a-7f6d2b1c8e90",
+ name: "General Assistant",
+ title: "Morning brief",
+ gone: false,
+ },
+ enabled: true,
+ nextRunAt: "2026-11-16T14:00:00.000Z",
+ lastRun: { status: "succeeded", at: "2026-11-13T14:00:41.000Z" },
+ goalId: null,
+ createdAt: "2026-11-02T16:21:09.000Z",
+ },
+});
+
+export const getUpdateRoutineResponseMock = (): RoutineResponse => ({
+ routine: {
+ id: "4a0d6f6e-1c1b-4f3e-8a52-0d9b7c6e5f41",
+ botId: "agent_9b1c6f0e-7f0e-4c1e-9d55-2f4a8c1b6e21",
+ schedule: "Weekdays at 09:00",
+ cron: "0 9 * * 1-5",
timezone: "America/New_York",
instruction: "Summarize my unread mail and today's calendar.",
title: "Morning brief",
@@ -143,6 +169,45 @@ export const getCreateRoutineMockHandler = (
);
};
+export const getUpdateRoutineMockHandler = (
+ overrideResponse?:
+ | RoutineResponse
+ | ((
+ info: Parameters<
+ HttpResponseResolver<
+ { organizationId: string; routineId: string },
+ UpdateRoutineRequest
+ >
+ >[0],
+ ) => Promise | RoutineResponse),
+ options?: RequestHandlerOptions,
+) => {
+ return http.patch<
+ { organizationId: string; routineId: string },
+ UpdateRoutineRequest
+ >(
+ "*/api/v2/organizations/:organizationId/routines/:routineId",
+ async (
+ info: Parameters<
+ HttpResponseResolver<
+ { organizationId: string; routineId: string },
+ UpdateRoutineRequest
+ >
+ >[0],
+ ) => {
+ return HttpResponse.json(
+ overrideResponse !== undefined
+ ? typeof overrideResponse === "function"
+ ? await overrideResponse(info)
+ : overrideResponse
+ : getUpdateRoutineResponseMock(),
+ { status: 200 },
+ );
+ },
+ options,
+ );
+};
+
export const getDeleteRoutineMockHandler = (
overrideResponse?:
| void
@@ -292,6 +357,7 @@ export const getListRoutineRunsMockHandler = (
export const getRoutinesMock = () => [
getListRoutinesMockHandler(),
getCreateRoutineMockHandler(),
+ getUpdateRoutineMockHandler(),
getDeleteRoutineMockHandler(),
getPauseRoutineMockHandler(),
getResumeRoutineMockHandler(),
diff --git a/app/src/lib/api/generated/routines/routines.ts b/app/src/lib/api/generated/routines/routines.ts
index 00dc08872a..1b007ea1c9 100644
--- a/app/src/lib/api/generated/routines/routines.ts
+++ b/app/src/lib/api/generated/routines/routines.ts
@@ -40,6 +40,8 @@ import type {
ServerErrorResponse,
UnauthenticatedResponse,
UnexpectedErrorResponse,
+ UpdateRoutineHeaders,
+ UpdateRoutineRequest,
} from "../model";
import { apiRequest } from "../../request";
@@ -290,7 +292,7 @@ export const getCreateRoutineUrl = (organizationId: string) => {
};
/**
- * Create a routine owned by the caller: the Bot carries out the instruction on the schedule and posts in the conversation, which must be one the caller and the Bot share. With goalId it is the routine that runs that goal on a schedule. A person may have 20 routines switched on, and a routine runs at most once an hour. There is no operation to change a routine: that is done by asking its Bot. A repeated request with the same Idempotency-Key and body returns the first result.
+ * Create a routine owned by the caller: the Bot carries out the instruction on the schedule and posts in the conversation, which must be one the caller and the Bot share. With goalId it is the routine that runs that goal on a schedule. A person may have 20 routines switched on, and a routine runs at most once an hour. updateRoutine changes one. A repeated request with the same Idempotency-Key and body returns the first result.
* @summary Create a routine
*/
export const createRoutine = async (
@@ -429,6 +431,164 @@ export const useCreateRoutine = <
> => {
return useMutation(getCreateRoutineMutationOptions(options), queryClient);
};
+export const getUpdateRoutineUrl = (
+ organizationId: string,
+ routineId: string,
+) => {
+ return `/api/v2/organizations/${encodeURIComponent(String(organizationId))}/routines/${encodeURIComponent(String(routineId))}`;
+};
+
+/**
+ * Change one of the caller's routines: its name, what the Bot does, its schedule or its time zone. Only the fields sent change. It keeps its id, its conversation and its runs. A new schedule or time zone follows the same rules as a new routine's, and its next run is worked out from now. One that does not exist, or is somebody else's, is not found. A repeated request with the same Idempotency-Key and body returns the first result.
+ * @summary Change a routine
+ */
+export const updateRoutine = async (
+ organizationId: string,
+ routineId: string,
+ updateRoutineRequest: UpdateRoutineRequest,
+ headers: UpdateRoutineHeaders,
+ options?: Parameters[1],
+): Promise => {
+ const getHeaders = (
+ h?: NonNullable,
+ ): Record => {
+ if (!h) return {};
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
+ if (Symbol.iterator in h) {
+ return Object.fromEntries(
+ Array.from(
+ h as Iterable>,
+ (entry) => Array.from(entry) as [string, string],
+ ),
+ );
+ }
+ const headers: Record = {};
+ for (const [name, value] of Object.entries<
+ string | readonly string[] | undefined
+ >(h)) {
+ if (value !== undefined) headers[name] = value;
+ }
+ return headers;
+ };
+ return apiRequest(
+ getUpdateRoutineUrl(organizationId, routineId),
+ {
+ ...options,
+ method: "PATCH",
+ headers: {
+ "Content-Type": "application/json",
+ ...headers,
+ ...getHeaders(options?.headers),
+ },
+ body: JSON.stringify(updateRoutineRequest),
+ },
+ );
+};
+
+export const getUpdateRoutineMutationKey = () => ["updateRoutine"] as const;
+
+export const getUpdateRoutineMutationOptions = <
+ TError =
+ | InvalidRoutineResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | RoutineNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ UpdateRoutineMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+}): UseMutationOptions<
+ Awaited>,
+ TError,
+ UpdateRoutineMutationVariables,
+ TContext
+> => {
+ const mutationKey = getUpdateRoutineMutationKey();
+ const { mutation: mutationOptions, request: requestOptions } = options
+ ? options.mutation &&
+ "mutationKey" in options.mutation &&
+ options.mutation.mutationKey
+ ? options
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
+ : { mutation: { mutationKey }, request: undefined };
+
+ const mutationFn: MutationFunction<
+ Awaited>,
+ UpdateRoutineMutationVariables
+ > = (props) => {
+ const { organizationId, routineId, data, headers } = props ?? {};
+
+ return updateRoutine(
+ organizationId,
+ routineId,
+ data,
+ headers,
+ requestOptions,
+ );
+ };
+
+ return { mutationFn, ...mutationOptions };
+};
+
+export type UpdateRoutineMutationResult = NonNullable<
+ Awaited>
+>;
+export type UpdateRoutineMutationBody = UpdateRoutineRequest;
+export type UpdateRoutineMutationError =
+ | InvalidRoutineResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | RoutineNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse;
+export type UpdateRoutineMutationVariables = {
+ organizationId: string;
+ routineId: string;
+ data: UpdateRoutineRequest;
+ headers: UpdateRoutineHeaders;
+};
+
+/**
+ * @summary Change a routine
+ */
+export const useUpdateRoutine = <
+ TError =
+ | InvalidRoutineResponse
+ | UnauthenticatedResponse
+ | ForbiddenResponse
+ | RoutineNotFoundResponse
+ | IdempotencyConflictResponse
+ | ServerErrorResponse
+ | UnexpectedErrorResponse,
+ TContext = unknown,
+>(
+ options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ UpdateRoutineMutationVariables,
+ TContext
+ >;
+ request?: SecondParameter;
+ },
+ queryClient?: QueryClient,
+): UseMutationResult<
+ Awaited>,
+ TError,
+ UpdateRoutineMutationVariables,
+ TContext
+> => {
+ return useMutation(getUpdateRoutineMutationOptions(options), queryClient);
+};
export const getDeleteRoutineUrl = (
organizationId: string,
routineId: string,
diff --git a/app/src/lib/api/generated/routines/routines.zod.ts b/app/src/lib/api/generated/routines/routines.zod.ts
index 8fcbcbf4c1..f753b047d4 100644
--- a/app/src/lib/api/generated/routines/routines.zod.ts
+++ b/app/src/lib/api/generated/routines/routines.zod.ts
@@ -56,6 +56,11 @@ export const ListRoutinesResponse = zod.object({
id: zod.string().describe("The routine's id."),
botId: zod.string().describe("The Bot that carries it out."),
schedule: zod.string().describe("When it runs, as text to show."),
+ cron: zod
+ .string()
+ .describe(
+ "The schedule as it is kept, five cron fields: minute, hour, day of month, month, day of week. What a form that changes the schedule starts from.",
+ ),
timezone: zod
.string()
.describe("The IANA time zone the schedule is read in."),
@@ -98,13 +103,7 @@ export const ListRoutinesResponse = zod.object({
.union([
zod.object({
status: zod
- .union([
- zod.literal("succeeded"),
- zod.literal("failed"),
- zod.literal("skipped"),
- zod.literal("waiting"),
- zod.literal(null),
- ])
+ .string()
.nullable()
.describe(
"How it ended, or null while it is still open. Only failed is a failure.",
@@ -143,7 +142,7 @@ export const ListRoutinesResponse = zod.object({
});
/**
- * Create a routine owned by the caller: the Bot carries out the instruction on the schedule and posts in the conversation, which must be one the caller and the Bot share. With goalId it is the routine that runs that goal on a schedule. A person may have 20 routines switched on, and a routine runs at most once an hour. There is no operation to change a routine: that is done by asking its Bot. A repeated request with the same Idempotency-Key and body returns the first result.
+ * Create a routine owned by the caller: the Bot carries out the instruction on the schedule and posts in the conversation, which must be one the caller and the Bot share. With goalId it is the routine that runs that goal on a schedule. A person may have 20 routines switched on, and a routine runs at most once an hour. updateRoutine changes one. A repeated request with the same Idempotency-Key and body returns the first result.
* @summary Create a routine
*/
@@ -236,6 +235,177 @@ export const CreateRoutineResponse = zod.object({
id: zod.string().describe("The routine's id."),
botId: zod.string().describe("The Bot that carries it out."),
schedule: zod.string().describe("When it runs, as text to show."),
+ cron: zod
+ .string()
+ .describe(
+ "The schedule as it is kept, five cron fields: minute, hour, day of month, month, day of week. What a form that changes the schedule starts from.",
+ ),
+ timezone: zod
+ .string()
+ .describe("The IANA time zone the schedule is read in."),
+ instruction: zod.string().describe("What the Bot does on each run."),
+ title: zod
+ .string()
+ .nullable()
+ .describe(
+ "What the person called it, or null when they named it nothing.",
+ ),
+ conversation: zod
+ .object({
+ id: zod.string().describe("The conversation's id."),
+ name: zod
+ .string()
+ .nullable()
+ .describe(
+ "The names of the Bots in it, or null when the conversation is gone entirely.",
+ ),
+ title: zod
+ .string()
+ .nullable()
+ .describe(
+ "The conversation as the sidebar titles it, which is what a person knows it by. Null when it is gone entirely.",
+ ),
+ gone: zod
+ .boolean()
+ .describe(
+ "Whether the conversation was deleted. Such a routine is shown, not hidden.",
+ ),
+ })
+ .describe("Where a routine posts."),
+ enabled: zod
+ .boolean()
+ .describe("False while it is paused. A paused routine never runs."),
+ nextRunAt: zod.iso
+ .datetime({ offset: true })
+ .describe("When it runs next, if it is on."),
+ lastRun: zod
+ .union([
+ zod.object({
+ status: zod
+ .string()
+ .nullable()
+ .describe(
+ "How it ended, or null while it is still open. Only failed is a failure.",
+ ),
+ at: zod.iso
+ .datetime({ offset: true })
+ .nullable()
+ .describe("When it finished, or null while it is still open."),
+ }),
+ zod.null(),
+ ])
+ .describe("Its newest run, or null when it has never run."),
+ goalId: zod
+ .string()
+ .nullable()
+ .describe("The goal it runs, or null when it runs none."),
+ createdAt: zod.iso
+ .datetime({ offset: true })
+ .describe("When it was made."),
+ })
+ .describe(
+ "One of a person's routines. schedule is display text and never a value to parse: words for the schedules OpenBot can describe, the five cron fields for anything stranger. nextRunAt is the one time to rely on.",
+ ),
+});
+
+/**
+ * Change one of the caller's routines: its name, what the Bot does, its schedule or its time zone. Only the fields sent change. It keeps its id, its conversation and its runs. A new schedule or time zone follows the same rules as a new routine's, and its next run is worked out from now. One that does not exist, or is somebody else's, is not found. A repeated request with the same Idempotency-Key and body returns the first result.
+ * @summary Change a routine
+ */
+
+export const updateRoutinePathRoutineIdMax = 200;
+
+export const updateRoutinePathRoutineIdRegExp = new RegExp("\\S");
+
+export const UpdateRoutineParams = zod.object({
+ organizationId: zod
+ .string()
+ .min(1)
+ .describe(
+ "The organization, by its id or its slug. One the caller is not a member of answers as one that does not exist, `default` included.",
+ ),
+ routineId: zod
+ .string()
+ .min(1)
+ .max(updateRoutinePathRoutineIdMax)
+ .regex(updateRoutinePathRoutineIdRegExp)
+ .describe("The routine's id."),
+});
+
+export const updateRoutineHeaderIdempotencyKeyMax = 128;
+
+export const UpdateRoutineHeader = zod.object({
+ "Idempotency-Key": zod
+ .string()
+ .min(1)
+ .max(updateRoutineHeaderIdempotencyKeyMax)
+ .describe(
+ "Generated by the caller for each write it means to make once. Reuse the same key and the same request for 24 hours after an uncertain response; the same key with a different request is a conflict.",
+ ),
+});
+
+export const updateRoutineBodyTitleMax = 100;
+
+export const updateRoutineBodyInstructionMax = 2000;
+
+export const updateRoutineBodyInstructionRegExp = new RegExp("\\S");
+export const updateRoutineBodyCronMax = 200;
+
+export const updateRoutineBodyCronRegExp = new RegExp("\\S");
+export const updateRoutineBodyTimezoneMax = 100;
+
+export const updateRoutineBodyTimezoneRegExp = new RegExp("\\S");
+
+export const UpdateRoutineBody = zod
+ .object({
+ title: zod
+ .string()
+ .max(updateRoutineBodyTitleMax)
+ .optional()
+ .describe(
+ "A new name, at most 100 characters. Empty takes the name away, and the routine is called by what it does.",
+ ),
+ instruction: zod
+ .string()
+ .min(1)
+ .max(updateRoutineBodyInstructionMax)
+ .regex(updateRoutineBodyInstructionRegExp)
+ .optional()
+ .describe(
+ "What the Bot does on each run from now on. At most 2,000 characters.",
+ ),
+ cron: zod
+ .string()
+ .min(1)
+ .max(updateRoutineBodyCronMax)
+ .regex(updateRoutineBodyCronRegExp)
+ .optional()
+ .describe(
+ "A new schedule, as five cron fields: minute, hour, day of month, month, day of week. The same rules as a new routine's.",
+ ),
+ timezone: zod
+ .string()
+ .min(1)
+ .max(updateRoutineBodyTimezoneMax)
+ .regex(updateRoutineBodyTimezoneRegExp)
+ .optional()
+ .describe("A new IANA time zone to read the schedule in."),
+ })
+ .describe(
+ "What to change. Only the fields sent change, and at least one must be sent.",
+ );
+
+export const UpdateRoutineResponse = zod.object({
+ routine: zod
+ .object({
+ id: zod.string().describe("The routine's id."),
+ botId: zod.string().describe("The Bot that carries it out."),
+ schedule: zod.string().describe("When it runs, as text to show."),
+ cron: zod
+ .string()
+ .describe(
+ "The schedule as it is kept, five cron fields: minute, hour, day of month, month, day of week. What a form that changes the schedule starts from.",
+ ),
timezone: zod
.string()
.describe("The IANA time zone the schedule is read in."),
@@ -278,13 +448,7 @@ export const CreateRoutineResponse = zod.object({
.union([
zod.object({
status: zod
- .union([
- zod.literal("succeeded"),
- zod.literal("failed"),
- zod.literal("skipped"),
- zod.literal("waiting"),
- zod.literal(null),
- ])
+ .string()
.nullable()
.describe(
"How it ended, or null while it is still open. Only failed is a failure.",
@@ -531,7 +695,7 @@ export const ListRoutineRunsResponse = zod.object({
.object({
id: zod.string().describe("The run's id."),
status: zod
- .enum(["running", "succeeded", "failed", "skipped", "waiting"])
+ .string()
.describe(
"running until it ends; waiting while it waits on the person, for an approval or an answer.",
),
diff --git a/app/src/lib/api/generated/shared-use/shared-use.zod.ts b/app/src/lib/api/generated/shared-use/shared-use.zod.ts
index b61f017859..b0af4ceaeb 100644
--- a/app/src/lib/api/generated/shared-use/shared-use.zod.ts
+++ b/app/src/lib/api/generated/shared-use/shared-use.zod.ts
@@ -146,7 +146,7 @@ export const ListSharedUseRequestsResponse = zod.object({
),
requestedBy: zod.string().describe("The id of the person who asked."),
status: zod
- .enum(["pending", "approved", "declined", "superseded"])
+ .string()
.describe(
"pending until an administrator answers it. superseded when a later request for the same Bot and app replaced it.",
),
@@ -358,7 +358,7 @@ export const ApproveSharedUseRequestResponse = zod
),
requestedBy: zod.string().describe("The id of the person who asked."),
status: zod
- .enum(["pending", "approved", "declined", "superseded"])
+ .string()
.describe(
"pending until an administrator answers it. superseded when a later request for the same Bot and app replaced it.",
),
@@ -497,7 +497,7 @@ export const DeclineSharedUseRequestResponse = zod
),
requestedBy: zod.string().describe("The id of the person who asked."),
status: zod
- .enum(["pending", "approved", "declined", "superseded"])
+ .string()
.describe(
"pending until an administrator answers it. superseded when a later request for the same Bot and app replaced it.",
),
@@ -712,7 +712,7 @@ export const GetBotSharedUseResponse = zod.object({
),
requestedBy: zod.string().describe("The id of the person who asked."),
status: zod
- .enum(["pending", "approved", "declined", "superseded"])
+ .string()
.describe(
"pending until an administrator answers it. superseded when a later request for the same Bot and app replaced it.",
),
diff --git a/app/src/lib/api/generated/sign-in-requests/sign-in-requests.zod.ts b/app/src/lib/api/generated/sign-in-requests/sign-in-requests.zod.ts
index ad6ccf24a7..0c57da3ae0 100644
--- a/app/src/lib/api/generated/sign-in-requests/sign-in-requests.zod.ts
+++ b/app/src/lib/api/generated/sign-in-requests/sign-in-requests.zod.ts
@@ -79,16 +79,7 @@ export const ListSignInRequestsResponse = zod.object({
.nullable()
.describe("Why the Bot asked, in its own words."),
status: zod
- .enum([
- "pending",
- "filling",
- "code_required",
- "taken_over",
- "signed_in",
- "failed",
- "cancelled",
- "expired",
- ])
+ .string()
.describe(
"Where a sign-in request has got to. code_required: the site took the password and sent a verification code, and the form now asks for only that. signed_in, failed, cancelled and expired are final.",
),
@@ -256,16 +247,7 @@ export const CreateSignInRequestResponse = zod.object({
.nullable()
.describe("Why the Bot asked, in its own words."),
status: zod
- .enum([
- "pending",
- "filling",
- "code_required",
- "taken_over",
- "signed_in",
- "failed",
- "cancelled",
- "expired",
- ])
+ .string()
.describe(
"Where a sign-in request has got to. code_required: the site took the password and sent a verification code, and the form now asks for only that. signed_in, failed, cancelled and expired are final.",
),
@@ -378,16 +360,7 @@ export const GetSignInRequestResponse = zod.object({
.nullable()
.describe("Why the Bot asked, in its own words."),
status: zod
- .enum([
- "pending",
- "filling",
- "code_required",
- "taken_over",
- "signed_in",
- "failed",
- "cancelled",
- "expired",
- ])
+ .string()
.describe(
"Where a sign-in request has got to. code_required: the site took the password and sent a verification code, and the form now asks for only that. signed_in, failed, cancelled and expired are final.",
),
@@ -531,16 +504,7 @@ export const SubmitSignInResponse = zod.object({
.nullable()
.describe("Why the Bot asked, in its own words."),
status: zod
- .enum([
- "pending",
- "filling",
- "code_required",
- "taken_over",
- "signed_in",
- "failed",
- "cancelled",
- "expired",
- ])
+ .string()
.describe(
"Where a sign-in request has got to. code_required: the site took the password and sent a verification code, and the form now asks for only that. signed_in, failed, cancelled and expired are final.",
),
@@ -677,16 +641,7 @@ export const SubmitSignInCodeResponse = zod.object({
.nullable()
.describe("Why the Bot asked, in its own words."),
status: zod
- .enum([
- "pending",
- "filling",
- "code_required",
- "taken_over",
- "signed_in",
- "failed",
- "cancelled",
- "expired",
- ])
+ .string()
.describe(
"Where a sign-in request has got to. code_required: the site took the password and sent a verification code, and the form now asks for only that. signed_in, failed, cancelled and expired are final.",
),
@@ -821,16 +776,7 @@ export const UseSavedLoginResponse = zod.object({
.nullable()
.describe("Why the Bot asked, in its own words."),
status: zod
- .enum([
- "pending",
- "filling",
- "code_required",
- "taken_over",
- "signed_in",
- "failed",
- "cancelled",
- "expired",
- ])
+ .string()
.describe(
"Where a sign-in request has got to. code_required: the site took the password and sent a verification code, and the form now asks for only that. signed_in, failed, cancelled and expired are final.",
),
@@ -955,16 +901,7 @@ export const TakeOverSignInResponse = zod.object({
.nullable()
.describe("Why the Bot asked, in its own words."),
status: zod
- .enum([
- "pending",
- "filling",
- "code_required",
- "taken_over",
- "signed_in",
- "failed",
- "cancelled",
- "expired",
- ])
+ .string()
.describe(
"Where a sign-in request has got to. code_required: the site took the password and sent a verification code, and the form now asks for only that. signed_in, failed, cancelled and expired are final.",
),
@@ -1089,16 +1026,7 @@ export const FinishSignInResponse = zod.object({
.nullable()
.describe("Why the Bot asked, in its own words."),
status: zod
- .enum([
- "pending",
- "filling",
- "code_required",
- "taken_over",
- "signed_in",
- "failed",
- "cancelled",
- "expired",
- ])
+ .string()
.describe(
"Where a sign-in request has got to. code_required: the site took the password and sent a verification code, and the form now asks for only that. signed_in, failed, cancelled and expired are final.",
),
@@ -1223,16 +1151,7 @@ export const CancelSignInResponse = zod.object({
.nullable()
.describe("Why the Bot asked, in its own words."),
status: zod
- .enum([
- "pending",
- "filling",
- "code_required",
- "taken_over",
- "signed_in",
- "failed",
- "cancelled",
- "expired",
- ])
+ .string()
.describe(
"Where a sign-in request has got to. code_required: the site took the password and sent a verification code, and the form now asks for only that. signed_in, failed, cancelled and expired are final.",
),
diff --git a/app/src/lib/api/generated/tasks/tasks.zod.ts b/app/src/lib/api/generated/tasks/tasks.zod.ts
index 912b11532e..d92879bca1 100644
--- a/app/src/lib/api/generated/tasks/tasks.zod.ts
+++ b/app/src/lib/api/generated/tasks/tasks.zod.ts
@@ -100,13 +100,7 @@ export const ListTasksResponse = zod.object({
"The conversation a delegated task was asked for in, where its result is said.",
),
status: zod
- .enum([
- "needs_input",
- "working",
- "resolved",
- "failed",
- "ready_for_review",
- ])
+ .string()
.describe(
"Where a task stands: waiting on the person, being worked on, marked done, failed, or finished and ready to read.",
),
@@ -273,13 +267,7 @@ export const GetTaskResponse = zod.object({
"The conversation a delegated task was asked for in, where its result is said.",
),
status: zod
- .enum([
- "needs_input",
- "working",
- "resolved",
- "failed",
- "ready_for_review",
- ])
+ .string()
.describe(
"Where a task stands: waiting on the person, being worked on, marked done, failed, or finished and ready to read.",
),
@@ -554,13 +542,7 @@ export const ResolveTaskResponse = zod.object({
"The conversation a delegated task was asked for in, where its result is said.",
),
status: zod
- .enum([
- "needs_input",
- "working",
- "resolved",
- "failed",
- "ready_for_review",
- ])
+ .string()
.describe(
"Where a task stands: waiting on the person, being worked on, marked done, failed, or finished and ready to read.",
),
@@ -730,13 +712,7 @@ export const ReopenTaskResponse = zod.object({
"The conversation a delegated task was asked for in, where its result is said.",
),
status: zod
- .enum([
- "needs_input",
- "working",
- "resolved",
- "failed",
- "ready_for_review",
- ])
+ .string()
.describe(
"Where a task stands: waiting on the person, being worked on, marked done, failed, or finished and ready to read.",
),
@@ -906,13 +882,7 @@ export const RetryTaskResponse = zod.object({
"The conversation a delegated task was asked for in, where its result is said.",
),
status: zod
- .enum([
- "needs_input",
- "working",
- "resolved",
- "failed",
- "ready_for_review",
- ])
+ .string()
.describe(
"Where a task stands: waiting on the person, being worked on, marked done, failed, or finished and ready to read.",
),
@@ -1082,13 +1052,7 @@ export const StopTaskResponse = zod.object({
"The conversation a delegated task was asked for in, where its result is said.",
),
status: zod
- .enum([
- "needs_input",
- "working",
- "resolved",
- "failed",
- "ready_for_review",
- ])
+ .string()
.describe(
"Where a task stands: waiting on the person, being worked on, marked done, failed, or finished and ready to read.",
),
diff --git a/app/src/lib/api/generated/teams/teams.zod.ts b/app/src/lib/api/generated/teams/teams.zod.ts
index 618802816c..6e36efd51f 100644
--- a/app/src/lib/api/generated/teams/teams.zod.ts
+++ b/app/src/lib/api/generated/teams/teams.zod.ts
@@ -155,7 +155,9 @@ export const CreateTeamHeader = zod.object({
export const createTeamBodyNameMax = 100;
-export const createTeamBodyNameRegExp = new RegExp("^[^\\x00]*\\S[^\\x00]*$");
+export const createTeamBodyNameRegExp = new RegExp(
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
+);
export const createTeamBodyDescriptionMax = 500;
export const createTeamBodyDescriptionRegExp = new RegExp("^[^\\x00]*$");
@@ -375,7 +377,9 @@ export const UpdateTeamHeader = zod.object({
export const updateTeamBodyNameMax = 100;
-export const updateTeamBodyNameRegExp = new RegExp("^[^\\x00]*\\S[^\\x00]*$");
+export const updateTeamBodyNameRegExp = new RegExp(
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
+);
export const updateTeamBodyDescriptionMax = 500;
export const updateTeamBodyDescriptionRegExp = new RegExp("^[^\\x00]*$");
diff --git a/app/src/lib/api/generated/what-if/what-if.zod.ts b/app/src/lib/api/generated/what-if/what-if.zod.ts
index de3058b799..65d4afd319 100644
--- a/app/src/lib/api/generated/what-if/what-if.zod.ts
+++ b/app/src/lib/api/generated/what-if/what-if.zod.ts
@@ -99,7 +99,7 @@ export const AskWhatIfHeader = zod.object({
export const askWhatIfBodyQuestionMax = 500;
export const askWhatIfBodyQuestionRegExp = new RegExp(
- "^[^\\x00]*\\S[^\\x00]*$",
+ "^[^\\x00]*[^\\s\\x00][^\\x00]*$",
);
export const AskWhatIfBody = zod.object({
diff --git a/app/src/lib/app-access/queries.ts b/app/src/lib/app-access/queries.ts
index 83f2f3bcd0..b52e1b6ae7 100644
--- a/app/src/lib/app-access/queries.ts
+++ b/app/src/lib/app-access/queries.ts
@@ -116,7 +116,8 @@ export type AppAccessRequest = {
appKey: string;
appTitle: string;
kind: AppAccessRequestKind;
- status: "pending" | "approved" | "dismissed" | "cancelled";
+ /** `pending`, `approved`, `dismissed` or `cancelled`. The list can grow. */
+ status: string;
agentId: string | null;
botName: string | null;
requestedBy: string;
diff --git a/app/src/lib/auth/client.ts b/app/src/lib/auth/client.ts
index 90c438cb54..b656e31fef 100644
--- a/app/src/lib/auth/client.ts
+++ b/app/src/lib/auth/client.ts
@@ -1,13 +1,15 @@
import { ssoClient } from "@better-auth/sso/client";
import { createAuthClient } from "better-auth/react";
+import { withClientName } from "@/lib/client";
import type { AuthProviderId } from "./queries";
export const authClient = createAuthClient({
plugins: [ssoClient()],
fetchOptions: {
// The page's fetch at the time of each call, as every other request in the app uses it, rather
- // than the one there was when this module loaded.
- customFetchImpl: (input, init) => fetch(input, init),
+ // than the one there was when this module loaded. Naming this app, as every request does.
+ customFetchImpl: (input, init) =>
+ fetch(input, { ...init, headers: withClientName(init?.headers) }),
},
});
diff --git a/app/src/lib/auth/queries.ts b/app/src/lib/auth/queries.ts
index 38727ca2c6..d007aa72ba 100644
--- a/app/src/lib/auth/queries.ts
+++ b/app/src/lib/auth/queries.ts
@@ -2,6 +2,7 @@ import { type QueryClient, queryOptions } from "@tanstack/react-query";
import type { GetPersonResponse } from "@/lib/api/generated/model";
import { getPerson } from "@/lib/api/generated/people/people";
import { ClientError } from "@/lib/client";
+import { knownRole } from "./roles";
import { readDeployment } from "@/lib/deployment/queries";
import { currentOrganizationId } from "@/lib/organizations/current";
import { ensureCurrentOrganization } from "@/lib/organizations/queries";
@@ -125,7 +126,8 @@ async function currentUser(
name: person.name,
needsName: person.needsName,
image: person.image,
- role: person.role,
+ // A role a newer server names that this app doesn't know is read as a member.
+ role: knownRole(person.role),
onboarding: person.onboarding,
openbotVersion: answer.openbotVersion,
};
diff --git a/app/src/lib/auth/roles.ts b/app/src/lib/auth/roles.ts
index a5802f1c00..d43cfe0c6c 100644
--- a/app/src/lib/auth/roles.ts
+++ b/app/src/lib/auth/roles.ts
@@ -1,3 +1,6 @@
+/** The roles this app knows. A newer server may answer one it doesn't. */
+export type KnownRole = "owner" | "admin" | "member";
+
/**
* Whether a role administers its organization.
*
@@ -9,3 +12,16 @@
export function isOrganizationAdmin(role: string | null | undefined): boolean {
return role === "admin" || role === "owner";
}
+
+/**
+ * A role as the server answered it, read as one this app knows. The list of roles can grow, and a role
+ * this app doesn't know is read as the least it could be: a member.
+ */
+export function knownRole(role: string | null | undefined): KnownRole {
+ return role === "owner" || role === "admin" ? role : "member";
+}
+
+/** Whether a role is one this app knows, and so can name and give. */
+export function isKnownRole(role: string): role is KnownRole {
+ return role === "owner" || role === "admin" || role === "member";
+}
diff --git a/app/src/lib/capability-changes/queries.ts b/app/src/lib/capability-changes/queries.ts
index 46a227fd08..1031cb5066 100644
--- a/app/src/lib/capability-changes/queries.ts
+++ b/app/src/lib/capability-changes/queries.ts
@@ -37,8 +37,11 @@ export type PreviewPerson = {
id: string;
email: string;
name: string | null;
- /** Their role as a member of the organization. */
- role: "owner" | "admin" | "member";
+ /**
+ * Their role as a member of the organization. The list can grow, so it is read with
+ * `isOrganizationAdmin`, which reads a role this app doesn't know as a member's.
+ */
+ role: string;
groups: string[];
/** Each permission the changes touch, before and after. */
capabilities: PreviewCapability[];
diff --git a/app/src/lib/channels/attachments.ts b/app/src/lib/channels/attachments.ts
index 9cadbf9a23..520de80753 100644
--- a/app/src/lib/channels/attachments.ts
+++ b/app/src/lib/channels/attachments.ts
@@ -7,13 +7,21 @@
*/
export {
ACCEPTED_DOCUMENT_MIME,
+ ACCEPTED_FILE_TYPES,
ACCEPTED_IMAGE_MIME,
ACCEPTED_TEXT_MIME,
type AttachmentKind,
+ type AttachmentLimits,
type AttachmentPart,
type AttachmentSource,
+ attachmentLimitsFrom,
attachmentUrl,
classifyAttachment,
+ DEFAULT_ATTACHMENT_LIMITS,
+ documentKindInWords,
+ formatAttachmentLimit,
+ LARGEST_PICTURE_DRAWN_INLINE,
+ largestAttachmentBytes,
MAX_ATTACHMENTS_PER_MESSAGE,
MAX_DOCUMENT_BYTES,
MAX_EXTRACTED_CHARACTERS,
diff --git a/app/src/lib/channels/turn-did-work.ts b/app/src/lib/channels/turn-did-work.ts
new file mode 100644
index 0000000000..5411aefb8d
--- /dev/null
+++ b/app/src/lib/channels/turn-did-work.ts
@@ -0,0 +1,27 @@
+import type { Message } from "@ag-ui/core";
+
+/**
+ * Whether a turn that failed had already done something: said something, or called a tool.
+ *
+ * A failed send puts the person's words back in the box, or back in the queue, so they can send
+ * them again (`deliver` in channel-chat.tsx). That is right for a turn that never got going: a
+ * refused request, a gateway that answered 503. It is wrong for a turn that worked for minutes
+ * first. FOUND IN DOGFOODING: a Bot looked up HubSpot deals for five minutes and then failed, and
+ * the same message came back ready to send. Sent again, the whole request runs from the start and
+ * repeats what already ran, writes included. The message stays sent, the failure is said under the
+ * turn, and the person decides what to ask next.
+ *
+ * `before` is every message the conversation held when the turn began.
+ */
+export function turnDidWork(
+ messages: readonly Message[],
+ before: ReadonlySet,
+): boolean {
+ return messages.some((message) => {
+ if (before.has(message.id)) return false;
+ if (message.role === "tool") return true;
+ if (message.role !== "assistant") return false;
+ if ((message.toolCalls?.length ?? 0) > 0) return true;
+ return typeof message.content === "string" && message.content.trim() !== "";
+ });
+}
diff --git a/app/src/lib/channels/use-channel-events.ts b/app/src/lib/channels/use-channel-events.ts
index b527ab4eb8..692ec814aa 100644
--- a/app/src/lib/channels/use-channel-events.ts
+++ b/app/src/lib/channels/use-channel-events.ts
@@ -5,7 +5,11 @@ import {
} from "@tanstack/react-query";
import { useRouter } from "@tanstack/react-router";
import { useEffect } from "react";
-import { noticeChannelEvent } from "@/lib/notifications/reply-notice";
+import { nudgeMoment } from "@/lib/notices";
+import {
+ isBotReply,
+ noticeChannelEvent,
+} from "@/lib/notifications/reply-notice";
import { apiSocketPath, socketUrl as buildSocketUrl } from "@/lib/socket-url";
import { type BotTask, taskKeys } from "@/lib/tasks/queries";
import { type BotLine, botSaidOffTheList } from "./said-off-the-list";
@@ -523,6 +527,15 @@ export function useChannelEvents() {
refreshTaskCards(queryClient, activity);
+ /*
+ * A turn ended, or a Bot said something: a routine's run or a long task may just have
+ * finished, which is a win a nudge may follow. The preferences are read again a moment
+ * later, once the server has written the run's outcome (`lib/notices.ts`). Nothing is read
+ * where no nudge could come of it.
+ */
+ if (activity.busy === false || isBotReply(activity))
+ nudgeMoment(queryClient, { afterMs: 1500 });
+
if (activity.work !== undefined) {
queryClient.setQueryData(
channelKeys.detail(activity.channelId),
diff --git a/app/src/lib/client-version/refusal.ts b/app/src/lib/client-version/refusal.ts
new file mode 100644
index 0000000000..59ef6a1b92
--- /dev/null
+++ b/app/src/lib/client-version/refusal.ts
@@ -0,0 +1,98 @@
+/**
+ * Whether the OpenBot this page talks to refused it for being too old an app.
+ *
+ * Every request names this app in the `OpenBot-Client` header (`lib/client.ts`). An OpenBot whose
+ * oldest served release of that app is newer than it refuses every request except its `deployment`
+ * with a 400 problem whose code is CLIENT_UPDATE_REQUIRED, naming the app (`client`) and the oldest
+ * release it serves (`minimumVersion`), and `security: true` when that minimum was raised because of a
+ * security problem in older releases. Inside OpenBot Desktop's window the desktop app adds its own
+ * name to the page's header, so there the app named can be OpenBot Desktop rather than this page.
+ *
+ * `lib/client.ts` hands every 400 here before the caller sees it. The first refusal is kept until the
+ * page is loaded again, and the update screen reads it (`components/layout/client-version-gate.tsx`),
+ * so a tab left open across an upgrade shows "Update OpenBot" in place of a screen whose read failed.
+ *
+ * No imports from the app, so the transport can report to it without a cycle.
+ */
+import {
+ CLIENT_KINDS,
+ CLIENT_UPDATE_REQUIRED,
+ type ClientKind,
+ isVersion,
+} from "@openbot/shared/client-version";
+
+/**
+ * The app the OpenBot refused, the oldest release of it that OpenBot serves, and `security` when that
+ * minimum is there for a security problem.
+ */
+export type ClientRefusal = {
+ client: ClientKind;
+ minimumVersion?: string;
+ security?: true;
+};
+
+let refused: ClientRefusal | null = null;
+const listeners = new Set<() => void>();
+
+/** The refusal a problem body is, or null when it is some other answer. */
+export function clientRefusalOf(body: unknown): ClientRefusal | null {
+ if (!body || typeof body !== "object" || Array.isArray(body)) return null;
+ const problem = body as {
+ code?: unknown;
+ client?: unknown;
+ minimumVersion?: unknown;
+ security?: unknown;
+ };
+ if (problem.code !== CLIENT_UPDATE_REQUIRED) return null;
+ // A refusal that names no app we know is still this page's to act on: it is the page that asked.
+ const client = (CLIENT_KINDS as readonly unknown[]).includes(problem.client)
+ ? (problem.client as ClientKind)
+ : "web";
+ return {
+ client,
+ ...(isVersion(problem.minimumVersion)
+ ? { minimumVersion: problem.minimumVersion }
+ : {}),
+ ...(problem.security === true ? { security: true as const } : {}),
+ };
+}
+
+/**
+ * A request was answered 400. Its body is read from a copy, so the caller still reads its own; the
+ * promise settles once it has been, so the caller can fail knowing whether this was the reason.
+ */
+export function noteRefusal(response: Response): Promise {
+ if (response.status !== 400 || refused !== null) return Promise.resolve();
+ const type = response.headers.get("content-type") ?? "";
+ if (!type.includes("json")) return Promise.resolve();
+ return response
+ .clone()
+ .json()
+ .then(
+ (body: unknown) => {
+ const refusal = clientRefusalOf(body);
+ if (refusal === null || refused !== null) return;
+ refused = refusal;
+ for (const listener of listeners) listener();
+ },
+ () => undefined,
+ );
+}
+
+/** For `useSyncExternalStore`. */
+export function subscribeClientRefusal(listener: () => void): () => void {
+ listeners.add(listener);
+ return () => listeners.delete(listener);
+}
+
+/** The refusal this page met, or null while it has met none. */
+export function clientRefusal(): ClientRefusal | null {
+ return refused;
+}
+
+/** Forget the refusal, as loading the page again does. For tests, which share one module. */
+export function forgetClientRefusal(): void {
+ if (refused === null) return;
+ refused = null;
+ for (const listener of listeners) listener();
+}
diff --git a/app/src/lib/client.ts b/app/src/lib/client.ts
index 21e481ce2f..0fcbd820f8 100644
--- a/app/src/lib/client.ts
+++ b/app/src/lib/client.ts
@@ -12,8 +12,47 @@
* guessed the envelope would be a client that had to be argued with.
*/
+import { CLIENT_HEADER, clientToken } from "@openbot/shared/client-version";
+import { noteRefusal } from "@/lib/client-version/refusal";
import { noteAnswer, noteNoAnswer } from "@/lib/desktop/reachability";
+/**
+ * This app as it names itself to its OpenBot: `web/`, the release it was built from
+ * (shared/client-version.ts). The server refuses an app older than the oldest it serves.
+ */
+export const CLIENT_NAME = clientToken("web");
+
+/**
+ * `headers` with this app named in them, in the same shape they were given: a record, a `Headers`,
+ * or a list of pairs. For the few requests the app makes to OpenBot without the client: the
+ * runtime's, sign-in's and finishing a consent. A file's own address is read like a picture's,
+ * which carries no header either, and can be sent on to wherever the file is kept.
+ */
+export function withClientName(
+ headers: Record,
+): Record;
+export function withClientName(headers?: HeadersInit): HeadersInit;
+export function withClientName(headers?: HeadersInit): HeadersInit {
+ const header = CLIENT_HEADER.toLowerCase();
+ if (headers instanceof Headers) {
+ const named = new Headers(headers);
+ named.set(CLIENT_HEADER, CLIENT_NAME);
+ return named;
+ }
+ if (Array.isArray(headers)) {
+ return [
+ ...headers.filter(([name]) => name.toLowerCase() !== header),
+ [CLIENT_HEADER, CLIENT_NAME],
+ ];
+ }
+ const named: Record = {};
+ for (const [name, value] of Object.entries(headers ?? {})) {
+ if (name.toLowerCase() !== header) named[name] = value;
+ }
+ named[CLIENT_HEADER] = CLIENT_NAME;
+ return named;
+}
+
export type ClientOptions = {
/** Absent means GET. */
method?: string;
@@ -41,17 +80,26 @@ export type ClientOptions = {
*
* A 502 is read before it is handed back, so a read failing on the relay's own answer fails with
* the connection already known to be lost, and waits for OpenBot (`connection-lost.ts`).
+ *
+ * Every request names this app ({@link CLIENT_NAME}). A 400 is read before it is handed back too, so
+ * a refusal for being too old an app is known before the request fails, and the update screen shows
+ * in place of whatever failed (`lib/client-version/refusal.ts`).
*/
async function request(path: string, init: RequestInit): Promise {
let response: Response;
try {
- response = await fetch(path, { ...init, credentials: "include" });
+ response = await fetch(path, {
+ ...init,
+ headers: withClientName(init.headers),
+ credentials: "include",
+ });
} catch (error) {
noteNoAnswer(error);
throw error;
}
const noted = noteAnswer(response);
if (response.status === 502) await noted;
+ if (response.status === 400) await noteRefusal(response);
return response;
}
diff --git a/app/src/lib/computers/activity.ts b/app/src/lib/computers/activity.ts
index 5bdc040d5d..0ff8836c1c 100644
--- a/app/src/lib/computers/activity.ts
+++ b/app/src/lib/computers/activity.ts
@@ -16,6 +16,7 @@ import {
} from "@/lib/approvals";
import type { ToolOutcome } from "./call";
import { followView, latestView } from "./panel-view";
+import { fileSize, sentFileOf } from "./sent-file";
/**
* What a Bot has been doing on its computer: the pages it opened and acted on, the commands it ran,
@@ -62,7 +63,13 @@ export type ComputerActivity = {
* when: the time the page read it would be a guess drawn as a fact.
*/
at?: number;
- kind: "command" | "read_file" | "write_file" | "list_files" | "browser";
+ kind:
+ | "command"
+ | "read_file"
+ | "write_file"
+ | "list_files"
+ | "send_file"
+ | "browser";
/**
* For a browser step, which one it was (`computer_navigate`, `computer_click` and so on). The pane
* names it as the transcript does (`ownToolLabel` in `shared/tool-name.ts`).
@@ -448,12 +455,13 @@ export function activityFor(computerId: string): ComputerActivity[] {
return byComputer.get(computerId) ?? NONE;
}
-/** The four calls that act on the computer behind the screen, and what the pane calls each. */
+/** The calls that act on the computer behind the screen, and what the pane calls each. */
const KINDS: Record = {
computer_run_command: "command",
computer_read_file: "read_file",
computer_write_file: "write_file",
computer_list_files: "list_files",
+ computer_send_file: "send_file",
};
/**
@@ -860,6 +868,23 @@ export function detailsOf(
: {}),
...notTheBot,
};
+ if (kind === "send_file") {
+ const sent = sentFileOf(result);
+ return {
+ kind,
+ subject: path,
+ output: sent
+ ? `${sent.name}, ${fileSize(sent.sizeBytes)}`
+ : outputOf(result),
+ // Not sent: the line must not say "Sent" about a file nobody received.
+ ...(result.ok === false &&
+ result.refused !== true &&
+ result.doneByPerson !== true
+ ? { failed: true }
+ : {}),
+ ...notTheBot,
+ };
+ }
return {
kind,
subject: kind === "list_files" ? path || "the workspace" : path,
diff --git a/app/src/lib/computers/panel-view.ts b/app/src/lib/computers/panel-view.ts
index 4f9e2cb7d8..729cb37cc8 100644
--- a/app/src/lib/computers/panel-view.ts
+++ b/app/src/lib/computers/panel-view.ts
@@ -22,6 +22,7 @@ const OFF_SCREEN = new Set([
"computer_read_file",
"computer_write_file",
"computer_list_files",
+ "computer_send_file",
]);
/** The view a computer tool works in, or nothing for a tool that is not the computer's or shows neither. */
diff --git a/app/src/lib/computers/queries.ts b/app/src/lib/computers/queries.ts
index c3278a5377..f3bce2bda6 100644
--- a/app/src/lib/computers/queries.ts
+++ b/app/src/lib/computers/queries.ts
@@ -71,7 +71,11 @@ export type ComputerState = "absent" | "starting" | "ready" | "unreachable";
export type ComputerStatus = {
botId: string;
- state: ComputerState;
+ /**
+ * One of `ComputerState`, or a state a newer server sends that this app doesn't know: the screen
+ * then neither starts the computer nor calls it asleep, and waits for a frame.
+ */
+ state: string;
/** Set when `state` is `unreachable`. Written for an admin, so not shown on a screen anybody can open. */
reason?: string;
};
diff --git a/app/src/lib/computers/sent-file.ts b/app/src/lib/computers/sent-file.ts
new file mode 100644
index 0000000000..038d5a87b4
--- /dev/null
+++ b/app/src/lib/computers/sent-file.ts
@@ -0,0 +1,63 @@
+import { acceptedFileTypeOf } from "@openbot/shared/attachments";
+
+/**
+ * A file a Bot sent from its computer into the conversation, as its tool call's answer carries it.
+ *
+ * `computer_send_file` answers `{ ok: true, file: { attachmentId, name, mimeType, sizeBytes, url } }`.
+ * The server stored the file as an attachment of the conversation, so the card reads everything it
+ * draws from this answer: a reopened conversation shows the same card from the stored answer alone,
+ * and every member of the conversation reads the file from the same address.
+ */
+export type SentFile = {
+ attachmentId: string;
+ name: string;
+ /** The type the server found in the bytes, which it serves the file as. */
+ mimeType: string;
+ sizeBytes: number;
+ /** The stored form every message uses, `/api/attachments/`. */
+ url: string;
+};
+
+/** The file in a `computer_send_file` answer, or null when the answer carries none. */
+export function sentFileOf(answer: unknown): SentFile | null {
+ if (!answer || typeof answer !== "object") return null;
+ const { ok, file } = answer as { ok?: unknown; file?: unknown };
+ if (ok !== true || !file || typeof file !== "object") return null;
+ const { attachmentId, name, mimeType, sizeBytes, url } = file as Record<
+ string,
+ unknown
+ >;
+ if (
+ typeof attachmentId !== "string" ||
+ !attachmentId ||
+ typeof name !== "string" ||
+ typeof mimeType !== "string" ||
+ typeof sizeBytes !== "number" ||
+ !Number.isFinite(sizeBytes) ||
+ typeof url !== "string"
+ )
+ return null;
+ return { attachmentId, name, mimeType, sizeBytes, url };
+}
+
+/** A size as a person reads it: 820 bytes, 14 KB, 2.3 MB. */
+export function fileSize(bytes: number): string {
+ if (bytes < 1024) return `${bytes} ${bytes === 1 ? "byte" : "bytes"}`;
+ const kilobytes = bytes / 1024;
+ if (kilobytes < 1024) return `${Math.round(kilobytes)} KB`;
+ const megabytes = kilobytes / 1024;
+ return `${megabytes < 10 ? megabytes.toFixed(1) : Math.round(megabytes)} MB`;
+}
+
+/**
+ * What the card calls a file's kind, from the type the server found and the names in the one list
+ * of files OpenBot takes (`ACCEPTED_FILE_TYPES`): "PNG image", "PDF", "CSV". Plain text has no
+ * better name than its extension, so it reads as "LOG file" or "Text file".
+ */
+export function kindLabel(mimeType: string, name: string): string {
+ const type = acceptedFileTypeOf(mimeType);
+ if (type?.kind === "image") return `${type.name} image`;
+ if (type && type.mimeType !== "text/plain") return type.name;
+ const dot = name.lastIndexOf(".");
+ return dot > 0 ? `${name.slice(dot + 1).toUpperCase()} file` : "Text file";
+}
diff --git a/app/src/lib/copilot/approval-tools.tsx b/app/src/lib/copilot/approval-tools.tsx
index 0b82f4a32d..c0fdf30994 100644
--- a/app/src/lib/copilot/approval-tools.tsx
+++ b/app/src/lib/copilot/approval-tools.tsx
@@ -4,6 +4,7 @@ import {
useFrontendTool as useSDKFrontendTool,
} from "@copilotkit/react-core/v2";
import { withFinishedAt } from "@openbot/shared/computer-control";
+import { SEND_FILE_TOOL } from "@openbot/shared/send-file";
import { type QueryClient, useQueryClient } from "@tanstack/react-query";
import type { ReactNode } from "react";
import { InlineApproval } from "@/components/approvals/inline-approval";
@@ -37,6 +38,8 @@ const writes = new Set([
"computer_key",
"computer_run_command",
"computer_write_file",
+ // Not a change, and still through the gate: the server needs the conversation to put the file in.
+ SEND_FILE_TOOL,
]);
/**
diff --git a/app/src/lib/copilot/computer-tools.tsx b/app/src/lib/copilot/computer-tools.tsx
index 0cf6433b1b..c148a42c36 100644
--- a/app/src/lib/copilot/computer-tools.tsx
+++ b/app/src/lib/copilot/computer-tools.tsx
@@ -1,6 +1,12 @@
import { outcomeForPerson } from "@openbot/shared/approval-outcomes";
import { SECRET_FIELD_BY_REF } from "@openbot/shared/computer-control";
+import {
+ SEND_FILE_NO_CONVERSATION,
+ SEND_FILE_TOOL,
+ SEND_FILE_TOOL_DESCRIPTION,
+} from "@openbot/shared/send-file";
import { z } from "zod";
+import { SentFileCard } from "@/components/channels/sent-file-card";
import { ToolLine } from "@/components/channels/tool-line";
import { ComputerView } from "@/components/computer/computer-view";
import { HelpRequestCard } from "@/components/computer/help-request-card";
@@ -19,6 +25,7 @@ import {
runNavigation,
} from "@/lib/computers/handoff";
import { secretAnswer, secretRequestOver } from "@/lib/computers/secret";
+import { sentFileOf } from "@/lib/computers/sent-file";
import {
type ToolCallContext,
useActiveBotHolder,
@@ -184,6 +191,16 @@ function refusedDetail(target: string | undefined, outcome: ComputerOutcome) {
return [target, reason].filter(Boolean).join(" · ");
}
+/**
+ * A file that was not sent: the server's sentence already names the file ("budget.xlsx can't be
+ * sent. ..."), so the line leads with it rather than saying the name twice in a narrow column.
+ */
+function sendRefusedDetail(path: string | undefined, outcome: ComputerOutcome) {
+ const reason = outcomeForPerson(String(outcome.reason ?? ""));
+ const name = path?.split("/").pop();
+ return name && reason.includes(name) ? reason : refusedDetail(path, outcome);
+}
+
/** Whether a result is an ordinary failure rather than a refusal, so the two can render differently. */
function didNotWork(outcome: ComputerOutcome): boolean {
return (
@@ -326,6 +343,7 @@ const OFFERED: Readonly> = {
computer_read_file: offeredComputer,
computer_run_command: offeredComputer,
computer_write_file: offeredComputer,
+ [SEND_FILE_TOOL]: offeredComputer,
computer_scroll: offeredBrowser,
};
@@ -943,6 +961,50 @@ export function ComputerTools() {
},
});
+ useFrontendTool({
+ name: SEND_FILE_TOOL,
+ description: SEND_FILE_TOOL_DESCRIPTION,
+ parameters: z.object({
+ path: z
+ .string()
+ .describe(
+ "Path of the file relative to your workspace, such as reports/august.pdf",
+ ),
+ }),
+ /*
+ * NEVER CALLED IN A CONVERSATION. Sending a file is in the approval wrapper's `writes`, so it
+ * always goes to the server's gate with the conversation: the server pulls the file through the
+ * governed download, stores it in this conversation and answers with it. This answers only a
+ * surface with no conversation to send a file into.
+ */
+ handler: async () => ({ ok: false, reason: SEND_FILE_NO_CONVERSATION }),
+ render: ({ args, result, status }) => {
+ const sent = sentFileOf(readOutcome(result));
+ if (sent) return ;
+ const outcome = outcomeOf(result);
+ const path = typeof args?.path === "string" ? args.path : undefined;
+ const finished = status === "complete" || result !== undefined;
+ return (
+
+ );
+ },
+ });
+
useFrontendTool({
name: "computer_scroll",
description:
diff --git a/app/src/lib/copilot/provider.tsx b/app/src/lib/copilot/provider.tsx
index 91b1533755..8e0b797814 100644
--- a/app/src/lib/copilot/provider.tsx
+++ b/app/src/lib/copilot/provider.tsx
@@ -5,6 +5,7 @@ import {
} from "@openbot/shared/person-time-zone";
import { useQuery } from "@tanstack/react-query";
import { type ReactNode, useMemo } from "react";
+import { withClientName } from "@/lib/client";
import { deploymentCapabilitiesQueryOptions } from "@/lib/deployment/queries";
import {
organizationHeaders,
@@ -50,8 +51,9 @@ export function CopilotProvider({ children }: { children: ReactNode }) {
* it in the one named, when the person is a member of it.
*/
const organization = useCurrentOrganizationId();
+ // And this app, as every request to OpenBot names it (lib/client.ts).
const headers = useMemo(
- () => organizationHeaders(organization),
+ () => withClientName(organizationHeaders(organization)),
[organization],
);
diff --git a/app/src/lib/deployment/queries.ts b/app/src/lib/deployment/queries.ts
index e51ba0fcf2..f8a35f8a60 100644
--- a/app/src/lib/deployment/queries.ts
+++ b/app/src/lib/deployment/queries.ts
@@ -1,12 +1,24 @@
+import {
+ type ClientKind,
+ type Compatibility,
+ compatibility,
+ RELEASE,
+} from "@openbot/shared/client-version";
import {
type QueryClient,
queryOptions,
useQuery,
} from "@tanstack/react-query";
+import { useMemo } from "react";
import type { Deployment } from "@/lib/api/generated/model";
import { getDeployment } from "@/lib/api/generated/organization-settings/organization-settings";
import { listOrganizations } from "@/lib/api/generated/organizations/organizations";
import { DEPLOYMENT_ORGANIZATION } from "@/lib/api/request";
+import {
+ type AttachmentLimits,
+ attachmentLimitsFrom,
+ DEFAULT_ATTACHMENT_LIMITS,
+} from "@/lib/channels/attachments";
import { ClientError } from "@/lib/client";
import { currentOrganizationId } from "@/lib/organizations/current";
@@ -97,11 +109,111 @@ export async function readDeployment(options: {
}
}
+/** An app as `compatibility` reads it: its kind, its release, and the API versions it speaks. */
+export type CompatibleApp = {
+ kind: ClientKind;
+ version: string;
+ speaks?: readonly string[];
+};
+
+/** This app: the web app, the release it was built from, speaking this release's API versions. */
+export const THIS_APP: CompatibleApp = { kind: "web", version: RELEASE };
+
export const deploymentKeys = {
all: ["deployment"] as const,
capabilities: () => ["deployment", "capabilities"] as const,
+ attachmentLimits: () => ["deployment", "attachment-limits"] as const,
+ compatibility: (app: CompatibleApp) =>
+ [
+ "deployment",
+ "compatibility",
+ { kind: app.kind, version: app.version, speaks: app.speaks ?? null },
+ ] as const,
+};
+
+/**
+ * Whether this app and the OpenBot it talks to can work together, as that OpenBot's `deployment`
+ * says: the API versions it serves and the oldest release of each app it serves
+ * (`compatibility` in shared/client-version.ts, which every OpenBot app decides by).
+ *
+ * `deployment` is the one read an OpenBot never refuses for the app's version, so this is how a page
+ * finds out before anything else fails. Read again every so often and when the tab is looked at
+ * again, like the attachment limits, because the OpenBot can be upgraded while the tab stays open.
+ * Not answered (an OpenBot from before the v2 API, or one that failed to answer) is not a verdict:
+ * the screens say their own failures as they always did.
+ *
+ * `app` is this app; a test names another to see the other verdicts drawn.
+ */
+export function deploymentCompatibilityQueryOptions(
+ app: CompatibleApp = THIS_APP,
+) {
+ return queryOptions({
+ queryKey: deploymentKeys.compatibility(app),
+ staleTime: 60_000,
+ refetchOnWindowFocus: true,
+ queryFn: async ({ signal }): Promise =>
+ compatibility(
+ await readDeployment({
+ signal,
+ fallback: "Couldn't load which apps OpenBot serves.",
+ }),
+ app,
+ ),
+ });
+}
+
+/**
+ * How large an attached file may be, as this server says, read again every so often.
+ *
+ * NOT ON {@link deploymentCapabilitiesQueryOptions}, BECAUSE THESE CAN CHANGE WHILE THE SERVER RUNS.
+ * Everything there is fixed until the process restarts, so it is read once. These are not: a server
+ * can start taking larger files once the whole deployment has been upgraded, with no restart of the
+ * one this tab talks to. Read once, a tab left open across that would refuse a file the server now
+ * takes, naming a limit that is no longer true. So they are their own query, stale after a minute,
+ * read again when the tab is looked at again, and after any upload is refused.
+ *
+ * Absent reads as today's 8MB and 1MB (`attachmentLimitsFrom`): an older server publishes nothing
+ * and takes exactly those, so assuming more would pass files it then refuses.
+ */
+export function attachmentLimitsQueryOptions() {
+ return queryOptions({
+ queryKey: deploymentKeys.attachmentLimits(),
+ staleTime: 60_000,
+ refetchOnWindowFocus: true,
+ queryFn: async ({ signal }): Promise => {
+ const body = await readDeployment({
+ signal,
+ fallback: "Couldn't load how large a file may be.",
+ });
+ return attachmentLimitsFrom(body.attachmentLimits);
+ },
+ });
+}
+
+/** The limits a composer screens a pick against, and how it asks for them again. */
+export type ComposerAttachmentLimits = {
+ limits: AttachmentLimits;
+ /** Read the limits again, as after a refusal: the refusal may be the first sign they changed. */
+ refresh: () => void;
};
+/**
+ * {@link attachmentLimitsQueryOptions} for a screen with a composer: the server's limits, and the
+ * defaults while they load or when they could not be read. The defaults are the safe side, the
+ * smallest any server takes.
+ */
+export function useAttachmentLimits(): ComposerAttachmentLimits {
+ const query = useQuery(attachmentLimitsQueryOptions());
+ const { refetch } = query;
+ return useMemo(
+ () => ({
+ limits: query.data ?? DEFAULT_ATTACHMENT_LIMITS,
+ refresh: () => void refetch(),
+ }),
+ [query.data, refetch],
+ );
+}
+
/**
* What this deployment can do.
*
diff --git a/app/src/lib/desktop/speech.ts b/app/src/lib/desktop/speech.ts
index 2d212cc7d3..8daf3b0d93 100644
--- a/app/src/lib/desktop/speech.ts
+++ b/app/src/lib/desktop/speech.ts
@@ -64,6 +64,8 @@ export function desktopRecognition(shell: ShellIpc): RecognitionConstructor {
}
lang = "";
+ /** Languages the recognizer turned down before `lang` was chosen, for the desktop's speech.log. */
+ refused: string[] = [];
continuous = false;
interimResults = false;
maxAlternatives = 1;
@@ -93,6 +95,7 @@ export function desktopRecognition(shell: ShellIpc): RecognitionConstructor {
this.#session = shell
.invoke(`${PLUGIN}|speech_start`, {
language: this.lang,
+ ...(this.refused.length > 0 ? { refused: this.refused } : {}),
onEvent: `__CHANNEL__:${this.#callback}`,
})
.then(
diff --git a/app/src/lib/dictation/live.ts b/app/src/lib/dictation/live.ts
index 90fc92f8e5..90f87fe458 100644
--- a/app/src/lib/dictation/live.ts
+++ b/app/src/lib/dictation/live.ts
@@ -78,6 +78,110 @@ export const STOP_GRACE_MS = 2_000;
const PERMISSION_POLL_MS = 500;
const PERMISSION_WAIT_MS = 120_000;
+/** The most languages dictation asks the desktop app about before it gives up. */
+export const MOST_LANGUAGES = 10;
+
+/**
+ * Regions besides a language's likely one where it is commonly dictated. A Mac whose recognizer has no
+ * English (United Kingdom) on the device often has English (United States), and the person's
+ * Dictation may have it turned on.
+ */
+const COMMON_REGIONS: Record = {
+ en: ["US", "GB"],
+ es: ["ES", "MX"],
+ fr: ["FR", "CA"],
+ pt: ["BR", "PT"],
+ zh: ["CN", "TW"],
+};
+
+/** `tag` as a well-formed BCP 47 tag ("en_gb" is "en-GB"), or null when it is not one. */
+function canonicalTag(tag: string): string | null {
+ try {
+ return Intl.getCanonicalLocales(tag.trim().replace(/_/g, "-"))[0] ?? null;
+ } catch {
+ return null;
+ }
+}
+
+/**
+ * The languages to dictate in, best first: the page's language, then each language the person
+ * prefers, then for each of their base languages its likely region, its other common regions and
+ * the bare language ("en-GB" brings "en-US" and "en"). No repeats, and never more than
+ * `MOST_LANGUAGES`. The desktop app takes the first its recognizer has on the device.
+ */
+export function dictationLanguages(
+ primary: string | undefined,
+ preferred: readonly string[] = [],
+): string[] {
+ const asked = [primary ?? "", ...preferred]
+ .map(canonicalTag)
+ .filter((tag): tag is string => tag !== null);
+ const bases = [
+ ...new Set(asked.map((tag) => (tag.split("-")[0] ?? tag).toLowerCase())),
+ ];
+ const regional = bases.flatMap((base) => {
+ let likely: string | undefined;
+ try {
+ likely = new Intl.Locale(base).maximize().region;
+ } catch {
+ likely = undefined;
+ }
+ const regions = [
+ ...(likely ? [likely] : []),
+ ...(COMMON_REGIONS[base] ?? []),
+ ];
+ return [...regions.map((region) => `${base}-${region}`), base];
+ });
+ const seen = new Set();
+ const languages: string[] = [];
+ for (const tag of [...asked, ...regional]) {
+ const key = tag.toLowerCase();
+ if (seen.has(key)) continue;
+ seen.add(key);
+ languages.push(tag);
+ }
+ return (languages.length > 0 ? languages : ["en-US"]).slice(
+ 0,
+ MOST_LANGUAGES,
+ );
+}
+
+/**
+ * A language as a person reads it: "English (United Kingdom)" for "en-GB", or the tag itself. Built
+ * from the language's and the region's names, the same in every engine (WebKit's standard name for
+ * en-GB is "English (UK)").
+ */
+export function languageName(tag: string): string {
+ try {
+ const locale = new Intl.Locale(tag);
+ const language =
+ new Intl.DisplayNames(["en"], { type: "language" }).of(locale.language) ??
+ locale.language;
+ const region = locale.region
+ ? new Intl.DisplayNames(["en"], { type: "region" }).of(locale.region)
+ : undefined;
+ return region ? `${language} (${region})` : language;
+ } catch {
+ return tag;
+ }
+}
+
+/** What to tell the person when nothing here can take dictation in `language`, and where to add it. */
+export function languageProblem(
+ platform: LivePlatform,
+ language: string,
+): string {
+ const name = language ? languageName(language) : "your language";
+ switch (platform) {
+ case "mac":
+ return `This Mac can't take dictation in ${name}. Turn on Dictation and add the language in System Settings, under Keyboard, then try again.`;
+ case "windows":
+ return `This computer can't take dictation in ${name}. Add the language in Settings, under Time & language > Speech, then try again.`;
+ default:
+ return `This browser can't take dictation in ${name}.`;
+ }
+}
+
/** The transcript so far: every phrase in order, final or not, joined by single spaces. */
export function transcriptOf(event: RecognitionResultEvent): string {
const words: string[] = [];
@@ -88,10 +192,14 @@ export function transcriptOf(event: RecognitionResultEvent): string {
return words.join(" ");
}
-/** What to tell the person when recognition fails, or null when the failure is not one (no speech, aborted). */
+/**
+ * What to tell the person when recognition fails, or null when the failure is not one (no speech,
+ * aborted). `language` is the one listening was in.
+ */
export function liveProblem(
error: string,
platform: LivePlatform,
+ language = "",
): string | null {
switch (error) {
case "no-speech":
@@ -108,9 +216,7 @@ export function liveProblem(
case "network":
return "Dictation in this browser needs an internet connection. Check your connection, then try again.";
case "language-not-supported":
- return platform === "browser"
- ? "This browser can't take dictation in your language."
- : "This computer can't take dictation in your language.";
+ return languageProblem(platform, language);
case "service-not-allowed":
return platform === "browser"
? "This browser won't run speech recognition for OpenBot. Try Chrome or Edge."
@@ -138,7 +244,8 @@ export class LiveDictation {
constructor(
private readonly deps: {
source: () => LiveSource | null;
- language: () => string;
+ /** The languages to dictate in, best first (`dictationLanguages`). */
+ languages: () => string[];
/** Listening is about to begin: the box as it is now is what the words are added to. */
onStart: () => void;
/** The whole transcript so far, each time it changes. */
@@ -174,13 +281,19 @@ export class LiveDictation {
if (!source) return;
this.release();
const generation = this.generation;
- const language = this.deps.language();
+ const languages = this.deps.languages();
+ let language = languages[0] ?? "en-US";
+ let refused: string[] = [];
if (source.platform !== "browser") {
- const ready = await this.permission(source, language, generation);
- if (!ready || generation !== this.generation) return;
+ const chosen = await this.choose(source, languages, generation);
+ if (!chosen || generation !== this.generation) return;
+ ({ language, refused } = chosen);
}
const recognition = new source.Recognition();
recognition.lang = language;
+ // The desktop app notes the languages its recognizer turned down, so speech.log shows the fallback.
+ if (source.platform !== "browser")
+ (recognition as Recognition & { refused?: string[] }).refused = refused;
recognition.continuous = true;
recognition.interimResults = true;
recognition.maxAlternatives = 1;
@@ -191,7 +304,7 @@ export class LiveDictation {
};
recognition.onerror = ({ error }) => {
if (generation !== this.generation) return;
- problem = liveProblem(error, source.platform) ?? problem;
+ problem = liveProblem(error, source.platform, language) ?? problem;
};
recognition.onend = () => {
if (generation !== this.generation) return;
@@ -248,52 +361,67 @@ export class LiveDictation {
}
/**
- * The desktop app's answer for the language. The first time, it puts the system's microphone and
- * speech recognition questions to the person and answers `downloading` until they have answered.
+ * The first of `languages` the desktop app's recognizer has on the device, and the ones it turned
+ * down before it. A language it answers `unavailable` for moves on to the next. The first time, it
+ * puts the system's microphone and speech recognition questions to the person and answers
+ * `downloading` until they have answered, which is waited out. Null, with the problem shown, when
+ * none will do.
*/
- private async permission(
+ private async choose(
source: LiveSource,
- language: string,
+ languages: string[],
generation: number,
- ): Promise {
+ ): Promise<{ language: string; refused: string[] } | null> {
+ const first = languages[0] ?? "en-US";
const available = (
source.Recognition as unknown as { available?: Availability }
).available;
- if (typeof available !== "function") return true;
+ if (typeof available !== "function")
+ return { language: first, refused: [] };
const wait =
this.deps.wait ??
((ms: number) => new Promise((resolve) => setTimeout(resolve, ms)));
const asked = Date.now();
- for (;;) {
- let answer: unknown;
- try {
- answer = await available({ langs: [language], processLocally: true });
- } catch {
- answer = "unsupported";
- }
- if (generation !== this.generation) return false;
- if (answer === "available") return true;
- if (answer !== "downloading") {
- this.update({
- phase: "error",
- error:
- answer === "unavailable"
- ? "This computer can't take dictation in your language."
- : "Dictation isn't available on this computer.",
- });
- return false;
- }
- if (Date.now() - asked > PERMISSION_WAIT_MS) {
- this.update({
- phase: "error",
- error:
- "OpenBot is still waiting for permission. Answer the system's question, then try again.",
- });
- return false;
+ const refused: string[] = [];
+ for (const language of languages.slice(0, MOST_LANGUAGES)) {
+ for (;;) {
+ let answer: unknown;
+ try {
+ answer = await available({ langs: [language], processLocally: true });
+ } catch {
+ answer = "unsupported";
+ }
+ if (generation !== this.generation) return null;
+ if (answer === "available") return { language, refused };
+ if (answer === "unavailable") {
+ refused.push(language);
+ break;
+ }
+ if (answer !== "downloading") {
+ this.update({
+ phase: "error",
+ error: "Dictation isn't available on this computer.",
+ });
+ return null;
+ }
+ if (Date.now() - asked > PERMISSION_WAIT_MS) {
+ this.update({
+ phase: "error",
+ error:
+ "OpenBot is still waiting for permission. Answer the system's question, then try again.",
+ });
+ return null;
+ }
+ if (this.state.phase !== "preparing")
+ this.update({ phase: "preparing" });
+ await wait(PERMISSION_POLL_MS);
+ if (generation !== this.generation) return null;
}
- if (this.state.phase !== "preparing") this.update({ phase: "preparing" });
- await wait(PERMISSION_POLL_MS);
- if (generation !== this.generation) return false;
}
+ this.update({
+ phase: "error",
+ error: languageProblem(source.platform, first),
+ });
+ return null;
}
}
diff --git a/app/src/lib/enterprise/queries.ts b/app/src/lib/enterprise/queries.ts
index c28ce41323..09790b5f27 100644
--- a/app/src/lib/enterprise/queries.ts
+++ b/app/src/lib/enterprise/queries.ts
@@ -12,7 +12,8 @@ import type {
CheckInUsage,
EgressRule as EgressRuleEntry,
NetworkMode as NetworkModeName,
- NetworkPolicyScopeKind,
+ NetworkPolicyCandidateScopeKind,
+ OrganizationSettingsContextComputerMode,
} from "@/lib/api/generated/model";
import {
listNetworkPolicies,
@@ -44,12 +45,30 @@ export type EgressRule = EgressRuleEntry;
export type NetworkMode = NetworkModeName;
-/** Whose a network policy is: the organization's, a team's (by id), or a directory group's (by name). */
-export type NetworkScopeKind = NetworkPolicyScopeKind;
+/**
+ * Whose a network policy is: the organization's, a team's (by id), or a directory group's (by name).
+ * The kinds this app knows and sends, as the API takes them in a request.
+ */
+export type NetworkScopeKind = NetworkPolicyCandidateScopeKind;
-/** One network policy: the API's `NetworkPolicy`, without its address. */
+/**
+ * One network policy: the API's `NetworkPolicy`, without its address. Its `scopeKind` is as the
+ * server answered it, and the list can grow: a policy of a kind this app doesn't know is neither
+ * listed nor sent back (`knownNetworkScope`).
+ */
export type NetworkPolicy = Omit;
+/** Whether a policy is of a kind this app knows, and so can list, open and save. */
+export function knownNetworkScope(
+ policy: T,
+): policy is T & { scopeKind: NetworkScopeKind } {
+ return (
+ policy.scopeKind === "organization" ||
+ policy.scopeKind === "team" ||
+ policy.scopeKind === "group"
+ );
+}
+
export type EnterpriseSettings = {
ssoRequired: boolean;
actionRecording: boolean;
@@ -151,8 +170,28 @@ export const enterpriseKeys = {
/* Under the root, so saving a policy, which changes the one in force, asks the replay again. */
networkReplay: (candidate: NetworkCandidate) =>
["enterprise", "network-replay", candidate] as const,
+ computerMode: () => ["enterprise", "computer-mode"] as const,
};
+/**
+ * How Bots get computers here: the settings' read-only `computerMode`. Null from a server that
+ * predates it, which the screens read as nothing to say.
+ */
+export type ComputerMode = NonNullable;
+
+export function computerModeQueryOptions() {
+ return queryOptions({
+ queryKey: enterpriseKeys.computerMode(),
+ queryFn: async ({ signal }): Promise =>
+ (
+ await getOrganizationSettings(organizationId(), {
+ signal,
+ fallback: OVERVIEW_FALLBACK,
+ })
+ ).context.computerMode ?? null,
+ });
+}
+
/** A network policy as the dialog holds it, not yet saved. */
export type NetworkCandidate = {
scopeKind: NetworkScopeKind;
diff --git a/app/src/lib/groups.ts b/app/src/lib/groups.ts
index 6804dc41dc..2acd4de151 100644
--- a/app/src/lib/groups.ts
+++ b/app/src/lib/groups.ts
@@ -15,12 +15,14 @@ import type {
ConversationMember,
ConversationMessage,
} from "@/lib/api/generated/model";
+import { attachmentUrl as storedAttachmentUrl } from "@openbot/shared/attachments";
import { idempotencyKey, organizationId } from "@/lib/api/request";
import {
type AgentChannel,
channelKeys,
channelOf,
} from "@/lib/channels/queries";
+import type { SentFile } from "@/lib/computers/sent-file";
/** A key for one write, so a retry of it is recognised as the same write. */
const once = () => ({ "Idempotency-Key": idempotencyKey() });
@@ -59,10 +61,22 @@ function groupMessageOf(
status: message.status,
createdAt: message.createdAt ?? "",
...(message.reason === undefined ? {} : { reason: message.reason }),
+ ...(message.declined ? { declined: true } : {}),
...(message.answeredBy === undefined
? {}
: { answeredBy: message.answeredBy }),
...(message.consent === undefined ? {} : { consent: message.consent }),
+ ...(message.files?.length
+ ? {
+ files: message.files.map((file) => ({
+ attachmentId: file.id,
+ name: file.name,
+ mimeType: file.mimeType,
+ sizeBytes: file.sizeBytes,
+ url: storedAttachmentUrl(file.id),
+ })),
+ }
+ : {}),
};
}
@@ -74,14 +88,22 @@ export type GroupMessage = {
ownerUserId: string;
agentId: string | null;
text: string;
- status: "queued" | "running" | "waiting" | "completed" | "failed";
+ /**
+ * `queued`, `running`, `waiting`, `completed` or `failed`. The list can grow: a status this app
+ * doesn't know draws the line as a plain reply.
+ */
+ status: string;
createdAt: string;
- /** Why a waiting Bot is waiting, when it is. */
+ /** Why a waiting Bot is waiting, when it is, in words for the person reading. */
reason?: string;
+ /** A failed reply its person chose not to share: a choice, drawn as a notice and not an error. */
+ declined?: true;
/** For an answer relayed from another Bot through `message_bot`: which Bot answered. */
answeredBy?: string;
/** A Team Bot asking the person whose turn it was to use their own account. */
consent?: { botId: string; serverId: string };
+ /** The files a Bot sent from its computer with this reply, each drawn as its card. */
+ files?: SentFile[];
};
export type GroupPerson = {
userId: string;
diff --git a/app/src/lib/identity/queries.ts b/app/src/lib/identity/queries.ts
index 7da479efbb..d76b77c76e 100644
--- a/app/src/lib/identity/queries.ts
+++ b/app/src/lib/identity/queries.ts
@@ -11,7 +11,11 @@ export type LinkedAccount = {
provider: "slack" | "github";
title: string;
handle: string | null;
- status: "active" | "needs_reconnect";
+ /**
+ * `active` or `needs_reconnect`. The list can grow: a status this app doesn't know is read as
+ * nothing to fix.
+ */
+ status: string;
createdAt: string;
};
diff --git a/app/src/lib/markdown.tsx b/app/src/lib/markdown.tsx
index 8c39a65376..28e23ec745 100644
--- a/app/src/lib/markdown.tsx
+++ b/app/src/lib/markdown.tsx
@@ -19,6 +19,8 @@ import {
Streamdown,
type StreamdownProps,
} from "streamdown";
+import { attachmentUrl as storedAttachmentUrl } from "@openbot/shared/attachments";
+import { attachmentAddress } from "@/lib/channels/attachments";
import { hasMaths, withMathDelimiters } from "@/lib/maths";
import {
NO_SLACK_NAMES,
@@ -151,10 +153,42 @@ function AppLink({
);
}
+/**
+ * The address a link to a stored file downloads it from, or null for a link that is not one.
+ *
+ * A Bot that sends a file names it in its words, linked to the form a message stores
+ * (`/api/attachments/`, from the send's answer), or now and then to the API's own address. Read
+ * as a page of the app, a click asked the router for it, found no such page and landed on home, so
+ * the person never got the file from the words (found by the end-to-end pass). It is the file, from
+ * the conversation's own address, the one the card's Download button uses.
+ */
+export function fileAddress(path: string): string | null {
+ if (path.startsWith(storedAttachmentUrl(""))) return attachmentAddress(path);
+ return /^\/api\/v2\/organizations\/[^/]+\/attachments\/[^/?#]+/.test(path)
+ ? path
+ : null;
+}
+
export const markdownComponents = {
a: ({ href, children, ...rest }: ComponentProps<"a">) => {
const path = inAppPath(href);
- if (path !== null)
+ const file = path === null ? null : fileAddress(path);
+ if (file !== null)
+ return (
+
+ {children}
+
+ );
+ // Any other address under /api is the server's, not a page: the router has nothing to open.
+ if (path !== null && !path.startsWith("/api/"))
return (
{children}
diff --git a/app/src/lib/models/queries.ts b/app/src/lib/models/queries.ts
index 9b126f7d76..f0a4612e24 100644
--- a/app/src/lib/models/queries.ts
+++ b/app/src/lib/models/queries.ts
@@ -80,6 +80,12 @@ export type AvailableModels = {
export type ConversationModel = {
model: string | null;
effort: string | null;
+ /**
+ * The model the person chose here, set aside because it hasn't been checked to work with this
+ * Bot's harness (shared/model-lock.ts). Runs use the default until it has been. Only ever on a
+ * read from the server.
+ */
+ unverified?: { model: string; label: string };
};
export const modelKeys = {
diff --git a/app/src/lib/models/run-model.ts b/app/src/lib/models/run-model.ts
index c90768375c..7937dda6bf 100644
--- a/app/src/lib/models/run-model.ts
+++ b/app/src/lib/models/run-model.ts
@@ -28,6 +28,15 @@ export function withdrawnModelNotice(
return `${picked} ${gone} any more, so this conversation now uses ${now}. Pick another model to change it.`;
}
+/**
+ * What the composer says when the model a person chose here hasn't been proven to work with this
+ * Bot (shared/model-lock.ts): the provider would turn down every message, so runs use the default
+ * until a check proves it.
+ */
+export function unverifiedModelNotice(picked: string, now: string): string {
+ return `${picked} doesn't work with this Bot yet, so this conversation uses ${now}. Pick another model to change it.`;
+}
+
/**
* The model and thinking effort one conversation runs on, as its picker shows them, and the way
* to change them.
@@ -133,8 +142,19 @@ export function useConversationModel(
? undefined
: shownPick(picked, catalogue),
saving: save.isPending,
- /** What the composer says about the pick, when the picked model stopped being offered. */
- notice: withdrawn?.channelId === channelId ? withdrawn.notice : null,
+ /**
+ * What the composer says about the pick: the chosen model doesn't work with this Bot yet, or
+ * it stopped being offered.
+ */
+ notice:
+ (!save.isPending && saved.data?.unverified && catalogue
+ ? unverifiedModelNotice(
+ saved.data.unverified.label,
+ catalogue.models.find((option) => option.id === catalogue.default)
+ ?.label ?? catalogue.default,
+ )
+ : null) ??
+ (withdrawn?.channelId === channelId ? withdrawn.notice : null),
// Read the ref at submission time, including a choice made before React renders again.
beforeSend: async () => {
await pendingSave.current;
diff --git a/app/src/lib/notices.ts b/app/src/lib/notices.ts
new file mode 100644
index 0000000000..e9d49b10e1
--- /dev/null
+++ b/app/src/lib/notices.ts
@@ -0,0 +1,130 @@
+import { STAR_ON_GITHUB } from "@openbot/shared/notices";
+import type { UserPreferences } from "@openbot/shared/user-preferences";
+import type { QueryClient } from "@tanstack/react-query";
+import { recordNudgeEvent } from "@/lib/api/generated/product-events/product-events";
+import { idempotencyKey } from "@/lib/api/request";
+import { authKeys } from "@/lib/auth/queries";
+import { ClientError } from "@/lib/client";
+import {
+ type DeploymentCapabilities,
+ deploymentKeys,
+} from "@/lib/deployment/queries";
+import { desktopShell } from "@/lib/desktop/shell";
+import { organizationId } from "@/lib/organizations/current";
+import { userPreferencesQueryOptions } from "@/lib/settings/message-list";
+
+/**
+ * NOTICES A PERSON IS SHOWN ONCE: NUDGES (shared/notices.ts).
+ *
+ * The browser decides nothing about when one is due. The server works it out on every read of the
+ * person's preferences (`noticesDue`), from the edition and how they have used OpenBot, and leaves
+ * out any they dismissed (`dismissedNotices`). What the browser does is draw the card, save the
+ * answer, count it, and read the preferences again at a moment that could have made one due: a
+ * copied answer, a turn that ended somewhere, a Bot's reply.
+ */
+
+/** Whether the server says this notice is due for this person now, and they have not answered it. */
+export function noticeDue(
+ preferences:
+ | Pick
+ | undefined,
+ id: string,
+): boolean {
+ if (!preferences) return false;
+ if ((preferences.dismissedNotices ?? []).includes(id)) return false;
+ return (preferences.noticesDue ?? []).includes(id);
+}
+
+/**
+ * Whether a moment could make any notice due here: the personal edition (the only one with a
+ * nudge today), the person and their preferences loaded, and a nudge they have not answered. Read
+ * from what the app already loaded, so asking costs nothing.
+ */
+function mightBecomeDue(
+ queryClient: QueryClient,
+): { userId: string } | undefined {
+ const capabilities = queryClient.getQueryData(
+ deploymentKeys.capabilities(),
+ );
+ if (capabilities?.edition !== "personal") return undefined;
+ const userId = queryClient.getQueryData<{ id?: string } | null>(
+ authKeys.currentUser(),
+ )?.id;
+ if (!userId) return undefined;
+ const preferences = queryClient.getQueryData(
+ userPreferencesQueryOptions(userId).queryKey,
+ );
+ if (!preferences) return undefined;
+ // Every nudge there is, answered: nothing a moment could bring.
+ const answered = new Set(preferences.dismissedNotices ?? []);
+ if (NUDGES.every((id) => answered.has(id))) return undefined;
+ return { userId };
+}
+
+/** The nudges this app draws. A new one is added here and given its card. */
+const NUDGES: readonly string[] = [STAR_ON_GITHUB];
+
+let pendingRead: ReturnType | undefined;
+
+/**
+ * A moment that could have made a nudge due: read the person's preferences again, so the server's
+ * answer reaches the card right after the win. Only where a nudge could come of it at all (see
+ * {@link mightBecomeDue}): a team's OpenBot, or somebody who answered every nudge, asks for nothing.
+ *
+ * `afterMs` waits a little for a moment the server records after telling the app (a routine's run
+ * and a task's report are each said in the conversation a moment before their outcome is written),
+ * and folds a burst of events into one read.
+ */
+export function nudgeMoment(
+ queryClient: QueryClient,
+ { afterMs = 0 }: { afterMs?: number } = {},
+): void {
+ if (!mightBecomeDue(queryClient)) return;
+ if (pendingRead) clearTimeout(pendingRead);
+ pendingRead = setTimeout(() => {
+ pendingRead = undefined;
+ const due = mightBecomeDue(queryClient);
+ if (!due) return;
+ void queryClient
+ .fetchQuery({
+ ...userPreferencesQueryOptions(due.userId),
+ staleTime: 0,
+ })
+ .catch(() => {
+ // A read that failed changes nothing on screen; the next moment asks again.
+ });
+ }, afterMs);
+}
+
+/** What a person did with a nudge: `NudgeEvent.action` in api/openapi/conversations.yaml. */
+export type NudgeAction = "shown" | "clicked" | "dismissed";
+
+/**
+ * Count a nudge shown, followed or dismissed, and where. Best effort: the server works out who and
+ * which moment made it due, and a count that does not arrive changes nothing on screen. Never
+ * throws, so a caller can fire and forget. With keepalive, because following the star nudge leaves
+ * the page as it is pressed.
+ */
+export async function recordNudge(
+ nudge: string,
+ action: NudgeAction,
+ place: "card" | "settings",
+): Promise {
+ try {
+ await recordNudgeEvent(
+ organizationId(),
+ {
+ nudge,
+ action,
+ place,
+ surface: desktopShell() === null ? "web" : "desktop",
+ },
+ { "Idempotency-Key": idempotencyKey() },
+ { keepalive: true },
+ );
+ } catch (error) {
+ if (error instanceof ClientError)
+ console.warn("Nudge telemetry was not accepted.", error.status);
+ else console.warn("Nudge telemetry could not be delivered.");
+ }
+}
diff --git a/app/src/lib/openbot-for-business.ts b/app/src/lib/openbot-for-business.ts
index b176cf706d..a4bc6bf136 100644
--- a/app/src/lib/openbot-for-business.ts
+++ b/app/src/lib/openbot-for-business.ts
@@ -1,53 +1,11 @@
/**
- * The OpenBot for Business page on the website, which has the same booking calendar inline. In the
- * app every OpenBot for Business entry opens the in-app dialog (`openTeamFeatures`), which embeds
- * the calendar; this page is where a calendar that can't load in the app sends somebody instead.
+ * OpenBot for Business's page, its Calendly event and the calendar's address. They live in
+ * `@openbot/shared/openbot-for-business`, which Desktop's first screen reads too.
*/
-export const BUSINESS_URL = "https://open.bot/business";
-
-/**
- * The OpenBot for Business booking event on Calendly: the same calls the page above books. The
- * onboarding step and the OpenBot for Business dialog embed it, and fall back to
- * {@link BUSINESS_URL} when it can't load.
- */
-export const BOOKING_CALENDAR_URL =
- "https://calendly.com/d/dwfr-k64-8d2/openbot-for-business";
-
-/** Where the calendar is served from, and the only origin its messages are read from. */
-export const BOOKING_CALENDAR_ORIGIN = new URL(BOOKING_CALENDAR_URL).origin;
-
-/** Colours for the calendar, as Calendly takes them: six hex digits, no `#`. */
-export type BookingCalendarColors = {
- background: string;
- text: string;
- primary: string;
-};
-
-/**
- * The address the calendar's frame loads.
- *
- * `embed_domain` and `embed_type=Inline` are what Calendly's own `widget.js` adds for an inline
- * embed: they are what make the page an embed, which posts its height and its bookings to this
- * window, and honours the hide options. The script itself is not loaded, since all it would do here
- * is write this address into an iframe. `hide_event_type_details` drops the event's name, host and
- * length, which the step's own words already say, so the narrow column shows the calendar first.
- * `hide_gdpr_banner` drops Calendly's cookie banner, which otherwise sits over the calendar inside
- * the step.
- * Colours are the app's own, where they could be read.
- */
-export function bookingCalendarSrc(
- host: string,
- colors?: BookingCalendarColors,
-): string {
- const url = new URL(BOOKING_CALENDAR_URL);
- url.searchParams.set("embed_domain", host);
- url.searchParams.set("embed_type", "Inline");
- url.searchParams.set("hide_event_type_details", "1");
- url.searchParams.set("hide_gdpr_banner", "1");
- if (colors) {
- url.searchParams.set("background_color", colors.background);
- url.searchParams.set("text_color", colors.text);
- url.searchParams.set("primary_color", colors.primary);
- }
- return url.href;
-}
+export {
+ BOOKING_CALENDAR_ORIGIN,
+ BOOKING_CALENDAR_URL,
+ type BookingCalendarColors,
+ BUSINESS_URL,
+ bookingCalendarSrc,
+} from "@openbot/shared/openbot-for-business";
diff --git a/app/src/lib/organizations/mutations.ts b/app/src/lib/organizations/mutations.ts
index ed5dcf35fb..3ce6f1b640 100644
--- a/app/src/lib/organizations/mutations.ts
+++ b/app/src/lib/organizations/mutations.ts
@@ -14,6 +14,7 @@ import {
updateOrganizationMember,
} from "@/lib/api/generated/organizations/organizations";
import { idempotencyKey } from "@/lib/api/request";
+import type { KnownRole } from "@/lib/auth/roles";
import { currentOrganizationId, setCurrentOrganization } from "./current";
import {
type OrganizationMemberSummary,
@@ -165,7 +166,8 @@ export function changeMemberRoleMutationOptions(queryClient: QueryClient) {
mutationFn: async (variables: {
organizationId: string;
personId: string;
- role: OrganizationMemberSummary["role"];
+ /** Only a role this app knows: one from `givableRoles`. */
+ role: KnownRole;
}): Promise =>
(
await updateOrganizationMember(
diff --git a/app/src/lib/organizations/words.ts b/app/src/lib/organizations/words.ts
index 78345bfcf9..48823cc71b 100644
--- a/app/src/lib/organizations/words.ts
+++ b/app/src/lib/organizations/words.ts
@@ -1,4 +1,9 @@
-import { isOrganizationAdmin } from "@/lib/auth/roles";
+import {
+ isKnownRole,
+ isOrganizationAdmin,
+ type KnownRole,
+ knownRole,
+} from "@/lib/auth/roles";
import { relativeTime } from "@/lib/relative-time";
import type {
OrganizationMemberSummary,
@@ -12,15 +17,18 @@ import type {
* only keep a screen from offering what the person's role is known to be refused.
*/
-const ROLE_NAMES: Record = {
+const ROLE_NAMES = {
owner: "Owner",
admin: "Admin",
member: "Member",
};
-/** A role as a label: Owner, Admin or Member. One the app does not know is said as it came. */
+/**
+ * A role as a label: Owner, Admin or Member. One a newer server sends that the app doesn't know is
+ * read as the least it could be, and named Member.
+ */
export function roleName(role: string): string {
- return ROLE_NAMES[role] ?? role;
+ return ROLE_NAMES[knownRole(role)];
}
/** A role inside a sentence: "an admin", "a member". */
@@ -66,6 +74,17 @@ export function memberControl(
return isOrganizationAdmin(viewer.role) ? "remove" : null;
}
+/**
+ * The roles a member's Role menu offers: the server's verdict (`assignableRoles`), less any role a
+ * newer server lists that this app doesn't know. The app can't name one it doesn't know, and never
+ * sends one back.
+ */
+export function givableRoles(
+ member: Pick,
+): KnownRole[] {
+ return (member.assignableRoles as readonly string[]).filter(isKnownRole);
+}
+
/**
* Whether giving a member a role is asked about first, and as what: making somebody an owner, or
* the person stepping down from owner themselves. Any other change applies at once. This picks the
@@ -81,15 +100,20 @@ export function roleChangeQuestion(
return null;
}
-const SENT_STATUS: Record = {
+const SENT_STATUS: Record = {
pending: "Pending",
expired: "Expired",
declined: "Declined",
};
-/** The second line of an invitation an organization sent: its role, its status, and when it expires. */
+/**
+ * The second line of an invitation an organization sent: its role, its status, and when it expires.
+ * A status a newer server sends that the app doesn't know leaves the role alone.
+ */
export function sentInvitationLine(invitation: SentInvitation): string {
- const parts = [roleName(invitation.role), SENT_STATUS[invitation.status]];
+ const parts = [roleName(invitation.role)];
+ const status = SENT_STATUS[invitation.status];
+ if (status) parts.push(status);
if (invitation.status === "pending")
parts.push(`Expires ${relativeTime(invitation.expiresAt)}`);
return parts.join(" · ");
@@ -109,6 +133,9 @@ export function receivedInvitationLine(invitation: ReceivedInvitation): string {
return "You declined this invitation.";
case "canceled":
return `This invitation was canceled. Ask ${inviter} to send a new one.`;
+ default:
+ // A status a newer server sends that the app doesn't know: only who it is from.
+ return `Invited by ${inviter}.`;
}
}
diff --git a/app/src/lib/people/mutations.ts b/app/src/lib/people/mutations.ts
index 95f35382f0..4a256c5836 100644
--- a/app/src/lib/people/mutations.ts
+++ b/app/src/lib/people/mutations.ts
@@ -5,7 +5,7 @@ import {
updatePerson,
} from "@/lib/api/generated/people/people";
import { idempotencyKey, organizationId } from "@/lib/api/request";
-import { type Person, peopleKeys } from "./queries";
+import { type Person, peopleKeys, personOf } from "./queries";
const FALLBACK = "Could not update that person";
@@ -19,15 +19,17 @@ export function setPersonRoleMutationOptions(queryClient: QueryClient) {
userId: string;
role: "admin" | "member";
}): Promise =>
- (
- await updatePerson(
- organizationId(),
- variables.userId,
- { role: variables.role },
- { "Idempotency-Key": idempotencyKey() },
- { fallback: FALLBACK },
- )
- ).person,
+ personOf(
+ (
+ await updatePerson(
+ organizationId(),
+ variables.userId,
+ { role: variables.role },
+ { "Idempotency-Key": idempotencyKey() },
+ { fallback: FALLBACK },
+ )
+ ).person,
+ ),
onSuccess: () => invalidatePeople(queryClient),
});
}
@@ -44,14 +46,16 @@ export function setPersonAccessMutationOptions(queryClient: QueryClient) {
userId: string;
revoked: boolean;
}): Promise =>
- (
- await (variables.revoked ? revokePersonAccess : restorePersonAccess)(
- organizationId(),
- variables.userId,
- { "Idempotency-Key": idempotencyKey() },
- { fallback: FALLBACK },
- )
- ).person,
+ personOf(
+ (
+ await (variables.revoked ? revokePersonAccess : restorePersonAccess)(
+ organizationId(),
+ variables.userId,
+ { "Idempotency-Key": idempotencyKey() },
+ { fallback: FALLBACK },
+ )
+ ).person,
+ ),
onSuccess: () => invalidatePeople(queryClient),
});
}
diff --git a/app/src/lib/people/queries.ts b/app/src/lib/people/queries.ts
index 6cbebeb5e6..4da8d9e337 100644
--- a/app/src/lib/people/queries.ts
+++ b/app/src/lib/people/queries.ts
@@ -1,6 +1,7 @@
import { infiniteQueryOptions } from "@tanstack/react-query";
import { listPeople } from "@/lib/api/generated/people/people";
import { organizationId } from "@/lib/api/request";
+import { knownRole } from "@/lib/auth/roles";
/**
* Somebody who has signed in to this deployment.
@@ -29,6 +30,16 @@ export type Person = {
configuredAdmin: boolean;
};
+/**
+ * A person as the API answers them, in the shape this screen reads. A role a newer server names that
+ * this app doesn't know is read as the least it could be, a member.
+ */
+export function personOf(
+ person: Omit & { role: string },
+): Person {
+ return { ...person, role: knownRole(person.role) };
+}
+
export const peopleKeys = {
all: ["people"] as const,
list: (search = "") => ["people", "list", { search }] as const,
@@ -62,7 +73,10 @@ export function peopleListQueryOptions(search = "") {
},
{ signal, fallback: "Could not load people" },
);
- return { people: page.people, nextCursor: page.nextCursor };
+ return {
+ people: page.people.map(personOf),
+ nextCursor: page.nextCursor,
+ };
},
getNextPageParam: (page: PeoplePage) => page.nextCursor ?? undefined,
});
diff --git a/app/src/lib/plugins/consent-handoff.ts b/app/src/lib/plugins/consent-handoff.ts
index c3e75df532..9c0e6fed79 100644
--- a/app/src/lib/plugins/consent-handoff.ts
+++ b/app/src/lib/plugins/consent-handoff.ts
@@ -162,18 +162,29 @@ export function consentHandoffWords(handoff: {
* Whether a consent OpenBot is about to open for this app goes through Composio, and the app's
* name and sign-in page if so. Null otherwise: an Arcade deployment, an app OpenBot signs in to
* itself, or a read that failed (the sign-in then opens straight away, as it always did).
+ *
+ * FROM WHAT THE SCREEN ALREADY HOLDS. The screen that drew Connect read how apps are set up and
+ * which apps there are, and neither fact this asks changes between the read and the press. Asking
+ * the server again at the press made the step hang on one more round trip, and a re-read that
+ * failed, or was cancelled by another refetch it had joined, dropped the step and opened the
+ * sign-in straight away. Only an app the screen has not read yet (one Browse apps has just added)
+ * is read again.
*/
export async function brokeredConsentFor(
queryClient: QueryClient,
serverId: string,
): Promise | null> {
try {
- const [setup, apps] = await Promise.all([
- queryClient.fetchQuery(appSetupQueryOptions()),
- queryClient.fetchQuery(appsQueryOptions()),
- ]);
+ const setup = await queryClient.ensureQueryData(appSetupQueryOptions());
if (setup.directoryProvider !== "composio") return null;
- const app = apps.find((each) => each.id === serverId);
+ const held = queryClient
+ .getQueryData(appsQueryOptions().queryKey)
+ ?.find((each) => each.id === serverId);
+ const app =
+ held ??
+ (
+ await queryClient.fetchQuery({ ...appsQueryOptions(), staleTime: 0 })
+ ).find((each) => each.id === serverId);
if (app?.source !== "directory") return null;
return {
app: app.title,
diff --git a/app/src/lib/plugins/finish-on-return.ts b/app/src/lib/plugins/finish-on-return.ts
index 24bf46dc21..cb83b38e1f 100644
--- a/app/src/lib/plugins/finish-on-return.ts
+++ b/app/src/lib/plugins/finish-on-return.ts
@@ -1,4 +1,5 @@
import { VERIFIER_PATH } from "@/lib/auth/resume";
+import { withClientName } from "@/lib/client";
import { desktopShell } from "@/lib/desktop/shell";
/** The step waiting for the window to be back in front, while there is one. */
@@ -45,6 +46,7 @@ export async function finishInBackground(): Promise {
await fetch(VERIFIER_PATH, {
credentials: "same-origin",
redirect: "manual",
+ headers: withClientName(),
});
} catch {
// Nothing to tell anybody: the connections read that follows says whether it was finished.
diff --git a/app/src/lib/product-telemetry.ts b/app/src/lib/product-telemetry.ts
index abb89f8b5d..4b5265e083 100644
--- a/app/src/lib/product-telemetry.ts
+++ b/app/src/lib/product-telemetry.ts
@@ -2,7 +2,9 @@ import { useEffect, useRef } from "react";
import { recordProductEvent } from "@/lib/api/generated/product-events/product-events";
import { idempotencyKey } from "@/lib/api/request";
import { ClientError } from "@/lib/client";
+import { nudgeMoment } from "@/lib/notices";
import { organizationId } from "@/lib/organizations/current";
+import { queryClient } from "@/query-client";
export type ResultReference = { threadId: string; messageId: string };
type ResultAction = "result_viewed" | "result_copied";
@@ -31,6 +33,12 @@ export async function recordResultAction(
{ "Idempotency-Key": idempotencyKey() },
{ keepalive: true },
);
+ /*
+ * A copied answer is a win, which the server has now recorded: read the preferences again, so a
+ * nudge it makes due shows right after the copy (`lib/notices.ts`). Nothing is read where no
+ * nudge could come of it.
+ */
+ if (kind === "result_copied") nudgeMoment(queryClient);
} catch (error) {
// This best-effort observation must not interrupt chat or a successful copy.
if (error instanceof ClientError)
diff --git a/app/src/lib/routines/form.ts b/app/src/lib/routines/form.ts
index 14b0fc06cb..fc32727315 100644
--- a/app/src/lib/routines/form.ts
+++ b/app/src/lib/routines/form.ts
@@ -177,7 +177,7 @@ export const ROUTINE_FORM_DEFAULTS: Omit<
interval: "1440",
};
-type Schedule = Pick<
+export type Schedule = Pick<
RoutineFormValues,
"repeat" | "time" | "weekday" | "monthDay"
>;
@@ -209,6 +209,61 @@ export function cronFrom(schedule: Schedule): string {
}
}
+const pad = (value: number) => String(value).padStart(2, "0");
+
+/** A plain whole number from `min` to `max` in one cron field, or null for anything else. */
+function plain(field: string, min: number, max: number): number | null {
+ if (!/^\d{1,2}$/.test(field)) return null;
+ const value = Number(field);
+ return value >= min && value <= max ? value : null;
+}
+
+/**
+ * The picker's choices for a routine's five cron fields, when the picker can say them: the exact
+ * shapes `cronFrom` writes, and nothing else. Null for any other schedule, such as one a Bot wrote
+ * ("every other Tuesday"), which Edit routine keeps as it is unless the person picks a new one.
+ *
+ * Read only to prefill the picker: what a routine's row says is still the server's `schedule`.
+ */
+export function scheduleFrom(cron: string): Schedule | null {
+ const fields = cron.trim().split(/\s+/);
+ if (fields.length !== 5) return null;
+ const [minuteField, hourField, dayField, monthField, weekdayField] =
+ fields as [string, string, string, string, string];
+ if (monthField !== "*") return null;
+ const defaults = {
+ weekday: ROUTINE_FORM_DEFAULTS.weekday,
+ monthDay: ROUTINE_FORM_DEFAULTS.monthDay,
+ };
+ if (
+ minuteField === "0" &&
+ hourField === "*" &&
+ dayField === "*" &&
+ weekdayField === "*"
+ )
+ return { ...defaults, repeat: "hourly", time: ROUTINE_FORM_DEFAULTS.time };
+ const minute = plain(minuteField, 0, 59);
+ const hour = plain(hourField, 0, 23);
+ if (minute === null || hour === null) return null;
+ const time = `${pad(hour)}:${pad(minute)}`;
+ if (dayField === "*" && weekdayField === "*")
+ return { ...defaults, repeat: "daily", time };
+ if (dayField === "*" && weekdayField === "1-5")
+ return { ...defaults, repeat: "weekdays", time };
+ const weekday = plain(weekdayField, 0, 6);
+ if (dayField === "*" && weekday !== null)
+ return { ...defaults, repeat: "weekly", weekday: String(weekday), time };
+ const monthDay = plain(dayField, 1, 28);
+ if (weekdayField === "*" && monthDay !== null)
+ return {
+ ...defaults,
+ repeat: "monthly",
+ monthDay: String(monthDay),
+ time,
+ };
+ return null;
+}
+
/** "9:00 AM", on the person's own clock. */
export function clockTime(time: string): string {
const [hour, minute] = hourAndMinute(time);
diff --git a/app/src/lib/routines/mutations.ts b/app/src/lib/routines/mutations.ts
index b361b560bd..f06aaa6e85 100644
--- a/app/src/lib/routines/mutations.ts
+++ b/app/src/lib/routines/mutations.ts
@@ -4,13 +4,17 @@ import {
deleteConversation,
updateConversation,
} from "@/lib/api/generated/conversations/conversations";
-import type { CreateRoutineRequest } from "@/lib/api/generated/model";
+import type {
+ CreateRoutineRequest,
+ UpdateRoutineRequest,
+} from "@/lib/api/generated/model";
import {
createRoutine as createRoutineRequest,
deleteRoutine,
pauseRoutine,
resumeRoutine,
runRoutine,
+ updateRoutine,
} from "@/lib/api/generated/routines/routines";
import { idempotencyKey, organizationId } from "@/lib/api/request";
import { channelKeys } from "@/lib/channels/queries";
@@ -30,9 +34,8 @@ import { routineKeys } from "./queries";
/**
* Writes against a person's own standing instructions.
*
- * Create is here, as a plan the form made, through the same store calls a Bot's tools make; there is no edit.
- * Changing a routine is conversational, through the `RoutineTools` a Bot calls mid-chat. See
- * the routines operations in the API spec for the full reasoning.
+ * Create is here, as a plan the form made, through the same store calls a Bot's tools make. So is
+ * Edit routine, which changes one in place: it keeps its id, its conversation and its runs.
*/
const FALLBACK = "That routine could not be changed.";
@@ -292,6 +295,21 @@ export function setRoutineEnabledMutationOptions(queryClient: QueryClient) {
});
}
+/**
+ * Change a routine's name, what it does, its schedule or its time zone. Only the fields sent change.
+ * The server says what it refused (a schedule too frequent, a time zone it doesn't know) in words a
+ * person reads, which the dialog shows as they are.
+ */
+export function updateRoutineMutationOptions(queryClient: QueryClient) {
+ return mutationOptions({
+ mutationFn: (variables: { id: string; changes: UpdateRoutineRequest }) =>
+ updateRoutine(organizationId(), variables.id, variables.changes, once(), {
+ fallback: "Couldn't save your changes. Try again.",
+ }).then((answer) => answer.routine),
+ onSuccess: () => invalidateRoutines(queryClient),
+ });
+}
+
/** Every routine delete, so the routine's page can tell it was deleted from there. */
export const deleteRoutineMutationKey = [...routineKeys.all, "delete"] as const;
diff --git a/app/src/lib/settings/message-list.ts b/app/src/lib/settings/message-list.ts
index e0f0e82f89..2b8b625d5f 100644
--- a/app/src/lib/settings/message-list.ts
+++ b/app/src/lib/settings/message-list.ts
@@ -93,6 +93,49 @@ export function dismissSelfHostBannerMutationOptions(
});
}
+/**
+ * Answer a notice for this person (a nudge, `lib/notices.ts`), on every device they sign in from.
+ * Either answer is the same answer: never show it again. The server adds the id to the ones already
+ * dismissed, so two devices answering two notices at once both stay answered.
+ *
+ * Patched in onMutate like the self-host banner's, so the card is gone the moment it is pressed,
+ * and put back if the save fails. A card that vanished and came back on the next load would read
+ * as ignoring the click.
+ */
+export function dismissNoticeMutationOptions(
+ queryClient: QueryClient,
+ userId: string | undefined,
+) {
+ const queryKey = userPreferencesQueryOptions(userId).queryKey;
+ return mutationOptions({
+ mutationFn: (notice: string): Promise => {
+ if (!userId) throw new Error("Sign in to save your preferences.");
+ return savePreferences(
+ { dismissedNotices: [notice] },
+ "Could not save your preferences",
+ );
+ },
+ onMutate: (notice) => {
+ const previous = queryClient.getQueryData(queryKey);
+ if (previous) {
+ queryClient.setQueryData(queryKey, {
+ ...previous,
+ dismissedNotices: [...(previous.dismissedNotices ?? []), notice],
+ noticesDue: (previous.noticesDue ?? []).filter(
+ (due) => due !== notice,
+ ),
+ });
+ }
+ return { previous };
+ },
+ onError: (_error, _variables, context) => {
+ if (context?.previous)
+ queryClient.setQueryData(queryKey, context.previous);
+ },
+ onSuccess: (preferences) => queryClient.setQueryData(queryKey, preferences),
+ });
+}
+
export function saveUserPreferencesMutationOptions(
queryClient: QueryClient,
userId: string | undefined,
diff --git a/app/src/lib/tasks/groups.ts b/app/src/lib/tasks/groups.ts
index f653e75785..7372ae8a73 100644
--- a/app/src/lib/tasks/groups.ts
+++ b/app/src/lib/tasks/groups.ts
@@ -1,4 +1,9 @@
-import { type BotTask, liveStatus, type TaskStatus } from "./queries";
+import {
+ type BotTask,
+ type KnownTaskStatus,
+ liveStatus,
+ type TaskStatus,
+} from "./queries";
/*
* The order a person's tasks are listed in, worked out here, away from the screens, so the Bots page,
@@ -7,7 +12,7 @@ import { type BotTask, liveStatus, type TaskStatus } from "./queries";
*/
/** Top to bottom: what to read, what to answer, what to retry, what is running, what is done. */
-export const TASK_ORDER: readonly TaskStatus[] = [
+export const TASK_ORDER: readonly KnownTaskStatus[] = [
"ready_for_review",
"needs_input",
"failed",
@@ -15,6 +20,12 @@ export const TASK_ORDER: readonly TaskStatus[] = [
"resolved",
];
+/** A status's place in `TASK_ORDER`. One a newer server sends that this app doesn't know comes last. */
+function rank(status: TaskStatus): number {
+ const at = (TASK_ORDER as readonly string[]).indexOf(status);
+ return at === -1 ? TASK_ORDER.length : at;
+}
+
/** How long a task the person marked done stays listed. */
export const RESOLVED_FOR_MS = 7 * 24 * 60 * 60 * 1000;
@@ -110,7 +121,7 @@ export function orderTasks(
)
.sort(
(a, b) =>
- TASK_ORDER.indexOf(a.status) - TASK_ORDER.indexOf(b.status) ||
+ rank(a.status) - rank(b.status) ||
time(b.task.updatedAt) - time(a.task.updatedAt),
);
}
diff --git a/app/src/lib/tasks/queries.ts b/app/src/lib/tasks/queries.ts
index b3a2d2b488..babf4deea6 100644
--- a/app/src/lib/tasks/queries.ts
+++ b/app/src/lib/tasks/queries.ts
@@ -22,13 +22,19 @@ import { organizationId } from "@/lib/api/request";
* conversation waits on the person; its turn is queued or running; the person marked it done; its
* turn ran out of runs; its Bot replied.
*/
-export type TaskStatus =
+export type KnownTaskStatus =
| "needs_input"
| "working"
| "resolved"
| "failed"
| "ready_for_review";
+/**
+ * A task's status as the server answers it: one of `KnownTaskStatus`, or one a newer server added
+ * that this app doesn't know, which every screen reads as other.
+ */
+export type TaskStatus = string;
+
export type BotTask = {
id: string;
agentId: string;
@@ -239,7 +245,7 @@ export function liveStatus(status: TaskStatus, busy: boolean): TaskStatus {
}
/** Each status in a word or two, as a row says it. */
-export const TASK_STATUS_LABEL: Record = {
+export const TASK_STATUS_LABEL: Record = {
ready_for_review: "Ready for review",
needs_input: "Needs input",
failed: "Failed",
@@ -247,6 +253,12 @@ export const TASK_STATUS_LABEL: Record = {
resolved: "Resolved",
};
+/** A status in a word or two, or nothing for one a newer server sends that this app doesn't know. */
+export function taskStatusLabel(status: TaskStatus): string | null {
+ const known: Partial> = TASK_STATUS_LABEL;
+ return known[status] ?? null;
+}
+
/** What a failed task says after its status: "Couldn't finish: ." */
export function couldNotFinish(failure: string | null): string {
return failure ? `Couldn't finish: ${failure}.` : "Couldn't finish.";
diff --git a/app/src/routes/__root.tsx b/app/src/routes/__root.tsx
index 7293d47cbd..90b7b76c64 100644
--- a/app/src/routes/__root.tsx
+++ b/app/src/routes/__root.tsx
@@ -4,6 +4,7 @@ import {
Outlet,
} from "@tanstack/react-router";
import { useEffect } from "react";
+import { ClientVersionGate } from "@/components/layout/client-version-gate";
import { ThemeProvider } from "@/components/theme-provider";
import { Toaster } from "@/components/ui/toast";
import { TooltipProvider } from "@/components/ui/tooltip";
@@ -126,7 +127,10 @@ function RootComponent() {
-
+ {/* In place of every route when this app and its OpenBot can't work together. */}
+
+
+
diff --git a/app/src/routes/_authed/_app/bot.tsx b/app/src/routes/_authed/_app/bot.tsx
index 6be74d20be..8f2e720073 100644
--- a/app/src/routes/_authed/_app/bot.tsx
+++ b/app/src/routes/_authed/_app/bot.tsx
@@ -9,6 +9,7 @@ import { ComputerViewPanel } from "@/components/computer/computer-panel";
import { useOpenComputerOnRequest } from "@/lib/computers/panel-view";
import { DetailPanel } from "@/components/layout/detail-panel";
import { SidebarToggleBar } from "@/components/layout/sidebar-toggle";
+import { StarPrompt } from "@/components/star-prompt/star-prompt";
import { Button } from "@/components/ui/button";
import { defaultAgentId } from "@/lib/agents/default-agent";
import {
@@ -242,6 +243,19 @@ function BotChat({ agentId, name }: { agentId: string; name: string }) {
{stopped}
) : null}
+ {/*
+ * The ask to star OpenBot on GitHub, when the server says it is due: this is the screen where
+ * a Bot's answer can be copied, which is one of the wins it follows (`StarPrompt`). Under the
+ * header with the banners, for the same reason as them: the packaged chat owns the space
+ * above its message box. Never while this chat shows an error. As wide as the chat's own
+ * column, with the conversation's composer column's gutters, so it lines up with the message
+ * box under it.
+ */}
+ {stopped || history === "unavailable" ? null : (
+
+
+
+ )}
{/*
* Keyed on the thread as well as the agent. Switching agents was already handled by
diff --git a/app/src/routes/_authed/_app/channel/new.tsx b/app/src/routes/_authed/_app/channel/new.tsx
index 47a0743898..70d8103fb4 100644
--- a/app/src/routes/_authed/_app/channel/new.tsx
+++ b/app/src/routes/_authed/_app/channel/new.tsx
@@ -38,6 +38,7 @@ import {
} from "@/lib/agents/queries";
import { useBotTakesModelChoice } from "@/lib/bot-agents/queries";
import { useStartChannel } from "@/lib/channels/start";
+import { useAttachmentLimits } from "@/lib/deployment/queries";
import { modelCatalogueQueryOptions } from "@/lib/models/queries";
import { useDraftModel } from "@/lib/models/run-model";
import { useSkillCommands } from "@/lib/plugins/skill-commands";
@@ -208,6 +209,7 @@ function NewConversation({ composition }: { composition: string }) {
const skillCommands = useSkillCommands(
group ? "" : (recipients[0]?.id ?? ""),
);
+ const attachmentLimits = useAttachmentLimits();
const submit = async (draft: ComposerDraft) => {
const recipient = recipients[0];
@@ -413,6 +415,7 @@ function NewConversation({ composition }: { composition: string }) {
* for a group: its messages carry words only, so its composer offers no `+`.
*/
holdsFilesUntilSent={!group}
+ attachmentLimits={attachmentLimits}
modelPicker={
+
{ADMIN_SECTIONS.map((section) => (
diff --git a/app/src/routes/_authed/admin/learning.tsx b/app/src/routes/_authed/admin/learning.tsx
index 5ba9066167..2fc45edfba 100644
--- a/app/src/routes/_authed/admin/learning.tsx
+++ b/app/src/routes/_authed/admin/learning.tsx
@@ -1,6 +1,5 @@
import type {
LearningAutoAssignState,
- LearningProposal,
LearningTarget,
} from "@openbot/shared/learning";
import {
@@ -657,12 +656,17 @@ export function LearningPage() {
);
}
-const STATUS: Record = {
+const STATUS: Partial> = {
pending_review: "To review",
approved: "Published",
rejected: "Rejected",
};
+/** A proposal's status in a word. Nothing for one a newer server sends that this app doesn't know. */
+export function proposalStatusWord(status: string): string | null {
+ return STATUS[status] ?? null;
+}
+
/**
* The skills Intelligence proposed for the container shown above, to approve (which publishes it to
* that container's Bots) or reject, and Learn now. Here because a bundled Intelligence has no
@@ -738,7 +742,7 @@ function ProposedSkills({ agentId }: { agentId?: string }) {
- {STATUS[proposal.status]}
+ {proposalStatusWord(proposal.status)}
@@ -770,7 +774,7 @@ function ProposedSkills({ agentId }: { agentId?: string }) {
);
}
-const RUN_STATUS: Record = {
+const RUN_STATUS: Partial> = {
queued: "Queued",
freezing: "Starting",
batching: "Analyzing",
@@ -809,6 +813,21 @@ export function runPollInterval(
: false;
}
+/**
+ * A run's title: where it stands, and whether somebody started it. A status a newer server sends that
+ * this app doesn't know is left out.
+ */
+export function runTitle(
+ run: Pick,
+): string {
+ return [
+ RUN_STATUS[run.status],
+ run.triggerSource === "manual" ? "Manual" : "Automatic",
+ ]
+ .filter(Boolean)
+ .join(" · ");
+}
+
/** One line saying how many skills and insights a run produced, for the counts it has. */
function runCounts(run: LearningRunSummary): string | null {
const counts = [
@@ -866,10 +885,7 @@ function AnalysisRuns({ agentId }: { agentId?: string }) {
-
- {RUN_STATUS[run.status]} ·{" "}
- {run.triggerSource === "manual" ? "Manual" : "Automatic"}
-
+ {runTitle(run)}
{[runTimes(run), runCounts(run)]
.filter((line) => line !== null)
.map((line) => (
diff --git a/app/src/routes/_authed/settings/index.tsx b/app/src/routes/_authed/settings/index.tsx
index 8927037746..59fe2c34f6 100644
--- a/app/src/routes/_authed/settings/index.tsx
+++ b/app/src/routes/_authed/settings/index.tsx
@@ -9,6 +9,7 @@ import { AiModelSection } from "@/components/settings/ai-connection";
import { MessageListPreference } from "@/components/settings/message-list-preference";
import { NameRow } from "@/components/settings/profile";
import { StandingInstructionsRow } from "@/components/settings/standing-instructions";
+import { StarOnGitHubSection } from "@/components/settings/star-on-github";
import { ThemeRow } from "@/components/settings/theme-row";
import { UsageDataSection } from "@/components/settings/usage-data";
import {
@@ -95,6 +96,8 @@ function RouteComponent() {
))}
+ {/* Last: OpenBot itself rather than this person's OpenBot. Gone when the deployment says so. */}
+
);
}
diff --git a/app/tests/admin-personal-edition.test.tsx b/app/tests/admin-personal-edition.test.tsx
index 2f6945f700..5e10271f90 100644
--- a/app/tests/admin-personal-edition.test.tsx
+++ b/app/tests/admin-personal-edition.test.tsx
@@ -17,6 +17,7 @@ import {
} from "@tanstack/react-router";
import { cleanup, render, within } from "@testing-library/react";
import type * as React from "react";
+import { authKeys } from "@/lib/auth/queries";
import { deploymentKeys } from "@/lib/deployment/queries";
import { queryClient } from "@/query-client";
import { IDENTITY_PROVIDERS_PATH, PEOPLE_PATH } from "./accounts-api";
@@ -24,6 +25,7 @@ import {
COMPUTER_ACTIONS_PATH,
isOverviewRead,
MODEL_USAGE_PATH,
+ SETTINGS_PATH,
} from "./admin-settings-api";
import { answerBotsList } from "./bots-api";
import { MODEL_CATALOGUE_PATH } from "./models-api";
@@ -71,6 +73,7 @@ const { Route: LearningRoute } = await import(
const { Route: ComputersRoute } = await import(
"@/routes/_authed/admin/computers"
);
+const { Route: AdminRoute } = await import("@/routes/_authed/admin/index");
const { CheckInsPage } = await import("@/routes/_authed/admin/proactive");
const { ProvidersPage } = await import("@/routes/_authed/admin/providers");
@@ -281,3 +284,31 @@ test("in the team edition the same pages are the team's, and ask for what they s
expect(view.queryByText(FOR_A_TEAM)).toBeNull();
expect(asked.some((path) => path.startsWith(PEOPLE_PATH))).toBe(true);
});
+
+/*
+ * The personal edition's one person is its admin, and its server keeps no organization settings: it
+ * answers them 404. Admin's overview and Computers asked for them anyway, for the notice about
+ * shared computers, and the personal edition's Admin journey failed on the 404s. That notice is for
+ * a team's OpenBot, where every person's Bots can share one computer; here the computer is the
+ * person's own.
+ */
+// Computers is titled Computer here: one person's one computer.
+test.each([
+ ["Admin", AdminRoute],
+ ["Computer", ComputersRoute],
+])(
+ "%s asks the one person's server for no settings it has not got",
+ async (title, route) => {
+ queryClient.setQueryData(authKeys.currentUser(), {
+ id: "dev-local-user",
+ email: "dev@openbot.local",
+ name: "Dana",
+ role: "admin",
+ } as never);
+ const view = await draw(component(route));
+ await view.findByRole("heading", { level: 1, name: title });
+ await settleReactWork();
+ expect(asked).not.toContain(SETTINGS_PATH);
+ expect(view.queryByText("Everyone's Bots share one computer.")).toBeNull();
+ },
+);
diff --git a/app/tests/admin-settings-api.ts b/app/tests/admin-settings-api.ts
index c43bfcab31..4b967a44bf 100644
--- a/app/tests/admin-settings-api.ts
+++ b/app/tests/admin-settings-api.ts
@@ -123,7 +123,8 @@ export type TodayOverview = {
settings?: Record;
groups?: string[];
network?: {
- scopeKind: "organization" | "group" | "team";
+ /** `organization`, `group` or `team`, or one a newer server adds. */
+ scopeKind: string;
scopeId: string;
mode: string;
rules: unknown[];
diff --git a/app/tests/ai-connection-dialog.fixture.tsx b/app/tests/ai-connection-dialog.fixture.tsx
new file mode 100644
index 0000000000..bb32f1b1c2
--- /dev/null
+++ b/app/tests/ai-connection-dialog.fixture.tsx
@@ -0,0 +1,75 @@
+import { QueryClientProvider } from "@tanstack/react-query";
+import {
+ createBrowserHistory,
+ createRootRoute,
+ createRoute,
+ createRouter,
+ Outlet,
+ RouterProvider,
+} from "@tanstack/react-router";
+import type { ReactNode } from "react";
+import { createRoot } from "react-dom/client";
+import { SidebarShell } from "@/components/layout/sidebar-shell";
+import { SettingsSidebar } from "@/components/settings/settings-sidebar";
+import { ThemeProvider } from "@/components/theme-provider";
+import { SidebarInset } from "@/components/ui/sidebar";
+import { setCurrentOrganization } from "@/lib/organizations/current";
+import { queryClient } from "@/query-client";
+import { Route as ApiKeysRoute } from "@/routes/_authed/settings/api-keys";
+import { Route as GeneralRoute } from "@/routes/_authed/settings/index";
+
+/**
+ * Settings, General, in the app's real settings frame (its sidebar and inset panel, as
+ * `routes/_authed/settings/route.tsx` draws them), for ai-connection-dialog.test.tsx to bundle and
+ * load in a browser. API keys is beside it, a Settings page from before with a dialog of its own, to
+ * look at next to the AI connection dialog. What the server answers comes from the test's routes.
+ *
+ * Started in `default`, the organization those routes answer for, as every test does.
+ */
+setCurrentOrganization("default");
+
+const component = (route: { options: { component?: unknown } }) =>
+ route.options.component as () => ReactNode;
+
+const rootRoute = createRootRoute({ component: () => });
+
+const settingsRoute = createRoute({
+ getParentRoute: () => rootRoute,
+ id: "settings-frame",
+ component: () => (
+
+
+
+
+
+
+ ),
+});
+
+const settings = (path: string, page: () => ReactNode) =>
+ createRoute({ getParentRoute: () => settingsRoute, path, component: page });
+
+const router = createRouter({
+ history: createBrowserHistory(),
+ routeTree: rootRoute.addChildren([
+ settingsRoute.addChildren([
+ settings("/settings", component(GeneralRoute)),
+ settings("/settings/api-keys", component(ApiKeysRoute)),
+ ]),
+ createRoute({
+ getParentRoute: () => rootRoute,
+ path: "/",
+ component: () => null,
+ }),
+ ]),
+});
+
+const root = document.getElementById("root");
+if (root)
+ createRoot(root).render(
+
+
+
+
+ ,
+ );
diff --git a/app/tests/ai-connection-dialog.test.tsx b/app/tests/ai-connection-dialog.test.tsx
new file mode 100644
index 0000000000..8d654fe76f
--- /dev/null
+++ b/app/tests/ai-connection-dialog.test.tsx
@@ -0,0 +1,587 @@
+import { afterAll, beforeAll, describe, expect, test } from "bun:test";
+import { existsSync, mkdirSync, readdirSync, readFileSync } from "node:fs";
+import { dirname, join } from "node:path";
+import type { Browser, BrowserType, Page, Request } from "playwright-core";
+import { compile } from "tailwindcss";
+import { parse } from "yaml";
+import type { AiConnection } from "@/lib/api/generated/model";
+import {
+ GetAiConnectionResponse,
+ ReplaceAiConnectionBody,
+} from "@/lib/api/generated/models/models.zod";
+import { personBody } from "./accounts-api";
+
+/**
+ * Settings → General → AI model changes the AI connection in the app, with OpenBot running.
+ *
+ * In a real browser, Chromium and WebKit, in the app's real settings frame: open the AI model row,
+ * choose Change, pick Anthropic, paste a key. A key the provider refuses shows the server's one
+ * sentence and changes nothing; a good one shows the connection in use, and the row under the
+ * dialog reads the new provider (the connection's query was read again). Before this the row's
+ * Change could only stop OpenBot and open Desktop's setup window, and a plain browser had no row.
+ *
+ * The server is served as routes at the API's address, answering as api/openapi.yaml says: every
+ * body the page sends is checked against the generated request schema, every answer against the
+ * response schema, and a refusal is the spec's own example for AI_CONNECTION_KEY_REFUSED.
+ *
+ * OPENBOT_APP_BROWSER=1 OPENBOT_APP_ENGINES=chromium,webkit bun test app/tests/ai-connection-dialog.test.tsx
+ *
+ * Chromium by default, as CI has it. With OPENBOT_APP_SHOTS= each step is saved as
+ * ai-connection----.png, beside General and API keys from before.
+ */
+const asked = process.env.OPENBOT_APP_BROWSER === "1";
+const shots = process.env.OPENBOT_APP_SHOTS;
+const engines = (process.env.OPENBOT_APP_ENGINES ?? "chromium")
+ .split(",")
+ .map((engine) => engine.trim())
+ .filter((engine) => engine === "chromium" || engine === "webkit") as (
+ | "chromium"
+ | "webkit"
+)[];
+
+const APP = join(import.meta.dir, "..");
+const ORIGIN = "http://openbot.test";
+const ORGANIZATION = "/api/v2/organizations/default";
+const AI_CONNECTION = `${ORGANIZATION}/ai-connection`;
+
+const WIDE = { width: 1440, height: 900 };
+const PHONE = { width: 390, height: 844 };
+const THEMES = ["light", "dark"] as const;
+type Theme = (typeof THEMES)[number];
+type Window = { width: number; height: number };
+
+/** The spec, for the refusal the server answers with: its own example, word for word. */
+const spec = parse(
+ readFileSync(join(APP, "..", "api", "openapi.yaml"), "utf8"),
+) as {
+ components: {
+ responses: Record<
+ string,
+ {
+ content: {
+ "application/problem+json": {
+ examples: Record }>;
+ };
+ };
+ }
+ >;
+ };
+};
+const REFUSED =
+ spec.components.responses.AiConnectionRefused?.content[
+ "application/problem+json"
+ ].examples.keyRefused?.value;
+if (!REFUSED) throw new Error("the spec has no keyRefused example");
+
+const GOOD_KEY = "sk-ant-api03-good";
+const BAD_KEY = "sk-ant-api03-refused";
+
+/** One OpenBot's server, as far as these screens ask it. */
+class FakeServer {
+ connection: AiConnection = {
+ provider: "openai",
+ login: "api-key",
+ model: null,
+ endpointHost: null,
+ keySet: true,
+ ready: true,
+ source: "stored",
+ editable: true,
+ saved: [{ provider: "openai", login: "api-key", endpointHost: null }],
+ changedAt: "2026-11-14T09:00:00.000Z",
+ };
+ reads = 0;
+ replaces: { body: unknown; idempotencyKey: string | null }[] = [];
+
+ answer(request: Request): { status: number; json: unknown } {
+ const url = new URL(request.url());
+ const path = url.pathname;
+ if (path === AI_CONNECTION && request.method() === "GET") {
+ this.reads += 1;
+ return {
+ status: 200,
+ json: GetAiConnectionResponse.parse(this.connection),
+ };
+ }
+ if (path === AI_CONNECTION && request.method() === "PUT") {
+ const body = request.postDataJSON() as Record;
+ this.replaces.push({
+ body,
+ idempotencyKey: request.headers()["idempotency-key"] ?? null,
+ });
+ const input = ReplaceAiConnectionBody.parse(body);
+ // As the spec's input schema: nothing it doesn't name.
+ for (const key of Object.keys(body))
+ expect(Object.keys(input)).toContain(key);
+ if (input.apiKey === BAD_KEY) return { status: 422, json: REFUSED };
+ const stillSaved = this.connection.saved.filter(
+ (saved) => saved.provider !== input.provider,
+ );
+ this.connection = GetAiConnectionResponse.parse({
+ provider: input.provider,
+ login: input.login,
+ model: input.model ?? null,
+ endpointHost: input.baseUrl ? new URL(input.baseUrl).host : null,
+ keySet: true,
+ ready: true,
+ source: "stored",
+ editable: true,
+ saved: [
+ ...stillSaved,
+ {
+ provider: input.provider,
+ login: input.login,
+ endpointHost: input.baseUrl ? new URL(input.baseUrl).host : null,
+ },
+ ],
+ changedAt: "2026-11-17T23:30:00.000Z",
+ }) as AiConnection;
+ return { status: 200, json: this.connection };
+ }
+ if (path === `${ORGANIZATION}/people/me`)
+ return {
+ status: 200,
+ json: {
+ person: personBody({
+ id: "dana",
+ name: "Dana Whitfield",
+ email: "dana@example.com",
+ role: "admin",
+ }),
+ openbotVersion: "v1.1.0",
+ },
+ };
+ if (path === `${ORGANIZATION}/deployment`)
+ return {
+ status: 200,
+ json: {
+ generativeUi: true,
+ selfHostBanner: false,
+ localEvaluation: false,
+ edition: "personal",
+ authProviders: [],
+ ssoConfigured: false,
+ ssoRequired: false,
+ },
+ };
+ // The rest of General, as a person who chose nothing yet sees it.
+ if (path === `${ORGANIZATION}/people/me/preferences`)
+ return {
+ status: 200,
+ json: {
+ messageListEmphasis: "thread",
+ selfHostBannerDismissed: false,
+ narration: null,
+ skin: "openbot",
+ proactive: "on",
+ },
+ };
+ if (path === `${ORGANIZATION}/people/me/api-keys`)
+ return { status: 200, json: { apiKeys: [], nextCursor: null } };
+ return { status: 404, json: { detail: "Not found." } };
+ }
+}
+
+/** The vendored marks as data URIs, as Vite's `import.meta.glob` hands them to `@/lib/marks`. */
+function marksModule(): string {
+ const dir = join(APP, "..", "shared", "marks");
+ const marks = Object.fromEntries(
+ readdirSync(dir)
+ .filter((file) => file.endsWith(".svg"))
+ .map((file) => [
+ file.replace(".svg", ""),
+ `data:image/svg+xml;base64,${readFileSync(join(dir, file)).toString("base64")}`,
+ ]),
+ );
+ return `const marks = ${JSON.stringify(marks)}; export const markFor = (id) => (id && marks[id]) || null;`;
+}
+
+async function bundle(): Promise {
+ const built = await Bun.build({
+ entrypoints: [join(import.meta.dir, "ai-connection-dialog.fixture.tsx")],
+ target: "browser",
+ define: { "process.env.NODE_ENV": JSON.stringify("production") },
+ plugins: [
+ {
+ name: "marks",
+ setup(build) {
+ build.onResolve({ filter: /^@\/lib\/marks$/ }, () => ({
+ path: "marks",
+ namespace: "marks",
+ }));
+ build.onLoad({ filter: /.*/, namespace: "marks" }, () => ({
+ contents: marksModule(),
+ loader: "js",
+ }));
+ },
+ },
+ ],
+ });
+ if (!built.success) throw new AggregateError(built.logs, "bundle failed");
+ const script = built.outputs.find((output) => output.kind === "entry-point");
+ if (!script) throw new Error("bundle has no entry point");
+ return script.text();
+}
+
+/** The directory of an installed package, from the app or the repository root. */
+function packageDir(name: string): string {
+ const dir = [
+ join(APP, "node_modules", name),
+ join(APP, "..", "node_modules", name),
+ ].find(existsSync);
+ if (!dir) throw new Error(`no package ${name}`);
+ return dir;
+}
+
+/** Where `@import "[/]"` lands, by the package's `style` export as Vite reads it. */
+function packageStylesheet(id: string): string {
+ const parts = id.split("/");
+ const name = id.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
+ const dir = packageDir(name);
+ const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
+ const subpath = `.${id.slice(name.length)}`;
+ const entry = pkg.exports?.[subpath];
+ const file =
+ typeof entry === "string"
+ ? entry
+ : (entry?.style ?? entry?.default ?? pkg.main ?? "index.css");
+ return join(dir, file);
+}
+
+/** The app's stylesheet, built by Tailwind for these classes, as the app's build does. */
+async function stylesheet(classes: string[]): Promise {
+ const tailwind = dirname(Bun.resolveSync("tailwindcss/package.json", APP));
+ const entry = join(APP, "src", "styles.css");
+ const compiler = await compile(readFileSync(entry, "utf8"), {
+ base: dirname(entry),
+ loadStylesheet: async (id, base) => {
+ const path =
+ id === "tailwindcss"
+ ? join(tailwind, "index.css")
+ : id.startsWith(".")
+ ? join(base, id)
+ : packageStylesheet(id);
+ return { path, base: dirname(path), content: readFileSync(path, "utf8") };
+ },
+ });
+ return compiler.build(classes);
+}
+
+const browsers = new Map();
+let script: string;
+
+beforeAll(async () => {
+ if (!asked) return;
+ script = await bundle();
+ const playwright = await import("playwright-core");
+ for (const engine of engines) {
+ const type: BrowserType = playwright[engine];
+ browsers.set(
+ engine,
+ // The CI job installs full Chromium without the headless shell.
+ await type.launch(engine === "chromium" ? { channel: "chromium" } : {}),
+ );
+ }
+}, 120_000);
+
+afterAll(async () => {
+ for (const browser of browsers.values()) await browser.close();
+});
+
+/** The page at `path`, its server answering from `server`. */
+async function open(
+ path: string,
+ server: FakeServer,
+ engine: string,
+ theme: Theme,
+ window: Window,
+): Promise {
+ const browser = browsers.get(engine);
+ if (!browser) throw new Error(`no ${engine}`);
+ const page = await browser.newPage({
+ viewport: window,
+ colorScheme: theme,
+ reducedMotion: "reduce",
+ });
+ page.on("pageerror", (error) => console.error(error));
+ const inter = join(packageDir("@fontsource-variable/inter"), "files");
+ await page.route(`${ORIGIN}/**`, (route) => {
+ const where = new URL(route.request().url()).pathname;
+ if (where === "/screens.js")
+ return route.fulfill({ contentType: "text/javascript", body: script });
+ const font = join(inter, where.split("/").pop() ?? "");
+ if (where.startsWith("/files/") && existsSync(font))
+ return route.fulfill({ path: font });
+ if (where.startsWith("/api/")) {
+ const { status, json } = server.answer(route.request());
+ return route.fulfill({
+ status,
+ json,
+ headers:
+ status >= 400 ? { "content-type": "application/problem+json" } : {},
+ });
+ }
+ return route.fulfill({
+ contentType: "text/html",
+ body: ``,
+ });
+ });
+ await page.goto(`${ORIGIN}${path}`);
+ return page;
+}
+
+/** Style the page for every class it draws now: what just opened brings classes of its own. */
+async function style(page: Page) {
+ const classes = await page.evaluate(() =>
+ [...document.querySelectorAll("[class]")].flatMap((element) => [
+ ...element.classList,
+ ]),
+ );
+ await page.addStyleTag({ content: await stylesheet([...new Set(classes)]) });
+ await page.evaluate(() => document.fonts.ready);
+ // A dialog scales in: looked at once it is still.
+ await page.waitForTimeout(250);
+}
+
+async function shoot(
+ page: Page,
+ step: string,
+ engine: string,
+ theme: Theme,
+ window: Window,
+) {
+ if (!shots) return;
+ await style(page);
+ mkdirSync(shots, { recursive: true });
+ await page.screenshot({
+ path: join(
+ shots,
+ `ai-connection-${step}-${engine}-${theme}-${window.width}.png`,
+ ),
+ });
+}
+
+/** What a person would see wrong: sideways scroll, a control cut off, the dialog off screen. */
+async function measured(page: Page) {
+ await style(page);
+ return page.evaluate(() => {
+ const inside = (rect: DOMRect) =>
+ rect.left >= -0.5 && rect.right <= innerWidth + 0.5;
+ const dialog = document.querySelector("[data-slot=dialog-content]");
+ const scope: Element = dialog ?? document.body;
+ const cut = [...scope.querySelectorAll("button, a, input")]
+ .filter((control) => {
+ const rect = control.getBoundingClientRect();
+ return rect.width > 0 && rect.height > 0;
+ })
+ .filter((control) => !control.matches("[data-sidebar=rail]"))
+ .filter((control) => !inside(control.getBoundingClientRect()))
+ .map(
+ (control) =>
+ control.textContent?.trim() ||
+ control.getAttribute("aria-label") ||
+ control.tagName,
+ );
+ const box = dialog?.getBoundingClientRect();
+ return {
+ sideways: document.documentElement.scrollWidth > innerWidth,
+ cut,
+ dialogInside: box
+ ? inside(box) && box.top >= 0 && box.bottom <= innerHeight + 0.5
+ : true,
+ };
+ });
+}
+
+const FINE = { sideways: false, cut: [], dialogInside: true };
+
+describe.skipIf(!asked)("changing the AI connection in Settings", () => {
+ for (const engine of engines)
+ for (const theme of THEMES)
+ test(`a refused key says why and changes nothing; a good one connects, in ${engine}, ${theme}`, async () => {
+ const server = new FakeServer();
+ const window = WIDE;
+ const page = await open("/settings", server, engine, theme, window);
+ try {
+ const row = page.getByRole("button", {
+ name: /OpenAI.*Uses your OpenAI API key\./,
+ });
+ await row.waitFor();
+ await shoot(page, "row", engine, theme, window);
+ await row.click();
+
+ const dialog = page.getByRole("dialog");
+ await dialog.getByText("AI connection", { exact: true }).waitFor();
+ await expect(
+ dialog.getByText("API key", { exact: true }).count(),
+ ).resolves.toBe(1);
+ await shoot(page, "current", engine, theme, window);
+ await dialog
+ .getByRole("button", { name: "Change", exact: true })
+ .click();
+
+ // Every provider the setup window offers, in its order.
+ const providers = dialog.getByRole("group", { name: "AI provider" });
+ await dialog.getByRole("button", { name: /^Anthropic/ }).waitFor();
+ expect(
+ await providers.locator("[data-slot=item-title]").allTextContents(),
+ ).toEqual([
+ "OpenAI",
+ "Anthropic",
+ "Google Gemini",
+ "xAI",
+ "Unbiased AI",
+ "Any OpenAI-compatible endpoint",
+ ]);
+ expect(await measured(page)).toEqual(FINE);
+ await shoot(page, "providers", engine, theme, window);
+
+ await dialog.getByRole("button", { name: /^Anthropic/ }).click();
+ const key = dialog.getByLabel("Anthropic API key");
+ await key.waitFor();
+ // A plain browser offers keys only: a plan signs in through OpenBot Desktop.
+ expect(await dialog.getByText("Sign in with my plan").count()).toBe(
+ 0,
+ );
+ const connect = dialog.getByRole("button", { name: "Connect" });
+ expect(await connect.isDisabled()).toBe(true);
+
+ await key.fill(BAD_KEY);
+ await connect.click();
+ const alert = dialog.getByRole("alert");
+ await alert.waitFor();
+ expect(await alert.textContent()).toBe(
+ "Anthropic didn't accept that key. Check it and paste it again.",
+ );
+ expect(server.connection.provider).toBe("openai");
+ expect(await measured(page)).toEqual(FINE);
+ await shoot(page, "refused", engine, theme, window);
+
+ await key.fill(GOOD_KEY);
+ // Typing again takes the old sentence away.
+ expect(await dialog.getByRole("alert").count()).toBe(0);
+ await connect.click();
+ await dialog.getByText("Connected to Anthropic").waitFor();
+ expect(await dialog.textContent()).not.toContain(GOOD_KEY);
+ expect(await measured(page)).toEqual(FINE);
+ await shoot(page, "connected", engine, theme, window);
+
+ // Two presses, two writes, each with its own Idempotency-Key, each a body the spec takes.
+ expect(server.replaces.map((replace) => replace.body)).toEqual([
+ { provider: "anthropic", login: "api-key", apiKey: BAD_KEY },
+ { provider: "anthropic", login: "api-key", apiKey: GOOD_KEY },
+ ]);
+ const keys = server.replaces.map((replace) => replace.idempotencyKey);
+ expect(
+ keys.every((one) => typeof one === "string" && one.length > 0),
+ ).toBe(true);
+ expect(new Set(keys).size).toBe(2);
+
+ // The row under the dialog was read again: it names the new provider.
+ await dialog.getByRole("button", { name: "Done" }).click();
+ await page
+ .getByRole("button", {
+ name: /Anthropic.*Uses your Anthropic API key\./,
+ })
+ .waitFor();
+ } finally {
+ await page.close();
+ }
+ }, 90_000);
+
+ for (const engine of engines)
+ test(`a provider whose key is still kept connects with it, no key pasted, in ${engine}`, async () => {
+ const server = new FakeServer();
+ server.connection = {
+ ...server.connection,
+ provider: "anthropic",
+ saved: [
+ { provider: "openai", login: "api-key", endpointHost: null },
+ { provider: "anthropic", login: "api-key", endpointHost: null },
+ ],
+ };
+ const page = await open("/settings", server, engine, "light", WIDE);
+ try {
+ await page.getByRole("button", { name: /^Anthropic/ }).click();
+ const dialog = page.getByRole("dialog");
+ await dialog.waitFor();
+ await style(page);
+ await dialog
+ .getByRole("button", { name: "Change", exact: true })
+ .click();
+ await dialog.getByRole("button", { name: /^OpenAI/ }).click();
+ const saved = dialog.getByRole("checkbox", {
+ name: "Use the saved key",
+ });
+ await saved.waitFor();
+ expect(await saved.getAttribute("aria-checked")).toBe("true");
+ expect(await dialog.getByLabel("OpenAI API key").count()).toBe(0);
+ await dialog.getByRole("button", { name: "Connect" }).click();
+ await dialog.getByText("Connected to OpenAI").waitFor();
+ expect(server.replaces.map((replace) => replace.body)).toEqual([
+ { provider: "openai", login: "api-key", useSavedKey: true },
+ ]);
+ } finally {
+ await page.close();
+ }
+ }, 60_000);
+
+ for (const engine of engines)
+ for (const theme of THEMES)
+ test(`at a phone's width the dialog fits, in ${engine}, ${theme}`, async () => {
+ const server = new FakeServer();
+ const page = await open("/settings", server, engine, theme, PHONE);
+ try {
+ await page.getByRole("button", { name: /^OpenAI/ }).click();
+ const dialog = page.getByRole("dialog");
+ await dialog.waitFor();
+ await style(page);
+ await dialog
+ .getByRole("button", { name: "Change", exact: true })
+ .click();
+ await dialog
+ .getByRole("button", { name: /^Any OpenAI-compatible/ })
+ .click();
+ await dialog.getByLabel("Address").fill("https://llm.example.com/v1");
+ await dialog.getByLabel("Model name").fill("llama-5-70b");
+ expect(await measured(page)).toEqual(FINE);
+ await shoot(page, "endpoint", engine, theme, PHONE);
+ } finally {
+ await page.close();
+ }
+ }, 60_000);
+
+ // Two Settings pages from before, to look at beside the new dialog.
+ test.skipIf(!shots)(
+ "screenshots of General and API keys from before",
+ async () => {
+ for (const engine of engines)
+ for (const theme of THEMES) {
+ const server = new FakeServer();
+ const page = await open(
+ "/settings/api-keys",
+ server,
+ engine,
+ theme,
+ WIDE,
+ );
+ try {
+ await page
+ .getByRole("button", { name: /Create/ })
+ .first()
+ .waitFor();
+ await style(page);
+ await page
+ .getByRole("button", { name: /Create/ })
+ .first()
+ .click();
+ await page.getByRole("dialog").waitFor();
+ await shoot(page, "compare-api-keys", engine, theme, WIDE);
+ } finally {
+ await page.close();
+ }
+ }
+ },
+ 120_000,
+ );
+});
diff --git a/app/tests/ai-connection-providers.test.ts b/app/tests/ai-connection-providers.test.ts
new file mode 100644
index 0000000000..2564a6533d
--- /dev/null
+++ b/app/tests/ai-connection-providers.test.ts
@@ -0,0 +1,64 @@
+import { expect, test } from "bun:test";
+import { readFileSync } from "node:fs";
+import { join } from "node:path";
+import { AI_PROVIDERS } from "@/lib/ai-connection/providers";
+
+/**
+ * Settings offers the same providers as Desktop's setup window, in its order, with its names,
+ * summaries, ways in and marks. The setup window's list is `catalogue()` in
+ * desktop/src-tauri/src/provider.rs; a change there that Settings does not follow fails here.
+ */
+const rust = readFileSync(
+ join(
+ import.meta.dir,
+ "..",
+ "..",
+ "desktop",
+ "src-tauri",
+ "src",
+ "provider.rs",
+ ),
+ "utf8",
+);
+
+const LOGINS: Record = {
+ Plan: "plan",
+ ApiKey: "api-key",
+ Endpoint: "endpoint",
+ Oauth: "oauth",
+};
+
+/** Each `Provider { ... }` in the catalogue, read for the fields Settings draws. */
+function catalogue() {
+ const body = rust.slice(rust.indexOf("pub fn catalogue()"));
+ return [...body.matchAll(/Provider \{([\s\S]*?)caution:/g)].map((match) => {
+ const block = match[1] ?? "";
+ const field = (name: string) =>
+ new RegExp(`${name}: "([^"]*)"\\.into\\(\\)`).exec(block)?.[1];
+ const logins = /logins: vec!\[([^\]]*)\]/.exec(block)?.[1] ?? "";
+ const mark = /mark: (None|Some\("([^"]*)"\.into\(\)\))/.exec(block);
+ return {
+ id: field("id"),
+ name: field("name"),
+ summary: field("summary"),
+ logins: [...logins.matchAll(/Login::(\w+)/g)].map(
+ (login) => LOGINS[login[1] ?? ""],
+ ),
+ mark: mark?.[2] ?? null,
+ };
+ });
+}
+
+test("Settings lists the setup window's providers, in its order and words", () => {
+ const desktop = catalogue();
+ expect(desktop.length).toBe(6);
+ expect(
+ AI_PROVIDERS.map(({ id, name, summary, logins, mark }) => ({
+ id,
+ name,
+ summary,
+ logins,
+ mark,
+ })),
+ ).toEqual(desktop);
+});
diff --git a/app/tests/app-navigation.test.tsx b/app/tests/app-navigation.test.tsx
index ec6b7eb045..ad3d271c0d 100644
--- a/app/tests/app-navigation.test.tsx
+++ b/app/tests/app-navigation.test.tsx
@@ -121,6 +121,7 @@ function renderSidebar(
queryClient.setQueryData(userPreferencesQueryOptions("maya").queryKey, {
messageListEmphasis: "thread",
selfHostBannerDismissed: true,
+ dismissedNotices: [],
narration: null,
skin: "openbot",
proactive: "on",
diff --git a/app/tests/bot-setup-engine.test.tsx b/app/tests/bot-setup-engine.test.tsx
new file mode 100644
index 0000000000..c8a68300db
--- /dev/null
+++ b/app/tests/bot-setup-engine.test.tsx
@@ -0,0 +1,117 @@
+import {
+ afterAll,
+ afterEach,
+ beforeAll,
+ beforeEach,
+ expect,
+ test,
+} from "bun:test";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import {
+ createMemoryHistory,
+ createRootRoute,
+ createRouter,
+ RouterProvider,
+} from "@tanstack/react-router";
+import { cleanup, render, within } from "@testing-library/react";
+import type { ReactNode } from "react";
+import { SetupSections } from "@/components/bot-profile/setup";
+import type { AgentProfile } from "@/lib/agents/queries";
+import { DEPLOYMENT_PATH, deploymentResponse } from "./admin-settings-api";
+
+/**
+ * A Bot's Setup says what runs it. A Bot made from New Bot runs inside OpenBot on the LangGraph
+ * (TypeScript) engine, and the Bot API names that as its framework; its Connection says so, under
+ * "Built in", so a person can see which engine answers. A Bot that runs on OpenBot's own agent, as
+ * every Bot made before does, shows "Built in" alone.
+ */
+
+beforeAll(() => GlobalRegistrator.register());
+afterEach(cleanup);
+afterAll(() => GlobalRegistrator.unregister());
+
+const originalFetch = global.fetch;
+
+beforeEach(() => {
+ global.fetch = Object.assign(
+ async (path: Parameters[0]) =>
+ path === DEPLOYMENT_PATH
+ ? deploymentResponse({ builtInBots: true })
+ : new Response(null, { status: 404 }),
+ { preconnect: originalFetch.preconnect },
+ );
+});
+
+afterEach(() => {
+ global.fetch = originalFetch;
+});
+
+const BOT: AgentProfile = {
+ assignedToMe: false,
+ runsOnOpenBotModel: false,
+ keyFromOpenBot: false,
+ id: "tide-table-clerk",
+ name: "Tide Table Clerk",
+ title: "Powered by OpenBot",
+ roleDescription: "You answer questions about harbours.",
+ avatarSeed: "tide-table-clerk",
+ visibility: "private",
+ endpoint: null,
+ builtIn: true,
+ hasAuth: false,
+ hasCallbackToken: false,
+ isolated: false,
+ isolationActive: false,
+ isolationOffReason: null,
+ hidden: false,
+ pinned: false,
+ systemOwned: false,
+ canManage: true,
+ mine: true,
+};
+
+/** The Setup sections inside a router of one route, for the links they hold. */
+function draw(screen: ReactNode) {
+ const queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+ });
+ const router = createRouter({
+ history: createMemoryHistory({ initialEntries: ["/"] }),
+ routeTree: createRootRoute({ component: () => screen }),
+ });
+ return render(
+
+
+ ,
+ );
+}
+
+async function connection(bot: AgentProfile) {
+ const view = draw();
+ const heading = await view.findByRole("heading", { name: "Connection" });
+ const section = heading.closest("section") ?? heading.parentElement;
+ if (!section) throw new Error("no Connection section");
+ return within(section as HTMLElement);
+}
+
+test("a Bot on the LangGraph (TypeScript) engine names it under Built in", async () => {
+ const section = await connection({
+ ...BOT,
+ framework: "LangGraph (TypeScript)",
+ });
+ expect(section.getByText("Built in")).toBeTruthy();
+ expect(section.getByText("Runs on")).toBeTruthy();
+ expect(
+ section.getByText("LangGraph (TypeScript)", { exact: true }),
+ ).toBeTruthy();
+});
+
+test("a Bot on OpenBot's own agent shows Built in alone", async () => {
+ for (const framework of ["OpenBot", undefined]) {
+ const section = await connection({ ...BOT, framework });
+ expect(section.getByText("Built in")).toBeTruthy();
+ expect(section.queryByText("Runs on")).toBeNull();
+ cleanup();
+ }
+});
diff --git a/app/tests/browser-nav-item.test.tsx b/app/tests/browser-nav-item.test.tsx
index e2e0add485..2f7b201ca0 100644
--- a/app/tests/browser-nav-item.test.tsx
+++ b/app/tests/browser-nav-item.test.tsx
@@ -138,6 +138,7 @@ function renderSidebar() {
queryClient.setQueryData(userPreferencesQueryOptions("maya").queryKey, {
messageListEmphasis: "thread",
selfHostBannerDismissed: true,
+ dismissedNotices: [],
narration: null,
skin: "openbot",
proactive: "on",
diff --git a/app/tests/channel-chat.test.ts b/app/tests/channel-chat.test.ts
index a790d93b46..87045f2a0c 100644
--- a/app/tests/channel-chat.test.ts
+++ b/app/tests/channel-chat.test.ts
@@ -164,6 +164,41 @@ describe("toMessageContent", () => {
expect(parts[0]?.type).toBe("document");
});
+ /*
+ * THE SIZE AND THE TYPE THE SERVER FOUND GO WITH THE PART, so a transcript can decide how to draw
+ * a picture without fetching it. Pictures go up to 100MB, and a tile that downloads the whole file
+ * to draw a 128px thumbnail costs every reader that much on first paint.
+ */
+ test("a stored picture carries its size and the type the server found", () => {
+ const picture = attachment({
+ id: "att_big",
+ type: "image",
+ size: 99_553_808,
+ source: {
+ type: "url",
+ value: "https://example.test/placeholder",
+ mimeType: "image/png",
+ },
+ metadata: { attachmentId: "att_big", filename: "site-survey.png" },
+ });
+
+ const [part] = toMessageContent("", [picture]) as unknown[];
+
+ expect(part).toEqual({
+ type: "image",
+ source: {
+ type: "url",
+ value: attachmentUrl("att_big"),
+ mimeType: "image/png",
+ },
+ metadata: {
+ attachmentId: "att_big",
+ filename: "site-survey.png",
+ sizeBytes: 99_553_808,
+ },
+ });
+ });
+
test("the ref's id comes from metadata.attachmentId, not attachment.id", () => {
const image = attachment({
// The SDK's own client-side upload placeholder — must never reach the wire.
diff --git a/app/tests/channel-failed-run-restore.test.tsx b/app/tests/channel-failed-run-restore.test.tsx
index edad8d8065..30a36824bd 100644
--- a/app/tests/channel-failed-run-restore.test.tsx
+++ b/app/tests/channel-failed-run-restore.test.tsx
@@ -55,6 +55,8 @@ const REJECTED = "invalid x-api-key";
/** How the next `/run` goes. A fresh one per test. */
type RunPlan =
| { kind: "fails"; message: string }
+ /** The Bot works (it says what it found, and reads an app) and then the run fails. */
+ | { kind: "worksThenFails"; text: string; message: string }
| { kind: "calls"; tool: string }
| { kind: "answers"; text: string }
| { kind: "stalls"; text: string }
@@ -168,6 +170,33 @@ function run(input: RunAgentInput): Response {
record(input.threadId, events);
return sse(events);
}
+ if (plan.kind === "worksThenFails") {
+ const said = `said-${input.runId}`;
+ const read = `read-${input.runId}`;
+ const events = [
+ started,
+ { type: "TEXT_MESSAGE_START", messageId: said, role: "assistant" },
+ { type: "TEXT_MESSAGE_CONTENT", messageId: said, delta: plan.text },
+ { type: "TEXT_MESSAGE_END", messageId: said },
+ {
+ type: "TOOL_CALL_START",
+ toolCallId: read,
+ toolCallName: "mcp__composio-hubspot__HUBSPOT_SEARCH_DEALS",
+ parentMessageId: said,
+ },
+ { type: "TOOL_CALL_ARGS", toolCallId: read, delta: "{}" },
+ { type: "TOOL_CALL_END", toolCallId: read },
+ {
+ type: "TOOL_CALL_RESULT",
+ messageId: `result-${input.runId}`,
+ toolCallId: read,
+ content: '{"deals":2}',
+ },
+ { type: "RUN_ERROR", message: plan.message, code: "agent_error" },
+ ];
+ record(input.threadId, events);
+ return sse(events);
+ }
const messageId = `reply-${input.runId}`;
const reply = [
{ type: "TEXT_MESSAGE_START", messageId, role: "assistant" },
@@ -560,6 +589,52 @@ test("a Bot that says why it failed is not asked about again", async () => {
expect(botReads).toBe(before);
});
+/** What is typed in the composer: the editor the words live in. */
+function typed(view: ReturnType): string {
+ return (
+ view.container.querySelector("[contenteditable]")?.textContent ?? ""
+ ).trim();
+}
+
+/*
+ * FOUND IN DOGFOODING. A Bot looked up HubSpot deals for five minutes, then its run failed, and the
+ * person's message came back in the box, ready to send again. Sent again, it runs the whole request
+ * from the start and repeats what already ran. A turn that never got going still hands its words
+ * back, so they can be sent once it can.
+ */
+test("a turn that failed after it had done some work keeps its message sent, and the box stays empty", async () => {
+ const FAILED =
+ "Claude's reply came back incomplete, so the Bot stopped. Ask it to carry on.";
+ plans = [
+ {
+ kind: "worksThenFails",
+ text: "Looking up deals at S1 and later.",
+ message: FAILED,
+ },
+ ];
+ const live = open();
+ await send(live, "Find all HubSpot deals at S1 and later");
+ expect((await live.findByTestId("transcript-stopped")).textContent).toBe(
+ FAILED,
+ );
+ await waitFor(() =>
+ expect(live.queryByRole("button", { name: "Stop the Bot" })).toBeNull(),
+ );
+ expect(typed(live)).toBe("");
+ // Once, where it was sent.
+ expect(
+ live.getAllByText("Find all HubSpot deals at S1 and later"),
+ ).toHaveLength(1);
+});
+
+test("a turn that failed before it did anything hands the words back to send again", async () => {
+ plans = [{ kind: "fails", message: REJECTED }];
+ const live = open();
+ await send(live, "Summarise my inbox");
+ await live.findByTestId("transcript-stopped");
+ await waitFor(() => expect(typed(live)).toBe("Summarise my inbox"));
+});
+
test("a turn that fails in a run after its browser steps says so, as one that fails at once does", async () => {
// The Bot works through browser steps, each answered here and sent back in a run of its own, and
// the run after the last of them fails. That turn used to end on its steps with nothing said.
diff --git a/app/tests/channel-history-refresh.test.tsx b/app/tests/channel-history-refresh.test.tsx
index 20c1e7e81a..a3a5995870 100644
--- a/app/tests/channel-history-refresh.test.tsx
+++ b/app/tests/channel-history-refresh.test.tsx
@@ -417,7 +417,8 @@ test.each([
async () => new NativeResponse("failed", { status: 500 }),
snapshot,
);
- await view.findByText(unavailable);
+ // Said once the retries a failed read on opening gets have failed too.
+ await view.findByText(unavailable, {}, { timeout: 6000 });
if (snapshot.length > 0)
expect(view.getByText(initial.content)).toBeTruthy();
const user = userEvent.setup({ document: view.container.ownerDocument });
@@ -919,7 +920,14 @@ test.each([false, true])(
},
);
-test("a stalled mount history read releases the send gate and shows unavailable history", async () => {
+/*
+ * A STALL RELEASES THE SEND GATE AT ONCE, AND IS SAID ONLY ONCE ASKING AGAIN HAS FAILED TOO. The
+ * read on opening gives up after its deadline, and the message waiting behind it goes then, as it
+ * always has. What changed is the notice: a read that was only slow (seen on a link busy with a
+ * 95MB picture) used to say "Couldn't load earlier messages" on its first deadline. It is asked
+ * again the way a refresh is, and the notice comes only when every try has failed.
+ */
+test("a stalled mount history read releases the send gate at once, and says so only after its retries fail", async () => {
const pending = delayedResponse();
const view = mounting((_threadId) => pending.promise, [initial]);
await waitFor(() => expect(historyReads).toHaveLength(1));
@@ -930,8 +938,12 @@ test("a stalled mount history read releases the send gate and shows unavailable
);
await user.click(view.getByRole("button", { name: "Send message" }));
- await view.findByText(unavailable, {}, { timeout: 4000 });
+ // Released by the first read's deadline, as before, and no notice yet: it is being asked again.
await waitFor(() => expect(runRequests).toHaveLength(1), { timeout: 4000 });
+ expect(view.queryByText(unavailable)).toBeNull();
+
+ await view.findByText(unavailable, {}, { timeout: 12_000 });
+ expect(historyReads.length).toBeGreaterThanOrEqual(4);
expect(runRequests[0]?.path).toBe("/api/copilotkit/agent/refresh-bot/run");
expect(runRequests[0]?.input.threadId).toBe(channel.threadId);
expect(runRequests[0]?.input.messages.slice(0, -1)).toEqual([initial]);
@@ -945,7 +957,21 @@ test("a stalled mount history read releases the send gate and shows unavailable
expect(currentAgent().messages.map((message) => message.id)).not.toContain(
fresh.id,
);
-});
+}, 20_000);
+
+test("a mount history read that succeeds on a retry shows its messages and no notice", async () => {
+ let reads = 0;
+ const view = mounting(async () => {
+ reads += 1;
+ return reads === 1
+ ? new NativeResponse("failed", { status: 500 })
+ : stored([initial, fresh]);
+ });
+
+ await view.findByText(fresh.content, {}, { timeout: 6000 });
+ expect(view.queryByText(unavailable)).toBeNull();
+ expect(historyReads.length).toBeGreaterThanOrEqual(2);
+}, 10_000);
test("a UI send waits for mount history before adding its message", async () => {
const pending = delayedResponse();
@@ -1208,7 +1234,12 @@ test.each([false, true])(
? stored([initial])
: new NativeResponse("failed", { status: 500 }),
);
- await view.findByText(prefixPresent ? initial.content : unavailable);
+ // A failed read on opening is said once its retries have failed too.
+ await view.findByText(
+ prefixPresent ? initial.content : unavailable,
+ {},
+ { timeout: 6000 },
+ );
const user = userEvent.setup({ document: view.container.ownerDocument });
const editor = view.getByRole("textbox", { name: "Message" });
await user.type(editor, "Local turn after mount completed");
diff --git a/app/tests/channel-join-replay.test.tsx b/app/tests/channel-join-replay.test.tsx
index f7cb5a8c2a..5da4297e2f 100644
--- a/app/tests/channel-join-replay.test.tsx
+++ b/app/tests/channel-join-replay.test.tsx
@@ -445,11 +445,12 @@ test("a conversation opened while nothing answers says its history could not be
);
const view = opened();
+ // Said once the read on opening and the retries after it have all run out of time.
await view.findByText(/Couldn't load earlier messages\./, undefined, {
- timeout: 12_000,
+ timeout: 20_000,
});
expect(view.queryByRole("button", { name: "Stop the Bot" })).toBeNull();
-}, 20_000);
+}, 30_000);
/*
* The conversation's real route, under the app's layout ids, beside a home page to leave it for.
diff --git a/app/tests/channel-pagination.test.tsx b/app/tests/channel-pagination.test.tsx
index 66853696ed..d309bb98b1 100644
--- a/app/tests/channel-pagination.test.tsx
+++ b/app/tests/channel-pagination.test.tsx
@@ -179,6 +179,7 @@ function renderSidebar() {
queryClient.setQueryData(userPreferencesQueryOptions("user").queryKey, {
messageListEmphasis: "thread",
selfHostBannerDismissed: false,
+ dismissedNotices: [],
narration: null,
skin: "openbot",
proactive: "on",
@@ -258,6 +259,7 @@ test("message emphasis updates mounted rows from the account preferences cache",
clients[0]?.setQueryData(userPreferencesQueryOptions("user").queryKey, {
messageListEmphasis: "agent",
selfHostBannerDismissed: false,
+ dismissedNotices: [],
narration: null,
skin: "openbot",
proactive: "on",
diff --git a/app/tests/client-name-header.test.ts b/app/tests/client-name-header.test.ts
new file mode 100644
index 0000000000..f480e0e709
--- /dev/null
+++ b/app/tests/client-name-header.test.ts
@@ -0,0 +1,99 @@
+/**
+ * Every request this app makes to its OpenBot names the app: `OpenBot-Client: web/`.
+ *
+ * The server reads the header to refuse an app older than it serves (CLIENT_UPDATE_REQUIRED) and to
+ * count which apps still call what. These requests leave through the app's real transport
+ * (`lib/client.ts`, and the generated client's mutator on top of it) and reach a real HTTP server on
+ * this computer, which records what arrived. The page is addressed at that server, as a page is at
+ * the OpenBot that served it.
+ */
+import { afterAll, beforeAll, beforeEach, expect, test } from "bun:test";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import {
+ CLIENT_HEADER,
+ clientToken,
+ RELEASE,
+} from "@openbot/shared/client-version";
+import { getDeployment } from "@/lib/api/generated/organization-settings/organization-settings";
+import { listOrganizations } from "@/lib/api/generated/organizations/organizations";
+import { client, tryClient } from "@/lib/client";
+import { nativeFetch, pageFetch } from "./page-fetch";
+import { settleReactWork } from "./settle-react-work";
+
+type Seen = { path: string; headers: Headers };
+let seen: Seen[] = [];
+let openbot: ReturnType;
+// The server answers in the runtime's own Response, not the page's.
+const NativeResponse = globalThis.Response;
+
+beforeAll(() => {
+ openbot = Bun.serve({
+ hostname: "127.0.0.1",
+ port: 0,
+ fetch(request) {
+ const path = new URL(request.url).pathname;
+ seen.push({ path, headers: request.headers });
+ if (path.endsWith("/deployment"))
+ return NativeResponse.json({ edition: "team", api: ["v2"] });
+ if (path === "/api/v2/people/me/organizations")
+ return NativeResponse.json({ organizations: [], nextCursor: null });
+ return NativeResponse.json({ thing: { id: "one" } });
+ },
+ });
+ GlobalRegistrator.register({ url: `http://127.0.0.1:${openbot.port}/` });
+ // The page is at the server.
+ globalThis.fetch = pageFetch();
+});
+beforeEach(() => {
+ seen = [];
+});
+afterAll(async () => {
+ globalThis.fetch = nativeFetch;
+ await settleReactWork();
+ await GlobalRegistrator.unregister();
+ openbot.stop(true);
+});
+
+const NAMED = clientToken("web", RELEASE);
+
+function headerAt(path: string): string | null {
+ const request = seen.find((one) => one.path === path);
+ if (!request) throw new Error(`nothing reached ${path}`);
+ return request.headers.get(CLIENT_HEADER);
+}
+
+test(`a request through the client says ${NAMED}`, async () => {
+ expect(NAMED).toBe(`web/${RELEASE}`);
+ await client("/api/things/one", "thing");
+ expect(headerAt("/api/things/one")).toBe(NAMED);
+});
+
+test("a generated operation says it too", async () => {
+ await getDeployment("default", { fallback: "Couldn't load OpenBot." });
+ expect(headerAt("/api/v2/organizations/default/deployment")).toBe(NAMED);
+});
+
+test("beside the headers a caller gives, as a record or as Headers", async () => {
+ await tryClient("/api/things/record", {
+ method: "POST",
+ body: { a: 1 },
+ headers: { "OpenBot-Organization": "default" },
+ });
+ const record = seen.find((one) => one.path === "/api/things/record");
+ expect(record?.headers.get(CLIENT_HEADER)).toBe(NAMED);
+ expect(record?.headers.get("OpenBot-Organization")).toBe("default");
+ expect(record?.headers.get("content-type")).toBe("application/json");
+
+ // getDeployment hands its options' headers to the transport as they were given: here, Headers.
+ await getDeployment("given", {
+ headers: new Headers({ "OpenBot-Organization": "default" }),
+ });
+ const given = seen.find(
+ (one) => one.path === "/api/v2/organizations/given/deployment",
+ );
+ expect(given?.headers.get(CLIENT_HEADER)).toBe(NAMED);
+ expect(given?.headers.get("OpenBot-Organization")).toBe("default");
+
+ await listOrganizations({ limit: 1 });
+ expect(headerAt("/api/v2/people/me/organizations")).toBe(NAMED);
+});
diff --git a/app/tests/client-version-gate.test.tsx b/app/tests/client-version-gate.test.tsx
new file mode 100644
index 0000000000..fd7be15e9f
--- /dev/null
+++ b/app/tests/client-version-gate.test.tsx
@@ -0,0 +1,454 @@
+/**
+ * When this app and the OpenBot it talks to can't work together, the person reads one sentence in
+ * place of the app: "Update OpenBot" when the app is too old, "Ask whoever runs your OpenBot to
+ * update it" when the OpenBot is. Before sign-in as well as after, and nothing that fails behind it.
+ *
+ * The app is the real one at its root: the root route's own component, the sign-in screen and the
+ * sign-in gate, the app's query client and its transport. The OpenBot is a real HTTP server on this
+ * computer answering `deployment` with the real answers in shared/fixtures/client-version/cases.json,
+ * and refusing every other v2 operation the way an OpenBot does: an app the header names below the
+ * minimum its `deployment` publishes gets 400 CLIENT_UPDATE_REQUIRED, with the rules the server uses
+ * (shared/client-version.ts). A tab left open across an upgrade meets that refusal on any request,
+ * and the screen comes up the same; the spec's own example of the refusal is served for that.
+ */
+import {
+ afterAll,
+ afterEach,
+ beforeAll,
+ beforeEach,
+ expect,
+ test,
+} from "bun:test";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import {
+ APP_UPDATE_SENTENCE,
+ belowMinimum,
+ CLIENT_HEADER,
+ CLIENT_UPDATE_REQUIRED,
+ type ClientKind,
+ clientUpdateDetail,
+ compatibility,
+ parseClientHeader,
+ RELEASE,
+ SECURITY_UPDATE_SENTENCE,
+ SERVER_UPDATE_SENTENCE,
+} from "@openbot/shared/client-version";
+import { DOESNT_UPDATE_ITSELF } from "@openbot/shared/desktop-updates";
+import { QueryClientProvider } from "@tanstack/react-query";
+import {
+ type AnyRoute,
+ createMemoryHistory,
+ createRootRouteWithContext,
+ createRoute,
+ createRouter,
+ Outlet,
+ RouterProvider,
+} from "@tanstack/react-router";
+import { cleanup, render, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { ClientVersionGate } from "@/components/layout/client-version-gate";
+import { forgetClientRefusal } from "@/lib/client-version/refusal";
+import type { CompatibleApp } from "@/lib/deployment/queries";
+import { queryClient } from "@/query-client";
+import type { RouterContext } from "@/router-context";
+import { Route as RootRoute } from "@/routes/__root";
+import { Route as AuthedRoute } from "@/routes/_authed";
+import { Route as SignRoute } from "@/routes/sign";
+import cases from "../../shared/fixtures/client-version/cases.json";
+import { nativeFetch, pageFetch } from "./page-fetch";
+import { settleReactWork } from "./settle-react-work";
+
+type DeploymentName = keyof typeof cases.deployments;
+
+/** This app, as it names itself. */
+const THIS_WEB = { kind: "web" as const, version: RELEASE };
+
+/** The spec's example of the refusal (api/openapi/common.yaml, `clientUpdateRequired`), as is. */
+const SPEC_REFUSAL = {
+ type: "https://open.bot/errors/client-update-required",
+ title: "This app is too old for this OpenBot.",
+ status: 400,
+ detail:
+ "This OpenBot needs OpenBot Desktop 1.2.0 or later. Update OpenBot, then try again.",
+ code: "CLIENT_UPDATE_REQUIRED",
+ category: "validation",
+ retryable: false,
+ requestId: "req_example",
+ traceId: "trace_example",
+ client: "desktop",
+ minimumVersion: "1.2.0",
+};
+
+/** The spec's example of a refusal for a security problem (`clientUpdateRequiredSecurity`), as is. */
+const SPEC_SECURITY_REFUSAL = {
+ ...SPEC_REFUSAL,
+ detail:
+ "This version of OpenBot has a security problem. Update to keep using it.",
+ security: true,
+};
+
+/** What the OpenBot answers: its `deployment`, and whether it refuses every other v2 operation. */
+let deployment: DeploymentName;
+let refuseEverything: boolean;
+/** What it refuses every other v2 operation with, when it does. */
+let refusalBody: Record;
+const NativeResponse = globalThis.Response;
+let openbot: ReturnType;
+
+function problem(status: number, body: Record): Response {
+ return new NativeResponse(JSON.stringify({ status, ...body }), {
+ status,
+ headers: { "content-type": "application/problem+json" },
+ });
+}
+
+function answer(request: Request): Response {
+ const path = new URL(request.url).pathname;
+ const published = cases.deployments[deployment];
+ if (/^\/api\/v2\/organizations\/[^/]+\/deployment$/.test(path))
+ return NativeResponse.json(published);
+ if (refuseEverything) return problem(400, refusalBody);
+ // A later OpenBot that serves only v3 no longer answers at v2. One that names no API serves v2.
+ if ("api" in published && !published.api.includes("v2"))
+ return problem(404, { code: "NOT_FOUND" });
+ // The server's own rule: an app below the minimum the deployment publishes is refused.
+ const minimums =
+ "minimumClients" in published
+ ? (published.minimumClients as Partial>)
+ : {};
+ const below = belowMinimum(
+ parseClientHeader(request.headers.get(CLIENT_HEADER)),
+ minimums,
+ );
+ if (below)
+ return problem(400, {
+ code: CLIENT_UPDATE_REQUIRED,
+ detail: clientUpdateDetail(below.kind, below.minimum),
+ client: below.kind,
+ minimumVersion: below.minimum,
+ });
+ // Nobody is signed in.
+ return problem(401, {
+ code: "UNAUTHENTICATED",
+ detail: "Sign in to OpenBot.",
+ });
+}
+
+beforeAll(() => {
+ openbot = Bun.serve({ hostname: "127.0.0.1", port: 0, fetch: answer });
+ GlobalRegistrator.register({ url: `http://127.0.0.1:${openbot.port}/` });
+});
+beforeEach(() => {
+ deployment = "current";
+ refuseEverything = false;
+ refusalBody = SPEC_REFUSAL;
+ queryClient.clear();
+ // The page is at the server.
+ globalThis.fetch = pageFetch();
+});
+afterEach(async () => {
+ cleanup();
+ await settleReactWork();
+ queryClient.clear();
+ forgetClientRefusal();
+ delete (window as unknown as Record).__TAURI_INTERNALS__;
+ globalThis.fetch = nativeFetch;
+});
+afterAll(async () => {
+ await settleReactWork();
+ await GlobalRegistrator.unregister();
+ openbot.stop(true);
+});
+
+/**
+ * The app at `/`: the root route's own component around the real sign-in gate and sign-in screen,
+ * on routes of this test's own (re-parenting the app's route objects would take them out of the
+ * app's tree for every test after this one). `app` replaces the root with the gate for another app.
+ */
+function openApp(app?: CompatibleApp) {
+ const root = createRootRouteWithContext()({
+ component: app
+ ? () => (
+
+
+
+ )
+ : (RootRoute.options.component as () => React.JSX.Element),
+ });
+ const gate = AuthedRoute.options as unknown as Record;
+ const authed = createRoute({
+ id: "_authed",
+ getParentRoute: () => root,
+ component: Outlet,
+ ...{ beforeLoad: gate.beforeLoad, errorComponent: gate.errorComponent },
+ } as never) as unknown as AnyRoute;
+ const home = createRoute({
+ getParentRoute: () => authed,
+ path: "/",
+ component: () =>
The app
,
+ } as never) as unknown as AnyRoute;
+ const sign = SignRoute.options as unknown as Record;
+ const signIn = createRoute({
+ getParentRoute: () => root,
+ path: "/sign",
+ ...{
+ validateSearch: sign.validateSearch,
+ beforeLoad: sign.beforeLoad,
+ component: sign.component,
+ },
+ } as never) as unknown as AnyRoute;
+ const router = createRouter({
+ routeTree: root.addChildren([authed.addChildren([home]), signIn]),
+ history: createMemoryHistory({ initialEntries: ["/"] }),
+ context: { queryClient },
+ });
+ return render(
+
+
+ ,
+ );
+}
+
+/** A deployment answer, as `compatibility` reads one. */
+function publishedBy(name: DeploymentName): {
+ api?: unknown;
+ minimumClients?: unknown;
+} {
+ const answer: Record = cases.deployments[name];
+ return answer;
+}
+
+/** The fixture's verdict for an app, so the screen is held to the same cases as every other app. */
+function expected(
+ name: DeploymentName,
+ client: { kind: ClientKind; version: string; speaks?: string[] },
+) {
+ const listed = cases.cases.find(
+ (one) =>
+ one.deployment === name &&
+ one.client.kind === client.kind &&
+ one.client.version === client.version &&
+ JSON.stringify(one.client.speaks ?? null) ===
+ JSON.stringify(client.speaks ?? null),
+ );
+ return listed?.fit ?? compatibility(publishedBy(name), client).fit;
+}
+
+test("an OpenBot of today: the sign-in screen, and no update screen", async () => {
+ expect(RELEASE).toBe("1.1.0");
+ expect(expected("current", THIS_WEB)).toBe("ok");
+ const view = openApp();
+ expect(
+ await view.findByRole(
+ "heading",
+ { name: /Sign in to/ },
+ { timeout: 5_000 },
+ ),
+ ).toBeTruthy();
+ expect(view.queryByText(APP_UPDATE_SENTENCE)).toBeNull();
+ expect(view.queryByText(SERVER_UPDATE_SENTENCE)).toBeNull();
+}, 15_000);
+
+test("an OpenBot whose oldest web app is newer than this one: Update OpenBot, before sign-in", async () => {
+ deployment = "next";
+ expect(expected("next", THIS_WEB)).toBe("app");
+ const view = openApp();
+ expect(
+ await view.findByRole(
+ "heading",
+ { name: APP_UPDATE_SENTENCE },
+ { timeout: 5_000 },
+ ),
+ ).toBeTruthy();
+ expect(
+ view.getByText("This page is from an older version of OpenBot."),
+ ).toBeTruthy();
+ expect(view.getByRole("button", { name: "Update" })).toBeTruthy();
+ // Nothing behind it: no sign-in screen, no error screen.
+ expect(view.queryByRole("heading", { name: /Sign in to/ })).toBeNull();
+ expect(view.queryByRole("alert")).toBeNull();
+}, 15_000);
+
+test("an OpenBot that serves only a newer API: Update OpenBot", async () => {
+ deployment = "v3-only";
+ expect(compatibility(cases.deployments["v3-only"], THIS_WEB).fit).toBe("app");
+ const view = openApp();
+ expect(
+ await view.findByRole(
+ "heading",
+ { name: APP_UPDATE_SENTENCE },
+ { timeout: 5_000 },
+ ),
+ ).toBeTruthy();
+ expect(view.queryByRole("heading", { name: /Sign in to/ })).toBeNull();
+}, 15_000);
+
+test("an app that speaks only a newer API than the OpenBot serves: ask whoever runs it", async () => {
+ const app = { kind: "web" as const, version: "2.0.0", speaks: ["v3"] };
+ expect(
+ expected("current", { kind: "desktop", version: "2.0.0", speaks: ["v3"] }),
+ ).toBe("server");
+ const view = openApp(app);
+ expect(
+ await view.findByRole(
+ "heading",
+ { name: SERVER_UPDATE_SENTENCE },
+ { timeout: 5_000 },
+ ),
+ ).toBeTruthy();
+ expect(
+ view.getByText("This OpenBot is on a release this page can't use yet."),
+ ).toBeTruthy();
+ expect(view.getByRole("button", { name: "Try again" })).toBeTruthy();
+ expect(view.queryByRole("heading", { name: /Sign in to/ })).toBeNull();
+}, 15_000);
+
+test("any request refused with CLIENT_UPDATE_REQUIRED brings up Update OpenBot, in place of what failed", async () => {
+ refuseEverything = true;
+ const view = openApp();
+ expect(
+ await view.findByRole(
+ "heading",
+ { name: APP_UPDATE_SENTENCE },
+ { timeout: 5_000 },
+ ),
+ ).toBeTruthy();
+ expect(view.getByRole("button", { name: "Update" })).toBeTruthy();
+ expect(view.queryByText(SPEC_REFUSAL.detail)).toBeNull();
+ // A plain raise is not a security problem.
+ expect(view.queryByText(SECURITY_UPDATE_SENTENCE)).toBeNull();
+ expect(view.queryByRole("heading", { name: /Sign in to/ })).toBeNull();
+}, 15_000);
+
+test("a refusal for a security problem says so in place of Update OpenBot, with the same Update", async () => {
+ refuseEverything = true;
+ refusalBody = SPEC_SECURITY_REFUSAL;
+ const view = openApp();
+ expect(
+ await view.findByRole(
+ "heading",
+ { name: SECURITY_UPDATE_SENTENCE },
+ { timeout: 5_000 },
+ ),
+ ).toBeTruthy();
+ expect(view.queryByText(APP_UPDATE_SENTENCE)).toBeNull();
+ expect(view.getByRole("button", { name: "Update" })).toBeTruthy();
+ expect(view.queryByRole("heading", { name: /Sign in to/ })).toBeNull();
+}, 15_000);
+
+test("an OpenBot whose deployment raised an app's minimum for a security problem: that app reads the security sentence", async () => {
+ deployment = "security";
+ const app = { kind: "recorder" as const, version: "1.1.0" };
+ expect(compatibility(cases.deployments.security, app)).toEqual({
+ fit: "app",
+ minimum: "1.2.0",
+ security: true,
+ });
+ const view = openApp(app);
+ expect(
+ await view.findByRole(
+ "heading",
+ { name: SECURITY_UPDATE_SENTENCE },
+ { timeout: 5_000 },
+ ),
+ ).toBeTruthy();
+ expect(view.getByRole("button", { name: "Update" })).toBeTruthy();
+ cleanup();
+ // The same OpenBot's plain raise, for an app it raised for no security problem, reads as before.
+ deployment = "raised";
+ queryClient.clear();
+ const plain = openApp(app);
+ expect(
+ await plain.findByRole(
+ "heading",
+ { name: APP_UPDATE_SENTENCE },
+ { timeout: 5_000 },
+ ),
+ ).toBeTruthy();
+ expect(plain.queryByText(SECURITY_UPDATE_SENTENCE)).toBeNull();
+}, 15_000);
+
+/** OpenBot Desktop's window around the page, answering its plugin's update commands. */
+function insideDesktop(updatesItself: boolean, installed: string[]) {
+ (window as unknown as Record).__TAURI_INTERNALS__ = {
+ invoke: async (command: string) => {
+ if (command === "plugin:openbot-desktop|connection")
+ return { mode: "connected", address: openbot.url.origin };
+ if (command === "plugin:openbot-desktop|update_offer")
+ return {
+ version: null,
+ current: "1.0.1",
+ installing: null,
+ updatesItself,
+ ready: null,
+ };
+ if (command === "plugin:openbot-desktop|install_update") {
+ installed.push(command);
+ throw "No update is available right now.";
+ }
+ throw `command ${command} not found`;
+ },
+ transformCallback: () => 0,
+ };
+}
+
+test("inside OpenBot Desktop, a refusal naming OpenBot Desktop offers its own Update and restart", async () => {
+ refuseEverything = true;
+ const installed: string[] = [];
+ insideDesktop(true, installed);
+ const view = openApp();
+ expect(
+ await view.findByRole(
+ "heading",
+ { name: APP_UPDATE_SENTENCE },
+ { timeout: 5_000 },
+ ),
+ ).toBeTruthy();
+ expect(
+ view.getByText("This OpenBot needs OpenBot Desktop 1.2.0 or later."),
+ ).toBeTruthy();
+ const update = await view.findByRole(
+ "button",
+ { name: "Update and restart" },
+ { timeout: 5_000 },
+ );
+ await userEvent.click(update);
+ await waitFor(() => expect(installed).toHaveLength(1));
+ expect(
+ (await view.findByRole("alert", {}, { timeout: 5_000 })).textContent,
+ ).toBe("Couldn't install the update: No update is available right now.");
+}, 15_000);
+
+test("inside OpenBot Desktop, a refusal of it for a security problem says so, with its own Update and restart", async () => {
+ refuseEverything = true;
+ refusalBody = SPEC_SECURITY_REFUSAL;
+ insideDesktop(true, []);
+ const view = openApp();
+ expect(
+ await view.findByRole(
+ "heading",
+ { name: SECURITY_UPDATE_SENTENCE },
+ { timeout: 5_000 },
+ ),
+ ).toBeTruthy();
+ expect(
+ view.getByText("This OpenBot needs OpenBot Desktop 1.2.0 or later."),
+ ).toBeTruthy();
+ expect(
+ await view.findByRole(
+ "button",
+ { name: "Update and restart" },
+ { timeout: 5_000 },
+ ),
+ ).toBeTruthy();
+}, 15_000);
+
+test("inside an OpenBot Desktop that never updates itself, it says what to do instead", async () => {
+ refuseEverything = true;
+ insideDesktop(false, []);
+ const view = openApp();
+ expect(
+ await view.findByText(DOESNT_UPDATE_ITSELF, {}, { timeout: 5_000 }),
+ ).toBeTruthy();
+ expect(view.queryByRole("button", { name: "Update and restart" })).toBeNull();
+}, 15_000);
diff --git a/app/tests/composer-attachment-limits.test.tsx b/app/tests/composer-attachment-limits.test.tsx
new file mode 100644
index 0000000000..675c8f8d48
--- /dev/null
+++ b/app/tests/composer-attachment-limits.test.tsx
@@ -0,0 +1,135 @@
+import {
+ afterAll,
+ afterEach,
+ beforeAll,
+ beforeEach,
+ expect,
+ test,
+} from "bun:test";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import { cleanup, fireEvent, render, waitFor } from "@testing-library/react";
+import { Composer } from "@/components/channels/composer/composer";
+import {
+ attachmentLimitsFrom,
+ DEFAULT_ATTACHMENT_LIMITS,
+} from "@/lib/channels/attachments";
+import { problem } from "./conversations-api";
+import { settleReactWork } from "./settle-react-work";
+
+/**
+ * The composer refuses a picked file with the server's numbers, and with today's 8MB and 1MB when
+ * the server says nothing. Harness as in `composer-attachments-ui.test.tsx`.
+ */
+
+beforeAll(() => GlobalRegistrator.register({ url: "http://127.0.0.1/" }));
+afterEach(cleanup);
+afterAll(async () => {
+ await settleReactWork();
+ GlobalRegistrator.unregister();
+});
+
+const MIB = 1024 * 1024;
+const originalFetch = global.fetch;
+let uploads: string[];
+
+beforeEach(() => {
+ uploads = [];
+ global.fetch = (async (path: string, init: RequestInit) => {
+ if (!/\/conversations\/[^/]+\/attachments$/.test(path))
+ return problem(404, "Not found.");
+ const file = (init.body as FormData).get("file") as File;
+ uploads.push(file.name);
+ return new Response(
+ JSON.stringify({
+ id: "attachment-id",
+ name: file.name,
+ mimeType: "image/png",
+ sizeBytes: file.size,
+ }),
+ { status: 201, headers: { "content-type": "application/json" } },
+ );
+ }) as unknown as typeof fetch;
+});
+
+afterEach(() => {
+ global.fetch = originalFetch;
+});
+
+function drop(form: Element, files: File[]) {
+ fireEvent.drop(form, {
+ dataTransfer: { files, items: [], types: ["Files"] },
+ });
+}
+
+/** A `File` that reports `size` bytes without holding them; the screen reads only the size. */
+function sized(name: string, type: string, size: number): File {
+ const file = new File(["x"], name, { type });
+ Object.defineProperty(file, "size", { value: size });
+ return file;
+}
+
+/** What a server keeping files in an object store publishes. */
+const larger = attachmentLimitsFrom({
+ imageBytes: 100 * MIB,
+ documentBytes: 100 * MIB,
+ fileBytes: 100 * MIB,
+});
+
+test("with no limits from the server, a 9MB image is refused at today's 8MB", async () => {
+ const view = render(
+ {}} />,
+ );
+
+ drop(view.container.querySelector("form") as HTMLFormElement, [
+ sized("site-photo.png", "image/png", 9 * MIB),
+ ]);
+
+ const alert = await view.findByRole("alert");
+ expect(alert.textContent).toContain(
+ "'site-photo.png' is too large for an image. The limit is 8MB.",
+ );
+ expect(uploads).toEqual([]);
+});
+
+test("with the server's 100MB, the same 9MB image goes up, and 101MB is refused naming 100MB", async () => {
+ let refreshed = 0;
+ const view = render(
+ {}}
+ attachmentLimits={{ limits: larger, refresh: () => refreshed++ }}
+ />,
+ );
+ const form = view.container.querySelector("form") as HTMLFormElement;
+
+ const photo = new File([new Uint8Array(9 * MIB)], "site-photo.png", {
+ type: "image/png",
+ });
+ drop(form, [photo]);
+ await waitFor(() => {
+ expect(view.queryByLabelText("Remove site-photo.png")).not.toBeNull();
+ expect(
+ (view.getByLabelText("Send message") as HTMLButtonElement).disabled,
+ ).toBe(false);
+ });
+ expect(uploads).toEqual(["site-photo.png"]);
+ expect(refreshed).toBe(0);
+
+ drop(form, [sized("drone.png", "image/png", 100 * MIB + 1)]);
+ const alert = await view.findByRole("alert");
+ expect(alert.textContent).toContain(
+ "'drone.png' is too large for an image. The limit is 100MB.",
+ );
+ expect(uploads).toEqual(["site-photo.png"]);
+ // A refusal asks the server for its limits again: it may be the first sign they changed.
+ expect(refreshed).toBe(1);
+});
+
+test("the defaults are the smallest a server takes", () => {
+ expect(DEFAULT_ATTACHMENT_LIMITS).toEqual({
+ imageBytes: 8 * MIB,
+ documentBytes: 8 * MIB,
+ fileBytes: MIB,
+ });
+});
diff --git a/app/tests/composer-attachment-strip.test.tsx b/app/tests/composer-attachment-strip.test.tsx
index 7ee036f0f7..2a53003d16 100644
--- a/app/tests/composer-attachment-strip.test.tsx
+++ b/app/tests/composer-attachment-strip.test.tsx
@@ -1,6 +1,6 @@
import { afterAll, afterEach, beforeAll, expect, test } from "bun:test";
import { GlobalRegistrator } from "@happy-dom/global-registrator";
-import { cleanup, render } from "@testing-library/react";
+import { cleanup, fireEvent, render } from "@testing-library/react";
import {
AttachmentStrip,
type StagedFile,
@@ -147,3 +147,36 @@ test("a text file over the extraction ceiling warns it may be read truncated", (
expect(getByText(/· may be cut/)).toBeTruthy();
});
+
+test("a picture the browser cannot draw becomes the file's tile, never an empty box", () => {
+ // Pictures up to 100MB can be attached, and some will not draw in every browser (a phone's memory
+ // limit, a file whose bytes are damaged). The thumbnail must then say what the file is, the way
+ // every other file on the composer does: its name, its kind and its size, and still removable.
+ const removed: string[] = [];
+ const { getByRole, getByText, queryByRole } = render(
+ removed.push(id)}
+ />,
+ );
+
+ fireEvent.error(getByRole("img", { name: "big-photo.png" }));
+
+ expect(queryByRole("img")).toBeNull();
+ expect(getByText("big-photo.png")).toBeTruthy();
+ // Sized the way the file tiles beside it are.
+ expect(getByText("PNG image · 94.9MB")).toBeTruthy();
+ fireEvent.click(getByRole("button", { name: "Remove big-photo.png" }));
+ expect(removed).toEqual(["6"]);
+});
diff --git a/app/tests/composer-attachments-ui.test.tsx b/app/tests/composer-attachments-ui.test.tsx
index 98b196e0c8..659cde3da6 100644
--- a/app/tests/composer-attachments-ui.test.tsx
+++ b/app/tests/composer-attachments-ui.test.tsx
@@ -266,6 +266,29 @@ test("a dropped screenshot shows its preview and goes up to the conversation", a
expect(view.container.querySelector('[role="alert"]')).toBeNull();
});
+/*
+ * THE CHIP IS DRAWN FROM THE FILE ON THIS DEVICE, NOT FETCHED BACK. Pictures go up to 100MB, and a
+ * chip drawn from the server's address downloads the whole file again straight after uploading it,
+ * to draw an 80px square.
+ */
+test("an uploaded picture's chip draws from the file on this device, not from the server", async () => {
+ serverSniffs("image/png");
+ const picture = new File(
+ [new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])],
+ "site-survey.png",
+ { type: "image/png" },
+ );
+ const view = render(
+ {}} />,
+ );
+
+ drop(view.container.querySelector("form") as HTMLFormElement, [picture]);
+ await uploaded(view, picture.name);
+
+ const src = view.container.querySelector("img")?.getAttribute("src") ?? "";
+ expect(src.startsWith("blob:")).toBe(true);
+});
+
/**
* A drag that announced files and handed over none (the webview could not read what was dragged)
* used to stage an empty list: no chip, no refusal, nothing. It says so now.
diff --git a/app/tests/composer-attachments.test.ts b/app/tests/composer-attachments.test.ts
index 1e5465a11a..65c5738ae1 100644
--- a/app/tests/composer-attachments.test.ts
+++ b/app/tests/composer-attachments.test.ts
@@ -4,7 +4,10 @@ import {
FILE_PICKER_ACCEPT,
uploadToChannel,
} from "@/components/channels/composer/attachments";
-import { MAX_IMAGE_BYTES } from "@/lib/channels/attachments";
+import {
+ DEFAULT_ATTACHMENT_LIMITS,
+ MAX_IMAGE_BYTES,
+} from "@/lib/channels/attachments";
import { problemBody } from "./conversations-api";
/**
@@ -194,14 +197,28 @@ describe("uploadToChannel", () => {
});
describe("attachmentsConfigFor", () => {
- test("maxSize is MAX_IMAGE_BYTES", () => {
+ test("maxSize is the largest of the limits the screen used", () => {
const config = attachmentsConfigFor(
"chan_1",
"group_1",
() => {},
() => {},
+ DEFAULT_ATTACHMENT_LIMITS,
);
expect(config.maxSize).toBe(MAX_IMAGE_BYTES);
+
+ const larger = attachmentsConfigFor(
+ "chan_1",
+ "group_1",
+ () => {},
+ () => {},
+ {
+ imageBytes: 100 * 1024 * 1024,
+ documentBytes: 100 * 1024 * 1024,
+ fileBytes: 1024 * 1024,
+ },
+ );
+ expect(larger.maxSize).toBe(100 * 1024 * 1024);
});
/**
@@ -220,6 +237,7 @@ describe("attachmentsConfigFor", () => {
"group_1",
() => {},
() => {},
+ DEFAULT_ATTACHMENT_LIMITS,
);
expect(config.accept).toBe("*/*");
diff --git a/app/tests/composer-dictation-language.fixture.tsx b/app/tests/composer-dictation-language.fixture.tsx
new file mode 100644
index 0000000000..50585c11a9
--- /dev/null
+++ b/app/tests/composer-dictation-language.fixture.tsx
@@ -0,0 +1,65 @@
+import { CopilotKitProvider } from "@copilotkit/react-core/v2";
+import { QueryClientProvider } from "@tanstack/react-query";
+import { createRoot } from "react-dom/client";
+import { Composer } from "@/components/channels/composer/composer";
+import { deploymentKeys } from "@/lib/deployment/queries";
+import { queryClient } from "@/query-client";
+import { installDesktopShell } from "./desktop-shell.fixture";
+
+/**
+ * A conversation's message box on a page of its own, for composer-dictation-language.test.tsx to
+ * bundle and load in Chromium and WebKit. OpenBot has no transcription provider, and this is the
+ * Desktop window on a Mac whose recognizer has no English (United Kingdom) on the device:
+ *
+ * - `?case=fallback`: it has English (United States), and hears a few words once listening.
+ * - `?case=none`: it has no language at all.
+ *
+ * The browser's locale is the page's language. `?theme=dark` draws it dark.
+ */
+const params = new URLSearchParams(location.search);
+if (params.get("theme") === "dark")
+ document.documentElement.classList.add("dark");
+
+queryClient.setQueryData(deploymentKeys.capabilities(), {
+ generativeUi: true,
+ transcription: false,
+});
+const fallback = params.get("case") === "fallback";
+const { calls } = installDesktopShell({
+ availability: (language) =>
+ fallback && language === "en-US" ? "available" : "unavailable",
+ heard: [
+ { type: "result", index: 0, text: "book a table", final: false },
+ { type: "result", index: 0, text: "book a table for two", final: false },
+ ],
+});
+/** What the page asked the desktop app, for the test to read. */
+(window as { shellCalls?: unknown }).shellCalls = calls;
+
+function Thread() {
+ return (
+
+
+ A conversation above the box.
+
+
+ {}}
+ />
+
+
+ );
+}
+
+const root = document.getElementById("root");
+if (root) {
+ createRoot(root).render(
+
+
+
+
+ ,
+ );
+}
diff --git a/app/tests/composer-dictation-language.test.tsx b/app/tests/composer-dictation-language.test.tsx
new file mode 100644
index 0000000000..e738c78801
--- /dev/null
+++ b/app/tests/composer-dictation-language.test.tsx
@@ -0,0 +1,247 @@
+import { afterAll, beforeAll, describe, expect, test } from "bun:test";
+import { existsSync, mkdirSync, readFileSync } from "node:fs";
+import { dirname, join } from "node:path";
+import type { Browser, Page } from "playwright-core";
+import { compile } from "tailwindcss";
+
+/**
+ * FOUND IN DOGFOODING. OpenBot Desktop on a Mac set to English (United Kingdom), with Dictation on for
+ * English (United Kingdom) and English (United States), said "This computer can't take dictation in
+ * your language." The Mac's recognizer has no English (United Kingdom) on the device, and OpenBot
+ * asked for nothing else. It now listens in English (United States), and when no language is on the
+ * device it says which language and where to add it.
+ *
+ * Rendered in a real browser, in the engine the Mac window draws with (WebKit) and in Chromium,
+ * because the page's language is the browser's own `navigator.language`, set here by the browser's
+ * locale, and its names for languages are the engine's. The composer is the real component, bundled
+ * from the fixture beside this file, with the desktop app faked by its channel contract.
+ *
+ * OPENBOT_APP_BROWSER=1 bun test app/tests/composer-dictation-language.test.tsx
+ *
+ * Chromium by default, as CI has it. OPENBOT_APP_ENGINES=chromium,webkit adds WebKit. With
+ * OPENBOT_APP_SHOTS= each state is saved as dictation-fallback---.png.
+ */
+const asked = process.env.OPENBOT_APP_BROWSER === "1";
+const shots = process.env.OPENBOT_APP_SHOTS;
+const engines = (process.env.OPENBOT_APP_ENGINES ?? "chromium")
+ .split(",")
+ .map((engine) => engine.trim())
+ .filter((engine) => engine === "chromium" || engine === "webkit") as (
+ | "chromium"
+ | "webkit"
+)[];
+
+const APP = join(import.meta.dir, "..");
+const ORIGIN = "http://openbot.test";
+/** The desktop app's dictation runs on macOS and Windows; the browsers on Linux CI say they are a Mac. */
+const MAC =
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)";
+const NONE =
+ "This Mac can't take dictation in English (United Kingdom). Turn on Dictation and add the language in System Settings, under Keyboard, then try again.";
+
+async function bundle(): Promise {
+ const built = await Bun.build({
+ entrypoints: [
+ join(import.meta.dir, "composer-dictation-language.fixture.tsx"),
+ ],
+ target: "browser",
+ define: { "process.env.NODE_ENV": JSON.stringify("production") },
+ });
+ if (!built.success) throw new AggregateError(built.logs, "bundle failed");
+ const script = built.outputs.find((output) => output.kind === "entry-point");
+ if (!script) throw new Error("bundle has no entry point");
+ return script.text();
+}
+
+/** Where `@import "[/]"` lands, by the package's `style` export as Vite reads it. */
+function packageStylesheet(id: string): string {
+ const parts = id.split("/");
+ const name = id.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
+ const dir = [
+ join(APP, "node_modules", name),
+ join(APP, "..", "node_modules", name),
+ ].find(existsSync);
+ if (!dir) throw new Error(`no package for ${id}`);
+ const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
+ const subpath = `.${id.slice(name.length)}`;
+ const entry = pkg.exports?.[subpath];
+ const file =
+ typeof entry === "string"
+ ? entry
+ : (entry?.style ?? entry?.default ?? pkg.main ?? "index.css");
+ return join(dir, file);
+}
+
+/** The app's stylesheet, built by Tailwind for these classes, as the app's build does. */
+async function stylesheet(classes: string[]): Promise {
+ const tailwind = dirname(Bun.resolveSync("tailwindcss/package.json", APP));
+ const entry = join(APP, "src", "styles.css");
+ const compiler = await compile(readFileSync(entry, "utf8"), {
+ base: dirname(entry),
+ loadStylesheet: async (id, base) => {
+ const path =
+ id === "tailwindcss"
+ ? join(tailwind, "index.css")
+ : id.startsWith(".")
+ ? join(base, id)
+ : packageStylesheet(id);
+ return { path, base: dirname(path), content: readFileSync(path, "utf8") };
+ },
+ });
+ return compiler.build(classes);
+}
+
+let script = "";
+const browsers = new Map();
+
+async function browserFor(name: "chromium" | "webkit"): Promise {
+ let browser = browsers.get(name);
+ if (!browser) {
+ const playwright = await import("playwright-core");
+ browser =
+ name === "chromium"
+ ? // The CI job installs full Chromium without the headless shell.
+ await playwright.chromium.launch({ channel: "chromium" })
+ : await playwright.webkit.launch();
+ browsers.set(name, browser);
+ }
+ return browser;
+}
+
+beforeAll(async () => {
+ if (asked) script = await bundle();
+}, 120_000);
+
+afterAll(async () => {
+ await Promise.all([...browsers.values()].map((browser) => browser.close()));
+});
+
+/** Every class the page uses now, so the stylesheet covers what has just shown. */
+async function style(page: Page) {
+ const classes = await page.evaluate(() => [
+ ...new Set(
+ [...document.querySelectorAll("[class]")].flatMap((element) => [
+ ...element.classList,
+ ]),
+ ),
+ ]);
+ await page.addStyleTag({ content: await stylesheet(classes) });
+}
+
+async function open(
+ engine: "chromium" | "webkit",
+ which: "fallback" | "none",
+ theme: "light" | "dark",
+) {
+ const browser = await browserFor(engine);
+ const page = await browser.newPage({
+ viewport: { width: 760, height: 360 },
+ userAgent: MAC,
+ locale: "en-GB",
+ });
+ page.on("pageerror", (error) => console.error(error));
+ await page.route(`${ORIGIN}/**`, (route) => {
+ const path = new URL(route.request().url()).pathname;
+ if (path === "/")
+ return route.fulfill({
+ contentType: "text/html",
+ body: '',
+ });
+ if (path === "/composer.js")
+ return route.fulfill({ contentType: "text/javascript", body: script });
+ return route.fulfill({ status: 404 });
+ });
+ await page.goto(`${ORIGIN}/?case=${which}&theme=${theme}`);
+ await page
+ .getByRole("button", { name: "Dictate a message" })
+ .waitFor({ timeout: 8000 });
+ await style(page);
+ return page;
+}
+
+/** The languages the page asked the desktop app about, and the one it started listening in. */
+function asks(page: Page) {
+ return page.evaluate(() => {
+ const calls = (
+ window as unknown as {
+ shellCalls: { command: string; args?: Record }[];
+ }
+ ).shellCalls;
+ return {
+ available: calls
+ .filter((call) => call.command.endsWith("|speech_available"))
+ .map((call) => call.args?.language),
+ start: calls.find((call) => call.command.endsWith("|speech_start"))?.args
+ ?.language,
+ };
+ });
+}
+
+describe.skipIf(!asked)(
+ "dictation on a Mac without the page's language",
+ () => {
+ for (const engine of engines) {
+ test(`${engine}: the microphone listens in English (United States), with no notice`, async () => {
+ const page = await open(engine, "fallback", "light");
+ try {
+ expect(await page.evaluate(() => navigator.language)).toBe("en-GB");
+ await page.getByRole("button", { name: "Dictate a message" }).click();
+ await page
+ .getByRole("button", { name: "Stop dictation" })
+ .waitFor({ timeout: 8000 });
+ await page
+ .getByText("book a table for two")
+ .waitFor({ timeout: 8000 });
+ expect(await page.getByRole("alert").count()).toBe(0);
+ expect(await asks(page)).toEqual({
+ available: ["en-GB", "en-US"],
+ start: "en-US",
+ });
+ if (shots) {
+ await style(page);
+ mkdirSync(shots, { recursive: true });
+ await page.screenshot({
+ path: join(
+ shots,
+ `dictation-fallback-${engine}-light-listening.png`,
+ ),
+ });
+ }
+ } finally {
+ await page.close();
+ }
+ }, 60_000);
+
+ for (const theme of ["light", "dark"] as const)
+ test(`${engine} (${theme}): with no language on the device it says which, and where to add it`, async () => {
+ const page = await open(engine, "none", theme);
+ try {
+ await page
+ .getByRole("button", { name: "Dictate a message" })
+ .click();
+ const alert = page.getByRole("alert");
+ await alert.waitFor({ timeout: 8000 });
+ expect(await alert.textContent()).toBe(NONE);
+ expect((await asks(page)).start).toBeUndefined();
+ await style(page);
+ // The notice reads whole: on screen, inside the page's width.
+ const box = await alert.boundingBox();
+ expect(box).not.toBeNull();
+ expect(box?.x ?? -1).toBeGreaterThanOrEqual(0);
+ expect((box?.x ?? 0) + (box?.width ?? 0)).toBeLessThanOrEqual(760);
+ if (shots) {
+ mkdirSync(shots, { recursive: true });
+ await page.screenshot({
+ path: join(
+ shots,
+ `dictation-fallback-${engine}-${theme}-none.png`,
+ ),
+ });
+ }
+ } finally {
+ await page.close();
+ }
+ }, 60_000);
+ }
+ },
+);
diff --git a/app/tests/composer-live-dictation.test.tsx b/app/tests/composer-live-dictation.test.tsx
index 696ddc23c7..7138e5e45f 100644
--- a/app/tests/composer-live-dictation.test.tsx
+++ b/app/tests/composer-live-dictation.test.tsx
@@ -175,6 +175,82 @@ test("desktop: a refused permission says where to turn it on, and the draft is u
expect(view.getByRole("button", { name: "Dictate a message" })).toBeDefined();
});
+/** The page's language for one test, as a Mac set to `language` gives it to the window. */
+async function inLanguage(language: string, run: () => Promise) {
+ const nav = navigator as {
+ language?: string;
+ languages?: readonly string[];
+ };
+ Object.defineProperty(navigator, "language", {
+ configurable: true,
+ get: () => language,
+ });
+ Object.defineProperty(navigator, "languages", {
+ configurable: true,
+ get: () => [language],
+ });
+ try {
+ await run();
+ } finally {
+ delete nav.language;
+ delete nav.languages;
+ }
+}
+
+/**
+ * FOUND IN DOGFOODING. A Mac set to English (United Kingdom), with Dictation on for English (United
+ * Kingdom) and English (United States), said "This computer can't take dictation in your language":
+ * its recognizer has no English (United Kingdom) on the device, and OpenBot never asked for English
+ * (United States).
+ */
+test("desktop: a Mac without the page's language on the device dictates in the next one it has", async () => {
+ await inLanguage("en-GB", async () => {
+ noProvider();
+ const { calls } = installDesktopShell({
+ ...desktop,
+ availability: (language) =>
+ language === "en-US" ? "available" : "unavailable",
+ });
+ const { view, box } = renderComposer(true, []);
+ fireEvent.click(
+ await view.findByRole("button", { name: "Dictate a message" }),
+ );
+ await waitFor(() =>
+ expect(box().textContent).toBe("Existing draft book a table for two"),
+ );
+ expect(view.queryByRole("alert")).toBeNull();
+ expect(
+ calls
+ .filter((call) => call.command.endsWith("|speech_available"))
+ .map((call) => call.args?.language),
+ ).toEqual(["en-GB", "en-US"]);
+ const start = calls.find((call) => call.command.endsWith("|speech_start"));
+ expect(start?.args).toMatchObject({
+ language: "en-US",
+ refused: ["en-GB"],
+ });
+ });
+});
+
+test("desktop: with no language on the device it says which and where to add it", async () => {
+ await inLanguage("en-GB", async () => {
+ noProvider();
+ const { calls } = installDesktopShell({ availability: "unavailable" });
+ const { view, box } = renderComposer(true, []);
+ fireEvent.click(
+ await view.findByRole("button", { name: "Dictate a message" }),
+ );
+ const alert = await view.findByRole("alert");
+ expect(alert.textContent).toBe(
+ "This Mac can't take dictation in English (United Kingdom). Turn on Dictation and add the language in System Settings, under Keyboard, then try again.",
+ );
+ expect(calls.some((call) => call.command.endsWith("|speech_start"))).toBe(
+ false,
+ );
+ expect(box().textContent).toBe("Existing draft");
+ });
+});
+
test("desktop: typing while listening stops listening and keeps what is in the box", async () => {
noProvider();
const { calls } = installDesktopShell(desktop);
diff --git a/app/tests/composer-paste.test.tsx b/app/tests/composer-paste.test.tsx
index 645f7279b9..9ffca8612f 100644
--- a/app/tests/composer-paste.test.tsx
+++ b/app/tests/composer-paste.test.tsx
@@ -318,13 +318,16 @@ test("a full-size composer stages an image pasted alongside text", async () => {
expect(queryByLabelText("Remove chart.png")).not.toBeNull(),
);
// All the way through the upload rather than stalled as a placeholder: the tile only draws an
- // `` once `onUpload` has answered with a URL to point it at. The upload answers with the
- // form a sent message stores; the tile loads the file from the API's address for it, never from
- // the address that form spells.
+ // `` once `onUpload` has answered. A picture the server took is drawn from the file on this
+ // device, never fetched back from the server it just went up to, nor from the address the stored
+ // form spells.
await waitFor(() =>
expect(
- container.querySelector('img[alt="chart.png"]')?.getAttribute("src"),
- ).toBe("/api/v2/organizations/default/attachments/attachment-id"),
+ container
+ .querySelector('img[alt="chart.png"]')
+ ?.getAttribute("src")
+ ?.startsWith("blob:"),
+ ).toBe(true),
);
expect(uploads).toEqual(["chart.png"]);
});
diff --git a/app/tests/connect-app-card.test.tsx b/app/tests/connect-app-card.test.tsx
index abf2736d66..a6b24b230b 100644
--- a/app/tests/connect-app-card.test.tsx
+++ b/app/tests/connect-app-card.test.tsx
@@ -1,5 +1,6 @@
import { afterAll, afterEach, beforeAll, expect, test } from "bun:test";
import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import { CLIENT_HEADER } from "@openbot/shared/client-version";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import {
createMemoryHistory,
@@ -11,6 +12,7 @@ import {
} from "@tanstack/react-router";
import { cleanup, fireEvent, render, waitFor } from "@testing-library/react";
import { ConnectAppCard } from "@/components/channels/connect-app-card";
+import { CLIENT_NAME } from "@/lib/client";
import { carryOnMessage } from "@/lib/copilot/carry-on";
import { ConversationProvider } from "@/lib/copilot/conversation";
import { settleReactWork } from "./settle-react-work";
@@ -402,7 +404,12 @@ test("in OpenBot Desktop, coming back finishes a held consent in the background,
await comeBack(card);
expect(card.verifierCalls).toEqual([
- { credentials: "same-origin", redirect: "manual" },
+ {
+ credentials: "same-origin",
+ redirect: "manual",
+ // Naming this app, as every request to OpenBot does.
+ headers: { [CLIENT_HEADER]: CLIENT_NAME },
+ },
]);
expect(window.location.href).toBe(before);
} finally {
diff --git a/app/tests/consent-handoff.fixture.tsx b/app/tests/consent-handoff.fixture.tsx
index 373bfc3d00..e47c1023b2 100644
--- a/app/tests/consent-handoff.fixture.tsx
+++ b/app/tests/consent-handoff.fixture.tsx
@@ -9,6 +9,7 @@ import {
} from "@tanstack/react-router";
import { createRoot } from "react-dom/client";
import { ConnectAppCard } from "@/components/channels/connect-app-card";
+import { BrokerDirectoryPage } from "@/components/manage/broker-directory-page";
import { setCurrentOrganization } from "@/lib/organizations/current";
import { queryClient } from "@/query-client";
import { Route as AccountRoute } from "@/routes/_authed/_app/connections.$key";
@@ -19,8 +20,8 @@ import { Route as DesktopReturnRoute } from "@/routes/desktop-return";
* The screens a sign-in through Composio passes through, as pages of their own for
* consent-handoff.test.tsx to bundle and load in a real browser: an app's page under Connections
* (where Connect leaves this tab), a Bot's Connect card in a conversation (where it opens a new
- * one), the step that new tab shows (`/connecting`), and the page OpenBot Desktop's sign-in comes
- * back to (`/desktop-return`). Each is the app's own route or component; what the server answers
+ * one), Browse apps (where Add starts a sign-in the same way), the step that new tab shows
+ * (`/connecting`), and the page OpenBot Desktop's sign-in comes back to (`/desktop-return`). Each is the app's own route or component; what the server answers
* comes from the test's routes.
*
* The tree is built the way `routeTree.gen.ts` builds it, a pathless `_authed` and `_app` above
@@ -83,6 +84,16 @@ const cardRoute = createRoute({
},
});
+/**
+ * Browse apps, as the personal edition draws it under Connections: the route's own component,
+ * without the edition guard in front of it (this page asks the server which edition it is).
+ */
+const browseRoute = createRoute({
+ getParentRoute: () => appRoute,
+ path: "/connections/browse/composio",
+ component: () => ,
+});
+
const router = createRouter({
history: createBrowserHistory(),
routeTree: rootRoute.addChildren([
@@ -95,8 +106,8 @@ const router = createRouter({
"/connections/$key",
),
cardRoute,
+ browseRoute,
elsewhere("/connections"),
- elsewhere("/connections/browse/composio"),
elsewhere("/settings/vault"),
]),
]),
diff --git a/app/tests/consent-handoff.test.tsx b/app/tests/consent-handoff.test.tsx
index 70f75329c4..3dbe23b6ec 100644
--- a/app/tests/consent-handoff.test.tsx
+++ b/app/tests/consent-handoff.test.tsx
@@ -4,7 +4,13 @@ import { dirname, join } from "node:path";
import type { Browser, BrowserContext, Page } from "playwright-core";
import { compile } from "tailwindcss";
import { ME_PATH } from "./accounts-api";
-import { type AppsFixture, answerAppsApi, type TodayServer } from "./apps-api";
+import {
+ APPS_PATH,
+ type AppsFixture,
+ answerAppsApi,
+ appBody,
+ type TodayServer,
+} from "./apps-api";
import {
confirmationResponse,
connectionPage,
@@ -53,6 +59,8 @@ const ORIGIN = "http://openbot.test";
const CONSENT = "https://consent.test";
/** The countdown, as the step starts it. Kept here rather than imported so main can run this. */
const SECONDS = 5;
+/** What this OpenBot is (getDeployment), which says which edition it runs. */
+const DEPLOYMENT_PATH = "/api/v2/organizations/default/deployment";
function gmail(id: string, title: string): TodayServer {
return {
@@ -182,10 +190,62 @@ afterAll(async () => {
await Promise.all(browsers.map((browser) => browser.close()));
});
+/**
+ * OPENBOT DESKTOP'S WINDOW, AS THE PAGE FINDS IT. The shell serves OpenBot from this computer
+ * (a loopback address), gives the page Tauri's `__TAURI_INTERNALS__` (`desktopShell()` reads its
+ * `invoke` and `transformCallback`), and injects its outside-links shim on every load, which turns
+ * `window.open` into a tab that hands its address to a navigation. The window's guard then cancels
+ * any navigation to a site outside OpenBot and opens it in the person's default browser instead,
+ * while the page stays (`outside_links_guard` in desktop/src-tauri/src/main.rs). Here a request for
+ * the consent page is that guard: it is written down as opened in the browser, and answered 204,
+ * which a browser takes as "stay where you are".
+ */
+const DESKTOP_ORIGIN = "http://127.0.0.1:38173";
+const OUTSIDE_LINKS = readFileSync(
+ join(APP, "..", "desktop", "src-tauri", "src", "outside-links.js"),
+ "utf8",
+);
+const TAURI_INTERNALS = `(() => {
+ let next = 1;
+ window.__shellCalls = [];
+ window.__TAURI_INTERNALS__ = {
+ transformCallback: () => next++,
+ unregisterCallback: () => {},
+ invoke: (command, args) => {
+ window.__shellCalls.push(command);
+ return Promise.resolve(null);
+ },
+ };
+})();`;
+
+/** What the Desktop window's guard did: every consent address it handed to the browser. */
+type DesktopWindow = { opened: string[] };
+
+/** Gmail in Composio's directory, as Browse apps lists it before it is added. */
+const GMAIL_IN_DIRECTORY = {
+ slug: "gmail",
+ name: "Gmail",
+ description: "Read, send and organize your email.",
+ actionCount: 40,
+ connection: { kind: "consent" as const },
+};
+
/** The server, as it answers right before anybody has connected Gmail or Slack. */
-async function serve(context: BrowserContext, theme: "light" | "dark") {
+async function serve(
+ context: BrowserContext,
+ theme: "light" | "dark",
+ desktop?: { servers: TodayServer[]; window: DesktopWindow },
+) {
const connects: string[] = [];
- await context.route(`${ORIGIN}/**`, async (route) => {
+ const origin = desktop ? DESKTOP_ORIGIN : ORIGIN;
+ const deployment: AppsFixture = desktop
+ ? {
+ ...DEPLOYMENT,
+ servers: desktop.servers,
+ directory: [GMAIL_IN_DIRECTORY],
+ }
+ : DEPLOYMENT;
+ await context.route(`${origin}/**`, async (route) => {
const request = route.request();
const url = new URL(request.url());
if (url.pathname === "/app.js")
@@ -217,7 +277,18 @@ async function serve(context: BrowserContext, theme: "light" | "dark") {
if (call?.operation === "confirm")
return answer(confirmationResponse(false));
if (call?.operation === "list") return answer(connectionPage([]));
- const apps = answerAppsApi(url.toString(), init, DEPLOYMENT);
+ if (desktop) {
+ // OpenBot Desktop runs the personal edition.
+ if (url.pathname === DEPLOYMENT_PATH)
+ return route.fulfill({ json: { edition: "personal" } });
+ // Browse apps adds an app from the directory, and the server answers the app it made.
+ if (url.pathname === APPS_PATH && init.method === "POST") {
+ const added = gmail("composio-gmail", "Gmail");
+ desktop.servers.push(added);
+ return route.fulfill({ status: 201, json: appBody(added) });
+ }
+ }
+ const apps = answerAppsApi(url.toString(), init, deployment);
if (apps) return answer(apps);
return route.fulfill({ status: 404, json: { error: "not here" } });
}
@@ -229,12 +300,21 @@ async function serve(context: BrowserContext, theme: "light" | "dark") {
});
});
// The consent page itself: the provider's, outside OpenBot.
- await context.route(`${CONSENT}/**`, (route) =>
- route.fulfill({
+ await context.route(`${CONSENT}/**`, (route) => {
+ if (desktop) {
+ // The Desktop window's guard: into the person's browser, and the window stays.
+ desktop.window.opened.push(route.request().url());
+ return route.fulfill({ status: 204 });
+ }
+ return route.fulfill({
contentType: "text/html",
body: "Consent
The provider's consent page
",
- }),
- );
+ });
+ });
+ if (desktop)
+ await context.addInitScript({
+ content: `${TAURI_INTERNALS}\n${OUTSIDE_LINKS}`,
+ });
return { connects };
}
@@ -262,6 +342,45 @@ async function launch(
return { browser, context, page, server };
}
+/**
+ * The same, in OpenBot Desktop's window: the personal edition, with Gmail added from Composio's
+ * directory and not connected (`servers`), or not added yet (none).
+ */
+async function launchDesktop(
+ name: "chromium" | "webkit",
+ options: { theme?: "light" | "dark"; added?: boolean } = {},
+) {
+ const theme = options.theme ?? "light";
+ const playwright = await import("playwright-core");
+ const engine = playwright[name];
+ const browser =
+ name === "chromium"
+ ? await engine.launch({ channel: "chromium" })
+ : await engine.launch();
+ browsers.push(browser);
+ const context = await browser.newContext({
+ viewport: { width: 1280, height: 860 },
+ deviceScaleFactor: 2,
+ colorScheme: theme,
+ });
+ const window: DesktopWindow = { opened: [] };
+ const servers =
+ options.added === false ? [] : [gmail("composio-gmail", "Gmail")];
+ const server = await serve(context, theme, { servers, window });
+ // The window opens no tab of its own: a second page here would be a tab the shell never makes.
+ let first: Page | undefined;
+ context.on("page", (opened) => {
+ if (first) window.opened.push(`new tab: ${opened.url()}`);
+ });
+ const page = await context.newPage();
+ first = page;
+ page.on("pageerror", (error) => console.error(error));
+ return { page, server, window };
+}
+
+/** A path in OpenBot Desktop's window. */
+const inWindow = (path: string) => `${DESKTOP_ORIGIN}${path}`;
+
/** An app's page under Connections, with its Connect on screen. */
async function accountPage(page: Page, app: string) {
await page.goto(`${ORIGIN}/connections/${app}`, {
@@ -282,6 +401,21 @@ async function countdown(page: Page): Promise {
const MS = (seconds: number) => seconds * 1_000;
+/** Wait for what the browser was handed to become `want`, then hold it to that. */
+async function opensIn(
+ window: DesktopWindow,
+ want: string[],
+ timeout: number,
+): Promise {
+ const until = Date.now() + timeout;
+ while (
+ Date.now() < until &&
+ JSON.stringify(window.opened) !== JSON.stringify(want)
+ )
+ await new Promise((resolve) => setTimeout(resolve, 100));
+ expect(window.opened).toEqual(want);
+}
+
describe.skipIf(!asked)("a sign-in through Composio", () => {
for (const name of engines) {
test(`in ${name}: Connect shows OpenBot's step, counts down from 5, then opens the consent page by itself`, async () => {
@@ -405,6 +539,178 @@ describe.skipIf(!asked)("a sign-in through Composio", () => {
}
});
+/**
+ * THE SAME STEP IN OPENBOT DESKTOP'S WINDOW, where the sign-in opens in the person's browser.
+ *
+ * Reported from OpenBot Desktop 1.1.0-rc.2 on a Mac: Add in Browse apps and Connect on Gmail's
+ * page both opened the browser straight on Google's sign-in, with no step at all. Here the
+ * window is the real shell's page as far as the page can tell (`launchDesktop`), Gmail is the
+ * personal edition's row as the server lists it (Composio's directory, each person's own
+ * account), and a consent address reaching the window's guard is the browser opening.
+ */
+describe.skipIf(!asked)(
+ "a sign-in through Composio in OpenBot Desktop's window",
+ () => {
+ /** The step in the window: its heading, its words and where its countdown stands. */
+ async function expectStep(page: Page) {
+ const step = page.getByRole("dialog");
+ await step.waitFor({ timeout: 5_000 });
+ expect(await countdown(page)).toBe(`Taking you to Google in ${SECONDS}`);
+ expect(
+ await step.getByRole("heading", { name: "Connecting Gmail" }).count(),
+ ).toBe(1);
+ expect((await step.textContent()) ?? "").toContain(
+ "Next, Google will ask you to allow Composio to access your Google Account.",
+ );
+ // The page and the dialog with the app's stylesheet, so its buttons are where a person sees them.
+ await styled(page);
+ return step;
+ }
+
+ for (const name of engines) {
+ test(`in ${name}: Connect on Gmail's page shows the step even when the apps can't be read again at the press`, async () => {
+ const { page, window } = await launchDesktop(name);
+ await page.goto(inWindow("/connections/composio-gmail"), {
+ waitUntil: "domcontentloaded",
+ });
+ const connect = page.getByRole("button", {
+ name: "Connect",
+ exact: true,
+ });
+ await connect.waitFor();
+ // From here on the apps list fails: the page already holds Gmail, and so does the step.
+ await page.route(
+ (url) => url.pathname === APPS_PATH,
+ (route) =>
+ route.fulfill({ status: 503, json: { error: "try again" } }),
+ );
+ await connect.click();
+
+ await expectStep(page);
+ await page.waitForTimeout(1_000);
+ expect(window.opened).toEqual([]);
+ }, 30_000);
+
+ test(`in ${name}: Connect on Gmail's page shows the step in the window, and the browser opens only at 0`, async () => {
+ const { page, server, window } = await launchDesktop(name);
+ await page.goto(inWindow("/connections/composio-gmail"), {
+ waitUntil: "domcontentloaded",
+ });
+ const connect = page.getByRole("button", {
+ name: "Connect",
+ exact: true,
+ });
+ await connect.waitFor();
+ await connect.click();
+
+ await expectStep(page);
+ expect(server.connects).toEqual(["composio-gmail"]);
+ expect(window.opened).toEqual([]);
+
+ // Two seconds on, still counting, and the browser has not been sent anywhere.
+ await page.waitForTimeout(2_000);
+ expect(await countdown(page)).toMatch(
+ /^Taking you to Google in [2-4]$/,
+ );
+ expect(window.opened).toEqual([]);
+
+ // At 0 the browser opens on exactly the address the server answered, and the window stays.
+ await opensIn(window, [`${CONSENT}/composio-gmail`], MS(SECONDS + 2));
+ expect(page.url()).toBe(inWindow("/connections/composio-gmail"));
+ }, 30_000);
+
+ test(`in ${name}: on Gmail's page, Cancel opens nothing and Continue now opens the browser at once`, async () => {
+ const { page, window } = await launchDesktop(name);
+ await page.goto(inWindow("/connections/composio-gmail"), {
+ waitUntil: "domcontentloaded",
+ });
+ const connect = page.getByRole("button", {
+ name: "Connect",
+ exact: true,
+ });
+ await connect.waitFor();
+
+ await connect.click();
+ let step = await expectStep(page);
+ await step.getByRole("button", { name: "Cancel" }).click();
+ await step.waitFor({ state: "hidden", timeout: 3_000 });
+ // Past where the countdown would have ended: nothing went to the browser.
+ await page.waitForTimeout(MS(SECONDS + 1));
+ expect(window.opened).toEqual([]);
+
+ await connect.click();
+ step = await expectStep(page);
+ await step.getByRole("button", { name: "Continue now" }).click();
+ await opensIn(window, [`${CONSENT}/composio-gmail`], 2_000);
+ expect(page.url()).toBe(inWindow("/connections/composio-gmail"));
+ }, 40_000);
+
+ test(`in ${name}: Add in Browse apps shows the step in the window before the browser opens`, async () => {
+ const { page, server, window } = await launchDesktop(name, {
+ added: false,
+ });
+ await page.goto(inWindow("/connections/browse/composio"), {
+ waitUntil: "domcontentloaded",
+ });
+ const add = page
+ .getByTestId("directory-gmail")
+ .getByRole("button", { name: "Add" });
+ await add.waitFor();
+ await add.click();
+
+ const step = await expectStep(page);
+ expect(server.connects).toEqual(["composio-gmail"]);
+ await page.waitForTimeout(2_000);
+ expect(window.opened).toEqual([]);
+ expect(page.url()).toBe(inWindow("/connections/browse/composio"));
+
+ await step.getByRole("button", { name: "Continue now" }).click();
+ await opensIn(window, [`${CONSENT}/composio-gmail`], 2_000);
+ expect(page.url()).toBe(inWindow("/connections/browse/composio"));
+ }, 30_000);
+
+ test(`in ${name}: Connect on Gmail's row in Browse apps, added and not connected, shows the step in the window`, async () => {
+ const { page, window } = await launchDesktop(name);
+ await page.goto(inWindow("/connections/browse/composio"), {
+ waitUntil: "domcontentloaded",
+ });
+ const connect = page
+ .getByTestId("directory-gmail")
+ .getByRole("button", { name: "Connect" });
+ await connect.waitFor();
+ await connect.click();
+
+ await expectStep(page);
+ await page.waitForTimeout(2_000);
+ expect(window.opened).toEqual([]);
+ await opensIn(window, [`${CONSENT}/composio-gmail`], MS(SECONDS + 2));
+ expect(page.url()).toBe(inWindow("/connections/browse/composio"));
+ }, 30_000);
+
+ test(`in ${name}: a Bot's Connect card shows the step in the window, and Cancel opens nothing`, async () => {
+ const { page, window } = await launchDesktop(name);
+ await page.goto(inWindow("/card/composio-gmail"), {
+ waitUntil: "domcontentloaded",
+ });
+ const connect = page.getByRole("button", { name: "Connect" });
+ await connect.waitFor();
+
+ await connect.click();
+ const step = await expectStep(page);
+ await step.getByRole("button", { name: "Cancel" }).click();
+ await step.waitFor({ state: "hidden", timeout: 3_000 });
+ await page.waitForTimeout(MS(SECONDS + 1));
+ expect(window.opened).toEqual([]);
+
+ await connect.click();
+ await expectStep(page);
+ await opensIn(window, [`${CONSENT}/composio-gmail`], MS(SECONDS + 2));
+ expect(page.url()).toBe(inWindow("/card/composio-gmail"));
+ }, 40_000);
+ }
+ },
+);
+
/*
* THE SCREENS, SAVED FOR A PERSON TO LOOK AT, in light and dark. Only with OPENBOT_APP_SHOTS set:
* nothing is asserted here that the cases above do not already.
@@ -467,7 +773,33 @@ describe.skipIf(!asked || !shots)("the screens, for a look", () => {
// The button eases its colours in once styled; let it land.
await page.waitForTimeout(1_200);
await page.screenshot({ path: file("Gmail-return") });
- }, 120_000);
+
+ // The step in OpenBot Desktop's window: over Gmail's page, over Browse apps and over a card.
+ for (const [path, screen, button] of [
+ ["/connections/composio-gmail", "desktop-Gmail-page", "Connect"],
+ ["/connections/browse/composio", "desktop-browse", "Add"],
+ ["/card/composio-gmail", "desktop-card", "Connect"],
+ ] as const) {
+ const desktop = await launchDesktop(name, {
+ theme,
+ added: screen !== "desktop-browse",
+ });
+ await desktop.page.goto(inWindow(path), {
+ waitUntil: "domcontentloaded",
+ });
+ const press = desktop.page
+ .getByRole("button", { name: button, exact: true })
+ .first();
+ await press.waitFor();
+ await styled(desktop.page);
+ await press.click();
+ await desktop.page.getByRole("dialog").waitFor();
+ await styled(desktop.page);
+ await desktop.page.waitForTimeout(1_200);
+ await desktop.page.screenshot({ path: file(screen) });
+ await desktop.page.getByRole("button", { name: "Cancel" }).click();
+ }
+ }, 180_000);
}
}
});
diff --git a/app/tests/conversations-api.ts b/app/tests/conversations-api.ts
index 9e2544fe33..9ff7eff2ec 100644
--- a/app/tests/conversations-api.ts
+++ b/app/tests/conversations-api.ts
@@ -168,6 +168,7 @@ export type GroupFixture = {
status: string;
createdAt: string;
reason?: string;
+ declined?: boolean;
answeredBy?: string;
consent?: { botId: string; serverId: string };
[other: string]: unknown;
@@ -200,10 +201,12 @@ export function messagesOf(group: Pick) {
status: message.status,
createdAt: message.createdAt,
...(message.reason === undefined ? {} : { reason: message.reason }),
+ ...(message.declined === undefined ? {} : { declined: message.declined }),
...(message.answeredBy === undefined
? {}
: { answeredBy: message.answeredBy }),
...(message.consent === undefined ? {} : { consent: message.consent }),
+ ...(message.files === undefined ? {} : { files: message.files }),
}))
.reverse();
}
diff --git a/app/tests/dictation-language-fallback.test.ts b/app/tests/dictation-language-fallback.test.ts
new file mode 100644
index 0000000000..b6ebeda16d
--- /dev/null
+++ b/app/tests/dictation-language-fallback.test.ts
@@ -0,0 +1,151 @@
+import { expect, test } from "bun:test";
+import type { Recognition } from "@/lib/browser/narration";
+import {
+ dictationLanguages,
+ LiveDictation,
+ type LiveSource,
+ type LiveState,
+ liveProblem,
+ MOST_LANGUAGES,
+} from "@/lib/dictation/live";
+
+/**
+ * FOUND IN DOGFOODING. OpenBot Desktop on a Mac set to English (United Kingdom), with Hebrew second
+ * and the region Israel, and Dictation on for English (United Kingdom) and English (United States),
+ * said "This computer can't take dictation in your language." Its speech.log had one line,
+ * `available(en-GB) = Unavailable`: the Mac's recognizer has no English (United Kingdom) on the
+ * device, and OpenBot never asked for English (United States). Dictation now takes the first of the
+ * person's languages, and their common regions, the recognizer has, and when it has none says which
+ * language and where to add it.
+ */
+
+type Asked = { langs: string[]; processLocally: true };
+
+/** A desktop recognizer that has only `has` on the device, recording what it is asked. */
+function fakeRecognition(has: (language: string) => string) {
+ const asked: string[] = [];
+ const made: (Recognition & { refused?: string[] })[] = [];
+ class Fake implements Recognition {
+ static async available({ langs }: Asked) {
+ asked.push(langs[0] ?? "");
+ return has(langs[0] ?? "");
+ }
+ lang = "";
+ continuous = false;
+ interimResults = false;
+ maxAlternatives = 1;
+ onstart: Recognition["onstart"] = null;
+ onresult: Recognition["onresult"] = null;
+ onerror: Recognition["onerror"] = null;
+ onend: Recognition["onend"] = null;
+ constructor() {
+ made.push(this);
+ }
+ start() {}
+ stop() {}
+ abort() {}
+ }
+ const source: LiveSource = { Recognition: Fake, platform: "mac" };
+ return { source, asked, made };
+}
+
+function dictation(source: LiveSource, languages: string[]) {
+ const states: LiveState[] = [];
+ const live = new LiveDictation({
+ source: () => source,
+ languages: () => languages,
+ onStart: () => {},
+ onText: () => {},
+ wait: async () => {},
+ });
+ live.subscribe(() => states.push(live.getSnapshot()));
+ return { live, states };
+}
+
+test("a Mac without English (United Kingdom) on the device dictates in English (United States)", async () => {
+ const { source, asked, made } = fakeRecognition((language) =>
+ language === "en-US" ? "available" : "unavailable",
+ );
+ const { live, states } = dictation(
+ source,
+ dictationLanguages("en-GB", ["en-GB", "he-IL"]),
+ );
+ await live.start();
+ expect(made).toHaveLength(1);
+ expect(made[0]?.lang).toBe("en-US");
+ expect(made[0]?.refused).toEqual(["en-GB", "he-IL"]);
+ expect(asked).toEqual(["en-GB", "he-IL", "en-US"]);
+ expect(live.getSnapshot()).toEqual({ phase: "listening" });
+ expect(states.some((state) => state.phase === "error")).toBe(false);
+});
+
+test("the permission wait still holds for the language that is on the device", async () => {
+ let answered = 0;
+ const { source, asked, made } = fakeRecognition((language) => {
+ if (language !== "en-US") return "unavailable";
+ return answered++ < 2 ? "downloading" : "available";
+ });
+ const { live, states } = dictation(source, dictationLanguages("en-GB"));
+ await live.start();
+ expect(made[0]?.lang).toBe("en-US");
+ expect(asked).toEqual(["en-GB", "en-US", "en-US", "en-US"]);
+ expect(states.map((state) => state.phase)).toEqual([
+ "preparing",
+ "listening",
+ ]);
+});
+
+test("with no language on the device, it names the person's language and where to add it, and starts nothing", async () => {
+ const { source, asked, made } = fakeRecognition(() => "unavailable");
+ const { live } = dictation(source, dictationLanguages("en-GB", ["en-GB"]));
+ await live.start();
+ expect(made).toEqual([]);
+ // Every candidate once, then it stops.
+ expect(asked).toEqual(["en-GB", "en-US", "en"]);
+ expect(live.getSnapshot()).toEqual({
+ phase: "error",
+ error:
+ "This Mac can't take dictation in English (United Kingdom). Turn on Dictation and add the language in System Settings, under Keyboard, then try again.",
+ });
+});
+
+test("on Windows and in a browser it points to the right place", () => {
+ expect(liveProblem("language-not-supported", "windows", "en-GB")).toBe(
+ "This computer can't take dictation in English (United Kingdom). Add the language in Settings, under Time & language > Speech, then try again.",
+ );
+ expect(liveProblem("language-not-supported", "browser", "he-IL")).toBe(
+ "This browser can't take dictation in Hebrew (Israel).",
+ );
+});
+
+test("the languages tried: the person's, then their languages' common regions, once each and bounded", () => {
+ expect(dictationLanguages("en-GB", ["en-GB", "he-IL"])).toEqual([
+ "en-GB",
+ "he-IL",
+ "en-US",
+ "en",
+ "he",
+ ]);
+ expect(dictationLanguages("pt_br")).toEqual(["pt-BR", "pt-PT", "pt"]);
+ expect(dictationLanguages("de-AT", ["de-AT"])).toEqual([
+ "de-AT",
+ "de-DE",
+ "de",
+ ]);
+ expect(dictationLanguages("not a language", [])).toEqual(["en-US"]);
+ expect(dictationLanguages(undefined)).toEqual(["en-US"]);
+ const many = dictationLanguages("en-GB", [
+ "fr-FR",
+ "de-DE",
+ "es-ES",
+ "it-IT",
+ "ja-JP",
+ "ko-KR",
+ "nl-NL",
+ "sv-SE",
+ "pl-PL",
+ "tr-TR",
+ ]);
+ expect(many).toHaveLength(MOST_LANGUAGES);
+ expect(many[0]).toBe("en-GB");
+});
diff --git a/app/tests/goal-page-starts.test.tsx b/app/tests/goal-page-starts.test.tsx
index 56e4a95736..aad93c44e3 100644
--- a/app/tests/goal-page-starts.test.tsx
+++ b/app/tests/goal-page-starts.test.tsx
@@ -106,6 +106,7 @@ const routine = (overrides: Partial = {}): RoutineRecord => ({
id: "routine-1",
botId: "bot-1",
schedule: "Weekdays at 09:00",
+ cron: "0 9 * * 1-5",
timezone: "UTC",
instruction: "Check the queue.",
title: null,
diff --git a/app/tests/group-sender-name.test.tsx b/app/tests/group-sender-name.test.tsx
new file mode 100644
index 0000000000..6f1ab91670
--- /dev/null
+++ b/app/tests/group-sender-name.test.tsx
@@ -0,0 +1,176 @@
+import { afterAll, afterEach, beforeAll, expect, test } from "bun:test";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import { QueryClientProvider } from "@tanstack/react-query";
+import { cleanup, render, waitFor } from "@testing-library/react";
+import { GroupChat } from "@/components/channels/group-chat";
+import { queryClient } from "@/query-client";
+import { ME_PATH, meResponse } from "./accounts-api";
+import { approvalInboxResponse } from "./approvals-api";
+import { answerBotsList } from "./bots-api";
+import { answerGroupRead, type GroupFixture } from "./conversations-api";
+import { settleReactWork } from "./settle-react-work";
+
+/**
+ * Who said a person's line in a conversation with several Bots, as another person in it reads it.
+ *
+ * Marcus opened a group Priya had asked a Bot in, and her message was headed "Someone else". The
+ * conversation's members already name everybody in it (`GET /conversations/{id}/members`, kind
+ * `person`, with `name` and `email`), and each line names its sender by `personId`, but the group
+ * drew only "You" or "Someone else". A line now carries its sender's name from the members list:
+ * their name, their email when they have none, and "Someone who left" for a person no longer in
+ * the conversation, whose name is no longer the reader's to see.
+ *
+ * The transcript is the real run's (bundle r2, group check, read as Marcus). The two reads are
+ * answered at the HTTP boundary as the server answers them; everything above is the real GroupChat.
+ */
+
+const CHANNEL = "channel_97ea1195-9e93-48e7-8508-855f909dd76f";
+const ASSISTANT = "general-assistant";
+const KNOWLEDGE = "knowledge";
+const ASKED =
+ "On your computer, write a small CSV file named group-budget.csv with a header row (item,owner,amount) and three made-up budget lines, then send that file to me in this chat so I can download it. Don't paste its contents, send the file.";
+
+const PRIYA = {
+ userId: "n4Qk2c8YlZpS0mWfVb1eTj7RuH3xAoGd",
+ email: "priya@example.test",
+ name: "Priya Shah",
+ creator: true,
+};
+const MARCUS = {
+ userId: "Lr9Xh2mVq0cT5sNwJ8bYpE1kUa6dFzGi",
+ email: "marcus@example.test",
+ name: "Marcus Bell",
+ creator: false,
+};
+
+function groupWith(
+ people: GroupFixture["people"],
+ extra: GroupFixture["messages"] = [],
+): GroupFixture {
+ return {
+ bots: [
+ { id: ASSISTANT, name: "General Assistant" },
+ { id: KNOWLEDGE, name: "Knowledge" },
+ ],
+ people,
+ messages: [
+ {
+ id: "m-1",
+ ownerUserId: PRIYA.userId,
+ agentId: null,
+ text: ASKED,
+ status: "completed",
+ createdAt: "2026-11-17T22:30:30.000Z",
+ },
+ {
+ id: `m-1:${ASSISTANT}`,
+ ownerUserId: PRIYA.userId,
+ agentId: ASSISTANT,
+ text: "I’ll create the CSV on my computer and send it here.",
+ status: "completed",
+ createdAt: "2026-11-17T22:30:50.000Z",
+ },
+ ...extra,
+ ],
+ };
+}
+
+let group = groupWith([PRIYA, MARCUS]);
+let originalFetch: typeof fetch;
+
+beforeAll(() => {
+ GlobalRegistrator.register({ url: "http://localhost/" });
+ originalFetch = globalThis.fetch;
+ globalThis.fetch = (async (
+ input: Parameters[0],
+ init?: RequestInit,
+ ) => {
+ const url = new URL(
+ typeof input === "string"
+ ? input
+ : input instanceof URL
+ ? input.href
+ : input.url,
+ "http://localhost",
+ );
+ // Marcus is the one reading.
+ if (url.pathname === ME_PATH)
+ return meResponse({
+ user: { id: MARCUS.userId, role: "user", email: MARCUS.email },
+ });
+ const bots = answerBotsList(url, init, {
+ visible: [
+ { id: ASSISTANT, name: "General Assistant", avatarSeed: ASSISTANT },
+ { id: KNOWLEDGE, name: "Knowledge", avatarSeed: KNOWLEDGE },
+ ],
+ });
+ if (bots) return bots;
+ const read = answerGroupRead(url, init, CHANNEL, group);
+ if (read) return read;
+ const approvals = approvalInboxResponse(url.pathname, {
+ enabled: true,
+ requests: [],
+ rules: [],
+ teamRules: [],
+ questions: [],
+ });
+ if (approvals) return approvals;
+ return new Response(null, { status: 404 });
+ }) as typeof fetch;
+});
+afterEach(() => {
+ cleanup();
+ queryClient.clear();
+});
+afterAll(async () => {
+ await settleReactWork();
+ globalThis.fetch = originalFetch;
+ GlobalRegistrator.unregister();
+});
+
+/** The heading over each person's line that is not the reader's own, in transcript order. */
+async function senders() {
+ const view = render(
+
+
+ ,
+ );
+ await waitFor(() => expect(view.queryByText(ASKED)).not.toBeNull());
+ return [
+ ...view.container.querySelectorAll('[data-slot="message-header"]'),
+ ].map((header) => header.textContent);
+}
+
+test("another person in the group sees a person's message under that person's name", async () => {
+ group = groupWith([PRIYA, MARCUS]);
+ const headings = await senders();
+ expect(headings[0]).toBe("Priya Shah");
+ expect(headings).not.toContain("Someone else");
+ // The Bot's reply keeps its own name.
+ expect(headings[1]).toBe("General Assistant");
+});
+
+test("a person with no name is shown by their email, and the reader's own lines carry no heading", async () => {
+ group = groupWith(
+ [{ ...PRIYA, name: null }, MARCUS],
+ [
+ {
+ id: "m-2",
+ ownerUserId: MARCUS.userId,
+ agentId: null,
+ text: "Thanks, got it.",
+ status: "completed",
+ createdAt: "2026-11-17T22:31:10.000Z",
+ },
+ ],
+ );
+ const headings = await senders();
+ expect(headings).toEqual(["priya@example.test", "General Assistant"]);
+});
+
+test("a person who has left the group is not named", async () => {
+ group = groupWith([MARCUS]);
+ const headings = await senders();
+ expect(headings[0]).toBe("Someone who left");
+ expect(headings.join(" ")).not.toContain("Priya");
+});
diff --git a/app/tests/group-sent-file.test.tsx b/app/tests/group-sent-file.test.tsx
new file mode 100644
index 0000000000..ea5a9c5013
--- /dev/null
+++ b/app/tests/group-sent-file.test.tsx
@@ -0,0 +1,185 @@
+import { afterAll, afterEach, beforeAll, expect, test } from "bun:test";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import { QueryClientProvider } from "@tanstack/react-query";
+import { cleanup, render, waitFor, within } from "@testing-library/react";
+import { GroupChat } from "@/components/channels/group-chat";
+import { attachmentAddress } from "@/lib/channels/attachments";
+import { queryClient } from "@/query-client";
+import { ME_PATH, meResponse } from "./accounts-api";
+import { approvalInboxResponse } from "./approvals-api";
+import { answerBotsList } from "./bots-api";
+import { answerGroupRead } from "./conversations-api";
+import { settleReactWork } from "./settle-react-work";
+
+/**
+ * A file a Bot sends from its computer in a conversation with several Bots.
+ *
+ * The server stores it as an attachment of the group, so every member can open it, but a group
+ * keeps only each Bot's words of a turn: the reply read "Created and sent team-budget.csv" with no
+ * card, and its name in the words was the only way to the file. The reply now carries the files
+ * (`files` on the message, the API's Attachment), and the group draws each as the card a
+ * conversation with one Bot draws.
+ *
+ * The file is the real run's (test-20261117-71): its stored attachment and the words the Bot wrote
+ * about it. The group's reads and the attachment address are answered at the HTTP boundary as the
+ * server answers them; everything above is the real GroupChat.
+ */
+
+const CHANNEL = "group-1";
+const PA = "personal-assistant";
+const BUDGET = "budget-buddy";
+const ATTACHMENT = "bffdecae-4a19-48ea-b363-d1842fa33791";
+const WORDS = `Created and sent [team-budget.csv](/api/attachments/${ATTACHMENT}) with three made-up budget lines.`;
+
+let reads = 0;
+let originalFetch: typeof fetch;
+
+beforeAll(() => {
+ GlobalRegistrator.register({ url: "http://localhost/" });
+ originalFetch = globalThis.fetch;
+ globalThis.fetch = (async (
+ input: Parameters[0],
+ init?: RequestInit,
+ ) => {
+ const url = new URL(
+ typeof input === "string"
+ ? input
+ : input instanceof URL
+ ? input.href
+ : input.url,
+ "http://localhost",
+ );
+ if (url.pathname === ME_PATH)
+ return meResponse({
+ user: { id: "alex", role: "user", email: "alex@example.test" },
+ });
+ const bots = answerBotsList(url, init, {
+ visible: [
+ { id: PA, name: "Personal Assistant", avatarSeed: "personal" },
+ { id: BUDGET, name: "Budget Buddy", avatarSeed: BUDGET },
+ ],
+ });
+ if (bots) return bots;
+ // The card asks whether its file is still there, at the conversation's attachment address.
+ if (url.pathname.endsWith(`/attachments/${ATTACHMENT}`))
+ return new Response(null, { status: 200 });
+ if (url.pathname.endsWith("/messages")) reads += 1;
+ const read = answerGroupRead(url, init, CHANNEL, {
+ bots: [
+ { id: PA, name: "Personal Assistant" },
+ { id: BUDGET, name: "Budget Buddy" },
+ ],
+ // Priya asked; Alex, reading here, is the other person in the group.
+ people: [
+ {
+ userId: "priya",
+ email: "priya@example.test",
+ name: "Priya",
+ creator: true,
+ },
+ {
+ userId: "alex",
+ email: "alex@example.test",
+ name: "Alex",
+ creator: false,
+ },
+ ],
+ messages: [
+ {
+ id: "m-1",
+ ownerUserId: "priya",
+ agentId: null,
+ text: "@Personal Assistant write a small CSV named team-budget.csv with three made-up budget lines and send it here.",
+ status: "completed",
+ createdAt: "2026-11-17T20:57:20.000Z",
+ },
+ {
+ id: `m-1:${PA}`,
+ ownerUserId: "priya",
+ agentId: PA,
+ text: WORDS,
+ status: "completed",
+ createdAt: "2026-11-17T20:57:40.000Z",
+ files: [
+ {
+ id: ATTACHMENT,
+ name: "team-budget.csv",
+ mimeType: "text/csv",
+ sizeBytes: 84,
+ },
+ ],
+ },
+ ],
+ });
+ if (read) return read;
+ const approvals = approvalInboxResponse(url.pathname, {
+ enabled: true,
+ requests: [],
+ rules: [],
+ teamRules: [],
+ questions: [],
+ });
+ if (approvals) return approvals;
+ return new Response(null, { status: 404 });
+ }) as typeof fetch;
+});
+afterEach(() => {
+ cleanup();
+ queryClient.clear();
+});
+afterAll(async () => {
+ await settleReactWork();
+ globalThis.fetch = originalFetch;
+ GlobalRegistrator.unregister();
+});
+
+function conversation() {
+ return render(
+
+
+ ,
+ );
+}
+
+const CARD = 'figure[aria-label="File from the Bot: team-budget.csv"]';
+
+test("another person in the group sees the file the Bot sent as its card under the Bot's words, now and on reload", async () => {
+ // A reload reads the transcript again from the server and draws it from scratch.
+ for (let pass = 0; pass < 2; pass += 1) {
+ const before = reads;
+ const view = conversation();
+ await waitFor(() => expect(reads).toBeGreaterThan(before));
+ await waitFor(() =>
+ expect(view.container.querySelector(CARD)).not.toBeNull(),
+ );
+ const card = view.container.querySelector(CARD) as HTMLElement;
+ expect(card.textContent).toContain("CSV · 84 bytes");
+ const download = within(card).getByRole("button", {
+ name: "Download team-budget.csv",
+ });
+ expect(download.getAttribute("href")).toBe(
+ attachmentAddress(`/api/attachments/${ATTACHMENT}`),
+ );
+ // Inside the Bot's own reply, after its words.
+ const reply = view.container.querySelector(
+ `[data-speaker="${PA}"]`,
+ ) as HTMLElement;
+ expect(reply.contains(card)).toBe(true);
+ const words = within(reply).getByRole("link", { name: "team-budget.csv" });
+ expect(
+ words.compareDocumentPosition(card) & Node.DOCUMENT_POSITION_FOLLOWING,
+ ).toBeTruthy();
+ cleanup();
+ queryClient.clear();
+ }
+});
+
+test("the file's name in the group Bot's words downloads it from the conversation's address", async () => {
+ const view = conversation();
+ const link = await view.findByRole("link", { name: "team-budget.csv" });
+ expect(link.getAttribute("href")).toBe(
+ attachmentAddress(`/api/attachments/${ATTACHMENT}`),
+ );
+ expect(link.hasAttribute("download")).toBe(true);
+ expect(link.getAttribute("target")).toBeNull();
+});
diff --git a/app/tests/group-share-notice.test.tsx b/app/tests/group-share-notice.test.tsx
new file mode 100644
index 0000000000..033fd83bfa
--- /dev/null
+++ b/app/tests/group-share-notice.test.tsx
@@ -0,0 +1,225 @@
+import { afterAll, afterEach, beforeAll, expect, test } from "bun:test";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import { QueryClientProvider } from "@tanstack/react-query";
+import {
+ createMemoryHistory,
+ createRootRoute,
+ createRouter,
+ RouterProvider,
+} from "@tanstack/react-router";
+import { cleanup, render, waitFor } from "@testing-library/react";
+import { GroupChat } from "@/components/channels/group-chat";
+import { queryClient } from "@/query-client";
+import { ME_PATH, meResponse } from "./accounts-api";
+import { approvalInboxResponse } from "./approvals-api";
+import { answerBotsList } from "./bots-api";
+import { answerGroupRead, type GroupFixture } from "./conversations-api";
+import { settleReactWork } from "./settle-react-work";
+
+/**
+ * A Bot's reply in a group that waits for, or was refused, its person's permission to share it, as
+ * that person reads it and as everyone else in the group reads it.
+ *
+ * Two things were wrong. Everyone read the waiting line with "Open General Assistant" after it, a
+ * link to the Bot's page where only the person whose turn it was has anything to answer. And a
+ * reply its person chose not to share was drawn red, as an alert, for everyone: a choice drawn as a
+ * failure. The waiting line now carries the link for that person only, and a declined reply is the
+ * same muted notice as the group's other informational lines.
+ *
+ * The reads are answered at the HTTP boundary as the server answers them, with the words it writes
+ * for each reader; everything above is the real GroupChat.
+ */
+
+const CHANNEL = "channel_5b7e3c1a-2f44-4d0e-9a51-6c0f2d8e7b19";
+const ASSISTANT = "general-assistant";
+const ASKED = "What did I tell you about the Q3 budget?";
+
+const PRIYA = {
+ userId: "n4Qk2c8YlZpS0mWfVb1eTj7RuH3xAoGd",
+ email: "priya@example.test",
+ name: "Priya Shah",
+ creator: true,
+};
+const MARCUS = {
+ userId: "Lr9Xh2mVq0cT5sNwJ8bYpE1kUa6dFzGi",
+ email: "marcus@example.test",
+ name: "Marcus Bell",
+ creator: false,
+};
+
+const WAITING_FOR_PRIYA =
+ "Waiting for permission to share private information with this group conversation. Nothing was sent.";
+const WAITING_FOR_MARCUS =
+ "Waiting for Priya Shah to allow sharing this reply.";
+const DECLINED_FOR_PRIYA =
+ "You declined sharing this with them. It was not sent.";
+const DECLINED_FOR_MARCUS =
+ "Priya Shah didn't share this reply. Nothing was sent.";
+
+let reader = PRIYA;
+let group: GroupFixture;
+
+/** Priya asked; her Bot's reply is the line under test. */
+function groupWith(reply: GroupFixture["messages"][number]): GroupFixture {
+ return {
+ bots: [{ id: ASSISTANT, name: "General Assistant" }],
+ people: [PRIYA, MARCUS],
+ messages: [
+ {
+ id: "m-1",
+ ownerUserId: PRIYA.userId,
+ agentId: null,
+ text: ASKED,
+ status: "completed",
+ createdAt: "2026-11-18T10:00:00.000Z",
+ },
+ reply,
+ ],
+ };
+}
+
+function waiting(reason: string) {
+ return groupWith({
+ id: `m-1:${ASSISTANT}`,
+ ownerUserId: PRIYA.userId,
+ agentId: ASSISTANT,
+ text: "",
+ status: "waiting",
+ createdAt: "2026-11-18T10:00:05.000Z",
+ reason,
+ });
+}
+
+function declined(text: string) {
+ return groupWith({
+ id: `m-1:${ASSISTANT}`,
+ ownerUserId: PRIYA.userId,
+ agentId: ASSISTANT,
+ text,
+ status: "failed",
+ createdAt: "2026-11-18T10:00:05.000Z",
+ declined: true,
+ });
+}
+
+let originalFetch: typeof fetch;
+
+beforeAll(() => {
+ GlobalRegistrator.register({ url: "http://localhost/" });
+ originalFetch = globalThis.fetch;
+ globalThis.fetch = (async (
+ input: Parameters[0],
+ init?: RequestInit,
+ ) => {
+ const url = new URL(
+ typeof input === "string"
+ ? input
+ : input instanceof URL
+ ? input.href
+ : input.url,
+ "http://localhost",
+ );
+ if (url.pathname === ME_PATH)
+ return meResponse({
+ user: { id: reader.userId, role: "user", email: reader.email },
+ });
+ const bots = answerBotsList(url, init, {
+ visible: [
+ { id: ASSISTANT, name: "General Assistant", avatarSeed: ASSISTANT },
+ ],
+ });
+ if (bots) return bots;
+ const read = answerGroupRead(url, init, CHANNEL, group);
+ if (read) return read;
+ const approvals = approvalInboxResponse(url.pathname, {
+ enabled: true,
+ requests: [],
+ rules: [],
+ teamRules: [],
+ questions: [],
+ });
+ if (approvals) return approvals;
+ return new Response(null, { status: 404 });
+ }) as typeof fetch;
+});
+afterEach(() => {
+ cleanup();
+ queryClient.clear();
+});
+afterAll(async () => {
+ await settleReactWork();
+ globalThis.fetch = originalFetch;
+ GlobalRegistrator.unregister();
+});
+
+/** The group as `who` opens it, once the Bot's line is drawn. */
+async function open(who: typeof PRIYA, line: string) {
+ reader = who;
+ const router = createRouter({
+ routeTree: createRootRoute({
+ component: () => ,
+ }),
+ history: createMemoryHistory({ initialEntries: [`/group/${CHANNEL}`] }),
+ });
+ const view = render(
+
+
+ ,
+ );
+ await waitFor(() =>
+ expect(view.queryByText(line, { exact: false })).not.toBeNull(),
+ );
+ const notice = view.getByText(line, { exact: false });
+ return { view, notice };
+}
+
+test("the person whose turn it was reads why the reply waits, with the way to answer it", async () => {
+ group = waiting(WAITING_FOR_PRIYA);
+ const { view, notice } = await open(PRIYA, WAITING_FOR_PRIYA);
+ expect(notice.getAttribute("role")).toBe("status");
+ const link = view.getByRole("link", { name: "Open General Assistant" });
+ expect(link.getAttribute("href")).toBe(`/bots/${ASSISTANT}`);
+});
+
+test("everyone else reads who the reply waits for, and is given nothing they can't do", async () => {
+ group = waiting(WAITING_FOR_MARCUS);
+ const { view, notice } = await open(MARCUS, WAITING_FOR_MARCUS);
+ expect(notice.textContent).toBe(WAITING_FOR_MARCUS);
+ expect(notice.getAttribute("role")).toBe("status");
+ expect(view.queryByRole("link")).toBeNull();
+ expect(
+ view.queryByText("Open General Assistant", { exact: false }),
+ ).toBeNull();
+});
+
+test("a reply its person declined to share is a muted notice for that person, not an error", async () => {
+ group = declined(DECLINED_FOR_PRIYA);
+ const { view, notice } = await open(PRIYA, DECLINED_FOR_PRIYA);
+ expect(notice.getAttribute("role")).toBe("status");
+ expect(notice.className).toContain("text-muted-foreground");
+ expect(notice.className).not.toContain("text-destructive");
+ expect(view.queryByRole("alert")).toBeNull();
+});
+
+test("a reply its person declined to share is a muted notice for everyone else too", async () => {
+ group = declined(DECLINED_FOR_MARCUS);
+ const { view, notice } = await open(MARCUS, DECLINED_FOR_MARCUS);
+ expect(notice.getAttribute("role")).toBe("status");
+ expect(notice.className).toContain("text-muted-foreground");
+ expect(notice.className).not.toContain("text-destructive");
+ expect(view.queryByRole("alert")).toBeNull();
+});
+
+test("a reply that failed for another reason is still drawn as an error", async () => {
+ group = groupWith({
+ id: `m-1:${ASSISTANT}`,
+ ownerUserId: PRIYA.userId,
+ agentId: ASSISTANT,
+ text: "The model provider didn't answer.",
+ status: "failed",
+ createdAt: "2026-11-18T10:00:05.000Z",
+ });
+ const { notice } = await open(MARCUS, "The model provider didn't answer.");
+ expect(notice.getAttribute("role")).toBe("alert");
+ expect(notice.className).toContain("text-destructive");
+});
diff --git a/app/tests/handoff-share-on-board.test.tsx b/app/tests/handoff-share-on-board.test.tsx
index ec28ffbf80..291e978867 100644
--- a/app/tests/handoff-share-on-board.test.tsx
+++ b/app/tests/handoff-share-on-board.test.tsx
@@ -110,7 +110,14 @@ const SENTENCE =
function readsAsTheCard(scope: HTMLElement) {
const view = within(scope);
expect(view.getByText(SENTENCE)).toBeTruthy();
- expect(view.getByLabelText("What it would send").textContent).toBe(TEXT);
+ // The whole text, each paragraph drawn as the conversation draws it.
+ const said = view.getByLabelText("What it would send");
+ expect(
+ Array.from(
+ said.querySelectorAll("p"),
+ (paragraph) => paragraph.textContent,
+ ),
+ ).toEqual(TEXT.split("\n\n"));
for (const field of ["Hand off", "Preview", "Audience", "Recipients"])
expect(view.queryByText(field)).toBeNull();
expect(scope.textContent).not.toContain("9f2c");
diff --git a/app/tests/large-picture-tile.fixture.tsx b/app/tests/large-picture-tile.fixture.tsx
new file mode 100644
index 0000000000..6aa3a2fe4d
--- /dev/null
+++ b/app/tests/large-picture-tile.fixture.tsx
@@ -0,0 +1,58 @@
+import type { Message } from "@ag-ui/core";
+import { CopilotKitProvider } from "@copilotkit/react-core/v2";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { createRoot } from "react-dom/client";
+import { ChatTranscript } from "@/components/channels/chat-transcript";
+import { TooltipProvider } from "@/components/ui/tooltip";
+import { setCurrentOrganization } from "@/lib/organizations/current";
+
+/**
+ * A sent message carrying a picture over 8MB and one under it, as a page of its own for
+ * large-picture-tile.test.tsx to bundle and load in Chromium. `?theme=dark` draws it dark.
+ */
+if (new URLSearchParams(location.search).get("theme") === "dark") {
+ document.documentElement.classList.add("dark");
+}
+setCurrentOrganization("default");
+
+const picture = (id: string, filename: string, sizeBytes: number) => ({
+ type: "image" as const,
+ source: {
+ type: "url" as const,
+ value: `/api/attachments/${id}`,
+ mimeType: "image/png",
+ },
+ metadata: { attachmentId: id, filename, sizeBytes },
+});
+
+const MESSAGES: Message[] = [
+ {
+ id: "u1",
+ role: "user",
+ content: [
+ { type: "text", text: "Here is the drone survey and the site photo." },
+ picture("big", "drone-survey.png", 99_553_808),
+ picture("small", "site-photo.png", 2_400_000),
+ ],
+ } as Message,
+ { id: "a1", role: "assistant", content: "I have both pictures." },
+];
+
+const queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+});
+
+const root = document.getElementById("root");
+if (root) {
+ createRoot(root).render(
+
+
+
+
+
+
+
+
+ ,
+ );
+}
diff --git a/app/tests/large-picture-tile.test.tsx b/app/tests/large-picture-tile.test.tsx
new file mode 100644
index 0000000000..2bf401105f
--- /dev/null
+++ b/app/tests/large-picture-tile.test.tsx
@@ -0,0 +1,277 @@
+import { afterAll, beforeAll, expect, test } from "bun:test";
+import { existsSync, readFileSync } from "node:fs";
+import { dirname, join } from "node:path";
+import { deflateSync } from "node:zlib";
+import type { Browser, Page } from "playwright-core";
+import { compile } from "tailwindcss";
+
+/**
+ * A picture over 8MB is not downloaded to draw its tile; it is fetched when somebody opens it.
+ *
+ * Pictures go up to 100MB on an install with an object store. A tile that draws one as a thumbnail
+ * fetches all of it, for every reader, the moment the conversation paints, and on a slow link that
+ * download holds up the conversation's other requests. Over the old 8MB image limit the tile is the
+ * file instead (name, kind, size, Open and Download), and the full picture is fetched only when it
+ * is opened in the lightbox. A picture of 8MB or less draws as it always did.
+ *
+ * Counted on the wire, in a real Chromium, because what a browser fetches for an `` is the
+ * browser's decision. The transcript is the real component, bundled from the fixture beside this
+ * file, with the app's own stylesheet.
+ *
+ * OPENBOT_APP_BROWSER=1 bun test app/tests/large-picture-tile.test.tsx
+ *
+ * `OPENBOT_SHOTS=` also saves the tiles light and dark, wide and on a phone, and the lightbox.
+ */
+const asked = process.env.OPENBOT_APP_BROWSER === "1";
+const shots = process.env.OPENBOT_SHOTS;
+
+const APP = join(import.meta.dir, "..");
+const ORIGIN = "http://openbot.test";
+const BIG = "/api/v2/organizations/default/attachments/big";
+const SMALL = "/api/v2/organizations/default/attachments/small";
+
+/** A real picture to serve for either file: a 240px sky over grass. */
+function picture(): Buffer {
+ const side = 240;
+ const row = side * 3 + 1;
+ const raw = Buffer.alloc(row * side);
+ for (let y = 0; y < side; y++) {
+ for (let x = 0; x < side; x++) {
+ const sky = y < side * 0.65;
+ raw.set(
+ sky ? [90 + y / 3, 160, 235] : [50, 125, 70],
+ y * row + 1 + x * 3,
+ );
+ }
+ }
+ const table = Array.from({ length: 256 }, (_, n) => {
+ let c = n;
+ for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
+ return c >>> 0;
+ });
+ const chunk = (type: string, data: Buffer) => {
+ const typed = Buffer.concat([Buffer.from(type, "ascii"), data]);
+ let crc = 0xffffffff;
+ for (const byte of typed) crc = table[(crc ^ byte) & 0xff] ^ (crc >>> 8);
+ const length = Buffer.alloc(4);
+ length.writeUInt32BE(data.length);
+ const sum = Buffer.alloc(4);
+ sum.writeUInt32BE((crc ^ 0xffffffff) >>> 0);
+ return Buffer.concat([length, typed, sum]);
+ };
+ const header = Buffer.alloc(13);
+ header.writeUInt32BE(side, 0);
+ header.writeUInt32BE(side, 4);
+ header[8] = 8;
+ header[9] = 2;
+ return Buffer.concat([
+ Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]),
+ chunk("IHDR", header),
+ chunk("IDAT", deflateSync(raw)),
+ chunk("IEND", Buffer.alloc(0)),
+ ]);
+}
+
+/** The fixture bundled for the browser. `@/lib/marks` is Vite's `import.meta.glob`, so no marks. */
+async function bundle(): Promise {
+ const built = await Bun.build({
+ entrypoints: [join(import.meta.dir, "large-picture-tile.fixture.tsx")],
+ target: "browser",
+ define: { "process.env.NODE_ENV": JSON.stringify("production") },
+ plugins: [
+ {
+ name: "no-marks",
+ setup(build) {
+ build.onResolve({ filter: /^@\/lib\/marks$/ }, () => ({
+ path: "marks",
+ namespace: "no-marks",
+ }));
+ build.onLoad({ filter: /.*/, namespace: "no-marks" }, () => ({
+ contents: "export const markFor = () => null;",
+ loader: "js",
+ }));
+ },
+ },
+ ],
+ });
+ if (!built.success) throw new AggregateError(built.logs, "bundle failed");
+ const script = built.outputs.find((output) => output.kind === "entry-point");
+ if (!script) throw new Error("bundle has no entry point");
+ return script.text();
+}
+
+/** Where `@import "[/]"` lands, by the package's `style` export as Vite reads it. */
+function packageStylesheet(id: string): string {
+ const parts = id.split("/");
+ const name = id.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
+ const dir = [
+ join(APP, "node_modules", name),
+ join(APP, "..", "node_modules", name),
+ ].find(existsSync);
+ if (!dir) throw new Error(`no package for ${id}`);
+ const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
+ const subpath = `.${id.slice(name.length)}`;
+ const entry = pkg.exports?.[subpath];
+ const file =
+ typeof entry === "string"
+ ? entry
+ : (entry?.style ?? entry?.default ?? pkg.main ?? "index.css");
+ return join(dir, file);
+}
+
+/** The app's stylesheet, built by Tailwind for these classes, as the app's build does. */
+async function stylesheet(classes: string[]): Promise {
+ const tailwind = dirname(Bun.resolveSync("tailwindcss/package.json", APP));
+ const entry = join(APP, "src", "styles.css");
+ const compiler = await compile(readFileSync(entry, "utf8"), {
+ base: dirname(entry),
+ loadStylesheet: async (id, base) => {
+ const path =
+ id === "tailwindcss"
+ ? join(tailwind, "index.css")
+ : id.startsWith(".")
+ ? join(base, id)
+ : packageStylesheet(id);
+ return { path, base: dirname(path), content: readFileSync(path, "utf8") };
+ },
+ });
+ return compiler.build(classes);
+}
+
+let browser: Browser;
+let script: string;
+let css = "";
+const bytes = picture();
+
+beforeAll(async () => {
+ if (!asked) return;
+ script = await bundle();
+ const { chromium } = await import("playwright-core");
+ // The CI job installs full Chromium without the headless shell.
+ browser = await chromium.launch({ channel: "chromium" });
+ // A first pass, closed and open, to know which classes the stylesheet needs.
+ const { page } = await open();
+ try {
+ const classes = new Set(await classesOn(page));
+ await page.getByRole("button", { name: "Open drone-survey.png" }).click();
+ await page.getByRole("dialog").waitFor();
+ for (const name of await classesOn(page)) classes.add(name);
+ css = await stylesheet([...classes]);
+ } finally {
+ await page.close();
+ }
+}, 60_000);
+
+afterAll(async () => {
+ await browser?.close();
+});
+
+/** The conversation, with every request for a file counted by its address. */
+async function open(
+ theme: "light" | "dark" = "light",
+ viewport = { width: 1000, height: 700 },
+): Promise<{ page: Page; fetched: string[] }> {
+ const page = await browser.newPage({ viewport });
+ const fetched: string[] = [];
+ page.on("pageerror", (error) => console.error(error));
+ await page.route(`${ORIGIN}/**`, (route) => {
+ const request = route.request();
+ const path = new URL(request.url()).pathname;
+ if (path === "/")
+ return route.fulfill({
+ contentType: "text/html",
+ body: ``,
+ });
+ if (path === "/transcript.js")
+ return route.fulfill({ contentType: "text/javascript", body: script });
+ if (path === BIG || path === SMALL) {
+ fetched.push(`${request.method()} ${path}`);
+ return route.fulfill({ contentType: "image/png", body: bytes });
+ }
+ return route.fulfill({ status: 404 });
+ });
+ await page.goto(`${ORIGIN}/?theme=${theme}`);
+ await page.getByText("Here is the drone survey").waitFor({ timeout: 8000 });
+ return { page, fetched };
+}
+
+function classesOn(page: Page): Promise {
+ return page.evaluate(() => [
+ ...new Set(
+ [...document.querySelectorAll("[class]")].flatMap((element) => [
+ ...element.classList,
+ ]),
+ ),
+ ]);
+}
+
+/** Every picture on the page has finished, drawn or not, so the count is final. */
+async function settled(page: Page) {
+ await page.waitForFunction(() =>
+ [...document.images].every((image) => image.complete),
+ );
+ await page.waitForTimeout(300);
+}
+
+test.skipIf(!asked)(
+ "a picture over 8MB is not fetched until it is opened, and opens full size",
+ async () => {
+ const { page, fetched } = await open();
+ try {
+ await settled(page);
+ // The small picture is drawn; the large one is its file, and nothing asked for its bytes.
+ expect(fetched).toEqual([`GET ${SMALL}`]);
+ await page.getByText("PNG image · 95 MB").waitFor();
+
+ await page.getByRole("button", { name: "Open drone-survey.png" }).click();
+ const opened = page
+ .getByRole("dialog")
+ .getByRole("img", { name: "drone-survey.png" });
+ await opened.waitFor();
+ await settled(page);
+ expect(
+ await opened.evaluate(
+ (image) => (image as HTMLImageElement).naturalWidth,
+ ),
+ ).toBe(240);
+ expect(fetched).toEqual([`GET ${SMALL}`, `GET ${BIG}`]);
+ } finally {
+ await page.close();
+ }
+ },
+ 30_000,
+);
+
+test.skipIf(!asked || !shots)(
+ "the tiles, light and dark, wide and on a phone",
+ async () => {
+ for (const theme of ["light", "dark"] as const) {
+ for (const [shape, viewport] of [
+ ["desktop", { width: 1000, height: 700 }],
+ ["phone", { width: 390, height: 844 }],
+ ] as const) {
+ const { page } = await open(theme, viewport);
+ try {
+ await settled(page);
+ await page.screenshot({
+ path: `${shots}/large-picture-tile-${theme}-${shape}.png`,
+ });
+ await page
+ .getByRole("button", { name: "Open drone-survey.png" })
+ .click();
+ await page
+ .getByRole("dialog")
+ .getByRole("img", { name: "drone-survey.png" })
+ .waitFor();
+ await settled(page);
+ await page.screenshot({
+ path: `${shots}/large-picture-opened-${theme}-${shape}.png`,
+ });
+ } finally {
+ await page.close();
+ }
+ }
+ }
+ },
+ 120_000,
+);
diff --git a/app/tests/learning-admin.test.tsx b/app/tests/learning-admin.test.tsx
index 69ea9d8e49..a493421fed 100644
--- a/app/tests/learning-admin.test.tsx
+++ b/app/tests/learning-admin.test.tsx
@@ -441,7 +441,7 @@ describe("reviewing proposed skills", () => {
}
/** A review as approving or rejecting a proposal answers it. */
- const reviewed = (proposalId: string, status: "approved" | "rejected") =>
+ const reviewed = (proposalId: string, status: string) =>
served(learningContract.ApproveLearningProposalResponse, {
proposalId,
operation: "add",
diff --git a/app/tests/narrow-sidebar-sheet.test.tsx b/app/tests/narrow-sidebar-sheet.test.tsx
index d93fed0cfa..93c3184460 100644
--- a/app/tests/narrow-sidebar-sheet.test.tsx
+++ b/app/tests/narrow-sidebar-sheet.test.tsx
@@ -155,6 +155,7 @@ function renderNarrowApp(
queryClient.setQueryData(userPreferencesQueryOptions("dana").queryKey, {
messageListEmphasis: "thread",
selfHostBannerDismissed: true,
+ dismissedNotices: [],
narration: null,
skin: "openbot",
proactive: "on",
diff --git a/app/tests/new-bot-sheet.test.tsx b/app/tests/new-bot-sheet.test.tsx
index 06cc2fc186..fec417217f 100644
--- a/app/tests/new-bot-sheet.test.tsx
+++ b/app/tests/new-bot-sheet.test.tsx
@@ -325,8 +325,11 @@ test("Create fills in what was left blank, then hands over", async () => {
visibility: "private",
endpoint: "",
});
- // It runs on OpenBot, which the server knows without being told.
- expect(creates[0]).not.toHaveProperty("harness");
+ /*
+ * It runs inside OpenBot, on the engine new Bots run on: OpenBot's own LangGraph (TypeScript)
+ * agent, named with no address. The server still picks each run's engine for the sign-in.
+ */
+ expect(creates[0]).toMatchObject({ harness: "langgraph-ts" });
// For a Bot that runs here this is its system prompt, so it has to be something it can act on.
expect(String(creates[0]?.roleDescription)).toStartWith(
"You are Expense Review.",
diff --git a/app/tests/new-conversation-attachments.test.tsx b/app/tests/new-conversation-attachments.test.tsx
index 08cd4c6924..0379a51255 100644
--- a/app/tests/new-conversation-attachments.test.tsx
+++ b/app/tests/new-conversation-attachments.test.tsx
@@ -338,8 +338,13 @@ test("a file attached with + on /channel/new is uploaded to the conversation it
expect(sentParts()).toEqual([
{
type: "document",
- source: { type: "url", value: "/api/attachments/att-1" },
- metadata: { attachmentId: "att-1", filename: "notes.txt" },
+ source: {
+ type: "url",
+ value: "/api/attachments/att-1",
+ mimeType: "text/plain",
+ },
+ // The size goes with the part, so a reader decides how to show the file without fetching it.
+ metadata: { attachmentId: "att-1", filename: "notes.txt", sizeBytes: 22 },
},
]);
// And the conversation draws the file in the message it was sent with.
@@ -372,8 +377,13 @@ test("a file dropped on the home composer goes with the message that starts the
expect(sentParts()).toEqual([
{
type: "document",
- source: { type: "url", value: "/api/attachments/att-1" },
- metadata: { attachmentId: "att-1", filename: "notes.txt" },
+ source: {
+ type: "url",
+ value: "/api/attachments/att-1",
+ mimeType: "text/plain",
+ },
+ // The size goes with the part, so a reader decides how to show the file without fetching it.
+ metadata: { attachmentId: "att-1", filename: "notes.txt", sizeBytes: 22 },
},
]);
});
diff --git a/app/tests/office-file-cards.test.tsx b/app/tests/office-file-cards.test.tsx
new file mode 100644
index 0000000000..cb0a95ee41
--- /dev/null
+++ b/app/tests/office-file-cards.test.tsx
@@ -0,0 +1,104 @@
+import { afterAll, afterEach, beforeAll, expect, test } from "bun:test";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import { ACCEPTED_FILE_TYPES } from "@openbot/shared/attachments";
+import { cleanup, render, waitFor } from "@testing-library/react";
+import { FILE_TYPE_ICONS } from "@/components/channels/file-icon";
+import { SentFileCard } from "@/components/channels/sent-file-card";
+import { attachmentUrl } from "@/lib/channels/attachments";
+import { kindLabel } from "@/lib/computers/sent-file";
+import { attachmentPath } from "./conversations-api";
+import { settleReactWork } from "./settle-react-work";
+
+/**
+ * A Word, Excel or PowerPoint file a Bot sends reads as what it is on its card: its own icon and the
+ * kind named in the one list of files OpenBot takes, with its size and a Download for the file.
+ *
+ * The card asks whether the file is still there (a HEAD to its address), so `fetch` is answered here
+ * with "still there", as in transcript-attachments.test.tsx.
+ */
+let probes: string[] = [];
+let realFetch: typeof fetch;
+
+beforeAll(() => {
+ GlobalRegistrator.register({ url: "http://localhost/" });
+ realFetch = globalThis.fetch;
+ globalThis.fetch = ((input: RequestInfo | URL) => {
+ probes.push(String(input));
+ return Promise.resolve().then(() => new Response(null, { status: 200 }));
+ }) as typeof fetch;
+});
+
+afterEach(() => {
+ cleanup();
+ probes = [];
+});
+
+afterAll(async () => {
+ await settleReactWork();
+ globalThis.fetch = realFetch;
+ GlobalRegistrator.unregister();
+});
+
+const OFFICE = [
+ {
+ name: "Q3 budget.xlsx",
+ mimeType:
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ sizeBytes: 14_336,
+ label: "Excel workbook · 14 KB",
+ icon: "tabler-icon-file-type-xls",
+ },
+ {
+ name: "launch memo.docx",
+ mimeType:
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ sizeBytes: 48_128,
+ label: "Word document · 47 KB",
+ icon: "tabler-icon-file-type-docx",
+ },
+ {
+ name: "board deck.pptx",
+ mimeType:
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation",
+ sizeBytes: 3_250_586,
+ label: "PowerPoint presentation · 3.1 MB",
+ icon: "tabler-icon-file-type-ppt",
+ },
+] as const;
+
+for (const file of OFFICE) {
+ test(`a Bot's ${file.name} reads as its kind, with its icon and a download`, async () => {
+ const attachmentId = `att-${file.icon}`;
+ const { container, getByRole, getByText } = render(
+ ,
+ );
+ await waitFor(() => expect(probes).toHaveLength(1));
+
+ expect(getByRole("figure", { name: `File from the Bot: ${file.name}` }));
+ expect(getByText(file.label)).toBeTruthy();
+ expect(container.querySelector(`svg.${file.icon}`)).not.toBeNull();
+ const download = getByRole("button", { name: `Download ${file.name}` });
+ expect(download.getAttribute("href")).toBe(attachmentPath(attachmentId));
+ expect(download.getAttribute("download")).toBe(file.name);
+ // An Office file is never drawn in the page: no picture, only the card.
+ expect(container.querySelector("img")).toBeNull();
+ });
+}
+
+test("every kind of file OpenBot takes has a name of its own and an icon of its own", () => {
+ for (const type of ACCEPTED_FILE_TYPES) {
+ expect(FILE_TYPE_ICONS[type.mimeType]).toBeDefined();
+ if (type.kind === "document")
+ expect(kindLabel(type.mimeType, `file.${type.extensions[0]}`)).toBe(
+ type.name,
+ );
+ }
+});
diff --git a/app/tests/organization-invitations.test.tsx b/app/tests/organization-invitations.test.tsx
index 5027b43192..0486c6cf7f 100644
--- a/app/tests/organization-invitations.test.tsx
+++ b/app/tests/organization-invitations.test.tsx
@@ -31,6 +31,7 @@ import { OrganizationSettingsPage } from "@/components/organizations/organizatio
import { settingsSidebarItems } from "@/components/settings/settings-sidebar";
import { SidebarProvider } from "@/components/ui/sidebar";
import { Toaster } from "@/components/ui/toast";
+import type { PersonRole } from "@/lib/api/generated/model";
import { signedInUser } from "@/lib/auth/queries";
import {
currentOrganizationId,
@@ -373,7 +374,7 @@ async function answer(
const no = refused();
if (no) return no;
if (!manages) return adminOnly();
- const { role } = body as { role: OrganizationMemberSummary["role"] };
+ const { role } = body as { role: PersonRole };
const changed = server.members.find((one) => one.id === removed[1]);
if (!changed)
return problem(404, "PERSON_NOT_FOUND", "Couldn't find that person.");
diff --git a/app/tests/page-fetch.ts b/app/tests/page-fetch.ts
new file mode 100644
index 0000000000..d7ce6369a7
--- /dev/null
+++ b/app/tests/page-fetch.ts
@@ -0,0 +1,33 @@
+/**
+ * The page's `fetch`, for a test whose page is addressed at a real HTTP server on this computer.
+ *
+ * A browser resolves a request's path against the page's address and aborts it on the page's own
+ * signal. Under happy-dom the page's `AbortSignal` is happy-dom's, which the runtime's `fetch`
+ * refuses, so the abort is carried over to one of the runtime's own. Everything else is the
+ * runtime's real request, on the real network stack.
+ *
+ * Captured when this module loads, before a test file registers happy-dom.
+ */
+const nativeFetch = globalThis.fetch;
+const NativeAbortController = globalThis.AbortController;
+
+export function pageFetch(): typeof fetch {
+ return Object.assign(
+ (input: RequestInfo | URL, init?: RequestInit) => {
+ const target =
+ typeof input === "string" ? new URL(input, location.href) : input;
+ const given = init?.signal;
+ if (!given) return nativeFetch(target, init);
+ const controller = new NativeAbortController();
+ if (given.aborted) controller.abort();
+ else
+ given.addEventListener("abort", () => controller.abort(), {
+ once: true,
+ });
+ return nativeFetch(target, { ...init, signal: controller.signal });
+ },
+ { preconnect: nativeFetch.preconnect },
+ ) as typeof fetch;
+}
+
+export { nativeFetch };
diff --git a/app/tests/personal-settings.test.tsx b/app/tests/personal-settings.test.tsx
index 072181b867..b45d8427df 100644
--- a/app/tests/personal-settings.test.tsx
+++ b/app/tests/personal-settings.test.tsx
@@ -20,6 +20,7 @@ import { ComputersPage } from "@/components/manage/computers-page";
import { PluginToolPage } from "@/components/manage/plugin-tool-page";
import { settingsSidebarItems } from "@/components/settings/settings-sidebar";
import { type AgentProfile, agentKeys } from "@/lib/agents/queries";
+import { authKeys } from "@/lib/auth/queries";
import {
type HostAccessStatus,
hostAccessKeys,
@@ -29,6 +30,7 @@ import {
type DeploymentCapabilities,
deploymentKeys,
} from "@/lib/deployment/queries";
+import { type ComputerMode, enterpriseKeys } from "@/lib/enterprise/queries";
import { Route as PersonalSettingsRoute } from "@/routes/_authed/settings/_personal";
import { Route as LearningRoute } from "@/routes/_authed/settings/learning";
import { seedAppReads } from "./apps-api";
@@ -218,11 +220,20 @@ describe("the Computer page", () => {
edition: "team" | "personal",
host: HostAccessStatus = hostAccess,
computers: ComputerFleet = fleet,
+ computerMode?: ComputerMode,
) {
const client = clientFor(edition);
client.setDefaultOptions({
queries: { retry: false, staleTime: Infinity },
});
+ if (computerMode) {
+ // An admin reading, and what the server's settings say about the computers.
+ client.setQueryData(authKeys.currentUser(), {
+ id: "dev-local-user",
+ role: "admin",
+ } as never);
+ client.setQueryData(enterpriseKeys.computerMode(), computerMode);
+ }
client.setQueryData(computerKeys.fleet(), computers);
// No Bot is hidden: a name not on the list is then a Bot that is gone.
client.setQueryData(agentKeys.list(true), []);
@@ -547,9 +558,11 @@ describe("the Computer page", () => {
});
test("in the team edition still tells an admin how to give each person a computer", async () => {
- const view = await renderPage("team");
+ const view = await renderPage("team", hostAccess, fleet, "shared");
const text = view.container.textContent ?? "";
expect(view.getByRole("heading", { name: "Computers" })).toBeTruthy();
+ expect(text).toContain("Everyone's Bots share one computer.");
+ expect(text).toContain("computers.mode: sandbox");
expect(text).toContain("COMPUTER_SUPERVISOR_URL");
expect(text).toContain("Computers in this organization");
expect(text).toContain("dev@openbot.local · Personal Assistant");
diff --git a/app/tests/routine-delete-returns.test.tsx b/app/tests/routine-delete-returns.test.tsx
index b7e7783ec3..cce43469e6 100644
--- a/app/tests/routine-delete-returns.test.tsx
+++ b/app/tests/routine-delete-returns.test.tsx
@@ -43,6 +43,7 @@ const ROUTINE: RoutineRecord = {
id: "routine-1",
botId: "lead-desk",
schedule: "Weekdays at 09:00",
+ cron: "0 9 * * 1-5",
timezone: "Europe/Madrid",
instruction: "Send me a summary of yesterday's new leads",
title: "Morning leads",
diff --git a/app/tests/routine-edit.test.tsx b/app/tests/routine-edit.test.tsx
new file mode 100644
index 0000000000..200b41c43a
--- /dev/null
+++ b/app/tests/routine-edit.test.tsx
@@ -0,0 +1,284 @@
+import { afterAll, afterEach, beforeAll, expect, test } from "bun:test";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import { QueryClientProvider } from "@tanstack/react-query";
+import {
+ createMemoryHistory,
+ createRootRoute,
+ createRoute,
+ createRouter,
+ RouterProvider,
+} from "@tanstack/react-router";
+import { cleanup, render, waitFor, within } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { RoutineRoutePage } from "@/components/routines/routine-page";
+import { cronFrom, scheduleFrom } from "@/lib/routines/form";
+import type { RoutineRecord } from "@/lib/routines/queries";
+import { queryClient } from "@/query-client";
+import { answerBotsList } from "./bots-api";
+import { pathOf, ROUTINES_PATH, routineRunsPath } from "./schedules-api";
+import { settleReactWork } from "./settle-react-work";
+
+/*
+ * Edit routine, on a routine's page. A routine could only be deleted and made again, which lost its
+ * runs. Now its name, what it does, its schedule and its time zone change in place, through the
+ * API's updateRoutine, and the page shows what was saved.
+ */
+
+beforeAll(() => GlobalRegistrator.register());
+afterEach(() => {
+ cleanup();
+ queryClient.clear();
+});
+afterAll(async () => {
+ await settleReactWork();
+ GlobalRegistrator.unregister();
+});
+
+const originalFetch = global.fetch;
+afterEach(() => {
+ global.fetch = originalFetch;
+});
+
+const ROUTINE: RoutineRecord = {
+ id: "routine-1",
+ botId: "lead-desk",
+ schedule: "Weekdays at 09:00",
+ cron: "0 9 * * 1-5",
+ timezone: "Europe/Madrid",
+ instruction: "Send me a summary of yesterday's new leads",
+ title: "Morning leads",
+ conversation: {
+ id: "conversation-1",
+ name: "Lead Desk",
+ title: "Leads",
+ gone: false,
+ },
+ enabled: true,
+ nextRunAt: "2099-01-01T08:00:00.000Z",
+ lastRun: null,
+ goalId: null,
+ createdAt: "2026-11-01T09:00:00.000Z",
+};
+
+/** What the server says a cron is, for the ones these tests send. */
+const WORDS: Record = {
+ "0 9 * * 1-5": "Weekdays at 09:00",
+ "30 7 * * 3": "Wednesdays at 07:30",
+ "0 9,17 * * *": "0 9,17 * * *",
+};
+
+/**
+ * The server: one routine, changed by updateRoutine as the real one changes it, or refused with
+ * `refusal`. Every change it was sent is kept, in order.
+ */
+function serving(
+ routine: RoutineRecord = ROUTINE,
+ refusal?: { status: number; detail: string },
+) {
+ let current = routine;
+ const changes: Record[] = [];
+ global.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
+ const path = pathOf(input);
+ const method = init?.method ?? "GET";
+ if (path === `${ROUTINES_PATH}/${routine.id}` && method === "PATCH") {
+ const body = JSON.parse(String(init?.body)) as Record;
+ changes.push(body);
+ if (refusal)
+ return Response.json(
+ { status: refusal.status, detail: refusal.detail },
+ {
+ status: refusal.status,
+ headers: { "content-type": "application/problem+json" },
+ },
+ );
+ current = {
+ ...current,
+ ...(body.title !== undefined ? { title: body.title || null } : {}),
+ ...(body.instruction !== undefined
+ ? { instruction: body.instruction }
+ : {}),
+ ...(body.cron !== undefined
+ ? { cron: body.cron, schedule: WORDS[body.cron] ?? body.cron }
+ : {}),
+ ...(body.timezone !== undefined ? { timezone: body.timezone } : {}),
+ };
+ return Response.json({ routine: current });
+ }
+ if (path === routineRunsPath(routine.id))
+ return Response.json({ runs: [], nextCursor: null });
+ if (path === ROUTINES_PATH)
+ return Response.json({ routines: [current], nextCursor: null });
+ const bots = answerBotsList(path, init, {
+ visible: [
+ { id: "lead-desk", name: "Lead Desk", avatarSeed: "lead-desk" },
+ ],
+ hidden: [],
+ });
+ if (bots) return bots;
+ return Response.json({});
+ }) as unknown as typeof fetch;
+ return changes;
+}
+
+function draw(routine: RoutineRecord = ROUTINE) {
+ const root = createRootRoute();
+ const router = createRouter({
+ history: createMemoryHistory({
+ initialEntries: [`/routines/schedules/${routine.id}`],
+ }),
+ routeTree: root.addChildren([
+ createRoute({
+ getParentRoute: () => root,
+ path: "/routines/schedules/$routineId",
+ component: () => ,
+ }),
+ ]),
+ });
+ return render(
+
+
+ ,
+ );
+}
+
+/** What a person does to replace a field's text: select all of it, delete it, type the new. */
+async function replaceText(
+ user: ReturnType,
+ field: HTMLElement,
+ text: string,
+) {
+ await user.click(field);
+ await user.keyboard("{Control>}a{/Control}{Delete}");
+ if (text) await user.type(field, text);
+}
+
+async function openEdit(view: ReturnType) {
+ const user = userEvent.setup({ document });
+ await user.click(await view.findByRole("button", { name: /^Edit routine/ }));
+ const dialog = await view.findByRole("dialog", { name: "Edit routine" });
+ return { user, dialog: within(dialog) };
+}
+
+test("the picker reads back exactly the schedules it writes, and no others", () => {
+ for (const schedule of [
+ { repeat: "daily", time: "08:15", weekday: "1", monthDay: "1" },
+ { repeat: "weekdays", time: "09:00", weekday: "1", monthDay: "1" },
+ { repeat: "weekly", time: "07:30", weekday: "3", monthDay: "1" },
+ { repeat: "monthly", time: "18:45", weekday: "1", monthDay: "28" },
+ { repeat: "hourly", time: "09:00", weekday: "1", monthDay: "1" },
+ ] as const)
+ expect(scheduleFrom(cronFrom(schedule))).toEqual(schedule);
+ // What a Bot can write and the picker can't say.
+ for (const cron of [
+ "*/15 * * * *",
+ "0 9,17 * * *",
+ "0 9 * * 1,3",
+ "0 9 31 * *",
+ "0 9 1 1 *",
+ "15 * * * *",
+ "0 9 * * 7",
+ ])
+ expect(scheduleFrom(cron)).toBeNull();
+});
+
+test("Edit routine opens with what the routine is now", async () => {
+ serving();
+ const view = draw();
+ const { dialog } = await openEdit(view);
+ expect((dialog.getByLabelText("Name") as HTMLInputElement).value).toBe(
+ "Morning leads",
+ );
+ expect(
+ (dialog.getByLabelText("What to do") as HTMLTextAreaElement).value,
+ ).toBe(ROUTINE.instruction);
+ expect(dialog.getByLabelText("Schedule").textContent).toContain(
+ "Every weekday",
+ );
+ expect((dialog.getByLabelText("Time") as HTMLInputElement).value).toBe(
+ "09:00",
+ );
+ expect((dialog.getByLabelText("Time zone") as HTMLInputElement).value).toBe(
+ "Europe/Madrid",
+ );
+});
+
+test("saving changes what to do and when it runs, and the page shows it", async () => {
+ const changes = serving();
+ const view = draw();
+ const { user, dialog } = await openEdit(view);
+ await replaceText(
+ user,
+ dialog.getByLabelText("What to do"),
+ "Send me this week's new leads",
+ );
+ await user.click(dialog.getByLabelText("Schedule"));
+ await user.click(await view.findByRole("option", { name: "Every week" }));
+ await user.click(await view.findByLabelText("Day of the week"));
+ await user.click(await view.findByRole("option", { name: "Wednesday" }));
+ await replaceText(user, dialog.getByLabelText("Time"), "07:30");
+ expect(
+ dialog.getByText("Every Wednesday at 7:30 AM", { exact: false }),
+ ).toBeTruthy();
+ await user.click(dialog.getByRole("button", { name: "Save changes" }));
+
+ await waitFor(() =>
+ expect(view.queryByRole("dialog", { name: "Edit routine" })).toBeNull(),
+ );
+ // Only what changed was sent: the name and the time zone were left alone.
+ expect(changes).toEqual([
+ { instruction: "Send me this week's new leads", cron: "30 7 * * 3" },
+ ]);
+ await view.findByText("Send me this week's new leads");
+ expect(
+ (await view.findAllByText("Wednesdays at 07:30")).length,
+ ).toBeGreaterThan(0);
+});
+
+test("a schedule the picker can't say is kept unless another is picked", async () => {
+ const custom: RoutineRecord = {
+ ...ROUTINE,
+ cron: "0 9,17 * * *",
+ schedule: "0 9,17 * * *",
+ };
+ const changes = serving(custom);
+ const view = draw(custom);
+ const { user, dialog } = await openEdit(view);
+ expect(dialog.getByLabelText("Schedule").textContent).toContain(
+ "0 9,17 * * *",
+ );
+ // No time to pick while it is kept: the schedule is the one it has.
+ expect(dialog.queryByLabelText("Time")).toBeNull();
+ await replaceText(user, dialog.getByLabelText("Name"), "Twice-daily leads");
+ await user.click(dialog.getByRole("button", { name: "Save changes" }));
+ await waitFor(() =>
+ expect(view.queryByRole("dialog", { name: "Edit routine" })).toBeNull(),
+ );
+ expect(changes).toEqual([{ title: "Twice-daily leads" }]);
+});
+
+test("a refusal is said in the dialog, which stays open", async () => {
+ const changes = serving(ROUTINE, {
+ status: 400,
+ detail: "Routines may run at most every 15 minutes.",
+ });
+ const view = draw();
+ const { user, dialog } = await openEdit(view);
+ await user.click(dialog.getByLabelText("Schedule"));
+ await user.click(await view.findByRole("option", { name: "Every hour" }));
+ await user.click(dialog.getByRole("button", { name: "Save changes" }));
+ expect((await dialog.findByRole("alert")).textContent).toBe(
+ "Routines may run at most every 15 minutes.",
+ );
+ expect(view.getByRole("dialog", { name: "Edit routine" })).toBeTruthy();
+ expect(changes).toEqual([{ cron: "0 * * * *" }]);
+});
+
+test("an empty What to do is not saved", async () => {
+ const changes = serving();
+ const view = draw();
+ const { user, dialog } = await openEdit(view);
+ await replaceText(user, dialog.getByLabelText("What to do"), "");
+ await user.click(dialog.getByRole("button", { name: "Save changes" }));
+ expect(await dialog.findByText("Say what the Bot should do.")).toBeTruthy();
+ expect(changes).toEqual([]);
+});
diff --git a/app/tests/routine-event-words.test.ts b/app/tests/routine-event-words.test.ts
index ed05e22f6b..27fc512ee1 100644
--- a/app/tests/routine-event-words.test.ts
+++ b/app/tests/routine-event-words.test.ts
@@ -81,6 +81,7 @@ const schedule = (overrides: Partial = {}): RoutineRecord => ({
id: "r1",
botId: "bot",
schedule: "Weekdays at 09:00",
+ cron: "0 9 * * 1-5",
timezone: "Europe/Madrid",
instruction: "Check.",
title: null,
diff --git a/app/tests/routines-conversation-title.test.tsx b/app/tests/routines-conversation-title.test.tsx
index 61a8ca4b06..eaf649e466 100644
--- a/app/tests/routines-conversation-title.test.tsx
+++ b/app/tests/routines-conversation-title.test.tsx
@@ -45,6 +45,7 @@ const PAGE: RoutinesPage = {
id: "routine-eks",
botId: "general-assistant",
schedule: "Every 15 minutes",
+ cron: "*/15 * * * *",
timezone: "UTC",
instruction:
"Reply with the current UTC time and the words 'routine check from EKS'.",
@@ -65,6 +66,7 @@ const PAGE: RoutinesPage = {
id: "routine-new",
botId: "general-assistant",
schedule: "Every day at 09:00",
+ cron: "0 9 * * *",
timezone: "UTC",
instruction: "Post the morning summary.",
title: null,
diff --git a/app/tests/routines-discovery.test.tsx b/app/tests/routines-discovery.test.tsx
index 3cf0a0a0e1..c93987d2d4 100644
--- a/app/tests/routines-discovery.test.tsx
+++ b/app/tests/routines-discovery.test.tsx
@@ -46,6 +46,7 @@ function routine(overrides: Partial): RoutineRecord {
id: "routine-1",
botId: "lead-desk",
schedule: "Weekdays at 09:00",
+ cron: "0 9 * * 1-5",
timezone: "Europe/Madrid",
instruction: "Send me a summary of yesterday's new leads",
title: "Morning leads",
diff --git a/app/tests/routines-list-follows-changes.test.tsx b/app/tests/routines-list-follows-changes.test.tsx
index 5574562241..338a65e26e 100644
--- a/app/tests/routines-list-follows-changes.test.tsx
+++ b/app/tests/routines-list-follows-changes.test.tsx
@@ -113,6 +113,7 @@ const routine = (overrides: Partial = {}): RoutineRecord => ({
id: "r1",
botId: "expenses",
schedule: "Weekdays at 09:00",
+ cron: "0 9 * * 1-5",
timezone: "UTC",
instruction: 'Run the goal "Reconcile receipts" (g1) with run_goal.',
title: "Reconcile receipts",
diff --git a/app/tests/routines-merged.test.tsx b/app/tests/routines-merged.test.tsx
index 600450eccb..f5516ea4d3 100644
--- a/app/tests/routines-merged.test.tsx
+++ b/app/tests/routines-merged.test.tsx
@@ -80,6 +80,7 @@ const routine = (
id,
botId: agentId,
schedule: "Weekdays at 09:00",
+ cron: "0 9 * * 1-5",
timezone: "UTC",
instruction: "Post the standup summary.",
title: null,
diff --git a/app/tests/routines-title.test.tsx b/app/tests/routines-title.test.tsx
index 13a21553f1..7695d9f170 100644
--- a/app/tests/routines-title.test.tsx
+++ b/app/tests/routines-title.test.tsx
@@ -44,6 +44,7 @@ const PAGE: RoutinesPage = {
id: "routine-named",
botId: "general-assistant",
schedule: "Every day at 08:00",
+ cron: "0 8 * * *",
timezone: "Europe/Madrid",
instruction: "Summarise my unread mail and today's meetings.",
title: "Morning briefing",
@@ -63,6 +64,7 @@ const PAGE: RoutinesPage = {
id: "routine-unnamed",
botId: "general-assistant",
schedule: "Weekdays at 18:00",
+ cron: "0 18 * * 1-5",
timezone: "UTC",
instruction: "Post the day's open pull requests.",
title: null,
diff --git a/app/tests/self-host-banner.test.tsx b/app/tests/self-host-banner.test.tsx
index 200e9cf98c..cec9ff62f5 100644
--- a/app/tests/self-host-banner.test.tsx
+++ b/app/tests/self-host-banner.test.tsx
@@ -35,6 +35,7 @@ beforeEach(() => {
preferences: {
messageListEmphasis: "thread",
selfHostBannerDismissed: true,
+ dismissedNotices: [],
},
});
globalThis.fetch = Object.assign(
@@ -91,6 +92,7 @@ function setup({
const preferences: UserPreferences = {
messageListEmphasis: "thread",
selfHostBannerDismissed: dismissed,
+ dismissedNotices: [],
narration: null,
skin: "openbot",
proactive: "on",
diff --git a/app/tests/sent-file-card.test.tsx b/app/tests/sent-file-card.test.tsx
new file mode 100644
index 0000000000..15adc1a820
--- /dev/null
+++ b/app/tests/sent-file-card.test.tsx
@@ -0,0 +1,187 @@
+import { afterAll, afterEach, beforeAll, expect, spyOn, test } from "bun:test";
+import * as ReactCoreV2 from "@copilotkit/react-core/v2";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import { SEND_FILE_TOOL } from "@openbot/shared/send-file";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { cleanup, render, waitFor, within } from "@testing-library/react";
+import type { ReactElement } from "react";
+import { attachmentAddress } from "@/lib/channels/attachments";
+import { ComputerTools } from "@/lib/copilot/computer-tools";
+import { approvalInboxResponse } from "./approvals-api";
+
+/**
+ * A file a Bot sent from its computer, as the conversation draws it, live and after a reload.
+ *
+ * The server stores the file as an attachment of the conversation and answers `computer_send_file`
+ * with it: `{ ok: true, file: { attachmentId, name, mimeType, sizeBytes, url } }`. That answer is
+ * what the stored thread keeps, so a reopened conversation draws the card from it alone. These draw
+ * the renderer the app registers for the tool, which is what the conversation calls, with answers in
+ * exactly that shape, against a server that answers the attachment's address as the real one does:
+ * 200 while the file is there, 404 once it is gone or for somebody who is not in the conversation.
+ */
+
+type Registered = Parameters[0];
+const registered: Registered[] = [];
+const useCopilotKitSpy = spyOn(ReactCoreV2, "useCopilotKit").mockImplementation(
+ () => ({ copilotkit: { stopAgent: () => undefined } }) as never,
+);
+const useFrontendToolSpy = spyOn(
+ ReactCoreV2,
+ "useFrontendTool",
+).mockImplementation((tool) => {
+ if (!registered.some((entry) => entry.name === tool.name))
+ registered.push(tool as unknown as Registered);
+});
+
+const THERE = "7f1c2a9e-0b5d-4c41-9a37-2f8e6d4b1c01";
+const PICTURE = "a3d94b10-6e2f-4f8a-b0c7-91e5d2c84f22";
+const GONE = "c0ffee00-1234-4abc-8def-001122334455";
+const probed: string[] = [];
+let originalFetch: typeof fetch;
+
+beforeAll(() => {
+ // An origin, so a relative `src` resolves and a picture is not reported broken before it draws.
+ GlobalRegistrator.register({ url: "http://localhost/" });
+ originalFetch = globalThis.fetch;
+ globalThis.fetch = (async (
+ input: Parameters[0],
+ init?: RequestInit,
+ ) => {
+ const path = String(input);
+ {
+ const approvals = approvalInboxResponse(path, { requests: [] });
+ if (approvals) return approvals;
+ }
+ if (path.includes("/attachments/")) {
+ probed.push(`${init?.method ?? "GET"} ${path}`);
+ return path.includes(GONE)
+ ? Response.json({ code: "NOT_FOUND" }, { status: 404 })
+ : new Response(null, { status: 200 });
+ }
+ return new Response("not found", { status: 404 });
+ }) as typeof fetch;
+});
+afterEach(cleanup);
+afterAll(() => {
+ globalThis.fetch = originalFetch;
+ useCopilotKitSpy.mockRestore();
+ useFrontendToolSpy.mockRestore();
+ GlobalRegistrator.unregister();
+});
+
+function withQueries(ui: ReactElement) {
+ const queries = new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+ });
+ return render(
+ {ui},
+ );
+}
+
+/** One `computer_send_file` call, drawn by the renderer the app registered for it. */
+function drawSend(path: string, answer: unknown) {
+ if (!registered.some((entry) => entry.name === SEND_FILE_TOOL)) {
+ withQueries();
+ cleanup();
+ }
+ const tool = registered.find((entry) => entry.name === SEND_FILE_TOOL);
+ if (!tool?.render) throw new Error("computer_send_file draws nothing.");
+ const draw = tool.render as unknown as (
+ props: Record,
+ ) => ReactElement;
+ return withQueries(
+ draw({
+ name: SEND_FILE_TOOL,
+ toolCallId: `send-${path}`,
+ args: { path },
+ status: "complete",
+ result: JSON.stringify(answer),
+ }),
+ );
+}
+
+const sent = (file: {
+ attachmentId: string;
+ name: string;
+ mimeType: string;
+ sizeBytes: number;
+}) => ({
+ ok: true,
+ file: { ...file, url: `/api/attachments/${file.attachmentId}` },
+});
+
+test("a CSV the Bot sent is a card with its name, kind, size and a download of the stored file", async () => {
+ const view = drawSend(
+ "reports/revenue.csv",
+ sent({
+ attachmentId: THERE,
+ name: "revenue.csv",
+ mimeType: "text/csv",
+ sizeBytes: 31_744,
+ }),
+ );
+
+ const card = within(
+ await view.findByRole("figure", { name: "File from the Bot: revenue.csv" }),
+ );
+ expect(card.getByText("revenue.csv")).toBeTruthy();
+ expect(card.getByText("CSV · 31 KB")).toBeTruthy();
+ // A link drawn as the app's own outline button, so it is announced as one.
+ const download = card.getByRole("button", { name: "Download revenue.csv" });
+ const address = attachmentAddress(`/api/attachments/${THERE}`);
+ expect(download.getAttribute("href")).toBe(address);
+ expect(download.getAttribute("download")).toBe("revenue.csv");
+ // Not a picture, so nothing opens in the page.
+ expect(view.container.querySelector("img")).toBeNull();
+ // A document is asked whether it is still there, at the conversation's own address.
+ await waitFor(() => expect(probed).toContain(`HEAD ${address}`));
+});
+
+test("a picture the Bot sent shows itself in the card and opens full size", async () => {
+ const view = drawSend(
+ "charts/q3.png",
+ sent({
+ attachmentId: PICTURE,
+ name: "q3.png",
+ mimeType: "image/png",
+ sizeBytes: 2_411_724,
+ }),
+ );
+
+ const card = within(
+ await view.findByRole("figure", { name: "File from the Bot: q3.png" }),
+ );
+ expect(card.getByText("PNG image · 2.3 MB")).toBeTruthy();
+ expect(card.getByRole("button", { name: "Open q3.png" })).toBeTruthy();
+ expect(card.getByRole("img", { name: "q3.png" }).getAttribute("src")).toBe(
+ attachmentAddress(`/api/attachments/${PICTURE}`),
+ );
+});
+
+test("a sent file that is gone says so in its own name instead of offering a download", async () => {
+ const view = drawSend(
+ "notes.md",
+ sent({
+ attachmentId: GONE,
+ name: "notes.md",
+ mimeType: "text/markdown",
+ sizeBytes: 820,
+ }),
+ );
+
+ const note = await view.findByRole("note");
+ expect(note.textContent).toContain("notes.md");
+ expect(view.queryByRole("button", { name: /Download/ })).toBeNull();
+});
+
+test("a file that could not be sent is one line with the reason, and no card", async () => {
+ const reason =
+ "budget.xlsx can't be sent. Bots can send images (PNG, JPEG, GIF, WebP), PDFs, and text, Markdown, CSV or JSON files.";
+ const view = drawSend("budget.xlsx", { ok: false, refused: true, reason });
+
+ expect(await view.findByText("Blocked: Send a file")).toBeTruthy();
+ // The sentence names the file, so the line does not say the name twice.
+ expect(view.getByText(reason)).toBeTruthy();
+ expect(view.queryByRole("figure")).toBeNull();
+ expect(view.queryByRole("button", { name: /Download/ })).toBeNull();
+});
diff --git a/app/tests/sent-file-in-a-task.test.tsx b/app/tests/sent-file-in-a-task.test.tsx
new file mode 100644
index 0000000000..d5f64879b2
--- /dev/null
+++ b/app/tests/sent-file-in-a-task.test.tsx
@@ -0,0 +1,334 @@
+import { afterAll, afterEach, beforeAll, expect, test } from "bun:test";
+import type { Message } from "@ag-ui/core";
+import { CopilotKitProvider } from "@copilotkit/react-core/v2";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import {
+ DELEGATE_TOOL,
+ frameBrief,
+ taskReportMessageId,
+} from "@openbot/shared/orchestration";
+import { SEND_FILE_TOOL } from "@openbot/shared/send-file";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import {
+ createMemoryHistory,
+ createRootRoute,
+ createRoute,
+ createRouter,
+ Outlet,
+ RouterProvider,
+} from "@tanstack/react-router";
+import { cleanup, render, waitFor } from "@testing-library/react";
+import { HttpResponse, http } from "msw";
+import { setupServer } from "msw/node";
+import { ChatTranscript } from "@/components/channels/chat-transcript";
+import { attachmentAddress } from "@/lib/channels/attachments";
+import { ComputerTools } from "@/lib/copilot/computer-tools";
+import { settleReactWork } from "./settle-react-work";
+
+/**
+ * A file a Bot sends is seen where the person reads, without opening anything.
+ *
+ * FOUND BY THE END-TO-END PASS. Asked in a conversation to make a CSV and send it, Personal
+ * Assistant handed the work to a task, as it does. The file was stored, but no card showed
+ * anywhere: in the task's thread the send folded into "Worked for 13s" with the other steps, and the
+ * report in the conversation that asked carried only the words, "Created and sent team-budget.csv",
+ * with no card at all.
+ *
+ * Both threads below are the real run's, as its API answered them (test-20261117-71, Desktop): the
+ * brief, a line on the way and the write, the send and its answer, and the report. The report is
+ * written the way the server writes one with what the work drew: the words, then each drawn call
+ * and its answer under the same message. The transcript and the tools are the app's own; the server
+ * is faked at the HTTP boundary only.
+ */
+
+const ATTACHMENT = "bffdecae-4a19-48ea-b363-d1842fa33791";
+const SENT = JSON.stringify({
+ ok: true,
+ file: {
+ attachmentId: ATTACHMENT,
+ name: "team-budget.csv",
+ mimeType: "text/csv",
+ sizeBytes: 84,
+ url: `/api/attachments/${ATTACHMENT}`,
+ },
+ finishedAt: "2026-11-17T20:57:38.110Z",
+});
+const REPORT = `Created and sent [team-budget.csv](/api/attachments/${ATTACHMENT}) with three made-up budget lines.`;
+const TASK_ID = "68a24229-7ffb-4e2d-98f4-f684f7e92f4f";
+
+const task = {
+ id: TASK_ID,
+ botId: "personal-assistant",
+ conversationId: "channel_task",
+ threadId: "thread_task",
+ title: "Create and send team budget CSV",
+ why: null,
+ origin: "delegated",
+ suggestionId: null,
+ sourceApp: null,
+ sourceLink: null,
+ originConversationId: "channel_main",
+ status: "ready_for_review",
+ failure: null,
+ failedAt: null,
+ stoppedAt: null,
+ workingSince: null,
+ tryingAgainAt: null,
+ lastActivityAt: "2026-11-17T20:57:40.000Z",
+ next: REPORT,
+ resolvedAt: null,
+ createdAt: "2026-11-17T20:57:25.000Z",
+ updatedAt: "2026-11-17T20:57:40.000Z",
+};
+const server = setupServer(
+ http.get("*/api/v2/organizations/:organizationId/tasks", () =>
+ HttpResponse.json({ tasks: [task], nextCursor: null }),
+ ),
+ http.get("*/api/v2/organizations/:organizationId/tasks/:id/turns", () =>
+ HttpResponse.json({
+ turns: [
+ {
+ askId: `task-${TASK_ID}`,
+ startedAt: "2026-11-17T20:57:25.000Z",
+ endedAt: "2026-11-17T20:57:38.000Z",
+ workedSeconds: 13,
+ runs: 1,
+ model: "gpt-5.1",
+ },
+ ],
+ nextCursor: null,
+ }),
+ ),
+ http.get("*/api/v2/organizations/:organizationId/bots", () =>
+ HttpResponse.json({
+ bots: [{ id: "personal-assistant", name: "Personal Assistant" }],
+ nextCursor: null,
+ }),
+ ),
+ // The card asks whether its file is still there, at the conversation's attachment address.
+ http.head(
+ "*/api/v2/organizations/:organizationId/attachments/:id",
+ () => new HttpResponse(null, { status: 200 }),
+ ),
+ // Nothing else on this screen bears on the test.
+ http.all("*", () => new HttpResponse(null, { status: 404 })),
+);
+
+beforeAll(() => {
+ GlobalRegistrator.register({ url: "http://localhost/" });
+ server.listen({ onUnhandledRequest: "bypass" });
+});
+afterEach(() => {
+ cleanup();
+ server.resetHandlers();
+});
+afterAll(async () => {
+ server.close();
+ await settleReactWork();
+ GlobalRegistrator.unregister();
+});
+
+const call = (id: string, name: string, args: object) => ({
+ id,
+ type: "function" as const,
+ function: { name, arguments: JSON.stringify(args) },
+});
+
+/** The task's thread, as the real run stored it. */
+const taskThread: Message[] = [
+ {
+ id: `task-${TASK_ID}`,
+ role: "user",
+ content: frameBrief(
+ "On your computer, write a small CSV file named team-budget.csv with the exact header row item,owner,amount and three made-up budget lines. Send the file to the user in this chat so they can download it. Do not paste the contents.",
+ ),
+ },
+ {
+ id: "msg_0fb5961ed9816a4b",
+ role: "assistant",
+ content:
+ "I’ll create the CSV on my computer and send it here for download.",
+ toolCalls: [
+ call("call_write", "computer_write_file", {
+ path: "team-budget.csv",
+ content: "item,owner,amount\n",
+ }),
+ ],
+ },
+ {
+ id: "f65c068b-7800-4ae7-8a98-9e8682e7bf48",
+ role: "tool",
+ toolCallId: "call_write",
+ content: JSON.stringify({
+ ok: true,
+ path: "team-budget.csv",
+ bytes: 84,
+ appended: false,
+ finishedAt: "2026-11-17T20:57:34.068Z",
+ }),
+ },
+ {
+ id: "ce480438-33e6-4cf5-b84f-617e7df4495b",
+ role: "assistant",
+ content: "",
+ toolCalls: [call("call_send", SEND_FILE_TOOL, { path: "team-budget.csv" })],
+ },
+ {
+ id: "3ea0ed53-4f3d-4a47-a244-5c236aa979f1",
+ role: "tool",
+ toolCallId: "call_send",
+ content: SENT,
+ },
+ { id: "msg_0875b0466cf3e3cc", role: "assistant", content: REPORT },
+];
+
+/** The conversation that asked, with the task's report as the server writes it into it. */
+const reportId = taskReportMessageId(
+ "result",
+ TASK_ID,
+ "4c6f2c7f3ad1163d24ac1d28641c14ec",
+);
+const askingConversation: Message[] = [
+ {
+ id: "d0dc33ec-e4f7-45da-b18f-99057187e4f0",
+ role: "user",
+ content:
+ "On your computer, write a small CSV file named team-budget.csv with a header row (item,owner,amount) and three made-up budget lines, then send that file to me in this chat so I can download it. Don't paste its contents, send the file.",
+ },
+ {
+ id: "msg_0635dab8d46a7247",
+ role: "assistant",
+ content: "I’ll create the CSV and send it here for download.",
+ toolCalls: [
+ call("call_delegate", DELEGATE_TOOL, {
+ title: "Create and send team budget CSV",
+ }),
+ ],
+ },
+ {
+ id: "504a6acb-af8e-4fac-9d01-fb7aa59dd01d",
+ role: "tool",
+ toolCallId: "call_delegate",
+ content: JSON.stringify(
+ JSON.stringify({
+ taskId: TASK_ID,
+ channelId: "channel_task",
+ title: "Create and send team budget CSV",
+ }),
+ ),
+ },
+ {
+ id: reportId,
+ role: "assistant",
+ content: REPORT,
+ toolCalls: [
+ call("call_drawn_0", SEND_FILE_TOOL, { path: "team-budget.csv" }),
+ ],
+ },
+ {
+ id: "call_drawn_0:result",
+ role: "tool",
+ toolCallId: "call_drawn_0",
+ content: SENT,
+ },
+];
+
+function draw(messages: Message[], threadId: string) {
+ const client = new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+ });
+ const rootRoute = createRootRoute({
+ component: () => (
+
+
+
+
+
+ ),
+ });
+ const routeTree = rootRoute.addChildren([
+ createRoute({
+ getParentRoute: () => rootRoute,
+ path: "/channel/$channelId",
+ component: () =>
a conversation
,
+ }),
+ ]);
+ const router = createRouter({
+ routeTree,
+ history: createMemoryHistory({ initialEntries: ["/"] }),
+ });
+ return Object.assign(
+ render(
+
+
+ ,
+ ),
+ { router },
+ );
+}
+
+const CARD = 'figure[aria-label="File from the Bot: team-budget.csv"]';
+
+test("in the task's thread the sent file's card stands outside Worked for, before the answer", async () => {
+ const view = draw(taskThread, "thread_task");
+ await waitFor(() =>
+ expect(
+ view.container.querySelector('[data-slot="worked-for"]'),
+ ).not.toBeNull(),
+ );
+ await waitFor(() =>
+ expect(view.container.querySelector(CARD)).not.toBeNull(),
+ );
+ const card = view.container.querySelector(CARD) as HTMLElement;
+ // Seen without opening anything: not inside the fold's disclosure.
+ expect(card.closest("details")).toBeNull();
+ expect(card.closest('[data-slot="worked-for"]')).toBeNull();
+ // The work still folds: the write is a step inside it.
+ const fold = view.container.querySelector(
+ '[data-slot="worked-for"] details',
+ ) as HTMLDetailsElement;
+ expect(fold.open).toBe(false);
+ // The card comes before the answer's words.
+ const answer = view.getByText(/with three made-up budget lines/);
+ expect(
+ card.compareDocumentPosition(answer) & Node.DOCUMENT_POSITION_FOLLOWING,
+ ).toBeTruthy();
+});
+
+test("in the conversation that asked, the task's report shows the card, now and on reload", async () => {
+ // A reload draws from the stored thread, which is this same list: drawn twice, from scratch.
+ for (let pass = 0; pass < 2; pass += 1) {
+ const view = draw(askingConversation, "thread_main");
+ await waitFor(() =>
+ expect(view.container.querySelector(CARD)).not.toBeNull(),
+ );
+ const card = view.container.querySelector(CARD) as HTMLElement;
+ expect(card.closest("details")).toBeNull();
+ expect(card.textContent).toContain("CSV · 84 bytes");
+ expect(view.getByText(/with three made-up budget lines/)).toBeTruthy();
+ cleanup();
+ }
+});
+
+/*
+ * AND THE NAME IN THE WORDS IS THE FILE TOO. The Bot links the file's name to its stored address,
+ * `/api/attachments/`, which read as a page of the app: a click asked the router for it, found
+ * no such page, and landed on home. So no click in the chat ever gave the person the file. It is a
+ * download of the file from the conversation's own address, as the card's Download button is.
+ */
+test("the file's name in the Bot's words downloads the file instead of leaving the conversation", async () => {
+ const view = draw(askingConversation, "thread_main");
+ const link = await view.findByRole("link", { name: "team-budget.csv" });
+ expect(link.getAttribute("href")).toBe(
+ attachmentAddress(`/api/attachments/${ATTACHMENT}`),
+ );
+ expect(link.hasAttribute("download")).toBe(true);
+ link.click();
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ expect(view.router.state.location.pathname).toBe("/");
+ expect(view.router.state.location.href).not.toContain("/api/");
+});
diff --git a/app/tests/settings-ai-connection-desktop.test.tsx b/app/tests/settings-ai-connection-desktop.test.tsx
new file mode 100644
index 0000000000..fb1d8c450c
--- /dev/null
+++ b/app/tests/settings-ai-connection-desktop.test.tsx
@@ -0,0 +1,256 @@
+/**
+ * Settings → General → AI model inside OpenBot Desktop: a plan or a sign-in changes the connection
+ * with OpenBot running.
+ *
+ * Before, Change there only asked Desktop to stop OpenBot and reopen its setup window
+ * (`change_ai_connection`). Now the page signs in through Desktop, has Desktop start the one engine a
+ * plan needs, switches the server, and has Desktop settle to it; a refused switch settles Desktop
+ * back to the connection still in use.
+ *
+ * The IPC Tauri injects stands in for Desktop's page commands as the contract names them
+ * (desktop_page.rs: `ai_providers`, `begin_plan_sign_in`, `finish_plan_sign_in`,
+ * `prepare_ai_connection`, `settle_ai_connection`), and `fetch` answers the API as
+ * api/openapi.yaml says, every body checked against the generated schemas. The General page, its
+ * queries and its mutation are the real ones.
+ */
+import {
+ afterAll,
+ afterEach,
+ beforeAll,
+ beforeEach,
+ expect,
+ test,
+} from "bun:test";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import { QueryClientProvider } from "@tanstack/react-query";
+import { cleanup, render, waitFor, within } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import type { ComponentType } from "react";
+import { ThemeProvider } from "@/components/theme-provider";
+import type { AiConnection } from "@/lib/api/generated/model";
+import {
+ GetAiConnectionResponse,
+ ReplaceAiConnectionBody,
+} from "@/lib/api/generated/models/models.zod";
+import { modelKeys } from "@/lib/models/queries";
+import { queryClient } from "@/query-client";
+import { Route as GeneralRoute } from "@/routes/_authed/settings/index";
+import { settleReactWork } from "./settle-react-work";
+
+const AI_CONNECTION = "/api/v2/organizations/default/ai-connection";
+
+const OPENAI_KEY: AiConnection = {
+ provider: "openai",
+ login: "api-key",
+ model: null,
+ endpointHost: null,
+ keySet: true,
+ ready: true,
+ source: "stored",
+ editable: true,
+ saved: [{ provider: "openai", login: "api-key", endpointHost: null }],
+ changedAt: "2026-11-14T09:00:00.000Z",
+};
+
+const ENGINE_NOT_READY = {
+ type: "https://open.bot/errors/ai-connection-refused",
+ title: "OpenBot couldn't use that connection.",
+ status: 422,
+ detail: "Claude hasn't started yet. Try again in a moment.",
+ code: "AI_CONNECTION_ENGINE_NOT_READY",
+ category: "validation",
+ retryable: true,
+ requestId: "req_test",
+ traceId: "trace_test",
+};
+
+let connection: AiConnection;
+let refuse: boolean;
+/** Everything Desktop and the server were asked, in order. */
+let calls: { what: string; args?: unknown }[];
+
+/** What was asked of the AI connection: the rest of General reads its own things. */
+const AI_CALLS = new Set([
+ "ai_providers",
+ "begin_plan_sign_in",
+ "finish_plan_sign_in",
+ "cancel_plan_sign_in",
+ "prepare_ai_connection",
+ "replaceAiConnection",
+ "settle_ai_connection",
+ "change_ai_connection",
+]);
+const aiCalls = () => calls.filter((call) => AI_CALLS.has(call.what));
+
+async function shellInvoke(command: string, args?: Record) {
+ const what = command.replace("plugin:openbot-desktop|", "");
+ calls.push({ what, args });
+ switch (what) {
+ case "ai_providers":
+ return [];
+ case "begin_plan_sign_in":
+ return { url: "https://claude.ai/oauth/authorize?code=true" };
+ case "finish_plan_sign_in":
+ case "cancel_plan_sign_in":
+ case "settle_ai_connection":
+ return null;
+ case "prepare_ai_connection":
+ return { ready: true };
+ }
+ throw `command ${command} not found`;
+}
+
+const originalFetch = global.fetch;
+
+beforeAll(() => GlobalRegistrator.register({ url: "http://127.0.0.1:3010/" }));
+beforeEach(() => {
+ calls = [];
+ refuse = false;
+ connection = OPENAI_KEY;
+ (window as unknown as Record).__TAURI_INTERNALS__ = {
+ invoke: shellInvoke,
+ transformCallback: () => 0,
+ };
+ // The sign-in page opens in the browser; nothing to open here.
+ window.open = () => null;
+ global.fetch = Object.assign(
+ async (input: RequestInfo | URL, init?: RequestInit) => {
+ const url = new URL(String(input), "http://127.0.0.1:3010/");
+ if (url.pathname !== AI_CONNECTION)
+ return new Response(null, { status: 404 });
+ if ((init?.method ?? "GET") === "GET")
+ return Response.json(GetAiConnectionResponse.parse(connection));
+ const body = JSON.parse(String(init?.body));
+ calls.push({ what: "replaceAiConnection", args: body });
+ const input_ = ReplaceAiConnectionBody.parse(body);
+ if (refuse)
+ return new Response(JSON.stringify(ENGINE_NOT_READY), {
+ status: 422,
+ headers: { "content-type": "application/problem+json" },
+ });
+ connection = {
+ ...OPENAI_KEY,
+ provider: input_.provider,
+ login: input_.login,
+ changedAt: "2026-11-17T23:30:00.000Z",
+ };
+ return Response.json(GetAiConnectionResponse.parse(connection));
+ },
+ { preconnect: originalFetch.preconnect },
+ );
+});
+afterEach(() => {
+ cleanup();
+ queryClient.clear();
+ global.fetch = originalFetch;
+ delete (window as unknown as Record).__TAURI_INTERNALS__;
+});
+afterAll(async () => {
+ await settleReactWork();
+ await GlobalRegistrator.unregister();
+});
+
+function renderGeneral() {
+ const Page = GeneralRoute.options.component as ComponentType;
+ return render(
+
+
+
+
+ ,
+ );
+}
+
+/** Open the AI model row, choose Change, then Anthropic, and sign in with the Claude plan. */
+async function signInWithClaude(view: ReturnType) {
+ await userEvent.click(
+ await view.findByRole("button", { name: /Uses your OpenAI API key/ }),
+ );
+ const dialog = await view.findByRole("dialog");
+ await userEvent.click(within(dialog).getByRole("button", { name: "Change" }));
+ await userEvent.click(
+ await within(dialog).findByRole("button", { name: /^Anthropic/ }),
+ );
+ // Inside Desktop the plan is offered, first, as at setup.
+ await userEvent.click(
+ await within(dialog).findByRole("button", {
+ name: "Sign in with Anthropic",
+ }),
+ );
+ await userEvent.type(
+ await within(dialog).findByLabelText("Code from your browser"),
+ "code#state",
+ );
+ await userEvent.click(within(dialog).getByRole("button", { name: "Finish" }));
+ await within(dialog).findByText("Signed in to Anthropic.");
+ return dialog;
+}
+
+test("a Claude plan: signed in, its engine started alone, the server switched, Desktop settled, and OpenBot never stopped", async () => {
+ const view = renderGeneral();
+ const dialog = await signInWithClaude(view);
+ await userEvent.click(
+ within(dialog).getByRole("button", { name: "Connect" }),
+ );
+ await within(dialog).findByText("Connected to Anthropic");
+
+ const asked = aiCalls();
+ expect(asked.map((call) => call.what)).toEqual([
+ "ai_providers",
+ "begin_plan_sign_in",
+ "finish_plan_sign_in",
+ "prepare_ai_connection",
+ "replaceAiConnection",
+ "settle_ai_connection",
+ ]);
+ expect(asked[1]?.args).toEqual({ plan: "claude" });
+ expect(asked[2]?.args).toEqual({ plan: "claude", code: "code#state" });
+ expect(asked[3]?.args).toEqual({ provider: "anthropic", login: "plan" });
+ expect(asked[4]?.args).toEqual({ provider: "anthropic", login: "plan" });
+ expect(asked[5]?.args).toEqual({ provider: "anthropic", login: "plan" });
+ expect(calls.map((call) => call.what)).not.toContain("change_ai_connection");
+});
+
+test("a refused switch says why in one sentence, and Desktop settles back to the connection still in use", async () => {
+ refuse = true;
+ const view = renderGeneral();
+ const dialog = await signInWithClaude(view);
+ await userEvent.click(
+ within(dialog).getByRole("button", { name: "Connect" }),
+ );
+ const alert = await within(dialog).findByRole("alert");
+ expect(alert.textContent).toBe(
+ "Claude hasn't started yet. Try again in a moment.",
+ );
+ await waitFor(() =>
+ expect(aiCalls().at(-1)).toEqual({
+ what: "settle_ai_connection",
+ args: { provider: "openai", login: "api-key" },
+ }),
+ );
+ expect(calls.map((call) => call.what)).not.toContain("change_ai_connection");
+});
+
+test("after a switch, the models a person may pick and each conversation's pick are read again", async () => {
+ queryClient.setQueryData(modelKeys.catalogue, { models: [] });
+ queryClient.setQueryData(modelKeys.conversation("channel-1"), {
+ model: "gpt-6.1-pro",
+ effort: null,
+ });
+ const view = renderGeneral();
+ const dialog = await signInWithClaude(view);
+ await userEvent.click(
+ within(dialog).getByRole("button", { name: "Connect" }),
+ );
+ await within(dialog).findByText("Connected to Anthropic");
+ expect(queryClient.getQueryState(modelKeys.catalogue)?.isInvalidated).toBe(
+ true,
+ );
+ expect(
+ queryClient.getQueryState(modelKeys.conversation("channel-1"))
+ ?.isInvalidated,
+ ).toBe(true);
+ // And the row under the dialog reads the new connection.
+ await userEvent.click(within(dialog).getByRole("button", { name: "Done" }));
+ await view.findByRole("button", { name: /Signed in with your Claude plan/ });
+});
diff --git a/app/tests/share-preview-files.test.tsx b/app/tests/share-preview-files.test.tsx
new file mode 100644
index 0000000000..206c53fa8f
--- /dev/null
+++ b/app/tests/share-preview-files.test.tsx
@@ -0,0 +1,184 @@
+import { afterAll, afterEach, beforeAll, expect, test } from "bun:test";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { cleanup, render, within } from "@testing-library/react";
+import type { ReactNode } from "react";
+import { InlineApproval } from "@/components/approvals/inline-approval";
+import { WaitingForYou } from "@/components/approvals/waiting";
+import { BotNeedsYou } from "@/components/needs-you/board";
+import { attachmentAddress } from "@/lib/channels/attachments";
+import { approvalInboxResponse } from "./approvals-api";
+import { answerBotsList } from "./bots-api";
+import { CONVERSATIONS_PATH, TASKS_PATH } from "./conversations-api";
+import { CHECK_IN_ITEMS_PATH, pathOf } from "./schedules-api";
+import { settleReactWork } from "./settle-react-work";
+
+/*
+ * FOUND IN THE END-TO-END PASS (bundle, round 2). In a group conversation, a Bot's reply that sent
+ * a file waits for its owner's "Share private information with this group conversation". The
+ * request showed the reply as its raw Markdown, "Sent [group-budget.csv](/api/attachments/6888…)."
+ * and "Attached: **group-budget.csv**.", so the person deciding whether to share a file read a
+ * URL and asterisks and never saw the file. It now reads as the reply will look: the words drawn
+ * as the conversation draws them, and each file the held reply carries as its card, which the
+ * owner can open, since the file is their Bot's.
+ *
+ * The request is the one the run held (its words as the Bot wrote them, the file's attachment id),
+ * with the file named on it as the server now names it (`args.files`). Drawn on the Bot's page, on
+ * the Needs you board and as the card in the conversation.
+ */
+
+beforeAll(() => GlobalRegistrator.register({ url: "http://localhost/" }));
+afterEach(cleanup);
+afterAll(async () => {
+ await settleReactWork();
+ GlobalRegistrator.unregister();
+});
+
+const originalFetch = global.fetch;
+afterEach(() => {
+ global.fetch = originalFetch;
+});
+
+const ATTACHMENT = "6888e790-0e95-409b-8116-90bd3aa0d8b6";
+const WORDS = `I’ll create the CSV on my computer and send it here.\n\nSent [group-budget.csv](/api/attachments/${ATTACHMENT}).`;
+
+const share = {
+ id: "approval-group-share",
+ status: "pending",
+ createdAt: "2026-11-17T22:10:00.000Z",
+ action: {
+ botId: "general-assistant",
+ toolRef: "openbot/share_private_information",
+ effect: "share_private",
+ scope: "group:channel_group:members:6f0c",
+ threadId: "thread-group",
+ toolCallId: "group-post:m-1:general-assistant",
+ args: {
+ audience: "this group conversation",
+ recipients: 2,
+ contentDigest: "5b1e",
+ preview: WORDS,
+ files: [
+ {
+ id: ATTACHMENT,
+ name: "group-budget.csv",
+ mimeType: "text/csv",
+ sizeBytes: 96,
+ },
+ ],
+ },
+ target: { kind: "group", id: "channel_group" },
+ },
+};
+
+function serving() {
+ global.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
+ const url = String(input);
+ // The owner reads their Bot's file at the conversation's attachment address.
+ if (url.includes(`/attachments/${ATTACHMENT}`))
+ return new Response(null, { status: 200 });
+ {
+ const approvals = approvalInboxResponse(url, {
+ enabled: true,
+ rules: [],
+ teamRules: [],
+ questions: [],
+ requests: [share],
+ });
+ if (approvals) return approvals;
+ }
+ if (pathOf(url) === CHECK_IN_ITEMS_PATH)
+ return Response.json({ checkInItems: [], nextCursor: null });
+ if (url.split("?")[0] === TASKS_PATH)
+ return Response.json({ tasks: [], nextCursor: null });
+ if (url.split("?")[0] === CONVERSATIONS_PATH)
+ return Response.json({ conversations: [], nextCursor: null });
+ return (
+ answerBotsList(input, init, {
+ visible: [{ id: "general-assistant", name: "General Assistant" }],
+ }) ?? Response.json({})
+ );
+ }) as unknown as typeof fetch;
+}
+
+function draw(node: ReactNode) {
+ return render(
+
+ {node}
+ ,
+ );
+}
+
+/** Reads as the reply will: no Markdown or address showing, the name a download, the file a card. */
+async function readsAsTheReply(scope: HTMLElement) {
+ const view = within(scope);
+ const said = view.getByLabelText("What it would send");
+ expect(said.textContent).toContain(
+ "I’ll create the CSV on my computer and send it here.",
+ );
+ expect(said.textContent).not.toContain("](");
+ expect(said.textContent).not.toContain("/api/attachments");
+ const link = within(said).getByRole("link", { name: "group-budget.csv" });
+ expect(link.getAttribute("href")).toBe(
+ attachmentAddress(`/api/attachments/${ATTACHMENT}`),
+ );
+ expect(link.hasAttribute("download")).toBe(true);
+ const card = await view.findByRole("figure", {
+ name: "File from the Bot: group-budget.csv",
+ });
+ expect(card.textContent).toContain("CSV · 96 bytes");
+ expect(
+ within(card).getByRole("button", { name: "Download group-budget.csv" }),
+ ).toBeTruthy();
+}
+
+test("on the Bot's page, a held group reply reads as it will look, with its file as a card", async () => {
+ serving();
+ const view = draw();
+ await view.findByLabelText("What it would send");
+ await readsAsTheReply(view.container);
+});
+
+test("on the Needs you board, the same", async () => {
+ serving();
+ const view = draw();
+ await view.findByLabelText("What it would send");
+ await readsAsTheReply(view.container);
+});
+
+test("as the card in the conversation, the same", async () => {
+ serving();
+ const view = draw(
+ ,
+ );
+ const card = await view.findByRole("region", {
+ name: "Waiting for your approval",
+ });
+ await readsAsTheReply(card);
+});
+
+test("bold in the words is drawn as bold, not as asterisks", async () => {
+ serving();
+ share.action.args.preview =
+ "I’ll create the CSV on my computer and send it here.\n\nAttached: **group-budget.csv**.";
+ try {
+ const view = draw();
+ const said = await view.findByLabelText("What it would send");
+ expect(said.textContent).not.toContain("**");
+ // Bold as the conversation draws it.
+ expect(
+ within(said)
+ .getByText("group-budget.csv")
+ .closest('[data-streamdown="strong"]'),
+ ).not.toBeNull();
+ } finally {
+ share.action.args.preview = WORDS;
+ }
+});
diff --git a/app/tests/skins-account.test.tsx b/app/tests/skins-account.test.tsx
index b89cfa0822..08a5f41f95 100644
--- a/app/tests/skins-account.test.tsx
+++ b/app/tests/skins-account.test.tsx
@@ -77,6 +77,7 @@ function preferences(skin: UserPreferences["skin"]): UserPreferences {
return {
messageListEmphasis: "thread",
selfHostBannerDismissed: true,
+ dismissedNotices: [],
narration: null,
skin,
proactive: "on",
diff --git a/app/tests/skins-openfuse.test.tsx b/app/tests/skins-openfuse.test.tsx
index 5444c50b4d..5253d2d7a7 100644
--- a/app/tests/skins-openfuse.test.tsx
+++ b/app/tests/skins-openfuse.test.tsx
@@ -316,6 +316,7 @@ const routines: RoutineRecord[] = [
id: "rt-1",
botId: fuse.id,
schedule: "Every weekday at 9:00",
+ cron: "0 9 * * 1-5",
timezone: "Europe/London",
instruction: "Send me the headlines",
title: null,
diff --git a/app/tests/star-on-github-setting.test.tsx b/app/tests/star-on-github-setting.test.tsx
new file mode 100644
index 0000000000..d7575680eb
--- /dev/null
+++ b/app/tests/star-on-github-setting.test.tsx
@@ -0,0 +1,157 @@
+import {
+ afterAll,
+ afterEach,
+ beforeAll,
+ beforeEach,
+ expect,
+ test,
+} from "bun:test";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import type { UserPreferences } from "@openbot/shared/user-preferences";
+import { QueryClientProvider } from "@tanstack/react-query";
+import { cleanup, fireEvent, render, waitFor } from "@testing-library/react";
+import { StarOnGitHubSection } from "@/components/settings/star-on-github";
+import { authKeys } from "@/lib/auth/queries";
+import { deploymentKeys } from "@/lib/deployment/queries";
+import { userPreferencesQueryOptions } from "@/lib/settings/message-list";
+import { queryClient } from "@/query-client";
+import { settleReactWork } from "./settle-react-work";
+
+/**
+ * Settings → General's permanent link to star OpenBot on GitHub. Only in the personal edition, like
+ * the card: a team's or a company's OpenBot never asks for a star. It stays whether or not the
+ * person answered the card; pressing it is counted as a Settings click and answers the card, so
+ * somebody who starred here is not asked again.
+ */
+
+const STAR = "star-on-github";
+const originalFetch = globalThis.fetch;
+let requests: { path: string; method: string; body: unknown }[];
+
+beforeAll(() =>
+ // The link is real: pressing it must not open github.com from a test.
+ GlobalRegistrator.register({
+ url: "http://localhost:3010",
+ settings: {
+ navigation: {
+ disableChildPageNavigation: true,
+ disableMainFrameNavigation: true,
+ },
+ },
+ }),
+);
+beforeEach(() => {
+ requests = [];
+ globalThis.fetch = Object.assign(
+ async (input: RequestInfo | URL, init?: RequestInit) => {
+ const path = String(input);
+ const method = init?.method ?? "GET";
+ const body =
+ typeof init?.body === "string" ? JSON.parse(init.body) : init?.body;
+ requests.push({ path, method, body });
+ if (path.endsWith("/people/me/preferences")) {
+ // The API answers with the preferences themselves, not wrapped.
+ return Response.json({ ...preferences, ...(body as object) });
+ }
+ return new Response(null, { status: 204 });
+ },
+ { preconnect: originalFetch.preconnect },
+ );
+});
+afterEach(async () => {
+ cleanup();
+ await settleReactWork();
+ queryClient.clear();
+ globalThis.fetch = originalFetch;
+});
+afterAll(async () => {
+ await settleReactWork();
+ GlobalRegistrator.unregister();
+});
+
+const preferences: UserPreferences = {
+ messageListEmphasis: "thread",
+ selfHostBannerDismissed: true,
+ dismissedNotices: [],
+ narration: null,
+ skin: "openbot",
+ proactive: "on",
+};
+
+function setup(edition: "personal" | "team") {
+ queryClient.setQueryData(authKeys.currentUser(), {
+ id: "alice",
+ email: "alice@example.com",
+ role: "user",
+ });
+ queryClient.setQueryData(deploymentKeys.capabilities(), {
+ generativeUi: true,
+ selfHostBanner: false,
+ localEvaluation: edition === "personal",
+ edition,
+ // What an earlier build read as leave to list it everywhere. Nothing reads it now.
+ starPrompt: true,
+ });
+ queryClient.setQueryData(
+ userPreferencesQueryOptions("alice").queryKey,
+ preferences,
+ );
+ return render(
+
+
+ ,
+ );
+}
+
+test("personal edition: Settings lists Star OpenBot on GitHub, linking to the repository in a new tab", () => {
+ const view = setup("personal");
+ expect(view.getByText("Star OpenBot on GitHub")).toBeTruthy();
+ expect(
+ view.getByText(
+ "OpenBot is open source. A star helps us keep making it better.",
+ ),
+ ).toBeTruthy();
+ const link = view.getByRole("link", { name: "Star on GitHub" });
+ expect(link.getAttribute("href")).toBe(
+ "https://github.com/CopilotKit/OpenBot",
+ );
+ expect(link.getAttribute("target")).toBe("_blank");
+ expect(link.getAttribute("rel")).toBe("noopener noreferrer");
+});
+
+test("a team's OpenBot lists nothing", () => {
+ const view = setup("team");
+ expect(view.queryByText("Star OpenBot on GitHub")).toBeNull();
+ expect(view.queryByRole("link", { name: "Star on GitHub" })).toBeNull();
+});
+
+test("pressing it counts a Settings click and answers the card", async () => {
+ const view = setup("personal");
+ fireEvent.click(view.getByRole("link", { name: "Star on GitHub" }));
+
+ await waitFor(() =>
+ expect(
+ requests.find((request) => request.path.endsWith("/nudge-events"))?.body,
+ ).toEqual({
+ nudge: STAR,
+ action: "clicked",
+ place: "settings",
+ surface: "web",
+ }),
+ );
+ await waitFor(() =>
+ expect(
+ requests.find(
+ (request) =>
+ request.path.endsWith("/people/me/preferences") &&
+ request.method === "PATCH",
+ )?.body,
+ ).toEqual({ dismissedNotices: [STAR] }),
+ );
+ expect(
+ queryClient.getQueryData(userPreferencesQueryOptions("alice").queryKey)
+ ?.dismissedNotices,
+ ).toEqual([STAR]);
+ // Still there: the link in Settings is permanent, whatever the card's answer.
+ expect(view.getByRole("link", { name: "Star on GitHub" })).toBeTruthy();
+});
diff --git a/app/tests/star-prompt.test.tsx b/app/tests/star-prompt.test.tsx
new file mode 100644
index 0000000000..48cbdfa5e0
--- /dev/null
+++ b/app/tests/star-prompt.test.tsx
@@ -0,0 +1,493 @@
+import {
+ afterAll,
+ afterEach,
+ beforeAll,
+ beforeEach,
+ expect,
+ test,
+} from "bun:test";
+import type { Message } from "@ag-ui/core";
+import {
+ CopilotChatConfigurationProvider,
+ CopilotChatMessageView,
+ CopilotKitProvider,
+} from "@copilotkit/react-core/v2";
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+import type { UserPreferences } from "@openbot/shared/user-preferences";
+import {
+ act,
+ cleanup,
+ fireEvent,
+ render,
+ waitFor,
+} from "@testing-library/react";
+import { ConversationView } from "@/components/channels/conversation-view";
+import { TelemetryAssistantMessage } from "@/components/channels/telemetry-assistant-message";
+import { NOTIFY_PROMPT_KEY } from "@/components/notifications/notify-prompt";
+import { StarPrompt } from "@/components/star-prompt/star-prompt";
+import { authKeys } from "@/lib/auth/queries";
+import { deploymentKeys } from "@/lib/deployment/queries";
+import { refreshNotificationPermission } from "@/lib/notifications/permission";
+import { userPreferencesQueryOptions } from "@/lib/settings/message-list";
+import { queryClient } from "@/query-client";
+import { closeDesktop, launchDesktop } from "./desktop-notifications.fixture";
+import { settleReactWork } from "./settle-react-work";
+
+/**
+ * The ask to star OpenBot on GitHub (David's rules):
+ *
+ * 1. Only in the personal edition, never a team's or a company's OpenBot.
+ * 2. Once per person: either answer is saved to their account, so no device asks again.
+ * 3. Only after three days of use and a win (a copied answer, a routine's run, a long task), right
+ * after the win, and never right after an error.
+ *
+ * The server decides when it is due (`noticesDue` on the person's preferences). This file drives the
+ * app through its real components and its real requests against a server that keeps the rule's
+ * inputs the way the real one does: days with a message sent, the last win or error, and the
+ * notices the person dismissed.
+ */
+
+const STAR = "star-on-github";
+const ASK =
+ "Enjoying OpenBot? Star it on GitHub so that we can keep making it better.";
+
+class OfflineWebSocket extends EventTarget {
+ readyState = 0;
+ onclose = null;
+ onerror = null;
+ onmessage = null;
+ onopen = null;
+ close() {}
+ send() {}
+}
+
+/** What the server knows about the one person. */
+type Server = {
+ daysActive: number;
+ last: "win" | "error" | undefined;
+ dismissed: string[];
+ personal: boolean;
+};
+
+const originalFetch = globalThis.fetch;
+const originalWebSocket = globalThis.WebSocket;
+const originalNotification = (globalThis as { Notification?: unknown })
+ .Notification;
+let requests: { path: string; method: string; body: unknown }[];
+let server: Server;
+
+/** The server's own answer for the person's preferences, worked out the way the real one does. */
+function served(): UserPreferences {
+ const due =
+ server.personal &&
+ !server.dismissed.includes(STAR) &&
+ server.daysActive >= 3 &&
+ server.last === "win";
+ return {
+ messageListEmphasis: "thread",
+ selfHostBannerDismissed: true,
+ dismissedNotices: [...server.dismissed],
+ noticesDue: due ? [STAR] : [],
+ narration: null,
+ skin: "openbot",
+ proactive: "on",
+ };
+}
+
+beforeAll(() => {
+ // Star on GitHub is a real link: pressing it must not open github.com from a test.
+ GlobalRegistrator.register({
+ url: "http://localhost:3010",
+ settings: {
+ navigation: {
+ disableChildPageNavigation: true,
+ disableMainFrameNavigation: true,
+ },
+ },
+ });
+ globalThis.WebSocket = OfflineWebSocket as unknown as typeof WebSocket;
+});
+beforeEach(async () => {
+ const { forgetStarPrompt } = await import(
+ "@/components/star-prompt/star-prompt"
+ );
+ forgetStarPrompt?.();
+ window.localStorage.clear();
+ requests = [];
+ server = { daysActive: 3, last: undefined, dismissed: [], personal: true };
+ globalThis.fetch = Object.assign(
+ async (input: RequestInfo | URL, init?: RequestInit) => {
+ const path = String(input);
+ const method = init?.method ?? "GET";
+ const body =
+ typeof init?.body === "string" ? JSON.parse(init.body) : init?.body;
+ requests.push({ path, method, body });
+ if (path.endsWith("/nudge-events"))
+ return new Response(null, { status: 204 });
+ if (path.endsWith("/product-events")) {
+ // The server records a copied answer as a win.
+ if ((body as { kind?: string }).kind === "result_copied")
+ server.last = "win";
+ return new Response(null, { status: 204 });
+ }
+ if (path.endsWith("/people/me/preferences")) {
+ if (method === "PATCH") {
+ const sent = (body as { dismissedNotices?: string[] })
+ .dismissedNotices;
+ // Added to the ones already dismissed, never taken off.
+ for (const id of sent ?? [])
+ if (!server.dismissed.includes(id)) server.dismissed.push(id);
+ }
+ return Response.json(served());
+ }
+ // CopilotKit's runtime info, for the direct Bot chat's provider.
+ return Response.json({
+ version: "fixture",
+ agents: {},
+ mode: "sse",
+ telemetryDisabled: true,
+ });
+ },
+ { preconnect: originalFetch.preconnect },
+ );
+ // A browser already answered about notifications, so that offer is not what is being tested.
+ (globalThis as { Notification?: unknown }).Notification = {
+ permission: "granted",
+ requestPermission: async () => "granted",
+ };
+ refreshNotificationPermission();
+});
+afterEach(async () => {
+ cleanup();
+ closeDesktop();
+ await settleReactWork();
+ queryClient.clear();
+ window.localStorage.clear();
+ globalThis.fetch = originalFetch;
+});
+afterAll(async () => {
+ await settleReactWork();
+ globalThis.WebSocket = originalWebSocket;
+ (globalThis as { Notification?: unknown }).Notification =
+ originalNotification;
+ refreshNotificationPermission();
+ GlobalRegistrator.unregister();
+});
+
+/** What the app shell loads on every page (the self-host banner reads the same three). */
+function loadAppShell() {
+ queryClient.setQueryData(authKeys.currentUser(), {
+ id: "alice",
+ email: "alice@example.com",
+ role: "user",
+ });
+ queryClient.setQueryData(deploymentKeys.capabilities(), {
+ generativeUi: true,
+ selfHostBanner: false,
+ localEvaluation: server.personal,
+ edition: server.personal ? "personal" : "team",
+ // What an earlier build read as leave to ask everybody. Nothing reads it now; it stays so a
+ // build that did would show the card here and fail these tests.
+ starPrompt: true,
+ });
+ // And a browser an earlier build had counted five messages in. Nothing reads it now either.
+ window.localStorage.setItem("openbot-star-prompt-prompts", "5");
+ queryClient.setQueryData(
+ userPreferencesQueryOptions("alice").queryKey,
+ served(),
+ );
+}
+
+/** A conversation, with the card's place above its message box. */
+function conversation(
+ props: Partial[0]> = {},
+) {
+ return render(
+ {}}
+ {...props}
+ />,
+ );
+}
+
+/** The direct Bot chat, where a Bot's answer has a copy button. */
+function directChat() {
+ const messages: Message[] = [
+ { id: "person", role: "user", content: "Find me a table for two" },
+ { id: "answer", role: "assistant", content: "Dishoom, 7:30, booked." },
+ ];
+ return render(
+
+
+
+
+ ,
+ );
+}
+
+async function copyTheAnswer(chat: ReturnType) {
+ Object.defineProperty(navigator, "clipboard", {
+ configurable: true,
+ value: { writeText: async () => {} },
+ });
+ await act(async () => {
+ fireEvent.click(chat.getByTestId("copilot-copy-button"));
+ });
+}
+
+async function sendMessages(view: ReturnType, n: number) {
+ const box = view.getByRole("textbox");
+ for (let sent = 0; sent < n; sent += 1) {
+ await act(async () => {
+ fireEvent.input(box, { target: { textContent: `Message ${sent}` } });
+ fireEvent.keyDown(box, { key: "Enter" });
+ });
+ }
+}
+
+const card = (view: { container: HTMLElement }) =>
+ view.container.querySelector("[data-star-prompt]");
+
+const nudges = (action: string) =>
+ requests.filter(
+ (request) =>
+ request.path.endsWith("/nudge-events") &&
+ (request.body as { action?: string }).action === action,
+ );
+
+const preferenceReads = () =>
+ requests.filter(
+ (request) =>
+ request.path.endsWith("/people/me/preferences") &&
+ request.method === "GET",
+ );
+
+test("personal edition: shows right after a copy on the third day of use", async () => {
+ loadAppShell();
+ const view = conversation();
+ const chat = directChat();
+ expect(card(view)).toBeNull();
+
+ await copyTheAnswer(chat);
+
+ await waitFor(() => expect(card(view)).not.toBeNull());
+ expect(view.getByText(ASK)).toBeTruthy();
+ await waitFor(() => expect(nudges("shown")).toHaveLength(1));
+ expect(nudges("shown")[0]?.body).toEqual({
+ nudge: STAR,
+ action: "shown",
+ place: "card",
+ surface: "web",
+ });
+});
+
+test("a team's OpenBot never shows it, and a copy there asks the server for nothing", async () => {
+ server.personal = false;
+ // Even a server that wrongly said it was due is not believed outside the personal edition.
+ server.last = "win";
+ loadAppShell();
+ queryClient.setQueryData(userPreferencesQueryOptions("alice").queryKey, {
+ ...served(),
+ noticesDue: [STAR],
+ });
+ const view = conversation();
+ const chat = directChat();
+ await copyTheAnswer(chat);
+ await new Promise((resolve) => setTimeout(resolve, 50));
+
+ expect(card(view)).toBeNull();
+ expect(preferenceReads()).toHaveLength(0);
+ expect(nudges("shown")).toHaveLength(0);
+});
+
+test("never before three days of use, even after many messages and a copy", async () => {
+ server.daysActive = 2;
+ loadAppShell();
+ const view = conversation();
+ await sendMessages(view, 8);
+ await copyTheAnswer(directChat());
+ await waitFor(() => expect(preferenceReads().length).toBeGreaterThan(0));
+ await settleReactWork();
+
+ expect(card(view)).toBeNull();
+});
+
+test("never before a win, even after many messages on the third day", async () => {
+ loadAppShell();
+ const view = conversation();
+ await sendMessages(view, 8);
+ await settleReactWork();
+
+ expect(card(view)).toBeNull();
+ expect(nudges("shown")).toHaveLength(0);
+});
+
+test("never right after an error, even when the server says it is due", () => {
+ server.last = "win";
+ loadAppShell();
+ const failed = conversation({
+ stopped: "The Bot stopped before it finished answering.",
+ });
+ expect(card(failed)).toBeNull();
+});
+
+/*
+ * A conversation always hands the view a notice: the allowances, the hand-off resume and the rest,
+ * which mostly draw nothing. Its being there is no error, and the card must still show.
+ */
+test("an ordinary conversation's notice, drawing nothing, does not hide it", () => {
+ server.last = "win";
+ loadAppShell();
+ const view = conversation({
+ notice: (
+ <>
+ {null}
+ {false}
+ >
+ ),
+ });
+ expect(card(view)).not.toBeNull();
+});
+
+test("the server taking the win back (a routine failed after it) shows nothing", async () => {
+ loadAppShell();
+ const view = conversation();
+ const chat = directChat();
+ server.last = "error";
+ // The copy is a win; then a routine fails before the app reads again. The server's last word wins.
+ const { nudgeMoment } = await import("@/lib/notices");
+ nudgeMoment(queryClient);
+ await waitFor(() => expect(preferenceReads().length).toBeGreaterThan(0));
+ await settleReactWork();
+ expect(card(view)).toBeNull();
+ expect(chat).toBeTruthy();
+});
+
+for (const [control, action] of [
+ ["Star on GitHub", "clicked"],
+ ["Not now", "dismissed"],
+] as const) {
+ test(`${control} hides it, saves the answer to the account, and counts it`, async () => {
+ server.last = "win";
+ loadAppShell();
+ const view = conversation();
+ fireEvent.click(
+ control === "Not now"
+ ? view.getByRole("button", { name: control })
+ : view.getByRole("link", { name: control }),
+ );
+
+ await waitFor(() => expect(card(view)).toBeNull());
+ await waitFor(() => expect(nudges(action)).toHaveLength(1));
+ expect(nudges(action)[0]?.body).toEqual({
+ nudge: STAR,
+ action,
+ place: "card",
+ surface: "web",
+ });
+ const saved = requests.find(
+ (request) =>
+ request.path.endsWith("/people/me/preferences") &&
+ request.method === "PATCH",
+ );
+ expect(saved?.body).toEqual({ dismissedNotices: [STAR] });
+ });
+}
+
+test("answered once is never asked again, after a reload and in a second browser", async () => {
+ server.last = "win";
+ loadAppShell();
+ const first = conversation();
+ fireEvent.click(first.getByRole("button", { name: "Not now" }));
+ await waitFor(() => expect(server.dismissed).toEqual([STAR]));
+ cleanup();
+
+ // A reload, or another browser: nothing kept in this page or its storage, only the account.
+ const { forgetStarPrompt } = await import(
+ "@/components/star-prompt/star-prompt"
+ );
+ forgetStarPrompt();
+ queryClient.clear();
+ window.localStorage.clear();
+ loadAppShell();
+ const again = conversation();
+ // Another win on another day does not bring it back.
+ server.daysActive = 9;
+ await copyTheAnswer(directChat());
+ await settleReactWork();
+
+ expect(card(again)).toBeNull();
+ expect(
+ queryClient.getQueryData(userPreferencesQueryOptions("alice").queryKey)
+ ?.dismissedNotices,
+ ).toEqual([STAR]);
+});
+
+test("Star on GitHub is a link to the repository, opened in a new tab", () => {
+ server.last = "win";
+ loadAppShell();
+ const link = conversation().getByRole("link", { name: "Star on GitHub" });
+ expect(link.getAttribute("href")).toBe(
+ "https://github.com/CopilotKit/OpenBot",
+ );
+ expect(link.getAttribute("target")).toBe("_blank");
+ expect(link.getAttribute("rel")).toBe("noopener noreferrer");
+});
+
+test("asks the server for nothing itself when drawn", async () => {
+ server.last = "win";
+ loadAppShell();
+ render();
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ expect(preferenceReads()).toHaveLength(0);
+});
+
+test("a conversation that cannot take messages never shows it", () => {
+ server.last = "win";
+ loadAppShell();
+ expect(card(conversation({ disabled: true }))).toBeNull();
+});
+
+test("in OpenBot Desktop it waits until the app has said whether notifications are on", async () => {
+ const desktop = launchDesktop({ plugin: true, answersLate: true });
+ refreshNotificationPermission();
+ server.last = "win";
+ loadAppShell();
+ const view = conversation();
+ expect(card(view)).toBeNull();
+ expect(nudges("shown")).toHaveLength(0);
+
+ await act(async () => desktop.answer());
+
+ await waitFor(() => expect(card(view)).not.toBeNull());
+});
+
+test("waits while the notifications offer is still open, so the two never stack", () => {
+ (globalThis as { Notification?: unknown }).Notification = {
+ permission: "default",
+ requestPermission: async () => "default",
+ };
+ refreshNotificationPermission();
+ server.last = "win";
+ loadAppShell();
+ const open = conversation();
+ expect(open.container.querySelector("[data-notify-prompt]")).not.toBeNull();
+ expect(card(open)).toBeNull();
+ cleanup();
+
+ window.localStorage.setItem(NOTIFY_PROMPT_KEY, new Date().toISOString());
+ const answered = conversation();
+ expect(card(answered)).not.toBeNull();
+ expect(
+ card(answered)?.closest('[data-slot="composer-column"]'),
+ ).not.toBeNull();
+});
diff --git a/app/tests/tolerant-reader.test.ts b/app/tests/tolerant-reader.test.ts
new file mode 100644
index 0000000000..cb642b3143
--- /dev/null
+++ b/app/tests/tolerant-reader.test.ts
@@ -0,0 +1,117 @@
+import { afterEach, describe, expect, test } from "bun:test";
+import { listNetworkPolicies } from "../src/lib/api/generated/network-policies/network-policies";
+import { getListNetworkPoliciesResponseMock } from "../src/lib/api/generated/network-policies/network-policies.msw";
+import { ListNetworkPoliciesResponse } from "../src/lib/api/generated/network-policies/network-policies.zod";
+import { getPerson } from "../src/lib/api/generated/people/people";
+import { getGetPersonResponseMock } from "../src/lib/api/generated/people/people.msw";
+import { GetPersonResponse } from "../src/lib/api/generated/people/people.zod";
+import { listRoutineRuns } from "../src/lib/api/generated/routines/routines";
+import { getListRoutineRunsResponseMock } from "../src/lib/api/generated/routines/routines.msw";
+import { ListRoutineRunsResponse } from "../src/lib/api/generated/routines/routines.zod";
+import { getTask } from "../src/lib/api/generated/tasks/tasks";
+import { getGetTaskResponseMock } from "../src/lib/api/generated/tasks/tasks.msw";
+import { GetTaskResponse } from "../src/lib/api/generated/tasks/tasks.zod";
+
+/**
+ * The app's generated client is a tolerant reader (api/README.md, Enums that grow): a newer server
+ * may answer with a field this app has never heard of, or a value it doesn't know in an enum the spec
+ * declares open, and neither may break a read. Each case is a real answer, the spec's own example as
+ * the generated mocks give it, with an unknown field added and an open enum given a value no release
+ * has sent, and it goes through the generated function the screens call and the generated contract
+ * schema the app's tests check answers with.
+ */
+
+const realFetch = globalThis.fetch;
+afterEach(() => {
+ globalThis.fetch = realFetch;
+});
+
+/** The server: answers `body` to the one address asked for. */
+function answer(address: string, body: unknown) {
+ globalThis.fetch = (async (input: Parameters[0]) => {
+ const url = new URL(String(input), "http://openbot.test");
+ return url.pathname === address
+ ? Response.json(body)
+ : Response.json({ detail: "Not found." }, { status: 404 });
+ }) as unknown as typeof fetch;
+}
+
+/** `body` with `value` at `path`, and a field no release has sent beside it and at the top. */
+function newer(body: T, path: (string | number)[], value: string): T {
+ const copy = structuredClone(body) as Record;
+ let at: Record = copy;
+ for (const key of path.slice(0, -1))
+ at = at[key] as Record;
+ at[path.at(-1) as string | number] = value;
+ at.addedLater = { by: "a newer server" };
+ copy.alsoAddedLater = true;
+ return copy as T;
+}
+
+const ORG = "/api/v2/organizations/default";
+
+const cases = [
+ {
+ name: "a task's status",
+ address: `${ORG}/tasks/t_1`,
+ body: newer(getGetTaskResponseMock(), ["task", "status"], "parked"),
+ read: () => getTask("default", "t_1"),
+ contract: GetTaskResponse,
+ value: (answer: unknown) =>
+ (answer as { task: { status: string } }).task.status,
+ },
+ {
+ name: "a person's role",
+ address: `${ORG}/people/me`,
+ body: newer(getGetPersonResponseMock(), ["person", "role"], "auditor"),
+ read: () => getPerson("default", "me"),
+ contract: GetPersonResponse,
+ value: (answer: unknown) =>
+ (answer as { person: { role: string } }).person.role,
+ },
+ {
+ name: "a network policy's scope",
+ address: `${ORG}/network-policies`,
+ body: newer(
+ getListNetworkPoliciesResponseMock(),
+ ["networkPolicies", 0, "scopeKind"],
+ "project",
+ ),
+ read: () => listNetworkPolicies("default"),
+ contract: ListNetworkPoliciesResponse,
+ value: (answer: unknown) =>
+ (answer as { networkPolicies: { scopeKind: string }[] })
+ .networkPolicies[0]?.scopeKind,
+ },
+ {
+ name: "a routine run's status",
+ address: `${ORG}/routines/r_1/runs`,
+ body: newer(
+ getListRoutineRunsResponseMock(),
+ ["runs", 0, "status"],
+ "cancelled",
+ ),
+ read: () => listRoutineRuns("default", "r_1"),
+ contract: ListRoutineRunsResponse,
+ value: (answer: unknown) =>
+ (answer as { runs: { status: string }[] }).runs[0]?.status,
+ },
+];
+
+describe.each(cases)(
+ "$name, from a newer server",
+ ({ address, body, read, contract, value }) => {
+ test("the generated function reads it, the new value and fields as sent", async () => {
+ answer(address, body);
+ const read_: unknown = await read();
+ expect(value(read_)).toBe(value(body));
+ expect((read_ as Record).alsoAddedLater).toBe(true);
+ });
+
+ test("the generated contract takes it, and drops only the fields it doesn't name", () => {
+ const parsed = contract.safeParse(body);
+ expect(parsed.error?.issues ?? []).toEqual([]);
+ expect(value(parsed.data)).toBe(value(body));
+ });
+ },
+);
diff --git a/app/tests/tool-line-wrap.test.tsx b/app/tests/tool-line-wrap.test.tsx
index e5bd11d7b2..c699491f8c 100644
--- a/app/tests/tool-line-wrap.test.tsx
+++ b/app/tests/tool-line-wrap.test.tsx
@@ -38,3 +38,45 @@ test("a long label wraps rather than running past the column, and the detail giv
cleanup();
}
});
+
+/**
+ * A refused or failed step's detail is the reason, and the reason has to be read in full. Cut off
+ * with an ellipsis, "budget.xlsx can't be sent. Bots c..." told the person on a phone neither why
+ * nor what a Bot can send, and every other refusal's reason was cut the same way. So on those rows
+ * the detail wraps, under the label when it does not fit beside it; every other row keeps its
+ * one-line rhythm, with the detail truncated as before.
+ */
+const REASON =
+ "budget.xlsx can't be sent. Bots can send images (PNG, JPEG, GIF, WebP), PDFs, and text, Markdown, CSV or JSON files.";
+
+test("a refused or failed step's reason wraps in full instead of being cut off", () => {
+ for (const state of [{ refused: true }, { failed: true }]) {
+ const view = render(
+ ,
+ );
+ const detail = view.getByText(REASON);
+ const classes = detail.className.split(/\s+/);
+ expect(classes).not.toContain("truncate");
+ expect(classes).toContain("min-w-0");
+ expect(classes).toContain("break-words");
+ // The row lets the reason move under the label when it does not fit beside it.
+ expect(
+ (detail.parentElement as HTMLElement).className.split(/\s+/),
+ ).toContain("flex-wrap");
+ cleanup();
+ }
+});
+
+test("a step that went through keeps its one line, with the detail truncated", () => {
+ const view = render();
+ const detail = view.getByText(REASON);
+ expect(detail.className.split(/\s+/)).toContain("truncate");
+ expect(
+ (detail.parentElement as HTMLElement).className.split(/\s+/),
+ ).not.toContain("flex-wrap");
+});
diff --git a/app/tests/transcript-attachments.test.tsx b/app/tests/transcript-attachments.test.tsx
index 4c1ee1c1b7..38177f6dd1 100644
--- a/app/tests/transcript-attachments.test.tsx
+++ b/app/tests/transcript-attachments.test.tsx
@@ -66,7 +66,7 @@ import { settleReactWork } from "./settle-react-work";
*/
let probeAnswer: () => Response | Promise = () =>
new Response(null, { status: 200 });
-let probes: { url: string; method?: string }[] = [];
+let probes: { url: string; method?: string; cache?: string }[] = [];
let realFetch: typeof fetch;
beforeAll(() => {
@@ -76,6 +76,7 @@ beforeAll(() => {
probes.push({
url: String(input),
...(init?.method ? { method: init.method } : {}),
+ ...(init?.cache ? { cache: init.cache } : {}),
});
return Promise.resolve().then(() => probeAnswer());
}) as typeof fetch;
@@ -180,8 +181,9 @@ test("an image attachment renders as an img carrying the attachment url", () =>
expect(url).toBe("/api/attachments/att-image");
});
-test("a broken image is replaced by a stated absence, not a broken-image glyph", () => {
- const { getByRole, getByText, queryByRole } = renderTranscript([
+test("a broken image whose file is gone is replaced by a stated absence, not a broken-image glyph", async () => {
+ probeAnswer = () => new Response(null, { status: 404 });
+ const { getByRole, findByText, queryByRole } = renderTranscript([
userMessage([imagePart(attachmentUrl("att-image"), "gone.png")]),
]);
@@ -190,8 +192,83 @@ test("a broken image is replaced by a stated absence, not a broken-image glyph",
// The