@gorlitzer-labs/apiary 1.13.5 → 1.13.7

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/cli/index.js CHANGED
@@ -769,9 +769,9 @@ async function runClaude(options) {
769
769
  });
770
770
  process.stderr.write(`MCP server: ${setup2.mcpServer.url}
771
771
  `);
772
- await new Promise((resolve3) => {
773
- process.on("SIGINT", resolve3);
774
- process.on("SIGTERM", resolve3);
772
+ await new Promise((resolve4) => {
773
+ process.on("SIGINT", resolve4);
774
+ process.on("SIGTERM", resolve4);
775
775
  });
776
776
  await setup2.cleanup();
777
777
  await eventLoopPromise2;
@@ -916,9 +916,9 @@ async function runClaude(options) {
916
916
  const noop = (() => true);
917
917
  process.stdout.write = noop;
918
918
  process.stderr.write = noop;
919
- await new Promise((resolve3) => {
920
- process.on("SIGTERM", resolve3);
921
- process.on("SIGINT", resolve3);
919
+ await new Promise((resolve4) => {
920
+ process.on("SIGTERM", resolve4);
921
+ process.on("SIGINT", resolve4);
922
922
  });
923
923
  clearInterval(activityTimer);
924
924
  clearInterval(metricsTimer);
@@ -948,9 +948,9 @@ async function runClaude(options) {
948
948
  const noop = (() => true);
949
949
  process.stdout.write = noop;
950
950
  process.stderr.write = noop;
951
- await new Promise((resolve3) => {
952
- process.on("SIGINT", resolve3);
953
- process.on("SIGTERM", resolve3);
951
+ await new Promise((resolve4) => {
952
+ process.on("SIGINT", resolve4);
953
+ process.on("SIGTERM", resolve4);
954
954
  });
955
955
  }
956
956
  clearInterval(activityTimer);
@@ -1181,12 +1181,12 @@ async function runOpencode(options) {
1181
1181
  OpenCode agent running.`);
1182
1182
  console.log(` To watch: opencode attach ${opencodeUrl}
1183
1183
  `);
1184
- const exitPromise = new Promise((resolve3) => {
1185
- child.on("exit", resolve3);
1184
+ const exitPromise = new Promise((resolve4) => {
1185
+ child.on("exit", resolve4);
1186
1186
  });
1187
- const signalPromise = new Promise((resolve3) => {
1187
+ const signalPromise = new Promise((resolve4) => {
1188
1188
  const handler = () => {
1189
- resolve3();
1189
+ resolve4();
1190
1190
  };
1191
1191
  process.on("SIGINT", handler);
1192
1192
  process.on("SIGTERM", handler);
@@ -1369,7 +1369,11 @@ var BLOCKED_PATTERNS = [
1369
1369
  // `[\s\S]` not `.`: the screen renders these on separate lines, and `.`
1370
1370
  // does not cross a newline, so the original pattern never matched.
1371
1371
  /You are running Codex in [\s\S]+Do you want to allow/,
1372
- "Do you trust the files in this folder"
1372
+ "Do you trust the files in this folder",
1373
+ // Codex 0.156 reworded the trust prompt; the old string above no longer appears.
1374
+ "Trust this folder?",
1375
+ // The startup update menu ("Update now / Skip") sits in front of the composer too.
1376
+ /Update available[\s\S]+Update now/
1373
1377
  ];
1374
1378
  var STREAMING_PATTERNS = [
1375
1379
  /Working\s*\(\d+[smh]/,
@@ -1657,8 +1661,8 @@ function extractCodexActivityLabel(lines) {
1657
1661
  }
1658
1662
 
1659
1663
  // src/cli/codex/launch.ts
1660
- import { existsSync as existsSync5, mkdirSync as mkdirSync2, readdirSync as readdirSync4, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
1661
- import { join as join6 } from "path";
1664
+ import { existsSync as existsSync5, mkdirSync as mkdirSync2, readdirSync as readdirSync4, realpathSync as realpathSync2, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
1665
+ import { join as join6, resolve as resolve2 } from "path";
1662
1666
  import { homedir as homedir5 } from "os";
1663
1667
  var STARTUP_TIMEOUT_SEC = 15;
1664
1668
  var TOOL_TIMEOUT_SEC = 60;
@@ -1679,7 +1683,7 @@ function codexProfileName(agentName) {
1679
1683
  function tomlString(value) {
1680
1684
  return JSON.stringify(value);
1681
1685
  }
1682
- function renderCodexProfile(mcpUrl, approvalMode = codexToolApprovalMode(), unattended = wantsUnattendedAgents()) {
1686
+ function renderCodexProfile(mcpUrl, approvalMode = codexToolApprovalMode(), unattended = wantsUnattendedAgents(), trustDirs = []) {
1683
1687
  const blocks = [
1684
1688
  // Top-level keys must precede every table header, or TOML parses them as
1685
1689
  // members of the last table.
@@ -1689,7 +1693,9 @@ function renderCodexProfile(mcpUrl, approvalMode = codexToolApprovalMode(), unat
1689
1693
  "# No approval prompts: nobody is watching this pane, so a prompt is a",
1690
1694
  "# permanent stall. Commands still run inside Codex's sandbox \u2014 anything",
1691
1695
  "# it will not allow returns a failure to the model instead of asking.",
1692
- 'approval_policy = "never"'
1696
+ 'approval_policy = "never"',
1697
+ "# The update prompt is a menu in front of the composer: another stall.",
1698
+ "check_for_update_on_startup = false"
1693
1699
  ].join("\n")] : [],
1694
1700
  [
1695
1701
  ...unattended ? [] : ["# Written by apiary. Layered over your own config; deleted when the agent stops."],
@@ -1701,17 +1707,21 @@ function renderCodexProfile(mcpUrl, approvalMode = codexToolApprovalMode(), unat
1701
1707
  ...RUNTIME_TOOL_NAMES.map((tool) => [
1702
1708
  `[mcp_servers.apiary.tools.${tool}]`,
1703
1709
  `approval_mode = ${tomlString(approvalMode)}`
1704
- ].join("\n"))
1710
+ ].join("\n")),
1711
+ ...unattended ? [...new Set(trustDirs)].map((dir) => [
1712
+ `[projects.${tomlString(dir)}]`,
1713
+ 'trust_level = "trusted"'
1714
+ ].join("\n")) : []
1705
1715
  ];
1706
1716
  return blocks.join("\n\n") + "\n";
1707
1717
  }
1708
1718
  function codexProfilePath(agentName, codexHome = userCodexHome()) {
1709
1719
  return join6(codexHome, `${codexProfileName(agentName)}.config.toml`);
1710
1720
  }
1711
- function prepareCodexLaunch(agentName, mcpUrl, extraArgs = [], codexHome = userCodexHome()) {
1721
+ function prepareCodexLaunch(agentName, mcpUrl, extraArgs = [], codexHome = userCodexHome(), cwd = process.cwd()) {
1712
1722
  mkdirSync2(codexHome, { recursive: true });
1713
1723
  const profilePath = codexProfilePath(agentName, codexHome);
1714
- writeFileSync3(profilePath, renderCodexProfile(mcpUrl), { mode: 384 });
1724
+ writeFileSync3(profilePath, renderCodexProfile(mcpUrl, void 0, void 0, trustDirsFor(cwd)), { mode: 384 });
1715
1725
  const command = ["codex", "--profile", codexProfileName(agentName), ...extraArgs].join(" ");
1716
1726
  return { command, profilePath };
1717
1727
  }
@@ -1739,6 +1749,14 @@ function pruneCodexProfiles(liveAgentNames, codexHome = userCodexHome()) {
1739
1749
  }
1740
1750
  return removed;
1741
1751
  }
1752
+ function trustDirsFor(cwd) {
1753
+ const dirs = [resolve2(cwd)];
1754
+ try {
1755
+ dirs.push(realpathSync2(cwd));
1756
+ } catch {
1757
+ }
1758
+ return [...new Set(dirs)];
1759
+ }
1742
1760
 
1743
1761
  // src/cli/codex/run.ts
1744
1762
  function listCodexSessions() {
@@ -1763,9 +1781,9 @@ async function runCodex(options) {
1763
1781
  });
1764
1782
  process.stderr.write(`MCP server: ${setup2.mcpServer.url}
1765
1783
  `);
1766
- await new Promise((resolve3) => {
1767
- process.on("SIGINT", resolve3);
1768
- process.on("SIGTERM", resolve3);
1784
+ await new Promise((resolve4) => {
1785
+ process.on("SIGINT", resolve4);
1786
+ process.on("SIGTERM", resolve4);
1769
1787
  });
1770
1788
  await setup2.cleanup();
1771
1789
  await eventLoopPromise2;
@@ -1867,9 +1885,9 @@ async function runCodex(options) {
1867
1885
  const noop = (() => true);
1868
1886
  process.stdout.write = noop;
1869
1887
  process.stderr.write = noop;
1870
- await new Promise((resolve3) => {
1871
- process.on("SIGTERM", resolve3);
1872
- process.on("SIGINT", resolve3);
1888
+ await new Promise((resolve4) => {
1889
+ process.on("SIGTERM", resolve4);
1890
+ process.on("SIGINT", resolve4);
1873
1891
  });
1874
1892
  inviteAbort.abort();
1875
1893
  await invitePromise;
@@ -1949,12 +1967,12 @@ function stopCodexSession(session) {
1949
1967
 
1950
1968
  // src/cli/version.ts
1951
1969
  import { readFileSync as readFileSync4 } from "fs";
1952
- import { dirname, resolve as resolve2 } from "path";
1970
+ import { dirname, resolve as resolve3 } from "path";
1953
1971
  import { fileURLToPath } from "url";
1954
1972
  function readPackageField(field) {
1955
1973
  try {
1956
1974
  const dir = dirname(fileURLToPath(import.meta.url));
1957
- const pkg = JSON.parse(readFileSync4(resolve2(dir, "../../package.json"), "utf-8"));
1975
+ const pkg = JSON.parse(readFileSync4(resolve3(dir, "../../package.json"), "utf-8"));
1958
1976
  return typeof pkg[field] === "string" ? pkg[field] : null;
1959
1977
  } catch {
1960
1978
  return null;
@@ -2137,7 +2155,7 @@ async function main() {
2137
2155
  const all = rest.includes("--all");
2138
2156
  const positional = rest.find((a) => !a.startsWith("--"));
2139
2157
  const name = getFlag("name", rest) ?? positional;
2140
- const { roomStop } = await import("../room-IHVB5CWO.js");
2158
+ const { roomStop } = await import("../room-ID4DQDPT.js");
2141
2159
  if (all) {
2142
2160
  for (const r of listRoomSessions()) {
2143
2161
  try {
@@ -2211,7 +2229,7 @@ async function main() {
2211
2229
  if (sub === "create") {
2212
2230
  const portStr = getFlag("port", roomArgs);
2213
2231
  const port = portStr ? parseInt(portStr, 10) : void 0;
2214
- const { roomCreate } = await import("../room-IHVB5CWO.js");
2232
+ const { roomCreate } = await import("../room-ID4DQDPT.js");
2215
2233
  await roomCreate({
2216
2234
  room: getFlag("room", roomArgs) ?? roomArgs.find((a) => !a.startsWith("--")),
2217
2235
  port,
@@ -2228,12 +2246,12 @@ async function main() {
2228
2246
  console.error("Usage: apiary room resume <name>");
2229
2247
  process.exit(1);
2230
2248
  }
2231
- const { roomResume } = await import("../room-IHVB5CWO.js");
2249
+ const { roomResume } = await import("../room-ID4DQDPT.js");
2232
2250
  await roomResume(name);
2233
2251
  return;
2234
2252
  }
2235
2253
  if (sub === "list" || sub === "ls") {
2236
- const { roomList } = await import("../room-IHVB5CWO.js");
2254
+ const { roomList } = await import("../room-ID4DQDPT.js");
2237
2255
  roomList();
2238
2256
  return;
2239
2257
  }
@@ -2243,7 +2261,7 @@ async function main() {
2243
2261
  console.error("Usage: apiary room stop <name>");
2244
2262
  process.exit(1);
2245
2263
  }
2246
- const { roomStop } = await import("../room-IHVB5CWO.js");
2264
+ const { roomStop } = await import("../room-ID4DQDPT.js");
2247
2265
  await roomStop(name);
2248
2266
  return;
2249
2267
  }
@@ -2258,7 +2276,7 @@ async function main() {
2258
2276
  console.error(`Invalid port: ${portStr}`);
2259
2277
  process.exit(1);
2260
2278
  }
2261
- const { spawnDaemonServer, isDaemonResult } = await import("../room-IHVB5CWO.js");
2279
+ const { spawnDaemonServer, isDaemonResult } = await import("../room-ID4DQDPT.js");
2262
2280
  const daemonRes = await spawnDaemonServer({
2263
2281
  room: roomName,
2264
2282
  port,