blun-king-cli 9.1.642 → 9.1.643

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/blun.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  // BLUN_BUILD_INPUT_SHA256:e50c78300e52dc6fc7d8003478fe2fa01fe7fdff8b1a749e108e6627de244e7e
3
+ import toolLiveness642 from "./tool-liveness642/index.cjs";
3
4
  /*! wasm-webp 0.1.0
4
5
  MIT License
5
6
 
@@ -185288,7 +185289,8 @@ var init_background = __esmMin((() => {
185288
185289
  * Wait for a task to reach a terminal state.
185289
185290
  * Returns immediately if already terminal. Times out after `timeoutMs`.
185290
185291
  */
185291
- async wait(taskId, timeoutMs = 3e4) {
185292
+ async wait(taskId, timeoutMs = 3e4, signal) {
185293
+ signal?.throwIfAborted();
185292
185294
  const entry = this.tasks.get(taskId);
185293
185295
  if (!entry) return void 0;
185294
185296
  if (TERMINAL_STATUSES.has(entry.status)) {
@@ -185297,7 +185299,7 @@ var init_background = __esmMin((() => {
185297
185299
  }
185298
185300
  if (timeoutMs <= 0) return this.toInfo(entry);
185299
185301
  const timeout = timeoutOutcome(timeoutMs, void 0);
185300
- await Promise.race([entry.terminal, timeout]).finally(() => timeout.clear());
185302
+ await toolLiveness642.waitForTaskTerminal(entry.terminal, timeout, signal);
185301
185303
  if (TERMINAL_STATUSES.has(entry.status)) await entry.persistWriteQueue;
185302
185304
  return this.toInfo(entry);
185303
185305
  }
@@ -257026,6 +257028,7 @@ function fullOutputHint(output) {
257026
257028
  }
257027
257029
  var OUTPUT_PREVIEW_BYTES, PAGING_HINT_LINES, TaskOutputInputSchema, TaskOutputTool;
257028
257030
  var init_task_output = __esmMin((() => {
257031
+ init_input_control();
257029
257032
  init_zod$1();
257030
257033
  init_background();
257031
257034
  init_input_schema();
@@ -257052,16 +257055,27 @@ var init_task_output = __esmMin((() => {
257052
257055
  description: `Reading output of task ${args.task_id}`,
257053
257056
  approvalRule: this.name,
257054
257057
  matchesRule: (ruleArgs) => matchesGlobRuleSubject(ruleArgs, args.task_id),
257055
- execute: () => this.execute(args)
257058
+ execute: ({ signal }) => this.execute(args, signal)
257056
257059
  };
257057
257060
  }
257058
- async execute(args) {
257061
+ async execute(args, signal = new AbortController().signal) {
257062
+ signal.throwIfAborted();
257063
+ const control642 = inputControl(signal);
257064
+ const epoch642 = control642.epoch;
257065
+ let waitReleasedForInput642 = false;
257059
257066
  const info = this.manager.getTask(args.task_id);
257060
257067
  if (!info) return {
257061
257068
  isError: true,
257062
257069
  output: `Task not found: ${args.task_id}`
257063
257070
  };
257064
- if (args.block && !isBackgroundTaskTerminal(info.status)) await this.manager.wait(args.task_id, (args.timeout ?? 30) * 1e3);
257071
+ if (args.block && !isBackgroundTaskTerminal(info.status)) {
257072
+ waitReleasedForInput642 = await toolLiveness642.waitForTaskInput({
257073
+ manager: this.manager, taskId: args.task_id,
257074
+ timeoutMs: (args.timeout ?? 30) * 1e3, signal,
257075
+ control: control642, initialEpoch: epoch642
257076
+ }) === "input";
257077
+ }
257078
+ signal.throwIfAborted();
257065
257079
  const current = this.manager.getTask(args.task_id);
257066
257080
  if (!current) return {
257067
257081
  isError: true,
@@ -257069,7 +257083,8 @@ var init_task_output = __esmMin((() => {
257069
257083
  };
257070
257084
  const output = await this.manager.getOutputSnapshot(args.task_id, OUTPUT_PREVIEW_BYTES);
257071
257085
  const lines = [formatPlainObject({
257072
- retrievalStatus: retrievalStatus(current.status, args.block),
257086
+ retrievalStatus: retrievalStatus(current.status, args.block && !waitReleasedForInput642),
257087
+ waitReleasedForInput: waitReleasedForInput642 || void 0,
257073
257088
  ...current,
257074
257089
  outputPath: output.outputPath,
257075
257090
  terminalReason: terminalReason(current),
@@ -257485,6 +257500,7 @@ function buildSubagentDescriptions(subagents) {
257485
257500
  }
257486
257501
  var AgentToolInputSchema, BACKGROUND_AGENT_UNAVAILABLE, AgentTool, USER_INTERRUPTED_SUBAGENT_MESSAGE;
257487
257502
  var init_agent$1 = __esmMin((() => {
257503
+ init_input_control();
257488
257504
  init_zod$1();
257489
257505
  init_tool_access();
257490
257506
  init_errors$5();
@@ -257558,6 +257574,8 @@ var init_agent$1 = __esmMin((() => {
257558
257574
  };
257559
257575
  }
257560
257576
  async execution(args, { toolCallId, signal }) {
257577
+ const control642 = inputControl(signal);
257578
+ const epoch642 = control642.epoch;
257561
257579
  try {
257562
257580
  signal.throwIfAborted();
257563
257581
  const runInBackground = args.run_in_background === true;
@@ -257625,8 +257643,16 @@ var init_agent$1 = __esmMin((() => {
257625
257643
  };
257626
257644
  }
257627
257645
  if (runInBackground) return { output: formatBackgroundAgentResult(taskId, handle, args.description, this.allowBackground) };
257628
- if (await this.backgroundManager.waitForForegroundRelease(taskId) === "detached") return { output: formatBackgroundAgentResult(taskId, handle, args.description, this.allowBackground) };
257629
- return await this.formatForegroundResult(taskId, handle);
257646
+ const inputYield642 = toolLiveness642.createForegroundYield({
257647
+ control: control642, initialEpoch: epoch642, signal,
257648
+ enabled: this.allowBackground, idleMs: 0,
257649
+ detach: () => this.backgroundManager.detach(taskId),
257650
+ onError: error => this.log?.warn("Could not background active agent", { error })
257651
+ });
257652
+ try {
257653
+ if (await this.backgroundManager.waitForForegroundRelease(taskId) === "detached") return { output: formatBackgroundAgentResult(taskId, handle, args.description, this.allowBackground) };
257654
+ return await this.formatForegroundResult(taskId, handle);
257655
+ } finally { inputYield642.dispose(); }
257630
257656
  } catch (error) {
257631
257657
  return {
257632
257658
  output: `subagent error: ${launchErrorMessage(error, signal)}`,
@@ -267509,6 +267535,7 @@ function rewriteWindowsNullRedirect(command) {
267509
267535
  }
267510
267536
  var MS_PER_SECOND, DEFAULT_TIMEOUT_S, MAX_TIMEOUT_S, DEFAULT_BACKGROUND_TIMEOUT_S, MAX_BACKGROUND_TIMEOUT_S, USER_INTERRUPT_REASON, BashInputSchema, SHELL_TIMEOUT_VARS, BashTool, WINDOWS_NUL_REDIRECT;
267511
267537
  var init_bash = __esmMin((() => {
267538
+ init_input_control();
267512
267539
  init_zod$1();
267513
267540
  init_background();
267514
267541
  init_render_prompt();
@@ -267672,6 +267699,9 @@ var init_bash = __esmMin((() => {
267672
267699
  return this.kaos.execWithEnv(shellArgs, mergedEnv);
267673
267700
  }
267674
267701
  async execution(args, signal, onUpdate, onForegroundTaskStart) {
267702
+ const inputControl642 = inputControl(signal);
267703
+ const inputEpoch642 = inputControl642.epoch;
267704
+ let foregroundYield642;
267675
267705
  const validationError = this.validateRunRequest(args, signal);
267676
267706
  if (validationError !== void 0) return validationError;
267677
267707
  const startsInBackground = args.run_in_background === true;
@@ -267696,6 +267726,7 @@ var init_bash = __esmMin((() => {
267696
267726
  let foregroundTaskId;
267697
267727
  const onProcessOutput = startsInBackground ? void 0 : (kind, text) => {
267698
267728
  if (!collectForegroundOutput) return;
267729
+ if (text.length > 0) foregroundYield642?.touch();
267699
267730
  onUpdate?.({
267700
267731
  kind,
267701
267732
  text
@@ -267725,6 +267756,13 @@ var init_bash = __esmMin((() => {
267725
267756
  };
267726
267757
  }
267727
267758
  if (!startsInBackground) onForegroundTaskStart?.(taskId);
267759
+ foregroundYield642 = toolLiveness642.createForegroundYield({
267760
+ control: inputControl642, initialEpoch: inputEpoch642, signal,
267761
+ enabled: !startsInBackground && this.allowBackground,
267762
+ detach: () => this.backgroundManager.detach(taskId),
267763
+ onError: () => onUpdate?.({ kind: "status",
267764
+ text: "Could not move this command to the background; it remains running." }),
267765
+ });
267728
267766
  if (startsInBackground) return this.backgroundStartedResult(taskId, proc, description, {
267729
267767
  title: "Background task started",
267730
267768
  brief: `Started ${taskId}`
@@ -267739,6 +267777,7 @@ var init_bash = __esmMin((() => {
267739
267777
  }
267740
267778
  return await this.foregroundCompletionResult(taskId, proc, builder, foregroundTimeoutMs);
267741
267779
  } finally {
267780
+ foregroundYield642?.dispose();
267742
267781
  collectForegroundOutput = false;
267743
267782
  }
267744
267783
  }
@@ -368624,7 +368663,7 @@ function optionalBuildString(value) {
368624
368663
  var BLUN_BUILD_INFO;
368625
368664
  var init_build_info = __esmMin((() => {
368626
368665
  BLUN_BUILD_INFO = {
368627
- version: optionalBuildString("9.1.642"),
368666
+ version: optionalBuildString("9.1.643"),
368628
368667
  channel: typeof __BLUN_CHANNEL__ === "string" ? optionalBuildString(__BLUN_CHANNEL__) : void 0,
368629
368668
  commit: typeof __BLUN_COMMIT__ === "string" ? optionalBuildString(__BLUN_COMMIT__) : void 0,
368630
368669
  buildTarget: typeof __BLUN_BUILD_TARGET__ === "string" ? optionalBuildString(__BLUN_BUILD_TARGET__) : void 0
@@ -546371,6 +546410,7 @@ activeApprovalPanel;
546371
546410
  const stream = this.shellOutputStreams.get(event.commandId);
546372
546411
  if (stream === void 0) return;
546373
546412
  stream.taskId = event.taskId;
546413
+ toolLiveness642.yieldRequestedLocalShell(this, event.commandId, stream);
546374
546414
  }
546375
546415
  cancelRunningShellCommand() {
546376
546416
  const session = this.session;
@@ -546399,7 +546439,11 @@ activeApprovalPanel;
546399
546439
  finishShellOutput(commandId, stdout, stderr, isError, backgrounded) {
546400
546440
  const stream = this.shellOutputStreams.get(commandId);
546401
546441
  if (stream === void 0) return;
546402
- if (backgrounded === true) return;
546442
+ if (backgrounded === true) {
546443
+ toolLiveness642.releaseLocalShell(this, commandId, stream,
546444
+ uiText("blunTui.detach.movedTranscript"));
546445
+ return;
546446
+ }
546403
546447
  stream.component.finish(stdout, stderr, isError);
546404
546448
  stream.entry.content = formatBashOutputForDisplay(stdout, stderr, isError);
546405
546449
  this.shellOutputStreams.delete(commandId);
@@ -546439,7 +546483,7 @@ activeApprovalPanel;
546439
546483
  if (this.session !== void 0 && (this.stoppedInputSession === this.session || this.stoppedInputScopes?.get(this.session, this.state.queuedMessages[0]?.agentId ?? this.interactiveAgentId) !== void 0)) return false;
546440
546484
  if (this.activeInputDelivery?.has(this.state.queuedMessages[0])) return false;
546441
546485
  if (this.hasPendingQueueCommandCancellation()) return false;
546442
- if (this.state.appState.isCompacting || this.streamingUI.hasActiveToolCalls() || this.shellOutputStreams.size > 0 || this.state.appState.streamingPhase === "shell") return false;
546486
+ if (this.state.appState.isCompacting || this.shellOutputStreams.size > 0 || this.state.appState.streamingPhase === "shell") return false;
546443
546487
  const item = this.state.queuedMessages[0];
546444
546488
  if (this.isShuttingDown || this.queueCommandRunning || this.localShellConsentRequest !== void 0 || this.queueSteerInFlight !== void 0 || this.manualPromptInFlight !== void 0 || this.editorReplacementActive || this.deferUserMessages || this.session === void 0 || this.state.appState.model.trim().length === 0 || item?.mode !== "channel") return false;
546445
546489
  const guard = this.pendingChannelReplyGuard;
@@ -546861,6 +546905,8 @@ releaseChannelQueueAtSafePoint() {
546861
546905
  const inFlightCount = this.queueSteerInFlight?.items.length ?? 0;
546862
546906
  this.queueFlushBatchRemaining = inFlightCount + this.state.queuedMessages.length;
546863
546907
  if (this.manualPromptInFlight !== void 0) this.manualPromptInFlight.flushRequested = this.queueFlushBatchRemaining > 0;
546908
+ if (this.queueFlushBatchRemaining > 0 && this.state.appState.streamingPhase === "shell")
546909
+ toolLiveness642.yieldLocalShellsForInput(this, true);
546864
546910
  this.steerQueueFlushPrefix();
546865
546911
  this.scheduleQueueDrain();
546866
546912
  }
@@ -549506,6 +549552,7 @@ releaseChannelQueueAtSafePoint() {
549506
549552
  return this.state.livePane.mode;
549507
549553
  }
549508
549554
  updateQueueDisplay() {
549555
+ (this.queueDeliveryNudge642 ??= new toolLiveness642.QueueDeliveryNudge(this)).sync();
549509
549556
  this.syncChannelQueueDeadline();
549510
549557
  this.state.queueContainer.clear();
549511
549558
  const queued = [...this.queueSteerInFlight?.items ?? [], ...this.state.queuedMessages];
@@ -549572,9 +549619,8 @@ releaseChannelQueueAtSafePoint() {
549572
549619
  this.showError(uiText("blunTui.detach.moveFailed", { error: formatErrorMessage$2(error) }));
549573
549620
  return;
549574
549621
  }
549575
- stream.component.finishBackgrounded();
549576
- stream.entry.content = uiText("blunTui.detach.movedTranscript");
549577
- this.shellOutputStreams.delete(commandId);
549622
+ toolLiveness642.releaseLocalShell(this, commandId, stream,
549623
+ uiText("blunTui.detach.movedTranscript"));
549578
549624
  this.showDetachHint(uiText("blunTui.detach.movedView"));
549579
549625
  }
549580
549626
  async detachCurrentForegroundTask() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.642",
3
+ "version": "9.1.643",
4
4
  "description": "BLUN CLI - your own AI agent with a Telegram channel. Get it done. With BLUN.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -48,7 +48,9 @@
48
48
  "agent-spine-plugin/.mcp.json",
49
49
  "bundled-agent-sources.json",
50
50
  "telegram-plugin/",
51
- "LIESMICH.txt"
51
+ "LIESMICH.txt",
52
+ "tool-liveness642/",
53
+ "versionierung/"
52
54
  ],
53
55
  "keywords": [
54
56
  "blun",
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ ...require('./shell-yield.cjs'),
5
+ ...require('./queue-delivery.cjs'),
6
+ ...require('./task-wait.cjs'),
7
+ };
@@ -0,0 +1,109 @@
1
+ 'use strict';
2
+
3
+ const QUEUE_DELIVERY_DELAY_MS = 250;
4
+ const localShellRequests = new WeakSet();
5
+ const localShellManualRequests = new WeakSet();
6
+ const localShellPending = new WeakSet();
7
+ const localShellFailed = new WeakSet();
8
+ const localShellSucceeded = new WeakSet();
9
+
10
+ function releaseLocalShell(host, commandId, stream, content) {
11
+ if (host.shellOutputStreams.get(commandId) !== stream || stream.owner !== host.session) return false;
12
+ stream.component.finishBackgrounded();
13
+ stream.entry.content = content;
14
+ host.shellOutputStreams.delete(commandId);
15
+ if (host.shellOutputStreams.size === 0) {
16
+ host.setAppState({ streamingPhase: 'idle' });
17
+ host.requestQueueDrain();
18
+ }
19
+ host.updateQueueDisplay();
20
+ host.state.ui.requestRender();
21
+ return true;
22
+ }
23
+
24
+ function yieldRequestedLocalShell(host, commandId, stream) {
25
+ if (!localShellRequests.has(stream) || localShellPending.has(stream) || localShellFailed.has(stream)
26
+ || localShellSucceeded.has(stream)
27
+ || stream.taskId === undefined || stream.owner !== host.session
28
+ || host.gatewayLocalShells?.has(commandId)) return;
29
+ const session = host.session;
30
+ localShellPending.add(stream);
31
+ Promise.resolve().then(() => {
32
+ if (host.session !== session || host.isShuttingDown || host.aborted
33
+ || host.shellOutputStreams.get(commandId) !== stream) return;
34
+ const policy = host.queuePolicyForSession?.(session);
35
+ if (!localShellManualRequests.has(stream) && policy !== undefined && policy.mode !== 'steer') {
36
+ localShellRequests.delete(stream);
37
+ return;
38
+ }
39
+ return session.detachBackgroundTask(stream.taskId).then(result => {
40
+ localShellSucceeded.add(stream);
41
+ return result;
42
+ });
43
+ }).catch(() => {
44
+ localShellFailed.add(stream);
45
+ if (host.session === session && host.shellOutputStreams.get(commandId) === stream) {
46
+ host.showError('Could not move the command to the background.');
47
+ }
48
+ }).finally(() => localShellPending.delete(stream));
49
+ }
50
+
51
+ function yieldLocalShellsForInput(host, manual = false) {
52
+ for (const [commandId, stream] of host.shellOutputStreams) {
53
+ if (stream.owner !== host.session) continue;
54
+ if (manual) {
55
+ localShellFailed.delete(stream);
56
+ localShellManualRequests.add(stream);
57
+ }
58
+ localShellRequests.add(stream);
59
+ yieldRequestedLocalShell(host, commandId, stream);
60
+ }
61
+ }
62
+
63
+ class QueueDeliveryNudge {
64
+ constructor(host) { this.host = host; }
65
+ sync() {
66
+ const host = this.host;
67
+ if (this.owner !== host.session) { clearTimeout(this.timer); this.timer = undefined; }
68
+ this.owner = host.session;
69
+ if (host.state.queuedMessages.length === 0) { clearTimeout(this.timer); this.timer = undefined; }
70
+ if (this.timer !== undefined || !this.owner || host.isShuttingDown || host.aborted
71
+ || host.state.queuedMessages.length === 0) return;
72
+ const owner = this.owner;
73
+ this.timer = setTimeout(() => {
74
+ this.timer = undefined;
75
+ if (host.session !== owner || host.isShuttingDown || host.aborted) return;
76
+ const state = host.state.appState;
77
+ const head = host.state.queuedMessages[0];
78
+ const stopped = host.stoppedInputSession === owner
79
+ || host.stoppedInputScopes?.get(owner, head?.agentId ?? host.interactiveAgentId);
80
+ const policy = host.queuePolicyForSession?.(owner);
81
+ const maySteer = policy === undefined || policy.mode === 'steer';
82
+ if (!state.isReplaying && !state.isCompacting && !host.deferUserMessages
83
+ && !host.queueCommandRunning && !host.editorReplacementActive
84
+ && !host.manualPromptInFlight && !host.localShellConsentRequest
85
+ && !host.queueSteerInFlight && !stopped
86
+ && !(host.gatewayStartup && !host.gatewayViewReady)
87
+ && !host.hasPendingQueueCommandCancellation?.()
88
+ && !(host.queueInterruptCancellations?.size > 0)
89
+ && !host.activeInputDelivery?.has(head)) {
90
+ if (state.streamingPhase === 'shell') {
91
+ if (maySteer) yieldLocalShellsForInput(host);
92
+ }
93
+ else if (state.streamingPhase === 'idle') host.requestQueueDrain();
94
+ else if (maySteer && host.state.queuedMessages[0]?.mode === 'channel') {
95
+ host.channelQueueDeadline.requestDeliveryNow();
96
+ } else if (maySteer && host.pendingChannelReplyGuard === undefined) {
97
+ host.queueFlushBatchRemaining = Math.max(host.queueFlushBatchRemaining,
98
+ host.state.queuedMessages.length);
99
+ host.steerQueueFlushPrefix();
100
+ }
101
+ }
102
+ this.sync();
103
+ }, QUEUE_DELIVERY_DELAY_MS);
104
+ this.timer.unref?.();
105
+ }
106
+ }
107
+
108
+ module.exports = { QUEUE_DELIVERY_DELAY_MS, QueueDeliveryNudge, releaseLocalShell,
109
+ yieldRequestedLocalShell, yieldLocalShellsForInput };
@@ -0,0 +1,40 @@
1
+ {
2
+ "schema": "blun.shell-queue643-candidate/v1",
3
+ "releaseApproved": false,
4
+ "upstreamArchiveSha256": "529dda1f1a7fc9530d155ebf538b2bd408b762d3b3af82cce33da19855d4d43e",
5
+ "patchesSha256": "5b8006429074b0101b212431da7a7e9b51c899c23d1a2e1bd39b4fc878164db3",
6
+ "upstreamFiles": 939,
7
+ "preservedFiles": 936,
8
+ "removedFiles": [],
9
+ "changes": {
10
+ "blun.mjs": {
11
+ "before": "3b1c3891b1cb1a640d679d972ec773ba3a8371282fbf91ddbaa979ad57c1e9a7",
12
+ "after": "0a6664e561cb9495d34f1a90c731ff1aadbc3a2bc406723a8630599888d1b303"
13
+ },
14
+ "package.json": {
15
+ "before": "754161b0f802c6c6288bbe66f2a7f3b4e10b983d394ebdc10d6bdaef4d00a144",
16
+ "after": "0f9b7f75089537abad70deffb1fbb0d6934492aae90dc6032a477b1f2435c11c"
17
+ },
18
+ "tool-liveness642/index.cjs": {
19
+ "before": null,
20
+ "after": "490943e2bb28c59fea8aafaf2a05fbfe3ab10665924147c4e039039acad876cb"
21
+ },
22
+ "tool-liveness642/queue-delivery.cjs": {
23
+ "before": null,
24
+ "after": "504d416fd73ac2cb23b8df519fddb22eb5679b35560a4c1aad3311ca4e03110e"
25
+ },
26
+ "tool-liveness642/shell-yield.cjs": {
27
+ "before": null,
28
+ "after": "1cc0aa50f21f728bad582bfbdad6cb9c0f193a34a47bf23074cde1608dca7c5b"
29
+ },
30
+ "tool-liveness642/task-wait.cjs": {
31
+ "before": null,
32
+ "after": "e83bbea76b293d3444c180e49454c42b91fd3a2d8e975b3e4686a55ce4c9a039"
33
+ },
34
+ "worker-host.mjs": {
35
+ "before": "38955b66e48ae559935026e9124cbd4d0777b6948fb6007b60e9b288afc23bd6",
36
+ "after": "8bbbcf971599e20e916816571d084b7999ca6d6a669a8f66d73ce2eed28eee14"
37
+ }
38
+ },
39
+ "version": "9.1.643"
40
+ }
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ const SHELL_IDLE_YIELD_MS = 30_000;
4
+
5
+ /** Release the foreground wait; the existing manager retains the same process. */
6
+ function createForegroundYield({ control, initialEpoch, signal, enabled, detach,
7
+ onError = () => {}, idleMs = SHELL_IDLE_YIELD_MS }) {
8
+ let disposed = false;
9
+ let yielded = false;
10
+ let timer;
11
+ let removeInputListener;
12
+ const clear = () => { clearTimeout(timer); timer = undefined; };
13
+ const dispose = () => {
14
+ if (disposed) return;
15
+ disposed = true;
16
+ clear();
17
+ removeInputListener?.();
18
+ signal.removeEventListener('abort', dispose);
19
+ };
20
+ const yieldForeground = () => {
21
+ if (disposed || yielded || signal.aborted || control.stopped) return;
22
+ yielded = true;
23
+ clear();
24
+ try { detach(); }
25
+ catch (error) { try { onError(error); } catch {} }
26
+ finally { dispose(); }
27
+ };
28
+ const touch = () => {
29
+ if (disposed || yielded || !enabled || idleMs <= 0) return;
30
+ clear();
31
+ timer = setTimeout(yieldForeground, idleMs);
32
+ timer.unref?.();
33
+ };
34
+ if (enabled && !signal.aborted) {
35
+ removeInputListener = control.onChange(yieldForeground);
36
+ signal.addEventListener('abort', dispose, { once: true });
37
+ if (control.epoch !== initialEpoch) yieldForeground();
38
+ else touch();
39
+ }
40
+ return { touch, dispose };
41
+ }
42
+
43
+ module.exports = { SHELL_IDLE_YIELD_MS, createForegroundYield };
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ /** Cancel an observation wait without cancelling the task being observed. */
4
+ async function waitForTaskTerminal(terminal, timeout, signal) {
5
+ let onAbort;
6
+ try {
7
+ signal?.throwIfAborted();
8
+ const waits = [terminal, timeout];
9
+ if (signal) waits.push(new Promise((_, reject) => {
10
+ onAbort = () => reject(signal.reason);
11
+ signal.addEventListener('abort', onAbort, { once: true });
12
+ if (signal.aborted) onAbort();
13
+ }));
14
+ await Promise.race(waits);
15
+ } finally {
16
+ timeout.clear();
17
+ if (onAbort) signal.removeEventListener('abort', onAbort);
18
+ }
19
+ }
20
+
21
+ /** A new instruction releases TaskOutput's wait; work and notifications stay owned. */
22
+ async function waitForTaskInput({ manager, taskId, timeoutMs, signal, control, initialEpoch }) {
23
+ signal.throwIfAborted();
24
+ const inputArrived = Symbol('task-wait-input');
25
+ const observer = new AbortController();
26
+ const changed = () => observer.abort(control.stopped
27
+ ? new DOMException('Input stopped', 'AbortError') : inputArrived);
28
+ const remove = control.onChange(changed);
29
+ try {
30
+ if (control.stopped || control.epoch !== initialEpoch) changed();
31
+ await manager.wait(taskId, timeoutMs, AbortSignal.any([signal, observer.signal]));
32
+ signal.throwIfAborted();
33
+ if (control.stopped) throw new DOMException('Input stopped', 'AbortError');
34
+ return 'settled';
35
+ } catch (error) {
36
+ signal.throwIfAborted();
37
+ if (control.stopped) throw new DOMException('Input stopped', 'AbortError');
38
+ if (error === inputArrived) return 'input';
39
+ throw error;
40
+ } finally {
41
+ remove();
42
+ }
43
+ }
44
+
45
+ module.exports = { waitForTaskTerminal, waitForTaskInput };
@@ -0,0 +1,43 @@
1
+ {
2
+ "schema": "ISOLIERTE-VERSIONIERUNG-v1",
3
+ "version": "9.1.643",
4
+ "releaseApproved": false,
5
+ "installation": false,
6
+ "basisArchivSha256": "529dda1f1a7fc9530d155ebf538b2bd408b762d3b3af82cce33da19855d4d43e",
7
+ "quellen": {
8
+ "quellen/.gitignore": "58eab193f3324cfcb16a960f1b35fe4c3652d7bcfa5cc07234e78ac6045d1b03",
9
+ "quellen/README.md": "cf9200723365e770b976565f5a20885481a300d0807887b57c3acd0756c460bb",
10
+ "quellen/build.py": "fe170233a9f26a534177fcd41e2190c10e9b69a89f38604e2930d5622ec1698d",
11
+ "quellen/package.json": "bb5f6bfd59f1014843d4ec2fbec12baba154fe5d991e4604b75df96917874e42",
12
+ "quellen/patches.py": "5b8006429074b0101b212431da7a7e9b51c899c23d1a2e1bd39b4fc878164db3",
13
+ "quellen/runtime/index.cjs": "490943e2bb28c59fea8aafaf2a05fbfe3ab10665924147c4e039039acad876cb",
14
+ "quellen/runtime/queue-delivery.cjs": "504d416fd73ac2cb23b8df519fddb22eb5679b35560a4c1aad3311ca4e03110e",
15
+ "quellen/runtime/shell-yield.cjs": "1cc0aa50f21f728bad582bfbdad6cb9c0f193a34a47bf23074cde1608dca7c5b",
16
+ "quellen/runtime/task-wait.cjs": "e83bbea76b293d3444c180e49454c42b91fd3a2d8e975b3e4686a55ce4c9a039",
17
+ "quellen/test/agent-wait.test.cjs": "b2ed8e96a44531984cb849f6e1ce430b4031dfae073660de675e6ec3037a4051",
18
+ "quellen/test/assembly.test.cjs": "56331ddd6bd5ab6ce41062c032b528115ee1e1f645dd7d055e7a9ef804892c43",
19
+ "quellen/test/bundle.test.cjs": "22d5220b054abaeacd589edd4cfa756799aba775e421d88b426517a9f8621cdd",
20
+ "quellen/test/runtime.test.cjs": "e05c337ad0f6d8a9dcb25484b23a052b55b2508663ef5f36e7326eab9f40e5e4",
21
+ "quellen/test/task-harness.cjs": "9e6dae7603567c96041690a8171d98af9c6bc18db3fdb779fb700907d37e71e2",
22
+ "quellen/test/task-wait.test.cjs": "3649d739caf250fdf4fefe8027778ad25a682d168b96b552bf903d3340d5f079"
23
+ },
24
+ "versioniererSha256": "88e50b48c0622dd0b38a66145093eaddbbdf21bd53f9efdfaebf8275a52bf864",
25
+ "versionsschritt": {
26
+ "blun.mjs": {
27
+ "before": "48e2714999ae4f9f8d2979d69d0cde3eba73f14b95824007bf045d5db6eb2667",
28
+ "after": "0a6664e561cb9495d34f1a90c731ff1aadbc3a2bc406723a8630599888d1b303",
29
+ "aenderung": "Ausschliesslich Buildversionsliteral"
30
+ },
31
+ "worker-host.mjs": {
32
+ "before": "74f4f6b6d701977d5aaf424b6b98eb370458c6720957d098844972fbf5a40878",
33
+ "after": "8bbbcf971599e20e916816571d084b7999ca6d6a669a8f66d73ce2eed28eee14",
34
+ "aenderung": "Ausschliesslich Buildversionsliteral"
35
+ },
36
+ "package.json": {
37
+ "before": "11880ed0ca482030cfbcdf6f0c9215365b03de93f84dc83f1f1ce81ecebb0bf7",
38
+ "after": "0f9b7f75089537abad70deffb1fbb0d6934492aae90dc6032a477b1f2435c11c",
39
+ "aenderung": "Version und Aufnahme des Versionierungsbelegs"
40
+ }
41
+ },
42
+ "grenze": "Gepruefte Bundles werden mit Original-PR17-Builder rekonstruiert, dann ausschliesslich Buildversionsliterale und Paketmetadaten versioniert; kein TypeScript-Neubau. Headerhash bezeichnet weiterhin den Upstream-Build. Native 642-Belege sind kein nativer 643-PASS."
43
+ }
@@ -0,0 +1,5 @@
1
+ # Isolierter Kandidat 9.1.643
2
+
3
+ Nicht veröffentlicht, nicht installiert. PR17-Overlay aus exakt hashgeprüfter veröffentlichter Basis rekonstruiert; danach ausschließlich Versionsidentität und Paketierungsbeleg ergänzt. Kein Neubau aus gepflegten TypeScript-Quellen. Upstream-Buildheader bleibt Herkunftsbeleg, nicht Hash des Versionsschritts.
4
+
5
+ Persönliche 9.1.642-Lieferung und historische Belege unverändert. Kein Livekonto, Telegramversand oder fremde Konfiguration. Datenarten: technische Quell-/Dateihashes und synthetische Tests. Rechtsgrundlage, Verantwortliche, Speicherfristen und konkrete KI-Rolle/Risiko-/Transparenzpflichten aus T4593 vor betroffenem echtem Betrieb klären; kein Rechtsgesamt-PASS. Löschung ausschließlich im eigenen Aufgabenordner samt autorisierten Sicherungs-/Rücklesekopien durch Berechtigte.
@@ -0,0 +1,39 @@
1
+ {
2
+ "schema": "blun.shell-queue642-candidate/v1",
3
+ "releaseApproved": false,
4
+ "upstreamArchiveSha256": "529dda1f1a7fc9530d155ebf538b2bd408b762d3b3af82cce33da19855d4d43e",
5
+ "patchesSha256": "5b8006429074b0101b212431da7a7e9b51c899c23d1a2e1bd39b4fc878164db3",
6
+ "upstreamFiles": 939,
7
+ "preservedFiles": 936,
8
+ "removedFiles": [],
9
+ "changes": {
10
+ "blun.mjs": {
11
+ "before": "3b1c3891b1cb1a640d679d972ec773ba3a8371282fbf91ddbaa979ad57c1e9a7",
12
+ "after": "48e2714999ae4f9f8d2979d69d0cde3eba73f14b95824007bf045d5db6eb2667"
13
+ },
14
+ "package.json": {
15
+ "before": "754161b0f802c6c6288bbe66f2a7f3b4e10b983d394ebdc10d6bdaef4d00a144",
16
+ "after": "11880ed0ca482030cfbcdf6f0c9215365b03de93f84dc83f1f1ce81ecebb0bf7"
17
+ },
18
+ "tool-liveness642/index.cjs": {
19
+ "before": null,
20
+ "after": "490943e2bb28c59fea8aafaf2a05fbfe3ab10665924147c4e039039acad876cb"
21
+ },
22
+ "tool-liveness642/queue-delivery.cjs": {
23
+ "before": null,
24
+ "after": "504d416fd73ac2cb23b8df519fddb22eb5679b35560a4c1aad3311ca4e03110e"
25
+ },
26
+ "tool-liveness642/shell-yield.cjs": {
27
+ "before": null,
28
+ "after": "1cc0aa50f21f728bad582bfbdad6cb9c0f193a34a47bf23074cde1608dca7c5b"
29
+ },
30
+ "tool-liveness642/task-wait.cjs": {
31
+ "before": null,
32
+ "after": "e83bbea76b293d3444c180e49454c42b91fd3a2d8e975b3e4686a55ce4c9a039"
33
+ },
34
+ "worker-host.mjs": {
35
+ "before": "38955b66e48ae559935026e9124cbd4d0777b6948fb6007b60e9b288afc23bd6",
36
+ "after": "74f4f6b6d701977d5aaf424b6b98eb370458c6720957d098844972fbf5a40878"
37
+ }
38
+ }
39
+ }
package/worker-host.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  // BLUN_BUILD_INPUT_SHA256:e50c78300e52dc6fc7d8003478fe2fa01fe7fdff8b1a749e108e6627de244e7e
3
+ import toolLiveness642 from "./tool-liveness642/index.cjs";
3
4
  /*! wasm-webp 0.1.0
4
5
  MIT License
5
6
 
@@ -184894,7 +184895,8 @@ var BackgroundManager = class {
184894
184895
  * Wait for a task to reach a terminal state.
184895
184896
  * Returns immediately if already terminal. Times out after `timeoutMs`.
184896
184897
  */
184897
- async wait(taskId, timeoutMs = 3e4) {
184898
+ async wait(taskId, timeoutMs = 3e4, signal) {
184899
+ signal?.throwIfAborted();
184898
184900
  const entry = this.tasks.get(taskId);
184899
184901
  if (!entry) return void 0;
184900
184902
  if (TERMINAL_STATUSES.has(entry.status)) {
@@ -184903,7 +184905,7 @@ var BackgroundManager = class {
184903
184905
  }
184904
184906
  if (timeoutMs <= 0) return this.toInfo(entry);
184905
184907
  const timeout = timeoutOutcome(timeoutMs, void 0);
184906
- await Promise.race([entry.terminal, timeout]).finally(() => timeout.clear());
184908
+ await toolLiveness642.waitForTaskTerminal(entry.terminal, timeout, signal);
184907
184909
  if (TERMINAL_STATUSES.has(entry.status)) await entry.persistWriteQueue;
184908
184910
  return this.toInfo(entry);
184909
184911
  }
@@ -256776,16 +256778,27 @@ var TaskOutputTool = class {
256776
256778
  description: `Reading output of task ${args.task_id}`,
256777
256779
  approvalRule: this.name,
256778
256780
  matchesRule: (ruleArgs) => matchesGlobRuleSubject(ruleArgs, args.task_id),
256779
- execute: () => this.execute(args)
256781
+ execute: ({ signal }) => this.execute(args, signal)
256780
256782
  };
256781
256783
  }
256782
- async execute(args) {
256784
+ async execute(args, signal = new AbortController().signal) {
256785
+ signal.throwIfAborted();
256786
+ const control642 = inputControl(signal);
256787
+ const epoch642 = control642.epoch;
256788
+ let waitReleasedForInput642 = false;
256783
256789
  const info = this.manager.getTask(args.task_id);
256784
256790
  if (!info) return {
256785
256791
  isError: true,
256786
256792
  output: `Task not found: ${args.task_id}`
256787
256793
  };
256788
- if (args.block && !isBackgroundTaskTerminal(info.status)) await this.manager.wait(args.task_id, (args.timeout ?? 30) * 1e3);
256794
+ if (args.block && !isBackgroundTaskTerminal(info.status)) {
256795
+ waitReleasedForInput642 = await toolLiveness642.waitForTaskInput({
256796
+ manager: this.manager, taskId: args.task_id,
256797
+ timeoutMs: (args.timeout ?? 30) * 1e3, signal,
256798
+ control: control642, initialEpoch: epoch642
256799
+ }) === "input";
256800
+ }
256801
+ signal.throwIfAborted();
256789
256802
  const current = this.manager.getTask(args.task_id);
256790
256803
  if (!current) return {
256791
256804
  isError: true,
@@ -256793,7 +256806,8 @@ var TaskOutputTool = class {
256793
256806
  };
256794
256807
  const output = await this.manager.getOutputSnapshot(args.task_id, OUTPUT_PREVIEW_BYTES);
256795
256808
  const lines = [formatPlainObject({
256796
- retrievalStatus: retrievalStatus(current.status, args.block),
256809
+ retrievalStatus: retrievalStatus(current.status, args.block && !waitReleasedForInput642),
256810
+ waitReleasedForInput: waitReleasedForInput642 || void 0,
256797
256811
  ...current,
256798
256812
  outputPath: output.outputPath,
256799
256813
  terminalReason: terminalReason(current),
@@ -257179,6 +257193,8 @@ var AgentTool = class {
257179
257193
  };
257180
257194
  }
257181
257195
  async execution(args, { toolCallId, signal }) {
257196
+ const control642 = inputControl(signal);
257197
+ const epoch642 = control642.epoch;
257182
257198
  try {
257183
257199
  signal.throwIfAborted();
257184
257200
  const runInBackground = args.run_in_background === true;
@@ -257246,8 +257262,16 @@ var AgentTool = class {
257246
257262
  };
257247
257263
  }
257248
257264
  if (runInBackground) return { output: formatBackgroundAgentResult(taskId, handle, args.description, this.allowBackground) };
257249
- if (await this.backgroundManager.waitForForegroundRelease(taskId) === "detached") return { output: formatBackgroundAgentResult(taskId, handle, args.description, this.allowBackground) };
257250
- return await this.formatForegroundResult(taskId, handle);
257265
+ const inputYield642 = toolLiveness642.createForegroundYield({
257266
+ control: control642, initialEpoch: epoch642, signal,
257267
+ enabled: this.allowBackground, idleMs: 0,
257268
+ detach: () => this.backgroundManager.detach(taskId),
257269
+ onError: error => this.log?.warn("Could not background active agent", { error })
257270
+ });
257271
+ try {
257272
+ if (await this.backgroundManager.waitForForegroundRelease(taskId) === "detached") return { output: formatBackgroundAgentResult(taskId, handle, args.description, this.allowBackground) };
257273
+ return await this.formatForegroundResult(taskId, handle);
257274
+ } finally { inputYield642.dispose(); }
257251
257275
  } catch (error) {
257252
257276
  return {
257253
257277
  output: `subagent error: ${launchErrorMessage(error, signal)}`,
@@ -267095,6 +267119,9 @@ var BashTool = class BashTool {
267095
267119
  return this.kaos.execWithEnv(shellArgs, mergedEnv);
267096
267120
  }
267097
267121
  async execution(args, signal, onUpdate, onForegroundTaskStart) {
267122
+ const inputControl642 = inputControl(signal);
267123
+ const inputEpoch642 = inputControl642.epoch;
267124
+ let foregroundYield642;
267098
267125
  const validationError = this.validateRunRequest(args, signal);
267099
267126
  if (validationError !== void 0) return validationError;
267100
267127
  const startsInBackground = args.run_in_background === true;
@@ -267119,6 +267146,7 @@ var BashTool = class BashTool {
267119
267146
  let foregroundTaskId;
267120
267147
  const onProcessOutput = startsInBackground ? void 0 : (kind, text) => {
267121
267148
  if (!collectForegroundOutput) return;
267149
+ if (text.length > 0) foregroundYield642?.touch();
267122
267150
  onUpdate?.({
267123
267151
  kind,
267124
267152
  text
@@ -267148,6 +267176,13 @@ var BashTool = class BashTool {
267148
267176
  };
267149
267177
  }
267150
267178
  if (!startsInBackground) onForegroundTaskStart?.(taskId);
267179
+ foregroundYield642 = toolLiveness642.createForegroundYield({
267180
+ control: inputControl642, initialEpoch: inputEpoch642, signal,
267181
+ enabled: !startsInBackground && this.allowBackground,
267182
+ detach: () => this.backgroundManager.detach(taskId),
267183
+ onError: () => onUpdate?.({ kind: "status",
267184
+ text: "Could not move this command to the background; it remains running." }),
267185
+ });
267151
267186
  if (startsInBackground) return this.backgroundStartedResult(taskId, proc, description, {
267152
267187
  title: "Background task started",
267153
267188
  brief: `Started ${taskId}`
@@ -267162,6 +267197,7 @@ var BashTool = class BashTool {
267162
267197
  }
267163
267198
  return await this.foregroundCompletionResult(taskId, proc, builder, foregroundTimeoutMs);
267164
267199
  } finally {
267200
+ foregroundYield642?.dispose();
267165
267201
  collectForegroundOutput = false;
267166
267202
  }
267167
267203
  }
@@ -350406,7 +350442,7 @@ function optionalBuildString(value) {
350406
350442
  return typeof value === "string" && value.length > 0 ? value : void 0;
350407
350443
  }
350408
350444
  const BLUN_BUILD_INFO = {
350409
- version: optionalBuildString("9.1.642"),
350445
+ version: optionalBuildString("9.1.643"),
350410
350446
  channel: typeof __BLUN_CHANNEL__ === "string" ? optionalBuildString(__BLUN_CHANNEL__) : void 0,
350411
350447
  commit: typeof __BLUN_COMMIT__ === "string" ? optionalBuildString(__BLUN_COMMIT__) : void 0,
350412
350448
  buildTarget: typeof __BLUN_BUILD_TARGET__ === "string" ? optionalBuildString(__BLUN_BUILD_TARGET__) : void 0