@opencow-ai/opencow-agent-sdk 0.4.1 → 0.4.2-beta.0
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/cli.mjs +39 -14
- package/dist/client.js +30 -5
- package/dist/providers/openai/shim.d.ts +1 -0
- package/dist/sdk.js +30 -5
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -84669,9 +84669,7 @@ async function* readSseEvents(response) {
|
|
|
84669
84669
|
if (done)
|
|
84670
84670
|
break;
|
|
84671
84671
|
buffer += decoder.decode(value, { stream: true });
|
|
84672
|
-
const chunks = buffer.split(
|
|
84673
|
-
|
|
84674
|
-
`);
|
|
84672
|
+
const chunks = buffer.split(/\r?\n\r?\n/);
|
|
84675
84673
|
buffer = chunks.pop() ?? "";
|
|
84676
84674
|
for (const chunk of chunks) {
|
|
84677
84675
|
const lines = chunk.split(`
|
|
@@ -84699,6 +84697,25 @@ async function* readSseEvents(response) {
|
|
|
84699
84697
|
yield { event, data };
|
|
84700
84698
|
}
|
|
84701
84699
|
}
|
|
84700
|
+
if (buffer.trim()) {
|
|
84701
|
+
const lines = buffer.split(`
|
|
84702
|
+
`).map((line) => line.trim()).filter(Boolean);
|
|
84703
|
+
const eventLine = lines.find((line) => line.startsWith("event: "));
|
|
84704
|
+
const dataLines = lines.filter((line) => line.startsWith("data: "));
|
|
84705
|
+
if (eventLine && dataLines.length > 0) {
|
|
84706
|
+
const event = eventLine.slice(7).trim();
|
|
84707
|
+
const rawData = dataLines.map((line) => line.slice(6)).join(`
|
|
84708
|
+
`);
|
|
84709
|
+
if (rawData !== "[DONE]") {
|
|
84710
|
+
try {
|
|
84711
|
+
const parsed = JSON.parse(rawData);
|
|
84712
|
+
if (parsed && typeof parsed === "object") {
|
|
84713
|
+
yield { event, data: parsed };
|
|
84714
|
+
}
|
|
84715
|
+
} catch {}
|
|
84716
|
+
}
|
|
84717
|
+
}
|
|
84718
|
+
}
|
|
84702
84719
|
}
|
|
84703
84720
|
function determineStopReason(response, sawToolUse) {
|
|
84704
84721
|
const output = Array.isArray(response?.output) ? response.output : [];
|
|
@@ -85183,6 +85200,7 @@ function convertMessages(messages, system) {
|
|
|
85183
85200
|
} else if (role === "assistant") {
|
|
85184
85201
|
if (Array.isArray(content)) {
|
|
85185
85202
|
const toolUses = content.filter((b) => b.type === "tool_use");
|
|
85203
|
+
const thinkingBlocks = content.filter((b) => b.type === "thinking");
|
|
85186
85204
|
const textContent = content.filter((b) => b.type !== "tool_use" && b.type !== "thinking");
|
|
85187
85205
|
const assistantMsg = {
|
|
85188
85206
|
role: "assistant",
|
|
@@ -85191,6 +85209,13 @@ function convertMessages(messages, system) {
|
|
|
85191
85209
|
return typeof c5 === "string" ? c5 : Array.isArray(c5) ? c5.map((p) => p.text ?? "").join("") : "";
|
|
85192
85210
|
})()
|
|
85193
85211
|
};
|
|
85212
|
+
if (thinkingBlocks.length > 0) {
|
|
85213
|
+
const reasoningText = thinkingBlocks.map((b) => b.thinking ?? "").filter(Boolean).join(`
|
|
85214
|
+
`);
|
|
85215
|
+
if (reasoningText) {
|
|
85216
|
+
assistantMsg.reasoning_content = reasoningText;
|
|
85217
|
+
}
|
|
85218
|
+
}
|
|
85194
85219
|
if (toolUses.length > 0) {
|
|
85195
85220
|
assistantMsg.tool_calls = toolUses.map((tu) => ({
|
|
85196
85221
|
id: tu.id ?? `call_${crypto.randomUUID().replace(/-/g, "")}`,
|
|
@@ -94146,7 +94171,7 @@ function printStartupScreen() {
|
|
|
94146
94171
|
const sLen = ` ● ${sL} Ready — type /help to begin`.length;
|
|
94147
94172
|
out.push(boxRow(sRow, W2, sLen));
|
|
94148
94173
|
out.push(`${rgb(...BORDER)}╚${"═".repeat(W2 - 2)}╝${RESET}`);
|
|
94149
|
-
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.
|
|
94174
|
+
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.2-beta.0"}${RESET}`);
|
|
94150
94175
|
out.push("");
|
|
94151
94176
|
process.stdout.write(out.join(`
|
|
94152
94177
|
`) + `
|
|
@@ -243912,7 +243937,7 @@ function getAnthropicEnvMetadata() {
|
|
|
243912
243937
|
function getBuildAgeMinutes() {
|
|
243913
243938
|
if (false)
|
|
243914
243939
|
;
|
|
243915
|
-
const buildTime = new Date("2026-05-
|
|
243940
|
+
const buildTime = new Date("2026-05-19T09:07:47.609Z").getTime();
|
|
243916
243941
|
if (isNaN(buildTime))
|
|
243917
243942
|
return;
|
|
243918
243943
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -479051,7 +479076,7 @@ function buildPrimarySection() {
|
|
|
479051
479076
|
}, undefined, false, undefined, this);
|
|
479052
479077
|
return [{
|
|
479053
479078
|
label: "Version",
|
|
479054
|
-
value: "0.4.
|
|
479079
|
+
value: "0.4.2-beta.0"
|
|
479055
479080
|
}, {
|
|
479056
479081
|
label: "Session name",
|
|
479057
479082
|
value: nameValue
|
|
@@ -535369,7 +535394,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
535369
535394
|
var call58 = async () => {
|
|
535370
535395
|
return {
|
|
535371
535396
|
type: "text",
|
|
535372
|
-
value: `${"99.0.0"} (built ${"2026-05-
|
|
535397
|
+
value: `${"99.0.0"} (built ${"2026-05-19T09:07:47.609Z"})`
|
|
535373
535398
|
};
|
|
535374
535399
|
}, version2, version_default;
|
|
535375
535400
|
var init_version = __esm(() => {
|
|
@@ -557479,7 +557504,7 @@ function WelcomeV2() {
|
|
|
557479
557504
|
dimColor: true,
|
|
557480
557505
|
children: [
|
|
557481
557506
|
"v",
|
|
557482
|
-
"0.4.
|
|
557507
|
+
"0.4.2-beta.0",
|
|
557483
557508
|
" "
|
|
557484
557509
|
]
|
|
557485
557510
|
}, undefined, true, undefined, this)
|
|
@@ -557679,7 +557704,7 @@ function WelcomeV2() {
|
|
|
557679
557704
|
dimColor: true,
|
|
557680
557705
|
children: [
|
|
557681
557706
|
"v",
|
|
557682
|
-
"0.4.
|
|
557707
|
+
"0.4.2-beta.0",
|
|
557683
557708
|
" "
|
|
557684
557709
|
]
|
|
557685
557710
|
}, undefined, true, undefined, this)
|
|
@@ -557905,7 +557930,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
557905
557930
|
dimColor: true,
|
|
557906
557931
|
children: [
|
|
557907
557932
|
"v",
|
|
557908
|
-
"0.4.
|
|
557933
|
+
"0.4.2-beta.0",
|
|
557909
557934
|
" "
|
|
557910
557935
|
]
|
|
557911
557936
|
}, undefined, true, undefined, this);
|
|
@@ -558159,7 +558184,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
558159
558184
|
dimColor: true,
|
|
558160
558185
|
children: [
|
|
558161
558186
|
"v",
|
|
558162
|
-
"0.4.
|
|
558187
|
+
"0.4.2-beta.0",
|
|
558163
558188
|
" "
|
|
558164
558189
|
]
|
|
558165
558190
|
}, undefined, true, undefined, this);
|
|
@@ -579005,7 +579030,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
579005
579030
|
pendingHookMessages
|
|
579006
579031
|
}, renderAndRun);
|
|
579007
579032
|
}
|
|
579008
|
-
}).version("0.4.
|
|
579033
|
+
}).version("0.4.2-beta.0 (OpenCow)", "-v, --version", "Output the version number");
|
|
579009
579034
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
579010
579035
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
579011
579036
|
if (canUserConfigureAdvisor()) {
|
|
@@ -579651,7 +579676,7 @@ if (false) {}
|
|
|
579651
579676
|
async function main2() {
|
|
579652
579677
|
const args = process.argv.slice(2);
|
|
579653
579678
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
579654
|
-
console.log(`${"0.4.
|
|
579679
|
+
console.log(`${"0.4.2-beta.0"} (OpenCow)`);
|
|
579655
579680
|
return;
|
|
579656
579681
|
}
|
|
579657
579682
|
if (args.includes("--provider")) {
|
|
@@ -579769,4 +579794,4 @@ async function main2() {
|
|
|
579769
579794
|
}
|
|
579770
579795
|
main2();
|
|
579771
579796
|
|
|
579772
|
-
//# debugId=
|
|
579797
|
+
//# debugId=B27BB5D17B4E841F64756E2164756E21
|
package/dist/client.js
CHANGED
|
@@ -95418,9 +95418,7 @@ async function* readSseEvents(response) {
|
|
|
95418
95418
|
if (done)
|
|
95419
95419
|
break;
|
|
95420
95420
|
buffer += decoder.decode(value, { stream: true });
|
|
95421
|
-
const chunks = buffer.split(
|
|
95422
|
-
|
|
95423
|
-
`);
|
|
95421
|
+
const chunks = buffer.split(/\r?\n\r?\n/);
|
|
95424
95422
|
buffer = chunks.pop() ?? "";
|
|
95425
95423
|
for (const chunk of chunks) {
|
|
95426
95424
|
const lines = chunk.split(`
|
|
@@ -95448,6 +95446,25 @@ async function* readSseEvents(response) {
|
|
|
95448
95446
|
yield { event, data };
|
|
95449
95447
|
}
|
|
95450
95448
|
}
|
|
95449
|
+
if (buffer.trim()) {
|
|
95450
|
+
const lines = buffer.split(`
|
|
95451
|
+
`).map((line) => line.trim()).filter(Boolean);
|
|
95452
|
+
const eventLine = lines.find((line) => line.startsWith("event: "));
|
|
95453
|
+
const dataLines = lines.filter((line) => line.startsWith("data: "));
|
|
95454
|
+
if (eventLine && dataLines.length > 0) {
|
|
95455
|
+
const event = eventLine.slice(7).trim();
|
|
95456
|
+
const rawData = dataLines.map((line) => line.slice(6)).join(`
|
|
95457
|
+
`);
|
|
95458
|
+
if (rawData !== "[DONE]") {
|
|
95459
|
+
try {
|
|
95460
|
+
const parsed = JSON.parse(rawData);
|
|
95461
|
+
if (parsed && typeof parsed === "object") {
|
|
95462
|
+
yield { event, data: parsed };
|
|
95463
|
+
}
|
|
95464
|
+
} catch {}
|
|
95465
|
+
}
|
|
95466
|
+
}
|
|
95467
|
+
}
|
|
95451
95468
|
}
|
|
95452
95469
|
function determineStopReason(response, sawToolUse) {
|
|
95453
95470
|
const output = Array.isArray(response?.output) ? response.output : [];
|
|
@@ -96007,6 +96024,7 @@ function convertMessages(messages, system) {
|
|
|
96007
96024
|
} else if (role === "assistant") {
|
|
96008
96025
|
if (Array.isArray(content)) {
|
|
96009
96026
|
const toolUses = content.filter((b) => b.type === "tool_use");
|
|
96027
|
+
const thinkingBlocks = content.filter((b) => b.type === "thinking");
|
|
96010
96028
|
const textContent = content.filter((b) => b.type !== "tool_use" && b.type !== "thinking");
|
|
96011
96029
|
const assistantMsg = {
|
|
96012
96030
|
role: "assistant",
|
|
@@ -96015,6 +96033,13 @@ function convertMessages(messages, system) {
|
|
|
96015
96033
|
return typeof c5 === "string" ? c5 : Array.isArray(c5) ? c5.map((p) => p.text ?? "").join("") : "";
|
|
96016
96034
|
})()
|
|
96017
96035
|
};
|
|
96036
|
+
if (thinkingBlocks.length > 0) {
|
|
96037
|
+
const reasoningText = thinkingBlocks.map((b) => b.thinking ?? "").filter(Boolean).join(`
|
|
96038
|
+
`);
|
|
96039
|
+
if (reasoningText) {
|
|
96040
|
+
assistantMsg.reasoning_content = reasoningText;
|
|
96041
|
+
}
|
|
96042
|
+
}
|
|
96018
96043
|
if (toolUses.length > 0) {
|
|
96019
96044
|
assistantMsg.tool_calls = toolUses.map((tu) => ({
|
|
96020
96045
|
id: tu.id ?? `call_${crypto.randomUUID().replace(/-/g, "")}`,
|
|
@@ -282009,7 +282034,7 @@ function getAnthropicEnvMetadata() {
|
|
|
282009
282034
|
function getBuildAgeMinutes() {
|
|
282010
282035
|
if (false)
|
|
282011
282036
|
;
|
|
282012
|
-
const buildTime = new Date("2026-05-
|
|
282037
|
+
const buildTime = new Date("2026-05-19T09:07:47.609Z").getTime();
|
|
282013
282038
|
if (isNaN(buildTime))
|
|
282014
282039
|
return;
|
|
282015
282040
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -335188,4 +335213,4 @@ export {
|
|
|
335188
335213
|
AbortError2 as AbortError
|
|
335189
335214
|
};
|
|
335190
335215
|
|
|
335191
|
-
//# debugId=
|
|
335216
|
+
//# debugId=E32B2704E5125D2B64756E2164756E21
|
package/dist/sdk.js
CHANGED
|
@@ -95418,9 +95418,7 @@ async function* readSseEvents(response) {
|
|
|
95418
95418
|
if (done)
|
|
95419
95419
|
break;
|
|
95420
95420
|
buffer += decoder.decode(value, { stream: true });
|
|
95421
|
-
const chunks = buffer.split(
|
|
95422
|
-
|
|
95423
|
-
`);
|
|
95421
|
+
const chunks = buffer.split(/\r?\n\r?\n/);
|
|
95424
95422
|
buffer = chunks.pop() ?? "";
|
|
95425
95423
|
for (const chunk of chunks) {
|
|
95426
95424
|
const lines = chunk.split(`
|
|
@@ -95448,6 +95446,25 @@ async function* readSseEvents(response) {
|
|
|
95448
95446
|
yield { event, data };
|
|
95449
95447
|
}
|
|
95450
95448
|
}
|
|
95449
|
+
if (buffer.trim()) {
|
|
95450
|
+
const lines = buffer.split(`
|
|
95451
|
+
`).map((line) => line.trim()).filter(Boolean);
|
|
95452
|
+
const eventLine = lines.find((line) => line.startsWith("event: "));
|
|
95453
|
+
const dataLines = lines.filter((line) => line.startsWith("data: "));
|
|
95454
|
+
if (eventLine && dataLines.length > 0) {
|
|
95455
|
+
const event = eventLine.slice(7).trim();
|
|
95456
|
+
const rawData = dataLines.map((line) => line.slice(6)).join(`
|
|
95457
|
+
`);
|
|
95458
|
+
if (rawData !== "[DONE]") {
|
|
95459
|
+
try {
|
|
95460
|
+
const parsed = JSON.parse(rawData);
|
|
95461
|
+
if (parsed && typeof parsed === "object") {
|
|
95462
|
+
yield { event, data: parsed };
|
|
95463
|
+
}
|
|
95464
|
+
} catch {}
|
|
95465
|
+
}
|
|
95466
|
+
}
|
|
95467
|
+
}
|
|
95451
95468
|
}
|
|
95452
95469
|
function determineStopReason(response, sawToolUse) {
|
|
95453
95470
|
const output = Array.isArray(response?.output) ? response.output : [];
|
|
@@ -96007,6 +96024,7 @@ function convertMessages(messages, system) {
|
|
|
96007
96024
|
} else if (role === "assistant") {
|
|
96008
96025
|
if (Array.isArray(content)) {
|
|
96009
96026
|
const toolUses = content.filter((b) => b.type === "tool_use");
|
|
96027
|
+
const thinkingBlocks = content.filter((b) => b.type === "thinking");
|
|
96010
96028
|
const textContent = content.filter((b) => b.type !== "tool_use" && b.type !== "thinking");
|
|
96011
96029
|
const assistantMsg = {
|
|
96012
96030
|
role: "assistant",
|
|
@@ -96015,6 +96033,13 @@ function convertMessages(messages, system) {
|
|
|
96015
96033
|
return typeof c5 === "string" ? c5 : Array.isArray(c5) ? c5.map((p) => p.text ?? "").join("") : "";
|
|
96016
96034
|
})()
|
|
96017
96035
|
};
|
|
96036
|
+
if (thinkingBlocks.length > 0) {
|
|
96037
|
+
const reasoningText = thinkingBlocks.map((b) => b.thinking ?? "").filter(Boolean).join(`
|
|
96038
|
+
`);
|
|
96039
|
+
if (reasoningText) {
|
|
96040
|
+
assistantMsg.reasoning_content = reasoningText;
|
|
96041
|
+
}
|
|
96042
|
+
}
|
|
96018
96043
|
if (toolUses.length > 0) {
|
|
96019
96044
|
assistantMsg.tool_calls = toolUses.map((tu) => ({
|
|
96020
96045
|
id: tu.id ?? `call_${crypto.randomUUID().replace(/-/g, "")}`,
|
|
@@ -282009,7 +282034,7 @@ function getAnthropicEnvMetadata() {
|
|
|
282009
282034
|
function getBuildAgeMinutes() {
|
|
282010
282035
|
if (false)
|
|
282011
282036
|
;
|
|
282012
|
-
const buildTime = new Date("2026-05-
|
|
282037
|
+
const buildTime = new Date("2026-05-19T09:07:47.609Z").getTime();
|
|
282013
282038
|
if (isNaN(buildTime))
|
|
282014
282039
|
return;
|
|
282015
282040
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -335188,4 +335213,4 @@ export {
|
|
|
335188
335213
|
AbortError2 as AbortError
|
|
335189
335214
|
};
|
|
335190
335215
|
|
|
335191
|
-
//# debugId=
|
|
335216
|
+
//# debugId=84304F203C57EF9364756E2164756E21
|
package/package.json
CHANGED