@capybara-hq/plugin-sdk 0.1.0-rc.55 → 0.1.0-rc.56

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/dist/dial-in.d.ts CHANGED
@@ -95,17 +95,34 @@ export declare function parseDialInKernelFrame(text: string, maxBytes: number):
95
95
  * declares `permissions.dialIn = { protocol: "<name>/<major>" }`.
96
96
  */
97
97
  export interface DialInHandler {
98
- /** Called on the gateway replica holding the socket, after the kernel authenticated it. */
99
- onHello(deviceId: string, hello: unknown, signal: AbortSignal): Promise<{
98
+ /**
99
+ * Called on the gateway replica holding the socket, after the kernel authenticated it.
100
+ * `connection` names the machine and the connection the hello arrived on.
101
+ */
102
+ onHello(deviceId: string, hello: unknown, signal: AbortSignal, connection: DialInConnectionInfo): Promise<{
100
103
  ok: true;
101
104
  } | {
102
105
  ok: false;
103
106
  code: string;
104
107
  message: string;
105
108
  }>;
106
- /** Unsolicited frames from the machine (not responses to requests). */
107
- onFrame?(deviceId: string, frame: unknown): Promise<void>;
108
- onClose?(deviceId: string, reason: "offline" | "replaced" | "revoked" | "deleted"): void;
109
+ /** Unsolicited frames from the machine (not responses to requests), with their connection. */
110
+ onFrame?(deviceId: string, frame: unknown, connection: DialInConnectionInfo): Promise<void>;
111
+ /**
112
+ * The connection whose hello this provider accepted closed. `connection` is that connection's,
113
+ * so a `replaced` close names the old machine, never the one that replaced it.
114
+ */
115
+ onClose?(deviceId: string, reason: "offline" | "replaced" | "revoked" | "deleted", connection: DialInConnectionInfo): void;
116
+ }
117
+ /** Which machine and which of its connections a {@link DialInHandler} call is about. */
118
+ export interface DialInConnectionInfo {
119
+ /**
120
+ * The kernel's id of the signed-in machine (its credential): a machine signing in again to the
121
+ * same device, or another machine replacing it, gets another id.
122
+ */
123
+ machineId: string;
124
+ /** The connection id, the same the kernel sends to the machine in `ready`. */
125
+ connectionId: string;
109
126
  }
110
127
  /**
111
128
  * `ctx.dialIn` (requires `permissions.dialIn`): talks to the machines serving this extension's
@@ -121,6 +138,17 @@ export interface DialInChannel {
121
138
  signal?: AbortSignal;
122
139
  }): Promise<unknown>;
123
140
  online(deviceId: string): Promise<boolean>;
141
+ /**
142
+ * The negotiated frame capacity of the machine's current connection: the `maxFrameBytes` the
143
+ * kernel sent in that connection's `ready` (the smaller of the machine's announced
144
+ * `transport.maxFrameBytes` and the deployment's limit). A provider sizes its request bodies
145
+ * and the answers it asks for by it: a `req` frame larger than this is refused. Null when no
146
+ * machine holds the device now. Read from shared state at every call, so a reconnect with
147
+ * another capacity shows at once; it can change between this call and a later request.
148
+ */
149
+ capacity(deviceId: string): Promise<{
150
+ maxFrameBytes: number;
151
+ } | null>;
124
152
  stop(deviceId: string, reason: "drain" | "stop"): Promise<void>;
125
153
  }
126
154
  /**
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "0.1.0-rc.55";
1
+ export declare const SDK_VERSION = "0.1.0-rc.56";
2
2
  export * from "./agent-template.js";
3
3
  export * from "./avatar-presets.js";
4
4
  export * from "./bootstrap.js";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const SDK_VERSION = "0.1.0-rc.55";
1
+ export const SDK_VERSION = "0.1.0-rc.56";
2
2
  export * from "./agent-template.js";
3
3
  export * from "./avatar-presets.js";
4
4
  export * from "./bootstrap.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/plugin-sdk",
3
- "version": "0.1.0-rc.55",
3
+ "version": "0.1.0-rc.56",
4
4
  "description": "Capybara plugin SDK: the types and pure functions plugins are written against",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {