@stdiobus/workers-registry 1.4.8 → 1.4.10

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.
@@ -85,7 +85,7 @@ export declare class MessageRouter {
85
85
  private readonly writeCallback;
86
86
  /** API keys for agent authentication */
87
87
  private readonly apiKeys;
88
- /** Map of request ID (as string) to pending request info for correlation */
88
+ /** Map of request ID to pending request info for correlation */
89
89
  private readonly pendingRequests;
90
90
  /** Map of agent ID to authentication state */
91
91
  private readonly authState;
@@ -113,13 +113,50 @@ export declare class MessageRouter {
113
113
  * Handle a response from an agent process.
114
114
  *
115
115
  * Intercepts initialize responses to trigger automatic authentication.
116
+ * Handles agent-to-client requests (like session/request_permission) by
117
+ * auto-responding when they cannot be forwarded to the client.
116
118
  * Tracks sessionId mapping for proper notification routing.
117
- * Forwards all responses to stdout with proper sessionId for stdio Bus routing.
119
+ * Forwards all responses to stdout.
118
120
  *
119
121
  * @param agentId - The agent that sent the response
120
122
  * @param response - The response object from the agent
121
123
  */
122
124
  handleAgentResponse(agentId: string, response: object): void;
125
+ /**
126
+ * Handle a request from an agent to the client.
127
+ *
128
+ * Agent-to-client requests (JSON-RPC messages with both `id` and `method`)
129
+ * require a response. Since the Registry Launcher is headless and cannot
130
+ * forward these to a human, we auto-respond to keep the agent unblocked.
131
+ *
132
+ * Known methods:
133
+ * - session/request_permission: Auto-approve with the first "allow" option
134
+ *
135
+ * Unknown methods get a generic success response so the agent continues.
136
+ *
137
+ * @param agentId - The agent that sent the request
138
+ * @param id - The JSON-RPC request id
139
+ * @param method - The JSON-RPC method name
140
+ * @param msg - The full message object
141
+ */
142
+ private handleAgentRequest;
143
+ /**
144
+ * Build an auto-approve result for session/request_permission.
145
+ *
146
+ * Picks the first "allow" option from the request, preferring
147
+ * allow_always > allow_once > first option as fallback.
148
+ *
149
+ * @param msg - The request_permission message
150
+ * @returns The result object for the response
151
+ */
152
+ private buildPermissionResponse;
153
+ /**
154
+ * Send a JSON-RPC message directly to an agent process.
155
+ *
156
+ * @param agentId - The agent to send to
157
+ * @param message - The message to send
158
+ */
159
+ private sendToAgent;
123
160
  /**
124
161
  * Attempt automatic authentication for an agent.
125
162
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdiobus/workers-registry",
3
- "version": "1.4.8",
3
+ "version": "1.4.10",
4
4
  "description": "Worker implementations for stdio Bus kernel - ACP, MCP, and protocol bridges",
5
5
  "type": "module",
6
6
  "main": "./out/dist/workers-registry/acp-registry/index.js",