@teable/agent-gateway 0.0.0-stage → 1.0.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.
@@ -0,0 +1,637 @@
1
+ /**
2
+ * The agent protocol (ADR 0012): what travels between the agent gateway in a
3
+ * person's sandbox, their hub (`AgentHub` in apps/runtime, one per person)
4
+ * and the builder's agent panel, over two WebSockets.
5
+ *
6
+ * gateway ⇄ hub GET GATEWAY_PATH, with `Authorization: Bearer <gateway
7
+ * token>`. ACP's JSON-RPC messages, unchanged, in
8
+ * `{ session, acp }` frames, with what agents ask the
9
+ * person beyond ACP in one agent-neutral form (ASK); and
10
+ * control frames, which have a `type`: the hub asks the
11
+ * gateway to open and close sessions, the gateway says
12
+ * what it runs.
13
+ * tab ⇄ hub GET `${APPS_PATH}/:appId/agent?since=<seq>` (APPS_PATH
14
+ * from @teable/app/protocol), with the identity cookie.
15
+ * The hub sends a snapshot, then each stored event after
16
+ * `since` as `{ type: "event", seq, session, at, event }`,
17
+ * then live ones; the tab sends commands `{ id, session,
18
+ * op }`, each acknowledged once by its `id`. Everything the
19
+ * hub sends a tab has a `type`.
20
+ *
21
+ * Every message is one JSON text frame, except the keep-alive: either side
22
+ * of a hub socket may send PING, which the hub answers with PONG.
23
+ *
24
+ * It imports nothing: the gateway runs it in Node and Bun, the runtime in
25
+ * workerd, and the panel imports its types.
26
+ */
27
+ /** The gateway's socket, on the runtime's hosts (under /api/v4, as APPS_PATH is). */
28
+ export declare const GATEWAY_PATH = "/api/v4/agent/gateway";
29
+ /**
30
+ * This protocol's version, which the gateway says in its hello. The hub
31
+ * closes the socket of a gateway that speaks another (GATEWAY_CLOSE.unsupported).
32
+ */
33
+ export declare const AGENT_PROTOCOL = 1;
34
+ /** The keep-alive: sent as a text frame, answered by the hub without waking it. */
35
+ export declare const PING = "ping";
36
+ export declare const PONG = "pong";
37
+ /**
38
+ * Why the hub closed the gateway's socket, when the gateway must not dial
39
+ * again: a newer gateway of the same person connected (one gateway per
40
+ * person, the newest wins), the gateway token expired, or the gateway
41
+ * speaks another AGENT_PROTOCOL. The old platform starts a gateway with a
42
+ * fresh token when the panel asks for the sandbox.
43
+ */
44
+ export declare const GATEWAY_CLOSE: {
45
+ readonly replaced: 4000;
46
+ readonly expired: 4001;
47
+ readonly unsupported: 4002;
48
+ };
49
+ /** Session ids, made by the hub: `ses` and 16 letters or digits. */
50
+ export declare const SESSION_ID: RegExp;
51
+ /** A JSON-RPC request id. */
52
+ export type JsonRpcId = string | number;
53
+ export interface AcpRequest {
54
+ jsonrpc: "2.0";
55
+ id: JsonRpcId;
56
+ method: string;
57
+ params?: unknown;
58
+ result?: never;
59
+ error?: never;
60
+ }
61
+ export interface AcpNotification {
62
+ jsonrpc: "2.0";
63
+ method: string;
64
+ params?: unknown;
65
+ id?: never;
66
+ result?: never;
67
+ error?: never;
68
+ }
69
+ export interface AcpResponse {
70
+ jsonrpc: "2.0";
71
+ id: JsonRpcId;
72
+ result?: unknown;
73
+ error?: AcpError;
74
+ method?: never;
75
+ params?: never;
76
+ }
77
+ export interface AcpError {
78
+ code: number;
79
+ message: string;
80
+ data?: unknown;
81
+ }
82
+ export type AcpMessage = AcpRequest | AcpNotification | AcpResponse;
83
+ /** The ACP methods the hub and the gateway send or read. */
84
+ export declare const ACP: {
85
+ readonly initialize: "initialize";
86
+ readonly newSession: "session/new";
87
+ readonly loadSession: "session/load";
88
+ readonly prompt: "session/prompt";
89
+ readonly cancel: "session/cancel";
90
+ readonly update: "session/update";
91
+ readonly requestPermission: "session/request_permission";
92
+ };
93
+ /** Content in prompts and updates (ACP's ContentBlock, from MCP). */
94
+ export type AcpContentBlock = {
95
+ type: "text";
96
+ text: string;
97
+ } | {
98
+ type: "image";
99
+ data: string;
100
+ mimeType: string;
101
+ uri?: string | null;
102
+ } | {
103
+ type: "audio";
104
+ data: string;
105
+ mimeType: string;
106
+ } | {
107
+ type: "resource_link";
108
+ uri: string;
109
+ name: string;
110
+ title?: string | null;
111
+ description?: string | null;
112
+ mimeType?: string | null;
113
+ size?: number | null;
114
+ } | {
115
+ type: "resource";
116
+ resource: AcpEmbeddedResource;
117
+ };
118
+ export type AcpEmbeddedResource = {
119
+ uri: string;
120
+ mimeType?: string | null;
121
+ text: string;
122
+ } | {
123
+ uri: string;
124
+ mimeType?: string | null;
125
+ blob: string;
126
+ };
127
+ export type AcpToolKind = "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "switch_mode" | "other";
128
+ export type AcpToolCallStatus = "pending" | "in_progress" | "completed" | "failed";
129
+ /** What a tool call shows: content, a file's diff, or a terminal. */
130
+ export type AcpToolCallContent = {
131
+ type: "content";
132
+ content: AcpContentBlock;
133
+ } | {
134
+ type: "diff";
135
+ path: string;
136
+ oldText?: string | null;
137
+ newText: string;
138
+ } | {
139
+ type: "terminal";
140
+ terminalId: string;
141
+ };
142
+ export interface AcpToolCallLocation {
143
+ path: string;
144
+ line?: number | null;
145
+ }
146
+ /** A tool call's fields: a `tool_call` sets them, a `tool_call_update` changes those it carries. */
147
+ export interface AcpToolCallUpdate {
148
+ toolCallId: string;
149
+ title?: string | null;
150
+ kind?: AcpToolKind | null;
151
+ status?: AcpToolCallStatus | null;
152
+ content?: AcpToolCallContent[] | null;
153
+ locations?: AcpToolCallLocation[] | null;
154
+ rawInput?: unknown;
155
+ rawOutput?: unknown;
156
+ }
157
+ export interface AcpPlanEntry {
158
+ content: string;
159
+ priority: "high" | "medium" | "low";
160
+ status: "pending" | "in_progress" | "completed";
161
+ }
162
+ export interface AcpAvailableCommand {
163
+ name: string;
164
+ description: string;
165
+ input?: {
166
+ hint: string;
167
+ } | null;
168
+ }
169
+ /**
170
+ * What a `session/update` reports, in `params.update`, by `sessionUpdate`.
171
+ * Agents may send kinds not listed here; show what you know, skip the rest.
172
+ */
173
+ export type AcpSessionUpdate = {
174
+ sessionUpdate: "user_message_chunk";
175
+ content: AcpContentBlock;
176
+ } | {
177
+ sessionUpdate: "agent_message_chunk";
178
+ content: AcpContentBlock;
179
+ } | {
180
+ sessionUpdate: "agent_thought_chunk";
181
+ content: AcpContentBlock;
182
+ } | ({
183
+ sessionUpdate: "tool_call";
184
+ title: string;
185
+ } & AcpToolCallUpdate) | ({
186
+ sessionUpdate: "tool_call_update";
187
+ } & AcpToolCallUpdate) | {
188
+ sessionUpdate: "plan";
189
+ entries: AcpPlanEntry[];
190
+ } | {
191
+ sessionUpdate: "available_commands_update";
192
+ availableCommands: AcpAvailableCommand[];
193
+ } | {
194
+ sessionUpdate: "current_mode_update";
195
+ currentModeId: string;
196
+ } | {
197
+ sessionUpdate: "session_info_update";
198
+ title?: string | null;
199
+ updatedAt?: string | null;
200
+ };
201
+ /** `session/update` (agent → client), a notification: what the agent did, as it happens. */
202
+ export interface AcpSessionNotification {
203
+ sessionId: string;
204
+ update: AcpSessionUpdate;
205
+ }
206
+ export interface AcpPermissionOption {
207
+ optionId: string;
208
+ name: string;
209
+ kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
210
+ }
211
+ /**
212
+ * `session/request_permission` (agent → client), a request: may the agent
213
+ * go ahead with this tool call? Its result is `{ outcome: AcpPermissionOutcome }`.
214
+ */
215
+ export interface AcpPermissionRequest {
216
+ sessionId: string;
217
+ toolCall: AcpToolCallUpdate;
218
+ options: AcpPermissionOption[];
219
+ }
220
+ /** The answer to a permission request: one of its options, or cancelled with its turn. */
221
+ export type AcpPermissionOutcome = {
222
+ outcome: "cancelled";
223
+ } | {
224
+ outcome: "selected";
225
+ optionId: string;
226
+ };
227
+ /** `session/prompt` (client → agent), a request: a person's message; answered when the turn ends. */
228
+ export interface AcpPromptRequest {
229
+ sessionId: string;
230
+ prompt: AcpContentBlock[];
231
+ }
232
+ /** Why a turn ended, as the agent says in its answer to `session/prompt`. */
233
+ export type AcpStopReason = "end_turn" | "max_tokens" | "max_turn_requests" | "refusal" | "cancelled";
234
+ /** What the agent says it is and can do, in its answer to `initialize`. */
235
+ export interface AcpInitializeResult {
236
+ protocolVersion: number;
237
+ agentCapabilities?: {
238
+ loadSession?: boolean;
239
+ promptCapabilities?: {
240
+ image?: boolean;
241
+ audio?: boolean;
242
+ embeddedContext?: boolean;
243
+ };
244
+ mcpCapabilities?: {
245
+ http?: boolean;
246
+ sse?: boolean;
247
+ };
248
+ };
249
+ authMethods?: {
250
+ id: string;
251
+ name: string;
252
+ description?: string | null;
253
+ }[];
254
+ agentInfo?: {
255
+ name: string;
256
+ title?: string | null;
257
+ version: string;
258
+ } | null;
259
+ }
260
+ /** What the agent's answer to `session/new` or `session/load` offers besides the id. */
261
+ export interface AcpSessionSetup {
262
+ modes?: unknown;
263
+ models?: unknown;
264
+ configOptions?: unknown;
265
+ }
266
+ export declare const ASK: {
267
+ /** Questions for the person (AgentQuestionRequest), answered with an AgentQuestionOutcome. */
268
+ readonly question: "_teable/question";
269
+ /** A plan for the person to approve before the agent acts on it (AgentPlanRequest), answered with an AgentPlanOutcome. */
270
+ readonly plan: "_teable/plan";
271
+ };
272
+ /** A question: the person picks an option, or several, or answers in their own words. */
273
+ export interface AgentQuestion {
274
+ /** The question, as a full sentence. */
275
+ question: string;
276
+ options: AgentQuestionOption[];
277
+ /** Whether more than one option may be picked. */
278
+ multiSelect: boolean;
279
+ /** Whether the person may answer in their own words instead of an option. */
280
+ freeText: boolean;
281
+ }
282
+ export interface AgentQuestionOption {
283
+ label: string;
284
+ /** What picking it means. */
285
+ description: string | null;
286
+ /** What to show while it is considered: a sketch, a snippet. */
287
+ preview: string | null;
288
+ }
289
+ export interface AgentQuestionRequest {
290
+ sessionId: string;
291
+ /** The agent's tool call that asks, when it says. */
292
+ toolCallId: string | null;
293
+ questions: AgentQuestion[];
294
+ }
295
+ /** The answer to questions: for each, in order, the labels picked and the person's own words; or none. */
296
+ export type AgentQuestionOutcome = {
297
+ outcome: "answered";
298
+ answers: {
299
+ picked: string[];
300
+ text: string | null;
301
+ }[];
302
+ } | {
303
+ outcome: "cancelled";
304
+ };
305
+ export interface AgentPlanRequest {
306
+ sessionId: string;
307
+ /** The agent's tool call that asks, when it says. */
308
+ toolCallId: string | null;
309
+ /** The plan, in Markdown. */
310
+ plan: string;
311
+ }
312
+ /** The answer to a plan: approved, or rejected with what to change; or none. */
313
+ export type AgentPlanOutcome = {
314
+ outcome: "approved";
315
+ } | {
316
+ outcome: "rejected";
317
+ feedback: string | null;
318
+ } | {
319
+ outcome: "cancelled";
320
+ };
321
+ /** An answer to anything the agent asks the person: a permission, questions, a plan. */
322
+ export type AgentAnswer = AcpPermissionOutcome | AgentQuestionOutcome | AgentPlanOutcome;
323
+ export declare function isAcpRequest(message: AcpMessage): message is AcpRequest;
324
+ export declare function isAcpNotification(message: AcpMessage): message is AcpNotification;
325
+ export declare function isAcpResponse(message: AcpMessage): message is AcpResponse;
326
+ /** The agents a gateway starts: grok-build first; Codex and Claude Code follow (ADR 0012). */
327
+ export declare const AGENT_NAMES: readonly ["grok"];
328
+ export type AgentName = (typeof AGENT_NAMES)[number];
329
+ /**
330
+ * What an agent can do, as the hub and the panel need to know it: data, so
331
+ * neither branches on which agent it is. The gateway's registry holds each
332
+ * agent's record and sends them all in its hello.
333
+ */
334
+ export interface AgentCapabilities {
335
+ agent: AgentName;
336
+ /** Its name, for people. */
337
+ title: string;
338
+ /**
339
+ * What happens to a message sent with `steer` while a turn runs: "steer"
340
+ * puts it into the running turn; "interrupt" stops the turn and sends it next.
341
+ */
342
+ steering: "steer" | "interrupt";
343
+ /** Whether it asks before acting (`session/request_permission`). */
344
+ approvals: boolean;
345
+ /** Whether it asks the person questions (ASK.question). */
346
+ questions: boolean;
347
+ /** Whether it asks the person to approve its plan before it acts on it (ASK.plan). */
348
+ planApproval: boolean;
349
+ /** Whether it reports its plan (`plan` updates). */
350
+ plans: boolean;
351
+ /** Whether it runs background tasks that outlive a turn. */
352
+ backgroundTasks: boolean;
353
+ /** Whether a session survives a restart of the agent or the sandbox (`session/load`). */
354
+ resume: boolean;
355
+ }
356
+ /**
357
+ * ACP for one session, both ways: relayed unchanged between the hub and the
358
+ * session's agent. The gateway answers a request for a session whose agent
359
+ * does not run with an error, and keeps vendor extensions (methods starting
360
+ * with `_`) to its per-agent shims: the hub sees standard ACP, and the
361
+ * requests the shims make of agents' own (ASK).
362
+ */
363
+ export interface AcpFrame {
364
+ session: string;
365
+ acp: AcpMessage;
366
+ }
367
+ /** What the hub asks of the gateway. */
368
+ export type HubControl =
369
+ /**
370
+ * Start the session's agent in the app's checkout: resume the agent's own
371
+ * session with `session/load` when it has one (`acpSessionId`), else start
372
+ * one. Answered with `opened` or `failed`; opening an open session answers
373
+ * `opened` again.
374
+ */
375
+ {
376
+ type: "open";
377
+ session: string;
378
+ agent: AgentName;
379
+ appId: string;
380
+ spaceId: string;
381
+ acpSessionId: string | null;
382
+ }
383
+ /** Stop the session's agent. Answered with `closed`. */
384
+ | {
385
+ type: "close";
386
+ session: string;
387
+ };
388
+ /** The hub sends nothing before the gateway's hello. */
389
+ export type HubToGateway = AcpFrame | HubControl;
390
+ /** A session the gateway runs an agent for. */
391
+ export interface GatewaySession {
392
+ session: string;
393
+ /** The agent's own session id; null while the agent starts. */
394
+ acpSessionId: string | null;
395
+ /** The ids of the `session/prompt` requests its agent has not answered yet. */
396
+ prompts: JsonRpcId[];
397
+ }
398
+ /** What the gateway tells the hub. */
399
+ export type GatewayControl =
400
+ /**
401
+ * Sent on every connection, after what the gateway kept while it was
402
+ * disconnected: the protocol it speaks, which gateway process this is
403
+ * (`instance`) and its package version, its agents, and the sessions it
404
+ * runs now. A session it does not list has no agent.
405
+ */
406
+ {
407
+ type: "hello";
408
+ protocol: number;
409
+ instance: string;
410
+ version: string;
411
+ agents: AgentCapabilities[];
412
+ sessions: GatewaySession[];
413
+ }
414
+ /**
415
+ * The session's agent runs: it resumed the agent's session (`resumed`), or
416
+ * started a new one, which knows nothing of the conversation before.
417
+ */
418
+ | {
419
+ type: "opened";
420
+ session: string;
421
+ acpSessionId: string;
422
+ resumed: boolean;
423
+ initialize: AcpInitializeResult;
424
+ setup: AcpSessionSetup;
425
+ }
426
+ /** The session's agent could not start. */
427
+ | {
428
+ type: "failed";
429
+ session: string;
430
+ message: string;
431
+ }
432
+ /** The session's agent stopped: it exited, was closed, or sat idle. */
433
+ | {
434
+ type: "closed";
435
+ session: string;
436
+ message: string;
437
+ };
438
+ export type GatewayToHub = AcpFrame | GatewayControl;
439
+ /**
440
+ * A command from a tab. `id` names it: any string the tab makes up, unique
441
+ * among the person's commands, so that sending it again (after a reconnect)
442
+ * gets the same acknowledgement and does nothing twice.
443
+ */
444
+ export interface TabCommand {
445
+ id: string;
446
+ /** The session it is for; null for `new`. */
447
+ session: string | null;
448
+ op: TabOp;
449
+ }
450
+ /**
451
+ * What a command does. Starting a session, prompting and answering what the
452
+ * agent asks need a creator or owner of the app's space, as publishing does;
453
+ * any member may connect, read their own sessions and cancel.
454
+ */
455
+ export type TabOp =
456
+ /** Start a session about the tab's app, with `prompt` as its first message, if given. */
457
+ {
458
+ type: "new";
459
+ agent: AgentName;
460
+ prompt?: AcpContentBlock[];
461
+ }
462
+ /**
463
+ * Send a message. While a turn runs it waits in the queue; with `steer`
464
+ * it goes to the running turn instead, as the agent's `steering` says.
465
+ */
466
+ | {
467
+ type: "prompt";
468
+ prompt: AcpContentBlock[];
469
+ steer?: boolean;
470
+ }
471
+ /** Stop a turn: the running one, or a queued one by its number. */
472
+ | {
473
+ type: "cancel";
474
+ turn?: number;
475
+ }
476
+ /**
477
+ * Answer what the agent asks the person (a permission, questions, a plan),
478
+ * named by the `seq` of the event that asked, with the outcome its kind
479
+ * takes. The first answer wins. While the gateway is away the answer waits
480
+ * for it, since the agent waits too.
481
+ */
482
+ | {
483
+ type: "answer";
484
+ request: number;
485
+ outcome: AgentAnswer;
486
+ };
487
+ /** Why a command was refused: malformed, not allowed, nothing to act on, or too late. */
488
+ export type AgentErrorCode = "BAD_INPUT" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT";
489
+ export interface AgentError {
490
+ code: AgentErrorCode;
491
+ message: string;
492
+ }
493
+ /** The answer to a command, sent once per command id to the tab that sent it. */
494
+ export type Ack = {
495
+ type: "ack";
496
+ id: string;
497
+ ok: true;
498
+ session: string;
499
+ turn: number | null;
500
+ } | {
501
+ type: "ack";
502
+ id: string;
503
+ ok: false;
504
+ error: AgentError;
505
+ };
506
+ /** Whether the person's gateway is connected, and the agents it last said it has. */
507
+ export interface GatewayStatus {
508
+ connected: boolean;
509
+ agents: AgentCapabilities[];
510
+ }
511
+ /** idle: nothing to do; queued: messages wait to run (for the gateway, perhaps); running: a turn runs. */
512
+ export type SessionState = "idle" | "queued" | "running";
513
+ /** A session as it is now: one row of the hub's. */
514
+ export interface SessionInfo {
515
+ session: string;
516
+ appId: string;
517
+ spaceId: string;
518
+ agent: AgentName;
519
+ createdBy: string;
520
+ createdAt: number;
521
+ /** The agent's title for it, else the start of its first message. */
522
+ title: string | null;
523
+ state: SessionState;
524
+ /** The running turn. */
525
+ turn: number | null;
526
+ /** The turns waiting, in the order they will run. */
527
+ queued: number[];
528
+ /** What the agent asks the person and waits for an answer to, by the `seq` of the event that asked. */
529
+ requests: number[];
530
+ lastSeq: number;
531
+ }
532
+ /** Something that happened in a session: stored, numbered and sent to every tab of its app. */
533
+ export type SessionEvent = {
534
+ type: "created";
535
+ appId: string;
536
+ spaceId: string;
537
+ agent: AgentName;
538
+ by: string;
539
+ }
540
+ /** A person's message, numbered `turn` in the session; it waits until it can run. */
541
+ | {
542
+ type: "prompt";
543
+ turn: number;
544
+ by: string;
545
+ prompt: AcpContentBlock[];
546
+ steer: boolean;
547
+ }
548
+ /** The turn went to the agent. */
549
+ | {
550
+ type: "turn_started";
551
+ turn: number;
552
+ }
553
+ /**
554
+ * A message from the agent, unchanged: `session/update` notifications, and
555
+ * what it asks the person (`session/request_permission` requests, and ASK's),
556
+ * during `turn` (null between turns).
557
+ */
558
+ | {
559
+ type: "acp";
560
+ turn: number | null;
561
+ acp: AcpMessage;
562
+ }
563
+ /**
564
+ * What the agent asked (the `seq` of its event) was answered, by `by`. The
565
+ * answer reaches the agent at once, or when its gateway is back, unless
566
+ * the request expires first.
567
+ */
568
+ | {
569
+ type: "answered";
570
+ request: number;
571
+ outcome: AgentAnswer;
572
+ by: string;
573
+ }
574
+ /**
575
+ * What the agent asked can no longer be answered: its turn was stopped or
576
+ * ended, or its agent stopped, before an answer reached it. An answer given
577
+ * meanwhile went nowhere.
578
+ */
579
+ | {
580
+ type: "expired";
581
+ request: number;
582
+ }
583
+ /** Someone asked to stop the turn; it ends with `turn_ended`. */
584
+ | {
585
+ type: "cancel_requested";
586
+ turn: number;
587
+ by: string;
588
+ }
589
+ /** The turn ended: the agent's stop reason, or, when it could not finish, why. */
590
+ | {
591
+ type: "turn_ended";
592
+ turn: number;
593
+ stopReason: AcpStopReason | null;
594
+ error: string | null;
595
+ }
596
+ /** The session's agent started: it resumed its session, or started a new one (`resumed` false). */
597
+ | {
598
+ type: "agent_started";
599
+ resumed: boolean;
600
+ initialize: AcpInitializeResult;
601
+ setup: AcpSessionSetup;
602
+ }
603
+ /** The session's agent stopped, or could not start. */
604
+ | {
605
+ type: "agent_stopped";
606
+ message: string;
607
+ };
608
+ /** A stored event: `seq` numbers every event of the person's, in the order the hub took them. */
609
+ export interface TabEvent {
610
+ type: "event";
611
+ seq: number;
612
+ session: string;
613
+ /** When the hub stored it, in milliseconds since the epoch. */
614
+ at: number;
615
+ event: SessionEvent;
616
+ }
617
+ export type HubToTab = TabEvent | Ack
618
+ /**
619
+ * First on every connection: this app's sessions as they are, whether a
620
+ * gateway is connected, whether this person may start sessions, prompt
621
+ * and answer what the agent asks here (`canPrompt`), and the latest `seq`
622
+ * (of any app's). Events after the tab's `since` follow, up to that `seq`,
623
+ * then live ones. Reconnect with `since` the larger of that `seq` and the
624
+ * last event's.
625
+ */
626
+ | {
627
+ type: "snapshot";
628
+ seq: number;
629
+ canPrompt: boolean;
630
+ gateway: GatewayStatus;
631
+ sessions: SessionInfo[];
632
+ }
633
+ /** The gateway connected or went away. */
634
+ | {
635
+ type: "gateway";
636
+ gateway: GatewayStatus;
637
+ };
@@ -0,0 +1,28 @@
1
+ import {
2
+ ACP,
3
+ AGENT_NAMES,
4
+ AGENT_PROTOCOL,
5
+ ASK,
6
+ GATEWAY_CLOSE,
7
+ GATEWAY_PATH,
8
+ PING,
9
+ PONG,
10
+ SESSION_ID,
11
+ isAcpNotification,
12
+ isAcpRequest,
13
+ isAcpResponse
14
+ } from "./chunks/CYVXAHGU.js";
15
+ export {
16
+ ACP,
17
+ AGENT_NAMES,
18
+ AGENT_PROTOCOL,
19
+ ASK,
20
+ GATEWAY_CLOSE,
21
+ GATEWAY_PATH,
22
+ PING,
23
+ PONG,
24
+ SESSION_ID,
25
+ isAcpNotification,
26
+ isAcpRequest,
27
+ isAcpResponse
28
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The per-agent shims (ADR 0012): what an agent does in words of its own
3
+ * that the protocol has one word for. Each agent's record (agents.ts) names
4
+ * its shims; this is the only code that knows an agent's vendor extensions.
5
+ */
6
+ import { type AgentPlanRequest, type AgentQuestionRequest, ASK } from "./protocol.js";
7
+ /**
8
+ * A vendor request with which an agent asks the person: relayed to the hub
9
+ * as the protocol's request (ASK), under the agent's own id, and the answer,
10
+ * the request's result, given back in the agent's words.
11
+ */
12
+ export interface AskShim {
13
+ method: (typeof ASK)[keyof typeof ASK];
14
+ /** The protocol's request, from the agent's params; throws when they are not the agent's. */
15
+ request(params: unknown): AgentQuestionRequest | AgentPlanRequest;
16
+ /** The agent's result, from the answer and the params it asked with. */
17
+ result(answer: unknown, params: unknown): unknown;
18
+ }
19
+ /** grok-build's requests that ask the person, by method. */
20
+ export declare const GROK_ASKS: Readonly<Record<string, AskShim>>;