clawcompany 0.41.0 → 0.50.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.
Files changed (2) hide show
  1. package/dist/index.js +68 -59
  2. 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.41.0");
2152
+ console.log(" \u{1F99E} ClawCompany v0.50.0");
2153
2153
  console.log(" Build for OPC. Every human being is a chairman.");
2154
2154
  console.log("");
2155
2155
  }
@@ -3670,54 +3670,79 @@ Respond ONLY with JSON:
3670
3670
  const results = /* @__PURE__ */ new Map();
3671
3671
  const totalStart = Date.now();
3672
3672
  let totalCost = 0;
3673
- const order = this.topologicalSort(workStreams);
3673
+ const completed = /* @__PURE__ */ new Set();
3674
+ const remaining = new Map(workStreams.map((ws) => [ws.id, ws]));
3674
3675
  console.log(`
3675
- \u{1F4CB} Executing ${order.length} work streams...
3676
+ \u{1F4CB} Executing ${workStreams.length} work streams (batch-parallel)...
3676
3677
  `);
3677
- for (const ws of order) {
3678
- const depOutputs = {};
3679
- for (const depId of ws.dependencies) {
3680
- const dep = results.get(depId);
3681
- if (dep && dep.status === "completed") depOutputs[depId] = dep.output;
3678
+ let batch = 1;
3679
+ while (remaining.size > 0) {
3680
+ const ready = [...remaining.values()].filter(
3681
+ (ws) => (ws.dependencies ?? []).every((dep) => completed.has(dep))
3682
+ );
3683
+ if (ready.length === 0) {
3684
+ console.log(` \u26A0\uFE0F Unresolvable dependencies \u2014 forcing remaining streams`);
3685
+ ready.push(...remaining.values());
3682
3686
  }
3683
- const role2 = this.router.getRole(ws.assignTo);
3684
- const roleName = role2?.name ?? ws.assignTo;
3685
- const modelName = role2?.model ?? "unknown";
3686
- console.log(` \u26A1 ${ws.id}: ${ws.title}`);
3687
- console.log(` \u2192 ${roleName} (${modelName})`);
3688
- const startTime = Date.now();
3689
- try {
3690
- const output = await this.executeWorkStream(ws, depOutputs);
3691
- const elapsed = ((Date.now() - startTime) / 1e3).toFixed(1);
3692
- results.set(ws.id, {
3693
- workStreamId: ws.id,
3694
- title: ws.title,
3695
- assignedTo: ws.assignTo,
3696
- output: output.content,
3697
- cost: output.cost,
3698
- tokensIn: output.tokensIn,
3699
- tokensOut: output.tokensOut,
3700
- model: output.model,
3701
- status: "completed"
3702
- });
3703
- totalCost += output.cost;
3704
- console.log(` \u2705 Done (${elapsed}s, $${output.cost.toFixed(4)})
3687
+ console.log(` \u{1F4E6} Batch ${batch}: ${ready.map((ws) => ws.id).join(", ")}
3705
3688
  `);
3706
- } catch (err) {
3707
- console.log(` \u274C Failed: ${err.message}
3689
+ const batchResults = await Promise.all(ready.map(async (ws) => {
3690
+ const depOutputs = {};
3691
+ for (const depId of ws.dependencies ?? []) {
3692
+ const dep = results.get(depId);
3693
+ if (dep && dep.status === "completed") depOutputs[depId] = dep.output;
3694
+ }
3695
+ const role2 = this.router.getRole(ws.assignTo);
3696
+ const roleName = role2?.name ?? ws.assignTo;
3697
+ const modelName = role2?.model ?? "unknown";
3698
+ console.log(` \u26A1 ${ws.id}: ${ws.title}`);
3699
+ console.log(` \u2192 ${roleName} (${modelName})`);
3700
+ const startTime = Date.now();
3701
+ try {
3702
+ const output = await this.executeWorkStream(ws, depOutputs);
3703
+ const elapsed = ((Date.now() - startTime) / 1e3).toFixed(1);
3704
+ totalCost += output.cost;
3705
+ console.log(` \u2705 Done (${elapsed}s, $${output.cost.toFixed(4)})
3708
3706
  `);
3709
- results.set(ws.id, {
3710
- workStreamId: ws.id,
3711
- title: ws.title,
3712
- assignedTo: ws.assignTo,
3713
- output: `Error: ${err.message}`,
3714
- cost: 0,
3715
- tokensIn: 0,
3716
- tokensOut: 0,
3717
- model: "none",
3718
- status: "failed"
3719
- });
3707
+ return {
3708
+ id: ws.id,
3709
+ result: {
3710
+ workStreamId: ws.id,
3711
+ title: ws.title,
3712
+ assignedTo: ws.assignTo,
3713
+ output: output.content,
3714
+ cost: output.cost,
3715
+ tokensIn: output.tokensIn,
3716
+ tokensOut: output.tokensOut,
3717
+ model: output.model,
3718
+ status: "completed"
3719
+ }
3720
+ };
3721
+ } catch (err) {
3722
+ console.log(` \u274C Failed: ${err.message}
3723
+ `);
3724
+ return {
3725
+ id: ws.id,
3726
+ result: {
3727
+ workStreamId: ws.id,
3728
+ title: ws.title,
3729
+ assignedTo: ws.assignTo,
3730
+ output: `Error: ${err.message}`,
3731
+ cost: 0,
3732
+ tokensIn: 0,
3733
+ tokensOut: 0,
3734
+ model: "none",
3735
+ status: "failed"
3736
+ }
3737
+ };
3738
+ }
3739
+ }));
3740
+ for (const { id, result } of batchResults) {
3741
+ results.set(id, result);
3742
+ completed.add(id);
3743
+ remaining.delete(id);
3720
3744
  }
3745
+ batch++;
3721
3746
  }
3722
3747
  const totalElapsed = ((Date.now() - totalStart) / 1e3).toFixed(1);
3723
3748
  console.log(` \u{1F4CA} All work streams complete: ${totalElapsed}s, $${totalCost.toFixed(4)} total
@@ -3779,22 +3804,6 @@ Today's date is ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.`,
3779
3804
  toolCallCount: result.toolCallCount
3780
3805
  };
3781
3806
  }
3782
- topologicalSort(workStreams) {
3783
- const sorted = [];
3784
- const visited = /* @__PURE__ */ new Set();
3785
- const wsMap = new Map(workStreams.map((ws) => [ws.id, ws]));
3786
- const visit = (ws) => {
3787
- if (visited.has(ws.id)) return;
3788
- visited.add(ws.id);
3789
- for (const depId of ws.dependencies) {
3790
- const dep = wsMap.get(depId);
3791
- if (dep) visit(dep);
3792
- }
3793
- sorted.push(ws);
3794
- };
3795
- for (const ws of workStreams) visit(ws);
3796
- return sorted;
3797
- }
3798
3807
  };
3799
3808
 
3800
3809
  // src/commands/mission.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawcompany",
3
- "version": "0.41.0",
3
+ "version": "0.50.0",
4
4
  "description": "Build for OPC. Every human being is a chairman. AI company infrastructure — one key, 9 roles, 4 models.",
5
5
  "type": "module",
6
6
  "bin": { "clawcompany": "dist/index.js" },