@bivy/bivy 0.16.6-staging.4 → 0.16.6-staging.6
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/bin/agent-manifest.json
CHANGED
package/dist/agents/profiles.js
CHANGED
|
@@ -356,6 +356,7 @@ export const AGENT_PROFILES = {
|
|
|
356
356
|
command: "grok",
|
|
357
357
|
packageName: "grok (curl -fsSL https://x.ai/cli/install.sh | bash)",
|
|
358
358
|
supportTier: "supported",
|
|
359
|
+
testedVersion: "1.0.0",
|
|
359
360
|
authOwner: "mixed",
|
|
360
361
|
blurb: "xAI's official Grok coding agent (Grok CLI) — SuperGrok/X subscription or API key.",
|
|
361
362
|
// Official CLI: `grok -p "<prompt>"` (alias `--single`) runs one headless
|
|
@@ -369,6 +370,13 @@ export const AGENT_PROFILES = {
|
|
|
369
370
|
// TUI uses the same store via `grok --resume <id>`. Model ids match
|
|
370
371
|
// `grok models` for the official CLI (override with BIVY_GROK_MODELS).
|
|
371
372
|
args: ["-p"],
|
|
373
|
+
// The current CLI's streaming-json mode is ACP's standard NDJSON envelope.
|
|
374
|
+
// The shared tolerant parser unwraps session/update notifications, including
|
|
375
|
+
// tool calls/results and sub-agent activity, so Grok gets faithful transcripts
|
|
376
|
+
// without a Grok-specific adapter. Keep the plain args as the explicit
|
|
377
|
+
// BIVY_AGENT_STRUCTURED=0 fallback.
|
|
378
|
+
jsonArgs: ["--output-format", "streaming-json", "-p"],
|
|
379
|
+
parserId: "generic-stream-json",
|
|
372
380
|
resume: {
|
|
373
381
|
template: ["--resume", "{id}", "-p"],
|
|
374
382
|
historyLoader: "grok",
|
|
@@ -542,8 +542,19 @@ export function geminiJsonParser() {
|
|
|
542
542
|
* event carries no assistant text (a control frame), so the caller can ignore it.
|
|
543
543
|
*/
|
|
544
544
|
function textFromStreamEvent(msg) {
|
|
545
|
+
// ACP session/update notifications nest the update below JSON-RPC params.
|
|
546
|
+
// Grok's streaming-json mode uses this standard shape, while other CLIs put
|
|
547
|
+
// the same content directly on the event. Unwrap it before applying the
|
|
548
|
+
// broad fallbacks below so ACP remains a generic capability, not an agent
|
|
549
|
+
// specific parser.
|
|
550
|
+
const nested = msg.params?.update
|
|
551
|
+
?? msg.update;
|
|
552
|
+
const source = nested && typeof nested === "object" ? nested : msg;
|
|
553
|
+
const nestedContent = source.content;
|
|
554
|
+
if (nestedContent && typeof nestedContent.text === "string")
|
|
555
|
+
return nestedContent.text;
|
|
545
556
|
// Claude / ACP assistant shape: { message: { content: [{type:"text",text}] } }.
|
|
546
|
-
const mc =
|
|
557
|
+
const mc = source.message?.content;
|
|
547
558
|
if (Array.isArray(mc)) {
|
|
548
559
|
return mc.map((b) => (b && typeof b === "object" && typeof b.text === "string" ? b.text : "")).join("");
|
|
549
560
|
}
|
|
@@ -569,8 +580,34 @@ function textFromStreamEvent(msg) {
|
|
|
569
580
|
}
|
|
570
581
|
return "";
|
|
571
582
|
}
|
|
583
|
+
/** Extract an ACP tool update from a JSON-RPC session/update notification.
|
|
584
|
+
* ACP deliberately calls these updates rather than tool calls; mapping the
|
|
585
|
+
* common fields here lets any ACP-speaking CLI show the same tool cards. */
|
|
586
|
+
function acpToolUpdate(msg) {
|
|
587
|
+
const params = msg.params;
|
|
588
|
+
const update = (params?.update ?? msg.update);
|
|
589
|
+
if (!update || typeof update !== "object")
|
|
590
|
+
return undefined;
|
|
591
|
+
const type = String(update.sessionUpdate ?? update.type ?? "").toLowerCase();
|
|
592
|
+
const id = String(update.toolCallId ?? update.tool_call_id ?? update.id ?? "");
|
|
593
|
+
if (!id)
|
|
594
|
+
return undefined;
|
|
595
|
+
if (type === "tool_call" || type === "tool_call_started" || type === "tool_call_start") {
|
|
596
|
+
return { kind: "call", id, name: String(update.title ?? update.name ?? "tool"), input: update.rawInput ?? update.input ?? update.arguments };
|
|
597
|
+
}
|
|
598
|
+
if (type === "tool_call_update" || type === "tool_result" || type === "tool_call_completed") {
|
|
599
|
+
const status = String(update.status ?? "").toLowerCase();
|
|
600
|
+
// ACP sends progress updates through the same envelope. Only close the
|
|
601
|
+
// card once it has a terminal status or an actual result payload.
|
|
602
|
+
const output = update.rawOutput ?? update.output ?? update.content ?? update.result;
|
|
603
|
+
if (type === "tool_call_update" && (status === "in_progress" || status === "pending" || (output === undefined && !["completed", "failed", "error"].includes(status))))
|
|
604
|
+
return undefined;
|
|
605
|
+
return { kind: "result", id, output, error: status === "failed" || status === "error" };
|
|
606
|
+
}
|
|
607
|
+
return undefined;
|
|
608
|
+
}
|
|
572
609
|
// Event `type` values that mean "the turn is finished" across the various CLIs.
|
|
573
|
-
const STREAM_TERMINALS = new Set(["result", "done", "complete", "completed", "turn.completed", "session.done", "message_stop", "response.completed", "final"]);
|
|
610
|
+
const STREAM_TERMINALS = new Set(["result", "done", "complete", "completed", "turn.completed", "session.done", "session_end", "session/ended", "message_stop", "response.completed", "final"]);
|
|
574
611
|
/**
|
|
575
612
|
* A TOLERANT line-delimited JSON parser for CLIs whose `--stream-json` /
|
|
576
613
|
* `--format json` streaming vocabularies we haven't pinned exactly (Amp, Cursor,
|
|
@@ -599,7 +636,14 @@ export function genericStreamJsonParser() {
|
|
|
599
636
|
return events;
|
|
600
637
|
}
|
|
601
638
|
acc.addUsage(extractTokenUsage(msg.usage ?? msg.stats ?? msg));
|
|
602
|
-
const
|
|
639
|
+
const nestedUpdate = (msg.params?.update
|
|
640
|
+
?? msg.update);
|
|
641
|
+
const type = String(msg.type ?? msg.method ?? nestedUpdate?.sessionUpdate ?? nestedUpdate?.type ?? "");
|
|
642
|
+
const tool = acpToolUpdate(msg);
|
|
643
|
+
if (tool?.kind === "call")
|
|
644
|
+
acc.addToolUse(tool.id, tool.name ?? "tool", tool.input, events);
|
|
645
|
+
else if (tool?.kind === "result")
|
|
646
|
+
acc.addToolResult(tool.id, tool.name ?? "tool", tool.output, events, tool.error);
|
|
603
647
|
if (msg.error && !type.includes("delta")) {
|
|
604
648
|
const m = msg.error.message ?? msg.error;
|
|
605
649
|
events.push({ type: "session.error", error: String(m) });
|
package/package.json
CHANGED