perchai-cli 2.4.53 → 2.4.56

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 +42 -7
  2. package/package.json +1 -1
package/dist/perch.mjs CHANGED
@@ -75908,7 +75908,6 @@ var init_payroll = __esm({
75908
75908
  // lib/perchBusinessTools/index.ts
75909
75909
  var init_perchBusinessTools = __esm({
75910
75910
  "lib/perchBusinessTools/index.ts"() {
75911
- "use strict";
75912
75911
  init_generateAPAuditPacket();
75913
75912
  init_inventoryFolder();
75914
75913
  init_loadBusinessTables();
@@ -83484,6 +83483,7 @@ function listFinancialRoleIds() {
83484
83483
  var FINANCIAL_ROLE_REGISTRY, evidenceScoutManifest;
83485
83484
  var init_financialRoles = __esm({
83486
83485
  "features/perchTerminal/agentPlatform/financialRoles.ts"() {
83486
+ "use strict";
83487
83487
  FINANCIAL_ROLE_REGISTRY = /* @__PURE__ */ new Map();
83488
83488
  evidenceScoutManifest = {
83489
83489
  workerId: "evidence_scout",
@@ -87172,6 +87172,7 @@ function truncateHistoryLine(value, max2) {
87172
87172
  }
87173
87173
  var init_operatorTruth = __esm({
87174
87174
  "features/perchTerminal/runtime/operatorTruth.ts"() {
87175
+ "use strict";
87175
87176
  }
87176
87177
  });
87177
87178
 
@@ -87187,6 +87188,7 @@ function wireTranscriptSanitizeOptionsForContextLimit(contextLimitTokens) {
87187
87188
  return {
87188
87189
  maxMessages: 384,
87189
87190
  maxTextChars: 8e4,
87191
+ maxToolResultChars: 4e3,
87190
87192
  maxToolArgumentChars: 16e3,
87191
87193
  maxToolArgumentPreviewChars: 2e3,
87192
87194
  maxTotalTextChars: Math.floor(
@@ -87198,6 +87200,7 @@ function wireTranscriptSanitizeOptionsForContextLimit(contextLimitTokens) {
87198
87200
  return {
87199
87201
  maxMessages: 160,
87200
87202
  maxTextChars: 24e3,
87203
+ maxToolResultChars: 2e3,
87201
87204
  maxToolArgumentChars: 1e4,
87202
87205
  maxToolArgumentPreviewChars: 1500,
87203
87206
  maxTotalTextChars: Math.floor(
@@ -87214,6 +87217,7 @@ function resolveOptions(options) {
87214
87217
  return {
87215
87218
  maxMessages: positiveInt(options?.maxMessages) ?? positiveInt(contextAware.maxMessages) ?? MAX_WIRE_MESSAGES,
87216
87219
  maxTextChars: positiveInt(options?.maxTextChars) ?? positiveInt(contextAware.maxTextChars) ?? MAX_TEXT_CHARS,
87220
+ maxToolResultChars: positiveInt(options?.maxToolResultChars) ?? positiveInt(contextAware.maxToolResultChars) ?? MAX_TOOL_RESULT_CHARS,
87217
87221
  maxToolArgumentChars: positiveInt(options?.maxToolArgumentChars) ?? positiveInt(contextAware.maxToolArgumentChars) ?? MAX_TOOL_ARGUMENT_CHARS,
87218
87222
  maxToolArgumentPreviewChars: positiveInt(options?.maxToolArgumentPreviewChars) ?? positiveInt(contextAware.maxToolArgumentPreviewChars) ?? MAX_TOOL_ARGUMENT_PREVIEW_CHARS,
87219
87223
  maxTotalTextChars: positiveInt(options?.maxTotalTextChars) ?? positiveInt(contextAware.maxTotalTextChars) ?? MAX_WIRE_MESSAGES * MAX_TEXT_CHARS
@@ -87242,11 +87246,11 @@ function sanitizeToolArguments(value, options) {
87242
87246
  preview: truncate3(value, options.maxToolArgumentPreviewChars)
87243
87247
  });
87244
87248
  }
87245
- function sanitizeContent(content, options) {
87246
- if (typeof content === "string") return truncate3(content, options.maxTextChars);
87249
+ function sanitizeContent(content, options, textCap = options.maxTextChars) {
87250
+ if (typeof content === "string") return truncate3(content, textCap);
87247
87251
  if (!Array.isArray(content)) return "";
87248
87252
  return content.map((part) => {
87249
- if (part.type === "text") return { type: "text", text: truncate3(part.text, options.maxTextChars) };
87253
+ if (part.type === "text") return { type: "text", text: truncate3(part.text, textCap) };
87250
87254
  return { type: "text", text: "[image omitted from persisted wire transcript]" };
87251
87255
  });
87252
87256
  }
@@ -87269,7 +87273,13 @@ function sanitizeMessage(message, options) {
87269
87273
  }
87270
87274
  const sanitized = {
87271
87275
  role: message.role,
87272
- content: sanitizeContent(message.content, options)
87276
+ content: sanitizeContent(
87277
+ message.content,
87278
+ options,
87279
+ // Tool results replay only as a short reminder; conversation keeps the
87280
+ // larger text cap so continuity is preserved.
87281
+ message.role === "tool" ? options.maxToolResultChars : options.maxTextChars
87282
+ )
87273
87283
  };
87274
87284
  if (message.role === "tool" && typeof message.tool_call_id === "string") {
87275
87285
  sanitized.tool_call_id = message.tool_call_id;
@@ -87341,12 +87351,13 @@ function sanitizeWireMessagesForThread(messages, options) {
87341
87351
  const sanitized = (messages ?? []).map((message) => sanitizeMessage(message, resolved)).filter((message) => Boolean(message));
87342
87352
  return enforceTotalTextBudget(trimToValidBoundary(sanitized, resolved), resolved);
87343
87353
  }
87344
- var MAX_WIRE_MESSAGES, MAX_TEXT_CHARS, MAX_TOOL_ARGUMENT_CHARS, MAX_TOOL_ARGUMENT_PREVIEW_CHARS, CHARS_PER_TOKEN_REPLAY_BUDGET, MAX_CONTEXT_AWARE_REPLAY_TOKENS_RATIO;
87354
+ var MAX_WIRE_MESSAGES, MAX_TEXT_CHARS, MAX_TOOL_RESULT_CHARS, MAX_TOOL_ARGUMENT_CHARS, MAX_TOOL_ARGUMENT_PREVIEW_CHARS, CHARS_PER_TOKEN_REPLAY_BUDGET, MAX_CONTEXT_AWARE_REPLAY_TOKENS_RATIO;
87345
87355
  var init_wireTranscript = __esm({
87346
87356
  "features/perchTerminal/runtime/wireTranscript.ts"() {
87347
87357
  "use strict";
87348
87358
  MAX_WIRE_MESSAGES = 48;
87349
87359
  MAX_TEXT_CHARS = 6e3;
87360
+ MAX_TOOL_RESULT_CHARS = 2e3;
87350
87361
  MAX_TOOL_ARGUMENT_CHARS = 6e3;
87351
87362
  MAX_TOOL_ARGUMENT_PREVIEW_CHARS = 1e3;
87352
87363
  CHARS_PER_TOKEN_REPLAY_BUDGET = 4;
@@ -92401,6 +92412,7 @@ function listFinancialPlaybooks() {
92401
92412
  var AP_AUDIT_PACKET_DEF, PLAYBOOKS;
92402
92413
  var init_registry2 = __esm({
92403
92414
  "features/perchTerminal/runtime/financialPlaybooks/registry.ts"() {
92415
+ "use strict";
92404
92416
  init_managedWorkflowRegistry2();
92405
92417
  init_toolNames();
92406
92418
  AP_AUDIT_PACKET_DEF = {
@@ -141259,6 +141271,7 @@ function offSandboxEvent(runId, handler) {
141259
141271
  var LOCAL_WORKSPACE_ACCESS_UNAVAILABLE;
141260
141272
  var init_bridge = __esm({
141261
141273
  "features/perchTerminal/desktop/bridge.ts"() {
141274
+ "use strict";
141262
141275
  LOCAL_WORKSPACE_ACCESS_UNAVAILABLE = "Local workspace access is unavailable. Open Perch Desktop or update the app.";
141263
141276
  }
141264
141277
  });
@@ -199476,6 +199489,7 @@ function recordDispatchBatchResult(tasks, result2, ctx, opts = {}) {
199476
199489
  var lifecycleByRun, MAX_LIFECYCLE_RUNS;
199477
199490
  var init_workerLifecycle = __esm({
199478
199491
  "features/perchTerminal/runtime/workers/workerLifecycle.ts"() {
199492
+ "use strict";
199479
199493
  init_workerManifest();
199480
199494
  lifecycleByRun = /* @__PURE__ */ new Map();
199481
199495
  MAX_LIFECYCLE_RUNS = 200;
@@ -226230,7 +226244,7 @@ var init_runFlockTurn = __esm({
226230
226244
  init_flockPlanner();
226231
226245
  init_flockRoles();
226232
226246
  init_toolLoop();
226233
- FLOCK_PLANNER_TIMEOUT_MS = 35e3;
226247
+ FLOCK_PLANNER_TIMEOUT_MS = 12e4;
226234
226248
  FLOCK_WORKER_STALL_TIMEOUT_MS = 15e4;
226235
226249
  FLOCK_SYNTHESIS_TIMEOUT_MS = 3e4;
226236
226250
  FLOCK_SYNTHESIS_MAX_OUTPUT_PER_WORKER = 8e3;
@@ -292355,6 +292369,9 @@ function composeWorkerActivityRowText(base, activity) {
292355
292369
  }
292356
292370
  return parts.join(" \xB7 ");
292357
292371
  }
292372
+ function reasoningDetailLines(text) {
292373
+ return text.replace(/\r/g, "").split("\n").slice(-INK_DETAIL_LINE_LIMIT).map((line) => ({ text: line.length > 0 ? line : " ", tone: "meta" }));
292374
+ }
292358
292375
  async function runPerchCli(argv, writer = defaultWriter(), deps = {}) {
292359
292376
  const parsed = parsePerchCli(argv);
292360
292377
  if (!parsed.ok) {
@@ -292899,6 +292916,8 @@ async function runInkInteractivePerchCli(writer, deps, options) {
292899
292916
  const [, refresh] = React11.useState(0);
292900
292917
  const liveTextRef = React11.useRef("");
292901
292918
  const liveTextFlushTimerRef = React11.useRef(null);
292919
+ const reasoningBufferRef = React11.useRef("");
292920
+ const reasoningItemIdRef = React11.useRef(null);
292902
292921
  const activeRunRef = React11.useRef(null);
292903
292922
  const pendingWakesRef = React11.useRef(new BackgroundWakeQueue());
292904
292923
  const workingRef = React11.useRef(false);
@@ -293030,6 +293049,8 @@ async function runInkInteractivePerchCli(writer, deps, options) {
293030
293049
  setWorkingText("thinking");
293031
293050
  clearLiveTextFlushTimer();
293032
293051
  setLiveText("");
293052
+ reasoningBufferRef.current = "";
293053
+ reasoningItemIdRef.current = null;
293033
293054
  liveTextRef.current = "";
293034
293055
  const toolNamesById = /* @__PURE__ */ new Map();
293035
293056
  const flockWorkerNames = /* @__PURE__ */ new Map();
@@ -293094,6 +293115,20 @@ async function runInkInteractivePerchCli(writer, deps, options) {
293094
293115
  liveTextRef.current += event.text;
293095
293116
  scheduleLiveTextPaint();
293096
293117
  break;
293118
+ case "reasoning_delta": {
293119
+ if (!event.text) break;
293120
+ reasoningBufferRef.current += event.text;
293121
+ const reasoningId = reasoningItemIdRef.current ?? `reasoning-${clientRunId}`;
293122
+ reasoningItemIdRef.current = reasoningId;
293123
+ updateToolItem(reasoningId, {
293124
+ label: "thinking",
293125
+ text: "thinking\u2026",
293126
+ tone: "muted",
293127
+ detailLines: reasoningDetailLines(reasoningBufferRef.current),
293128
+ expanded: false
293129
+ });
293130
+ break;
293131
+ }
293097
293132
  case "assistant_preamble":
293098
293133
  case "activity_delta":
293099
293134
  case "workflow_narration":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perchai-cli",
3
- "version": "2.4.53",
3
+ "version": "2.4.56",
4
4
  "description": "Perch AI command-line interface",
5
5
  "bin": {
6
6
  "perch": "bin/perch"