agent-yes 1.223.1-beta.549.1 → 1.223.1

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.
Files changed (66) hide show
  1. package/dist/SUPPORTED_CLIS-CE3JLqnP.js +9 -0
  2. package/dist/{SUPPORTED_CLIS-CrqrtyIm.js → SUPPORTED_CLIS-CY6Qo_bF.js} +2 -2
  3. package/dist/{agent-yes.config-DmW_TVFI.js → agent-yes.config-whqkqq9P.js} +2 -2
  4. package/dist/{agentShare-Bl7oUh0a.js → agentShare-CRJb4GhE.js} +8 -8
  5. package/dist/callback-CzFcLTZn.js +12 -0
  6. package/dist/{callback-D_Wgbxzz.js → callback-DZhSN9-O.js} +5 -5
  7. package/dist/{callbackCore-DSxbO_6a.js → callbackCore-BbAMbeUp.js} +1 -1
  8. package/dist/{callbackCore-CgnOT1Cp.js → callbackCore-Cm_yYhep.js} +1 -1
  9. package/dist/cli.js +9 -9
  10. package/dist/{configShared-nnIwDYY-.js → configShared-aKTg-sa5.js} +1 -1
  11. package/dist/{e2e-D5jaSHyY.js → e2e-jb0Hp43q.js} +1 -1
  12. package/dist/{expose-CGpMiQxp.js → expose-BiFqNtOa.js} +1 -1
  13. package/dist/{forkNested-BLa3Mz_t.js → forkNested-BCxO485A.js} +1 -1
  14. package/dist/index.js +5 -8
  15. package/dist/{messageLog-Bb_Ie3Ck.js → messageLog-CxrKJj77.js} +1 -1
  16. package/dist/{nodeRuntime-DoBOoeUW.js → nodeRuntime-DttG711L.js} +1 -1
  17. package/dist/{notifyDaemon-BM0fm2jj.js → notifyDaemon-CjszDILI.js} +7 -7
  18. package/dist/{openBrowser-D_qKXZNj.js → openBrowser-C2xmaYpe.js} +1 -1
  19. package/dist/{pidStore-DCqpU_bI.js → pidStore-BIvsBQ8X.js} +183 -3
  20. package/dist/pidStore-CLxwp0qI.js +5 -0
  21. package/dist/{reaper-BNKvujYy.js → reaper-BUHCyxdF.js} +1 -1
  22. package/dist/{reaper-BBc2AIKA.js → reaper-CJSu8UVZ.js} +1 -1
  23. package/dist/{remotes-C_YlVvr9.js → remotes-B4R8KvWI.js} +3 -3
  24. package/dist/{remotes-D-jPl9Fj.js → remotes-CZGDxzIP.js} +3 -3
  25. package/dist/{rustBinary-TTFsH3Hc.js → rustBinary-CUJuJD2N.js} +2 -2
  26. package/dist/{schedule-DPzonLGT.js → schedule-CKF_arnv.js} +8 -10
  27. package/dist/{serve-FuXB9UBl.js → serve-v5fUhHiR.js} +31 -33
  28. package/dist/{setup-C9ZF0GBm.js → setup-DojqtiR5.js} +3 -3
  29. package/dist/{share-B7VP4_UF.js → share-_QYjPN7q.js} +2 -2
  30. package/dist/{share-BwEUEHfy.js → share-vchIyVd8.js} +2 -2
  31. package/dist/{spawnGate-Vmd1d9OQ.js → spawnGate-SmqvtNIZ.js} +2 -2
  32. package/dist/{spawnGate-nUBaOXoG.js → spawnGate-vT9DJbq0.js} +1 -1
  33. package/dist/{subcommands-DOoQwSR1.js → subcommands-Dl2Kx1FC.js} +16 -21
  34. package/dist/{subcommands-Cw4mNoVr.js → subcommands-ZqHQMFDJ.js} +6 -6
  35. package/dist/{tray-CIm-5aWB.js → tray-xmaEYe1N.js} +1 -1
  36. package/dist/{ts-DsAeKp_Z.js → ts-bE-SKMWi.js} +6 -6
  37. package/dist/{versionChecker-BKvAKJ49.js → versionChecker-EEzUODBd.js} +2 -2
  38. package/dist/{webrtcLink-DknpJQ0y.js → webrtcLink-B7REGtK2.js} +2 -2
  39. package/dist/{webrtcRemote-CWogO7Qa.js → webrtcRemote-CMWelyTZ.js} +3 -3
  40. package/dist/{workspaceConfig-dHHBQh0F.js → workspaceConfig-Dcbe4y77.js} +1 -1
  41. package/dist/{ws-BGelZQJh.js → ws-qE_t5H8x.js} +8 -8
  42. package/lab/ui/blog/ay-callback/index.html +22 -27
  43. package/lab/ui/blog/index.html +3 -3
  44. package/lab/ui/index.html +8 -9
  45. package/package.json +1 -1
  46. package/ts/index.ts +0 -26
  47. package/ts/serve.ts +2 -8
  48. package/ts/subcommands.ts +0 -5
  49. package/dist/JsonlStore-Bm5Nj6v_.js +0 -187
  50. package/dist/SUPPORTED_CLIS-DPh0e8OB.js +0 -11
  51. package/dist/callback--FSZhV3J.js +0 -12
  52. package/dist/pidStore-CatWvn5W.js +0 -6
  53. package/dist/todoBlock-N6Kr9HnP.js +0 -409
  54. package/dist/todoCli-DXY3TEnZ.js +0 -300
  55. package/dist/todoDigest-BDVvC8wJ.js +0 -3
  56. package/dist/todoDigest-DvG0AVQ7.js +0 -260
  57. package/ts/todoBlock.spec.ts +0 -33
  58. package/ts/todoBlock.ts +0 -61
  59. package/ts/todoCli.spec.ts +0 -303
  60. package/ts/todoCli.ts +0 -356
  61. package/ts/todoDigest.spec.ts +0 -150
  62. package/ts/todoDigest.ts +0 -175
  63. package/ts/todoLifecycle.spec.ts +0 -67
  64. package/ts/todoLifecycle.ts +0 -121
  65. package/ts/todoStore.spec.ts +0 -410
  66. package/ts/todoStore.ts +0 -614
@@ -0,0 +1,9 @@
1
+ import "./ts-bE-SKMWi.js";
2
+ import "./logger-CDIsZ-Pp.js";
3
+ import "./versionChecker-EEzUODBd.js";
4
+ import "./pidStore-BIvsBQ8X.js";
5
+ import "./globalPidIndex-CoNr7tS8.js";
6
+ import "./messageLog-CxrKJj77.js";
7
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-CY6Qo_bF.js";
8
+
9
+ export { SUPPORTED_CLIS };
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-DsAeKp_Z.js";
1
+ import { t as CLIS_CONFIG } from "./ts-bE-SKMWi.js";
2
2
 
3
3
  //#region ts/SUPPORTED_CLIS.ts
4
4
  const SUPPORTED_CLIS = Object.keys(CLIS_CONFIG);
5
5
 
6
6
  //#endregion
7
7
  export { SUPPORTED_CLIS as t };
8
- //# sourceMappingURL=SUPPORTED_CLIS-CrqrtyIm.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-CY6Qo_bF.js.map
@@ -1,5 +1,5 @@
1
1
  import { n as logger } from "./logger-CDIsZ-Pp.js";
2
- import { n as normalizeAgentYesConfig, t as loadSharedCliDefaults } from "./configShared-nnIwDYY-.js";
2
+ import { n as normalizeAgentYesConfig, t as loadSharedCliDefaults } from "./configShared-aKTg-sa5.js";
3
3
  import os from "node:os";
4
4
  import { access, mkdir, readFile, writeFile } from "node:fs/promises";
5
5
  import path from "node:path";
@@ -226,4 +226,4 @@ async function getDefaultConfig() {
226
226
 
227
227
  //#endregion
228
228
  export { agent_yes_config_default as default };
229
- //# sourceMappingURL=agent-yes.config-DmW_TVFI.js.map
229
+ //# sourceMappingURL=agent-yes.config-whqkqq9P.js.map
@@ -1,12 +1,12 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
- import "./messageLog-Bb_Ie3Ck.js";
4
- import "./configShared-nnIwDYY-.js";
5
- import { M as resolveOne } from "./subcommands-DOoQwSR1.js";
6
- import "./e2e-D5jaSHyY.js";
7
- import "./webrtcLink-DknpJQ0y.js";
8
- import "./remotes-D-jPl9Fj.js";
9
- import { r as startShare } from "./share-BwEUEHfy.js";
3
+ import "./messageLog-CxrKJj77.js";
4
+ import "./configShared-aKTg-sa5.js";
5
+ import { M as resolveOne } from "./subcommands-Dl2Kx1FC.js";
6
+ import "./e2e-jb0Hp43q.js";
7
+ import "./webrtcLink-B7REGtK2.js";
8
+ import "./remotes-CZGDxzIP.js";
9
+ import { r as startShare } from "./share-vchIyVd8.js";
10
10
 
11
11
  //#region ts/agentShare.ts
12
12
  const MAX_SHARES = 8;
@@ -229,4 +229,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
229
229
 
230
230
  //#endregion
231
231
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
232
- //# sourceMappingURL=agentShare-Bl7oUh0a.js.map
232
+ //# sourceMappingURL=agentShare-CRJb4GhE.js.map
@@ -0,0 +1,12 @@
1
+ import "./logger-CDIsZ-Pp.js";
2
+ import "./globalPidIndex-CoNr7tS8.js";
3
+ import "./messageLog-CxrKJj77.js";
4
+ import "./configShared-aKTg-sa5.js";
5
+ import "./subcommands-Dl2Kx1FC.js";
6
+ import "./e2e-jb0Hp43q.js";
7
+ import "./webrtcLink-B7REGtK2.js";
8
+ import "./remotes-CZGDxzIP.js";
9
+ import "./callbackCore-Cm_yYhep.js";
10
+ import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-DZhSN9-O.js";
11
+
12
+ export { cmdCallback };
@@ -1,6 +1,6 @@
1
1
  import { t as agentYesHome } from "./agentYesHome-CtHb5b71.js";
2
- import { M as resolveOne } from "./subcommands-DOoQwSR1.js";
3
- import { a as mintCapability, o as parseExpires } from "./callbackCore-CgnOT1Cp.js";
2
+ import { M as resolveOne } from "./subcommands-Dl2Kx1FC.js";
3
+ import { a as mintCapability, o as parseExpires } from "./callbackCore-Cm_yYhep.js";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { mkdir, readFile, writeFile } from "node:fs/promises";
6
6
  import path from "node:path";
@@ -72,7 +72,7 @@ async function resolveBase(flag) {
72
72
  if (flag) return flag;
73
73
  if (process.env.AGENT_YES_CALLBACK_BASE) return process.env.AGENT_YES_CALLBACK_BASE;
74
74
  try {
75
- const { resolveLocalServeUrl } = await import("./serve-FuXB9UBl.js");
75
+ const { resolveLocalServeUrl } = await import("./serve-v5fUhHiR.js");
76
76
  const url = await resolveLocalServeUrl();
77
77
  if (url) return url;
78
78
  } catch {}
@@ -170,7 +170,7 @@ async function cmdCallback(rest) {
170
170
  createdAt: Date.now()
171
171
  };
172
172
  saveStore(all);
173
- const { buildSnippet } = await import("./callbackCore-DSxbO_6a.js");
173
+ const { buildSnippet } = await import("./callbackCore-BbAMbeUp.js");
174
174
  w(`callback ${id} → ${record.cli} #${record.pid} @ ${record.cwd}`);
175
175
  w(`expires: ${new Date(exp).toISOString()} (${expiresSpec})`);
176
176
  w(`endpoint: ${base.replace(/\/+$/, "")}/cb/${cap}`);
@@ -187,4 +187,4 @@ async function cmdCallback(rest) {
187
187
 
188
188
  //#endregion
189
189
  export { loadOrCreateCallbackSecret as i, isCallbackRevoked as n, loadCallbackSecretReadOnly as r, cmdCallback as t };
190
- //# sourceMappingURL=callback-D_Wgbxzz.js.map
190
+ //# sourceMappingURL=callback-DZhSN9-O.js.map
@@ -1,3 +1,3 @@
1
- import { a as mintCapability, i as frameVisitorMessage, n as MAX_EXPIRES_MS, o as parseExpires, r as buildSnippet, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-CgnOT1Cp.js";
1
+ import { a as mintCapability, i as frameVisitorMessage, n as MAX_EXPIRES_MS, o as parseExpires, r as buildSnippet, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-Cm_yYhep.js";
2
2
 
3
3
  export { buildSnippet };
@@ -140,4 +140,4 @@ function buildSnippet(opts) {
140
140
 
141
141
  //#endregion
142
142
  export { mintCapability as a, frameVisitorMessage as i, MAX_EXPIRES_MS as n, parseExpires as o, buildSnippet as r, verifyCapability as s, MAX_CALLBACK_MSG_BYTES as t };
143
- //# sourceMappingURL=callbackCore-CgnOT1Cp.js.map
143
+ //# sourceMappingURL=callbackCore-Cm_yYhep.js.map
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env bun
2
2
  import { t as invokedCliName } from "./invokedCli-uqM2YYA7.js";
3
3
  import { n as logger } from "./logger-CDIsZ-Pp.js";
4
- import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-BKvAKJ49.js";
5
- import { n as getRustBinary } from "./rustBinary-TTFsH3Hc.js";
4
+ import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-EEzUODBd.js";
5
+ import { n as getRustBinary } from "./rustBinary-CUJuJD2N.js";
6
6
  import { argv } from "process";
7
7
  import { spawn } from "child_process";
8
8
  import ms from "ms";
@@ -285,7 +285,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
285
285
  const rawArg = process.argv[2];
286
286
  const managerCommands = !invokedCliName(process.argv);
287
287
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
288
- const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-Cw4mNoVr.js");
288
+ const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-ZqHQMFDJ.js");
289
289
  if (isHelpFlag && process.argv.length === 3) {
290
290
  await cmdHelp(managerCommands);
291
291
  process.exit(0);
@@ -299,16 +299,16 @@ await checkAndAutoUpdate();
299
299
  logger.info(versionString());
300
300
  const config = parseCliArgs(process.argv);
301
301
  if (config.tray) {
302
- const { startTray } = await import("./tray-CIm-5aWB.js");
302
+ const { startTray } = await import("./tray-xmaEYe1N.js");
303
303
  await startTray();
304
304
  await new Promise(() => {});
305
305
  }
306
306
  {
307
- const { ensureTray } = await import("./tray-CIm-5aWB.js");
307
+ const { ensureTray } = await import("./tray-xmaEYe1N.js");
308
308
  ensureTray();
309
309
  }
310
310
  if (!config.showVersion && !config.appendPrompt && !config.tray) {
311
- const { waitForSpawnCapacity } = await import("./spawnGate-nUBaOXoG.js");
311
+ const { waitForSpawnCapacity } = await import("./spawnGate-vT9DJbq0.js");
312
312
  await waitForSpawnCapacity({
313
313
  onWait: (reason, waitedMs) => {
314
314
  if (config.verbose || waitedMs === 0) console.error(`[agent-yes] spawn gate: ${reason} — waiting…`);
@@ -327,14 +327,14 @@ if (config.useRust) {
327
327
  }
328
328
  }
329
329
  if (rustBinary) {
330
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DPh0e8OB.js");
330
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-CE3JLqnP.js");
331
331
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
332
332
  if (config.verbose) {
333
333
  console.log(`[rust] Using binary: ${rustBinary}`);
334
334
  console.log(`[rust] Args: ${rustArgs.join(" ")}`);
335
335
  }
336
336
  const attach = config.attach || process.env.AGENT_YES_ATTACH === "1";
337
- const { shouldForkNested, buildSpawnTutorial, waitForFifo } = await import("./forkNested-BLa3Mz_t.js");
337
+ const { shouldForkNested, buildSpawnTutorial, waitForFifo } = await import("./forkNested-BCxO485A.js");
338
338
  if (shouldForkNested({
339
339
  isTTY: Boolean(process.stdout.isTTY),
340
340
  ayPid: process.env.AGENT_YES_PID,
@@ -392,7 +392,7 @@ if (config.showVersion) {
392
392
  process.exit(0);
393
393
  }
394
394
  if (config.appendPrompt) {
395
- const { PidStore } = await import("./pidStore-CatWvn5W.js");
395
+ const { PidStore } = await import("./pidStore-CLxwp0qI.js");
396
396
  const ipcPath = await PidStore.findActiveFifo(process.cwd());
397
397
  if (!ipcPath) {
398
398
  console.error("No active agent with IPC found in current directory.");
@@ -69,4 +69,4 @@ async function loadSharedCliDefaults(fromUrl = import.meta.url) {
69
69
 
70
70
  //#endregion
71
71
  export { normalizeAgentYesConfig as n, loadSharedCliDefaults as t };
72
- //# sourceMappingURL=configShared-nnIwDYY-.js.map
72
+ //# sourceMappingURL=configShared-aKTg-sa5.js.map
@@ -172,4 +172,4 @@ function randomHex(n) {
172
172
 
173
173
  //#endregion
174
174
  export { computeTranscriptHash as a, open as c, randomHex as d, seal as f, MAX_CHUNK as i, packEnvelope as l, FLAG_CONFIRM as n, deriveAuthToken as o, unpackEnvelope as p, MARKER as r, deriveDirKeys as s, CONFIRM_TIMEOUT_MS as t, parseSecret as u };
175
- //# sourceMappingURL=e2e-D5jaSHyY.js.map
175
+ //# sourceMappingURL=e2e-jb0Hp43q.js.map
@@ -546,4 +546,4 @@ async function cmdExpose(args) {
546
546
 
547
547
  //#endregion
548
548
  export { cmdExpose, ensureExposure, listExposures, stopExposure };
549
- //# sourceMappingURL=expose-CGpMiQxp.js.map
549
+ //# sourceMappingURL=expose-BiFqNtOa.js.map
@@ -56,4 +56,4 @@ async function waitForFifo(pid, timeoutMs = 2e3, aborted) {
56
56
 
57
57
  //#endregion
58
58
  export { buildSpawnTutorial, shouldForkNested, waitForFifo };
59
- //# sourceMappingURL=forkNested-BLa3Mz_t.js.map
59
+ //# sourceMappingURL=forkNested-BCxO485A.js.map
package/dist/index.js CHANGED
@@ -1,11 +1,8 @@
1
- import { i as AgentContext, n as agentYes, o as removeControlCharacters, r as config, t as CLIS_CONFIG } from "./ts-DsAeKp_Z.js";
1
+ import { i as AgentContext, n as agentYes, o as removeControlCharacters, r as config, t as CLIS_CONFIG } from "./ts-bE-SKMWi.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-BKvAKJ49.js";
4
- import "./JsonlStore-Bm5Nj6v_.js";
3
+ import "./versionChecker-EEzUODBd.js";
4
+ import "./pidStore-BIvsBQ8X.js";
5
5
  import "./globalPidIndex-CoNr7tS8.js";
6
- import "./pidStore-DCqpU_bI.js";
7
- import "./messageLog-Bb_Ie3Ck.js";
8
- import { a as unblockedTasks, c as canTransition, d as nextStates, f as requiredGate, i as renderTree, l as initialState, n as openBlockers, p as statesOf, r as renderDigest, s as LIFECYCLES, u as isKnownKind } from "./todoDigest-DvG0AVQ7.js";
9
- import { a as openStore, i as TodoStore, n as monitorHint, r as CycleError, t as describeBlock } from "./todoBlock-N6Kr9HnP.js";
6
+ import "./messageLog-CxrKJj77.js";
10
7
 
11
- export { AgentContext, CLIS_CONFIG, CycleError, LIFECYCLES, TodoStore, canTransition, config, agentYes as default, describeBlock, initialState, isKnownKind, monitorHint, nextStates, openBlockers, openStore, removeControlCharacters, renderDigest, renderTree, requiredGate, statesOf, unblockedTasks };
8
+ export { AgentContext, CLIS_CONFIG, config, agentYes as default, removeControlCharacters };
@@ -91,4 +91,4 @@ async function readMailbox(cwd, box) {
91
91
 
92
92
  //#endregion
93
93
  export { recordOutbox as a, recordMessage as i, readMailbox as n, recordInbox as r, partyMatches as t };
94
- //# sourceMappingURL=messageLog-Bb_Ie3Ck.js.map
94
+ //# sourceMappingURL=messageLog-CxrKJj77.js.map
@@ -53,4 +53,4 @@ async function ensureNodeRuntime(which = Bun.which) {
53
53
 
54
54
  //#endregion
55
55
  export { liveEnv as n, ensureNodeRuntime as t };
56
- //# sourceMappingURL=nodeRuntime-DoBOoeUW.js.map
56
+ //# sourceMappingURL=nodeRuntime-DttG711L.js.map
@@ -1,11 +1,11 @@
1
1
  import { n as logger } from "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
- import "./messageLog-Bb_Ie3Ck.js";
4
- import "./configShared-nnIwDYY-.js";
5
- import { $ as daemonLockOwnerPath, G as gcInboxes, J as listInboxParents, K as hostId, Q as daemonLockDir, S as listRecords, W as appendEvent, X as readInbox, Y as liveWatchers, Z as shouldStealLock, _ as isPidAlive, c as deriveLiveState, et as notifyDir, k as renderLogTailLines } from "./subcommands-DOoQwSR1.js";
6
- import "./e2e-D5jaSHyY.js";
7
- import "./webrtcLink-DknpJQ0y.js";
8
- import "./remotes-D-jPl9Fj.js";
3
+ import "./messageLog-CxrKJj77.js";
4
+ import "./configShared-aKTg-sa5.js";
5
+ import { $ as daemonLockOwnerPath, G as gcInboxes, J as listInboxParents, K as hostId, Q as daemonLockDir, S as listRecords, W as appendEvent, X as readInbox, Y as liveWatchers, Z as shouldStealLock, _ as isPidAlive, c as deriveLiveState, et as notifyDir, k as renderLogTailLines } from "./subcommands-Dl2Kx1FC.js";
6
+ import "./e2e-jb0Hp43q.js";
7
+ import "./webrtcLink-B7REGtK2.js";
8
+ import "./remotes-CZGDxzIP.js";
9
9
  import { mkdir, readFile, rename, rm, stat, writeFile } from "fs/promises";
10
10
  import { randomUUID } from "node:crypto";
11
11
  import { execFile } from "node:child_process";
@@ -589,4 +589,4 @@ async function ensureDaemon() {
589
589
 
590
590
  //#endregion
591
591
  export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
592
- //# sourceMappingURL=notifyDaemon-BM0fm2jj.js.map
592
+ //# sourceMappingURL=notifyDaemon-CjszDILI.js.map
@@ -68,4 +68,4 @@ async function offerOpenInBrowser(url, prompt = "Open in browser now? [Y/n] ") {
68
68
 
69
69
  //#endregion
70
70
  export { offerOpenInBrowser };
71
- //# sourceMappingURL=openBrowser-D_qKXZNj.js.map
71
+ //# sourceMappingURL=openBrowser-C2xmaYpe.js.map
@@ -1,11 +1,191 @@
1
1
  import { n as logger } from "./logger-CDIsZ-Pp.js";
2
2
  import { t as agentYesHome } from "./agentYesHome-CtHb5b71.js";
3
- import { t as JsonlStore } from "./JsonlStore-Bm5Nj6v_.js";
4
3
  import { a as updateGlobalPidStatus, n as maybeCompactGlobalPids, r as pruneOldLogs, t as appendGlobalPid } from "./globalPidIndex-CoNr7tS8.js";
5
- import { mkdir, writeFile } from "fs/promises";
4
+ import { closeSync, existsSync, fsyncSync, openSync } from "fs";
5
+ import { appendFile, mkdir, readFile, rename, writeFile } from "fs/promises";
6
6
  import path from "path";
7
7
  import { randomBytes } from "node:crypto";
8
+ import { lock } from "proper-lockfile";
8
9
 
10
+ //#region ts/JsonlStore.ts
11
+ /**
12
+ * A lightweight NeDB-style JSONL persistence layer.
13
+ *
14
+ * - Append-only writes (one JSON object per line)
15
+ * - Same `_id` → last line wins (fields merged)
16
+ * - `$$deleted` lines act as tombstones
17
+ * - Crash recovery: skip partial last line, recover from temp file
18
+ * - Multi-process safe via proper-lockfile (reads don't need lock)
19
+ * - Compact on close: deduplicates into clean file via atomic rename
20
+ */
21
+ var JsonlStore = class {
22
+ filePath;
23
+ tempPath;
24
+ docs = /* @__PURE__ */ new Map();
25
+ constructor(filePath) {
26
+ this.filePath = filePath;
27
+ this.tempPath = filePath + "~";
28
+ }
29
+ /**
30
+ * Load all records from the JSONL file. No lock needed.
31
+ * Handles crash recovery: partial last line skipped, temp file recovery.
32
+ */
33
+ async load() {
34
+ await mkdir(path.dirname(this.filePath), { recursive: true });
35
+ if (!existsSync(this.filePath) && existsSync(this.tempPath)) {
36
+ logger.debug("[JsonlStore] Recovering from temp file");
37
+ await rename(this.tempPath, this.filePath);
38
+ }
39
+ this.docs = /* @__PURE__ */ new Map();
40
+ let raw = "";
41
+ try {
42
+ raw = await readFile(this.filePath, "utf-8");
43
+ } catch (err) {
44
+ if (err.code === "ENOENT") return this.docs;
45
+ throw err;
46
+ }
47
+ const lines = raw.split("\n");
48
+ let corruptCount = 0;
49
+ for (const line of lines) {
50
+ const trimmed = line.trim();
51
+ if (!trimmed) continue;
52
+ try {
53
+ const doc = JSON.parse(trimmed);
54
+ if (!doc._id) continue;
55
+ if (doc.$$deleted) this.docs.delete(doc._id);
56
+ else {
57
+ const existing = this.docs.get(doc._id);
58
+ if (existing) this.docs.set(doc._id, {
59
+ ...existing,
60
+ ...doc
61
+ });
62
+ else this.docs.set(doc._id, doc);
63
+ }
64
+ } catch {
65
+ corruptCount++;
66
+ }
67
+ }
68
+ if (corruptCount > 0) logger.debug(`[JsonlStore] Skipped ${corruptCount} corrupt line(s) in ${this.filePath}`);
69
+ return this.docs;
70
+ }
71
+ /** Get all live documents. */
72
+ getAll() {
73
+ return Array.from(this.docs.values());
74
+ }
75
+ /** Find a document by _id. */
76
+ getById(id) {
77
+ return this.docs.get(id);
78
+ }
79
+ /** Find documents matching a predicate. */
80
+ find(predicate) {
81
+ return this.getAll().filter(predicate);
82
+ }
83
+ /** Find first document matching a predicate. */
84
+ findOne(predicate) {
85
+ for (const doc of this.docs.values()) if (predicate(doc)) return doc;
86
+ }
87
+ /**
88
+ * Append a new document. Acquires lock.
89
+ * If no _id is provided, one is generated.
90
+ */
91
+ async append(doc) {
92
+ const id = doc._id || generateId();
93
+ const { _id: _, ...rest } = doc;
94
+ const fullDoc = {
95
+ _id: id,
96
+ ...rest
97
+ };
98
+ return await this.withLock(async () => {
99
+ await appendFile(this.filePath, JSON.stringify(fullDoc) + "\n");
100
+ const existing = this.docs.get(fullDoc._id);
101
+ if (existing) this.docs.set(fullDoc._id, {
102
+ ...existing,
103
+ ...fullDoc
104
+ });
105
+ else this.docs.set(fullDoc._id, fullDoc);
106
+ return fullDoc;
107
+ });
108
+ }
109
+ /**
110
+ * Update a document by _id. Appends a merge line. Acquires lock.
111
+ */
112
+ async updateById(id, patch) {
113
+ await this.withLock(async () => {
114
+ const line = {
115
+ _id: id,
116
+ ...patch
117
+ };
118
+ await appendFile(this.filePath, JSON.stringify(line) + "\n");
119
+ const existing = this.docs.get(id);
120
+ if (existing) this.docs.set(id, {
121
+ ...existing,
122
+ ...patch
123
+ });
124
+ });
125
+ }
126
+ /**
127
+ * Delete a document by _id. Appends a tombstone. Acquires lock.
128
+ */
129
+ async deleteById(id) {
130
+ await this.withLock(async () => {
131
+ const tombstone = {
132
+ _id: id,
133
+ $$deleted: true
134
+ };
135
+ await appendFile(this.filePath, JSON.stringify(tombstone) + "\n");
136
+ this.docs.delete(id);
137
+ });
138
+ }
139
+ /**
140
+ * Compact the file: deduplicate entries, remove tombstones.
141
+ * Writes to temp file, fsyncs, then atomic renames.
142
+ * Acquires lock.
143
+ */
144
+ async compact() {
145
+ const lines = Array.from(this.docs.values()).map((doc) => {
146
+ const { _id, $$deleted: _$$deleted, ...rest } = doc;
147
+ return JSON.stringify({
148
+ _id,
149
+ ...rest
150
+ });
151
+ }).join("\n");
152
+ const content = lines ? lines + "\n" : "";
153
+ try {
154
+ await this.withLock(async () => {
155
+ await writeFile(this.tempPath, content);
156
+ const fd = openSync(this.tempPath, "r");
157
+ fsyncSync(fd);
158
+ closeSync(fd);
159
+ await rename(this.tempPath, this.filePath);
160
+ });
161
+ } catch {
162
+ await writeFile(this.filePath, content);
163
+ }
164
+ }
165
+ async withLock(fn) {
166
+ const dir = path.dirname(this.filePath);
167
+ let release;
168
+ try {
169
+ release = await lock(dir, {
170
+ lockfilePath: this.filePath + ".lock",
171
+ retries: {
172
+ retries: 5,
173
+ minTimeout: 50,
174
+ maxTimeout: 500
175
+ }
176
+ });
177
+ return await fn();
178
+ } finally {
179
+ if (release) await release();
180
+ }
181
+ }
182
+ };
183
+ let idCounter = 0;
184
+ function generateId() {
185
+ return Date.now().toString(36) + (idCounter++).toString(36) + Math.random().toString(36).slice(2, 6);
186
+ }
187
+
188
+ //#endregion
9
189
  //#region ts/pidStore.ts
10
190
  var PidStore = class PidStore {
11
191
  storeDir;
@@ -188,4 +368,4 @@ pid-db/
188
368
 
189
369
  //#endregion
190
370
  export { PidStore as t };
191
- //# sourceMappingURL=pidStore-DCqpU_bI.js.map
371
+ //# sourceMappingURL=pidStore-BIvsBQ8X.js.map
@@ -0,0 +1,5 @@
1
+ import "./logger-CDIsZ-Pp.js";
2
+ import { t as PidStore } from "./pidStore-BIvsBQ8X.js";
3
+ import "./globalPidIndex-CoNr7tS8.js";
4
+
5
+ export { PidStore };
@@ -107,4 +107,4 @@ async function pruneStaleActivityMarkers() {
107
107
 
108
108
  //#endregion
109
109
  export { register as n, sweep as r, pgidForWrapper as t };
110
- //# sourceMappingURL=reaper-BNKvujYy.js.map
110
+ //# sourceMappingURL=reaper-BUHCyxdF.js.map
@@ -1,3 +1,3 @@
1
- import { n as register, r as sweep, t as pgidForWrapper } from "./reaper-BNKvujYy.js";
1
+ import { n as register, r as sweep, t as pgidForWrapper } from "./reaper-BUHCyxdF.js";
2
2
 
3
3
  export { sweep };
@@ -1,5 +1,5 @@
1
- import "./e2e-D5jaSHyY.js";
2
- import "./webrtcLink-DknpJQ0y.js";
3
- import { a as resolveRemoteSpec, i as readRemotes, n as deleteRemoteAlias, o as writeRemoteAlias, r as parseDirectRemoteSpec, t as cmdRemote } from "./remotes-D-jPl9Fj.js";
1
+ import "./e2e-jb0Hp43q.js";
2
+ import "./webrtcLink-B7REGtK2.js";
3
+ import { a as resolveRemoteSpec, i as readRemotes, n as deleteRemoteAlias, o as writeRemoteAlias, r as parseDirectRemoteSpec, t as cmdRemote } from "./remotes-CZGDxzIP.js";
4
4
 
5
5
  export { cmdRemote };
@@ -1,4 +1,4 @@
1
- import { n as isWebrtcSpec } from "./webrtcLink-DknpJQ0y.js";
1
+ import { n as isWebrtcSpec } from "./webrtcLink-B7REGtK2.js";
2
2
  import { mkdir, readFile, writeFile } from "fs/promises";
3
3
  import { homedir } from "os";
4
4
  import path from "path";
@@ -86,7 +86,7 @@ async function resolveRemoteSpec(spec) {
86
86
  * The bridge lives for the rest of the process (torn down on `process.exit`).
87
87
  */
88
88
  async function resolveWebrtc(link, keyword) {
89
- const { startWebrtcBridge } = await import("./webrtcRemote-CWogO7Qa.js");
89
+ const { startWebrtcBridge } = await import("./webrtcRemote-CMWelyTZ.js");
90
90
  const bridge = await startWebrtcBridge(link);
91
91
  return {
92
92
  url: bridge.baseUrl,
@@ -173,4 +173,4 @@ async function cmdRemote(rest) {
173
173
 
174
174
  //#endregion
175
175
  export { resolveRemoteSpec as a, readRemotes as i, deleteRemoteAlias as n, writeRemoteAlias as o, parseDirectRemoteSpec as r, cmdRemote as t };
176
- //# sourceMappingURL=remotes-D-jPl9Fj.js.map
176
+ //# sourceMappingURL=remotes-CZGDxzIP.js.map
@@ -1,4 +1,4 @@
1
- import { r as getInstalledPackage } from "./versionChecker-BKvAKJ49.js";
1
+ import { r as getInstalledPackage } from "./versionChecker-EEzUODBd.js";
2
2
  import { execFileSync } from "child_process";
3
3
  import { existsSync, mkdirSync, unlinkSync } from "fs";
4
4
  import { chmod, copyFile } from "fs/promises";
@@ -225,4 +225,4 @@ async function getRustBinary(options = {}) {
225
225
 
226
226
  //#endregion
227
227
  export { getRustBinary as n, findSpawnHiddenLauncher as t };
228
- //# sourceMappingURL=rustBinary-TTFsH3Hc.js.map
228
+ //# sourceMappingURL=rustBinary-CUJuJD2N.js.map
@@ -1,14 +1,12 @@
1
- import "./ts-DsAeKp_Z.js";
1
+ import "./ts-bE-SKMWi.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-BKvAKJ49.js";
4
- import "./JsonlStore-Bm5Nj6v_.js";
3
+ import "./versionChecker-EEzUODBd.js";
4
+ import "./pidStore-BIvsBQ8X.js";
5
5
  import "./globalPidIndex-CoNr7tS8.js";
6
- import "./pidStore-DCqpU_bI.js";
7
- import "./messageLog-Bb_Ie3Ck.js";
8
- import "./todoBlock-N6Kr9HnP.js";
9
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-CrqrtyIm.js";
10
- import { d as resolveSpawnCwd } from "./workspaceConfig-dHHBQh0F.js";
11
- import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-DoBOoeUW.js";
6
+ import "./messageLog-CxrKJj77.js";
7
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-CY6Qo_bF.js";
8
+ import { d as resolveSpawnCwd } from "./workspaceConfig-Dcbe4y77.js";
9
+ import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-DttG711L.js";
12
10
  import { createHash } from "node:crypto";
13
11
 
14
12
  //#region ts/oxmgrService.ts
@@ -153,4 +151,4 @@ async function cmdSchedule(rest) {
153
151
 
154
152
  //#endregion
155
153
  export { cmdSchedule };
156
- //# sourceMappingURL=schedule-DPzonLGT.js.map
154
+ //# sourceMappingURL=schedule-CKF_arnv.js.map