jinzd-ai-cli 0.4.211 → 0.4.213
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/README.md +30 -0
- package/README.zh-CN.md +30 -0
- package/dist/{batch-DE4RXKZD.js → batch-PKY63TME.js} +2 -2
- package/dist/{chat-index-UBCWHBLR.js → chat-index-R2E27VXN.js} +1 -1
- package/dist/{chunk-JBWA73GK.js → chunk-7NTFMLJJ.js} +1 -1
- package/dist/{chunk-C3OU2OPF.js → chunk-FGUKBIYO.js} +2 -2
- package/dist/{chunk-BE6ERF7M.js → chunk-G3PW3AOB.js} +1 -1
- package/dist/{chunk-E5XCM4A6.js → chunk-IWLVH32D.js} +1 -1
- package/dist/{chunk-ZY2N2N6T.js → chunk-J35V3IAH.js} +1 -1
- package/dist/{chunk-UOROWTGG.js → chunk-MRGWPCFQ.js} +26 -3
- package/dist/{chunk-W7UKO3PS.js → chunk-OQGVGPEK.js} +5 -0
- package/dist/{chunk-ZOPYREL5.js → chunk-THNECAAY.js} +464 -67
- package/dist/{chunk-6NS6643Y.js → chunk-UDMU4FUF.js} +1 -1
- package/dist/{ci-XMUEX526.js → ci-HBZ6CIW5.js} +2 -2
- package/dist/{constants-AWTIQIWG.js → constants-CAUBTSFW.js} +1 -1
- package/dist/{doctor-cli-SSI6ETFT.js → doctor-cli-5Z5UWYW6.js} +4 -4
- package/dist/electron-server.js +794 -241
- package/dist/{hub-INUJND2G.js → hub-ZRADBR76.js} +1 -1
- package/dist/index.js +205 -19
- package/dist/{run-tests-PACN4UYX.js → run-tests-7J3PNWVS.js} +1 -1
- package/dist/{run-tests-3MHWUF43.js → run-tests-DSOJBJWA.js} +2 -2
- package/dist/{server-7USZJJAH.js → server-PWBWHVYB.js} +4 -4
- package/dist/{server-BTSKOPQI.js → server-U4I7RI42.js} +175 -10
- package/dist/{task-orchestrator-OV4O25MX.js → task-orchestrator-RUXWRMQV.js} +4 -4
- package/dist/{usage-T2P6FTE7.js → usage-2P6TIBTN.js} +2 -2
- package/dist/web/client/app.js +1 -1
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
scanDirTree,
|
|
25
25
|
scanProject,
|
|
26
26
|
setupProxy
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-FGUKBIYO.js";
|
|
28
28
|
import {
|
|
29
29
|
buildReviewPrompt,
|
|
30
30
|
buildSecurityReviewPrompt
|
|
@@ -36,12 +36,18 @@ import {
|
|
|
36
36
|
checkNetworkPolicy,
|
|
37
37
|
checkPermissionWithProfile,
|
|
38
38
|
cleanupRejectedTeeFile,
|
|
39
|
+
clearRecentlyDeniedAutoActions,
|
|
40
|
+
defaultActionClassifier,
|
|
39
41
|
estimateTokens,
|
|
40
42
|
formatPermissionProfileWarning,
|
|
43
|
+
getPendingHookTrust,
|
|
44
|
+
getRecentlyDeniedAutoActions,
|
|
41
45
|
googleSearchContext,
|
|
42
46
|
groupCallsByPhase,
|
|
47
|
+
recordRecentlyDeniedAutoAction,
|
|
43
48
|
renderDiff,
|
|
44
49
|
runHook,
|
|
50
|
+
runLifecycleHooks,
|
|
45
51
|
runSafePhases,
|
|
46
52
|
runWithSessionKey,
|
|
47
53
|
setContextWindow,
|
|
@@ -49,10 +55,10 @@ import {
|
|
|
49
55
|
spawnAgentContext,
|
|
50
56
|
truncateOutput,
|
|
51
57
|
undoStack
|
|
52
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-THNECAAY.js";
|
|
53
59
|
import "./chunk-T2NL5ZIA.js";
|
|
54
60
|
import "./chunk-BXP6YZ2P.js";
|
|
55
|
-
import "./chunk-
|
|
61
|
+
import "./chunk-UDMU4FUF.js";
|
|
56
62
|
import {
|
|
57
63
|
SessionManager,
|
|
58
64
|
getContentText
|
|
@@ -66,7 +72,7 @@ import {
|
|
|
66
72
|
} from "./chunk-QMXC327F.js";
|
|
67
73
|
import {
|
|
68
74
|
runTool
|
|
69
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-7NTFMLJJ.js";
|
|
70
76
|
import {
|
|
71
77
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
72
78
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -85,7 +91,7 @@ import {
|
|
|
85
91
|
} from "./chunk-XPBEJB27.js";
|
|
86
92
|
import {
|
|
87
93
|
ConfigManager
|
|
88
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-MRGWPCFQ.js";
|
|
89
95
|
import "./chunk-TZQHYZKT.js";
|
|
90
96
|
import {
|
|
91
97
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
@@ -104,7 +110,7 @@ import {
|
|
|
104
110
|
SKILLS_DIR_NAME,
|
|
105
111
|
VERSION,
|
|
106
112
|
buildUserIdentityPrompt
|
|
107
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-IWLVH32D.js";
|
|
108
114
|
import {
|
|
109
115
|
formatGitContextForPrompt,
|
|
110
116
|
getGitContext,
|
|
@@ -113,7 +119,9 @@ import {
|
|
|
113
119
|
import "./chunk-4BKXL7SM.js";
|
|
114
120
|
import "./chunk-TB4W4Y4T.js";
|
|
115
121
|
import "./chunk-KHYD3WXE.js";
|
|
116
|
-
import
|
|
122
|
+
import {
|
|
123
|
+
scanString
|
|
124
|
+
} from "./chunk-SLSWPBK3.js";
|
|
117
125
|
import "./chunk-K3CF65QH.js";
|
|
118
126
|
import "./chunk-CKH4KQ4E.js";
|
|
119
127
|
import {
|
|
@@ -147,6 +155,7 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
147
155
|
allowedPermissionProfiles = [];
|
|
148
156
|
workspaceRoot = process.cwd();
|
|
149
157
|
networkPolicy;
|
|
158
|
+
hookConfigDir = process.cwd();
|
|
150
159
|
/** Pending confirm promises keyed by requestId */
|
|
151
160
|
pendingConfirms = /* @__PURE__ */ new Map();
|
|
152
161
|
/** Pending batch confirm promises */
|
|
@@ -159,6 +168,8 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
159
168
|
confirming = false;
|
|
160
169
|
/** Session-level auto-approve toggle (/yolo command) */
|
|
161
170
|
sessionAutoApprove = false;
|
|
171
|
+
/** Session-level Auto Mode: rule-based low-risk auto approval. */
|
|
172
|
+
sessionAutoMode = false;
|
|
162
173
|
/** Track tool start times for duration calculation */
|
|
163
174
|
toolStartTimes = /* @__PURE__ */ new Map();
|
|
164
175
|
/**
|
|
@@ -186,6 +197,7 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
186
197
|
if (opts.allowedPermissionProfiles) this.allowedPermissionProfiles = opts.allowedPermissionProfiles;
|
|
187
198
|
if (opts.workspaceRoot) this.workspaceRoot = opts.workspaceRoot;
|
|
188
199
|
if (opts.networkPolicy) this.networkPolicy = opts.networkPolicy;
|
|
200
|
+
if (opts.hookConfigDir) this.hookConfigDir = opts.hookConfigDir;
|
|
189
201
|
}
|
|
190
202
|
/** Clear M7 timeout timer for a requestId */
|
|
191
203
|
clearPendingTimer(requestId) {
|
|
@@ -234,7 +246,6 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
234
246
|
}
|
|
235
247
|
sendToolCallStart(call) {
|
|
236
248
|
const dangerLevel = getDangerLevel(call.name, call.arguments);
|
|
237
|
-
let toolCallStarted = false;
|
|
238
249
|
const startTime = Date.now();
|
|
239
250
|
this.toolStartTimes.set(call.id, startTime);
|
|
240
251
|
const msg = {
|
|
@@ -349,6 +360,26 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
349
360
|
dangerLevel,
|
|
350
361
|
args: JSON.stringify(call.arguments).slice(0, 200)
|
|
351
362
|
});
|
|
363
|
+
const preToolDecisions = runLifecycleHooks(
|
|
364
|
+
this.hookConfig,
|
|
365
|
+
"PreToolUse",
|
|
366
|
+
{ tool: call.name, dangerLevel, args: call.arguments },
|
|
367
|
+
{ configDir: this.hookConfigDir, onSummary: (message) => this.send({ type: "info", message: `[hook] ${message}` }) }
|
|
368
|
+
);
|
|
369
|
+
const preDeny = preToolDecisions.find((d) => d.action === "deny");
|
|
370
|
+
if (preDeny) {
|
|
371
|
+
const result = {
|
|
372
|
+
callId: call.id,
|
|
373
|
+
content: `[Hook denied] ${preDeny.reason ?? `PreToolUse blocked ${call.name}`}. Do not retry without asking.`,
|
|
374
|
+
isError: true
|
|
375
|
+
};
|
|
376
|
+
this.sendToolCallResult(call, result.content, true);
|
|
377
|
+
return result;
|
|
378
|
+
}
|
|
379
|
+
for (const d of preToolDecisions) {
|
|
380
|
+
const warnings = [d.warning, ...d.warnings ?? []].filter(Boolean);
|
|
381
|
+
for (const warning of warnings) this.send({ type: "info", message: `[hook] ${warning}` });
|
|
382
|
+
}
|
|
352
383
|
const permission = checkPermissionWithProfile(
|
|
353
384
|
call.name,
|
|
354
385
|
call.arguments,
|
|
@@ -364,6 +395,14 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
364
395
|
}
|
|
365
396
|
);
|
|
366
397
|
const networkPermission = checkNetworkPolicy(call.name, call.arguments, this.networkPolicy);
|
|
398
|
+
if (networkPermission?.action === "confirm" || permission.action === "confirm") {
|
|
399
|
+
runLifecycleHooks(
|
|
400
|
+
this.hookConfig,
|
|
401
|
+
"PermissionRequest",
|
|
402
|
+
{ tool: call.name, dangerLevel, args: call.arguments, reason: networkPermission?.reason ?? permission.reason },
|
|
403
|
+
{ configDir: this.hookConfigDir, onSummary: (message) => this.send({ type: "info", message: "[hook] " + message }) }
|
|
404
|
+
);
|
|
405
|
+
}
|
|
367
406
|
if (networkPermission?.action === "deny") {
|
|
368
407
|
const reason = networkPermission.reason ? ` (${networkPermission.reason})` : "";
|
|
369
408
|
return {
|
|
@@ -387,11 +426,13 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
387
426
|
const content = truncateOutput(rawContent, call.name);
|
|
388
427
|
this.sendToolCallResult(call, rawContent, false);
|
|
389
428
|
runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "ok" });
|
|
429
|
+
runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
|
|
390
430
|
return { callId: call.id, content, isError: false };
|
|
391
431
|
} catch (err) {
|
|
392
432
|
const message = err instanceof Error ? err.message : String(err);
|
|
393
433
|
this.sendToolCallResult(call, message, true);
|
|
394
434
|
runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
|
|
435
|
+
runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
|
|
395
436
|
return { callId: call.id, content: message, isError: true };
|
|
396
437
|
}
|
|
397
438
|
}
|
|
@@ -406,17 +447,48 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
406
447
|
}
|
|
407
448
|
}
|
|
408
449
|
this.sendToolCallStart(call);
|
|
450
|
+
if (this.sessionAutoMode && networkPermission?.action !== "confirm") {
|
|
451
|
+
const classification = defaultActionClassifier.classify(call, dangerLevel, {
|
|
452
|
+
workspaceRoot: this.workspaceRoot,
|
|
453
|
+
tempDirs: [tmpdir()]
|
|
454
|
+
});
|
|
455
|
+
if (classification.decision === "deny") {
|
|
456
|
+
recordRecentlyDeniedAutoAction(call, classification);
|
|
457
|
+
const rejectionMsg = `[Auto denied] ${classification.reason}. Do not retry without asking.`;
|
|
458
|
+
this.sendToolCallResult(call, rejectionMsg, true);
|
|
459
|
+
return { callId: call.id, content: rejectionMsg, isError: true };
|
|
460
|
+
}
|
|
461
|
+
if (classification.decision === "auto-approve") {
|
|
462
|
+
this.send({ type: "info", message: `\u26A1 Auto-approved (/auto: ${classification.ruleId})` });
|
|
463
|
+
try {
|
|
464
|
+
const rawContent = await runTool(tool, call.arguments, call.name);
|
|
465
|
+
const content = truncateOutput(rawContent, call.name);
|
|
466
|
+
this.sendToolCallResult(call, rawContent, false);
|
|
467
|
+
runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "ok" });
|
|
468
|
+
runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
|
|
469
|
+
return { callId: call.id, content, isError: false };
|
|
470
|
+
} catch (err) {
|
|
471
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
472
|
+
this.sendToolCallResult(call, message, true);
|
|
473
|
+
runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
|
|
474
|
+
runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
|
|
475
|
+
return { callId: call.id, content: message, isError: true };
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
409
479
|
if (this.sessionAutoApprove && dangerLevel === "write") {
|
|
410
480
|
try {
|
|
411
481
|
const rawContent = await runTool(tool, call.arguments, call.name);
|
|
412
482
|
const content = truncateOutput(rawContent, call.name);
|
|
413
483
|
this.sendToolCallResult(call, rawContent, false);
|
|
414
484
|
runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "ok" });
|
|
485
|
+
runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
|
|
415
486
|
return { callId: call.id, content, isError: false };
|
|
416
487
|
} catch (err) {
|
|
417
488
|
const message = err instanceof Error ? err.message : String(err);
|
|
418
489
|
this.sendToolCallResult(call, message, true);
|
|
419
490
|
runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
|
|
491
|
+
runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
|
|
420
492
|
return { callId: call.id, content: message, isError: true };
|
|
421
493
|
}
|
|
422
494
|
}
|
|
@@ -434,11 +506,13 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
434
506
|
const content = truncateOutput(rawContent, call.name);
|
|
435
507
|
this.sendToolCallResult(call, rawContent, false);
|
|
436
508
|
runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "ok" });
|
|
509
|
+
runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
|
|
437
510
|
return { callId: call.id, content, isError: false };
|
|
438
511
|
} catch (err) {
|
|
439
512
|
const message = err instanceof Error ? err.message : String(err);
|
|
440
513
|
this.sendToolCallResult(call, message, true);
|
|
441
514
|
runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
|
|
515
|
+
runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
|
|
442
516
|
return { callId: call.id, content: message, isError: true };
|
|
443
517
|
}
|
|
444
518
|
}
|
|
@@ -681,6 +755,7 @@ var SessionHandler = class {
|
|
|
681
755
|
const permissionProfiles = this.config.get("permissionProfiles") ?? {};
|
|
682
756
|
this.toolExecutor.setConfig({
|
|
683
757
|
hookConfig: hooks,
|
|
758
|
+
hookConfigDir: this.config.getConfigDir(),
|
|
684
759
|
permissionRules,
|
|
685
760
|
defaultPermission,
|
|
686
761
|
permissionProfileName,
|
|
@@ -693,6 +768,11 @@ var SessionHandler = class {
|
|
|
693
768
|
if (permissionProfileWarning) {
|
|
694
769
|
this.send({ type: "info", message: permissionProfileWarning });
|
|
695
770
|
}
|
|
771
|
+
const pendingHooks = getPendingHookTrust(hooks, this.config.getConfigDir());
|
|
772
|
+
if (pendingHooks.length > 0) {
|
|
773
|
+
this.send({ type: "info", message: `${pendingHooks.length} project hook(s) require trust. Use /hooks list and /hooks trust <id>.` });
|
|
774
|
+
}
|
|
775
|
+
runLifecycleHooks(hooks, "SessionStart", { source: "web" }, { configDir: this.config.getConfigDir() });
|
|
696
776
|
this.sendStatus();
|
|
697
777
|
askUserContext.rl = null;
|
|
698
778
|
askUserContext.prompting = false;
|
|
@@ -801,6 +881,7 @@ var SessionHandler = class {
|
|
|
801
881
|
}
|
|
802
882
|
}
|
|
803
883
|
onDisconnect() {
|
|
884
|
+
runLifecycleHooks(this.config.get("hooks") ?? void 0, "Stop", { sessionId: this.sessions.current?.id }, { configDir: this.config.getConfigDir() });
|
|
804
885
|
this.toolExecutor.cancelAll();
|
|
805
886
|
if (this.abortController) this.abortController.abort();
|
|
806
887
|
for (const resolve3 of this.pendingAskUser.values()) resolve3(null);
|
|
@@ -978,6 +1059,26 @@ var SessionHandler = class {
|
|
|
978
1059
|
try {
|
|
979
1060
|
this.ensureSession();
|
|
980
1061
|
const session = this.sessions.current;
|
|
1062
|
+
const promptDecisions = runLifecycleHooks(
|
|
1063
|
+
this.config.get("hooks") ?? void 0,
|
|
1064
|
+
"UserPromptSubmit",
|
|
1065
|
+
{ sessionId: session.id, prompt: content },
|
|
1066
|
+
{ configDir: this.config.getConfigDir(), onSummary: (message) => this.send({ type: "info", message: "[hook] " + message }) }
|
|
1067
|
+
);
|
|
1068
|
+
const promptDeny = promptDecisions.find((d) => d.action === "deny");
|
|
1069
|
+
if (promptDeny) {
|
|
1070
|
+
this.send({ type: "error", message: "Prompt blocked by hook: " + (promptDeny.reason ?? "UserPromptSubmit denied") });
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
for (const d of promptDecisions) {
|
|
1074
|
+
const warnings = [d.warning, ...d.warnings ?? []].filter(Boolean);
|
|
1075
|
+
for (const warning of warnings) this.send({ type: "info", message: "[hook] " + warning });
|
|
1076
|
+
}
|
|
1077
|
+
const secretHits = scanString(content, { customRegexes: [] });
|
|
1078
|
+
if (secretHits.length > 0) {
|
|
1079
|
+
const kinds = [...new Set(secretHits.map((h) => h.kind))].join(", ");
|
|
1080
|
+
this.send({ type: "info", message: "Possible secret in prompt (" + kinds + ")." });
|
|
1081
|
+
}
|
|
981
1082
|
const ALLOWED_IMAGE_MIMES = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml"]);
|
|
982
1083
|
const MAX_IMAGE_SIZE = 10 * 1024 * 1024;
|
|
983
1084
|
let msgContent;
|
|
@@ -1915,6 +2016,47 @@ ${activated.meta.description || ""}` });
|
|
|
1915
2016
|
break;
|
|
1916
2017
|
}
|
|
1917
2018
|
// ── /yolo ──────────────────────────────────────────────────────
|
|
2019
|
+
case "auto": {
|
|
2020
|
+
const sub = args[0]?.toLowerCase() ?? "status";
|
|
2021
|
+
if (sub === "on") {
|
|
2022
|
+
this.toolExecutor.sessionAutoMode = true;
|
|
2023
|
+
this.send({ type: "info", message: "\u26A1 Auto Mode ON \u2014 low-risk actions may auto-run; high-risk actions still confirm or deny. Auto Mode is session-scoped." });
|
|
2024
|
+
} else if (sub === "off") {
|
|
2025
|
+
this.toolExecutor.sessionAutoMode = false;
|
|
2026
|
+
this.send({ type: "info", message: "Auto Mode disabled." });
|
|
2027
|
+
} else if (sub === "status") {
|
|
2028
|
+
this.send({ type: "info", message: `Auto Mode: ${this.toolExecutor.sessionAutoMode ? "on" : "off"}
|
|
2029
|
+
Scope: current session only
|
|
2030
|
+
Denied: /permissions recently-denied` });
|
|
2031
|
+
} else {
|
|
2032
|
+
this.send({ type: "error", message: "Usage: /auto [on|off|status]" });
|
|
2033
|
+
}
|
|
2034
|
+
this.sendStatus();
|
|
2035
|
+
break;
|
|
2036
|
+
}
|
|
2037
|
+
case "permissions": {
|
|
2038
|
+
const sub = args[0]?.toLowerCase() ?? "recently-denied";
|
|
2039
|
+
if (sub === "recently-denied") {
|
|
2040
|
+
const rows = getRecentlyDeniedAutoActions();
|
|
2041
|
+
if (rows.length === 0) {
|
|
2042
|
+
this.send({ type: "info", message: "No recently denied Auto Mode actions." });
|
|
2043
|
+
} else {
|
|
2044
|
+
const lines = [`Recently denied Auto Mode actions (${rows.length})`, ""];
|
|
2045
|
+
for (const r of rows.slice(0, 20)) {
|
|
2046
|
+
lines.push(`- ${r.timestamp} ${r.tool} ${r.ruleId}`);
|
|
2047
|
+
lines.push(` ${r.reason}`);
|
|
2048
|
+
lines.push(` ${r.argsPreview}`);
|
|
2049
|
+
}
|
|
2050
|
+
this.send({ type: "info", message: lines.join("\n") });
|
|
2051
|
+
}
|
|
2052
|
+
} else if (sub === "clear-denied") {
|
|
2053
|
+
clearRecentlyDeniedAutoActions();
|
|
2054
|
+
this.send({ type: "info", message: "Cleared recently denied Auto Mode actions." });
|
|
2055
|
+
} else {
|
|
2056
|
+
this.send({ type: "error", message: "Usage: /permissions recently-denied|clear-denied" });
|
|
2057
|
+
}
|
|
2058
|
+
break;
|
|
2059
|
+
}
|
|
1918
2060
|
case "yolo": {
|
|
1919
2061
|
const sub = args[0]?.toLowerCase();
|
|
1920
2062
|
if (sub === "off") {
|
|
@@ -2533,7 +2675,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
2533
2675
|
case "test": {
|
|
2534
2676
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
2535
2677
|
try {
|
|
2536
|
-
const { executeTests } = await import("./run-tests-
|
|
2678
|
+
const { executeTests } = await import("./run-tests-DSOJBJWA.js");
|
|
2537
2679
|
const argStr = args.join(" ").trim();
|
|
2538
2680
|
let testArgs = {};
|
|
2539
2681
|
if (argStr) {
|
|
@@ -2883,6 +3025,21 @@ Add .md files to create commands.` });
|
|
|
2883
3025
|
this.send({ type: "info", message: "Not enough messages to compact." });
|
|
2884
3026
|
return;
|
|
2885
3027
|
}
|
|
3028
|
+
const preDecisions = runLifecycleHooks(
|
|
3029
|
+
this.config.get("hooks") ?? void 0,
|
|
3030
|
+
"PreCompact",
|
|
3031
|
+
{ sessionId: session.id, messageCount: session.messages.length, instruction },
|
|
3032
|
+
{ configDir: this.config.getConfigDir(), onSummary: (message) => this.send({ type: "info", message: "[hook] " + message }) }
|
|
3033
|
+
);
|
|
3034
|
+
const preDeny = preDecisions.find((d) => d.action === "deny");
|
|
3035
|
+
if (preDeny) {
|
|
3036
|
+
this.send({ type: "error", message: "Compact blocked by hook: " + (preDeny.reason ?? "PreCompact denied") });
|
|
3037
|
+
return;
|
|
3038
|
+
}
|
|
3039
|
+
for (const d of preDecisions) {
|
|
3040
|
+
const warnings = [d.warning, ...d.warnings ?? []].filter(Boolean);
|
|
3041
|
+
for (const warning of warnings) this.send({ type: "info", message: "[hook] " + warning });
|
|
3042
|
+
}
|
|
2886
3043
|
const provider = this.providers.get(this.currentProvider);
|
|
2887
3044
|
if (!provider) return;
|
|
2888
3045
|
this.send({ type: "info", message: "Compacting conversation..." });
|
|
@@ -2902,7 +3059,15 @@ Add .md files to create commands.` });
|
|
|
2902
3059
|
});
|
|
2903
3060
|
const summaryMsg = { role: "user", content: "[Conversation summary]", timestamp: /* @__PURE__ */ new Date() };
|
|
2904
3061
|
const ackMsg = { role: "assistant", content: response.content, timestamp: /* @__PURE__ */ new Date() };
|
|
2905
|
-
session.
|
|
3062
|
+
const beforeCount = session.messages.length;
|
|
3063
|
+
const removedCount = session.compact(summaryMsg, ackMsg, keepLast);
|
|
3064
|
+
const afterCount = session.messages.length;
|
|
3065
|
+
runLifecycleHooks(
|
|
3066
|
+
this.config.get("hooks") ?? void 0,
|
|
3067
|
+
"PostCompact",
|
|
3068
|
+
{ sessionId: session.id, beforeCount, afterCount, removedCount, keepLast, instruction },
|
|
3069
|
+
{ configDir: this.config.getConfigDir(), onSummary: (message) => this.send({ type: "info", message: "[hook] " + message }) }
|
|
3070
|
+
);
|
|
2906
3071
|
this.send({ type: "info", message: `Compacted: removed ${toSummarize.length} messages, kept last ${keepLast}.` });
|
|
2907
3072
|
this.sendStatus();
|
|
2908
3073
|
} catch (err) {
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
ToolRegistry,
|
|
4
4
|
googleSearchContext,
|
|
5
5
|
truncateOutput
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-THNECAAY.js";
|
|
7
7
|
import "./chunk-T2NL5ZIA.js";
|
|
8
8
|
import "./chunk-BXP6YZ2P.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-UDMU4FUF.js";
|
|
10
10
|
import {
|
|
11
11
|
runTool
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7NTFMLJJ.js";
|
|
13
13
|
import {
|
|
14
14
|
getDangerLevel,
|
|
15
15
|
runLeanAgentLoop
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import "./chunk-TZQHYZKT.js";
|
|
18
18
|
import {
|
|
19
19
|
SUBAGENT_ALLOWED_TOOLS
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-IWLVH32D.js";
|
|
21
21
|
import "./chunk-4BKXL7SM.js";
|
|
22
22
|
import "./chunk-TB4W4Y4T.js";
|
|
23
23
|
import "./chunk-KHYD3WXE.js";
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
} from "./chunk-E44DTERW.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigManager
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MRGWPCFQ.js";
|
|
12
12
|
import "./chunk-TZQHYZKT.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-IWLVH32D.js";
|
|
14
14
|
import "./chunk-IW3Q7AE5.js";
|
|
15
15
|
|
|
16
16
|
// src/cli/usage.ts
|
package/dist/web/client/app.js
CHANGED
|
@@ -548,7 +548,7 @@ function handleStatus(msg) {
|
|
|
548
548
|
// Active tab: full UI reflection
|
|
549
549
|
btnThink.classList.toggle('btn-active-toggle', msg.thinkingMode);
|
|
550
550
|
btnPlan.classList.toggle('btn-active-toggle', msg.planMode);
|
|
551
|
-
statusSession.textContent = '📋 ' + (msg.sessionId?.slice(0, 8) || '—') + ' (' + msg.messageCount + ' msgs) · ' + (msg.permissionProfile || 'legacy') + (msg.networkPolicyEnabled ? ' · net:on' : '');
|
|
551
|
+
statusSession.textContent = '📋 ' + (msg.sessionId?.slice(0, 8) || '—') + ' (' + msg.messageCount + ' msgs) · ' + (msg.permissionProfile || 'legacy') + (msg.networkPolicyEnabled ? ' · net:on' : '') + (msg.autoMode ? ' · auto:on' : '') + (msg.pendingHookTrustCount ? ' · hooks:' + msg.pendingHookTrustCount : '');
|
|
552
552
|
if (msg.tokenUsage) {
|
|
553
553
|
const u = msg.tokenUsage;
|
|
554
554
|
const cacheRead = u.cacheReadTokens || 0;
|