poe-code 3.0.351 → 3.0.352

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
@@ -93655,6 +93655,7 @@ var init_decimal_integer = __esm({
93655
93655
 
93656
93656
  // src/cli/commands/spawn.ts
93657
93657
  import path145 from "node:path";
93658
+ import { randomUUID as randomUUID39 } from "node:crypto";
93658
93659
  import { Option as Option3 } from "commander";
93659
93660
  function registerSpawnCommand(program, container, options = {}) {
93660
93661
  const spawnServices = container.registry.list().filter((service) => typeof service.spawn === "function" || getSpawnConfig(service.name));
@@ -93861,6 +93862,7 @@ function registerSpawnCommand(program, container, options = {}) {
93861
93862
  mcpServers
93862
93863
  );
93863
93864
  if (flags.dryRun) {
93865
+ validateDryRunBridgeResources(canonicalService, container, spawnOptions);
93864
93866
  await spawnCore(container, canonicalService, spawnOptions, {
93865
93867
  dryRun: true,
93866
93868
  verbose: flags.verbose
@@ -94251,6 +94253,45 @@ function resolveHookOptions(from, strategy, scope, command) {
94251
94253
  ...scope ? { scope } : {}
94252
94254
  };
94253
94255
  }
94256
+ function validateDryRunBridgeResources(service, container, options) {
94257
+ if ((options.skills === void 0 || options.skills.length === 0) && options.hooks === void 0) {
94258
+ return;
94259
+ }
94260
+ const runId = randomUUID39();
94261
+ let skillsManifest;
94262
+ let hooksManifest;
94263
+ try {
94264
+ if (options.skills !== void 0 && options.skills.length > 0) {
94265
+ skillsManifest = bridgeActiveSkills(
94266
+ service,
94267
+ options.cwd ?? container.env.cwd,
94268
+ options.skills,
94269
+ container.env.homeDir,
94270
+ runId
94271
+ );
94272
+ }
94273
+ if (options.hooks !== void 0) {
94274
+ hooksManifest = bridgeHooks(
94275
+ options.hooks.from,
94276
+ service,
94277
+ options.cwd ?? container.env.cwd,
94278
+ container.env.homeDir,
94279
+ runId,
94280
+ {
94281
+ strategy: options.hooks.strategy === "auto" ? void 0 : options.hooks.strategy,
94282
+ ...options.hooks.scope !== void 0 ? { scope: options.hooks.scope } : {}
94283
+ }
94284
+ );
94285
+ }
94286
+ } finally {
94287
+ if (hooksManifest !== void 0) {
94288
+ cleanupBridgedHooks(hooksManifest);
94289
+ }
94290
+ if (skillsManifest !== void 0) {
94291
+ cleanupBridgedSkills(skillsManifest);
94292
+ }
94293
+ }
94294
+ }
94254
94295
  function assertSpawnSupport(label, service, providerSupportsSpawn) {
94255
94296
  if (providerSupportsSpawn) {
94256
94297
  return;
@@ -94282,6 +94323,8 @@ var init_spawn6 = __esm({
94282
94323
  "use strict";
94283
94324
  init_src17();
94284
94325
  init_src7();
94326
+ init_src14();
94327
+ init_src15();
94285
94328
  init_src2();
94286
94329
  init_config5();
94287
94330
  init_shared();
@@ -95792,7 +95835,7 @@ var init_test = __esm({
95792
95835
  });
95793
95836
 
95794
95837
  // src/services/media-download.ts
95795
- import { randomUUID as randomUUID39 } from "node:crypto";
95838
+ import { randomUUID as randomUUID40 } from "node:crypto";
95796
95839
  async function downloadToFile(options) {
95797
95840
  const fetcher = options.fetcher ?? globalThis.fetch;
95798
95841
  if (!fetcher) {
@@ -95823,7 +95866,7 @@ async function downloadToFile(options) {
95823
95866
  outputPath: options.outputPath
95824
95867
  });
95825
95868
  }
95826
- const temporaryPath = `${options.outputPath}.${process.pid}.${randomUUID39()}.tmp`;
95869
+ const temporaryPath = `${options.outputPath}.${process.pid}.${randomUUID40()}.tmp`;
95827
95870
  let temporaryCreated = false;
95828
95871
  try {
95829
95872
  await options.fs.writeFile(temporaryPath, buffer, { flag: "wx" });
@@ -98253,7 +98296,7 @@ var init_dashboard_loop_shared = __esm({
98253
98296
  });
98254
98297
 
98255
98298
  // src/cli/commands/pipeline.ts
98256
- import { randomUUID as randomUUID40 } from "node:crypto";
98299
+ import { randomUUID as randomUUID41 } from "node:crypto";
98257
98300
  import path148 from "node:path";
98258
98301
  import { readFile as readFile39, stat as stat24 } from "node:fs/promises";
98259
98302
  import { fileURLToPath as fileURLToPath10 } from "node:url";
@@ -98828,7 +98871,7 @@ async function writePipelineTextFile(fs29, filePath, content, options) {
98828
98871
  }
98829
98872
  return;
98830
98873
  }
98831
- const temporaryPath = `${filePath}.${process.pid}.${randomUUID40()}.tmp`;
98874
+ const temporaryPath = `${filePath}.${process.pid}.${randomUUID41()}.tmp`;
98832
98875
  let temporaryCreated = false;
98833
98876
  try {
98834
98877
  await fs29.writeFile(temporaryPath, content, { encoding: "utf8", flag: "wx" });
@@ -99433,7 +99476,7 @@ var init_pipeline5 = __esm({
99433
99476
  });
99434
99477
 
99435
99478
  // src/cli/commands/ralph.ts
99436
- import { randomUUID as randomUUID41 } from "node:crypto";
99479
+ import { randomUUID as randomUUID42 } from "node:crypto";
99437
99480
  import path149 from "node:path";
99438
99481
  function formatRalphAgentSummary(agent3) {
99439
99482
  return Array.isArray(agent3) ? agent3.join(", ") : agent3;
@@ -99678,7 +99721,7 @@ async function writeTextFileAtomically(fs29, filePath, content, options) {
99678
99721
  await fs29.writeFile(filePath, content, { encoding: "utf8" });
99679
99722
  return;
99680
99723
  }
99681
- const temporaryPath = `${filePath}.${process.pid}.${randomUUID41()}.tmp`;
99724
+ const temporaryPath = `${filePath}.${process.pid}.${randomUUID42()}.tmp`;
99682
99725
  let temporaryCreated = false;
99683
99726
  try {
99684
99727
  await fs29.writeFile(temporaryPath, content, { encoding: "utf8", flag: "wx" });
@@ -101032,6 +101075,7 @@ function registerLaunchCommand(program, container) {
101032
101075
  const flags = resolveCommandFlags(program);
101033
101076
  const resources = createExecutionResources(container, flags, `launch:stop:${id}`);
101034
101077
  if (flags.dryRun) {
101078
+ await validateManagedProcessExists(container, id);
101035
101079
  resources.logger.dryRun(`Dry run: would stop managed process ${id}.`);
101036
101080
  return;
101037
101081
  }
@@ -101048,6 +101092,7 @@ function registerLaunchCommand(program, container) {
101048
101092
  const flags = resolveCommandFlags(program);
101049
101093
  const resources = createExecutionResources(container, flags, `launch:restart:${id}`);
101050
101094
  if (flags.dryRun) {
101095
+ await validateManagedProcessExists(container, id);
101051
101096
  resources.logger.dryRun(`Dry run: would restart managed process ${id}.`);
101052
101097
  return;
101053
101098
  }
@@ -101337,6 +101382,15 @@ function formatReadinessWait(readyCheck) {
101337
101382
  }
101338
101383
  return `waiting for TCP port ${readyCheck.port}`;
101339
101384
  }
101385
+ async function validateManagedProcessExists(container, id) {
101386
+ const records = await listLaunches({ homeDir: container.env.homeDir });
101387
+ if (!records.some((record) => getManagedProcessId(record) === id)) {
101388
+ throw new ValidationError(`Managed process not found: ${id}`);
101389
+ }
101390
+ }
101391
+ function getManagedProcessId(record) {
101392
+ return record.spec?.id ?? record.state?.id ?? record.id;
101393
+ }
101340
101394
  function formatManagedProcessStatus(record, fallbackId) {
101341
101395
  const id = record.spec?.id ?? record.state?.id ?? fallbackId;
101342
101396
  if (record.state?.status) {
@@ -102079,10 +102133,10 @@ var init_status = __esm({
102079
102133
  });
102080
102134
 
102081
102135
  // packages/memory/src/atomic-write.ts
102082
- import { randomUUID as randomUUID42 } from "node:crypto";
102136
+ import { randomUUID as randomUUID43 } from "node:crypto";
102083
102137
  import * as fs18 from "node:fs/promises";
102084
102138
  async function writeFileAtomically7(filePath, content) {
102085
- const tempPath = `${filePath}.${process.pid}.${randomUUID42()}.tmp`;
102139
+ const tempPath = `${filePath}.${process.pid}.${randomUUID43()}.tmp`;
102086
102140
  let tempCreated = false;
102087
102141
  try {
102088
102142
  await fs18.writeFile(tempPath, content, { encoding: "utf8", flag: "wx" });
@@ -102492,7 +102546,7 @@ var init_reconcile2 = __esm({
102492
102546
  });
102493
102547
 
102494
102548
  // packages/memory/src/write.ts
102495
- import { randomUUID as randomUUID43 } from "node:crypto";
102549
+ import { randomUUID as randomUUID44 } from "node:crypto";
102496
102550
  import * as fs20 from "node:fs/promises";
102497
102551
  import path158 from "node:path";
102498
102552
  async function writePage(root, relPath, body, opts) {
@@ -102545,8 +102599,8 @@ function parseAppendTarget(originalPage, relPath) {
102545
102599
  }
102546
102600
  async function clearMemory(root) {
102547
102601
  await assertMemoryRootIsNotSymlink(root);
102548
- const stagedRoot = `${root}.clear-${randomUUID43()}`;
102549
- const backupRoot = `${root}.backup-${randomUUID43()}`;
102602
+ const stagedRoot = `${root}.clear-${randomUUID44()}`;
102603
+ const backupRoot = `${root}.backup-${randomUUID44()}`;
102550
102604
  let originalMoved = false;
102551
102605
  try {
102552
102606
  await initMemory(stagedRoot);
@@ -104945,11 +104999,11 @@ async function executeRuntimeBuild(program, container, options) {
104945
104999
  resources.logger.info(`Docker runtime uses pinned image ${runtimeConfig.image}.`);
104946
105000
  return;
104947
105001
  }
105002
+ await requireRuntimeBuildPaths(container, runtimeConfig, "Docker");
104948
105003
  if (flags.dryRun) {
104949
105004
  resources.logger.dryRun("Dry run: would build docker runtime template.");
104950
105005
  return;
104951
105006
  }
104952
- await requireRuntimeBuildPaths(container, runtimeConfig, "Docker");
104953
105007
  const result = await buildDockerRuntimeTemplate({
104954
105008
  cwd: container.env.cwd,
104955
105009
  runtime: runtimeConfig,
@@ -105388,6 +105442,7 @@ async function executeRuntimeJobsAttach(root, container, jobId, options) {
105388
105442
  const resources = createExecutionResources(container, flags, "runtime:jobs:attach");
105389
105443
  const state = createRuntimeState(container);
105390
105444
  const entry = await resolveJob(state, jobId, "running");
105445
+ const since = parseSince(options.since);
105391
105446
  if (flags.dryRun) {
105392
105447
  const syncDetail = options.syncOnExit === true ? " and sync its workspace on exit" : "";
105393
105448
  resources.logger.dryRun(`Dry run: would attach to runtime job ${entry.id}${syncDetail}.`);
@@ -105398,7 +105453,7 @@ async function executeRuntimeJobsAttach(root, container, jobId, options) {
105398
105453
  resources.logger.info(line);
105399
105454
  });
105400
105455
  await streamJobLog(handle, {
105401
- since: parseSince(options.since),
105456
+ since,
105402
105457
  follow: true,
105403
105458
  write(chunk) {
105404
105459
  logWriter.write(chunk);
@@ -105432,6 +105487,7 @@ async function executeRuntimeJobsLogs(root, container, jobId, options) {
105432
105487
  const resources = createExecutionResources(container, flags, "runtime:jobs:logs");
105433
105488
  const state = createRuntimeState(container);
105434
105489
  const entry = await resolveJob(state, jobId, "pullable");
105490
+ const since = parseSince(options.since);
105435
105491
  if (flags.dryRun) {
105436
105492
  resources.logger.dryRun(`Dry run: would read logs for runtime job ${entry.id}.`);
105437
105493
  return;
@@ -105441,7 +105497,7 @@ async function executeRuntimeJobsLogs(root, container, jobId, options) {
105441
105497
  resources.logger.info(line);
105442
105498
  });
105443
105499
  await streamJobLog(handle, {
105444
- since: parseSince(options.since),
105500
+ since,
105445
105501
  follow: false,
105446
105502
  write(chunk) {
105447
105503
  logWriter.write(chunk);
@@ -105532,13 +105588,13 @@ function registerRuntimeJobsSandboxCommand(jobs, root, container) {
105532
105588
  jobs.command("sandbox").description("Open a shell in a runtime sandbox.").argument("<envId>", "Runtime sandbox id").option("--runtime <runtime>", "Runtime backend for the sandbox", "docker").action(async (envId, options) => {
105533
105589
  const flags = resolveCommandFlags(root);
105534
105590
  const resources = createExecutionResources(container, flags, "runtime:jobs:sandbox");
105591
+ const factory = selectExecutionEnvFactory(options.runtime);
105535
105592
  if (flags.dryRun) {
105536
105593
  resources.logger.dryRun(
105537
105594
  `Dry run: would open a shell in ${options.runtime} runtime sandbox ${envId}.`
105538
105595
  );
105539
105596
  return;
105540
105597
  }
105541
- const factory = selectExecutionEnvFactory(options.runtime);
105542
105598
  const job = (await createRuntimeState(container).jobs.list()).filter((entry) => entry.env_id === envId && entry.env_kind === options.runtime).sort((left, right) => Date.parse(right.started_at) - Date.parse(left.started_at))[0];
105543
105599
  const env = await factory.attach(
105544
105600
  envId,
@@ -125653,7 +125709,7 @@ var init_policy = __esm({
125653
125709
  });
125654
125710
 
125655
125711
  // packages/safejs/src/interp/host-call.ts
125656
- import { createHash as createHash10, randomUUID as randomUUID44 } from "node:crypto";
125712
+ import { createHash as createHash10, randomUUID as randomUUID45 } from "node:crypto";
125657
125713
  function validateRestoredRecords(records, runId, sourceHash) {
125658
125714
  const ids = /* @__PURE__ */ new Set();
125659
125715
  let previousOrdinal = 0;
@@ -125767,7 +125823,7 @@ var init_host_call = __esm({
125767
125823
  constructor(sourceHash, records = [], resumeProvider) {
125768
125824
  this.sourceHash = sourceHash;
125769
125825
  this.resumeProvider = resumeProvider;
125770
- this.runId = records[0]?.runId ?? randomUUID44();
125826
+ this.runId = records[0]?.runId ?? randomUUID45();
125771
125827
  this.records = records.map((record) => structuredClone(record));
125772
125828
  validateRestoredRecords(this.records, this.runId, sourceHash);
125773
125829
  this.restored = [...this.records];
@@ -133454,7 +133510,7 @@ var init_error_codes21 = __esm({
133454
133510
  });
133455
133511
 
133456
133512
  // packages/safejs/src/snapshot/backend.ts
133457
- import { randomUUID as randomUUID45 } from "node:crypto";
133513
+ import { randomUUID as randomUUID46 } from "node:crypto";
133458
133514
  import { readFile as readFile52, rename as rename27, stat as stat31, unlink as unlink24, writeFile as writeFile28 } from "node:fs/promises";
133459
133515
  import { dirname as dirname10 } from "node:path";
133460
133516
  async function writeSnapshotAtomically(snapshotPath, snapshot2, options) {
@@ -133463,7 +133519,7 @@ async function writeSnapshotAtomically(snapshotPath, snapshot2, options) {
133463
133519
  await assertParentDirectoryExists(snapshotPath, parentPath);
133464
133520
  for (let attempt = 1; attempt <= options.maxAttempts; attempt += 1) {
133465
133521
  try {
133466
- const temporaryPath = `${snapshotPath}.${randomUUID45()}.tmp`;
133522
+ const temporaryPath = `${snapshotPath}.${randomUUID46()}.tmp`;
133467
133523
  await writeSnapshotOnce(temporaryPath, snapshotPath, contents);
133468
133524
  return;
133469
133525
  } catch (error3) {
@@ -136058,7 +136114,7 @@ var init_extract_schema = __esm({
136058
136114
  });
136059
136115
 
136060
136116
  // packages/agent-harness/src/codegen/emit-schemas.ts
136061
- import { randomUUID as randomUUID46 } from "node:crypto";
136117
+ import { randomUUID as randomUUID47 } from "node:crypto";
136062
136118
  import * as nodeFs21 from "node:fs/promises";
136063
136119
  import path171 from "node:path";
136064
136120
  import { fileURLToPath as fileURLToPath13 } from "node:url";
@@ -136218,7 +136274,7 @@ var init_validate4 = __esm({
136218
136274
  });
136219
136275
 
136220
136276
  // packages/agent-harness/src/loader/run.ts
136221
- import { createHash as createHash11, randomUUID as randomUUID47 } from "node:crypto";
136277
+ import { createHash as createHash11, randomUUID as randomUUID48 } from "node:crypto";
136222
136278
  import { lstat as lstat34, mkdir as mkdir37, readFile as readFile55, rename as rename28, unlink as unlink25, writeFile as writeFile29 } from "node:fs/promises";
136223
136279
  import os22 from "node:os";
136224
136280
  import { dirname as dirname13, join as join14, parse as parse14, resolve as resolve10, sep as sep7 } from "node:path";
@@ -136580,7 +136636,7 @@ async function writeHostCallRecords(storePath, records) {
136580
136636
  await writeTextFileAtomically2(storePath, serialized);
136581
136637
  }
136582
136638
  async function writeTextFileAtomically2(filePath, content) {
136583
- const temporaryPath = `${filePath}.${process.pid}.${randomUUID47()}.tmp`;
136639
+ const temporaryPath = `${filePath}.${process.pid}.${randomUUID48()}.tmp`;
136584
136640
  let temporaryCreated = false;
136585
136641
  try {
136586
136642
  await writeFile29(temporaryPath, content, { encoding: "utf8", flag: "wx" });
@@ -136837,6 +136893,7 @@ async function executeHarnessRun(program, container, mdPath, options) {
136837
136893
  const resources = createExecutionResources(container, flags, "harness:run");
136838
136894
  const selectedPath = mdPath ? path172.resolve(container.env.cwd, mdPath) : (await resolveDiscoveredHarness(container, flags.assumeYes)).mdPath;
136839
136895
  if (flags.dryRun) {
136896
+ await resolvePair(selectedPath, container.fs);
136840
136897
  resources.logger.dryRun(
136841
136898
  `Dry run: would run ${formatDisplayPath3(container, selectedPath)} without executing its script or applying fixes.`
136842
136899
  );
@@ -138621,7 +138678,7 @@ var init_package2 = __esm({
138621
138678
  "package.json"() {
138622
138679
  package_default2 = {
138623
138680
  name: "poe-code",
138624
- version: "3.0.351",
138681
+ version: "3.0.352",
138625
138682
  description: "CLI tool to configure Poe API for developer workflows.",
138626
138683
  type: "module",
138627
138684
  main: "./dist/index.js",