perchai-cli 2.4.37 → 2.4.38

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 +56 -7
  2. package/package.json +1 -1
package/dist/perch.mjs CHANGED
@@ -75566,6 +75566,7 @@ 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";
75569
75570
  init_generateAPAuditPacket();
75570
75571
  init_inventoryFolder();
75571
75572
  init_loadBusinessTables();
@@ -75917,6 +75918,7 @@ function isTurnAbortedError(error) {
75917
75918
  var TURN_STOPPED_BY_USER_MESSAGE;
75918
75919
  var init_turnAbort = __esm({
75919
75920
  "features/perchTerminal/runtime/turnAbort.ts"() {
75921
+ "use strict";
75920
75922
  TURN_STOPPED_BY_USER_MESSAGE = "Turn stopped by user.";
75921
75923
  }
75922
75924
  });
@@ -76217,6 +76219,7 @@ function getToolDisplayName(toolName) {
76217
76219
  var NON_MODULE_TOOL_OWNERS, TOOL_RISK, TOOL_DISPLAY_NAMES;
76218
76220
  var init_catalog = __esm({
76219
76221
  "features/perchTerminal/runtime/toolSystem/catalog.ts"() {
76222
+ "use strict";
76220
76223
  init_toolNames();
76221
76224
  NON_MODULE_TOOL_OWNERS = {
76222
76225
  [TOOL_NAMES.listSources]: "lane",
@@ -86721,6 +86724,7 @@ function truncateHistoryLine(value, max2) {
86721
86724
  }
86722
86725
  var init_operatorTruth = __esm({
86723
86726
  "features/perchTerminal/runtime/operatorTruth.ts"() {
86727
+ "use strict";
86724
86728
  }
86725
86729
  });
86726
86730
 
@@ -138640,7 +138644,6 @@ function offSandboxEvent(runId, handler) {
138640
138644
  var LOCAL_WORKSPACE_ACCESS_UNAVAILABLE;
138641
138645
  var init_bridge = __esm({
138642
138646
  "features/perchTerminal/desktop/bridge.ts"() {
138643
- "use strict";
138644
138647
  LOCAL_WORKSPACE_ACCESS_UNAVAILABLE = "Local workspace access is unavailable. Open Perch Desktop or update the app.";
138645
138648
  }
138646
138649
  });
@@ -287195,7 +287198,8 @@ __export(perch_cli_exports, {
287195
287198
  flockNicknameAccentColor: () => flockNicknameAccentColor,
287196
287199
  parseInteractiveSlashCommand: () => parseInteractiveSlashCommand,
287197
287200
  parsePerchCli: () => parsePerchCli,
287198
- runPerchCli: () => runPerchCli
287201
+ runPerchCli: () => runPerchCli,
287202
+ workerEventToCliRow: () => workerEventToCliRow
287199
287203
  });
287200
287204
  import fs14 from "node:fs";
287201
287205
  import { createHash as createHash4 } from "node:crypto";
@@ -287228,6 +287232,26 @@ function flockEventToCliRow(event) {
287228
287232
  return null;
287229
287233
  }
287230
287234
  }
287235
+ function workerEventToCliRow(event) {
287236
+ switch (event.type) {
287237
+ case "worker_run_started":
287238
+ return {
287239
+ id: `worker-${event.workerRunId ?? event.workerId}`,
287240
+ text: `${event.title} \xB7 running`,
287241
+ tone: "muted"
287242
+ };
287243
+ case "worker_run_completed": {
287244
+ const status = event.ok ? event.usabilityStatus === "needs_user_input" ? "blocked" : "done" : "failed";
287245
+ return {
287246
+ id: `worker-${event.workerRunId ?? event.workerId}`,
287247
+ text: `${event.title} \xB7 ${FLOCK_STATUS_LABELS[status] ?? status}`,
287248
+ tone: status === "done" ? "success" : status === "failed" || status === "blocked" ? "danger" : "muted"
287249
+ };
287250
+ }
287251
+ default:
287252
+ return null;
287253
+ }
287254
+ }
287231
287255
  async function runPerchCli(argv, writer = defaultWriter(), deps = {}) {
287232
287256
  const parsed = parsePerchCli(argv);
287233
287257
  if (!parsed.ok) {
@@ -287829,6 +287853,7 @@ async function runInkInteractivePerchCli(writer, deps, options) {
287829
287853
  liveTextRef.current = "";
287830
287854
  const toolNamesById = /* @__PURE__ */ new Map();
287831
287855
  const flockWorkerNames = /* @__PURE__ */ new Map();
287856
+ const workerTitles = /* @__PURE__ */ new Map();
287832
287857
  const flockLimitMeta = /* @__PURE__ */ new Map();
287833
287858
  const aggregateToolIds = /* @__PURE__ */ new Map();
287834
287859
  const aggregateToolMeta = /* @__PURE__ */ new Map();
@@ -287894,6 +287919,7 @@ async function runInkInteractivePerchCli(writer, deps, options) {
287894
287919
  setWorkingText("recovering route");
287895
287920
  break;
287896
287921
  case "tool_call_started": {
287922
+ if (event.workerId) break;
287897
287923
  const toolId = event.toolCallId ?? `${event.toolName}-${Date.now()}`;
287898
287924
  const name = humanizeCliToolName(event.toolName);
287899
287925
  const aggregateKind = cliToolAggregateKind(event.toolName);
@@ -287931,6 +287957,7 @@ async function runInkInteractivePerchCli(writer, deps, options) {
287931
287957
  break;
287932
287958
  }
287933
287959
  case "tool_call_completed": {
287960
+ if (event.workerId) break;
287934
287961
  const toolId = event.toolCallId ?? `${event.toolName}-${Date.now()}`;
287935
287962
  const stored = toolInputsById.current.get(toolId);
287936
287963
  const aggregateKind = aggregateToolIds.get(toolId);
@@ -287976,6 +288003,7 @@ async function runInkInteractivePerchCli(writer, deps, options) {
287976
288003
  break;
287977
288004
  }
287978
288005
  case "tool_call_failed": {
288006
+ if (event.workerId) break;
287979
288007
  const toolId = event.toolCallId ?? `${event.toolName}-${Date.now()}`;
287980
288008
  const name = toolNamesById.get(toolId) ?? humanizeCliToolName(event.toolName);
287981
288009
  const stored = toolInputsById.current.get(toolId);
@@ -288180,7 +288208,7 @@ async function runInkInteractivePerchCli(writer, deps, options) {
288180
288208
  meta2.skipped += event.skippedCount ?? 0;
288181
288209
  for (const toolName of event.toolNames ?? []) meta2.tools.add(toolName);
288182
288210
  flockLimitMeta.set(limitKey, meta2);
288183
- const who = event.workerId ? flockWorkerNames.get(event.workerId) ?? "A worker" : "The model";
288211
+ const who = event.workerId ? workerTitles.get(event.workerId) ?? flockWorkerNames.get(event.workerId) ?? "A worker" : "The model";
288184
288212
  updateToolItem(limitKey, {
288185
288213
  label: "flock",
288186
288214
  text: `${who} hit its tool limit and is finishing from gathered evidence.`,
@@ -288196,6 +288224,25 @@ async function runInkInteractivePerchCli(writer, deps, options) {
288196
288224
  });
288197
288225
  break;
288198
288226
  }
288227
+ case "worker_run_started":
288228
+ case "worker_run_completed": {
288229
+ if (event.type === "worker_run_started") {
288230
+ workerTitles.set(event.workerId, event.title);
288231
+ }
288232
+ const row = workerEventToCliRow(event);
288233
+ if (!row) break;
288234
+ if (row.id) {
288235
+ updateToolItem(row.id, { label: "worker", text: row.text, tone: row.tone });
288236
+ } else {
288237
+ addItem({ label: "worker", text: row.text, tone: row.tone });
288238
+ }
288239
+ if (event.type === "worker_run_started") {
288240
+ setWorkingText(event.title.split(" \xB7 ")[0] ?? event.title);
288241
+ } else {
288242
+ setWorkingText("thinking");
288243
+ }
288244
+ break;
288245
+ }
288199
288246
  case "flock_run_started":
288200
288247
  case "flock_plan_ready":
288201
288248
  case "flock_worker_update":
@@ -288370,7 +288417,7 @@ async function runInkInteractivePerchCli(writer, deps, options) {
288370
288417
  const renderFlockRow = (key, line, tone, showLabel) => {
288371
288418
  const dotParts = line.split(" \xB7 ");
288372
288419
  const limitMatch = dotParts.length < 2 ? line.match(/^(.+?) (hit its tool limit .*)$/) : null;
288373
- if (dotParts.length < 2 && !limitMatch) {
288420
+ if (dotParts.length === 2 && WORKER_STATUS_WORDS.has(dotParts[1] ?? "") || dotParts.length < 2 && !limitMatch) {
288374
288421
  return renderTranscriptRow(key, "flock", line, tone, showLabel);
288375
288422
  }
288376
288423
  if (limitMatch) {
@@ -288417,7 +288464,7 @@ async function runInkInteractivePerchCli(writer, deps, options) {
288417
288464
  React11.createElement(Ink2.Box, { width: INK_LABEL_WIDTH, flexShrink: 0 }),
288418
288465
  React11.createElement(Ink2.Text, { color: CLI_BRAND.divider }, INK_DIVIDER)
288419
288466
  ) : null,
288420
- lines.map((line, lineIndex) => item.label === "flock" ? renderFlockRow(`${item.id}-${lineIndex}`, line, item.tone, lineIndex === 0) : renderTranscriptRow(
288467
+ lines.map((line, lineIndex) => item.label === "flock" || item.label === "worker" ? renderFlockRow(`${item.id}-${lineIndex}`, line, item.tone, lineIndex === 0) : renderTranscriptRow(
288421
288468
  `${item.id}-${lineIndex}`,
288422
288469
  item.label,
288423
288470
  line,
@@ -289920,7 +289967,7 @@ function defaultWriter() {
289920
289967
  stderr: (text) => process.stderr.write(text)
289921
289968
  };
289922
289969
  }
289923
- var execFileAsync3, DEFAULT_CLI_LOGIN_APP_URL, CLI_PACKAGE_VERSION, CLI_BRAND, ANSI2, HELP_TEXT, INTERACTIVE_HELP_TEXT, FLOCK_STATUS_LABELS, INK_LABEL_WIDTH, INK_ROW_LIMIT, INK_DETAIL_LINE_LIMIT, INK_DIVIDER, PERCH_MOTION_FRAMES, PERCH_SPLASH_WIDTH, PERCH_SPLASH_SCENE, PERCH_SPLASH_COMMANDS, FLOCK_NICKNAME_ACCENTS;
289970
+ var execFileAsync3, DEFAULT_CLI_LOGIN_APP_URL, CLI_PACKAGE_VERSION, CLI_BRAND, ANSI2, HELP_TEXT, INTERACTIVE_HELP_TEXT, FLOCK_STATUS_LABELS, WORKER_STATUS_WORDS, INK_LABEL_WIDTH, INK_ROW_LIMIT, INK_DETAIL_LINE_LIMIT, INK_DIVIDER, PERCH_MOTION_FRAMES, PERCH_SPLASH_WIDTH, PERCH_SPLASH_SCENE, PERCH_SPLASH_COMMANDS, FLOCK_NICKNAME_ACCENTS;
289924
289971
  var init_perch_cli = __esm({
289925
289972
  "scripts/perch-cli.ts"() {
289926
289973
  "use strict";
@@ -290015,8 +290062,10 @@ Commands:
290015
290062
  done: "done",
290016
290063
  failed: "failed",
290017
290064
  cancelled: "stopped",
290018
- skipped: "skipped"
290065
+ skipped: "skipped",
290066
+ blocked: "blocked"
290019
290067
  };
290068
+ WORKER_STATUS_WORDS = new Set(Object.values(FLOCK_STATUS_LABELS));
290020
290069
  INK_LABEL_WIDTH = 12;
290021
290070
  INK_ROW_LIMIT = 100;
290022
290071
  INK_DETAIL_LINE_LIMIT = 80;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perchai-cli",
3
- "version": "2.4.37",
3
+ "version": "2.4.38",
4
4
  "description": "Perch AI command-line interface",
5
5
  "bin": {
6
6
  "perch": "bin/perch"