diff --git a/CHANGELOG.md b/CHANGELOG.md index c879aa1ae..7ab76ab17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f ### Fixed +- **Sessions run on omp 18.22.** omp now ends a run once and pauses between loops; the runner maps that onto the same `agent_end`/`session_settled` frames as before, so completion, notifications and background-work settlement behave as they did. - **GitHub workflow watches no longer regress to stale run states.** Workflow updates retain GitHub's run timestamp and ignore older snapshots for the same or an earlier attempt, so a delayed `queued` response cannot follow a newer `in_progress` delivery. - **Keep sidebar transcript results aligned with expandable hits on every linked host.** Each daemon now searches its own active conversations, ignoring abandoned branches and pre-compaction messages. diff --git a/runner/bun.lock b/runner/bun.lock index 7f1bbdec9..051754a07 100644 --- a/runner/bun.lock +++ b/runner/bun.lock @@ -5,9 +5,9 @@ "": { "name": "@kahme247/ompweb-omp", "dependencies": { - "@oh-my-pi/pi-coding-agent": "file:./vendor/oh-my-pi-pi-coding-agent-18.20.0.tgz", - "@oh-my-pi/pi-natives": "file:./vendor/oh-my-pi-pi-natives-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-utils": "file:./vendor/oh-my-pi-pi-utils-18.20.0-int.202611131515.g11d9dc7.tgz", + "@oh-my-pi/pi-coding-agent": "file:./vendor/oh-my-pi-pi-coding-agent-18.22.0.tgz", + "@oh-my-pi/pi-natives": "file:./vendor/oh-my-pi-pi-natives-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-utils": "file:./vendor/oh-my-pi-pi-utils-18.22.0-int.202611171027.gec3956c.tgz", }, "devDependencies": { "@types/bun": "1.4.4", @@ -16,24 +16,24 @@ }, }, "overrides": { - "@oh-my-pi/omp-stats": "file:./vendor/oh-my-pi-omp-stats-18.20.0.tgz", - "@oh-my-pi/omptype": "file:./vendor/oh-my-pi-omptype-18.20.0.tgz", - "@oh-my-pi/pi-agent-core": "file:./vendor/oh-my-pi-pi-agent-core-18.20.0.tgz", - "@oh-my-pi/pi-ai": "file:./vendor/oh-my-pi-pi-ai-18.20.0.tgz", - "@oh-my-pi/pi-catalog": "file:./vendor/oh-my-pi-pi-catalog-18.20.0.tgz", - "@oh-my-pi/pi-coding-agent": "file:./vendor/oh-my-pi-pi-coding-agent-18.20.0.tgz", - "@oh-my-pi/pi-mnemopi": "file:./vendor/oh-my-pi-pi-mnemopi-18.20.0.tgz", - "@oh-my-pi/pi-natives": "file:./vendor/oh-my-pi-pi-natives-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-natives-darwin-arm64": "file:./vendor/oh-my-pi-pi-natives-darwin-arm64-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-natives-darwin-x64": "file:./vendor/oh-my-pi-pi-natives-darwin-x64-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-natives-linux-arm64": "file:./vendor/oh-my-pi-pi-natives-linux-arm64-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-natives-linux-x64": "file:./vendor/oh-my-pi-pi-natives-linux-x64-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-natives-win32-arm64": "file:./vendor/oh-my-pi-pi-natives-win32-arm64-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-natives-win32-x64": "file:./vendor/oh-my-pi-pi-natives-win32-x64-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-tui": "file:./vendor/oh-my-pi-pi-tui-18.20.0.tgz", - "@oh-my-pi/pi-utils": "file:./vendor/oh-my-pi-pi-utils-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-wire": "file:./vendor/oh-my-pi-pi-wire-18.20.0.tgz", - "@oh-my-pi/snapcompact": "file:./vendor/oh-my-pi-snapcompact-18.20.0.tgz", + "@oh-my-pi/omp-stats": "file:./vendor/oh-my-pi-omp-stats-18.22.0.tgz", + "@oh-my-pi/omptype": "file:./vendor/oh-my-pi-omptype-18.22.0.tgz", + "@oh-my-pi/pi-agent-core": "file:./vendor/oh-my-pi-pi-agent-core-18.22.0.tgz", + "@oh-my-pi/pi-ai": "file:./vendor/oh-my-pi-pi-ai-18.22.0.tgz", + "@oh-my-pi/pi-catalog": "file:./vendor/oh-my-pi-pi-catalog-18.22.0.tgz", + "@oh-my-pi/pi-coding-agent": "file:./vendor/oh-my-pi-pi-coding-agent-18.22.0.tgz", + "@oh-my-pi/pi-mnemopi": "file:./vendor/oh-my-pi-pi-mnemopi-18.22.0.tgz", + "@oh-my-pi/pi-natives": "file:./vendor/oh-my-pi-pi-natives-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-natives-darwin-arm64": "file:./vendor/oh-my-pi-pi-natives-darwin-arm64-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-natives-darwin-x64": "file:./vendor/oh-my-pi-pi-natives-darwin-x64-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-natives-linux-arm64": "file:./vendor/oh-my-pi-pi-natives-linux-arm64-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-natives-linux-x64": "file:./vendor/oh-my-pi-pi-natives-linux-x64-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-natives-win32-arm64": "file:./vendor/oh-my-pi-pi-natives-win32-arm64-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-natives-win32-x64": "file:./vendor/oh-my-pi-pi-natives-win32-x64-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-tui": "file:./vendor/oh-my-pi-pi-tui-18.22.0.tgz", + "@oh-my-pi/pi-utils": "file:./vendor/oh-my-pi-pi-utils-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-wire": "file:./vendor/oh-my-pi-pi-wire-18.22.0.tgz", + "@oh-my-pi/snapcompact": "file:./vendor/oh-my-pi-snapcompact-18.22.0.tgz", }, "packages": { "@babel/helper-string-parser": ["@babel/helper-string-parser@7.29.14", "", {}, "sha512-CXvKMFvM80ihI7Vox9jb+kQjnyjESQNPM+vB7U0Zz6TWuZA+Z/FL0QPMH300h33qJtIx+REeBhXqWOPW48TcAQ=="], @@ -44,41 +44,41 @@ "@babel/types": ["@babel/types@7.29.14", "", { "dependencies": { "@babel/helper-string-parser": "^7.29.14", "@babel/helper-validator-identifier": "^7.29.7" } }, "sha512-UjI/dKmwJwT9pOszJitq2G6EObZPnsZUfdCr92z2TlF3EZK9J3EdfOKUrCzHl6wFthbzwhzl1Soc/UIwxRiq6w=="], - "@oh-my-pi/omp-stats": ["@oh-my-pi/omp-stats@./vendor/oh-my-pi-omp-stats-18.20.0.tgz", { "dependencies": { "@oh-my-pi/pi-ai": "18.20.0", "@oh-my-pi/pi-catalog": "18.20.0", "@oh-my-pi/pi-utils": "18.20.0", "lucide-react": "^1.24.0", "react": "19.2.7", "react-dom": "19.2.7" }, "bin": { "omp-stats": "./src/index.ts" } }, "sha512-KIjc4TEwokONT0UZ5RxSRieHaL8zu3qnpxanP8YMSc1r0F+SzXkzynw9rS8Hxc61SBUCxM1Q+IgLXiw99M8Uhw=="], + "@oh-my-pi/omp-stats": ["@oh-my-pi/omp-stats@./vendor/oh-my-pi-omp-stats-18.22.0.tgz", { "dependencies": { "@oh-my-pi/pi-ai": "18.22.0", "@oh-my-pi/pi-catalog": "18.22.0", "@oh-my-pi/pi-utils": "18.22.0", "lucide-react": "^1.24.0", "react": "19.2.7", "react-dom": "19.2.7" }, "bin": { "omp-stats": "./src/index.ts" } }, "sha512-toiivpmsJ8hSu/8VMzR1ZixdEowbQ8GEBQ6Z0ujJKHaBLUog8n1z+nSpolWEWnxtDl3Hg9qrBAZu+sTHA8RdlA=="], - "@oh-my-pi/omptype": ["@oh-my-pi/omptype@./vendor/oh-my-pi-omptype-18.20.0.tgz", {}, "sha512-Z+Gbo56PjzzlM1IDnKna8bVD8zaEE+SWOGliuzG9NpalnXwK12NQki7vVP09N4IgDQdXK6jQmEg+VZbFFXLYSw=="], + "@oh-my-pi/omptype": ["@oh-my-pi/omptype@./vendor/oh-my-pi-omptype-18.22.0.tgz", {}, "sha512-qDAImekJF5lYntcJxRXnMXNIZeb8KRjz5H09kLl64v/2Mxi8dMwMhuK7LDr6ZqzNVMTlqglTkcv/aBp3kEKeTA=="], - "@oh-my-pi/pi-agent-core": ["@oh-my-pi/pi-agent-core@./vendor/oh-my-pi-pi-agent-core-18.20.0.tgz", { "dependencies": { "@oh-my-pi/pi-ai": "18.20.0", "@oh-my-pi/pi-catalog": "18.20.0", "@oh-my-pi/pi-natives": "18.20.0", "@oh-my-pi/pi-utils": "18.20.0", "@oh-my-pi/pi-wire": "18.20.0", "@oh-my-pi/snapcompact": "18.20.0", "@opentelemetry/api": "^1.9.1" } }, "sha512-NBkX95BovCEu2iCgfv/jq0OqcES+bTdBUJc+h7V8H0v5TGrDXm7VdKmBn09aN4AuUTO9TQ9oj+fQNONHEntODA=="], + "@oh-my-pi/pi-agent-core": ["@oh-my-pi/pi-agent-core@./vendor/oh-my-pi-pi-agent-core-18.22.0.tgz", { "dependencies": { "@oh-my-pi/pi-ai": "18.22.0", "@oh-my-pi/pi-catalog": "18.22.0", "@oh-my-pi/pi-natives": "18.22.0", "@oh-my-pi/pi-utils": "18.22.0", "@oh-my-pi/pi-wire": "18.22.0", "@oh-my-pi/snapcompact": "18.22.0", "@opentelemetry/api": "^1.9.1" } }, "sha512-AK6MUJlJ5PPuOOTFcAUnZ1LDvvLfKcdjKvy8D9aCt0NZg1y5qKMTcDqgYihO1vqNW8joYbXq0oJ0SLoawD/UUA=="], - "@oh-my-pi/pi-ai": ["@oh-my-pi/pi-ai@./vendor/oh-my-pi-pi-ai-18.20.0.tgz", { "dependencies": { "@oh-my-pi/omptype": "18.20.0", "@oh-my-pi/pi-catalog": "18.20.0", "@oh-my-pi/pi-natives": "18.20.0", "@oh-my-pi/pi-utils": "18.20.0", "@oh-my-pi/pi-wire": "18.20.0" } }, "sha512-nKiyG1GdOvF/lB7+1BJvGZunU+ScnKRcM4mL6hzVV4lMn5pxsTpdzY7VDhYooaPmYK/KjtRAPkbytJY5yriXvg=="], + "@oh-my-pi/pi-ai": ["@oh-my-pi/pi-ai@./vendor/oh-my-pi-pi-ai-18.22.0.tgz", { "dependencies": { "@oh-my-pi/omptype": "18.22.0", "@oh-my-pi/pi-catalog": "18.22.0", "@oh-my-pi/pi-natives": "18.22.0", "@oh-my-pi/pi-utils": "18.22.0", "@oh-my-pi/pi-wire": "18.22.0" } }, "sha512-tjNbdCxAzTchMO+aqjk/Wic/8HmRSDY0VCGh89LCeDPVvIYlYDiK45Y77eW6ybf/IfMtQXNtkazRvQcAClaREQ=="], - "@oh-my-pi/pi-catalog": ["@oh-my-pi/pi-catalog@./vendor/oh-my-pi-pi-catalog-18.20.0.tgz", { "dependencies": { "@oh-my-pi/omptype": "18.20.0", "@oh-my-pi/pi-utils": "18.20.0" } }, "sha512-dvW4aF9GW9myjosmrDau7cllISORh83BKdMRzaISCqgeJdJodvyH56GXSRjCFu9H8/Oz/0gO8/VaZiRM2TNJQg=="], + "@oh-my-pi/pi-catalog": ["@oh-my-pi/pi-catalog@./vendor/oh-my-pi-pi-catalog-18.22.0.tgz", { "dependencies": { "@oh-my-pi/omptype": "18.22.0", "@oh-my-pi/pi-utils": "18.22.0" } }, "sha512-Wvx12nojDBXEjeJzC0h3qyAwjc2au0f9/c256Pna6VHe7NeHYWHkzG2oEL0gWpY6r2/B3Eygw2HIj5R64n+chA=="], - "@oh-my-pi/pi-coding-agent": ["@oh-my-pi/pi-coding-agent@./vendor/oh-my-pi-pi-coding-agent-18.20.0.tgz", { "dependencies": { "@babel/parser": "^7.29.7", "@oh-my-pi/omp-stats": "18.20.0", "@oh-my-pi/omptype": "18.20.0", "@oh-my-pi/pi-agent-core": "18.20.0", "@oh-my-pi/pi-ai": "18.20.0", "@oh-my-pi/pi-catalog": "18.20.0", "@oh-my-pi/pi-mnemopi": "18.20.0", "@oh-my-pi/pi-natives": "18.20.0", "@oh-my-pi/pi-tui": "18.20.0", "@oh-my-pi/pi-utils": "18.20.0", "@oh-my-pi/pi-wire": "18.20.0", "@oh-my-pi/snapcompact": "18.20.0", "@opentelemetry/api": "^1.9.1", "@opentelemetry/api-logs": "^0.220.0", "@opentelemetry/context-async-hooks": "2.9.0", "@opentelemetry/exporter-logs-otlp-proto": "^0.220.0", "@opentelemetry/exporter-metrics-otlp-proto": "^0.220.0", "@opentelemetry/exporter-trace-otlp-proto": "^0.220.0", "@opentelemetry/resources": "2.9.0", "@opentelemetry/sdk-logs": "^0.220.0", "@opentelemetry/sdk-metrics": "2.9.0", "@opentelemetry/sdk-trace-base": "2.9.0", "@opentelemetry/sdk-trace-node": "2.9.0", "axe-core": "4.13.0", "puppeteer-core": "25.3.0", "yaml": "2.9.1" }, "bin": { "omp": "dist/cli.js" } }, "sha512-d0AOI4AAbUgHBhnv2kMNDaBKJWZLHJEbZcsgSpGEPczpsqaHxJFTDeCehvx3Z12AAEaFCojd4FCiRQzB8qd/iA=="], + "@oh-my-pi/pi-coding-agent": ["@oh-my-pi/pi-coding-agent@./vendor/oh-my-pi-pi-coding-agent-18.22.0.tgz", { "dependencies": { "@babel/parser": "^7.29.7", "@oh-my-pi/omp-stats": "18.22.0", "@oh-my-pi/omptype": "18.22.0", "@oh-my-pi/pi-agent-core": "18.22.0", "@oh-my-pi/pi-ai": "18.22.0", "@oh-my-pi/pi-catalog": "18.22.0", "@oh-my-pi/pi-mnemopi": "18.22.0", "@oh-my-pi/pi-natives": "18.22.0", "@oh-my-pi/pi-tui": "18.22.0", "@oh-my-pi/pi-utils": "18.22.0", "@oh-my-pi/pi-wire": "18.22.0", "@oh-my-pi/snapcompact": "18.22.0", "@opentelemetry/api": "^1.9.1", "@opentelemetry/api-logs": "^0.220.0", "@opentelemetry/context-async-hooks": "2.9.0", "@opentelemetry/exporter-logs-otlp-proto": "^0.220.0", "@opentelemetry/exporter-metrics-otlp-proto": "^0.220.0", "@opentelemetry/exporter-trace-otlp-proto": "^0.220.0", "@opentelemetry/resources": "2.9.0", "@opentelemetry/sdk-logs": "^0.220.0", "@opentelemetry/sdk-metrics": "2.9.0", "@opentelemetry/sdk-trace-base": "2.9.0", "@opentelemetry/sdk-trace-node": "2.9.0", "axe-core": "4.13.0", "puppeteer-core": "25.3.0", "yaml": "2.9.1" }, "bin": { "omp": "dist/cli.js" } }, "sha512-XUPUvs6RcD+Zph2axxCs3SLZ1F/EZxtlXZuuA5mmqPUB7FzXCBp1+L/wIXBPgq2Xu1BdLNgSXxHguXRmmc2quw=="], - "@oh-my-pi/pi-mnemopi": ["@oh-my-pi/pi-mnemopi@./vendor/oh-my-pi-pi-mnemopi-18.20.0.tgz", { "dependencies": { "@oh-my-pi/pi-ai": "18.20.0", "@oh-my-pi/pi-catalog": "18.20.0", "@oh-my-pi/pi-natives": "18.20.0", "@oh-my-pi/pi-utils": "18.20.0" }, "peerDependencies": { "fastembed": "3.0.0", "onnxruntime-node": "1.21.0" }, "optionalPeers": ["fastembed", "onnxruntime-node"], "bin": { "mnemopi": "src/cli.ts" } }, "sha512-cNUCh9uWyAwpKVf7jLO6bq3HQDHIw3Ydn39EMqY3tuounFZDpx7K+eQ4MzSUPrnv5a5ztaJjF38brBmNFYjLgQ=="], + "@oh-my-pi/pi-mnemopi": ["@oh-my-pi/pi-mnemopi@./vendor/oh-my-pi-pi-mnemopi-18.22.0.tgz", { "dependencies": { "@oh-my-pi/pi-ai": "18.22.0", "@oh-my-pi/pi-catalog": "18.22.0", "@oh-my-pi/pi-natives": "18.22.0", "@oh-my-pi/pi-utils": "18.22.0" }, "peerDependencies": { "fastembed": "3.0.0", "onnxruntime-node": "1.21.0" }, "optionalPeers": ["fastembed", "onnxruntime-node"], "bin": { "mnemopi": "src/cli.ts" } }, "sha512-4YjangqvGNNaiukrr3nD8qoi88RLGSI9dKwCmVjVGPKCQEg6YRLO2r80Gs7q2lRnaNtdcjcs5tEs4cWOjMWrEQ=="], - "@oh-my-pi/pi-natives": ["@oh-my-pi/pi-natives@./vendor/oh-my-pi-pi-natives-18.20.0-int.202611131515.g11d9dc7.tgz", { "optionalDependencies": { "@oh-my-pi/pi-natives-darwin-arm64": "18.20.0-int.202611131515.g11d9dc7", "@oh-my-pi/pi-natives-darwin-x64": "18.20.0-int.202611131515.g11d9dc7", "@oh-my-pi/pi-natives-linux-arm64": "18.20.0-int.202611131515.g11d9dc7", "@oh-my-pi/pi-natives-linux-x64": "18.20.0-int.202611131515.g11d9dc7", "@oh-my-pi/pi-natives-win32-arm64": "18.20.0-int.202611131515.g11d9dc7", "@oh-my-pi/pi-natives-win32-x64": "18.20.0-int.202611131515.g11d9dc7" } }, "sha512-yAqFgPHDyC4QfGHH73vwjaio3y17FvE9B3aLVjeFdT24oEB60MP5LZmYxwqAhbztdWY/iKdSNw0ONA9TGLDpFA=="], + "@oh-my-pi/pi-natives": ["@oh-my-pi/pi-natives@./vendor/oh-my-pi-pi-natives-18.22.0-int.202611171027.gec3956c.tgz", { "optionalDependencies": { "@oh-my-pi/pi-natives-darwin-arm64": "18.22.0-int.202611171027.gec3956c", "@oh-my-pi/pi-natives-darwin-x64": "18.22.0-int.202611171027.gec3956c", "@oh-my-pi/pi-natives-linux-arm64": "18.22.0-int.202611171027.gec3956c", "@oh-my-pi/pi-natives-linux-x64": "18.22.0-int.202611171027.gec3956c", "@oh-my-pi/pi-natives-win32-arm64": "18.22.0-int.202611171027.gec3956c", "@oh-my-pi/pi-natives-win32-x64": "18.22.0-int.202611171027.gec3956c" } }, "sha512-P/9yFrzeAUw6Kj2NpASbR8lOOPCaNxb/9Eh/SWFddXu4Zb6SBKQDZmgfwt4gQT6d6HXw/VT100o6pQNjCbOUUg=="], - "@oh-my-pi/pi-natives-darwin-arm64": ["@oh-my-pi/pi-natives-darwin-arm64@./vendor/oh-my-pi-pi-natives-darwin-arm64-18.20.0-int.202611131515.g11d9dc7.tgz", {}, "sha512-JdQYZAoYLD3hmWC+XJd7eIa0ezTm1JsQDFdpSYGqWtsa10HidnWDF4/FEsNSuEh3VfZx4lrHyb5K/YOws/3E9Q=="], + "@oh-my-pi/pi-natives-darwin-arm64": ["@oh-my-pi/pi-natives-darwin-arm64@./vendor/oh-my-pi-pi-natives-darwin-arm64-18.22.0-int.202611171027.gec3956c.tgz", {}, "sha512-KRE7kZEp3Ra7y3Na2kdg8MS5hmFoABRrsEIOQP7yRPHeZBedWq0GOZmb2cZdz7KO3K2r2lLL6mRnPL7jMQICcw=="], - "@oh-my-pi/pi-natives-darwin-x64": ["@oh-my-pi/pi-natives-darwin-x64@./vendor/oh-my-pi-pi-natives-darwin-x64-18.20.0-int.202611131515.g11d9dc7.tgz", {}, "sha512-ZvQ+vVRv/w88LLbzriOTWBISvJB1RWTG6QeSifDZm+hWE8LOvWqlhVCCZNqhXmrnJnAJzkcRZ9hvQ0LdrDrgqg=="], + "@oh-my-pi/pi-natives-darwin-x64": ["@oh-my-pi/pi-natives-darwin-x64@./vendor/oh-my-pi-pi-natives-darwin-x64-18.22.0-int.202611171027.gec3956c.tgz", {}, "sha512-nzo+CJiqBqN9K1bYLKB4JoNpdOpT1whi1qjx370dBRiPNwWQ3IkPytr5kzcxgET3gHYmsmAzEimEC/ODXsubjg=="], - "@oh-my-pi/pi-natives-linux-arm64": ["@oh-my-pi/pi-natives-linux-arm64@./vendor/oh-my-pi-pi-natives-linux-arm64-18.20.0-int.202611131515.g11d9dc7.tgz", {}, "sha512-+gkkfbQtGq3v8uWB5IeNvJg2P9RW4Qyd/bpwXbG8xIA0pTH2TZbQ3inS+4W9al0Fv8LxzRxDZOS3vtClVYXoTw=="], + "@oh-my-pi/pi-natives-linux-arm64": ["@oh-my-pi/pi-natives-linux-arm64@./vendor/oh-my-pi-pi-natives-linux-arm64-18.22.0-int.202611171027.gec3956c.tgz", {}, "sha512-i+ibukGVJHgLLclN9L73tCBmNsuAQ6e6xQrAAV3X/EgqSDm/L6yGf3TlZxxfvAGbMTsYE+VaU6WAT9747AjBWA=="], - "@oh-my-pi/pi-natives-linux-x64": ["@oh-my-pi/pi-natives-linux-x64@./vendor/oh-my-pi-pi-natives-linux-x64-18.20.0-int.202611131515.g11d9dc7.tgz", {}, "sha512-+3NBcj1sw5ICLJi7VDCvtZpQ5stvqXce21KNWKx03LwiF+Sme9Wiyk2VGk+nyfcVacGrTuk6AhwtN11IWTPirg=="], + "@oh-my-pi/pi-natives-linux-x64": ["@oh-my-pi/pi-natives-linux-x64@./vendor/oh-my-pi-pi-natives-linux-x64-18.22.0-int.202611171027.gec3956c.tgz", {}, "sha512-W38MEoSMpRpVBvp0AAh1VB5KSn/EG7QrXiq4DPIqgJrxl5bodg5+TrdL2PE/yMUjXtKyA3QAZdSsJ3qBfDfAcQ=="], - "@oh-my-pi/pi-natives-win32-arm64": ["@oh-my-pi/pi-natives-win32-arm64@./vendor/oh-my-pi-pi-natives-win32-arm64-18.20.0-int.202611131515.g11d9dc7.tgz", {}, "sha512-bMplxB8IYfztG+y75uC5Tk3LaKhBtz79oIG+T9jzV4BDcw30ytz0z45MQ7HIJcY5o1kick0Irz/EIb/406NRvQ=="], + "@oh-my-pi/pi-natives-win32-arm64": ["@oh-my-pi/pi-natives-win32-arm64@./vendor/oh-my-pi-pi-natives-win32-arm64-18.22.0-int.202611171027.gec3956c.tgz", {}, "sha512-4c56sQq0WjVlyuuwD4lhiksWthWtD/J6TwufR7EWtygHyb/Q7XB2BRelVv1J0uVuLtIG82VGGGbtQThLVBktFA=="], - "@oh-my-pi/pi-natives-win32-x64": ["@oh-my-pi/pi-natives-win32-x64@./vendor/oh-my-pi-pi-natives-win32-x64-18.20.0-int.202611131515.g11d9dc7.tgz", {}, "sha512-DV///y1oYQpUa7+wcojYBzx20f4C+CeoBKWzuli8ou7isTpBN5MTFzt6BnEmjNRvzokUc0ZT7k9TAeFuMe2fbQ=="], + "@oh-my-pi/pi-natives-win32-x64": ["@oh-my-pi/pi-natives-win32-x64@./vendor/oh-my-pi-pi-natives-win32-x64-18.22.0-int.202611171027.gec3956c.tgz", {}, "sha512-Cwg5wdE9aRFoey6+0sPKiSpNudk9Fd62MCwWzO2NsQYcpjPnTQcMjk7ri1Ml4ZJXvYjPeQFtG7XiZlicLnTsAA=="], - "@oh-my-pi/pi-tui": ["@oh-my-pi/pi-tui@./vendor/oh-my-pi-pi-tui-18.20.0.tgz", { "dependencies": { "@oh-my-pi/omptype": "18.20.0", "@oh-my-pi/pi-agent-core": "18.20.0", "@oh-my-pi/pi-ai": "18.20.0", "@oh-my-pi/pi-catalog": "18.20.0", "@oh-my-pi/pi-natives": "18.20.0", "@oh-my-pi/pi-utils": "18.20.0", "@oh-my-pi/pi-wire": "18.20.0", "@oh-my-pi/snapcompact": "18.20.0" } }, "sha512-Lxmg7twgyCCNUCpor4mWrQA3RMZhnoGt//Xbbvl7aNHXImxO2FLPC+W4LvaeFNHikGc4vv1RT9YqKpCvN49yQw=="], + "@oh-my-pi/pi-tui": ["@oh-my-pi/pi-tui@./vendor/oh-my-pi-pi-tui-18.22.0.tgz", { "dependencies": { "@oh-my-pi/omptype": "18.22.0", "@oh-my-pi/pi-agent-core": "18.22.0", "@oh-my-pi/pi-ai": "18.22.0", "@oh-my-pi/pi-catalog": "18.22.0", "@oh-my-pi/pi-natives": "18.22.0", "@oh-my-pi/pi-utils": "18.22.0", "@oh-my-pi/pi-wire": "18.22.0", "@oh-my-pi/snapcompact": "18.22.0" } }, "sha512-kJkK0/zaUbPEJ6jl/NQm2wizb8b+okh44BVN8YynVwx6py4jdNePg3/9UZCEq23BrI0vjr/ybjY0bXvXpvmnbQ=="], - "@oh-my-pi/pi-utils": ["@oh-my-pi/pi-utils@./vendor/oh-my-pi-pi-utils-18.20.0-int.202611131515.g11d9dc7.tgz", { "dependencies": { "@oh-my-pi/omptype": "18.20.0", "@oh-my-pi/pi-natives": "18.20.0" } }, "sha512-DNOzJE3hXBvFEjcHfQ+eRjbsT0BhbsSFBDESMP/DOKXbNtzKkkcM3m4zQAP9CP+xvlFGvH85fdYUWgYDlsdUTg=="], + "@oh-my-pi/pi-utils": ["@oh-my-pi/pi-utils@./vendor/oh-my-pi-pi-utils-18.22.0-int.202611171027.gec3956c.tgz", { "dependencies": { "@oh-my-pi/omptype": "18.22.0", "@oh-my-pi/pi-natives": "18.22.0" } }, "sha512-pY6B2gKfXXQ6J98txy192geX9MryPvUaDnOaernD08l1DTH/WT/BfRszcAMvL00GJmcCRhKaHCDOSuib60kbyg=="], - "@oh-my-pi/pi-wire": ["@oh-my-pi/pi-wire@./vendor/oh-my-pi-pi-wire-18.20.0.tgz", {}, "sha512-fiwQsxyxwb6eGLgg8QFWU6SKB/4K12wDEhRhgPzLL0O/Q5kExDnMndMp7TDFSX8Ysn6/jkU/Fn/CvWW9UXVAbg=="], + "@oh-my-pi/pi-wire": ["@oh-my-pi/pi-wire@./vendor/oh-my-pi-pi-wire-18.22.0.tgz", {}, "sha512-LkDkljPyjuBAqlJ7mgHhuyfqQqq3lZqPgPRgLZy4Bn+NF0/ZqhRZF3C540zakcdUjYTAuIypMoKOKCBuKZUqtA=="], - "@oh-my-pi/snapcompact": ["@oh-my-pi/snapcompact@./vendor/oh-my-pi-snapcompact-18.20.0.tgz", { "dependencies": { "@oh-my-pi/omptype": "18.20.0", "@oh-my-pi/pi-ai": "18.20.0", "@oh-my-pi/pi-catalog": "18.20.0", "@oh-my-pi/pi-natives": "18.20.0", "@oh-my-pi/pi-utils": "18.20.0", "@oh-my-pi/pi-wire": "18.20.0" } }, "sha512-z7OahHZ21VUwnU/rZlJpzBYC0ibJPCiEaytGuegOXfpbxRjLIHhEGxycRRW9I26dA9s/mEqiTX/Q3rdDBPsYcg=="], + "@oh-my-pi/snapcompact": ["@oh-my-pi/snapcompact@./vendor/oh-my-pi-snapcompact-18.22.0.tgz", { "dependencies": { "@oh-my-pi/omptype": "18.22.0", "@oh-my-pi/pi-ai": "18.22.0", "@oh-my-pi/pi-catalog": "18.22.0", "@oh-my-pi/pi-natives": "18.22.0", "@oh-my-pi/pi-utils": "18.22.0", "@oh-my-pi/pi-wire": "18.22.0" } }, "sha512-vxTp6+C5gOpewGfa9KK8atUnRu40RxJzBbJxJX3Pt4aubHWSVb8SFbEoOrFbJV1HUv3LgI0fqIKKM/1sSW0uBA=="], "@opentelemetry/api": ["@opentelemetry/api@1.10.0", "", {}, "sha512-lMkyes8iHrG+mk6WH7X70MdCLI2RS0FwNBY1PyQ8UemaijE2m5mv5A0Niy3HtbYTFrgkUEQjFMXmSAk2hQDuPQ=="], diff --git a/runner/omp-build.json b/runner/omp-build.json index 40ab09256..6da33a103 100644 --- a/runner/omp-build.json +++ b/runner/omp-build.json @@ -1,4 +1,4 @@ { "repo": "ompweb-dev/oh-my-pi", - "tag": "v18.20.0-int.202611131515.g11d9dc7" + "tag": "v18.22.0-int.202611171027.gec3956c" } diff --git a/runner/package.json b/runner/package.json index 083cb6b85..c9a9b4a6a 100644 --- a/runner/package.json +++ b/runner/package.json @@ -6,32 +6,32 @@ "build": "bun scripts/build-binary.ts" }, "dependencies": { - "@oh-my-pi/pi-coding-agent": "file:./vendor/oh-my-pi-pi-coding-agent-18.20.0.tgz", - "@oh-my-pi/pi-natives": "file:./vendor/oh-my-pi-pi-natives-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-utils": "file:./vendor/oh-my-pi-pi-utils-18.20.0-int.202611131515.g11d9dc7.tgz" + "@oh-my-pi/pi-coding-agent": "file:./vendor/oh-my-pi-pi-coding-agent-18.22.0.tgz", + "@oh-my-pi/pi-natives": "file:./vendor/oh-my-pi-pi-natives-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-utils": "file:./vendor/oh-my-pi-pi-utils-18.22.0-int.202611171027.gec3956c.tgz" }, "devDependencies": { "@types/bun": "1.4.4", "typescript": "7.0.2" }, "overrides": { - "@oh-my-pi/omp-stats": "file:./vendor/oh-my-pi-omp-stats-18.20.0.tgz", - "@oh-my-pi/omptype": "file:./vendor/oh-my-pi-omptype-18.20.0.tgz", - "@oh-my-pi/pi-agent-core": "file:./vendor/oh-my-pi-pi-agent-core-18.20.0.tgz", - "@oh-my-pi/pi-ai": "file:./vendor/oh-my-pi-pi-ai-18.20.0.tgz", - "@oh-my-pi/pi-catalog": "file:./vendor/oh-my-pi-pi-catalog-18.20.0.tgz", - "@oh-my-pi/pi-coding-agent": "file:./vendor/oh-my-pi-pi-coding-agent-18.20.0.tgz", - "@oh-my-pi/pi-mnemopi": "file:./vendor/oh-my-pi-pi-mnemopi-18.20.0.tgz", - "@oh-my-pi/pi-natives": "file:./vendor/oh-my-pi-pi-natives-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-natives-darwin-arm64": "file:./vendor/oh-my-pi-pi-natives-darwin-arm64-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-natives-darwin-x64": "file:./vendor/oh-my-pi-pi-natives-darwin-x64-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-natives-linux-arm64": "file:./vendor/oh-my-pi-pi-natives-linux-arm64-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-natives-linux-x64": "file:./vendor/oh-my-pi-pi-natives-linux-x64-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-natives-win32-arm64": "file:./vendor/oh-my-pi-pi-natives-win32-arm64-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-natives-win32-x64": "file:./vendor/oh-my-pi-pi-natives-win32-x64-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-tui": "file:./vendor/oh-my-pi-pi-tui-18.20.0.tgz", - "@oh-my-pi/pi-utils": "file:./vendor/oh-my-pi-pi-utils-18.20.0-int.202611131515.g11d9dc7.tgz", - "@oh-my-pi/pi-wire": "file:./vendor/oh-my-pi-pi-wire-18.20.0.tgz", - "@oh-my-pi/snapcompact": "file:./vendor/oh-my-pi-snapcompact-18.20.0.tgz" + "@oh-my-pi/omp-stats": "file:./vendor/oh-my-pi-omp-stats-18.22.0.tgz", + "@oh-my-pi/omptype": "file:./vendor/oh-my-pi-omptype-18.22.0.tgz", + "@oh-my-pi/pi-agent-core": "file:./vendor/oh-my-pi-pi-agent-core-18.22.0.tgz", + "@oh-my-pi/pi-ai": "file:./vendor/oh-my-pi-pi-ai-18.22.0.tgz", + "@oh-my-pi/pi-catalog": "file:./vendor/oh-my-pi-pi-catalog-18.22.0.tgz", + "@oh-my-pi/pi-coding-agent": "file:./vendor/oh-my-pi-pi-coding-agent-18.22.0.tgz", + "@oh-my-pi/pi-mnemopi": "file:./vendor/oh-my-pi-pi-mnemopi-18.22.0.tgz", + "@oh-my-pi/pi-natives": "file:./vendor/oh-my-pi-pi-natives-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-natives-darwin-arm64": "file:./vendor/oh-my-pi-pi-natives-darwin-arm64-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-natives-darwin-x64": "file:./vendor/oh-my-pi-pi-natives-darwin-x64-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-natives-linux-arm64": "file:./vendor/oh-my-pi-pi-natives-linux-arm64-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-natives-linux-x64": "file:./vendor/oh-my-pi-pi-natives-linux-x64-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-natives-win32-arm64": "file:./vendor/oh-my-pi-pi-natives-win32-arm64-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-natives-win32-x64": "file:./vendor/oh-my-pi-pi-natives-win32-x64-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-tui": "file:./vendor/oh-my-pi-pi-tui-18.22.0.tgz", + "@oh-my-pi/pi-utils": "file:./vendor/oh-my-pi-pi-utils-18.22.0-int.202611171027.gec3956c.tgz", + "@oh-my-pi/pi-wire": "file:./vendor/oh-my-pi-pi-wire-18.22.0.tgz", + "@oh-my-pi/snapcompact": "file:./vendor/oh-my-pi-snapcompact-18.22.0.tgz" } } diff --git a/runner/src/commands/model.ts b/runner/src/commands/model.ts index 1f2769ea8..15466afa9 100644 --- a/runner/src/commands/model.ts +++ b/runner/src/commands/model.ts @@ -27,7 +27,7 @@ export function sessionState(session: AgentSession) { sessionName: session.sessionName, autoCompactionEnabled: session.autoCompactionEnabled, queuedMessageCount: session.queuedMessageCount, - hasPendingAsyncWork: session.hasPendingAsyncWork(), + hasPendingAsyncWork: session.wakeSources !== undefined, isSettled: isSessionSettled(session), queuedMessages: { steering: [...queued.steering], diff --git a/runner/src/commands/session.ts b/runner/src/commands/session.ts index 53180fe97..37b5c7aad 100644 --- a/runner/src/commands/session.ts +++ b/runner/src/commands/session.ts @@ -310,7 +310,7 @@ export const sessionCommands: CommandTable = { async edit_message(ctx, args) { const { session } = ctx; const entryId = requiredString("edit_message", args, "entryId"); - if (session.isBusyForSnapshot || session.hasPendingAsyncWork()) { + if (session.isBusyForSnapshot || session.isRunActive) { throw new CommandError("Cannot edit while the agent is running", "session_busy"); } const entry = session.sessionManager.getEntry(entryId); diff --git a/runner/src/events.ts b/runner/src/events.ts index 0262d2334..d5e62d8f7 100644 --- a/runner/src/events.ts +++ b/runner/src/events.ts @@ -10,7 +10,8 @@ * switches to full until the message ends, then back to delta. * * Events that are not plain AgentSession events: - * session_settled {type} the session went quiet after activity ({@link SessionSettleWatcher}) + * agent_end {type, messages, isTerminal, yielded, awaitingAsyncWork?} one per stopped model loop: omp's `agent_pause` is `isTerminal: false`, the run's `agent_end` `isTerminal: true`, both via omp's `toWireEvent` + * session_settled {type} the session went quiet after activity (omp's `RpcSessionSettleWatcher`) * available_commands_update {type, commands} at subscribe, on command-metadata change, after a session change * session_info_update {type, title?, sessionId} the session name changed (TUI /rename, auto title, host rename) * notice (source "session-persistence") {type, level, message, source} store failure (error) or session moved to a new file (warning) @@ -20,10 +21,10 @@ */ import type { AssistantMessage, AssistantMessageEvent } from "@oh-my-pi/pi-ai"; import { formatPersistenceFailure, formatPersistenceNotice } from "@oh-my-pi/pi-coding-agent/modes/persistence-failure"; +import { RpcSessionSettleWatcher, watchedScheduledTurnProbe } from "@oh-my-pi/pi-coding-agent/modes/rpc/rpc-session-settle"; import type { AgentSession, AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; -import { isSessionSettled, waitForSessionSettlement } from "@oh-my-pi/pi-coding-agent/session/session-settle"; +import { toWireEvent, type WireSessionEvent } from "@oh-my-pi/pi-coding-agent/session/loop-end-wire"; import { buildAvailableSlashCommands } from "@oh-my-pi/pi-coding-agent/slash-commands/available-commands"; -import { logger } from "@oh-my-pi/pi-utils"; import type { CommandContext, CommandTable } from "./commands/types"; import { onClientQueueChange, stampClientMessageId } from "./correlation"; @@ -115,7 +116,9 @@ class SessionEventForwarder { return this.#filter ? Array.from(this.#filter) : null; } - forward(event: AgentSessionEvent): void { + forward(sessionEvent: AgentSessionEvent): void { + // Loop pauses and the run's end go out as per-loop `agent_end` frames (isTerminal/yielded), the shape ompweb reads. + const event = toWireEvent(sessionEvent); const messageId = this.#stamp(event); if (this.#filter && !this.#filter.has(event.type)) return; if (event.type === "message_update" && this.#messageUpdates === "delta") { @@ -130,7 +133,7 @@ class SessionEventForwarder { this.#output(messageId === undefined ? event : { ...event, messageId }); } - #stamp(event: AgentSessionEvent): string | undefined { + #stamp(event: WireSessionEvent): string | undefined { switch (event.type) { case "message_start": { const messageId = this.#mintMessageId(); @@ -161,79 +164,9 @@ class SessionEventForwarder { } } -async function nextMacrotask(): Promise { - const { promise, resolve } = Promise.withResolvers(); - setImmediate(resolve); - await promise; -} - -/** - * Emits `session_settled` once per stretch of agent activity, after the final run yields and background work - * that could wake the session has drained. Re-checks on every terminal `agent_end` and after session transitions. - */ -class SessionSettleWatcher { - /** Agent activity since the last `session_settled`. */ - #active = false; - #checking = false; - #recheck = false; - readonly #session: AgentSession; - readonly #output: (frame: object) => void; - readonly #scheduledTurn: () => boolean; - - constructor(session: AgentSession, output: (frame: object) => void, scheduledTurn: () => boolean) { - this.#session = session; - this.#output = output; - this.#scheduledTurn = scheduledTurn; - } - - observe(event: AgentSessionEvent): void { - if (event.type === "agent_start") this.#active = true; - else if (event.type === "agent_end" && event.isTerminal !== false) void this.check(); - } - - /** Record activity no `agent_start` announces (a reported pending goal turn), so its stretch still settles. */ - markActive(): void { - this.#active = true; - } - - /** - * Settle the current stretch of activity if the session is quiet, waiting out background work that will wake - * it. A live run is left alone: its own terminal `agent_end` triggers the next check. - */ - async check(): Promise { - if (this.#checking) { - this.#recheck = true; - return; - } - this.#checking = true; - try { - do { - this.#recheck = false; - // Two hops: prompt_result frames for this yield are written one macrotask after it, and - // session_settled must follow them. - await nextMacrotask(); - await nextMacrotask(); - if (this.#active) { - await waitForSessionSettlement(this.#session, { - isCurrent: () => this.#active, - scheduledTurn: this.#scheduledTurn, - }); - } - } while (this.#recheck); - if (!this.#active || !isSessionSettled(this.#session, this.#scheduledTurn)) return; - this.#active = false; - this.#output({ type: "session_settled" }); - } catch (error) { - logger.warn("ompweb: session settle check failed", { error: String(error) }); - } finally { - this.#checking = false; - } - } -} - interface HostEvents { forwarder: SessionEventForwarder; - settle: SessionSettleWatcher; + settle: RpcSessionSettleWatcher; emitCommands(): Promise; } @@ -244,7 +177,7 @@ const scheduledTurns = new WeakMap boolean>(); export function subscribeHostEvents(session: AgentSession, send: CommandContext["send"]): () => void { const event = (frame: object) => send({ t: "event", event: frame }); const forwarder = new SessionEventForwarder(event); - const settle = new SessionSettleWatcher(session, event, () => scheduledTurns.get(session)?.() ?? false); + const settle = new RpcSessionSettleWatcher(session, event, () => scheduledTurns.get(session)?.() ?? false); const emitCommands = async () => { event({ type: "available_commands_update", commands: await buildAvailableSlashCommands(session) }); }; @@ -282,19 +215,15 @@ export function subscribeHostEvents(session: AgentSession, send: CommandContext[ */ export function scheduledTurnProbe(session: AgentSession, pending: () => boolean): () => boolean { scheduledTurns.set(session, pending); - return () => { - const isPending = pending(); - if (isPending) bridges.get(session)?.settle.markActive(); - return isPending; - }; + return watchedScheduledTurnProbe(pending, () => bridges.get(session)?.settle); } -/** Re-check settlement where no terminal `agent_end` will (an abandoned goal turn, a prompt that settled without a run). */ +/** Re-check settlement where no run `agent_end` will (an abandoned goal turn, a prompt that settled without a run). */ export function checkSettled(session: AgentSession): void { void bridges.get(session)?.settle.check(); } -/** After new/switch/branch/fork/open session: the detached run sends no terminal `agent_end`, and the command catalog may differ. */ +/** After new/switch/branch/fork/open session: the detached run sends no `agent_end`, and the command catalog may differ. */ export async function afterSessionChange(session: AgentSession): Promise { const bridge = bridges.get(session); if (!bridge) return; diff --git a/runner/src/goal.ts b/runner/src/goal.ts index 0e769c87d..ad4b7bfe1 100644 --- a/runner/src/goal.ts +++ b/runner/src/goal.ts @@ -29,7 +29,7 @@ export class GoalController { readonly #session: AgentSession; /** Active tool set before goal mode added `goal`; restored when the goal ends. */ #previousTools: string[] | undefined; - /** Continuation turns submitted whose terminal `agent_end` has not arrived. */ + /** Continuation turns submitted whose run has not reached its `agent_end`. */ #pendingContinuationTurns = 0; #previousContinuationActivity: string | undefined; /** A continuation turn made no new progress; wait for the host before continuing. */ @@ -307,7 +307,7 @@ export class GoalController { } return; } - if (event.type !== "agent_end" || event.isTerminal === false) return; + if (event.type !== "agent_end") return; if (this.#pendingContinuationTurns > 0) { this.#pendingContinuationTurns--; const activity = goalContinuationActivity(event.messages); diff --git a/runner/src/prompt-results.ts b/runner/src/prompt-results.ts index dce033924..4e23a8f3e 100644 --- a/runner/src/prompt-results.ts +++ b/runner/src/prompt-results.ts @@ -1,8 +1,8 @@ /** * `prompt_result` reporting: every accepted `prompt`/`abort_and_prompt` not answered with `agentInvoked: false` * gets exactly one `{t:"prompt_result", id, agentInvoked, status, sessionSettled, error?}` once the work it caused - * has yielded: at once for local-only slash commands and failures, else after the terminal `agent_end` of the run - * the prompt started or joined. The host correlates on the cmd `id` instead of guessing who owns an `agent_end`. + * has yielded: at once for local-only slash commands and failures, else once the run the prompt started or joined + * yields (`agent_pause` with `yielded`, or `agent_end`). The host correlates on the cmd `id` instead of guessing who owns an `agent_end`. */ import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; import type { AssistantMessage } from "@oh-my-pi/pi-ai"; @@ -109,7 +109,7 @@ export class PromptResults { /** * Mark every open prompt aborted after a session transition: transitions detach the agent before aborting it, - * so the interrupted run never publishes a terminal `agent_end` for them. + * so the interrupted run never publishes an `agent_end` for them. */ abortOpen(): void { for (const [ticket, open] of this.#open) { @@ -119,16 +119,15 @@ export class PromptResults { } } - /** Track run boundaries; call after the event was sent so `prompt_result` follows its `agent_end`. */ + /** Track run boundaries; call after the event was sent so `prompt_result` follows its yield. */ observe(event: AgentSessionEvent): void { if (event.type === "agent_start") { this.#agentStarts++; this.#refusalAtRunStart = this.#session.costCapRefusal; return; } - if (event.type !== "agent_end" || this.#open.size === 0) return; - // Older sessions omit `yielded`; only their terminal ends were yields. - if (!(event.yielded ?? event.isTerminal !== false)) return; + if (this.#open.size === 0) return; + if (event.type !== "agent_end" && (event.type !== "agent_pause" || !event.yielded)) return; // A request the cost gate refused during this run is its outcome, whatever message ended it. const outcome = this.#costCapOutcome(this.#refusalAtRunStart) ?? runOutcome(event.messages); // A still-queued steer/follow-up has not been read by the agent yet. diff --git a/runner/test/events.test.ts b/runner/test/events.test.ts index fe7f2b366..82d03890e 100644 --- a/runner/test/events.test.ts +++ b/runner/test/events.test.ts @@ -49,6 +49,7 @@ describe("host events bridge", () => { const types = events.map(event => event.type); expect(types.indexOf("session_settled")).toBeGreaterThan(types.lastIndexOf("agent_end")); + expect(events.filter(event => event.type === "agent_end")).toMatchObject([{ isTerminal: true, yielded: true }]); const assistantEnd = events.find(event => event.type === "message_end" && JSON.stringify(event).includes("scripted reply")); const updates = events.filter(event => event.type === "message_update"); @@ -73,6 +74,25 @@ describe("host events bridge", () => { }); }); + it("sends a loop paused on background work as a non-terminal agent_end, and the run's end as the terminal one", async () => { + const { session, events, waitFor } = await bridged([{ content: ["started the job"] }, { content: ["job done"] }]); + const job = Promise.withResolvers(); + session.asyncJobManager?.register("bash", "wait", () => job.promise, { ownerId: session.getAgentId() }); + await session.prompt("go"); + await session.waitForIdle(); + + const ends = () => events.filter(event => event.type === "agent_end"); + const paused = { isTerminal: false, yielded: true, awaitingAsyncWork: true }; + expect(ends()).toMatchObject([paused]); + expect(events.some(event => event.type === "session_settled")).toBe(false); + + // The job's result resumes the run; its loop ends the run. + job.resolve("done"); + await waitFor("session_settled"); + expect(ends()).toMatchObject([paused, { isTerminal: true, yielded: true }]); + expect(events.some(event => event.type === "agent_pause")).toBe(false); + }); + it("reports session renames", async () => { const { session, events, waitFor } = await bridged(); session.sessionManager.setSessionName("renamed", "user");