perchai-cli 2.4.29 → 2.4.30

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 +35 -10
  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
  });
@@ -83127,6 +83125,7 @@ function listFinancialRoleIds() {
83127
83125
  var FINANCIAL_ROLE_REGISTRY, evidenceScoutManifest;
83128
83126
  var init_financialRoles = __esm({
83129
83127
  "features/perchTerminal/agentPlatform/financialRoles.ts"() {
83128
+ "use strict";
83130
83129
  FINANCIAL_ROLE_REGISTRY = /* @__PURE__ */ new Map();
83131
83130
  evidenceScoutManifest = {
83132
83131
  workerId: "evidence_scout",
@@ -118885,8 +118884,12 @@ var init_reasoningExtractor = __esm({
118885
118884
 
118886
118885
  // features/perchTerminal/runtime/modelRouter.ts
118887
118886
  async function callModelRouter(_config, request, opts) {
118887
+ const explicitProxyUrl = resolveModelCallProxyUrl(opts?.cliServerAppUrl ?? null);
118888
118888
  if (typeof window !== "undefined") {
118889
- return callModelRouterViaServer(request, opts);
118889
+ return callModelRouterViaServer(request, opts, explicitProxyUrl ?? void 0);
118890
+ }
118891
+ if (explicitProxyUrl) {
118892
+ return callModelRouterViaServer(request, opts, explicitProxyUrl);
118890
118893
  }
118891
118894
  const nodeProxyUrl = resolveNodeModelCallProxyUrl();
118892
118895
  if (nodeProxyUrl) {
@@ -119039,7 +119042,7 @@ async function callModelRouterViaServer(request, opts, endpoint = "/api/perch-te
119039
119042
  headers: {
119040
119043
  "Content-Type": "application/json",
119041
119044
  ...hasStreamingHandler ? { Accept: "text/event-stream" } : {},
119042
- ...nodeModelProxyAuthHeader()
119045
+ ...modelProxyAuthHeader(opts?.cliServerAccessToken ?? null)
119043
119046
  },
119044
119047
  body,
119045
119048
  signal: _signal
@@ -119203,7 +119206,10 @@ function waitForModelProxyRetry(attempt, signal) {
119203
119206
  }
119204
119207
  function resolveNodeModelCallProxyUrl() {
119205
119208
  if (typeof process === "undefined") return null;
119206
- const raw = process.env[MODEL_CALL_PROXY_ENV]?.trim();
119209
+ return resolveModelCallProxyUrl(process.env[MODEL_CALL_PROXY_ENV]?.trim() ?? null);
119210
+ }
119211
+ function resolveModelCallProxyUrl(rawInput) {
119212
+ const raw = rawInput?.trim();
119207
119213
  if (!raw) return null;
119208
119214
  if (raw.endsWith("/api/perch-terminal/model-call")) return raw;
119209
119215
  try {
@@ -119216,9 +119222,8 @@ function resolveNodeModelCallProxyUrl() {
119216
119222
  return null;
119217
119223
  }
119218
119224
  }
119219
- function nodeModelProxyAuthHeader() {
119220
- if (typeof process === "undefined") return {};
119221
- const token = process.env[MODEL_CALL_PROXY_TOKEN_ENV]?.trim();
119225
+ function modelProxyAuthHeader(explicitToken) {
119226
+ const token = explicitToken?.trim() || (typeof process !== "undefined" ? process.env[MODEL_CALL_PROXY_TOKEN_ENV]?.trim() : "");
119222
119227
  return token ? { Authorization: `Bearer ${token}` } : {};
119223
119228
  }
119224
119229
  function getRouterAvailabilityReport() {
@@ -217488,7 +217493,9 @@ async function runModelToolLoop(input) {
217488
217493
  runId,
217489
217494
  lane: activeLane,
217490
217495
  source: "tool_loop"
217491
- })
217496
+ }),
217497
+ cliServerAppUrl: input.cliServerAppUrl ?? null,
217498
+ cliServerAccessToken: input.cliServerAccessToken ?? null
217492
217499
  }
217493
217500
  );
217494
217501
  result2 = routerResult;
@@ -217665,6 +217672,8 @@ async function runModelToolLoop(input) {
217665
217672
  runId,
217666
217673
  userId: input.userId,
217667
217674
  workspaceId: input.workspaceId,
217675
+ cliServerAppUrl: input.cliServerAppUrl ?? null,
217676
+ cliServerAccessToken: input.cliServerAccessToken ?? null,
217668
217677
  signal,
217669
217678
  onEvent
217670
217679
  });
@@ -217713,6 +217722,8 @@ async function runModelToolLoop(input) {
217713
217722
  runId,
217714
217723
  userId: input.userId,
217715
217724
  workspaceId: input.workspaceId,
217725
+ cliServerAppUrl: input.cliServerAppUrl ?? null,
217726
+ cliServerAccessToken: input.cliServerAccessToken ?? null,
217716
217727
  signal,
217717
217728
  onEvent
217718
217729
  });
@@ -218243,6 +218254,8 @@ async function runModelToolLoop(input) {
218243
218254
  runId,
218244
218255
  userId: input.userId,
218245
218256
  workspaceId: input.workspaceId,
218257
+ cliServerAppUrl: input.cliServerAppUrl ?? null,
218258
+ cliServerAccessToken: input.cliServerAccessToken ?? null,
218246
218259
  signal,
218247
218260
  onEvent
218248
218261
  });
@@ -218315,7 +218328,9 @@ async function requestClosingResponse(input) {
218315
218328
  runId: input.runId,
218316
218329
  lane: input.lane,
218317
218330
  source: "tool_loop_closing"
218318
- })
218331
+ }),
218332
+ cliServerAppUrl: input.cliServerAppUrl ?? null,
218333
+ cliServerAccessToken: input.cliServerAccessToken ?? null
218319
218334
  }
218320
218335
  );
218321
218336
  if (!routerResult.ok) return null;
@@ -218718,6 +218733,8 @@ async function finalizeChatAnswerAfterReadSuppression(input) {
218718
218733
  runId: input.runId,
218719
218734
  userId: input.userId,
218720
218735
  workspaceId: input.workspaceId,
218736
+ cliServerAppUrl: input.cliServerAppUrl ?? null,
218737
+ cliServerAccessToken: input.cliServerAccessToken ?? null,
218721
218738
  signal: input.signal,
218722
218739
  onEvent: input.onEvent
218723
218740
  }) : null;
@@ -219613,6 +219630,10 @@ ${contextBlock}
219613
219630
  selectedSourceId: ctx.selectedSourceId,
219614
219631
  supabaseConfigured: ctx.supabaseConfigured,
219615
219632
  supabase: ctx.supabase,
219633
+ cliServerAppUrl: ctx.cliServerAppUrl,
219634
+ cliServerAccessToken: ctx.cliServerAccessToken,
219635
+ marketDeskProxyAppUrl: ctx.marketDeskProxyAppUrl,
219636
+ marketDeskProxyAccessToken: ctx.marketDeskProxyAccessToken,
219616
219637
  runId: runtimeWorkerRunId,
219617
219638
  chatMode: "agents",
219618
219639
  forceToolUse: DELIVERY_WORKER_IDS.has(args.workerId),
@@ -221532,6 +221553,10 @@ function buildSpawnContext(input, flockId, signal, emit, worker) {
221532
221553
  selectedSourceId: input.selectedSourceId,
221533
221554
  supabaseConfigured: input.supabaseConfigured,
221534
221555
  supabase: input.supabase ?? null,
221556
+ cliServerAppUrl: input.cliServerAppUrl ?? null,
221557
+ cliServerAccessToken: input.cliServerAccessToken ?? null,
221558
+ marketDeskProxyAppUrl: input.marketDeskProxyAppUrl ?? null,
221559
+ marketDeskProxyAccessToken: input.marketDeskProxyAccessToken ?? null,
221535
221560
  runId: flockId,
221536
221561
  // Default: the currently selected Perch model path. Only an explicit
221537
221562
  // "use <model> as <role>" request in the task pins this worker elsewhere.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perchai-cli",
3
- "version": "2.4.29",
3
+ "version": "2.4.30",
4
4
  "description": "Perch AI command-line interface",
5
5
  "bin": {
6
6
  "perch": "bin/perch"