@linghun/tui 0.1.2 → 0.1.3
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/background-control-runtime.js +31 -31
- package/dist/capability-runtime.js +19 -19
- package/dist/{chunk-AGI6GFFL.js → chunk-5OZEJQBH.js} +1 -1
- package/dist/{chunk-42ZZUF7P.js → chunk-6C32YAB5.js} +17 -5
- package/dist/{chunk-PPUOHBAK.js → chunk-6JPUBF7B.js} +11 -11
- package/dist/{chunk-CJRJR7TP.js → chunk-7XAOTGHZ.js} +2 -2
- package/dist/{chunk-YLOJWSHB.js → chunk-BEDD7OFL.js} +2 -2
- package/dist/{chunk-HPQ2IHOW.js → chunk-CQCJGMXG.js} +3 -3
- package/dist/{chunk-NK4NMYF5.js → chunk-DEIYY6NI.js} +276 -10
- package/dist/{chunk-5IFNLTOF.js → chunk-EGHM55EV.js} +2 -2
- package/dist/{chunk-EKYXI6C7.js → chunk-ESAACKVG.js} +1 -1
- package/dist/{chunk-YMEMN5FG.js → chunk-G7O26P5X.js} +1 -1
- package/dist/{chunk-FGGY5KNM.js → chunk-GYHEUVR2.js} +2 -2
- package/dist/{chunk-HZ5XNKWS.js → chunk-HMGYFENJ.js} +1 -1
- package/dist/{chunk-ZJDPYOTK.js → chunk-IQS34W5A.js} +2 -2
- package/dist/{chunk-7BHMBWG2.js → chunk-J7AAPUTV.js} +1 -1
- package/dist/{chunk-YDTJ7UBG.js → chunk-JMUAQUQQ.js} +1 -1
- package/dist/{chunk-NL4M3V5D.js → chunk-KKZBBCHK.js} +1 -1
- package/dist/{chunk-UIKN3CDF.js → chunk-NMOVU75L.js} +1 -1
- package/dist/{chunk-YKOXJQGX.js → chunk-NWZ44SFI.js} +78 -3
- package/dist/{chunk-HPIHFENG.js → chunk-OH35XDD4.js} +1 -1
- package/dist/{chunk-WXTHKLNH.js → chunk-OI5TZ37D.js} +27 -0
- package/dist/{chunk-DIDRFIIW.js → chunk-OMWSM2DA.js} +1 -1
- package/dist/{chunk-X7E34LKV.js → chunk-OV5OT66G.js} +5 -5
- package/dist/{chunk-HGCTHBUY.js → chunk-PHPEPZAA.js} +1 -1
- package/dist/{chunk-ZF36LULR.js → chunk-Q57WS7YZ.js} +2 -2
- package/dist/{chunk-3PG7I3LA.js → chunk-QXV2N4F2.js} +1 -1
- package/dist/{chunk-7R4YXN7Z.js → chunk-RDTVAQBD.js} +86 -61
- package/dist/{chunk-LBC75QAB.js → chunk-TO6IN4LA.js} +201 -5
- package/dist/{chunk-O2U4XQVM.js → chunk-UYU4QN3P.js} +1 -1
- package/dist/{chunk-J6CYFWSW.js → chunk-VDQTNA4W.js} +20 -1
- package/dist/{chunk-3MRYQO7X.js → chunk-XYY5LRSF.js} +3 -3
- package/dist/{chunk-OSFBVVEP.js → chunk-YBTXLLO5.js} +1 -1
- package/dist/{chunk-JY3LI63F.js → chunk-YGXPS5F2.js} +1 -1
- package/dist/{chunk-4UER2AKI.js → chunk-ZPFOP557.js} +190 -0
- package/dist/command-panel-runtime.js +18 -18
- package/dist/compact-cache-command-runtime.js +31 -31
- package/dist/compact-preflight-runtime.js +7 -7
- package/dist/connector-runtime.js +20 -20
- package/dist/details-status-runtime.js +18 -18
- package/dist/evidence-runtime.d.ts.map +1 -1
- package/dist/evidence-runtime.js +3 -2
- package/dist/extension-command-runtime.js +3 -3
- package/dist/extension-slash-runtime.js +19 -19
- package/dist/failure-learning-command-runtime.js +19 -19
- package/dist/final-answer-gate.d.ts +1 -0
- package/dist/final-answer-gate.d.ts.map +1 -1
- package/dist/final-answer-gate.js +4 -2
- package/dist/git-command-runtime.js +19 -19
- package/dist/headless-bench-runtime.d.ts +19 -1
- package/dist/headless-bench-runtime.d.ts.map +1 -1
- package/dist/headless-bench-runtime.js +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -40
- package/dist/job-agent-command-runtime.js +18 -18
- package/dist/job-runtime.js +4 -4
- package/dist/mcp-index-command-runtime.js +3 -3
- package/dist/mcp-index-runtime.js +21 -21
- package/dist/mcp-stdio-runtime.js +2 -2
- package/dist/memory-command-runtime.js +19 -19
- package/dist/meta-scheduler-runtime.js +2 -2
- package/dist/model-command-runtime.js +19 -19
- package/dist/model-loop-runtime.d.ts.map +1 -1
- package/dist/model-loop-runtime.js +1 -1
- package/dist/model-prompt-runtime.js +4 -4
- package/dist/model-stream-runtime.d.ts.map +1 -1
- package/dist/model-stream-runtime.js +31 -31
- package/dist/model-tool-runtime.d.ts.map +1 -1
- package/dist/model-tool-runtime.js +31 -31
- package/dist/permission-approval-runtime.js +31 -31
- package/dist/permission-continuation-runtime.d.ts.map +1 -1
- package/dist/permission-continuation-runtime.js +2 -2
- package/dist/process-command-runtime.js +2 -2
- package/dist/process-guard.d.ts +3 -0
- package/dist/process-guard.d.ts.map +1 -1
- package/dist/process-guard.js +5 -1
- package/dist/remote-command-runtime.js +19 -19
- package/dist/runner-runtime.js +3 -3
- package/dist/shell/view-model.js +5 -5
- package/dist/slash-command-runtime.js +31 -31
- package/dist/tool-output-presenter.d.ts +1 -0
- package/dist/tool-output-presenter.d.ts.map +1 -1
- package/dist/tool-output-presenter.js +3 -1
- package/dist/tui-agent-job-runtime.js +5 -5
- package/dist/tui-context-runtime.d.ts +2 -0
- package/dist/tui-context-runtime.d.ts.map +1 -1
- package/dist/tui-data-types.d.ts +1 -0
- package/dist/tui-data-types.d.ts.map +1 -1
- package/dist/tui-details-runtime.js +5 -5
- package/dist/tui-output-surface.js +6 -6
- package/dist/tui-permission-runtime.js +3 -3
- package/dist/verification-command-runtime.js +6 -6
- package/dist/workflow-command-runtime.js +18 -18
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
showCommandPanel
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6JPUBF7B.js";
|
|
4
4
|
import {
|
|
5
5
|
createSkillEvolutionCandidate,
|
|
6
6
|
formatExtensionInstallGate,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
removeExtension,
|
|
15
15
|
updateExtension,
|
|
16
16
|
validateExtensionItems
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5OZEJQBH.js";
|
|
18
18
|
import {
|
|
19
19
|
createHookState,
|
|
20
20
|
createPluginState,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
consumeRemoteInboundMessage,
|
|
22
22
|
processRemoteInbound,
|
|
23
23
|
validateRemotePairingEnvelope
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-IQS34W5A.js";
|
|
25
25
|
import {
|
|
26
26
|
formatLocalToolPermissionPrompt,
|
|
27
27
|
formatModelToolPermissionPrompt
|
|
@@ -36,18 +36,18 @@ import {
|
|
|
36
36
|
executeMemoryMutation,
|
|
37
37
|
resumeSessionWithHandoff,
|
|
38
38
|
runAutoLearningOnTurnEnd
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-GYHEUVR2.js";
|
|
40
40
|
import {
|
|
41
41
|
evaluateMetaScheduler,
|
|
42
42
|
formatMetaSchedulerDirective,
|
|
43
43
|
formatPolicyDecisionSummary,
|
|
44
44
|
hasActiveProviderFailure,
|
|
45
45
|
verifyFailureLearningContract
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-KKZBBCHK.js";
|
|
47
47
|
import {
|
|
48
48
|
configureModelCommandRuntime,
|
|
49
49
|
startModelSetup
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-J7AAPUTV.js";
|
|
51
51
|
import {
|
|
52
52
|
looksLikeModelSetupInput,
|
|
53
53
|
parseModelSetupPrefill
|
|
@@ -59,10 +59,10 @@ import {
|
|
|
59
59
|
refreshIndexStatus,
|
|
60
60
|
runIndexRepository,
|
|
61
61
|
stabilizeMcpToolList
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-OV5OT66G.js";
|
|
63
63
|
import {
|
|
64
64
|
formatIndexRefreshSummary
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-UYU4QN3P.js";
|
|
66
66
|
import {
|
|
67
67
|
isIgnoredIndexPath
|
|
68
68
|
} from "./chunk-6CHUZ2NF.js";
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
checkClaimSupport,
|
|
71
71
|
formatClaimCheck,
|
|
72
72
|
runArchitectureAndCompletenessFinalGate
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-TO6IN4LA.js";
|
|
74
74
|
import {
|
|
75
75
|
executeGitToolUse,
|
|
76
76
|
resolveStablePointApprove,
|
|
@@ -80,10 +80,10 @@ import {
|
|
|
80
80
|
} from "./chunk-7ZE5JFAZ.js";
|
|
81
81
|
import {
|
|
82
82
|
configureExtensionSlashRuntime
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-Q57WS7YZ.js";
|
|
84
84
|
import {
|
|
85
85
|
configureFailureLearningCommandRuntime
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-QXV2N4F2.js";
|
|
87
87
|
import {
|
|
88
88
|
startFeishuLongConnection
|
|
89
89
|
} from "./chunk-WJWYRBWH.js";
|
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
inspectToolPairingSafety,
|
|
98
98
|
prepareMessagesForProviderPreflight,
|
|
99
99
|
recordCompactBoundary
|
|
100
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-EGHM55EV.js";
|
|
101
101
|
import {
|
|
102
102
|
appendBreakCacheEvent,
|
|
103
103
|
buildPromptCacheRequestFields,
|
|
@@ -144,13 +144,13 @@ import {
|
|
|
144
144
|
transitionDurableJob,
|
|
145
145
|
upsertWorkflowBackgroundTask,
|
|
146
146
|
writeStatus
|
|
147
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-6JPUBF7B.js";
|
|
148
148
|
import {
|
|
149
149
|
addAllowRule,
|
|
150
150
|
decidePermission,
|
|
151
151
|
savePermissionState,
|
|
152
152
|
toPermissionPromptView
|
|
153
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-PHPEPZAA.js";
|
|
154
154
|
import {
|
|
155
155
|
createReviewReport,
|
|
156
156
|
createVerificationPlan,
|
|
@@ -160,7 +160,7 @@ import {
|
|
|
160
160
|
formatVerificationTaskSummary,
|
|
161
161
|
runVerificationCommand,
|
|
162
162
|
runVerificationPlan
|
|
163
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-7XAOTGHZ.js";
|
|
164
164
|
import {
|
|
165
165
|
abortBackgroundTask,
|
|
166
166
|
clearBackgroundAbortController,
|
|
@@ -175,7 +175,7 @@ import {
|
|
|
175
175
|
listCancellableAgents,
|
|
176
176
|
registerBackgroundAbortController,
|
|
177
177
|
rememberBackgroundTask
|
|
178
|
-
} from "./chunk-
|
|
178
|
+
} from "./chunk-YBTXLLO5.js";
|
|
179
179
|
import {
|
|
180
180
|
ShellBlockOutput,
|
|
181
181
|
beginAssistantStream,
|
|
@@ -185,7 +185,7 @@ import {
|
|
|
185
185
|
writeAssistantDelta,
|
|
186
186
|
writeErrorLine,
|
|
187
187
|
writeLocalCommandOutputLine
|
|
188
|
-
} from "./chunk-
|
|
188
|
+
} from "./chunk-OH35XDD4.js";
|
|
189
189
|
import {
|
|
190
190
|
createTerminalReadinessView
|
|
191
191
|
} from "./chunk-PBIPV4LD.js";
|
|
@@ -193,26 +193,26 @@ import {
|
|
|
193
193
|
appendJobLog,
|
|
194
194
|
parseJobRunOptions,
|
|
195
195
|
rescheduleDurableJobAgents
|
|
196
|
-
} from "./chunk-
|
|
196
|
+
} from "./chunk-NMOVU75L.js";
|
|
197
197
|
import {
|
|
198
198
|
refreshRunnerStatusForJob,
|
|
199
199
|
resolveNativeRunner,
|
|
200
200
|
startRunnerForDurableJob,
|
|
201
201
|
stopRunnerForDurableJob
|
|
202
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-JMUAQUQQ.js";
|
|
203
203
|
import {
|
|
204
204
|
detectEngineeringTaskProfile
|
|
205
|
-
} from "./chunk-
|
|
205
|
+
} from "./chunk-ZPFOP557.js";
|
|
206
206
|
import {
|
|
207
207
|
formatHooksDoctor
|
|
208
|
-
} from "./chunk-
|
|
208
|
+
} from "./chunk-5OZEJQBH.js";
|
|
209
209
|
import {
|
|
210
210
|
runCommandCapture
|
|
211
|
-
} from "./chunk-
|
|
211
|
+
} from "./chunk-HMGYFENJ.js";
|
|
212
212
|
import {
|
|
213
213
|
createModelSystemPrompt,
|
|
214
214
|
sanitizeMainScreenLeakage
|
|
215
|
-
} from "./chunk-
|
|
215
|
+
} from "./chunk-BEDD7OFL.js";
|
|
216
216
|
import {
|
|
217
217
|
collectInputFiles,
|
|
218
218
|
createReportFinalReferenceReminder,
|
|
@@ -230,11 +230,7 @@ import {
|
|
|
230
230
|
shouldSendReportEvidenceReminder,
|
|
231
231
|
shouldSendReportFinalReferenceReminder,
|
|
232
232
|
shouldSendReportWriteReminder
|
|
233
|
-
} from "./chunk-
|
|
234
|
-
import {
|
|
235
|
-
createAssistantPrimaryTextSanitizer,
|
|
236
|
-
formatToolOutput
|
|
237
|
-
} from "./chunk-WXTHKLNH.js";
|
|
233
|
+
} from "./chunk-6C32YAB5.js";
|
|
238
234
|
import {
|
|
239
235
|
buildRuntimeStatusForModel,
|
|
240
236
|
createModelCapabilitySummary,
|
|
@@ -273,7 +269,7 @@ import {
|
|
|
273
269
|
recordVerificationEvidence,
|
|
274
270
|
rememberEvidence,
|
|
275
271
|
truncateRoundAssistantForProvider
|
|
276
|
-
} from "./chunk-
|
|
272
|
+
} from "./chunk-DEIYY6NI.js";
|
|
277
273
|
import {
|
|
278
274
|
BACKGROUND_KIND_CAPS,
|
|
279
275
|
BACKGROUND_RUNNING_GLOBAL_CAP,
|
|
@@ -291,6 +287,10 @@ import {
|
|
|
291
287
|
import {
|
|
292
288
|
applyToolResultBudgetToMessages
|
|
293
289
|
} from "./chunk-O7S3HYE6.js";
|
|
290
|
+
import {
|
|
291
|
+
createAssistantPrimaryTextSanitizer,
|
|
292
|
+
formatToolOutput
|
|
293
|
+
} from "./chunk-OI5TZ37D.js";
|
|
294
294
|
import {
|
|
295
295
|
loadOrCreateHandoffPacket,
|
|
296
296
|
validateHandoffPacket,
|
|
@@ -320,7 +320,7 @@ import {
|
|
|
320
320
|
extractFileMentions,
|
|
321
321
|
sanitizeDeferredToolPrimaryText,
|
|
322
322
|
stripStructuredFinalAnswerClaims
|
|
323
|
-
} from "./chunk-
|
|
323
|
+
} from "./chunk-NWZ44SFI.js";
|
|
324
324
|
import {
|
|
325
325
|
INDEX_REFRESH,
|
|
326
326
|
INDEX_REPAIR,
|
|
@@ -3810,7 +3810,7 @@ function evaluateEngineeringFinalBoundary(context, assistantText) {
|
|
|
3810
3810
|
assistantText
|
|
3811
3811
|
);
|
|
3812
3812
|
if (!highRiskFinal && !signal.failureCategory) return { status: "passed" };
|
|
3813
|
-
if (signal.failureCategory === "missing_artifact" && !hasArtifactEvidence(context
|
|
3813
|
+
if (signal.failureCategory === "missing_artifact" && !hasArtifactEvidence(context)) {
|
|
3814
3814
|
return {
|
|
3815
3815
|
status: "needs_disclaimer",
|
|
3816
3816
|
unsupportedKinds: ["engineering_missing_artifact"],
|
|
@@ -3831,7 +3831,7 @@ function evaluateEngineeringFinalBoundary(context, assistantText) {
|
|
|
3831
3831
|
message: signal.finalBoundaryHint ?? "provider output was interrupted"
|
|
3832
3832
|
};
|
|
3833
3833
|
}
|
|
3834
|
-
if (signal.profile === "binary_or_artifact" && highRiskFinal && !hasArtifactEvidence(context
|
|
3834
|
+
if (signal.profile === "binary_or_artifact" && highRiskFinal && !hasArtifactEvidence(context)) {
|
|
3835
3835
|
return {
|
|
3836
3836
|
status: "needs_disclaimer",
|
|
3837
3837
|
unsupportedKinds: ["engineering_artifact_unverified"],
|
|
@@ -3856,18 +3856,14 @@ function evaluateEngineeringFinalBoundary(context, assistantText) {
|
|
|
3856
3856
|
}
|
|
3857
3857
|
return { status: "passed" };
|
|
3858
3858
|
}
|
|
3859
|
-
function hasArtifactEvidence(context
|
|
3859
|
+
function hasArtifactEvidence(context) {
|
|
3860
3860
|
const signalTargets = context.lastMetaSchedulerDecision?.policyDecision.engineeringSignal.artifactTargets ?? [];
|
|
3861
|
-
const targets = uniqueArtifactTargets(
|
|
3861
|
+
const targets = uniqueArtifactTargets(signalTargets);
|
|
3862
3862
|
return context.evidence.some((item) => {
|
|
3863
|
-
const
|
|
3864
|
-
if (
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
if (targets.length === 0) {
|
|
3868
|
-
return /(?:artifact|output file|out\.txt|non-empty|产物|输出文件)/iu.test(text);
|
|
3869
|
-
}
|
|
3870
|
-
return targets.some((target) => text.toLowerCase().includes(target.toLowerCase()));
|
|
3863
|
+
const artifactHint = readEvidenceDataRecord(item, "artifactHint");
|
|
3864
|
+
if (artifactHint?.exists !== true || typeof artifactHint.path !== "string") return false;
|
|
3865
|
+
if (targets.length === 0) return true;
|
|
3866
|
+
return targets.some((target) => pathsReferToSameArtifact(artifactHint.path, target));
|
|
3871
3867
|
});
|
|
3872
3868
|
}
|
|
3873
3869
|
function hasFullVerificationEvidence(context) {
|
|
@@ -3878,22 +3874,27 @@ function hasFullVerificationEvidence(context) {
|
|
|
3878
3874
|
);
|
|
3879
3875
|
}
|
|
3880
3876
|
function hasServiceVerificationEvidence(context) {
|
|
3881
|
-
return context.evidence.some(
|
|
3882
|
-
(item
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
);
|
|
3877
|
+
return context.evidence.some((item) => {
|
|
3878
|
+
const service = readEvidenceDataRecord(item, "service");
|
|
3879
|
+
const serviceHint = readEvidenceDataRecord(item, "serviceHint");
|
|
3880
|
+
return service?.ready === true || serviceHint?.ready === true;
|
|
3881
|
+
});
|
|
3886
3882
|
}
|
|
3887
|
-
function
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3883
|
+
function readEvidenceDataRecord(evidence, key) {
|
|
3884
|
+
if (!evidence.data || typeof evidence.data !== "object") return void 0;
|
|
3885
|
+
const value = evidence.data[key];
|
|
3886
|
+
return value && typeof value === "object" ? value : void 0;
|
|
3887
|
+
}
|
|
3888
|
+
function pathsReferToSameArtifact(actual, target) {
|
|
3889
|
+
const normalizedActual = normalizeArtifactEvidencePath(actual);
|
|
3890
|
+
const normalizedTarget = normalizeArtifactEvidencePath(target);
|
|
3891
|
+
return normalizedActual === normalizedTarget || basenameLike(normalizedActual) === basenameLike(normalizedTarget);
|
|
3892
|
+
}
|
|
3893
|
+
function normalizeArtifactEvidencePath(path) {
|
|
3894
|
+
return path.replace(/\\/g, "/").replace(/\/+/g, "/").toLowerCase();
|
|
3895
|
+
}
|
|
3896
|
+
function basenameLike(path) {
|
|
3897
|
+
return path.split("/").filter(Boolean).at(-1) ?? path;
|
|
3897
3898
|
}
|
|
3898
3899
|
function uniqueArtifactTargets(targets) {
|
|
3899
3900
|
const out = /* @__PURE__ */ new Set();
|
|
@@ -6520,7 +6521,7 @@ async function executeApprovedModelToolUse(toolCall, toolName, context, sessionI
|
|
|
6520
6521
|
if (preflight) {
|
|
6521
6522
|
writeLine(output, preflight);
|
|
6522
6523
|
}
|
|
6523
|
-
if (toolName === "Bash") {
|
|
6524
|
+
if (toolName === "Bash" && shouldTrackBashAsBackground(toolCall.input)) {
|
|
6524
6525
|
const guard = checkBackgroundStartGuard2(context, "bash", true);
|
|
6525
6526
|
if (guard) {
|
|
6526
6527
|
const evidence = await recordToolFailureEvidence(context, sessionId, toolName, guard);
|
|
@@ -6536,7 +6537,7 @@ async function executeApprovedModelToolUse(toolCall, toolName, context, sessionI
|
|
|
6536
6537
|
return { ok: false, tool: toolName, text: guard, evidenceId: evidence.id };
|
|
6537
6538
|
}
|
|
6538
6539
|
}
|
|
6539
|
-
const task = toolName === "Bash" ? createBackgroundTask(toolName, toolCall.input, context) : void 0;
|
|
6540
|
+
const task = toolName === "Bash" && shouldTrackBashAsBackground(toolCall.input) ? createBackgroundTask(toolName, toolCall.input, context) : void 0;
|
|
6540
6541
|
if (task) {
|
|
6541
6542
|
rememberBackgroundTask(context, task);
|
|
6542
6543
|
await appendBackgroundTaskEvent(context, sessionId, task);
|
|
@@ -6575,7 +6576,13 @@ async function executeApprovedModelToolUse(toolCall, toolName, context, sessionI
|
|
|
6575
6576
|
rememberToolFiles(context, toolName, toolCall.input, result.output);
|
|
6576
6577
|
const isError = isToolOutputFailure(toolName, result.output);
|
|
6577
6578
|
if (task) {
|
|
6578
|
-
|
|
6579
|
+
const bgData = result.output.data;
|
|
6580
|
+
if (bgData?.backgroundTaskId) {
|
|
6581
|
+
context.backgroundBashTaskMap?.set(bgData.backgroundTaskId, task.id);
|
|
6582
|
+
task.outputPath = bgData.outputPath;
|
|
6583
|
+
} else {
|
|
6584
|
+
finishBackgroundTaskFromToolOutput2(task, result.output, context);
|
|
6585
|
+
}
|
|
6579
6586
|
await appendBackgroundTaskEvent(context, sessionId, task);
|
|
6580
6587
|
}
|
|
6581
6588
|
await appendToolResultEvent(
|
|
@@ -6604,7 +6611,10 @@ async function executeApprovedModelToolUse(toolCall, toolName, context, sessionI
|
|
|
6604
6611
|
"warning"
|
|
6605
6612
|
);
|
|
6606
6613
|
}
|
|
6607
|
-
|
|
6614
|
+
const bgStarted = !!result.output.data?.backgroundTaskId;
|
|
6615
|
+
if (!bgStarted) {
|
|
6616
|
+
clearBackgroundAbortController(context, task?.id ?? "");
|
|
6617
|
+
}
|
|
6608
6618
|
if (backgroundController) {
|
|
6609
6619
|
context.tools.abortSignal = previousAbortSignal;
|
|
6610
6620
|
}
|
|
@@ -8015,18 +8025,28 @@ async function handleToolCommand(name, args, context, output) {
|
|
|
8015
8025
|
}
|
|
8016
8026
|
const progress = installToolProgressHandler(context, sessionId, callId, output, task);
|
|
8017
8027
|
let result;
|
|
8028
|
+
let bgStarted2 = false;
|
|
8018
8029
|
try {
|
|
8019
8030
|
result = await runTool2(name, input, context.tools);
|
|
8031
|
+
bgStarted2 = !!result.output.data?.backgroundTaskId;
|
|
8020
8032
|
} finally {
|
|
8021
8033
|
progress.restore();
|
|
8022
8034
|
await Promise.all(progress.pending);
|
|
8023
|
-
|
|
8035
|
+
if (!bgStarted2) {
|
|
8036
|
+
clearBackgroundAbortController(context, task?.id ?? "");
|
|
8037
|
+
}
|
|
8024
8038
|
if (backgroundController) {
|
|
8025
8039
|
context.tools.abortSignal = previousAbortSignal;
|
|
8026
8040
|
}
|
|
8027
8041
|
}
|
|
8028
8042
|
if (task) {
|
|
8029
|
-
|
|
8043
|
+
const bgData = result.output.data;
|
|
8044
|
+
if (bgData?.backgroundTaskId) {
|
|
8045
|
+
context.backgroundBashTaskMap?.set(bgData.backgroundTaskId, task.id);
|
|
8046
|
+
task.outputPath = bgData.outputPath ?? void 0;
|
|
8047
|
+
} else {
|
|
8048
|
+
finishBackgroundTaskFromToolOutput2(task, result.output, context);
|
|
8049
|
+
}
|
|
8030
8050
|
await appendBackgroundTaskEvent(context, sessionId, task);
|
|
8031
8051
|
}
|
|
8032
8052
|
await context.store.appendEvent(sessionId, createToolEndEvent(callId, result.output));
|
|
@@ -8190,6 +8210,11 @@ function createBackgroundTask(name, input, context) {
|
|
|
8190
8210
|
nextAction: context.language === "en-US" ? "Wait for completion or use /interrupt." : "\u7B49\u5F85\u5B8C\u6210\uFF0C\u6216\u7528 /interrupt \u4E2D\u65AD\u3002"
|
|
8191
8211
|
};
|
|
8192
8212
|
}
|
|
8213
|
+
function shouldTrackBashAsBackground(input) {
|
|
8214
|
+
if (typeof input !== "object" || input === null) return false;
|
|
8215
|
+
const record = input;
|
|
8216
|
+
return record.runInBackground === true || record.run_in_background === true;
|
|
8217
|
+
}
|
|
8193
8218
|
async function appendProgressEventSafely(context, sessionId, event) {
|
|
8194
8219
|
try {
|
|
8195
8220
|
await context.store.appendEvent(sessionId, event);
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
extractStructuredFinalAnswerClaims,
|
|
5
5
|
finalAnswerHasCompletenessClassification,
|
|
6
6
|
hasArchitectureEvidenceForClaims
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NWZ44SFI.js";
|
|
8
8
|
import {
|
|
9
9
|
detectArchitectureDrift
|
|
10
10
|
} from "./chunk-MVONSJEN.js";
|
|
@@ -170,17 +170,44 @@ function isBetaVerdictEvidence(item) {
|
|
|
170
170
|
) || hasReportWriteEvidence([item]);
|
|
171
171
|
}
|
|
172
172
|
function checkClaimSupport(claim, context) {
|
|
173
|
+
const headlessRisk = createHeadlessBenchDiagnosticRiskSummary(context);
|
|
174
|
+
const validationContractRisk = createHeadlessBenchValidationContractRiskSummary(context);
|
|
173
175
|
const structuredClaims = extractStructuredFinalAnswerClaims(claim);
|
|
174
176
|
if (structuredClaims.some((item) => item.kind === "beta_readiness")) {
|
|
175
177
|
return {
|
|
176
178
|
status: "needs_disclaimer",
|
|
177
|
-
unsupportedClaims:
|
|
179
|
+
unsupportedClaims: [
|
|
180
|
+
...structuredClaims.filter((item) => item.kind === "beta_readiness").map((item) => item.phrase),
|
|
181
|
+
...validationContractRisk ? [validationContractRisk] : [],
|
|
182
|
+
...headlessRisk ? [headlessRisk] : []
|
|
183
|
+
],
|
|
178
184
|
verdict: createPhase15BetaVerdictScope(context.evidence)
|
|
179
185
|
};
|
|
180
186
|
}
|
|
181
187
|
if (structuredClaims.length === 0) {
|
|
182
188
|
const nlCheck = detectNaturalLanguageHighRiskClaims(claim);
|
|
183
|
-
if (nlCheck.status !== "passed")
|
|
189
|
+
if (nlCheck.status !== "passed") {
|
|
190
|
+
return {
|
|
191
|
+
...nlCheck,
|
|
192
|
+
unsupportedClaims: [
|
|
193
|
+
...nlCheck.unsupportedClaims,
|
|
194
|
+
...validationContractRisk ? [validationContractRisk] : [],
|
|
195
|
+
...headlessRisk ? [headlessRisk] : []
|
|
196
|
+
]
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
if (validationContractRisk) {
|
|
200
|
+
return {
|
|
201
|
+
status: "needs_disclaimer",
|
|
202
|
+
unsupportedClaims: [validationContractRisk]
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (headlessRisk) {
|
|
206
|
+
return {
|
|
207
|
+
status: "needs_disclaimer",
|
|
208
|
+
unsupportedClaims: [headlessRisk]
|
|
209
|
+
};
|
|
210
|
+
}
|
|
184
211
|
return { status: "passed", unsupportedClaims: [] };
|
|
185
212
|
}
|
|
186
213
|
if (structuredClaims.some(
|
|
@@ -190,19 +217,187 @@ function checkClaimSupport(claim, context) {
|
|
|
190
217
|
if (extended.status === "needs_disclaimer") {
|
|
191
218
|
return {
|
|
192
219
|
status: "needs_disclaimer",
|
|
193
|
-
unsupportedClaims:
|
|
220
|
+
unsupportedClaims: [
|
|
221
|
+
...extended.verdict.matchedClaims.map((item) => item.phrase),
|
|
222
|
+
...validationContractRisk ? [validationContractRisk] : [],
|
|
223
|
+
...headlessRisk ? [headlessRisk] : []
|
|
224
|
+
]
|
|
194
225
|
};
|
|
195
226
|
}
|
|
196
227
|
}
|
|
197
228
|
const verdict = evaluateFinalAnswerClaims(claim, context.evidence);
|
|
198
229
|
if (verdict.status === "passed") {
|
|
230
|
+
if (validationContractRisk) {
|
|
231
|
+
return {
|
|
232
|
+
status: "needs_disclaimer",
|
|
233
|
+
unsupportedClaims: [validationContractRisk]
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
if (headlessRisk) {
|
|
237
|
+
return {
|
|
238
|
+
status: "needs_disclaimer",
|
|
239
|
+
unsupportedClaims: [headlessRisk]
|
|
240
|
+
};
|
|
241
|
+
}
|
|
199
242
|
return { status: "passed", unsupportedClaims: [] };
|
|
200
243
|
}
|
|
201
244
|
return {
|
|
202
245
|
status: "needs_disclaimer",
|
|
203
|
-
unsupportedClaims:
|
|
246
|
+
unsupportedClaims: [
|
|
247
|
+
...structuredClaims.map((item) => item.phrase),
|
|
248
|
+
...validationContractRisk ? [validationContractRisk] : [],
|
|
249
|
+
...headlessRisk ? [headlessRisk] : []
|
|
250
|
+
]
|
|
204
251
|
};
|
|
205
252
|
}
|
|
253
|
+
function createHeadlessBenchValidationContractRiskSummary(context) {
|
|
254
|
+
const tools = context.tools;
|
|
255
|
+
if (tools.headlessBench?.enabled !== true) return void 0;
|
|
256
|
+
const items = tools.validationContract?.items ?? [];
|
|
257
|
+
if (items.length === 0) return void 0;
|
|
258
|
+
const risks = items.map((item) => summarizeValidationContractItemRisk(item, context.evidence)).filter((risk) => Boolean(risk));
|
|
259
|
+
if (risks.length === 0) return void 0;
|
|
260
|
+
return `validation contract needs validation: ${risks.slice(0, 4).join("; ")}`;
|
|
261
|
+
}
|
|
262
|
+
function summarizeValidationContractItemRisk(item, evidence) {
|
|
263
|
+
const matching = collectMatchingValidationEvidence(item, evidence);
|
|
264
|
+
if (matching.some((entry) => entry.ok === true)) {
|
|
265
|
+
if (item.kind === "service" && item.validation === "semantic" && !hasSemanticServiceEvidence(item, matching, evidence)) {
|
|
266
|
+
const subject2 = item.path ?? item.target ?? item.id;
|
|
267
|
+
return `${item.kind} ${subject2} missing semantic response probe evidence; status/readiness alone is not enough`;
|
|
268
|
+
}
|
|
269
|
+
return void 0;
|
|
270
|
+
}
|
|
271
|
+
const subject = item.path ?? item.target ?? item.id;
|
|
272
|
+
if (matching.some((entry) => entry.ok === false)) {
|
|
273
|
+
return `${item.kind} ${subject} failed explicit ${item.requiredTool}; needs_repair before final`;
|
|
274
|
+
}
|
|
275
|
+
return `${item.kind} ${subject} missing explicit ${item.requiredTool}`;
|
|
276
|
+
}
|
|
277
|
+
function collectMatchingValidationEvidence(item, evidence) {
|
|
278
|
+
return evidence.flatMap((record) => readValidationEvidence(record)).filter(
|
|
279
|
+
(entry) => entry.kind === item.kind && entry.tool === item.requiredTool && validationEvidenceSubjectMatches(item, entry)
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
function readValidationEvidence(evidence) {
|
|
283
|
+
if (!evidence.data || typeof evidence.data !== "object") return [];
|
|
284
|
+
const value = evidence.data.validationEvidence;
|
|
285
|
+
if (!Array.isArray(value)) return [];
|
|
286
|
+
return value.map((entry) => entry && typeof entry === "object" ? entry : void 0).filter((entry) => Boolean(entry));
|
|
287
|
+
}
|
|
288
|
+
function validationEvidenceSubjectMatches(item, evidence) {
|
|
289
|
+
if (item.path) return validationPathsMatch(evidence.path, item.path);
|
|
290
|
+
if (item.target) return normalizeValidationTarget(evidence.target) === normalizeValidationTarget(item.target);
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
function validationPathsMatch(evidencePath, contractPath) {
|
|
294
|
+
const evidence = normalizeValidationPath(evidencePath);
|
|
295
|
+
const contract = normalizeValidationPath(contractPath);
|
|
296
|
+
if (!evidence || !contract) return false;
|
|
297
|
+
if (evidence === contract) return true;
|
|
298
|
+
return stripKnownWorkspaceRoot(evidence) === stripKnownWorkspaceRoot(contract);
|
|
299
|
+
}
|
|
300
|
+
function stripKnownWorkspaceRoot(path) {
|
|
301
|
+
for (const prefix of ["/app/", "/workspace/"]) {
|
|
302
|
+
if (path.startsWith(prefix)) return path.slice(prefix.length);
|
|
303
|
+
}
|
|
304
|
+
return path;
|
|
305
|
+
}
|
|
306
|
+
function normalizeValidationPath(path) {
|
|
307
|
+
if (!path) return void 0;
|
|
308
|
+
return path.replace(/\\/gu, "/").replace(/\/$/u, "");
|
|
309
|
+
}
|
|
310
|
+
function normalizeValidationTarget(target) {
|
|
311
|
+
if (!target) return void 0;
|
|
312
|
+
try {
|
|
313
|
+
const url = target.startsWith("http://") || target.startsWith("https://") ? new URL(target) : new URL(`http://${target}`);
|
|
314
|
+
const port = url.port || (url.protocol === "https:" ? "443" : "80");
|
|
315
|
+
const path = target.startsWith("http://") || target.startsWith("https://") ? url.pathname.replace(/\/$/u, "") : "";
|
|
316
|
+
return `${url.hostname}:${port}${path}`;
|
|
317
|
+
} catch {
|
|
318
|
+
return target.replace(/\/$/u, "");
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
function hasSemanticServiceEvidence(item, matching, evidence) {
|
|
322
|
+
const tokens = item.semanticTokens ?? [];
|
|
323
|
+
if (matching.some((entry) => serviceFetchEvidenceHasSemanticChecks(entry, tokens))) return true;
|
|
324
|
+
return evidence.some((record) => commandOrVerificationEvidenceHasSemanticProbe(record, tokens));
|
|
325
|
+
}
|
|
326
|
+
function serviceFetchEvidenceHasSemanticChecks(entry, tokens) {
|
|
327
|
+
if (entry.ok !== true) return false;
|
|
328
|
+
const fetch = readRecord(entry.checks?.fetch);
|
|
329
|
+
const bodyContains = readStringList(fetch?.bodyContains);
|
|
330
|
+
if (bodyContains.length === 0) return false;
|
|
331
|
+
if (tokens.length === 0) return true;
|
|
332
|
+
const haystack = bodyContains.join("\n").toLowerCase();
|
|
333
|
+
return tokens.some((token) => haystack.includes(token.toLowerCase()));
|
|
334
|
+
}
|
|
335
|
+
function commandOrVerificationEvidenceHasSemanticProbe(record, tokens) {
|
|
336
|
+
if (record.kind === "test_result" && record.supportsClaims.includes("verification_passed")) return true;
|
|
337
|
+
if (record.kind !== "command_output") return false;
|
|
338
|
+
if (!record.supportsClaims.includes("bash_exit_0")) return false;
|
|
339
|
+
const semanticProbe = readRecord(readEvidenceDataRecord(record, "semanticProbe"));
|
|
340
|
+
const semanticProbeTokens = readStringList(semanticProbe?.tokens);
|
|
341
|
+
const haystack = `${record.summary}
|
|
342
|
+
${record.source}
|
|
343
|
+
${semanticProbeTokens.join("\n")}`.toLowerCase();
|
|
344
|
+
const matchedTokens = tokens.filter((token) => haystack.includes(token.toLowerCase()));
|
|
345
|
+
return matchedTokens.length >= Math.min(2, tokens.length);
|
|
346
|
+
}
|
|
347
|
+
function readRecord(value) {
|
|
348
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
349
|
+
}
|
|
350
|
+
function readStringList(value) {
|
|
351
|
+
if (typeof value === "string" && value.trim()) return [value];
|
|
352
|
+
if (!Array.isArray(value)) return [];
|
|
353
|
+
return value.filter((item) => typeof item === "string" && item.trim().length > 0);
|
|
354
|
+
}
|
|
355
|
+
function createHeadlessBenchDiagnosticRiskSummary(context) {
|
|
356
|
+
const tools = context.tools;
|
|
357
|
+
if (tools.headlessBench?.enabled !== true) return void 0;
|
|
358
|
+
const risky = (tools.recentDiagnostics ?? []).slice(0, 10).filter(
|
|
359
|
+
(diagnostic) => (diagnostic.severity === "recoverable" || diagnostic.severity === "blocking") && (diagnostic.type === "service_readiness" || diagnostic.type === "artifact_preservation" || diagnostic.type === "binary_tool_missing" || diagnostic.type === "missing_command" || diagnostic.type === "timeout" || diagnostic.type === "provider_or_network") && !isDiagnosticRiskResolved(diagnostic, context.evidence)
|
|
360
|
+
);
|
|
361
|
+
if (risky.length === 0) return void 0;
|
|
362
|
+
return `headless bench risk: ${risky.slice(0, 3).map((diagnostic) => `${diagnostic.type}: ${diagnostic.evidence ?? ""}`.trim()).join("; ")}`;
|
|
363
|
+
}
|
|
364
|
+
function isDiagnosticRiskResolved(diagnostic, evidence) {
|
|
365
|
+
if (diagnostic.type === "service_readiness" || diagnostic.type === "timeout") {
|
|
366
|
+
const target = readDiagnosticServiceTarget(diagnostic);
|
|
367
|
+
if (!target) return false;
|
|
368
|
+
return evidence.some((item) => {
|
|
369
|
+
const serviceHint = readEvidenceDataRecord(item, "serviceHint");
|
|
370
|
+
const service = readEvidenceDataRecord(item, "service");
|
|
371
|
+
return serviceHint?.ready === true && serviceHint.target === target || service?.ready === true && service.target === target;
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
if (diagnostic.type === "artifact_preservation") {
|
|
375
|
+
if (!diagnostic.path) return false;
|
|
376
|
+
return evidence.some((item) => {
|
|
377
|
+
const artifactHint = readEvidenceDataRecord(item, "artifactHint");
|
|
378
|
+
return artifactHint?.exists === true && artifactHint.path === diagnostic.path;
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
if (diagnostic.type === "binary_tool_missing") {
|
|
382
|
+
if (!diagnostic.path) return false;
|
|
383
|
+
return evidence.some(
|
|
384
|
+
(item) => readEvidenceDataRecord(item, "binaryHint")?.path === diagnostic.path || readEvidenceDataRecord(item, "binaryPreflight")?.path === diagnostic.path
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
function readDiagnosticServiceTarget(diagnostic) {
|
|
390
|
+
if (diagnostic.target) return diagnostic.target;
|
|
391
|
+
if (diagnostic.targetHost && diagnostic.targetPort !== void 0) {
|
|
392
|
+
return `${diagnostic.targetHost}:${diagnostic.targetPort}`;
|
|
393
|
+
}
|
|
394
|
+
return void 0;
|
|
395
|
+
}
|
|
396
|
+
function readEvidenceDataRecord(evidence, key) {
|
|
397
|
+
if (!evidence.data || typeof evidence.data !== "object") return void 0;
|
|
398
|
+
const value = evidence.data[key];
|
|
399
|
+
return value && typeof value === "object" ? value : void 0;
|
|
400
|
+
}
|
|
206
401
|
var HIGH_RISK_NL_CLAIM_PATTERNS = [
|
|
207
402
|
// ── Chinese patterns(无 \b,CJK 字符无需 ASCII 单词边界)──
|
|
208
403
|
{
|
|
@@ -299,5 +494,6 @@ export {
|
|
|
299
494
|
createHandoffRiskItems,
|
|
300
495
|
createPhase15BetaVerdictScope,
|
|
301
496
|
checkClaimSupport,
|
|
497
|
+
createHeadlessBenchValidationContractRiskSummary,
|
|
302
498
|
formatClaimCheck
|
|
303
499
|
};
|