agent-yes 1.288.0-beta.691.1 → 1.289.0
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/default.config.yaml +106 -0
- package/dist/{SUPPORTED_CLIS-Dg7Cy8R1.js → SUPPORTED_CLIS-BlgVWZrM.js} +2 -2
- package/dist/{SUPPORTED_CLIS-MrLVSlcR.js → SUPPORTED_CLIS-C65PuIs6.js} +3 -3
- package/dist/{agentShare-D-ochGIx.js → agentShare-Cm15-dfZ.js} +2 -2
- package/dist/{callback-CSOgnPrU.js → callback-Bbplrsbv.js} +3 -3
- package/dist/{callback-BimoGykR.js → callback-Dwnkeqpz.js} +2 -2
- package/dist/cli.js +5 -5
- package/dist/{cmdPs-D8-dC9hr.js → cmdPs-BYBZQ0Vc.js} +2 -2
- package/dist/index.js +2 -2
- package/dist/{notifyDaemon-CDi8y3_s.js → notifyDaemon-Q3FF-WEZ.js} +46 -38
- package/dist/{parentPingLoop-CNJSecBe.js → parentPingLoop-Dc7co5D7.js} +2 -2
- package/dist/{rustBinary-34k78wH7.js → rustBinary-B57oRftk.js} +2 -2
- package/dist/{rustBinary-B6fBHuzz.js → rustBinary-Dq0AytZ7.js} +2 -2
- package/dist/{schedule-DJ96g3pg.js → schedule-pim0Izhs.js} +4 -4
- package/dist/{serve-ZVo1XRbJ.js → serve-CMsvjqPU.js} +17 -17
- package/dist/{setup-BEsF8xw3.js → setup-BmxYINCx.js} +2 -2
- package/dist/{subcommands-piqR6qZc.js → subcommands-CJBV06rg.js} +1 -1
- package/dist/{subcommands-D-IwsyJQ.js → subcommands-CWDqhKQe.js} +15 -15
- package/dist/{terminal-CUKaM4_4.js → terminal-CcmBzB3G.js} +2 -2
- package/dist/trayApp-BovAZs7m.js +5 -0
- package/dist/{trayApp-BcdXc3ao.js → trayApp-DuZBkGl_.js} +2 -2
- package/dist/{ts-Cvw9FS1L.js → ts-CSp4mJ7Z.js} +21 -7
- package/dist/{versionChecker-DFQqPKaO.js → versionChecker-CWCN4vwm.js} +2 -2
- package/dist/{widget-BhqRtiMP.js → widget-D2cCC8nz.js} +3 -3
- package/dist/{ws-mZukCQr5.js → ws-B5Qb2c-1.js} +2 -2
- package/dist/{ws-BW3ujQ6-.js → ws-CyO9r4jx.js} +2 -2
- package/package.json +1 -1
- package/ts/index.ts +5 -4
- package/ts/notifyDaemon.spec.ts +16 -0
- package/ts/notifyDaemon.ts +22 -0
- package/dist/trayApp-DDWTl8KU.js +0 -5
package/default.config.yaml
CHANGED
|
@@ -334,6 +334,112 @@ clis:
|
|
|
334
334
|
- --search
|
|
335
335
|
noEOL: true
|
|
336
336
|
|
|
337
|
+
# codex-ds — the `codex` binary pointed at DeepSeek V4 Pro over OpenRouter
|
|
338
|
+
# instead of the built-in OpenAI models. Everything the provider needs rides
|
|
339
|
+
# in `defaultArgs` as `-c` overrides, so this works against a stock codex
|
|
340
|
+
# install with no `~/.codex/*.config.toml` of your own; the only external
|
|
341
|
+
# requirement is `OPENROUTER_API_KEY` in the environment (same shape as glm's
|
|
342
|
+
# ZAI_API_KEY). Get one at https://openrouter.ai/keys.
|
|
343
|
+
#
|
|
344
|
+
# Two codex-version constraints are baked into the override:
|
|
345
|
+
# - `wire_api` must be "responses"; codex >= 0.147 removed the "chat"
|
|
346
|
+
# wire protocol, and OpenRouter serves POST /api/v1/responses.
|
|
347
|
+
# - the provider table is passed inline rather than as a named profile,
|
|
348
|
+
# because codex >= 0.147 rejects a `[profiles.X]` table in config.toml
|
|
349
|
+
# and wants it in a separate `<X>.config.toml`.
|
|
350
|
+
#
|
|
351
|
+
# All drive markers below are copied from the `codex` block — same binary,
|
|
352
|
+
# same TUI — because per-CLI config does not inherit.
|
|
353
|
+
codex-ds:
|
|
354
|
+
binary: codex
|
|
355
|
+
promptArg: first-arg
|
|
356
|
+
defaultArgs:
|
|
357
|
+
- -c
|
|
358
|
+
- model_providers.openrouter={name="OpenRouter",base_url="https://openrouter.ai/api/v1",env_key="OPENROUTER_API_KEY",wire_api="responses"}
|
|
359
|
+
- -c
|
|
360
|
+
- model_provider="openrouter"
|
|
361
|
+
- -c
|
|
362
|
+
- model="deepseek/deepseek-v4-pro-0813"
|
|
363
|
+
- --search
|
|
364
|
+
yesArgs:
|
|
365
|
+
- --dangerously-bypass-approvals-and-sandbox
|
|
366
|
+
install:
|
|
367
|
+
npm: "npm install -g @openai/codex@latest"
|
|
368
|
+
help: https://openrouter.ai/deepseek/deepseek-v4-pro
|
|
369
|
+
updateAvailable:
|
|
370
|
+
- "^✨⬆️ Update available!"
|
|
371
|
+
ready:
|
|
372
|
+
- ⏎ send
|
|
373
|
+
- "› "
|
|
374
|
+
- '\? for shortcuts'
|
|
375
|
+
working:
|
|
376
|
+
- esc to interrupt
|
|
377
|
+
needsInput:
|
|
378
|
+
- pattern: '[›>] ?\d+\.'
|
|
379
|
+
flags: m
|
|
380
|
+
enter:
|
|
381
|
+
- pattern: '[›>] ?1\. ?Yes'
|
|
382
|
+
flags: m
|
|
383
|
+
- pattern: '[›>] ?1\. ?Approve'
|
|
384
|
+
flags: m
|
|
385
|
+
- pattern: '[›>] ?1\. ?Allow'
|
|
386
|
+
flags: m
|
|
387
|
+
fatal:
|
|
388
|
+
- "Error: The cursor position could not be read within"
|
|
389
|
+
noEOL: true
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
# codex-ds-direct — same idea as codex-ds, but pointed straight at DeepSeek's
|
|
393
|
+
# own endpoint instead of going through OpenRouter. DeepSeek gained native
|
|
394
|
+
# Responses API support in the 2026-08-13 V4 Pro update
|
|
395
|
+
# (https://api-docs.deepseek.com/guides/responses_api/), so no translating
|
|
396
|
+
# proxy is needed on this path either — one less hop and no reseller margin.
|
|
397
|
+
# Requires `DEEPSEEK_API_KEY`; get one at https://platform.deepseek.com.
|
|
398
|
+
#
|
|
399
|
+
# Model id differs from the OpenRouter route: DeepSeek's own /models lists
|
|
400
|
+
# exactly `deepseek-v4-flash` and `deepseek-v4-pro` — there are no dated
|
|
401
|
+
# snapshot ids here, so this uses the plain `deepseek-v4-pro`.
|
|
402
|
+
#
|
|
403
|
+
# Drive markers are copied from the `codex` block, as with codex-ds.
|
|
404
|
+
codex-ds-direct:
|
|
405
|
+
binary: codex
|
|
406
|
+
promptArg: first-arg
|
|
407
|
+
defaultArgs:
|
|
408
|
+
- -c
|
|
409
|
+
- model_providers.deepseek={name="DeepSeek",base_url="https://api.deepseek.com",env_key="DEEPSEEK_API_KEY",wire_api="responses"}
|
|
410
|
+
- -c
|
|
411
|
+
- model_provider="deepseek"
|
|
412
|
+
- -c
|
|
413
|
+
- model="deepseek-v4-pro"
|
|
414
|
+
- --search
|
|
415
|
+
yesArgs:
|
|
416
|
+
- --dangerously-bypass-approvals-and-sandbox
|
|
417
|
+
install:
|
|
418
|
+
npm: "npm install -g @openai/codex@latest"
|
|
419
|
+
help: https://api-docs.deepseek.com/guides/responses_api/
|
|
420
|
+
updateAvailable:
|
|
421
|
+
- "^✨⬆️ Update available!"
|
|
422
|
+
ready:
|
|
423
|
+
- ⏎ send
|
|
424
|
+
- "› "
|
|
425
|
+
- '\? for shortcuts'
|
|
426
|
+
working:
|
|
427
|
+
- esc to interrupt
|
|
428
|
+
needsInput:
|
|
429
|
+
- pattern: '[›>] ?\d+\.'
|
|
430
|
+
flags: m
|
|
431
|
+
enter:
|
|
432
|
+
- pattern: '[›>] ?1\. ?Yes'
|
|
433
|
+
flags: m
|
|
434
|
+
- pattern: '[›>] ?1\. ?Approve'
|
|
435
|
+
flags: m
|
|
436
|
+
- pattern: '[›>] ?1\. ?Allow'
|
|
437
|
+
flags: m
|
|
438
|
+
fatal:
|
|
439
|
+
- "Error: The cursor position could not be read within"
|
|
440
|
+
noEOL: true
|
|
441
|
+
|
|
442
|
+
|
|
337
443
|
qwen:
|
|
338
444
|
install:
|
|
339
445
|
npm: "npm install -g @qwen-code/qwen-code@latest"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as CLIS_CONFIG } from "./ts-
|
|
1
|
+
import { t as CLIS_CONFIG } from "./ts-CSp4mJ7Z.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-
|
|
8
|
+
//# sourceMappingURL=SUPPORTED_CLIS-BlgVWZrM.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./versionChecker-
|
|
3
|
-
import "./ts-
|
|
2
|
+
import "./versionChecker-CWCN4vwm.js";
|
|
3
|
+
import "./ts-CSp4mJ7Z.js";
|
|
4
4
|
import "./todoAutomation-CbVVS4re.js";
|
|
5
5
|
import "./JsonlStore-BqF7AQ6E.js";
|
|
6
6
|
import "./globalPidIndex-DoaKEUkO.js";
|
|
7
7
|
import "./pidStore-B73xnAeT.js";
|
|
8
8
|
import "./messageLog-DdjBNqgt.js";
|
|
9
9
|
import "./todoStore-DF6vxHgV.js";
|
|
10
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-
|
|
10
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BlgVWZrM.js";
|
|
11
11
|
|
|
12
12
|
export { SUPPORTED_CLIS };
|
|
@@ -3,7 +3,7 @@ import "./globalPidIndex-DoaKEUkO.js";
|
|
|
3
3
|
import "./messageLog-DdjBNqgt.js";
|
|
4
4
|
import "./e2e-z1xpwSAg.js";
|
|
5
5
|
import "./configShared-DKTgiz7K.js";
|
|
6
|
-
import { z as resolveOne } from "./subcommands-
|
|
6
|
+
import { z as resolveOne } from "./subcommands-CWDqhKQe.js";
|
|
7
7
|
import "./notifyStore-2SWKGwZI.js";
|
|
8
8
|
import "./webrtcLink-DLaJfTcB.js";
|
|
9
9
|
import "./remotes-BjsglpjL.js";
|
|
@@ -230,4 +230,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
|
|
|
230
230
|
|
|
231
231
|
//#endregion
|
|
232
232
|
export { createScopedShare, listShares, revokeAllShares, revokeShare };
|
|
233
|
-
//# sourceMappingURL=agentShare-
|
|
233
|
+
//# sourceMappingURL=agentShare-Cm15-dfZ.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as agentYesHome } from "./agentYesHome-BNtn19J4.js";
|
|
2
|
-
import { z as resolveOne } from "./subcommands-
|
|
2
|
+
import { z as resolveOne } from "./subcommands-CWDqhKQe.js";
|
|
3
3
|
import { a as mintCapability, o as parseExpires } from "./callbackCore-Bl2gGcxg.js";
|
|
4
4
|
import { randomBytes } from "node:crypto";
|
|
5
5
|
import { chmodSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
@@ -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-
|
|
75
|
+
const { resolveLocalServeUrl } = await import("./serve-CMsvjqPU.js");
|
|
76
76
|
const url = await resolveLocalServeUrl();
|
|
77
77
|
if (url) return url;
|
|
78
78
|
} catch {}
|
|
@@ -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-
|
|
190
|
+
//# sourceMappingURL=callback-Bbplrsbv.js.map
|
|
@@ -3,11 +3,11 @@ import "./globalPidIndex-DoaKEUkO.js";
|
|
|
3
3
|
import "./messageLog-DdjBNqgt.js";
|
|
4
4
|
import "./e2e-z1xpwSAg.js";
|
|
5
5
|
import "./configShared-DKTgiz7K.js";
|
|
6
|
-
import "./subcommands-
|
|
6
|
+
import "./subcommands-CWDqhKQe.js";
|
|
7
7
|
import "./notifyStore-2SWKGwZI.js";
|
|
8
8
|
import "./webrtcLink-DLaJfTcB.js";
|
|
9
9
|
import "./remotes-BjsglpjL.js";
|
|
10
10
|
import "./callbackCore-Bl2gGcxg.js";
|
|
11
|
-
import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-
|
|
11
|
+
import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-Bbplrsbv.js";
|
|
12
12
|
|
|
13
13
|
export { cmdCallback };
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { t as invokedCliName } from "./invokedCli-zdFbz1ST.js";
|
|
3
3
|
import { n as logger } from "./logger-CDIsZ-Pp.js";
|
|
4
|
-
import { a as versionString, r as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-
|
|
5
|
-
import { l as getRustBinary } from "./rustBinary-
|
|
4
|
+
import { a as versionString, r as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-CWCN4vwm.js";
|
|
5
|
+
import { l as getRustBinary } from "./rustBinary-B57oRftk.js";
|
|
6
6
|
import { argv } from "process";
|
|
7
7
|
import { spawn } from "child_process";
|
|
8
8
|
import ms from "ms";
|
|
@@ -295,7 +295,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
|
|
|
295
295
|
const rawArg = process.argv[2];
|
|
296
296
|
const managerCommands = !invokedCliName(process.argv);
|
|
297
297
|
const isHelpFlag = rawArg === "-h" || rawArg === "--help";
|
|
298
|
-
const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-
|
|
298
|
+
const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-CJBV06rg.js");
|
|
299
299
|
if (isHelpFlag && process.argv.length === 3) {
|
|
300
300
|
await cmdHelp(managerCommands);
|
|
301
301
|
process.exit(0);
|
|
@@ -309,7 +309,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
|
|
|
309
309
|
process.exit(code ?? 0);
|
|
310
310
|
}
|
|
311
311
|
{
|
|
312
|
-
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-
|
|
312
|
+
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-C65PuIs6.js");
|
|
313
313
|
if (isUnknownManagerToken(rawArg, managerCommands, SUPPORTED_CLIS)) {
|
|
314
314
|
process.stderr.write(`ay: unknown subcommand or CLI '${rawArg}'.\n See 'ay help' for subcommands. To run an agent, name a CLI:\n 'ay <cli> …' (e.g. 'ay claude …') or 'ay --cli <cli> …'.\n`);
|
|
315
315
|
process.exit(1);
|
|
@@ -360,7 +360,7 @@ if (config.useRust) {
|
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
if (rustBinary) {
|
|
363
|
-
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-
|
|
363
|
+
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-C65PuIs6.js");
|
|
364
364
|
const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
|
|
365
365
|
if (config.verbose) {
|
|
366
366
|
console.log(`[rust] Using binary: ${rustBinary}`);
|
|
@@ -3,7 +3,7 @@ import "./globalPidIndex-DoaKEUkO.js";
|
|
|
3
3
|
import "./messageLog-DdjBNqgt.js";
|
|
4
4
|
import "./e2e-z1xpwSAg.js";
|
|
5
5
|
import "./configShared-DKTgiz7K.js";
|
|
6
|
-
import { $ as buildAgentForest, D as listRecords, et as flattenForest, u as deriveLiveState } from "./subcommands-
|
|
6
|
+
import { $ as buildAgentForest, D as listRecords, et as flattenForest, u as deriveLiveState } from "./subcommands-CWDqhKQe.js";
|
|
7
7
|
import "./notifyStore-2SWKGwZI.js";
|
|
8
8
|
import "./webrtcLink-DLaJfTcB.js";
|
|
9
9
|
import "./remotes-BjsglpjL.js";
|
|
@@ -328,4 +328,4 @@ function readPpidSync(pid) {
|
|
|
328
328
|
|
|
329
329
|
//#endregion
|
|
330
330
|
export { cmdPs };
|
|
331
|
-
//# sourceMappingURL=cmdPs-
|
|
331
|
+
//# sourceMappingURL=cmdPs-BYBZQ0Vc.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./versionChecker-
|
|
3
|
-
import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-
|
|
2
|
+
import "./versionChecker-CWCN4vwm.js";
|
|
3
|
+
import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-CSp4mJ7Z.js";
|
|
4
4
|
import { a as renderTree, c as describeBlock, i as renderDigest, l as monitorHint, o as unblockedTasks, r as openBlockers, t as reconcileTodos, u as removeControlCharacters } from "./todoAutomation-CbVVS4re.js";
|
|
5
5
|
import "./JsonlStore-BqF7AQ6E.js";
|
|
6
6
|
import "./globalPidIndex-DoaKEUkO.js";
|
|
@@ -3,7 +3,7 @@ import "./globalPidIndex-DoaKEUkO.js";
|
|
|
3
3
|
import "./messageLog-DdjBNqgt.js";
|
|
4
4
|
import "./e2e-z1xpwSAg.js";
|
|
5
5
|
import "./configShared-DKTgiz7K.js";
|
|
6
|
-
import { D as listRecords, I as renderLogTailLines, b as isPidAlive, u as deriveLiveState } from "./subcommands-
|
|
6
|
+
import { D as listRecords, I as renderLogTailLines, b as isPidAlive, u as deriveLiveState } from "./subcommands-CWDqhKQe.js";
|
|
7
7
|
import { f as readInbox, g as daemonLockOwnerPath, h as daemonLockDir, i as gcInboxes, l as listInboxParents, m as shouldStealLock, n as appendEvent, s as hostId, u as liveWatchers, x as notifyDir } from "./notifyStore-2SWKGwZI.js";
|
|
8
8
|
import "./webrtcLink-DLaJfTcB.js";
|
|
9
9
|
import "./remotes-BjsglpjL.js";
|
|
@@ -556,6 +556,7 @@ async function liveChildrenSnapshot() {
|
|
|
556
556
|
return m;
|
|
557
557
|
}
|
|
558
558
|
const OWNER_TTL_MS = 3e4;
|
|
559
|
+
const LOCK_WAIT_BUDGET_MS = 5e3;
|
|
559
560
|
let daemonStartedAt = 0;
|
|
560
561
|
let daemonOsStart = null;
|
|
561
562
|
let daemonToken = "";
|
|
@@ -597,46 +598,53 @@ async function writeOwner() {
|
|
|
597
598
|
* mkdir→writeOwner window of another daemon coming up), so two concurrent starts
|
|
598
599
|
* can't both "win". The liveness predicate is injectable for tests.
|
|
599
600
|
*/
|
|
600
|
-
async function acquireDaemonLock(isAlive = isPidAlive) {
|
|
601
|
+
async function acquireDaemonLock(isAlive = isPidAlive, waitBudgetMs = LOCK_WAIT_BUDGET_MS) {
|
|
601
602
|
await mkdir(notifyDir(), { recursive: true }).catch(() => {});
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
if (!await writeOwner()) {
|
|
608
|
-
await rm(daemonLockDir(), {
|
|
609
|
-
recursive: true,
|
|
610
|
-
force: true
|
|
611
|
-
}).catch(() => {});
|
|
612
|
-
await new Promise((r) => setTimeout(r, 15));
|
|
613
|
-
continue;
|
|
603
|
+
const deadline = Date.now() + waitBudgetMs;
|
|
604
|
+
for (;;) {
|
|
605
|
+
if (Date.now() >= deadline) {
|
|
606
|
+
logger.warn("[notifyd] gave up acquiring the daemon lock — unverifiable live holder");
|
|
607
|
+
return false;
|
|
614
608
|
}
|
|
615
|
-
return true;
|
|
616
|
-
} catch (e) {
|
|
617
|
-
if (e.code !== "EEXIST") throw e;
|
|
618
|
-
const raw = await readFile(daemonLockOwnerPath(), "utf8").catch(() => "");
|
|
619
|
-
const now = Date.now();
|
|
620
|
-
let owner = null;
|
|
621
609
|
try {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
610
|
+
await mkdir(daemonLockDir(), { recursive: false });
|
|
611
|
+
daemonStartedAt = Date.now();
|
|
612
|
+
daemonToken = randomUUID();
|
|
613
|
+
daemonOsStart = osProcessStartToken(process.pid);
|
|
614
|
+
if (!await writeOwner()) {
|
|
615
|
+
await rm(daemonLockDir(), {
|
|
616
|
+
recursive: true,
|
|
617
|
+
force: true
|
|
618
|
+
}).catch(() => {});
|
|
619
|
+
await new Promise((r) => setTimeout(r, 15));
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
622
|
+
return true;
|
|
623
|
+
} catch (e) {
|
|
624
|
+
if (e.code !== "EEXIST") throw e;
|
|
625
|
+
const raw = await readFile(daemonLockOwnerPath(), "utf8").catch(() => "");
|
|
626
|
+
const now = Date.now();
|
|
627
|
+
let owner = null;
|
|
628
|
+
try {
|
|
629
|
+
owner = JSON.parse(raw);
|
|
630
|
+
} catch {}
|
|
631
|
+
const recycled = owner && typeof owner.pid === "number" && owner.pid > 0 ? osStartTokenMismatch(owner.os_start, osProcessStartToken(owner.pid)) : false;
|
|
632
|
+
if (owner && typeof owner.pid === "number" && owner.pid > 0 && owner.pid !== process.pid && typeof owner.ts === "number" && now - owner.ts <= OWNER_TTL_MS && isAlive(owner.pid) && !recycled) return false;
|
|
633
|
+
const lockAgeMs = now - await stat(daemonLockDir()).then((s) => s.mtimeMs).catch(() => now);
|
|
634
|
+
if (recycled || shouldStealLock(raw, now, {
|
|
635
|
+
staleMs: OWNER_TTL_MS,
|
|
636
|
+
lockAgeMs,
|
|
637
|
+
selfPid: process.pid,
|
|
638
|
+
isAlive
|
|
639
|
+
})) {
|
|
640
|
+
await rm(daemonLockDir(), {
|
|
641
|
+
recursive: true,
|
|
642
|
+
force: true
|
|
643
|
+
}).catch(() => {});
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
await new Promise((r) => setTimeout(r, 15));
|
|
638
647
|
}
|
|
639
|
-
await new Promise((r) => setTimeout(r, 15));
|
|
640
648
|
}
|
|
641
649
|
}
|
|
642
650
|
/**
|
|
@@ -863,4 +871,4 @@ async function ensureDaemon() {
|
|
|
863
871
|
|
|
864
872
|
//#endregion
|
|
865
873
|
export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
|
|
866
|
-
//# sourceMappingURL=notifyDaemon-
|
|
874
|
+
//# sourceMappingURL=notifyDaemon-Q3FF-WEZ.js.map
|
|
@@ -338,7 +338,7 @@ async function isParentWatching(parentWrapperPid, parentAgentPid, selfAgentPid,
|
|
|
338
338
|
logger.debug("[parent-ping] watcher lookup failed:", error);
|
|
339
339
|
}
|
|
340
340
|
try {
|
|
341
|
-
const { lastReadAt, READ_WINDOW_MS } = await import("./subcommands-
|
|
341
|
+
const { lastReadAt, READ_WINDOW_MS } = await import("./subcommands-CJBV06rg.js");
|
|
342
342
|
const last = await lastReadAt(`agent:${parentAgentPid}`, selfAgentPid);
|
|
343
343
|
if (last !== null && now - last <= READ_WINDOW_MS) return true;
|
|
344
344
|
} catch (error) {
|
|
@@ -466,4 +466,4 @@ function startParentPingLoop(opts) {
|
|
|
466
466
|
|
|
467
467
|
//#endregion
|
|
468
468
|
export { startParentPingLoop };
|
|
469
|
-
//# sourceMappingURL=parentPingLoop-
|
|
469
|
+
//# sourceMappingURL=parentPingLoop-Dc7co5D7.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as getInstalledPackage, n as compareVersions } from "./versionChecker-
|
|
1
|
+
import { i as getInstalledPackage, n as compareVersions } from "./versionChecker-CWCN4vwm.js";
|
|
2
2
|
import { execFileSync } from "child_process";
|
|
3
3
|
import { existsSync, mkdirSync, readdirSync, rmSync, statSync, unlinkSync } from "fs";
|
|
4
4
|
import { chmod, copyFile } from "fs/promises";
|
|
@@ -310,4 +310,4 @@ async function getRustBinary(options = {}) {
|
|
|
310
310
|
|
|
311
311
|
//#endregion
|
|
312
312
|
export { gcOldBinaryDirs as a, getDownloadUrl as c, findTrayLauncher as i, getRustBinary as l, findRustBinary as n, getBinDir as o, findSpawnHiddenLauncher as r, getBinaryName as s, downloadBinary as t };
|
|
313
|
-
//# sourceMappingURL=rustBinary-
|
|
313
|
+
//# sourceMappingURL=rustBinary-B57oRftk.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./versionChecker-
|
|
2
|
-
import { a as gcOldBinaryDirs, c as getDownloadUrl, i as findTrayLauncher, l as getRustBinary, n as findRustBinary, o as getBinDir, r as findSpawnHiddenLauncher, s as getBinaryName, t as downloadBinary } from "./rustBinary-
|
|
1
|
+
import "./versionChecker-CWCN4vwm.js";
|
|
2
|
+
import { a as gcOldBinaryDirs, c as getDownloadUrl, i as findTrayLauncher, l as getRustBinary, n as findRustBinary, o as getBinDir, r as findSpawnHiddenLauncher, s as getBinaryName, t as downloadBinary } from "./rustBinary-B57oRftk.js";
|
|
3
3
|
|
|
4
4
|
export { gcOldBinaryDirs };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./versionChecker-
|
|
3
|
-
import "./ts-
|
|
2
|
+
import "./versionChecker-CWCN4vwm.js";
|
|
3
|
+
import "./ts-CSp4mJ7Z.js";
|
|
4
4
|
import "./todoAutomation-CbVVS4re.js";
|
|
5
5
|
import "./JsonlStore-BqF7AQ6E.js";
|
|
6
6
|
import "./globalPidIndex-DoaKEUkO.js";
|
|
7
7
|
import "./pidStore-B73xnAeT.js";
|
|
8
8
|
import "./messageLog-DdjBNqgt.js";
|
|
9
9
|
import "./todoStore-DF6vxHgV.js";
|
|
10
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-
|
|
10
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BlgVWZrM.js";
|
|
11
11
|
import { f as resolveSpawnCwd } from "./workspaceConfig-DTvPtr5j.js";
|
|
12
12
|
import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-CipjIwfO.js";
|
|
13
13
|
import { createHash } from "node:crypto";
|
|
@@ -154,4 +154,4 @@ async function cmdSchedule(rest) {
|
|
|
154
154
|
|
|
155
155
|
//#endregion
|
|
156
156
|
export { cmdSchedule };
|
|
157
|
-
//# sourceMappingURL=schedule-
|
|
157
|
+
//# sourceMappingURL=schedule-pim0Izhs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import { i as getInstalledPackage } from "./versionChecker-
|
|
3
|
-
import { r as findSpawnHiddenLauncher } from "./rustBinary-
|
|
4
|
-
import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-
|
|
2
|
+
import { i as getInstalledPackage } from "./versionChecker-CWCN4vwm.js";
|
|
3
|
+
import { r as findSpawnHiddenLauncher } from "./rustBinary-B57oRftk.js";
|
|
4
|
+
import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-CSp4mJ7Z.js";
|
|
5
5
|
import { t as agentYesHome$1 } from "./agentYesHome-BNtn19J4.js";
|
|
6
6
|
import { u as removeControlCharacters } from "./todoAutomation-CbVVS4re.js";
|
|
7
7
|
import "./JsonlStore-BqF7AQ6E.js";
|
|
@@ -12,19 +12,19 @@ import { t as pgidForWrapper } from "./reaper-UimuuTfO.js";
|
|
|
12
12
|
import "./todoStore-DF6vxHgV.js";
|
|
13
13
|
import "./e2e-z1xpwSAg.js";
|
|
14
14
|
import "./configShared-DKTgiz7K.js";
|
|
15
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-
|
|
16
|
-
import { D as listRecords, F as recentReadEdges, I as renderLogTailLines, L as renderRawLog, M as readNotes, N as readPtysize, P as recentMessageEdges, Q as TYPING_BADGE, R as renderRawLogLines, W as snapshotStatus, X as writeToIpc, Z as withIpcLock, c as controlCodeFromName, d as deriveLiveStatus, f as extractBadges, h as extractTaskCounts, j as readLogForRender, m as extractNeedsInput, w as isUserTyping, z as resolveOne } from "./subcommands-
|
|
15
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BlgVWZrM.js";
|
|
16
|
+
import { D as listRecords, F as recentReadEdges, I as renderLogTailLines, L as renderRawLog, M as readNotes, N as readPtysize, P as recentMessageEdges, Q as TYPING_BADGE, R as renderRawLogLines, W as snapshotStatus, X as writeToIpc, Z as withIpcLock, c as controlCodeFromName, d as deriveLiveStatus, f as extractBadges, h as extractTaskCounts, j as readLogForRender, m as extractNeedsInput, w as isUserTyping, z as resolveOne } from "./subcommands-CWDqhKQe.js";
|
|
17
17
|
import { c as isTransientLockMkdirError } from "./notifyStore-2SWKGwZI.js";
|
|
18
18
|
import "./webrtcLink-DLaJfTcB.js";
|
|
19
19
|
import "./remotes-BjsglpjL.js";
|
|
20
20
|
import { i as frameVisitorMessage, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-Bl2gGcxg.js";
|
|
21
|
-
import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-
|
|
21
|
+
import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-Bbplrsbv.js";
|
|
22
22
|
import { n as sampleTrees } from "./procStats-CyD8h5nx.js";
|
|
23
23
|
import { a as getProvisionRoot, d as isProvisionAllowed, f as resolveSpawnCwd, i as getProvisionHook, l as hasProvisionHook, o as getSpawnHook, t as allowsSkipPermissions, u as hasSpawnHook } from "./workspaceConfig-DTvPtr5j.js";
|
|
24
24
|
import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-CipjIwfO.js";
|
|
25
|
-
import { i as importProvisionModule } from "./ws-
|
|
25
|
+
import { i as importProvisionModule } from "./ws-B5Qb2c-1.js";
|
|
26
26
|
import { r as spawnRejectionReason } from "./spawnGate-B26UnzqP.js";
|
|
27
|
-
import { i as launchTray } from "./trayApp-
|
|
27
|
+
import { i as launchTray } from "./trayApp-DuZBkGl_.js";
|
|
28
28
|
import yargs from "yargs";
|
|
29
29
|
import { appendFile, mkdir, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "fs/promises";
|
|
30
30
|
import { arch, cpus, freemem, homedir, hostname, loadavg, platform, totalmem, uptime, userInfo } from "os";
|
|
@@ -2582,7 +2582,7 @@ Options:
|
|
|
2582
2582
|
}
|
|
2583
2583
|
});
|
|
2584
2584
|
if (req.method === "GET" && p === "/api/ws") {
|
|
2585
|
-
const ws = await import("./ws-
|
|
2585
|
+
const ws = await import("./ws-CyO9r4jx.js");
|
|
2586
2586
|
try {
|
|
2587
2587
|
await ws.loadProvision();
|
|
2588
2588
|
} catch (e) {
|
|
@@ -2602,7 +2602,7 @@ Options:
|
|
|
2602
2602
|
if (req.method === "GET" && p === "/api/ws/status") {
|
|
2603
2603
|
const dirRaw = url.searchParams.get("path");
|
|
2604
2604
|
if (!dirRaw) return new Response("missing ?path=<workspace dir>", { status: 400 });
|
|
2605
|
-
const ws = await import("./ws-
|
|
2605
|
+
const ws = await import("./ws-CyO9r4jx.js");
|
|
2606
2606
|
let prov;
|
|
2607
2607
|
try {
|
|
2608
2608
|
prov = await ws.loadProvision();
|
|
@@ -2624,7 +2624,7 @@ Options:
|
|
|
2624
2624
|
}
|
|
2625
2625
|
}
|
|
2626
2626
|
if (req.method === "GET" && p === "/api/ws/repos") {
|
|
2627
|
-
const ws = await import("./ws-
|
|
2627
|
+
const ws = await import("./ws-CyO9r4jx.js");
|
|
2628
2628
|
try {
|
|
2629
2629
|
await ws.loadProvision();
|
|
2630
2630
|
} catch (e) {
|
|
@@ -2705,7 +2705,7 @@ Options:
|
|
|
2705
2705
|
const m = /^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)$/.exec(repoParam);
|
|
2706
2706
|
if (!m || m[1] === "." || m[1] === ".." || m[2] === "." || m[2] === "..") return new Response("missing/invalid ?repo=<owner>/<repo>", { status: 400 });
|
|
2707
2707
|
const [, owner, repo] = m;
|
|
2708
|
-
const ws = await import("./ws-
|
|
2708
|
+
const ws = await import("./ws-CyO9r4jx.js");
|
|
2709
2709
|
let prov;
|
|
2710
2710
|
try {
|
|
2711
2711
|
prov = await ws.loadProvision();
|
|
@@ -3616,7 +3616,7 @@ Options:
|
|
|
3616
3616
|
const perm = body.perm ?? "r";
|
|
3617
3617
|
if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
|
|
3618
3618
|
try {
|
|
3619
|
-
const { createScopedShare } = await import("./agentShare-
|
|
3619
|
+
const { createScopedShare } = await import("./agentShare-Cm15-dfZ.js");
|
|
3620
3620
|
const share = await createScopedShare({
|
|
3621
3621
|
agent: body.agent,
|
|
3622
3622
|
perm,
|
|
@@ -3631,12 +3631,12 @@ Options:
|
|
|
3631
3631
|
}
|
|
3632
3632
|
}
|
|
3633
3633
|
if (req.method === "GET" && p === "/api/shares") {
|
|
3634
|
-
const { listShares } = await import("./agentShare-
|
|
3634
|
+
const { listShares } = await import("./agentShare-Cm15-dfZ.js");
|
|
3635
3635
|
return Response.json(listShares());
|
|
3636
3636
|
}
|
|
3637
3637
|
const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
|
|
3638
3638
|
if (req.method === "DELETE" && revokeM) {
|
|
3639
|
-
const { revokeShare } = await import("./agentShare-
|
|
3639
|
+
const { revokeShare } = await import("./agentShare-Cm15-dfZ.js");
|
|
3640
3640
|
const ok = revokeShare(decodeURIComponent(revokeM[1]));
|
|
3641
3641
|
return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
|
|
3642
3642
|
}
|
|
@@ -3942,7 +3942,7 @@ Options:
|
|
|
3942
3942
|
const shutdown = (resolve) => {
|
|
3943
3943
|
if (heartbeat) clearInterval(heartbeat);
|
|
3944
3944
|
closeShare?.();
|
|
3945
|
-
import("./agentShare-
|
|
3945
|
+
import("./agentShare-Cm15-dfZ.js").then((m) => m.revokeAllShares()).catch(() => {});
|
|
3946
3946
|
server?.stop();
|
|
3947
3947
|
Promise.resolve(releaseHostLock?.()).catch(() => {}).then(resolve);
|
|
3948
3948
|
};
|
|
@@ -3955,4 +3955,4 @@ Options:
|
|
|
3955
3955
|
|
|
3956
3956
|
//#endregion
|
|
3957
3957
|
export { cmdServe, loadTokenReadOnly, mintScopedTermToken, resolveDaemonHttpBase, resolveLocalServeUrl };
|
|
3958
|
-
//# sourceMappingURL=serve-
|
|
3958
|
+
//# sourceMappingURL=serve-CMsvjqPU.js.map
|
|
@@ -40,7 +40,7 @@ async function cmdSetup(rest) {
|
|
|
40
40
|
} catch {}
|
|
41
41
|
if (noShare) return 0;
|
|
42
42
|
process.stdout.write(`\nsharing this machine to agent-yes.com…\n`);
|
|
43
|
-
const { cmdServe } = await import("./serve-
|
|
43
|
+
const { cmdServe } = await import("./serve-CMsvjqPU.js");
|
|
44
44
|
return cmdServe([
|
|
45
45
|
"install",
|
|
46
46
|
"--share",
|
|
@@ -50,4 +50,4 @@ async function cmdSetup(rest) {
|
|
|
50
50
|
|
|
51
51
|
//#endregion
|
|
52
52
|
export { cmdSetup };
|
|
53
|
-
//# sourceMappingURL=setup-
|
|
53
|
+
//# sourceMappingURL=setup-BmxYINCx.js.map
|
|
@@ -3,7 +3,7 @@ import "./globalPidIndex-DoaKEUkO.js";
|
|
|
3
3
|
import "./messageLog-DdjBNqgt.js";
|
|
4
4
|
import "./e2e-z1xpwSAg.js";
|
|
5
5
|
import "./configShared-DKTgiz7K.js";
|
|
6
|
-
import { A as readAgentPtysize, B as resolveReadWindow, C as isUnknownManagerToken, D as listRecords, E as lastStdinAt, F as recentReadEdges, G as stdinActivityPath, H as restartHintLines, I as renderLogTailLines, J as waitForLogQuiet, K as stopTipForCli, L as renderRawLog, M as readNotes, N as readPtysize, O as matchKeyword, P as recentMessageEdges, R as renderRawLogLines, S as isSubcommand, T as lastReadAt, U as runSubcommand, V as resolveResumeArgs, W as snapshotStatus, X as writeToIpc, Y as writeKeysPaced, _ as isAgentStuck, a as TYPING_WINDOW_MS, b as isPidAlive, c as controlCodeFromName, d as deriveLiveStatus, f as extractBadges, g as finalizedLines, h as extractTaskCounts, i as READ_WINDOW_MS, j as readLogForRender, k as menuSelectKeys, l as cursorAbs, m as extractNeedsInput, n as MAX_RENDER_BYTES, o as backoffWhileTyping, p as extractMenu, q as submitAndConfirm, r as READ_PAGE_DEFAULT, s as cmdHelp, t as GRACEFUL_EXIT_COMMANDS, u as deriveLiveState, v as isBareManagerInvocation, w as isUserTyping, x as isSlashCommand, y as isExitRequest, z as resolveOne } from "./subcommands-
|
|
6
|
+
import { A as readAgentPtysize, B as resolveReadWindow, C as isUnknownManagerToken, D as listRecords, E as lastStdinAt, F as recentReadEdges, G as stdinActivityPath, H as restartHintLines, I as renderLogTailLines, J as waitForLogQuiet, K as stopTipForCli, L as renderRawLog, M as readNotes, N as readPtysize, O as matchKeyword, P as recentMessageEdges, R as renderRawLogLines, S as isSubcommand, T as lastReadAt, U as runSubcommand, V as resolveResumeArgs, W as snapshotStatus, X as writeToIpc, Y as writeKeysPaced, _ as isAgentStuck, a as TYPING_WINDOW_MS, b as isPidAlive, c as controlCodeFromName, d as deriveLiveStatus, f as extractBadges, g as finalizedLines, h as extractTaskCounts, i as READ_WINDOW_MS, j as readLogForRender, k as menuSelectKeys, l as cursorAbs, m as extractNeedsInput, n as MAX_RENDER_BYTES, o as backoffWhileTyping, p as extractMenu, q as submitAndConfirm, r as READ_PAGE_DEFAULT, s as cmdHelp, t as GRACEFUL_EXIT_COMMANDS, u as deriveLiveState, v as isBareManagerInvocation, w as isUserTyping, x as isSlashCommand, y as isExitRequest, z as resolveOne } from "./subcommands-CWDqhKQe.js";
|
|
7
7
|
import "./notifyStore-2SWKGwZI.js";
|
|
8
8
|
import "./webrtcLink-DLaJfTcB.js";
|
|
9
9
|
import "./remotes-BjsglpjL.js";
|
|
@@ -906,7 +906,7 @@ async function runSubcommand(argv) {
|
|
|
906
906
|
switch (sub) {
|
|
907
907
|
case "ls":
|
|
908
908
|
case "list": return await cmdLs(rest);
|
|
909
|
-
case "ps": return await (await import("./cmdPs-
|
|
909
|
+
case "ps": return await (await import("./cmdPs-BYBZQ0Vc.js")).cmdPs(rest);
|
|
910
910
|
case "status": return await cmdStatus(rest);
|
|
911
911
|
case "whoami": return await cmdWhoami(rest);
|
|
912
912
|
case "result": return await cmdResult(rest);
|
|
@@ -953,35 +953,35 @@ async function runSubcommand(argv) {
|
|
|
953
953
|
return cmdCh(rest);
|
|
954
954
|
}
|
|
955
955
|
case "term": {
|
|
956
|
-
const { cmdTerm } = await import("./terminal-
|
|
956
|
+
const { cmdTerm } = await import("./terminal-CcmBzB3G.js");
|
|
957
957
|
return cmdTerm(rest);
|
|
958
958
|
}
|
|
959
959
|
case "widget": {
|
|
960
|
-
const { cmdWidget } = await import("./widget-
|
|
960
|
+
const { cmdWidget } = await import("./widget-D2cCC8nz.js");
|
|
961
961
|
return cmdWidget(rest);
|
|
962
962
|
}
|
|
963
963
|
case "mint": {
|
|
964
|
-
const { cmdMint } = await import("./widget-
|
|
964
|
+
const { cmdMint } = await import("./widget-D2cCC8nz.js");
|
|
965
965
|
return cmdMint(rest);
|
|
966
966
|
}
|
|
967
967
|
case "serve": {
|
|
968
|
-
const { cmdServe } = await import("./serve-
|
|
968
|
+
const { cmdServe } = await import("./serve-CMsvjqPU.js");
|
|
969
969
|
return cmdServe(rest);
|
|
970
970
|
}
|
|
971
971
|
case "tray": {
|
|
972
|
-
const { cmdTray } = await import("./trayApp-
|
|
972
|
+
const { cmdTray } = await import("./trayApp-BovAZs7m.js");
|
|
973
973
|
return cmdTray(rest);
|
|
974
974
|
}
|
|
975
975
|
case "setup": {
|
|
976
|
-
const { cmdSetup } = await import("./setup-
|
|
976
|
+
const { cmdSetup } = await import("./setup-BmxYINCx.js");
|
|
977
977
|
return cmdSetup(rest);
|
|
978
978
|
}
|
|
979
979
|
case "ws": {
|
|
980
|
-
const { cmdWs } = await import("./ws-
|
|
980
|
+
const { cmdWs } = await import("./ws-CyO9r4jx.js");
|
|
981
981
|
return cmdWs(rest);
|
|
982
982
|
}
|
|
983
983
|
case "schedule": {
|
|
984
|
-
const { cmdSchedule } = await import("./schedule-
|
|
984
|
+
const { cmdSchedule } = await import("./schedule-pim0Izhs.js");
|
|
985
985
|
return cmdSchedule(rest);
|
|
986
986
|
}
|
|
987
987
|
case "remote": {
|
|
@@ -993,7 +993,7 @@ async function runSubcommand(argv) {
|
|
|
993
993
|
return cmdExpose(rest);
|
|
994
994
|
}
|
|
995
995
|
case "callback": {
|
|
996
|
-
const { cmdCallback } = await import("./callback-
|
|
996
|
+
const { cmdCallback } = await import("./callback-Dwnkeqpz.js");
|
|
997
997
|
return cmdCallback(rest);
|
|
998
998
|
}
|
|
999
999
|
case "reap":
|
|
@@ -1004,7 +1004,7 @@ async function runSubcommand(argv) {
|
|
|
1004
1004
|
return await cmdDsh(rest);
|
|
1005
1005
|
}
|
|
1006
1006
|
case "gc": {
|
|
1007
|
-
const { gcOldBinaryDirs } = await import("./rustBinary-
|
|
1007
|
+
const { gcOldBinaryDirs } = await import("./rustBinary-Dq0AytZ7.js");
|
|
1008
1008
|
const res = gcOldBinaryDirs();
|
|
1009
1009
|
if (res.removed.length === 0) process.stdout.write("no old agent-yes binary cache dirs to remove\n");
|
|
1010
1010
|
else {
|
|
@@ -3481,7 +3481,7 @@ async function cmdAttach(rest) {
|
|
|
3481
3481
|
const winsizeDir = path.join(ayHome, "winsize");
|
|
3482
3482
|
await mkdir(winsizeDir, { recursive: true });
|
|
3483
3483
|
const winsizePath = path.join(winsizeDir, String(record.pid));
|
|
3484
|
-
const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve-
|
|
3484
|
+
const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve-CMsvjqPU.js");
|
|
3485
3485
|
const daemonBase = await resolveDaemonHttpBase().catch(() => null);
|
|
3486
3486
|
const daemonToken = daemonBase ? await loadTokenReadOnly().catch(() => null) ?? "" : "";
|
|
3487
3487
|
const capViewer = `attach:${process.pid}`;
|
|
@@ -4199,7 +4199,7 @@ async function cmdNotify(rest) {
|
|
|
4199
4199
|
}
|
|
4200
4200
|
const ensure = async () => {
|
|
4201
4201
|
if (!argv["ensure-daemon"]) return;
|
|
4202
|
-
const { ensureDaemon } = await import("./notifyDaemon-
|
|
4202
|
+
const { ensureDaemon } = await import("./notifyDaemon-Q3FF-WEZ.js");
|
|
4203
4203
|
await ensureDaemon().catch(() => null);
|
|
4204
4204
|
};
|
|
4205
4205
|
await heartbeatWatcher(parent, selfStartedAt);
|
|
@@ -4273,7 +4273,7 @@ async function cmdNotifyCursor(args) {
|
|
|
4273
4273
|
}
|
|
4274
4274
|
async function cmdNotifyd(rest) {
|
|
4275
4275
|
const sub = rest[0] ?? "status";
|
|
4276
|
-
const daemon = await import("./notifyDaemon-
|
|
4276
|
+
const daemon = await import("./notifyDaemon-Q3FF-WEZ.js");
|
|
4277
4277
|
switch (sub) {
|
|
4278
4278
|
case "run": return daemon.runDaemon();
|
|
4279
4279
|
case "once": return daemon.runDaemon({ once: true });
|
|
@@ -4300,4 +4300,4 @@ async function cmdNotifyd(rest) {
|
|
|
4300
4300
|
|
|
4301
4301
|
//#endregion
|
|
4302
4302
|
export { buildAgentForest as $, readAgentPtysize as A, resolveReadWindow as B, isUnknownManagerToken as C, listRecords as D, lastStdinAt as E, recentReadEdges as F, stdinActivityPath as G, restartHintLines as H, renderLogTailLines as I, waitForLogQuiet as J, stopTipForCli as K, renderRawLog as L, readNotes as M, readPtysize as N, matchKeyword as O, recentMessageEdges as P, TYPING_BADGE as Q, renderRawLogLines as R, isSubcommand as S, lastReadAt as T, runSubcommand as U, resolveResumeArgs as V, snapshotStatus as W, writeToIpc as X, writeKeysPaced as Y, withIpcLock as Z, isAgentStuck as _, TYPING_WINDOW_MS as a, isPidAlive as b, controlCodeFromName as c, deriveLiveStatus as d, flattenForest as et, extractBadges as f, finalizedLines as g, extractTaskCounts as h, READ_WINDOW_MS as i, readLogForRender as j, menuSelectKeys as k, cursorAbs as l, extractNeedsInput as m, MAX_RENDER_BYTES as n, backoffWhileTyping as o, extractMenu as p, submitAndConfirm as q, READ_PAGE_DEFAULT as r, cmdHelp as s, GRACEFUL_EXIT_COMMANDS as t, deriveLiveState as u, isBareManagerInvocation as v, isUserTyping as w, isSlashCommand as x, isExitRequest as y, resolveOne as z };
|
|
4303
|
-
//# sourceMappingURL=subcommands-
|
|
4303
|
+
//# sourceMappingURL=subcommands-CWDqhKQe.js.map
|
|
@@ -98,7 +98,7 @@ async function cmdTermMint(args) {
|
|
|
98
98
|
if (flags.ro && flags.interactive) throw new Error("--ro and --interactive are mutually exclusive");
|
|
99
99
|
const ttlSec = parseTtlSec(typeof flags.ttl === "string" ? flags.ttl : "15m");
|
|
100
100
|
const canSend = flags.interactive === true;
|
|
101
|
-
const { mintScopedTermToken } = await import("./serve-
|
|
101
|
+
const { mintScopedTermToken } = await import("./serve-CMsvjqPU.js");
|
|
102
102
|
const r = await mintScopedTermToken(pid, {
|
|
103
103
|
ttlSec,
|
|
104
104
|
canSend
|
|
@@ -135,4 +135,4 @@ async function cmdTerm(args) {
|
|
|
135
135
|
|
|
136
136
|
//#endregion
|
|
137
137
|
export { cmdTerm };
|
|
138
|
-
//# sourceMappingURL=terminal-
|
|
138
|
+
//# sourceMappingURL=terminal-CcmBzB3G.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as findTrayLauncher } from "./rustBinary-
|
|
1
|
+
import { i as findTrayLauncher } from "./rustBinary-B57oRftk.js";
|
|
2
2
|
import { t as agentYesHome } from "./agentYesHome-BNtn19J4.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
@@ -97,4 +97,4 @@ async function cmdTray(args) {
|
|
|
97
97
|
|
|
98
98
|
//#endregion
|
|
99
99
|
export { trayHiddenMarker as a, launchTray as i, hasDesktop as n, isTrayHidden as r, cmdTray as t };
|
|
100
|
-
//# sourceMappingURL=trayApp-
|
|
100
|
+
//# sourceMappingURL=trayApp-DuZBkGl_.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __esmMin, r as __exportAll } from "./chunk-cZBX9HZv.js";
|
|
2
2
|
import { n as logger, t as addTransport } from "./logger-CDIsZ-Pp.js";
|
|
3
|
-
import { i as getInstalledPackage } from "./versionChecker-
|
|
3
|
+
import { i as getInstalledPackage } from "./versionChecker-CWCN4vwm.js";
|
|
4
4
|
import { t as agentYesHome } from "./agentYesHome-BNtn19J4.js";
|
|
5
5
|
import { u as removeControlCharacters } from "./todoAutomation-CbVVS4re.js";
|
|
6
6
|
import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-BOIPD_Vs.js";
|
|
@@ -248,6 +248,20 @@ async function getSessionForCwd(cwd) {
|
|
|
248
248
|
* Extract session ID from codex output
|
|
249
249
|
* Session IDs are UUIDs in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
|
250
250
|
*/
|
|
251
|
+
/**
|
|
252
|
+
* True for the codex CLI and every codex-derived variant (`codex-ds`,
|
|
253
|
+
* `codex-ds-direct`, …) — they all run the same `codex` binary and print the
|
|
254
|
+
* same session-id banner, so the session capture/resume path must treat them
|
|
255
|
+
* alike. Keying those sites on an exact `=== "codex"` made `--continue` on a
|
|
256
|
+
* variant silently start a fresh session instead of resuming.
|
|
257
|
+
*
|
|
258
|
+
* The per-cwd session store is therefore shared across codex variants. That is
|
|
259
|
+
* fine: resuming re-applies the launching CLI's own `defaultArgs`, so a session
|
|
260
|
+
* resumed via `codex-ds` still talks to DeepSeek.
|
|
261
|
+
*/
|
|
262
|
+
function isCodexFamily(cli) {
|
|
263
|
+
return cli === "codex" || cli.startsWith("codex-");
|
|
264
|
+
}
|
|
251
265
|
function extractSessionId(output) {
|
|
252
266
|
const match = output.match(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/i);
|
|
253
267
|
return match ? match[0] : null;
|
|
@@ -1666,7 +1680,7 @@ async function agentYes({ cli, cliArgs = [], skipPermissions = false, prompt, ro
|
|
|
1666
1680
|
prompt = prompt ? `[${hint}]\n\n${prompt}` : hint;
|
|
1667
1681
|
}
|
|
1668
1682
|
} catch {}
|
|
1669
|
-
if (resume) if (cli
|
|
1683
|
+
if (resume) if (isCodexFamily(cli) && resume) {
|
|
1670
1684
|
const storedSessionId = await getSessionForCwd(workingDir);
|
|
1671
1685
|
if (storedSessionId) {
|
|
1672
1686
|
cliArgs = [
|
|
@@ -1905,7 +1919,7 @@ async function agentYes({ cli, cliArgs = [], skipPermissions = false, prompt, ro
|
|
|
1905
1919
|
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
1906
1920
|
}
|
|
1907
1921
|
let restoreArgs = conf.restoreArgs;
|
|
1908
|
-
if (cli
|
|
1922
|
+
if (isCodexFamily(cli)) {
|
|
1909
1923
|
const storedSessionId = await getSessionForCwd(workingDir);
|
|
1910
1924
|
if (storedSessionId) {
|
|
1911
1925
|
restoreArgs = ["resume", storedSessionId];
|
|
@@ -2057,7 +2071,7 @@ async function agentYes({ cli, cliArgs = [], skipPermissions = false, prompt, ro
|
|
|
2057
2071
|
await exitAgent();
|
|
2058
2072
|
break;
|
|
2059
2073
|
}
|
|
2060
|
-
if (cli
|
|
2074
|
+
if (isCodexFamily(cli)) {
|
|
2061
2075
|
const sessionId = extractSessionId(line);
|
|
2062
2076
|
if (sessionId) {
|
|
2063
2077
|
logger.debug(`heartbeat|session|captured session ID: ${sessionId}`);
|
|
@@ -2071,7 +2085,7 @@ async function agentYes({ cli, cliArgs = [], skipPermissions = false, prompt, ro
|
|
|
2071
2085
|
}, 100);
|
|
2072
2086
|
const cleanupHeartbeat = () => clearInterval(heartbeatInterval);
|
|
2073
2087
|
shell.onExit(cleanupHeartbeat);
|
|
2074
|
-
const { startParentPingLoop } = await import("./parentPingLoop-
|
|
2088
|
+
const { startParentPingLoop } = await import("./parentPingLoop-Dc7co5D7.js");
|
|
2075
2089
|
const parentPingLoop = startParentPingLoop({
|
|
2076
2090
|
parentPid,
|
|
2077
2091
|
selfWrapperPid: process.pid,
|
|
@@ -2283,7 +2297,7 @@ async function agentYes({ cli, cliArgs = [], skipPermissions = false, prompt, ro
|
|
|
2283
2297
|
ctx.isFatal = true;
|
|
2284
2298
|
await exitAgent();
|
|
2285
2299
|
}
|
|
2286
|
-
if (cli
|
|
2300
|
+
if (isCodexFamily(cli)) {
|
|
2287
2301
|
const sessionId = extractSessionId(line);
|
|
2288
2302
|
if (sessionId) {
|
|
2289
2303
|
logger.debug(`session|captured session ID: ${sessionId}`);
|
|
@@ -2334,4 +2348,4 @@ function sleep(ms) {
|
|
|
2334
2348
|
|
|
2335
2349
|
//#endregion
|
|
2336
2350
|
export { hasTodoStore as a, permissionBadge as c, answerAsk as i, AgentContext as l, agentYes as n, listAsks as o, config as r, listAsksForProject as s, CLIS_CONFIG as t, CLAUDE_SESSION_PIN_ENV as u };
|
|
2337
|
-
//# sourceMappingURL=ts-
|
|
2351
|
+
//# sourceMappingURL=ts-CSp4mJ7Z.js.map
|
|
@@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
|
|
|
7
7
|
|
|
8
8
|
//#region package.json
|
|
9
9
|
var name = "agent-yes";
|
|
10
|
-
var version = "1.
|
|
10
|
+
var version = "1.289.0";
|
|
11
11
|
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region ts/versionChecker.ts
|
|
@@ -215,4 +215,4 @@ async function displayVersion() {
|
|
|
215
215
|
|
|
216
216
|
//#endregion
|
|
217
217
|
export { versionString as a, getInstalledPackage as i, compareVersions as n, displayVersion as r, checkAndAutoUpdate as t };
|
|
218
|
-
//# sourceMappingURL=versionChecker-
|
|
218
|
+
//# sourceMappingURL=versionChecker-CWCN4vwm.js.map
|
|
@@ -28,7 +28,7 @@ function parseFlags(args, known) {
|
|
|
28
28
|
}
|
|
29
29
|
/** Resolve the local daemon base URL + token (flags override discovery). */
|
|
30
30
|
async function daemonTarget(flags) {
|
|
31
|
-
const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve-
|
|
31
|
+
const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve-CMsvjqPU.js");
|
|
32
32
|
const base = typeof flags.base === "string" ? flags.base : await resolveDaemonHttpBase();
|
|
33
33
|
if (!base) throw new Error("no running ay serve daemon found — start `ay serve` or pass --base <url> (e.g. http://127.0.0.1:PORT)");
|
|
34
34
|
const token = typeof flags.token === "string" ? flags.token : await loadTokenReadOnly() ?? "";
|
|
@@ -186,7 +186,7 @@ async function cmdMint(args) {
|
|
|
186
186
|
const bad = caps.filter((c) => !KNOWN_CAPS.has(c));
|
|
187
187
|
if (bad.length) throw new Error(`unknown cap(s): ${bad.join(", ")} (valid: ${[...KNOWN_CAPS].join(", ")})`);
|
|
188
188
|
const ttlSec = parseTtlSec(typeof flags.ttl === "string" ? flags.ttl : "15m");
|
|
189
|
-
const { mintScopedTermToken } = await import("./serve-
|
|
189
|
+
const { mintScopedTermToken } = await import("./serve-CMsvjqPU.js");
|
|
190
190
|
const r = await mintScopedTermToken(target, {
|
|
191
191
|
ttlSec,
|
|
192
192
|
caps
|
|
@@ -202,4 +202,4 @@ async function cmdMint(args) {
|
|
|
202
202
|
|
|
203
203
|
//#endregion
|
|
204
204
|
export { cmdMint, cmdWidget };
|
|
205
|
-
//# sourceMappingURL=widget-
|
|
205
|
+
//# sourceMappingURL=widget-D2cCC8nz.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as listRecords } from "./subcommands-
|
|
1
|
+
import { D as listRecords } from "./subcommands-CWDqhKQe.js";
|
|
2
2
|
import { a as getProvisionRoot } from "./workspaceConfig-DTvPtr5j.js";
|
|
3
3
|
import { existsSync } from "fs";
|
|
4
4
|
import { lstat, opendir } from "fs/promises";
|
|
@@ -424,4 +424,4 @@ async function cmdWs(args) {
|
|
|
424
424
|
|
|
425
425
|
//#endregion
|
|
426
426
|
export { isPathInside as a, walkWorkspaces as c, importProvisionModule as i, workspaceStatus as l, cmdWs as n, loadProvision as o, collectWorkspaces as r, resolveOperand as s, WS_JSON_SCHEMA as t };
|
|
427
|
-
//# sourceMappingURL=ws-
|
|
427
|
+
//# sourceMappingURL=ws-B5Qb2c-1.js.map
|
|
@@ -3,10 +3,10 @@ import "./globalPidIndex-DoaKEUkO.js";
|
|
|
3
3
|
import "./messageLog-DdjBNqgt.js";
|
|
4
4
|
import "./e2e-z1xpwSAg.js";
|
|
5
5
|
import "./configShared-DKTgiz7K.js";
|
|
6
|
-
import "./subcommands-
|
|
6
|
+
import "./subcommands-CWDqhKQe.js";
|
|
7
7
|
import "./notifyStore-2SWKGwZI.js";
|
|
8
8
|
import "./webrtcLink-DLaJfTcB.js";
|
|
9
9
|
import "./remotes-BjsglpjL.js";
|
|
10
|
-
import { a as isPathInside, c as walkWorkspaces, i as importProvisionModule, l as workspaceStatus, n as cmdWs, o as loadProvision, r as collectWorkspaces, s as resolveOperand, t as WS_JSON_SCHEMA } from "./ws-
|
|
10
|
+
import { a as isPathInside, c as walkWorkspaces, i as importProvisionModule, l as workspaceStatus, n as cmdWs, o as loadProvision, r as collectWorkspaces, s as resolveOperand, t as WS_JSON_SCHEMA } from "./ws-B5Qb2c-1.js";
|
|
11
11
|
|
|
12
12
|
export { WS_JSON_SCHEMA, cmdWs, collectWorkspaces, isPathInside, loadProvision, walkWorkspaces, workspaceStatus };
|
package/package.json
CHANGED
package/ts/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { agentYesHome } from "./agentYesHome.ts";
|
|
|
10
10
|
import {
|
|
11
11
|
extractSessionId,
|
|
12
12
|
getSessionForCwd,
|
|
13
|
+
isCodexFamily,
|
|
13
14
|
storeSessionForCwd,
|
|
14
15
|
} from "./resume/codexSessionManager.ts";
|
|
15
16
|
import pty, { ptyPackage } from "./pty.ts";
|
|
@@ -435,7 +436,7 @@ export default async function agentYes({
|
|
|
435
436
|
|
|
436
437
|
// Handle --continue flag for codex session restoration
|
|
437
438
|
if (resume) {
|
|
438
|
-
if (cli
|
|
439
|
+
if (isCodexFamily(cli) && resume) {
|
|
439
440
|
// Try to get stored session for this directory
|
|
440
441
|
const storedSessionId = await getSessionForCwd(workingDir);
|
|
441
442
|
if (storedSessionId) {
|
|
@@ -827,7 +828,7 @@ export default async function agentYes({
|
|
|
827
828
|
|
|
828
829
|
// For codex, try to use stored session ID for this directory
|
|
829
830
|
let restoreArgs = conf.restoreArgs;
|
|
830
|
-
if (cli
|
|
831
|
+
if (isCodexFamily(cli)) {
|
|
831
832
|
const storedSessionId = await getSessionForCwd(workingDir);
|
|
832
833
|
if (storedSessionId) {
|
|
833
834
|
// Use specific session ID instead of --last
|
|
@@ -1060,7 +1061,7 @@ export default async function agentYes({
|
|
|
1060
1061
|
}
|
|
1061
1062
|
|
|
1062
1063
|
// session ID capture for codex
|
|
1063
|
-
if (cli
|
|
1064
|
+
if (isCodexFamily(cli)) {
|
|
1064
1065
|
const sessionId = extractSessionId(line);
|
|
1065
1066
|
if (sessionId) {
|
|
1066
1067
|
logger.debug(`heartbeat|session|captured session ID: ${sessionId}`);
|
|
@@ -1447,7 +1448,7 @@ export default async function agentYes({
|
|
|
1447
1448
|
}
|
|
1448
1449
|
|
|
1449
1450
|
// session ID capture for codex
|
|
1450
|
-
if (cli
|
|
1451
|
+
if (isCodexFamily(cli)) {
|
|
1451
1452
|
const sessionId = extractSessionId(line);
|
|
1452
1453
|
if (sessionId) {
|
|
1453
1454
|
logger.debug(`session|captured session ID: ${sessionId}`);
|
package/ts/notifyDaemon.spec.ts
CHANGED
|
@@ -72,6 +72,22 @@ describe("notifyd singleton lock", () => {
|
|
|
72
72
|
expect(await acquireDaemonLock((pid) => pid === 424242)).toBe(true);
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
+
it("GIVES UP (bounded, not a 15ms busy-wait) when the owner is OUR OWN pid, live and fresh", async () => {
|
|
76
|
+
// The pathological spin: pid reuse hands us the SAME pid a prior daemon held.
|
|
77
|
+
// With no os_start to prove the disagreement, the decline check skips
|
|
78
|
+
// (owner.pid === process.pid) AND the shared steal decision refuses (pid is
|
|
79
|
+
// "self" → not dead; ts fresh → not stale). Before the wait bound this looped
|
|
80
|
+
// at 15ms forever; now it must decline within the budget instead of spinning.
|
|
81
|
+
await mkdir(daemonLockDir(), { recursive: true });
|
|
82
|
+
await writeFile(
|
|
83
|
+
daemonLockOwnerPath(),
|
|
84
|
+
JSON.stringify({ pid: process.pid, started_at: 1, ts: Date.now() }),
|
|
85
|
+
);
|
|
86
|
+
const t0 = Date.now();
|
|
87
|
+
expect(await acquireDaemonLock(() => true, 80)).toBe(false); // bounded decline
|
|
88
|
+
expect(Date.now() - t0).toBeLessThan(2000);
|
|
89
|
+
});
|
|
90
|
+
|
|
75
91
|
it("eventually steals a torn owner, but only AFTER the grace (no double daemon)", async () => {
|
|
76
92
|
// A torn owner is also the mkdir→writeOwner window of a concurrent daemon
|
|
77
93
|
// start, so it is respected within the grace (~1s) and stolen only past it —
|
package/ts/notifyDaemon.ts
CHANGED
|
@@ -258,6 +258,18 @@ export interface DaemonOptions {
|
|
|
258
258
|
// the pid+started_at re-check before SIGTERM).
|
|
259
259
|
const OWNER_TTL_MS = 30_000;
|
|
260
260
|
|
|
261
|
+
// Hard upper bound on how long a contender may wait for the singleton lock. The
|
|
262
|
+
// decline and steal predicates are SUPPOSED to be exhaustive, but they are not
|
|
263
|
+
// complements: a valid owner whose pid equals OUR OWN pid (pid reuse — a prior
|
|
264
|
+
// daemon died and the OS handed us the same pid, with no os_start recorded to
|
|
265
|
+
// prove the disagreement) is skipped by the decline check (`owner.pid !==
|
|
266
|
+
// process.pid`) yet also refused by the shared steal decision (its pid is "self",
|
|
267
|
+
// so not dead; its ts is fresh, so not stale). Without a bound that residue spins
|
|
268
|
+
// at 15ms forever, burning a whole core. Bounded well above the torn-owner grace
|
|
269
|
+
// (~1s) and well below the heartbeat TTL (30s), so a live holder is never waited
|
|
270
|
+
// out to staleness — we decline promptly instead and the next watch poll retries.
|
|
271
|
+
const LOCK_WAIT_BUDGET_MS = 5000;
|
|
272
|
+
|
|
261
273
|
export interface DaemonIdentity {
|
|
262
274
|
pid: number;
|
|
263
275
|
started_at: number;
|
|
@@ -333,11 +345,21 @@ async function writeOwner(): Promise<boolean> {
|
|
|
333
345
|
*/
|
|
334
346
|
export async function acquireDaemonLock(
|
|
335
347
|
isAlive: (pid: number) => boolean = isPidAlive,
|
|
348
|
+
waitBudgetMs: number = LOCK_WAIT_BUDGET_MS,
|
|
336
349
|
): Promise<boolean> {
|
|
337
350
|
// The lock dir lives under notify/ — ensure that exists first, else mkdir of
|
|
338
351
|
// the lock throws ENOENT which must NOT be mistaken for "someone holds it".
|
|
339
352
|
await mkdir(notifyDir(), { recursive: true }).catch(() => {});
|
|
353
|
+
const deadline = Date.now() + waitBudgetMs;
|
|
340
354
|
for (;;) {
|
|
355
|
+
// Never busy-wait without bound. Every iteration must end in acquire,
|
|
356
|
+
// decline, or steal; if the identity is so split that NEITHER decline nor
|
|
357
|
+
// steal applies (see LOCK_WAIT_BUDGET_MS), give up and decline rather than
|
|
358
|
+
// spin at 15ms indefinitely — the next watch poll re-ensures the daemon.
|
|
359
|
+
if (Date.now() >= deadline) {
|
|
360
|
+
logger.warn("[notifyd] gave up acquiring the daemon lock — unverifiable live holder");
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
341
363
|
try {
|
|
342
364
|
await mkdir(daemonLockDir(), { recursive: false });
|
|
343
365
|
daemonStartedAt = Date.now(); // fixed for this daemon's lifetime
|
package/dist/trayApp-DDWTl8KU.js
DELETED