@teable/agent-gateway 1.0.0 → 1.0.2

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,38 @@
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 AcpNotification, type AgentPlanRequest, type AgentQuestionRequest, ASK, type JsonRpcId } 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
+ /** What a notice shim may learn of, and do to, the agent process it reads for. */
20
+ interface NoticeContext {
21
+ /**
22
+ * The agent took the oldest message sent to steer its running turn into
23
+ * it: its id, which is no longer answered; null when none was sent.
24
+ */
25
+ steered(): JsonRpcId | null;
26
+ }
27
+ /**
28
+ * A vendor notification with which an agent says something the protocol
29
+ * has words for: the protocol's notifications for it (none, to drop it).
30
+ */
31
+ export interface NoticeShim {
32
+ notices(params: unknown, context: NoticeContext): AcpNotification[];
33
+ }
34
+ /** grok-build's requests that ask the person, by method. */
35
+ export declare const GROK_ASKS: Readonly<Record<string, AskShim>>;
36
+ /** grok-build's notifications the protocol has words for, by method. */
37
+ export declare const GROK_NOTICES: Readonly<Record<string, NoticeShim>>;
38
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teable/agent-gateway",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "The agent gateway in a person's Teable sandbox: starts an ACP agent for each session and relays it to the person's hub",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,40 +0,0 @@
1
- // src/protocol.ts
2
- var GATEWAY_PATH = "/api/v4/agent/gateway";
3
- var AGENT_PROTOCOL = 1;
4
- var PING = "ping";
5
- var PONG = "pong";
6
- var GATEWAY_CLOSE = { replaced: 4e3, expired: 4001, unsupported: 4002 };
7
- var SESSION_ID = /^ses[0-9A-Za-z]{16}$/;
8
- var ACP = {
9
- initialize: "initialize",
10
- newSession: "session/new",
11
- loadSession: "session/load",
12
- prompt: "session/prompt",
13
- cancel: "session/cancel",
14
- update: "session/update",
15
- requestPermission: "session/request_permission"
16
- };
17
- function isAcpRequest(message) {
18
- return "method" in message && "id" in message;
19
- }
20
- function isAcpNotification(message) {
21
- return "method" in message && !("id" in message);
22
- }
23
- function isAcpResponse(message) {
24
- return !("method" in message) && "id" in message;
25
- }
26
- var AGENT_NAMES = ["grok"];
27
-
28
- export {
29
- GATEWAY_PATH,
30
- AGENT_PROTOCOL,
31
- PING,
32
- PONG,
33
- GATEWAY_CLOSE,
34
- SESSION_ID,
35
- ACP,
36
- isAcpRequest,
37
- isAcpNotification,
38
- isAcpResponse,
39
- AGENT_NAMES
40
- };