clawcompany 0.11.0 → 0.13.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 +290 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26,21 +26,21 @@ function getDefaultConfig() {
26
26
  version: "1.0",
27
27
  providers: [DEFAULT_CLAWAPI_PROVIDER],
28
28
  roles: rolesMap,
29
- fallbackChain: DEFAULT_FALLBACK_CHAIN
29
+ fallbackChain: DEFAULT_FALLBACK_CHAIN,
30
+ activeTemplate: "default"
30
31
  };
31
32
  }
32
- function getBuiltinRole(id) {
33
- return BUILTIN_ROLES.find((r) => r.id === id);
34
- }
35
33
  function resolveRoles(config) {
34
+ const templateId = config.activeTemplate ?? "default";
35
+ const template = TEMPLATES[templateId] ?? DEFAULT_TEMPLATE;
36
36
  const resolved = [];
37
37
  for (const [id, overrides] of Object.entries(config.roles)) {
38
- const builtin = getBuiltinRole(id);
38
+ const builtin = template.roles.find((r) => r.id === id);
39
39
  if (builtin) {
40
40
  resolved.push({ ...builtin, ...overrides, id, isBuiltin: true, updatedAt: (/* @__PURE__ */ new Date()).toISOString() });
41
41
  } else {
42
42
  if (!overrides.name || !overrides.model) {
43
- throw new Error(`Custom role "${id}" must have at least "name" and "model"`);
43
+ continue;
44
44
  }
45
45
  resolved.push({
46
46
  id,
@@ -49,9 +49,9 @@ function resolveRoles(config) {
49
49
  systemPrompt: overrides.systemPrompt ?? `You are ${overrides.name}.`,
50
50
  model: overrides.model,
51
51
  provider: overrides.provider ?? config.providers[0]?.id ?? "clawapi",
52
- reportsTo: overrides.reportsTo ?? "ceo",
52
+ reportsTo: overrides.reportsTo ?? null,
53
53
  canDelegateTo: overrides.canDelegateTo ?? [],
54
- canEscalateTo: overrides.canEscalateTo ?? [overrides.reportsTo ?? "ceo"],
54
+ canEscalateTo: overrides.canEscalateTo ?? [],
55
55
  budgetTier: overrides.budgetTier ?? "save",
56
56
  budgetMonthly: overrides.budgetMonthly ?? null,
57
57
  maxTokensPerTask: overrides.maxTokensPerTask ?? null,
@@ -67,7 +67,7 @@ function resolveRoles(config) {
67
67
  }
68
68
  return resolved;
69
69
  }
70
- var DEFAULT_CLAWAPI_PROVIDER, BUILTIN_ROLES, DEFAULT_FALLBACK_CHAIN, MODEL_PRICING;
70
+ var DEFAULT_CLAWAPI_PROVIDER, BUILTIN_ROLES, DEFAULT_TEMPLATE, YC_STARTUP_ROLES, YC_STARTUP_TEMPLATE, TEMPLATES, DEFAULT_FALLBACK_CHAIN, MODEL_PRICING;
71
71
  var init_defaults = __esm({
72
72
  "../packages/shared/src/defaults.ts"() {
73
73
  "use strict";
@@ -197,7 +197,7 @@ Own marketing strategy, content creation, brand voice, growth initiatives. Write
197
197
  budgetTier: "earn",
198
198
  budgetMonthly: null,
199
199
  maxTokensPerTask: null,
200
- tools: ["http", "filesystem", "web_fetch", "web_search"],
200
+ tools: ["http", "filesystem", "web_fetch", "web_search", "browser_use"],
201
201
  skills: [],
202
202
  isBuiltin: true,
203
203
  isActive: true,
@@ -223,7 +223,7 @@ CRITICAL: All data, figures, prices, and statistics MUST come from tool calls (w
223
223
  budgetTier: "earn",
224
224
  budgetMonthly: null,
225
225
  maxTokensPerTask: null,
226
- tools: ["http", "filesystem", "web_fetch", "web_search", "price_feed"],
226
+ tools: ["http", "filesystem", "web_fetch", "web_search", "price_feed", "browser_use"],
227
227
  skills: [],
228
228
  isBuiltin: true,
229
229
  isActive: true,
@@ -271,7 +271,7 @@ Write code, implement features, fix bugs, write tests. Execute the technical vis
271
271
  budgetTier: "earn",
272
272
  budgetMonthly: null,
273
273
  maxTokensPerTask: null,
274
- tools: ["shell", "filesystem", "http", "code_interpreter"],
274
+ tools: ["shell", "filesystem", "http", "code_interpreter", "browser_use"],
275
275
  skills: ["coding"],
276
276
  isBuiltin: true,
277
277
  isActive: true,
@@ -370,6 +370,206 @@ CRITICAL: When collecting data (prices, statistics, figures), you MUST use tools
370
370
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
371
371
  }
372
372
  ];
373
+ DEFAULT_TEMPLATE = {
374
+ id: "default",
375
+ name: "Default",
376
+ icon: "\u{1F99E}",
377
+ description: "General purpose AI company \u2014 9 roles, 4 models",
378
+ roles: BUILTIN_ROLES
379
+ };
380
+ YC_STARTUP_ROLES = [
381
+ {
382
+ id: "founder_coach",
383
+ name: "Founder Coach",
384
+ description: "YC-style partner \u2014 rethinks problems before executing.",
385
+ systemPrompt: `You are the Founder Coach \u2014 a YC-style partner who has seen 10,000 startups.
386
+ When the Chairman gives you a mission or idea, DO NOT execute it immediately. Your job is to RETHINK THE PROBLEM FIRST.
387
+
388
+ PHASE 1 \u2014 UNDERSTAND:
389
+ 1. What specific pain are we solving?
390
+ 2. Who experiences this pain?
391
+ 3. What do they do today?
392
+ 4. Why hasn't someone solved this?
393
+ 5. What would a 10-star version look like?
394
+ 6. What's the simplest version we could ship this week?
395
+
396
+ PHASE 2 \u2014 CHALLENGE: Push back on the framing. Identify hidden assumptions. Suggest alternatives.
397
+
398
+ PHASE 3 \u2014 DESIGN DOC: Problem statement, Target user, Core insight, MVP scope, Success metrics, Risks.
399
+
400
+ DELEGATION: Architecture \u2192 Tech Lead, UI/UX \u2192 Designer, Implementation \u2192 Engineer, Testing \u2192 QA, Growth \u2192 Growth Hacker, Market analysis \u2192 Product Manager.
401
+
402
+ COST AWARENESS: You are the most expensive role. Delegate execution immediately after alignment.`,
403
+ model: "claude-opus-4-6",
404
+ provider: "clawapi",
405
+ reportsTo: null,
406
+ canDelegateTo: ["product_manager", "tech_lead", "designer", "engineer", "qa", "growth_hacker"],
407
+ canEscalateTo: [],
408
+ budgetTier: "earn",
409
+ budgetMonthly: null,
410
+ maxTokensPerTask: null,
411
+ tools: ["web_fetch", "web_search", "price_feed", "browser_use"],
412
+ skills: [],
413
+ isBuiltin: true,
414
+ isActive: true,
415
+ heartbeatInterval: 0,
416
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
417
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
418
+ },
419
+ {
420
+ id: "product_manager",
421
+ name: "Product Manager",
422
+ description: 'Owns the "what" and "why" \u2014 specs, user stories, prioritization.',
423
+ systemPrompt: `You are the Product Manager \u2014 you own the "what" and "why."
424
+ Translate vision into actionable specs. Define user stories with acceptance criteria. Prioritize ruthlessly. Say NO to features that don't serve the core user. Every feature ships with a way to measure its impact.`,
425
+ model: "claude-sonnet-4-6",
426
+ provider: "clawapi",
427
+ reportsTo: "founder_coach",
428
+ canDelegateTo: ["designer", "engineer", "growth_hacker"],
429
+ canEscalateTo: ["founder_coach"],
430
+ budgetTier: "save",
431
+ budgetMonthly: null,
432
+ maxTokensPerTask: null,
433
+ tools: ["web_fetch", "web_search"],
434
+ skills: [],
435
+ isBuiltin: true,
436
+ isActive: true,
437
+ heartbeatInterval: 0,
438
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
439
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
440
+ },
441
+ {
442
+ id: "tech_lead",
443
+ name: "Tech Lead",
444
+ description: "Technical architecture, engineering quality, system design.",
445
+ systemPrompt: `You are the Tech Lead \u2014 you own technical architecture and engineering quality.
446
+ Review every plan for technical feasibility. Design system architecture: data flow, APIs, edge cases. Identify technical debt. Enforce coding standards and security practices.
447
+
448
+ Principles: Simple > clever. Make it work, make it right, make it fast.`,
449
+ model: "gpt-5.4",
450
+ provider: "clawapi",
451
+ reportsTo: "founder_coach",
452
+ canDelegateTo: ["engineer", "qa"],
453
+ canEscalateTo: ["founder_coach"],
454
+ budgetTier: "save",
455
+ budgetMonthly: null,
456
+ maxTokensPerTask: null,
457
+ tools: ["shell", "filesystem", "http", "code_interpreter", "web_fetch"],
458
+ skills: ["coding"],
459
+ isBuiltin: true,
460
+ isActive: true,
461
+ heartbeatInterval: 0,
462
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
463
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
464
+ },
465
+ {
466
+ id: "designer",
467
+ name: "Designer",
468
+ description: "User experience, interface design, user flows.",
469
+ systemPrompt: `You are the Designer \u2014 you own the user experience.
470
+ Design intuitive interfaces. Create user flows before wireframes. Push for simplicity.
471
+
472
+ Principles: "Don't make me think." One primary action per screen. The best UI is no UI.
473
+ Rate designs 0-10 on: Clarity, Simplicity, Delight, Consistency, Accessibility.`,
474
+ model: "claude-sonnet-4-6",
475
+ provider: "clawapi",
476
+ reportsTo: "founder_coach",
477
+ canDelegateTo: ["engineer"],
478
+ canEscalateTo: ["founder_coach"],
479
+ budgetTier: "save",
480
+ budgetMonthly: null,
481
+ maxTokensPerTask: null,
482
+ tools: ["web_fetch", "web_search", "browser_use"],
483
+ skills: [],
484
+ isBuiltin: true,
485
+ isActive: true,
486
+ heartbeatInterval: 0,
487
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
488
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
489
+ },
490
+ {
491
+ id: "engineer",
492
+ name: "Engineer",
493
+ description: "Code implementation, debugging, testing, feature development.",
494
+ systemPrompt: `You are the Engineer \u2014 you write the code that ships.
495
+ Read the spec FIRST. Write tests alongside code. Small commits. Handle errors. No magic numbers. DRY but don't over-abstract. Working software > perfect software.`,
496
+ model: "gpt-5.4",
497
+ provider: "clawapi",
498
+ reportsTo: "tech_lead",
499
+ canDelegateTo: ["qa"],
500
+ canEscalateTo: ["tech_lead"],
501
+ budgetTier: "save",
502
+ budgetMonthly: null,
503
+ maxTokensPerTask: null,
504
+ tools: ["shell", "filesystem", "http", "code_interpreter", "browser_use"],
505
+ skills: ["coding"],
506
+ isBuiltin: true,
507
+ isActive: true,
508
+ heartbeatInterval: 0,
509
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
510
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
511
+ },
512
+ {
513
+ id: "qa",
514
+ name: "QA",
515
+ description: "Testing \u2014 happy path, edge cases, error paths, security, performance.",
516
+ systemPrompt: `You are the QA Engineer \u2014 you break things so users don't have to.
517
+ Test: happy path, edge cases, error paths, security, performance, regression.
518
+
519
+ Bug report format: Title, Steps to reproduce, Expected, Actual, Severity.`,
520
+ model: "gpt-5-mini",
521
+ provider: "clawapi",
522
+ reportsTo: "tech_lead",
523
+ canDelegateTo: [],
524
+ canEscalateTo: ["tech_lead"],
525
+ budgetTier: "save",
526
+ budgetMonthly: null,
527
+ maxTokensPerTask: null,
528
+ tools: ["shell", "filesystem", "http", "browser_use"],
529
+ skills: [],
530
+ isBuiltin: true,
531
+ isActive: true,
532
+ heartbeatInterval: 0,
533
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
534
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
535
+ },
536
+ {
537
+ id: "growth_hacker",
538
+ name: "Growth Hacker",
539
+ description: "User acquisition, activation, retention \u2014 AARRR framework.",
540
+ systemPrompt: `You are the Growth Hacker \u2014 you find users and make them stay.
541
+ AARRR framework: Acquisition, Activation, Retention, Revenue, Referral.
542
+
543
+ Design experiments: Hypothesis, Control, Variant, Sample size, Success criteria.
544
+ Measure everything. Retention > acquisition.`,
545
+ model: "gemini-3.1-flash-lite",
546
+ provider: "clawapi",
547
+ reportsTo: "product_manager",
548
+ canDelegateTo: [],
549
+ canEscalateTo: ["product_manager"],
550
+ budgetTier: "save",
551
+ budgetMonthly: null,
552
+ maxTokensPerTask: null,
553
+ tools: ["web_fetch", "web_search", "price_feed", "browser_use"],
554
+ skills: [],
555
+ isBuiltin: true,
556
+ isActive: true,
557
+ heartbeatInterval: 0,
558
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
559
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
560
+ }
561
+ ];
562
+ YC_STARTUP_TEMPLATE = {
563
+ id: "yc_startup",
564
+ name: "YC Startup",
565
+ icon: "\u{1F680}",
566
+ description: "Lean startup team \u2014 7 roles, YC methodology, ship fast",
567
+ roles: YC_STARTUP_ROLES
568
+ };
569
+ TEMPLATES = {
570
+ default: DEFAULT_TEMPLATE,
571
+ yc_startup: YC_STARTUP_TEMPLATE
572
+ };
373
573
  DEFAULT_FALLBACK_CHAIN = [
374
574
  "claude-opus-4-6",
375
575
  "claude-sonnet-4-6",
@@ -947,7 +1147,7 @@ import { join } from "path";
947
1147
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
948
1148
  function banner() {
949
1149
  console.log("");
950
- console.log(" \u{1F99E} ClawCompany v0.11.0");
1150
+ console.log(" \u{1F99E} ClawCompany v0.13.0");
951
1151
  console.log(" Build for OPC. Every human being is a chairman.");
952
1152
  console.log("");
953
1153
  }
@@ -1833,6 +2033,8 @@ var ToolExecutor = class {
1833
2033
  return this.execWebSearch(args);
1834
2034
  case "price_feed":
1835
2035
  return this.execPriceFeed(args);
2036
+ case "browser_use":
2037
+ return this.execBrowserUse(args);
1836
2038
  default:
1837
2039
  return `Unknown tool: ${toolName}`;
1838
2040
  }
@@ -1975,6 +2177,57 @@ ${text.slice(0, 5e3)}`;
1975
2177
  return `Error: ${err.message}`;
1976
2178
  }
1977
2179
  }
2180
+ async execBrowserUse(args) {
2181
+ const { action, url, index, text, path, code, direction } = args;
2182
+ let cmd;
2183
+ switch (action) {
2184
+ case "open":
2185
+ if (!url) return "Error: url is required for open action";
2186
+ cmd = `browser-use open ${JSON.stringify(url)}`;
2187
+ break;
2188
+ case "state":
2189
+ cmd = "browser-use state --json";
2190
+ break;
2191
+ case "click":
2192
+ if (index === void 0) return "Error: index is required for click action";
2193
+ cmd = `browser-use click ${index}`;
2194
+ break;
2195
+ case "type":
2196
+ if (!text) return "Error: text is required for type action";
2197
+ cmd = `browser-use type ${JSON.stringify(text)}`;
2198
+ break;
2199
+ case "input":
2200
+ if (index === void 0 || !text) return "Error: index and text are required for input action";
2201
+ cmd = `browser-use input ${index} ${JSON.stringify(text)}`;
2202
+ break;
2203
+ case "screenshot":
2204
+ cmd = `browser-use screenshot ${JSON.stringify(path ?? "/tmp/screenshot.png")}`;
2205
+ break;
2206
+ case "eval":
2207
+ if (!code) return "Error: code is required for eval action";
2208
+ cmd = `browser-use eval ${JSON.stringify(code)}`;
2209
+ break;
2210
+ case "scroll":
2211
+ if (!direction) return "Error: direction is required for scroll action";
2212
+ cmd = `browser-use scroll ${direction}`;
2213
+ break;
2214
+ case "close":
2215
+ cmd = "browser-use close";
2216
+ break;
2217
+ default:
2218
+ return `Unknown browser action: ${action}. Valid: open, state, click, type, input, screenshot, eval, scroll, close`;
2219
+ }
2220
+ try {
2221
+ const { stdout, stderr } = await execAsync(cmd, { timeout: 3e4 });
2222
+ return stdout + (stderr ? `
2223
+ STDERR: ${stderr}` : "");
2224
+ } catch (err) {
2225
+ if (err.code === "ENOENT" || err.message?.includes("not found") || err.message?.includes("ENOENT")) {
2226
+ return "Error: browser-use not installed. Run: pip install browser-use && browser-use install";
2227
+ }
2228
+ return `Error: ${err.message}`;
2229
+ }
2230
+ }
1978
2231
  async execPriceFeed(args) {
1979
2232
  const asset = (args.asset ?? "bitcoin").toLowerCase();
1980
2233
  const currency = (args.currency ?? "usd").toLowerCase();
@@ -2106,6 +2359,30 @@ var BUILTIN_TOOLS = {
2106
2359
  }
2107
2360
  }
2108
2361
  },
2362
+ browser_use: {
2363
+ type: "function",
2364
+ function: {
2365
+ name: "browser_use",
2366
+ description: "Control a web browser \u2014 navigate pages, click elements, fill forms, take screenshots, run JavaScript. Uses browser-use CLI.",
2367
+ parameters: {
2368
+ type: "object",
2369
+ properties: {
2370
+ action: {
2371
+ type: "string",
2372
+ enum: ["open", "state", "click", "type", "input", "screenshot", "eval", "scroll", "close"],
2373
+ description: "Browser action to perform"
2374
+ },
2375
+ url: { type: "string", description: "URL to open (for open action)" },
2376
+ index: { type: "number", description: "Element index to interact with (for click/input actions)" },
2377
+ text: { type: "string", description: "Text to type (for type/input actions)" },
2378
+ path: { type: "string", description: "Screenshot save path (default: /tmp/screenshot.png)" },
2379
+ code: { type: "string", description: "JavaScript code to evaluate (for eval action)" },
2380
+ direction: { type: "string", enum: ["up", "down"], description: "Scroll direction (for scroll action)" }
2381
+ },
2382
+ required: ["action"]
2383
+ }
2384
+ }
2385
+ },
2109
2386
  price_feed: {
2110
2387
  type: "function",
2111
2388
  function: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawcompany",
3
- "version": "0.11.0",
3
+ "version": "0.13.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" },