lazyclaw 6.3.1 → 6.5.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 (179) hide show
  1. package/README.ko.md +5 -1
  2. package/README.md +17 -13
  3. package/agents.mjs +54 -4
  4. package/channels-discord/index.mjs +5 -1
  5. package/channels-email/index.mjs +4 -3
  6. package/channels-whatsapp/index.mjs +3 -2
  7. package/chat_window.mjs +11 -2
  8. package/cli.mjs +103 -3
  9. package/commands/agents.mjs +7 -193
  10. package/commands/agents_registry.mjs +205 -0
  11. package/commands/auth_nodes.mjs +19 -1
  12. package/commands/automation.mjs +28 -94
  13. package/commands/automation_loops.mjs +94 -0
  14. package/commands/channels.mjs +46 -3
  15. package/commands/chat.mjs +127 -704
  16. package/commands/chat_hardening.mjs +23 -0
  17. package/commands/chat_legacy_slash.mjs +716 -0
  18. package/commands/config.mjs +36 -2
  19. package/commands/daemon.mjs +99 -1
  20. package/commands/gateway.mjs +123 -4
  21. package/commands/help_text.mjs +78 -0
  22. package/commands/mcp.mjs +150 -0
  23. package/commands/misc.mjs +20 -0
  24. package/commands/sessions.mjs +68 -8
  25. package/commands/setup.mjs +44 -80
  26. package/commands/setup_channels.mjs +219 -47
  27. package/commands/skills.mjs +19 -1
  28. package/commands/workflow_named.mjs +137 -0
  29. package/config-validate.mjs +10 -1
  30. package/config_features.mjs +45 -0
  31. package/cron.mjs +19 -8
  32. package/daemon/lib/auth.mjs +25 -0
  33. package/daemon/lib/cost.mjs +41 -0
  34. package/daemon/lib/respond.mjs +20 -1
  35. package/daemon/lib/team_inbound.mjs +69 -0
  36. package/daemon/route_table.mjs +5 -1
  37. package/daemon/routes/_deps.mjs +2 -2
  38. package/daemon/routes/config.mjs +11 -6
  39. package/daemon/routes/conversation.mjs +103 -40
  40. package/daemon/routes/events.mjs +45 -0
  41. package/daemon/routes/meta.mjs +38 -7
  42. package/daemon/routes/providers.mjs +26 -6
  43. package/daemon/routes/workflows.mjs +30 -0
  44. package/daemon.mjs +27 -3
  45. package/dotenv_min.mjs +15 -3
  46. package/gateway/challenge_registry.mjs +90 -0
  47. package/gateway/device_auth.mjs +71 -97
  48. package/gateway/http_gateway.mjs +29 -3
  49. package/lib/args.mjs +69 -3
  50. package/lib/config.mjs +85 -3
  51. package/lib/render.mjs +43 -0
  52. package/lib/service_install.mjs +15 -1
  53. package/mas/agent_turn.mjs +68 -12
  54. package/mas/confidence.mjs +20 -1
  55. package/mas/embedder.mjs +100 -0
  56. package/mas/events.mjs +57 -0
  57. package/mas/index_db.mjs +103 -10
  58. package/mas/learning.mjs +96 -72
  59. package/mas/mention_router.mjs +48 -90
  60. package/mas/prompt_stack.mjs +60 -3
  61. package/mas/recall_blend.mjs +56 -0
  62. package/mas/redact.mjs +55 -0
  63. package/mas/router_posting.mjs +96 -0
  64. package/mas/router_termination.mjs +63 -0
  65. package/mas/scrub_env.mjs +21 -6
  66. package/mas/skill_synth.mjs +7 -33
  67. package/mas/tool_runner.mjs +3 -2
  68. package/mas/tools/bash.mjs +9 -2
  69. package/mas/tools/coding.mjs +28 -5
  70. package/mas/tools/delegation.mjs +34 -4
  71. package/mas/tools/git.mjs +19 -9
  72. package/mas/tools/ha.mjs +2 -0
  73. package/mas/tools/learning.mjs +55 -0
  74. package/mas/tools/media.mjs +21 -3
  75. package/mas/tools/os.mjs +70 -16
  76. package/mas/tools/recall.mjs +28 -2
  77. package/mcp/client.mjs +8 -1
  78. package/mcp/server_spawn.mjs +5 -1
  79. package/memory.mjs +24 -0
  80. package/package.json +3 -1
  81. package/providers/anthropic.mjs +101 -6
  82. package/providers/cache.mjs +9 -1
  83. package/providers/claude_cli.mjs +104 -22
  84. package/providers/claude_cli_session.mjs +183 -0
  85. package/providers/cli_error.mjs +38 -0
  86. package/providers/cli_login.mjs +179 -0
  87. package/providers/codex_cli.mjs +70 -12
  88. package/providers/gemini.mjs +104 -3
  89. package/providers/gemini_cli.mjs +78 -17
  90. package/providers/model_catalogue.mjs +33 -2
  91. package/providers/ollama.mjs +104 -3
  92. package/providers/openai.mjs +110 -8
  93. package/providers/openai_compat.mjs +97 -6
  94. package/providers/orchestrator.mjs +112 -12
  95. package/providers/registry.mjs +15 -9
  96. package/providers/retry.mjs +14 -2
  97. package/providers/tool_use/anthropic.mjs +17 -3
  98. package/providers/tool_use/claude_cli.mjs +72 -20
  99. package/providers/tool_use/gemini.mjs +29 -2
  100. package/providers/tool_use/openai.mjs +35 -5
  101. package/sandbox/confiners/seatbelt.mjs +37 -12
  102. package/sandbox/index.mjs +49 -0
  103. package/sandbox/local.mjs +7 -1
  104. package/sandbox/spawn.mjs +144 -0
  105. package/sandbox.mjs +5 -1
  106. package/scripts/loop-worker.mjs +25 -1
  107. package/sessions.mjs +0 -0
  108. package/skills/channel-style.md +20 -0
  109. package/skills/code-review.md +33 -0
  110. package/skills/commit-message.md +30 -0
  111. package/skills/concise.md +24 -0
  112. package/skills/debug-coach.md +25 -0
  113. package/skills/explain.md +24 -0
  114. package/skills/korean.md +25 -0
  115. package/skills/summarize.md +33 -0
  116. package/skills.mjs +24 -2
  117. package/skills_curator.mjs +6 -0
  118. package/skills_install.mjs +10 -2
  119. package/tasks.mjs +6 -1
  120. package/teams.mjs +78 -0
  121. package/tui/banner.mjs +72 -0
  122. package/tui/chat_mode_slash.mjs +59 -0
  123. package/tui/config_picker.mjs +1 -0
  124. package/tui/editor.mjs +0 -0
  125. package/tui/editor_anchor.mjs +46 -0
  126. package/tui/editor_keys.mjs +275 -0
  127. package/tui/hud.mjs +111 -0
  128. package/tui/login_flow.mjs +113 -0
  129. package/tui/modal_picker.mjs +10 -1
  130. package/tui/model_pick.mjs +287 -0
  131. package/tui/orchestrator_flow.mjs +164 -0
  132. package/tui/orchestrator_setup.mjs +135 -0
  133. package/tui/pickers.mjs +218 -248
  134. package/tui/repl.mjs +118 -209
  135. package/tui/repl_altbuffer.mjs +63 -0
  136. package/tui/repl_reducers.mjs +114 -0
  137. package/tui/repl_reset.mjs +37 -0
  138. package/tui/run_turn.mjs +228 -26
  139. package/tui/slash_args.mjs +159 -0
  140. package/tui/slash_channels.mjs +208 -0
  141. package/tui/slash_commands.mjs +7 -5
  142. package/tui/slash_dashboard.mjs +220 -0
  143. package/tui/slash_dispatcher.mjs +339 -774
  144. package/tui/slash_helpers.mjs +68 -0
  145. package/tui/slash_popup.mjs +5 -1
  146. package/tui/slash_trainer.mjs +173 -0
  147. package/tui/splash.mjs +15 -2
  148. package/tui/status_bar.mjs +26 -0
  149. package/tui/theme.mjs +28 -0
  150. package/web/avatars/01.png +0 -0
  151. package/web/avatars/02.png +0 -0
  152. package/web/avatars/03.png +0 -0
  153. package/web/avatars/04.png +0 -0
  154. package/web/avatars/05.png +0 -0
  155. package/web/avatars/06.png +0 -0
  156. package/web/avatars/07.png +0 -0
  157. package/web/avatars/08.png +0 -0
  158. package/web/avatars/09.png +0 -0
  159. package/web/avatars/10.png +0 -0
  160. package/web/avatars/11.png +0 -0
  161. package/web/avatars/12.png +0 -0
  162. package/web/avatars/13.png +0 -0
  163. package/web/avatars/14.png +0 -0
  164. package/web/avatars/15.png +0 -0
  165. package/web/avatars/16.png +0 -0
  166. package/web/avatars/17.png +0 -0
  167. package/web/avatars/18.png +0 -0
  168. package/web/avatars/19.png +0 -0
  169. package/web/avatars/20.png +0 -0
  170. package/web/dashboard.css +77 -0
  171. package/web/dashboard.html +29 -2
  172. package/web/dashboard.js +296 -33
  173. package/workflow/builtin_caps.mjs +94 -0
  174. package/workflow/declarative.mjs +101 -0
  175. package/workflow/named.mjs +71 -0
  176. package/workflow/named_cron.mjs +50 -0
  177. package/workflow/nodes.mjs +67 -0
  178. package/workflow/run_request.mjs +74 -0
  179. package/workflow/yaml_min.mjs +97 -0
@@ -0,0 +1,135 @@
1
+ // tui/orchestrator_setup.mjs — the composite-provider (orchestrator) setup
2
+ // wizard, extracted verbatim from tui/pickers.mjs. It builds
3
+ // `cfg.orchestrator = { planner, workers, maxSubtasks }` interactively and
4
+ // persists it.
5
+ //
6
+ // CIRCULAR IMPORT: this module imports _arrowMenu / _quickPrompt from
7
+ // ./pickers.mjs, and pickers re-exports _setupOrchestratorInteractive from
8
+ // here — a pickers ↔ orchestrator_setup cycle. It is safe because both helpers
9
+ // are referenced at CALL TIME (inside the function body), never at module load,
10
+ // and ES live bindings resolve them once pickers finishes loading. pickers puts
11
+ // its re-export line at the bottom (after _arrowMenu/_quickPrompt are declared),
12
+ // and both helpers are hoisted top-level function declarations.
13
+ import { readConfig, writeConfig } from '../lib/config.mjs';
14
+ import { getRegistry } from '../lib/registry_boot.mjs';
15
+ import { paint } from './theme.mjs';
16
+ import { _arrowMenu, _quickPrompt } from './pickers.mjs';
17
+
18
+ // Step-3 alternative for composite providers (currently only the
19
+ // orchestrator). Builds `cfg.orchestrator = { planner, workers,
20
+ // maxSubtasks }` interactively and persists it before returning.
21
+ //
22
+ // planner: single picker over registered non-composite providers.
23
+ // workers: multi-select with a running list + add/remove/done loop.
24
+ // maxSubtasks: typed integer, default 5.
25
+ export async function _setupOrchestratorInteractive() {
26
+ const accent = (s) => paint('38;5;208', s);
27
+ const dim = (s) => paint('2', s);
28
+ const bold = (s) => paint('1', s);
29
+ const ok = (s) => paint('32', s);
30
+ const info = getRegistry().PROVIDER_INFO || {};
31
+ const eligibleNames = Object.keys(getRegistry().PROVIDERS).filter((n) => n !== 'orchestrator' && n !== 'mock');
32
+ if (eligibleNames.length === 0) {
33
+ process.stdout.write('\n' + accent('orchestrator setup') + ': no eligible workers — register a real provider first.\n');
34
+ await _quickPrompt(' press Enter to continue ');
35
+ return 'CANCEL';
36
+ }
37
+ const cfg = readConfig();
38
+ const existing = cfg.orchestrator && typeof cfg.orchestrator === 'object' ? cfg.orchestrator : {};
39
+
40
+ // ── Pick planner ─────────────────────────────────────────────────
41
+ const plannerItems = eligibleNames.map((name) => {
42
+ const m = info[name] || {};
43
+ const defaultModel = m.defaultModel || '';
44
+ return {
45
+ id: `${name}${defaultModel ? ':' + defaultModel : ''}`,
46
+ label: m.label && m.label !== name ? `${name} — ${m.label}` : name,
47
+ desc: defaultModel ? `default model: ${defaultModel}` : '',
48
+ };
49
+ });
50
+ const plannerPick = await _arrowMenu({
51
+ title: 'LazyClaw setup — Step 3 of 3: orchestrator — pick the planner',
52
+ subtitle: 'The planner decomposes the user request into subtasks and writes the final synthesis. Strong reasoning models work best here.',
53
+ items: plannerItems,
54
+ searchable: true,
55
+ defaultIdx: Math.max(0, plannerItems.findIndex((p) => p.id === existing.planner)),
56
+ });
57
+ if (plannerPick === 'CANCEL') return 'CANCEL';
58
+ if (plannerPick === 'BACK') return 'BACK';
59
+ const planner = plannerPick.id;
60
+
61
+ // ── Pick workers (iterative add/remove) ──────────────────────────
62
+ const workers = Array.isArray(existing.workers) ? existing.workers.slice() : [];
63
+ while (true) {
64
+ process.stdout.write('\x1b[2J\x1b[H');
65
+ process.stdout.write(accent('Orchestrator workers') + '\n');
66
+ process.stdout.write(dim('Subtasks are dispatched round-robin across this list.') + '\n\n');
67
+ if (workers.length === 0) {
68
+ process.stdout.write(' ' + dim('(none yet — add at least one)') + '\n\n');
69
+ } else {
70
+ workers.forEach((w, i) => {
71
+ process.stdout.write(` ${i + 1}. ${ok(w)}\n`);
72
+ });
73
+ process.stdout.write('\n');
74
+ }
75
+ const items = [
76
+ { id: '__add__', label: '+ Add a worker', desc: 'pick from registered providers' },
77
+ { id: '__remove__', label: '- Remove a worker', desc: workers.length ? 'pick which entry to drop' : '(nothing to remove)' },
78
+ { id: '__done__', label: `Done${workers.length ? ` (${workers.length} worker${workers.length === 1 ? '' : 's'})` : ' — at least one worker required'}`, desc: workers.length ? 'save cfg.orchestrator and finish' : 'add one worker first' },
79
+ ];
80
+ const action = await _arrowMenu({
81
+ title: 'LazyClaw setup — orchestrator workers',
82
+ subtitle: `Planner: ${planner}`,
83
+ items,
84
+ });
85
+ if (action === 'CANCEL') return 'CANCEL';
86
+ if (action === 'BACK') return 'BACK';
87
+ if (action.id === '__add__') {
88
+ const wPick = await _arrowMenu({
89
+ title: 'Add worker',
90
+ subtitle: 'Picked entries are appended to the workers list.',
91
+ items: plannerItems.filter((p) => !workers.includes(p.id)),
92
+ searchable: true,
93
+ });
94
+ if (wPick === 'CANCEL' || wPick === 'BACK') continue;
95
+ workers.push(wPick.id);
96
+ continue;
97
+ }
98
+ if (action.id === '__remove__') {
99
+ if (!workers.length) continue;
100
+ const rPick = await _arrowMenu({
101
+ title: 'Remove worker',
102
+ subtitle: 'Highlighted entry is removed from the list.',
103
+ items: workers.map((w) => ({ id: w, label: w })),
104
+ });
105
+ if (rPick === 'CANCEL' || rPick === 'BACK') continue;
106
+ const idx = workers.indexOf(rPick.id);
107
+ if (idx >= 0) workers.splice(idx, 1);
108
+ continue;
109
+ }
110
+ if (action.id === '__done__') {
111
+ if (workers.length === 0) continue;
112
+ break;
113
+ }
114
+ }
115
+
116
+ // ── maxSubtasks ──────────────────────────────────────────────────
117
+ const defaultMax = Number.isFinite(existing.maxSubtasks) && existing.maxSubtasks > 0
118
+ ? Math.min(10, existing.maxSubtasks)
119
+ : 5;
120
+ const rawMax = (await _quickPrompt(` ${bold('maxSubtasks')} ${dim(`(2..10, blank → ${defaultMax}):`)} `)).trim();
121
+ let maxSubtasks = defaultMax;
122
+ if (rawMax) {
123
+ const n = parseInt(rawMax, 10);
124
+ if (Number.isFinite(n) && n >= 1) maxSubtasks = Math.min(10, Math.max(1, n));
125
+ }
126
+
127
+ // ── Persist ──────────────────────────────────────────────────────
128
+ cfg.orchestrator = { planner, workers, maxSubtasks };
129
+ writeConfig(cfg);
130
+ process.stdout.write('\n');
131
+ process.stdout.write(` ${ok('✓ orchestrator saved')} ${dim('→')} ` +
132
+ `planner ${ok(planner)} · ${workers.length} worker${workers.length === 1 ? '' : 's'} · maxSubtasks ${maxSubtasks}\n`);
133
+ await _quickPrompt(' press Enter to continue ');
134
+ return { ok: true };
135
+ }