@xopcai/xopc 0.0.459 → 0.0.462
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/assets/{pcm-capture-worklet-CGN9Mlhg.js → pcm-capture-worklet-Df5TcFw4.js} +4 -2
- package/dist/browser-ext/dist/sidepanel.js +3 -2
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agents-CGUdvmIT.js → agents-DC0lHtl5.js} +3 -3
- package/dist/gateway/static/root/assets/{apps-page-M2XD1Pzu.js → apps-page-QLOYw2QR.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-CiJmJ7_h.js → automation-task-card-CJbIHRxN.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CVjgENMO.js → automations-page-DpKnqajR.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CGPWyL0P.js → automations-workspace-BXT_EDON.js} +2 -2
- package/dist/gateway/static/root/assets/{block-editor-CmnkluMF.js → block-editor-DrZyRQQ0.js} +5 -5
- package/dist/gateway/static/root/assets/{capabilities-DDqDvCBs.js → capabilities-Dr-vvMez.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-hSb-qEgL.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-CnU0htlO.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-CvF8VRTv.js → capabilities-settings-panel-B08mjrGB.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-BDVQ6Z7A.js → channels-B--IHNs4.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-stPJEZ90.js → chat-chart-block-ClCZyIi0.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-U2a7d6wP.js +71 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-B4uA_W6R.js → chat-terminal-dock-eneTvxV3.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DyzDVVfz.js → connectors-page-Bs29RvXz.js} +1 -1
- package/dist/gateway/static/root/assets/constants-Bg1wM2nv.js +1 -0
- package/dist/gateway/static/root/assets/diagnostics-Bo0Z42P_.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BPwRrP3L.js → extension-debug-page-Bn_5xu_M.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-DIH4TcdH.js → extension-iframe-host-Vs6USa0c.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-C9JDpo_7.js → extension-message-router-GIekDj_w.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CLDoL5N8.js → extension-page-C_3bIjSB.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-BPIoHw4r.js → extension-provider-D-LolObs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BO_UKeG8.js → extension-settings-page-BV51dk16.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-DefKShSW.js +8 -0
- package/dist/gateway/static/root/assets/index-CChzK_5b.css +1 -0
- package/dist/gateway/static/root/assets/index-CEBDMkde.js +11 -0
- package/dist/gateway/static/root/assets/{local-app-workbench-page-D8oqDDAn.js → local-app-workbench-page-CfnixDO3.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BlxIaCCQ.js → markdown-view-CNJaAdNN.js} +39 -39
- package/dist/gateway/static/root/assets/note-detail-panel-D_l5jkV9.js +7 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-D6mvMSKr.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-CdXA-g9r.js → notes-api-BOIM9Q_D.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-R4uJroeD.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-Dibmspef.js → page-context-capture-button-B_Vdo2Ai.js} +1 -1
- package/dist/gateway/static/root/assets/pcm-capture-worklet-CpXsv44v.js +1 -0
- package/dist/gateway/static/root/assets/personal-page-BsONyPfQ.js +1 -0
- package/dist/gateway/static/root/assets/personal-profile-settings-C4CxmQLQ.js +1 -0
- package/dist/gateway/static/root/assets/{personal-settings-panel-BppxtWBl.js → personal-settings-panel-CnxI2TL0.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-D51I7Lg3.js → product-automation-feedback-CGso8wGv.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-WkF2j_c-.js → product-preview-content-Dgtb4LF7.js} +1 -1
- package/dist/gateway/static/root/assets/product-preview-modal-C35EWUps.js +2 -0
- package/dist/gateway/static/root/assets/project-detail-page-xNSy6SAv.js +7 -0
- package/dist/gateway/static/root/assets/recording-upload-CFX7CANT.js +1 -0
- package/dist/gateway/static/root/assets/route-preload-Dwb_N8L-.js +2 -0
- package/dist/gateway/static/root/assets/routine-panel-KH1VaEdC.js +2 -0
- package/dist/gateway/static/root/assets/session-manager-63NaXb1s.js +25 -0
- package/dist/gateway/static/root/assets/{settings-page-D2qkIrUg.js → settings-page-8MiJzbbl.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-fV5USZb1.js → share-preview-page-Cqy-7-rd.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-sl40lqND.js → shares-settings-BDr50uTV.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-FTd0Z7Ey.js → skills-page-DReUQ4Ug.js} +1 -1
- package/dist/gateway/static/root/assets/star-CnYNmpLd.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-DxKXoBbE.js +3 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-CSJeB9AH.js → task-result-evidence-CW_tN93T.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-CO7XLI4x.js → use-composer-attachments-Xn6eUus2.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-BXXeXnT0.js → use-file-preview-expanded-D0IBFhM9.js} +1 -1
- package/dist/gateway/static/root/assets/use-realtime-voice-B5IsKrRW.js +1 -0
- package/dist/gateway/static/root/assets/{use-workspace-tree-D27u-eoX.js → use-workspace-tree-7X2ydgS8.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-settings-BiqJ0tlf.js → voice-settings-57pwZeKD.js} +1 -1
- package/dist/gateway/static/root/assets/workspace-api-Dd_UDfeo.js +2 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-NffP-UXC.js → workspace-file-preview-dialog-Clj9hMj5.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-preview-store-Do31QQH5.js → workspace-preview-store-imhtuEIP.js} +1 -1
- package/dist/gateway/static/root/index.html +27 -26
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/follow-ups.js +97 -0
- package/dist/packages/gateway-contract/src/home.js +1 -0
- package/dist/packages/gateway-contract/src/index.js +4 -0
- package/dist/packages/gateway-contract/src/observation-starters.js +95 -0
- package/dist/packages/gateway-contract/src/observation.js +7 -0
- package/dist/packages/gateway-contract/src/task-research-result.js +3 -0
- package/dist/src/agent/agent-manager.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.d.ts +1 -0
- package/dist/src/agent/background-review/prompts.js +7 -1
- package/dist/src/agent/background-review/run-background-review.js +85 -7
- package/dist/src/agent/coding/run-verification.d.ts +14 -7
- package/dist/src/agent/coding/run-verification.js +28 -6
- package/dist/src/agent/context/coordinator.js +1 -1
- package/dist/src/agent/context/deep-recall.js +1 -1
- package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -0
- package/dist/src/agent/embedded/execution-tool-policy.js +4 -2
- package/dist/src/agent/embedded/run-for-session.d.ts +2 -0
- package/dist/src/agent/embedded/run-for-session.js +9 -0
- package/dist/src/agent/embedded/run-turn.js +63 -14
- package/dist/src/agent/embedded/types.d.ts +2 -0
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +1 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +1 -0
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
- package/dist/src/agent/service/direct-turn-helpers.js +17 -2
- package/dist/src/agent/service/process-direct-streaming.d.ts +1 -0
- package/dist/src/agent/service/process-direct-streaming.js +1 -0
- package/dist/src/agent/service.d.ts +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +1 -0
- package/dist/src/agent/tool-manuals/browser.d.ts +1 -1
- package/dist/src/agent/tool-manuals/browser.js +3 -1
- package/dist/src/agent/tools/factory.d.ts +1 -1
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/personal-request-tool.js +36 -4
- package/dist/src/agent/tools/personal-task-tool.d.ts +7 -1
- package/dist/src/agent/tools/personal-task-tool.js +68 -3
- package/dist/src/agent/tools/session-search-tool.js +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.d.ts +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.js +54 -3
- package/dist/src/agent/tools/task-result-tool.js +31 -0
- package/dist/src/agent/tools/xopc-use-tool.js +50 -19
- package/dist/src/automations/capabilities/write.d.ts +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/browser-driver.d.ts +1 -0
- package/dist/src/browser/drivers/create-driver.js +2 -11
- package/dist/src/browser/drivers/playwright-driver.d.ts +5 -2
- package/dist/src/browser/drivers/playwright-driver.js +83 -38
- package/dist/src/browser/runtime/browser-runtime.d.ts +5 -0
- package/dist/src/browser/runtime/browser-runtime.js +71 -9
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/computer/diagnostics.d.ts +4 -4
- package/dist/src/computer/errors.d.ts +4 -4
- package/dist/src/computer/evaluation.d.ts +3 -3
- package/dist/src/computer/flows.d.ts +1 -1
- package/dist/src/computer/runtime.d.ts +3 -3
- package/dist/src/config/schema.d.ts +6 -2
- package/dist/src/config/schema.js +3 -0
- package/dist/src/connectors/connected-source-understanding.js +11 -3
- package/dist/src/connectors/learning-coordinator.js +45 -11
- package/dist/src/discussions/recording.js +13 -6
- package/dist/src/endpoint-tools/device-host.d.ts +2 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +4 -0
- package/dist/src/gateway/hono/routes/home.js +52 -1
- package/dist/src/gateway/hono/routes/projects.js +1 -1
- package/dist/src/gateway/hono/routes/session-command-handler.js +15 -1
- package/dist/src/gateway/hono/routes/user-model.js +1 -1
- package/dist/src/gateway/service/agent-runner.d.ts +2 -8
- package/dist/src/gateway/service/agent-runner.js +1 -0
- package/dist/src/gateway/service/config-coordinator.d.ts +5 -1
- package/dist/src/gateway/service/run-gateway-agent.d.ts +13 -8
- package/dist/src/gateway/service/run-gateway-agent.js +5 -2
- package/dist/src/gateway/service/session-input-coordinator.d.ts +4 -0
- package/dist/src/gateway/service/session-input-coordinator.js +6 -1
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +8 -1
- package/dist/src/home-intelligence/follow-ups.d.ts +36 -0
- package/dist/src/home-intelligence/follow-ups.js +496 -0
- package/dist/src/home-intelligence/host.d.ts +80 -4
- package/dist/src/home-intelligence/host.js +122 -2
- package/dist/src/home-intelligence/observation-starters.d.ts +3 -0
- package/dist/src/home-intelligence/observation-starters.js +27 -0
- package/dist/src/home-intelligence/observation.d.ts +1 -1
- package/dist/src/home-intelligence/observation.js +16 -4
- package/dist/src/local-apps/automation-proposals.d.ts +4 -4
- package/dist/src/local-apps/capabilities/projections.d.ts +38 -38
- package/dist/src/memory-learning/choice-observations.d.ts +9 -0
- package/dist/src/memory-learning/choice-observations.js +155 -0
- package/dist/src/memory-learning/evidence-repair.d.ts +12 -0
- package/dist/src/memory-learning/evidence-repair.js +31 -0
- package/dist/src/memory-learning/repository.d.ts +1 -0
- package/dist/src/memory-learning/repository.js +43 -5
- package/dist/src/memory-learning/source-learning.js +52 -7
- package/dist/src/memory-learning/task-receipts.js +19 -10
- package/dist/src/memory-learning/transcript-source.js +7 -0
- package/dist/src/memory-learning/work-candidate.d.ts +14 -0
- package/dist/src/memory-learning/work-candidate.js +17 -2
- package/dist/src/memory-learning/work-capture.d.ts +1 -0
- package/dist/src/memory-learning/work-capture.js +28 -10
- package/dist/src/memory-learning/work-review.d.ts +46 -0
- package/dist/src/memory-learning/work-review.js +209 -0
- package/dist/src/notes/agent-context.js +1 -1
- package/dist/src/personal-agent/communication.d.ts +1 -1
- package/dist/src/personal-agent/communication.js +1 -1
- package/dist/src/personal-agent/default-style.d.ts +1 -1
- package/dist/src/personal-agent/default-style.js +1 -1
- package/dist/src/personal-agent/proactivity/repository.d.ts +1 -1
- package/dist/src/personal-agent/prompts.js +4 -4
- package/dist/src/personal-agent/reply-composer.d.ts +1 -1
- package/dist/src/personal-agent/reply-composer.js +52 -34
- package/dist/src/personal-agent/reply-style.d.ts +2 -2
- package/dist/src/personal-agent/reply-style.js +3 -2
- package/dist/src/personal-agent/request-repository.d.ts +3 -0
- package/dist/src/personal-agent/request-service.d.ts +2 -0
- package/dist/src/personal-agent/request-service.js +8 -2
- package/dist/src/phone/contracts.d.ts +1 -1
- package/dist/src/projects/capabilities/write.js +1 -1
- package/dist/src/projects/index.js +1 -1
- package/dist/src/projects/project-service.js +1 -1
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +7 -7
- package/dist/src/storage/sqlite/schema.sql +22 -0
- package/dist/src/storage/sqlite/upgrades/274_home_followups.sql +21 -0
- package/dist/src/tasks/capabilities/management.d.ts +3 -3
- package/dist/src/tasks/capabilities/relations.d.ts +3 -3
- package/dist/src/tasks/capabilities/write.d.ts +4 -4
- package/dist/src/tasks/capabilities/write.js +2 -0
- package/dist/src/tasks/home-query-service.js +4 -2
- package/dist/src/tasks/task-allocation-service.js +10 -2
- package/dist/src/tasks/task-application-service.d.ts +4 -0
- package/dist/src/tasks/task-application-service.js +6 -1
- package/dist/src/tasks/task-context-assembler.js +7 -2
- package/dist/src/tasks/task-contract-planner.js +3 -3
- package/dist/src/tasks/task-conversation-summary.d.ts +64 -0
- package/dist/src/tasks/task-conversation-summary.js +105 -0
- package/dist/src/tasks/task-delay-notice.d.ts +4 -0
- package/dist/src/tasks/task-delay-notice.js +113 -0
- package/dist/src/tasks/task-deletion-service.js +6 -1
- package/dist/src/tasks/task-handoff.d.ts +21 -0
- package/dist/src/tasks/task-handoff.js +77 -1
- package/dist/src/tasks/task-json-acceptance.d.ts +22 -0
- package/dist/src/tasks/task-json-acceptance.js +96 -0
- package/dist/src/tasks/task-main-update-decision-service.js +17 -21
- package/dist/src/tasks/task-main-update-delivery.js +34 -7
- package/dist/src/tasks/task-notification-preference.d.ts +16 -0
- package/dist/src/tasks/task-notification-preference.js +42 -0
- package/dist/src/tasks/task-origin-repository.d.ts +1 -0
- package/dist/src/tasks/task-origin-repository.js +3 -0
- package/dist/src/tasks/task-read-model-projector.js +1 -1
- package/dist/src/tasks/task-repository.js +1 -0
- package/dist/src/tasks/task-research-repair.d.ts +19 -1
- package/dist/src/tasks/task-research-repair.js +14 -4
- package/dist/src/tasks/task-research-result.d.ts +12 -0
- package/dist/src/tasks/task-research-result.js +5 -0
- package/dist/src/tasks/task-result-delivery-repository.d.ts +4 -1
- package/dist/src/tasks/task-result-delivery-repository.js +8 -5
- package/dist/src/tasks/task-result-delivery-service.js +9 -1
- package/dist/src/tasks/task-run-coordinator.js +45 -10
- package/dist/src/usage/cloud-wire.d.ts +1 -0
- package/dist/src/user-context/config.d.ts +8 -0
- package/dist/src/user-context/config.js +10 -0
- package/dist/src/user-model/capture/evidence-policy.d.ts +2 -0
- package/dist/src/user-model/capture/evidence-policy.js +8 -1
- package/dist/src/user-model/capture/executor.js +16 -4
- package/dist/src/user-model/capture/semantic.d.ts +4 -0
- package/dist/src/user-model/capture/semantic.js +3 -0
- package/dist/src/user-model/index.js +1 -1
- package/dist/src/user-model/observation-repository.d.ts +6 -0
- package/dist/src/user-model/observation-repository.js +12 -0
- package/dist/src/user-model/repository.js +10 -1
- package/dist/src/voice/realtime/agentEngine.js +29 -7
- package/dist/src/voice/realtime/pcmPlaybackEcho.d.ts +10 -0
- package/dist/src/voice/realtime/pcmPlaybackEcho.js +56 -0
- package/dist/src/voice/realtime/playback-echo.d.ts +3 -0
- package/dist/src/voice/realtime/playback-echo.js +35 -5
- package/dist/src/voice/realtime/runtime.js +6 -1
- package/dist/src/voice/realtime/turnPolicy.js +1 -1
- package/package.json +15 -9
- package/dist/gateway/static/root/assets/capabilities-DB713nRi.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-D2hq4cgE.js +0 -2
- package/dist/gateway/static/root/assets/chat-page-BhPw56Vc.js +0 -71
- package/dist/gateway/static/root/assets/constants-DpkUgykJ.js +0 -1
- package/dist/gateway/static/root/assets/discussion-annotation-sync-fwPPMPv9.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BPPe4JXB.js +0 -7
- package/dist/gateway/static/root/assets/index-D0_qnBzh.css +0 -1
- package/dist/gateway/static/root/assets/index-Hv71yddc.js +0 -11
- package/dist/gateway/static/root/assets/note-detail-panel-DLPwJGh0.js +0 -7
- package/dist/gateway/static/root/assets/note-image-lightbox-CqK_uJ6Y.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-DpfN5bZZ.js +0 -8
- package/dist/gateway/static/root/assets/pcm-capture-worklet-uW_SEACy.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-BBGjwkAC.js +0 -1
- package/dist/gateway/static/root/assets/personal-profile-settings-HMQY9lz9.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-modal-DMHOKocl.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-Dj_PuT7k.js +0 -7
- package/dist/gateway/static/root/assets/recording-upload-CyZSl2DJ.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-gas8e1we.js +0 -2
- package/dist/gateway/static/root/assets/routine-panel-CXs4PjW0.js +0 -2
- package/dist/gateway/static/root/assets/session-manager-D2LaQymu.js +0 -25
- package/dist/gateway/static/root/assets/task-detail-page-_5TEldtl.js +0 -3
- package/dist/gateway/static/root/assets/use-realtime-voice-C7iWQuUv.js +0 -1
- package/dist/gateway/static/root/assets/workspace-api-LghfbP5g.js +0 -2
|
@@ -7,6 +7,7 @@ const READ_ONLY_TOOLS = new Set([
|
|
|
7
7
|
"grep",
|
|
8
8
|
"find",
|
|
9
9
|
"list_dir",
|
|
10
|
+
"list_directory",
|
|
10
11
|
"update_plan",
|
|
11
12
|
"session_status"
|
|
12
13
|
]);
|
|
@@ -38,6 +39,8 @@ function editsOnlyProse(name, args) {
|
|
|
38
39
|
/** One run owns its evidence; transcript tool results are the durable record. */
|
|
39
40
|
var RunVerification = class RunVerification {
|
|
40
41
|
revision;
|
|
42
|
+
snapshotStarted;
|
|
43
|
+
initialSnapshot;
|
|
41
44
|
changed = false;
|
|
42
45
|
proseOnly = true;
|
|
43
46
|
before = /* @__PURE__ */ new Map();
|
|
@@ -48,13 +51,17 @@ var RunVerification = class RunVerification {
|
|
|
48
51
|
constructor(snapshot, options = {}) {
|
|
49
52
|
this.snapshot = snapshot;
|
|
50
53
|
this.options = options;
|
|
54
|
+
this.snapshotStarted = options.deferWorkspaceSnapshot !== true;
|
|
55
|
+
}
|
|
56
|
+
get workspaceSnapshotStarted() {
|
|
57
|
+
return this.snapshotStarted;
|
|
51
58
|
}
|
|
52
59
|
static async open(workspace, options = {}) {
|
|
53
60
|
const run = new RunVerification(options.trackWorkspace === false && options.required === false ? async () => void 0 : () => readWorkspaceRevision(workspace), {
|
|
54
61
|
...options,
|
|
55
62
|
workspace
|
|
56
63
|
});
|
|
57
|
-
run.revision = await run.snapshot();
|
|
64
|
+
if (run.snapshotStarted) run.revision = await run.snapshot();
|
|
58
65
|
return run;
|
|
59
66
|
}
|
|
60
67
|
restore(value, includeEvidence) {
|
|
@@ -75,8 +82,18 @@ var RunVerification = class RunVerification {
|
|
|
75
82
|
});
|
|
76
83
|
}
|
|
77
84
|
}
|
|
78
|
-
async beforeTool(toolCallId, toolName) {
|
|
79
|
-
|
|
85
|
+
async beforeTool(toolCallId, toolName, recordBaseline) {
|
|
86
|
+
let revision = this.revision;
|
|
87
|
+
if (!toolName || !READ_ONLY_TOOLS.has(toolName)) if (this.snapshotStarted) revision = await this.snapshot();
|
|
88
|
+
else {
|
|
89
|
+
this.initialSnapshot ??= this.snapshot().then((initial) => {
|
|
90
|
+
this.revision = initial;
|
|
91
|
+
recordBaseline?.(this.capturedSummary());
|
|
92
|
+
this.snapshotStarted = true;
|
|
93
|
+
return initial;
|
|
94
|
+
});
|
|
95
|
+
revision = await this.initialSnapshot;
|
|
96
|
+
}
|
|
80
97
|
this.observeRevision(revision);
|
|
81
98
|
this.before.set(toolCallId, revision);
|
|
82
99
|
}
|
|
@@ -171,8 +188,9 @@ var RunVerification = class RunVerification {
|
|
|
171
188
|
return `Execution phase: complete outstanding requirements, then verify once with a direct command (no cd, chains, or pipes). ${this.proseOnly ? "Inspect final prose once; no assertion script is required." : "Finish outstanding requested changes, then check the final contract once."} Still missing: ${missing.join(", ")}. Reuse valid evidence; report unavailable verification.`;
|
|
172
189
|
}
|
|
173
190
|
async pendingContext() {
|
|
191
|
+
if (this.options.required === false || !this.snapshotStarted) return "";
|
|
174
192
|
this.observeRevision(await this.snapshot());
|
|
175
|
-
if (!this.changed
|
|
193
|
+
if (!this.changed) return "";
|
|
176
194
|
const current = [...this.evidence.values()].filter((item) => item.revision && item.revision === this.revision);
|
|
177
195
|
const checked = !this.pendingEvidence().includes("check");
|
|
178
196
|
const reviewed = current.some((item) => item.kind === "diff-review" && item.status === "passed");
|
|
@@ -187,8 +205,8 @@ var RunVerification = class RunVerification {
|
|
|
187
205
|
"If a check is unavailable or unrelated to the requested change, report what remains unverified and why. Do not claim verified completion."
|
|
188
206
|
].join("\n");
|
|
189
207
|
}
|
|
190
|
-
|
|
191
|
-
|
|
208
|
+
/** Serialize verification state from the latest captured revision. */
|
|
209
|
+
capturedSummary() {
|
|
192
210
|
return {
|
|
193
211
|
changed: this.changed,
|
|
194
212
|
proseOnly: this.proseOnly,
|
|
@@ -199,6 +217,10 @@ var RunVerification = class RunVerification {
|
|
|
199
217
|
}))
|
|
200
218
|
};
|
|
201
219
|
}
|
|
220
|
+
async summary() {
|
|
221
|
+
if (this.snapshotStarted) this.observeRevision(await this.snapshot());
|
|
222
|
+
return this.capturedSummary();
|
|
223
|
+
}
|
|
202
224
|
};
|
|
203
225
|
//#endregion
|
|
204
226
|
export { RunVerification, toolResultFailed };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { extractProfileAgentId } from "../../config/agent-profile.js";
|
|
2
1
|
import { forgottenHistoryEntries, projectUnadmittedForgottenFields } from "../../memory-learning/forgotten-history.js";
|
|
2
|
+
import { extractProfileAgentId } from "../../config/agent-profile.js";
|
|
3
3
|
import { stripRuntimeContextFromUserMessage } from "../../session/user-message-display.js";
|
|
4
4
|
import { extractAgentUserPlainText } from "../memory/user-message-text.js";
|
|
5
5
|
import { assembleTaskContext } from "../../tasks/task-context-assembler.js";
|
|
@@ -2,9 +2,9 @@ import { getSqliteDatabase, init_transaction } from "../../storage/sqlite/transa
|
|
|
2
2
|
import { escapeSqlLike, init_fts, sessionSearchTerms } from "../../storage/sqlite/fts.js";
|
|
3
3
|
import { resolveUserContextSessionAccess } from "../../user-context/access-policy.js";
|
|
4
4
|
import { OWNER_LEARNING_SESSION_SQL } from "../../memory-learning/transcript-source.js";
|
|
5
|
+
import { forgottenHistoryEntries, projectUnadmittedForgottenFields } from "../../memory-learning/forgotten-history.js";
|
|
5
6
|
import { completeWithResolvedCredentials } from "../../providers/model-call.js";
|
|
6
7
|
import { isLoopbackModel } from "../../providers/local-model.js";
|
|
7
|
-
import { forgottenHistoryEntries, projectUnadmittedForgottenFields } from "../../memory-learning/forgotten-history.js";
|
|
8
8
|
import { retrievalLexicalSimilarity } from "../../retrieval/textFeatures.js";
|
|
9
9
|
import { stripRuntimeContextFromUserMessage } from "../../session/user-message-display.js";
|
|
10
10
|
import { canonicalWorkspacePath } from "../../projects/workspace-project.js";
|
|
@@ -31,7 +31,8 @@ function resolveExecutionToolPolicy(conversationId) {
|
|
|
31
31
|
const interaction = getSessionInteractionPolicy(conversationId);
|
|
32
32
|
const readOnly = interaction.mode === "plan" || interaction.access === "read-only";
|
|
33
33
|
const taskSession = isXopcDatabaseOpen() ? new TaskConversationRepository().resolveActiveExecutionSession(conversationId) : void 0;
|
|
34
|
-
const
|
|
34
|
+
const followUp = Boolean(taskSession && getXopcDatabase().db.prepare("SELECT 1 FROM home_followup_steps WHERE task_id=? UNION ALL SELECT 1 FROM home_followups WHERE root_task_id=? LIMIT 1").get(taskSession.taskId, taskSession.taskId));
|
|
35
|
+
const privateRoutine = followUp || Boolean(taskSession && getXopcDatabase().db.prepare(`SELECT 1 FROM observation_routine_executions WHERE task_id=?
|
|
35
36
|
UNION ALL SELECT 1 FROM observation_methods WHERE validation_task_id=?
|
|
36
37
|
UNION ALL SELECT 1 FROM home_observation_trials WHERE task_id=? LIMIT 1`).get(taskSession.taskId, taskSession.taskId, taskSession.taskId));
|
|
37
38
|
const unrestricted = !privateRoutine && configured && !readOnly && (!authority || authority.unrestrictedTools);
|
|
@@ -39,6 +40,7 @@ function resolveExecutionToolPolicy(conversationId) {
|
|
|
39
40
|
surface,
|
|
40
41
|
taskExecution: Boolean(taskSession),
|
|
41
42
|
privateRoutine,
|
|
43
|
+
followUp,
|
|
42
44
|
readOnly,
|
|
43
45
|
nativeMcp: unrestricted,
|
|
44
46
|
externalMaterialization: unrestricted,
|
|
@@ -50,7 +52,7 @@ function resolveExecutionToolPolicy(conversationId) {
|
|
|
50
52
|
function allowsExecutionTool(policy, name) {
|
|
51
53
|
const authority = getExecutionAuthority();
|
|
52
54
|
authority?.assertCurrent();
|
|
53
|
-
if (policy.privateRoutine && !PRIVATE_ROUTINE_TOOLS.has(name)) return false;
|
|
55
|
+
if (policy.privateRoutine && !PRIVATE_ROUTINE_TOOLS.has(name) && !(policy.followUp && name === "task_collaboration")) return false;
|
|
54
56
|
if (policy.readOnly && !isReadOnlySessionTool(name)) return false;
|
|
55
57
|
if (authority && !authority.allowsTool(name)) return false;
|
|
56
58
|
if (TASK_EXECUTION_TOOL_IDS.includes(name) && !policy.taskExecution) return false;
|
|
@@ -7,6 +7,8 @@ import type { EmbeddedStreamEvent, RunXopcEmbeddedTurnResult } from './types.js'
|
|
|
7
7
|
export type RunEmbeddedForSessionParams = {
|
|
8
8
|
conversationId: string;
|
|
9
9
|
runId?: string;
|
|
10
|
+
gatewayRunStartedMonotonic?: number;
|
|
11
|
+
preparationTimings?: Record<string, number>;
|
|
10
12
|
userMessage: AgentMessage;
|
|
11
13
|
dynamicSystemContext?: string;
|
|
12
14
|
llmImages?: import('@earendil-works/pi-ai').ImageContent[];
|
|
@@ -54,6 +54,7 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
54
54
|
}, () => runEmbeddedTurnForSessionInner(input), input.userMessage);
|
|
55
55
|
}
|
|
56
56
|
async function runEmbeddedTurnForSessionInner(params) {
|
|
57
|
+
const sessionStartedAt = performance.now();
|
|
57
58
|
const { conversationId, agentManager, modelManager, sessionStore, userMessage } = params;
|
|
58
59
|
const personal = isPersonalConversation(conversationId);
|
|
59
60
|
const idleScheduler = sessionStore.idleCompaction;
|
|
@@ -153,7 +154,9 @@ async function runEmbeddedTurnForSessionInner(params) {
|
|
|
153
154
|
ok: false,
|
|
154
155
|
errorMessage: "aborted"
|
|
155
156
|
});
|
|
157
|
+
const memoryStartedAt = performance.now();
|
|
156
158
|
await agentManager.ensureMemoryReadyForSession?.(conversationId);
|
|
159
|
+
const memoryReadyMs = performance.now() - memoryStartedAt;
|
|
157
160
|
if (supervisor.signal.aborted) return await finish({
|
|
158
161
|
ok: false,
|
|
159
162
|
errorMessage: "aborted"
|
|
@@ -374,6 +377,12 @@ async function runEmbeddedTurnForSessionInner(params) {
|
|
|
374
377
|
conversationId,
|
|
375
378
|
verifyChanges: config ? resolveEffectiveAgentProfileForSession(conversationId).agentId === "coder" : false,
|
|
376
379
|
runId,
|
|
380
|
+
gatewayRunStartedMonotonic: params.gatewayRunStartedMonotonic,
|
|
381
|
+
preparationTimings: {
|
|
382
|
+
...params.preparationTimings,
|
|
383
|
+
memoryReadyMs,
|
|
384
|
+
sessionPreparationMs: performance.now() - sessionStartedAt
|
|
385
|
+
},
|
|
377
386
|
userMessage: userMessageForTurn,
|
|
378
387
|
images: params.llmImages,
|
|
379
388
|
model: candidateModel,
|
|
@@ -11,12 +11,12 @@ import { projectContextForModel } from "../memory/context-budget.js";
|
|
|
11
11
|
import { getActiveClarification, getClarification, getClarificationResumeInput, isClarificationSuspended } from "../../storage/sqlite/clarification-wait-repository.js";
|
|
12
12
|
import "../../storage/sqlite/index.js";
|
|
13
13
|
import { ProviderUsageScopeError, init_model_usage } from "../../providers/model-usage.js";
|
|
14
|
+
import { originalReadAuthorizationNotice, projectForgottenHistoryMessages, projectSuppressedMemoryBlocks } from "../../memory-learning/forgotten-history.js";
|
|
14
15
|
import { resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
|
|
15
16
|
import { getExecutionAuthority } from "../../infra/execution-authority.js";
|
|
16
17
|
import { recordTraceLatency, setTraceIdentity, traceOperation, traceRun, traceTools } from "../../observability/runtime.js";
|
|
17
18
|
import { continuesAfterTool, trackAiUsageStream } from "../../usage/recorder.js";
|
|
18
19
|
import { cloudCreditBudgetStopMessage, isCloudCreditBudgetExhausted, reportCloudCreditError, withCloudCreditBudget } from "../../providers/xopc-cloud-credit-budget.js";
|
|
19
|
-
import { originalReadAuthorizationNotice, projectForgottenHistoryMessages, projectSuppressedMemoryBlocks } from "../../memory-learning/forgotten-history.js";
|
|
20
20
|
import { resolveAgentAbortReason } from "../orchestration/run-termination.js";
|
|
21
21
|
import { isAgentTurnTimeoutError, isAgentTurnUnsettledError, resolveAgentTurnTimeoutMs, runAgentTurnWithTimeout } from "../orchestration/run-agent-turn-with-timeout.js";
|
|
22
22
|
import { isContextOverflowError } from "../orchestration/context-overflow.js";
|
|
@@ -334,10 +334,12 @@ async function runXopcEmbeddedTurn(params) {
|
|
|
334
334
|
}
|
|
335
335
|
async function runXopcEmbeddedTurnInner(params) {
|
|
336
336
|
const preparationStartedAt = performance.now();
|
|
337
|
+
const preparationTimings = { ...params.preparationTimings };
|
|
337
338
|
let firstModelRequestAt;
|
|
338
339
|
let currentModelRequestAt;
|
|
339
340
|
let modelRequestNumber = 0;
|
|
340
341
|
let firstModelTextSeen = false;
|
|
342
|
+
let firstModelDeltaSeen = false;
|
|
341
343
|
let latencyModelRef;
|
|
342
344
|
let latencyReasoning;
|
|
343
345
|
const { conversationId, runId, userMessage, model, tools: rawTools, systemPrompt, thinkingLevel, workspaceDir, sessionStore, onEvent } = params;
|
|
@@ -370,8 +372,11 @@ async function runXopcEmbeddedTurnInner(params) {
|
|
|
370
372
|
transcriptId: transcriptRuntime.transcriptId,
|
|
371
373
|
runId
|
|
372
374
|
});
|
|
375
|
+
const instructionsStartedAt = performance.now();
|
|
373
376
|
const instructions = await RepositoryInstructions.open(workspaceDir, { isWorkspaceTrusted: params.isWorkspaceTrusted });
|
|
374
377
|
const rootInstructions = await instructions.load(".", true);
|
|
378
|
+
preparationTimings.workspaceInstructionsMs = performance.now() - instructionsStartedAt;
|
|
379
|
+
const runnerStartedAt = performance.now();
|
|
375
380
|
runner = await acquireEmbeddedSessionRunner({
|
|
376
381
|
runtimeId: transcriptRuntime.runtimeId,
|
|
377
382
|
transcriptId: transcriptRuntime.transcriptId,
|
|
@@ -390,6 +395,7 @@ async function runXopcEmbeddedTurnInner(params) {
|
|
|
390
395
|
thinkingLevel: configuredThinking ?? thinkingLevel ?? "medium",
|
|
391
396
|
transcriptRuntime
|
|
392
397
|
});
|
|
398
|
+
preparationTimings.runnerAcquireMs = performance.now() - runnerStartedAt;
|
|
393
399
|
const { session, reused } = runner;
|
|
394
400
|
const configurationTurnStart = session.agent.state.messages.length;
|
|
395
401
|
await runLease.attach(session, async () => session.abort());
|
|
@@ -407,7 +413,9 @@ async function runXopcEmbeddedTurnInner(params) {
|
|
|
407
413
|
errorMessage: "aborted"
|
|
408
414
|
};
|
|
409
415
|
}
|
|
416
|
+
const transcriptStartedAt = performance.now();
|
|
410
417
|
session.agent.state.messages = stripTrailingErrorAssistantMessages(await transcriptRuntime.loadMessages());
|
|
418
|
+
preparationTimings.transcriptLoadMs = performance.now() - transcriptStartedAt;
|
|
411
419
|
runner.piSm.setActiveTurnId?.(runId);
|
|
412
420
|
const recoveryState = { interruptedAttempts: 0 };
|
|
413
421
|
const requestRetryBudget = { continues: 0 };
|
|
@@ -519,6 +527,7 @@ async function runXopcEmbeddedTurnInner(params) {
|
|
|
519
527
|
if (session.agent.transformContext === transformWorkEvidence) session.agent.transformContext = baseTransformContext;
|
|
520
528
|
};
|
|
521
529
|
const loggingStreamFn = (streamModel, context, options) => {
|
|
530
|
+
const payloadStartedAt = firstModelRequestAt === void 0 ? performance.now() : void 0;
|
|
522
531
|
bindComputerAgentTurn(conversationId, runId, streamModel);
|
|
523
532
|
const releaseComputerFrames = computerRequestFrameCleanup(conversationId, runId);
|
|
524
533
|
instructions.acknowledge();
|
|
@@ -697,14 +706,24 @@ async function runXopcEmbeddedTurnInner(params) {
|
|
|
697
706
|
latencyReasoning = options?.reasoning;
|
|
698
707
|
if (firstModelRequestAt === void 0) {
|
|
699
708
|
firstModelRequestAt = currentModelRequestAt;
|
|
700
|
-
|
|
709
|
+
const gatewayTiming = params.gatewayRunStartedMonotonic === void 0 ? {} : { gatewayRunToFirstModelRequestMs: firstModelRequestAt - params.gatewayRunStartedMonotonic };
|
|
710
|
+
if (payloadStartedAt !== void 0) preparationTimings.modelPayloadPreparationMs = firstModelRequestAt - payloadStartedAt;
|
|
711
|
+
recordTraceLatency({
|
|
712
|
+
embeddedPreparationMs: firstModelRequestAt - preparationStartedAt,
|
|
713
|
+
...gatewayTiming,
|
|
714
|
+
...preparationTimings
|
|
715
|
+
});
|
|
701
716
|
log.info({
|
|
702
717
|
conversationId,
|
|
703
718
|
runId,
|
|
704
719
|
modelRef: latencyModelRef,
|
|
705
720
|
thinking: latencyReasoning ?? "off",
|
|
706
721
|
phase: "first_model_request",
|
|
722
|
+
...gatewayTiming,
|
|
707
723
|
preparationMs: firstModelRequestAt - preparationStartedAt,
|
|
724
|
+
preparationTimings,
|
|
725
|
+
runnerReused: reused,
|
|
726
|
+
workspaceVerificationDeferred: !verification.workspaceSnapshotStarted,
|
|
708
727
|
messageCount: effectiveContext.messages.length,
|
|
709
728
|
systemPromptLength: effectiveSystemPrompt.length,
|
|
710
729
|
toolCount: effectiveTools.length,
|
|
@@ -725,23 +744,32 @@ async function runXopcEmbeddedTurnInner(params) {
|
|
|
725
744
|
return stream;
|
|
726
745
|
};
|
|
727
746
|
session.agent.streamFunction = loggingStreamFn;
|
|
728
|
-
const
|
|
729
|
-
required: params.verifyChanges === true,
|
|
730
|
-
toolNames: tools.map((tool) => tool.name),
|
|
731
|
-
trackWorkspace: executionToolPolicy.surface !== "personal_main"
|
|
732
|
-
});
|
|
747
|
+
const verificationStartedAt = performance.now();
|
|
733
748
|
const checkpoints = runner.piSm.getBranch?.() ?? [];
|
|
734
749
|
const recoveryTurn = params.resumeLastUserMessage === true || Boolean(params.recoveryMessage);
|
|
735
750
|
const lastStart = checkpoints.findLastIndex((entry) => entry.type === "custom" && entry.customType === "coding_run_started");
|
|
736
751
|
const lastSummary = checkpoints.findLastIndex((entry) => entry.type === "custom" && entry.customType === "coding_verification");
|
|
737
752
|
const checkpoint = checkpoints[recoveryTurn && lastSummary >= lastStart ? lastSummary : lastStart];
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
753
|
+
const restoreBaseline = checkpoint?.type === "custom" && (recoveryTurn || lastStart > lastSummary) && checkpoint.data?.workspaceSnapshotStarted !== false;
|
|
754
|
+
const trackWorkspace = executionToolPolicy.surface !== "personal_main";
|
|
755
|
+
const verification = await RunVerification.open(workspaceDir, {
|
|
756
|
+
required: params.verifyChanges === true,
|
|
757
|
+
toolNames: tools.map((tool) => tool.name),
|
|
758
|
+
trackWorkspace,
|
|
759
|
+
deferWorkspaceSnapshot: (trackWorkspace || params.verifyChanges === true) && !restoreBaseline
|
|
744
760
|
});
|
|
761
|
+
if (restoreBaseline) verification.restore(checkpoint.data, recoveryTurn && lastSummary >= lastStart);
|
|
762
|
+
const recordVerificationStart = (snapshot, workspaceSnapshotStarted) => {
|
|
763
|
+
runner.piSm.appendCustomEntry("coding_run_started", {
|
|
764
|
+
runId,
|
|
765
|
+
workspace: workspaceDir,
|
|
766
|
+
required: params.verifyChanges ?? false,
|
|
767
|
+
workspaceSnapshotStarted,
|
|
768
|
+
...snapshot
|
|
769
|
+
});
|
|
770
|
+
};
|
|
771
|
+
recordVerificationStart(verification.capturedSummary(), verification.workspaceSnapshotStarted);
|
|
772
|
+
preparationTimings.workspaceVerificationMs = performance.now() - verificationStartedAt;
|
|
745
773
|
let policyStopped = false;
|
|
746
774
|
let policyCompleted = false;
|
|
747
775
|
let recoveringModel = params.resumeLastUserMessage === true || Boolean(params.recoveryMessage);
|
|
@@ -837,7 +865,9 @@ async function runXopcEmbeddedTurnInner(params) {
|
|
|
837
865
|
reason: `${scoped}\n\nApply these instructions, then retry the operation.`
|
|
838
866
|
};
|
|
839
867
|
}
|
|
840
|
-
await verification.beforeTool(context.toolCall.id, context.toolCall.name)
|
|
868
|
+
await verification.beforeTool(context.toolCall.id, context.toolCall.name, (snapshot) => {
|
|
869
|
+
recordVerificationStart(snapshot, true);
|
|
870
|
+
});
|
|
841
871
|
if (context.toolCall.name === "computer_use" && !context[computerProgramOperation]) {
|
|
842
872
|
let operationNumber = 0;
|
|
843
873
|
const nestedContext = (operation, args) => ({
|
|
@@ -966,6 +996,24 @@ async function runXopcEmbeddedTurnInner(params) {
|
|
|
966
996
|
if (baseDecision && baseDecision.action === "continue") return { action: "continue" };
|
|
967
997
|
};
|
|
968
998
|
unsubscribe = subscribeEmbeddedSessionEvents(session, (event) => {
|
|
999
|
+
const delta = event.type === "message_update" ? event.assistantMessageEvent : void 0;
|
|
1000
|
+
if (!firstModelDeltaSeen && currentModelRequestAt !== void 0 && firstModelRequestAt !== void 0 && (delta?.type === "text_delta" || delta?.type === "thinking_delta" || delta?.type === "toolcall_delta") && delta.delta.length > 0) {
|
|
1001
|
+
firstModelDeltaSeen = true;
|
|
1002
|
+
const now = performance.now();
|
|
1003
|
+
const latency = {
|
|
1004
|
+
modelFirstDeltaMs: now - currentModelRequestAt,
|
|
1005
|
+
firstRequestToDeltaMs: now - firstModelRequestAt
|
|
1006
|
+
};
|
|
1007
|
+
recordTraceLatency(latency);
|
|
1008
|
+
log.info({
|
|
1009
|
+
conversationId,
|
|
1010
|
+
runId,
|
|
1011
|
+
phase: "first_model_delta",
|
|
1012
|
+
...latency,
|
|
1013
|
+
modelRequestNumber,
|
|
1014
|
+
deltaType: delta.type
|
|
1015
|
+
}, "Embedded first model content delta received");
|
|
1016
|
+
}
|
|
969
1017
|
if (!firstModelTextSeen && firstModelRequestAt !== void 0 && currentModelRequestAt !== void 0 && event.type === "message_update" && event.assistantMessageEvent?.type === "text_delta" && event.assistantMessageEvent.delta.trim()) {
|
|
970
1018
|
firstModelTextSeen = true;
|
|
971
1019
|
const textSeenAt = performance.now();
|
|
@@ -1305,6 +1353,7 @@ async function runXopcEmbeddedTurnInner(params) {
|
|
|
1305
1353
|
runId,
|
|
1306
1354
|
workspace: workspaceDir,
|
|
1307
1355
|
required: params.verifyChanges ?? false,
|
|
1356
|
+
workspaceSnapshotStarted: verification.workspaceSnapshotStarted,
|
|
1308
1357
|
...await verification.summary()
|
|
1309
1358
|
});
|
|
1310
1359
|
if (runAbortSignal.aborted) return {
|
|
@@ -76,6 +76,8 @@ export type RunXopcEmbeddedTurnParams = {
|
|
|
76
76
|
/** Host-owned parent identity for ephemeral runs that inherit its tools. */
|
|
77
77
|
toolPolicyConversationId?: string;
|
|
78
78
|
runId: string;
|
|
79
|
+
gatewayRunStartedMonotonic?: number;
|
|
80
|
+
preparationTimings?: Record<string, number>;
|
|
79
81
|
userMessage: AgentMessage;
|
|
80
82
|
model: Model<Api>;
|
|
81
83
|
modelRef: string;
|
|
@@ -75,6 +75,7 @@ export declare class TurnDispatcher {
|
|
|
75
75
|
processDirectStreaming(content: string, conversationId: string, origin: TurnOrigin, attachments?: DirectAttachment[], thinking?: string, options?: {
|
|
76
76
|
signal?: AbortSignal;
|
|
77
77
|
runId?: string;
|
|
78
|
+
gatewayRunStartedMonotonic?: number;
|
|
78
79
|
sourceContexts?: AgentSourceContext[];
|
|
79
80
|
presentation?: 'voice';
|
|
80
81
|
onDeferredAudio?: (audio: WebchatTtsResult) => void;
|
|
@@ -38,6 +38,7 @@ var TurnDispatcher = class {
|
|
|
38
38
|
thinking,
|
|
39
39
|
signal: options?.signal,
|
|
40
40
|
runId: options?.runId,
|
|
41
|
+
gatewayRunStartedMonotonic: options?.gatewayRunStartedMonotonic,
|
|
41
42
|
sourceContexts: options?.sourceContexts,
|
|
42
43
|
presentation: options?.presentation,
|
|
43
44
|
onDeferredAudio: options?.onDeferredAudio
|
|
@@ -116,15 +116,25 @@ async function tryRunSlashCommand(deps, ctx, content, options) {
|
|
|
116
116
|
* planning and background-review wiring used by every direct entry point.
|
|
117
117
|
*/
|
|
118
118
|
async function runDirectAgentTurn(deps, input) {
|
|
119
|
+
const directStartedAt = performance.now();
|
|
119
120
|
const turnId = input.runId ?? crypto.randomUUID();
|
|
120
121
|
const isConnectionResume = Boolean(getConnectionResumeInput(input.conversationId, turnId));
|
|
121
122
|
const isClarificationResume = Boolean(getClarificationResumeInput(input.conversationId, turnId));
|
|
122
123
|
const isResume = Boolean(phoneResumeForRun(input.conversationId, turnId)) || isConnectionResume || isClarificationResume || Boolean(getTaskContinuation(input.conversationId, turnId)) || Boolean(getMcpSetupResumeInput(input.conversationId, turnId));
|
|
123
124
|
const modelRef = deps.modelManager.getModelForSession(input.conversationId);
|
|
124
|
-
const
|
|
125
|
+
const preparationTimings = {};
|
|
126
|
+
const contextStartedAt = performance.now();
|
|
127
|
+
const context = Promise.resolve(deps.agentManager.prepareUserTurnContext(input.userMessage, input.conversationId, turnId)).finally(() => {
|
|
128
|
+
preparationTimings.userContextMs = performance.now() - contextStartedAt;
|
|
129
|
+
});
|
|
130
|
+
const mediaStartedAt = performance.now();
|
|
131
|
+
const media = Promise.resolve(hydrateUserTurnForLlm({
|
|
125
132
|
message: input.userMessage,
|
|
126
133
|
modelRef
|
|
127
|
-
})
|
|
134
|
+
})).finally(() => {
|
|
135
|
+
preparationTimings.mediaHydrationMs = performance.now() - mediaStartedAt;
|
|
136
|
+
});
|
|
137
|
+
const [contextResult, mediaResult] = await Promise.allSettled([context, media]);
|
|
128
138
|
if (contextResult.status === "rejected") throw contextResult.reason;
|
|
129
139
|
if (mediaResult.status === "rejected") throw mediaResult.reason;
|
|
130
140
|
const userContext = contextResult.value;
|
|
@@ -138,6 +148,11 @@ async function runDirectAgentTurn(deps, input) {
|
|
|
138
148
|
const result = await runEmbeddedTurnForSession({
|
|
139
149
|
conversationId: input.conversationId,
|
|
140
150
|
runId: turnId,
|
|
151
|
+
gatewayRunStartedMonotonic: input.gatewayRunStartedMonotonic,
|
|
152
|
+
preparationTimings: {
|
|
153
|
+
...preparationTimings,
|
|
154
|
+
directPreparationMs: performance.now() - directStartedAt
|
|
155
|
+
},
|
|
141
156
|
userMessage: sourceEnrichedMessage,
|
|
142
157
|
dynamicSystemContext: [userContext.dynamicSystemContext, taskContext].filter(Boolean).join("\n\n"),
|
|
143
158
|
llmImages,
|
|
@@ -68,6 +68,7 @@ export interface ProcessDirectStreamingInput {
|
|
|
68
68
|
thinking?: string;
|
|
69
69
|
signal?: AbortSignal;
|
|
70
70
|
runId?: string;
|
|
71
|
+
gatewayRunStartedMonotonic?: number;
|
|
71
72
|
sourceContexts?: AgentSourceContext[];
|
|
72
73
|
presentation?: 'voice';
|
|
73
74
|
/** Delivers durable audio independently of the completed text run. */
|
|
@@ -345,6 +345,7 @@ async function* runProcessDirectStreamingInner(deps, input) {
|
|
|
345
345
|
sourceContexts,
|
|
346
346
|
presentation: input.presentation,
|
|
347
347
|
requireVisibleReply: input.origin.type === "endpoint" || input.origin.type === "system" && input.origin.source === "cli",
|
|
348
|
+
gatewayRunStartedMonotonic: input.gatewayRunStartedMonotonic,
|
|
348
349
|
runId: input.runId,
|
|
349
350
|
onEvent: (embeddedEvent) => {
|
|
350
351
|
const event = { ...embeddedEvent };
|
|
@@ -106,7 +106,7 @@ export declare class AgentService {
|
|
|
106
106
|
getSkillCatalogSnapshot(): SkillCatalogSnapshot;
|
|
107
107
|
getAgentToolAvailability(agentId: string, name: string): {
|
|
108
108
|
condition: string;
|
|
109
|
-
state: "
|
|
109
|
+
state: "verified" | "blocked";
|
|
110
110
|
reasonCode: string;
|
|
111
111
|
detail: string;
|
|
112
112
|
};
|
|
@@ -82,6 +82,7 @@ function codingCompletionEvidence(rows) {
|
|
|
82
82
|
const checkpoint = entries[Math.max(start, final)]?.data;
|
|
83
83
|
if (!checkpoint?.required) return { allowed: true };
|
|
84
84
|
if (start > final) return { allowed: false };
|
|
85
|
+
if (checkpoint.workspaceSnapshotStarted === false && checkpoint.changed === false) return { allowed: true };
|
|
85
86
|
const evidence = Array.isArray(checkpoint.evidence) ? checkpoint.evidence : [];
|
|
86
87
|
return {
|
|
87
88
|
allowed: checkpoint.changed !== true || evidence.some((item) => item.kind === "check" && item.status === "passed") && evidence.some((item) => item.kind === "diff-review" && item.status === "passed") && evidence.every((item) => item.status === "passed"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const browserUseManual = "# Browser Tool Manual\n\n## browser_use\n\nUse one typed action per call. Start with `observe` or `navigate`. Every observation returns a `sessionId`, `revision`, and semantic element refs. Element actions must use refs from the newest revision; never invent refs.\n\nAvailable actions:\n\n- `observe`: return URL, title, interactive semantic nodes, and changes. Set `visual` to `always` only when visual evidence is needed.\n- `navigate`: open an HTTP(S) URL and optionally verify an expectation.\n- `click`, `fill`, `select`: act on a semantic ref with its observation revision.\n- `press`, `scroll`: act on an optional ref or the active page.\n- `wait`: wait for page idle, text, or a ref visibility state.\n- `upload`: attach workspace files to a file input.\n- `tabs`: list, create, activate, or close task-owned tabs.\n- `sequence`: run a short list of same-document ref actions.\n- `close`: close the task-owned browser session.\n\
|
|
1
|
+
export declare const browserUseManual = "# Browser Tool Manual\n\n## browser_use\n\nUse one typed action per call. Start with `observe` or `navigate`. Every observation returns a `sessionId`, `revision`, and semantic element refs. Element actions must use refs from the newest revision; never invent refs.\n\nAvailable actions:\n\n- `observe`: return URL, title, interactive semantic nodes, and changes. Set `visual` to `always` only when visual evidence is needed.\n- `navigate`: open an HTTP(S) URL and optionally verify an expectation.\n- `click`, `fill`, `select`: act on a semantic ref with its observation revision.\n- `press`, `scroll`: act on an optional ref or the active page.\n- `wait`: wait for page idle, text, or a ref visibility state.\n- `upload`: attach workspace files to a file input.\n- `tabs`: list, create, activate, or close task-owned tabs.\n- `sequence`: run a short list of same-document ref actions.\n- `close`: close the task-owned browser session.\n\nFor a delayed UI transition, pass an expectation when the action supports it, or use `wait` for a known result before acting on the next screen. Re-observe after navigation or a stale-observation response.\n\nThe tool does not accept CSS, XPath, JavaScript, cookie, storage, or network-inspection commands. Browser actions execute directly under the configured allow/deny policy. Sensitive fields expose only their semantic identity and values are redacted.\n\n";
|
|
@@ -17,7 +17,9 @@ Available actions:
|
|
|
17
17
|
- \`sequence\`: run a short list of same-document ref actions.
|
|
18
18
|
- \`close\`: close the task-owned browser session.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
For a delayed UI transition, pass an expectation when the action supports it, or use \`wait\` for a known result before acting on the next screen. Re-observe after navigation or a stale-observation response.
|
|
21
|
+
|
|
22
|
+
The tool does not accept CSS, XPath, JavaScript, cookie, storage, or network-inspection commands. Browser actions execute directly under the configured allow/deny policy. Sensitive fields expose only their semantic identity and values are redacted.
|
|
21
23
|
|
|
22
24
|
`;
|
|
23
25
|
//#endregion
|
|
@@ -114,7 +114,7 @@ export declare class AgentToolsFactory {
|
|
|
114
114
|
private deps;
|
|
115
115
|
getAgentToolAvailability(candidateId: string, name: string): {
|
|
116
116
|
condition: string;
|
|
117
|
-
state: "
|
|
117
|
+
state: "verified" | "blocked";
|
|
118
118
|
reasonCode: string;
|
|
119
119
|
detail: string;
|
|
120
120
|
};
|
|
@@ -13,6 +13,7 @@ import { getConversationRouting } from "../../storage/sqlite/conversation-reposi
|
|
|
13
13
|
import { init_session_key } from "../../routing/session-key.js";
|
|
14
14
|
import { resolveUserContextSessionAccess } from "../../user-context/access-policy.js";
|
|
15
15
|
import { resolveEffectiveAgentConfigForAgent } from "../../config/agent-profile.js";
|
|
16
|
+
import { canRecallConversation, canRecallHistoryEntry } from "../../session/history-recall-policy.js";
|
|
16
17
|
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
17
18
|
import { getActiveTranscriptUserText, getPendingTranscriptUserText } from "../inbound/attachment-pipeline.js";
|
|
18
19
|
import { PERSONAL_TOOL_DESCRIPTIONS } from "../../personal-agent/policy.js";
|
|
@@ -75,7 +76,6 @@ import { createImageGenerateTool } from "./image-generate-tool.js";
|
|
|
75
76
|
import { createPersonalReadTool } from "./personal-read-tool.js";
|
|
76
77
|
import { createTaskCollaborationTool } from "./task-collaboration-tool.js";
|
|
77
78
|
import "./index.js";
|
|
78
|
-
import { canRecallConversation, canRecallHistoryEntry } from "../../session/history-recall-policy.js";
|
|
79
79
|
import { createPersonalResultTool } from "./personal-result-tool.js";
|
|
80
80
|
import { createPersonalTaskTool } from "./personal-task-tool.js";
|
|
81
81
|
import { withTaskEvidenceIdentity } from "./task-evidence.js";
|