relaymessenger 0.1.14-staging.9 → 0.1.14

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 (142) hide show
  1. package/README.md +65 -0
  2. package/dist/acp-bridge.d.ts +131 -24
  3. package/dist/acp-bridge.d.ts.map +1 -1
  4. package/dist/acp-bridge.js +313 -33
  5. package/dist/acp-bridge.js.map +1 -1
  6. package/dist/acp-threads.d.ts.map +1 -1
  7. package/dist/acp-threads.js.map +1 -1
  8. package/dist/agent-access.d.ts +85 -0
  9. package/dist/agent-access.d.ts.map +1 -0
  10. package/dist/agent-access.js +142 -0
  11. package/dist/agent-access.js.map +1 -0
  12. package/dist/agent-create.d.ts +5 -0
  13. package/dist/agent-create.d.ts.map +1 -1
  14. package/dist/agent-create.js +14 -1
  15. package/dist/agent-create.js.map +1 -1
  16. package/dist/agent-driver.d.ts.map +1 -1
  17. package/dist/agent-driver.js.map +1 -1
  18. package/dist/agents.d.ts +7 -6
  19. package/dist/agents.d.ts.map +1 -1
  20. package/dist/agents.js +2 -1
  21. package/dist/agents.js.map +1 -1
  22. package/dist/approvals.d.ts +170 -0
  23. package/dist/approvals.d.ts.map +1 -0
  24. package/dist/approvals.js +362 -0
  25. package/dist/approvals.js.map +1 -0
  26. package/dist/bridge-turn.d.ts +36 -1
  27. package/dist/bridge-turn.d.ts.map +1 -1
  28. package/dist/bridge-turn.js +23 -2
  29. package/dist/bridge-turn.js.map +1 -1
  30. package/dist/clack-theme.d.ts.map +1 -1
  31. package/dist/clack-theme.js.map +1 -1
  32. package/dist/claude-bridge.d.ts +83 -8
  33. package/dist/claude-bridge.d.ts.map +1 -1
  34. package/dist/claude-bridge.js +158 -17
  35. package/dist/claude-bridge.js.map +1 -1
  36. package/dist/claude-channel.d.ts.map +1 -1
  37. package/dist/claude-channel.js.map +1 -1
  38. package/dist/claude-threads.d.ts.map +1 -1
  39. package/dist/claude-threads.js.map +1 -1
  40. package/dist/client.d.ts.map +1 -1
  41. package/dist/client.js.map +1 -1
  42. package/dist/codex-bridge.d.ts +172 -21
  43. package/dist/codex-bridge.d.ts.map +1 -1
  44. package/dist/codex-bridge.js +302 -43
  45. package/dist/codex-bridge.js.map +1 -1
  46. package/dist/codex-threads.d.ts.map +1 -1
  47. package/dist/codex-threads.js.map +1 -1
  48. package/dist/coding-agents/claude-code.d.ts.map +1 -1
  49. package/dist/coding-agents/cline.d.ts +11 -1
  50. package/dist/coding-agents/cline.d.ts.map +1 -1
  51. package/dist/coding-agents/cline.js +29 -3
  52. package/dist/coding-agents/cline.js.map +1 -1
  53. package/dist/coding-agents/codex-project-config.d.ts +9 -8
  54. package/dist/coding-agents/codex-project-config.d.ts.map +1 -1
  55. package/dist/coding-agents/codex-project-config.js +4 -7
  56. package/dist/coding-agents/codex-project-config.js.map +1 -1
  57. package/dist/coding-agents/codex.d.ts.map +1 -1
  58. package/dist/coding-agents/codex.js +6 -2
  59. package/dist/coding-agents/codex.js.map +1 -1
  60. package/dist/coding-agents/cursor.d.ts.map +1 -1
  61. package/dist/coding-agents/gemini-cli.d.ts.map +1 -1
  62. package/dist/coding-agents/gemini-cli.js +10 -1
  63. package/dist/coding-agents/gemini-cli.js.map +1 -1
  64. package/dist/coding-agents/hermes.d.ts.map +1 -1
  65. package/dist/coding-agents/openclaw.d.ts.map +1 -1
  66. package/dist/coding-agents/opencode.d.ts.map +1 -1
  67. package/dist/coding-agents/pi.d.ts.map +1 -1
  68. package/dist/coding-agents/shared.d.ts +4 -9
  69. package/dist/coding-agents/shared.d.ts.map +1 -1
  70. package/dist/coding-agents/shared.js +0 -4
  71. package/dist/coding-agents/shared.js.map +1 -1
  72. package/dist/coding-agents/vscode.d.ts +13 -1
  73. package/dist/coding-agents/vscode.d.ts.map +1 -1
  74. package/dist/coding-agents/vscode.js +32 -12
  75. package/dist/coding-agents/vscode.js.map +1 -1
  76. package/dist/coding-agents.d.ts +8 -4
  77. package/dist/coding-agents.d.ts.map +1 -1
  78. package/dist/coding-agents.js.map +1 -1
  79. package/dist/config.d.ts.map +1 -1
  80. package/dist/config.js.map +1 -1
  81. package/dist/connect.d.ts +35 -28
  82. package/dist/connect.d.ts.map +1 -1
  83. package/dist/connect.js +112 -66
  84. package/dist/connect.js.map +1 -1
  85. package/dist/console-auth.d.ts +24 -3
  86. package/dist/console-auth.d.ts.map +1 -1
  87. package/dist/console-auth.js +5 -24
  88. package/dist/console-auth.js.map +1 -1
  89. package/dist/doctor.d.ts.map +1 -1
  90. package/dist/error-codes.d.ts.map +1 -1
  91. package/dist/error-codes.js.map +1 -1
  92. package/dist/errors.d.ts.map +1 -1
  93. package/dist/errors.js.map +1 -1
  94. package/dist/event-listen.d.ts.map +1 -1
  95. package/dist/exit-codes.d.ts.map +1 -1
  96. package/dist/folder-link.d.ts.map +1 -1
  97. package/dist/help-groups.d.ts +10 -3
  98. package/dist/help-groups.d.ts.map +1 -1
  99. package/dist/help-groups.js +27 -3
  100. package/dist/help-groups.js.map +1 -1
  101. package/dist/hosted-mcp.d.ts +106 -0
  102. package/dist/hosted-mcp.d.ts.map +1 -0
  103. package/dist/hosted-mcp.js +110 -0
  104. package/dist/hosted-mcp.js.map +1 -0
  105. package/dist/inbound-media.d.ts.map +1 -1
  106. package/dist/inbound-media.js +26 -1
  107. package/dist/inbound-media.js.map +1 -1
  108. package/dist/interactive.d.ts.map +1 -1
  109. package/dist/interactive.js.map +1 -1
  110. package/dist/local-image.js.map +1 -1
  111. package/dist/output.d.ts.map +1 -1
  112. package/dist/output.js.map +1 -1
  113. package/dist/phone-link.d.ts +52 -0
  114. package/dist/phone-link.d.ts.map +1 -0
  115. package/dist/phone-link.js +179 -0
  116. package/dist/phone-link.js.map +1 -0
  117. package/dist/private-file.d.ts +20 -0
  118. package/dist/private-file.d.ts.map +1 -1
  119. package/dist/private-file.js +47 -5
  120. package/dist/private-file.js.map +1 -1
  121. package/dist/program.d.ts.map +1 -1
  122. package/dist/program.js +214 -43
  123. package/dist/program.js.map +1 -1
  124. package/dist/qr-terminal.d.ts.map +1 -1
  125. package/dist/qr-terminal.js.map +1 -1
  126. package/dist/relay-brand.d.ts.map +1 -1
  127. package/dist/runtime-connect/implementation.js.map +1 -1
  128. package/dist/runtime-connect/windows-acl.d.ts.map +1 -1
  129. package/dist/runtime-sniff.d.ts.map +1 -1
  130. package/dist/runtime-sniff.js.map +1 -1
  131. package/dist/secret-input.js.map +1 -1
  132. package/dist/skill-offer.d.ts.map +1 -1
  133. package/dist/skill-offer.js.map +1 -1
  134. package/dist/spawn-command.d.ts +15 -0
  135. package/dist/spawn-command.d.ts.map +1 -1
  136. package/dist/spawn-command.js +15 -2
  137. package/dist/spawn-command.js.map +1 -1
  138. package/dist/terminal-session.js.map +1 -1
  139. package/dist/terminal-watch.js.map +1 -1
  140. package/dist/ui-colour.d.ts.map +1 -1
  141. package/dist/verbose.d.ts.map +1 -1
  142. package/package.json +6 -6
package/README.md CHANGED
@@ -8,6 +8,22 @@ Source is maintained in
8
8
  [`RelayMessenger/Relay-SDK`](https://github.com/RelayMessenger/Relay-SDK/tree/staging/packages/cli)
9
9
  under `packages/cli`.
10
10
 
11
+ ## Selection
12
+
13
+ Codex and Claude bridges accept a final `selection` JSON fence holding the
14
+ question as `title` (1 to 60 characters) and the `options`; any words outside
15
+ the fence go as a normal message above the card. The shared ACP bridge uses the
16
+ same format. Inbound model context preserves
17
+ ordered rich parts, `selected_values`, and `reply_to` as data.
18
+
19
+ New human reply text is literal `• ` + each selected source label joined with
20
+ `\n`, followed by `selection_response` metadata in source-option order. Dispatch
21
+ with `selected_values` and the explicit source target, never label parsing.
22
+ Exact legacy comma-joined text remains a server compatibility input. The person
23
+ checks any number of options and submits them once; checking sends nothing, and
24
+ a person answers a given selection once. iOS may draw a checkmark in place of
25
+ each bullet and repeat the prompt's title, as presentation only.
26
+
11
27
  ## Install
12
28
 
13
29
  ```sh
@@ -115,6 +131,19 @@ flow. It stores the Console session locally; Relay Console names your first
115
131
  organization after you. Use `organization update --name` to rename it and
116
132
  optional `--website` to set its website.
117
133
 
134
+ `relay phone link` links your phone to the same account, so the Relay app
135
+ signs in to it too. It is optional, and it lets tool approvals from your
136
+ connected agents reach you in the Relay app. At a terminal it asks for the
137
+ number, texts a code, and asks for the code. Without a terminal, run it twice:
138
+
139
+ ```sh
140
+ relay phone link --number +15551234567
141
+ relay phone link --number +15551234567 --code 123456
142
+ ```
143
+
144
+ When the number already had a Relay app account, the two become one account
145
+ and the saved sign-in is refreshed.
146
+
118
147
  For legacy integrations, `relay auth login --with-token` keeps the explicit
119
148
  Agent Token import path. The token is read from stdin and is never printed.
120
149
 
@@ -133,6 +162,14 @@ relay auth status
133
162
  relay doctor
134
163
  ```
135
164
 
165
+ `relay auth token` prints the Agent Token the CLI would use, and nothing else,
166
+ the way `gh auth token` does. Use it to give the token to the SDK:
167
+
168
+ ```sh
169
+ export RELAY_AGENT_TOKEN=$(relay auth token)
170
+ relay auth token --profile staging
171
+ ```
172
+
136
173
  Profiles live in `${XDG_CONFIG_HOME:-~/.config}/relay/config.json`. The
137
174
  directory is mode `0700` and the file is mode `0600` on POSIX systems.
138
175
 
@@ -237,6 +274,29 @@ storage is present, absent, or unverified, without printing the secret. Relay
237
274
  checks that it can write a private config file before it asks Relay to create the
238
275
  agent, and it never overwrites a token that is already there.
239
276
 
277
+ ### Who can message an agent
278
+
279
+ These are the agent's "Available to" settings and its Always Allow and Never
280
+ Allow lists in Relay Console, read and changed with the Console sign-in.
281
+
282
+ ```sh
283
+ relay agents access show weather
284
+ relay agents access private weather
285
+ relay agents access open weather
286
+ relay agents access update weather --people off --agents nobody
287
+ relay agents access allow weather alice
288
+ relay agents access deny weather spam_bot
289
+ relay agents access remove weather alice
290
+ ```
291
+
292
+ `--people on|off` is "People in the Relay app". `--agents everyone|communities|nobody`
293
+ is "Other agents". A handle on Always Allow can start a chat whatever these
294
+ say; a handle on Never Allow cannot. People in your organization, and its
295
+ other agents, always get through. `private` turns people off and sets other
296
+ agents to nobody, so only your organization and the handles on Always Allow
297
+ can start a chat. `open` turns both back on; agents are open by default.
298
+ `show` says Private or Open when the settings match one of the two.
299
+
240
300
  ### Optional identity and picture
241
301
 
242
302
  ```sh
@@ -367,3 +427,8 @@ printf '%s' "$STAGING_RELAY_AGENT_TOKEN" |
367
427
  relay auth login --profile staging --with-token
368
428
  relay profiles list
369
429
  ```
430
+
431
+ Agent creation requires `--subtitle "Helps with your calendar"`, the line under
432
+ its name (up to 60 characters). An interactive terminal asks when it is missing;
433
+ `--json` and non-interactive commands fail instead. Use `--description` for the
434
+ detailed text of what the agent can do (up to 2000 characters), required for public agents.
@@ -1,7 +1,9 @@
1
1
  import { type InboundMediaOptions } from "./inbound-media.js";
2
2
  import type Relay from "@relaymessenger/sdk";
3
- import { ClientSideConnection, type RequestPermissionRequest, type RequestPermissionResponse, type McpServer } from "@agentclientprotocol/sdk";
3
+ import { ClientSideConnection, type PermissionOption, type RequestPermissionRequest, type RequestPermissionResponse, type McpServer, type AuthMethod } from "@agentclientprotocol/sdk";
4
4
  import type { AcpSessionStore } from "./acp-threads.js";
5
+ import { type HostedMcp } from "./hosted-mcp.js";
6
+ import { type ApprovalChoice, type ApprovalOutcome, type OwnerApprovals } from "./approvals.js";
5
7
  /**
6
8
  * What `relay connect cursor|gemini-cli|cline|opencode` leaves running so the
7
9
  * agent answers Relay messages by itself.
@@ -14,9 +16,9 @@ import type { AcpSessionStore } from "./acp-threads.js";
14
16
  * (`cursor-agent acp`, `gemini --experimental-acp`, `opencode acp`), gives every
15
17
  * chat its own ACP session, and sends the final answer back to the same chat.
16
18
  *
17
- * Relay's own tools travel through the session, natively: the Relay MCP server
18
- * connect would otherwise write into the agent's `mcp.json` is handed to
19
- * `session/new` instead, so the agent keeps Relay's send, read and react tools
19
+ * Relay's own tools travel through the session, natively: Relay's hosted MCP
20
+ * server, with this agent's token, is handed to `session/new` instead of being
21
+ * written into the agent's `mcp.json`, so the agent keeps Relay's send, read and react tools
20
22
  * while this process drives its turns. This mirrors `codex-bridge.ts`, which
21
23
  * does the same over Codex's `app-server`; the two never share a session file.
22
24
  */
@@ -47,23 +49,106 @@ export interface AcpCommand {
47
49
  * find. The ACP words are kept as they are (runtime-sniff.ts, spawn-command.ts).
48
50
  */
49
51
  export declare const acpCommand: (found: string, args: readonly string[], env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform) => Promise<AcpCommand>;
50
- /** The Relay MCP server as ACP takes it (`McpServerStdio`, schema/types.gen). */
51
- export declare const relayMcpServer: (spec: {
52
- command: string;
53
- args: readonly string[];
54
- env: Record<string, string>;
55
- }) => McpServer;
56
52
  /**
57
- * Nobody is at the keyboard, so a tool the agent asks to run is allowed the
58
- * same way Codex's `approvalPolicy: "never"` allows it: the agent proceeds. The
59
- * first `allow` option is chosen; when none is offered the request is cancelled
60
- * (`RequestPermissionOutcome`, schema/types.gen), which the reference client
61
- * does too (openclaw/src/acp/client-helpers.ts, `resolvePermissionRequest`).
53
+ * Relay's hosted MCP server as ACP takes it. HTTP is optional in ACP: a client
54
+ * sends an `McpServerHttp` (`type: "http"`, `name`, `url`, `headers` as
55
+ * `{ name, value }` pairs) only to an agent whose `initialize` answer carries
56
+ * `mcpCapabilities.http`, and every agent must take stdio (ACP "Session Setup",
57
+ * MCP Servers; _sources/mcp-hosted-docs-20260926/acp-session-setup.md:374-470;
58
+ * `McpServerHttp`, `McpCapabilities` in @agentclientprotocol/sdk 1.4.0
59
+ * schema/types.gen). An agent without it gets the stdio `mcp-remote` entry
60
+ * Relay-Docs gives clients without remote support (hosted-mcp.ts).
61
+ */
62
+ export declare const relayMcpServer: (mcp: HostedMcp, capabilities: {
63
+ http?: boolean;
64
+ } | null | undefined) => McpServer;
65
+ /**
66
+ * Whether a permission request is for one of Relay's own tools, which run
67
+ * without a card, as Inkbox's own tools do (inkbox-claude-code-plugin-
68
+ * sessions.py.txt:1171-1173). ACP's `ToolCall` names no MCP server
69
+ * (acp-protocol-tool-calls.md), so this reads the one agent whose naming is
70
+ * known: Gemini CLI names an MCP tool `mcp_{server}_{tool}`
71
+ * (packages/core/src/tools/mcp-tool.ts `generateValidName`) and starts each
72
+ * call id with the tool's name (packages/cli/src/acp/acpSession.ts
73
+ * `generateCallId`; _sources/oss-20260912/gemini-cli). Any other request gets
74
+ * a card, the side that asks rather than allows.
75
+ */
76
+ export declare const isRelayToolCall: (params: Pick<RequestPermissionRequest, "toolCall">) => boolean;
77
+ /**
78
+ * The agent's own options mapped to the card's three: its first
79
+ * `allow_once`, its first `allow_always` as "for this session" (Gemini CLI
80
+ * names it "Allow for this session", acpUtils.ts `toPermissionOptions`), and
81
+ * its first `reject_once`, else `reject_always`. Each keeps the agent's own
82
+ * name and id (`PermissionOption`, acp-protocol-tool-calls.md).
83
+ */
84
+ export declare const acpChoices: (options: readonly PermissionOption[]) => ApprovalChoice[];
85
+ /**
86
+ * The answer the agent gets. A cancelled turn is answered `cancelled`, which
87
+ * ACP requires ("If the current prompt turn gets cancelled, the Client MUST
88
+ * respond with the "cancelled" outcome", acp-protocol-tool-calls.md:193). A
89
+ * prompt nobody allowed selects the agent's own reject option; ACP's answer
90
+ * carries no message.
62
91
  */
63
- export declare const autoPermission: (params: RequestPermissionRequest) => RequestPermissionResponse;
92
+ export declare const acpPermissionResponse: (params: Pick<RequestPermissionRequest, "options">, outcome: ApprovalOutcome) => RequestPermissionResponse;
93
+ /** Relay's own secrets a person may hold in the shell that runs connect. */
94
+ export declare const RELAY_SECRET_ENV: readonly ["RELAY_AGENT_TOKEN", "RELAY_WEBHOOK_SECRET"];
95
+ /**
96
+ * The agent's environment: this process's own, without Relay's secrets. The
97
+ * agent reaches Relay through the MCP server handed to its session, which
98
+ * carries the token itself (`relayMcpServer`), so nothing the model runs needs
99
+ * it. The Codex bridge keeps the same name out of every command Codex runs
100
+ * (`shell_environment_policy`, codex-bridge.ts).
101
+ *
102
+ * Everything else passes through, the client's own sign-in variables above
103
+ * all: Gemini CLI reads `GEMINI_API_KEY` (docs/reference/configuration.md; see
104
+ * `ENV_AUTH_METHODS`), and Cline reads `CLINE_API_KEY`, "Authenticate with an
105
+ * API key instead of interactive sign-in" (Cline docs, usage/acp;
106
+ * _sources/unattended-agent-permissions-20260926/cline-docs-usage-acp.mdx.txt:131),
107
+ * and Cursor's agent reads `CURSOR_API_KEY` (Cursor docs, cli/headless;
108
+ * cursor-com-docs-cli-headless.txt:13). Without them the agent cannot sign in
109
+ * and answers nothing.
110
+ */
111
+ export declare const acpEnvironment: (env: NodeJS.ProcessEnv) => NodeJS.ProcessEnv;
112
+ /**
113
+ * One permission request, answered by the agent's owners in Relay; Relay's
114
+ * own tools run without asking.
115
+ */
116
+ export declare const acpPermission: (label: string, approvals: Pick<OwnerApprovals, "ask">) => (params: RequestPermissionRequest, signal?: AbortSignal) => Promise<RequestPermissionResponse>;
117
+ /**
118
+ * How long a loaded session must stay silent before the bridge prompts it.
119
+ * ACP says an agent replays the whole conversation and only then answers
120
+ * `session/load` (Session Setup, "Loading Sessions";
121
+ * _sources/mcp-hosted-docs-20260926/acp-session-setup.md:137,181). Gemini CLI
122
+ * answers first and replays after (`session.streamHistory` is not awaited,
123
+ * acpSessionManager.ts `loadSession`; acpSession.ts:241), so without a wait the
124
+ * old answers stream into the new turn's answer (the Daytona run of
125
+ * 2026-09-26 sent "Probe a8749ac6Probe a8749ac6"). An agent that follows the
126
+ * spec sends nothing after its answer and costs one window.
127
+ */
128
+ export declare const REPLAY_QUIET_MS = 300;
129
+ export declare const REPLAY_MAX_MS = 10000;
130
+ /** ACP's `auth_required` error code (`RequestError.authRequired`, jsonrpc.js). */
131
+ export declare const AUTH_REQUIRED = -32000;
132
+ /**
133
+ * Sign-in methods whose credential is an environment variable the agent reads
134
+ * itself, by method id. ACP leaves the choice of method to the client
135
+ * (Authentication, "Protocol-driven authentication";
136
+ * _sources/mcp-hosted-docs-20260926/acp-v1-authentication.md:138-170), and no
137
+ * person is at this client to choose, so the bridge picks only a method whose
138
+ * credential is already present, the rule acpx follows (`selectAuthMethod`,
139
+ * _sources/network-20260926/mcp-xos/acpx-src-src_acp_client.ts.txt:2054-2103).
140
+ * `gemini-api-key` is Gemini CLI's `AuthType.USE_GEMINI`, read from
141
+ * `GEMINI_API_KEY` (Gemini CLI docs/reference/configuration.md; Zed hands the
142
+ * same variable to Gemini, zed-agent_servers-custom.rs.txt:250-253).
143
+ */
144
+ export declare const ENV_AUTH_METHODS: Readonly<Record<string, readonly string[]>>;
145
+ /** The advertised method whose credential this environment holds, when there is one. */
146
+ export declare const authMethodFromEnv: (methods: readonly AuthMethod[] | undefined, env: NodeJS.ProcessEnv) => string | undefined;
147
+ /** An ACP error, an Error, or anything thrown, as one line. */
148
+ export declare const acpFailure: (error: unknown) => string;
64
149
  /** One running ACP agent, and the calls this bridge makes to it. */
65
150
  export interface AcpAgent {
66
- client: Pick<ClientSideConnection, "initialize" | "newSession" | "loadSession" | "prompt" | "cancel">;
151
+ client: Pick<ClientSideConnection, "initialize" | "authenticate" | "newSession" | "loadSession" | "prompt" | "cancel">;
67
152
  /**
68
153
  * Collect the answer streamed for one session's running turn. Every
69
154
  * `agent_message_chunk` of text is handed to the sink until the returned
@@ -71,15 +156,30 @@ export interface AcpAgent {
71
156
  * is registered per session at a time.
72
157
  */
73
158
  collect(sessionId: string, sink: (text: string) => void): () => void;
159
+ /**
160
+ * Resolves once the agent has sent nothing for this session for `windowMs`,
161
+ * or after `maxMs` at most. See `REPLAY_QUIET_MS`.
162
+ */
163
+ quiet(sessionId: string, windowMs?: number, maxMs?: number): Promise<void>;
74
164
  /** True once the agent advertised `session/load`; set after `initialize`. */
75
165
  canLoad: boolean;
166
+ /** What the agent said it can reach an MCP server over; set after `initialize`. */
167
+ mcp?: {
168
+ http?: boolean;
169
+ } | null;
170
+ /** The sign-in methods the agent advertised in `initialize`. */
171
+ authMethods?: readonly AuthMethod[];
172
+ /** Set once `authenticate` has been sent, so it is sent at most once per process. */
173
+ authenticated?: boolean;
76
174
  /** Resolves, with the line to show the person, when the process is gone. */
77
175
  stopped: Promise<string>;
78
176
  /** True once the process is gone, so the next message starts a new one. */
79
177
  gone(): boolean;
80
178
  }
81
179
  /** Starts the agent's ACP command and drives it over the official SDK. */
82
- export declare const startAcpAgent: (acp: AcpCommand, cwd: string, signal: AbortSignal) => AcpAgent;
180
+ export declare const startAcpAgent: (acp: AcpCommand, cwd: string, signal: AbortSignal,
181
+ /** Answers `session/request_permission`; `acpPermission` in the bridge. */
182
+ permission: (params: RequestPermissionRequest) => Promise<RequestPermissionResponse>) => AcpAgent;
83
183
  /** The turn the agent is running for one chat right now. */
84
184
  export interface LiveTurn {
85
185
  sessionId: string;
@@ -104,28 +204,35 @@ export declare const runTurn: (agent: AcpAgent, input: {
104
204
  onStarted(turn: LiveTurn): void;
105
205
  }) => Promise<TurnOutcome>;
106
206
  export interface AcpBridgeInput {
107
- client: Pick<Relay, "chats" | "websocket">;
207
+ client: Pick<Relay, "chats" | "paymentRequests" | "websocket">;
108
208
  media?: Omit<InboundMediaOptions, "chatId">;
109
209
  /** The agent's ACP command, and the folder to run it in. */
110
210
  acp: AcpCommand;
111
211
  cwd: string;
112
- /** The Relay MCP server handed to every session, so Relay's tools travel with it. */
113
- mcpServers: readonly McpServer[];
212
+ /** Relay's hosted MCP server and this agent's token, handed to every
213
+ * session so Relay's tools travel with it. */
214
+ mcp: HostedMcp;
114
215
  /** The label shown to the person, e.g. "Cursor". */
115
216
  label: string;
217
+ /** Asks the agent's owners, in Relay, whatever the agent would ask its editor. */
218
+ approvals: Pick<OwnerApprovals, "ask" | "take">;
116
219
  /** Which ACP session belongs to which chat, across restarts. */
117
220
  sessions: AcpSessionStore;
118
221
  signal: AbortSignal;
119
222
  /** One line to the terminal the person is watching. */
120
223
  say(line: string): void;
224
+ /** Where a sign-in method's credential is looked for; this process's own by default. */
225
+ env?: NodeJS.ProcessEnv;
121
226
  }
122
227
  /**
123
228
  * Answers every message that arrives until the signal stops it.
124
229
  *
125
230
  * Turns run one at a time inside a chat and at the same time across chats,
126
- * which is what one agent with one session per chat allows. A message for a
127
- * chat whose turn is still running cancels that turn (`session/cancel`) and
128
- * takes its place; the cancelled turn sends nothing.
231
+ * which is what one agent with one session per chat allows. A person's
232
+ * message for a chat whose turn for a person is still running cancels that
233
+ * turn (`session/cancel`) and takes its place; the cancelled turn sends
234
+ * nothing. An agent's message waits for the running turn instead
235
+ * (`replacesLiveTurn`).
129
236
  */
130
237
  export declare const runAcpBridge: (input: AcpBridgeInput) => Promise<void>;
131
238
  //# sourceMappingURL=acp-bridge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"acp-bridge.d.ts","sourceRoot":"","sources":["../src/acp-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,oBAAoB,EAIpB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAE9B,KAAK,SAAS,EACf,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAMxD;;;;;;;;;;;;;;;;;GAiBG;AAEH,gGAAgG;AAChG,eAAO,MAAM,QAAQ,GAAI,SAAS,MAAM,KAAG,MAAiC,CAAC;AAE7E,+EAA+E;AAC/E,eAAO,MAAM,WAAW,mBAAmB,CAAC;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAoB,CAAC;AAE/E,kFAAkF;AAClF,MAAM,WAAW,UAAU;IACzB,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CACzB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,MAAM,EACb,MAAM,SAAS,MAAM,EAAE,EACvB,MAAK,MAAM,CAAC,UAAwB,EACpC,WAAU,MAAM,CAAC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