clawcompany 0.30.0 → 0.32.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/index.js +60 -36
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2149,7 +2149,7 @@ import { join } from "path";
|
|
|
2149
2149
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
2150
2150
|
function banner() {
|
|
2151
2151
|
console.log("");
|
|
2152
|
-
console.log(" \u{1F99E} ClawCompany v0.
|
|
2152
|
+
console.log(" \u{1F99E} ClawCompany v0.32.0");
|
|
2153
2153
|
console.log(" Build for OPC. Every human being is a chairman.");
|
|
2154
2154
|
console.log("");
|
|
2155
2155
|
}
|
|
@@ -2381,7 +2381,7 @@ async function marketInstallCommand(itemId) {
|
|
|
2381
2381
|
const builtin = BUILTIN_ROLES.find((r) => r.id === id);
|
|
2382
2382
|
const name = overrides.name ?? builtin?.name ?? id;
|
|
2383
2383
|
const model = overrides.model ?? builtin?.model ?? "default";
|
|
2384
|
-
const reportsTo = overrides.reportsTo ?? builtin?.reportsTo ??
|
|
2384
|
+
const reportsTo = overrides.reportsTo ?? builtin?.reportsTo ?? null;
|
|
2385
2385
|
const pricing = MODEL_PRICING[model];
|
|
2386
2386
|
const cost = pricing ? `$${pricing.input}/$${pricing.output}` : "";
|
|
2387
2387
|
activeRoles.push({ id, name, model, reportsTo });
|
|
@@ -2655,41 +2655,62 @@ var OpenAICompatibleProvider = class _OpenAICompatibleProvider {
|
|
|
2655
2655
|
let promptTokens = 0;
|
|
2656
2656
|
let completionTokens = 0;
|
|
2657
2657
|
const toolCallBuffers = /* @__PURE__ */ new Map();
|
|
2658
|
-
const
|
|
2659
|
-
const
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2658
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
2659
|
+
const isSSE = contentType.includes("text/event-stream");
|
|
2660
|
+
if (!isSSE) {
|
|
2661
|
+
const data = await response.json();
|
|
2662
|
+
content = data.choices?.[0]?.message?.content ?? "";
|
|
2663
|
+
model = data.model ?? params.model;
|
|
2664
|
+
finishReason = data.choices?.[0]?.finish_reason ?? "stop";
|
|
2665
|
+
promptTokens = data.usage?.prompt_tokens ?? 0;
|
|
2666
|
+
completionTokens = data.usage?.completion_tokens ?? 0;
|
|
2667
|
+
const tcList = data.choices?.[0]?.message?.tool_calls;
|
|
2668
|
+
if (tcList?.length) {
|
|
2669
|
+
for (const tc of tcList) {
|
|
2670
|
+
toolCallBuffers.set(toolCallBuffers.size, {
|
|
2671
|
+
id: tc.id,
|
|
2672
|
+
name: tc.function?.name ?? "",
|
|
2673
|
+
args: tc.function?.arguments ?? ""
|
|
2674
|
+
});
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
} else {
|
|
2678
|
+
const reader = response.body.getReader();
|
|
2679
|
+
const decoder = new TextDecoder();
|
|
2680
|
+
let buffer = "";
|
|
2681
|
+
while (true) {
|
|
2682
|
+
const { done, value } = await reader.read();
|
|
2683
|
+
if (done) break;
|
|
2684
|
+
buffer += decoder.decode(value, { stream: true });
|
|
2685
|
+
const lines = buffer.split("\n");
|
|
2686
|
+
buffer = lines.pop() ?? "";
|
|
2687
|
+
for (const line of lines) {
|
|
2688
|
+
if (!line.startsWith("data: ") || line === "data: [DONE]") continue;
|
|
2689
|
+
try {
|
|
2690
|
+
const chunk = JSON.parse(line.slice(6));
|
|
2691
|
+
const delta = chunk.choices?.[0]?.delta;
|
|
2692
|
+
if (delta?.content) content += delta.content;
|
|
2693
|
+
if (chunk.model) model = chunk.model;
|
|
2694
|
+
const fr = chunk.choices?.[0]?.finish_reason;
|
|
2695
|
+
if (fr) finishReason = fr;
|
|
2696
|
+
if (delta?.tool_calls) {
|
|
2697
|
+
for (const tc of delta.tool_calls) {
|
|
2698
|
+
const idx = tc.index ?? 0;
|
|
2699
|
+
if (!toolCallBuffers.has(idx)) {
|
|
2700
|
+
toolCallBuffers.set(idx, { id: tc.id ?? `call_${idx}`, name: "", args: "" });
|
|
2701
|
+
}
|
|
2702
|
+
const buf = toolCallBuffers.get(idx);
|
|
2703
|
+
if (tc.id) buf.id = tc.id;
|
|
2704
|
+
if (tc.function?.name) buf.name = tc.function.name;
|
|
2705
|
+
if (tc.function?.arguments) buf.args += tc.function.arguments;
|
|
2681
2706
|
}
|
|
2682
|
-
const buf = toolCallBuffers.get(idx);
|
|
2683
|
-
if (tc.id) buf.id = tc.id;
|
|
2684
|
-
if (tc.function?.name) buf.name = tc.function.name;
|
|
2685
|
-
if (tc.function?.arguments) buf.args += tc.function.arguments;
|
|
2686
2707
|
}
|
|
2708
|
+
if (chunk.usage) {
|
|
2709
|
+
promptTokens = chunk.usage.prompt_tokens ?? 0;
|
|
2710
|
+
completionTokens = chunk.usage.completion_tokens ?? 0;
|
|
2711
|
+
}
|
|
2712
|
+
} catch {
|
|
2687
2713
|
}
|
|
2688
|
-
if (chunk.usage) {
|
|
2689
|
-
promptTokens = chunk.usage.prompt_tokens ?? 0;
|
|
2690
|
-
completionTokens = chunk.usage.completion_tokens ?? 0;
|
|
2691
|
-
}
|
|
2692
|
-
} catch {
|
|
2693
2714
|
}
|
|
2694
2715
|
}
|
|
2695
2716
|
}
|
|
@@ -3532,8 +3553,11 @@ var TaskOrchestrator = class {
|
|
|
3532
3553
|
}
|
|
3533
3554
|
/** Get the leader role ID (reportsTo === null) */
|
|
3534
3555
|
getLeaderId() {
|
|
3535
|
-
const
|
|
3536
|
-
|
|
3556
|
+
const roles = this.router.getRoles().filter((r) => r.budgetTier !== "survive");
|
|
3557
|
+
const leader = roles.find((r) => r.reportsTo === null);
|
|
3558
|
+
if (leader) return leader.id;
|
|
3559
|
+
if (roles.length > 0) return roles[0].id;
|
|
3560
|
+
throw new Error("No active roles configured");
|
|
3537
3561
|
}
|
|
3538
3562
|
/**
|
|
3539
3563
|
* Phase 2: Leader decomposes mission into work streams.
|
package/package.json
CHANGED