clawcompany 0.24.0 → 0.26.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 +33 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -395,7 +395,13 @@ RULES: Stay focused on the assigned task. Do not expand scope. If blocked, repor
395
395
  id: "fallback_a",
396
396
  name: "Fallback A",
397
397
  description: "Low-balance fallback.",
398
- systemPrompt: `Fallback agent. Low-balance mode. Be concise. Output only what's needed.`,
398
+ systemPrompt: `Fallback agent. Low-balance mode. Be concise. Output only what's needed.
399
+
400
+ ## SOP
401
+ 1. Receive task \u2192 classify urgency.
402
+ 2. If simple \u2192 answer directly (\u2264100 words).
403
+ 3. If complex \u2192 summarise what's needed and escalate.
404
+ 4. Never exceed token budget.`,
399
405
  model: "gpt-oss-120b",
400
406
  provider: "clawapi",
401
407
  reportsTo: null,
@@ -416,7 +422,12 @@ RULES: Stay focused on the assigned task. Do not expand scope. If blocked, repor
416
422
  id: "fallback_b",
417
423
  name: "Fallback B",
418
424
  description: "Minimum cost, last resort.",
419
- systemPrompt: `Last-resort agent. Extremely low balance. Classification, tagging, yes/no only.`,
425
+ systemPrompt: `Last-resort agent. Extremely low balance. Classification, tagging, yes/no only.
426
+
427
+ ## SOP
428
+ 1. Receive task \u2192 classify as yes/no/tag.
429
+ 2. Output one-line answer only.
430
+ 3. Never generate long text \u2014 budget is near zero.`,
420
431
  model: "gpt-oss-20b",
421
432
  provider: "clawapi",
422
433
  reportsTo: null,
@@ -1929,7 +1940,7 @@ import { join } from "path";
1929
1940
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
1930
1941
  function banner() {
1931
1942
  console.log("");
1932
- console.log(" \u{1F99E} ClawCompany v0.24.0");
1943
+ console.log(" \u{1F99E} ClawCompany v0.26.0");
1933
1944
  console.log(" Build for OPC. Every human being is a chairman.");
1934
1945
  console.log("");
1935
1946
  }
@@ -2905,15 +2916,17 @@ ${text.slice(0, 5e3)}`;
2905
2916
  }
2906
2917
  const html = await response.text();
2907
2918
  const results = [];
2908
- const resultBlocks = html.split('class="result__body"');
2919
+ const resultBlocks = html.split(/result__body">/);
2909
2920
  for (let i = 1; i < resultBlocks.length && results.length < limit; i++) {
2910
2921
  const block = resultBlocks[i];
2911
- const titleMatch = block.match(/class="result__a"[^>]*>([^<]+)</);
2912
- const title = titleMatch?.[1]?.trim() ?? "";
2922
+ const prevTail = resultBlocks[i - 1].slice(-300);
2923
+ if (prevTail.includes("result--ad")) continue;
2924
+ const titleMatch = block.match(/class="result__a"[^>]*>([^<]+)/);
2925
+ const title = titleMatch?.[1]?.replace(/&amp;/g, "&")?.replace(/&quot;/g, '"')?.replace(/&#x27;/g, "'")?.trim() ?? "";
2913
2926
  const urlMatch = block.match(/href="\/\/duckduckgo\.com\/l\/\?[^"]*uddg=([^&"]+)/);
2914
2927
  const url = urlMatch?.[1] ? decodeURIComponent(urlMatch[1]) : "";
2915
2928
  const snippetMatch = block.match(/class="result__snippet"[^>]*>([\s\S]*?)<\/a>/);
2916
- const snippet = snippetMatch?.[1]?.replace(/<[^>]+>/g, "")?.replace(/\s+/g, " ")?.trim() ?? "";
2929
+ const snippet = snippetMatch?.[1]?.replace(/<[^>]+>/g, "")?.replace(/&quot;/g, '"')?.replace(/&#x27;/g, "'")?.replace(/&amp;/g, "&")?.replace(/\s+/g, " ")?.trim() ?? "";
2917
2930
  if (title && url) {
2918
2931
  results.push({ title, url, snippet });
2919
2932
  }
@@ -3266,16 +3279,21 @@ var TaskOrchestrator = class {
3266
3279
  setMemoryContext(ctx) {
3267
3280
  this.memoryContext = ctx;
3268
3281
  }
3282
+ /** Get the leader role ID (reportsTo === null) */
3283
+ getLeaderId() {
3284
+ const leader = this.router.getRoles().find((r) => r.reportsTo === null && r.budgetTier !== "survive");
3285
+ return leader?.id ?? "ceo";
3286
+ }
3269
3287
  /**
3270
- * Phase 2: CEO decomposes mission into work streams.
3271
- * Human (Chairman) gives the mission → CEO breaks it down.
3288
+ * Phase 2: Leader decomposes mission into work streams.
3289
+ * Human (Chairman) gives the mission → leader breaks it down.
3272
3290
  */
3273
3291
  async decompose(mission) {
3274
- const ceo = this.router.getRole("ceo");
3275
- if (!ceo) throw new Error("CEO role not configured");
3276
- const roles = this.router.getRoles().filter((r) => r.isActive && r.id !== "ceo" && r.budgetTier !== "survive");
3292
+ const leader = this.router.getRoles().find((r) => r.reportsTo === null && r.budgetTier !== "survive");
3293
+ if (!leader) throw new Error("No leader role configured");
3294
+ const roles = this.router.getRoles().filter((r) => r.isActive && r.id !== leader.id && r.budgetTier !== "survive");
3277
3295
  const roleList = roles.map((r) => `- ${r.id}: ${r.name} (${r.model}) \u2014 ${r.description}`).join("\n");
3278
- const response = await this.router.chatAsRole("ceo", [
3296
+ const response = await this.router.chatAsRole(leader.id, [
3279
3297
  {
3280
3298
  role: "user",
3281
3299
  content: `Mission from the Chairman (human):
@@ -3424,8 +3442,8 @@ ${this.memoryContext}` : ""}
3424
3442
 
3425
3443
  Today's date is ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.`,
3426
3444
  assignedTo: ws.assignTo,
3427
- createdBy: "ceo",
3428
- reportTo: "ceo",
3445
+ createdBy: this.getLeaderId(),
3446
+ reportTo: this.getLeaderId(),
3429
3447
  status: "in_progress",
3430
3448
  priority: 1,
3431
3449
  tokensIn: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawcompany",
3
- "version": "0.24.0",
3
+ "version": "0.26.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" },