perchai-cli 2.4.54 → 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.
- package/dist/perch.mjs +43 -12
- 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();
|
|
@@ -76566,6 +76565,7 @@ function getToolDisplayName(toolName) {
|
|
|
76566
76565
|
var NON_MODULE_TOOL_OWNERS, TOOL_RISK, TOOL_DISPLAY_NAMES;
|
|
76567
76566
|
var init_catalog = __esm({
|
|
76568
76567
|
"features/perchTerminal/runtime/toolSystem/catalog.ts"() {
|
|
76568
|
+
"use strict";
|
|
76569
76569
|
init_toolNames();
|
|
76570
76570
|
NON_MODULE_TOOL_OWNERS = {
|
|
76571
76571
|
[TOOL_NAMES.listSources]: "lane",
|
|
@@ -83483,6 +83483,7 @@ function listFinancialRoleIds() {
|
|
|
83483
83483
|
var FINANCIAL_ROLE_REGISTRY, evidenceScoutManifest;
|
|
83484
83484
|
var init_financialRoles = __esm({
|
|
83485
83485
|
"features/perchTerminal/agentPlatform/financialRoles.ts"() {
|
|
83486
|
+
"use strict";
|
|
83486
83487
|
FINANCIAL_ROLE_REGISTRY = /* @__PURE__ */ new Map();
|
|
83487
83488
|
evidenceScoutManifest = {
|
|
83488
83489
|
workerId: "evidence_scout",
|
|
@@ -87171,6 +87172,7 @@ function truncateHistoryLine(value, max2) {
|
|
|
87171
87172
|
}
|
|
87172
87173
|
var init_operatorTruth = __esm({
|
|
87173
87174
|
"features/perchTerminal/runtime/operatorTruth.ts"() {
|
|
87175
|
+
"use strict";
|
|
87174
87176
|
}
|
|
87175
87177
|
});
|
|
87176
87178
|
|
|
@@ -87186,6 +87188,7 @@ function wireTranscriptSanitizeOptionsForContextLimit(contextLimitTokens) {
|
|
|
87186
87188
|
return {
|
|
87187
87189
|
maxMessages: 384,
|
|
87188
87190
|
maxTextChars: 8e4,
|
|
87191
|
+
maxToolResultChars: 4e3,
|
|
87189
87192
|
maxToolArgumentChars: 16e3,
|
|
87190
87193
|
maxToolArgumentPreviewChars: 2e3,
|
|
87191
87194
|
maxTotalTextChars: Math.floor(
|
|
@@ -87197,6 +87200,7 @@ function wireTranscriptSanitizeOptionsForContextLimit(contextLimitTokens) {
|
|
|
87197
87200
|
return {
|
|
87198
87201
|
maxMessages: 160,
|
|
87199
87202
|
maxTextChars: 24e3,
|
|
87203
|
+
maxToolResultChars: 2e3,
|
|
87200
87204
|
maxToolArgumentChars: 1e4,
|
|
87201
87205
|
maxToolArgumentPreviewChars: 1500,
|
|
87202
87206
|
maxTotalTextChars: Math.floor(
|
|
@@ -87213,6 +87217,7 @@ function resolveOptions(options) {
|
|
|
87213
87217
|
return {
|
|
87214
87218
|
maxMessages: positiveInt(options?.maxMessages) ?? positiveInt(contextAware.maxMessages) ?? MAX_WIRE_MESSAGES,
|
|
87215
87219
|
maxTextChars: positiveInt(options?.maxTextChars) ?? positiveInt(contextAware.maxTextChars) ?? MAX_TEXT_CHARS,
|
|
87220
|
+
maxToolResultChars: positiveInt(options?.maxToolResultChars) ?? positiveInt(contextAware.maxToolResultChars) ?? MAX_TOOL_RESULT_CHARS,
|
|
87216
87221
|
maxToolArgumentChars: positiveInt(options?.maxToolArgumentChars) ?? positiveInt(contextAware.maxToolArgumentChars) ?? MAX_TOOL_ARGUMENT_CHARS,
|
|
87217
87222
|
maxToolArgumentPreviewChars: positiveInt(options?.maxToolArgumentPreviewChars) ?? positiveInt(contextAware.maxToolArgumentPreviewChars) ?? MAX_TOOL_ARGUMENT_PREVIEW_CHARS,
|
|
87218
87223
|
maxTotalTextChars: positiveInt(options?.maxTotalTextChars) ?? positiveInt(contextAware.maxTotalTextChars) ?? MAX_WIRE_MESSAGES * MAX_TEXT_CHARS
|
|
@@ -87241,11 +87246,11 @@ function sanitizeToolArguments(value, options) {
|
|
|
87241
87246
|
preview: truncate3(value, options.maxToolArgumentPreviewChars)
|
|
87242
87247
|
});
|
|
87243
87248
|
}
|
|
87244
|
-
function sanitizeContent(content, options) {
|
|
87245
|
-
if (typeof content === "string") return truncate3(content,
|
|
87249
|
+
function sanitizeContent(content, options, textCap = options.maxTextChars) {
|
|
87250
|
+
if (typeof content === "string") return truncate3(content, textCap);
|
|
87246
87251
|
if (!Array.isArray(content)) return "";
|
|
87247
87252
|
return content.map((part) => {
|
|
87248
|
-
if (part.type === "text") return { type: "text", text: truncate3(part.text,
|
|
87253
|
+
if (part.type === "text") return { type: "text", text: truncate3(part.text, textCap) };
|
|
87249
87254
|
return { type: "text", text: "[image omitted from persisted wire transcript]" };
|
|
87250
87255
|
});
|
|
87251
87256
|
}
|
|
@@ -87268,7 +87273,13 @@ function sanitizeMessage(message, options) {
|
|
|
87268
87273
|
}
|
|
87269
87274
|
const sanitized = {
|
|
87270
87275
|
role: message.role,
|
|
87271
|
-
content: sanitizeContent(
|
|
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
|
+
)
|
|
87272
87283
|
};
|
|
87273
87284
|
if (message.role === "tool" && typeof message.tool_call_id === "string") {
|
|
87274
87285
|
sanitized.tool_call_id = message.tool_call_id;
|
|
@@ -87340,12 +87351,13 @@ function sanitizeWireMessagesForThread(messages, options) {
|
|
|
87340
87351
|
const sanitized = (messages ?? []).map((message) => sanitizeMessage(message, resolved)).filter((message) => Boolean(message));
|
|
87341
87352
|
return enforceTotalTextBudget(trimToValidBoundary(sanitized, resolved), resolved);
|
|
87342
87353
|
}
|
|
87343
|
-
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;
|
|
87344
87355
|
var init_wireTranscript = __esm({
|
|
87345
87356
|
"features/perchTerminal/runtime/wireTranscript.ts"() {
|
|
87346
87357
|
"use strict";
|
|
87347
87358
|
MAX_WIRE_MESSAGES = 48;
|
|
87348
87359
|
MAX_TEXT_CHARS = 6e3;
|
|
87360
|
+
MAX_TOOL_RESULT_CHARS = 2e3;
|
|
87349
87361
|
MAX_TOOL_ARGUMENT_CHARS = 6e3;
|
|
87350
87362
|
MAX_TOOL_ARGUMENT_PREVIEW_CHARS = 1e3;
|
|
87351
87363
|
CHARS_PER_TOKEN_REPLAY_BUDGET = 4;
|
|
@@ -91721,7 +91733,6 @@ Final answers lead with findings, name artifacts or delivery status, and give on
|
|
|
91721
91733
|
var MARKET_DESK_TOOL_NAMES;
|
|
91722
91734
|
var init_marketDeskAccess = __esm({
|
|
91723
91735
|
"features/perchTerminal/runtime/marketDesk/marketDeskAccess.ts"() {
|
|
91724
|
-
"use strict";
|
|
91725
91736
|
init_toolNames();
|
|
91726
91737
|
MARKET_DESK_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
91727
91738
|
TOOL_NAMES.getMarketSignal,
|
|
@@ -141260,6 +141271,7 @@ function offSandboxEvent(runId, handler) {
|
|
|
141260
141271
|
var LOCAL_WORKSPACE_ACCESS_UNAVAILABLE;
|
|
141261
141272
|
var init_bridge = __esm({
|
|
141262
141273
|
"features/perchTerminal/desktop/bridge.ts"() {
|
|
141274
|
+
"use strict";
|
|
141263
141275
|
LOCAL_WORKSPACE_ACCESS_UNAVAILABLE = "Local workspace access is unavailable. Open Perch Desktop or update the app.";
|
|
141264
141276
|
}
|
|
141265
141277
|
});
|
|
@@ -234648,15 +234660,13 @@ function getBackgroundTaskStore() {
|
|
|
234648
234660
|
var STORE_FILE, BackgroundTaskStore, singleton;
|
|
234649
234661
|
var init_backgroundTaskRegistry = __esm({
|
|
234650
234662
|
"features/perchTerminal/runtime/background/backgroundTaskRegistry.ts"() {
|
|
234663
|
+
"use strict";
|
|
234651
234664
|
init_backgroundTaskTypes();
|
|
234652
234665
|
STORE_FILE = "background-tasks.json";
|
|
234653
234666
|
BackgroundTaskStore = class {
|
|
234654
|
-
baseDir;
|
|
234655
|
-
storePath;
|
|
234656
|
-
outputDir;
|
|
234657
|
-
records = /* @__PURE__ */ new Map();
|
|
234658
|
-
loaded = false;
|
|
234659
234667
|
constructor(options = {}) {
|
|
234668
|
+
this.records = /* @__PURE__ */ new Map();
|
|
234669
|
+
this.loaded = false;
|
|
234660
234670
|
this.baseDir = options.baseDir ?? path11.join(os.homedir(), ".perch");
|
|
234661
234671
|
this.storePath = path11.join(this.baseDir, STORE_FILE);
|
|
234662
234672
|
this.outputDir = path11.join(this.baseDir, "background-output");
|
|
@@ -292359,6 +292369,9 @@ function composeWorkerActivityRowText(base, activity) {
|
|
|
292359
292369
|
}
|
|
292360
292370
|
return parts.join(" \xB7 ");
|
|
292361
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
|
+
}
|
|
292362
292375
|
async function runPerchCli(argv, writer = defaultWriter(), deps = {}) {
|
|
292363
292376
|
const parsed = parsePerchCli(argv);
|
|
292364
292377
|
if (!parsed.ok) {
|
|
@@ -292903,6 +292916,8 @@ async function runInkInteractivePerchCli(writer, deps, options) {
|
|
|
292903
292916
|
const [, refresh] = React11.useState(0);
|
|
292904
292917
|
const liveTextRef = React11.useRef("");
|
|
292905
292918
|
const liveTextFlushTimerRef = React11.useRef(null);
|
|
292919
|
+
const reasoningBufferRef = React11.useRef("");
|
|
292920
|
+
const reasoningItemIdRef = React11.useRef(null);
|
|
292906
292921
|
const activeRunRef = React11.useRef(null);
|
|
292907
292922
|
const pendingWakesRef = React11.useRef(new BackgroundWakeQueue());
|
|
292908
292923
|
const workingRef = React11.useRef(false);
|
|
@@ -293034,6 +293049,8 @@ async function runInkInteractivePerchCli(writer, deps, options) {
|
|
|
293034
293049
|
setWorkingText("thinking");
|
|
293035
293050
|
clearLiveTextFlushTimer();
|
|
293036
293051
|
setLiveText("");
|
|
293052
|
+
reasoningBufferRef.current = "";
|
|
293053
|
+
reasoningItemIdRef.current = null;
|
|
293037
293054
|
liveTextRef.current = "";
|
|
293038
293055
|
const toolNamesById = /* @__PURE__ */ new Map();
|
|
293039
293056
|
const flockWorkerNames = /* @__PURE__ */ new Map();
|
|
@@ -293098,6 +293115,20 @@ async function runInkInteractivePerchCli(writer, deps, options) {
|
|
|
293098
293115
|
liveTextRef.current += event.text;
|
|
293099
293116
|
scheduleLiveTextPaint();
|
|
293100
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
|
+
}
|
|
293101
293132
|
case "assistant_preamble":
|
|
293102
293133
|
case "activity_delta":
|
|
293103
293134
|
case "workflow_narration":
|