Skip to content

The agent that grows with you

Merge origin/main (#46: 38 commits to 63d0b941200) into feat/unified-gateway-runtime

Teknium954839a32760
diff --cc apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts
index 9a10b830b9a,16a8d9fba33..cabee7f3139
--- a/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts
+++ b/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.ts
@@@ -6,19 -6,18 +6,20 @@@ import { translateNow, useI18n } from '
import { isSlashCommandText } from '@/lib/chat-runtime'
import { isSideTaskSlashCommand } from '@/lib/desktop-slash-commands'
import { triggerHaptic } from '@/lib/haptics'
+import type { BusyInputMode } from '@/store/busy-input-mode'
- import { answerSetupCard, hasClarifyRequest, skipClarifyRequest } from '@/store/clarify'
+ import { hasClarifyRequest, skipClarifyRequest } from '@/store/clarify'
import {
clearSessionDraft,
type ComposerAttachment,
freezeComposerTransportPayload,
isFreshDraftScope
} from '@/store/composer'
+import { type ComposerDraftRetry, draftRetry } from '@/store/composer-draft-retry'
import { resetBrowseState } from '@/store/composer-input-history'
-import { enqueueQueuedPrompt, type QueuedPromptEntry } from '@/store/composer-queue'
+import { enqueueQueuedPrompt, type QueuedPromptEntry, serverOwnsComposerQueue } from '@/store/composer-queue'
import { hasConnectionRequest, skipConnectionRequest } from '@/store/connection-request'
import { notify } from '@/store/notifications'
+ import { answerParkedCard } from '@/store/parked-card-answers'
import { hasBlockingPromptRequest } from '@/store/prompts'
import { cloneAttachments, type QueueEditState } from '../composer-utils'
diff --cc apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/input-requests.ts
index c0cdfccef3c,ddc01daaa0c..00a87db4008
--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/input-requests.ts
+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/input-requests.ts
@@@ -41,47 -46,10 +46,51 @@@ const isConnectionRequestEvent = (event
const isConnectionUpdateEvent = (event: GatewayEvent): event is ConnectionUpdateEvent =>
event.type === 'connection.update' && event.payload !== undefined
+/** `approval.settled` / `clarify.settled {prompt_id}`: take down the card
+ * parked under that server request id. Returns false for other events. */
+function handlePromptSettledEvent(ctx: GatewayEventContext): boolean {
+ const { deps, event, payload, sessionId } = ctx
+
+ if (event.type !== 'approval.settled' && event.type !== 'clarify.settled') {
+ return false
+ }
+
+ const promptId = (payload as { prompt_id?: unknown } | undefined)?.prompt_id
+
+ if (typeof promptId !== 'string' || !promptId) {
+ return true
+ }
+
+ forgetServerRequest(promptId)
+ const key = sessionId ?? ''
+
+ if (event.type === 'clarify.settled') {
+ if ($clarifyRequests.get()[key]?.requestId === promptId) {
+ clearClarifyRequest(promptId, sessionId)
+
+ if (sessionId) {
+ deps.updateSessionState(sessionId, state => ({ ...state, needsInput: false }))
+ }
+ }
+
+ return true
+ }
+
+ const approval = sessionApprovalRequests(sessionId ?? null)
+ .get()
+ .find(request => request.serverRequestId === promptId)
+
+ if (approval) {
+ clearApprovalRequest(sessionId, approval.requestId)
+ }
+
+ return true
+}
+
+ // A display card has no targets to name.
+ const connectionRequestNoticeBody = (request: ConnectionRequest): string =>
+ request.targets.map(target => target.name).join(', ') || translateNow('connectors.title')
+
/** The blocking-input family arrives as server→client REQUESTS (see
* `server-requests.ts`); the one EVENT in the family is `request.cancel`, the
* backend withdrawing an open request (timeout / interrupt / session close):
diff --cc apps/desktop/src/app/session/hooks/use-session-actions/index.ts
index 1e208d4c8ec,32f42ef42fc..016e3d29b65
--- a/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
+++ b/apps/desktop/src/app/session/hooks/use-session-actions/index.ts
@@@ -170,14 -171,7 +164,14 @@@ import { rememberedOwnerForResume } fro
import { restorePendingApproval } from './restore-pending-approval'
import { pendingClarifyToolPayload, restorePendingClarifyFromSnapshot } from './restore-pending-clarify'
import { projectPendingConnection, restorePendingConnectionFromSnapshot } from './restore-pending-connection'
+import {
+ ambientResumeConnectionId,
+ openResumeGateway,
+ primaryResumeParams,
+ rememberResolvedResumeOwner,
+ resolveResumeOwner
+} from './resume-owner'
- import { createGatewaySession } from './session-create-request'
+ import { createGatewaySession, desktopSessionCreateParams } from './session-create-request'
import {
createPersistedDisplayTranscriptProvenance,
hasPersistedDisplayTranscriptProvenance,
diff --cc apps/desktop/src/components/assistant-ui/clarify/pending.tsx
index a5492b4df93,bc15ac6a9fb..2cee52752e7
--- a/apps/desktop/src/components/assistant-ui/clarify/pending.tsx
+++ b/apps/desktop/src/components/assistant-ui/clarify/pending.tsx
@@@ -77,24 -77,12 +77,28 @@@ export function ClarifyToolPending(
const [staged, setStaged] = useState<Record<string, { choices: string[]; draft: string }>>({})
const [submitting, setSubmitting] = useState(false)
+ // Locked answers (a reconnect replay, or text typed in the composer) stage
+ // their questions. A newly locked answer replaces what the card staged, so
+ // Confirm never re-sends an older pick; an answer seen before is left alone,
+ // so a later edit on the card stands.
+ const [seenLocks, setSeenLocks] = useState<Record<string, null | string>>({})
+
+ // A canonical gateway answers a batch one card at a time through the SAME
+ // mounted tool row: a new live request is a new card, so the previous card's
- // submit latch and staged picks must not carry over (that left question 2
- // disabled behind question 1's spinner).
++ // submit latch, staged picks and seen locks must not carry over (that left
++ // question 2 disabled behind question 1's spinner).
+ const [cardRequestId, setCardRequestId] = useState(request?.requestId)
+
+ if (request?.requestId !== cardRequestId) {
+ setCardRequestId(request?.requestId)
+
+ if (request?.requestId) {
+ setSubmitting(false)
+ setStaged({})
++ setSeenLocks({})
+ }
+ }
+
- // Reconnect replay: answers the server already locked (an earlier window's
- // partial progress) pre-stage their questions so the restored card shows
- // them selected instead of blank.
useEffect(() => {
const lockedAnswers = request?.lockedAnswers
diff --cc apps/desktop/src/i18n/ja.ts
index 74dd89e0aed,7f674f29793..aaa8753a225
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@@ -3,7 -3,7 +3,8 @@@ import { defineFieldCopy } from '@/app/
import { defineLocale, type TranslationOverrides } from './define-locale'
import { introJa } from './intro-ja'
import { jaAuxTasks } from './ja_aux_tasks'
+import { jaBoot } from './ja_boot'
+ import { jaConnectors } from './ja_connectors'
import { jaLocalModels } from './ja_local_models'
import { jaModelMenu } from './ja_model_menu'
import { jaNotices } from './ja_notices'
diff --cc apps/desktop/src/i18n/ru.ts
index 6e345df16d1,1ba1f257472..271fb94162b
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@@ -2,7 -2,7 +2,8 @@@ import { defineFieldCopy } from '@/app/
import { defineLocale, type TranslationOverrides } from './define-locale'
import { ruAuxTasks } from './ru_aux_tasks'
+import { ruBoot } from './ru_boot'
+ import { ruConnectors } from './ru_connectors'
import { ruModelMenu } from './ru_model_menu'
import { ruNotices } from './ru_notices'
import { ruOnboarding } from './ru_onboarding'
diff --cc apps/shared/src/gateway-contract.openrpc.json
index 0dc75e21030,8fa3884dd54..48e373f81a7
--- a/apps/shared/src/gateway-contract.openrpc.json
+++ b/apps/shared/src/gateway-contract.openrpc.json
@@@ -12377,23 -12160,12 +12377,41 @@@
}
],
"default": null,
- "title": "Scoped"
- },
- "gateway_running": {
+ "title": "Env"
+ }
+ },
+ "required": [
+ "name",
+ "status"
+ ],
+ "title": "ConnectionAnswerTarget",
+ "type": "object"
+ },
++ "ConnectionDisplay": {
++ "additionalProperties": false,
++ "description": "``manage_connections`` action ``display``: the directory card, with these slugs pinned as Suggested.",
++ "properties": {
++ "suggested": {
++ "items": {
++ "type": "string"
++ },
++ "title": "Suggested",
++ "type": "array"
++ }
++ },
++ "required": [
++ "suggested"
++ ],
++ "title": "ConnectionDisplay",
++ "type": "object"
++ },
+ "ConnectionOperationParams": {
+ "additionalProperties": false,
+ "properties": {
+ "profile": {
"anyOf": [
{
- "type": "boolean"
+ "type": "string"
},
{
"type": "null"
@@@ -12927,7 -12899,40 +12945,18 @@@
}
],
"default": null,
- "title": "Profile"
- },
- "viewer_id": {
- "title": "Viewer Id",
- "type": "string"
+ "title": "Tool Call Id"
+ },
- "reason": {
++ "display": {
+ "anyOf": [
+ {
- "type": "string"
++ "$ref": "#/components/schemas/ConnectionDisplay"
+ },
+ {
+ "type": "null"
+ }
+ ],
- "default": null,
- "title": "Reason"
- }
- },
- "required": [
- "viewer_id"
- ],
- "title": "DisplayLeaseAcquireParams",
- "type": "object"
- },
- "DisplayLeasePayload": {
- "additionalProperties": false,
- "properties": {
- "profile_key": {
- "title": "Profile Key",
- "type": "string"
- },
- "lease": {
- "$ref": "#/components/schemas/DisplayLease"
++ "default": null
}
},
"required": [