@xopcai/xopc 0.0.243 → 0.0.245
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/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CAah-_8h.js → activity-store-BlxqErph.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DDH4HgP7.js → agent-avatar-dicebear-DRQnogaU.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BDCfJZhh.js → agent-defaults-settings-panel-CpOxGbMD.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-B0ZWgf-U.js → agents-flnXZLaT.js} +1 -1
- package/dist/gateway/static/root/assets/{api-B2tKxbcz.js → api-BbXzyQMj.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Blfwszzn.js → app-management-settings-panel-CZl6n2xi.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C3V7Na75.js → appearance-settings-Bglp-pn6.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BiEks0-F.js → apps-page-CmsWarVB.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BmSx7wzY.js → archive-plugin-DD2SweEH.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BS-S4LJ9.js → attachment-load-G0HenUmG.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-C7Y3L30D.js → automations-page-B78bFjH2.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-A3zPkPuo.js → automations-workspace-BMQGmn50.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-BM9B5kcm.js → binary-plugins-BbSQmXqn.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BbnpkYP9.js → block-editor-DutTIH81.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-Dk4FQ7fY.js → browser-settings-page-CALiFKm4.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-CRnkgZHI.js → browser-workflow-inputs-BAAc151l.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-B9qGL-it.js → browser-workflows-page-DE5HPrHZ.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel--tR_El9e.js → capabilities-settings-panel-Dts7XtP3.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-D347vl_J.js → channels-settings-CWEd3wzh.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-status-swr-DuY4MGxe.js → channels-status-swr-CCBCtLDg.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DABPvwBT.js → chat-terminal-dock-Bp1fXQm1.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-B-tvJkRJ.js → connectors-page-CQ6wVNLm.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-D3bsKbNd.js → cron-expression-B8HA5IRb.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-BsGM6Yty.js → date-picker-DD8b7oad.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Dj3g6YXZ.js → dependency-picker-BC9zwIyH.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-C1QT0Sur.js → desktop-pet-DsrsPZTW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-r6kAOnfY.js → desktop-pet-settings-D7gp_HNA.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DOkf7nh9.js → extension-debug-page-BoKbOX7x.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Cq2IA4Ho.js → extension-page-BegL4FW8.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DQn4qjDZ.js → extension-settings-page-CjPqq57s.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DM3poL22.js → gateway-config-api-DaG57o4X.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BC3pgb_P.js → gateway-config-swr-826dipyU.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DPgH1hnh.js → gateway-settings-DkJGpgm6.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-uMcSfLru.js → gateway-startup-retry-DyvcAIMm.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Bk80-E3b.js → heartbeat-settings-BLZ48kSU.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-DKo5JiMR.js → home-page-Dtw7Ipt1.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-D1qlQA-A.js → image-generation-api-D7cyfks6.js} +1 -1
- package/dist/gateway/static/root/assets/{index-B0WJL9N1.js → index-DG5CfYat.js} +10 -10
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BEwvd8ZU.js → keyboard-shortcuts-settings-D2Has7-N.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page--eJ5rmNj.js → local-app-workbench-page-BWidWY93.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-CgkY9E-r.js → local-apps-page-Bkekjoxf.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CMZljTJx.js → locale-store-CBoCuIMx.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-Z49Td0J9.js → logs-page-C5zSSgvA.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-Dv8NSJKt.js → management-settings-B8c62vRS.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-Cm0RBB-t.js → markdown-split-3kxTTGO7.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-PPCLt7fu.js → markdown-view-BXsHghJd.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Bcr5sU1f.js → media-plugins-BW8J1nCG.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BbdwoxVo.js +3 -0
- package/dist/gateway/static/root/assets/{mobile-pairing-wizard-kKDiXofY.js → mobile-pairing-wizard-nwQ8iUcd.js} +1 -1
- package/dist/gateway/static/root/assets/models-hub-cache-88f4fzYS.js +1 -0
- package/dist/gateway/static/root/assets/{notes-page-CgsaRaGi.js → notes-page-DdybD0QM.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-C1DEE09k.js → notes-workbench-IYfpy2Jx.js} +2 -2
- package/dist/gateway/static/root/assets/{oauth-api-4VeMbkTJ.js → oauth-api-BjSUDIgq.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BU0HiZtv.js → product-open-page-CAJeUXeU.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-isRapnp5.js → project-detail-page-4wjw-b7h.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-zvsjg0mi.js → projects-page-CCMj9PeL.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-CWOtPFrE.js → registry-api-BhGKnvLP.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-C9TGZ9Hc.js → remote-access-hub-DsBJqWIk.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-2zm9edMA.js → runtime-tools-settings-panel-B4IDcqx0.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-54A5gzkN.js → schema-form-DiGUUjO6.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-BP8RyiUn.js → sessions-page-BwGj0t-2.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BJCfUghk.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-DzDhoyxv.js → settings-page-CVQUsAhd.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-uDicHU1w.js → setup-status-panel-CQACRh1i.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-lOmLCWFS.js → share-preview-page-DTP1dtuS.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-T4Yvouvv.js → shares-settings-D_YPh6Rw.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B43xlJlX.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CnyNH3To.js → skills-page-Czpn7Y28.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CgDtf2qs.js → skills-page.utils-d39rm3hb.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-C8yWfwtR.js → system-settings-panel-CXXySCSp.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-Tzfjlbf3.js → task-detail-page-DHiOqQMx.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-uxUwr10D.js → theme-store-hybK3oC9.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-Bvg679no.js → tunnel-api-BiBGK7O2.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-D88VGoyG.js → use-autosave-DjpzpeIm.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-RijPtyfO.js → user-context-page-1XBRV5gX.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-CBHLsMcc.js → voice-api-key-field-CUIPNmOc.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-MqyI6cgq.js → voice-config-api-CBbiF1T3.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-GGe2TQ98.js → work-discovery-overlay-DVNxhb1x.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C0layUE9.js → workflow-run-setup-panel-HxxFQFY7.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DQXIzBAc.js → workflows-page-BCgL7PRm.js} +1 -1
- package/dist/gateway/static/root/index.html +11 -11
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/turn-outcome.js +3 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +3 -1
- package/dist/src/agent/agent-manager.d.ts +2 -4
- package/dist/src/agent/agent-manager.js +24 -28
- package/dist/src/agent/background-review/coordinator.js +1 -1
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/child-agent-factory.d.ts +10 -7
- package/dist/src/agent/child-agent-factory.js +112 -158
- package/dist/src/agent/coding/index.d.ts +1 -1
- package/dist/src/agent/coding/index.js +2 -2
- package/dist/src/agent/coding/repository-instructions.d.ts +12 -0
- package/dist/src/agent/coding/repository-instructions.js +76 -0
- package/dist/src/agent/coding/run-verification.d.ts +34 -0
- package/dist/src/agent/coding/run-verification.js +134 -0
- package/dist/src/agent/coding/verification-command.d.ts +3 -0
- package/dist/src/agent/coding/verification-command.js +50 -0
- package/dist/src/agent/coding/workspace-revision.d.ts +2 -0
- package/dist/src/agent/coding/workspace-revision.js +77 -0
- package/dist/src/agent/commands/command-isolation.d.ts +21 -0
- package/dist/src/agent/commands/command-isolation.js +71 -0
- package/dist/src/agent/commands/command-registry.d.ts +56 -0
- package/dist/src/agent/commands/command-registry.js +259 -0
- package/dist/src/agent/embedded/index.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +2 -1
- package/dist/src/agent/embedded/run-turn.js +88 -25
- package/dist/src/agent/embedded/session-tool-result-guard.js +2 -2
- package/dist/src/agent/embedded/subscribe-session.d.ts +2 -1
- package/dist/src/agent/embedded/subscribe-session.js +2 -1
- package/dist/src/agent/embedded/types.d.ts +3 -1
- package/dist/src/agent/embedded/xopc-tools-bridge.js +4 -1
- package/dist/src/agent/image/index.js +1 -1
- package/dist/src/agent/index.js +3 -3
- package/dist/src/agent/memory/user-context-coordinator.js +1 -1
- package/dist/src/agent/middleware/index.d.ts +0 -5
- package/dist/src/agent/middleware/index.js +1 -2
- package/dist/src/agent/orchestration/agent-event-handler.d.ts +0 -5
- package/dist/src/agent/orchestration/agent-event-handler.js +1 -96
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
- package/dist/src/agent/orchestration/agent-turn-policy.js +5 -5
- package/dist/src/agent/orchestration/index.d.ts +1 -1
- package/dist/src/agent/orchestration/index.js +2 -2
- package/dist/src/agent/orchestration/loop-guard.d.ts +4 -31
- package/dist/src/agent/orchestration/loop-guard.js +14 -99
- package/dist/src/agent/prompt/sections/tooling.js +2 -4
- package/dist/src/agent/sandbox/types.d.ts +2 -2
- package/dist/src/agent/sandbox/types.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +1 -1
- package/dist/src/agent/service.d.ts +0 -2
- package/dist/src/agent/service.js +6 -23
- package/dist/src/agent/tasks/task-judge-service.d.ts +7 -0
- package/dist/src/agent/tasks/task-judge-service.js +24 -2
- package/dist/src/agent/tools/delegate-tool.d.ts +2 -1
- package/dist/src/agent/tools/delegate-tool.js +102 -124
- package/dist/src/agent/tools/exec-command.d.ts +8 -1
- package/dist/src/agent/tools/exec-command.js +77 -169
- package/dist/src/agent/tools/executor.js +9 -2
- package/dist/src/agent/tools/factory.js +50 -5
- package/dist/src/agent/tools/find.d.ts +10 -13
- package/dist/src/agent/tools/find.js +33 -80
- package/dist/src/agent/tools/grep.d.ts +14 -18
- package/dist/src/agent/tools/grep.js +56 -144
- package/dist/src/agent/tools/index.d.ts +0 -1
- package/dist/src/agent/tools/index.js +2 -3
- package/dist/src/agent/tools/language-diagnostics.d.ts +11 -0
- package/dist/src/agent/tools/language-diagnostics.js +62 -0
- package/dist/src/agent/tools/managed-job-tool.d.ts +2 -1
- package/dist/src/agent/tools/managed-job-tool.js +58 -118
- package/dist/src/agent/tools/read.js +24 -7
- package/dist/src/agent/tools/repository-search.d.ts +5 -0
- package/dist/src/agent/tools/repository-search.js +56 -0
- package/dist/src/agent/tools/review-workspace.d.ts +2 -0
- package/dist/src/agent/tools/review-workspace.js +103 -0
- package/dist/src/agent/tools/write.js +4 -4
- package/dist/src/agent/transcript/index.js +2 -2
- package/dist/src/agent/transcript/transcript-hygiene.js +2 -2
- package/dist/src/agent/workflow/subagent-runner.d.ts +0 -2
- package/dist/src/agent/workflow/subagent-runner.js +12 -31
- package/dist/src/agent-config/schema.d.ts +42 -0
- package/dist/src/agent-config/schema.js +5 -0
- package/dist/src/automations/draft/automation-draft-service.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/config/schema.d.ts +28 -0
- package/dist/src/execution-environments/local-worktree-manager.d.ts +3 -1
- package/dist/src/execution-environments/local-worktree-manager.js +8 -3
- package/dist/src/execution-environments/session-environment-service.js +5 -3
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +7 -0
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +23 -23
- package/dist/src/gateway/hono/routes/sessions.js +1 -1
- package/dist/src/gateway/media-access.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +4 -1
- package/dist/src/gateway/service.js +1 -1
- package/dist/src/gateway/session-reset-service.js +1 -1
- package/dist/src/gateway/workspace-ripgrep.d.ts +0 -6
- package/dist/src/gateway/workspace-ripgrep.js +2 -40
- package/dist/src/infra/ripgrep.d.ts +13 -0
- package/dist/src/infra/ripgrep.js +46 -0
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/proactive/execution/agent-executor.js +1 -1
- package/dist/src/session/store.js +1 -1
- package/dist/src/session/turn-outcome-projector.js +26 -6
- package/dist/src/tasks/task-run-coordinator.d.ts +2 -2
- package/dist/src/tasks/task-run-coordinator.js +14 -12
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/messages-CTSgFlE4.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-ZrbGRiGY.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D4EMxWAZ.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DVb7nrXz.js +0 -1
- package/dist/src/agent/coding/turn-diff-tracker.d.ts +0 -67
- package/dist/src/agent/coding/turn-diff-tracker.js +0 -231
- package/dist/src/agent/middleware/self-verify.d.ts +0 -136
- package/dist/src/agent/middleware/self-verify.js +0 -380
- package/dist/src/agent/tools/execute-code-tool.d.ts +0 -11
- package/dist/src/agent/tools/execute-code-tool.js +0 -208
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { isAbsolute, relative, resolve } from "node:path";
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { lstat, readFile, readlink, realpath } from "node:fs/promises";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
//#region src/agent/coding/workspace-revision.ts
|
|
7
|
+
const exec$1 = promisify(execFile);
|
|
8
|
+
/** A content fingerprint, including user changes and untracked files, without changing Git state. */
|
|
9
|
+
async function readWorkspaceRevision(workspace) {
|
|
10
|
+
let cwd = workspace;
|
|
11
|
+
const git = async (args) => (await exec$1("git", [
|
|
12
|
+
"-c",
|
|
13
|
+
"core.fsmonitor=false",
|
|
14
|
+
...args
|
|
15
|
+
], {
|
|
16
|
+
cwd,
|
|
17
|
+
timeout: 1e4,
|
|
18
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
19
|
+
env: {
|
|
20
|
+
...process.env,
|
|
21
|
+
GIT_OPTIONAL_LOCKS: "0"
|
|
22
|
+
}
|
|
23
|
+
})).stdout;
|
|
24
|
+
try {
|
|
25
|
+
cwd = await realpath(workspace);
|
|
26
|
+
cwd = await realpath((await git(["rev-parse", "--show-toplevel"])).trim());
|
|
27
|
+
const head = await git([
|
|
28
|
+
"rev-parse",
|
|
29
|
+
"--verify",
|
|
30
|
+
"HEAD"
|
|
31
|
+
]).catch(() => "unborn");
|
|
32
|
+
const [diff, untracked] = await Promise.all([head === "unborn" ? Promise.all([git([
|
|
33
|
+
"diff",
|
|
34
|
+
"--no-ext-diff",
|
|
35
|
+
"--no-textconv",
|
|
36
|
+
"--binary",
|
|
37
|
+
"--cached",
|
|
38
|
+
"--"
|
|
39
|
+
]), git([
|
|
40
|
+
"diff",
|
|
41
|
+
"--no-ext-diff",
|
|
42
|
+
"--no-textconv",
|
|
43
|
+
"--binary",
|
|
44
|
+
"--"
|
|
45
|
+
])]).then((parts) => parts.join("\0")) : git([
|
|
46
|
+
"diff",
|
|
47
|
+
"--no-ext-diff",
|
|
48
|
+
"--no-textconv",
|
|
49
|
+
"--binary",
|
|
50
|
+
"HEAD",
|
|
51
|
+
"--"
|
|
52
|
+
]), git([
|
|
53
|
+
"ls-files",
|
|
54
|
+
"--others",
|
|
55
|
+
"--exclude-standard",
|
|
56
|
+
"-z"
|
|
57
|
+
])]);
|
|
58
|
+
const hash = createHash("sha256").update(head).update(diff);
|
|
59
|
+
for (const file of untracked.split("\0").filter(Boolean).sort()) {
|
|
60
|
+
const path = resolve(cwd, file);
|
|
61
|
+
const rel = relative(cwd, path);
|
|
62
|
+
if (isAbsolute(rel) || rel === ".." || rel.startsWith("../")) return void 0;
|
|
63
|
+
const stat = await lstat(path);
|
|
64
|
+
if (stat.isSymbolicLink()) {
|
|
65
|
+
hash.update(file).update("\0link\0").update(await readlink(path)).update("\0");
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (!stat.isFile() || stat.size > 16 * 1024 * 1024) return void 0;
|
|
69
|
+
hash.update(JSON.stringify([file, stat.mode])).update("\0").update(await readFile(path)).update("\0");
|
|
70
|
+
}
|
|
71
|
+
return hash.digest("hex");
|
|
72
|
+
} catch {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { readWorkspaceRevision };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type CommandIsolation = {
|
|
2
|
+
mode: 'host';
|
|
3
|
+
} | {
|
|
4
|
+
mode: 'docker';
|
|
5
|
+
image: string;
|
|
6
|
+
network?: boolean;
|
|
7
|
+
};
|
|
8
|
+
/** Docker is opt-in and never falls back to host execution or pulls an image implicitly. */
|
|
9
|
+
export declare function isolatedCommand(input: {
|
|
10
|
+
id: string;
|
|
11
|
+
command: string;
|
|
12
|
+
cwd: string;
|
|
13
|
+
workspace: string;
|
|
14
|
+
isolation?: CommandIsolation;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
executable: string;
|
|
17
|
+
args: string[];
|
|
18
|
+
shell: boolean;
|
|
19
|
+
containerName?: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function removeCommandContainer(name: string): Promise<void>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { isAbsolute, relative, sep } from "node:path";
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
import { realpath } from "node:fs/promises";
|
|
4
|
+
import { promisify } from "node:util";
|
|
5
|
+
//#region src/agent/commands/command-isolation.ts
|
|
6
|
+
const exec$1 = promisify(execFile);
|
|
7
|
+
/** Docker is opt-in and never falls back to host execution or pulls an image implicitly. */
|
|
8
|
+
async function isolatedCommand(input) {
|
|
9
|
+
if (!input.isolation || input.isolation.mode === "host") return {
|
|
10
|
+
executable: input.command,
|
|
11
|
+
args: [],
|
|
12
|
+
shell: true
|
|
13
|
+
};
|
|
14
|
+
if (!/^[a-zA-Z0-9][a-zA-Z0-9./:_-]*@sha256:[a-f0-9]{64}$/.test(input.isolation.image)) throw new Error("Docker command isolation requires an image pinned by sha256 digest.");
|
|
15
|
+
const [workspace, cwd] = await Promise.all([realpath(input.workspace), realpath(input.cwd)]);
|
|
16
|
+
const rel = relative(workspace, cwd);
|
|
17
|
+
if (isAbsolute(rel) || rel === ".." || rel.startsWith(`..${sep}`)) throw new Error("Container cwd must be inside the workspace.");
|
|
18
|
+
if (workspace.includes(",")) throw new Error("Container workspace paths cannot contain commas.");
|
|
19
|
+
const containerName = `xopc-command-${input.id}`;
|
|
20
|
+
return {
|
|
21
|
+
executable: "docker",
|
|
22
|
+
shell: false,
|
|
23
|
+
containerName,
|
|
24
|
+
args: [
|
|
25
|
+
"run",
|
|
26
|
+
"--rm",
|
|
27
|
+
"--pull=never",
|
|
28
|
+
"--name",
|
|
29
|
+
containerName,
|
|
30
|
+
"--interactive",
|
|
31
|
+
"--init",
|
|
32
|
+
"--read-only",
|
|
33
|
+
"--cap-drop=ALL",
|
|
34
|
+
"--security-opt=no-new-privileges",
|
|
35
|
+
"--pids-limit=256",
|
|
36
|
+
"--memory=2g",
|
|
37
|
+
"--cpus=2",
|
|
38
|
+
"--network",
|
|
39
|
+
input.isolation.network ? "bridge" : "none",
|
|
40
|
+
"--user",
|
|
41
|
+
`${process.getuid?.() || 65534}:${process.getgid?.() || 65534}`,
|
|
42
|
+
"--mount",
|
|
43
|
+
`type=bind,source=${workspace},target=/workspace`,
|
|
44
|
+
"--tmpfs",
|
|
45
|
+
"/tmp:rw,nosuid,nodev,size=256m",
|
|
46
|
+
"--env",
|
|
47
|
+
"HOME=/tmp",
|
|
48
|
+
"--env",
|
|
49
|
+
"CI=true",
|
|
50
|
+
"--workdir",
|
|
51
|
+
`/workspace${rel ? `/${rel.split(sep).join("/")}` : ""}`,
|
|
52
|
+
"--entrypoint",
|
|
53
|
+
"/bin/sh",
|
|
54
|
+
input.isolation.image,
|
|
55
|
+
"-lc",
|
|
56
|
+
input.command
|
|
57
|
+
]
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
async function removeCommandContainer(name) {
|
|
61
|
+
if (!/^xopc-command-[a-f0-9-]{36}$/.test(name)) throw new Error("Invalid command container name");
|
|
62
|
+
await exec$1("docker", [
|
|
63
|
+
"rm",
|
|
64
|
+
"--force",
|
|
65
|
+
name
|
|
66
|
+
], { timeout: 1e4 }).catch((error) => {
|
|
67
|
+
if (!String(error.stderr).includes("No such container")) throw error;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { isolatedCommand, removeCommandContainer };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type CommandIsolation } from './command-isolation.js';
|
|
2
|
+
export declare const DEFAULT_COMMAND_TIMEOUT_MS: number;
|
|
3
|
+
export declare const MAX_COMMAND_TIMEOUT_MS: number;
|
|
4
|
+
export type CommandStatus = 'running' | 'success' | 'failed' | 'cancelled' | 'timed_out' | 'interrupted';
|
|
5
|
+
export interface CommandResult {
|
|
6
|
+
id: string;
|
|
7
|
+
command: string;
|
|
8
|
+
cwd: string;
|
|
9
|
+
status: CommandStatus;
|
|
10
|
+
exitCode: number | null;
|
|
11
|
+
createdAtMs: number;
|
|
12
|
+
durationMs: number;
|
|
13
|
+
timedOut: boolean;
|
|
14
|
+
stdout: string;
|
|
15
|
+
stderr: string;
|
|
16
|
+
aggregatedOutput: string;
|
|
17
|
+
totalOutputBytes: number;
|
|
18
|
+
captureTruncated: boolean;
|
|
19
|
+
logPath: string;
|
|
20
|
+
logTruncated: boolean;
|
|
21
|
+
startRevision?: string;
|
|
22
|
+
endRevision?: string;
|
|
23
|
+
isolation?: 'host' | 'docker';
|
|
24
|
+
containerName?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function commandTimeout(raw: unknown, ceiling?: number): number;
|
|
27
|
+
/** Foreground and background tools share ownership, cancellation, output and durable receipts. */
|
|
28
|
+
export declare class CommandRegistry {
|
|
29
|
+
private readonly root;
|
|
30
|
+
private readonly prunedAt;
|
|
31
|
+
private readonly running;
|
|
32
|
+
constructor(root?: string);
|
|
33
|
+
private directory;
|
|
34
|
+
private persist;
|
|
35
|
+
start(input: {
|
|
36
|
+
owner: string;
|
|
37
|
+
command: string;
|
|
38
|
+
cwd: string;
|
|
39
|
+
env: NodeJS.ProcessEnv;
|
|
40
|
+
timeoutMs: number;
|
|
41
|
+
workspace?: string;
|
|
42
|
+
isolation?: CommandIsolation;
|
|
43
|
+
maxOutputChars?: number;
|
|
44
|
+
signal?: AbortSignal;
|
|
45
|
+
snapshot?: boolean;
|
|
46
|
+
onOutput?: (stream: 'stdout' | 'stderr', delta: string) => void;
|
|
47
|
+
}): Promise<CommandResult>;
|
|
48
|
+
get(owner: string, id: string): CommandResult | undefined;
|
|
49
|
+
wait(owner: string, id: string, waitMs?: number, signal?: AbortSignal): Promise<CommandResult | undefined>;
|
|
50
|
+
cancel(owner: string, id: string): Promise<CommandResult | undefined>;
|
|
51
|
+
write(owner: string, id: string, chars: string, end?: boolean): boolean;
|
|
52
|
+
shutdown(): void;
|
|
53
|
+
private prune;
|
|
54
|
+
list(owner: string): CommandResult[];
|
|
55
|
+
}
|
|
56
|
+
export declare function commandRegistry(): CommandRegistry;
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { resolveStateDir } from "../../config/paths-state.js";
|
|
2
|
+
import { resolveGlobalSingleton } from "../../utils/global-singleton.js";
|
|
3
|
+
import { init_paths } from "../../config/paths.js";
|
|
4
|
+
import { isolatedCommand, removeCommandContainer } from "./command-isolation.js";
|
|
5
|
+
import { readWorkspaceRevision } from "../coding/workspace-revision.js";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { appendFileSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { spawn } from "node:child_process";
|
|
9
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
10
|
+
//#region src/agent/commands/command-registry.ts
|
|
11
|
+
init_paths();
|
|
12
|
+
const DEFAULT_COMMAND_TIMEOUT_MS = 30 * 6e4;
|
|
13
|
+
const MAX_COMMAND_TIMEOUT_MS = 240 * 6e4;
|
|
14
|
+
const MAX_LOG_BYTES = 8 * 1024 * 1024;
|
|
15
|
+
function commandTimeout(raw, ceiling = MAX_COMMAND_TIMEOUT_MS) {
|
|
16
|
+
return Math.min(ceiling, Math.max(1, typeof raw === "number" && Number.isFinite(raw) ? Math.floor(raw) : DEFAULT_COMMAND_TIMEOUT_MS));
|
|
17
|
+
}
|
|
18
|
+
function killTree(child) {
|
|
19
|
+
if (!child.pid) return;
|
|
20
|
+
if (process.platform === "win32") {
|
|
21
|
+
const killer = spawn("taskkill", [
|
|
22
|
+
"/pid",
|
|
23
|
+
String(child.pid),
|
|
24
|
+
"/t",
|
|
25
|
+
"/f"
|
|
26
|
+
], {
|
|
27
|
+
stdio: "ignore",
|
|
28
|
+
windowsHide: true
|
|
29
|
+
});
|
|
30
|
+
killer.on("error", () => child.kill("SIGKILL"));
|
|
31
|
+
killer.unref();
|
|
32
|
+
} else try {
|
|
33
|
+
process.kill(-child.pid, "SIGKILL");
|
|
34
|
+
} catch {
|
|
35
|
+
child.kill("SIGKILL");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Foreground and background tools share ownership, cancellation, output and durable receipts. */
|
|
39
|
+
var CommandRegistry = class {
|
|
40
|
+
prunedAt = /* @__PURE__ */ new Map();
|
|
41
|
+
running = /* @__PURE__ */ new Map();
|
|
42
|
+
constructor(root = join(resolveStateDir(), "command-runs")) {
|
|
43
|
+
this.root = root;
|
|
44
|
+
}
|
|
45
|
+
directory(owner) {
|
|
46
|
+
return join(this.root, createHash("sha256").update(owner).digest("hex"));
|
|
47
|
+
}
|
|
48
|
+
persist(owner, result) {
|
|
49
|
+
const file = join(this.directory(owner), `${result.id}.json`);
|
|
50
|
+
writeFileSync(`${file}.tmp`, JSON.stringify(result), { mode: 384 });
|
|
51
|
+
renameSync(`${file}.tmp`, file);
|
|
52
|
+
}
|
|
53
|
+
async start(input) {
|
|
54
|
+
input.signal?.throwIfAborted();
|
|
55
|
+
if (this.running.size >= 64) throw new Error("Command capacity reached; wait for or cancel an existing job.");
|
|
56
|
+
const directory = this.directory(input.owner);
|
|
57
|
+
mkdirSync(directory, {
|
|
58
|
+
recursive: true,
|
|
59
|
+
mode: 448
|
|
60
|
+
});
|
|
61
|
+
this.prune(input.owner);
|
|
62
|
+
const id = randomUUID();
|
|
63
|
+
const startRevision = input.snapshot ? await readWorkspaceRevision(input.cwd) : void 0;
|
|
64
|
+
input.signal?.throwIfAborted();
|
|
65
|
+
const launch = await isolatedCommand({
|
|
66
|
+
id,
|
|
67
|
+
command: input.command,
|
|
68
|
+
cwd: input.cwd,
|
|
69
|
+
workspace: input.workspace ?? input.cwd,
|
|
70
|
+
isolation: input.isolation
|
|
71
|
+
});
|
|
72
|
+
const result = {
|
|
73
|
+
isolation: input.isolation?.mode ?? "host",
|
|
74
|
+
...launch.containerName ? { containerName: launch.containerName } : {},
|
|
75
|
+
id,
|
|
76
|
+
command: input.command,
|
|
77
|
+
cwd: input.cwd,
|
|
78
|
+
status: "running",
|
|
79
|
+
exitCode: null,
|
|
80
|
+
createdAtMs: Date.now(),
|
|
81
|
+
durationMs: 0,
|
|
82
|
+
timedOut: false,
|
|
83
|
+
stdout: "",
|
|
84
|
+
stderr: "",
|
|
85
|
+
aggregatedOutput: "",
|
|
86
|
+
totalOutputBytes: 0,
|
|
87
|
+
captureTruncated: false,
|
|
88
|
+
logPath: join(directory, `${id}.log`),
|
|
89
|
+
logTruncated: false,
|
|
90
|
+
...startRevision ? { startRevision } : {}
|
|
91
|
+
};
|
|
92
|
+
writeFileSync(result.logPath, "", {
|
|
93
|
+
mode: 384,
|
|
94
|
+
flag: "wx"
|
|
95
|
+
});
|
|
96
|
+
this.persist(input.owner, result);
|
|
97
|
+
const child = spawn(launch.executable, launch.args, {
|
|
98
|
+
shell: launch.shell,
|
|
99
|
+
cwd: input.cwd,
|
|
100
|
+
env: input.env,
|
|
101
|
+
detached: process.platform !== "win32"
|
|
102
|
+
});
|
|
103
|
+
const limit = input.maxOutputChars ?? 5e4;
|
|
104
|
+
let logBytes = 0;
|
|
105
|
+
let closed = false;
|
|
106
|
+
let containerCleanup;
|
|
107
|
+
const append = (stream, chunk) => {
|
|
108
|
+
const value = String(chunk);
|
|
109
|
+
result.totalOutputBytes += Buffer.byteLength(value);
|
|
110
|
+
result.captureTruncated ||= result[stream].length + value.length > limit || result.aggregatedOutput.length + value.length > limit;
|
|
111
|
+
result[stream] = (result[stream] + value).slice(-limit);
|
|
112
|
+
result.aggregatedOutput = (result.aggregatedOutput + value).slice(-limit);
|
|
113
|
+
const bytes = Buffer.from(value), remaining = Math.max(0, MAX_LOG_BYTES - logBytes);
|
|
114
|
+
if (remaining > 0) try {
|
|
115
|
+
appendFileSync(result.logPath, bytes.subarray(0, remaining));
|
|
116
|
+
} catch {
|
|
117
|
+
result.logTruncated = true;
|
|
118
|
+
}
|
|
119
|
+
logBytes += Math.min(bytes.length, remaining);
|
|
120
|
+
result.logTruncated ||= bytes.length > remaining;
|
|
121
|
+
input.onOutput?.(stream, value.length > 16e3 ? `${value.slice(0, 16e3)}\n[stream delta truncated]` : value);
|
|
122
|
+
};
|
|
123
|
+
const stop = (status) => {
|
|
124
|
+
if (result.status !== "running" || closed) return;
|
|
125
|
+
result.status = status;
|
|
126
|
+
result.timedOut = status === "timed_out";
|
|
127
|
+
if (launch.containerName) containerCleanup = removeCommandContainer(launch.containerName).catch((error) => {
|
|
128
|
+
result.status = "interrupted";
|
|
129
|
+
append("stderr", `Container cleanup failed: ${String(error)}`);
|
|
130
|
+
});
|
|
131
|
+
killTree(child);
|
|
132
|
+
};
|
|
133
|
+
const timer = setTimeout(() => stop("timed_out"), commandTimeout(input.timeoutMs));
|
|
134
|
+
timer.unref();
|
|
135
|
+
const abort = () => stop("cancelled");
|
|
136
|
+
input.signal?.addEventListener("abort", abort, { once: true });
|
|
137
|
+
const done = new Promise((resolve) => {
|
|
138
|
+
child.stdout?.on("data", (value) => append("stdout", value));
|
|
139
|
+
child.stderr?.on("data", (value) => append("stderr", value));
|
|
140
|
+
child.on("error", (error) => append("stderr", error.message));
|
|
141
|
+
child.stdin?.on("error", (error) => append("stderr", error.message));
|
|
142
|
+
child.on("close", async (exitCode) => {
|
|
143
|
+
closed = true;
|
|
144
|
+
clearTimeout(timer);
|
|
145
|
+
input.signal?.removeEventListener("abort", abort);
|
|
146
|
+
if (containerCleanup) await containerCleanup;
|
|
147
|
+
if (input.snapshot) result.endRevision = await readWorkspaceRevision(input.cwd);
|
|
148
|
+
if (result.status === "running") result.status = exitCode === 0 ? "success" : "failed";
|
|
149
|
+
result.exitCode = exitCode;
|
|
150
|
+
result.durationMs = Date.now() - result.createdAtMs;
|
|
151
|
+
try {
|
|
152
|
+
this.persist(input.owner, result);
|
|
153
|
+
} catch {
|
|
154
|
+
result.logTruncated = true;
|
|
155
|
+
}
|
|
156
|
+
this.running.delete(id);
|
|
157
|
+
resolve({ ...result });
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
this.running.set(id, {
|
|
161
|
+
owner: input.owner,
|
|
162
|
+
result,
|
|
163
|
+
process: child,
|
|
164
|
+
done,
|
|
165
|
+
stop
|
|
166
|
+
});
|
|
167
|
+
if (input.signal?.aborted) abort();
|
|
168
|
+
return { ...result };
|
|
169
|
+
}
|
|
170
|
+
get(owner, id) {
|
|
171
|
+
if (!/^[\da-f-]{36}$/.test(id)) return void 0;
|
|
172
|
+
const current = this.running.get(id);
|
|
173
|
+
if (current) return current.owner === owner ? {
|
|
174
|
+
...current.result,
|
|
175
|
+
durationMs: Date.now() - current.result.createdAtMs
|
|
176
|
+
} : void 0;
|
|
177
|
+
try {
|
|
178
|
+
const result = JSON.parse(readFileSync(join(this.directory(owner), `${id}.json`), "utf8"));
|
|
179
|
+
if (result.status === "running") {
|
|
180
|
+
result.status = "interrupted";
|
|
181
|
+
result.stderr += "\nRuntime ownership was lost. Process/container state is unknown; inspect before restarting.";
|
|
182
|
+
this.persist(owner, result);
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
} catch {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
async wait(owner, id, waitMs = 3e4, signal) {
|
|
190
|
+
const current = this.running.get(id);
|
|
191
|
+
if (!current || current.owner !== owner) return this.get(owner, id);
|
|
192
|
+
signal?.throwIfAborted();
|
|
193
|
+
let timer;
|
|
194
|
+
let aborted;
|
|
195
|
+
try {
|
|
196
|
+
return await Promise.race([current.done, new Promise((resolve, reject) => {
|
|
197
|
+
timer = setTimeout(() => resolve(this.get(owner, id)), Math.min(6e4, Math.max(0, waitMs)));
|
|
198
|
+
aborted = () => reject(signal?.reason ?? /* @__PURE__ */ new Error("Aborted"));
|
|
199
|
+
signal?.addEventListener("abort", aborted, { once: true });
|
|
200
|
+
})]);
|
|
201
|
+
} finally {
|
|
202
|
+
clearTimeout(timer);
|
|
203
|
+
if (aborted) signal?.removeEventListener("abort", aborted);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
async cancel(owner, id) {
|
|
207
|
+
const current = this.running.get(id);
|
|
208
|
+
if (current?.owner === owner) {
|
|
209
|
+
current.stop("cancelled");
|
|
210
|
+
return current.done;
|
|
211
|
+
}
|
|
212
|
+
return this.get(owner, id);
|
|
213
|
+
}
|
|
214
|
+
write(owner, id, chars, end = false) {
|
|
215
|
+
const current = this.running.get(id);
|
|
216
|
+
if (!current || current.owner !== owner || current.result.status !== "running" || !current.process.stdin?.writable) return false;
|
|
217
|
+
if (end) current.process.stdin.end(chars);
|
|
218
|
+
else current.process.stdin.write(chars);
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
shutdown() {
|
|
222
|
+
for (const command of this.running.values()) command.stop("cancelled");
|
|
223
|
+
}
|
|
224
|
+
prune(owner) {
|
|
225
|
+
if (Date.now() - (this.prunedAt.get(owner) ?? 0) < 6e4) return;
|
|
226
|
+
this.prunedAt.set(owner, Date.now());
|
|
227
|
+
const directory = this.directory(owner);
|
|
228
|
+
const completed = readdirSync(directory).filter((file) => file.endsWith(".json")).flatMap((file) => {
|
|
229
|
+
try {
|
|
230
|
+
const job = JSON.parse(readFileSync(join(directory, file), "utf8"));
|
|
231
|
+
return this.running.has(job.id) || job.status === "running" ? [] : [job];
|
|
232
|
+
} catch {
|
|
233
|
+
return [];
|
|
234
|
+
}
|
|
235
|
+
}).sort((a, b) => b.createdAtMs - a.createdAtMs);
|
|
236
|
+
for (const [index, job] of completed.entries()) {
|
|
237
|
+
if (index < 500 && Date.now() - job.createdAtMs < 10080 * 6e4) continue;
|
|
238
|
+
if (!/^[\da-f-]{36}$/.test(job.id)) continue;
|
|
239
|
+
rmSync(join(directory, `${job.id}.json`), { force: true });
|
|
240
|
+
rmSync(join(directory, `${job.id}.log`), { force: true });
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
list(owner) {
|
|
244
|
+
try {
|
|
245
|
+
return readdirSync(this.directory(owner)).filter((file) => file.endsWith(".json")).map((file) => this.get(owner, file.slice(0, -5))).filter((job) => !!job).sort((a, b) => b.createdAtMs - a.createdAtMs).slice(0, 50);
|
|
246
|
+
} catch {
|
|
247
|
+
return [];
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
function commandRegistry() {
|
|
252
|
+
return resolveGlobalSingleton(Symbol.for("xopc.commandRegistry"), () => {
|
|
253
|
+
const registry = new CommandRegistry();
|
|
254
|
+
process.once("exit", () => registry.shutdown());
|
|
255
|
+
return registry;
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
//#endregion
|
|
259
|
+
export { CommandRegistry, DEFAULT_COMMAND_TIMEOUT_MS, MAX_COMMAND_TIMEOUT_MS, commandRegistry, commandTimeout };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { abortEmbeddedRun, getEmbeddedRunBySessionKey, queueEmbeddedSteer } from "./runs.js";
|
|
1
2
|
import { DEFAULT_MAX_LIVE_TOOL_RESULT_CHARS, resolveLiveToolResultMaxChars, truncateToolResultMessage } from "./tool-result-truncation.js";
|
|
2
3
|
import { getRawSessionAppendMessage, guardSessionManager, installSessionToolResultGuard } from "./session-tool-result-guard.js";
|
|
3
4
|
import { acquireEmbeddedSessionRunner, buildEmbeddedRunnerFingerprint, evictAllEmbeddedSessionRunners, evictEmbeddedSessionRunner, getEmbeddedSessionRunnerIdleTtlMs, getEmbeddedSessionRunnerStats, isEmbeddedSessionRunnerEnabled, resetEmbeddedSessionRunnerForTest } from "./session-runner.js";
|
|
4
|
-
import { abortEmbeddedRun, getEmbeddedRunBySessionKey, queueEmbeddedSteer } from "./runs.js";
|
|
5
5
|
import { repairAssistantUsageInSessionManager } from "./session-manager-init.js";
|
|
6
6
|
import { openSqliteHydratingSessionManager } from "./sqlite-hydrating-session-manager.js";
|
|
7
7
|
import { InMemoryTranscriptRuntime, createSqliteTranscriptRuntime } from "./transcript-runtime.js";
|
|
@@ -6,9 +6,9 @@ import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profi
|
|
|
6
6
|
import { resolveAgentTurnTimeoutMs } from "../orchestration/run-agent-turn-with-timeout.js";
|
|
7
7
|
import { resolvePromptCachePolicy } from "../../providers/prompt-cache-plan.js";
|
|
8
8
|
import { evaluateContextBudget } from "../memory/context-budget.js";
|
|
9
|
+
import { runXopcEmbeddedTurn } from "./run-turn.js";
|
|
9
10
|
import { resolveCompactionPolicy } from "../memory/compaction-policy.js";
|
|
10
11
|
import { projectTurnOutcome } from "../../session/turn-outcome-projector.js";
|
|
11
|
-
import { runXopcEmbeddedTurn } from "./run-turn.js";
|
|
12
12
|
import { voicePresentationPrompt } from "../prompt/voice-presentation.js";
|
|
13
13
|
import { applyStartupContextToUserMessage } from "../reply/apply-turn-user-enrichment.js";
|
|
14
14
|
import { AgentRunSupervisor } from "../orchestration/agent-run-supervisor.js";
|
|
@@ -196,6 +196,7 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
196
196
|
turnPolicy,
|
|
197
197
|
abortSignal: supervisor.signal,
|
|
198
198
|
onEvent: params.onEvent,
|
|
199
|
+
onAgentEvent: (event) => agentManager.emitRuntimeEvent(sessionKey, event),
|
|
199
200
|
resumeLastUserMessage
|
|
200
201
|
});
|
|
201
202
|
if (turnResult.ok) {
|