pacework 1.7.17 → 1.7.18

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.
@@ -9,6 +9,7 @@ import process from "node:process"
9
9
  import { spawn, execFileSync } from "node:child_process"
10
10
  import { AsyncLocalStorage } from "node:async_hooks"
11
11
  import { createLogger } from "../lib/logger.mjs"
12
+ import { fileLimitAppliesTo, isReviewRun } from "../lib/run-kind.mjs"
12
13
  import { detectCapabilities, detectPower } from "../lib/capabilities.mjs"
13
14
  import { detectRunUsageLimit, USAGE_LIMIT_MARKER } from "../lib/usage-limit.mjs"
14
15
  import {
@@ -624,29 +625,6 @@ function buildRunnerCompletionComment(input) {
624
625
  ].join(" ")
625
626
  }
626
627
 
627
- /**
628
- * Whether a run is a review. The server says so in `purpose`, from the issue's
629
- * workflow stage or the agent's role; the skill slug is only a fallback for
630
- * servers that predate it. Deciding by slug made a renamed reviewer build code.
631
- */
632
- function isReviewRun(run) {
633
- if (run?.purpose) return run.purpose === "review"
634
- return getAgentSkillProfileSlug(run?.agent) === "reviewer"
635
- }
636
-
637
- function getAgentSkillProfileSlug(agent) {
638
- if (!agent || typeof agent !== "object") return null
639
- const direct = agent.skill_profile
640
- if (direct && typeof direct === "object" && typeof direct.slug === "string") return direct.slug
641
- const nested = agent.skill_profiles
642
- if (Array.isArray(nested)) {
643
- const first = nested.find((entry) => entry && typeof entry.slug === "string")
644
- return first?.slug || null
645
- }
646
- if (nested && typeof nested === "object" && typeof nested.slug === "string") return nested.slug
647
- return null
648
- }
649
-
650
628
  function parseReviewerDecisionSummary(summary) {
651
629
  const text = String(summary || "").trim()
652
630
  if (!text) return null
@@ -2114,9 +2092,8 @@ function buildPrompt(run, branch, worktreePath, options = {}) {
2114
2092
  const gitAvailable = options.gitAvailable !== false
2115
2093
  const workspaceContext = options.workspaceContext || null
2116
2094
  const greenfieldWorkspace = workspaceContext?.is_empty_workspace === true
2117
- // The agent's standing instructions; servers before skill profiles were
2118
- // retired sent them as skill_profile.system_prompt.
2119
- const skillPrompt = (agent?.instructions ?? agent?.skill_profile?.system_prompt)?.trim()
2095
+ // The agent's standing instructions.
2096
+ const skillPrompt = typeof agent?.instructions === "string" ? agent.instructions.trim() : ""
2120
2097
  const base = skillPrompt ? `${skillPrompt}\n\n---\n\n` : ""
2121
2098
  const codingRules = Array.isArray(run?.coding_rules) ? run.coding_rules : []
2122
2099
  const reviewerContext = run?.reviewer_context || null
@@ -3462,7 +3439,7 @@ async function runExecutor(run, state) {
3462
3439
  }
3463
3440
  const runLimits = resolveRunLimits({ args, env: process.env, profile: runnerProfile })
3464
3441
  // Scouts survey the codebase and may touch many files on purpose.
3465
- const fileLimitApplies = gitAvailable && getAgentSkillProfileSlug(run.agent) !== "scout"
3442
+ const fileLimitApplies = gitAvailable && fileLimitAppliesTo(run.agent)
3466
3443
  // The commit the run starts from: only the files this run changes count.
3467
3444
  const runStartSha = gitAvailable
3468
3445
  ? ((await execCommandSafe("git", ["-C", worktreePath, "rev-parse", "HEAD"], worktreePath))?.stdout?.trim() || null)
@@ -0,0 +1,25 @@
1
+ /**
2
+ * What kind of run this is, from what the server says about it: the run's
3
+ * `purpose` (its workflow stage) first, then the agent's role.
4
+ */
5
+
6
+ /** The slug of the agent's role, or null when it has none. */
7
+ export function agentRoleSlug(agent) {
8
+ const slug = agent && typeof agent === "object" ? agent.role?.slug : null
9
+ return typeof slug === "string" && slug ? slug : null
10
+ }
11
+
12
+ /**
13
+ * Whether a run is a review. The server says so in `purpose`; the agent's role
14
+ * decides only when a run carries no purpose. Deciding by a name alone made a
15
+ * renamed reviewer build code.
16
+ */
17
+ export function isReviewRun(run) {
18
+ if (run?.purpose) return run.purpose === "review"
19
+ return agentRoleSlug(run?.agent) === "reviewer"
20
+ }
21
+
22
+ /** Scouts survey the codebase and may touch many files on purpose. */
23
+ export function fileLimitAppliesTo(agent) {
24
+ return agentRoleSlug(agent) !== "scout"
25
+ }
@@ -204,7 +204,7 @@ export function createShellHandlers({
204
204
  out.log(cmd("issues", "List issues (open / active / all / in_progress …)"))
205
205
  out.log(cmd("mine", "Issues assigned to you"))
206
206
  out.log(cmd("issue <id>", "View issue detail, description, comments"))
207
- out.log(cmd("agents", "List agents and their skill profiles"))
207
+ out.log(cmd("agents", "List agents and their roles"))
208
208
  out.log(cmd("dashboard", "Orchestration status — runs, queue, review"))
209
209
  out.log(cmd("logtail <run-id>","Stream live log of a running job"))
210
210
  out.log(cmd("open [id]", "Open workspace (or specific issue) in browser"))
@@ -785,20 +785,20 @@ export function createShellHandlers({
785
785
  const { agents } = await res.json()
786
786
  if (!agents?.length) { out.log(` \x1b[2mNo agents configured.\x1b[0m\n`); break }
787
787
 
788
- const SKILL_COLOR = { reviewer:"\x1b[33m", implementer:"\x1b[34m", planner:"\x1b[35m" }
789
- const COL_NAME = 22, COL_SKILL = 16, COL_EXE = 14
790
- const hr = ` ${"─".repeat(COL_NAME + COL_SKILL + COL_EXE + 4)}`
788
+ const ROLE_COLOR = { reviewer:"\x1b[33m", implementer:"\x1b[34m", planner:"\x1b[35m" }
789
+ const COL_NAME = 22, COL_ROLE = 16, COL_EXE = 14
790
+ const hr = ` ${"─".repeat(COL_NAME + COL_ROLE + COL_EXE + 4)}`
791
791
  out.log(`\n\x1b[1mAgents\x1b[0m \x1b[2m(${agents.length})\x1b[0m`)
792
792
  out.log(hr)
793
- out.log(` \x1b[2m${"NAME".padEnd(COL_NAME)} ${"SKILL".padEnd(COL_SKILL)} ${"EXECUTOR".padEnd(COL_EXE)}\x1b[0m`)
793
+ out.log(` \x1b[2m${"NAME".padEnd(COL_NAME)} ${"ROLE".padEnd(COL_ROLE)} ${"EXECUTOR".padEnd(COL_EXE)}\x1b[0m`)
794
794
  out.log(hr)
795
795
  for (const a of agents) {
796
- const skill = (a.skill_profile_label ?? a.skill_profile_slug ?? "—").toLowerCase()
797
- const skillCol = SKILL_COLOR[a.skill_profile_slug] ?? "\x1b[2m"
796
+ const role = (a.role_name ?? a.role_slug ?? "—").toLowerCase()
797
+ const roleCol = ROLE_COLOR[a.role_slug] ?? "\x1b[2m"
798
798
  const name = (a.name ?? a.slug ?? a.id.slice(0,8)).slice(0, COL_NAME).padEnd(COL_NAME)
799
- const skillStr = skill.slice(0, COL_SKILL).padEnd(COL_SKILL)
799
+ const roleStr = role.slice(0, COL_ROLE).padEnd(COL_ROLE)
800
800
  const exe = executorLabel(a.local_executor ?? "").slice(0, COL_EXE).padEnd(COL_EXE)
801
- out.log(` \x1b[1m${name}\x1b[0m ${skillCol}${skillStr}\x1b[0m \x1b[2m${exe}\x1b[0m`)
801
+ out.log(` \x1b[1m${name}\x1b[0m ${roleCol}${roleStr}\x1b[0m \x1b[2m${exe}\x1b[0m`)
802
802
  }
803
803
  out.log(hr)
804
804
  out.log(` \x1b[2mTip: /run <issue-id> to dispatch with agent picker\x1b[0m\n`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacework",
3
- "version": "1.7.17",
3
+ "version": "1.7.18",
4
4
  "description": "pacework CLI: connect this machine as a runner for pacework AI agents",
5
5
  "type": "module",
6
6
  "bin": {