perchai-cli 2.4.38 → 2.4.40

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/perch.mjs +48 -7
  2. package/package.json +1 -1
package/dist/perch.mjs CHANGED
@@ -75566,7 +75566,6 @@ var init_payroll = __esm({
75566
75566
  // lib/perchBusinessTools/index.ts
75567
75567
  var init_perchBusinessTools = __esm({
75568
75568
  "lib/perchBusinessTools/index.ts"() {
75569
- "use strict";
75570
75569
  init_generateAPAuditPacket();
75571
75570
  init_inventoryFolder();
75572
75571
  init_loadBusinessTables();
@@ -75918,7 +75917,6 @@ function isTurnAbortedError(error) {
75918
75917
  var TURN_STOPPED_BY_USER_MESSAGE;
75919
75918
  var init_turnAbort = __esm({
75920
75919
  "features/perchTerminal/runtime/turnAbort.ts"() {
75921
- "use strict";
75922
75920
  TURN_STOPPED_BY_USER_MESSAGE = "Turn stopped by user.";
75923
75921
  }
75924
75922
  });
@@ -76219,7 +76217,6 @@ function getToolDisplayName(toolName) {
76219
76217
  var NON_MODULE_TOOL_OWNERS, TOOL_RISK, TOOL_DISPLAY_NAMES;
76220
76218
  var init_catalog = __esm({
76221
76219
  "features/perchTerminal/runtime/toolSystem/catalog.ts"() {
76222
- "use strict";
76223
76220
  init_toolNames();
76224
76221
  NON_MODULE_TOOL_OWNERS = {
76225
76222
  [TOOL_NAMES.listSources]: "lane",
@@ -205518,13 +205515,13 @@ var init_spawnWorker = __esm({
205518
205515
  if (workerId && customSpec && !resolveWorkerManifest(workerId)) {
205519
205516
  workerId = "";
205520
205517
  }
205521
- let adhocDisplayTitle;
205518
+ let displayTitle;
205522
205519
  if (!workerId && customSpec) {
205523
205520
  const { manifest, droppedTools } = buildAdhocWorkerManifest(customSpec);
205524
205521
  registerWorkerManifest(manifest);
205525
205522
  adhocManifestId = manifest.workerId;
205526
205523
  adhocNickname = flockNicknameFor(manifest.workerId, 0);
205527
- adhocDisplayTitle = `${manifest.name} \xB7 ${adhocNickname}`;
205524
+ displayTitle = `${manifest.name} \xB7 ${adhocNickname}`;
205528
205525
  workerId = manifest.workerId;
205529
205526
  if (droppedTools.length > 0 && ctx.onEvent) {
205530
205527
  ctx.onEvent({
@@ -205543,6 +205540,14 @@ var init_spawnWorker = __esm({
205543
205540
  errorCode: "worker_id_missing"
205544
205541
  };
205545
205542
  }
205543
+ if (!displayTitle) {
205544
+ const registeredManifest = resolveWorkerManifest(workerId);
205545
+ if (registeredManifest) {
205546
+ const runSeed = `${workerId}_${ctx.threadId ?? ""}_${Date.now().toString(36)}`;
205547
+ const nickname = flockNicknameFor(runSeed, 0);
205548
+ displayTitle = `${registeredManifest.name} \xB7 ${nickname}`;
205549
+ }
205550
+ }
205546
205551
  const context = typeof args.context === "string" || typeof args.context === "object" && args.context !== null && !Array.isArray(args.context) ? args.context : void 0;
205547
205552
  const lane = typeof args.lane === "string" ? args.lane : void 0;
205548
205553
  const maxIterations = typeof args.maxIterations === "number" ? adhocManifestId ? Math.min(args.maxIterations, ADHOC_MAX_ITERATIONS) : args.maxIterations : void 0;
@@ -205579,7 +205584,7 @@ Proceed with the available context. If a missing fact is essential, ask the user
205579
205584
  maxToolCalls: adhocManifestId ? ADHOC_MAX_TOOL_CALLS : void 0
205580
205585
  },
205581
205586
  {
205582
- displayTitle: adhocDisplayTitle,
205587
+ displayTitle,
205583
205588
  workspaceRoot: effectiveWorkspaceRoot(ctx),
205584
205589
  desktopConnected: ctx.desktopConnected,
205585
205590
  // CLI surface: children inherit the local bridge and server auth,
@@ -287920,6 +287925,7 @@ async function runInkInteractivePerchCli(writer, deps, options) {
287920
287925
  break;
287921
287926
  case "tool_call_started": {
287922
287927
  if (event.workerId) break;
287928
+ if (event.toolName === "spawn_worker") break;
287923
287929
  const toolId = event.toolCallId ?? `${event.toolName}-${Date.now()}`;
287924
287930
  const name = humanizeCliToolName(event.toolName);
287925
287931
  const aggregateKind = cliToolAggregateKind(event.toolName);
@@ -287958,6 +287964,7 @@ async function runInkInteractivePerchCli(writer, deps, options) {
287958
287964
  }
287959
287965
  case "tool_call_completed": {
287960
287966
  if (event.workerId) break;
287967
+ if (event.toolName === "spawn_worker") break;
287961
287968
  const toolId = event.toolCallId ?? `${event.toolName}-${Date.now()}`;
287962
287969
  const stored = toolInputsById.current.get(toolId);
287963
287970
  const aggregateKind = aggregateToolIds.get(toolId);
@@ -288004,6 +288011,7 @@ async function runInkInteractivePerchCli(writer, deps, options) {
288004
288011
  }
288005
288012
  case "tool_call_failed": {
288006
288013
  if (event.workerId) break;
288014
+ if (event.toolName === "spawn_worker") break;
288007
288015
  const toolId = event.toolCallId ?? `${event.toolName}-${Date.now()}`;
288008
288016
  const name = toolNamesById.get(toolId) ?? humanizeCliToolName(event.toolName);
288009
288017
  const stored = toolInputsById.current.get(toolId);
@@ -288451,6 +288459,39 @@ async function runInkInteractivePerchCli(writer, deps, options) {
288451
288459
  )
288452
288460
  );
288453
288461
  };
288462
+ const renderWorkerRow = (key, line, tone, showLabel) => {
288463
+ const dotParts = line.split(" \xB7 ");
288464
+ if (dotParts.length >= 3 && WORKER_STATUS_WORDS.has(dotParts[dotParts.length - 1] ?? "")) {
288465
+ const status = dotParts[dotParts.length - 1];
288466
+ const nickname = dotParts[dotParts.length - 2] ?? "";
288467
+ const name = dotParts.slice(0, dotParts.length - 2).join(" \xB7 ");
288468
+ return React11.createElement(
288469
+ Ink2.Box,
288470
+ { key },
288471
+ React11.createElement(
288472
+ Ink2.Box,
288473
+ { width: INK_LABEL_WIDTH, flexShrink: 0 },
288474
+ React11.createElement(
288475
+ Ink2.Text,
288476
+ { color: colorForInkTone(tone) },
288477
+ showLabel ? renderInkSpeakerLabel("worker") : ""
288478
+ )
288479
+ ),
288480
+ React11.createElement(
288481
+ Ink2.Box,
288482
+ { flexGrow: 1 },
288483
+ React11.createElement(
288484
+ Ink2.Text,
288485
+ null,
288486
+ React11.createElement(Ink2.Text, { color: bodyColorForInkTone(tone) }, `${name} \xB7 `),
288487
+ React11.createElement(Ink2.Text, { color: flockNicknameAccentColor(nickname), bold: true }, nickname),
288488
+ React11.createElement(Ink2.Text, { color: bodyColorForInkTone(tone) }, ` \xB7 ${status}`)
288489
+ )
288490
+ )
288491
+ );
288492
+ }
288493
+ return renderTranscriptRow(key, "worker", line, tone, showLabel);
288494
+ };
288454
288495
  const renderTranscriptItem = (item, index) => {
288455
288496
  const lines = item.text.split(/\r?\n/);
288456
288497
  const previous = items[index - 1];
@@ -288464,7 +288505,7 @@ async function runInkInteractivePerchCli(writer, deps, options) {
288464
288505
  React11.createElement(Ink2.Box, { width: INK_LABEL_WIDTH, flexShrink: 0 }),
288465
288506
  React11.createElement(Ink2.Text, { color: CLI_BRAND.divider }, INK_DIVIDER)
288466
288507
  ) : null,
288467
- lines.map((line, lineIndex) => item.label === "flock" || item.label === "worker" ? renderFlockRow(`${item.id}-${lineIndex}`, line, item.tone, lineIndex === 0) : renderTranscriptRow(
288508
+ lines.map((line, lineIndex) => item.label === "flock" ? renderFlockRow(`${item.id}-${lineIndex}`, line, item.tone, lineIndex === 0) : item.label === "worker" ? renderWorkerRow(`${item.id}-${lineIndex}`, line, item.tone, lineIndex === 0) : renderTranscriptRow(
288468
288509
  `${item.id}-${lineIndex}`,
288469
288510
  item.label,
288470
288511
  line,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perchai-cli",
3
- "version": "2.4.38",
3
+ "version": "2.4.40",
4
4
  "description": "Perch AI command-line interface",
5
5
  "bin": {
6
6
  "perch": "bin/perch"