@moxxy/cli 0.5.1 → 0.5.3

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/bin.js CHANGED
@@ -92262,6 +92262,7 @@ init_dist();
92262
92262
  async function buildSession(args) {
92263
92263
  const userPolicyPath = args.config.permissions?.policyPath ?? path3.join(os5.homedir(), ".moxxy", "permissions.json");
92264
92264
  const permissionEngine = await PermissionEngine.load(userPolicyPath);
92265
+ const effectiveSessionId = args.resumeSessionId ?? args.sessionId;
92265
92266
  let restoredEvents = [];
92266
92267
  if (args.resumeSessionId) {
92267
92268
  try {
@@ -92275,6 +92276,12 @@ async function buildSession(args) {
92275
92276
  cause: err
92276
92277
  });
92277
92278
  }
92279
+ } else if (args.sessionId) {
92280
+ try {
92281
+ restoredEvents = await restoreEvents(args.sessionId);
92282
+ } catch {
92283
+ restoredEvents = [];
92284
+ }
92278
92285
  }
92279
92286
  const userPluginsDir2 = path3.join(os5.homedir(), ".moxxy", "plugins");
92280
92287
  return new Session({
@@ -92290,7 +92297,7 @@ async function buildSession(args) {
92290
92297
  pluginDiscoveryPaths: [userPluginsDir2, path3.join(userPluginsDir2, "node_modules")],
92291
92298
  ...args.isPluginDisabled ? { isPluginDisabled: args.isPluginDisabled } : {},
92292
92299
  ...args.secretResolver ? { secretResolver: args.secretResolver } : {},
92293
- ...args.resumeSessionId ? { sessionId: args.resumeSessionId } : {},
92300
+ ...effectiveSessionId ? { sessionId: effectiveSessionId } : {},
92294
92301
  // Seed restored events directly into the log so subscribers don't
92295
92302
  // re-fire side effects for historical events. New appends from this
92296
92303
  // point onward fire subscribers normally (and the persistence
@@ -118322,6 +118329,7 @@ async function setupSessionWithConfig(opts) {
118322
118329
  config,
118323
118330
  resolver: opts.resolver,
118324
118331
  resumeSessionId: opts.resumeSessionId,
118332
+ sessionId: opts.sessionId,
118325
118333
  logger,
118326
118334
  isPluginDisabled: (pkg) => disabledPackages.has(pkg),
118327
118335
  // Surface vault secrets to tool handlers as `ctx.getSecret(name)`. The
@@ -123548,9 +123556,11 @@ async function runServeStatus(except, all) {
123548
123556
  return 0;
123549
123557
  }
123550
123558
  async function runServeForeground(argv, except, all) {
123559
+ const stickySessionId = process.env["MOXXY_SESSION_ID"]?.trim();
123551
123560
  const setup = await bootSessionWithConfig(argv, {
123552
123561
  skipKeyPrompt: true,
123553
- tolerateNoProvider: true
123562
+ tolerateNoProvider: true,
123563
+ ...stickySessionId ? { sessionId: stickySessionId } : {}
123554
123564
  });
123555
123565
  const { session, vault, config, scheduler, webhooks } = setup;
123556
123566
  const setupHandle = { scheduler, webhooks };