@opencow-ai/opencow-agent-sdk 0.4.2-beta.0 → 0.4.2
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 +51 -51
- package/dist/client.js +42 -42
- package/dist/sdk.js +42 -42
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -84275,6 +84275,40 @@ var init_schema = __esm(() => {
|
|
|
84275
84275
|
});
|
|
84276
84276
|
|
|
84277
84277
|
// src/providers/codex/shim.ts
|
|
84278
|
+
function parseSseChunk(chunk) {
|
|
84279
|
+
const lines = chunk.split(`
|
|
84280
|
+
`).map((line) => line.trim()).filter(Boolean);
|
|
84281
|
+
if (lines.length === 0)
|
|
84282
|
+
return null;
|
|
84283
|
+
const eventLine = lines.find((line) => line.startsWith("event:"));
|
|
84284
|
+
const dataStart = lines.findIndex((line) => line.startsWith("data:"));
|
|
84285
|
+
if (dataStart < 0)
|
|
84286
|
+
return null;
|
|
84287
|
+
const rawData = lines.slice(dataStart).flatMap((line) => {
|
|
84288
|
+
if (line.startsWith("data:")) {
|
|
84289
|
+
return [line.slice(5).trimStart()];
|
|
84290
|
+
}
|
|
84291
|
+
if (line.startsWith("event:") || line.startsWith("id:") || line.startsWith("retry:")) {
|
|
84292
|
+
return [];
|
|
84293
|
+
}
|
|
84294
|
+
return [line];
|
|
84295
|
+
}).join(`
|
|
84296
|
+
`).trim();
|
|
84297
|
+
if (!rawData || /^\[DONE\s*\]$/.test(rawData))
|
|
84298
|
+
return null;
|
|
84299
|
+
try {
|
|
84300
|
+
const parsed = JSON.parse(rawData);
|
|
84301
|
+
if (!parsed || typeof parsed !== "object")
|
|
84302
|
+
return null;
|
|
84303
|
+
const data = parsed;
|
|
84304
|
+
const event = eventLine?.slice(6).trim() || (typeof data.type === "string" ? data.type : "");
|
|
84305
|
+
if (!event)
|
|
84306
|
+
return null;
|
|
84307
|
+
return { event, data };
|
|
84308
|
+
} catch {
|
|
84309
|
+
return null;
|
|
84310
|
+
}
|
|
84311
|
+
}
|
|
84278
84312
|
function makeUsage(usage) {
|
|
84279
84313
|
return {
|
|
84280
84314
|
input_tokens: usage?.input_tokens ?? 0,
|
|
@@ -84672,49 +84706,15 @@ async function* readSseEvents(response) {
|
|
|
84672
84706
|
const chunks = buffer.split(/\r?\n\r?\n/);
|
|
84673
84707
|
buffer = chunks.pop() ?? "";
|
|
84674
84708
|
for (const chunk of chunks) {
|
|
84675
|
-
const
|
|
84676
|
-
|
|
84677
|
-
|
|
84678
|
-
continue;
|
|
84679
|
-
const eventLine = lines.find((line) => line.startsWith("event: "));
|
|
84680
|
-
const dataLines = lines.filter((line) => line.startsWith("data: "));
|
|
84681
|
-
if (!eventLine || dataLines.length === 0)
|
|
84682
|
-
continue;
|
|
84683
|
-
const event = eventLine.slice(7).trim();
|
|
84684
|
-
const rawData = dataLines.map((line) => line.slice(6)).join(`
|
|
84685
|
-
`);
|
|
84686
|
-
if (rawData === "[DONE]")
|
|
84687
|
-
continue;
|
|
84688
|
-
let data;
|
|
84689
|
-
try {
|
|
84690
|
-
const parsed = JSON.parse(rawData);
|
|
84691
|
-
if (!parsed || typeof parsed !== "object")
|
|
84692
|
-
continue;
|
|
84693
|
-
data = parsed;
|
|
84694
|
-
} catch {
|
|
84695
|
-
continue;
|
|
84696
|
-
}
|
|
84697
|
-
yield { event, data };
|
|
84709
|
+
const parsed = parseSseChunk(chunk);
|
|
84710
|
+
if (parsed)
|
|
84711
|
+
yield parsed;
|
|
84698
84712
|
}
|
|
84699
84713
|
}
|
|
84700
84714
|
if (buffer.trim()) {
|
|
84701
|
-
const
|
|
84702
|
-
|
|
84703
|
-
|
|
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
|
-
}
|
|
84715
|
+
const parsed = parseSseChunk(buffer);
|
|
84716
|
+
if (parsed)
|
|
84717
|
+
yield parsed;
|
|
84718
84718
|
}
|
|
84719
84719
|
}
|
|
84720
84720
|
function determineStopReason(response, sawToolUse) {
|
|
@@ -94171,7 +94171,7 @@ function printStartupScreen() {
|
|
|
94171
94171
|
const sLen = ` ● ${sL} Ready — type /help to begin`.length;
|
|
94172
94172
|
out.push(boxRow(sRow, W2, sLen));
|
|
94173
94173
|
out.push(`${rgb(...BORDER)}╚${"═".repeat(W2 - 2)}╝${RESET}`);
|
|
94174
|
-
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.2
|
|
94174
|
+
out.push(` ${DIM}${rgb(...DIMCOL)}opencow ${RESET}${rgb(...ACCENT)}v${"0.4.2"}${RESET}`);
|
|
94175
94175
|
out.push("");
|
|
94176
94176
|
process.stdout.write(out.join(`
|
|
94177
94177
|
`) + `
|
|
@@ -243937,7 +243937,7 @@ function getAnthropicEnvMetadata() {
|
|
|
243937
243937
|
function getBuildAgeMinutes() {
|
|
243938
243938
|
if (false)
|
|
243939
243939
|
;
|
|
243940
|
-
const buildTime = new Date("2026-05-
|
|
243940
|
+
const buildTime = new Date("2026-05-19T14:04:55.374Z").getTime();
|
|
243941
243941
|
if (isNaN(buildTime))
|
|
243942
243942
|
return;
|
|
243943
243943
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -479076,7 +479076,7 @@ function buildPrimarySection() {
|
|
|
479076
479076
|
}, undefined, false, undefined, this);
|
|
479077
479077
|
return [{
|
|
479078
479078
|
label: "Version",
|
|
479079
|
-
value: "0.4.2
|
|
479079
|
+
value: "0.4.2"
|
|
479080
479080
|
}, {
|
|
479081
479081
|
label: "Session name",
|
|
479082
479082
|
value: nameValue
|
|
@@ -535394,7 +535394,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
535394
535394
|
var call58 = async () => {
|
|
535395
535395
|
return {
|
|
535396
535396
|
type: "text",
|
|
535397
|
-
value: `${"99.0.0"} (built ${"2026-05-
|
|
535397
|
+
value: `${"99.0.0"} (built ${"2026-05-19T14:04:55.374Z"})`
|
|
535398
535398
|
};
|
|
535399
535399
|
}, version2, version_default;
|
|
535400
535400
|
var init_version = __esm(() => {
|
|
@@ -557504,7 +557504,7 @@ function WelcomeV2() {
|
|
|
557504
557504
|
dimColor: true,
|
|
557505
557505
|
children: [
|
|
557506
557506
|
"v",
|
|
557507
|
-
"0.4.2
|
|
557507
|
+
"0.4.2",
|
|
557508
557508
|
" "
|
|
557509
557509
|
]
|
|
557510
557510
|
}, undefined, true, undefined, this)
|
|
@@ -557704,7 +557704,7 @@ function WelcomeV2() {
|
|
|
557704
557704
|
dimColor: true,
|
|
557705
557705
|
children: [
|
|
557706
557706
|
"v",
|
|
557707
|
-
"0.4.2
|
|
557707
|
+
"0.4.2",
|
|
557708
557708
|
" "
|
|
557709
557709
|
]
|
|
557710
557710
|
}, undefined, true, undefined, this)
|
|
@@ -557930,7 +557930,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
557930
557930
|
dimColor: true,
|
|
557931
557931
|
children: [
|
|
557932
557932
|
"v",
|
|
557933
|
-
"0.4.2
|
|
557933
|
+
"0.4.2",
|
|
557934
557934
|
" "
|
|
557935
557935
|
]
|
|
557936
557936
|
}, undefined, true, undefined, this);
|
|
@@ -558184,7 +558184,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
558184
558184
|
dimColor: true,
|
|
558185
558185
|
children: [
|
|
558186
558186
|
"v",
|
|
558187
|
-
"0.4.2
|
|
558187
|
+
"0.4.2",
|
|
558188
558188
|
" "
|
|
558189
558189
|
]
|
|
558190
558190
|
}, undefined, true, undefined, this);
|
|
@@ -579030,7 +579030,7 @@ Usage: claude --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
579030
579030
|
pendingHookMessages
|
|
579031
579031
|
}, renderAndRun);
|
|
579032
579032
|
}
|
|
579033
|
-
}).version("0.4.2
|
|
579033
|
+
}).version("0.4.2 (OpenCow)", "-v, --version", "Output the version number");
|
|
579034
579034
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
579035
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.");
|
|
579036
579036
|
if (canUserConfigureAdvisor()) {
|
|
@@ -579676,7 +579676,7 @@ if (false) {}
|
|
|
579676
579676
|
async function main2() {
|
|
579677
579677
|
const args = process.argv.slice(2);
|
|
579678
579678
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
579679
|
-
console.log(`${"0.4.2
|
|
579679
|
+
console.log(`${"0.4.2"} (OpenCow)`);
|
|
579680
579680
|
return;
|
|
579681
579681
|
}
|
|
579682
579682
|
if (args.includes("--provider")) {
|
|
@@ -579794,4 +579794,4 @@ async function main2() {
|
|
|
579794
579794
|
}
|
|
579795
579795
|
main2();
|
|
579796
579796
|
|
|
579797
|
-
//# debugId=
|
|
579797
|
+
//# debugId=04CA1BD278A0566564756E2164756E21
|
package/dist/client.js
CHANGED
|
@@ -95024,6 +95024,40 @@ var init_schema = __esm(() => {
|
|
|
95024
95024
|
});
|
|
95025
95025
|
|
|
95026
95026
|
// src/providers/codex/shim.ts
|
|
95027
|
+
function parseSseChunk(chunk) {
|
|
95028
|
+
const lines = chunk.split(`
|
|
95029
|
+
`).map((line) => line.trim()).filter(Boolean);
|
|
95030
|
+
if (lines.length === 0)
|
|
95031
|
+
return null;
|
|
95032
|
+
const eventLine = lines.find((line) => line.startsWith("event:"));
|
|
95033
|
+
const dataStart = lines.findIndex((line) => line.startsWith("data:"));
|
|
95034
|
+
if (dataStart < 0)
|
|
95035
|
+
return null;
|
|
95036
|
+
const rawData = lines.slice(dataStart).flatMap((line) => {
|
|
95037
|
+
if (line.startsWith("data:")) {
|
|
95038
|
+
return [line.slice(5).trimStart()];
|
|
95039
|
+
}
|
|
95040
|
+
if (line.startsWith("event:") || line.startsWith("id:") || line.startsWith("retry:")) {
|
|
95041
|
+
return [];
|
|
95042
|
+
}
|
|
95043
|
+
return [line];
|
|
95044
|
+
}).join(`
|
|
95045
|
+
`).trim();
|
|
95046
|
+
if (!rawData || /^\[DONE\s*\]$/.test(rawData))
|
|
95047
|
+
return null;
|
|
95048
|
+
try {
|
|
95049
|
+
const parsed = JSON.parse(rawData);
|
|
95050
|
+
if (!parsed || typeof parsed !== "object")
|
|
95051
|
+
return null;
|
|
95052
|
+
const data = parsed;
|
|
95053
|
+
const event = eventLine?.slice(6).trim() || (typeof data.type === "string" ? data.type : "");
|
|
95054
|
+
if (!event)
|
|
95055
|
+
return null;
|
|
95056
|
+
return { event, data };
|
|
95057
|
+
} catch {
|
|
95058
|
+
return null;
|
|
95059
|
+
}
|
|
95060
|
+
}
|
|
95027
95061
|
function makeUsage(usage) {
|
|
95028
95062
|
return {
|
|
95029
95063
|
input_tokens: usage?.input_tokens ?? 0,
|
|
@@ -95421,49 +95455,15 @@ async function* readSseEvents(response) {
|
|
|
95421
95455
|
const chunks = buffer.split(/\r?\n\r?\n/);
|
|
95422
95456
|
buffer = chunks.pop() ?? "";
|
|
95423
95457
|
for (const chunk of chunks) {
|
|
95424
|
-
const
|
|
95425
|
-
|
|
95426
|
-
|
|
95427
|
-
continue;
|
|
95428
|
-
const eventLine = lines.find((line) => line.startsWith("event: "));
|
|
95429
|
-
const dataLines = lines.filter((line) => line.startsWith("data: "));
|
|
95430
|
-
if (!eventLine || dataLines.length === 0)
|
|
95431
|
-
continue;
|
|
95432
|
-
const event = eventLine.slice(7).trim();
|
|
95433
|
-
const rawData = dataLines.map((line) => line.slice(6)).join(`
|
|
95434
|
-
`);
|
|
95435
|
-
if (rawData === "[DONE]")
|
|
95436
|
-
continue;
|
|
95437
|
-
let data;
|
|
95438
|
-
try {
|
|
95439
|
-
const parsed = JSON.parse(rawData);
|
|
95440
|
-
if (!parsed || typeof parsed !== "object")
|
|
95441
|
-
continue;
|
|
95442
|
-
data = parsed;
|
|
95443
|
-
} catch {
|
|
95444
|
-
continue;
|
|
95445
|
-
}
|
|
95446
|
-
yield { event, data };
|
|
95458
|
+
const parsed = parseSseChunk(chunk);
|
|
95459
|
+
if (parsed)
|
|
95460
|
+
yield parsed;
|
|
95447
95461
|
}
|
|
95448
95462
|
}
|
|
95449
95463
|
if (buffer.trim()) {
|
|
95450
|
-
const
|
|
95451
|
-
|
|
95452
|
-
|
|
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
|
-
}
|
|
95464
|
+
const parsed = parseSseChunk(buffer);
|
|
95465
|
+
if (parsed)
|
|
95466
|
+
yield parsed;
|
|
95467
95467
|
}
|
|
95468
95468
|
}
|
|
95469
95469
|
function determineStopReason(response, sawToolUse) {
|
|
@@ -282034,7 +282034,7 @@ function getAnthropicEnvMetadata() {
|
|
|
282034
282034
|
function getBuildAgeMinutes() {
|
|
282035
282035
|
if (false)
|
|
282036
282036
|
;
|
|
282037
|
-
const buildTime = new Date("2026-05-
|
|
282037
|
+
const buildTime = new Date("2026-05-19T14:04:55.374Z").getTime();
|
|
282038
282038
|
if (isNaN(buildTime))
|
|
282039
282039
|
return;
|
|
282040
282040
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -335213,4 +335213,4 @@ export {
|
|
|
335213
335213
|
AbortError2 as AbortError
|
|
335214
335214
|
};
|
|
335215
335215
|
|
|
335216
|
-
//# debugId=
|
|
335216
|
+
//# debugId=003768B505C730B064756E2164756E21
|
package/dist/sdk.js
CHANGED
|
@@ -95024,6 +95024,40 @@ var init_schema = __esm(() => {
|
|
|
95024
95024
|
});
|
|
95025
95025
|
|
|
95026
95026
|
// src/providers/codex/shim.ts
|
|
95027
|
+
function parseSseChunk(chunk) {
|
|
95028
|
+
const lines = chunk.split(`
|
|
95029
|
+
`).map((line) => line.trim()).filter(Boolean);
|
|
95030
|
+
if (lines.length === 0)
|
|
95031
|
+
return null;
|
|
95032
|
+
const eventLine = lines.find((line) => line.startsWith("event:"));
|
|
95033
|
+
const dataStart = lines.findIndex((line) => line.startsWith("data:"));
|
|
95034
|
+
if (dataStart < 0)
|
|
95035
|
+
return null;
|
|
95036
|
+
const rawData = lines.slice(dataStart).flatMap((line) => {
|
|
95037
|
+
if (line.startsWith("data:")) {
|
|
95038
|
+
return [line.slice(5).trimStart()];
|
|
95039
|
+
}
|
|
95040
|
+
if (line.startsWith("event:") || line.startsWith("id:") || line.startsWith("retry:")) {
|
|
95041
|
+
return [];
|
|
95042
|
+
}
|
|
95043
|
+
return [line];
|
|
95044
|
+
}).join(`
|
|
95045
|
+
`).trim();
|
|
95046
|
+
if (!rawData || /^\[DONE\s*\]$/.test(rawData))
|
|
95047
|
+
return null;
|
|
95048
|
+
try {
|
|
95049
|
+
const parsed = JSON.parse(rawData);
|
|
95050
|
+
if (!parsed || typeof parsed !== "object")
|
|
95051
|
+
return null;
|
|
95052
|
+
const data = parsed;
|
|
95053
|
+
const event = eventLine?.slice(6).trim() || (typeof data.type === "string" ? data.type : "");
|
|
95054
|
+
if (!event)
|
|
95055
|
+
return null;
|
|
95056
|
+
return { event, data };
|
|
95057
|
+
} catch {
|
|
95058
|
+
return null;
|
|
95059
|
+
}
|
|
95060
|
+
}
|
|
95027
95061
|
function makeUsage(usage) {
|
|
95028
95062
|
return {
|
|
95029
95063
|
input_tokens: usage?.input_tokens ?? 0,
|
|
@@ -95421,49 +95455,15 @@ async function* readSseEvents(response) {
|
|
|
95421
95455
|
const chunks = buffer.split(/\r?\n\r?\n/);
|
|
95422
95456
|
buffer = chunks.pop() ?? "";
|
|
95423
95457
|
for (const chunk of chunks) {
|
|
95424
|
-
const
|
|
95425
|
-
|
|
95426
|
-
|
|
95427
|
-
continue;
|
|
95428
|
-
const eventLine = lines.find((line) => line.startsWith("event: "));
|
|
95429
|
-
const dataLines = lines.filter((line) => line.startsWith("data: "));
|
|
95430
|
-
if (!eventLine || dataLines.length === 0)
|
|
95431
|
-
continue;
|
|
95432
|
-
const event = eventLine.slice(7).trim();
|
|
95433
|
-
const rawData = dataLines.map((line) => line.slice(6)).join(`
|
|
95434
|
-
`);
|
|
95435
|
-
if (rawData === "[DONE]")
|
|
95436
|
-
continue;
|
|
95437
|
-
let data;
|
|
95438
|
-
try {
|
|
95439
|
-
const parsed = JSON.parse(rawData);
|
|
95440
|
-
if (!parsed || typeof parsed !== "object")
|
|
95441
|
-
continue;
|
|
95442
|
-
data = parsed;
|
|
95443
|
-
} catch {
|
|
95444
|
-
continue;
|
|
95445
|
-
}
|
|
95446
|
-
yield { event, data };
|
|
95458
|
+
const parsed = parseSseChunk(chunk);
|
|
95459
|
+
if (parsed)
|
|
95460
|
+
yield parsed;
|
|
95447
95461
|
}
|
|
95448
95462
|
}
|
|
95449
95463
|
if (buffer.trim()) {
|
|
95450
|
-
const
|
|
95451
|
-
|
|
95452
|
-
|
|
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
|
-
}
|
|
95464
|
+
const parsed = parseSseChunk(buffer);
|
|
95465
|
+
if (parsed)
|
|
95466
|
+
yield parsed;
|
|
95467
95467
|
}
|
|
95468
95468
|
}
|
|
95469
95469
|
function determineStopReason(response, sawToolUse) {
|
|
@@ -282034,7 +282034,7 @@ function getAnthropicEnvMetadata() {
|
|
|
282034
282034
|
function getBuildAgeMinutes() {
|
|
282035
282035
|
if (false)
|
|
282036
282036
|
;
|
|
282037
|
-
const buildTime = new Date("2026-05-
|
|
282037
|
+
const buildTime = new Date("2026-05-19T14:04:55.374Z").getTime();
|
|
282038
282038
|
if (isNaN(buildTime))
|
|
282039
282039
|
return;
|
|
282040
282040
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -335213,4 +335213,4 @@ export {
|
|
|
335213
335213
|
AbortError2 as AbortError
|
|
335214
335214
|
};
|
|
335215
335215
|
|
|
335216
|
-
//# debugId=
|
|
335216
|
+
//# debugId=5D257F90247BA0D364756E2164756E21
|
package/package.json
CHANGED