@myagentroam/node 0.9.62 → 0.9.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +4 -0
- package/dist/capabilities.js +110 -2
- package/dist/claude-agent-sdk.js +330 -2
- package/dist/claude-channel.js +44 -2
- package/dist/codex-app-server.js +510 -2
- package/dist/config.js +106 -2
- package/dist/connector/node-connector-options.js +1 -2
- package/dist/connector/node-operation-router.js +22 -2
- package/dist/connector.js +1736 -2
- package/dist/control-outbound-scheduler.js +153 -2
- package/dist/database.js +639 -2
- package/dist/fake-runner.js +129 -2
- package/dist/git-askpass.js +12 -0
- package/dist/git-execution-helper.js +266 -0
- package/dist/health.js +3 -2
- package/dist/main.js +57 -2
- package/dist/mcp-installation-model.js +1 -2
- package/dist/migrations/v004.js +55 -3
- package/dist/migrations/v005.js +13 -3
- package/dist/migrations/v006.js +90 -3
- package/dist/migrations/v007.js +22 -3
- package/dist/migrations/v008.js +18 -3
- package/dist/migrations/v009.js +70 -4
- package/dist/migrations/v010.js +43 -3
- package/dist/migrations/v011.js +20 -3
- package/dist/migrations/v012.js +8 -0
- package/dist/native-jsonl-reader.js +186 -2
- package/dist/native-session-history.js +1143 -2
- package/dist/opencode-runtime.js +80 -2
- package/dist/opencode-server.js +259 -2
- package/dist/operational.js +122 -2
- package/dist/process-tree.js +18 -2
- package/dist/ripgrep-binary.js +31 -2
- package/dist/rotating-log.js +67 -2
- package/dist/runner/abstract-runner.js +260 -2
- package/dist/runner/claude/managed-run-controller.js +355 -2
- package/dist/runner/claude/tool-normalizer.js +120 -2
- package/dist/runner/claude-code-runner.js +303 -2
- package/dist/runner/codex/composer-image-markers.js +8 -2
- package/dist/runner/codex/conversation-parser.js +913 -2
- package/dist/runner/codex/managed-run-controller.js +494 -2
- package/dist/runner/codex/tool-normalizer.js +214 -2
- package/dist/runner/codex-runner.js +585 -2
- package/dist/runner/fake-test-runner.js +47 -2
- package/dist/runner/mar-agent/conversation-normalizer.js +644 -2
- package/dist/runner/mar-agent/executor-stdio-client-transport.js +139 -2
- package/dist/runner/mar-agent/generated-images.js +41 -2
- package/dist/runner/mar-agent/history-projection.js +106 -2
- package/dist/runner/mar-agent/hosted-conversation-runtime.js +446 -2
- package/dist/runner/mar-agent/managed-run-controller.js +785 -2
- package/dist/runner/mar-agent/mcp-client-pool.js +233 -2
- package/dist/runner/mar-agent/runtime-model-factory.js +326 -2
- package/dist/runner/mar-agent-runner.js +458 -2
- package/dist/runner/opencode/conversation-parser.js +221 -2
- package/dist/runner/opencode/managed-run-controller.js +588 -2
- package/dist/runner/opencode/tool-normalizer.js +80 -2
- package/dist/runner/opencode-runner.js +426 -2
- package/dist/runner/runner-registry.js +87 -2
- package/dist/runner-command-engine.js +71 -2
- package/dist/runner-profiles.js +323 -2
- package/dist/runner-usage.js +190 -2
- package/dist/runtime-command-detector.js +73 -2
- package/dist/runtime-model.js +1 -2
- package/dist/runtime-state.js +1509 -2
- package/dist/service/attachment-domain-state.js +7 -2
- package/dist/service/bubblewrap-sandbox-executor.js +543 -2
- package/dist/service/continuous-run-coordinator.js +425 -2
- package/dist/service/conversation-history-service.js +552 -2
- package/dist/service/conversation-hosting-capability-service.js +61 -2
- package/dist/service/conversation-hosting-enablement-service.js +91 -2
- package/dist/service/conversation-hosting-maintenance-service.js +174 -2
- package/dist/service/conversation-segment-service.js +162 -2
- package/dist/service/conversation-template-node-service.js +992 -2
- package/dist/service/external-session-resume-service.js +152 -2
- package/dist/service/fake-managed-run-service.js +60 -2
- package/dist/service/git-execution-service.js +418 -0
- package/dist/service/git-operation-service.js +57 -0
- package/dist/service/hosted-conversation-node-service.js +1982 -2
- package/dist/service/hosted-conversation-store.js +1405 -2
- package/dist/service/managed-runner-session-service.js +35 -2
- package/dist/service/mar-agent-model-transport-test-service.js +88 -2
- package/dist/service/mcp-installation-verifier.js +87 -2
- package/dist/service/mcp-node-operation-service.js +90 -2
- package/dist/service/mission-mcp-server.js +124 -2
- package/dist/service/mission-mcp-stdio.js +40 -2
- package/dist/service/mission-runtime.js +142 -2
- package/dist/service/native-session-projection-service.js +274 -2
- package/dist/service/native-session-watch-service.js +683 -2
- package/dist/service/node-connection-lifecycle-service.js +88 -2
- package/dist/service/node-control-channel.js +85 -2
- package/dist/service/node-control-message-service.js +109 -2
- package/dist/service/node-request-service.js +62 -2
- package/dist/service/node-run-event-bridge.js +88 -2
- package/dist/service/node-terminal-channel.js +202 -2
- package/dist/service/node-upgrade-coordinator.js +137 -2
- package/dist/service/node-workspace-coordinator.js +97 -2
- package/dist/service/recent-run-projection-service.js +99 -2
- package/dist/service/run-attachment-service.js +321 -2
- package/dist/service/run-domain-state.js +4 -2
- package/dist/service/run-event-service.js +246 -2
- package/dist/service/run-ownership-policy.js +22 -2
- package/dist/service/run-workbench-service.js +120 -2
- package/dist/service/runner-channel-message-service.js +20 -2
- package/dist/service/runner-interaction-service.js +243 -2
- package/dist/service/runner-service.js +69 -2
- package/dist/service/runtime-credential-control-service.js +95 -2
- package/dist/service/session-catalog-service.js +404 -2
- package/dist/service/session-command-service.js +125 -2
- package/dist/service/session-context-service.js +128 -2
- package/dist/service/session-domain-state.js +9 -2
- package/dist/service/session-identity-service.js +86 -2
- package/dist/service/session-lifecycle-service.js +248 -2
- package/dist/service/session-message-service.js +270 -2
- package/dist/service/session-presentation-service.js +43 -2
- package/dist/service/session-query-service.js +82 -2
- package/dist/service/session-watch-slot-coordinator.js +21 -2
- package/dist/service/skill-directory-service.js +238 -2
- package/dist/service/skill-install-service.js +434 -2
- package/dist/service/skill-node-operation-service.js +206 -2
- package/dist/service/terminal-relay-state.js +3 -2
- package/dist/service/terminal-service.js +90 -2
- package/dist/service/web-search-error.js +40 -2
- package/dist/service/workbench-event-service.js +21 -2
- package/dist/service/workbench-manifest-service.js +69 -2
- package/dist/service/workspace-change-service.js +290 -2
- package/dist/service/workspace-content-search-service.js +457 -2
- package/dist/service/workspace-domain-state.js +41 -2
- package/dist/service/workspace-file-service.js +150 -2
- package/dist/service/workspace-git-exclude-service.js +119 -2
- package/dist/service/workspace-queue-workbench-service.js +176 -2
- package/dist/service/workspace-service.js +92 -2
- package/dist/service/workspace-session-service.js +154 -2
- package/dist/service/workspace-upload-service.js +262 -2
- package/dist/service/workspace-watch-controller.js +68 -2
- package/dist/service/workspace-watch-service.js +170 -2
- package/dist/service/workspace-watch-snapshot-service.js +218 -2
- package/dist/service/workspace-workbench-service.js +239 -2
- package/dist/service.js +91 -2
- package/dist/storage.js +32 -2
- package/dist/supervisor.js +136 -2
- package/dist/terminal.js +496 -2
- package/dist/util/git-credential-client.js +32 -0
- package/dist/util/node-operation-data.js +9 -2
- package/dist/util/node-operation-parsers.js +382 -2
- package/dist/util/personal-instructions.js +34 -2
- package/dist/util/runner-error.js +70 -2
- package/dist/util/runner-native-session-parsers.js +510 -2
- package/dist/util/safe-error.js +8 -2
- package/dist/util/secret-environment.js +25 -2
- package/dist/workspace.js +1793 -2
- package/package.json +11 -8
- package/vendor/ripgrep/darwin-arm64/rg +0 -0
- package/vendor/ripgrep/darwin-x64/rg +0 -0
- package/vendor/ripgrep/manifest.json +12 -0
- package/README.md +0 -42
- package/dist/event-buffer.js +0 -2
- package/dist/migrations/v001.js +0 -107
- package/dist/migrations/v002.js +0 -2
- package/dist/migrations/v003.js +0 -2
- package/dist/service/mcp-package-installer.js +0 -2
|
@@ -1,2 +1,303 @@
|
|
|
1
|
-
|
|
2
|
-
const _0x2c013c=_0x316f;(function(_0x3a0d51,_0x569a75){const _0x2b3f4b=_0x316f,_0x2b0e69=_0x3a0d51();while(!![]){try{const _0x2beaf5=-parseInt(_0x2b3f4b(0xed))/(0x11b7+-0x9f1+0x297*-0x3)*(parseInt(_0x2b3f4b(0xdb))/(0x1075+0x16f+0x6d*-0x2a))+-parseInt(_0x2b3f4b(0x98))/(0x91a+0x17a+-0xa91*0x1)+-parseInt(_0x2b3f4b(0xc3))/(0x248b+-0x2058+-0x42f)*(parseInt(_0x2b3f4b(0xb0))/(0x1e1d+-0x96e+-0x14aa))+parseInt(_0x2b3f4b(0xc8))/(-0x2f*0x37+-0x1*-0xc33+-0x13*0x1c)+parseInt(_0x2b3f4b(0xec))/(-0x185b*-0x1+0x1*-0x101e+-0x41b*0x2)*(-parseInt(_0x2b3f4b(0xa2))/(0x8*0x76+0x1bd+-0x565))+parseInt(_0x2b3f4b(0x88))/(0x13*0x8d+-0x2*0xc5d+0x5*0x2dc)+parseInt(_0x2b3f4b(0xb8))/(-0x1a79+0x1f7f+-0x4fc);if(_0x2beaf5===_0x569a75)break;else _0x2b0e69['push'](_0x2b0e69['shift']());}catch(_0x58da4a){_0x2b0e69['push'](_0x2b0e69['shift']());}}}(_0x3f01,0xcaad8+0x13*-0xb332+-0xf*-0xae8e));import{ClaudeAgentSdkAdapter}from'../claude-agent-sdk.js';import{AbstractRunner}from'./abstract-runner.js';function _0x3f01(){const _0x3ffaa7=['Cgf0Aa','C2v0','CMvTzw1Izxjnyw5Hz2vKtMf0AxzL','D29YA3nWywnLugf0Aa','DMfSDwvZ','zgvMyxvSDa','D29YA3nWywnLCW','BwfUywDLze5HDgL2zuLKCW','CNvUlMnHBMnLBa','ywrK','y2XPzw50','C3rHCNrdAgfUBMvS','CMvZDw1LrxH0zxjUywW','CNvUCW','mZqWmdiYowTmrxfNsG','mJrruxvpDeq','surmrq','yxjNCW','u0vtu0LptL9srvnvtuvFuKvkrunuruq','zxzLBNrZlMXPDMu','C2vZC2LVBI5YzxDPBMq','C2vZC2LVBI5Yzw5HBwu','zgvSzxrL','BwfW','DgL0BgvtB3vYy2u','zM9YA05HDgL2zq','u1resu8','zxH0zxjUywXtzxnZAw9Uswq','zMXHDe1HCa','tufoquDfrf9bq1rjvKu','ChvZAa','BgLZDfnLC3nPB25Z','C2vZC2LVBKLUzM8','C3rHCNq','CMvZB2X2zq','zw52AxjVBM1LBNq','zgvSAxzLCKnOyw5UzwW','BwfUywDLzefSAwfZrM9Y','zw5ZDxjLq29UzMLNDxjHDgLVBG','AgLZDg9YEs5YzwfK','zgvMyxvSDenVBMzPz3vYyxrPB24','tufoquDfra','BwfUywDLzefJDgL2zq','uLvotKvsx1jfu1vnrv9gquLmruq','zgLZy292zxj5u2nVCgu','rvHurvjoquXFu0vtu0LptL9pqLnfuLzfx09otfK','y29TBwfUza','CgXHBG','DhjHBNnWB3j0','AgvHzgvYCW','DhvYBI5XDwv1zq','zNjVBuvUDhjPzxm','BwfYu2vZC2LVBKLK','mtaWnJiYmdDtt3vRAMS','BMf0AxzLqwXPyxnLC0zVCG','CNvUBMvY','zMLUza','D29YA3nWywnLswq','uevoreLor19srunfsvbu','uLvotKvsx1nfu1njt05Fv09ss1nqqunfx01ju01bveni','BMfTzq','BwfUywDLzefSAwfZswq','C3rKAw8','ChjVAMvJDerPC2nVDMvYzwrtzxnZAw9UCW','zxHLy3v0Aw9U','yxbWCM92ywWUCMvZCg9Uza','Dg9Rzw4','zgLZy292zxjtzxnZAw9UCW','CMvHze1HBMfNzwrsDw5UzxjuAxrSzq','mtq2mJKZmKPVCeTNva','y3vYCMvUDfjLC3vTzwq','BMf0AxzL','uLvotKvsx1nfu1njt05FtK9ux0zpvu5e','C3rYAw5N','BwfUywDLzfnLC3nPB25cEu5HDgL2zuLK','uKvkrunuruq','BwvKAxvT','zM9Yz2v0tMf0AxzLqwXPyxm','y3jLyxrL','oerhEhrovG','zMLUzeLUzgv4','tufsx01btKfhruq','zgvSAxzLCNK','DMfSAwrHDgLVBG','v09ss1nqqunfx1jfuvvjuKve','CMvHzenVBNrLEhrvC2fNzq','y3jLyxrLuhjVAMvJDgLVBG','vu5bvKfjtefcteu','u0vtu0LptL9srvDjtKrFvu5bvKfjtefcteu','CNvUBMvYvgL0Bgu','yxzHAwXHyMXL','zgvSAxzLCG','ChjVzMLSzuzVCLzHBgLKyxrPB24','mJi0ntuXnuf3yuLkyG','DxnLCKLUChv0CW','y2XHDwrLlwnVzgu','y2XHDwrLq29Kzq','yxbWCM92ywXZ','u1rfrvjfra','C2vZC2LVBI5Yzw1VDMu','uLvotKvsx1voqvzbsuXbqKXf','nJCYmZC1mhfosLvowq','y2HHBM5LBfrVA2vU','ywnJzxb0','rvHurvjoquW','DhvYBI5ZDgfYDa','z2f0zq','ChjLC2vUDfnLC3nPB24','zM9YA1nLC3nPB24','uKvtvu1bqKXf','C2vZC2LVBI5WAw4','BgfZDefJDgL2Axr5qxq','og9dAKXAsG','BwnWq29UzMLNDxjHDgLVBG','DhvYBI5PBNrLCNj1Chq','BgLUDxG','y29KzxG','ndm3mdaZnhfIzvHNAa','ChjVBw90zq','DxjS','CMvHzenVBNzLCNnHDgLVBKHPC3rVCNK','ywnRBM93BgvKz2u','zw50CMLLCW','z2v0','B3bLBKnVzgu','t0jtrvjwrv9ptKXz','y29TBwfUzfn0yxrLCW','AgfUzgXL','DgHLBG','zMLSDgvY','ChjVzMLSzq','ChjVAMvJDgLVBKzVCG','C3rVCa','BMf0AxzLq29UDhjVBa','ChjLCgfYzu1LC3nHz2vjBNb1Da','Ahr0Ca','mtuYngPJzKf0CG','DgL0Bgu','y3DK'];_0x3f01=function(){return _0x3ffaa7;};return _0x3f01();}import{claudeDefaultModel,declaredRunnerProfiles}from'../runner-profiles.js';import{withClaudePlanTag}from'../runner-command-engine.js';import{discoverNativeSessions,readNativeSession,readClaudeNativeContextUsage}from'../native-session-history.js';function _0x316f(_0x125f29,_0x1add1f){_0x125f29=_0x125f29-(0x1*-0x18e0+-0x124f+0x2b9b);const _0x450986=_0x3f01();let _0x21ea41=_0x450986[_0x125f29];if(_0x316f['ZXSzma']===undefined){var _0x1121e4=function(_0x1d33bf){const _0xda350c='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4b4ca8='',_0x1d4627='';for(let _0x5a1279=0x1998+-0x789+-0x120f,_0x58e878,_0x1f6a9e,_0x8dba81=-0x2*-0x96d+-0xe95*0x1+-0x445*0x1;_0x1f6a9e=_0x1d33bf['charAt'](_0x8dba81++);~_0x1f6a9e&&(_0x58e878=_0x5a1279%(0xd4d*0x2+-0x68*-0x45+-0x2*0x1b4f)?_0x58e878*(-0x64d*-0x5+0x920+-0x2861*0x1)+_0x1f6a9e:_0x1f6a9e,_0x5a1279++%(-0x191a+-0x1*0x26ef+0x400d))?_0x4b4ca8+=String['fromCharCode'](-0x1831+0x21a3+0x135*-0x7&_0x58e878>>(-(-0xe65+0x105*0x7+0x744)*_0x5a1279&0x230f*-0x1+0x1364+0xfb1)):-0x1*0x10ff+-0x14d0+0x25cf){_0x1f6a9e=_0xda350c['indexOf'](_0x1f6a9e);}for(let _0x2ff3a6=0x19d+-0x1*0x16+0x11*-0x17,_0x2afc2c=_0x4b4ca8['length'];_0x2ff3a6<_0x2afc2c;_0x2ff3a6++){_0x1d4627+='%'+('00'+_0x4b4ca8['charCodeAt'](_0x2ff3a6)['toString'](-0x869*0x2+-0x38f*-0x7+0x2ad*-0x3))['slice'](-(0xe7d+-0x32a+-0x1*0xb51));}return decodeURIComponent(_0x1d4627);};_0x316f['BYSzjd']=_0x1121e4,_0x316f['PzksAf']={},_0x316f['ZXSzma']=!![];}const _0x380b07=_0x450986[0x1*0x12b2+0x2*0xc5e+-0x2b6e*0x1];_0x316f['jGUSbI']!==_0x380b07&&(_0x316f['PzksAf']={},_0x316f['jGUSbI']=_0x380b07);const _0x2efec6=_0x316f['PzksAf'][_0x125f29];return _0x2efec6===undefined?(_0x21ea41=_0x316f['BYSzjd'](_0x21ea41),_0x316f['PzksAf'][_0x125f29]=_0x21ea41):_0x21ea41=_0x2efec6,_0x21ea41;}import{claudeDiscoveredSession,deduplicateDirectSessions,isNativeHistory,isWithinWorkspace,latestNativeActivity}from'./codex/conversation-parser.js';export class ClaudeCodeRunner extends AbstractRunner{[_0x2c013c(0xe8)];[_0x2c013c(0x76)];[_0x2c013c(0x8f)]=_0x2c013c(0xb2);[_0x2c013c(0x7f)]=_0x2c013c(0xa7);[_0x2c013c(0x93)]=new ClaudeExecutionState();constructor(_0x360393=new ClaudeAgentSdkAdapter(),_0x131934=process.env){const _0x2ccc95=_0x2c013c;super(),this[_0x2ccc95(0xe8)]=_0x360393,this[_0x2ccc95(0x76)]=_0x131934;}[_0x2c013c(0xd5)](_0x502881){const _0x34bc69=_0x2c013c;return declaredRunnerProfiles({'codexAvailable':_0x502881[_0x34bc69(0xc7)][_0x34bc69(0xad)],'claudeCodeAvailable':_0x502881[_0x34bc69(0xb3)][_0x34bc69(0xad)],'environment':this[_0x34bc69(0x76)],'openCodeAvailable':_0x502881[_0x34bc69(0xcf)]?.[_0x34bc69(0xad)]===!![]})[_0x34bc69(0x8b)](_0x51e6b5=>_0x51e6b5[_0x34bc69(0x8a)]===this[_0x34bc69(0x8f)]);}[_0x2c013c(0xad)](_0x42a785){const _0x414f1d=_0x2c013c;return _0x42a785[_0x414f1d(0xb3)][_0x414f1d(0xad)];}[_0x2c013c(0xaf)](){const _0x3a2c75=_0x2c013c;return this[_0x3a2c75(0xd5)]({'platform':_0x3a2c75(0xc6),'architecture':_0x3a2c75(0xa6),'nodeAppVersion':_0x3a2c75(0xa6),'nodeVersion':_0x3a2c75(0xa6),'codex':{'available':![]},'claudeCode':{'available':!![]},'openCode':{'available':![]}});}[_0x2c013c(0x7b)](){const _0x4da7ce=_0x2c013c;return{'runner':this[_0x4da7ce(0x8f)],'model':claudeDefaultModel(this[_0x4da7ce(0x76)]),'effort':_0x4da7ce(0x9f),'access':_0x4da7ce(0xe3)};}[_0x2c013c(0xc4)](_0x5bbe0f,_0x351ed1){const _0x400e5d=_0x2c013c,_0x164cbd=super[_0x400e5d(0xc4)](_0x5bbe0f,_0x351ed1);return Object[_0x400e5d(0x86)](_0x164cbd[_0x400e5d(0xf5)](_0x5b363f=>[_0x5b363f[_0x400e5d(0x8f)],_0x5b363f[_0x400e5d(0x83)]===_0x400e5d(0x6d)?{'type':_0x400e5d(0x91),'command':_0x5b363f[_0x400e5d(0x81)],'args':[..._0x5b363f[_0x400e5d(0xef)]??[]],'env':{..._0x5b363f[_0x400e5d(0x76)]??{}}}:{'type':_0x400e5d(0xda),'url':_0x5b363f[_0x400e5d(0xca)],'headers':{..._0x5b363f[_0x400e5d(0x84)]??{}}}]));}async[_0x2c013c(0xea)](_0x211f5a,_0x562353){const _0x68c381=_0x2c013c;if(_0x211f5a[_0x68c381(0x8a)]!==this[_0x68c381(0x8f)]||_0x211f5a[_0x68c381(0xd8)]!==_0x68c381(0xbb)||_0x211f5a[_0x68c381(0x6e)]===null||!_0x562353[_0x68c381(0xad)])return{'failureCode':_0x68c381(0xb7),'messageFailureCode':_0x68c381(0xf0)};const _0x3ad349=_0x562353[_0x68c381(0x78)](_0x211f5a);if(_0x3ad349!==undefined)return{'session':_0x562353[_0x68c381(0x79)](_0x3ad349),'activity':_0x68c381(0xee)};const _0x331e11=_0x562353[_0x68c381(0x99)](_0x211f5a['id']);if(_0x331e11!==undefined)return{'session':_0x562353[_0x68c381(0x79)](_0x331e11),'activity':_0x68c381(0xee)};try{const _0x10dc92=await this[_0x68c381(0x73)](_0x211f5a[_0x68c381(0x6e)],_0x211f5a[_0x68c381(0xdd)]);if(_0x10dc92===undefined)return{'failureCode':_0x68c381(0x9b),'messageFailureCode':_0x68c381(0xf0)};const _0x17cc01=_0x562353[_0x68c381(0xe1)](_0x211f5a[_0x68c381(0x8c)]);if(_0x17cc01===undefined||typeof _0x10dc92[_0x68c381(0xdd)]===_0x68c381(0x9c)&&!isWithinWorkspace(_0x10dc92[_0x68c381(0xdd)],_0x17cc01))return{'failureCode':_0x68c381(0x8e),'messageFailureCode':_0x68c381(0xf0)};const _0x5e0edb=_0x562353[_0x68c381(0x99)](_0x211f5a['id']);if(_0x5e0edb!==undefined)return{'session':_0x562353[_0x68c381(0x79)](_0x5e0edb),'activity':_0x68c381(0xee)};const _0xbdd009=_0x562353[_0x68c381(0xd6)](_0x211f5a),_0x110daa=_0xbdd009===undefined?_0x562353[_0x68c381(0xa1)](_0x211f5a):_0x562353[_0x68c381(0xc9)](_0xbdd009['id']);if(_0x110daa===undefined)return{'failureCode':_0x68c381(0x7e),'messageFailureCode':_0x68c381(0xf0)};const _0x2bbdb=_0x562353[_0x68c381(0x79)](_0x110daa);return _0x562353[_0x68c381(0xe0)](_0x211f5a[_0x68c381(0x6e)],_0x2bbdb['id']),{'session':_0x2bbdb,'activity':_0x68c381(0xee)};}catch{return{'failureCode':_0x68c381(0x7e),'messageFailureCode':_0x68c381(0xf0)};}}async[_0x2c013c(0x96)](_0x1a250d,_0x3eee13){const _0x48258a=_0x2c013c,_0x1ffd94=[];for(const _0x22fc4a of _0x3eee13===undefined?_0x1a250d[_0x48258a(0xe4)]:[_0x3eee13]){let _0x12293d=[];try{_0x12293d=await this[_0x48258a(0x72)](_0x22fc4a[_0x48258a(0xde)]);}catch{}const _0x58bd93=await discoverNativeSessions(this[_0x48258a(0x8f)],_0x22fc4a[_0x48258a(0xde)]);_0x1ffd94[_0x48258a(0x71)](...this[_0x48258a(0x92)](_0x1a250d,_0x22fc4a,[..._0x12293d[_0x48258a(0x6f)](_0x2c0bbb=>{const _0xad20fe=_0x48258a,_0xcb78d4=claudeDiscoveredSession(_0x2c0bbb,_0x22fc4a[_0xad20fe(0xde)]);return _0xcb78d4===undefined?[]:[_0xcb78d4];}),..._0x58bd93]));}return deduplicateDirectSessions(_0x1ffd94);}[_0x2c013c(0xa8)](_0x5280d4){const _0x261ac1=_0x2c013c;return _0x5280d4[_0x261ac1(0x6e)]===null?Promise[_0x261ac1(0x75)](undefined):readClaudeNativeContextUsage(_0x5280d4[_0x261ac1(0xdd)],_0x5280d4[_0x261ac1(0x6e)]);}async[_0x2c013c(0xcb)](_0x51e5dd){const _0x5b3a08=_0x2c013c,_0x1e1e46=await _0x51e5dd[_0x5b3a08(0x9a)]();return _0x1e1e46===undefined?undefined:{..._0x1e1e46,'source':_0x5b3a08(0x9a)};}[_0x2c013c(0x6c)](_0x386596,_0x2c8093,_0x5b6680){const _0x38788f=_0x2c013c;if(_0x386596[_0x38788f(0x6e)]===null)throw new Error(_0x38788f(0xab));return _0x2c8093===null?Promise[_0x38788f(0x75)](null):this[_0x38788f(0xe8)][_0x38788f(0xbf)](_0x386596[_0x38788f(0x6e)],_0x386596[_0x38788f(0xdd)],_0x2c8093,_0x5b6680);}[_0x2c013c(0xbe)](_0x5739a6,_0x1c2d88,_0x4e59f6){const _0x596725=_0x2c013c;if(_0x1c2d88[_0x596725(0xb3)][_0x596725(0xad)]&&_0x5739a6[_0x596725(0xd8)]===_0x596725(0xa4)){const _0x3fee13=[_0x596725(0x7a),_0x596725(0xf1),_0x596725(0xbc),_0x596725(0x85),_0x596725(0xc5),_0x596725(0xe6),_0x596725(0x94),_0x596725(0xf3),_0x596725(0xb6),_0x596725(0xc1),..._0x5739a6[_0x596725(0x6e)]===null?[]:[_0x596725(0xf2)]];return{'activity':_0x4e59f6[_0x596725(0x7d)]?_0x596725(0x70):_0x596725(0xee),'control':{'level':_0x596725(0x7c),'capabilities':[_0x596725(0x7a),_0x596725(0xf1),_0x596725(0xbc),_0x596725(0xc5)]},'commandStates':_0x4e59f6[_0x596725(0xd1)],'runtime':{'level':_0x596725(0x7c),'capabilities':_0x3fee13,'reasonCode':null}};}if(_0x1c2d88[_0x596725(0xb3)][_0x596725(0xad)]&&_0x5739a6[_0x596725(0x6e)]!==null){const _0x58a259=[_0x596725(0x7a),_0x596725(0xbc),_0x596725(0xf3),_0x596725(0xb6),_0x596725(0xc1),_0x596725(0xf2)];return{'activity':_0x596725(0xee),'control':{'level':_0x596725(0xc0),'capabilities':[_0x596725(0x7a),_0x596725(0xbc)]},'commandStates':_0x4e59f6[_0x596725(0xd1)],'runtime':{'level':_0x596725(0xc0),'capabilities':_0x58a259,'reasonCode':null}};}const _0x475aa4=[_0x596725(0x7a),_0x596725(0xf1),_0x596725(0xf3),_0x596725(0xb6),_0x596725(0xc1)];return{'activity':_0x596725(0xaa),'control':{'level':_0x596725(0xd0),'capabilities':[_0x596725(0x7a),_0x596725(0xf1)]},'commandStates':_0x4e59f6[_0x596725(0xd1)],'runtime':{'level':_0x596725(0xd0),'capabilities':_0x475aa4,'reasonCode':_0x596725(0x80)}};}[_0x2c013c(0xd9)](_0x1cdde9,_0x7cc2f0){const _0x413ef9=_0x2c013c;return _0x7cc2f0===_0x413ef9(0x82)?withClaudePlanTag(_0x1cdde9):_0x1cdde9;}[_0x2c013c(0xb9)](_0x1af215){const _0x26dfc0=_0x2c013c;return[...this[_0x26dfc0(0x93)][_0x26dfc0(0xeb)][_0x26dfc0(0xe2)]()][_0x26dfc0(0x8b)](_0x16490d=>_0x16490d[_0x26dfc0(0x87)]===_0x1af215)?.[_0x26dfc0(0xbd)][_0x26dfc0(0x95)];}[_0x2c013c(0x77)](_0x50925f,_0x299967,_0x10f7d4,_0xae0bfa,_0x31a847,_0x2f95cc){const _0x326f86=_0x2c013c,_0xe4ab01=[...this[_0x326f86(0x93)][_0x326f86(0xeb)][_0x326f86(0xcd)]()][_0x326f86(0x8b)](([,_0x1b281c])=>_0x1b281c[_0x326f86(0x87)]===_0x50925f);if(_0xe4ab01===undefined)return _0x326f86(0x9e);const [_0x5993f3,_0x29f113]=_0xe4ab01,_0x39725c=_0x29f113[_0x326f86(0xbd)][_0x326f86(0xa5)](_0x299967),_0x4126da=_0x29f113[_0x326f86(0xbd)][_0x326f86(0xba)]({'id':_0x299967,'senderId':_0x10f7d4,'token':_0xae0bfa,'content':_0x31a847});if(_0x4126da===_0x326f86(0x9e)){if(_0x39725c===undefined)_0x2f95cc(_0x5993f3,_0x299967,_0x326f86(0x9e));return _0x326f86(0x9e);}return _0x39725c===undefined&&_0x4126da===_0x326f86(0x8d)&&void _0x29f113[_0x326f86(0xd2)][_0x326f86(0xae)](_0x31a847)[_0x326f86(0xd3)](()=>_0x2f95cc(_0x5993f3,_0x299967,_0x29f113[_0x326f86(0xbd)][_0x326f86(0xcc)]({'messageId':_0x299967,'result':_0x326f86(0xb5)})),()=>_0x2f95cc(_0x5993f3,_0x299967,_0x29f113[_0x326f86(0xbd)][_0x326f86(0xcc)]({'messageId':_0x299967,'result':_0x326f86(0x9e)}))),_0x4126da;}[_0x2c013c(0x90)](_0x4e178a){const _0x4b39d2=_0x2c013c;return this[_0x4b39d2(0x93)][_0x4b39d2(0x9d)][_0x4b39d2(0xce)](_0x4e178a);}[_0x2c013c(0x89)](_0x4d1e17){const _0x2daae1=_0x2c013c;return[...this[_0x2daae1(0x93)][_0x2daae1(0x9d)]][_0x2daae1(0xd4)](([,_0x115a3d])=>_0x115a3d===_0x4d1e17)[_0x2daae1(0xf5)](([_0x4000f2])=>_0x4000f2);}[_0x2c013c(0xa0)](_0x17cce6){const _0x66f5d7=_0x2c013c;this[_0x66f5d7(0x93)][_0x66f5d7(0x9d)][_0x66f5d7(0xf4)](_0x17cce6),this[_0x66f5d7(0x93)][_0x66f5d7(0xe5)][_0x66f5d7(0xf4)](_0x17cce6);}[_0x2c013c(0xe0)](_0x5ea34e,_0x58da6d){const _0x55bf02=_0x2c013c;this[_0x55bf02(0x93)][_0x55bf02(0xe5)][_0x55bf02(0xe7)](_0x58da6d),this[_0x55bf02(0x93)][_0x55bf02(0x9d)][_0x55bf02(0xdf)](_0x58da6d,_0x5ea34e['id']);}async[_0x2c013c(0x97)](_0x415fac,_0x2bd389){const _0x4030fa=_0x2c013c;let _0x2bd55a=await readNativeSession(this[_0x4030fa(0x8f)],_0x415fac[_0x4030fa(0xdd)],_0x2bd389);if(_0x2bd55a===undefined){const _0x1483a5=await discoverNativeSessions(this[_0x4030fa(0x8f)],_0x415fac[_0x4030fa(0xdd)]);_0x2bd55a=_0x1483a5[_0x4030fa(0x8b)](_0x314d85=>_0x314d85[_0x4030fa(0x6e)]===_0x2bd389);}return _0x2bd55a?.[_0x4030fa(0xdc)];}[_0x2c013c(0x92)](_0x283335,_0x4681ce,_0x4de076){const _0x2757cd=_0x2c013c,_0x5a1626=[];for(const _0x37f9c5 of _0x4de076){if(!isWithinWorkspace(_0x37f9c5[_0x2757cd(0xdd)],_0x4681ce[_0x2757cd(0xde)]))continue;const _0x5e9ac5=_0x283335[_0x2757cd(0xa9)]({'workspace':_0x4681ce,'runner':this[_0x2757cd(0x8f)],'externalSessionId':_0x37f9c5[_0x2757cd(0x6e)],'cwd':_0x37f9c5[_0x2757cd(0xdd)],..._0x37f9c5[_0x2757cd(0xdc)]===undefined?{}:{'title':_0x37f9c5[_0x2757cd(0xdc)]},...isNativeHistory(_0x37f9c5)?{'lastActivityAt':latestNativeActivity(_0x37f9c5)}:{}}),_0x3d1df9=_0x5a1626[_0x2757cd(0xa3)](_0x442eae=>_0x442eae['id']===_0x5e9ac5['id']);if(_0x3d1df9<-0x1c01+-0x2*-0x96d+-0xd5*-0xb)_0x5a1626[_0x2757cd(0x71)](_0x5e9ac5);else{if(_0x5e9ac5[_0x2757cd(0xc2)]>=_0x5a1626[_0x3d1df9][_0x2757cd(0xc2)]){const _0x2fb59b=_0x5a1626[_0x3d1df9];_0x5a1626[_0x3d1df9]={..._0x5e9ac5,'runnerTitle':_0x5e9ac5[_0x2757cd(0xac)]??_0x2fb59b[_0x2757cd(0xac)],'titleSource':_0x5e9ac5[_0x2757cd(0xac)]===null?_0x2fb59b[_0x2757cd(0xf6)]:_0x5e9ac5[_0x2757cd(0xf6)]};}}}return deduplicateDirectSessions(_0x5a1626);}[_0x2c013c(0xd7)](){}[_0x2c013c(0x74)](_0x125f29){const _0x4fa1c4=_0x2c013c;return this[_0x4fa1c4(0xe8)][_0x4fa1c4(0x74)](_0x125f29);}[_0x2c013c(0xe9)](_0x1add1f){const _0x1e24a0=_0x2c013c;return this[_0x1e24a0(0xe8)][_0x1e24a0(0xe9)](_0x1add1f);}[_0x2c013c(0x72)](_0x450986){const _0x5cb56d=_0x2c013c;return this[_0x5cb56d(0xe8)][_0x5cb56d(0x72)](_0x450986);}[_0x2c013c(0x73)](_0x21ea41,_0x1121e4){const _0x2630f5=_0x2c013c;return this[_0x2630f5(0xe8)][_0x2630f5(0x73)](_0x21ea41,_0x1121e4);}}export class ClaudeExecutionState{[_0x2c013c(0xeb)]=new Map();[_0x2c013c(0xe5)]=new Set();[_0x2c013c(0x9d)]=new Map();[_0x2c013c(0xb4)]=new Map();[_0x2c013c(0xb1)]=new Map();}
|
|
1
|
+
import { ClaudeAgentSdkAdapter } from '../claude-agent-sdk.js';
|
|
2
|
+
import { AbstractRunner } from './abstract-runner.js';
|
|
3
|
+
import { claudeDefaultModel, declaredRunnerProfiles } from '../runner-profiles.js';
|
|
4
|
+
import { withClaudePlanTag } from '../runner-command-engine.js';
|
|
5
|
+
import { discoverNativeSessions, readNativeSession, readClaudeNativeContextUsage } from '../native-session-history.js';
|
|
6
|
+
import { claudeDiscoveredSession, deduplicateDirectSessions, isNativeHistory, isWithinWorkspace, latestNativeActivity } from './codex/conversation-parser.js';
|
|
7
|
+
export class ClaudeCodeRunner extends AbstractRunner {
|
|
8
|
+
client;
|
|
9
|
+
environment;
|
|
10
|
+
name = 'claude-code';
|
|
11
|
+
discoveryScope = 'WORKSPACE_REQUIRED';
|
|
12
|
+
execution = new ClaudeExecutionState();
|
|
13
|
+
constructor(client = new ClaudeAgentSdkAdapter(), environment = process.env) {
|
|
14
|
+
super();
|
|
15
|
+
this.client = client;
|
|
16
|
+
this.environment = environment;
|
|
17
|
+
}
|
|
18
|
+
profile(capabilities) {
|
|
19
|
+
return declaredRunnerProfiles({
|
|
20
|
+
codexAvailable: capabilities.codex.available,
|
|
21
|
+
claudeCodeAvailable: capabilities.claudeCode.available,
|
|
22
|
+
environment: this.environment,
|
|
23
|
+
openCodeAvailable: capabilities.openCode?.available === true
|
|
24
|
+
}).find((profile) => profile.runner === this.name);
|
|
25
|
+
}
|
|
26
|
+
available(capabilities) {
|
|
27
|
+
return capabilities.claudeCode.available;
|
|
28
|
+
}
|
|
29
|
+
profileForValidation() {
|
|
30
|
+
return this.profile({
|
|
31
|
+
platform: 'linux',
|
|
32
|
+
architecture: 'validation',
|
|
33
|
+
nodeAppVersion: 'validation',
|
|
34
|
+
nodeVersion: 'validation',
|
|
35
|
+
codex: { available: false },
|
|
36
|
+
claudeCode: { available: true },
|
|
37
|
+
openCode: { available: false }
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
defaultConfiguration() {
|
|
41
|
+
return {
|
|
42
|
+
runner: this.name,
|
|
43
|
+
model: claudeDefaultModel(this.environment),
|
|
44
|
+
effort: 'medium',
|
|
45
|
+
access: 'default'
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
mcpConfiguration(raw, secrets) {
|
|
49
|
+
const servers = super.mcpConfiguration(raw, secrets);
|
|
50
|
+
return Object.fromEntries(servers.map((server) => [
|
|
51
|
+
server.name,
|
|
52
|
+
server.transport === 'STDIO'
|
|
53
|
+
? {
|
|
54
|
+
type: 'stdio',
|
|
55
|
+
command: server.command,
|
|
56
|
+
args: [...(server.args ?? [])],
|
|
57
|
+
env: { ...(server.environment ?? {}) }
|
|
58
|
+
}
|
|
59
|
+
: { type: 'http', url: server.url, headers: { ...(server.headers ?? {}) } }
|
|
60
|
+
]));
|
|
61
|
+
}
|
|
62
|
+
async resumeExternal(external, context) {
|
|
63
|
+
if (external.runner !== this.name ||
|
|
64
|
+
external.nativeControl !== 'EXTERNAL' ||
|
|
65
|
+
external.externalSessionId === null ||
|
|
66
|
+
!context.available)
|
|
67
|
+
return {
|
|
68
|
+
failureCode: 'RUNNER_UNAVAILABLE',
|
|
69
|
+
messageFailureCode: 'SESSION_RESUME_REJECTED'
|
|
70
|
+
};
|
|
71
|
+
const nativeAlias = context.managedAliasFor(external);
|
|
72
|
+
if (nativeAlias !== undefined)
|
|
73
|
+
return { session: context.ensureConfiguration(nativeAlias), activity: 'IDLE' };
|
|
74
|
+
const existing = context.currentResumed(external.id);
|
|
75
|
+
if (existing !== undefined)
|
|
76
|
+
return { session: context.ensureConfiguration(existing), activity: 'IDLE' };
|
|
77
|
+
try {
|
|
78
|
+
const sessionInfo = await this.sessionInfo(external.externalSessionId, external.cwd);
|
|
79
|
+
if (sessionInfo === undefined)
|
|
80
|
+
return {
|
|
81
|
+
failureCode: 'RUNNER_SESSION_NOT_FOUND',
|
|
82
|
+
messageFailureCode: 'SESSION_RESUME_REJECTED'
|
|
83
|
+
};
|
|
84
|
+
const workspacePath = context.workspacePath(external.workspaceId);
|
|
85
|
+
if (workspacePath === undefined ||
|
|
86
|
+
(typeof sessionInfo.cwd === 'string' && !isWithinWorkspace(sessionInfo.cwd, workspacePath)))
|
|
87
|
+
return {
|
|
88
|
+
failureCode: 'RUNNER_SESSION_WORKSPACE_MISMATCH',
|
|
89
|
+
messageFailureCode: 'SESSION_RESUME_REJECTED'
|
|
90
|
+
};
|
|
91
|
+
const resumed = context.currentResumed(external.id);
|
|
92
|
+
if (resumed !== undefined)
|
|
93
|
+
return { session: context.ensureConfiguration(resumed), activity: 'IDLE' };
|
|
94
|
+
const projection = context.projectionFor(external);
|
|
95
|
+
const session = projection === undefined ? context.create(external) : context.promote(projection.id);
|
|
96
|
+
if (session === undefined)
|
|
97
|
+
return {
|
|
98
|
+
failureCode: 'RUNNER_RESUME_FAILED',
|
|
99
|
+
messageFailureCode: 'SESSION_RESUME_REJECTED'
|
|
100
|
+
};
|
|
101
|
+
const configured = context.ensureConfiguration(session);
|
|
102
|
+
context.rememberManagedNative(external.externalSessionId, configured.id);
|
|
103
|
+
return { session: configured, activity: 'IDLE' };
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return {
|
|
107
|
+
failureCode: 'RUNNER_RESUME_FAILED',
|
|
108
|
+
messageFailureCode: 'SESSION_RESUME_REJECTED'
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async discoverSessions(context, workspace) {
|
|
113
|
+
const sessions = [];
|
|
114
|
+
for (const target of workspace === undefined ? context.workspaces : [workspace]) {
|
|
115
|
+
let official = [];
|
|
116
|
+
try {
|
|
117
|
+
official = await this.listSessions(target.path);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// Native transcripts remain authoritative when SDK listing is unavailable.
|
|
121
|
+
}
|
|
122
|
+
const native = await discoverNativeSessions(this.name, target.path);
|
|
123
|
+
sessions.push(...this.projectDiscoveredSessions(context, target, [
|
|
124
|
+
...official.flatMap((value) => {
|
|
125
|
+
const parsed = claudeDiscoveredSession(value, target.path);
|
|
126
|
+
return parsed === undefined ? [] : [parsed];
|
|
127
|
+
}),
|
|
128
|
+
...native
|
|
129
|
+
]));
|
|
130
|
+
}
|
|
131
|
+
return deduplicateDirectSessions(sessions);
|
|
132
|
+
}
|
|
133
|
+
readContextUsage(session) {
|
|
134
|
+
return session.externalSessionId === null
|
|
135
|
+
? Promise.resolve(undefined)
|
|
136
|
+
: readClaudeNativeContextUsage(session.cwd, session.externalSessionId);
|
|
137
|
+
}
|
|
138
|
+
async readConversationHistory(readers) {
|
|
139
|
+
const native = await readers.native();
|
|
140
|
+
return native === undefined ? undefined : { ...native, source: 'native' };
|
|
141
|
+
}
|
|
142
|
+
forkNative(session, boundary, title) {
|
|
143
|
+
if (session.externalSessionId === null)
|
|
144
|
+
throw new Error('SESSION_REWIND_UNAVAILABLE');
|
|
145
|
+
return boundary === null
|
|
146
|
+
? Promise.resolve(null)
|
|
147
|
+
: this.client.forkSession(session.externalSessionId, session.cwd, boundary, title);
|
|
148
|
+
}
|
|
149
|
+
presentSession(session, capabilities, context) {
|
|
150
|
+
if (capabilities.claudeCode.available && session.nativeControl === 'MAR_MANAGED') {
|
|
151
|
+
const runtimeCapabilities = [
|
|
152
|
+
'history.read',
|
|
153
|
+
'events.live',
|
|
154
|
+
'turn.start',
|
|
155
|
+
'turn.queue',
|
|
156
|
+
'turn.interrupt',
|
|
157
|
+
'run.cancel',
|
|
158
|
+
'approval.respond',
|
|
159
|
+
'session.rename',
|
|
160
|
+
'session.remove',
|
|
161
|
+
'session.pin',
|
|
162
|
+
...(session.externalSessionId === null ? [] : ['session.rewind'])
|
|
163
|
+
];
|
|
164
|
+
return {
|
|
165
|
+
activity: context.managedActive ? 'MANAGED_ACTIVE' : 'IDLE',
|
|
166
|
+
control: {
|
|
167
|
+
level: 'MANAGED',
|
|
168
|
+
capabilities: ['history.read', 'events.live', 'turn.start', 'turn.interrupt']
|
|
169
|
+
},
|
|
170
|
+
commandStates: context.commandStates,
|
|
171
|
+
runtime: { level: 'MANAGED', capabilities: runtimeCapabilities, reasonCode: null }
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
if (capabilities.claudeCode.available && session.externalSessionId !== null) {
|
|
175
|
+
const runtimeCapabilities = [
|
|
176
|
+
'history.read',
|
|
177
|
+
'turn.start',
|
|
178
|
+
'session.rename',
|
|
179
|
+
'session.remove',
|
|
180
|
+
'session.pin',
|
|
181
|
+
'session.rewind'
|
|
182
|
+
];
|
|
183
|
+
return {
|
|
184
|
+
activity: 'IDLE',
|
|
185
|
+
control: { level: 'RESUMABLE', capabilities: ['history.read', 'turn.start'] },
|
|
186
|
+
commandStates: context.commandStates,
|
|
187
|
+
runtime: { level: 'RESUMABLE', capabilities: runtimeCapabilities, reasonCode: null }
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
const runtimeCapabilities = [
|
|
191
|
+
'history.read',
|
|
192
|
+
'events.live',
|
|
193
|
+
'session.rename',
|
|
194
|
+
'session.remove',
|
|
195
|
+
'session.pin'
|
|
196
|
+
];
|
|
197
|
+
return {
|
|
198
|
+
activity: 'UNAVAILABLE',
|
|
199
|
+
control: { level: 'OBSERVE_ONLY', capabilities: ['history.read', 'events.live'] },
|
|
200
|
+
commandStates: context.commandStates,
|
|
201
|
+
runtime: {
|
|
202
|
+
level: 'OBSERVE_ONLY',
|
|
203
|
+
capabilities: runtimeCapabilities,
|
|
204
|
+
reasonCode: 'EXTERNAL_SESSION_OBSERVE_ONLY'
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
prepareMessageInput(input, collaborationMode) {
|
|
209
|
+
return collaborationMode === 'plan' ? withClaudePlanTag(input) : input;
|
|
210
|
+
}
|
|
211
|
+
channelToken(sessionId) {
|
|
212
|
+
return [...this.execution.runs.values()].find((run) => run.marSessionId === sessionId)?.gate
|
|
213
|
+
.token;
|
|
214
|
+
}
|
|
215
|
+
deliverChannel(sessionId, messageId, senderId, token, content, notify) {
|
|
216
|
+
const found = [...this.execution.runs.entries()].find(([, value]) => value.marSessionId === sessionId);
|
|
217
|
+
if (found === undefined)
|
|
218
|
+
return 'REJECTED';
|
|
219
|
+
const [runId, active] = found;
|
|
220
|
+
const prior = active.gate.delivery(messageId);
|
|
221
|
+
const accepted = active.gate.accept({ id: messageId, senderId, token, content });
|
|
222
|
+
if (accepted === 'REJECTED') {
|
|
223
|
+
if (prior === undefined)
|
|
224
|
+
notify(runId, messageId, 'REJECTED');
|
|
225
|
+
return 'REJECTED';
|
|
226
|
+
}
|
|
227
|
+
if (prior === undefined && accepted === 'PENDING_RECEIPT') {
|
|
228
|
+
void active.handle.deliver(content).then(() => notify(runId, messageId, active.gate.acknowledge({ messageId, result: 'STEERED' })), () => notify(runId, messageId, active.gate.acknowledge({ messageId, result: 'REJECTED' })));
|
|
229
|
+
}
|
|
230
|
+
return accepted;
|
|
231
|
+
}
|
|
232
|
+
managedAliasId(nativeSessionId) {
|
|
233
|
+
return this.execution.managedSessionByNativeId.get(nativeSessionId);
|
|
234
|
+
}
|
|
235
|
+
nativeAliasesFor(managedSessionId) {
|
|
236
|
+
return [...this.execution.managedSessionByNativeId]
|
|
237
|
+
.filter(([, sessionId]) => sessionId === managedSessionId)
|
|
238
|
+
.map(([nativeSessionId]) => nativeSessionId);
|
|
239
|
+
}
|
|
240
|
+
forgetNativeAlias(nativeSessionId) {
|
|
241
|
+
this.execution.managedSessionByNativeId.delete(nativeSessionId);
|
|
242
|
+
this.execution.managedNativeIds.delete(nativeSessionId);
|
|
243
|
+
}
|
|
244
|
+
rememberManagedNative(session, nativeSessionId) {
|
|
245
|
+
this.execution.managedNativeIds.add(nativeSessionId);
|
|
246
|
+
this.execution.managedSessionByNativeId.set(nativeSessionId, session.id);
|
|
247
|
+
}
|
|
248
|
+
async readManagedRunnerTitle(session, nativeSessionId) {
|
|
249
|
+
let history = await readNativeSession(this.name, session.cwd, nativeSessionId);
|
|
250
|
+
if (history === undefined) {
|
|
251
|
+
const discovered = await discoverNativeSessions(this.name, session.cwd);
|
|
252
|
+
history = discovered.find((candidate) => candidate.externalSessionId === nativeSessionId);
|
|
253
|
+
}
|
|
254
|
+
return history?.title;
|
|
255
|
+
}
|
|
256
|
+
projectDiscoveredSessions(context, workspace, discovered) {
|
|
257
|
+
const sessions = [];
|
|
258
|
+
for (const item of discovered) {
|
|
259
|
+
if (!isWithinWorkspace(item.cwd, workspace.path))
|
|
260
|
+
continue;
|
|
261
|
+
const session = context.createProjection({
|
|
262
|
+
workspace,
|
|
263
|
+
runner: this.name,
|
|
264
|
+
externalSessionId: item.externalSessionId,
|
|
265
|
+
cwd: item.cwd,
|
|
266
|
+
...(item.title === undefined ? {} : { title: item.title }),
|
|
267
|
+
...(isNativeHistory(item) ? { lastActivityAt: latestNativeActivity(item) } : {})
|
|
268
|
+
});
|
|
269
|
+
const index = sessions.findIndex((candidate) => candidate.id === session.id);
|
|
270
|
+
if (index < 0)
|
|
271
|
+
sessions.push(session);
|
|
272
|
+
else if (session.lastActivityAt >= sessions[index].lastActivityAt) {
|
|
273
|
+
const existing = sessions[index];
|
|
274
|
+
sessions[index] = {
|
|
275
|
+
...session,
|
|
276
|
+
runnerTitle: session.runnerTitle ?? existing.runnerTitle,
|
|
277
|
+
titleSource: session.runnerTitle === null ? existing.titleSource : session.titleSource
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return deduplicateDirectSessions(sessions);
|
|
282
|
+
}
|
|
283
|
+
stop() { }
|
|
284
|
+
start(input) {
|
|
285
|
+
return this.client.start(input);
|
|
286
|
+
}
|
|
287
|
+
startChannel(input) {
|
|
288
|
+
return this.client.startChannel(input);
|
|
289
|
+
}
|
|
290
|
+
listSessions(cwd) {
|
|
291
|
+
return this.client.listSessions(cwd);
|
|
292
|
+
}
|
|
293
|
+
sessionInfo(sessionId, cwd) {
|
|
294
|
+
return this.client.sessionInfo(sessionId, cwd);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
export class ClaudeExecutionState {
|
|
298
|
+
runs = new Map();
|
|
299
|
+
managedNativeIds = new Set();
|
|
300
|
+
managedSessionByNativeId = new Map();
|
|
301
|
+
approvals = new Map();
|
|
302
|
+
userInputs = new Map();
|
|
303
|
+
}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export function parseCodexComposerImageMarkers(text) {
|
|
2
|
+
const images = [];
|
|
3
|
+
const visible = text.replace(/\n?<image\s+name=\[Image #(\d+)\]\s+path="([^"\n]*[\\/]myagentroam-attachment-[^"\n]*[\\/][^"\n]+)"\s*>\s*<\/image>/gu, (_marker, index, localPath) => {
|
|
4
|
+
images.push({ index: Number(index), localPath });
|
|
5
|
+
return '';
|
|
6
|
+
});
|
|
7
|
+
return { text: visible.trimEnd(), images };
|
|
8
|
+
}
|