majlis 0.2.0 → 0.3.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/cli.js +47 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2329,13 +2329,36 @@ async function runQuery(opts) {
2329
2329
  });
2330
2330
  const textParts = [];
2331
2331
  let costUsd = 0;
2332
+ let turnCount = 0;
2332
2333
  for await (const message of conversation) {
2333
2334
  if (message.type === "assistant") {
2335
+ turnCount++;
2336
+ let hasText = false;
2334
2337
  for (const block of message.message.content) {
2335
2338
  if (block.type === "text") {
2336
2339
  textParts.push(block.text);
2340
+ hasText = true;
2341
+ } else if (block.type === "tool_use") {
2342
+ const toolName = block.name ?? "tool";
2343
+ const input = block.input ?? {};
2344
+ const detail = formatToolDetail(toolName, input);
2345
+ process.stderr.write(`${DIM2}[majlis] ${CYAN2}${toolName}${RESET2}${DIM2}${detail}${RESET2}
2346
+ `);
2337
2347
  }
2338
2348
  }
2349
+ if (hasText) {
2350
+ const preview = textParts[textParts.length - 1].slice(0, 120).replace(/\n/g, " ").trim();
2351
+ if (preview) {
2352
+ process.stderr.write(`${DIM2}[majlis] writing: ${preview}${preview.length >= 120 ? "..." : ""}${RESET2}
2353
+ `);
2354
+ }
2355
+ }
2356
+ } else if (message.type === "tool_progress") {
2357
+ const elapsed = Math.round(message.elapsed_time_seconds);
2358
+ if (elapsed > 0 && elapsed % 5 === 0) {
2359
+ process.stderr.write(`${DIM2}[majlis] ${message.tool_name} running (${elapsed}s)...${RESET2}
2360
+ `);
2361
+ }
2339
2362
  } else if (message.type === "result") {
2340
2363
  if (message.subtype === "success") {
2341
2364
  costUsd = message.total_cost_usd;
@@ -2347,6 +2370,26 @@ async function runQuery(opts) {
2347
2370
  }
2348
2371
  return { text: textParts.join("\n\n"), costUsd };
2349
2372
  }
2373
+ function formatToolDetail(toolName, input) {
2374
+ switch (toolName) {
2375
+ case "Read":
2376
+ return input.file_path ? ` ${input.file_path}` : "";
2377
+ case "Write":
2378
+ return input.file_path ? ` \u2192 ${input.file_path}` : "";
2379
+ case "Edit":
2380
+ return input.file_path ? ` ${input.file_path}` : "";
2381
+ case "Glob":
2382
+ return input.pattern ? ` ${input.pattern}` : "";
2383
+ case "Grep":
2384
+ return input.pattern ? ` /${input.pattern}/` : "";
2385
+ case "Bash":
2386
+ return input.command ? ` $ ${input.command.slice(0, 80)}` : "";
2387
+ case "WebSearch":
2388
+ return input.query ? ` "${input.query}"` : "";
2389
+ default:
2390
+ return "";
2391
+ }
2392
+ }
2350
2393
  function writeArtifact(role, context, markdown, projectRoot) {
2351
2394
  const dirMap = {
2352
2395
  builder: "docs/experiments",
@@ -2376,7 +2419,7 @@ function writeArtifact(role, context, markdown, projectRoot) {
2376
2419
  fs7.writeFileSync(target, markdown);
2377
2420
  return target;
2378
2421
  }
2379
- var fs7, path7, import_claude_agent_sdk2;
2422
+ var fs7, path7, import_claude_agent_sdk2, DIM2, RESET2, CYAN2;
2380
2423
  var init_spawn = __esm({
2381
2424
  "src/agents/spawn.ts"() {
2382
2425
  "use strict";
@@ -2385,6 +2428,9 @@ var init_spawn = __esm({
2385
2428
  import_claude_agent_sdk2 = require("@anthropic-ai/claude-agent-sdk");
2386
2429
  init_parse();
2387
2430
  init_connection();
2431
+ DIM2 = "\x1B[2m";
2432
+ RESET2 = "\x1B[0m";
2433
+ CYAN2 = "\x1B[36m";
2388
2434
  }
2389
2435
  });
2390
2436
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "majlis",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Multi-agent workflow CLI for structured doubt, independent verification, and compressed knowledge",
5
5
  "bin": {
6
6
  "majlis": "./dist/cli.js"