diff --git a/package.json b/package.json index 77211d865..2cbb71fea 100644 --- a/package.json +++ b/package.json @@ -163,10 +163,10 @@ "@homebridge/ciao": "^1.3.4", "@line/bot-sdk": "^10.6.0", "@lydell/node-pty": "1.2.0-beta.3", - "@mariozechner/pi-agent-core": "0.49.3", - "@mariozechner/pi-ai": "0.49.3", - "@mariozechner/pi-coding-agent": "0.49.3", - "@mariozechner/pi-tui": "0.49.3", + "@mariozechner/pi-agent-core": "0.50.4", + "@mariozechner/pi-ai": "0.50.4", + "@mariozechner/pi-coding-agent": "0.50.4", + "@mariozechner/pi-tui": "0.50.4", "@mozilla/readability": "^0.6.0", "@sinclair/typebox": "0.34.47", "@slack/bolt": "^4.6.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 95b940c97..a6453c5ee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,17 +41,17 @@ importers: specifier: 1.2.0-beta.3 version: 1.2.0-beta.3 '@mariozechner/pi-agent-core': - specifier: 0.49.3 - version: 0.49.3(ws@8.19.0)(zod@4.3.6) + specifier: 0.50.4 + version: 0.50.4(ws@8.19.0)(zod@4.3.6) '@mariozechner/pi-ai': - specifier: 0.49.3 - version: 0.49.3(ws@8.19.0)(zod@4.3.6) + specifier: 0.50.4 + version: 0.50.4(ws@8.19.0)(zod@4.3.6) '@mariozechner/pi-coding-agent': - specifier: 0.49.3 - version: 0.49.3(ws@8.19.0)(zod@4.3.6) + specifier: 0.50.4 + version: 0.50.4(ws@8.19.0)(zod@4.3.6) '@mariozechner/pi-tui': - specifier: 0.49.3 - version: 0.49.3 + specifier: 0.50.4 + version: 0.50.4 '@mozilla/readability': specifier: ^0.6.0 version: 0.6.0 @@ -172,6 +172,13 @@ importers: zod: specifier: ^4.3.6 version: 4.3.6 + optionalDependencies: + '@napi-rs/canvas': + specifier: ^0.1.88 + version: 0.1.88 + node-llama-cpp: + specifier: 3.15.0 + version: 3.15.0(typescript@5.9.3) devDependencies: '@grammyjs/types': specifier: ^3.23.0 @@ -254,13 +261,6 @@ importers: wireit: specifier: ^0.14.12 version: 0.14.12 - optionalDependencies: - '@napi-rs/canvas': - specifier: ^0.1.88 - version: 0.1.88 - node-llama-cpp: - specifier: 3.15.0 - version: 3.15.0(typescript@5.9.3) extensions/bluebubbles: {} @@ -1328,7 +1328,6 @@ packages: '@lancedb/lancedb@0.23.0': resolution: {integrity: sha512-aYrIoEG24AC+wILCL57Ius/Y4yU+xFHDPKLvmjzzN4byAjzeIGF0TC86S5RBt4Ji+dxS7yIWV5Q/gE5/fybIFQ==} engines: {node: '>= 18'} - cpu: [x64, arm64] os: [darwin, linux, win32] peerDependencies: apache-arrow: '>=15.0.0 <=18.1.0' @@ -1448,22 +1447,22 @@ packages: peerDependencies: lit: ^3.3.1 - '@mariozechner/pi-agent-core@0.49.3': - resolution: {integrity: sha512-YL3PrLA8//Cklx58GJBUyNBCVLIOtK+wpAgqimuR03EgToaGPkSM7B/1S4CP4pFkr7b3DTIsC6t++tK7LgfjQg==} + '@mariozechner/pi-agent-core@0.50.4': + resolution: {integrity: sha512-m7tRto2hfW67hzJFurNurEbDVeX9gKikXxS8/O0RmFqu2ACTMr5Kl2Y8FAoD0lZKzeFvccR7+pea0DFeYP6Rag==} engines: {node: '>=20.0.0'} - '@mariozechner/pi-ai@0.49.3': - resolution: {integrity: sha512-FYck4TPrF7ps3WBKxLnBQdda9OXUWN6rukni0LgK8m/GpMAXGienHouDrWPn0XIgTwrz5r7SGI3sfsEYslCICA==} + '@mariozechner/pi-ai@0.50.4': + resolution: {integrity: sha512-v7dj8/DM4gJ4If4wzzNrszRscM8qRCQO+FKNNll5ddhKRSzGEZ6JEcNqKtSQFQU+QxEegliLWz06MXhc8Zyvqw==} engines: {node: '>=20.0.0'} hasBin: true - '@mariozechner/pi-coding-agent@0.49.3': - resolution: {integrity: sha512-V/Fsq0PeYB5svmw5lZsbD/glmkXofegQcPSKecK2ab3VihKwQp/MQfYjyK6nY4b/B1HIugatcDWaH5WvPKIKwg==} + '@mariozechner/pi-coding-agent@0.50.4': + resolution: {integrity: sha512-XYyZKXaAnojuPEtvoQp0DWsEWZdFvchOx+L46dUGipBZJuvwmUzrSCuj3TW2Mn65/GRu/w3NAkj/O0mpCK+ADQ==} engines: {node: '>=20.0.0'} hasBin: true - '@mariozechner/pi-tui@0.49.3': - resolution: {integrity: sha512-SyBtQ0B9A/8V4eX7z3l9Q7sEVAnSueNJ1gC6+nRakDBfBOSxuqA61vz6tic0C7Jj46NERRuvJKdQSmk1VP5sUA==} + '@mariozechner/pi-tui@0.50.4': + resolution: {integrity: sha512-MNuQhinwYqZXcYTxZX3qsQaa4ifxmN1goZL4oCGxXeS0jHyepS5NmqDMbX6shas1CYM+C92/xtoXCm6Ge8tBFA==} engines: {node: '>=20.0.0'} '@matrix-org/matrix-sdk-crypto-nodejs@0.4.0': @@ -2416,10 +2415,6 @@ packages: resolution: {integrity: sha512-qJpzYC64kaj3S0fueiu3kXm8xPrR3PcXDPEgnaNMRn0EjNSZFoFjvbUp0YUDsRhN1CB90EnHJtbxWKevnH99UQ==} engines: {node: '>=18.0.0'} - '@smithy/core@3.21.0': - resolution: {integrity: sha512-bg2TfzgsERyETAxc/Ims/eJX8eAnIeTi4r4LHpMpfF/2NyO6RsWis0rjKcCPaGksljmOb23BZRiCeT/3NvwkXw==} - engines: {node: '>=18.0.0'} - '@smithy/core@3.21.1': resolution: {integrity: sha512-NUH8R4O6FkN8HKMojzbGg/5pNjsfTjlMmeFclyPfPaXXUrbr5TzhWgbf7t92wfrpCHRgpjyz7ffASIS3wX28aA==} engines: {node: '>=18.0.0'} @@ -2472,18 +2467,10 @@ packages: resolution: {integrity: sha512-RO0jeoaYAB1qBRhfVyq0pMgBoUK34YEJxVxyjOWYZiOKOq2yMZ4MnVXMZCUDenpozHue207+9P5ilTV1zeda0A==} engines: {node: '>=18.0.0'} - '@smithy/middleware-endpoint@4.4.10': - resolution: {integrity: sha512-kwWpNltpxrvPabnjEFvwSmA+66l6s2ReCvgVSzW/z92LU4T28fTdgZ18IdYRYOrisu2NMQ0jUndRScbO65A/zg==} - engines: {node: '>=18.0.0'} - '@smithy/middleware-endpoint@4.4.11': resolution: {integrity: sha512-/WqsrycweGGfb9sSzME4CrsuayjJF6BueBmkKlcbeU5q18OhxRrvvKlmfw3tpDsK5ilx2XUJvoukwxHB0nHs/Q==} engines: {node: '>=18.0.0'} - '@smithy/middleware-retry@4.4.26': - resolution: {integrity: sha512-ozZMoTAr+B2aVYfLYfkssFvc8ZV3p/vLpVQ7/k277xxUOA9ykSPe5obL2j6yHfbdrM/SZV7qj0uk/hSqavHrLw==} - engines: {node: '>=18.0.0'} - '@smithy/middleware-retry@4.4.27': resolution: {integrity: sha512-xFUYCGRVsfgiN5EjsJJSzih9+yjStgMTCLANPlf0LVQkPDYCe0hz97qbdTZosFOiYlGBlHYityGRxrQ/hxhfVQ==} engines: {node: '>=18.0.0'} @@ -2532,10 +2519,6 @@ packages: resolution: {integrity: sha512-6A4vdGj7qKNRF16UIcO8HhHjKW27thsxYci+5r/uVRkdcBEkOEiY8OMPuydLX4QHSrJqGHPJzPRwwVTqbLZJhg==} engines: {node: '>=18.0.0'} - '@smithy/smithy-client@4.10.11': - resolution: {integrity: sha512-6o804SCyHGMXAb5mFJ+iTy9kVKv7F91a9szN0J+9X6p8A0NrdpUxdaC57aye2ipQkP2C4IAqETEpGZ0Zj77Haw==} - engines: {node: '>=18.0.0'} - '@smithy/smithy-client@4.10.12': resolution: {integrity: sha512-VKO/HKoQ5OrSHW6AJUmEnUKeXI1/5LfCwO9cwyao7CmLvGnZeM1i36Lyful3LK1XU7HwTVieTqO1y2C/6t3qtA==} engines: {node: '>=18.0.0'} @@ -2572,18 +2555,10 @@ packages: resolution: {integrity: sha512-YEjpl6XJ36FTKmD+kRJJWYvrHeUvm5ykaUS5xK+6oXffQPHeEM4/nXlZPe+Wu0lsgRUcNZiliYNh/y7q9c2y6Q==} engines: {node: '>=18.0.0'} - '@smithy/util-defaults-mode-browser@4.3.25': - resolution: {integrity: sha512-8ugoNMtss2dJHsXnqsibGPqoaafvWJPACmYKxJ4E6QWaDrixsAemmiMMAVbvwYadjR0H9G2+AlzsInSzRi8PSw==} - engines: {node: '>=18.0.0'} - '@smithy/util-defaults-mode-browser@4.3.26': resolution: {integrity: sha512-vva0dzYUTgn7DdE0uaha10uEdAgmdLnNFowKFjpMm6p2R0XDk5FHPX3CBJLzWQkQXuEprsb0hGz9YwbicNWhjw==} engines: {node: '>=18.0.0'} - '@smithy/util-defaults-mode-node@4.2.28': - resolution: {integrity: sha512-mjUdcP8h3E0K/XvNMi9oBXRV3DMCzeRiYIieZ1LQ7jq5tu6GH/GTWym7a1xIIE0pKSoLcpGsaImuQhGPSIJzAA==} - engines: {node: '>=18.0.0'} - '@smithy/util-defaults-mode-node@4.2.29': resolution: {integrity: sha512-c6D7IUBsZt/aNnTBHMTf+OVh+h/JcxUUgfTcIJaWRe6zhOum1X+pNKSZtZ+7fbOn5I99XVFtmrnXKv8yHHErTQ==} engines: {node: '>=18.0.0'} @@ -2649,6 +2624,9 @@ packages: '@tokenizer/token@0.3.0': resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==} + '@tootallnate/quickjs-emscripten@0.23.0': + resolution: {integrity: sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==} + '@twurple/api-call@8.0.3': resolution: {integrity: sha512-/5DBTqFjpYB+qqOkkFzoTWE79a7+I8uLXmBIIIYjGoq/CIPxKcHnlemXlU8cQhTr87PVa3th8zJXGYiNkpRx8w==} @@ -3042,6 +3020,10 @@ packages: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} + ast-types@0.13.4: + resolution: {integrity: sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==} + engines: {node: '>=4'} + ast-v8-to-istanbul@0.3.10: resolution: {integrity: sha512-p4K7vMz2ZSk3wN8l5o3y2bJAoZXT3VuJI5OLTATY/01CYWumWvwkUw0SqDBnNq6IiTO3qDa1eSQDibAV8g7XOQ==} @@ -3094,6 +3076,10 @@ packages: resolution: {integrity: sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==} engines: {node: '>= 0.8'} + basic-ftp@5.1.0: + resolution: {integrity: sha512-RkaJzeJKDbaDWTIPiJwubyljaEPwpVWkm9Rt5h9Nd6h7tEXTJ3VB4qxdZBioV7JO5yLUaOKwz7vDOzlncUsegw==} + engines: {node: '>=10.0.0'} + bcrypt-pbkdf@1.0.2: resolution: {integrity: sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==} @@ -3357,6 +3343,10 @@ packages: resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==} engines: {node: '>= 12'} + data-uri-to-buffer@6.0.2: + resolution: {integrity: sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==} + engines: {node: '>= 14'} + debug@2.6.9: resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} peerDependencies: @@ -3382,6 +3372,10 @@ packages: resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} engines: {node: '>=0.10.0'} + degenerator@5.0.1: + resolution: {integrity: sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==} + engines: {node: '>= 14'} + delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} @@ -3510,9 +3504,27 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} + escodegen@2.1.0: + resolution: {integrity: sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==} + engines: {node: '>=6.0'} + hasBin: true + + esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + + estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + estree-walker@3.0.3: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + esutils@2.0.3: + resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} + engines: {node: '>=0.10.0'} + etag@1.8.1: resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} engines: {node: '>= 0.6'} @@ -3710,6 +3722,10 @@ packages: get-tsconfig@4.13.0: resolution: {integrity: sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ==} + get-uri@6.0.5: + resolution: {integrity: sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==} + engines: {node: '>= 14'} + getpass@0.1.7: resolution: {integrity: sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==} @@ -3866,6 +3882,10 @@ packages: ini@1.3.8: resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} + ip-address@10.1.0: + resolution: {integrity: sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==} + engines: {node: '>= 12'} + ipaddr.js@1.9.1: resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} engines: {node: '>= 0.10'} @@ -4223,6 +4243,10 @@ packages: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} engines: {node: '>=10'} + lru-cache@7.18.3: + resolution: {integrity: sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==} + engines: {node: '>=12'} + lru-memoizer@2.3.0: resolution: {integrity: sha512-GXn7gyHAMhO13WSKrIiNfztwxodVsP8IoZ3XfrJV4yH2x0/OeTO/FIaAHTY5YekdGgW94njfuKmyyt1E0mR6Ug==} @@ -4398,6 +4422,10 @@ packages: resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==} engines: {node: '>= 0.6'} + netmask@2.0.2: + resolution: {integrity: sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==} + engines: {node: '>= 0.4.0'} + node-addon-api@8.5.0: resolution: {integrity: sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A==} engines: {node: ^18 || ^20 || >= 21} @@ -4598,6 +4626,14 @@ packages: resolution: {integrity: sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg==} engines: {node: '>=20'} + pac-proxy-agent@7.2.0: + resolution: {integrity: sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==} + engines: {node: '>= 14'} + + pac-resolver@7.0.1: + resolution: {integrity: sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==} + engines: {node: '>= 14'} + package-json-from-dist@1.0.1: resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} @@ -4781,6 +4817,10 @@ packages: resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} engines: {node: '>= 0.10'} + proxy-agent@6.5.0: + resolution: {integrity: sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==} + engines: {node: '>= 14'} + proxy-from-env@1.1.0: resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} @@ -5050,6 +5090,18 @@ packages: resolution: {integrity: sha512-iOBWFgUX7caIZiuutICxVgX1SdxwAVFFKwt1EvMYYec/NWO5meOJ6K5uQxhrYBdQJne4KxiqZc+KptFOWFSI9w==} engines: {node: '>=18'} + smart-buffer@4.2.0: + resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} + engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} + + socks-proxy-agent@8.0.5: + resolution: {integrity: sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==} + engines: {node: '>= 14'} + + socks@2.8.7: + resolution: {integrity: sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==} + engines: {node: '>= 10.0.0', npm: '>= 3.0.0'} + sonic-boom@4.2.0: resolution: {integrity: sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==} @@ -5323,6 +5375,10 @@ packages: resolution: {integrity: sha512-Heho1hJD81YChi+uS2RkSjcVO+EQLmLSyUlHyp7Y/wFbxQaGb4WXVKD073JytrjXJVkSZVzoE2MCSOKugFGtOQ==} engines: {node: '>=20.18.1'} + undici@7.19.2: + resolution: {integrity: sha512-4VQSpGEGsWzk0VYxyB/wVX/Q7qf9t5znLRgs0dzszr9w9Fej/8RVNQ+S20vdXSAyra/bJ7ZQfGv6ZMj7UEbzSg==} + engines: {node: '>=20.18.1'} + unicode-properties@1.4.1: resolution: {integrity: sha512-CLjCCLQ6UuMxWnbIylkisbRj31qxHPAurvena/0iwSVbQ2G1VY5/HjV0IRabOEbDHlzZlRdCrD4NhB0JtU40Pg==} @@ -5592,7 +5648,7 @@ snapshots: '@aws-crypto/crc32@5.2.0': dependencies: '@aws-crypto/util': 5.2.0 - '@aws-sdk/types': 3.972.0 + '@aws-sdk/types': 3.973.0 tslib: 2.8.1 '@aws-crypto/sha256-browser@5.2.0': @@ -5641,7 +5697,7 @@ snapshots: '@aws-sdk/util-user-agent-browser': 3.972.0 '@aws-sdk/util-user-agent-node': 3.972.0 '@smithy/config-resolver': 4.4.6 - '@smithy/core': 3.21.0 + '@smithy/core': 3.21.1 '@smithy/eventstream-serde-browser': 4.2.8 '@smithy/eventstream-serde-config-resolver': 4.3.8 '@smithy/eventstream-serde-node': 4.2.8 @@ -5649,21 +5705,21 @@ snapshots: '@smithy/hash-node': 4.2.8 '@smithy/invalid-dependency': 4.2.8 '@smithy/middleware-content-length': 4.2.8 - '@smithy/middleware-endpoint': 4.4.10 - '@smithy/middleware-retry': 4.4.26 + '@smithy/middleware-endpoint': 4.4.11 + '@smithy/middleware-retry': 4.4.27 '@smithy/middleware-serde': 4.2.9 '@smithy/middleware-stack': 4.2.8 '@smithy/node-config-provider': 4.3.8 '@smithy/node-http-handler': 4.4.8 '@smithy/protocol-http': 5.3.8 - '@smithy/smithy-client': 4.10.11 + '@smithy/smithy-client': 4.10.12 '@smithy/types': 4.12.0 '@smithy/url-parser': 4.2.8 '@smithy/util-base64': 4.3.0 '@smithy/util-body-length-browser': 4.2.0 '@smithy/util-body-length-node': 4.2.1 - '@smithy/util-defaults-mode-browser': 4.3.25 - '@smithy/util-defaults-mode-node': 4.2.28 + '@smithy/util-defaults-mode-browser': 4.3.26 + '@smithy/util-defaults-mode-node': 4.2.29 '@smithy/util-endpoints': 3.2.8 '@smithy/util-middleware': 4.2.8 '@smithy/util-retry': 4.2.8 @@ -5733,26 +5789,26 @@ snapshots: '@aws-sdk/util-user-agent-browser': 3.972.0 '@aws-sdk/util-user-agent-node': 3.972.0 '@smithy/config-resolver': 4.4.6 - '@smithy/core': 3.21.0 + '@smithy/core': 3.21.1 '@smithy/fetch-http-handler': 5.3.9 '@smithy/hash-node': 4.2.8 '@smithy/invalid-dependency': 4.2.8 '@smithy/middleware-content-length': 4.2.8 - '@smithy/middleware-endpoint': 4.4.10 - '@smithy/middleware-retry': 4.4.26 + '@smithy/middleware-endpoint': 4.4.11 + '@smithy/middleware-retry': 4.4.27 '@smithy/middleware-serde': 4.2.9 '@smithy/middleware-stack': 4.2.8 '@smithy/node-config-provider': 4.3.8 '@smithy/node-http-handler': 4.4.8 '@smithy/protocol-http': 5.3.8 - '@smithy/smithy-client': 4.10.11 + '@smithy/smithy-client': 4.10.12 '@smithy/types': 4.12.0 '@smithy/url-parser': 4.2.8 '@smithy/util-base64': 4.3.0 '@smithy/util-body-length-browser': 4.2.0 '@smithy/util-body-length-node': 4.2.1 - '@smithy/util-defaults-mode-browser': 4.3.25 - '@smithy/util-defaults-mode-node': 4.2.28 + '@smithy/util-defaults-mode-browser': 4.3.26 + '@smithy/util-defaults-mode-node': 4.2.29 '@smithy/util-endpoints': 3.2.8 '@smithy/util-middleware': 4.2.8 '@smithy/util-retry': 4.2.8 @@ -5808,12 +5864,12 @@ snapshots: dependencies: '@aws-sdk/types': 3.972.0 '@aws-sdk/xml-builder': 3.972.0 - '@smithy/core': 3.21.0 + '@smithy/core': 3.21.1 '@smithy/node-config-provider': 4.3.8 '@smithy/property-provider': 4.2.8 '@smithy/protocol-http': 5.3.8 '@smithy/signature-v4': 5.3.8 - '@smithy/smithy-client': 4.10.11 + '@smithy/smithy-client': 4.10.12 '@smithy/types': 4.12.0 '@smithy/util-base64': 4.3.0 '@smithy/util-middleware': 4.2.8 @@ -5860,7 +5916,7 @@ snapshots: '@smithy/node-http-handler': 4.4.8 '@smithy/property-provider': 4.2.8 '@smithy/protocol-http': 5.3.8 - '@smithy/smithy-client': 4.10.11 + '@smithy/smithy-client': 4.10.12 '@smithy/types': 4.12.0 '@smithy/util-stream': 4.5.10 tslib: 2.8.1 @@ -6105,7 +6161,7 @@ snapshots: '@aws-sdk/core': 3.972.0 '@aws-sdk/types': 3.972.0 '@aws-sdk/util-endpoints': 3.972.0 - '@smithy/core': 3.21.0 + '@smithy/core': 3.21.1 '@smithy/protocol-http': 5.3.8 '@smithy/types': 4.12.0 tslib: 2.8.1 @@ -6148,26 +6204,26 @@ snapshots: '@aws-sdk/util-user-agent-browser': 3.972.0 '@aws-sdk/util-user-agent-node': 3.972.0 '@smithy/config-resolver': 4.4.6 - '@smithy/core': 3.21.0 + '@smithy/core': 3.21.1 '@smithy/fetch-http-handler': 5.3.9 '@smithy/hash-node': 4.2.8 '@smithy/invalid-dependency': 4.2.8 '@smithy/middleware-content-length': 4.2.8 - '@smithy/middleware-endpoint': 4.4.10 - '@smithy/middleware-retry': 4.4.26 + '@smithy/middleware-endpoint': 4.4.11 + '@smithy/middleware-retry': 4.4.27 '@smithy/middleware-serde': 4.2.9 '@smithy/middleware-stack': 4.2.8 '@smithy/node-config-provider': 4.3.8 '@smithy/node-http-handler': 4.4.8 '@smithy/protocol-http': 5.3.8 - '@smithy/smithy-client': 4.10.11 + '@smithy/smithy-client': 4.10.12 '@smithy/types': 4.12.0 '@smithy/url-parser': 4.2.8 '@smithy/util-base64': 4.3.0 '@smithy/util-body-length-browser': 4.2.0 '@smithy/util-body-length-node': 4.2.1 - '@smithy/util-defaults-mode-browser': 4.3.25 - '@smithy/util-defaults-mode-node': 4.2.28 + '@smithy/util-defaults-mode-browser': 4.3.26 + '@smithy/util-defaults-mode-node': 4.2.29 '@smithy/util-endpoints': 3.2.8 '@smithy/util-middleware': 4.2.8 '@smithy/util-retry': 4.2.8 @@ -6994,10 +7050,10 @@ snapshots: transitivePeerDependencies: - tailwindcss - '@mariozechner/pi-agent-core@0.49.3(ws@8.19.0)(zod@4.3.6)': + '@mariozechner/pi-agent-core@0.50.4(ws@8.19.0)(zod@4.3.6)': dependencies: - '@mariozechner/pi-ai': 0.49.3(ws@8.19.0)(zod@4.3.6) - '@mariozechner/pi-tui': 0.49.3 + '@mariozechner/pi-ai': 0.50.4(ws@8.19.0)(zod@4.3.6) + '@mariozechner/pi-tui': 0.50.4 transitivePeerDependencies: - '@modelcontextprotocol/sdk' - aws-crt @@ -7007,7 +7063,7 @@ snapshots: - ws - zod - '@mariozechner/pi-ai@0.49.3(ws@8.19.0)(zod@4.3.6)': + '@mariozechner/pi-ai@0.50.4(ws@8.19.0)(zod@4.3.6)': dependencies: '@anthropic-ai/sdk': 0.71.2(zod@4.3.6) '@aws-sdk/client-bedrock-runtime': 3.972.0 @@ -7019,6 +7075,8 @@ snapshots: chalk: 5.6.2 openai: 6.10.0(ws@8.19.0)(zod@4.3.6) partial-json: 0.1.7 + proxy-agent: 6.5.0 + undici: 7.19.2 zod-to-json-schema: 3.25.1(zod@4.3.6) transitivePeerDependencies: - '@modelcontextprotocol/sdk' @@ -7029,19 +7087,20 @@ snapshots: - ws - zod - '@mariozechner/pi-coding-agent@0.49.3(ws@8.19.0)(zod@4.3.6)': + '@mariozechner/pi-coding-agent@0.50.4(ws@8.19.0)(zod@4.3.6)': dependencies: '@mariozechner/clipboard': 0.3.0 '@mariozechner/jiti': 2.6.5 - '@mariozechner/pi-agent-core': 0.49.3(ws@8.19.0)(zod@4.3.6) - '@mariozechner/pi-ai': 0.49.3(ws@8.19.0)(zod@4.3.6) - '@mariozechner/pi-tui': 0.49.3 + '@mariozechner/pi-agent-core': 0.50.4(ws@8.19.0)(zod@4.3.6) + '@mariozechner/pi-ai': 0.50.4(ws@8.19.0)(zod@4.3.6) + '@mariozechner/pi-tui': 0.50.4 '@silvia-odwyer/photon-node': 0.3.4 chalk: 5.6.2 cli-highlight: 2.1.11 diff: 8.0.3 file-type: 21.3.0 glob: 11.1.0 + ignore: 7.0.5 marked: 15.0.12 minimatch: 10.1.1 proper-lockfile: 4.1.2 @@ -7055,7 +7114,7 @@ snapshots: - ws - zod - '@mariozechner/pi-tui@0.49.3': + '@mariozechner/pi-tui@0.50.4': dependencies: '@types/mime-types': 2.1.4 chalk: 5.6.2 @@ -7997,19 +8056,6 @@ snapshots: '@smithy/util-middleware': 4.2.8 tslib: 2.8.1 - '@smithy/core@3.21.0': - dependencies: - '@smithy/middleware-serde': 4.2.9 - '@smithy/protocol-http': 5.3.8 - '@smithy/types': 4.12.0 - '@smithy/util-base64': 4.3.0 - '@smithy/util-body-length-browser': 4.2.0 - '@smithy/util-middleware': 4.2.8 - '@smithy/util-stream': 4.5.10 - '@smithy/util-utf8': 4.2.0 - '@smithy/uuid': 1.1.0 - tslib: 2.8.1 - '@smithy/core@3.21.1': dependencies: '@smithy/middleware-serde': 4.2.9 @@ -8095,17 +8141,6 @@ snapshots: '@smithy/types': 4.12.0 tslib: 2.8.1 - '@smithy/middleware-endpoint@4.4.10': - dependencies: - '@smithy/core': 3.21.0 - '@smithy/middleware-serde': 4.2.9 - '@smithy/node-config-provider': 4.3.8 - '@smithy/shared-ini-file-loader': 4.4.3 - '@smithy/types': 4.12.0 - '@smithy/url-parser': 4.2.8 - '@smithy/util-middleware': 4.2.8 - tslib: 2.8.1 - '@smithy/middleware-endpoint@4.4.11': dependencies: '@smithy/core': 3.21.1 @@ -8117,18 +8152,6 @@ snapshots: '@smithy/util-middleware': 4.2.8 tslib: 2.8.1 - '@smithy/middleware-retry@4.4.26': - dependencies: - '@smithy/node-config-provider': 4.3.8 - '@smithy/protocol-http': 5.3.8 - '@smithy/service-error-classification': 4.2.8 - '@smithy/smithy-client': 4.10.11 - '@smithy/types': 4.12.0 - '@smithy/util-middleware': 4.2.8 - '@smithy/util-retry': 4.2.8 - '@smithy/uuid': 1.1.0 - tslib: 2.8.1 - '@smithy/middleware-retry@4.4.27': dependencies: '@smithy/node-config-provider': 4.3.8 @@ -8208,16 +8231,6 @@ snapshots: '@smithy/util-utf8': 4.2.0 tslib: 2.8.1 - '@smithy/smithy-client@4.10.11': - dependencies: - '@smithy/core': 3.21.0 - '@smithy/middleware-endpoint': 4.4.10 - '@smithy/middleware-stack': 4.2.8 - '@smithy/protocol-http': 5.3.8 - '@smithy/types': 4.12.0 - '@smithy/util-stream': 4.5.10 - tslib: 2.8.1 - '@smithy/smithy-client@4.10.12': dependencies: '@smithy/core': 3.21.1 @@ -8266,13 +8279,6 @@ snapshots: dependencies: tslib: 2.8.1 - '@smithy/util-defaults-mode-browser@4.3.25': - dependencies: - '@smithy/property-provider': 4.2.8 - '@smithy/smithy-client': 4.10.11 - '@smithy/types': 4.12.0 - tslib: 2.8.1 - '@smithy/util-defaults-mode-browser@4.3.26': dependencies: '@smithy/property-provider': 4.2.8 @@ -8280,16 +8286,6 @@ snapshots: '@smithy/types': 4.12.0 tslib: 2.8.1 - '@smithy/util-defaults-mode-node@4.2.28': - dependencies: - '@smithy/config-resolver': 4.4.6 - '@smithy/credential-provider-imds': 4.2.8 - '@smithy/node-config-provider': 4.3.8 - '@smithy/property-provider': 4.2.8 - '@smithy/smithy-client': 4.10.11 - '@smithy/types': 4.12.0 - tslib: 2.8.1 - '@smithy/util-defaults-mode-node@4.2.29': dependencies: '@smithy/config-resolver': 4.4.6 @@ -8376,6 +8372,8 @@ snapshots: '@tokenizer/token@0.3.0': {} + '@tootallnate/quickjs-emscripten@0.23.0': {} + '@twurple/api-call@8.0.3': dependencies: '@d-fischer/shared-utils': 3.6.4 @@ -8887,6 +8885,10 @@ snapshots: assertion-error@2.0.1: {} + ast-types@0.13.4: + dependencies: + tslib: 2.8.1 + ast-v8-to-istanbul@0.3.10: dependencies: '@jridgewell/trace-mapping': 0.3.31 @@ -8948,6 +8950,8 @@ snapshots: dependencies: safe-buffer: 5.1.2 + basic-ftp@5.1.0: {} + bcrypt-pbkdf@1.0.2: dependencies: tweetnacl: 0.14.5 @@ -9244,6 +9248,8 @@ snapshots: data-uri-to-buffer@4.0.1: {} + data-uri-to-buffer@6.0.2: {} + debug@2.6.9: dependencies: ms: 2.0.0 @@ -9257,6 +9263,12 @@ snapshots: deepmerge@4.3.1: {} + degenerator@5.0.1: + dependencies: + ast-types: 0.13.4 + escodegen: 2.1.0 + esprima: 4.0.1 + delayed-stream@1.0.0: {} delegates@1.0.0: @@ -9389,10 +9401,24 @@ snapshots: escape-string-regexp@4.0.0: {} + escodegen@2.1.0: + dependencies: + esprima: 4.0.1 + estraverse: 5.3.0 + esutils: 2.0.3 + optionalDependencies: + source-map: 0.6.1 + + esprima@4.0.1: {} + + estraverse@5.3.0: {} + estree-walker@3.0.3: dependencies: '@types/estree': 1.0.8 + esutils@2.0.3: {} + etag@1.8.1: {} event-target-shim@5.0.1: {} @@ -9676,6 +9702,14 @@ snapshots: dependencies: resolve-pkg-maps: 1.0.0 + get-uri@6.0.5: + dependencies: + basic-ftp: 5.1.0 + data-uri-to-buffer: 6.0.2 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + getpass@0.1.7: dependencies: assert-plus: 1.0.0 @@ -9846,8 +9880,7 @@ snapshots: ieee754@1.2.1: {} - ignore@7.0.5: - optional: true + ignore@7.0.5: {} immediate@3.0.6: {} @@ -9863,6 +9896,8 @@ snapshots: ini@1.3.8: optional: true + ip-address@10.1.0: {} + ipaddr.js@1.9.1: {} ipull@3.9.3: @@ -10227,6 +10262,8 @@ snapshots: dependencies: yallist: 4.0.0 + lru-cache@7.18.3: {} + lru-memoizer@2.3.0: dependencies: lodash.clonedeep: 4.5.0 @@ -10384,6 +10421,8 @@ snapshots: negotiator@1.0.0: {} + netmask@2.0.2: {} + node-addon-api@8.5.0: optional: true @@ -10640,6 +10679,24 @@ snapshots: p-timeout@7.0.1: {} + pac-proxy-agent@7.2.0: + dependencies: + '@tootallnate/quickjs-emscripten': 0.23.0 + agent-base: 7.1.4 + debug: 4.4.3 + get-uri: 6.0.5 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + pac-resolver: 7.0.1 + socks-proxy-agent: 8.0.5 + transitivePeerDependencies: + - supports-color + + pac-resolver@7.0.1: + dependencies: + degenerator: 5.0.1 + netmask: 2.0.2 + package-json-from-dist@1.0.1: {} pako@0.2.9: {} @@ -10828,6 +10885,19 @@ snapshots: forwarded: 0.2.0 ipaddr.js: 1.9.1 + proxy-agent@6.5.0: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + lru-cache: 7.18.3 + pac-proxy-agent: 7.2.0 + proxy-from-env: 1.1.0 + socks-proxy-agent: 8.0.5 + transitivePeerDependencies: + - supports-color + proxy-from-env@1.1.0: {} psl@1.15.0: @@ -11254,6 +11324,21 @@ snapshots: is-fullwidth-code-point: 5.1.0 optional: true + smart-buffer@4.2.0: {} + + socks-proxy-agent@8.0.5: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + socks: 2.8.7 + transitivePeerDependencies: + - supports-color + + socks@2.8.7: + dependencies: + ip-address: 10.1.0 + smart-buffer: 4.2.0 + sonic-boom@4.2.0: dependencies: atomic-sleep: 1.0.0 @@ -11506,6 +11591,8 @@ snapshots: undici@7.19.0: {} + undici@7.19.2: {} + unicode-properties@1.4.1: dependencies: base64-js: 1.5.1 diff --git a/src/agents/context.ts b/src/agents/context.ts index d2559820f..1937006fe 100644 --- a/src/agents/context.ts +++ b/src/agents/context.ts @@ -2,7 +2,7 @@ // the agent reports a model id. This includes custom models.json entries. import { loadConfig } from "../config/config.js"; -import { resolveOpenClawAgentDir } from "./agent-paths.js"; +// Note: resolveOpenClawAgentDir no longer needed - AuthStorage() doesn't take agentDir in pi-agent-core 0.50.4 import { ensureOpenClawModelsJson } from "./models-config.js"; type ModelEntry = { id: string; contextWindow?: number }; @@ -10,12 +10,12 @@ type ModelEntry = { id: string; contextWindow?: number }; const MODEL_CACHE = new Map(); const loadPromise = (async () => { try { - const { discoverAuthStorage, discoverModels } = await import("@mariozechner/pi-coding-agent"); + const { AuthStorage, ModelRegistry } = await import("@mariozechner/pi-coding-agent"); const cfg = loadConfig(); await ensureOpenClawModelsJson(cfg); - const agentDir = resolveOpenClawAgentDir(); - const authStorage = discoverAuthStorage(agentDir); - const modelRegistry = discoverModels(authStorage, agentDir); + // Note: agentDir no longer needed - AuthStorage() doesn't take it as parameter in pi-agent-core 0.50.4 + const authStorage = new AuthStorage(); + const modelRegistry = new ModelRegistry(authStorage); const models = modelRegistry.getAll() as ModelEntry[]; for (const m of models) { if (!m?.id) continue; diff --git a/src/agents/model-catalog.ts b/src/agents/model-catalog.ts index a52a25f87..e9a585b8b 100644 --- a/src/agents/model-catalog.ts +++ b/src/agents/model-catalog.ts @@ -1,5 +1,5 @@ import { type OpenClawConfig, loadConfig } from "../config/config.js"; -import { resolveOpenClawAgentDir } from "./agent-paths.js"; +// Note: resolveOpenClawAgentDir no longer needed - AuthStorage() doesn't take agentDir in pi-agent-core 0.50.4 import { ensureOpenClawModelsJson } from "./models-config.js"; export type ModelCatalogEntry = { @@ -63,9 +63,9 @@ export async function loadModelCatalog(params?: { // we must not poison the cache with a rejected promise (otherwise all channel handlers // will keep failing until restart). const piSdk = await importPiSdk(); - const agentDir = resolveOpenClawAgentDir(); - const authStorage = piSdk.discoverAuthStorage(agentDir); - const registry = piSdk.discoverModels(authStorage, agentDir) as + // Note: agentDir no longer needed - AuthStorage() doesn't take it as parameter in pi-agent-core 0.50.4 + const authStorage = new piSdk.AuthStorage(); + const registry = new piSdk.ModelRegistry(authStorage) as | { getAll: () => Array; } diff --git a/src/agents/pi-embedded-runner/compact.ts b/src/agents/pi-embedded-runner/compact.ts index 2dc4c5325..8681f40c0 100644 --- a/src/agents/pi-embedded-runner/compact.ts +++ b/src/agents/pi-embedded-runner/compact.ts @@ -1,5 +1,5 @@ import fs from "node:fs/promises"; -import os from "node:os"; +// Note: os no longer needed - runtime info removed from system prompt in pi-agent-core 0.50.4 import { createAgentSession, @@ -8,24 +8,23 @@ import { SettingsManager, } from "@mariozechner/pi-coding-agent"; -import { resolveHeartbeatPrompt } from "../../auto-reply/heartbeat.js"; +// Note: resolveHeartbeatPrompt no longer needed - system prompt removed from CreateAgentSessionOptions in pi-agent-core 0.50.4 import type { ReasoningLevel, ThinkLevel } from "../../auto-reply/thinking.js"; -import { listChannelSupportedActions, resolveChannelMessageToolHints } from "../channel-tools.js"; +// Note: listChannelSupportedActions, resolveChannelMessageToolHints no longer needed - system prompt removed in pi-agent-core 0.50.4 import { resolveChannelCapabilities } from "../../config/channel-capabilities.js"; import type { OpenClawConfig } from "../../config/config.js"; -import { getMachineDisplayName } from "../../infra/machine-name.js"; +// Note: getMachineDisplayName no longer needed - system prompt removed in pi-agent-core 0.50.4 import { resolveTelegramInlineButtonsScope } from "../../telegram/inline-buttons.js"; -import { resolveTelegramReactionLevel } from "../../telegram/reaction-level.js"; -import { resolveSignalReactionLevel } from "../../signal/reaction-level.js"; +// Note: resolveTelegramReactionLevel, resolveSignalReactionLevel no longer needed - system prompt removed in pi-agent-core 0.50.4 import { type enqueueCommand, enqueueCommandInLane } from "../../process/command-queue.js"; import { normalizeMessageChannel } from "../../utils/message-channel.js"; -import { isSubagentSessionKey } from "../../routing/session-key.js"; -import { isReasoningTagProvider } from "../../utils/provider-utils.js"; +// Note: isSubagentSessionKey no longer needed - system prompt removed in pi-agent-core 0.50.4 +// Note: isReasoningTagProvider no longer needed - system prompt removed in pi-agent-core 0.50.4 import { resolveUserPath } from "../../utils.js"; import { resolveOpenClawAgentDir } from "../agent-paths.js"; -import { resolveSessionAgentIds } from "../agent-scope.js"; +// Note: resolveSessionAgentIds no longer needed - system prompt removed in pi-agent-core 0.50.4 import { makeBootstrapWarn, resolveBootstrapContextForRun } from "../bootstrap-files.js"; -import { resolveOpenClawDocsPath } from "../docs-path.js"; +// Note: resolveOpenClawDocsPath no longer needed - system prompt removed in pi-agent-core 0.50.4 import type { ExecElevatedDefaults } from "../bash-tools.js"; import { DEFAULT_MODEL, DEFAULT_PROVIDER } from "../defaults.js"; import { getApiKeyForModel, resolveModelAuthMode } from "../model-auth.js"; @@ -48,10 +47,10 @@ import { applySkillEnvOverrides, applySkillEnvOverridesFromSnapshot, loadWorkspaceSkillEntries, - resolveSkillsPromptForRun, + // Note: resolveSkillsPromptForRun no longer needed - system prompt removed in pi-agent-core 0.50.4 type SkillSnapshot, } from "../skills.js"; -import { buildEmbeddedExtensionPaths } from "./extensions.js"; +// Note: buildEmbeddedExtensionPaths no longer needed - removed from CreateAgentSessionOptions in pi-agent-core 0.50.4 import { logToolSchemasForGoogle, sanitizeSessionHistory, @@ -60,15 +59,16 @@ import { import { getDmHistoryLimitFromSessionKey, limitHistoryTurns } from "./history.js"; import { resolveGlobalLane, resolveSessionLane } from "./lanes.js"; import { log } from "./logger.js"; -import { buildModelAliasLines, resolveModel } from "./model.js"; -import { buildEmbeddedSandboxInfo } from "./sandbox-info.js"; +import { resolveModel } from "./model.js"; +// Note: buildModelAliasLines no longer needed - system prompt removed from CreateAgentSessionOptions in pi-agent-core 0.50.4 +// Note: buildEmbeddedSandboxInfo no longer needed - system prompt removed in pi-agent-core 0.50.4 import { prewarmSessionFile, trackSessionManagerAccess } from "./session-manager-cache.js"; -import { buildEmbeddedSystemPrompt, createSystemPromptOverride } from "./system-prompt.js"; +// Note: buildEmbeddedSystemPrompt and createSystemPromptOverride no longer needed - systemPrompt removed from CreateAgentSessionOptions in pi-agent-core 0.50.4 import { splitSdkTools } from "./tool-split.js"; import type { EmbeddedPiCompactResult } from "./types.js"; -import { formatUserTime, resolveUserTimeFormat, resolveUserTimezone } from "../date-time.js"; +// Note: formatUserTime, resolveUserTimeFormat, resolveUserTimezone no longer needed - system prompt removed in pi-agent-core 0.50.4 import { describeUnknownError, mapThinkingLevel, resolveExecToolDefaults } from "./utils.js"; -import { buildTtsSystemPromptHint } from "../../tts/tts.js"; +// Note: buildTtsSystemPromptHint no longer needed - system prompt removed in pi-agent-core 0.50.4 export type CompactEmbeddedPiSessionParams = { sessionId: string; @@ -195,15 +195,17 @@ export async function compactEmbeddedPiSessionDirect( skills: skillEntries ?? [], config: params.config, }); - const skillsPrompt = resolveSkillsPromptForRun({ - skillsSnapshot: params.skillsSnapshot, - entries: shouldLoadSkillEntries ? skillEntries : undefined, - config: params.config, - workspaceDir: effectiveWorkspace, - }); + // Note: Skills prompt no longer passed to createAgentSession in pi-agent-core 0.50.4 + // const skillsPrompt = resolveSkillsPromptForRun({ + // skillsSnapshot: params.skillsSnapshot, + // entries: shouldLoadSkillEntries ? skillEntries : undefined, + // config: params.config, + // workspaceDir: effectiveWorkspace, + // }); const sessionLabel = params.sessionKey ?? params.sessionId; - const { contextFiles } = await resolveBootstrapContextForRun({ + // Note: contextFiles no longer passed to createAgentSession in pi-agent-core 0.50.4 + await resolveBootstrapContextForRun({ workspaceDir: effectiveWorkspace, config: params.config, sessionKey: params.sessionKey, @@ -234,7 +236,8 @@ export async function compactEmbeddedPiSessionDirect( }); const tools = sanitizeToolsForGoogle({ tools: toolsRaw, provider }); logToolSchemasForGoogle({ tools, provider }); - const machineName = await getMachineDisplayName(); + // Note: machineName no longer needed - system prompt removed in pi-agent-core 0.50.4 + // const machineName = await getMachineDisplayName(); const runtimeChannel = normalizeMessageChannel(params.messageChannel ?? params.messageProvider); let runtimeCapabilities = runtimeChannel ? (resolveChannelCapabilities({ @@ -257,97 +260,50 @@ export async function compactEmbeddedPiSessionDirect( } } } - const reactionGuidance = - runtimeChannel && params.config - ? (() => { - if (runtimeChannel === "telegram") { - const resolved = resolveTelegramReactionLevel({ - cfg: params.config, - accountId: params.agentAccountId ?? undefined, - }); - const level = resolved.agentReactionGuidance; - return level ? { level, channel: "Telegram" } : undefined; - } - if (runtimeChannel === "signal") { - const resolved = resolveSignalReactionLevel({ - cfg: params.config, - accountId: params.agentAccountId ?? undefined, - }); - const level = resolved.agentReactionGuidance; - return level ? { level, channel: "Signal" } : undefined; - } - return undefined; - })() - : undefined; - // Resolve channel-specific message actions for system prompt - const channelActions = runtimeChannel - ? listChannelSupportedActions({ - cfg: params.config, - channel: runtimeChannel, - }) - : undefined; - const messageToolHints = runtimeChannel - ? resolveChannelMessageToolHints({ - cfg: params.config, - channel: runtimeChannel, - accountId: params.agentAccountId, - }) - : undefined; - - const runtimeInfo = { - host: machineName, - os: `${os.type()} ${os.release()}`, - arch: os.arch(), - node: process.version, - model: `${provider}/${modelId}`, - channel: runtimeChannel, - capabilities: runtimeCapabilities, - channelActions, - }; - const sandboxInfo = buildEmbeddedSandboxInfo(sandbox, params.bashElevated); - const reasoningTagHint = isReasoningTagProvider(provider); - const userTimezone = resolveUserTimezone(params.config?.agents?.defaults?.userTimezone); - const userTimeFormat = resolveUserTimeFormat(params.config?.agents?.defaults?.timeFormat); - const userTime = formatUserTime(new Date(), userTimezone, userTimeFormat); - const { defaultAgentId, sessionAgentId } = resolveSessionAgentIds({ - sessionKey: params.sessionKey, - config: params.config, - }); - const isDefaultAgent = sessionAgentId === defaultAgentId; - const promptMode = isSubagentSessionKey(params.sessionKey) ? "minimal" : "full"; - const docsPath = await resolveOpenClawDocsPath({ - workspaceDir: effectiveWorkspace, - argv1: process.argv[1], - cwd: process.cwd(), - moduleUrl: import.meta.url, - }); - const ttsHint = params.config ? buildTtsSystemPromptHint(params.config) : undefined; - const appendPrompt = buildEmbeddedSystemPrompt({ - workspaceDir: effectiveWorkspace, - defaultThinkLevel: params.thinkLevel, - reasoningLevel: params.reasoningLevel ?? "off", - extraSystemPrompt: params.extraSystemPrompt, - ownerNumbers: params.ownerNumbers, - reasoningTagHint, - heartbeatPrompt: isDefaultAgent - ? resolveHeartbeatPrompt(params.config?.agents?.defaults?.heartbeat?.prompt) - : undefined, - skillsPrompt, - docsPath: docsPath ?? undefined, - ttsHint, - promptMode, - runtimeInfo, - reactionGuidance, - messageToolHints, - sandboxInfo, - tools, - modelAliasLines: buildModelAliasLines(params.config), - userTimezone, - userTime, - userTimeFormat, - contextFiles, - }); - const systemPrompt = createSystemPromptOverride(appendPrompt); + // Note: The following variables were used for system prompt building, which has been + // removed from createAgentSession in pi-agent-core 0.50.4. System prompt is now + // handled internally by the pi-agent-core library. + // const reactionGuidance = ... + // const channelActions = ... + // const messageToolHints = ... + // const runtimeInfo = ... + // const sandboxInfo = ... + // const reasoningTagHint = ... + // const userTimezone = ... + // const userTimeFormat = ... + // const userTime = ... + // const isDefaultAgent = ... + // const promptMode = ... + // const docsPath = ... + // const ttsHint = ... + // Note: systemPrompt removed from CreateAgentSessionOptions in pi-agent-core 0.50.4 + // System prompt is now set via different mechanism in pi-agent-core + // const appendPrompt = buildEmbeddedSystemPrompt({ + // workspaceDir: effectiveWorkspace, + // defaultThinkLevel: params.thinkLevel, + // reasoningLevel: params.reasoningLevel ?? "off", + // extraSystemPrompt: params.extraSystemPrompt, + // ownerNumbers: params.ownerNumbers, + // reasoningTagHint, + // heartbeatPrompt: isDefaultAgent + // ? resolveHeartbeatPrompt(params.config?.agents?.defaults?.heartbeat?.prompt) + // : undefined, + // skillsPrompt, + // docsPath: docsPath ?? undefined, + // ttsHint, + // promptMode, + // runtimeInfo, + // reactionGuidance, + // messageToolHints, + // sandboxInfo, + // tools, + // modelAliasLines: buildModelAliasLines(params.config), + // userTimezone, + // userTime, + // userTimeFormat, + // contextFiles, + // }); + // const systemPrompt = createSystemPromptOverride(appendPrompt); const sessionLock = await acquireSessionWriteLock({ sessionFile: params.sessionFile, @@ -370,13 +326,14 @@ export async function compactEmbeddedPiSessionDirect( settingsManager, minReserveTokens: resolveCompactionReserveTokensFloor(params.config), }); - const additionalExtensionPaths = buildEmbeddedExtensionPaths({ - cfg: params.config, - sessionManager, - provider, - modelId, - model, - }); + // Note: additionalExtensionPaths removed from CreateAgentSessionOptions in pi-agent-core 0.50.4 + // const additionalExtensionPaths = buildEmbeddedExtensionPaths({ + // cfg: params.config, + // sessionManager, + // provider, + // modelId, + // model, + // }); const { builtInTools, customTools } = splitSdkTools({ tools, @@ -391,14 +348,10 @@ export async function compactEmbeddedPiSessionDirect( modelRegistry, model, thinkingLevel: mapThinkingLevel(params.thinkLevel), - systemPrompt, tools: builtInTools, customTools, sessionManager, settingsManager, - skills: [], - contextFiles: [], - additionalExtensionPaths, })); try { diff --git a/src/agents/pi-embedded-runner/model.ts b/src/agents/pi-embedded-runner/model.ts index 9dd94cd43..7c4b2c314 100644 --- a/src/agents/pi-embedded-runner/model.ts +++ b/src/agents/pi-embedded-runner/model.ts @@ -1,9 +1,9 @@ import type { Api, Model } from "@mariozechner/pi-ai"; -import { discoverAuthStorage, discoverModels } from "@mariozechner/pi-coding-agent"; +import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent"; import type { OpenClawConfig } from "../../config/config.js"; import type { ModelDefinitionConfig } from "../../config/types.js"; -import { resolveOpenClawAgentDir } from "../agent-paths.js"; +// Note: resolveOpenClawAgentDir no longer needed - AuthStorage() doesn't take agentDir in pi-agent-core 0.50.4 import { DEFAULT_CONTEXT_TOKENS } from "../defaults.js"; import { normalizeModelCompat } from "../model-compat.js"; import { normalizeProviderId } from "../model-selection.js"; @@ -53,12 +53,12 @@ export function resolveModel( ): { model?: Model; error?: string; - authStorage: ReturnType; - modelRegistry: ReturnType; + authStorage: AuthStorage; + modelRegistry: ModelRegistry; } { - const resolvedAgentDir = agentDir ?? resolveOpenClawAgentDir(); - const authStorage = discoverAuthStorage(resolvedAgentDir); - const modelRegistry = discoverModels(authStorage, resolvedAgentDir); + // Note: agentDir no longer needed - AuthStorage() doesn't take it as parameter in pi-agent-core 0.50.4 + const authStorage = new AuthStorage(); + const modelRegistry = new ModelRegistry(authStorage); const model = modelRegistry.find(provider, modelId) as Model | null; if (!model) { const providers = cfg?.models?.providers ?? {}; diff --git a/src/agents/pi-embedded-runner/run/attempt.ts b/src/agents/pi-embedded-runner/run/attempt.ts index e83c3ae4a..1887ea125 100644 --- a/src/agents/pi-embedded-runner/run/attempt.ts +++ b/src/agents/pi-embedded-runner/run/attempt.ts @@ -54,7 +54,7 @@ import { buildSystemPromptReport } from "../../system-prompt-report.js"; import { resolveDefaultModelForAgent } from "../../model-selection.js"; import { isAbortError } from "../abort.js"; -import { buildEmbeddedExtensionPaths } from "../extensions.js"; +// Note: buildEmbeddedExtensionPaths no longer needed - removed from CreateAgentSessionOptions in pi-agent-core 0.50.4 import { applyExtraParamsToAgent } from "../extra-params.js"; import { appendCacheTtlTimestamp, isCacheTtlEligibleProvider } from "../cache-ttl.js"; import { @@ -424,13 +424,14 @@ export async function runEmbeddedAttempt( minReserveTokens: resolveCompactionReserveTokensFloor(params.config), }); - const additionalExtensionPaths = buildEmbeddedExtensionPaths({ - cfg: params.config, - sessionManager, - provider: params.provider, - modelId: params.modelId, - model: params.model, - }); + // Note: additionalExtensionPaths removed from CreateAgentSessionOptions in pi-agent-core 0.50.4 + // const additionalExtensionPaths = buildEmbeddedExtensionPaths({ + // cfg: params.config, + // sessionManager, + // provider: params.provider, + // modelId: params.modelId, + // model: params.model, + // }); const { builtInTools, customTools } = splitSdkTools({ tools, @@ -454,14 +455,10 @@ export async function runEmbeddedAttempt( modelRegistry: params.modelRegistry, model: params.model, thinkingLevel: mapThinkingLevel(params.thinkLevel), - systemPrompt, tools: builtInTools, customTools: allCustomTools, sessionManager, settingsManager, - skills: [], - contextFiles: [], - additionalExtensionPaths, })); if (!session) { throw new Error("Embedded agent session missing"); diff --git a/src/agents/pi-embedded-runner/run/types.ts b/src/agents/pi-embedded-runner/run/types.ts index ffef0fb8a..c32149dce 100644 --- a/src/agents/pi-embedded-runner/run/types.ts +++ b/src/agents/pi-embedded-runner/run/types.ts @@ -1,6 +1,6 @@ import type { AgentMessage } from "@mariozechner/pi-agent-core"; import type { Api, AssistantMessage, ImageContent, Model } from "@mariozechner/pi-ai"; -import type { discoverAuthStorage, discoverModels } from "@mariozechner/pi-coding-agent"; +import type { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent"; import type { ReasoningLevel, ThinkLevel, VerboseLevel } from "../../../auto-reply/thinking.js"; import type { OpenClawConfig } from "../../../config/config.js"; @@ -12,9 +12,6 @@ import type { SkillSnapshot } from "../../skills.js"; import type { SessionSystemPromptReport } from "../../../config/sessions/types.js"; import type { ClientToolDefinition } from "./params.js"; -type AuthStorage = ReturnType; -type ModelRegistry = ReturnType; - export type EmbeddedRunAttemptParams = { sessionId: string; sessionKey?: string; diff --git a/src/agents/tools/image-tool.ts b/src/agents/tools/image-tool.ts index 2f7b0fec7..703045edc 100644 --- a/src/agents/tools/image-tool.ts +++ b/src/agents/tools/image-tool.ts @@ -8,7 +8,7 @@ import { complete, type Model, } from "@mariozechner/pi-ai"; -import { discoverAuthStorage, discoverModels } from "@mariozechner/pi-coding-agent"; +import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent"; import { Type } from "@sinclair/typebox"; import type { OpenClawConfig } from "../../config/config.js"; @@ -233,8 +233,8 @@ async function runImagePrompt(params: { : undefined; await ensureOpenClawModelsJson(effectiveCfg, params.agentDir); - const authStorage = discoverAuthStorage(params.agentDir); - const modelRegistry = discoverModels(authStorage, params.agentDir); + const authStorage = new AuthStorage(); + const modelRegistry = new ModelRegistry(authStorage); const result = await runWithImageModelFallback({ cfg: effectiveCfg, diff --git a/src/commands/auth-choice.apply.oauth.ts b/src/commands/auth-choice.apply.oauth.ts index 9e618e4c5..70fa122dc 100644 --- a/src/commands/auth-choice.apply.oauth.ts +++ b/src/commands/auth-choice.apply.oauth.ts @@ -68,7 +68,7 @@ export async function applyAuthChoiceOAuth( }); spin.stop("Chutes OAuth complete"); - const email = creds.email?.trim() || "default"; + const email = (typeof creds.email === "string" ? creds.email.trim() : null) || "default"; const profileId = `chutes:${email}`; await writeOAuthCredentials("chutes", creds, params.agentDir); diff --git a/src/commands/models/list.registry.ts b/src/commands/models/list.registry.ts index 76fba9b84..35e5c888e 100644 --- a/src/commands/models/list.registry.ts +++ b/src/commands/models/list.registry.ts @@ -1,7 +1,7 @@ import type { Api, Model } from "@mariozechner/pi-ai"; -import { discoverAuthStorage, discoverModels } from "@mariozechner/pi-coding-agent"; +import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent"; -import { resolveOpenClawAgentDir } from "../../agents/agent-paths.js"; +// Note: resolveOpenClawAgentDir no longer needed - AuthStorage() doesn't take agentDir in pi-agent-core 0.50.4 import type { AuthProfileStore } from "../../agents/auth-profiles.js"; import { listProfilesForProvider } from "../../agents/auth-profiles.js"; import { @@ -40,9 +40,9 @@ const hasAuthForProvider = (provider: string, cfg: OpenClawConfig, authStore: Au export async function loadModelRegistry(cfg: OpenClawConfig) { await ensureOpenClawModelsJson(cfg); - const agentDir = resolveOpenClawAgentDir(); - const authStorage = discoverAuthStorage(agentDir); - const registry = discoverModels(authStorage, agentDir); + // Note: agentDir no longer needed - AuthStorage() doesn't take it as parameter in pi-agent-core 0.50.4 + const authStorage = new AuthStorage(); + const registry = new ModelRegistry(authStorage); const models = registry.getAll() as Model[]; const availableModels = registry.getAvailable() as Model[]; const availableKeys = new Set(availableModels.map((model) => modelKey(model.provider, model.id))); diff --git a/src/commands/onboard-auth.credentials.ts b/src/commands/onboard-auth.credentials.ts index fbf6dbfb9..92d5835e3 100644 --- a/src/commands/onboard-auth.credentials.ts +++ b/src/commands/onboard-auth.credentials.ts @@ -10,8 +10,9 @@ export async function writeOAuthCredentials( agentDir?: string, ): Promise { // Write to resolved agent dir so gateway finds credentials on startup. + const email = typeof creds.email === "string" ? creds.email : "default"; upsertAuthProfile({ - profileId: `${provider}:${creds.email ?? "default"}`, + profileId: `${provider}:${email}`, credential: { type: "oauth", provider, diff --git a/src/gateway/test-helpers.mocks.ts b/src/gateway/test-helpers.mocks.ts index 15127ef31..93d31a2e1 100644 --- a/src/gateway/test-helpers.mocks.ts +++ b/src/gateway/test-helpers.mocks.ts @@ -232,15 +232,37 @@ vi.mock("@mariozechner/pi-coding-agent", async () => { "@mariozechner/pi-coding-agent", ); + class MockModelRegistry { + private actualInstance?: InstanceType; + + constructor(...args: unknown[]) { + if (!piSdkMock.enabled) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + this.actualInstance = new (actual.ModelRegistry as any)(...args); + } else { + piSdkMock.discoverCalls += 1; + } + } + getAll() { + if (this.actualInstance) return this.actualInstance.getAll(); + return piSdkMock.models; + } + find(...args: unknown[]) { + if (this.actualInstance) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (this.actualInstance.find as any)(...args); + } + return null; + } + getAvailable() { + if (this.actualInstance) return this.actualInstance.getAvailable(); + return piSdkMock.models; + } + } + return { ...actual, - discoverModels: (...args: unknown[]) => { - if (!piSdkMock.enabled) { - return (actual.discoverModels as (...args: unknown[]) => unknown)(...args); - } - piSdkMock.discoverCalls += 1; - return piSdkMock.models; - }, + ModelRegistry: MockModelRegistry, }; }); diff --git a/src/infra/unhandled-rejections.ts b/src/infra/unhandled-rejections.ts index 4d2a48d23..78abd48a8 100644 --- a/src/infra/unhandled-rejections.ts +++ b/src/infra/unhandled-rejections.ts @@ -147,9 +147,16 @@ export function installUnhandledRejectionHandler(): void { } if (isTransientNetworkError(reason)) { + // Log with more detail to help diagnose source (issue #4501) + const errorDetails = formatUncaughtError(reason); + const stack = + reason instanceof Error && reason.stack + ? reason.stack.split("\n").slice(0, 5).join("\n") + : ""; console.warn( "[openclaw] Non-fatal unhandled rejection (continuing):", - formatUncaughtError(reason), + errorDetails, + stack ? `\nStack trace (truncated):\n${stack}` : "", ); return; } diff --git a/src/media-understanding/providers/image.ts b/src/media-understanding/providers/image.ts index d996c7583..44407c0d4 100644 --- a/src/media-understanding/providers/image.ts +++ b/src/media-understanding/providers/image.ts @@ -1,6 +1,6 @@ import type { Api, AssistantMessage, Context, Model } from "@mariozechner/pi-ai"; import { complete } from "@mariozechner/pi-ai"; -import { discoverAuthStorage, discoverModels } from "@mariozechner/pi-coding-agent"; +import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent"; import { getApiKeyForModel, requireApiKey } from "../../agents/model-auth.js"; import { ensureOpenClawModelsJson } from "../../agents/models-config.js"; @@ -12,8 +12,8 @@ export async function describeImageWithModel( params: ImageDescriptionRequest, ): Promise { await ensureOpenClawModelsJson(params.cfg, params.agentDir); - const authStorage = discoverAuthStorage(params.agentDir); - const modelRegistry = discoverModels(authStorage, params.agentDir); + const authStorage = new AuthStorage(); + const modelRegistry = new ModelRegistry(authStorage); const model = modelRegistry.find(params.provider, params.model) as Model | null; if (!model) { throw new Error(`Unknown model: ${params.provider}/${params.model}`); diff --git a/src/telegram/monitor.ts b/src/telegram/monitor.ts index 2709b591b..3f3122734 100644 --- a/src/telegram/monitor.ts +++ b/src/telegram/monitor.ts @@ -159,6 +159,9 @@ export async function monitorTelegramProvider(opts: MonitorTelegramOpts = {}) { while (!opts.abortSignal?.aborted) { const runner = run(bot, createTelegramRunnerOptions(cfg)); + if (!runner) { + throw new Error("Failed to create Telegram runner"); + } const stopOnAbort = () => { if (opts.abortSignal?.aborted) { void runner.stop(); @@ -167,7 +170,15 @@ export async function monitorTelegramProvider(opts: MonitorTelegramOpts = {}) { opts.abortSignal?.addEventListener("abort", stopOnAbort, { once: true }); try { // runner.task() returns a promise that resolves when the runner stops - await runner.task(); + // Wrap in a defensive promise handler to catch any unhandled rejections + // from the grammY runner internals (addresses issue #4501) + const task = runner.task(); + if (task) { + await task.catch((taskErr) => { + // Re-throw to be handled by the outer catch block + throw taskErr; + }); + } return; } catch (err) { if (opts.abortSignal?.aborted) { @@ -177,6 +188,10 @@ export async function monitorTelegramProvider(opts: MonitorTelegramOpts = {}) { const isRecoverable = isRecoverableTelegramNetworkError(err, { context: "polling" }); const isNetworkError = isNetworkRelatedError(err); if (!isConflict && !isRecoverable && !isNetworkError) { + // Log detailed error info for non-recoverable errors before throwing + (opts.runtime?.error ?? console.error)( + `Telegram non-recoverable error (will crash): ${formatErrorMessage(err)}`, + ); throw err; } restartAttempts += 1; @@ -194,6 +209,14 @@ export async function monitorTelegramProvider(opts: MonitorTelegramOpts = {}) { } } finally { opts.abortSignal?.removeEventListener("abort", stopOnAbort); + // Ensure runner is properly stopped to prevent floating promises (issue #4501) + try { + // runner.stop() is idempotent and safe to call multiple times + await runner.stop(); + } catch { + // Ignore errors during stop - we're cleaning up + // This is expected if the runner already stopped + } } } }