chainlesschain 0.166.26 → 0.166.28
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-TeJoc3XQ.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-C4bKCISV.js → ActionButton-SZ9klC71.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-GztAv2jy.js → Analytics-BvxMGhXs.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-DEqNcuVx.js → AppLayout-5zUWvYnk.js} +4 -4
- package/src/assets/web-panel/assets/{Artifacts-D-R4Ehap.js → Artifacts-0BfSQj3N.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-mzzdTIlM.js → Audit-cScBdt3p.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-DS2QupIC.js → BackgroundAgents-022mS_uG.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-CQSirC39.js → Backup-CWnqpCpj.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-Bhuc-eOV.js → BaseInput-BCp80_Kc.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-B-RLVGnt.js → Chat-B2rj5NdZ.js} +6 -6
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-CBbMoVuE.js → ChatBubbleRenderer-2Lw_8bkr.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-DxwgBryW.js → Checkbox-BTHrb0x7.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-Cwrm-7nh.js → Codegen-Y17WGsCF.js} +1 -1
- package/src/assets/web-panel/assets/{Col-DrSCT-nF.js → Col-BBBucqHI.js} +1 -1
- package/src/assets/web-panel/assets/{Community-DY2D9WNs.js → Community-B2qcNGY4.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-o-tV0URw.js → Compact-BhDyZd93.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-Bndh6S8f.js → Compliance-BUEgTVrI.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-CSNQODak.js → Cowork-_wey4IKY.js} +3 -3
- package/src/assets/web-panel/assets/{Cron-CTgxRHdy.js → Cron-BSO7RSdx.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-BJoGQzDI.js → Crosschain-DawYCk-u.js} +1 -1
- package/src/assets/web-panel/assets/{DID-V0Ztm8ne.js → DID-DvtgImFY.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-B-38THOj.js → Dashboard-DYAyw4yL.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-B3FdOwMO.js → Dropdown-CIaenBpM.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-YQDz4mUF.js → EmailListRenderer-jKv7wz64.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-DYE45IF9.js → FamilyGuardDashboard-BxQggJuN.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-DjBFjdRZ.js → Federation-CDi_BOHj.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-CVTXEa0R.js → FormItemContext-C-7XWf-w.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-B6Tkke8X.js → GenericCardRenderer-D8PAhWue.js} +1 -1
- package/src/assets/web-panel/assets/{Git-CD0hyAzT.js → Git-yhajzO5I.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-CWOQQJr8.js → Governance-DjM6hZK3.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-lHYwUk-C.js → Inference-C-gVn1ci.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-Cledxv7t.js → KnowledgeGraph-CyG5TgH-.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-D45mt-rM.js → Logs-CnIbZJc3.js} +2 -2
- package/src/assets/web-panel/assets/MarkdownRenderer-BDfOgqr1.js +1 -0
- package/src/assets/web-panel/assets/{Marketplace-Yy30UZPw.js → Marketplace-BQry6ziq.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-Cil5l-bh.js → McpTools-7MBu8YsX.js} +3 -3
- package/src/assets/web-panel/assets/{Memory-DdJcnyqy.js → Memory-BlaZL_vM.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-IrzFYHEv.js → MobileBridge-iUYdZA22.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-D8q64LMd.js → MobileProjects-CUO-OpoO.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-CpdTJzW7.js → Mtc-6sD7414H.js} +4 -4
- package/src/assets/web-panel/assets/{MtcAudit-C7Tvw2m6.js → MtcAudit-BW8hjlD8.js} +4 -4
- package/src/assets/web-panel/assets/{Multisig-Dmj9F5Kr.js → Multisig-BA7_DWLu.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-C9Xchob5.js → NLProgramming-7P7H52-B.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-Bzq6Yry5.js → Notes-D2O2aG0R.js} +4 -4
- package/src/assets/web-panel/assets/{NotificationSettings-DxG9eKb4.js → NotificationSettings-SD4fdxcr.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-BS_IYoCe.js → OrderTableRenderer-BbXM4Ueq.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-kazsRvcq.js → Organization-DNabgtKX.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-i4wP-hwn.js → Overflow-B7Bqrhq0.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-CfGeU3h-.js → P2P-Dh0Df0zq.js} +2 -2
- package/src/assets/web-panel/assets/{PdhVaultBrowser-CS-VhVUx.js → PdhVaultBrowser-DHfJarF9.js} +5 -5
- package/src/assets/web-panel/assets/{Permissions-DnEHXs0I.js → Permissions-Bz3ddnZ9.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-DeD82qke.js → PersonalDataHub-Dfe0X6p8.js} +5 -5
- package/src/assets/web-panel/assets/{Pipeline-CMGGLgBY.js → Pipeline-kCnDqnwc.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-CvHoFv32.js → Privacy-CPveUX9G.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-DnJapCc1.js → ProjectInit-ddXd7WTL.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-CqVdv3-g.js → ProjectSettings-DnXcEjyu.js} +2 -2
- package/src/assets/web-panel/assets/{Projects-B_o8vcs_.js → Projects-O2yaPDuU.js} +1 -1
- package/src/assets/web-panel/assets/{Providers-CPKseoDW.js → Providers-hJpcyGxR.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-_iBfKbPQ.js → QrScannerModal-CkbMoodn.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-CMrlZ69a.js → QuickAsk-CyFailNZ.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-BwDtSZ0l.js → Recommend-jpIDoqHs.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-DomUAtn4.js → RemoteSession-CieiVXM-.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-Cuu2GCHr.js → Reputation-DHtgC0AY.js} +1 -1
- package/src/assets/web-panel/assets/{Row-C7GVts31.js → Row-CSUyTUkR.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-DRKvgEog.js → RssFeed-CkHylSMs.js} +3 -3
- package/src/assets/web-panel/assets/{Search-BGI9wOeA.js → Search-ykyn3OaJ.js} +1 -1
- package/src/assets/web-panel/assets/{Security-BlLaHy_L.js → Security-DjM95Eyb.js} +3 -3
- package/src/assets/web-panel/assets/{Services-DFqZbjmX.js → Services-Cf4UMvka.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-BCGxdooP.js → Skeleton-BnR-ZNiM.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-CwFKgcmm.js → Skills-oC5jYJgK.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-CiXXh9eS.js → Sla-CTc_YFxW.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-WSx2CLqO.js → SpeechSettings-31rddoaP.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-BBIqQOtW.js → SyncSettings-C-h00U59.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-D1BGLjO1.js → Tasks-CGn_IiAO.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-CUIl9axA.js → Templates-B9Hz_RuF.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-BFZJ0hNz.js → Tenant-CJnIeKrI.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-Cw-3eYVn.js → Terminal-DfGtwDMA.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-bOVPB56L.js → TimelineRenderer-CISmCIFj.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-Czfyq2VY.js → Tokens-DNr-VU6W.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-C-o4uJY0.js → Trigger-CCYolBXm.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-BKq_S6iF.js → Trust-DD75_Hjo.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-fKlWUvMx.js → UkeySign-BXulgGCu.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-DB5MLuS7.js → VideoEditing-B0DgHQiZ.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-WGXBn7IS.js → Wallet-BV3CEPVS.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-B8TC4EMF.js → WebAuthn-CI9bXloP.js} +4 -4
- package/src/assets/web-panel/assets/{WorkflowEditor-DLY--KmM.js → WorkflowEditor-B4z18zZp.js} +1 -1
- package/src/assets/web-panel/assets/{chat-Crw3XQaA.js → chat-BsQ4S4Nh.js} +1 -1
- package/src/assets/web-panel/assets/{colors-CxhWauPV.js → colors-C0Jsl3u8.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-Cp3ojtk5.js → compact-item-CMZ_5Gdj.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-CRuRXjSo.js → createContext-VeTZ9pjJ.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-ChXQhXs6.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-XGW474dj.js → hasIn-R2ip_4t-.js} +1 -1
- package/src/assets/web-panel/assets/{index-38TRdZb6.js → index-02inSVeg.js} +1 -1
- package/src/assets/web-panel/assets/{index-C73pqyDb.js → index-0LEUdXks.js} +1 -1
- package/src/assets/web-panel/assets/{index-B5fJS-kn.js → index-4i3UILe7.js} +1 -1
- package/src/assets/web-panel/assets/{index-DoUC5_ry.js → index-6vvyh4N2.js} +1 -1
- package/src/assets/web-panel/assets/{index-DHNixOg_.js → index-B53MC1iz.js} +1 -1
- package/src/assets/web-panel/assets/{index-CDIpH_8Q.js → index-BDl3jun-.js} +1 -1
- package/src/assets/web-panel/assets/{index-DfPLIA-f.js → index-BGFKUUsv.js} +1 -1
- package/src/assets/web-panel/assets/{index-DxOtBFVy.js → index-BGKhfuHU.js} +1 -1
- package/src/assets/web-panel/assets/{index-BXnNbbwa.js → index-BJvl_XUa.js} +1 -1
- package/src/assets/web-panel/assets/{index-qzmihx1d.js → index-BPTTGRU9.js} +1 -1
- package/src/assets/web-panel/assets/{index-BetOkRLs.js → index-BX_8_UFn.js} +1 -1
- package/src/assets/web-panel/assets/{index-CTE32qol.js → index-BdwYZI-H.js} +1 -1
- package/src/assets/web-panel/assets/{index-Ctu98x57.js → index-Bhz0a_oU.js} +1 -1
- package/src/assets/web-panel/assets/{index-jrIcbPUa.js → index-BjW7Qlh-.js} +1 -1
- package/src/assets/web-panel/assets/index-BpqhSIKB.js +1 -0
- package/src/assets/web-panel/assets/{index-BUWZ57T4.js → index-BtV-unhh.js} +1 -1
- package/src/assets/web-panel/assets/{index-C8UOVaUH.js → index-ByPe74vs.js} +1 -1
- package/src/assets/web-panel/assets/{index-BElgeKJ0.js → index-Bz4O8exa.js} +3 -3
- package/src/assets/web-panel/assets/{index-DUSVsOGS.js → index-C3oYV_lA.js} +1 -1
- package/src/assets/web-panel/assets/{index-De2FN0xN.js → index-CIanQUmB.js} +1 -1
- package/src/assets/web-panel/assets/{index-CdlfrcC-.js → index-CNMfIBsh.js} +1 -1
- package/src/assets/web-panel/assets/{index-QqAuH7-S.js → index-CsoYgCfM.js} +1 -1
- package/src/assets/web-panel/assets/{index-CPFam-me.js → index-CuIo38St.js} +1 -1
- package/src/assets/web-panel/assets/index-Cv9p7aNY.js +1 -0
- package/src/assets/web-panel/assets/{index-DhomnuaB.js → index-D4DUCUMd.js} +1 -1
- package/src/assets/web-panel/assets/{index-BYkjs7eP.js → index-DF8AVnyq.js} +1 -1
- package/src/assets/web-panel/assets/{index-DBcBsJYg.js → index-DUfRaQ2R.js} +1 -1
- package/src/assets/web-panel/assets/{index-BW028Pwn.js → index-DdXJoar7.js} +1 -1
- package/src/assets/web-panel/assets/{index-Yq3bFbYX.js → index-DjkLws9g.js} +1 -1
- package/src/assets/web-panel/assets/{index-J_08R33H.js → index-Dqf95oif.js} +1 -1
- package/src/assets/web-panel/assets/{index-BVmSfIkJ.js → index-Du20UePt.js} +1 -1
- package/src/assets/web-panel/assets/{index-BuVA26SD.js → index-DvYF07ij.js} +1 -1
- package/src/assets/web-panel/assets/{index-rsACoVT9.js → index-DwfM7rYW.js} +1 -1
- package/src/assets/web-panel/assets/{index-WvNZXbIO.js → index-WJ_YxlwK.js} +1 -1
- package/src/assets/web-panel/assets/{index-E-RSfImO.js → index-Zlt4hVX9.js} +1 -1
- package/src/assets/web-panel/assets/{index-Dp2nC5On.js → index-iHgBGK8l.js} +1 -1
- package/src/assets/web-panel/assets/{index-nJR64pA_.js → index-nM2lMEZ4.js} +1 -1
- package/src/assets/web-panel/assets/{index-B45Vkh3T.js → index-q_5BV7Pj.js} +1 -1
- package/src/assets/web-panel/assets/{index-W8_0yAi_.js → index-yIN1stc7.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-DAu-hgme.js → initDefaultProps-D1uCn3z4.js} +1 -1
- package/src/assets/web-panel/assets/{motion-Db8yk0Hu.js → motion-5TP3EY0Q.js} +1 -1
- package/src/assets/web-panel/assets/{move-Cii2jOin.js → move-C_bi-KUq.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-CnZBDkyZ.js → mtc-parser-CmdzT6ro.js} +1 -1
- package/src/assets/web-panel/assets/{omit-Buzt1FTL.js → omit-Ce0_wQke.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-CpZ_NmE6.js → pickAttrs-DG8auaWM.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-mBrx3dYm.js → placementArrow-CaWVLdLv.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-DC_QzljB.js → responsiveObserve-Bot4LFBx.js} +1 -1
- package/src/assets/web-panel/assets/{slide-DT_UVED-.js → slide-HCFYDpKc.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-78t6eNLV.js → statusUtils-CWNqwWxQ.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-CV_T1ULL.js → styleChecker-BUyR4PCy.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-s8edGuXD.js → useFlexGapSupport-C4XRVB5s.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-Pk9dH2HC.js → useFs-D2VOJbk-.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-B_GqAm8c.js → usePersonalDataHub-dN8G1tq6.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-Cxyss24q.js → vnode-DSQKKZnw.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-0UY3cOuc.js → zoom-Dl0bVMqQ.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 +13 -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 +21 -1
- package/src/lib/sub-agent-context.js +34 -2
- package/src/repl/chat-repl.js +60 -10
- package/src/runtime/agent-core.js +96 -5
- package/src/runtime/agent-runtime.js +20 -1
- package/src/runtime/runtime-factory.js +1 -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/commands/ask.js
CHANGED
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import ora from "ora";
|
|
25
|
+
import { randomUUID } from "node:crypto";
|
|
26
|
+
import { types as utilTypes } from "node:util";
|
|
27
|
+
import { captureAgentEvolutionRuntimeComposition } from "../lib/evolution/agent-evolution-runtime-composition-brand.js";
|
|
28
|
+
import { captureAgentEvolutionIngress } from "../lib/evolution/agent-evolution-ingress.js";
|
|
25
29
|
import { logger } from "../lib/logger.js";
|
|
26
30
|
import { BUILT_IN_PROVIDERS } from "../lib/llm-providers.js";
|
|
27
31
|
import { loadConfig } from "../lib/config-manager.js";
|
|
@@ -97,9 +101,22 @@ export function extractCompletion(data, provider = "provider") {
|
|
|
97
101
|
return content;
|
|
98
102
|
}
|
|
99
103
|
|
|
100
|
-
export async function queryLLM(
|
|
104
|
+
export async function queryLLM(
|
|
105
|
+
question,
|
|
106
|
+
options = {},
|
|
107
|
+
evolutionIngress = null,
|
|
108
|
+
) {
|
|
101
109
|
const provider = options.provider || "ollama";
|
|
102
110
|
const model = options.model || "qwen2:7b";
|
|
111
|
+
const messages = [{ role: "user", content: question }];
|
|
112
|
+
const providerMessages =
|
|
113
|
+
evolutionIngress === null
|
|
114
|
+
? messages
|
|
115
|
+
: (
|
|
116
|
+
await captureAgentEvolutionIngress(
|
|
117
|
+
evolutionIngress,
|
|
118
|
+
).prepareModelRequest({ messages, tools: [] })
|
|
119
|
+
).messages;
|
|
103
120
|
|
|
104
121
|
// Claude-Code 2.1.183 parity: warn (stderr only, so --json/stdout stays
|
|
105
122
|
// clean) if the requested model is a provider-retired snapshot. Suppressed
|
|
@@ -123,7 +140,7 @@ export async function queryLLM(question, options = {}) {
|
|
|
123
140
|
headers: { "Content-Type": "application/json" },
|
|
124
141
|
body: JSON.stringify({
|
|
125
142
|
model,
|
|
126
|
-
messages:
|
|
143
|
+
messages: providerMessages,
|
|
127
144
|
stream: false,
|
|
128
145
|
}),
|
|
129
146
|
});
|
|
@@ -169,7 +186,7 @@ export async function queryLLM(question, options = {}) {
|
|
|
169
186
|
},
|
|
170
187
|
body: JSON.stringify({
|
|
171
188
|
model: model || providerDef.models[0],
|
|
172
|
-
messages:
|
|
189
|
+
messages: providerMessages,
|
|
173
190
|
}),
|
|
174
191
|
});
|
|
175
192
|
|
|
@@ -183,7 +200,29 @@ export async function queryLLM(question, options = {}) {
|
|
|
183
200
|
return extractCompletion(data, provider);
|
|
184
201
|
}
|
|
185
202
|
|
|
186
|
-
export function registerAskCommand(program) {
|
|
203
|
+
export function registerAskCommand(program, dependencies = {}) {
|
|
204
|
+
if (
|
|
205
|
+
!dependencies ||
|
|
206
|
+
typeof dependencies !== "object" ||
|
|
207
|
+
Array.isArray(dependencies) ||
|
|
208
|
+
utilTypes.isProxy(dependencies)
|
|
209
|
+
) {
|
|
210
|
+
throw new TypeError("Ask command dependencies must be a plain object");
|
|
211
|
+
}
|
|
212
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
213
|
+
dependencies,
|
|
214
|
+
"evolutionCompositionFactory",
|
|
215
|
+
);
|
|
216
|
+
if (
|
|
217
|
+
descriptor &&
|
|
218
|
+
(!Object.hasOwn(descriptor, "value") ||
|
|
219
|
+
typeof descriptor.value !== "function")
|
|
220
|
+
) {
|
|
221
|
+
throw new TypeError(
|
|
222
|
+
"Ask evolutionCompositionFactory must be a function data property",
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
const evolutionCompositionFactory = descriptor?.value ?? null;
|
|
187
226
|
program
|
|
188
227
|
.command("ask")
|
|
189
228
|
.description("Ask a question to the AI (single-shot)")
|
|
@@ -239,7 +278,47 @@ export function registerAskCommand(program) {
|
|
|
239
278
|
|
|
240
279
|
const spinner = ora("Thinking...").start();
|
|
241
280
|
try {
|
|
242
|
-
|
|
281
|
+
let ingress = null;
|
|
282
|
+
if (evolutionCompositionFactory !== null) {
|
|
283
|
+
const runId = `ask-${randomUUID()}`;
|
|
284
|
+
const composition = captureAgentEvolutionRuntimeComposition(
|
|
285
|
+
await evolutionCompositionFactory(
|
|
286
|
+
Object.freeze({
|
|
287
|
+
mode: "ask",
|
|
288
|
+
runId,
|
|
289
|
+
taskId: runId,
|
|
290
|
+
cwd: process.cwd(),
|
|
291
|
+
}),
|
|
292
|
+
),
|
|
293
|
+
);
|
|
294
|
+
ingress = composition.evolutionIngress;
|
|
295
|
+
if (
|
|
296
|
+
composition.runId !== runId ||
|
|
297
|
+
ingress.runId !== runId ||
|
|
298
|
+
composition.tenantId !== ingress.tenantId
|
|
299
|
+
) {
|
|
300
|
+
throw new Error(
|
|
301
|
+
"Ask evolution composition is not bound to the requested Run",
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
await ingress.start();
|
|
305
|
+
await ingress.ingestUserPrompt({
|
|
306
|
+
content: expandedQuestion,
|
|
307
|
+
source: "ask",
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
const answer = await queryLLM(
|
|
311
|
+
expandedQuestion,
|
|
312
|
+
resolvedOptions,
|
|
313
|
+
ingress,
|
|
314
|
+
);
|
|
315
|
+
if (ingress !== null) {
|
|
316
|
+
await ingress.ingestAgentEvent({
|
|
317
|
+
type: "response-complete",
|
|
318
|
+
content: answer,
|
|
319
|
+
});
|
|
320
|
+
await ingress.complete();
|
|
321
|
+
}
|
|
243
322
|
|
|
244
323
|
spinner.stop();
|
|
245
324
|
|
package/src/commands/chat.js
CHANGED
|
@@ -5,10 +5,69 @@
|
|
|
5
5
|
|
|
6
6
|
import { createAgentRuntimeFactory } from "../runtime/runtime-factory.js";
|
|
7
7
|
import { assertChatSessionUsageAdmission } from "../lib/chat-session-admission.js";
|
|
8
|
+
import { randomUUID } from "node:crypto";
|
|
9
|
+
import { types as utilTypes } from "node:util";
|
|
10
|
+
import { captureAgentEvolutionRuntimeComposition } from "../lib/evolution/agent-evolution-runtime-composition.js";
|
|
8
11
|
|
|
9
12
|
export { assertChatSessionUsageAdmission } from "../lib/chat-session-admission.js";
|
|
10
13
|
|
|
14
|
+
function captureChatEvolutionCompositionFactory(commandDeps) {
|
|
15
|
+
if (
|
|
16
|
+
commandDeps === null ||
|
|
17
|
+
typeof commandDeps !== "object" ||
|
|
18
|
+
Array.isArray(commandDeps) ||
|
|
19
|
+
utilTypes.isProxy(commandDeps)
|
|
20
|
+
) {
|
|
21
|
+
throw new TypeError("Chat command dependencies must be a plain object");
|
|
22
|
+
}
|
|
23
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
24
|
+
commandDeps,
|
|
25
|
+
"evolutionCompositionFactory",
|
|
26
|
+
);
|
|
27
|
+
if (!descriptor) return null;
|
|
28
|
+
if (
|
|
29
|
+
!Object.hasOwn(descriptor, "value") ||
|
|
30
|
+
typeof descriptor.value !== "function"
|
|
31
|
+
) {
|
|
32
|
+
throw new TypeError(
|
|
33
|
+
"Chat evolutionCompositionFactory must be a function data property",
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
return descriptor.value;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export async function resolveChatCommandEvolutionComposition(
|
|
40
|
+
evolutionCompositionFactory,
|
|
41
|
+
{ agent = false } = {},
|
|
42
|
+
) {
|
|
43
|
+
if (evolutionCompositionFactory === null) return null;
|
|
44
|
+
const mode = agent ? "chat-agent" : "chat";
|
|
45
|
+
const runId = `${mode}-${randomUUID()}`;
|
|
46
|
+
const composition = captureAgentEvolutionRuntimeComposition(
|
|
47
|
+
await evolutionCompositionFactory(
|
|
48
|
+
Object.freeze({
|
|
49
|
+
mode,
|
|
50
|
+
runId,
|
|
51
|
+
taskId: runId,
|
|
52
|
+
cwd: process.cwd(),
|
|
53
|
+
}),
|
|
54
|
+
),
|
|
55
|
+
);
|
|
56
|
+
if (
|
|
57
|
+
composition.runId !== runId ||
|
|
58
|
+
composition.evolutionIngress.runId !== runId ||
|
|
59
|
+
composition.tenantId !== composition.evolutionIngress.tenantId
|
|
60
|
+
) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
"Chat evolution composition is not bound to the requested Run",
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return composition;
|
|
66
|
+
}
|
|
67
|
+
|
|
11
68
|
export function registerChatCommand(program, dependencies = {}) {
|
|
69
|
+
const evolutionCompositionFactory =
|
|
70
|
+
captureChatEvolutionCompositionFactory(dependencies);
|
|
12
71
|
const createRuntimeFactory =
|
|
13
72
|
dependencies.createAgentRuntimeFactory || createAgentRuntimeFactory;
|
|
14
73
|
const assertUsageAdmission =
|
|
@@ -31,7 +90,14 @@ export function registerChatCommand(program, dependencies = {}) {
|
|
|
31
90
|
.option("--session <id>", "Resume a previous session (agent mode)")
|
|
32
91
|
.action(async (options) => {
|
|
33
92
|
if (!options.agent) assertUsageAdmission(options.session);
|
|
34
|
-
const
|
|
93
|
+
const evolutionComposition = await resolveChatCommandEvolutionComposition(
|
|
94
|
+
evolutionCompositionFactory,
|
|
95
|
+
{ agent: Boolean(options.agent) },
|
|
96
|
+
);
|
|
97
|
+
const factory =
|
|
98
|
+
evolutionComposition === null
|
|
99
|
+
? createRuntimeFactory()
|
|
100
|
+
: createRuntimeFactory({ evolutionComposition });
|
|
35
101
|
const runtimeOptions = {
|
|
36
102
|
model: options.model,
|
|
37
103
|
provider: options.provider,
|
package/src/commands/compact.js
CHANGED
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import chalk from "chalk";
|
|
23
|
+
import { randomUUID } from "node:crypto";
|
|
24
|
+
import { types as utilTypes } from "node:util";
|
|
25
|
+
import { captureAgentEvolutionRuntimeComposition } from "../lib/evolution/agent-evolution-runtime-composition-brand.js";
|
|
23
26
|
import { logger } from "../lib/logger.js";
|
|
24
27
|
import {
|
|
25
28
|
appendAuthorityEventIfHead,
|
|
@@ -85,7 +88,14 @@ function attachMeteringMetadata(value, { callId, settled }) {
|
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
90
|
|
|
88
|
-
function buildSemanticQuery(
|
|
91
|
+
function buildSemanticQuery(
|
|
92
|
+
options,
|
|
93
|
+
recorded,
|
|
94
|
+
sessionId,
|
|
95
|
+
operationId,
|
|
96
|
+
ledger,
|
|
97
|
+
evolutionCompositionFactory,
|
|
98
|
+
) {
|
|
89
99
|
const provider = options.provider || recorded.provider || undefined;
|
|
90
100
|
const model = options.model || recorded.model || undefined;
|
|
91
101
|
// A preview must be both write-free and spend-free. It uses the same
|
|
@@ -97,6 +107,44 @@ function buildSemanticQuery(options, recorded, sessionId, operationId, ledger) {
|
|
|
97
107
|
return async (prompt) => {
|
|
98
108
|
let callId = null;
|
|
99
109
|
try {
|
|
110
|
+
let ingress = null;
|
|
111
|
+
if (evolutionCompositionFactory !== null) {
|
|
112
|
+
try {
|
|
113
|
+
const runId = `compact-run-${randomUUID()}`;
|
|
114
|
+
const composition = captureAgentEvolutionRuntimeComposition(
|
|
115
|
+
await evolutionCompositionFactory(
|
|
116
|
+
Object.freeze({
|
|
117
|
+
mode: "compact",
|
|
118
|
+
runId,
|
|
119
|
+
sessionId,
|
|
120
|
+
operationId,
|
|
121
|
+
cwd: process.cwd(),
|
|
122
|
+
}),
|
|
123
|
+
),
|
|
124
|
+
);
|
|
125
|
+
ingress = composition.evolutionIngress;
|
|
126
|
+
if (
|
|
127
|
+
composition.runId !== runId ||
|
|
128
|
+
ingress.runId !== runId ||
|
|
129
|
+
composition.tenantId !== ingress.tenantId
|
|
130
|
+
) {
|
|
131
|
+
throw new Error(
|
|
132
|
+
"Compact evolution composition is not bound to the requested Run",
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
await ingress.start();
|
|
136
|
+
await ingress.ingestUserPrompt({
|
|
137
|
+
content: prompt,
|
|
138
|
+
source: "compact",
|
|
139
|
+
});
|
|
140
|
+
} catch (cause) {
|
|
141
|
+
const error = new Error("Compact evolution admission failed", {
|
|
142
|
+
cause,
|
|
143
|
+
});
|
|
144
|
+
error.code = "CC_AGENT_EVOLUTION_INGRESS_FAILED";
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
100
148
|
const response = await runMeteredDirectModelCall({
|
|
101
149
|
sessionId,
|
|
102
150
|
provider,
|
|
@@ -129,8 +177,16 @@ function buildSemanticQuery(options, recorded, sessionId, operationId, ledger) {
|
|
|
129
177
|
hostManagedToolPolicy: null,
|
|
130
178
|
contextEngine: null,
|
|
131
179
|
maxOutputTokens: 2048,
|
|
180
|
+
...(ingress === null ? {} : { evolutionIngress: ingress }),
|
|
132
181
|
}),
|
|
133
182
|
});
|
|
183
|
+
if (ingress !== null) {
|
|
184
|
+
await ingress.ingestAgentEvent({
|
|
185
|
+
type: "response-complete",
|
|
186
|
+
content: response?.message?.content || "",
|
|
187
|
+
});
|
|
188
|
+
await ingress.complete();
|
|
189
|
+
}
|
|
134
190
|
return {
|
|
135
191
|
summary: response?.message?.content || "",
|
|
136
192
|
usage: response?.usage || null,
|
|
@@ -373,7 +429,29 @@ function readCompactSource(sessionId) {
|
|
|
373
429
|
});
|
|
374
430
|
}
|
|
375
431
|
|
|
376
|
-
export function registerCompactCommand(program) {
|
|
432
|
+
export function registerCompactCommand(program, dependencies = {}) {
|
|
433
|
+
if (
|
|
434
|
+
!dependencies ||
|
|
435
|
+
typeof dependencies !== "object" ||
|
|
436
|
+
Array.isArray(dependencies) ||
|
|
437
|
+
utilTypes.isProxy(dependencies)
|
|
438
|
+
) {
|
|
439
|
+
throw new TypeError("Compact command dependencies must be a plain object");
|
|
440
|
+
}
|
|
441
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
442
|
+
dependencies,
|
|
443
|
+
"evolutionCompositionFactory",
|
|
444
|
+
);
|
|
445
|
+
if (
|
|
446
|
+
descriptor &&
|
|
447
|
+
(!Object.hasOwn(descriptor, "value") ||
|
|
448
|
+
typeof descriptor.value !== "function")
|
|
449
|
+
) {
|
|
450
|
+
throw new TypeError(
|
|
451
|
+
"Compact evolution composition factory must be a function data property",
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
const evolutionCompositionFactory = descriptor?.value ?? null;
|
|
377
455
|
program
|
|
378
456
|
.command("compact <session-id>")
|
|
379
457
|
.description(
|
|
@@ -430,6 +508,7 @@ export function registerCompactCommand(program) {
|
|
|
430
508
|
sessionId,
|
|
431
509
|
operationId,
|
|
432
510
|
ledger,
|
|
511
|
+
evolutionCompositionFactory,
|
|
433
512
|
);
|
|
434
513
|
const compressor = buildCompressor(options, source.recorded, llmQuery);
|
|
435
514
|
const memoryRevision =
|
package/src/commands/complete.js
CHANGED
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
* makes it snappier.
|
|
14
14
|
*/
|
|
15
15
|
import { loadConfig } from "../lib/config-manager.js";
|
|
16
|
+
import { randomUUID } from "node:crypto";
|
|
17
|
+
import { types as utilTypes } from "node:util";
|
|
18
|
+
import { captureAgentEvolutionRuntimeComposition } from "../lib/evolution/agent-evolution-runtime-composition-brand.js";
|
|
16
19
|
import { resolveOllamaBaseUrl, queryLLM } from "./ask.js";
|
|
17
20
|
|
|
18
21
|
/** Hard cap so a runaway model can't flood the editor with a whole file. */
|
|
@@ -73,7 +76,29 @@ function readStdin() {
|
|
|
73
76
|
});
|
|
74
77
|
}
|
|
75
78
|
|
|
76
|
-
export function registerCompleteCommand(program) {
|
|
79
|
+
export function registerCompleteCommand(program, dependencies = {}) {
|
|
80
|
+
if (
|
|
81
|
+
!dependencies ||
|
|
82
|
+
typeof dependencies !== "object" ||
|
|
83
|
+
Array.isArray(dependencies) ||
|
|
84
|
+
utilTypes.isProxy(dependencies)
|
|
85
|
+
) {
|
|
86
|
+
throw new TypeError("Complete command dependencies must be a plain object");
|
|
87
|
+
}
|
|
88
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
89
|
+
dependencies,
|
|
90
|
+
"evolutionCompositionFactory",
|
|
91
|
+
);
|
|
92
|
+
if (
|
|
93
|
+
descriptor &&
|
|
94
|
+
(!Object.hasOwn(descriptor, "value") ||
|
|
95
|
+
typeof descriptor.value !== "function")
|
|
96
|
+
) {
|
|
97
|
+
throw new TypeError(
|
|
98
|
+
"Complete evolutionCompositionFactory must be a function data property",
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
const evolutionCompositionFactory = descriptor?.value ?? null;
|
|
77
102
|
program
|
|
78
103
|
.command("complete")
|
|
79
104
|
.description(
|
|
@@ -125,10 +150,44 @@ export function registerCompleteCommand(program) {
|
|
|
125
150
|
: options.baseUrl || config.llm?.baseUrl;
|
|
126
151
|
|
|
127
152
|
try {
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
153
|
+
const prompt = buildFimPrompt(prefix, suffix, language);
|
|
154
|
+
let ingress = null;
|
|
155
|
+
if (evolutionCompositionFactory !== null) {
|
|
156
|
+
const runId = `complete-${randomUUID()}`;
|
|
157
|
+
const composition = captureAgentEvolutionRuntimeComposition(
|
|
158
|
+
await evolutionCompositionFactory(
|
|
159
|
+
Object.freeze({
|
|
160
|
+
mode: "complete",
|
|
161
|
+
runId,
|
|
162
|
+
taskId: runId,
|
|
163
|
+
cwd: process.cwd(),
|
|
164
|
+
}),
|
|
165
|
+
),
|
|
166
|
+
);
|
|
167
|
+
ingress = composition.evolutionIngress;
|
|
168
|
+
if (
|
|
169
|
+
composition.runId !== runId ||
|
|
170
|
+
ingress.runId !== runId ||
|
|
171
|
+
composition.tenantId !== ingress.tenantId
|
|
172
|
+
) {
|
|
173
|
+
throw new Error(
|
|
174
|
+
"Complete evolution composition is not bound to the requested Run",
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
await ingress.start();
|
|
178
|
+
await ingress.ingestUserPrompt({
|
|
179
|
+
content: prompt,
|
|
180
|
+
source: "complete",
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
const reply = await queryLLM(prompt, resolvedOptions, ingress);
|
|
184
|
+
if (ingress !== null) {
|
|
185
|
+
await ingress.ingestAgentEvent({
|
|
186
|
+
type: "response-complete",
|
|
187
|
+
content: reply,
|
|
188
|
+
});
|
|
189
|
+
await ingress.complete();
|
|
190
|
+
}
|
|
132
191
|
emit(cleanCompletion(reply), {
|
|
133
192
|
model: resolvedOptions.model,
|
|
134
193
|
provider,
|
package/src/commands/cowork.js
CHANGED
|
@@ -7,11 +7,85 @@ import chalk from "chalk";
|
|
|
7
7
|
import ora from "ora";
|
|
8
8
|
import fs from "fs";
|
|
9
9
|
import path from "path";
|
|
10
|
+
import { randomUUID } from "node:crypto";
|
|
11
|
+
import { types as utilTypes } from "node:util";
|
|
10
12
|
import { logger } from "../lib/logger.js";
|
|
13
|
+
import { captureAgentEvolutionRuntimeComposition } from "../lib/evolution/agent-evolution-runtime-composition.js";
|
|
11
14
|
|
|
12
15
|
const SESSION_EXECUTION_LOCATION_AUTHORITY_SCHEMA =
|
|
13
16
|
"cc-session-execution-location-authority/v1";
|
|
14
17
|
|
|
18
|
+
function captureCoworkEvolutionCompositionFactory(commandDeps) {
|
|
19
|
+
if (
|
|
20
|
+
commandDeps === null ||
|
|
21
|
+
typeof commandDeps !== "object" ||
|
|
22
|
+
Array.isArray(commandDeps) ||
|
|
23
|
+
utilTypes.isProxy(commandDeps)
|
|
24
|
+
) {
|
|
25
|
+
throw new TypeError("Cowork command dependencies must be a plain object");
|
|
26
|
+
}
|
|
27
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
28
|
+
commandDeps,
|
|
29
|
+
"evolutionCompositionFactory",
|
|
30
|
+
);
|
|
31
|
+
if (!descriptor) return null;
|
|
32
|
+
if (
|
|
33
|
+
!Object.hasOwn(descriptor, "value") ||
|
|
34
|
+
typeof descriptor.value !== "function"
|
|
35
|
+
) {
|
|
36
|
+
throw new TypeError(
|
|
37
|
+
"Cowork evolutionCompositionFactory must be a function data property",
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
return descriptor.value;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function startCoworkCommandEvolution(
|
|
44
|
+
evolutionCompositionFactory,
|
|
45
|
+
{ mode, content, source },
|
|
46
|
+
) {
|
|
47
|
+
if (evolutionCompositionFactory === null) return null;
|
|
48
|
+
try {
|
|
49
|
+
const runId = `cowork-${mode}-${randomUUID()}`;
|
|
50
|
+
const composition = captureAgentEvolutionRuntimeComposition(
|
|
51
|
+
await evolutionCompositionFactory(
|
|
52
|
+
Object.freeze({
|
|
53
|
+
mode: `cowork-${mode}`,
|
|
54
|
+
runId,
|
|
55
|
+
taskId: runId,
|
|
56
|
+
cwd: process.cwd(),
|
|
57
|
+
}),
|
|
58
|
+
),
|
|
59
|
+
);
|
|
60
|
+
const ingress = composition.evolutionIngress;
|
|
61
|
+
if (
|
|
62
|
+
composition.runId !== runId ||
|
|
63
|
+
ingress.runId !== runId ||
|
|
64
|
+
composition.tenantId !== ingress.tenantId
|
|
65
|
+
) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
"Cowork evolution composition is not bound to the requested Run",
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
await ingress.start();
|
|
71
|
+
await ingress.ingestUserPrompt({ content, source });
|
|
72
|
+
return Object.freeze({ composition, ingress });
|
|
73
|
+
} catch (cause) {
|
|
74
|
+
const error = new Error("Cowork evolution admission failed", { cause });
|
|
75
|
+
error.code = "CC_AGENT_EVOLUTION_INGRESS_FAILED";
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function completeCoworkCommandEvolution(evolution, result) {
|
|
81
|
+
if (evolution === null) return;
|
|
82
|
+
await evolution.ingress.ingestAgentEvent({
|
|
83
|
+
type: "response-complete",
|
|
84
|
+
content: result,
|
|
85
|
+
});
|
|
86
|
+
await evolution.ingress.complete();
|
|
87
|
+
}
|
|
88
|
+
|
|
15
89
|
function workflowAuthorityError(code, message) {
|
|
16
90
|
const error = new Error(message);
|
|
17
91
|
error.code = code;
|
|
@@ -114,6 +188,8 @@ function verifyWorkflowRunAuthorities(
|
|
|
114
188
|
}
|
|
115
189
|
|
|
116
190
|
export function registerCoworkCommand(program, commandDeps = {}) {
|
|
191
|
+
const evolutionCompositionFactory =
|
|
192
|
+
captureCoworkEvolutionCompositionFactory(commandDeps);
|
|
117
193
|
const cowork = program
|
|
118
194
|
.command("cowork")
|
|
119
195
|
.description(
|
|
@@ -164,9 +240,20 @@ export function registerCoworkCommand(program, commandDeps = {}) {
|
|
|
164
240
|
).start();
|
|
165
241
|
|
|
166
242
|
try {
|
|
243
|
+
const evolution = await startCoworkCommandEvolution(
|
|
244
|
+
evolutionCompositionFactory,
|
|
245
|
+
{
|
|
246
|
+
mode: "debate",
|
|
247
|
+
content: code,
|
|
248
|
+
source: "cowork:debate",
|
|
249
|
+
},
|
|
250
|
+
);
|
|
167
251
|
const llmOptions = {};
|
|
168
252
|
if (options.provider) llmOptions.provider = options.provider;
|
|
169
253
|
if (options.model) llmOptions.model = options.model;
|
|
254
|
+
if (evolution !== null) {
|
|
255
|
+
llmOptions.evolutionIngress = evolution.ingress;
|
|
256
|
+
}
|
|
170
257
|
|
|
171
258
|
const result = await startDebate({
|
|
172
259
|
target: targetLabel,
|
|
@@ -174,6 +261,7 @@ export function registerCoworkCommand(program, commandDeps = {}) {
|
|
|
174
261
|
perspectives,
|
|
175
262
|
llmOptions,
|
|
176
263
|
});
|
|
264
|
+
await completeCoworkCommandEvolution(evolution, result);
|
|
177
265
|
spinner.stop();
|
|
178
266
|
|
|
179
267
|
if (options.json) {
|
|
@@ -257,9 +345,20 @@ export function registerCoworkCommand(program, commandDeps = {}) {
|
|
|
257
345
|
).start();
|
|
258
346
|
|
|
259
347
|
try {
|
|
348
|
+
const evolution = await startCoworkCommandEvolution(
|
|
349
|
+
evolutionCompositionFactory,
|
|
350
|
+
{
|
|
351
|
+
mode: "compare",
|
|
352
|
+
content: prompt,
|
|
353
|
+
source: "cowork:compare",
|
|
354
|
+
},
|
|
355
|
+
);
|
|
260
356
|
const llmOptions = {};
|
|
261
357
|
if (options.provider) llmOptions.provider = options.provider;
|
|
262
358
|
if (options.model) llmOptions.model = options.model;
|
|
359
|
+
if (evolution !== null) {
|
|
360
|
+
llmOptions.evolutionIngress = evolution.ingress;
|
|
361
|
+
}
|
|
263
362
|
|
|
264
363
|
const result = await compare({
|
|
265
364
|
prompt,
|
|
@@ -267,6 +366,7 @@ export function registerCoworkCommand(program, commandDeps = {}) {
|
|
|
267
366
|
criteria,
|
|
268
367
|
llmOptions,
|
|
269
368
|
});
|
|
369
|
+
await completeCoworkCommandEvolution(evolution, result);
|
|
270
370
|
spinner.stop();
|
|
271
371
|
|
|
272
372
|
if (options.json) {
|
|
@@ -342,6 +442,14 @@ export function registerCoworkCommand(program, commandDeps = {}) {
|
|
|
342
442
|
|
|
343
443
|
try {
|
|
344
444
|
let result;
|
|
445
|
+
const usesModel = ["style", "decisions"].includes(options.type);
|
|
446
|
+
const evolution = usesModel
|
|
447
|
+
? await startCoworkCommandEvolution(evolutionCompositionFactory, {
|
|
448
|
+
mode: `analyze-${options.type}`,
|
|
449
|
+
content: resolved,
|
|
450
|
+
source: `cowork:analyze:${options.type}`,
|
|
451
|
+
})
|
|
452
|
+
: null;
|
|
345
453
|
|
|
346
454
|
if (options.type === "style") {
|
|
347
455
|
const { analyzeProjectStyle } =
|
|
@@ -349,6 +457,9 @@ export function registerCoworkCommand(program, commandDeps = {}) {
|
|
|
349
457
|
const llmOptions = {};
|
|
350
458
|
if (options.provider) llmOptions.provider = options.provider;
|
|
351
459
|
if (options.model) llmOptions.model = options.model;
|
|
460
|
+
if (evolution !== null) {
|
|
461
|
+
llmOptions.evolutionIngress = evolution.ingress;
|
|
462
|
+
}
|
|
352
463
|
result = await analyzeProjectStyle({
|
|
353
464
|
targetPath: resolved,
|
|
354
465
|
llmOptions,
|
|
@@ -363,6 +474,9 @@ export function registerCoworkCommand(program, commandDeps = {}) {
|
|
|
363
474
|
const llmOptions = {};
|
|
364
475
|
if (options.provider) llmOptions.provider = options.provider;
|
|
365
476
|
if (options.model) llmOptions.model = options.model;
|
|
477
|
+
if (evolution !== null) {
|
|
478
|
+
llmOptions.evolutionIngress = evolution.ingress;
|
|
479
|
+
}
|
|
366
480
|
result = await extractDecisions({
|
|
367
481
|
targetPath: resolved,
|
|
368
482
|
llmOptions,
|
|
@@ -372,6 +486,8 @@ export function registerCoworkCommand(program, commandDeps = {}) {
|
|
|
372
486
|
process.exit(1);
|
|
373
487
|
}
|
|
374
488
|
|
|
489
|
+
await completeCoworkCommandEvolution(evolution, result);
|
|
490
|
+
|
|
375
491
|
spinner.stop();
|
|
376
492
|
|
|
377
493
|
if (options.json) {
|
|
@@ -875,10 +991,23 @@ export function registerCoworkCommand(program, commandDeps = {}) {
|
|
|
875
991
|
.option("--model <name>", "LLM model to use")
|
|
876
992
|
.action(async (prompt, options) => {
|
|
877
993
|
try {
|
|
994
|
+
const evolution = await startCoworkCommandEvolution(
|
|
995
|
+
evolutionCompositionFactory,
|
|
996
|
+
{
|
|
997
|
+
mode: "workflow-draft",
|
|
998
|
+
content: prompt,
|
|
999
|
+
source: "cowork:workflow-draft",
|
|
1000
|
+
},
|
|
1001
|
+
);
|
|
878
1002
|
let chat;
|
|
879
1003
|
let provider;
|
|
880
1004
|
let model;
|
|
881
1005
|
if (Object.hasOwn(commandDeps, "workflowDraftChat")) {
|
|
1006
|
+
if (evolution !== null) {
|
|
1007
|
+
throw new Error(
|
|
1008
|
+
"Cowork workflow draft chat seam cannot replace governed model ingress",
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
882
1011
|
const descriptor = Object.getOwnPropertyDescriptor(
|
|
883
1012
|
commandDeps,
|
|
884
1013
|
"workflowDraftChat",
|
|
@@ -920,6 +1049,9 @@ export function registerCoworkCommand(program, commandDeps = {}) {
|
|
|
920
1049
|
chat = createChatFn({
|
|
921
1050
|
provider,
|
|
922
1051
|
model,
|
|
1052
|
+
...(evolution === null
|
|
1053
|
+
? {}
|
|
1054
|
+
: { evolutionIngress: evolution.ingress }),
|
|
923
1055
|
...(config.provider === provider && config.baseUrl
|
|
924
1056
|
? { baseUrl: config.baseUrl }
|
|
925
1057
|
: {}),
|
|
@@ -934,6 +1066,7 @@ export function registerCoworkCommand(program, commandDeps = {}) {
|
|
|
934
1066
|
{ prompt, provider, model },
|
|
935
1067
|
{ chat },
|
|
936
1068
|
);
|
|
1069
|
+
await completeCoworkCommandEvolution(evolution, draft);
|
|
937
1070
|
console.log(JSON.stringify(draft, null, 2));
|
|
938
1071
|
} catch (err) {
|
|
939
1072
|
logger.error(`WORKFLOW_DRAFT_FAILED: ${err.message}`);
|