@xopcai/xopc 0.0.252 → 0.0.254
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/dist/background.js +59 -13
- package/dist/browser-ext/dist/content.js +0 -5
- package/dist/browser-ext/manifest.json +2 -1
- package/dist/extensions/telegram/src/inbound-processor.js +2 -2
- package/dist/extensions/telegram/src/plugin.js +3 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-w3eq3YpP.js → activity-store-Ci5Rxmi_.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-k039rbUz.js → agent-avatar-dicebear-D82jpmFL.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-vul32IsP.js +1 -0
- package/dist/gateway/static/root/assets/{agents-Bmth_bSQ.js → agents-p3kWyz1T.js} +1 -1
- package/dist/gateway/static/root/assets/{api-2joIfbrH.js → api-CXIzQJ2Z.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-ByJ4kiD0.js → app-management-settings-panel-mhxcQpkQ.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BK2Jga-B.js → appearance-settings-BIMwACUF.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-CJFJKNwS.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DMDKtYpi.js → archive-plugin-C63Xp_sU.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-B764Ql3Z.js → attachment-load-D12KYOav.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-D-sO8CZe.js → automations-page-DXj0o5CY.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-B2wxcpgq.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-fxtzYRpv.js → binary-plugins-Bcv8hun6.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Bcjtvckh.js → block-editor-C61LqK_-.js} +50 -50
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BSmnusjD.js → browser-automation-inputs-CAclu735.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-DC_OQIBk.js → browser-automations-page-BITfKX8L.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-BMjY8cyv.js +8 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-wB3Vgmp3.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-U5ffzu4r.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-BuWjIG_a.js → channels-status-swr-Cmbx0E8O.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-5SevEo_I.js → chat-terminal-dock-CNBgHN9U.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BGaF--m5.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-DtsfalBM.js → cron-expression-DCTN4QAG.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-tDEQV5TP.js → date-picker-BuEyUxZn.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-HhNwg0Y2.js → dependency-picker-l6IXzk0C.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-acU4Li-C.js → desktop-pet-cGn_20DO.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-R84AR0Pe.js → desktop-pet-settings-DIfccDKS.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CrLlRkSN.js → extension-debug-page-CTS5RP_D.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BH5lmZXE.js → extension-page-Dg9YssYH.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BscjNAd1.js → extension-settings-page-CWZYL8Fi.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-9HidFZUd.js → gateway-config-swr-Chsr5wGH.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-vHI_Que8.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DRCPXONr.js → gateway-startup-retry-C9ynH6VV.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-K5Zhl2rx.js → heartbeat-settings-WUhSfvob.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-CYjlMzPx.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-CR6Kle8H.js → image-generation-api-D_TsVe7h.js} +1 -1
- package/dist/gateway/static/root/assets/index-BBlJYVxR.js +74 -0
- package/dist/gateway/static/root/assets/index-_I0dD2LN.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B1QR49-7.js → keyboard-shortcuts-settings-DGBf6YfD.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CLlIl83V.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-C74It-T8.js → local-apps-page-DGWP_xsQ.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BfZGZKSs.js → locale-store-B2v8mNJw.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DuhCigiB.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-1kNnYL97.js → management-settings-DUAZ-dtt.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-DBWu9d_n.js +201 -0
- package/dist/gateway/static/root/assets/{media-plugins-B5c0AoS1.js → media-plugins-CsUjcIBy.js} +1 -1
- package/dist/gateway/static/root/assets/messages-ChSTFZR5.js +3 -0
- package/dist/gateway/static/root/assets/{mobile-pairing-wizard-CsIZqK51.js → mobile-pairing-wizard-Dxu8twiQ.js} +1 -1
- package/dist/gateway/static/root/assets/note-detail-panel-DMdbaTZp.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-xe_vX0nM.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-CqJN6Ljz.js → page-tabs-YeJKwV-7.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DqRIGxf4.js → preview-open-alternatives-BfJ3jMDG.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DE2nPE_K.js → product-open-page-B7NRGPox.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-hG7ELibZ.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-C5G2ET4w.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-Bpy8XX-5.js → registry-api-B9OZUdwC.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Dnd73xWt.js → remote-access-hub-DTO-faxH.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bb4b74-P.js → runtime-tools-settings-panel-uJ8Br3ZL.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DoPU5j3J.js → schema-form-CXwn6up5.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CwzsUCgP.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-Djc3EdoO.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Ci-9WajJ.js → settings-form-section-YVNYsR0U.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CL_2F95D.js → settings-page-cHqrIdVR.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-MUAMcZLD.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-XUA3oKQX.js → share-preview-page-DnjSDQru.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-C7A0aywX.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-D1xSGJAQ.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-sXXAZDc9.js → skills-page-DkrGEdiY.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-DD79Bl1I.js → skills-page.utils-CqZbiZuK.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BEH64qBV.js → system-settings-panel-Dmw0RfxZ.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-BvZSCLUH.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-CISSxU1c.js → theme-store-CubltMKm.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-DrKDhnJm.js → tunnel-api-CiieC6HP.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CPYePL-Q.js → use-autosave-XQ3SuyB9.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-BKJC7tyW.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DKqzrCXx.js → voice-api-key-field-D4QzVgdt.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-e9xWjwBX.js → voice-config-api-B1ZbyVmF.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-kTQug6bq.js → work-discovery-overlay-D5Tf8GRZ.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-m9SKj_GT.js → workflow-run-setup-panel-BW9p8Maz.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DuqRodIc.js +5 -0
- package/dist/gateway/static/root/index.html +10 -10
- package/dist/package.js +1 -1
- package/dist/packages/realtime-protocol/src/voice.js +6 -1
- package/dist/src/agent/agent-manager.js +24 -7
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/execution-context.d.ts +2 -1
- package/dist/src/agent/embedded/execution-context.js +10 -4
- package/dist/src/agent/embedded/index.d.ts +1 -1
- package/dist/src/agent/embedded/index.js +2 -2
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +5 -4
- package/dist/src/agent/embedded/run-turn.js +22 -3
- package/dist/src/agent/embedded/types.d.ts +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +6 -3
- package/dist/src/agent/service/process-direct-streaming.js +6 -3
- package/dist/src/agent/service.d.ts +2 -0
- package/dist/src/agent/service.js +23 -9
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +17 -2
- package/dist/src/agent/tools/browser/tool/schemas.d.ts +85 -1
- package/dist/src/agent/tools/browser/tool/schemas.js +212 -5
- package/dist/src/agent/tools/clarify-tool.d.ts +17 -3
- package/dist/src/agent/tools/clarify-tool.js +27 -32
- package/dist/src/agent/tools/cli-clarify.js +23 -8
- package/dist/src/agent/tools/factory.js +14 -4
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/automations/domain/validation.d.ts +4 -4
- package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
- package/dist/src/browser/drivers/extension-driver.d.ts +4 -4
- package/dist/src/browser/drivers/extension-driver.js +20 -8
- package/dist/src/browser/drivers/playwright-driver.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.d.ts +3 -0
- package/dist/src/browser/providers/browser-ext-install.js +19 -4
- package/dist/src/browser/providers/extension.d.ts +14 -1
- package/dist/src/browser/providers/extension.js +89 -11
- package/dist/src/browser/providers/playwright-install.js +8 -12
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +5 -1
- package/dist/src/gateway/chat-stream/protocol.d.ts +5 -1
- package/dist/src/gateway/clarify-runtime.d.ts +7 -5
- package/dist/src/gateway/clarify-runtime.js +8 -11
- package/dist/src/gateway/ephemeral-clarification-waiter.d.ts +17 -0
- package/dist/src/gateway/ephemeral-clarification-waiter.js +46 -0
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +44 -18
- package/dist/src/gateway/hono/routes/browser.js +149 -27
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +10 -2
- package/dist/src/gateway/hono/routes/side-chats.js +24 -4
- package/dist/src/gateway/security/gateway-scopes.js +1 -1
- package/dist/src/gateway/service/agent-runner.d.ts +25 -36
- package/dist/src/gateway/service/agent-runner.js +103 -32
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +5 -2
- package/dist/src/gateway/service/session-input-coordinator.js +4 -1
- package/dist/src/gateway/service/sessions-api.js +1 -1
- package/dist/src/gateway/service.d.ts +4 -2
- package/dist/src/gateway/service.js +36 -20
- package/dist/src/gateway/side-chat/manager.d.ts +2 -1
- package/dist/src/gateway/side-chat/manager.js +5 -4
- package/dist/src/gateway/side-chat/run-service.d.ts +5 -1
- package/dist/src/gateway/side-chat/run-service.js +24 -23
- package/dist/src/gateway/side-chat/types.d.ts +3 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/model-thinking.js +57 -20
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/storage/sqlite/clarification-wait-repository.d.ts +41 -0
- package/dist/src/storage/sqlite/clarification-wait-repository.js +418 -0
- package/dist/src/storage/sqlite/index.d.ts +2 -1
- package/dist/src/storage/sqlite/index.js +2 -1
- package/dist/src/storage/sqlite/migrations/154_session_clarification_waits.sql +60 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +11 -6
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/voice/realtime/agentEngine.js +7 -2
- package/dist/src/voice/realtime/runtime.types.d.ts +5 -0
- package/dist/src/work-discovery/service.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +3 -3
- package/skills/creative/hatch-pet/SKILL.md +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D4J4oq8p.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-B3ky7cWU.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-Ds5-_-9z.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-C1FojyG6.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Bs59UCut.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-CM9vNmoo.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BPZ44D-V.js +0 -2
- package/dist/gateway/static/root/assets/gateway-settings-BxLcW6ij.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CZAg9RBv.js +0 -1
- package/dist/gateway/static/root/assets/index-D4Ykja-U.js +0 -72
- package/dist/gateway/static/root/assets/index-zIJ3AXgR.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-wicoV-ti.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-xX-7S49A.js +0 -2
- package/dist/gateway/static/root/assets/markdown-view-DjiwT28p.js +0 -201
- package/dist/gateway/static/root/assets/messages-DaIwVWar.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-CfWxopl4.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-CYN-LCHJ.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-B5G3LzDq.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CuVK2mKu.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-XL4LyKZe.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-0ForzDSS.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DVws6XZc.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BwDvcacF.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BJjrATqE.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-0jxMi75O.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-B6zLDfDl.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-Bcd1XqP7.js +0 -5
- package/dist/src/gateway/clarify-bridge.d.ts +0 -46
- package/dist/src/gateway/clarify-bridge.js +0 -111
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { BrowserActionInput } from '@xopcai/browser-control-contract';
|
|
1
2
|
import { type Static } from '@sinclair/typebox';
|
|
2
|
-
export declare const
|
|
3
|
+
export declare const BrowserUseActionSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
3
4
|
action: import("@sinclair/typebox").TLiteral<"observe">;
|
|
4
5
|
sessionId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
5
6
|
approvalId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -200,4 +201,87 @@ export declare const BrowserUseSchema: import("@sinclair/typebox").TUnion<[impor
|
|
|
200
201
|
sessionId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
201
202
|
approvalId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
202
203
|
}>]>;
|
|
204
|
+
export declare const BrowserUseSchema: import("@sinclair/typebox").TObject<{
|
|
205
|
+
action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"observe">, import("@sinclair/typebox").TLiteral<"navigate">, import("@sinclair/typebox").TLiteral<"click">, import("@sinclair/typebox").TLiteral<"fill">, import("@sinclair/typebox").TLiteral<"select">, import("@sinclair/typebox").TLiteral<"press">, import("@sinclair/typebox").TLiteral<"scroll">, import("@sinclair/typebox").TLiteral<"wait">, import("@sinclair/typebox").TLiteral<"upload">, import("@sinclair/typebox").TLiteral<"tabs">, import("@sinclair/typebox").TLiteral<"sequence">, import("@sinclair/typebox").TLiteral<"close">]>;
|
|
206
|
+
sessionId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
207
|
+
approvalId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
208
|
+
revision: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
209
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
210
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
211
|
+
urlIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
212
|
+
titleIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
213
|
+
textIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
214
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
215
|
+
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>>;
|
|
216
|
+
}>>;
|
|
217
|
+
visual: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"never">, import("@sinclair/typebox").TLiteral<"auto">, import("@sinclair/typebox").TLiteral<"always">]>>;
|
|
218
|
+
url: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
219
|
+
value: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
220
|
+
submit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
221
|
+
key: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
222
|
+
deltaY: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
223
|
+
condition: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"page_idle">, import("@sinclair/typebox").TLiteral<"text">, import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>>;
|
|
224
|
+
timeoutMs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
225
|
+
paths: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
226
|
+
operation: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"list">, import("@sinclair/typebox").TLiteral<"create">, import("@sinclair/typebox").TLiteral<"activate">, import("@sinclair/typebox").TLiteral<"close">]>>;
|
|
227
|
+
tabId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
228
|
+
steps: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
229
|
+
action: import("@sinclair/typebox").TLiteral<"click">;
|
|
230
|
+
ref: import("@sinclair/typebox").TString;
|
|
231
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
232
|
+
urlIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
233
|
+
titleIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
234
|
+
textIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
235
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
236
|
+
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>>;
|
|
237
|
+
}>>;
|
|
238
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
239
|
+
action: import("@sinclair/typebox").TLiteral<"fill">;
|
|
240
|
+
ref: import("@sinclair/typebox").TString;
|
|
241
|
+
value: import("@sinclair/typebox").TString;
|
|
242
|
+
submit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
243
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
244
|
+
urlIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
245
|
+
titleIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
246
|
+
textIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
247
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
248
|
+
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>>;
|
|
249
|
+
}>>;
|
|
250
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
251
|
+
action: import("@sinclair/typebox").TLiteral<"select">;
|
|
252
|
+
ref: import("@sinclair/typebox").TString;
|
|
253
|
+
value: import("@sinclair/typebox").TString;
|
|
254
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
255
|
+
urlIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
256
|
+
titleIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
257
|
+
textIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
258
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
259
|
+
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>>;
|
|
260
|
+
}>>;
|
|
261
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
262
|
+
action: import("@sinclair/typebox").TLiteral<"press">;
|
|
263
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
264
|
+
key: import("@sinclair/typebox").TString;
|
|
265
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
266
|
+
urlIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
267
|
+
titleIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
268
|
+
textIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
269
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
270
|
+
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>>;
|
|
271
|
+
}>>;
|
|
272
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
273
|
+
action: import("@sinclair/typebox").TLiteral<"scroll">;
|
|
274
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
275
|
+
deltaY: import("@sinclair/typebox").TNumber;
|
|
276
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
277
|
+
urlIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
278
|
+
titleIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
279
|
+
textIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
280
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
281
|
+
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>>;
|
|
282
|
+
}>>;
|
|
283
|
+
}>]>>>;
|
|
284
|
+
}>;
|
|
203
285
|
export type BrowserUseInput = Static<typeof BrowserUseSchema>;
|
|
286
|
+
/** Decode the provider-facing superset into one exact Browser Control action. */
|
|
287
|
+
export declare function decodeBrowserUseInput(value: unknown): BrowserActionInput | null;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { Value } from "@sinclair/typebox/value";
|
|
2
3
|
//#region src/agent/tools/browser/tool/schemas.ts
|
|
3
4
|
const ApprovalId = Type.Optional(Type.String({ description: "One-time local-owner approval id for this exact action." }));
|
|
4
5
|
const SessionId = Type.Optional(Type.String({ description: "Browser session id returned by the previous observation." }));
|
|
5
6
|
const Revision = Type.Number({ description: "Observation revision used to resolve element refs." });
|
|
6
|
-
const Ref = Type.String({
|
|
7
|
-
|
|
7
|
+
const Ref = Type.String({
|
|
8
|
+
minLength: 1,
|
|
9
|
+
description: "Ephemeral element ref from the latest observation."
|
|
10
|
+
});
|
|
11
|
+
const ExpectationSchema = Type.Object({
|
|
8
12
|
urlIncludes: Type.Optional(Type.String()),
|
|
9
13
|
titleIncludes: Type.Optional(Type.String()),
|
|
10
14
|
textIncludes: Type.Optional(Type.String()),
|
|
11
15
|
ref: Type.Optional(Type.String()),
|
|
12
16
|
state: Type.Optional(Type.Union([Type.Literal("visible"), Type.Literal("hidden")]))
|
|
13
|
-
}, { additionalProperties: false })
|
|
17
|
+
}, { additionalProperties: false });
|
|
18
|
+
const Expectation = Type.Optional(ExpectationSchema);
|
|
14
19
|
function action(name, properties) {
|
|
15
20
|
return Type.Object({
|
|
16
21
|
action: Type.Literal(name),
|
|
@@ -133,7 +138,7 @@ const Sequence = action("sequence", {
|
|
|
133
138
|
expect: Expectation
|
|
134
139
|
});
|
|
135
140
|
const Close = action("close", {});
|
|
136
|
-
const
|
|
141
|
+
const BrowserUseActionSchema = Type.Union([
|
|
137
142
|
Observe,
|
|
138
143
|
Navigate,
|
|
139
144
|
Click,
|
|
@@ -147,5 +152,207 @@ const BrowserUseSchema = Type.Union([
|
|
|
147
152
|
Sequence,
|
|
148
153
|
Close
|
|
149
154
|
]);
|
|
155
|
+
const BrowserUseSchema = Type.Object({
|
|
156
|
+
action: Type.Union([
|
|
157
|
+
Type.Literal("observe"),
|
|
158
|
+
Type.Literal("navigate"),
|
|
159
|
+
Type.Literal("click"),
|
|
160
|
+
Type.Literal("fill"),
|
|
161
|
+
Type.Literal("select"),
|
|
162
|
+
Type.Literal("press"),
|
|
163
|
+
Type.Literal("scroll"),
|
|
164
|
+
Type.Literal("wait"),
|
|
165
|
+
Type.Literal("upload"),
|
|
166
|
+
Type.Literal("tabs"),
|
|
167
|
+
Type.Literal("sequence"),
|
|
168
|
+
Type.Literal("close")
|
|
169
|
+
]),
|
|
170
|
+
sessionId: SessionId,
|
|
171
|
+
approvalId: ApprovalId,
|
|
172
|
+
revision: Type.Optional(Revision),
|
|
173
|
+
ref: Type.Optional(Ref),
|
|
174
|
+
expect: Type.Optional(ExpectationSchema),
|
|
175
|
+
visual: Type.Optional(Type.Union([
|
|
176
|
+
Type.Literal("never"),
|
|
177
|
+
Type.Literal("auto"),
|
|
178
|
+
Type.Literal("always")
|
|
179
|
+
])),
|
|
180
|
+
url: Type.Optional(Type.String({ minLength: 1 })),
|
|
181
|
+
value: Type.Optional(Type.String()),
|
|
182
|
+
submit: Type.Optional(Type.Boolean()),
|
|
183
|
+
key: Type.Optional(Type.String({ minLength: 1 })),
|
|
184
|
+
deltaY: Type.Optional(Type.Number()),
|
|
185
|
+
condition: Type.Optional(Type.Union([
|
|
186
|
+
Type.Literal("page_idle"),
|
|
187
|
+
Type.Literal("text"),
|
|
188
|
+
Type.Literal("visible"),
|
|
189
|
+
Type.Literal("hidden")
|
|
190
|
+
])),
|
|
191
|
+
timeoutMs: Type.Optional(Type.Number({
|
|
192
|
+
minimum: 100,
|
|
193
|
+
maximum: 12e4
|
|
194
|
+
})),
|
|
195
|
+
paths: Type.Optional(Type.Array(Type.String({ minLength: 1 }), {
|
|
196
|
+
minItems: 1,
|
|
197
|
+
maxItems: 20
|
|
198
|
+
})),
|
|
199
|
+
operation: Type.Optional(Type.Union([
|
|
200
|
+
Type.Literal("list"),
|
|
201
|
+
Type.Literal("create"),
|
|
202
|
+
Type.Literal("activate"),
|
|
203
|
+
Type.Literal("close")
|
|
204
|
+
])),
|
|
205
|
+
tabId: Type.Optional(Type.String()),
|
|
206
|
+
steps: Type.Optional(Type.Array(SequenceStep, {
|
|
207
|
+
minItems: 1,
|
|
208
|
+
maxItems: 10
|
|
209
|
+
}))
|
|
210
|
+
}, { additionalProperties: false });
|
|
211
|
+
const ACTION_FIELDS = {
|
|
212
|
+
observe: ["visual"],
|
|
213
|
+
navigate: ["url", "expect"],
|
|
214
|
+
click: [
|
|
215
|
+
"revision",
|
|
216
|
+
"ref",
|
|
217
|
+
"expect"
|
|
218
|
+
],
|
|
219
|
+
fill: [
|
|
220
|
+
"revision",
|
|
221
|
+
"ref",
|
|
222
|
+
"value",
|
|
223
|
+
"submit",
|
|
224
|
+
"expect"
|
|
225
|
+
],
|
|
226
|
+
select: [
|
|
227
|
+
"revision",
|
|
228
|
+
"ref",
|
|
229
|
+
"value",
|
|
230
|
+
"expect"
|
|
231
|
+
],
|
|
232
|
+
press: [
|
|
233
|
+
"revision",
|
|
234
|
+
"ref",
|
|
235
|
+
"key",
|
|
236
|
+
"expect"
|
|
237
|
+
],
|
|
238
|
+
scroll: [
|
|
239
|
+
"revision",
|
|
240
|
+
"ref",
|
|
241
|
+
"deltaY",
|
|
242
|
+
"expect"
|
|
243
|
+
],
|
|
244
|
+
wait: [
|
|
245
|
+
"revision",
|
|
246
|
+
"condition",
|
|
247
|
+
"value",
|
|
248
|
+
"ref",
|
|
249
|
+
"timeoutMs"
|
|
250
|
+
],
|
|
251
|
+
upload: [
|
|
252
|
+
"revision",
|
|
253
|
+
"ref",
|
|
254
|
+
"paths",
|
|
255
|
+
"expect"
|
|
256
|
+
],
|
|
257
|
+
tabs: [
|
|
258
|
+
"operation",
|
|
259
|
+
"tabId",
|
|
260
|
+
"url"
|
|
261
|
+
],
|
|
262
|
+
sequence: [
|
|
263
|
+
"revision",
|
|
264
|
+
"steps",
|
|
265
|
+
"expect"
|
|
266
|
+
],
|
|
267
|
+
close: []
|
|
268
|
+
};
|
|
269
|
+
const SEQUENCE_STEP_FIELDS = {
|
|
270
|
+
click: ["ref", "expect"],
|
|
271
|
+
fill: [
|
|
272
|
+
"ref",
|
|
273
|
+
"value",
|
|
274
|
+
"submit",
|
|
275
|
+
"expect"
|
|
276
|
+
],
|
|
277
|
+
select: [
|
|
278
|
+
"ref",
|
|
279
|
+
"value",
|
|
280
|
+
"expect"
|
|
281
|
+
],
|
|
282
|
+
press: [
|
|
283
|
+
"ref",
|
|
284
|
+
"key",
|
|
285
|
+
"expect"
|
|
286
|
+
],
|
|
287
|
+
scroll: [
|
|
288
|
+
"ref",
|
|
289
|
+
"deltaY",
|
|
290
|
+
"expect"
|
|
291
|
+
]
|
|
292
|
+
};
|
|
293
|
+
/** Decode the provider-facing superset into one exact Browser Control action. */
|
|
294
|
+
function decodeBrowserUseInput(value) {
|
|
295
|
+
if (!isRecord(value) || !isBrowserActionName(value.action)) return null;
|
|
296
|
+
const candidate = { action: value.action };
|
|
297
|
+
copyNonEmptyString(value, candidate, "sessionId");
|
|
298
|
+
copyNonEmptyString(value, candidate, "approvalId");
|
|
299
|
+
for (const field of ACTION_FIELDS[value.action]) {
|
|
300
|
+
const fieldValue = value[field];
|
|
301
|
+
if (fieldValue === void 0 || fieldValue === null) continue;
|
|
302
|
+
if (field === "expect") {
|
|
303
|
+
const expectation = decodeExpectation(fieldValue);
|
|
304
|
+
if (expectation) candidate.expect = expectation;
|
|
305
|
+
} else if (field === "steps") {
|
|
306
|
+
if (!Array.isArray(fieldValue)) {
|
|
307
|
+
candidate.steps = fieldValue;
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
const steps = fieldValue.map(decodeSequenceStep);
|
|
311
|
+
if (steps.some((step) => step === null)) return null;
|
|
312
|
+
candidate.steps = steps;
|
|
313
|
+
} else if ((field === "ref" || field === "tabId" || field === "url") && fieldValue === "") continue;
|
|
314
|
+
else candidate[field] = fieldValue;
|
|
315
|
+
}
|
|
316
|
+
return Value.Check(BrowserUseActionSchema, candidate) ? candidate : null;
|
|
317
|
+
}
|
|
318
|
+
function decodeSequenceStep(value) {
|
|
319
|
+
if (!isRecord(value) || !isSequenceActionName(value.action)) return null;
|
|
320
|
+
const candidate = { action: value.action };
|
|
321
|
+
for (const field of SEQUENCE_STEP_FIELDS[value.action]) {
|
|
322
|
+
const fieldValue = value[field];
|
|
323
|
+
if (fieldValue === void 0 || fieldValue === null) continue;
|
|
324
|
+
if (field === "expect") {
|
|
325
|
+
const expectation = decodeExpectation(fieldValue);
|
|
326
|
+
if (expectation) candidate.expect = expectation;
|
|
327
|
+
} else if (field === "ref" && fieldValue === "") continue;
|
|
328
|
+
else candidate[field] = fieldValue;
|
|
329
|
+
}
|
|
330
|
+
return candidate;
|
|
331
|
+
}
|
|
332
|
+
function decodeExpectation(value) {
|
|
333
|
+
if (!isRecord(value)) return null;
|
|
334
|
+
const expectation = {};
|
|
335
|
+
for (const field of [
|
|
336
|
+
"urlIncludes",
|
|
337
|
+
"titleIncludes",
|
|
338
|
+
"textIncludes",
|
|
339
|
+
"ref"
|
|
340
|
+
]) copyNonEmptyString(value, expectation, field);
|
|
341
|
+
if (expectation.ref && (value.state === "visible" || value.state === "hidden")) expectation.state = value.state;
|
|
342
|
+
return Object.keys(expectation).length > 0 ? expectation : null;
|
|
343
|
+
}
|
|
344
|
+
function copyNonEmptyString(source, target, field) {
|
|
345
|
+
const value = source[field];
|
|
346
|
+
if (typeof value === "string" && value.length > 0) target[field] = value;
|
|
347
|
+
}
|
|
348
|
+
function isBrowserActionName(value) {
|
|
349
|
+
return typeof value === "string" && Object.hasOwn(ACTION_FIELDS, value);
|
|
350
|
+
}
|
|
351
|
+
function isSequenceActionName(value) {
|
|
352
|
+
return typeof value === "string" && Object.hasOwn(SEQUENCE_STEP_FIELDS, value);
|
|
353
|
+
}
|
|
354
|
+
function isRecord(value) {
|
|
355
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
356
|
+
}
|
|
150
357
|
//#endregion
|
|
151
|
-
export { BrowserUseSchema };
|
|
358
|
+
export { BrowserUseActionSchema, BrowserUseSchema, decodeBrowserUseInput };
|
|
@@ -3,11 +3,25 @@ export type ClarifyRequestPayload = {
|
|
|
3
3
|
kind?: 'approval';
|
|
4
4
|
question: string;
|
|
5
5
|
choices?: string[];
|
|
6
|
-
|
|
6
|
+
suggestedAnswer?: string;
|
|
7
|
+
/** Stable hash of the exact operation guarded by an approval. */
|
|
8
|
+
approvalKey?: string;
|
|
7
9
|
};
|
|
8
|
-
export type
|
|
10
|
+
export type ClarifyRequestResult = {
|
|
11
|
+
status: 'answered';
|
|
12
|
+
answer: string;
|
|
13
|
+
} | {
|
|
14
|
+
status: 'waiting';
|
|
15
|
+
waitId: string;
|
|
16
|
+
expiresAt?: number;
|
|
17
|
+
};
|
|
18
|
+
export type GatewayClarifyRequestFn = (context: {
|
|
19
|
+
sessionKey: string;
|
|
20
|
+
runId: string;
|
|
21
|
+
toolCallId: string;
|
|
22
|
+
}, request: ClarifyRequestPayload) => Promise<ClarifyRequestResult>;
|
|
9
23
|
export interface ClarifyToolDeps {
|
|
10
24
|
/** Resolve a per-turn callback; returns null when clarification is unavailable. */
|
|
11
|
-
resolveAskUser: () => ((request: ClarifyRequestPayload) => Promise<
|
|
25
|
+
resolveAskUser: (toolCallId: string) => ((request: ClarifyRequestPayload) => Promise<ClarifyRequestResult>) | null;
|
|
12
26
|
}
|
|
13
27
|
export declare function createClarifyTool(deps: ClarifyToolDeps): AgentTool;
|
|
@@ -7,7 +7,7 @@ const ClarifySchema = Type.Object({
|
|
|
7
7
|
minItems: 2,
|
|
8
8
|
maxItems: 10
|
|
9
9
|
})),
|
|
10
|
-
|
|
10
|
+
suggestedAnswer: Type.Optional(Type.String({ description: "Optional recommendation shown to the user. It is never selected automatically." }))
|
|
11
11
|
});
|
|
12
12
|
function waitForAbort(signal) {
|
|
13
13
|
return new Promise((_, reject) => {
|
|
@@ -23,40 +23,42 @@ function createClarifyTool(deps) {
|
|
|
23
23
|
return {
|
|
24
24
|
name: "clarify",
|
|
25
25
|
label: "❓ Clarify",
|
|
26
|
-
description: "Ask the user a clarifying question and
|
|
26
|
+
description: "Ask the user a clarifying question and pause the objective until they respond.\n\nUse this when you need more information to proceed correctly, rather than guessing.\n\nWHEN TO USE:\n- Ambiguous instructions with multiple valid interpretations\n- Missing critical information (which file, which approach, etc.)\n- Confirming destructive or irreversible actions\n\nWHEN NOT TO USE:\n- When you can reasonably infer the answer from context\n- For trivial decisions that do not affect the task\n- When the user explicitly said \"just do it\" or \"your choice\"\n\nTIPS:\n- Provide choices when there are clear options (faster for the user)\n- Keep questions short and specific\n- Include a suggested answer when one option is clearly more likely",
|
|
27
27
|
parameters: ClarifySchema,
|
|
28
|
-
async execute(
|
|
28
|
+
async execute(toolCallId, params, signal) {
|
|
29
29
|
const p = params;
|
|
30
|
-
const askUser = deps.resolveAskUser();
|
|
31
|
-
if (!askUser) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
39
|
-
return {
|
|
40
|
-
content: [{
|
|
41
|
-
type: "text",
|
|
42
|
-
text: "Clarification is not available in this environment (no active webchat run). Provide a default or proceed with the best assumption."
|
|
43
|
-
}],
|
|
44
|
-
details: { answer: "" }
|
|
45
|
-
};
|
|
46
|
-
}
|
|
30
|
+
const askUser = deps.resolveAskUser(toolCallId);
|
|
31
|
+
if (!askUser) return {
|
|
32
|
+
content: [{
|
|
33
|
+
type: "text",
|
|
34
|
+
text: "Clarification is not available in this environment. Proceed with the best safe assumption or explain what is missing."
|
|
35
|
+
}],
|
|
36
|
+
details: { answer: "" }
|
|
37
|
+
};
|
|
47
38
|
const payload = {
|
|
48
39
|
question: p.question,
|
|
49
40
|
choices: p.choices,
|
|
50
|
-
|
|
41
|
+
suggestedAnswer: p.suggestedAnswer
|
|
51
42
|
};
|
|
52
43
|
try {
|
|
53
|
-
const
|
|
44
|
+
const result = await Promise.race([askUser(payload), waitForAbort(signal)]);
|
|
45
|
+
if (result.status === "waiting") return {
|
|
46
|
+
content: [{
|
|
47
|
+
type: "text",
|
|
48
|
+
text: "Waiting for the user to answer this clarification. End the current run now."
|
|
49
|
+
}],
|
|
50
|
+
details: {
|
|
51
|
+
answer: "",
|
|
52
|
+
waitId: result.waitId,
|
|
53
|
+
status: result.status
|
|
54
|
+
}
|
|
55
|
+
};
|
|
54
56
|
return {
|
|
55
57
|
content: [{
|
|
56
58
|
type: "text",
|
|
57
|
-
text: `User answered: ${answer}`
|
|
59
|
+
text: `User answered: ${result.answer}`
|
|
58
60
|
}],
|
|
59
|
-
details: { answer }
|
|
61
|
+
details: { answer: result.answer }
|
|
60
62
|
};
|
|
61
63
|
} catch (error) {
|
|
62
64
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -65,14 +67,7 @@ function createClarifyTool(deps) {
|
|
|
65
67
|
type: "text",
|
|
66
68
|
text: "Clarification cancelled (run aborted)."
|
|
67
69
|
}],
|
|
68
|
-
details: { answer:
|
|
69
|
-
};
|
|
70
|
-
if (p.default !== void 0 && p.default !== "" && message.toLowerCase().includes("timeout")) return {
|
|
71
|
-
content: [{
|
|
72
|
-
type: "text",
|
|
73
|
-
text: `User did not respond in time. Using default: ${p.default}`
|
|
74
|
-
}],
|
|
75
|
-
details: { answer: p.default }
|
|
70
|
+
details: { answer: "" }
|
|
76
71
|
};
|
|
77
72
|
return {
|
|
78
73
|
content: [{
|
|
@@ -5,7 +5,7 @@ import * as readline from "node:readline/promises";
|
|
|
5
5
|
* stdin/stdout prompts for `clarify` when running the CLI agent (no gateway).
|
|
6
6
|
*/
|
|
7
7
|
function createCliReadlineClarifyRequestFn() {
|
|
8
|
-
return async (
|
|
8
|
+
return async (_context, req) => {
|
|
9
9
|
const rl = readline.createInterface({
|
|
10
10
|
input: stdin,
|
|
11
11
|
output: stdout
|
|
@@ -15,19 +15,34 @@ function createCliReadlineClarifyRequestFn() {
|
|
|
15
15
|
if (choices && choices.length >= 2) {
|
|
16
16
|
stdout.write(`\n${req.question}\n`);
|
|
17
17
|
choices.forEach((c, i) => stdout.write(` ${i + 1}) ${c}\n`));
|
|
18
|
-
if (req.
|
|
18
|
+
if (req.suggestedAnswer) stdout.write(` (recommended: ${req.suggestedAnswer})\n`);
|
|
19
19
|
const raw = (await rl.question("Choice (number or exact text): ")).trim();
|
|
20
20
|
const n = parseInt(raw, 10);
|
|
21
|
-
if (!Number.isNaN(n) && n >= 1 && n <= choices.length) return
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if (!Number.isNaN(n) && n >= 1 && n <= choices.length) return {
|
|
22
|
+
status: "answered",
|
|
23
|
+
answer: choices[n - 1]
|
|
24
|
+
};
|
|
25
|
+
if (raw) return {
|
|
26
|
+
status: "answered",
|
|
27
|
+
answer: raw
|
|
28
|
+
};
|
|
29
|
+
if (req.suggestedAnswer) return {
|
|
30
|
+
status: "answered",
|
|
31
|
+
answer: req.suggestedAnswer
|
|
32
|
+
};
|
|
24
33
|
throw new Error("No answer provided");
|
|
25
34
|
}
|
|
26
35
|
stdout.write(`\n${req.question}\n`);
|
|
27
|
-
if (req.
|
|
36
|
+
if (req.suggestedAnswer) stdout.write(`(Press Enter for recommendation: ${req.suggestedAnswer})\n`);
|
|
28
37
|
const raw = (await rl.question("> ")).trim();
|
|
29
|
-
if (raw) return
|
|
30
|
-
|
|
38
|
+
if (raw) return {
|
|
39
|
+
status: "answered",
|
|
40
|
+
answer: raw
|
|
41
|
+
};
|
|
42
|
+
if (req.suggestedAnswer) return {
|
|
43
|
+
status: "answered",
|
|
44
|
+
answer: req.suggestedAnswer
|
|
45
|
+
};
|
|
31
46
|
throw new Error("No answer provided");
|
|
32
47
|
} finally {
|
|
33
48
|
rl.close();
|
|
@@ -7,7 +7,7 @@ import { getSessionTaskPlan, setSessionTaskPlan } from "../../storage/sqlite/ses
|
|
|
7
7
|
import "../../storage/sqlite/index.js";
|
|
8
8
|
import { init_agent_scope, resolveDefaultAgentId } from "../agent-scope.js";
|
|
9
9
|
import { resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
|
|
10
|
-
import { getEmbeddedExecutionSession } from "../embedded/execution-context.js";
|
|
10
|
+
import { getEmbeddedExecutionRunId, getEmbeddedExecutionSession } from "../embedded/execution-context.js";
|
|
11
11
|
import { wrapToolsWithProtection } from "./executor.js";
|
|
12
12
|
import { EXTERNAL_TOOL_NAMES } from "../external-tools/gateway-tools.js";
|
|
13
13
|
import { buildRuntimeEnvironment } from "../../runtime-tools/environment.js";
|
|
@@ -215,15 +215,25 @@ var AgentToolsFactory = class AgentToolsFactory {
|
|
|
215
215
|
createSessionStatusTool(),
|
|
216
216
|
createMemoryMaintenanceTool({ getConfig: () => this.deps.getConfig?.() }),
|
|
217
217
|
createToolManualTool(),
|
|
218
|
-
createClarifyTool({ resolveAskUser: () => {
|
|
218
|
+
createClarifyTool({ resolveAskUser: (toolCallId) => {
|
|
219
219
|
const req = this.deps.gatewayClarify?.requestClarification;
|
|
220
220
|
if (!req) return null;
|
|
221
221
|
const executionSession = getEmbeddedExecutionSession();
|
|
222
|
-
|
|
222
|
+
const runId = getEmbeddedExecutionRunId();
|
|
223
|
+
if (executionSession && runId) return (request) => req({
|
|
224
|
+
sessionKey: executionSession,
|
|
225
|
+
runId,
|
|
226
|
+
toolCallId
|
|
227
|
+
}, request);
|
|
223
228
|
const ctx = this.deps.getCurrentContext();
|
|
224
229
|
if (!ctx?.sessionKey) return null;
|
|
225
230
|
if (!CLARIFY_SUPPORTED_CHANNELS.has(ctx.channel)) return null;
|
|
226
|
-
|
|
231
|
+
if (!runId) return null;
|
|
232
|
+
return (request) => req({
|
|
233
|
+
sessionKey: ctx.sessionKey,
|
|
234
|
+
runId,
|
|
235
|
+
toolCallId
|
|
236
|
+
}, request);
|
|
227
237
|
} }),
|
|
228
238
|
createTodoTool({
|
|
229
239
|
getSessionKey: () => this.deps.getCurrentContext()?.sessionKey,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { getAssistantMessageErrorReason, stripCodeFences } from "../providers/model-response.js";
|
|
3
4
|
import { getDefaultModelSync, init_providers, resolveModel } from "../providers/index.js";
|
|
4
5
|
import { createExtensionAwareStreamFn } from "../providers/extension-stream-bridge.js";
|
|
5
6
|
import { isLocalModelBaseUrl, resolveModelCallApiKey, resolveModelCallOptions } from "../providers/model-call.js";
|
|
6
|
-
import { getAssistantMessageErrorReason, stripCodeFences } from "../providers/model-response.js";
|
|
7
7
|
//#region src/ai-assist/text-assist.ts
|
|
8
8
|
init_providers();
|
|
9
9
|
init_logger();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
|
-
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
|
|
5
4
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
6
|
-
import {
|
|
5
|
+
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
|
|
7
6
|
import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
|
|
7
|
+
import { getOAuthProviderDefinition, init_registry } from "./oauth/registry.js";
|
|
8
8
|
import { init_oauth_provider_lock, withOAuthProviderLock } from "./oauth-provider-lock.js";
|
|
9
9
|
import { dirname, join } from "path";
|
|
10
10
|
import { mkdir, readFile, readdir, rm } from "fs/promises";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { init_resolution, resolveConnectedPlatformEndpoint } from "../../platform/resolution.js";
|
|
3
2
|
import { generatePKCE, init_pkce } from "./pkce.js";
|
|
3
|
+
import { init_resolution, resolveConnectedPlatformEndpoint } from "../../platform/resolution.js";
|
|
4
4
|
import { hostname } from "node:os";
|
|
5
5
|
import { randomBytes } from "node:crypto";
|
|
6
6
|
import http from "node:http";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
|
|
2
1
|
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
|
|
2
|
+
import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { chmodSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
5
5
|
//#region src/auth/profiles/store.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
3
2
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveOAuthPath } from "../config/paths.js";
|
|
4
|
-
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
3
|
import { init_registry, isOAuthOnlyProvider } from "./oauth/registry.js";
|
|
4
|
+
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
|
+
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
6
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
7
7
|
//#region src/auth/sync-provider-auth.ts
|
|
8
8
|
/**
|
|
@@ -117,9 +117,9 @@ export declare const AutomationActionSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
117
117
|
type: z.ZodLiteral<"add_wait">;
|
|
118
118
|
wait: z.ZodObject<{
|
|
119
119
|
kind: z.ZodEnum<{
|
|
120
|
+
approval: "approval";
|
|
120
121
|
dependency: "dependency";
|
|
121
122
|
user_input: "user_input";
|
|
122
|
-
approval: "approval";
|
|
123
123
|
external_event: "external_event";
|
|
124
124
|
scheduled_time: "scheduled_time";
|
|
125
125
|
retry_backoff: "retry_backoff";
|
|
@@ -294,9 +294,9 @@ export declare const AutomationSchema: z.ZodObject<{
|
|
|
294
294
|
type: z.ZodLiteral<"add_wait">;
|
|
295
295
|
wait: z.ZodObject<{
|
|
296
296
|
kind: z.ZodEnum<{
|
|
297
|
+
approval: "approval";
|
|
297
298
|
dependency: "dependency";
|
|
298
299
|
user_input: "user_input";
|
|
299
|
-
approval: "approval";
|
|
300
300
|
external_event: "external_event";
|
|
301
301
|
scheduled_time: "scheduled_time";
|
|
302
302
|
retry_backoff: "retry_backoff";
|
|
@@ -456,9 +456,9 @@ export declare const CreateAutomationSchema: z.ZodObject<{
|
|
|
456
456
|
type: z.ZodLiteral<"add_wait">;
|
|
457
457
|
wait: z.ZodObject<{
|
|
458
458
|
kind: z.ZodEnum<{
|
|
459
|
+
approval: "approval";
|
|
459
460
|
dependency: "dependency";
|
|
460
461
|
user_input: "user_input";
|
|
461
|
-
approval: "approval";
|
|
462
462
|
external_event: "external_event";
|
|
463
463
|
scheduled_time: "scheduled_time";
|
|
464
464
|
retry_backoff: "retry_backoff";
|
|
@@ -645,9 +645,9 @@ export declare const UpdateAutomationSchema: z.ZodObject<{
|
|
|
645
645
|
type: z.ZodLiteral<"add_wait">;
|
|
646
646
|
wait: z.ZodObject<{
|
|
647
647
|
kind: z.ZodEnum<{
|
|
648
|
+
approval: "approval";
|
|
648
649
|
dependency: "dependency";
|
|
649
650
|
user_input: "user_input";
|
|
650
|
-
approval: "approval";
|
|
651
651
|
external_event: "external_event";
|
|
652
652
|
scheduled_time: "scheduled_time";
|
|
653
653
|
retry_backoff: "retry_backoff";
|