perstack 0.0.137 → 0.0.139

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/cli.js CHANGED
@@ -16368,7 +16368,7 @@ const EMPTY_COMPLETION_RESULT = { completion: {
16368
16368
  //#endregion
16369
16369
  //#region ../base/package.json
16370
16370
  var name$5 = "@perstack/base";
16371
- var version$2 = "0.0.81";
16371
+ var version$2 = "0.0.83";
16372
16372
  //#endregion
16373
16373
  //#region ../base/src/tools/todo.ts
16374
16374
  var Todo = class {
@@ -16546,11 +16546,21 @@ const execFileAsync = promisify(execFile);
16546
16546
  function isExecError(error) {
16547
16547
  return error instanceof Error && "code" in error;
16548
16548
  }
16549
+ async function resolveCwd(cwd) {
16550
+ try {
16551
+ return await validatePath(cwd);
16552
+ } catch {
16553
+ return workspacePath;
16554
+ }
16555
+ }
16549
16556
  async function exec$2(input) {
16550
- const validatedCwd = await validatePath(input.cwd);
16557
+ const resolvedCwd = await resolveCwd(input.cwd);
16551
16558
  const { stdout, stderr } = await execFileAsync(input.command, input.args, {
16552
- cwd: validatedCwd,
16553
- env: getFilteredEnv(input.env),
16559
+ cwd: resolvedCwd,
16560
+ env: {
16561
+ ...process.env,
16562
+ ...input.env
16563
+ },
16554
16564
  timeout: input.timeout,
16555
16565
  maxBuffer: 10 * 1024 * 1024
16556
16566
  });
@@ -19306,13 +19316,16 @@ var InMemoryBaseSkillAdapter = class extends SkillAdapter {
19306
19316
  throw new Error("Skill management not initialized");
19307
19317
  }
19308
19318
  };
19319
+ _env;
19309
19320
  constructor(skill, onLifecycleEvent, options) {
19310
19321
  super(onLifecycleEvent);
19311
19322
  this.skill = skill;
19312
19323
  this._transportFactory = options?.transportFactory ?? defaultTransportFactory;
19324
+ this._env = options?.env ?? {};
19313
19325
  }
19314
19326
  async _doConnect() {
19315
19327
  this._spawnDurationMs = 0;
19328
+ for (const [key, value] of Object.entries(this._env)) if (value && !process.env[key]) process.env[key] = value;
19316
19329
  const [clientTransport, serverTransport] = this._transportFactory.createInMemoryPair();
19317
19330
  this._mcpServer = createBaseServer({ skillManagement: this._skillManagement });
19318
19331
  await this._mcpServer.connect(serverTransport);
@@ -19689,7 +19702,10 @@ var DefaultSkillAdapterFactory = class {
19689
19702
  return new McpSkillAdapter(skill, ctx.env, ctx.onLifecycleEvent, { transportFactory: ctx.transportFactory });
19690
19703
  }
19691
19704
  createInMemoryBase(skill, ctx) {
19692
- return new InMemoryBaseSkillAdapter(skill, ctx.onLifecycleEvent, { transportFactory: ctx.transportFactory });
19705
+ return new InMemoryBaseSkillAdapter(skill, ctx.onLifecycleEvent, {
19706
+ transportFactory: ctx.transportFactory,
19707
+ env: ctx.env
19708
+ });
19693
19709
  }
19694
19710
  createInteractive(skill, ctx) {
19695
19711
  return new InteractiveSkillAdapter(skill, ctx.onLifecycleEvent);
@@ -19796,7 +19812,6 @@ var SkillManager = class SkillManager {
19796
19812
  const baseSkill = skills["@perstack/base"];
19797
19813
  const useBundledBase = (baseSkill.type === "mcpStdioSkill" || baseSkill.type === "mcpSseSkill") && shouldUseBundledBase(baseSkill, perstackBaseSkillCommand);
19798
19814
  if (useBundledBase && baseSkill.type === "mcpStdioSkill") {
19799
- if (baseSkill.requiredEnv.length > 0) console.warn(`[perstack] requiredEnv is ignored for bundled @perstack/base. Pin a version to enable it.`);
19800
19815
  const baseAdapter = factory.createInMemoryBase(baseSkill, factoryCtx);
19801
19816
  allAdapters.push(baseAdapter);
19802
19817
  await connectAdaptersWithCleanup([baseAdapter], allAdapters);
@@ -21457,7 +21472,7 @@ async function expertVersionsHandler(scopeName, options) {
21457
21472
  }
21458
21473
  //#endregion
21459
21474
  //#region ../../packages/runtime/package.json
21460
- var version$1 = "0.0.144";
21475
+ var version$1 = "0.0.147";
21461
21476
  //#endregion
21462
21477
  //#region ../../packages/runtime/src/helpers/usage.ts
21463
21478
  function createEmptyUsage() {
@@ -93737,7 +93752,7 @@ var import_dist = (/* @__PURE__ */ __commonJSMin(((exports) => {
93737
93752
  })))();
93738
93753
  function getEnvironmentSection() {
93739
93754
  const lines = [`- Platform: ${os.platform()} ${os.release()} (${os.arch()})`];
93740
- if (process.env.PERSTACK_SANDBOX === "1") lines.push("- Sandbox: This is an isolated container environment (Ubuntu). You can freely install packages with `sudo apt-get install` and run arbitrary commands without affecting the host system.");
93755
+ if (process.env.PERSTACK_SANDBOX === "1") lines.push("- Sandbox: This is an isolated container environment (Ubuntu). You can freely install packages with `apt-get install` and run arbitrary commands without affecting the host system.");
93741
93756
  return `Environment:\n${lines.join("\n")}`;
93742
93757
  }
93743
93758
  function getDelegateMetaInstruction() {
@@ -121406,6 +121421,7 @@ function useRun() {
121406
121421
  const [streaming, setStreaming] = (0, import_react.useState)({ runs: {} });
121407
121422
  const [eventCount, setEventCount] = (0, import_react.useState)(0);
121408
121423
  const [isComplete, setIsComplete] = (0, import_react.useState)(false);
121424
+ const [activeRootRunId, setActiveRootRunId] = (0, import_react.useState)(null);
121409
121425
  const stateRef = (0, import_react.useRef)(createInitialActivityProcessState());
121410
121426
  const clearStreaming = (0, import_react.useCallback)(() => {
121411
121427
  setStreaming({ runs: {} });
@@ -121425,6 +121441,11 @@ function useRun() {
121425
121441
  processRunEventToActivity(stateRef.current, event, addActivity);
121426
121442
  if (newActivities.length > 0) setActivities((prev) => [...prev, ...newActivities]);
121427
121443
  setIsComplete(Array.from(stateRef.current.runStates.values()).some((rs) => rs.isComplete && !rs.delegatedBy));
121444
+ if ("type" in event && event.type === "startRun" && "runId" in event) {
121445
+ const startRunId = event.runId;
121446
+ const runState = stateRef.current.runStates.get(startRunId);
121447
+ if (runState && !runState.delegatedBy) setActiveRootRunId(startRunId);
121448
+ }
121428
121449
  }, []);
121429
121450
  const clearRunStreaming = (0, import_react.useCallback)((runId) => {
121430
121451
  setStreaming((prev) => {
@@ -121436,6 +121457,7 @@ function useRun() {
121436
121457
  activities,
121437
121458
  streaming,
121438
121459
  isComplete,
121460
+ activeRootRunId,
121439
121461
  eventCount,
121440
121462
  addEvent: (0, import_react.useCallback)((event) => {
121441
121463
  if (isStreamingEvent(event)) {
@@ -125766,7 +125788,7 @@ async function startHandler(expertKey, query, options, handlerOptions) {
125766
125788
  //#endregion
125767
125789
  //#region package.json
125768
125790
  var name = "perstack";
125769
- var version = "0.0.137";
125791
+ var version = "0.0.139";
125770
125792
  var description = "PerStack CLI";
125771
125793
  //#endregion
125772
125794
  //#region bin/cli.ts