agent-valley 3.0.0 → 3.0.2

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "av",
4
- "version": "3.0.0",
4
+ "version": "3.0.2",
5
5
  "description": "Delegate repository goals to Agent Valley and inspect mission progress and verification evidence.",
6
6
  "author": {
7
7
  "name": "Agent Valley"
package/dist/index.js CHANGED
@@ -15922,8 +15922,23 @@ function signalProcessTree(proc, signal) {
15922
15922
  }
15923
15923
  if (error.code !== "ESRCH")
15924
15924
  throw error;
15925
- if (proc.exitCode === null && proc.signalCode == null)
15926
- proc.kill(signal);
15925
+ if (proc.exitCode === null && proc.signalCode == null) {
15926
+ try {
15927
+ proc.kill(signal);
15928
+ } catch (handleError) {
15929
+ if (handleError.code === "EPERM" && absent(-proc.pid) && absent(proc.pid))
15930
+ return;
15931
+ throw handleError;
15932
+ }
15933
+ }
15934
+ }
15935
+ }
15936
+ function absent(pid) {
15937
+ try {
15938
+ process.kill(pid, 0);
15939
+ return false;
15940
+ } catch (error) {
15941
+ return error.code === "ESRCH";
15927
15942
  }
15928
15943
  }
15929
15944
  var init_process_tree = () => {};
@@ -16084,17 +16099,12 @@ function buildDarwinSandboxCommand(req, sandboxExecPath = "/usr/bin/sandbox-exec
16084
16099
  };
16085
16100
  }
16086
16101
  function buildSeatbeltProfile(req, home) {
16087
- const tmp = tmpdir();
16102
+ const tmpPaths = pathAliases(tmpdir());
16088
16103
  const git = linkedWorktreeGitPaths(req.workspacePath);
16089
16104
  const agentPaths = agentHomeAccess(req.agentType, home, req.env);
16090
- let tmpReal = tmp;
16091
- try {
16092
- tmpReal = realpathSync4(tmp);
16093
- } catch {}
16094
16105
  const writablePaths = [
16095
16106
  req.workspacePath,
16096
- tmp,
16097
- ...tmpReal !== tmp ? [tmpReal] : [],
16107
+ ...tmpPaths,
16098
16108
  ...agentPaths.active,
16099
16109
  `${home}/.cache`,
16100
16110
  `${home}/.npm`,
@@ -16120,7 +16130,7 @@ function buildSeatbeltProfile(req, home) {
16120
16130
  ];
16121
16131
  const denyReadLiterals = [
16122
16132
  `${home}/.git-credentials`,
16123
- ...new Set([process.cwd(), req.workspacePath].map((root) => join7(root, PROJECT_CONFIG_FILENAME)))
16133
+ ...new Set([process.cwd(), req.workspacePath].flatMap((root) => pathAliases(root).flatMap((path) => pathAliases(join7(path, PROJECT_CONFIG_FILENAME)))))
16124
16134
  ];
16125
16135
  const denyReadRules = [
16126
16136
  ...denyReadSubpaths.map((p) => `(deny file-read* (subpath ${seatbeltString(p)}))`),
@@ -16142,6 +16152,8 @@ function buildSeatbeltProfile(req, home) {
16142
16152
  (allow process-fork)
16143
16153
  (allow process-exec)
16144
16154
  (allow signal (target self))
16155
+ ; Tool cancellation must reach grandchildren; target children covers only direct children.
16156
+ (allow signal (target same-sandbox))
16145
16157
  (allow sysctl-read)
16146
16158
  (allow mach-lookup)
16147
16159
  ${req.agentType === "codex" ? '(allow ipc-posix-shm-read* (ipc-posix-name-prefix "apple.cfprefs."))' : ""}
@@ -16171,6 +16183,14 @@ ${denyWriteRules}
16171
16183
  (allow network-outbound (remote tcp "*:80"))
16172
16184
  `;
16173
16185
  }
16186
+ function pathAliases(path) {
16187
+ try {
16188
+ const canonical = realpathSync4(path);
16189
+ return canonical === path ? [path] : [path, canonical];
16190
+ } catch {
16191
+ return [path];
16192
+ }
16193
+ }
16174
16194
  function seatbeltString(value) {
16175
16195
  return `"${value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
16176
16196
  }
@@ -16396,11 +16416,14 @@ class BaseSession {
16396
16416
  _process = null;
16397
16417
  terminalEventReceived = false;
16398
16418
  processFailed = false;
16419
+ sandboxPlatform = null;
16399
16420
  get process() {
16400
16421
  return this._process;
16401
16422
  }
16402
16423
  set process(proc) {
16403
16424
  this._process = proc;
16425
+ if (!proc)
16426
+ this.sandboxPlatform = null;
16404
16427
  if (proc) {
16405
16428
  this.processFailed = false;
16406
16429
  this.terminalEventReceived = false;
@@ -16417,6 +16440,7 @@ class BaseSession {
16417
16440
  }
16418
16441
  }
16419
16442
  async spawnSandboxed(options) {
16443
+ this.sandboxPlatform = null;
16420
16444
  if (!this.config) {
16421
16445
  this.emitError("CRASH", "spawnSandboxed() called before start()", false);
16422
16446
  return false;
@@ -16437,6 +16461,7 @@ class BaseSession {
16437
16461
  this.emitError("CRASH", `${err}`, false);
16438
16462
  return false;
16439
16463
  }
16464
+ this.sandboxPlatform = plan.sandboxed ? plan.platform : null;
16440
16465
  this.process = spawn3(plan.command, plan.args, {
16441
16466
  detached: process.platform !== "win32",
16442
16467
  cwd: this.config.workspacePath,
@@ -16646,7 +16671,8 @@ var init_codex_session = __esm(() => {
16646
16671
  this.threadId = threadResult.thread.id;
16647
16672
  const turnResult = await this.rpc("turn/start", {
16648
16673
  threadId: this.threadId,
16649
- input: [{ type: "text", text: prompt }]
16674
+ input: [{ type: "text", text: prompt }],
16675
+ ...this.sandboxPlatform === "darwin" ? { sandboxPolicy: { type: "externalSandbox", networkAccess: "restricted" } } : {}
16650
16676
  });
16651
16677
  if (!this.terminalEventReceived && turnResult.turn)
16652
16678
  this.turnId = turnResult.turn.id;
@@ -68804,6 +68830,47 @@ file '${this.frames.at(-1)?.attachment.name}'
68804
68830
  // ../../packages/core/src/chief/schemas.ts
68805
68831
  init_container_observation_policy();
68806
68832
 
68833
+ // ../../packages/core/src/chief/review-response.ts
68834
+ function reviewResponseFormat(summary, criteria) {
68835
+ const passing = {
68836
+ passed: true,
68837
+ summary,
68838
+ findings: [],
68839
+ ...criteria ? {
68840
+ criteria: criteria.map((criterion) => ({
68841
+ criterion,
68842
+ passed: true,
68843
+ evidence: "actual inspected path or check"
68844
+ }))
68845
+ } : {}
68846
+ };
68847
+ const rejected = {
68848
+ ...passing,
68849
+ passed: false,
68850
+ summary: "An inspected requirement or evidence gap needs attention.",
68851
+ findings: [
68852
+ "Concern: describe the gap. Evidence: cite the inspected path or failed check. Action: give the concrete repair or next check."
68853
+ ],
68854
+ ...passing.criteria ? { criteria: passing.criteria.map((entry, index) => ({ ...entry, passed: index !== 0 })) } : {}
68855
+ };
68856
+ return [
68857
+ "Return ONLY one JSON object under 8,000 characters, without Markdown fences or text outside JSON.",
68858
+ `Use exactly these top-level keys: passed, summary, findings${criteria ? ", criteria" : ""}. Do not add other top-level keys or wrap the response in another object.`,
68859
+ "passed must be a boolean, summary must be a nonempty string, and findings must be an array of nonempty strings with at most 50 entries. Do not put objects, arrays, numbers or null in findings. Put each concern, inspected basis and concrete recommendation together inside one finding string; do not use concern/basis/recommendation objects.",
68860
+ "Use findings:[] for passed:true. For passed:false, include at least one actionable finding. Do not omit required keys.",
68861
+ ...criteria ? [
68862
+ "criteria must assess every requested criterion exactly once. Each criteria entry has exactly criterion, passed and evidence: criterion and evidence are nonempty strings, and passed is a boolean. Use the exact criterion text and actual inspected evidence. Overall passed must equal all criteria passing."
68863
+ ] : [],
68864
+ "The examples show response structure only. Replace example descriptions with actual inspected evidence; never claim an example check was performed.",
68865
+ `Passing response example:
68866
+ ${JSON.stringify(passing)}`,
68867
+ `Rejected response example:
68868
+ ${JSON.stringify(rejected)}`
68869
+ ].join(`
68870
+
68871
+ `);
68872
+ }
68873
+
68807
68874
  // ../../packages/core/src/chief/technical-lead.ts
68808
68875
  import { createHash as createHash14 } from "node:crypto";
68809
68876
  var TECHNICAL_DIRECTOR_ROLE = "Serve as the Chief Director's permanent Technical Director counterpart. Rigorously minimize total cost and wasted work while maximizing execution efficiency. Protect the user goal and quality requirements; standardize on the existing stack, reuse maintained modules and native integrations, keep dependencies justified and consistent, and favor the smallest maintainable solution.";
@@ -68857,7 +68924,8 @@ function technicalReviewPrompt(mission) {
68857
68924
  "Flag unjustified dependencies, unnecessary migrations, duplicate implementations, or complexity that materially harms maintainability. Give each concern an inspected basis and a concrete smaller adequate alternative or required evidence so the Chief Director can plan or revise. A passing assessment has no unresolved findings; passed:false includes at least one actionable finding.",
68858
68925
  "This consultation is advisory, not an execution veto or an operator approval gate. The Chief Director makes the final business and execution tradeoffs, including when a justified higher cost improves profit or the goal outcome. Do not discard an opportunity solely because of uncertainty: identify assumptions, evidence gaps and a concrete economical validation step or alternative. Do not invent profits, prices or evidence.",
68859
68926
  "The Chief Director retains execution judgment, supervision and the final explanation; the Technical Director supplies independent technical advice. The operator retains ultimate operational responsibility. Resolve routine technical choices from evidence without asking for microapprovals or inventing approval pauses.",
68860
- 'Return ONLY one JSON object under 8,000 characters: {"passed":true,"summary":"evidence-based technical advice with cost assumptions or unknowns","findings":[]}. For concerns use passed:false and actionable findings; the Chief Director decides how to act on them.',
68927
+ reviewResponseFormat("evidence-based technical advice with cost assumptions or unknowns"),
68928
+ "For concerns use passed:false and actionable findings; the Chief Director decides how to act on them.",
68861
68929
  [
68862
68930
  "Technical review input (JSON data):",
68863
68931
  JSON.stringify({
@@ -68900,7 +68968,8 @@ function designReviewPrompt(mission) {
68900
68968
  "If actual data is absent or insufficient, state what is unknown and propose the smallest useful instrumentation or user/field test: the specific journey or hypothesis, relevant user persona, observation or metric, comparison and decision rule. Propose these steps as advice; do not execute them in this read-only stage. Avoid false certainty and do not discard an opportunity solely because evidence is not yet available.",
68901
68969
  "Recommend the smallest adequate design approach that preserves the operator goal, any immutable success criteria, existing acceptance obligations and fixed verification command. Flag usability or evidence gaps with inspected examples and concrete alternatives; do not weaken requirements or demand an unrelated redesign.",
68902
68970
  "This consultation is advisory, not an execution veto or operator approval gate. The Chief Director owns the final business and execution judgment, supervision and explanation; the operator retains ultimate operational responsibility. Resolve routine choices from evidence without asking for microapprovals. Existing execution permissions remain in force.",
68903
- 'Return ONLY one JSON object under 8,000 characters: {"passed":true,"summary":"evidence-based design advice: alternatives, recommendation, data or unknowns, and retention tradeoffs","findings":[]}. Use passed:false with actionable concerns when evidence or usability needs improvement; the Chief Director decides how to act on them.',
68971
+ reviewResponseFormat("evidence-based design advice: alternatives, recommendation, data or unknowns, and retention tradeoffs"),
68972
+ "Use passed:false with actionable concerns when evidence or usability needs improvement; the Chief Director decides how to act on them.",
68904
68973
  [
68905
68974
  "Design review input (JSON data):",
68906
68975
  JSON.stringify({
@@ -68945,7 +69014,8 @@ function marketingReviewPrompt(mission) {
68945
69014
  "If real data is missing, state the gap and propose minimal measurement before claiming ROI improved. Do not discard a promising route solely because it is uncertain; distinguish a sourced fact, hypothesis and economical validation opportunity. Compare short-term revenue with costs, retention and payback instead of equating activity or clicks with money.",
68946
69015
  "Keep recommendations tied to the operator goal, any immutable success criteria, existing acceptance obligations and fixed verification command. Do not replace the goal with unrelated promotion or weaken requirements to report a better ROI. Recommend a concrete money-making option or improvement with its evidence and tradeoffs.",
68947
69016
  "This consultation is advisory, not an execution veto or operator approval gate. The Chief Director owns the final business and execution judgment, supervision and explanation; the operator retains ultimate operational responsibility. Resolve routine choices from evidence without asking for microapprovals. Existing execution permissions remain in force; this Actor preference does not grant outreach, publication or spending permission.",
68948
- 'Return ONLY one JSON object under 8,000 characters: {"passed":true,"summary":"evidence-based marketing advice: audience, revenue routes, recommendation, unit economics or unknowns, and measurable next test","findings":[]}. A passing assessment has no unresolved findings. Use passed:false with actionable concerns or missing evidence; the Chief Director decides how to act on them.',
69017
+ reviewResponseFormat("evidence-based marketing advice: audience, revenue routes, recommendation, unit economics or unknowns, and measurable next test"),
69018
+ "A passing assessment has no unresolved findings. Use passed:false with actionable concerns or missing evidence; the Chief Director decides how to act on them.",
68949
69019
  [
68950
69020
  "Marketing review input (JSON data):",
68951
69021
  JSON.stringify({
@@ -69856,6 +69926,7 @@ ${JSON.stringify({
69856
69926
  `);
69857
69927
  }
69858
69928
  function reviewPrompt(mission, task, state) {
69929
+ const criteria = !task && (mission.supervision || mission.operatingPolicy?.metricTargets?.length) ? finalCriteria(mission) : undefined;
69859
69930
  return [
69860
69931
  task ? "Independently review this task's changes and acceptance evidence." : "Perform the Chief Director's final review of the complete mission.",
69861
69932
  ...!task ? [CHIEF_DIRECTOR_ROLE, CHIEF_DECISION_RESPONSIBILITY] : [],
@@ -69870,7 +69941,10 @@ function reviewPrompt(mission, task, state) {
69870
69941
  ] : [],
69871
69942
  "Return actionable findings for the Actor to repair. A passing review must have no unresolved findings.",
69872
69943
  "Keep the complete JSON response under 8,000 characters; prioritize actionable blockers.",
69873
- !task && mission.supervision ? `Assess every goal success criterion in this exact JSON list once with a concise nonempty description of inspected files/checks: ${JSON.stringify(finalCriteria(mission))}. Every task acceptance obligation also needs its fresh independent task review. passed must equal all goal criteria passing; failed criteria need actionable findings. Return ONLY JSON: {"passed":true,"summary":"evidence-based assessment","findings":[],"criteria":[{"criterion":"exact criterion text","passed":true,"evidence":"actual inspected file or check"}]}` : 'Return ONLY JSON: {"passed":true,"summary":"evidence-based assessment","findings":[]}',
69944
+ ...criteria ? [
69945
+ `Assess every goal success criterion in this exact JSON list once with a concise nonempty description of inspected files/checks: ${JSON.stringify(criteria)}. Every task acceptance obligation also needs its fresh independent task review. passed must equal all goal criteria passing; failed criteria need actionable findings.`
69946
+ ] : [],
69947
+ reviewResponseFormat("evidence-based assessment", criteria),
69874
69948
  `Review input (JSON data):
69875
69949
  ${JSON.stringify({
69876
69950
  mission: JSON.parse(context(mission)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-valley",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=26.10.0",