@byok-sdk/client 0.16.0 → 0.18.0

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.
@@ -2379,7 +2379,7 @@ function resolveLocalAgentReleaseIdentity(input) {
2379
2379
 
2380
2380
  // src/bin/official-release.ts
2381
2381
  var OFFICIAL_LOCAL_AGENT_RELEASE = resolveLocalAgentReleaseIdentity({
2382
- version: "0.16.0"
2382
+ version: "0.18.0"
2383
2383
  });
2384
2384
 
2385
2385
  // src/bin/config.ts
@@ -5875,13 +5875,13 @@ function classifyDetectError(error) {
5875
5875
  if (code === "EACCES" || code === "EPERM" || code === "ENOEXEC") return { kind: "not-executable" };
5876
5876
  return { kind: "probe-failed" };
5877
5877
  }
5878
- async function probeRuntimeVersion(command, timeoutMs) {
5878
+ async function probeRuntimeVersion(command, timeoutMs, prefixArgs = []) {
5879
5879
  if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0) throw new TypeError("invalid runtime probe timeout");
5880
5880
  return new Promise((resolve) => {
5881
5881
  let timer;
5882
5882
  let timedOut = false;
5883
5883
  try {
5884
- const child = execFile(command, ["--version"], { encoding: "utf8" }, (error, stdout, stderr) => {
5884
+ const child = execFile(command, [...prefixArgs, "--version"], { encoding: "utf8" }, (error, stdout, stderr) => {
5885
5885
  if (timer) clearTimeout(timer);
5886
5886
  if (error?.code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER") resolve({ kind: "probe-failed" });
5887
5887
  else if (timedOut) resolve({ kind: "timeout" });
@@ -6138,6 +6138,9 @@ function withoutProviderCredentials(env) {
6138
6138
  // src/adapters/pi/pi-adapter.ts
6139
6139
  var execFileAsync = promisify(execFile);
6140
6140
  var DETECT_TIMEOUT_MS = 5e3;
6141
+ function piInvocation(bin) {
6142
+ return bin.source === "package" ? { command: process.execPath, entry: bin.command } : { command: bin.command };
6143
+ }
6141
6144
  function errorMessage2(err) {
6142
6145
  return err instanceof Error ? err.message : String(err);
6143
6146
  }
@@ -6186,6 +6189,7 @@ function validatePiByokLauncherConfig(launcher) {
6186
6189
  const reserved = /* @__PURE__ */ new Set([
6187
6190
  "--",
6188
6191
  "--pi-bin",
6192
+ "--pi-entry",
6189
6193
  "--profile-db",
6190
6194
  "--session-dir",
6191
6195
  "--macos-keychain-path",
@@ -6234,7 +6238,12 @@ var PiAdapter = class {
6234
6238
  async detect() {
6235
6239
  try {
6236
6240
  const bin = this.resolveBin();
6237
- const probe = await probeRuntimeVersion(bin.command, DETECT_TIMEOUT_MS);
6241
+ const invocation = piInvocation(bin);
6242
+ const probe = await probeRuntimeVersion(
6243
+ invocation.command,
6244
+ DETECT_TIMEOUT_MS,
6245
+ invocation.entry === void 0 ? [] : [invocation.entry]
6246
+ );
6238
6247
  if (probe.kind !== "available") return probe;
6239
6248
  const version = probe.stdout.trim() || probe.stderr.trim();
6240
6249
  const authPresent = PROVIDER_CREDENTIAL_ENV_NAMES.some((name) => process.env[name] !== void 0);
@@ -6265,7 +6274,8 @@ var PiAdapter = class {
6265
6274
  requiredCapabilities: Object.freeze([...selection.providerProfile.requiredCapabilities])
6266
6275
  })
6267
6276
  }) : Object.freeze({ ...selection });
6268
- let command = bin.command;
6277
+ const invocation = piInvocation(bin);
6278
+ let command = invocation.command;
6269
6279
  let launcherArgs;
6270
6280
  if (pinnedSelection !== void 0) {
6271
6281
  if (pinnedSelection.lane !== "byok" && pinnedSelection.lane !== "byok-profile" || pinnedSelection.runtimeId !== "pi") {
@@ -6294,7 +6304,8 @@ var PiAdapter = class {
6294
6304
  launcherArgs = [
6295
6305
  ...launcher.args ?? [],
6296
6306
  "--pi-bin",
6297
- bin.command,
6307
+ invocation.command,
6308
+ ...invocation.entry === void 0 ? [] : ["--pi-entry", invocation.entry],
6298
6309
  "--profile-db",
6299
6310
  launcher.profileDbPath,
6300
6311
  "--session-dir",
@@ -6388,7 +6399,7 @@ var PiAdapter = class {
6388
6399
  ...resumeSessionId ? ["--session", resumeSessionId] : [],
6389
6400
  ...mapping.args
6390
6401
  ];
6391
- const args = launcherArgs === void 0 ? piArgs : [...launcherArgs, "--", ...piArgs];
6402
+ const args = launcherArgs === void 0 ? [...invocation.entry === void 0 ? [] : [invocation.entry], ...piArgs] : [...launcherArgs, "--", ...piArgs];
6392
6403
  let rpc;
6393
6404
  try {
6394
6405
  rpc = new PiRpcClient({
@@ -15592,6 +15603,10 @@ var TaskRunner = class {
15592
15603
  usesAgentEgress(taskId) {
15593
15604
  return this.tasks.get(taskId)?.egressEnabled === true;
15594
15605
  }
15606
+ /** Frozen offer authority for the outbound result-document lane. */
15607
+ selectsResultDocument(taskId) {
15608
+ return this.tasks.get(taskId)?.terminalProjection?.mode === "result-document";
15609
+ }
15595
15610
  /** M5 batch-3 (workstream 2): effective `maxTaskOutputBytes` cap for this daemon — see {@link DEFAULT_MAX_TASK_OUTPUT_BYTES}'s own doc comment. */
15596
15611
  get maxTaskOutputBytes() {
15597
15612
  return this.deps.maxTaskOutputBytes ?? DEFAULT_MAX_TASK_OUTPUT_BYTES;
@@ -18695,7 +18710,7 @@ function cloneJson(value) {
18695
18710
  function asRecord(value) {
18696
18711
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
18697
18712
  }
18698
- function contentlessPayload(envelope) {
18713
+ function contentlessPayload(envelope, resultDocumentSelected) {
18699
18714
  const payload = cloneJson(envelope.payload);
18700
18715
  const record4 = asRecord(payload);
18701
18716
  if (!record4) return payload;
@@ -18709,7 +18724,7 @@ function contentlessPayload(envelope) {
18709
18724
  }
18710
18725
  case "task.complete":
18711
18726
  if (typeof record4.summary === "string") record4.summary = "[content omitted]";
18712
- delete record4.document;
18727
+ if (!resultDocumentSelected) delete record4.document;
18713
18728
  return record4;
18714
18729
  case "task.fail":
18715
18730
  case "task.decline":
@@ -18740,7 +18755,7 @@ function applyHostSanitizer(value, sanitizer, context) {
18740
18755
  }
18741
18756
  function sanitizeEgressEnvelope(envelope, policy, sanitizer, context = {}) {
18742
18757
  try {
18743
- const payload = policy.activity.mode === "metadata-status" ? contentlessPayload(envelope) : cloneJson(envelope.payload);
18758
+ const payload = policy.activity.mode === "metadata-status" ? contentlessPayload(envelope, context.resultDocumentSelected === true) : cloneJson(envelope.payload);
18744
18759
  if (payload === void 0) return { ok: false, reason: "policy_denied" };
18745
18760
  const sanitizedPayload = applyHostSanitizer(payload, sanitizer, {
18746
18761
  lane: context.lane ?? "latest-value",
@@ -20640,7 +20655,9 @@ function buildDaemonWithAdapters(config, adapters, overrides = {}, assertionProb
20640
20655
  sendSanitizedEnvelope(candidate);
20641
20656
  return;
20642
20657
  }
20643
- const sanitized = sanitizeEgressEnvelope(candidate, egressPolicy, config.agentEgress?.sanitizer);
20658
+ const sanitized = sanitizeEgressEnvelope(candidate, egressPolicy, config.agentEgress?.sanitizer, {
20659
+ resultDocumentSelected: runner.selectsResultDocument(candidate.task_id)
20660
+ });
20644
20661
  if (!sanitized.ok) {
20645
20662
  agentEgress.noteTransportDrop(sanitized.reason);
20646
20663
  return;