@bunny-agent/runner-cli 0.10.0-beta.3 → 0.10.0-beta.4
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/bundle.mjs +128 -1
- package/package.json +4 -4
package/dist/bundle.mjs
CHANGED
|
@@ -39586,6 +39586,123 @@ function createOpenCodeRunner(options = {}) {
|
|
|
39586
39586
|
});
|
|
39587
39587
|
}
|
|
39588
39588
|
|
|
39589
|
+
// ../../packages/runner-pi/dist/live-control.js
|
|
39590
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
39591
|
+
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
39592
|
+
function createPiLiveController(session, onFirstStreamInvocation) {
|
|
39593
|
+
const originalSteeringMode = session.agent.steeringMode;
|
|
39594
|
+
session.agent.steeringMode = "one-at-a-time";
|
|
39595
|
+
const controllerNonce = randomBytes2(16).toString("hex");
|
|
39596
|
+
const dispatchContext = new AsyncLocalStorage();
|
|
39597
|
+
const dispatches = /* @__PURE__ */ new Map();
|
|
39598
|
+
let consumedCallback;
|
|
39599
|
+
let disposed = false;
|
|
39600
|
+
let firstStreamInvocationReported = false;
|
|
39601
|
+
const reportIfConfirmed = (dispatch) => {
|
|
39602
|
+
if (!disposed && dispatch.outcome === "queued" && dispatch.captured.length === 1 && dispatch.observed && !dispatch.reported) {
|
|
39603
|
+
dispatch.reported = true;
|
|
39604
|
+
consumedCallback?.(dispatch.id);
|
|
39605
|
+
}
|
|
39606
|
+
};
|
|
39607
|
+
const originalAgentSteer = session.agent.steer;
|
|
39608
|
+
const installedAgentSteer = (message) => {
|
|
39609
|
+
const dispatch = dispatchContext.getStore();
|
|
39610
|
+
if (dispatch && message.role === "user") {
|
|
39611
|
+
dispatch.captured.push(message);
|
|
39612
|
+
message.__bunnyLiveControl = {
|
|
39613
|
+
controllerNonce,
|
|
39614
|
+
stableId: dispatch.id
|
|
39615
|
+
};
|
|
39616
|
+
}
|
|
39617
|
+
originalAgentSteer.call(session.agent, message);
|
|
39618
|
+
};
|
|
39619
|
+
session.agent.steer = installedAgentSteer;
|
|
39620
|
+
const originalStreamFunction = session.agent.streamFunction;
|
|
39621
|
+
const wrappedStreamFunction = (model, context, streamOptions) => {
|
|
39622
|
+
const observed = /* @__PURE__ */ new Set();
|
|
39623
|
+
const sanitizedMessages = context.messages.map((candidate) => {
|
|
39624
|
+
if (!Object.getOwnPropertyDescriptor(candidate, "__bunnyLiveControl"))
|
|
39625
|
+
return candidate;
|
|
39626
|
+
const { __bunnyLiveControl: marker, ...rest } = candidate;
|
|
39627
|
+
if (marker && marker.controllerNonce === controllerNonce && candidate.role === "user") {
|
|
39628
|
+
const dispatch = dispatches.get(marker.stableId);
|
|
39629
|
+
if (dispatch)
|
|
39630
|
+
observed.add(dispatch);
|
|
39631
|
+
}
|
|
39632
|
+
return rest;
|
|
39633
|
+
});
|
|
39634
|
+
const providerContext = {
|
|
39635
|
+
...context,
|
|
39636
|
+
messages: sanitizedMessages
|
|
39637
|
+
};
|
|
39638
|
+
const result = originalStreamFunction.call(session.agent, model, providerContext, streamOptions);
|
|
39639
|
+
return Promise.resolve(result).then((stream) => {
|
|
39640
|
+
if (!disposed && !firstStreamInvocationReported) {
|
|
39641
|
+
firstStreamInvocationReported = true;
|
|
39642
|
+
onFirstStreamInvocation?.();
|
|
39643
|
+
}
|
|
39644
|
+
for (const dispatch of observed) {
|
|
39645
|
+
dispatch.observed = true;
|
|
39646
|
+
reportIfConfirmed(dispatch);
|
|
39647
|
+
}
|
|
39648
|
+
return stream;
|
|
39649
|
+
});
|
|
39650
|
+
};
|
|
39651
|
+
session.agent.streamFunction = wrappedStreamFunction;
|
|
39652
|
+
return {
|
|
39653
|
+
async steer(message) {
|
|
39654
|
+
if (disposed)
|
|
39655
|
+
return { disposition: "rejected", reason: "controller disposed" };
|
|
39656
|
+
if (dispatches.has(message.id)) {
|
|
39657
|
+
return {
|
|
39658
|
+
disposition: "rejected",
|
|
39659
|
+
reason: "message id already dispatched"
|
|
39660
|
+
};
|
|
39661
|
+
}
|
|
39662
|
+
const dispatch = {
|
|
39663
|
+
id: message.id,
|
|
39664
|
+
captured: [],
|
|
39665
|
+
observed: false,
|
|
39666
|
+
reported: false
|
|
39667
|
+
};
|
|
39668
|
+
dispatches.set(message.id, dispatch);
|
|
39669
|
+
const images = message.images?.map((image) => ({
|
|
39670
|
+
type: "image",
|
|
39671
|
+
data: image.data,
|
|
39672
|
+
mimeType: image.mimeType
|
|
39673
|
+
}));
|
|
39674
|
+
try {
|
|
39675
|
+
dispatch.outcome = await dispatchContext.run(dispatch, () => session.steer(message.text, images?.length ? images : void 0));
|
|
39676
|
+
} catch (error109) {
|
|
39677
|
+
if (dispatch.captured.length > 0)
|
|
39678
|
+
throw error109;
|
|
39679
|
+
return {
|
|
39680
|
+
disposition: "rejected",
|
|
39681
|
+
reason: error109 instanceof Error ? error109.message : String(error109)
|
|
39682
|
+
};
|
|
39683
|
+
}
|
|
39684
|
+
if (dispatch.outcome === "handled")
|
|
39685
|
+
return { disposition: "handled" };
|
|
39686
|
+
reportIfConfirmed(dispatch);
|
|
39687
|
+
return { disposition: "queued" };
|
|
39688
|
+
},
|
|
39689
|
+
onConsumed(callback) {
|
|
39690
|
+
consumedCallback = callback;
|
|
39691
|
+
},
|
|
39692
|
+
dispose() {
|
|
39693
|
+
if (disposed)
|
|
39694
|
+
return;
|
|
39695
|
+
disposed = true;
|
|
39696
|
+
if (session.agent.steer === installedAgentSteer)
|
|
39697
|
+
session.agent.steer = originalAgentSteer;
|
|
39698
|
+
if (session.agent.streamFunction === wrappedStreamFunction)
|
|
39699
|
+
session.agent.streamFunction = originalStreamFunction;
|
|
39700
|
+
session.agent.steeringMode = originalSteeringMode;
|
|
39701
|
+
dispatches.clear();
|
|
39702
|
+
}
|
|
39703
|
+
};
|
|
39704
|
+
}
|
|
39705
|
+
|
|
39589
39706
|
// ../../packages/runner-pi/dist/mcp-config.js
|
|
39590
39707
|
import { createJiti } from "jiti";
|
|
39591
39708
|
var MAX_SERVERS = 50;
|
|
@@ -45818,6 +45935,14 @@ function createPiRunner(options = {}) {
|
|
|
45818
45935
|
wakeConsumer?.();
|
|
45819
45936
|
wakeConsumer = null;
|
|
45820
45937
|
};
|
|
45938
|
+
let liveControlRegistered = false;
|
|
45939
|
+
const registerLiveControl = options.liveControl;
|
|
45940
|
+
const liveController = registerLiveControl ? createPiLiveController(session, () => {
|
|
45941
|
+
if (liveControlRegistered)
|
|
45942
|
+
return;
|
|
45943
|
+
liveControlRegistered = true;
|
|
45944
|
+
registerLiveControl(liveController);
|
|
45945
|
+
}) : void 0;
|
|
45821
45946
|
const unsubscribe = session.subscribe((e) => {
|
|
45822
45947
|
eventQueue.push(e);
|
|
45823
45948
|
notify();
|
|
@@ -45915,6 +46040,7 @@ function createPiRunner(options = {}) {
|
|
|
45915
46040
|
if (abortSignal) {
|
|
45916
46041
|
abortSignal.removeEventListener("abort", abortHandler);
|
|
45917
46042
|
}
|
|
46043
|
+
liveController?.dispose();
|
|
45918
46044
|
unsubscribe();
|
|
45919
46045
|
await disposePiSession(session);
|
|
45920
46046
|
}
|
|
@@ -46119,7 +46245,8 @@ function dispatchRunner(runner, base, cwd, options, input2) {
|
|
|
46119
46245
|
mcpConfig: options.mcpConfig,
|
|
46120
46246
|
effort: options.effort,
|
|
46121
46247
|
systemEnv: options.systemEnv,
|
|
46122
|
-
searchContractVersion: options.searchContractVersion
|
|
46248
|
+
searchContractVersion: options.searchContractVersion,
|
|
46249
|
+
liveControl: options.liveControl
|
|
46123
46250
|
}).run(hasStructuredInput ? input2 : compiled.text);
|
|
46124
46251
|
}
|
|
46125
46252
|
case "opencode":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bunny-agent/runner-cli",
|
|
3
|
-
"version": "0.10.0-beta.
|
|
3
|
+
"version": "0.10.0-beta.4",
|
|
4
4
|
"description": "BunnyAgent Runner CLI - Like gemini-cli or claude-code, runs in your local terminal with AI SDK UI streaming",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -60,15 +60,15 @@
|
|
|
60
60
|
"typescript": "^5.3.0",
|
|
61
61
|
"vitest": "^1.6.1",
|
|
62
62
|
"@bunny-agent/apply-patch": "0.1.0",
|
|
63
|
-
"@bunny-agent/manager": "0.10.0-beta.3",
|
|
64
63
|
"@bunny-agent/runner-claude": "0.6.2",
|
|
65
64
|
"@bunny-agent/runner-copilot": "0.1.0",
|
|
66
65
|
"@bunny-agent/runner-gemini": "0.6.2",
|
|
67
66
|
"@bunny-agent/runner-harness": "0.1.1-beta.0",
|
|
68
67
|
"@bunny-agent/runner-opencode": "0.6.2",
|
|
69
|
-
"@bunny-agent/runner-codex": "0.6.2",
|
|
70
68
|
"@bunny-agent/runner-pi": "0.6.4-beta.0",
|
|
71
|
-
"@bunny-agent/server-acp": "0.1.0"
|
|
69
|
+
"@bunny-agent/server-acp": "0.1.0",
|
|
70
|
+
"@bunny-agent/manager": "0.10.0-beta.4",
|
|
71
|
+
"@bunny-agent/runner-codex": "0.6.2"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"build": "tsc && pnpm bundle",
|