@agenttrail/cli 0.2.6 → 0.2.8

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.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{$,A as N,Aa as Ne,B as _,Ba as _e,C as x,Ca as xe,D as O,Da as Oe,E as h,F as G,G as k,H as v,I as D,J as U,K as F,L as b,M as j,N as B,O as M,P as w,Q as V,R as J,S as K,T as W,U as z,V as H,W as Q,X as q,Y as X,Z as Y,_ as Z,a as e,aa as ee,b as t,ba as te,c as o,ca as oe,d as r,da as re,e as n,ea as ne,f as p,fa as pe,g as i,ga as ie,h as s,ha as se,i as l,ia as le,j as a,ja as ae,k as u,ka as ue,l as c,la as ce,m as y,ma as ye,n as f,na as fe,o as S,oa as Se,p as d,pa as de,q as T,qa as Te,r as I,ra as Ie,s as m,sa as me,t as E,ta as Ee,u as R,ua as Re,v as C,va as Ce,w as g,wa as ge,x as A,xa as Ae,y as P,ya as Pe,z as L,za as Le}from"./chunk-Q7QL7XER.js";export{t as AGENTTRAIL_AGENT_NS,d as AGENTTRAIL_API_ENDPOINT,o as AGENTTRAIL_INGEST_ENDPOINT,Se as AGENTTRAIL_MARKETPLACE_NAME,Te as AGENTTRAIL_PLUGIN_ID,de as AGENTTRAIL_PLUGIN_NAME,e as AGENTTRAIL_PROJECT_NS,n as CLAUDE_CODE_VENDOR_SLUG,p as CONTENT_FLAGS,Ee as ClaudeCliNotFoundError,R as DEFAULT_LOCK_STALE_MS,Ie as MIN_CLAUDE_VERSION,P as PROJECT_CONFIG_FILE,Ce as PluginCommandError,Re as PluginUnsupportedError,oe as QuarantineError,w as REFRESH_STALE_WINDOW_MS,g as agenttrailConfigSchema,$ as backfillSpanId,Z as backfillTraceId,ue as boundedPool,l as buildEnvBlock,s as buildResourceAttributes,ee as buildSpanTree,W as checkpointPath,S as clearCredentials,b as computeAgentId,F as computeProjectId,c as credentialsPath,me as defaultClaudeRunner,pe as defaultProjectsRoot,D as deriveProjectIdentity,U as deriveProjectSlug,i as encodeResourceValue,Pe as ensureClaudeSupportsPlugins,j as ensureGitignored,re as fileLineSource,_ as findGitRoot,N as findProjectConfig,L as globalConfigPath,Y as hashContent,X as hashFile,Ne as installAgentTrailPlugin,ie as isSessionInProject,Ae as isVersionAtLeast,r as normalizeEndpoint,A as parseAgentTrailConfig,ge as parseClaudeVersion,k as parseGitRemote,ne as parseSession,I as pollDeviceToken,y as readCredentials,v as readGitRemote,z as readState,m as refreshDeviceToken,h as resolveApiKey,O as resolveConfig,Le as resolvePluginScaffoldDir,x as resolveProjectRoot,E as revokeDeviceToken,Oe as run,fe as runImport,V as runLogin,K as runLogout,J as runRefresh,ce as runScan,xe as runSetup,ye as runStatus,se as scanTranscripts,te as sessionToResourceSpans,a as settingsPath,q as shouldProcess,G as slugify,T as startDeviceAuth,le as toOtlpJson,_e as uninstallAgentTrailPlugin,ae as uploadResourceSpans,Q as upsertSession,C as withRefreshLock,B as writeAgentTrailConfig,u as writeClaudeSettings,f as writeCredentials,M as writeGlobalConfig,H as writeState};
1
+ import{$,A as N,Aa as Ne,B as _,Ba as _e,C as x,Ca as xe,D as O,Da as Oe,E as h,F as G,G as k,H as v,I as D,J as U,K as F,L as b,M as j,N as B,O as M,P as w,Q as V,R as J,S as K,T as W,U as z,V as H,W as Q,X as q,Y as X,Z as Y,_ as Z,a as e,aa as ee,b as t,ba as te,c as o,ca as oe,d as r,da as re,e as n,ea as ne,f as p,fa as pe,g as i,ga as ie,h as s,ha as se,i as l,ia as le,j as a,ja as ae,k as u,ka as ue,l as c,la as ce,m as y,ma as ye,n as f,na as fe,o as S,oa as Se,p as d,pa as de,q as T,qa as Te,r as I,ra as Ie,s as m,sa as me,t as E,ta as Ee,u as R,ua as Re,v as C,va as Ce,w as g,wa as ge,x as A,xa as Ae,y as P,ya as Pe,z as L,za as Le}from"./chunk-XLIZZ2BX.js";export{t as AGENTTRAIL_AGENT_NS,d as AGENTTRAIL_API_ENDPOINT,o as AGENTTRAIL_INGEST_ENDPOINT,Se as AGENTTRAIL_MARKETPLACE_NAME,Te as AGENTTRAIL_PLUGIN_ID,de as AGENTTRAIL_PLUGIN_NAME,e as AGENTTRAIL_PROJECT_NS,n as CLAUDE_CODE_VENDOR_SLUG,p as CONTENT_FLAGS,Ee as ClaudeCliNotFoundError,R as DEFAULT_LOCK_STALE_MS,Ie as MIN_CLAUDE_VERSION,P as PROJECT_CONFIG_FILE,Ce as PluginCommandError,Re as PluginUnsupportedError,oe as QuarantineError,w as REFRESH_STALE_WINDOW_MS,g as agenttrailConfigSchema,$ as backfillSpanId,Z as backfillTraceId,ue as boundedPool,l as buildEnvBlock,s as buildResourceAttributes,ee as buildSpanTree,W as checkpointPath,S as clearCredentials,b as computeAgentId,F as computeProjectId,c as credentialsPath,me as defaultClaudeRunner,pe as defaultProjectsRoot,D as deriveProjectIdentity,U as deriveProjectSlug,i as encodeResourceValue,Pe as ensureClaudeSupportsPlugins,j as ensureGitignored,re as fileLineSource,_ as findGitRoot,N as findProjectConfig,L as globalConfigPath,Y as hashContent,X as hashFile,Ne as installAgentTrailPlugin,ie as isSessionInProject,Ae as isVersionAtLeast,r as normalizeEndpoint,A as parseAgentTrailConfig,ge as parseClaudeVersion,k as parseGitRemote,ne as parseSession,I as pollDeviceToken,y as readCredentials,v as readGitRemote,z as readState,m as refreshDeviceToken,h as resolveApiKey,O as resolveConfig,Le as resolvePluginScaffoldDir,x as resolveProjectRoot,E as revokeDeviceToken,Oe as run,fe as runImport,V as runLogin,K as runLogout,J as runRefresh,ce as runScan,xe as runSetup,ye as runStatus,se as scanTranscripts,te as sessionToResourceSpans,a as settingsPath,q as shouldProcess,G as slugify,T as startDeviceAuth,le as toOtlpJson,_e as uninstallAgentTrailPlugin,ae as uploadResourceSpans,Q as upsertSession,C as withRefreshLock,B as writeAgentTrailConfig,u as writeClaudeSettings,f as writeCredentials,M as writeGlobalConfig,H as writeState};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenttrail/cli",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "type": "module",
5
5
  "description": "The AgentTrail command-line tool: connects an AI coding agent's sessions to AgentTrail, with setup, sign-in, status and history import for the agent named by --agent.",
6
6
  "license": "Apache-2.0",
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "AgentTrail's plugin marketplace — the enforcement plugin for agent governance.",
9
- "version": "0.2.6"
9
+ "version": "0.2.8"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "agenttrail",
14
14
  "source": "./",
15
15
  "description": "AgentTrail enforcement plugin — PreToolUse governance hook (a fail-closed command shim).",
16
- "version": "0.2.6",
16
+ "version": "0.2.8",
17
17
  "author": {
18
18
  "name": "AgentTrail"
19
19
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agenttrail",
3
3
  "description": "AgentTrail enforcement plugin for Claude Code — carries the PreToolUse governance hook, a fail-closed command shim.",
4
- "version": "0.2.6",
4
+ "version": "0.2.8",
5
5
  "author": {
6
6
  "name": "AgentTrail",
7
7
  "url": "https://agenttrail.sh"
@@ -3064,6 +3064,10 @@ async function holdForApproval(args, fetchFn) {
3064
3064
  throw foreign403("hold");
3065
3065
  }
3066
3066
  if (res.status !== 200) throw new PdpUnreachableError(`hold status ${res.status}`);
3067
+ try {
3068
+ args.onHeld?.();
3069
+ } catch {
3070
+ }
3067
3071
  let parsed;
3068
3072
  try {
3069
3073
  parsed = JSON.parse(await res.text());
@@ -4634,10 +4638,116 @@ function withScope(requests, scope) {
4634
4638
  return requests.map((request) => ({ ...request, scope }));
4635
4639
  }
4636
4640
 
4641
+ // src/pep/hold-upload.ts
4642
+ import { spawn } from "child_process";
4643
+ import { readFileSync as readFileSync5 } from "fs";
4644
+ import { isAbsolute, join as join7 } from "path";
4645
+ var HOLD_CAPTURE_COMMAND = "npx -y @agenttrail/cli@latest capture --agent claude";
4646
+ var HOLD_WORKER_ENV = "AGENTTRAIL_SESSION_UPLOAD_WORKER";
4647
+ var HOLD_PAYLOAD_ENV = "AGENTTRAIL_SESSION_UPLOAD_PAYLOAD";
4648
+ var HOLD_SHELL_SAFE_ENDPOINT = /^https?:\/\/[A-Za-z0-9.:\-_/~%]+$/;
4649
+ var SAFE_SESSION_ID = /^[A-Za-z0-9._-]{1,128}$/;
4650
+ function holdUploadPayload(payload) {
4651
+ const { session_id: sessionId, transcript_path: transcriptPath, cwd } = payload;
4652
+ if (typeof sessionId !== "string" || !SAFE_SESSION_ID.test(sessionId)) return void 0;
4653
+ if (sessionId === "." || sessionId === "..") return void 0;
4654
+ if (typeof transcriptPath !== "string" || !isAbsolute(transcriptPath)) return void 0;
4655
+ if (!transcriptPath.endsWith(".jsonl")) return void 0;
4656
+ if (typeof cwd !== "string" || !isAbsolute(cwd)) return void 0;
4657
+ return {
4658
+ session_id: sessionId,
4659
+ transcript_path: transcriptPath,
4660
+ cwd,
4661
+ hook_event_name: "PreToolUse"
4662
+ };
4663
+ }
4664
+ function isPlainObject(v) {
4665
+ return typeof v === "object" && v !== null && !Array.isArray(v);
4666
+ }
4667
+ function baseCommand() {
4668
+ const [file, ...args] = HOLD_CAPTURE_COMMAND.split(" ");
4669
+ return { file, args };
4670
+ }
4671
+ function holdCaptureCommand(command) {
4672
+ if (command === HOLD_CAPTURE_COMMAND) return baseCommand();
4673
+ if (typeof command !== "string") return void 0;
4674
+ const prefix = `${HOLD_CAPTURE_COMMAND} --endpoint `;
4675
+ if (!command.startsWith(prefix)) return void 0;
4676
+ const endpoint = command.slice(prefix.length);
4677
+ if (!HOLD_SHELL_SAFE_ENDPOINT.test(endpoint)) return void 0;
4678
+ const base = baseCommand();
4679
+ return { file: base.file, args: [...base.args, "--endpoint", endpoint] };
4680
+ }
4681
+ function stopCaptureCommandIn(text) {
4682
+ let parsed;
4683
+ try {
4684
+ parsed = JSON.parse(text);
4685
+ } catch {
4686
+ return void 0;
4687
+ }
4688
+ if (!isPlainObject(parsed) || !isPlainObject(parsed.hooks)) return void 0;
4689
+ const groups = parsed.hooks.Stop;
4690
+ if (!Array.isArray(groups)) return void 0;
4691
+ for (const g of groups) {
4692
+ if (!isPlainObject(g) || !Array.isArray(g.hooks)) continue;
4693
+ for (const h of g.hooks) {
4694
+ if (!isPlainObject(h)) continue;
4695
+ const command = holdCaptureCommand(h.command);
4696
+ if (command) return command;
4697
+ }
4698
+ }
4699
+ return void 0;
4700
+ }
4701
+ function claudeProjectDir(env) {
4702
+ const dir = env.CLAUDE_PROJECT_DIR;
4703
+ return typeof dir === "string" && isAbsolute(dir) ? dir : void 0;
4704
+ }
4705
+ function projectCaptureCommand(env, readFile = (p) => readFileSync5(p, "utf8")) {
4706
+ const projectDir = claudeProjectDir(env);
4707
+ if (!projectDir) return void 0;
4708
+ let text;
4709
+ try {
4710
+ text = readFile(join7(projectDir, ".claude", "settings.json"));
4711
+ } catch {
4712
+ return void 0;
4713
+ }
4714
+ return stopCaptureCommandIn(text);
4715
+ }
4716
+ function defaultSpawnDetached(file, args, env) {
4717
+ const child = spawn(file, [...args], {
4718
+ shell: false,
4719
+ detached: true,
4720
+ stdio: "ignore",
4721
+ windowsHide: true,
4722
+ env
4723
+ });
4724
+ child.on("error", () => void 0);
4725
+ child.unref();
4726
+ }
4727
+ function startHoldUpload(payload, env, deps = {}) {
4728
+ try {
4729
+ if ((deps.platform ?? process.platform) === "win32") return false;
4730
+ const projectDir = claudeProjectDir(env);
4731
+ if (!projectDir) return false;
4732
+ const worker = holdUploadPayload({ ...payload, cwd: projectDir });
4733
+ if (!worker) return false;
4734
+ const command = projectCaptureCommand(env, deps.readFile);
4735
+ if (!command) return false;
4736
+ (deps.spawnDetached ?? defaultSpawnDetached)(command.file, command.args, {
4737
+ ...env,
4738
+ [HOLD_WORKER_ENV]: "1",
4739
+ [HOLD_PAYLOAD_ENV]: JSON.stringify(worker)
4740
+ });
4741
+ return true;
4742
+ } catch {
4743
+ return false;
4744
+ }
4745
+ }
4746
+
4637
4747
  // src/pep/pending-decisions.ts
4638
4748
  import { randomUUID } from "crypto";
4639
- import { mkdirSync as mkdirSync4, readdirSync as readdirSync2, readFileSync as readFileSync5, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
4640
- import { dirname as dirname4, join as join7 } from "path";
4749
+ import { mkdirSync as mkdirSync4, readdirSync as readdirSync2, readFileSync as readFileSync6, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
4750
+ import { dirname as dirname4, join as join8 } from "path";
4641
4751
 
4642
4752
  // ../policy-engine/src/action-shape.ts
4643
4753
  import { createHash as createHash3 } from "crypto";
@@ -4751,14 +4861,14 @@ var realIO = {
4751
4861
  mkdir: (p, mode) => mkdirSync4(p, { recursive: true, mode }),
4752
4862
  writeFile: (p, content, mode) => writeFileSync3(p, content, { mode }),
4753
4863
  readDir: (p) => readdirSync2(p),
4754
- readFile: (p) => readFileSync5(p, "utf8"),
4864
+ readFile: (p) => readFileSync6(p, "utf8"),
4755
4865
  remove: (p) => rmSync2(p, { force: true })
4756
4866
  };
4757
4867
  function io(over) {
4758
4868
  return { ...realIO, ...over ?? {} };
4759
4869
  }
4760
4870
  function pendingDecisionsDir(snapshotPath) {
4761
- return join7(dirname4(snapshotPath), "pending-decisions");
4871
+ return join8(dirname4(snapshotPath), "pending-decisions");
4762
4872
  }
4763
4873
  function label(v) {
4764
4874
  return typeof v === "string" && v.length > 0 && v.length <= LABEL_MAX ? v : void 0;
@@ -4799,7 +4909,7 @@ function queueOfflineDecision(snapshotPath, d, opts = {}) {
4799
4909
  if (count >= PENDING_DECISIONS_CAP) return false;
4800
4910
  const item = toUploadItem(d, opts.now);
4801
4911
  const stamp = String(Date.parse(item.decided_at)).padStart(15, "0");
4802
- fs.writeFile(join7(dir, `${stamp}-${item.id}.json`), JSON.stringify(item), FILE_MODE);
4912
+ fs.writeFile(join8(dir, `${stamp}-${item.id}.json`), JSON.stringify(item), FILE_MODE);
4803
4913
  return true;
4804
4914
  } catch {
4805
4915
  return false;
@@ -4807,8 +4917,8 @@ function queueOfflineDecision(snapshotPath, d, opts = {}) {
4807
4917
  }
4808
4918
 
4809
4919
  // src/pep/trusted-env.ts
4810
- import { readdirSync as readdirSync3, readFileSync as readFileSync6, realpathSync as realpathSync3 } from "fs";
4811
- import { dirname as dirname5, isAbsolute, join as join8, resolve as resolve2 } from "path";
4920
+ import { readdirSync as readdirSync3, readFileSync as readFileSync7, realpathSync as realpathSync3 } from "fs";
4921
+ import { dirname as dirname5, isAbsolute as isAbsolute2, join as join9, resolve as resolve2 } from "path";
4812
4922
  var PROJECT_IGNORED_PEP_KEYS = [
4813
4923
  ENV_PEP_URL,
4814
4924
  ENV_PEP_HOLD_URL,
@@ -4821,11 +4931,11 @@ var PROJECT_IGNORED_PEP_KEYS = [
4821
4931
  ];
4822
4932
  function managedSettingsFiles(platform = process.platform, listDir = (dir) => readdirSync3(dir)) {
4823
4933
  const dir = platform === "darwin" ? "/Library/Application Support/ClaudeCode" : platform === "win32" ? "C:\\Program Files\\ClaudeCode" : "/etc/claude-code";
4824
- const paths = [join8(dir, "managed-settings.json")];
4934
+ const paths = [join9(dir, "managed-settings.json")];
4825
4935
  try {
4826
- const dropIns = join8(dir, "managed-settings.d");
4936
+ const dropIns = join9(dir, "managed-settings.d");
4827
4937
  for (const name of listDir(dropIns).sort()) {
4828
- if (name.endsWith(".json")) paths.push(join8(dropIns, name));
4938
+ if (name.endsWith(".json")) paths.push(join9(dropIns, name));
4829
4939
  }
4830
4940
  } catch {
4831
4941
  }
@@ -4895,7 +5005,7 @@ function localRoot(opts, committed) {
4895
5005
  const realpath = opts.realpath ?? realpathSync3.native;
4896
5006
  const dir = opts.claudeProjectDir?.trim();
4897
5007
  if (dir !== void 0 && dir !== "") {
4898
- if (!isAbsolute(dir) || setByRepo(committed, "CLAUDE_PROJECT_DIR")) return void 0;
5008
+ if (!isAbsolute2(dir) || setByRepo(committed, "CLAUDE_PROJECT_DIR")) return void 0;
4899
5009
  return safeRealpath(dir, realpath);
4900
5010
  }
4901
5011
  const first = opts.projectDirs.find((d) => d !== void 0 && d.trim() !== "");
@@ -4903,13 +5013,13 @@ function localRoot(opts, committed) {
4903
5013
  }
4904
5014
  function userSettingsFile(opts, committed) {
4905
5015
  const dir = opts.claudeConfigDir?.trim();
4906
- const trusted = dir !== void 0 && dir !== "" && isAbsolute(dir) && !setByRepo(committed, "CLAUDE_CONFIG_DIR");
4907
- return join8(trusted ? dir : join8(opts.home, ".claude"), "settings.json");
5016
+ const trusted = dir !== void 0 && dir !== "" && isAbsolute2(dir) && !setByRepo(committed, "CLAUDE_CONFIG_DIR");
5017
+ return join9(trusted ? dir : join9(opts.home, ".claude"), "settings.json");
4908
5018
  }
4909
5019
  function trustedPepEnv(env, opts) {
4910
- const read = opts.read ?? ((p) => readFileSync6(p, "utf8"));
5020
+ const read = opts.read ?? ((p) => readFileSync7(p, "utf8"));
4911
5021
  const committedPaths = committedSettingsFolders(opts).map(
4912
- (dir) => join8(dir, ".claude", "settings.json")
5022
+ (dir) => join9(dir, ".claude", "settings.json")
4913
5023
  );
4914
5024
  const committed = committedPaths.map((path) => readEnv(path, read));
4915
5025
  const anyUnparseable = committed.some((file) => file.kind === "unparseable");
@@ -4917,7 +5027,7 @@ function trustedPepEnv(env, opts) {
4917
5027
  const root = localRoot(opts, committed);
4918
5028
  const trustedFiles = [
4919
5029
  ...opts.managedPaths ?? managedSettingsFiles(),
4920
- ...root === void 0 ? [] : [join8(root, ".claude", "settings.local.json")],
5030
+ ...root === void 0 ? [] : [join9(root, ".claude", "settings.local.json")],
4921
5031
  userSettingsFile(opts, committed)
4922
5032
  ];
4923
5033
  let trusted;
@@ -4945,7 +5055,7 @@ function trustedPepEnv(env, opts) {
4945
5055
  const ownRoot = localRoot(opts, wellFormed);
4946
5056
  const files = [
4947
5057
  ...opts.managedPaths ?? managedSettingsFiles(),
4948
- ...ownRoot === void 0 ? [] : [join8(ownRoot, ".claude", "settings.local.json")],
5058
+ ...ownRoot === void 0 ? [] : [join9(ownRoot, ".claude", "settings.local.json")],
4949
5059
  userSettingsFile(opts, wellFormed)
4950
5060
  ];
4951
5061
  const own = files.map((path) => readEnv(path, read)).find((file) => file.kind === "ok" && ENV_PEP_ENFORCE in file.env);
@@ -5005,7 +5115,8 @@ var handleApproval = async (payload, verdict, ctx) => {
5005
5115
  // The same scope as the evaluate request: the server labels the held approval with it.
5006
5116
  request: buildPdpRequest(payload, ctx.cfg.scope),
5007
5117
  correlationId,
5008
- timeoutMs: PEP_HOLD_FETCH_TIMEOUT_MS
5118
+ timeoutMs: PEP_HOLD_FETCH_TIMEOUT_MS,
5119
+ ...ctx.onHeld ? { onHeld: ctx.onHeld } : {}
5009
5120
  },
5010
5121
  ctx.fetchFn
5011
5122
  );
@@ -5098,7 +5209,12 @@ async function mapVerdict(payload, response, cfg, deps) {
5098
5209
  return (deps.approve ?? handleApproval)(
5099
5210
  payload,
5100
5211
  { reason: response.reason },
5101
- { cfg, fetchFn: deps.fetchFn, extendDeadline: deps.extendDeadline }
5212
+ {
5213
+ cfg,
5214
+ fetchFn: deps.fetchFn,
5215
+ extendDeadline: deps.extendDeadline,
5216
+ ...deps.startHoldUpload ? { onHeld: () => deps.startHoldUpload?.(payload) } : {}
5217
+ }
5102
5218
  );
5103
5219
  }
5104
5220
  }
@@ -5330,7 +5446,8 @@ async function runShim(deps) {
5330
5446
  fetchFn: deps.fetchFn,
5331
5447
  snapshotIO: deps.snapshotIO,
5332
5448
  approve: deps.approve,
5333
- extendDeadline
5449
+ extendDeadline,
5450
+ ...deps.startHoldUpload ? { startHoldUpload: deps.startHoldUpload } : {}
5334
5451
  });
5335
5452
  cancelWatchdog();
5336
5453
  deps.emitter.emitVerdict(decision.decision, decision.reason);
@@ -5428,7 +5545,8 @@ if (isDirectRun()) {
5428
5545
  fetchFn: fetch,
5429
5546
  emitter,
5430
5547
  argv,
5431
- settingsScopes: { home: homedir2(), processCwd: process.cwd() }
5548
+ settingsScopes: { home: homedir2(), processCwd: process.cwd() },
5549
+ startHoldUpload: (payload) => startHoldUpload(payload, process.env)
5432
5550
  });
5433
5551
  }
5434
5552
  });
@@ -5557,12 +5675,12 @@ function outcomeOf(perCandidate, via) {
5557
5675
  via
5558
5676
  };
5559
5677
  }
5560
- function decideCursorShell(join9, cfg, deps, request) {
5561
- if (join9.kind === "handoff") {
5678
+ function decideCursorShell(join10, cfg, deps, request) {
5679
+ if (join10.kind === "handoff") {
5562
5680
  return { kind: "approval", message: "AgentTrail is waiting for approval of this command." };
5563
5681
  }
5564
- if (join9.kind === "decided") return { kind: "none" };
5565
- if (join9.liveHandoff) {
5682
+ if (join10.kind === "decided") return { kind: "none" };
5683
+ if (join10.liveHandoff) {
5566
5684
  return { kind: "approval", message: "AgentTrail is waiting for approval in this turn." };
5567
5685
  }
5568
5686
  const snapshot = readCachedSnapshot(cfg.snapshotPath, deps.snapshotIO);
@@ -5683,7 +5801,7 @@ async function answerCursor(deps, startedAtMs) {
5683
5801
  }
5684
5802
  if (event === "beforeShellExecution") {
5685
5803
  const request = normalized?.candidates[0];
5686
- const join9 = (deps.shellJoin ?? readShellJoin)(
5804
+ const join10 = (deps.shellJoin ?? readShellJoin)(
5687
5805
  joinQueryFor({
5688
5806
  home: deps.home,
5689
5807
  io: deps.io,
@@ -5697,7 +5815,7 @@ async function answerCursor(deps, startedAtMs) {
5697
5815
  })
5698
5816
  );
5699
5817
  const outcome = decideCursorShell(
5700
- join9,
5818
+ join10,
5701
5819
  cfg,
5702
5820
  deps,
5703
5821
  request === void 0 ? void 0 : { tool: request.tool, args: { ...request.args } }
@@ -5706,7 +5824,7 @@ async function answerCursor(deps, startedAtMs) {
5706
5824
  verdict: verdictOf(outcome),
5707
5825
  // This checkpoint asks no one: it answers from the queue, or from the cached rules
5708
5826
  // when the queue has nothing to say.
5709
- via: join9.kind === "miss" ? "cached-rules" : "pdp"
5827
+ via: join10.kind === "miss" ? "cached-rules" : "pdp"
5710
5828
  });
5711
5829
  }
5712
5830
  const requests = buildCursorPdpRequest(payload);