chainlesschain 0.166.26 → 0.166.29
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/package.json +1 -1
- package/src/assets/web-panel/assets/{AIOps-Z8_dnLd8.js → AIOps-D4Dhiipq.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-C4bKCISV.js → ActionButton-P6fPjlUB.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-GztAv2jy.js → Analytics-CzeKpXdh.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-DEqNcuVx.js → AppLayout-Cj8CqntA.js} +4 -4
- package/src/assets/web-panel/assets/{Artifacts-D-R4Ehap.js → Artifacts-BOe7lviy.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-mzzdTIlM.js → Audit-D6kxPJyo.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-DS2QupIC.js → BackgroundAgents-OVuYY65D.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-CQSirC39.js → Backup-UAlkEXOa.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-Bhuc-eOV.js → BaseInput-DikQWFIL.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-B-RLVGnt.js → Chat-CEpqrZcV.js} +6 -6
- package/src/assets/web-panel/assets/ChatBubbleRenderer-BLE9L1yw.js +1 -0
- package/src/assets/web-panel/assets/{Checkbox-DxwgBryW.js → Checkbox-D2mdaw7o.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-Cwrm-7nh.js → Codegen-CJ2LEcdr.js} +1 -1
- package/src/assets/web-panel/assets/{Col-DrSCT-nF.js → Col-ej56LWvr.js} +1 -1
- package/src/assets/web-panel/assets/{Community-DY2D9WNs.js → Community-D9neNmTp.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-o-tV0URw.js → Compact-BzWfgovR.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-Bndh6S8f.js → Compliance-dStoa8Mw.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-CSNQODak.js → Cowork-BxYPXbQl.js} +3 -3
- package/src/assets/web-panel/assets/{Cron-CTgxRHdy.js → Cron-DxOQIcrL.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-BJoGQzDI.js → Crosschain-BYyOjqVA.js} +1 -1
- package/src/assets/web-panel/assets/{DID-V0Ztm8ne.js → DID-c81gsUZq.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-B-38THOj.js → Dashboard-CHIjYxb2.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-B3FdOwMO.js → Dropdown-C7hRZzkL.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-YQDz4mUF.js → EmailListRenderer--h_ShKAT.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-DYE45IF9.js → FamilyGuardDashboard-Bq68asD0.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-DjBFjdRZ.js → Federation-DGKsWpUO.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-CVTXEa0R.js → FormItemContext-1HbCXJAf.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-B6Tkke8X.js → GenericCardRenderer-BlKJ93Fy.js} +1 -1
- package/src/assets/web-panel/assets/{Git-CD0hyAzT.js → Git-DJA-kxuw.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-CWOQQJr8.js → Governance-BWZPtzHj.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-lHYwUk-C.js → Inference-D3QXUTYP.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-Cledxv7t.js → KnowledgeGraph-BM37hWOP.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-D45mt-rM.js → Logs-Bpu4Of_0.js} +2 -2
- package/src/assets/web-panel/assets/MarkdownRenderer-DAZcw_ZS.js +1 -0
- package/src/assets/web-panel/assets/{Marketplace-Yy30UZPw.js → Marketplace-BZe0jmAU.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-Cil5l-bh.js → McpTools-_q_nfUnU.js} +3 -3
- package/src/assets/web-panel/assets/{Memory-DdJcnyqy.js → Memory-CIzcovHt.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-IrzFYHEv.js → MobileBridge-DZzo5UjF.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-D8q64LMd.js → MobileProjects-DVZr9bVO.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-CpdTJzW7.js → Mtc-pULSsEOx.js} +4 -4
- package/src/assets/web-panel/assets/{MtcAudit-C7Tvw2m6.js → MtcAudit-BLz9fiz0.js} +2 -2
- package/src/assets/web-panel/assets/{Multisig-Dmj9F5Kr.js → Multisig-B1qxfPkT.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-C9Xchob5.js → NLProgramming-Bkb9YB7P.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-Bzq6Yry5.js → Notes-N0G87PD1.js} +4 -4
- package/src/assets/web-panel/assets/{NotificationSettings-DxG9eKb4.js → NotificationSettings-D0jB-hRv.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-BS_IYoCe.js → OrderTableRenderer-soFvgov0.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-kazsRvcq.js → Organization-BNBL1-7S.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-i4wP-hwn.js → Overflow-yqaJxwEo.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-CfGeU3h-.js → P2P-1JHDOnl3.js} +2 -2
- package/src/assets/web-panel/assets/{PdhVaultBrowser-CS-VhVUx.js → PdhVaultBrowser-D1FgaOLV.js} +5 -5
- package/src/assets/web-panel/assets/{Permissions-DnEHXs0I.js → Permissions-DOQh1Wzv.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-DeD82qke.js → PersonalDataHub-SVa21bUw.js} +5 -5
- package/src/assets/web-panel/assets/{Pipeline-CMGGLgBY.js → Pipeline-Du3gCATi.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-CvHoFv32.js → Privacy-CPW8EDaC.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-DnJapCc1.js → ProjectInit-CAu5N0A_.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-CqVdv3-g.js → ProjectSettings-DVTow6ty.js} +2 -2
- package/src/assets/web-panel/assets/{Projects-B_o8vcs_.js → Projects-CBUF9hPa.js} +1 -1
- package/src/assets/web-panel/assets/{Providers-CPKseoDW.js → Providers-B7pNEoaY.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-_iBfKbPQ.js → QrScannerModal-BHs1Kx7e.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-CMrlZ69a.js → QuickAsk-IBrdC5B5.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-BwDtSZ0l.js → Recommend-BtkLuO-e.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-DomUAtn4.js → RemoteSession-Du4_izg3.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-Cuu2GCHr.js → Reputation-IEbMZN6v.js} +1 -1
- package/src/assets/web-panel/assets/{Row-C7GVts31.js → Row-D5UM_ivw.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-DRKvgEog.js → RssFeed-DTTNnkdJ.js} +3 -3
- package/src/assets/web-panel/assets/{Search-BGI9wOeA.js → Search-B5f7ggJE.js} +1 -1
- package/src/assets/web-panel/assets/{Security-BlLaHy_L.js → Security-CsZp2uGu.js} +3 -3
- package/src/assets/web-panel/assets/{Services-DFqZbjmX.js → Services-BJhguqIh.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-BCGxdooP.js → Skeleton-CAwO2JUK.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-CwFKgcmm.js → Skills-hKJcP390.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-CiXXh9eS.js → Sla-BCFiB8oS.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-WSx2CLqO.js → SpeechSettings-Bi1Y-Tgf.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-BBIqQOtW.js → SyncSettings-ZHYDv46g.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-D1BGLjO1.js → Tasks-BMCSrUy-.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-CUIl9axA.js → Templates-DF_FOEH8.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-BFZJ0hNz.js → Tenant-C7Q2LriV.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-Cw-3eYVn.js → Terminal-C59ckWXW.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-bOVPB56L.js → TimelineRenderer-Biu1m6Uf.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-Czfyq2VY.js → Tokens-CoHYWg3-.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-C-o4uJY0.js → Trigger-DglXXzEp.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-BKq_S6iF.js → Trust-CBBLh73r.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-fKlWUvMx.js → UkeySign-DuNdKeiD.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-DB5MLuS7.js → VideoEditing-BizHWVrh.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-WGXBn7IS.js → Wallet-ClUQGSKi.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-B8TC4EMF.js → WebAuthn-zyD7K5f5.js} +4 -4
- package/src/assets/web-panel/assets/{WorkflowEditor-DLY--KmM.js → WorkflowEditor-qbTI37Fi.js} +1 -1
- package/src/assets/web-panel/assets/{chat-Crw3XQaA.js → chat-CHv66tBY.js} +1 -1
- package/src/assets/web-panel/assets/{colors-CxhWauPV.js → colors-vBsvcJjY.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-Cp3ojtk5.js → compact-item-CdBQZWFX.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-CRuRXjSo.js → createContext-CLE2XsPX.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-DRQGMdYB.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-XGW474dj.js → hasIn-Du5rnUSg.js} +1 -1
- package/src/assets/web-panel/assets/{index-C73pqyDb.js → index-9nDAQkO-.js} +1 -1
- package/src/assets/web-panel/assets/{index-DHNixOg_.js → index-B-3GrN7D.js} +1 -1
- package/src/assets/web-panel/assets/{index-DUSVsOGS.js → index-BDaW0C3l.js} +1 -1
- package/src/assets/web-panel/assets/{index-BXnNbbwa.js → index-BY0Jg8JC.js} +1 -1
- package/src/assets/web-panel/assets/{index-Yq3bFbYX.js → index-Bdfg7CY3.js} +1 -1
- package/src/assets/web-panel/assets/{index-BW028Pwn.js → index-BnZkmomS.js} +1 -1
- package/src/assets/web-panel/assets/{index-DBcBsJYg.js → index-BojUN0eY.js} +1 -1
- package/src/assets/web-panel/assets/{index-DoUC5_ry.js → index-BrFwv-2v.js} +1 -1
- package/src/assets/web-panel/assets/{index-CPFam-me.js → index-Bu3v3PRU.js} +1 -1
- package/src/assets/web-panel/assets/{index-J_08R33H.js → index-BuSZyAD0.js} +1 -1
- package/src/assets/web-panel/assets/{index-WvNZXbIO.js → index-Bwqa-FcB.js} +1 -1
- package/src/assets/web-panel/assets/{index-rsACoVT9.js → index-ByEfQiLz.js} +1 -1
- package/src/assets/web-panel/assets/{index-DhomnuaB.js → index-CKoOU-ne.js} +1 -1
- package/src/assets/web-panel/assets/index-CPJgV0Ho.js +1 -0
- package/src/assets/web-panel/assets/{index-DfPLIA-f.js → index-CRiOcWZ1.js} +1 -1
- package/src/assets/web-panel/assets/{index-BuVA26SD.js → index-Ca0WeKz1.js} +1 -1
- package/src/assets/web-panel/assets/{index-E-RSfImO.js → index-Cc53mZoS.js} +1 -1
- package/src/assets/web-panel/assets/{index-C8UOVaUH.js → index-CigkcWWh.js} +1 -1
- package/src/assets/web-panel/assets/{index-qzmihx1d.js → index-Cuvyt0vv.js} +1 -1
- package/src/assets/web-panel/assets/{index-BUWZ57T4.js → index-CvHjeRw2.js} +1 -1
- package/src/assets/web-panel/assets/{index-BetOkRLs.js → index-CxmlGwpv.js} +1 -1
- package/src/assets/web-panel/assets/{index-B5fJS-kn.js → index-Cz48QuqC.js} +1 -1
- package/src/assets/web-panel/assets/{index-nJR64pA_.js → index-D-KoBLmE.js} +1 -1
- package/src/assets/web-panel/assets/{index-Dp2nC5On.js → index-D-jjL85C.js} +1 -1
- package/src/assets/web-panel/assets/{index-BYkjs7eP.js → index-DADajBnD.js} +1 -1
- package/src/assets/web-panel/assets/{index-BElgeKJ0.js → index-DHdrZp_q.js} +3 -3
- package/src/assets/web-panel/assets/{index-QqAuH7-S.js → index-DHhNie07.js} +1 -1
- package/src/assets/web-panel/assets/{index-jrIcbPUa.js → index-DnB7oqAR.js} +1 -1
- package/src/assets/web-panel/assets/{index-Ctu98x57.js → index-DsyYG63S.js} +1 -1
- package/src/assets/web-panel/assets/{index-CTE32qol.js → index-Dv9b_iFq.js} +1 -1
- package/src/assets/web-panel/assets/{index-CdlfrcC-.js → index-DzYEc47A.js} +1 -1
- package/src/assets/web-panel/assets/index-OtXVaszG.js +1 -0
- package/src/assets/web-panel/assets/{index-CDIpH_8Q.js → index-aYAtijnz.js} +1 -1
- package/src/assets/web-panel/assets/{index-38TRdZb6.js → index-dEhWAtoe.js} +1 -1
- package/src/assets/web-panel/assets/{index-DxOtBFVy.js → index-q3sGyZnD.js} +1 -1
- package/src/assets/web-panel/assets/{index-B45Vkh3T.js → index-sLcRd9pi.js} +1 -1
- package/src/assets/web-panel/assets/{index-BVmSfIkJ.js → index-sz6sGerd.js} +1 -1
- package/src/assets/web-panel/assets/{index-De2FN0xN.js → index-uHX8ZrJ9.js} +1 -1
- package/src/assets/web-panel/assets/{index-W8_0yAi_.js → index-x_0JRAO3.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-DAu-hgme.js → initDefaultProps-CThtsKhS.js} +1 -1
- package/src/assets/web-panel/assets/{motion-Db8yk0Hu.js → motion-BoqT16ZT.js} +1 -1
- package/src/assets/web-panel/assets/{move-Cii2jOin.js → move-1Jf6ZXg5.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-CnZBDkyZ.js → mtc-parser-DjfCYvnq.js} +1 -1
- package/src/assets/web-panel/assets/{omit-Buzt1FTL.js → omit-BaJPeP5Y.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-CpZ_NmE6.js → pickAttrs-B7nqrfVR.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-mBrx3dYm.js → placementArrow-Dmb7i435.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-DC_QzljB.js → responsiveObserve-B0TqfHJR.js} +1 -1
- package/src/assets/web-panel/assets/{slide-DT_UVED-.js → slide-C9PINvAM.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-78t6eNLV.js → statusUtils-DAug5z5S.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-CV_T1ULL.js → styleChecker-o6QvGnrq.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-s8edGuXD.js → useFlexGapSupport-CtZwQFCt.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-Pk9dH2HC.js → useFs-B0HVNsmA.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-B_GqAm8c.js → usePersonalDataHub-CbLIg5eO.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-Cxyss24q.js → vnode-uOK2NMHj.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-0UY3cOuc.js → zoom-BhyA2sIv.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/commands/ask.js +84 -5
- package/src/commands/chat.js +67 -1
- package/src/commands/compact.js +81 -2
- package/src/commands/complete.js +64 -5
- package/src/commands/cowork.js +133 -0
- package/src/commands/orchestrate.js +18 -7
- package/src/data/changelog.json +26 -0
- package/src/gateways/ws/action-protocol.js +2 -0
- package/src/lib/agent-router.js +116 -36
- package/src/lib/cowork-task-runner.js +107 -4
- package/src/lib/evolution/agent-evolution-ingress.js +231 -40
- package/src/lib/evolution/agent-evolution-runtime-composition.js +85 -5
- package/src/lib/evolution/evolution-deployment-loader.js +17 -1
- package/src/lib/evolution/evolution-evidence-projector.js +25 -6
- package/src/lib/model-failure-policy.js +10 -0
- package/src/lib/orchestrator.js +97 -27
- package/src/lib/read-file-loop-guard.js +33 -10
- package/src/lib/sub-agent-context.js +37 -2
- package/src/lib/task-progress-tracker.js +223 -0
- package/src/repl/chat-repl.js +60 -10
- package/src/runtime/agent-core.js +186 -16
- package/src/runtime/agent-runtime.js +20 -1
- package/src/runtime/runtime-factory.js +1 -1
- package/src/assets/web-panel/assets/ChatBubbleRenderer-CBbMoVuE.js +0 -1
- package/src/assets/web-panel/assets/MarkdownRenderer-DJjPaOnM.js +0 -1
- package/src/assets/web-panel/assets/devWarning-CKAQY2zn.js +0 -1
- package/src/assets/web-panel/assets/index-Cetfwq8j.js +0 -1
- package/src/assets/web-panel/assets/index-DOpcRO2-.js +0 -1
package/src/repl/chat-repl.js
CHANGED
|
@@ -56,6 +56,8 @@ import { installPipeSafety } from "../runtime/pipe-safety.js";
|
|
|
56
56
|
import { installOutputBackpressure } from "../runtime/output-backpressure.js";
|
|
57
57
|
import { assertChatSessionUsageAdmission } from "../lib/chat-session-admission.js";
|
|
58
58
|
import { captureAmbientExecutionLocation } from "../lib/execution-location-runtime.js";
|
|
59
|
+
import { captureAgentEvolutionIngress } from "../lib/evolution/agent-evolution-ingress.js";
|
|
60
|
+
import { createAgentEvolutionSessionLifecycle } from "../lib/evolution/agent-evolution-session-lifecycle.js";
|
|
59
61
|
|
|
60
62
|
const SLASH_COMMANDS = {
|
|
61
63
|
"/exit": "Exit the chat",
|
|
@@ -94,9 +96,17 @@ const SLASH_COMMANDS = {
|
|
|
94
96
|
* @param {object} options
|
|
95
97
|
*/
|
|
96
98
|
export async function startChatRepl(options = {}) {
|
|
99
|
+
const evolutionIngress =
|
|
100
|
+
options.evolutionIngress == null
|
|
101
|
+
? null
|
|
102
|
+
: captureAgentEvolutionIngress(options.evolutionIngress);
|
|
97
103
|
const admittedSessionId = options.sessionId
|
|
98
104
|
? assertChatSessionUsageAdmission(options.sessionId)
|
|
99
105
|
: null;
|
|
106
|
+
const evolutionSession =
|
|
107
|
+
evolutionIngress === null
|
|
108
|
+
? null
|
|
109
|
+
: createAgentEvolutionSessionLifecycle(evolutionIngress);
|
|
100
110
|
let model = options.model || "qwen2:7b";
|
|
101
111
|
let provider = options.provider || "ollama";
|
|
102
112
|
const baseUrl = options.baseUrl || "http://localhost:11434";
|
|
@@ -147,7 +157,9 @@ export async function startChatRepl(options = {}) {
|
|
|
147
157
|
),
|
|
148
158
|
);
|
|
149
159
|
try {
|
|
150
|
-
|
|
160
|
+
const createInterface =
|
|
161
|
+
options.createInterface || readline.createInterface.bind(readline);
|
|
162
|
+
rl = createInterface({
|
|
151
163
|
input: options.input || process.stdin,
|
|
152
164
|
output: stdout,
|
|
153
165
|
prompt: chalk.green("you> "),
|
|
@@ -266,13 +278,20 @@ export async function startChatRepl(options = {}) {
|
|
|
266
278
|
logger.verbose?.(`[@ref] expansion skipped: ${err.message}`);
|
|
267
279
|
}
|
|
268
280
|
|
|
269
|
-
|
|
270
|
-
|
|
281
|
+
try {
|
|
282
|
+
if (evolutionIngress !== null) {
|
|
283
|
+
await evolutionIngress.ingestUserPrompt({
|
|
284
|
+
content: userContent,
|
|
285
|
+
sessionId,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
271
288
|
|
|
272
|
-
|
|
273
|
-
|
|
289
|
+
// Add user message
|
|
290
|
+
messages.push({ role: "user", content: userContent });
|
|
291
|
+
|
|
292
|
+
// Stream the response
|
|
293
|
+
stdout.write(chalk.blue("ai> "));
|
|
274
294
|
|
|
275
|
-
try {
|
|
276
295
|
let response;
|
|
277
296
|
const onToken = (token) => {
|
|
278
297
|
const accepted = stdout.write(token);
|
|
@@ -302,9 +321,19 @@ export async function startChatRepl(options = {}) {
|
|
|
302
321
|
if (sessionId)
|
|
303
322
|
appendEvent(sessionId, "user_message", { content: trimmed });
|
|
304
323
|
|
|
324
|
+
const providerMessages =
|
|
325
|
+
evolutionIngress === null
|
|
326
|
+
? messages
|
|
327
|
+
: (
|
|
328
|
+
await evolutionIngress.prepareModelRequest({
|
|
329
|
+
messages,
|
|
330
|
+
tools: [],
|
|
331
|
+
})
|
|
332
|
+
).messages;
|
|
333
|
+
|
|
305
334
|
if (provider === "ollama") {
|
|
306
335
|
response = await streamOllama(
|
|
307
|
-
|
|
336
|
+
providerMessages,
|
|
308
337
|
model,
|
|
309
338
|
baseUrl,
|
|
310
339
|
onToken,
|
|
@@ -325,7 +354,7 @@ export async function startChatRepl(options = {}) {
|
|
|
325
354
|
`API key required for anthropic (set ${providerDef?.apiKeyEnv || "ANTHROPIC_API_KEY"})`,
|
|
326
355
|
);
|
|
327
356
|
response = await streamAnthropic(
|
|
328
|
-
|
|
357
|
+
providerMessages,
|
|
329
358
|
model,
|
|
330
359
|
url,
|
|
331
360
|
key,
|
|
@@ -348,7 +377,7 @@ export async function startChatRepl(options = {}) {
|
|
|
348
377
|
`API key required for ${provider} (set ${providerDef?.apiKeyEnv || "API key"})`,
|
|
349
378
|
);
|
|
350
379
|
response = await streamOpenAI(
|
|
351
|
-
|
|
380
|
+
providerMessages,
|
|
352
381
|
model,
|
|
353
382
|
url,
|
|
354
383
|
key,
|
|
@@ -358,6 +387,14 @@ export async function startChatRepl(options = {}) {
|
|
|
358
387
|
);
|
|
359
388
|
}
|
|
360
389
|
|
|
390
|
+
if (evolutionIngress !== null) {
|
|
391
|
+
await evolutionIngress.ingestAgentEvent({
|
|
392
|
+
type: "response-complete",
|
|
393
|
+
content: response,
|
|
394
|
+
sessionId,
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
|
|
361
398
|
stdout.write("\n\n");
|
|
362
399
|
messages.push({ role: "assistant", content: response });
|
|
363
400
|
|
|
@@ -410,6 +447,19 @@ export async function startChatRepl(options = {}) {
|
|
|
410
447
|
: 0;
|
|
411
448
|
disposePipeSafety();
|
|
412
449
|
outputFlow.restore();
|
|
413
|
-
|
|
450
|
+
if (evolutionSession !== null) {
|
|
451
|
+
try {
|
|
452
|
+
await evolutionSession.close(outputFailure);
|
|
453
|
+
} catch (error) {
|
|
454
|
+
outputFailure ||= error;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
const finalExitCode = outputFailure
|
|
458
|
+
? outputFailure.code === "EPIPE"
|
|
459
|
+
? 0
|
|
460
|
+
: 1
|
|
461
|
+
: exitCode;
|
|
462
|
+
process.exit(finalExitCode);
|
|
414
463
|
});
|
|
464
|
+
return evolutionSession?.handle;
|
|
415
465
|
}
|
|
@@ -21,12 +21,17 @@ import {
|
|
|
21
21
|
buildReadFileOutline,
|
|
22
22
|
} from "../lib/read-file-page.js";
|
|
23
23
|
import { ReadFileLoopGuard } from "../lib/read-file-loop-guard.js";
|
|
24
|
+
import {
|
|
25
|
+
TaskProgressTracker,
|
|
26
|
+
TASK_RECOVERY_TOOLS,
|
|
27
|
+
} from "../lib/task-progress-tracker.js";
|
|
24
28
|
import broker from "../lib/process-execution-broker/index.js";
|
|
25
29
|
import os from "os";
|
|
26
30
|
import { createHash, randomUUID } from "node:crypto";
|
|
27
31
|
import skillInvocationReceipt from "@chainlesschain/session-core/skill-invocation-receipt";
|
|
28
32
|
import { isProxy } from "node:util/types";
|
|
29
33
|
import { captureAgentEvolutionIngress } from "../lib/evolution/agent-evolution-ingress.js";
|
|
34
|
+
import { isEvolutionIngressFailure } from "../lib/model-failure-policy.js";
|
|
30
35
|
|
|
31
36
|
const { startSkillInvocation, settleSkillInvocation } = skillInvocationReceipt;
|
|
32
37
|
import sharedCodingAgentPolicy from "./coding-agent-policy.cjs";
|
|
@@ -1092,6 +1097,7 @@ Key behaviors:
|
|
|
1092
1097
|
- When asked about git status, diff, log, or other repository operations, use the git tool instead of run_shell
|
|
1093
1098
|
- When asked about files or code, use search_files to locate relevant sections, then read_file with offset/limit. Follow nextRead for large files. Reuse unchanged content already in context instead of repeatedly reading the same page; re-read when the file changes or the earlier content is no longer available.
|
|
1094
1099
|
- Large task documents include a sampled outline with line numbers. Use it to locate relevant unfinished work and inspect those sections instead of scanning the entire document unless the task requires full coverage. File coverage and excerpts survive compaction; reading to EOF is not completing the user's task.
|
|
1100
|
+
- For task counts or completion status, search the named document for the latest status/summary table first, then read that section. Distinguish historical entries from current status and repository work from external acceptance. Once the relevant entries are verified, answer; do not read every implementation detail just to count tasks.
|
|
1095
1101
|
- Before renaming or changing a symbol, use code_intelligence (action: references/definition) to find every real usage instead of guessing with text search. It degrades to "unavailable" when no language server is installed — fall back to search_files then.
|
|
1096
1102
|
- After an edit, if the tool result includes a "newDiagnostics" array, you just introduced (or exposed) those errors/warnings — read them and fix before moving on. You can also run code_intelligence (action: diagnostics) on any file to check it on demand.
|
|
1097
1103
|
- If a tool result includes a "subtreeInstructions" array, you just entered a subdirectory that carries its own cc.md/CLAUDE.md/AGENTS.md — treat that content as authoritative project rules for work in that subtree (it is injected once, the first time you touch the subtree).
|
|
@@ -1101,6 +1107,7 @@ Key behaviors:
|
|
|
1101
1107
|
|
|
1102
1108
|
When the user's problem involves data processing, calculations, file operations, text parsing, API calls, web scraping, or any task that can be solved programmatically:
|
|
1103
1109
|
- Proactively write and execute code using run_code tool
|
|
1110
|
+
- For long documents, scripts should filter/count locally and print only the relevant rows, totals and source line numbers. Do not print an entire file or repeatedly dump its prefix through run_code/run_shell; use read_file offset/limit for missing sections. Truncated output is not full-file evidence.
|
|
1104
1111
|
- Choose the best language: Python for data/math/scraping, Node.js for JSON/API, Bash for system tasks
|
|
1105
1112
|
- Missing Python packages are NOT auto-installed by default; the tool result tells you (and the user) how to opt in (settings runCode.autoInstall)
|
|
1106
1113
|
- Scripts run from a temp file by default; pass persist:true to keep one in .chainlesschain/agent-scripts/ for reference
|
|
@@ -3638,6 +3645,7 @@ export async function executeTool(name, args, context = {}) {
|
|
|
3638
3645
|
hostResourceBudget: context.hostResourceBudget || null,
|
|
3639
3646
|
readFileCache: context.readFileCache || null,
|
|
3640
3647
|
readFileLoopGuard: context.readFileLoopGuard || null,
|
|
3648
|
+
taskProgressTracker: context.taskProgressTracker || null,
|
|
3641
3649
|
// Effective contract of THIS loop (parent ceiling for a nested spawn) +
|
|
3642
3650
|
// the MCP tool definitions this loop exposes (inheritable by a spawn).
|
|
3643
3651
|
subAgentContract: context.subAgentContract || null,
|
|
@@ -8227,6 +8235,7 @@ async function executeToolInner(
|
|
|
8227
8235
|
});
|
|
8228
8236
|
} catch (err) {
|
|
8229
8237
|
if (
|
|
8238
|
+
isEvolutionIngressFailure(err) ||
|
|
8230
8239
|
err?.runtimeLedgerPersistence === true ||
|
|
8231
8240
|
err?.workflowEffectOutcomeUnknown === true
|
|
8232
8241
|
) {
|
|
@@ -9226,7 +9235,7 @@ async function _executeRunCode(args, cwd) {
|
|
|
9226
9235
|
|
|
9227
9236
|
return {
|
|
9228
9237
|
success: true,
|
|
9229
|
-
|
|
9238
|
+
...boundedCodeOutput(retryOutput),
|
|
9230
9239
|
language: lang,
|
|
9231
9240
|
duration: `${retryDuration}ms`,
|
|
9232
9241
|
autoInstalled: [packageName],
|
|
@@ -9269,7 +9278,7 @@ async function _executeRunCode(args, cwd) {
|
|
|
9269
9278
|
const duration = Date.now() - start;
|
|
9270
9279
|
return {
|
|
9271
9280
|
success: true,
|
|
9272
|
-
output
|
|
9281
|
+
...boundedCodeOutput(output),
|
|
9273
9282
|
language: lang,
|
|
9274
9283
|
duration: `${duration}ms`,
|
|
9275
9284
|
scriptPath: persist ? scriptPath : undefined,
|
|
@@ -9347,9 +9356,66 @@ export function capToolResultString(serialized, max = MAX_TOOL_RESULT_CHARS) {
|
|
|
9347
9356
|
);
|
|
9348
9357
|
}
|
|
9349
9358
|
|
|
9359
|
+
/** Leave room for JSON escaping and execution metadata, including the hint. */
|
|
9360
|
+
export function boundedCodeOutput(value) {
|
|
9361
|
+
const output = String(value ?? "");
|
|
9362
|
+
const budget = Math.max(0, MAX_TOOL_RESULT_CHARS - 4096);
|
|
9363
|
+
let low = 0;
|
|
9364
|
+
let high = Math.min(output.length, 50000);
|
|
9365
|
+
while (low < high) {
|
|
9366
|
+
const mid = Math.ceil((low + high) / 2);
|
|
9367
|
+
if (JSON.stringify(output.slice(0, mid)).length <= budget) low = mid;
|
|
9368
|
+
else high = mid - 1;
|
|
9369
|
+
}
|
|
9370
|
+
if (low === output.length) return { output };
|
|
9371
|
+
if (low > 0 && /[\uD800-\uDBFF]/.test(output[low - 1])) low--;
|
|
9372
|
+
return {
|
|
9373
|
+
truncated: true,
|
|
9374
|
+
outputChars: output.length,
|
|
9375
|
+
returnedChars: low,
|
|
9376
|
+
hint: "Only an output prefix is shown. Do not rerun the same full-file print: filter/count locally and print a bounded summary with source line numbers, or use read_file with offset/limit for a missing section. This prefix is not evidence of the entire file.",
|
|
9377
|
+
output: output.slice(0, low),
|
|
9378
|
+
};
|
|
9379
|
+
}
|
|
9380
|
+
|
|
9350
9381
|
/** Avoid injecting the same file page twice while its original is still visible. */
|
|
9351
9382
|
export function toolResultForModel(tool, result, messages) {
|
|
9352
9383
|
const serialized = capToolResultString(safeStringifyToolResult(result));
|
|
9384
|
+
if (
|
|
9385
|
+
(tool === "run_code" || tool === "run_shell") &&
|
|
9386
|
+
!result?.error &&
|
|
9387
|
+
typeof result?.output === "string" &&
|
|
9388
|
+
result.output.length >= 8000
|
|
9389
|
+
) {
|
|
9390
|
+
const callIds = new Set(
|
|
9391
|
+
messages.flatMap((message) =>
|
|
9392
|
+
(message.tool_calls || [])
|
|
9393
|
+
.filter((call) => call.function?.name === tool)
|
|
9394
|
+
.map((call) => call.id),
|
|
9395
|
+
),
|
|
9396
|
+
);
|
|
9397
|
+
const previous = messages.find((message) => {
|
|
9398
|
+
if (message.role !== "tool" || !callIds.has(message.tool_call_id))
|
|
9399
|
+
return false;
|
|
9400
|
+
try {
|
|
9401
|
+
const prior = JSON.parse(message.content.split("\n\n[Budget ")[0]);
|
|
9402
|
+
return !prior.error && prior.output === result.output;
|
|
9403
|
+
} catch {
|
|
9404
|
+
return false;
|
|
9405
|
+
}
|
|
9406
|
+
});
|
|
9407
|
+
if (previous) {
|
|
9408
|
+
return capToolResultString(
|
|
9409
|
+
safeStringifyToolResult({
|
|
9410
|
+
...result,
|
|
9411
|
+
output: undefined,
|
|
9412
|
+
outputOmitted: true,
|
|
9413
|
+
previousToolCallId: previous.tool_call_id,
|
|
9414
|
+
hint: "This command executed again and returned the same large output already visible in the referenced tool result. Reuse that output; filter/count locally or read a specific missing section instead of dumping it again. This does not establish that files or other command side effects are unchanged.",
|
|
9415
|
+
}),
|
|
9416
|
+
);
|
|
9417
|
+
}
|
|
9418
|
+
}
|
|
9353
9419
|
if (
|
|
9354
9420
|
tool !== "read_file" ||
|
|
9355
9421
|
result?.error ||
|
|
@@ -9547,6 +9613,7 @@ function _backgroundSubAgentResultText(entry) {
|
|
|
9547
9613
|
function _throwBackgroundSubAgentUsageFailure(entry) {
|
|
9548
9614
|
const error = entry?.outcome?.fatalError;
|
|
9549
9615
|
if (
|
|
9616
|
+
isEvolutionIngressFailure(error) ||
|
|
9550
9617
|
error?.runtimeLedgerPersistence === true ||
|
|
9551
9618
|
error?.workflowEffectOutcomeUnknown === true
|
|
9552
9619
|
) {
|
|
@@ -10287,6 +10354,9 @@ async function _executeSpawnSubAgent(args, ctx) {
|
|
|
10287
10354
|
...(ctx.hostResourceBudget
|
|
10288
10355
|
? { hostResourceBudget: ctx.hostResourceBudget }
|
|
10289
10356
|
: {}),
|
|
10357
|
+
...(ctx.taskProgressTracker
|
|
10358
|
+
? { taskProgressTracker: ctx.taskProgressTracker }
|
|
10359
|
+
: {}),
|
|
10290
10360
|
onUsage,
|
|
10291
10361
|
...(interaction && typeof interaction.emit === "function"
|
|
10292
10362
|
? {
|
|
@@ -10497,7 +10567,8 @@ async function _executeSpawnSubAgent(args, ctx) {
|
|
|
10497
10567
|
return {
|
|
10498
10568
|
result: subCtx.result,
|
|
10499
10569
|
error: err.message,
|
|
10500
|
-
...(err
|
|
10570
|
+
...(isEvolutionIngressFailure(err) ||
|
|
10571
|
+
err?.runtimeLedgerPersistence === true ||
|
|
10501
10572
|
err?.workflowEffectOutcomeUnknown === true
|
|
10502
10573
|
? { fatalError: err }
|
|
10503
10574
|
: {}),
|
|
@@ -10632,6 +10703,7 @@ async function _executeSpawnSubAgent(args, ctx) {
|
|
|
10632
10703
|
});
|
|
10633
10704
|
|
|
10634
10705
|
if (
|
|
10706
|
+
isEvolutionIngressFailure(err) ||
|
|
10635
10707
|
err?.runtimeLedgerPersistence === true ||
|
|
10636
10708
|
err?.workflowEffectOutcomeUnknown === true
|
|
10637
10709
|
) {
|
|
@@ -13326,6 +13398,8 @@ export async function* agentLoop(messages, options) {
|
|
|
13326
13398
|
const { HostResourceBudget } = await import("../lib/host-resource-budget.js");
|
|
13327
13399
|
const hostResourceBudget =
|
|
13328
13400
|
options.hostResourceBudget || new HostResourceBudget();
|
|
13401
|
+
const taskProgressTracker =
|
|
13402
|
+
options.taskProgressTracker || new TaskProgressTracker();
|
|
13329
13403
|
const signal = options.signal || null;
|
|
13330
13404
|
const workflowEffectId = _normalizeWorkflowEffectId(options.workflowEffectId);
|
|
13331
13405
|
// Optional OpenTelemetry recorder (TelemetryRecorder). When present, the loop
|
|
@@ -13551,6 +13625,7 @@ export async function* agentLoop(messages, options) {
|
|
|
13551
13625
|
// the main loop and every nested subagent. A host can tighten these limits
|
|
13552
13626
|
// by supplying its own budget; otherwise the conservative defaults apply.
|
|
13553
13627
|
hostResourceBudget,
|
|
13628
|
+
taskProgressTracker,
|
|
13554
13629
|
// This loop's EFFECTIVE subagent contract (set when this loop IS a spawned
|
|
13555
13630
|
// sub-agent). Threaded so a nested spawn_sub_agent sees it as the parent
|
|
13556
13631
|
// ceiling (tighten-only). null at the top level (no ceiling).
|
|
@@ -13733,6 +13808,7 @@ export async function* agentLoop(messages, options) {
|
|
|
13733
13808
|
let emptyThinkingReprompted = false;
|
|
13734
13809
|
const readFileLoopGuard = new ReadFileLoopGuard();
|
|
13735
13810
|
toolContext.readFileLoopGuard = readFileLoopGuard;
|
|
13811
|
+
let lastTaskProgressIntervention = null;
|
|
13736
13812
|
|
|
13737
13813
|
while (budget.hasRemaining()) {
|
|
13738
13814
|
readFileLoopGuard.finishBatch();
|
|
@@ -13743,7 +13819,7 @@ export async function* agentLoop(messages, options) {
|
|
|
13743
13819
|
);
|
|
13744
13820
|
yield* _drainSubAgentUsage(subAgentUsageSink);
|
|
13745
13821
|
const error = new Error(
|
|
13746
|
-
"Repeated
|
|
13822
|
+
"Repeated file reads or identical large command outputs: the model did not resume the task after six no-progress batches and recovery guidance. The task is not complete. Use a targeted section or compute a bounded summary before retrying.",
|
|
13747
13823
|
);
|
|
13748
13824
|
error.code = "CC_AGENT_REPEATED_FILE_READ";
|
|
13749
13825
|
throw error;
|
|
@@ -14278,6 +14354,14 @@ export async function* agentLoop(messages, options) {
|
|
|
14278
14354
|
role: "user",
|
|
14279
14355
|
content: _backgroundSubAgentResultText(entry),
|
|
14280
14356
|
});
|
|
14357
|
+
taskProgressTracker.retainChildResult(
|
|
14358
|
+
entry.id,
|
|
14359
|
+
{
|
|
14360
|
+
...entry.outcome?.result,
|
|
14361
|
+
error: entry.outcome?.error,
|
|
14362
|
+
},
|
|
14363
|
+
runId,
|
|
14364
|
+
);
|
|
14281
14365
|
yield {
|
|
14282
14366
|
type: "background-sub-agent-result",
|
|
14283
14367
|
runId,
|
|
@@ -14304,18 +14388,42 @@ export async function* agentLoop(messages, options) {
|
|
|
14304
14388
|
// whole-file request. This changes discovery for one request only; runtime
|
|
14305
14389
|
// permissions are untouched and ordinary reads return on the next turn.
|
|
14306
14390
|
const readRecoveryTurn = readFileLoopGuard.takeRecoveryTurn();
|
|
14307
|
-
const
|
|
14308
|
-
|
|
14309
|
-
|
|
14310
|
-
|
|
14311
|
-
|
|
14312
|
-
|
|
14313
|
-
|
|
14314
|
-
|
|
14315
|
-
|
|
14391
|
+
const progressIntervention = taskProgressTracker.intervention;
|
|
14392
|
+
const newProgressIntervention =
|
|
14393
|
+
progressIntervention &&
|
|
14394
|
+
progressIntervention.key !== lastTaskProgressIntervention;
|
|
14395
|
+
const taskRecoveryTurn =
|
|
14396
|
+
newProgressIntervention && progressIntervention.recovery;
|
|
14397
|
+
if (newProgressIntervention) {
|
|
14398
|
+
lastTaskProgressIntervention = progressIntervention.key;
|
|
14399
|
+
// Reuse the existing warning event so CLI, REPL and IDE clients all show
|
|
14400
|
+
// the recovery instead of leaving the user with an unexplained spinner.
|
|
14401
|
+
yield {
|
|
14402
|
+
type: "iteration-warning",
|
|
14403
|
+
message:
|
|
14404
|
+
progressIntervention.message +
|
|
14405
|
+
(taskRecoveryTurn
|
|
14406
|
+
? " Broad reading and new delegation are paused for one model turn."
|
|
14407
|
+
: ""),
|
|
14408
|
+
};
|
|
14409
|
+
}
|
|
14410
|
+
const iterationToolOptions =
|
|
14411
|
+
readRecoveryTurn || taskRecoveryTurn
|
|
14412
|
+
? {
|
|
14413
|
+
...effectiveToolOptions,
|
|
14414
|
+
disabledTools: [
|
|
14415
|
+
...new Set([
|
|
14416
|
+
...(effectiveToolOptions.disabledTools || []),
|
|
14417
|
+
...(readRecoveryTurn ? ["read_file"] : []),
|
|
14418
|
+
...(taskRecoveryTurn ? TASK_RECOVERY_TOOLS : []),
|
|
14419
|
+
]),
|
|
14420
|
+
],
|
|
14421
|
+
}
|
|
14422
|
+
: effectiveToolOptions;
|
|
14316
14423
|
const readContext = [
|
|
14317
14424
|
readFileLoopGuard.findingsHint,
|
|
14318
14425
|
readFileLoopGuard.progressHint,
|
|
14426
|
+
taskProgressTracker.checkpointFor(runId),
|
|
14319
14427
|
].filter(Boolean);
|
|
14320
14428
|
if (readContext.length) {
|
|
14321
14429
|
// Preserve the last conversational turn and never split a tool call
|
|
@@ -14360,6 +14468,20 @@ export async function* agentLoop(messages, options) {
|
|
|
14360
14468
|
}
|
|
14361
14469
|
}
|
|
14362
14470
|
const contextMemoryTrustedSystemIndexes = [];
|
|
14471
|
+
if (progressIntervention) {
|
|
14472
|
+
callMessages = [
|
|
14473
|
+
...callMessages,
|
|
14474
|
+
{
|
|
14475
|
+
role: "system",
|
|
14476
|
+
content:
|
|
14477
|
+
progressIntervention.guidance +
|
|
14478
|
+
(taskRecoveryTurn
|
|
14479
|
+
? " One-turn recovery: read_file, list_dir, todo_write, spawn_sub_agent and tool_search are omitted for this request only."
|
|
14480
|
+
: ""),
|
|
14481
|
+
},
|
|
14482
|
+
];
|
|
14483
|
+
contextMemoryTrustedSystemIndexes.push(callMessages.length - 1);
|
|
14484
|
+
}
|
|
14363
14485
|
if (readRecoveryTurn) {
|
|
14364
14486
|
callMessages = [
|
|
14365
14487
|
...callMessages,
|
|
@@ -14626,6 +14748,29 @@ export async function* agentLoop(messages, options) {
|
|
|
14626
14748
|
}
|
|
14627
14749
|
|
|
14628
14750
|
const toolCalls = msg.tool_calls;
|
|
14751
|
+
if (Array.isArray(toolCalls) && toolCalls.length > 0) {
|
|
14752
|
+
// Allocate missing provider IDs once, before transcript insertion and
|
|
14753
|
+
// any evidence or execution boundary. This is only local correlation,
|
|
14754
|
+
// not a provider receipt or an exactly-once execution guarantee.
|
|
14755
|
+
const usedIds = new Set();
|
|
14756
|
+
for (const call of toolCalls) {
|
|
14757
|
+
if (!call || typeof call !== "object") continue;
|
|
14758
|
+
if (call.id == null || call.id === "") {
|
|
14759
|
+
// Letter-only encoding retains UUID entropy without introducing
|
|
14760
|
+
// number-like control IDs into sensitive-data classification.
|
|
14761
|
+
const localId = randomUUID()
|
|
14762
|
+
.replaceAll("-", "")
|
|
14763
|
+
.replace(/[0-9]/g, (digit) =>
|
|
14764
|
+
String.fromCharCode(103 + Number(digit)),
|
|
14765
|
+
);
|
|
14766
|
+
call.id = `cc_tool_${localId}`;
|
|
14767
|
+
}
|
|
14768
|
+
if (typeof call.id !== "string" || usedIds.has(call.id)) {
|
|
14769
|
+
throw new Error("Malformed or duplicate tool call identity");
|
|
14770
|
+
}
|
|
14771
|
+
usedIds.add(call.id);
|
|
14772
|
+
}
|
|
14773
|
+
}
|
|
14629
14774
|
|
|
14630
14775
|
if (!toolCalls || toolCalls.length === 0) {
|
|
14631
14776
|
// A final answer while background sub-agents are still outstanding is
|
|
@@ -14655,6 +14800,14 @@ export async function* agentLoop(messages, options) {
|
|
|
14655
14800
|
_backgroundSubAgentResultText(entry) +
|
|
14656
14801
|
"\n\nAll background sub-agents have finished. Incorporate their results and give your final answer.",
|
|
14657
14802
|
});
|
|
14803
|
+
taskProgressTracker.retainChildResult(
|
|
14804
|
+
entry.id,
|
|
14805
|
+
{
|
|
14806
|
+
...entry.outcome?.result,
|
|
14807
|
+
error: entry.outcome?.error,
|
|
14808
|
+
},
|
|
14809
|
+
runId,
|
|
14810
|
+
);
|
|
14658
14811
|
yield {
|
|
14659
14812
|
type: "background-sub-agent-result",
|
|
14660
14813
|
runId,
|
|
@@ -14891,7 +15044,16 @@ export async function* agentLoop(messages, options) {
|
|
|
14891
15044
|
_throwBackgroundUsageFailureState(backgroundUsageFailureState);
|
|
14892
15045
|
const { result: toolResult, error: toolError } = await promise;
|
|
14893
15046
|
throwIfAborted(signal);
|
|
14894
|
-
readFileLoopGuard.record(
|
|
15047
|
+
readFileLoopGuard.record(
|
|
15048
|
+
call.function.name,
|
|
15049
|
+
toolResult,
|
|
15050
|
+
taskProgressTracker.record(
|
|
15051
|
+
call.function.name,
|
|
15052
|
+
toolResult,
|
|
15053
|
+
toolArgs,
|
|
15054
|
+
runId,
|
|
15055
|
+
),
|
|
15056
|
+
);
|
|
14895
15057
|
const failed = emitToolHookLifecycle({
|
|
14896
15058
|
tool: call.function.name,
|
|
14897
15059
|
args: toolArgs,
|
|
@@ -15263,7 +15425,11 @@ export async function* agentLoop(messages, options) {
|
|
|
15263
15425
|
"tool_error",
|
|
15264
15426
|
);
|
|
15265
15427
|
} catch (err) {
|
|
15266
|
-
if (
|
|
15428
|
+
if (
|
|
15429
|
+
isEvolutionIngressFailure(err) ||
|
|
15430
|
+
err?.runtimeLedgerPersistence === true
|
|
15431
|
+
)
|
|
15432
|
+
throw err;
|
|
15267
15433
|
toolResult = {
|
|
15268
15434
|
error: err.message,
|
|
15269
15435
|
...(workflowBinding
|
|
@@ -15362,7 +15528,11 @@ export async function* agentLoop(messages, options) {
|
|
|
15362
15528
|
// context — but tell the model when we cut it (no more silent
|
|
15363
15529
|
// mid-content slice). See MAX_TOOL_RESULT_CHARS / capToolResultString.
|
|
15364
15530
|
const resultStr = toolResultForModel(toolName, toolResult, messages);
|
|
15365
|
-
readFileLoopGuard.record(
|
|
15531
|
+
readFileLoopGuard.record(
|
|
15532
|
+
toolName,
|
|
15533
|
+
toolResult,
|
|
15534
|
+
taskProgressTracker.record(toolName, toolResult, toolArgs, runId),
|
|
15535
|
+
);
|
|
15366
15536
|
const toolContent = warningMsg
|
|
15367
15537
|
? `${resultStr}\n\n${warningMsg}`
|
|
15368
15538
|
: resultStr;
|
|
@@ -379,6 +379,9 @@ export class AgentRuntime {
|
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
async startChatSession() {
|
|
382
|
+
if (this.evolutionIngress !== null) {
|
|
383
|
+
await this.evolutionIngress.start();
|
|
384
|
+
}
|
|
382
385
|
this.emit(RUNTIME_EVENTS.RUNTIME_START, {
|
|
383
386
|
kind: this.kind,
|
|
384
387
|
policy: this.policy,
|
|
@@ -387,7 +390,23 @@ export class AgentRuntime {
|
|
|
387
390
|
kind: this.kind,
|
|
388
391
|
sessionId: this.policy.sessionId || null,
|
|
389
392
|
});
|
|
390
|
-
|
|
393
|
+
const result = await this.deps.startChatRepl({
|
|
394
|
+
...this.policy,
|
|
395
|
+
...(this.evolutionIngress === null
|
|
396
|
+
? {}
|
|
397
|
+
: { evolutionIngress: this.evolutionIngress }),
|
|
398
|
+
});
|
|
399
|
+
if (this.evolutionIngress !== null) {
|
|
400
|
+
if (result?.schema === AGENT_EVOLUTION_SESSION_SCHEMA) {
|
|
401
|
+
return await waitForAgentEvolutionSession(
|
|
402
|
+
result,
|
|
403
|
+
this.evolutionIngress,
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
if (result?.started === false) return result;
|
|
407
|
+
await this.evolutionIngress.complete();
|
|
408
|
+
}
|
|
409
|
+
return result;
|
|
391
410
|
}
|
|
392
411
|
|
|
393
412
|
async startServer() {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as h,P as u,J as S,U as n,R as a,S as y,K as C,Q as x,V as w,_ as B,b as s}from"./vendor-Bn1JzzAn.js";import{_ as k}from"./index-BElgeKJ0.js";import"./icons-DG5UD-6K.js";const N={__name:"ChatBubbleRenderer",props:{event:{type:Object,required:!0}},setup(c,{expose:d}){d();const t=c,r=s(()=>{const e=t.event.content||{};return e.text||e.body||e.message||e.title||JSON.stringify(e).slice(0,200)}),i=s(()=>{const e=t.event.content||{};return e.from||e.sender||e.senderName||t.event.actor||"(unknown)"}),l=s(()=>{const e=(t.event.actor||"").toLowerCase();return e.includes("self")||e==="me"||e.endsWith("_self")}),o=s(()=>{const e=t.event.source.adapter||"";return e.startsWith("messaging-qq")?"magenta":e==="wechat"?"green":"blue"}),m=s(()=>{if(!t.event.occurredAt)return"";try{const e=new Date(t.event.occurredAt),p=e.getFullYear(),f=String(e.getMonth()+1).padStart(2,"0"),g=String(e.getDate()).padStart(2,"0"),v=String(e.getHours()).padStart(2,"0"),b=String(e.getMinutes()).padStart(2,"0");return`${p}-${f}-${g} ${v}:${b}`}catch{return""}}),_={props:t,messageText:r,actorLabel:i,isMine:l,adapterColor:o,formattedTime:m,computed:s};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}},T={class:"bubble"},M={class:"meta"},R={class:"actor"},V={class:"time"},q={class:"body"};function D(c,d,t,r,i,l){const o=h("a-tag");return u(),S("div",{class:B(["chat-row",{mine:r.isMine}])},[n("div",T,[n("div",M,[n("span",R,a(r.actorLabel),1),n("span",V,a(r.formattedTime),1)]),n("div",q,a(r.messageText),1),t.event.source.adapter?(u(),y(o,{key:0,class:"src",color:r.adapterColor},{default:C(()=>[x(a(t.event.source.adapter),1)]),_:1},8,["color"])):w("v-if",!0)])],2)}const O=k(N,[["render",D],["__scopeId","data-v-49238629"],["__file","/tmp/cc-web-panel-svJYvI/repo/packages/web-panel/src/components/pdh/renderers/ChatBubbleRenderer.vue"]]);export{O as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as c,J as p,b as s}from"./vendor-Bn1JzzAn.js";import{r as a}from"./markdown-Yo_c6Krv.js";import{_ as d}from"./index-BElgeKJ0.js";const _={__name:"MarkdownRenderer",props:{content:{type:String,default:""}},setup(t,{expose:o}){o();const e=t,r=s(()=>a(e.content||"")),n={props:e,rendered:r,computed:s,get renderMarkdown(){return a}};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}},i=["innerHTML"];function m(t,o,e,r,n,u){return c(),p("div",{class:"markdown-content",innerHTML:r.rendered},null,8,i)}const w=d(_,[["render",m],["__scopeId","data-v-0b0b9f63"],["__file","/tmp/cc-web-panel-svJYvI/repo/packages/web-panel/src/components/MarkdownRenderer.vue"]]);export{w as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Q as r}from"./index-BElgeKJ0.js";const o=((n,a,e)=>{r(n,`[ant-design-vue: ${a}] ${e}`)});export{o as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as o}from"./Col-DrSCT-nF.js";import{a0 as t}from"./index-BElgeKJ0.js";import"./vendor-Bn1JzzAn.js";import"./index-DoUC5_ry.js";import"./icons-DG5UD-6K.js";const s=t(o);export{s as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as o}from"./Row-C7GVts31.js";import{a0 as t}from"./index-BElgeKJ0.js";import"./vendor-Bn1JzzAn.js";import"./responsiveObserve-DC_QzljB.js";import"./useFlexGapSupport-s8edGuXD.js";import"./styleChecker-CV_T1ULL.js";import"./index-DoUC5_ry.js";import"./icons-DG5UD-6K.js";const l=t(o);export{l as default};
|