agent-yes 1.307.0 → 1.308.0-beta.822.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 (123) hide show
  1. package/README.md +53 -0
  2. package/dist/{JsonlStore-CB_0sfdT.js → JsonlStore-fEAVg5aY.js} +1 -1
  3. package/dist/{SUPPORTED_CLIS-qL9_2DZ8.js → SUPPORTED_CLIS-BLYnkdXU.js} +2 -2
  4. package/dist/SUPPORTED_CLIS-g2a7NXfV.js +12 -0
  5. package/dist/agent-yes.config-ByXwI-t3.js +47 -0
  6. package/dist/agentPermissions-CgM1bl6m.js +62 -0
  7. package/dist/{agentShare-C2oXrGvf.js → agentShare-CPbuzX6_.js} +14 -14
  8. package/dist/{askCli-D4czi-_j.js → askCli-BjQOqpvv.js} +6 -6
  9. package/dist/{browser-BW90gl2w.js → browser-BzjhscIR.js} +5 -5
  10. package/dist/{browser-BAFPmEvN.js → browser-CU933aYj.js} +1 -1
  11. package/dist/callback-BrUPWfzC.js +17 -0
  12. package/dist/{callback-ie8yyKma.js → callback-mlc8fh_F.js} +5 -5
  13. package/dist/{callbackCore-Deve5pv3.js → callbackCore-DoPrLOFY.js} +1 -1
  14. package/dist/{callbackCore-BZ_10zyc.js → callbackCore-TE7HjQm9.js} +1 -1
  15. package/dist/{channels-jIa5fNjY.js → channels-BGSdyeQs.js} +2 -2
  16. package/dist/{channels-Y36S0ccW.js → channels-bw-b9z0l.js} +6 -6
  17. package/dist/channels.js +5 -5
  18. package/dist/claude-DLN2dvVD.js +180 -0
  19. package/dist/cli.js +60 -15
  20. package/dist/{cmdDsh-DZ8bLsH7.js → cmdDsh-h7V2ThH5.js} +1 -1
  21. package/dist/{cmdKill-DUyZ7Dch.js → cmdKill-b5I7H8wx.js} +5 -5
  22. package/dist/{cmdPs-CfR5qCiO.js → cmdPs-BkQcgpMm.js} +14 -14
  23. package/dist/{agent-yes.config-CRfpdp3A.js → configLoader-CLSX_LND.js} +4 -42
  24. package/dist/configLoader-D9O9zwKR.js +5 -0
  25. package/dist/{configShared-De4bR5hH.js → configShared-B9gyn11R.js} +1 -1
  26. package/dist/{cwdConflictWarn-ml6Qs3Qu.js → cwdConflictWarn-BQ8vH915.js} +2 -2
  27. package/dist/{cwdPassthroughHint-CzWh0hrw.js → cwdPassthroughHint-h4dQQCLO.js} +1 -1
  28. package/dist/detach-B_n7xRl2.js +58 -0
  29. package/dist/{e2e-BdLf8DvY.js → e2e-C34A1uYu.js} +1 -1
  30. package/dist/{expose-Bhsn5yUz.js → expose-BKxcKYt-.js} +1 -1
  31. package/dist/{forceKill-BDqxx4uQ.js → forceKill-BAqKNR_f.js} +2 -2
  32. package/dist/{forkNested-DHuYbpaf.js → forkNested-CVSWfZT6.js} +3 -3
  33. package/dist/{globalPidIndex-DmDCB_X7.js → globalPidIndex-B5c_g_yJ.js} +1 -1
  34. package/dist/{globalPidIndex-C6p_AY4D.js → globalPidIndex-D9fxq9Ad.js} +10 -2
  35. package/dist/{hist-DY16wm7g.js → hist-OSUKO8sb.js} +1 -1
  36. package/dist/{html2canvas-pro.esm-Dp-JZojz.js → html2canvas-pro.esm-BW1GOcB-.js} +1 -1
  37. package/dist/{identity-D3hr59eC.js → identity-BVHHqtvP.js} +1 -1
  38. package/dist/{identity-puvd7hVQ.js → identity-CtwRW1nD.js} +1 -1
  39. package/dist/index.js +8 -8
  40. package/dist/{initMsg-GPU52N-j.js → initMsg-C1tgHfYP.js} +1 -1
  41. package/dist/{initMsg-BEVDWYnv.js → initMsg-CkrZjsX-.js} +1 -1
  42. package/dist/launch-BlKMU2ZA.js +74 -0
  43. package/dist/launch-CMran68t.js +3 -0
  44. package/dist/{messageLog-CEqe4Hk1.js → messageLog-BrXNxItW.js} +1 -1
  45. package/dist/{needsInput-hRiWFjGy.js → needsInput-B3aPVSqs.js} +1 -1
  46. package/dist/{nodeRuntime-DGMQRTGT.js → nodeRuntime-B1nCglgu.js} +1 -1
  47. package/dist/{notifyDaemon-DcAbvP43.js → notifyDaemon-B3cBxf0e.js} +13 -13
  48. package/dist/{notifyStore-C4pH_-zJ.js → notifyStore-B7DLD83Q.js} +1 -1
  49. package/dist/{notifyStore-DIfkfKB2.js → notifyStore-CNdHlJyW.js} +1 -1
  50. package/dist/{openBrowser-CQAOIrD6.js → openBrowser-CwhGNBhv.js} +1 -1
  51. package/dist/oxmgrService-C0nYf9CD.js +3 -0
  52. package/dist/{oxmgrService-DlYHmqyI.js → oxmgrService-CBlFJ_-C.js} +2 -2
  53. package/dist/{parentLink-UiM6WoKm.js → parentLink-C2gocHk9.js} +2 -2
  54. package/dist/{parentLink-B7_kEM1v.js → parentLink-EVI_0cLu.js} +2 -2
  55. package/dist/{parentPingLoop-BYT4XgfN.js → parentPingLoop-oxshq8c_.js} +7 -7
  56. package/dist/peer-BSZQbKB7.js +4 -0
  57. package/dist/{peer-L-prov9t.js → peer-DI_xxui8.js} +3 -3
  58. package/dist/pidStore-BRU1Q0uN.js +6 -0
  59. package/dist/{pidStore-DUXifdBr.js → pidStore-DXEbQrh-.js} +3 -3
  60. package/dist/{procStats-DwTxj3rs.js → procStats-CkzFrwx7.js} +1 -1
  61. package/dist/{reaper-DsZhX5FH.js → reaper-A_eEjMxS.js} +1 -1
  62. package/dist/{reaper-C2cuougX.js → reaper-BTfq0-5j.js} +1 -1
  63. package/dist/{remotes-CAZymHd7.js → remotes-B0vw-dsd.js} +3 -3
  64. package/dist/{remotes-W6NhMDfP.js → remotes-TKXkCV76.js} +3 -3
  65. package/dist/roomReplyAlias-0xfUQlda.js +6 -0
  66. package/dist/{roomReplyAlias-B1EJft2d.js → roomReplyAlias-CkfEtW2v.js} +3 -3
  67. package/dist/runner-B1vocYOj.js +371 -0
  68. package/dist/{runningLock-DMznYh45.js → runningLock-DaVbNt4d.js} +1 -1
  69. package/dist/{rustBinary-BjsZbiv5.js → rustBinary-BBXMvUrh.js} +2 -2
  70. package/dist/{rustBinary-CXQGcJEm.js → rustBinary-BVXl0jO1.js} +2 -2
  71. package/dist/{schedule-zacFV53l.js → schedule-CCd72rUL.js} +15 -15
  72. package/dist/{schedules-BvwTGXU2.js → schedules-D6hZ7VpJ.js} +1 -1
  73. package/dist/{schedulesCli-Donh0LS2.js → schedulesCli-DSBZwREE.js} +3 -3
  74. package/dist/{senderAncestry-KhAUPCQs.js → senderAncestry-Brb-cYni.js} +1 -1
  75. package/dist/{senderAncestry-CVHeKk1Y.js → senderAncestry-DqbNIecg.js} +1 -1
  76. package/dist/{serve-C38WYmzz.js → serve-BDAWlqju.js} +52 -51
  77. package/dist/{serveRust-76_apYb8.js → serveRust-B50JWdfK.js} +3 -3
  78. package/dist/{setup-CeAisuhv.js → setup-BdYFzMCF.js} +4 -4
  79. package/dist/{share-_TPYAGWC.js → share-CPtJgXt2.js} +2 -2
  80. package/dist/{share-CbFetL5H.js → share-zVt71n2g.js} +2 -2
  81. package/dist/{shareCmd-foO5MbJp.js → shareCmd-DlRaowh5.js} +10 -10
  82. package/dist/{spawnGate-nUrmf4dd.js → spawnGate-BkkT7GF2.js} +3 -3
  83. package/dist/spawnGate-Ky21E51l.js +5 -0
  84. package/dist/{store-xmBpqPUq.js → store-MjCqeJDI.js} +1 -1
  85. package/dist/{subcommands-DE31Tfv_.js → subcommands-AMenIpoC.js} +455 -124
  86. package/dist/{subcommands-DLQEC24N.js → subcommands-CsXAU4nP.js} +12 -12
  87. package/dist/{systemPathLink-DI9WdoqQ.js → systemPathLink-BQE53HED.js} +1 -1
  88. package/dist/{terminal-CBbp6PfB.js → terminal-szkWLu0B.js} +2 -2
  89. package/dist/terminal.js +1 -1
  90. package/dist/{todoAutomation-CKlrxuZv.js → todoAutomation-KgmnTAsD.js} +2 -2
  91. package/dist/{todoCli-BllShFnc.js → todoCli-ammnk6Wv.js} +6 -6
  92. package/dist/{todoIdentity-DeDp7LKl.js → todoIdentity-DzjduXlF.js} +2 -2
  93. package/dist/{todoStore-msRCEUi1.js → todoStore-Dre3Yhwt.js} +2 -2
  94. package/dist/{tray-RIjHSw7z.js → tray-C4sCiT8B.js} +2 -2
  95. package/dist/trayApp-BHDsVzNR.js +5 -0
  96. package/dist/{trayApp-C9SZOPpw.js → trayApp-D5mTwcU2.js} +2 -2
  97. package/dist/{ts-CO1H1P2R.js → ts-Cw3tcySd.js} +20 -79
  98. package/dist/{versionChecker-CG--tQsV.js → versionChecker-BUTz22Z5.js} +2 -2
  99. package/dist/{webrtcLink-WxS1nTIs.js → webrtcLink-CGCXjlQJ.js} +2 -2
  100. package/dist/{webrtcLink-DcvacEci.js → webrtcLink-D4pMhyvY.js} +2 -2
  101. package/dist/{webrtcRemote-B4pwES4i.js → webrtcRemote-DdCC3aZC.js} +3 -3
  102. package/dist/{widget-CI7BtN94.js → widget-VjNw0i_9.js} +3 -3
  103. package/dist/widget.js +1 -1
  104. package/dist/widgets.js +5 -5
  105. package/dist/{workspaceConfig-DjEklzxf.js → workspaceConfig-BmK6COFt.js} +1 -1
  106. package/dist/ws-COWlU1P2.js +16 -0
  107. package/dist/{ws-DLJSBws6.js → ws-XExAsRus.js} +3 -3
  108. package/package.json +2 -2
  109. package/ts/cli.ts +40 -1
  110. package/ts/globalPidIndex.ts +19 -2
  111. package/ts/parseCliArgs.spec.ts +10 -0
  112. package/ts/parseCliArgs.ts +22 -0
  113. package/ts/subcommands.spec.ts +2 -2
  114. package/ts/subcommands.ts +186 -13
  115. package/dist/SUPPORTED_CLIS-BOGmmIrH.js +0 -12
  116. package/dist/callback-CNL-PGwh.js +0 -17
  117. package/dist/oxmgrService-o9L3I6FX.js +0 -3
  118. package/dist/peer-3F7owPWt.js +0 -4
  119. package/dist/pidStore-B89BOF_T.js +0 -6
  120. package/dist/roomReplyAlias-BeGVkAlc.js +0 -6
  121. package/dist/spawnGate-DhPgMs0Y.js +0 -5
  122. package/dist/trayApp-BSOmax2E.js +0 -5
  123. package/dist/ws-W5nWHjDt.js +0 -16
package/README.md CHANGED
@@ -712,3 +712,56 @@ be committed.
712
712
  ## License
713
713
 
714
714
  MIT
715
+
716
+ ### Claude stream sessions (preview)
717
+
718
+ PTY remains the default. When Claude's own arguments request
719
+ `--output-format stream-json`, `ay` detects the protocol, records `mode: "stream"`,
720
+ and captures NDJSON through pipes in the TypeScript runtime. It does not add
721
+ stream flags to a native invocation:
722
+
723
+ ```sh
724
+ ay claude -p --input-format stream-json --output-format stream-json --verbose --replay-user-messages -- "task"
725
+ ```
726
+
727
+ `ay --stream claude "task"` is optional shorthand that appends those native
728
+ flags (and the stdio permission protocol). There is no config transport default.
729
+ Output-only stream invocations are also captured; bidirectional sends require
730
+ explicit `--input-format stream-json --replay-user-messages`.
731
+
732
+ Each session writes normalized `<pid>.events.jsonl`, original `<pid>.native.jsonl`,
733
+ and a readable `<pid>.raw.log` under the working directory's `.agent-yes/`.
734
+ Stream capture currently requires macOS or Linux. `ay --detach claude ...` starts a
735
+ background TypeScript wrapper and prints its registered CLI pid.
736
+ Permission requests are recorded; use an explicit Claude permission policy for
737
+ unattended sessions until approval commands are available.
738
+
739
+ For stream sessions, `ay status` and `ay ls --watch` derive state from events.
740
+ Permission requests and questions appear as `needs_input`; protocol errors appear
741
+ as `stuck`. `ay ls` shows the latest reported cumulative session cost in `COST`
742
+ (and `cost_usd` in JSON), with `-` when cost is unavailable.
743
+
744
+ `ay send <pid> "message"` sends one JSON line and returns success only after
745
+ Claude echoes that message's unique ID. Bodies are sent verbatim; sender provenance
746
+ stays in mailbox history rather than adding reply instructions to the task. `--interrupt` sends Claude's native
747
+ interrupt request before the new message. Receipt timeouts report an uncertain
748
+ outcome and never retry automatically. Stream sessions require receipts, so
749
+ `--no-wait` and terminal control codes are not supported. `ay tail`, including
750
+ follow and `--until`, reads the transcript without terminal wrapping.
751
+
752
+ A local preview executable such as `aysj` can forward arguments unchanged to a
753
+ worktree build. It behaves exactly like `ay`, including the PTY default; its name
754
+ does not enable stream capture.
755
+
756
+ Native stream flags also work after the wrapper separator, for example
757
+ `ay --detach claude -- -p --input-format stream-json --output-format stream-json --verbose --replay-user-messages --model haiku "task"`.
758
+ The initial stream task is passed verbatim, without PTY init-message envelopes.
759
+ The registry mirrors active/idle turn transitions, and event files preserve stream
760
+ identity when an older registry writer drops the transport field.
761
+
762
+ Successful CLI exit also cleans up its detached process group, including remaining
763
+ descendants that inherited the output pipes.
764
+
765
+ `ay status` uses the same normalized stream state and pending question as `ay ls`,
766
+ including permission requests. Output-only native stream invocations forward piped
767
+ stdin unchanged and preserve EOF; they do not convert text input into JSON messages.
@@ -185,4 +185,4 @@ function generateId() {
185
185
 
186
186
  //#endregion
187
187
  export { JsonlStore as t };
188
- //# sourceMappingURL=JsonlStore-CB_0sfdT.js.map
188
+ //# sourceMappingURL=JsonlStore-fEAVg5aY.js.map
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-CO1H1P2R.js";
1
+ import { t as CLIS_CONFIG } from "./ts-Cw3tcySd.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-qL9_2DZ8.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-BLYnkdXU.js.map
@@ -0,0 +1,12 @@
1
+ import "./logger-CDIsZ-Pp.js";
2
+ import "./versionChecker-BUTz22Z5.js";
3
+ import "./ts-Cw3tcySd.js";
4
+ import "./todoAutomation-KgmnTAsD.js";
5
+ import "./JsonlStore-fEAVg5aY.js";
6
+ import "./globalPidIndex-D9fxq9Ad.js";
7
+ import "./pidStore-DXEbQrh-.js";
8
+ import "./messageLog-BrXNxItW.js";
9
+ import "./todoStore-Dre3Yhwt.js";
10
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BLYnkdXU.js";
11
+
12
+ export { SUPPORTED_CLIS };
@@ -0,0 +1,47 @@
1
+ import { n as logger } from "./logger-CDIsZ-Pp.js";
2
+ import { t as loadSharedCliDefaults } from "./configShared-B9gyn11R.js";
3
+ import { n as loadCascadingConfig, r as deepMixin, t as ensureSchemaInConfigFiles } from "./configLoader-CLSX_LND.js";
4
+ import path from "node:path";
5
+ import os from "node:os";
6
+ import { mkdir } from "node:fs/promises";
7
+
8
+ //#region ts/defineConfig.ts
9
+ async function defineCliYesConfig(cfg) {
10
+ if (typeof cfg === "function") cfg = await cfg({ clis: {} });
11
+ return cfg;
12
+ }
13
+
14
+ //#endregion
15
+ //#region agent-yes.config.ts
16
+ logger.debug("loading cli-yes.config.ts from " + import.meta.url);
17
+ ensureSchemaInConfigFiles().catch(() => {});
18
+ const configDir = await (async () => {
19
+ const homeConfigDir = path.resolve(os.homedir(), ".agent-yes");
20
+ if (await mkdir(homeConfigDir, { recursive: true }).then(() => true).catch(() => false)) {
21
+ logger.debug("[config] Using home directory:", homeConfigDir);
22
+ return homeConfigDir;
23
+ }
24
+ const tmpConfigDir = path.resolve("/tmp/.agent-yes");
25
+ if (await mkdir(tmpConfigDir, { recursive: true })) {
26
+ logger.debug("[config] Using workspace directory:", tmpConfigDir);
27
+ return tmpConfigDir;
28
+ }
29
+ })();
30
+ const cascadingConfig = await loadCascadingConfig();
31
+ const legacyConfigs = await Promise.all([
32
+ import(path.resolve(os.homedir(), ".agent-yes/config.ts")).catch(() => ({ default: {} })).then((mod) => mod.default),
33
+ import(path.resolve(process.cwd(), "node_modules/.agent-yes/config.ts")).catch(() => ({ default: {} })).then((mod) => mod.default),
34
+ import(path.resolve(process.cwd(), ".agent-yes/config.ts")).catch(() => ({ default: {} })).then((mod) => mod.default)
35
+ ]);
36
+ var agent_yes_config_default = deepMixin(await getDefaultConfig(), cascadingConfig, ...legacyConfigs);
37
+ async function getDefaultConfig() {
38
+ return defineCliYesConfig({
39
+ configDir,
40
+ logsDir: configDir && path.resolve(configDir, "logs"),
41
+ clis: await loadSharedCliDefaults(import.meta.url)
42
+ });
43
+ }
44
+
45
+ //#endregion
46
+ export { agent_yes_config_default as default };
47
+ //# sourceMappingURL=agent-yes.config-ByXwI-t3.js.map
@@ -0,0 +1,62 @@
1
+ //#region ts/sessionEnv.ts
2
+ const CLAUDE_SESSION_PIN_ENV = [
3
+ "CLAUDECODE",
4
+ "CLAUDE_CODE_SSE_PORT",
5
+ "CLAUDE_CODE_SESSION_ID",
6
+ "CLAUDE_CODE_CHILD_SESSION",
7
+ "CLAUDE_CODE_ENTRYPOINT"
8
+ ];
9
+ /** Delete the parent Claude Code session-pin vars from a mutable env map, in
10
+ * place. Idempotent (a no-op when they're already absent, e.g. a console spawn
11
+ * whose env came from freshAgentEnv). Returns the same object for chaining. */
12
+ function stripClaudeSessionPin(env) {
13
+ for (const k of CLAUDE_SESSION_PIN_ENV) delete env[k];
14
+ return env;
15
+ }
16
+
17
+ //#endregion
18
+ //#region ts/agentPermissions.ts
19
+ /**
20
+ * Flags that disable a CLI's confirmation gate, recognised regardless of what
21
+ * `yesArgs` the config declares.
22
+ *
23
+ * The configured `yesArgs` are the flags `-y` APPENDS; a user is free to pass
24
+ * the same flag directly, and a config that omits `yesArgs` entirely (some CLIs
25
+ * deliberately have none) must not make a genuinely dangerous flag invisible.
26
+ * So the check is the union: configured flags OR any of these.
27
+ */
28
+ const DANGEROUS_FLAGS = new Set([
29
+ "--dangerously-skip-permissions",
30
+ "--dangerously-bypass-approvals-and-sandbox",
31
+ "--yolo",
32
+ "--full-auto"
33
+ ]);
34
+ /** `--flag=value` and `--flag value` must compare equal — match on the flag part. */
35
+ function flagName(arg) {
36
+ const eq = arg.indexOf("=");
37
+ return eq === -1 ? arg : arg.slice(0, eq);
38
+ }
39
+ function derivePermissions(opts) {
40
+ const configured = new Set((opts.yesArgs ?? []).map(flagName).filter(Boolean));
41
+ return {
42
+ skip_permissions: opts.cliArgs.some((a) => {
43
+ const name = flagName(a);
44
+ return configured.has(name) || DANGEROUS_FLAGS.has(name);
45
+ }),
46
+ robust: Boolean(opts.robust),
47
+ auto_continue: Boolean(opts.autoContinue)
48
+ };
49
+ }
50
+ /**
51
+ * One-word posture for a badge. `skip` is the only one that changes what the
52
+ * agent is ALLOWED to do; the wrapper flags change only how it recovers, so
53
+ * they never soften the label.
54
+ */
55
+ function permissionBadge(p) {
56
+ if (!p) return null;
57
+ return p.skip_permissions ? "skip" : "prompt";
58
+ }
59
+
60
+ //#endregion
61
+ export { stripClaudeSessionPin as i, permissionBadge as n, CLAUDE_SESSION_PIN_ENV as r, derivePermissions as t };
62
+ //# sourceMappingURL=agentPermissions-CgM1bl6m.js.map
@@ -1,17 +1,17 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./JsonlStore-CB_0sfdT.js";
3
- import "./globalPidIndex-C6p_AY4D.js";
4
- import "./pidStore-DUXifdBr.js";
5
- import "./messageLog-CEqe4Hk1.js";
6
- import "./e2e-BdLf8DvY.js";
7
- import "./configShared-De4bR5hH.js";
8
- import { ot as resolveOne } from "./subcommands-DE31Tfv_.js";
9
- import "./webrtcLink-DcvacEci.js";
10
- import "./remotes-CAZymHd7.js";
11
- import "./roomReplyAlias-B1EJft2d.js";
12
- import "./notifyStore-DIfkfKB2.js";
13
- import "./senderAncestry-CVHeKk1Y.js";
14
- import { l as startShare } from "./share-CbFetL5H.js";
2
+ import "./JsonlStore-fEAVg5aY.js";
3
+ import "./globalPidIndex-D9fxq9Ad.js";
4
+ import "./pidStore-DXEbQrh-.js";
5
+ import "./messageLog-BrXNxItW.js";
6
+ import "./e2e-C34A1uYu.js";
7
+ import "./configShared-B9gyn11R.js";
8
+ import { ot as resolveOne } from "./subcommands-AMenIpoC.js";
9
+ import "./webrtcLink-D4pMhyvY.js";
10
+ import "./remotes-B0vw-dsd.js";
11
+ import "./roomReplyAlias-CkfEtW2v.js";
12
+ import "./notifyStore-CNdHlJyW.js";
13
+ import "./senderAncestry-DqbNIecg.js";
14
+ import { l as startShare } from "./share-zVt71n2g.js";
15
15
 
16
16
  //#region ts/agentShare.ts
17
17
  const MAX_SHARES = 8;
@@ -234,4 +234,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
234
234
 
235
235
  //#endregion
236
236
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
237
- //# sourceMappingURL=agentShare-C2oXrGvf.js.map
237
+ //# sourceMappingURL=agentShare-CPbuzX6_.js.map
@@ -1,9 +1,9 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./JsonlStore-CB_0sfdT.js";
3
- import "./globalPidIndex-C6p_AY4D.js";
4
- import { r as openStore } from "./todoStore-msRCEUi1.js";
5
- import { t as formatIdentity } from "./identity-puvd7hVQ.js";
6
- import { a as resolveTodoRoot, i as resolveSelf } from "./todoIdentity-DeDp7LKl.js";
2
+ import "./JsonlStore-fEAVg5aY.js";
3
+ import "./globalPidIndex-D9fxq9Ad.js";
4
+ import { r as openStore } from "./todoStore-Dre3Yhwt.js";
5
+ import { t as formatIdentity } from "./identity-CtwRW1nD.js";
6
+ import { a as resolveTodoRoot, i as resolveSelf } from "./todoIdentity-DzjduXlF.js";
7
7
  import yargs from "yargs";
8
8
  import { randomBytes } from "crypto";
9
9
 
@@ -269,4 +269,4 @@ async function runAnswerSubcommand(rest, deps) {
269
269
 
270
270
  //#endregion
271
271
  export { runAnswerSubcommand, runAskSubcommand };
272
- //# sourceMappingURL=askCli-D4czi-_j.js.map
272
+ //# sourceMappingURL=askCli-BjQOqpvv.js.map
@@ -1,7 +1,7 @@
1
- import { d as randomHex } from "./e2e-BdLf8DvY.js";
2
- import { d as parseChannelLink, f as secretFromTopic, o as deriveChannelId, s as deriveRoom } from "./channels-jIa5fNjY.js";
3
- import { a as renderThread, c as makeOp, f as hlcSend, n as maxHlc, o as sortOps, r as mergeOps, s as isValidOp } from "./store-xmBpqPUq.js";
4
- import { t as ChannelPeer } from "./peer-L-prov9t.js";
1
+ import { d as randomHex } from "./e2e-C34A1uYu.js";
2
+ import { d as parseChannelLink, f as secretFromTopic, o as deriveChannelId, s as deriveRoom } from "./channels-BGSdyeQs.js";
3
+ import { a as renderThread, c as makeOp, f as hlcSend, n as maxHlc, o as sortOps, r as mergeOps, s as isValidOp } from "./store-MjCqeJDI.js";
4
+ import { t as ChannelPeer } from "./peer-DI_xxui8.js";
5
5
 
6
6
  //#region ts/channels/store.browser.ts
7
7
  const PREFIX = "ay29ch:";
@@ -308,4 +308,4 @@ const WIDGET_HTML = `
308
308
 
309
309
  //#endregion
310
310
  export { AyChannel as t };
311
- //# sourceMappingURL=browser-BW90gl2w.js.map
311
+ //# sourceMappingURL=browser-BzjhscIR.js.map
@@ -13566,4 +13566,4 @@ const XTERM_CSS = `
13566
13566
 
13567
13567
  //#endregion
13568
13568
  export { AyTerminal as t };
13569
- //# sourceMappingURL=browser-BAFPmEvN.js.map
13569
+ //# sourceMappingURL=browser-CU933aYj.js.map
@@ -0,0 +1,17 @@
1
+ import "./logger-CDIsZ-Pp.js";
2
+ import "./JsonlStore-fEAVg5aY.js";
3
+ import "./globalPidIndex-D9fxq9Ad.js";
4
+ import "./pidStore-DXEbQrh-.js";
5
+ import "./messageLog-BrXNxItW.js";
6
+ import "./e2e-C34A1uYu.js";
7
+ import "./configShared-B9gyn11R.js";
8
+ import "./subcommands-AMenIpoC.js";
9
+ import "./webrtcLink-D4pMhyvY.js";
10
+ import "./remotes-B0vw-dsd.js";
11
+ import "./roomReplyAlias-CkfEtW2v.js";
12
+ import "./notifyStore-CNdHlJyW.js";
13
+ import "./senderAncestry-DqbNIecg.js";
14
+ import "./callbackCore-DoPrLOFY.js";
15
+ import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-mlc8fh_F.js";
16
+
17
+ export { cmdCallback };
@@ -1,6 +1,6 @@
1
1
  import { t as agentYesHome } from "./agentYesHome-JmJC28YX.js";
2
- import { ot as resolveOne } from "./subcommands-DE31Tfv_.js";
3
- import { a as mintCapability, o as parseExpires } from "./callbackCore-Deve5pv3.js";
2
+ import { ot as resolveOne } from "./subcommands-AMenIpoC.js";
3
+ import { a as mintCapability, o as parseExpires } from "./callbackCore-DoPrLOFY.js";
4
4
  import { chmodSync, readFileSync, renameSync, writeFileSync } from "node:fs";
5
5
  import path from "node:path";
6
6
  import { randomBytes } from "node:crypto";
@@ -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-C38WYmzz.js");
75
+ const { resolveLocalServeUrl } = await import("./serve-BDAWlqju.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-BZ_10zyc.js");
173
+ const { buildSnippet } = await import("./callbackCore-TE7HjQm9.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-ie8yyKma.js.map
190
+ //# sourceMappingURL=callback-mlc8fh_F.js.map
@@ -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-Deve5pv3.js.map
143
+ //# sourceMappingURL=callbackCore-DoPrLOFY.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-Deve5pv3.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-DoPrLOFY.js";
2
2
 
3
3
  export { buildSnippet };
@@ -1,4 +1,4 @@
1
- import { m as validateS, u as parseSecret } from "./e2e-BdLf8DvY.js";
1
+ import { m as validateS, u as parseSecret } from "./e2e-C34A1uYu.js";
2
2
 
3
3
  //#region ts/channels/link.ts
4
4
  const CH_DEFAULT_SIGHOST = "s.agent-yes.com";
@@ -134,4 +134,4 @@ function formatUntrustedInbound(op, opts) {
134
134
 
135
135
  //#endregion
136
136
  export { CH_DEFAULT_SIGHOST as a, formatChannelLink as c, parseChannelLink as d, secretFromTopic as f, parseCmd as i, formatChannelWebLink as l, isActionableCmd as n, deriveChannelId as o, isEphemeral as r, deriveRoom as s, formatUntrustedInbound as t, isChannelLink as u };
137
- //# sourceMappingURL=channels-jIa5fNjY.js.map
137
+ //# sourceMappingURL=channels-BGSdyeQs.js.map
@@ -1,6 +1,6 @@
1
- import "./e2e-BdLf8DvY.js";
2
- import { c as formatChannelLink, d as parseChannelLink, f as secretFromTopic, l as formatChannelWebLink, o as deriveChannelId, s as deriveRoom, u as isChannelLink } from "./channels-jIa5fNjY.js";
3
- import { a as renderThread, c as makeOp, f as hlcSend, n as maxHlc, o as sortOps, r as mergeOps, s as isValidOp } from "./store-xmBpqPUq.js";
1
+ import "./e2e-C34A1uYu.js";
2
+ import { c as formatChannelLink, d as parseChannelLink, f as secretFromTopic, l as formatChannelWebLink, o as deriveChannelId, s as deriveRoom, u as isChannelLink } from "./channels-BGSdyeQs.js";
3
+ import { a as renderThread, c as makeOp, f as hlcSend, n as maxHlc, o as sortOps, r as mergeOps, s as isValidOp } from "./store-MjCqeJDI.js";
4
4
  import { appendFile, chmod, mkdir, readFile, rm, writeFile } from "fs/promises";
5
5
  import os from "os";
6
6
  import path from "path";
@@ -386,8 +386,8 @@ function printOp(op) {
386
386
  * `extraStdin` (pipe mode) drives it. Returns the started peer + a stop fn.
387
387
  */
388
388
  async function runMesh(cwd, entry, opts) {
389
- const { ChannelPeer } = await import("./peer-3F7owPWt.js");
390
- const { importRTC, getIceServers } = await import("./share-_TPYAGWC.js");
389
+ const { ChannelPeer } = await import("./peer-BSZQbKB7.js");
390
+ const { importRTC, getIceServers } = await import("./share-CPtJgXt2.js");
391
391
  const rtc = await importRTC();
392
392
  const seen = new Set((await readOps(cwd, entry.channelId)).map((o) => o.id));
393
393
  const peer = new ChannelPeer({
@@ -567,4 +567,4 @@ async function cmdCh(args) {
567
567
 
568
568
  //#endregion
569
569
  export { cmdCh };
570
- //# sourceMappingURL=channels-Y36S0ccW.js.map
570
+ //# sourceMappingURL=channels-bw-b9z0l.js.map
package/dist/channels.js CHANGED
@@ -1,7 +1,7 @@
1
- import "./e2e-BdLf8DvY.js";
2
- import { a as CH_DEFAULT_SIGHOST, c as formatChannelLink, d as parseChannelLink, f as secretFromTopic, i as parseCmd, l as formatChannelWebLink, n as isActionableCmd, o as deriveChannelId, r as isEphemeral, s as deriveRoom, t as formatUntrustedInbound, u as isChannelLink } from "./channels-jIa5fNjY.js";
3
- import { a as renderThread, c as makeOp, d as formatHlc, f as hlcSend, i as opsMissing, l as opId, n as maxHlc, o as sortOps, p as parseHlc, r as mergeOps, s as isValidOp, t as haveVector, u as compareHlc } from "./store-xmBpqPUq.js";
4
- import "./peer-L-prov9t.js";
5
- import { t as AyChannel } from "./browser-BW90gl2w.js";
1
+ import "./e2e-C34A1uYu.js";
2
+ import { a as CH_DEFAULT_SIGHOST, c as formatChannelLink, d as parseChannelLink, f as secretFromTopic, i as parseCmd, l as formatChannelWebLink, n as isActionableCmd, o as deriveChannelId, r as isEphemeral, s as deriveRoom, t as formatUntrustedInbound, u as isChannelLink } from "./channels-BGSdyeQs.js";
3
+ import { a as renderThread, c as makeOp, d as formatHlc, f as hlcSend, i as opsMissing, l as opId, n as maxHlc, o as sortOps, p as parseHlc, r as mergeOps, s as isValidOp, t as haveVector, u as compareHlc } from "./store-MjCqeJDI.js";
4
+ import "./peer-DI_xxui8.js";
5
+ import { t as AyChannel } from "./browser-BzjhscIR.js";
6
6
 
7
7
  export { AyChannel, AyChannel as default, CH_DEFAULT_SIGHOST, compareHlc, deriveChannelId, deriveRoom, formatChannelLink, formatChannelWebLink, formatHlc, formatUntrustedInbound, haveVector, hlcSend, isActionableCmd, isChannelLink, isEphemeral, isValidOp, makeOp, maxHlc, mergeOps, opId, opsMissing, parseChannelLink, parseCmd, parseHlc, renderThread, secretFromTopic, sortOps };
@@ -0,0 +1,180 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { spawn } from "node:child_process";
3
+
4
+ //#region ts/stream/claude.ts
5
+ function userMessage(text, id = randomUUID()) {
6
+ return JSON.stringify({
7
+ type: "user",
8
+ uuid: id,
9
+ message: {
10
+ role: "user",
11
+ content: text
12
+ }
13
+ }) + "\n";
14
+ }
15
+ /** Claude's SDK stdio protocol; unknown notifications are intentionally ignored. */
16
+ var ClaudeAdapter = class {
17
+ child;
18
+ turn = 0;
19
+ active = false;
20
+ receipts = /* @__PURE__ */ new Set();
21
+ requests = /* @__PURE__ */ new Map();
22
+ spawn(opts) {
23
+ const args = [...opts.args];
24
+ if (opts.resumeId) args.push("--resume", opts.resumeId);
25
+ this.child = spawn(opts.binary ?? "claude", args, {
26
+ cwd: opts.cwd,
27
+ env: opts.env ?? process.env,
28
+ stdio: "pipe",
29
+ detached: process.platform !== "win32"
30
+ });
31
+ return this.child;
32
+ }
33
+ send(msg, id = randomUUID()) {
34
+ if (!this.child?.stdin.writable) throw new Error("Claude stream is not writable");
35
+ this.child.stdin.write(userMessage(msg, id));
36
+ return id;
37
+ }
38
+ async interrupt() {
39
+ if (!this.child?.stdin.writable) throw new Error("Claude stream is not writable");
40
+ this.child.stdin.write(JSON.stringify({
41
+ type: "control_request",
42
+ request_id: randomUUID(),
43
+ request: { subtype: "interrupt" }
44
+ }) + "\n");
45
+ }
46
+ answer(reqId, choice) {
47
+ const input = this.requests.get(reqId);
48
+ if (input === void 0) throw new Error("Unknown Claude permission request");
49
+ this.requests.delete(reqId);
50
+ this.child?.stdin.write(JSON.stringify({
51
+ type: "control_response",
52
+ response: {
53
+ subtype: "success",
54
+ request_id: reqId,
55
+ response: choice === "allow" ? {
56
+ behavior: "allow",
57
+ updatedInput: input
58
+ } : {
59
+ behavior: "deny",
60
+ message: choice
61
+ }
62
+ }
63
+ }) + "\n");
64
+ }
65
+ parse(line) {
66
+ let d;
67
+ try {
68
+ d = JSON.parse(line);
69
+ } catch {
70
+ return [{
71
+ type: "error",
72
+ message: "Invalid Claude stream JSON",
73
+ fatal: false
74
+ }];
75
+ }
76
+ if (!d || typeof d !== "object") return [];
77
+ const events = [];
78
+ const start = () => {
79
+ if (!this.active) {
80
+ this.active = true;
81
+ events.push({
82
+ type: "turn_start",
83
+ turn: ++this.turn,
84
+ ts: Date.now()
85
+ });
86
+ }
87
+ };
88
+ if (d.type === "system" && d.subtype === "init" && typeof d.session_id === "string") events.push({
89
+ type: "session",
90
+ sessionId: d.session_id,
91
+ model: d.model
92
+ });
93
+ if (d.type === "user") {
94
+ const content = d.message?.content;
95
+ const text = typeof content === "string" ? content : Array.isArray(content) ? content.filter((b) => b.type === "text").map((b) => b.text).join("\n") : "";
96
+ if (text && typeof d.uuid === "string" && !this.receipts.has(d.uuid)) {
97
+ this.receipts.add(d.uuid);
98
+ start();
99
+ events.push({
100
+ type: "user",
101
+ id: d.uuid,
102
+ text
103
+ });
104
+ }
105
+ if (Array.isArray(content)) {
106
+ for (const b of content) if (b.type === "tool_result") events.push({
107
+ type: "tool_result",
108
+ id: b.tool_use_id,
109
+ ok: !b.is_error,
110
+ summary: typeof b.content === "string" ? b.content : JSON.stringify(b.content ?? "")
111
+ });
112
+ }
113
+ }
114
+ if (d.type === "assistant" && Array.isArray(d.message?.content)) {
115
+ start();
116
+ for (const b of d.message.content) {
117
+ if (b.type === "text" && typeof b.text === "string") events.push({
118
+ type: "text",
119
+ text: b.text
120
+ });
121
+ if (b.type === "tool_use") events.push({
122
+ type: "tool_call",
123
+ id: b.id,
124
+ name: b.name,
125
+ input: b.input
126
+ });
127
+ }
128
+ if (d.error) events.push({
129
+ type: "error",
130
+ message: String(d.error),
131
+ fatal: false
132
+ });
133
+ }
134
+ if (d.type === "control_request" && d.request?.subtype === "can_use_tool") {
135
+ const r = d.request;
136
+ this.requests.set(d.request_id, r.input);
137
+ if (r.tool_name === "AskUserQuestion") {
138
+ const questions = r.input?.questions ?? [];
139
+ events.push({
140
+ type: "needs_input",
141
+ reqId: d.request_id,
142
+ question: questions.map((q) => q.question).join("\n"),
143
+ options: questions.flatMap((q) => (q.options ?? []).map((o) => o.label))
144
+ });
145
+ } else events.push({
146
+ type: "needs_permission",
147
+ reqId: d.request_id,
148
+ tool: r.tool_name,
149
+ input: r.input,
150
+ options: ["allow", "deny"]
151
+ });
152
+ }
153
+ if (d.type === "result") {
154
+ start();
155
+ events.push({
156
+ type: "turn_end",
157
+ turn: this.turn,
158
+ costUsd: typeof d.total_cost_usd === "number" ? d.total_cost_usd : void 0,
159
+ usage: d.usage ? {
160
+ inputTokens: d.usage.input_tokens ?? 0,
161
+ outputTokens: d.usage.output_tokens ?? 0,
162
+ cacheReadTokens: d.usage.cache_read_input_tokens,
163
+ cacheCreationTokens: d.usage.cache_creation_input_tokens
164
+ } : void 0,
165
+ stopReason: d.stop_reason ?? d.subtype
166
+ });
167
+ this.active = false;
168
+ if (d.is_error) events.push({
169
+ type: "error",
170
+ message: (d.errors ?? [d.result ?? d.subtype]).join("\n"),
171
+ fatal: false
172
+ });
173
+ }
174
+ return events;
175
+ }
176
+ };
177
+
178
+ //#endregion
179
+ export { userMessage as n, ClaudeAdapter as t };
180
+ //# sourceMappingURL=claude-DLN2dvVD.js.map