@hmharness/agent 0.14.19 → 0.14.20

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/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { mechanicalGate, parseVerdict, runPipeline, type PipelineOptions, type P
5
5
  export { buildSystemPrompt } from './prompt.ts';
6
6
  export { strings, type Locale, type Strings } from './i18n.ts';
7
7
  export { makeSpawnTool, MAX_SPAWN_DEPTH, type SpawnBase } from './spawn.ts';
8
- export { buildRegistry, contextPack, makeApproval, nativeRegistry, runAgentTask, spawnBase, toServerConfig, type AgentTaskOptions, type RunnerEvents, } from './runner.ts';
8
+ export { buildRegistry, contextPack, makeApproval, liveYolo, nativeRegistry, runAgentTask, spawnBase, toServerConfig, type AgentTaskOptions, type RunnerEvents, } from './runner.ts';
9
9
  export * from './skills-conformance.ts';
10
10
  export * from './acp.ts';
11
11
  export * from './topology.ts';
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ export { mechanicalGate, parseVerdict, runPipeline, } from "./pipeline.js";
5
5
  export { buildSystemPrompt } from "./prompt.js";
6
6
  export { strings } from "./i18n.js";
7
7
  export { makeSpawnTool, MAX_SPAWN_DEPTH } from "./spawn.js";
8
- export { buildRegistry, contextPack, makeApproval, nativeRegistry, runAgentTask, spawnBase, toServerConfig, } from "./runner.js";
8
+ export { buildRegistry, contextPack, makeApproval, liveYolo, nativeRegistry, runAgentTask, spawnBase, toServerConfig, } from "./runner.js";
9
9
  export * from "./skills-conformance.js";
10
10
  export * from "./acp.js";
11
11
  export * from "./topology.js";
package/dist/runner.d.ts CHANGED
@@ -66,6 +66,14 @@ export declare function loadApprovedRules(home: string): ApprovedRule[];
66
66
  * path SEGMENT of the extension may be `..` (a boundary-only check missed
67
67
  * `node scripts/sub/../../evil.js`, whose first differing segment is `sub`). */
68
68
  export declare function matchesRule(rules: ApprovedRule[], toolName: string, args: Record<string, unknown>): boolean;
69
+ /** Live unattended-mode override (2026-09-25 user request: "YOLO 需要即时
70
+ * 生效"). Flipping this applies at the VERY NEXT approval ask of any running
71
+ * task - not only from the next session. The web /yolo command and the TUI
72
+ * /yolo toggle both write it AND persist via patchConfig, so it survives
73
+ * restarts (one selection = the standing default). */
74
+ export declare const liveYolo: {
75
+ on: boolean;
76
+ };
69
77
  export declare function makeApproval(cfg: HmhConfig, yes: boolean, sharedRl?: readline.Interface): LoopApproval;
70
78
  export interface RunnerEvents {
71
79
  onLine?(line: string): void;
package/dist/runner.js CHANGED
@@ -187,12 +187,18 @@ export function matchesRule(rules, toolName, args) {
187
187
  }
188
188
  });
189
189
  }
190
+ /** Live unattended-mode override (2026-09-25 user request: "YOLO 需要即时
191
+ * 生效"). Flipping this applies at the VERY NEXT approval ask of any running
192
+ * task - not only from the next session. The web /yolo command and the TUI
193
+ * /yolo toggle both write it AND persist via patchConfig, so it survives
194
+ * restarts (one selection = the standing default). */
195
+ export const liveYolo = { on: false };
190
196
  export function makeApproval(cfg, yes, sharedRl) {
191
197
  const t = strings(cfg.locale ?? 'zh');
192
198
  const home = homeDir();
193
199
  return {
194
200
  async ask(toolName, args) {
195
- if (yes || cfg.approval === 'auto')
201
+ if (yes || cfg.approval === 'auto' || liveYolo.on)
196
202
  return true;
197
203
  // Persistent rules: patterns the user previously approved are auto-passed
198
204
  if (matchesRule(loadApprovedRules(home), toolName, args))
@@ -307,8 +313,10 @@ export async function runAgentTask(opts) {
307
313
  // YOLO fix: when yes=true the caller's approvalAsk (TUI dialog, web remote
308
314
  // gate) must NOT override the auto-approve gate - it used to take
309
315
  // precedence unconditionally, so /yolo was cosmetic (user-reported).
316
+ // 2026-09-25: the live toggle also gates a caller-supplied approvalAsk -
317
+ // the web remote gate is bypassed the moment /yolo goes on, mid-run too.
310
318
  const approval = (opts.approvalAsk && !opts.yes)
311
- ? { ask: opts.approvalAsk }
319
+ ? { ask: async (name, args) => (liveYolo.on ? true : opts.approvalAsk(name, args)) }
312
320
  : makeApproval(cfg, opts.yes === true);
313
321
  spawnBase.current = {
314
322
  provider: resolveProvider(cfg, 'chat'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/agent",
3
- "version": "0.14.19",
3
+ "version": "0.14.20",
4
4
  "description": "hmharness agent execution layer: base tools, system prompt, sub-agent spawn, and the shared task runner that frontends (cli, web) drive.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",