pantheon-opencode 2.1.3 → 2.1.5

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.
@@ -51,8 +51,24 @@ var SAFE_DEV_BINARIES = /* @__PURE__ */ new Set([
51
51
  "cargo",
52
52
  "go",
53
53
  "sh",
54
- "bash"
54
+ "bash",
55
+ "opencode-quota"
55
56
  ]);
57
+ function isExcludedReadPath(rawPath) {
58
+ const trimmed = rawPath.trim();
59
+ if (!trimmed) return false;
60
+ const normalized = trimmed.replace(/\\/g, "/");
61
+ if (normalized.startsWith("../") || normalized === ".." || normalized.includes("/../")) {
62
+ return true;
63
+ }
64
+ if (/^\/(etc|boot|sys|proc|root)(\/|$)/.test(normalized)) {
65
+ return true;
66
+ }
67
+ if (/(^|\/)(\.git|node_modules)(\/|$)/.test(normalized)) {
68
+ return true;
69
+ }
70
+ return false;
71
+ }
56
72
  function autoPermissionsEnabled(env = process.env) {
57
73
  const val = (env.PANTHEON_AUTO_PERMISSIONS ?? "").trim().toLowerCase();
58
74
  return val !== "off" && val !== "0" && val !== "false";
@@ -129,7 +145,7 @@ function evaluateAutoPermission(event, options = {}) {
129
145
  return { decision: "allow", reason: "pantheon-native-tool" };
130
146
  }
131
147
  if (READ_ONLY_AGENTS.has(agent)) {
132
- if (["edit", "write", "hashline_edit", "bash", "shell"].includes(action)) {
148
+ if (["edit", "write", "hashline_edit", "bash", "shell", "execute"].includes(action)) {
133
149
  event.effect = "deny";
134
150
  event.message = `Pantheon auto-permissions denied: read-only agent '${agent}' cannot execute mutating action '${action}'`;
135
151
  return { decision: "deny", reason: "read-only-role-violation" };
@@ -140,10 +156,15 @@ function evaluateAutoPermission(event, options = {}) {
140
156
  if (firstResource.startsWith("http://") || firstResource.startsWith("https://")) {
141
157
  return { decision: "passthrough" };
142
158
  }
159
+ if (firstResource && isExcludedReadPath(firstResource)) {
160
+ event.effect = "deny";
161
+ event.message = `Pantheon auto-permissions denied: reading '${firstResource}' is prohibited (.git and node_modules are excluded)`;
162
+ return { decision: "deny", reason: "excluded-path" };
163
+ }
143
164
  event.effect = "allow";
144
165
  return { decision: "allow", reason: "safe-read-action" };
145
166
  }
146
- if (action === "bash" || action === "shell") {
167
+ if (action === "bash" || action === "shell" || action === "execute") {
147
168
  const rawCmd = Array.isArray(event.resources) && typeof event.resources[0] === "string" ? event.resources[0] : "";
148
169
  if (rawCmd) {
149
170
  if (isDangerousCommand(rawCmd)) {
@@ -3866,7 +3887,13 @@ var DEFAULT_BLOCKED_TOOLS = /* @__PURE__ */ new Set([
3866
3887
  // opencode.db.
3867
3888
  "pantheon_model"
3868
3889
  ]);
3869
- var ZEUS_READ_DENY_PATTERNS = [/^src\//, /^tests?\//, /^scripts?\//];
3890
+ var ZEUS_READ_DENY_PATTERNS = [
3891
+ /^src\//,
3892
+ /^tests?\//,
3893
+ /^scripts?\//,
3894
+ /(^|\/)\.git(\/|$)/,
3895
+ /(^|\/)node_modules(\/|$)/
3896
+ ];
3870
3897
  function normalizeGuardPath(value) {
3871
3898
  let normalized = value.replace(/\\/g, "/");
3872
3899
  while (normalized.startsWith("./")) normalized = normalized.slice(2);
@@ -3903,6 +3930,9 @@ function isDeniedGlobPattern(pattern) {
3903
3930
  if (normalized.startsWith("../") || normalized === ".." || normalized.includes("/../")) {
3904
3931
  return true;
3905
3932
  }
3933
+ if (/(^|\/)(\.git|node_modules)(\/|$)/.test(normalized)) {
3934
+ return true;
3935
+ }
3906
3936
  if (isDeniedReadPath(normalized, true)) {
3907
3937
  return true;
3908
3938
  }
@@ -8237,6 +8267,7 @@ function createJ3EscalationObserver(options) {
8237
8267
 
8238
8268
  // src/pantheon/native-vision.ts
8239
8269
  import { lookup as dnsLookup } from "node:dns/promises";
8270
+ import { existsSync as existsSync4 } from "node:fs";
8240
8271
  import { readFile as readFile4 } from "node:fs/promises";
8241
8272
  import { request as httpRequest } from "node:http";
8242
8273
  import { request as httpsRequest } from "node:https";
@@ -9207,6 +9238,33 @@ async function imageAttachment(value, directory, signal) {
9207
9238
  }
9208
9239
  return toImageAttachment(bytes, localPath.split(/[\\/]/).at(-1) || "image");
9209
9240
  }
9241
+ function discoverActiveSessionId(directory) {
9242
+ for (const envVar of ["OPENCODE_SESSION_ID", "SESSION_ID"]) {
9243
+ const val = (process.env[envVar] ?? "").trim();
9244
+ if (isValidSessionId(val)) return val;
9245
+ }
9246
+ try {
9247
+ const dataHome = process.env.XDG_DATA_HOME || join10(homedir4(), ".local", "share");
9248
+ const dbPath = process.env.OPENCODE_DB || join10(dataHome, "opencode", "opencode.db");
9249
+ if (!existsSync4(dbPath)) return void 0;
9250
+ const sqlite = __require("node:sqlite");
9251
+ const db = new sqlite.DatabaseSync(dbPath, { readOnly: true });
9252
+ try {
9253
+ if (directory) {
9254
+ const row = db.prepare(
9255
+ "SELECT id FROM session_v2 WHERE directory = ? ORDER BY time_created DESC LIMIT 1"
9256
+ ).get(directory);
9257
+ if (row && isValidSessionId(row.id)) return String(row.id);
9258
+ }
9259
+ const fallbackRow = db.prepare("SELECT id FROM session_v2 ORDER BY time_created DESC LIMIT 1").get();
9260
+ if (fallbackRow && isValidSessionId(fallbackRow.id)) return String(fallbackRow.id);
9261
+ } finally {
9262
+ db.close();
9263
+ }
9264
+ } catch {
9265
+ }
9266
+ return void 0;
9267
+ }
9210
9268
  function createV2VisionTool(runtime) {
9211
9269
  return {
9212
9270
  name: "vision_describe",
@@ -9229,7 +9287,11 @@ function createV2VisionTool(runtime) {
9229
9287
  let stage = "validate OpenCode session";
9230
9288
  try {
9231
9289
  const call = asRecord2(rawContext) ?? {};
9232
- if (!isValidSessionId(call.sessionID)) {
9290
+ let sessionID = isValidSessionId(call.sessionID) ? call.sessionID : void 0;
9291
+ if (!sessionID) {
9292
+ sessionID = discoverActiveSessionId(call.directory || process.cwd());
9293
+ }
9294
+ if (!sessionID) {
9233
9295
  throw new Error(
9234
9296
  "a valid OpenCode session id is required; retry this tool from an active OpenCode session"
9235
9297
  );
@@ -9268,7 +9330,7 @@ function createV2VisionTool(runtime) {
9268
9330
  stage = "send image to the selected multimodal model";
9269
9331
  const requestTarget = {
9270
9332
  ...target,
9271
- sessionID: call.sessionID
9333
+ sessionID
9272
9334
  };
9273
9335
  let failure;
9274
9336
  const output = await describeImagesNative(
@@ -10738,7 +10800,7 @@ import { promisify } from "node:util";
10738
10800
 
10739
10801
  // src/pantheon/cost-command.ts
10740
10802
  import { execFile } from "node:child_process";
10741
- import { accessSync, constants as constants3, existsSync as existsSync5, statSync as statSync3 } from "node:fs";
10803
+ import { accessSync, constants as constants3, existsSync as existsSync6, statSync as statSync3 } from "node:fs";
10742
10804
  import { delimiter, dirname as dirname8, join as join14 } from "node:path";
10743
10805
  import { fileURLToPath as fileURLToPath4 } from "node:url";
10744
10806
  import { z } from "zod";
@@ -10748,7 +10810,7 @@ import { homedir as homedir6 } from "node:os";
10748
10810
  import { join as join13 } from "node:path";
10749
10811
 
10750
10812
  // src/plugins/tui/src/model-pricing.ts
10751
- import { existsSync as existsSync4, mkdirSync as mkdirSync5, readFileSync as readFileSync6, renameSync as renameSync3, writeFileSync as writeFileSync4 } from "node:fs";
10813
+ import { existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync6, renameSync as renameSync3, writeFileSync as writeFileSync4 } from "node:fs";
10752
10814
  import { homedir as homedir5 } from "node:os";
10753
10815
  import { dirname as dirname7, join as join12 } from "node:path";
10754
10816
  var MODELS_DEV_URL = "https://models.dev/api.json";
@@ -10894,7 +10956,7 @@ function parseCachedCatalog(raw) {
10894
10956
  }
10895
10957
  function readPricingCache(cachePath) {
10896
10958
  try {
10897
- if (!existsSync4(cachePath)) return void 0;
10959
+ if (!existsSync5(cachePath)) return void 0;
10898
10960
  return parseCachedCatalog(JSON.parse(readFileSync6(cachePath, "utf8")));
10899
10961
  } catch {
10900
10962
  return void 0;
@@ -11125,7 +11187,7 @@ var costArgs = {
11125
11187
  };
11126
11188
  function findExistingDb(override) {
11127
11189
  const candidate = override === void 0 ? resolveCostDbPath() : resolveCostDbPath({ dbPath: override });
11128
- return existsSync5(candidate) ? candidate : void 0;
11190
+ return existsSync6(candidate) ? candidate : void 0;
11129
11191
  }
11130
11192
  var COST_AGGREGATE_SQL = {
11131
11193
  message: (sessionId) => `
@@ -11834,7 +11896,7 @@ async function queryWithCliFallback(dbPath, days, deps) {
11834
11896
  const execFileAsync = deps?.execFile ?? defaultExecFile;
11835
11897
  const isExecutable = deps?.isExecutable ?? defaultIsExecutable;
11836
11898
  const costScript = join14(__dirname, "..", "..", "scripts", "cost.mjs");
11837
- if (!existsSync5(costScript)) {
11899
+ if (!existsSync6(costScript)) {
11838
11900
  throw new Error(`CLI fallback script not found: ${costScript}`);
11839
11901
  }
11840
11902
  const node = resolveNodeExecutable(env, isExecutable);
@@ -12160,7 +12222,7 @@ function buildApprovalQuestion(plan) {
12160
12222
  }
12161
12223
 
12162
12224
  // src/pantheon/deepwork/plan-tracker.ts
12163
- import { existsSync as existsSync6 } from "node:fs";
12225
+ import { existsSync as existsSync7 } from "node:fs";
12164
12226
  import { appendFile as appendFile3, mkdir as mkdir6, readdir, readFile as readFile6, rename as rename5, writeFile as writeFile3 } from "node:fs/promises";
12165
12227
  import { join as join16 } from "node:path";
12166
12228
 
@@ -12393,7 +12455,7 @@ async function resolvePlanDecision(cwd = process.cwd(), slug, decisionId, chosen
12393
12455
  }
12394
12456
  async function listPlans(cwd = process.cwd()) {
12395
12457
  const root = deepworkRootDir(cwd);
12396
- if (!existsSync6(root)) return [];
12458
+ if (!existsSync7(root)) return [];
12397
12459
  const entries = await readdir(root, { withFileTypes: true });
12398
12460
  const result = [];
12399
12461
  for (const entry of entries) {
@@ -13738,6 +13800,11 @@ function createModelCommand(options = {}) {
13738
13800
  };
13739
13801
  }
13740
13802
 
13803
+ // src/pantheon/skill-search-tool.ts
13804
+ import { existsSync as existsSync8, readdirSync as readdirSync2, readFileSync as readFileSync7 } from "node:fs";
13805
+ import { homedir as homedir8 } from "node:os";
13806
+ import { join as join18 } from "node:path";
13807
+
13741
13808
  // scripts/skill-search.mjs
13742
13809
  import { spawnSync } from "node:child_process";
13743
13810
  import { pathToFileURL } from "node:url";
@@ -13957,6 +14024,75 @@ var invokedDirectly = process.argv[1] !== void 0 && import.meta.url === pathToFi
13957
14024
  if (invokedDirectly) main();
13958
14025
 
13959
14026
  // src/pantheon/skill-search-tool.ts
14027
+ function extractSkillMetadata(content, fallbackName) {
14028
+ let name = fallbackName;
14029
+ let description = "";
14030
+ const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
14031
+ const yaml = fmMatch?.[1];
14032
+ if (yaml) {
14033
+ const nameMatch = yaml.match(/^name:\s*["']?([^"'\r\n]+)["']?/m);
14034
+ if (nameMatch?.[1]) name = nameMatch[1].trim();
14035
+ const descMatch = yaml.match(/^description:\s*["']?([^"'\r\n]+)["']?/m);
14036
+ if (descMatch?.[1]) description = descMatch[1].trim();
14037
+ }
14038
+ if (!description) {
14039
+ const withoutFm = content.replace(/^---\r?\n[\s\S]*?\r?\n---/, "").trim();
14040
+ const lines = withoutFm.split("\n");
14041
+ for (const l of lines) {
14042
+ const trimmed = l.trim();
14043
+ if (trimmed && !trimmed.startsWith("#")) {
14044
+ description = trimmed.slice(0, 160);
14045
+ break;
14046
+ }
14047
+ }
14048
+ }
14049
+ return { name, description };
14050
+ }
14051
+ function scanInstalledSkills(cwd = process.cwd()) {
14052
+ const map = /* @__PURE__ */ new Map();
14053
+ for (const entry of PANTHEON_SKILL_CATALOG) {
14054
+ map.set(entry.id.toLowerCase(), {
14055
+ id: entry.id,
14056
+ description: entry.description,
14057
+ path: `src/skills/${entry.id}/SKILL.md`,
14058
+ scope: "internal"
14059
+ });
14060
+ }
14061
+ const scanDir = (baseDir, scope) => {
14062
+ try {
14063
+ if (!existsSync8(baseDir)) return;
14064
+ const entries = readdirSync2(baseDir, { withFileTypes: true });
14065
+ for (const entry of entries) {
14066
+ if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
14067
+ const skillName = entry.name;
14068
+ if (skillName.startsWith(".")) continue;
14069
+ const skillMd = join18(baseDir, skillName, "SKILL.md");
14070
+ if (existsSync8(skillMd)) {
14071
+ try {
14072
+ const raw = readFileSync7(skillMd, "utf8");
14073
+ const { name, description } = extractSkillMetadata(raw, skillName);
14074
+ const id = (name || skillName).trim();
14075
+ map.set(id.toLowerCase(), {
14076
+ id,
14077
+ description: description || skillName,
14078
+ path: skillMd,
14079
+ scope
14080
+ });
14081
+ } catch {
14082
+ }
14083
+ }
14084
+ }
14085
+ } catch {
14086
+ }
14087
+ };
14088
+ const xdgConfig = process.env.XDG_CONFIG_HOME || join18(homedir8(), ".config");
14089
+ scanDir(join18(xdgConfig, "opencode", "skills"), "global");
14090
+ scanDir(join18(homedir8(), ".agents", "skills"), "global");
14091
+ scanDir(join18(cwd, ".opencode", "skills"), "project");
14092
+ scanDir(join18(cwd, ".agents", "skills"), "project");
14093
+ scanDir(join18(cwd, "skills"), "project");
14094
+ return map;
14095
+ }
13960
14096
  var TOOL_DESCRIPTION3 = "Advisory discovery tool for skills. Queries installed Pantheon skills and external registries (Anthropic catalog, skills.sh, GitHub). Returns matched skill IDs, descriptions, install counts, and provenance tiers. Zeus uses this to recommend project-scoped skills (.agents/skills/) before proactively prompting the user via the question tool.";
13961
14097
  var SKILL_SEARCH_INPUT_SCHEMA = {
13962
14098
  type: "object",
@@ -13986,7 +14122,7 @@ var SKILL_SEARCH_INPUT_SCHEMA = {
13986
14122
  }
13987
14123
  }
13988
14124
  };
13989
- function executeSkillSearch(input) {
14125
+ function executeSkillSearch(input, options = {}) {
13990
14126
  const query = typeof input.query === "string" ? input.query.trim() : "";
13991
14127
  if (query.length === 0) {
13992
14128
  return { ok: false, query: "", count: 0, results: [], failures: ["query must be non-empty"] };
@@ -14002,10 +14138,12 @@ function executeSkillSearch(input) {
14002
14138
  );
14003
14139
  const results = [];
14004
14140
  const failures = [];
14141
+ const cwd = options.cwd ?? process.cwd();
14142
+ const installedMap = scanInstalledSkills(cwd);
14005
14143
  if (sources.has("installed")) {
14006
14144
  const tokens = query.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length > 2);
14007
14145
  if (tokens.length > 0) {
14008
- for (const entry of PANTHEON_SKILL_CATALOG) {
14146
+ for (const entry of installedMap.values()) {
14009
14147
  const idLower = entry.id.toLowerCase();
14010
14148
  const descLower = entry.description.toLowerCase();
14011
14149
  const matchScore = tokens.reduce((score, t) => {
@@ -14019,7 +14157,9 @@ function executeSkillSearch(input) {
14019
14157
  source: "installed",
14020
14158
  installed: true,
14021
14159
  installs: null,
14022
- installCommand: null
14160
+ installCommand: null,
14161
+ path: entry.path,
14162
+ scope: entry.scope
14023
14163
  });
14024
14164
  }
14025
14165
  }
@@ -14038,15 +14178,21 @@ function executeSkillSearch(input) {
14038
14178
  }
14039
14179
  if (Array.isArray(extRes.entries)) {
14040
14180
  for (const entry of extRes.entries) {
14041
- results.push({
14181
+ const bareName = (entry.skill.includes("@") ? entry.skill.split("@")[1] : entry.skill).toLowerCase();
14182
+ const isInstalled = installedMap.has(entry.skill.toLowerCase()) || installedMap.has(bareName);
14183
+ const installedRecord = installedMap.get(entry.skill.toLowerCase()) || installedMap.get(bareName);
14184
+ const pushItem = {
14042
14185
  skill: entry.skill,
14043
14186
  description: entry.skill,
14044
14187
  source: entry.source,
14045
- installed: false,
14188
+ installed: isInstalled,
14046
14189
  installs: entry.installs ?? null,
14047
- url: entry.url,
14048
- installCommand: `npx skills add ${entry.skill} -a opencode -y`
14049
- });
14190
+ ...entry.url ? { url: entry.url } : {},
14191
+ installCommand: isInstalled ? null : `npx skills add ${entry.skill} -a opencode -y`,
14192
+ path: isInstalled && installedRecord ? installedRecord.path : null,
14193
+ ...isInstalled && installedRecord ? { scope: installedRecord.scope } : {}
14194
+ };
14195
+ results.push(pushItem);
14050
14196
  }
14051
14197
  }
14052
14198
  } catch (err) {
@@ -14070,9 +14216,12 @@ function createV2SkillSearchDefinition() {
14070
14216
  description: TOOL_DESCRIPTION3,
14071
14217
  input: SKILL_SEARCH_INPUT_SCHEMA,
14072
14218
  output: {},
14073
- execute: async (input) => ({
14074
- output: JSON.stringify(executeSkillSearch(input), null, 2)
14075
- })
14219
+ execute: async (input, context) => {
14220
+ const cwd = context?.directory || process.cwd();
14221
+ return {
14222
+ output: JSON.stringify(executeSkillSearch(input, { cwd }), null, 2)
14223
+ };
14224
+ }
14076
14225
  };
14077
14226
  }
14078
14227
 
@@ -14391,7 +14540,8 @@ var shellTool = {
14391
14540
  input: SHELL_INPUT,
14392
14541
  output: {},
14393
14542
  execute: async (input, context) => {
14394
- const command = String(input.command ?? "");
14543
+ const raw = input ?? {};
14544
+ const command = String(raw.command ?? raw.cmd ?? "");
14395
14545
  if (!command.trim()) {
14396
14546
  return { output: "", ok: false, error: "Command cannot be empty" };
14397
14547
  }
@@ -2062,7 +2062,7 @@ async function readChangelogForBundle(bundleUrl) {
2062
2062
  }
2063
2063
  /** The ambient build-time version, or null outside a tsdown build. */
2064
2064
  function embeddedVersion() {
2065
- return "2.1.3";
2065
+ return "2.1.5";
2066
2066
  }
2067
2067
  /**
2068
2068
  * Resolve the running Pantheon version for the what's-new window: the plugin
@@ -2287,7 +2287,7 @@ function persistUpdateCheckState(previous, latest) {
2287
2287
  } catch {}
2288
2288
  }
2289
2289
  function resolveRunningVersion() {
2290
- return "2.1.3";
2290
+ return "2.1.5";
2291
2291
  }
2292
2292
  const VALUE_WIDTH = 24;
2293
2293
  function SettingsWindow(props) {
@@ -6513,7 +6513,7 @@ async function checkForPantheonUpdate(context) {
6513
6513
  const latest = String((await response.json())?.version ?? "");
6514
6514
  if (!latest) return;
6515
6515
  const notice = pickUpdateNotice({
6516
- currentVersion: "2.1.3",
6516
+ currentVersion: "2.1.5",
6517
6517
  latestVersion: latest,
6518
6518
  state: readState(),
6519
6519
  nowMs: Date.now()
@@ -7325,7 +7325,7 @@ function Sidebar(props) {
7325
7325
  get children() {
7326
7326
  var _el$13 = createElement("text");
7327
7327
  setProp(_el$13, "attributes", 1);
7328
- insert(_el$13, `Pantheon v2.1.3`);
7328
+ insert(_el$13, `Pantheon v2.1.5`);
7329
7329
  effect((_$p) => setProp(_el$13, "fg", text(), _$p));
7330
7330
  return _el$13;
7331
7331
  }
@@ -8097,7 +8097,7 @@ function HomeStatus(props) {
8097
8097
  },
8098
8098
  get children() {
8099
8099
  var _el$73 = createElement("text");
8100
- insert(_el$73, () => `Pantheon v2.1.3${preset().name ? ` ▸ ${preset().name}` : ""}`);
8100
+ insert(_el$73, () => `Pantheon v2.1.5${preset().name ? ` ▸ ${preset().name}` : ""}`);
8101
8101
  effect((_$p) => setProp(_el$73, "fg", muted(), _$p));
8102
8102
  return _el$73;
8103
8103
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pantheon-tui",
9
- "version": "2.1.3",
9
+ "version": "2.1.5",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@opencode/plugin": "2.0.26",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pantheon-tui",
3
3
  "type": "module",
4
- "version": "2.1.3",
4
+ "version": "2.1.5",
5
5
  "description": "Pantheon TUI plugin \u2014 V1 rich sidebar and usage gauges; native V2 status, session and delegation sidebar",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -19,13 +19,18 @@ Always prefer the repository's own focused selector or diff-aware command over g
19
19
  2. If a project-defined focused selector exists, execute it directly.
20
20
  3. If absent, map the modified file directly to its corresponding test file.
21
21
 
22
- ### 2. Scope Escalation & Mapping Gap Protocol
23
- - **No Silent Escalation:** NEVER silently broaden a test run from a modified file to an entire package or global suite.
24
- - **Explicit Justification:** If an expansion beyond the narrow slice is genuinely warranted (e.g. cross-cutting auth change, schema migration affecting multiple handlers), state visibly before running:
25
- `[Test Scope Expansion] Scope: <files> | Selected: <tests> | Reason: <concrete risk/integration rationale>`
22
+ ### 2. Scope Escalation & Risk-Based Protocol (Issue #444)
23
+ - **Focused Slice First:** Identify affected files/behaviors and run the narrowest slice (<10s).
24
+ - **Triggers for Package-Level Expansion:** Broaden beyond the local slice ONLY when changes:
25
+ 1. Cross module/package boundaries
26
+ 2. Alter public API/contracts or data schemas/migrations
27
+ 3. Touch authentication, authorization, or security boundaries
28
+ - **Broad Suite Distinction:** When running a broad suite, state explicitly whether it is an agent recommendation or a mandatory repository/CI gate.
29
+ - **Never Delete Tests to Speed Up:** Propose test removal only with concrete evidence of duplication, flakiness, or zero detection value.
30
+ - **CLI vs Code Execution:** Execute CLI binaries (`opencode-quota`, `git`, `npm`, `pytest`) via `shell`/`bash`, never JS eval (`execute`); on failure, never glob `~/.config`.
26
31
  - **Mapping Gap Handling:** If a modified file has no direct test counterpart:
27
32
  1. Report the mapping gap explicitly: `[Test Mapping Gap] No direct test file for <file>.`
28
- 2. Execute a bounded risk-appropriate fallback (static lint/typecheck gate e.g. `npx biome check <file>` or `ruff check <file>` plus the closest integration slice).
33
+ 2. Execute a bounded risk-appropriate fallback (static lint/typecheck gate plus closest slice).
29
34
  3. DO NOT escalate to running the entire repository test suite.
30
35
 
31
36
  ### 3. Failure/Fix Loop (Rerun Only Failed Tests)
@@ -36,11 +41,12 @@ Always prefer the repository's own focused selector or diff-aware command over g
36
41
  3. **DO NOT rerun checks that already passed** when their covered code did not change.
37
42
  4. Once the targeted test passes, rerun the single slice file once to confirm no regressions within the file.
38
43
 
39
- ### 4. Observable Task Receipt Summary
40
- Every implementation specialist MUST include the detailed test receipt in the `subtask_summary`:
44
+ ### 4. Observable Task Receipt Summary (Issue #444)
45
+ Every implementation specialist MUST include the detailed test receipt in `subtask_summary`, distinguishing agent-executed tests from CI gates and pending validations:
41
46
  ```markdown
42
47
  **tests:** [PASS | WARN | FAIL] `<command>` (targets: N, duration: <X>s, selection: <reason or repo selector>)
43
- **test_scope_justification:** <required ONLY if broader than a focused slice>
48
+ **validation_scope:** focused_slice | package_suite | ci_gate_required
49
+ **pending_validation:** none | [deferred broad suites / CI gates]
44
50
  ```
45
51
  *Example:*
46
52
  `**tests:** [PASS] npx tsx tests/pantheon/auto-permissions.test.ts (targets: 10, duration: 0.12s, selection: direct file slice for auto-permissions.ts)`