perchai-cli 2.4.40 → 2.4.41

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 +225 -13
  2. package/package.json +1 -1
package/dist/perch.mjs CHANGED
@@ -75917,6 +75917,7 @@ function isTurnAbortedError(error) {
75917
75917
  var TURN_STOPPED_BY_USER_MESSAGE;
75918
75918
  var init_turnAbort = __esm({
75919
75919
  "features/perchTerminal/runtime/turnAbort.ts"() {
75920
+ "use strict";
75920
75921
  TURN_STOPPED_BY_USER_MESSAGE = "Turn stopped by user.";
75921
75922
  }
75922
75923
  });
@@ -92807,6 +92808,40 @@ var init_agentSkillRegistry = __esm({
92807
92808
  "visionInspect"
92808
92809
  ]
92809
92810
  },
92811
+ {
92812
+ "id": "github",
92813
+ "name": "github",
92814
+ "description": "Inspect GitHub and git repository state, review commits and pull requests, debug checks, and publish local changes with clear permission boundaries.",
92815
+ "path": "features/perchTerminal/agentPlatform/skills/github/SKILL.md",
92816
+ "body": "\n# github\n\nUse this skill when the user asks Perch to inspect git state, review commits, prepare a commit, push a branch, understand GitHub checks, triage a pull request, or coordinate repo release work.\n\n## Operating Rules\n\n- Start with repository state before changing anything: current branch, status, recent commits, and relevant diff.\n- Protect unrelated work. Do not stage, discard, rewrite, or overwrite changes that are not part of the requested task.\n- For reviews, lead with concrete risks tied to file paths, diffs, commits, checks, or PR comments.\n- For commits, stage intentionally and write a concise message that matches the actual diff. Commit and push only when the user explicitly asks or has already authorized that action.\n- For CI or deployment checks, pair this with `wait-operator`: poll bounded status, read failing logs when available, and report final state rather than guessing.\n- For PR work, prefer existing authenticated GitHub routes or local `gh` when available; otherwise use git history, diff, and visible URLs as evidence.\n- Keep product language clean. Say GitHub, git, branch, commit, push, PR, checks, and deploy; avoid internal runtime labels unless debugging requires them.\n\n## Verification\n\nBefore finishing, report the branch, files changed, commit SHA when created, push target when pushed, PR/check/deploy URL when available, and any uncommitted files intentionally left alone.",
92817
+ "surface": {
92818
+ "gui": "supported",
92819
+ "cli": "supported"
92820
+ },
92821
+ "triggerHints": [
92822
+ "github",
92823
+ "git status",
92824
+ "git diff",
92825
+ "commit changes",
92826
+ "push branch",
92827
+ "pull request",
92828
+ "review commits",
92829
+ "github checks",
92830
+ "ci failure",
92831
+ "release branch"
92832
+ ],
92833
+ "companionSkills": [
92834
+ "workspace",
92835
+ "wait-operator"
92836
+ ],
92837
+ "preferredTools": [
92838
+ "bash",
92839
+ "runBashTerminalCommand",
92840
+ "grep",
92841
+ "readLocalFile",
92842
+ "writeLocalFile"
92843
+ ]
92844
+ },
92810
92845
  {
92811
92846
  "id": "pdf",
92812
92847
  "name": "pdf",
@@ -92996,6 +93031,41 @@ var init_agentSkillRegistry = __esm({
92996
93031
  "readLocalFile"
92997
93032
  ]
92998
93033
  },
93034
+ {
93035
+ "id": "wait-operator",
93036
+ "name": "wait-operator",
93037
+ "description": "Watch bounded external or local conditions, poll deployment and job status, wait through short-running tasks, and resume with verified state instead of guessing.",
93038
+ "path": "features/perchTerminal/agentPlatform/skills/wait-operator/SKILL.md",
93039
+ "body": "\n# wait-operator\n\nUse this skill when the user asks Perch to wait, watch, poll, monitor, check back, or keep an eye on a deployment, CI run, background job, file creation, local server, browser page, or other condition.\n\n## Operating Rules\n\n- Treat waiting as an active bounded loop: define the condition, timeout, interval, and failure states before polling.\n- Never sleep indefinitely. Use short intervals and a clear maximum wait unless the user explicitly asks for a longer watch.\n- Prefer read-only checks: status commands, existing logs, HTTP status endpoints, browser observe/wait, or file existence checks.\n- For deployments and CI, distinguish pending, ready/success, failed, canceled, timed out, and unknown. Do not call a run ready from elapsed time alone.\n- Report the last observed state if the wait times out or credentials/session state blocks verification.\n- Avoid noisy transcript spam. Group repeated polling into a short progress summary unless the user asks to see every check.\n- If the user asks for a real follow-up after this turn rather than an in-turn wait, create or suggest the appropriate automation instead of pretending the current turn can run forever.\n\n## Verification\n\nFinish only after the watched condition is directly verified or a blocker is named. Include the evidence source: command status, page state, URL, log line, file path, or timestamped last check.",
93040
+ "surface": {
93041
+ "gui": "supported",
93042
+ "cli": "supported"
93043
+ },
93044
+ "triggerHints": [
93045
+ "wait for deploy",
93046
+ "watch deployment",
93047
+ "poll status",
93048
+ "check until ready",
93049
+ "wait until done",
93050
+ "keep checking",
93051
+ "monitor progress",
93052
+ "long running task",
93053
+ "deployment status",
93054
+ "wake when done"
93055
+ ],
93056
+ "companionSkills": [
93057
+ "github",
93058
+ "workspace",
93059
+ "browser-operator"
93060
+ ],
93061
+ "preferredTools": [
93062
+ "bash",
93063
+ "runBashTerminalCommand",
93064
+ "webFetch",
93065
+ "browser_observe",
93066
+ "browser_wait"
93067
+ ]
93068
+ },
92999
93069
  {
93000
93070
  "id": "workspace",
93001
93071
  "name": "workspace",
@@ -93129,6 +93199,14 @@ function selectAgentSkills(input) {
93129
93199
  if (/\b(ap|accounts?\s+payable)\b/i.test(text)) {
93130
93200
  explicit.add("data-quality");
93131
93201
  }
93202
+ if (/\b(vercel|deploy(?:ment)?|github\s+actions?|ci|checks?)\b/i.test(text)) {
93203
+ if (/\b(wait|watch|poll|monitor|keep\s+checking|check\s+until|status)\b/i.test(text)) {
93204
+ explicit.add("wait-operator");
93205
+ }
93206
+ }
93207
+ if (/\b(github|git\b|pull\s+request|pr\b|commit|push|branch|ci|checks?)\b/i.test(text)) {
93208
+ explicit.add("github");
93209
+ }
93132
93210
  if (isMarketDeskSignalTask(text, availableToolNames)) {
93133
93211
  explicit.delete("research");
93134
93212
  omitted.push({
@@ -93183,6 +93261,8 @@ var init_skillSelector = __esm({
93183
93261
  "browser_navigate"
93184
93262
  ]);
93185
93263
  CORE_PRIORITY = [
93264
+ "wait-operator",
93265
+ "github",
93186
93266
  "data-quality",
93187
93267
  "presentations",
93188
93268
  "spreadsheets",
@@ -93218,6 +93298,14 @@ var init_skillSelector = __esm({
93218
93298
  /\b(research|credible\s+sources?|current\s+source|citations?|source\s+comparison|scholarly|public\s+web|fact[-\s]?check|latest|recent|filing)\b/i,
93219
93299
  /\b(find|gather|compare|verify)\b.{0,48}\b(sources?|evidence|filings?)\b/i
93220
93300
  ],
93301
+ github: [
93302
+ /\b(github|git\s+(?:status|diff|log|show|commit|push|pull|branch)|commit\s+(?:these|changes|and\s+push)|push\s+(?:this|the|branch)|pull\s+request|pr\s+#?\d*|review\s+commits?|github\s+checks?|ci\s+(?:failure|checks?|run)|release\s+branch)\b/i,
93303
+ /\b(stage|commit|push)\b.{0,56}\b(changes?|branch|repo|github)\b/i
93304
+ ],
93305
+ "wait-operator": [
93306
+ /\b(wait\s+(?:for|until)|watch\s+(?:the|this)?|poll\s+(?:status|until|for)|keep\s+checking|check\s+(?:until|back|again)|monitor\s+(?:progress|status|deploy)|long[-\s]?running\s+task|deployment\s+status|wake\s+when\s+done)\b/i,
93307
+ /\b(vercel|deploy(?:ment)?|github\s+actions?|ci|checks?|background\s+job|server|localhost)\b.{0,64}\b(ready|done|finish(?:ed)?|complete|succeed(?:ed)?|fail(?:ed)?|status)\b/i
93308
+ ],
93221
93309
  diagrams: [
93222
93310
  /\b(diagram|mermaid|drawio|workflow\s+graph|org\s+chart|entity\s+network|control\s+graph|architecture\s+map|vendor[-\s]?risk\s+graph|nodes?\s+and\s+edges?)\b/i,
93223
93311
  /\b(graph|map)\b.{0,32}\b(risk|workflow|architecture|network|relationship)\b/i
@@ -216988,6 +217076,53 @@ var init_toolExecutor = __esm({
216988
217076
  }
216989
217077
  });
216990
217078
 
217079
+ // features/perchTerminal/runtime/transcript/fileDiff.ts
217080
+ function lineDiff(oldText, newText) {
217081
+ const a = oldText.length ? oldText.split("\n") : [];
217082
+ const b2 = newText.length ? newText.split("\n") : [];
217083
+ const m = a.length;
217084
+ const n = b2.length;
217085
+ const dp = Array.from({ length: m + 1 }, () => new Array(n + 1).fill(0));
217086
+ for (let i2 = m - 1; i2 >= 0; i2--) {
217087
+ for (let j2 = n - 1; j2 >= 0; j2--) {
217088
+ dp[i2][j2] = a[i2] === b2[j2] ? dp[i2 + 1][j2 + 1] + 1 : Math.max(dp[i2 + 1][j2], dp[i2][j2 + 1]);
217089
+ }
217090
+ }
217091
+ const rows = [];
217092
+ let i = 0;
217093
+ let j = 0;
217094
+ while (i < m && j < n) {
217095
+ if (a[i] === b2[j]) {
217096
+ rows.push({ t: "ctx", text: a[i] });
217097
+ i++;
217098
+ j++;
217099
+ } else if (dp[i + 1][j] >= dp[i][j + 1]) {
217100
+ rows.push({ t: "del", text: a[i] });
217101
+ i++;
217102
+ } else {
217103
+ rows.push({ t: "add", text: b2[j] });
217104
+ j++;
217105
+ }
217106
+ }
217107
+ while (i < m) rows.push({ t: "del", text: a[i++] });
217108
+ while (j < n) rows.push({ t: "add", text: b2[j++] });
217109
+ return rows;
217110
+ }
217111
+ function lineDiffCounts(oldText, newText) {
217112
+ let added = 0;
217113
+ let removed = 0;
217114
+ for (const row of lineDiff(oldText, newText)) {
217115
+ if (row.t === "add") added++;
217116
+ else if (row.t === "del") removed++;
217117
+ }
217118
+ return { added, removed };
217119
+ }
217120
+ var init_fileDiff = __esm({
217121
+ "features/perchTerminal/runtime/transcript/fileDiff.ts"() {
217122
+ "use strict";
217123
+ }
217124
+ });
217125
+
216991
217126
  // features/perchTerminal/runtime/toolLoop/autoRouterTurnPolicy.ts
216992
217127
  function addAutoRouterAvoidFromProviderError(error, lane, avoid) {
216993
217128
  const match = error.match(/^([a-z0-9_]+)\s+returned\b/i);
@@ -217905,13 +218040,18 @@ async function executeToolBatch(toolCalls, ctx) {
217905
218040
  const filePath = typeof out?.relativePath === "string" ? out.relativePath : null;
217906
218041
  if (filePath) {
217907
218042
  const isWrite = toolCall.name === "writeLocalFile";
217908
- const overwrite = toolCall.arguments?.overwrite === true;
218043
+ const args = toolCall.arguments ?? {};
218044
+ const overwrite = args.overwrite === true;
218045
+ const { added, removed } = isWrite ? lineDiffCounts("", typeof args.content === "string" ? args.content : "") : lineDiffCounts(
218046
+ typeof args.oldText === "string" ? args.oldText : "",
218047
+ typeof args.newText === "string" ? args.newText : ""
218048
+ );
217909
218049
  ctx.onEvent({
217910
218050
  type: "file_change_summary",
217911
218051
  filePath,
217912
218052
  changeKind: isWrite && !overwrite ? "created" : "modified",
217913
- linesAdded: null,
217914
- linesRemoved: null,
218053
+ linesAdded: added,
218054
+ linesRemoved: removed,
217915
218055
  toolCallId: toolCall.id,
217916
218056
  ts: now6()
217917
218057
  });
@@ -218164,6 +218304,7 @@ var init_toolBatchExecutor = __esm({
218164
218304
  "use strict";
218165
218305
  init_modelRegistry();
218166
218306
  init_toolExecutor();
218307
+ init_fileDiff();
218167
218308
  init_toolNames();
218168
218309
  init_localCommandPolicy();
218169
218310
  init_toolArgHardening();
@@ -287199,6 +287340,8 @@ __export(perch_cli_exports, {
287199
287340
  HELP_TEXT: () => HELP_TEXT,
287200
287341
  INTERACTIVE_HELP_TEXT: () => INTERACTIVE_HELP_TEXT,
287201
287342
  PERCH_SPLASH_COMMANDS: () => PERCH_SPLASH_COMMANDS,
287343
+ cliWorkerActivityVerb: () => cliWorkerActivityVerb,
287344
+ composeWorkerActivityRowText: () => composeWorkerActivityRowText,
287202
287345
  flockEventToCliRow: () => flockEventToCliRow,
287203
287346
  flockNicknameAccentColor: () => flockNicknameAccentColor,
287204
287347
  parseInteractiveSlashCommand: () => parseInteractiveSlashCommand,
@@ -287257,6 +287400,19 @@ function workerEventToCliRow(event) {
287257
287400
  return null;
287258
287401
  }
287259
287402
  }
287403
+ function composeWorkerActivityRowText(base, activity) {
287404
+ const parts = [base.displayName];
287405
+ if (base.nickname) parts.push(base.nickname);
287406
+ const callCount = activity && activity.calls > 0 ? `${activity.calls} ${activity.calls === 1 ? "call" : "calls"}` : null;
287407
+ if (!base.done && activity && activity.calls > 0) {
287408
+ parts.push(cliWorkerActivityVerb(activity.lastTool));
287409
+ if (callCount) parts.push(callCount);
287410
+ } else {
287411
+ parts.push(FLOCK_STATUS_LABELS[base.status] ?? base.status);
287412
+ if (base.done && callCount) parts.push(callCount);
287413
+ }
287414
+ return parts.join(" \xB7 ");
287415
+ }
287260
287416
  async function runPerchCli(argv, writer = defaultWriter(), deps = {}) {
287261
287417
  const parsed = parsePerchCli(argv);
287262
287418
  if (!parsed.ok) {
@@ -287859,6 +288015,14 @@ async function runInkInteractivePerchCli(writer, deps, options) {
287859
288015
  const toolNamesById = /* @__PURE__ */ new Map();
287860
288016
  const flockWorkerNames = /* @__PURE__ */ new Map();
287861
288017
  const workerTitles = /* @__PURE__ */ new Map();
288018
+ const workerRowState = /* @__PURE__ */ new Map();
288019
+ const workerActivity = /* @__PURE__ */ new Map();
288020
+ const renderWorkerActivityRow = (workerId) => {
288021
+ const base = workerRowState.get(workerId);
288022
+ if (!base) return;
288023
+ const text = composeWorkerActivityRowText(base, workerActivity.get(workerId));
288024
+ updateToolItem(base.rowId, { label: base.label, text, tone: base.tone });
288025
+ };
287862
288026
  const flockLimitMeta = /* @__PURE__ */ new Map();
287863
288027
  const aggregateToolIds = /* @__PURE__ */ new Map();
287864
288028
  const aggregateToolMeta = /* @__PURE__ */ new Map();
@@ -287924,7 +288088,15 @@ async function runInkInteractivePerchCli(writer, deps, options) {
287924
288088
  setWorkingText("recovering route");
287925
288089
  break;
287926
288090
  case "tool_call_started": {
287927
- if (event.workerId) break;
288091
+ if (event.workerId) {
288092
+ const act = workerActivity.get(event.workerId) ?? { calls: 0, lastTool: event.toolName };
288093
+ act.calls += 1;
288094
+ act.lastTool = event.toolName;
288095
+ workerActivity.set(event.workerId, act);
288096
+ renderWorkerActivityRow(event.workerId);
288097
+ setWorkingText(cliWorkerActivityVerb(event.toolName));
288098
+ break;
288099
+ }
287928
288100
  if (event.toolName === "spawn_worker") break;
287929
288101
  const toolId = event.toolCallId ?? `${event.toolName}-${Date.now()}`;
287930
288102
  const name = humanizeCliToolName(event.toolName);
@@ -288240,7 +288412,17 @@ async function runInkInteractivePerchCli(writer, deps, options) {
288240
288412
  const row = workerEventToCliRow(event);
288241
288413
  if (!row) break;
288242
288414
  if (row.id) {
288243
- updateToolItem(row.id, { label: "worker", text: row.text, tone: row.tone });
288415
+ const done = event.type === "worker_run_completed";
288416
+ const status = done ? event.ok ? event.usabilityStatus === "needs_user_input" ? "blocked" : "done" : "failed" : "running";
288417
+ workerRowState.set(event.workerId, {
288418
+ rowId: row.id,
288419
+ label: "worker",
288420
+ displayName: event.title,
288421
+ status,
288422
+ tone: row.tone,
288423
+ done
288424
+ });
288425
+ renderWorkerActivityRow(event.workerId);
288244
288426
  } else {
288245
288427
  addItem({ label: "worker", text: row.text, tone: row.tone });
288246
288428
  }
@@ -288264,7 +288446,19 @@ async function runInkInteractivePerchCli(writer, deps, options) {
288264
288446
  }
288265
288447
  const row = flockEventToCliRow(event);
288266
288448
  if (!row) break;
288267
- if (row.id) {
288449
+ if (event.type === "flock_worker_update" && row.id) {
288450
+ const done = !(event.status === "queued" || event.status === "waiting" || event.status === "running");
288451
+ workerRowState.set(event.workerId, {
288452
+ rowId: row.id,
288453
+ label: "flock",
288454
+ displayName: event.displayName,
288455
+ nickname: event.nickname,
288456
+ status: event.status,
288457
+ tone: row.tone,
288458
+ done
288459
+ });
288460
+ renderWorkerActivityRow(event.workerId);
288461
+ } else if (row.id) {
288268
288462
  updateToolItem(row.id, { label: "flock", text: row.text, tone: row.tone });
288269
288463
  } else {
288270
288464
  addItem({ label: "flock", text: row.text, tone: row.tone });
@@ -289325,7 +289519,7 @@ function colorForInkDetailTone(tone) {
289325
289519
  case "add":
289326
289520
  return CLI_BRAND.patinaActive;
289327
289521
  case "remove":
289328
- return CLI_BRAND.bronzeGlint;
289522
+ return CLI_BRAND.brick;
289329
289523
  case "stderr":
289330
289524
  return "#d06b55";
289331
289525
  case "command":
@@ -289342,18 +289536,18 @@ function colorForCliSyntaxTone(tone, lineTone) {
289342
289536
  if (lineTone === "remove") {
289343
289537
  switch (tone) {
289344
289538
  case "comment":
289345
- return "#8e6a55";
289539
+ return "#9e6a5e";
289346
289540
  case "string":
289347
- return "#c48656";
289541
+ return "#d98a72";
289348
289542
  case "keyword":
289349
289543
  case "flag":
289350
- return CLI_BRAND.bronzeGlint;
289544
+ return CLI_BRAND.brickGlint;
289351
289545
  case "number":
289352
- return "#c77952";
289546
+ return "#d2705a";
289353
289547
  case "operator":
289354
- return CLI_BRAND.bronzeDeep;
289548
+ return CLI_BRAND.brickDeep;
289355
289549
  default:
289356
- return CLI_BRAND.bronzeGlint;
289550
+ return CLI_BRAND.brick;
289357
289551
  }
289358
289552
  }
289359
289553
  if (lineTone === "add") {
@@ -289560,6 +289754,19 @@ function cliToolAggregateKind(toolName) {
289560
289754
  if (normalized === "glob" || normalized === "grep" || normalized === "listlocalsources" || normalized === "statpath" || normalized === "validateworkspaceroot") return "search";
289561
289755
  return null;
289562
289756
  }
289757
+ function cliWorkerActivityVerb(toolName) {
289758
+ const aggregate = cliToolAggregateKind(toolName);
289759
+ if (aggregate === "read") return "reading";
289760
+ if (aggregate === "search") return "searching";
289761
+ const n = toolName.toLowerCase();
289762
+ if (n.includes("write") && n.includes("file")) return "writing";
289763
+ if (n.includes("edit") && n.includes("file")) return "editing";
289764
+ if (n.includes("patch")) return "patching";
289765
+ if (n === "run_sandbox_code") return "running code";
289766
+ if (n.includes("bash") || n.includes("terminal") || n.includes("shell")) return "running";
289767
+ if (n === "spawn_worker" || n === "dispatch_agent") return "delegating";
289768
+ return "working";
289769
+ }
289563
289770
  function getCliToolAggregateMeta(store, kind) {
289564
289771
  const existing = store.get(kind);
289565
289772
  if (existing) return existing;
@@ -290036,6 +290243,11 @@ var init_perch_cli = __esm({
290036
290243
  bronze: "#9A5228",
290037
290244
  bronzeGlint: "#B5632F",
290038
290245
  bronzeDeep: "#6F351D",
290246
+ // Diff "removed" family — warm muted brick red, brand-tuned (not git red),
290247
+ // kept distinct from bronze so deletions don't share the accent/interactive hue.
290248
+ brick: "#CF6A52",
290249
+ brickGlint: "#DC7A60",
290250
+ brickDeep: "#9E4634",
290039
290251
  graphite: "#0F0D0B",
290040
290252
  divider: "#32251E",
290041
290253
  cream: "#FFF8F0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perchai-cli",
3
- "version": "2.4.40",
3
+ "version": "2.4.41",
4
4
  "description": "Perch AI command-line interface",
5
5
  "bin": {
6
6
  "perch": "bin/perch"