@hachej/boring-agent 0.1.92 → 0.1.93

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.
@@ -340,6 +340,7 @@ var SAFE_SESSION_NAMESPACE = /^[a-zA-Z0-9_-]+$/;
340
340
  var SESSION_ROOT_ENV = "BORING_AGENT_SESSION_ROOT";
341
341
  var SUMMARY_PREFIX_BYTES = 64 * 1024;
342
342
  var DEFAULT_LEGACY_WORKSPACE_ID = "default";
343
+ var TRUSTED_LOCAL_USER_ID = "local";
343
344
  function sessionDirForNamespace(namespace, explicitRoot) {
344
345
  const safeNamespace = namespace.trim();
345
346
  if (!SAFE_SESSION_NAMESPACE.test(safeNamespace)) {
@@ -358,6 +359,7 @@ var PiSessionStore = class {
358
359
  cwd;
359
360
  sessionDir;
360
361
  allowLegacyUnscopedAccess;
362
+ pathDerivedLegacyAccess;
361
363
  prefixCache = /* @__PURE__ */ new Map();
362
364
  listInFlight = /* @__PURE__ */ new Map();
363
365
  writerTails = /* @__PURE__ */ new Map();
@@ -366,9 +368,11 @@ var PiSessionStore = class {
366
368
  if (typeof options === "string") {
367
369
  this.sessionDir = options;
368
370
  this.allowLegacyUnscopedAccess = true;
371
+ this.pathDerivedLegacyAccess = false;
369
372
  return;
370
373
  }
371
374
  this.allowLegacyUnscopedAccess = true;
375
+ this.pathDerivedLegacyAccess = options?.sessionDir === void 0 && options?.sessionNamespace === void 0;
372
376
  this.sessionDir = options?.sessionDir ?? (options?.sessionNamespace ? sessionDirForNamespace(options.sessionNamespace, options.sessionRoot) : defaultSessionDir(options?.storageCwd ?? cwd, options?.sessionRoot));
373
377
  }
374
378
  getSessionDir() {
@@ -713,6 +717,7 @@ var PiSessionStore = class {
713
717
  }
714
718
  throw new Error(`Session not found: ${sessionId}`);
715
719
  }
720
+ if (ctx) await this.assertFileBelongsToCtx(matchedPath, ctx, sessionId);
716
721
  return this.ensureWrapperForNativeSession(sessionId, matchedPath, ctx);
717
722
  }
718
723
  async assertFileBelongsToCtx(filepath, ctx, sessionId) {
@@ -975,8 +980,16 @@ var PiSessionStore = class {
975
980
  return header ? this.storedCtxBelongsToCtx(readHeaderSessionCtx(header), ctx) : isEmptySessionCtx(ctx);
976
981
  }
977
982
  storedCtxBelongsToCtx(storedCtx, ctx) {
978
- if (storedCtx === null) return this.allowLegacyUnscopedAccess && isLegacyUnscopedCtx(ctx);
979
- return sameSessionCtx(storedCtx, ctx);
983
+ const trustedLocalCtx = !ctx.userId || ctx.userId === TRUSTED_LOCAL_USER_ID;
984
+ if (storedCtx === null) {
985
+ return this.allowLegacyUnscopedAccess && (isLegacyUnscopedCtx(ctx) || this.pathDerivedLegacyAccess && trustedLocalCtx);
986
+ }
987
+ if (sameSessionCtx(storedCtx, ctx)) return true;
988
+ if (!this.pathDerivedLegacyAccess || !trustedLocalCtx) return false;
989
+ if (isEmptySessionCtx(storedCtx)) return true;
990
+ return Boolean(
991
+ storedCtx.workspaceId && storedCtx.workspaceId === ctx.workspaceId && (!storedCtx.userId || !ctx.userId && storedCtx.userId === TRUSTED_LOCAL_USER_ID)
992
+ );
980
993
  }
981
994
  };
982
995
  async function readJsonlPrefix(filepath, maxBytes = SUMMARY_PREFIX_BYTES) {
@@ -6,7 +6,7 @@ import {
6
6
  readConfiguredDefaultModel,
7
7
  registerConfiguredModelProviders,
8
8
  withPiHarnessDefaults
9
- } from "./chunk-IWBC6SF7.js";
9
+ } from "./chunk-2TMS2RU2.js";
10
10
  import {
11
11
  AgentEffectAdmissionError,
12
12
  createAgentRuntimeBridge,
@@ -4801,7 +4801,7 @@ function createAgentRuntimeBridge2(config, options = {}) {
4801
4801
  });
4802
4802
  }
4803
4803
  async function createRuntime(config, options) {
4804
- const harnessFactory = config.harnessFactory ?? (await import("./createHarness-PMYRKDE4.js")).createPiCodingAgentHarness;
4804
+ const harnessFactory = config.harnessFactory ?? (await import("./createHarness-UCD74XXK.js")).createPiCodingAgentHarness;
4805
4805
  const harnessInput = {
4806
4806
  tools: config.tools ?? [],
4807
4807
  cwd: config.workdir ?? DEFAULT_WORKDIR,
@@ -6957,7 +6957,7 @@ async function buildAgentComposition(input) {
6957
6957
  sessionNamespace: configuredNamespace,
6958
6958
  sessionDir: compatibility?.sessionDir ?? factoryInput.sessionDir
6959
6959
  }) : async (factoryInput) => {
6960
- const { createPiCodingAgentHarness } = await import("./createHarness-PMYRKDE4.js");
6960
+ const { createPiCodingAgentHarness } = await import("./createHarness-UCD74XXK.js");
6961
6961
  return createPiCodingAgentHarness({
6962
6962
  ...factoryInput,
6963
6963
  pi,
@@ -4,7 +4,7 @@ import {
4
4
  deriveSourcePlugin,
5
5
  mergePiPackageSources,
6
6
  withPiHarnessDefaults
7
- } from "./chunk-IWBC6SF7.js";
7
+ } from "./chunk-2TMS2RU2.js";
8
8
  import "./chunk-AQBXNPMD.js";
9
9
  import "./chunk-2GBHYJVC.js";
10
10
  export {
@@ -154,6 +154,7 @@ type SlashCommandHandlerResult = string | void | {
154
154
  preserveDraft?: boolean;
155
155
  };
156
156
  type SlashCommandHandler = (args: string, ctx: SlashCommandContext) => SlashCommandHandlerResult | Promise<SlashCommandHandlerResult>;
157
+ type SlashCommandClickBehavior = 'execute' | 'insert' | 'disabled';
157
158
  interface SlashCommand {
158
159
  name: string;
159
160
  description: string;
@@ -165,6 +166,8 @@ interface SlashCommand {
165
166
  * is needed.
166
167
  */
167
168
  kind?: 'local' | 'skill';
169
+ /** Explicit opt-in for assistant-message command links. Unset commands remain plain text. */
170
+ clickBehavior?: SlashCommandClickBehavior;
168
171
  /**
169
172
  * Origin of the command, surfaced as a tag in the slash-command picker.
170
173
  * Mirrors Pi's command sources for server commands; `local` for built-in