@linghun/tui 0.1.0 → 0.1.2
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/dist/agent-completion-finalizer.js +3 -3
- package/dist/background-control-runtime.js +56 -55
- package/dist/cache-command-runtime.js +3 -3
- package/dist/capability-runtime.js +35 -34
- package/dist/{chunk-TJLC3QAS.js → chunk-36ZWUJQS.js} +1 -1
- package/dist/{chunk-JDWXC2OQ.js → chunk-3MRYQO7X.js} +4 -4
- package/dist/{chunk-2FVEKTKN.js → chunk-3PG7I3LA.js} +4 -4
- package/dist/{chunk-J7ZE2JKP.js → chunk-42ZZUF7P.js} +3 -3
- package/dist/{chunk-DTK5NBTV.js → chunk-4BFCUJX6.js} +95 -11
- package/dist/{chunk-YH6UIHNF.js → chunk-4QWCNMP6.js} +2 -2
- package/dist/{chunk-WKMBK5UP.js → chunk-4TO2LDMP.js} +1 -1
- package/dist/chunk-4UER2AKI.js +636 -0
- package/dist/{chunk-WHFDDZHY.js → chunk-5IFNLTOF.js} +4 -4
- package/dist/{chunk-W3KHJNSH.js → chunk-6CHUZ2NF.js} +2 -2
- package/dist/{chunk-I3NTAIMF.js → chunk-6DBBXNEG.js} +3 -3
- package/dist/{chunk-GDQQNPBP.js → chunk-6GXIGN5W.js} +1 -1
- package/dist/{chunk-QLRTQHTR.js → chunk-6JGRNES6.js} +2 -2
- package/dist/{chunk-D7TCSOAZ.js → chunk-7BHMBWG2.js} +3 -3
- package/dist/{chunk-KO64OFSG.js → chunk-7C6T7RKJ.js} +1 -1
- package/dist/{chunk-4WHZ6JKD.js → chunk-7R4YXN7Z.js} +335 -63
- package/dist/{chunk-LDABZV5V.js → chunk-7RZE45OT.js} +1 -1
- package/dist/{chunk-MLUIOBKL.js → chunk-7ZMDQZ22.js} +4 -4
- package/dist/{chunk-X7A22JHP.js → chunk-A4H3UTJZ.js} +1 -1
- package/dist/{chunk-LVIM2PA7.js → chunk-AGI6GFFL.js} +3 -3
- package/dist/{chunk-D3UTL2QX.js → chunk-ATY7WBIT.js} +1 -1
- package/dist/{chunk-ZOSK2UEU.js → chunk-BBK5BA5C.js} +99 -117
- package/dist/{chunk-SRZIA6B4.js → chunk-BNC4F63N.js} +1 -1
- package/dist/{chunk-WQMSRO4D.js → chunk-CJRJR7TP.js} +5 -5
- package/dist/{chunk-OEYW3JE3.js → chunk-DIDRFIIW.js} +2 -2
- package/dist/{chunk-AKPXMCVF.js → chunk-EKYXI6C7.js} +11 -7
- package/dist/{chunk-GMUCSNUD.js → chunk-FGGY5KNM.js} +7 -7
- package/dist/{chunk-APJIC2O5.js → chunk-GTIZNO5O.js} +84 -0
- package/dist/{chunk-UOHZQIVL.js → chunk-GXFYUZAM.js} +1 -1
- package/dist/{chunk-DDXS2RDZ.js → chunk-HGCTHBUY.js} +1 -1
- package/dist/{chunk-QTDGRZMZ.js → chunk-HJOC5WUV.js} +1 -1
- package/dist/{chunk-ECFLCY5V.js → chunk-HPIHFENG.js} +2 -2
- package/dist/{chunk-SYBNJZEL.js → chunk-HPMBSOQ4.js} +1 -1
- package/dist/{chunk-QB4VWH7W.js → chunk-HPQ2IHOW.js} +4 -4
- package/dist/{chunk-RVY34HK4.js → chunk-HZ5XNKWS.js} +5 -2
- package/dist/{chunk-4K6UB524.js → chunk-IPZZGDUU.js} +1 -1
- package/dist/{chunk-JHGWGH2C.js → chunk-J6CYFWSW.js} +89 -7
- package/dist/{chunk-6CI6TKLN.js → chunk-JAVRQ3LM.js} +1 -1
- package/dist/{chunk-VCSRBS47.js → chunk-JLAJZPOC.js} +1 -1
- package/dist/{chunk-THZBFYAH.js → chunk-JY3LI63F.js} +2 -2
- package/dist/{chunk-RMLTVKOY.js → chunk-L4YVE3RG.js} +2 -2
- package/dist/{chunk-P277M7Z5.js → chunk-LBC75QAB.js} +1 -1
- package/dist/{chunk-F6TVBCZV.js → chunk-LWW2IAFC.js} +1 -1
- package/dist/{chunk-64MJP6FK.js → chunk-NK4NMYF5.js} +52 -10
- package/dist/{chunk-DNQN74CC.js → chunk-NL4M3V5D.js} +33 -0
- package/dist/{chunk-OF3K3CU5.js → chunk-O2U4XQVM.js} +2 -2
- package/dist/{chunk-LQTVYUT3.js → chunk-OJTMM5CV.js} +2 -2
- package/dist/{chunk-HW2TBXVK.js → chunk-OPVRII63.js} +1 -1
- package/dist/{chunk-ZZ2CNCXJ.js → chunk-OSFBVVEP.js} +4 -4
- package/dist/{chunk-F43AMWLZ.js → chunk-PDTJVJVD.js} +1 -1
- package/dist/{chunk-UDQT5CWK.js → chunk-PI6T2AGS.js} +1 -1
- package/dist/{chunk-JO5ANTMR.js → chunk-PPUOHBAK.js} +84 -37
- package/dist/{chunk-N7G2X2LK.js → chunk-QD4SCW4A.js} +235 -198
- package/dist/{chunk-SOPYWTFV.js → chunk-RRUI3VWQ.js} +1 -1
- package/dist/{chunk-IN42UISW.js → chunk-SRJ4XWOR.js} +10 -5
- package/dist/{chunk-6RJVTUWI.js → chunk-T6UOCF5D.js} +5 -1
- package/dist/{chunk-VTQL23UM.js → chunk-TVNWAEJR.js} +1 -1
- package/dist/chunk-TY4KIVA6.js +50 -0
- package/dist/{chunk-UT2TYK2A.js → chunk-TYTVAFGB.js} +1 -1
- package/dist/{chunk-OMZYPQVA.js → chunk-UGYFQF6M.js} +1 -1
- package/dist/{chunk-TYF4GJR3.js → chunk-UIKN3CDF.js} +4 -4
- package/dist/{chunk-JGDIO2NF.js → chunk-UO3KYTBU.js} +1 -1
- package/dist/{chunk-KI7C6ZOD.js → chunk-VIJ7GDKI.js} +1 -1
- package/dist/{chunk-NKFKOEYX.js → chunk-WCMHJ6SS.js} +1 -1
- package/dist/{chunk-EORRZP3F.js → chunk-WX2OTJXL.js} +1 -1
- package/dist/{chunk-BOV4K7FP.js → chunk-WXTHKLNH.js} +9 -1
- package/dist/{chunk-CRQORMFF.js → chunk-X37FSYAX.js} +1 -1
- package/dist/{chunk-JQCRCDOC.js → chunk-X7E34LKV.js} +15 -15
- package/dist/chunk-X7HMDZZQ.js +85 -0
- package/dist/{chunk-B4GQTZMT.js → chunk-YDTJ7UBG.js} +4 -4
- package/dist/{chunk-K56D3X7S.js → chunk-YKOXJQGX.js} +34 -2
- package/dist/{chunk-3GCIXKCI.js → chunk-YLOJWSHB.js} +9 -5
- package/dist/{chunk-GKZYTPN2.js → chunk-YMEMN5FG.js} +1 -1
- package/dist/chunk-YQNK7HK3.js +87 -0
- package/dist/{chunk-M4AIK2SP.js → chunk-Z265MCGC.js} +15 -11
- package/dist/{chunk-FTAEPAVY.js → chunk-ZF36LULR.js} +4 -4
- package/dist/{chunk-66BNE332.js → chunk-ZJDPYOTK.js} +4 -4
- package/dist/{chunk-RM5QMOFY.js → chunk-ZKPQ4KLK.js} +1 -1
- package/dist/command-panel-runtime.js +34 -33
- package/dist/compact-cache-command-runtime.js +56 -55
- package/dist/compact-preflight-runtime.js +21 -21
- package/dist/connector-runtime.js +36 -35
- package/dist/deep-compact-runtime.js +6 -6
- package/dist/deferred-tools-catalog.js +5 -5
- package/dist/details-status-runtime.js +34 -33
- package/dist/evidence-runtime.d.ts.map +1 -1
- package/dist/evidence-runtime.js +12 -12
- package/dist/extension-command-runtime.js +7 -7
- package/dist/extension-slash-runtime.js +35 -34
- package/dist/failure-learning-command-runtime.js +36 -35
- package/dist/failure-learning-presenter.js +4 -4
- package/dist/failure-learning-runtime.js +3 -3
- package/dist/final-answer-gate.js +2 -2
- package/dist/git-command-runtime.js +35 -34
- package/dist/handoff-session-runtime.js +8 -8
- package/dist/headless-bench-runtime.d.ts +108 -0
- package/dist/headless-bench-runtime.d.ts.map +1 -0
- package/dist/headless-bench-runtime.js +30 -0
- package/dist/index-result-presenter.js +5 -5
- package/dist/index-runtime.js +5 -5
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +531 -78
- package/dist/job-agent-command-runtime.d.ts +2 -1
- package/dist/job-agent-command-runtime.d.ts.map +1 -1
- package/dist/job-agent-command-runtime.js +34 -33
- package/dist/job-runner-presenter.js +3 -3
- package/dist/job-runtime.js +9 -9
- package/dist/mcp-index-command-runtime.js +5 -5
- package/dist/mcp-index-runtime.js +39 -38
- package/dist/mcp-sse-runtime.js +3 -3
- package/dist/mcp-stdio-runtime.js +4 -4
- package/dist/memory-command-runtime.js +36 -35
- package/dist/memory-extraction-runtime.js +3 -3
- package/dist/memory-rules-runtime.js +3 -3
- package/dist/meta-scheduler-runtime.d.ts +10 -0
- package/dist/meta-scheduler-runtime.d.ts.map +1 -1
- package/dist/meta-scheduler-runtime.js +2 -1
- package/dist/model-command-runtime.js +35 -34
- package/dist/model-loop-runtime.d.ts +1 -1
- package/dist/model-loop-runtime.d.ts.map +1 -1
- package/dist/model-loop-runtime.js +1 -1
- package/dist/model-prompt-runtime.d.ts.map +1 -1
- package/dist/model-prompt-runtime.js +10 -10
- package/dist/model-stream-runtime.d.ts +4 -0
- package/dist/model-stream-runtime.d.ts.map +1 -1
- package/dist/model-stream-runtime.js +56 -55
- package/dist/model-tool-runtime.d.ts +3 -2
- package/dist/model-tool-runtime.d.ts.map +1 -1
- package/dist/model-tool-runtime.js +58 -55
- package/dist/pending-details-presenter.js +3 -3
- package/dist/permission-approval-runtime.js +56 -55
- package/dist/permission-continuation-runtime.d.ts.map +1 -1
- package/dist/permission-continuation-runtime.js +4 -4
- package/dist/process-command-runtime.d.ts.map +1 -1
- package/dist/process-command-runtime.js +4 -4
- package/dist/process-guard.d.ts +3 -0
- package/dist/process-guard.d.ts.map +1 -1
- package/dist/process-guard.js +1 -1
- package/dist/provider-loop-runtime.js +3 -3
- package/dist/remote-command-runtime.js +35 -34
- package/dist/runner-runtime.js +8 -8
- package/dist/runtime-status-presenter.js +3 -3
- package/dist/runtime-status-snapshot.js +4 -4
- package/dist/shell/components/AgentProgressTree.js +2 -2
- package/dist/shell/components/BackgroundTaskOverlay.js +2 -2
- package/dist/shell/components/BtwPanel.js +2 -2
- package/dist/shell/components/CommandPanel.js +2 -2
- package/dist/shell/components/Composer.d.ts +16 -2
- package/dist/shell/components/Composer.d.ts.map +1 -1
- package/dist/shell/components/Composer.js +9 -7
- package/dist/shell/components/ConfigPanel.js +2 -2
- package/dist/shell/components/HelpPanel.js +2 -2
- package/dist/shell/components/HistorySearchPanel.js +2 -2
- package/dist/shell/components/MessageMarkdown.d.ts +23 -0
- package/dist/shell/components/MessageMarkdown.d.ts.map +1 -1
- package/dist/shell/components/MessageMarkdown.js +5 -3
- package/dist/shell/components/MouseInputRouter.js +5 -80
- package/dist/shell/components/OutputLine.d.ts.map +1 -1
- package/dist/shell/components/OutputLine.js +5 -3
- package/dist/shell/components/ProductBlock.d.ts.map +1 -1
- package/dist/shell/components/ProductBlock.js +5 -5
- package/dist/shell/components/ScrollViewport.js +3 -82
- package/dist/shell/components/SessionsPanel.js +2 -2
- package/dist/shell/components/ShellApp.d.ts.map +1 -1
- package/dist/shell/components/ShellApp.js +29 -24
- package/dist/shell/components/SlashSuggestions.js +2 -2
- package/dist/shell/components/StatusFooter.js +2 -2
- package/dist/shell/components/StatusTray.d.ts.map +1 -1
- package/dist/shell/components/StatusTray.js +2 -1
- package/dist/shell/components/StructuredDiff.js +2 -2
- package/dist/shell/components/TaskListView.js +2 -2
- package/dist/shell/components/TaskSuggestionBar.js +2 -2
- package/dist/shell/components/WorkflowProgressView.js +2 -2
- package/dist/shell/components/useAnchoredCursor.d.ts +6 -9
- package/dist/shell/components/useAnchoredCursor.d.ts.map +1 -1
- package/dist/shell/components/useAnchoredCursor.js +1 -1
- package/dist/shell/ink-renderer.d.ts.map +1 -1
- package/dist/shell/ink-renderer.js +29 -24
- package/dist/shell/models/transcript-selection-state.js +2 -2
- package/dist/shell/plain-renderer.d.ts.map +1 -1
- package/dist/shell/plain-renderer.js +2 -2
- package/dist/shell/text-utils.d.ts +16 -0
- package/dist/shell/text-utils.d.ts.map +1 -1
- package/dist/shell/text-utils.js +3 -1
- package/dist/shell/view-model.js +14 -14
- package/dist/slash-command-runtime.js +56 -55
- package/dist/slash-dispatch.js +4 -4
- package/dist/startup-runtime.js +2 -2
- package/dist/tool-output-presenter.d.ts.map +1 -1
- package/dist/tool-output-presenter.js +1 -1
- package/dist/tui-agent-job-runtime.js +11 -11
- package/dist/tui-data-types.d.ts +10 -0
- package/dist/tui-data-types.d.ts.map +1 -1
- package/dist/tui-details-runtime.js +10 -10
- package/dist/tui-memory-runtime.js +5 -5
- package/dist/tui-output-surface.js +15 -15
- package/dist/tui-permission-runtime.js +5 -5
- package/dist/tui-state-runtime.js +4 -4
- package/dist/verification-command-runtime.js +12 -12
- package/dist/workflow-command-runtime.d.ts.map +1 -1
- package/dist/workflow-command-runtime.js +34 -33
- package/package.json +5 -5
- package/dist/chunk-GW5YDCRZ.js +0 -42
package/dist/index.js
CHANGED
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
} from "./chunk-O7EFPSMC.js";
|
|
14
14
|
import {
|
|
15
15
|
handleAppsCommand
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3MRYQO7X.js";
|
|
17
17
|
import {
|
|
18
18
|
handleCapabilitiesCommand
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-HPQ2IHOW.js";
|
|
20
20
|
import {
|
|
21
21
|
__testFormatStartAgentDidNotStartMessage,
|
|
22
22
|
__testParseRunWorkflowToolInput,
|
|
@@ -28,9 +28,11 @@ import {
|
|
|
28
28
|
__testUpdateCommandPanelSelection,
|
|
29
29
|
addAllowRuleForTest,
|
|
30
30
|
cancelPendingInteraction,
|
|
31
|
+
clearRequestActivity,
|
|
31
32
|
configureSlashCommandRuntime,
|
|
32
33
|
confirmPendingInteraction,
|
|
33
34
|
cycleMode,
|
|
35
|
+
evaluateAggregatedFinalAnswerGate,
|
|
34
36
|
executePermissionApprove,
|
|
35
37
|
executePermissionDeny,
|
|
36
38
|
getWorkspaceTrustCommandGuard,
|
|
@@ -79,7 +81,7 @@ import {
|
|
|
79
81
|
toggleCommandPanelSelection,
|
|
80
82
|
updateCommandPanelSelection,
|
|
81
83
|
writeWorkspaceTrustStartupNotice
|
|
82
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-7R4YXN7Z.js";
|
|
83
85
|
import {
|
|
84
86
|
createCommandBlock,
|
|
85
87
|
createUserTextBlock
|
|
@@ -87,7 +89,7 @@ import {
|
|
|
87
89
|
import {
|
|
88
90
|
computeHomePromptPrefix,
|
|
89
91
|
writePlainShell
|
|
90
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-SRJ4XWOR.js";
|
|
91
93
|
import "./chunk-GC55DMZV.js";
|
|
92
94
|
import "./chunk-DICVLZHH.js";
|
|
93
95
|
import {
|
|
@@ -97,8 +99,8 @@ import {
|
|
|
97
99
|
formatTerminalProblemsPanel,
|
|
98
100
|
formatTerminalReadinessStatus
|
|
99
101
|
} from "./chunk-ZYSN7AWW.js";
|
|
100
|
-
import "./chunk-
|
|
101
|
-
import "./chunk-
|
|
102
|
+
import "./chunk-ZKPQ4KLK.js";
|
|
103
|
+
import "./chunk-4TO2LDMP.js";
|
|
102
104
|
import {
|
|
103
105
|
consumeRemoteInboundMessage,
|
|
104
106
|
createRemoteEvent,
|
|
@@ -108,25 +110,25 @@ import {
|
|
|
108
110
|
sendRemoteEventReal,
|
|
109
111
|
validateRemoteInboundEnvelope,
|
|
110
112
|
validateRemotePairingEnvelope
|
|
111
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-ZJDPYOTK.js";
|
|
112
114
|
import "./chunk-UT5BOJKU.js";
|
|
113
115
|
import "./chunk-RM5JDRCW.js";
|
|
114
116
|
import {
|
|
115
117
|
formatPendingApprovalDetails
|
|
116
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-HJOC5WUV.js";
|
|
117
119
|
import {
|
|
118
120
|
handleMemoryCommand,
|
|
119
121
|
resumeSessionWithHandoff,
|
|
120
122
|
runAutoLearningOnTurnEnd
|
|
121
|
-
} from "./chunk-
|
|
122
|
-
import "./chunk-
|
|
123
|
-
import "./chunk-
|
|
123
|
+
} from "./chunk-FGGY5KNM.js";
|
|
124
|
+
import "./chunk-TVNWAEJR.js";
|
|
125
|
+
import "./chunk-NL4M3V5D.js";
|
|
124
126
|
import "./chunk-KQJHVJZB.js";
|
|
125
127
|
import {
|
|
126
128
|
handleModelCommand,
|
|
127
129
|
handleModelSetupInput,
|
|
128
130
|
startModelSetup
|
|
129
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-7BHMBWG2.js";
|
|
130
132
|
import "./chunk-NMNOAFFT.js";
|
|
131
133
|
import {
|
|
132
134
|
executeExtraTool,
|
|
@@ -137,13 +139,13 @@ import {
|
|
|
137
139
|
handleIndexCommand,
|
|
138
140
|
handleMcpCommand,
|
|
139
141
|
refreshIndexStatus
|
|
140
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-X7E34LKV.js";
|
|
141
143
|
import "./chunk-W6NU7ZAV.js";
|
|
142
|
-
import "./chunk-OF3K3CU5.js";
|
|
143
|
-
import "./chunk-SRZIA6B4.js";
|
|
144
144
|
import {
|
|
145
145
|
isPotentiallyMutatingMcpTool
|
|
146
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-DIDRFIIW.js";
|
|
147
|
+
import "./chunk-O2U4XQVM.js";
|
|
148
|
+
import "./chunk-BNC4F63N.js";
|
|
147
149
|
import {
|
|
148
150
|
formatProviderGuardSummary,
|
|
149
151
|
formatRunnerGuardSummary,
|
|
@@ -153,23 +155,23 @@ import {
|
|
|
153
155
|
validateChangeDeclarationHuman,
|
|
154
156
|
validateCompletionClaim
|
|
155
157
|
} from "./chunk-CRW3636S.js";
|
|
156
|
-
import "./chunk-
|
|
157
|
-
import "./chunk-
|
|
158
|
+
import "./chunk-6CHUZ2NF.js";
|
|
159
|
+
import "./chunk-LBC75QAB.js";
|
|
158
160
|
import {
|
|
159
161
|
handleCheckpointCommand,
|
|
160
162
|
handleGitCommand,
|
|
161
163
|
handleWorktreeCommand
|
|
162
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-YMEMN5FG.js";
|
|
163
165
|
import "./chunk-GTP2KPLY.js";
|
|
164
166
|
import "./chunk-7ZE5JFAZ.js";
|
|
165
167
|
import {
|
|
166
168
|
handlePluginsCommand,
|
|
167
169
|
handleSkillsCommand
|
|
168
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-ZF36LULR.js";
|
|
169
171
|
import {
|
|
170
172
|
handleFailuresCommand
|
|
171
|
-
} from "./chunk-
|
|
172
|
-
import "./chunk-
|
|
173
|
+
} from "./chunk-3PG7I3LA.js";
|
|
174
|
+
import "./chunk-A4H3UTJZ.js";
|
|
173
175
|
import {
|
|
174
176
|
startFeishuLongConnection
|
|
175
177
|
} from "./chunk-WJWYRBWH.js";
|
|
@@ -186,14 +188,14 @@ import {
|
|
|
186
188
|
processRemoteBindCommand,
|
|
187
189
|
wecomBridgeAdapter
|
|
188
190
|
} from "./chunk-CFXB5SE5.js";
|
|
189
|
-
import "./chunk-
|
|
191
|
+
import "./chunk-5IFNLTOF.js";
|
|
190
192
|
import {
|
|
191
193
|
breakCacheTestHooks
|
|
192
194
|
} from "./chunk-WVAQYKGL.js";
|
|
193
195
|
import "./chunk-QIU3FJPC.js";
|
|
194
196
|
import {
|
|
195
197
|
writeLightHintsForTest
|
|
196
|
-
} from "./chunk-
|
|
198
|
+
} from "./chunk-7RZE45OT.js";
|
|
197
199
|
import {
|
|
198
200
|
__testBuildExplicitDetailsCommandPanel,
|
|
199
201
|
__testCreateShellBlockOutput,
|
|
@@ -219,37 +221,37 @@ import {
|
|
|
219
221
|
showCommandPanel,
|
|
220
222
|
t,
|
|
221
223
|
writeStatus
|
|
222
|
-
} from "./chunk-
|
|
223
|
-
import "./chunk-WQMSRO4D.js";
|
|
224
|
+
} from "./chunk-PPUOHBAK.js";
|
|
224
225
|
import "./chunk-V7GDHHBL.js";
|
|
225
226
|
import "./chunk-GCMH5P4W.js";
|
|
226
|
-
import "./chunk-THZBFYAH.js";
|
|
227
|
-
import {
|
|
228
|
-
ShellBlockOutput
|
|
229
|
-
} from "./chunk-ECFLCY5V.js";
|
|
230
227
|
import {
|
|
231
228
|
addAllowRule,
|
|
232
229
|
decidePermission,
|
|
233
230
|
loadPermissionState
|
|
234
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-HGCTHBUY.js";
|
|
232
|
+
import "./chunk-CJRJR7TP.js";
|
|
233
|
+
import {
|
|
234
|
+
cleanupCompletedBackgroundTasks,
|
|
235
|
+
getDurableJobPaths
|
|
236
|
+
} from "./chunk-OSFBVVEP.js";
|
|
237
|
+
import "./chunk-JY3LI63F.js";
|
|
238
|
+
import {
|
|
239
|
+
ShellBlockOutput
|
|
240
|
+
} from "./chunk-HPIHFENG.js";
|
|
235
241
|
import {
|
|
236
242
|
formatCatalogHelp,
|
|
237
243
|
formatSlashDiscovery,
|
|
238
244
|
formatUnknownSlashCommand,
|
|
239
245
|
getSlashPrefixCandidates,
|
|
240
246
|
slashCommandToTool
|
|
241
|
-
} from "./chunk-
|
|
247
|
+
} from "./chunk-IPZZGDUU.js";
|
|
242
248
|
import {
|
|
243
249
|
createTerminalReadinessView
|
|
244
250
|
} from "./chunk-PBIPV4LD.js";
|
|
245
|
-
import {
|
|
246
|
-
cleanupCompletedBackgroundTasks,
|
|
247
|
-
getDurableJobPaths
|
|
248
|
-
} from "./chunk-ZZ2CNCXJ.js";
|
|
249
251
|
import {
|
|
250
252
|
getDurableJobsRoot
|
|
251
|
-
} from "./chunk-
|
|
252
|
-
import "./chunk-
|
|
253
|
+
} from "./chunk-UIKN3CDF.js";
|
|
254
|
+
import "./chunk-YDTJ7UBG.js";
|
|
253
255
|
import "./chunk-L4XXW6Y5.js";
|
|
254
256
|
import {
|
|
255
257
|
classifyProviderVerificationLevel,
|
|
@@ -269,16 +271,26 @@ import {
|
|
|
269
271
|
formatRuntimePathMarker,
|
|
270
272
|
formatStartupPathMarker
|
|
271
273
|
} from "./chunk-VIBENDE3.js";
|
|
274
|
+
import {
|
|
275
|
+
collectHeadlessArtifactChecklist,
|
|
276
|
+
createHeadlessBenchInitialPrompt,
|
|
277
|
+
createHeadlessBenchRepairPrompt,
|
|
278
|
+
resolveHeadlessBenchConfig,
|
|
279
|
+
runHeadlessEnvironmentPreflight,
|
|
280
|
+
validateHeadlessBenchCompletion
|
|
281
|
+
} from "./chunk-4UER2AKI.js";
|
|
272
282
|
import {
|
|
273
283
|
formatConfigOverview,
|
|
274
284
|
formatFeaturePolicy,
|
|
275
285
|
validateExtensionContributionExecution
|
|
276
|
-
} from "./chunk-
|
|
277
|
-
import "./chunk-
|
|
286
|
+
} from "./chunk-AGI6GFFL.js";
|
|
287
|
+
import "./chunk-HZ5XNKWS.js";
|
|
278
288
|
import {
|
|
289
|
+
getTrackedProcessSnapshot,
|
|
279
290
|
installProcessGuardExitHandlers,
|
|
280
|
-
requestTrackedProcessStop
|
|
281
|
-
|
|
291
|
+
requestTrackedProcessStop,
|
|
292
|
+
trackChildProcess
|
|
293
|
+
} from "./chunk-J6CYFWSW.js";
|
|
282
294
|
import "./chunk-E72U7WW7.js";
|
|
283
295
|
import {
|
|
284
296
|
buildConfigPanelActions,
|
|
@@ -286,12 +298,12 @@ import {
|
|
|
286
298
|
createShellViewModel,
|
|
287
299
|
mapPendingApprovalToPermission,
|
|
288
300
|
mapRequestActivityToView
|
|
289
|
-
} from "./chunk-
|
|
301
|
+
} from "./chunk-EKYXI6C7.js";
|
|
290
302
|
import {
|
|
291
303
|
buildTranscriptScreenBuffer,
|
|
292
304
|
isSelectionStale,
|
|
293
305
|
reduceTranscriptSelection
|
|
294
|
-
} from "./chunk-
|
|
306
|
+
} from "./chunk-WCMHJ6SS.js";
|
|
295
307
|
import "./chunk-3AKXDMVS.js";
|
|
296
308
|
import "./chunk-H3T4EF5F.js";
|
|
297
309
|
import "./chunk-NSIKYD3X.js";
|
|
@@ -302,16 +314,16 @@ import {
|
|
|
302
314
|
import {
|
|
303
315
|
messages
|
|
304
316
|
} from "./chunk-RBOQJFIZ.js";
|
|
305
|
-
import "./chunk-
|
|
317
|
+
import "./chunk-VIJ7GDKI.js";
|
|
306
318
|
import {
|
|
307
319
|
createModelSystemPrompt,
|
|
308
320
|
sanitizeMainScreenLeakage
|
|
309
|
-
} from "./chunk-
|
|
310
|
-
import "./chunk-
|
|
311
|
-
import "./chunk-
|
|
321
|
+
} from "./chunk-YLOJWSHB.js";
|
|
322
|
+
import "./chunk-42ZZUF7P.js";
|
|
323
|
+
import "./chunk-WXTHKLNH.js";
|
|
312
324
|
import "./chunk-KTWV5JC5.js";
|
|
313
325
|
import "./chunk-PGNALDEH.js";
|
|
314
|
-
import "./chunk-
|
|
326
|
+
import "./chunk-PI6T2AGS.js";
|
|
315
327
|
import {
|
|
316
328
|
loadProjectKeybindings
|
|
317
329
|
} from "./chunk-6SMM5CMP.js";
|
|
@@ -329,11 +341,12 @@ import {
|
|
|
329
341
|
snapshotDeferredToolsSummary,
|
|
330
342
|
snapshotDiscoveredDeferredToolsSummary,
|
|
331
343
|
validateCodebaseMemoryToolExecution
|
|
332
|
-
} from "./chunk-
|
|
344
|
+
} from "./chunk-6DBBXNEG.js";
|
|
333
345
|
import {
|
|
334
|
-
appendSystemEvent
|
|
335
|
-
|
|
336
|
-
|
|
346
|
+
appendSystemEvent,
|
|
347
|
+
createEvidenceRecord,
|
|
348
|
+
rememberEvidence
|
|
349
|
+
} from "./chunk-NK4NMYF5.js";
|
|
337
350
|
import {
|
|
338
351
|
BACKGROUND_KIND_CAPS,
|
|
339
352
|
BACKGROUND_RUNNING_GLOBAL_CAP,
|
|
@@ -361,6 +374,7 @@ import {
|
|
|
361
374
|
createSingleToolCallContinuation,
|
|
362
375
|
runtimeFromContinuation
|
|
363
376
|
} from "./chunk-RDGM4RUE.js";
|
|
377
|
+
import "./chunk-O7S3HYE6.js";
|
|
364
378
|
import {
|
|
365
379
|
LINGHUN_BASH_MAX_OUTPUT_DEFAULT,
|
|
366
380
|
LINGHUN_BASH_MAX_OUTPUT_UPPER_LIMIT,
|
|
@@ -378,13 +392,13 @@ import {
|
|
|
378
392
|
LINGHUN_TASK_MAX_OUTPUT_DEFAULT,
|
|
379
393
|
LINGHUN_TASK_MAX_OUTPUT_UPPER_LIMIT
|
|
380
394
|
} from "./chunk-IWUIOLMF.js";
|
|
381
|
-
import "./chunk-
|
|
395
|
+
import "./chunk-7ZMDQZ22.js";
|
|
382
396
|
import {
|
|
383
397
|
containsSecret
|
|
384
|
-
} from "./chunk-
|
|
398
|
+
} from "./chunk-OJTMM5CV.js";
|
|
385
399
|
import {
|
|
386
400
|
createSolutionCompletenessStatus
|
|
387
|
-
} from "./chunk-
|
|
401
|
+
} from "./chunk-YKOXJQGX.js";
|
|
388
402
|
import "./chunk-BFVPLGAC.js";
|
|
389
403
|
import "./chunk-6USL33ZO.js";
|
|
390
404
|
import "./chunk-4EIC5BCT.js";
|
|
@@ -392,11 +406,11 @@ import "./chunk-AO4CXI37.js";
|
|
|
392
406
|
import {
|
|
393
407
|
createFailureLearningState,
|
|
394
408
|
loadFailureRecords
|
|
395
|
-
} from "./chunk-
|
|
396
|
-
import "./chunk-
|
|
409
|
+
} from "./chunk-6GXIGN5W.js";
|
|
410
|
+
import "./chunk-L4YVE3RG.js";
|
|
397
411
|
import {
|
|
398
412
|
createIndexState
|
|
399
|
-
} from "./chunk-
|
|
413
|
+
} from "./chunk-TYTVAFGB.js";
|
|
400
414
|
import {
|
|
401
415
|
applyRemoteSessionDisables,
|
|
402
416
|
codebaseMemoryRequiredArgs,
|
|
@@ -415,11 +429,11 @@ import {
|
|
|
415
429
|
pathExists,
|
|
416
430
|
stableId,
|
|
417
431
|
summarizeProjectRules
|
|
418
|
-
} from "./chunk-
|
|
432
|
+
} from "./chunk-6JGRNES6.js";
|
|
419
433
|
import "./chunk-ZJK25VFP.js";
|
|
420
434
|
import "./chunk-5H7RRF7C.js";
|
|
421
435
|
import "./chunk-4EP3TUFF.js";
|
|
422
|
-
import "./chunk-
|
|
436
|
+
import "./chunk-WX2OTJXL.js";
|
|
423
437
|
import {
|
|
424
438
|
formatStats,
|
|
425
439
|
formatUsage
|
|
@@ -443,7 +457,7 @@ import "./chunk-WV6YJGZR.js";
|
|
|
443
457
|
import "./chunk-4T5DJW54.js";
|
|
444
458
|
import {
|
|
445
459
|
createAgentCompletionState
|
|
446
|
-
} from "./chunk-
|
|
460
|
+
} from "./chunk-HPMBSOQ4.js";
|
|
447
461
|
import {
|
|
448
462
|
createShellLimitations,
|
|
449
463
|
formatError,
|
|
@@ -456,8 +470,8 @@ import {
|
|
|
456
470
|
shouldEnterProductShellCandidate,
|
|
457
471
|
truncateDisplay,
|
|
458
472
|
writeLine
|
|
459
|
-
} from "./chunk-
|
|
460
|
-
import "./chunk-
|
|
473
|
+
} from "./chunk-UGYFQF6M.js";
|
|
474
|
+
import "./chunk-GTIZNO5O.js";
|
|
461
475
|
import {
|
|
462
476
|
loadAgentRegistry,
|
|
463
477
|
loadWorkflowRegistry,
|
|
@@ -510,6 +524,11 @@ import {
|
|
|
510
524
|
createToolContext
|
|
511
525
|
} from "@linghun/tools";
|
|
512
526
|
var tuiStatus = "ready";
|
|
527
|
+
var DEFAULT_HEADLESS_MAX_CONTINUATIONS = 3;
|
|
528
|
+
var MAX_HEADLESS_CONTINUATIONS = 3;
|
|
529
|
+
var HEADLESS_CONTINUATION_BACKOFF_BASE_MS = 250;
|
|
530
|
+
var HEADLESS_CLEANUP_SETTLE_MS = 500;
|
|
531
|
+
var HEADLESS_DEADLINE_CLOSURE_WINDOW_MS = 6e4;
|
|
513
532
|
async function createAgentRegistryState(projectPath) {
|
|
514
533
|
const result = await loadAgentRegistry(projectPath);
|
|
515
534
|
return { agents: result.items, errors: result.errors };
|
|
@@ -550,11 +569,7 @@ function toggleCurrentCommandPanelDetails(context) {
|
|
|
550
569
|
context.ctrlOExpandState = { active: false };
|
|
551
570
|
return true;
|
|
552
571
|
}
|
|
553
|
-
async function
|
|
554
|
-
const input = options.stdin ?? defaultStdin;
|
|
555
|
-
const output = options.stdout ?? defaultStdout;
|
|
556
|
-
const errorOutput = options.stderr ?? defaultStderr;
|
|
557
|
-
const projectPath = options.projectPath ?? process.cwd();
|
|
572
|
+
async function createTuiRuntimeContext(projectPath) {
|
|
558
573
|
const config = await loadConfig(projectPath);
|
|
559
574
|
const storagePaths = resolveStoragePaths(config, projectPath);
|
|
560
575
|
const store = new SessionStore({ sessionRootDir: storagePaths.sessions, projectPath });
|
|
@@ -600,6 +615,7 @@ async function runTui(options = {}) {
|
|
|
600
615
|
backgroundAbortControllers: /* @__PURE__ */ new Map(),
|
|
601
616
|
discoveredDeferredToolNames: /* @__PURE__ */ new Set()
|
|
602
617
|
};
|
|
618
|
+
context.tools.trackChildProcess = (child, options) => trackChildProcess(child, options);
|
|
603
619
|
context.turnContinuity = createInitialContinuityState();
|
|
604
620
|
context.recentTaskKinds = [];
|
|
605
621
|
context.workflows.templates = mergeWorkflowTemplates(
|
|
@@ -607,8 +623,9 @@ async function runTui(options = {}) {
|
|
|
607
623
|
context.agentRegistry.agents.map(registryAgentToWorkflowTemplate),
|
|
608
624
|
context.workflowRegistry.workflows.map(registryWorkflowToTemplate)
|
|
609
625
|
);
|
|
610
|
-
|
|
611
|
-
|
|
626
|
+
return { context, store };
|
|
627
|
+
}
|
|
628
|
+
async function hydrateRuntimeContext(context) {
|
|
612
629
|
await refreshIndexStatus(context);
|
|
613
630
|
await hydrateDurableJobBackgroundTasks(context);
|
|
614
631
|
await hydratePersistentAgents(context);
|
|
@@ -617,8 +634,8 @@ async function runTui(options = {}) {
|
|
|
617
634
|
context.store.prune(50).catch(() => {
|
|
618
635
|
});
|
|
619
636
|
context.failureLearning.records = await loadFailureRecords(context.failureLearning);
|
|
620
|
-
|
|
621
|
-
|
|
637
|
+
}
|
|
638
|
+
function attachProviderRuntimeHooks(context) {
|
|
622
639
|
registerProviderHooks({
|
|
623
640
|
onRetry: (info) => {
|
|
624
641
|
if (info.requestContext === "agent") return;
|
|
@@ -632,6 +649,19 @@ async function runTui(options = {}) {
|
|
|
632
649
|
}
|
|
633
650
|
});
|
|
634
651
|
context.pushNotification = (text, tone) => pushTransientNotification(context, text, tone);
|
|
652
|
+
}
|
|
653
|
+
async function runTui(options = {}) {
|
|
654
|
+
const input = options.stdin ?? defaultStdin;
|
|
655
|
+
const output = options.stdout ?? defaultStdout;
|
|
656
|
+
const errorOutput = options.stderr ?? defaultStderr;
|
|
657
|
+
const projectPath = options.projectPath ?? process.cwd();
|
|
658
|
+
const { context, store } = await createTuiRuntimeContext(projectPath);
|
|
659
|
+
installProcessGuardExitHandlers();
|
|
660
|
+
const startup = await prepareTuiStartup(input, output, context);
|
|
661
|
+
await hydrateRuntimeContext(context);
|
|
662
|
+
const gateway = createModelGateway(context.config);
|
|
663
|
+
context.modelGateway = gateway;
|
|
664
|
+
attachProviderRuntimeHooks(context);
|
|
635
665
|
const sigintHandler = () => {
|
|
636
666
|
requestTrackedProcessStop(false);
|
|
637
667
|
void handleInterruptCommand([], context, output).catch((error) => {
|
|
@@ -663,6 +693,420 @@ async function runTui(options = {}) {
|
|
|
663
693
|
process.removeListener("SIGINT", sigintHandler);
|
|
664
694
|
}
|
|
665
695
|
}
|
|
696
|
+
async function runHeadlessTask(options) {
|
|
697
|
+
const output = options.stdout ?? defaultStdout;
|
|
698
|
+
const errorOutput = options.stderr ?? defaultStderr;
|
|
699
|
+
const projectPath = options.projectPath ?? process.cwd();
|
|
700
|
+
const prompt = options.prompt.trim();
|
|
701
|
+
if (!prompt) {
|
|
702
|
+
writeLine(errorOutput, "\u9519\u8BEF\uFF1Aheadless run prompt \u4E0D\u80FD\u4E3A\u7A7A\u3002");
|
|
703
|
+
return 2;
|
|
704
|
+
}
|
|
705
|
+
const runtime = options.__testContext && options.__testStore ? { context: options.__testContext, store: options.__testStore } : await createTuiRuntimeContext(projectPath);
|
|
706
|
+
const { context, store } = runtime;
|
|
707
|
+
context.permissionMode = options.mode ?? "full-access";
|
|
708
|
+
context.planAccepted = false;
|
|
709
|
+
installProcessGuardExitHandlers();
|
|
710
|
+
if (!options.__testSkipHydration) {
|
|
711
|
+
await hydrateRuntimeContext(context);
|
|
712
|
+
}
|
|
713
|
+
const gateway = options.__testGateway ?? createModelGateway(context.config);
|
|
714
|
+
const sendHeadlessMessage = options.__testSendMessage ?? sendMessage;
|
|
715
|
+
context.modelGateway = gateway;
|
|
716
|
+
attachProviderRuntimeHooks(context);
|
|
717
|
+
const maxApprovals = Math.max(0, Math.min(options.maxApprovals ?? 32, 200));
|
|
718
|
+
const autoApprove = options.autoApprove ?? true;
|
|
719
|
+
const maxContinuations = Math.max(
|
|
720
|
+
0,
|
|
721
|
+
Math.min(options.maxContinuations ?? DEFAULT_HEADLESS_MAX_CONTINUATIONS, MAX_HEADLESS_CONTINUATIONS)
|
|
722
|
+
);
|
|
723
|
+
const deadlineAtMs = resolveHeadlessDeadlineAtMs(options);
|
|
724
|
+
const benchConfig = await resolveHeadlessBenchConfig({
|
|
725
|
+
prompt,
|
|
726
|
+
projectPath,
|
|
727
|
+
...options.bench ? { options: options.bench } : {}
|
|
728
|
+
});
|
|
729
|
+
const benchPreflight = benchConfig.enabled && benchConfig.preflight ? await runHeadlessEnvironmentPreflight(projectPath) : void 0;
|
|
730
|
+
if (benchConfig.enabled && benchPreflight) {
|
|
731
|
+
writeLine(output, `[headless] bench preflight: ${benchPreflight.summary}`);
|
|
732
|
+
}
|
|
733
|
+
try {
|
|
734
|
+
let approvals = 0;
|
|
735
|
+
let continuations = 0;
|
|
736
|
+
let requestAttempts = 0;
|
|
737
|
+
let benchValidationPassed = !benchConfig.enabled;
|
|
738
|
+
let lastValidation;
|
|
739
|
+
const runOneRequest = async (text) => {
|
|
740
|
+
requestAttempts += 1;
|
|
741
|
+
const previousProviderFailureId = context.lastProviderFailure?.evidenceId;
|
|
742
|
+
const deferredApprovals = [];
|
|
743
|
+
const messagePromise = sendHeadlessMessage(text, context, gateway, output);
|
|
744
|
+
const pump = createHeadlessApprovalPump({
|
|
745
|
+
context,
|
|
746
|
+
gateway,
|
|
747
|
+
output,
|
|
748
|
+
errorOutput,
|
|
749
|
+
autoApprove,
|
|
750
|
+
maxApprovals,
|
|
751
|
+
getApprovals: () => approvals,
|
|
752
|
+
setApprovals: (value) => {
|
|
753
|
+
approvals = value;
|
|
754
|
+
},
|
|
755
|
+
deferredApprovals
|
|
756
|
+
});
|
|
757
|
+
const messageResult = await runWithHeadlessApprovalPump(messagePromise, pump);
|
|
758
|
+
if (messageResult.exitCode !== void 0) {
|
|
759
|
+
return { exitCode: messageResult.exitCode };
|
|
760
|
+
}
|
|
761
|
+
const approvalStatus = await pumpHeadlessApprovals({
|
|
762
|
+
context,
|
|
763
|
+
gateway,
|
|
764
|
+
output,
|
|
765
|
+
errorOutput,
|
|
766
|
+
autoApprove,
|
|
767
|
+
maxApprovals,
|
|
768
|
+
approvals,
|
|
769
|
+
deferredApprovals
|
|
770
|
+
});
|
|
771
|
+
approvals = approvalStatus.approvals;
|
|
772
|
+
if (approvalStatus.exitCode !== void 0) {
|
|
773
|
+
return { exitCode: approvalStatus.exitCode };
|
|
774
|
+
}
|
|
775
|
+
const deferredStatus = await runDeferredHeadlessApprovals({
|
|
776
|
+
context,
|
|
777
|
+
gateway,
|
|
778
|
+
output,
|
|
779
|
+
errorOutput,
|
|
780
|
+
autoApprove,
|
|
781
|
+
maxApprovals,
|
|
782
|
+
approvals,
|
|
783
|
+
deferredApprovals
|
|
784
|
+
});
|
|
785
|
+
approvals = deferredStatus.approvals;
|
|
786
|
+
if (deferredStatus.exitCode !== void 0) {
|
|
787
|
+
return { exitCode: deferredStatus.exitCode };
|
|
788
|
+
}
|
|
789
|
+
const providerFailure = context.lastProviderFailure;
|
|
790
|
+
const hasNewProviderFailure = Boolean(providerFailure) && providerFailure?.evidenceId !== previousProviderFailureId;
|
|
791
|
+
return { providerFailure: hasNewProviderFailure };
|
|
792
|
+
};
|
|
793
|
+
const initialPrompt = createHeadlessBenchInitialPrompt({
|
|
794
|
+
originalPrompt: prompt,
|
|
795
|
+
config: benchConfig,
|
|
796
|
+
...benchPreflight ? { preflight: benchPreflight } : {}
|
|
797
|
+
});
|
|
798
|
+
let status = await runOneRequest(initialPrompt);
|
|
799
|
+
while (status.exitCode === void 0 && status.providerFailure && continuations < maxContinuations && shouldRunHeadlessProviderContinuation(context)) {
|
|
800
|
+
continuations += 1;
|
|
801
|
+
const sessionId = await ensureSession(context);
|
|
802
|
+
const continuationPrompt = createHeadlessProviderContinuationPrompt(context);
|
|
803
|
+
await appendSystemEvent(
|
|
804
|
+
context,
|
|
805
|
+
sessionId,
|
|
806
|
+
`headless_provider_stream_continuation: attempt=${continuations}; reason=${context.lastProviderFailure?.summary ?? "provider_failure"}`,
|
|
807
|
+
"warning"
|
|
808
|
+
);
|
|
809
|
+
writeLine(output, `[headless] provider stream failed; continuing attempt ${continuations}/${maxContinuations}`);
|
|
810
|
+
context.lastProviderFailure = void 0;
|
|
811
|
+
await sleep(createHeadlessContinuationBackoffMs(continuations));
|
|
812
|
+
status = await runOneRequest(continuationPrompt);
|
|
813
|
+
}
|
|
814
|
+
if (continuations > 0 && !status.providerFailure) {
|
|
815
|
+
context.lastProviderFailure = void 0;
|
|
816
|
+
}
|
|
817
|
+
if (status.exitCode !== void 0) {
|
|
818
|
+
return status.exitCode;
|
|
819
|
+
}
|
|
820
|
+
if (status.providerFailure) {
|
|
821
|
+
writeLine(
|
|
822
|
+
errorOutput,
|
|
823
|
+
createHeadlessProviderFailureDiagnostic(context, {
|
|
824
|
+
requestAttempts,
|
|
825
|
+
continuations,
|
|
826
|
+
maxContinuations
|
|
827
|
+
})
|
|
828
|
+
);
|
|
829
|
+
return 1;
|
|
830
|
+
}
|
|
831
|
+
if (benchConfig.enabled) {
|
|
832
|
+
for (let repairAttempt = 0; repairAttempt <= benchConfig.maxRepairAttempts; repairAttempt += 1) {
|
|
833
|
+
const validation = await validateHeadlessBenchCompletion({ projectPath, config: benchConfig });
|
|
834
|
+
lastValidation = validation;
|
|
835
|
+
if (validation.ok) {
|
|
836
|
+
benchValidationPassed = true;
|
|
837
|
+
writeLine(output, `[headless] bench validation passed: ${validation.summary}`);
|
|
838
|
+
break;
|
|
839
|
+
}
|
|
840
|
+
const failure = validation.failure;
|
|
841
|
+
writeLine(
|
|
842
|
+
errorOutput,
|
|
843
|
+
`[headless] bench validation failed: ${failure.category}; ${failure.summary.split(/\r?\n/u)[0]}`
|
|
844
|
+
);
|
|
845
|
+
if (repairAttempt >= benchConfig.maxRepairAttempts) {
|
|
846
|
+
writeLine(
|
|
847
|
+
errorOutput,
|
|
848
|
+
`\u9519\u8BEF\uFF1Aheadless bench \u4FEE\u8865\u5DF2\u8FBE\u4E0A\u9650 ${benchConfig.maxRepairAttempts}\uFF0C\u6700\u540E\u5931\u8D25\u7C7B\u522B\uFF1A${failure.category}`
|
|
849
|
+
);
|
|
850
|
+
return 5;
|
|
851
|
+
}
|
|
852
|
+
if (isHeadlessDeadlineApproaching(deadlineAtMs)) {
|
|
853
|
+
const remaining = formatHeadlessRemainingTime(deadlineAtMs);
|
|
854
|
+
writeLine(
|
|
855
|
+
errorOutput,
|
|
856
|
+
`[headless] deadline approaching (${remaining}); closure validation ran, skipping repair loop.`
|
|
857
|
+
);
|
|
858
|
+
return 6;
|
|
859
|
+
}
|
|
860
|
+
const repairPrompt = createHeadlessBenchRepairPrompt({
|
|
861
|
+
originalPrompt: prompt,
|
|
862
|
+
failure,
|
|
863
|
+
attempt: repairAttempt + 1,
|
|
864
|
+
maxAttempts: benchConfig.maxRepairAttempts,
|
|
865
|
+
profile: benchConfig.profile,
|
|
866
|
+
...benchPreflight ? { preflight: benchPreflight } : {}
|
|
867
|
+
});
|
|
868
|
+
const repairStatus = await runOneRequest(repairPrompt);
|
|
869
|
+
if (repairStatus.exitCode !== void 0) {
|
|
870
|
+
return repairStatus.exitCode;
|
|
871
|
+
}
|
|
872
|
+
if (repairStatus.providerFailure) {
|
|
873
|
+
writeLine(errorOutput, "\u9519\u8BEF\uFF1Aheadless bench \u4FEE\u8865\u671F\u95F4 provider stream \u5931\u8D25\u3002");
|
|
874
|
+
return 1;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
if (context.sessionId) {
|
|
879
|
+
await recordHeadlessArtifactChecklist(context, context.sessionId, benchConfig, lastValidation);
|
|
880
|
+
}
|
|
881
|
+
const cleanup = await finishHeadlessRuntime(context);
|
|
882
|
+
if (!cleanup.ok) {
|
|
883
|
+
const cleanupMessage = `\u8B66\u544A\uFF1Aheadless run \u6536\u5C3E\u5931\u8D25\uFF1A${cleanup.reason}`;
|
|
884
|
+
writeLine(errorOutput, cleanupMessage);
|
|
885
|
+
if (context.sessionId) {
|
|
886
|
+
await appendSystemEvent(context, context.sessionId, cleanupMessage, "warning").catch(
|
|
887
|
+
() => void 0
|
|
888
|
+
);
|
|
889
|
+
}
|
|
890
|
+
if (benchValidationPassed) {
|
|
891
|
+
writeLine(errorOutput, "\u8B66\u544A\uFF1A\u4EFB\u52A1\u7ED3\u679C\u5DF2\u5B8C\u6210\u4F46\u6E05\u7406\u5931\u8D25\uFF1B\u8FD9\u4E0D\u662F agent \u89E3\u9898\u5931\u8D25\u3002");
|
|
892
|
+
} else {
|
|
893
|
+
return 4;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
if (context.sessionId && !context.sessionEnded) {
|
|
897
|
+
await store.appendEvent(context.sessionId, createSessionEndEvent(context.sessionId));
|
|
898
|
+
context.sessionEnded = true;
|
|
899
|
+
}
|
|
900
|
+
return 0;
|
|
901
|
+
} catch (error) {
|
|
902
|
+
const message = error instanceof Error ? error.message : "headless run \u6267\u884C\u5931\u8D25\u3002";
|
|
903
|
+
writeLine(errorOutput, `\u9519\u8BEF\uFF1A${message}`);
|
|
904
|
+
return 1;
|
|
905
|
+
} finally {
|
|
906
|
+
await finishHeadlessRuntime(context);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
async function pumpHeadlessApprovals(input) {
|
|
910
|
+
let approvals = input.approvals;
|
|
911
|
+
while (input.context.pendingLocalApproval) {
|
|
912
|
+
if (!input.autoApprove) {
|
|
913
|
+
input.context.activeAbortController?.abort();
|
|
914
|
+
writeLine(
|
|
915
|
+
input.errorOutput,
|
|
916
|
+
`\u9519\u8BEF\uFF1Aheadless run \u505C\u5728\u6743\u9650\u786E\u8BA4\uFF1A${input.context.pendingLocalApproval.kind}\u3002\u8BF7\u5F00\u542F --auto-approve \u6216\u6539\u7528\u4EA4\u4E92\u6A21\u5F0F\u3002`
|
|
917
|
+
);
|
|
918
|
+
return { approvals, exitCode: 3 };
|
|
919
|
+
}
|
|
920
|
+
if (approvals >= input.maxApprovals) {
|
|
921
|
+
input.context.activeAbortController?.abort();
|
|
922
|
+
writeLine(
|
|
923
|
+
input.errorOutput,
|
|
924
|
+
`\u9519\u8BEF\uFF1Aheadless run \u81EA\u52A8\u6279\u51C6\u8D85\u8FC7\u4E0A\u9650 ${input.maxApprovals}\uFF0C\u505C\u5728\u6743\u9650\u786E\u8BA4\uFF1A${input.context.pendingLocalApproval.kind}\u3002`
|
|
925
|
+
);
|
|
926
|
+
return { approvals, exitCode: 3 };
|
|
927
|
+
}
|
|
928
|
+
const approval = input.context.pendingLocalApproval;
|
|
929
|
+
input.context.pendingLocalApproval = void 0;
|
|
930
|
+
approvals += 1;
|
|
931
|
+
writeLine(input.output, `[headless] auto-approved ${approval.kind}`);
|
|
932
|
+
if (input.deferredApprovals && hasModelContinuation(approval)) {
|
|
933
|
+
input.deferredApprovals.push(approval);
|
|
934
|
+
continue;
|
|
935
|
+
}
|
|
936
|
+
await executePermissionApprove(approval, input.context, input.gateway, input.output);
|
|
937
|
+
}
|
|
938
|
+
return { approvals };
|
|
939
|
+
}
|
|
940
|
+
async function runDeferredHeadlessApprovals(input) {
|
|
941
|
+
let approvals = input.approvals;
|
|
942
|
+
while (input.deferredApprovals.length > 0) {
|
|
943
|
+
const approval = input.deferredApprovals.shift();
|
|
944
|
+
if (!approval) continue;
|
|
945
|
+
await executePermissionApprove(approval, input.context, input.gateway, input.output);
|
|
946
|
+
const nested = await pumpHeadlessApprovals({
|
|
947
|
+
context: input.context,
|
|
948
|
+
gateway: input.gateway,
|
|
949
|
+
output: input.output,
|
|
950
|
+
errorOutput: input.errorOutput,
|
|
951
|
+
autoApprove: input.autoApprove,
|
|
952
|
+
maxApprovals: input.maxApprovals,
|
|
953
|
+
approvals
|
|
954
|
+
});
|
|
955
|
+
approvals = nested.approvals;
|
|
956
|
+
if (nested.exitCode !== void 0) {
|
|
957
|
+
return { approvals, exitCode: nested.exitCode };
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
return { approvals };
|
|
961
|
+
}
|
|
962
|
+
function hasModelContinuation(approval) {
|
|
963
|
+
return "continuation" in approval && Boolean(approval.continuation);
|
|
964
|
+
}
|
|
965
|
+
function createHeadlessApprovalPump(input) {
|
|
966
|
+
let running;
|
|
967
|
+
return async () => {
|
|
968
|
+
if (running) return running;
|
|
969
|
+
running = pumpHeadlessApprovals({
|
|
970
|
+
context: input.context,
|
|
971
|
+
gateway: input.gateway,
|
|
972
|
+
output: input.output,
|
|
973
|
+
errorOutput: input.errorOutput,
|
|
974
|
+
autoApprove: input.autoApprove,
|
|
975
|
+
maxApprovals: input.maxApprovals,
|
|
976
|
+
approvals: input.getApprovals(),
|
|
977
|
+
deferredApprovals: input.deferredApprovals
|
|
978
|
+
}).then((result) => {
|
|
979
|
+
input.setApprovals(result.approvals);
|
|
980
|
+
return result;
|
|
981
|
+
});
|
|
982
|
+
try {
|
|
983
|
+
return await running;
|
|
984
|
+
} finally {
|
|
985
|
+
running = void 0;
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
async function runWithHeadlessApprovalPump(messagePromise, pump) {
|
|
990
|
+
let settled = false;
|
|
991
|
+
let exitCode;
|
|
992
|
+
const loop = (async () => {
|
|
993
|
+
while (!settled && exitCode === void 0) {
|
|
994
|
+
const result = await pump();
|
|
995
|
+
exitCode = result.exitCode;
|
|
996
|
+
if (exitCode !== void 0) break;
|
|
997
|
+
await sleep(50);
|
|
998
|
+
}
|
|
999
|
+
})();
|
|
1000
|
+
try {
|
|
1001
|
+
await messagePromise;
|
|
1002
|
+
} finally {
|
|
1003
|
+
settled = true;
|
|
1004
|
+
await loop;
|
|
1005
|
+
}
|
|
1006
|
+
return exitCode !== void 0 ? { exitCode } : {};
|
|
1007
|
+
}
|
|
1008
|
+
function sleep(ms) {
|
|
1009
|
+
return new Promise((resolveSleep) => setTimeout(resolveSleep, ms));
|
|
1010
|
+
}
|
|
1011
|
+
function createHeadlessContinuationBackoffMs(attempt) {
|
|
1012
|
+
return Math.min(HEADLESS_CONTINUATION_BACKOFF_BASE_MS * 2 ** Math.max(0, attempt - 1), 1500);
|
|
1013
|
+
}
|
|
1014
|
+
function resolveHeadlessDeadlineAtMs(options) {
|
|
1015
|
+
if (typeof options.deadlineAtMs === "number" && Number.isFinite(options.deadlineAtMs)) {
|
|
1016
|
+
return options.deadlineAtMs;
|
|
1017
|
+
}
|
|
1018
|
+
if (typeof options.deadlineMs === "number" && Number.isFinite(options.deadlineMs)) {
|
|
1019
|
+
return Date.now() + Math.max(0, options.deadlineMs);
|
|
1020
|
+
}
|
|
1021
|
+
const envDeadlineAt = Number.parseInt(process.env.LINGHUN_HEADLESS_DEADLINE_AT_MS ?? "", 10);
|
|
1022
|
+
if (Number.isFinite(envDeadlineAt) && envDeadlineAt > 0) {
|
|
1023
|
+
return envDeadlineAt;
|
|
1024
|
+
}
|
|
1025
|
+
return void 0;
|
|
1026
|
+
}
|
|
1027
|
+
function isHeadlessDeadlineApproaching(deadlineAtMs) {
|
|
1028
|
+
return deadlineAtMs !== void 0 && deadlineAtMs - Date.now() <= HEADLESS_DEADLINE_CLOSURE_WINDOW_MS;
|
|
1029
|
+
}
|
|
1030
|
+
function formatHeadlessRemainingTime(deadlineAtMs) {
|
|
1031
|
+
if (deadlineAtMs === void 0) return "unknown";
|
|
1032
|
+
return `${Math.max(0, Math.ceil((deadlineAtMs - Date.now()) / 1e3))}s remaining`;
|
|
1033
|
+
}
|
|
1034
|
+
function shouldRunHeadlessProviderContinuation(context) {
|
|
1035
|
+
return context.evidence.some((record) => !record.supportsClaims.includes("provider_failure")) || context.tools.changedFiles.length > 0;
|
|
1036
|
+
}
|
|
1037
|
+
async function recordHeadlessArtifactChecklist(context, sessionId, config, lastValidation) {
|
|
1038
|
+
const checklist = await collectHeadlessArtifactChecklist({
|
|
1039
|
+
projectPath: context.projectPath,
|
|
1040
|
+
config,
|
|
1041
|
+
changedFiles: context.tools.changedFiles,
|
|
1042
|
+
...lastValidation ? { lastValidation } : {}
|
|
1043
|
+
});
|
|
1044
|
+
const evidence = createEvidenceRecord(
|
|
1045
|
+
"command_output",
|
|
1046
|
+
`headless artifact checklist: ${checklist.summary}`,
|
|
1047
|
+
"headless:artifact-checklist",
|
|
1048
|
+
[
|
|
1049
|
+
"headless_artifact_checklist",
|
|
1050
|
+
checklist.verificationRan ? "verification_ran" : "verification_not_run",
|
|
1051
|
+
checklist.changedFiles.length > 0 ? "file_written" : "no_file_changes"
|
|
1052
|
+
]
|
|
1053
|
+
);
|
|
1054
|
+
rememberEvidence(context, evidence);
|
|
1055
|
+
await context.store.appendEvent(sessionId, { type: "evidence_record", ...evidence });
|
|
1056
|
+
await appendSystemEvent(context, sessionId, `headless artifact checklist: ${checklist.summary}`, "info");
|
|
1057
|
+
}
|
|
1058
|
+
var __testHeadlessRuntime = {
|
|
1059
|
+
isDeadlineApproaching: isHeadlessDeadlineApproaching,
|
|
1060
|
+
formatRemainingTime: formatHeadlessRemainingTime
|
|
1061
|
+
};
|
|
1062
|
+
function createHeadlessProviderFailureDiagnostic(context, input) {
|
|
1063
|
+
const failure = context.lastProviderFailure;
|
|
1064
|
+
const lastEvidence = context.evidence.find(
|
|
1065
|
+
(record) => !record.supportsClaims.includes("provider_failure")
|
|
1066
|
+
);
|
|
1067
|
+
const changedFiles = context.tools.changedFiles.length;
|
|
1068
|
+
return [
|
|
1069
|
+
"\u9519\u8BEF\uFF1Aprovider stream \u5931\u8D25\uFF0Cheadless continuation \u5DF2\u8FBE\u4E0A\u9650\u6216\u7F3A\u5C11\u53EF\u6062\u590D\u8BC1\u636E\u3002",
|
|
1070
|
+
`providerKind=${failure?.kind ?? "unknown"}`,
|
|
1071
|
+
`providerCode=${failure?.code ?? "unknown"}`,
|
|
1072
|
+
`attempts=${input.requestAttempts}`,
|
|
1073
|
+
`continuations=${input.continuations}/${input.maxContinuations}`,
|
|
1074
|
+
`lastSuccessfulTool=${lastEvidence?.source ?? "none"}`,
|
|
1075
|
+
`fileChanges=${changedFiles > 0 ? `yes:${changedFiles}` : "no"}`,
|
|
1076
|
+
failure?.summary ? `summary=${failure.summary}` : ""
|
|
1077
|
+
].filter(Boolean).join(" ");
|
|
1078
|
+
}
|
|
1079
|
+
function createHeadlessProviderContinuationPrompt(context) {
|
|
1080
|
+
return context.language === "en-US" ? "The previous response stream was interrupted. Continue the original task based on the current workspace state, transcript, tool evidence, and any file changes already present. Do not restart from scratch unless needed." : "\u4E0A\u4E00\u8F6E\u54CD\u5E94\u6D41\u4E2D\u65AD\u3002\u8BF7\u57FA\u4E8E\u5F53\u524D\u5DE5\u4F5C\u533A\u72B6\u6001\u3001\u5DF2\u6709 transcript\u3001\u5DE5\u5177\u8BC1\u636E\u548C\u5DF2\u7ECF\u5B58\u5728\u7684\u6587\u4EF6\u6539\u52A8\u7EE7\u7EED\u5B8C\u6210\u539F\u4EFB\u52A1\uFF1B\u9664\u975E\u5FC5\u8981\uFF0C\u4E0D\u8981\u4ECE\u5934\u91CD\u505A\u3002";
|
|
1081
|
+
}
|
|
1082
|
+
async function finishHeadlessRuntime(context) {
|
|
1083
|
+
if (context.pendingLocalApproval) {
|
|
1084
|
+
return { ok: false, reason: `\u4ECD\u6709\u6743\u9650\u786E\u8BA4\u672A\u5904\u7406\uFF1A${context.pendingLocalApproval.kind}` };
|
|
1085
|
+
}
|
|
1086
|
+
if (context.activeAbortController) {
|
|
1087
|
+
context.activeAbortController.abort();
|
|
1088
|
+
}
|
|
1089
|
+
context.tools.abortSignal = void 0;
|
|
1090
|
+
context.interrupt = { type: "idle" };
|
|
1091
|
+
clearRequestActivity(context);
|
|
1092
|
+
context.activeAbortController = void 0;
|
|
1093
|
+
const stopResult = requestTrackedProcessStop(true);
|
|
1094
|
+
await sleep(HEADLESS_CLEANUP_SETTLE_MS);
|
|
1095
|
+
const stillTracked = getTrackedProcessSnapshot();
|
|
1096
|
+
if (stopResult.failures.length > 0) {
|
|
1097
|
+
return {
|
|
1098
|
+
ok: false,
|
|
1099
|
+
reason: `\u6E05\u7406\u672C\u5730\u5B50\u8FDB\u7A0B\u5931\u8D25\uFF1A${stopResult.failures.map((failure) => `${failure.pid}:${failure.message}`).join("; ")}`
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
if (stillTracked.length > 0) {
|
|
1103
|
+
return {
|
|
1104
|
+
ok: false,
|
|
1105
|
+
reason: `\u4ECD\u6709\u672C\u5730\u5B50\u8FDB\u7A0B\u672A\u9000\u51FA\uFF1A${stillTracked.map((entry) => `${entry.pid}${entry.label ? `(${entry.label})` : ""}`).join(", ")}`
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
return { ok: true };
|
|
1109
|
+
}
|
|
666
1110
|
var MAX_TOOL_LOG_FILES = 200;
|
|
667
1111
|
async function cleanStaleToolLogs(context) {
|
|
668
1112
|
const logsRoot = resolveStoragePaths(context.config, context.projectPath).logs;
|
|
@@ -847,14 +1291,17 @@ async function runInkShell(input, output, errorOutput, context, gateway, store,
|
|
|
847
1291
|
const controller = {
|
|
848
1292
|
getViewModel: () => {
|
|
849
1293
|
const runtime = getSelectedModelRuntime(context);
|
|
1294
|
+
const width = readOutputColumns(output);
|
|
1295
|
+
const height = readOutputRows(output);
|
|
1296
|
+
const activity = mapRequestActivityToView(context);
|
|
850
1297
|
return createShellViewModel(context, {
|
|
851
|
-
width
|
|
852
|
-
height
|
|
1298
|
+
width,
|
|
1299
|
+
height,
|
|
853
1300
|
noColor: isNoColorTerminal(),
|
|
854
1301
|
setupNeeded: startup.setupNeeded,
|
|
855
1302
|
projectRouteProblem: startup.projectRouteProblem,
|
|
856
1303
|
outputBlocks: blocks,
|
|
857
|
-
activity
|
|
1304
|
+
activity,
|
|
858
1305
|
permission: mapPendingApprovalToPermission(context),
|
|
859
1306
|
submitted: submittedPending,
|
|
860
1307
|
submittedStartedAt: submittedPendingStartedAt,
|
|
@@ -1764,8 +2211,11 @@ async function runInkShell(input, output, errorOutput, context, gateway, store,
|
|
|
1764
2211
|
cleanupCompletedBackgroundTasks(context);
|
|
1765
2212
|
const hasAgents = (context.agents ?? []).length > 0;
|
|
1766
2213
|
const hasWorkflows = (context.workflows?.activeRuns ?? []).length > 0 || Boolean(context.workflows?.activeRun);
|
|
1767
|
-
const hasBgTasks = (context.backgroundTasks ?? []).
|
|
1768
|
-
|
|
2214
|
+
const hasBgTasks = (context.backgroundTasks ?? []).some((task) => task.status === "running");
|
|
2215
|
+
const hasActiveAbort = Boolean(
|
|
2216
|
+
context.activeAbortController && context.activeAbortController.signal?.aborted !== true
|
|
2217
|
+
);
|
|
2218
|
+
if (!submittedPending && !context.requestActivityPhase && !hasActiveAbort && !hasAgents && !hasWorkflows && !hasBgTasks) {
|
|
1769
2219
|
return;
|
|
1770
2220
|
}
|
|
1771
2221
|
shell?.rerender();
|
|
@@ -2220,6 +2670,7 @@ export {
|
|
|
2220
2670
|
__testCreateVerificationLevelForReadiness,
|
|
2221
2671
|
__testFormatStartAgentDidNotStartMessage,
|
|
2222
2672
|
__testGetCurrentWorkflowStepRequest,
|
|
2673
|
+
__testHeadlessRuntime,
|
|
2223
2674
|
__testParseRunWorkflowToolInput,
|
|
2224
2675
|
__testRenderInteractiveChoiceLines,
|
|
2225
2676
|
__testRunWorkflowStepsWithPlan,
|
|
@@ -2273,6 +2724,7 @@ export {
|
|
|
2273
2724
|
dingtalkBridgeAdapter,
|
|
2274
2725
|
dingtalkStreamFrameToBridgeEvent,
|
|
2275
2726
|
estimateFileMetrics,
|
|
2727
|
+
evaluateAggregatedFinalAnswerGate,
|
|
2276
2728
|
executeExtraTool,
|
|
2277
2729
|
executeSearchExtraTools,
|
|
2278
2730
|
feishuBridgeAdapter,
|
|
@@ -2320,6 +2772,7 @@ export {
|
|
|
2320
2772
|
recordModelUsage,
|
|
2321
2773
|
runAutoLearningOnTurnEnd,
|
|
2322
2774
|
runCommandCaptureForTest,
|
|
2775
|
+
runHeadlessTask,
|
|
2323
2776
|
runTui,
|
|
2324
2777
|
runVerificationCommandForTest,
|
|
2325
2778
|
runtimeFromContinuation,
|