connectonion 0.0.6 → 0.0.8
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/connect.d.ts +45 -2
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +194 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +3 -1
- package/package.json +1 -1
package/dist/connect.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export interface Response {
|
|
|
39
39
|
done: boolean;
|
|
40
40
|
}
|
|
41
41
|
/** Chat item type */
|
|
42
|
-
export type ChatItemType = 'user' | 'agent' | 'thinking' | 'tool_call' | 'ask_user' | 'approval_needed' | 'onboard_required' | 'onboard_success' | 'intent' | 'eval' | 'compact';
|
|
42
|
+
export type ChatItemType = 'user' | 'agent' | 'thinking' | 'tool_call' | 'ask_user' | 'approval_needed' | 'onboard_required' | 'onboard_success' | 'intent' | 'eval' | 'compact' | 'tool_blocked';
|
|
43
43
|
/** Chat item - data for rendering one element in chat UI */
|
|
44
44
|
export type ChatItem = {
|
|
45
45
|
id: string;
|
|
@@ -123,6 +123,12 @@ export type ChatItem = {
|
|
|
123
123
|
context_percent?: number;
|
|
124
124
|
message?: string;
|
|
125
125
|
error?: string;
|
|
126
|
+
} | {
|
|
127
|
+
id: string;
|
|
128
|
+
type: 'tool_blocked';
|
|
129
|
+
tool: string;
|
|
130
|
+
reason: string;
|
|
131
|
+
message: string;
|
|
126
132
|
};
|
|
127
133
|
type WebSocketLike = {
|
|
128
134
|
onopen: ((ev?: unknown) => unknown) | null;
|
|
@@ -135,6 +141,36 @@ type WebSocketLike = {
|
|
|
135
141
|
close(): void;
|
|
136
142
|
};
|
|
137
143
|
type WebSocketCtor = new (url: string) => WebSocketLike;
|
|
144
|
+
/**
|
|
145
|
+
* Public agent info returned by fetchAgentInfo.
|
|
146
|
+
*/
|
|
147
|
+
export interface AgentInfo {
|
|
148
|
+
address: string;
|
|
149
|
+
name?: string;
|
|
150
|
+
tools?: string[];
|
|
151
|
+
trust?: string;
|
|
152
|
+
version?: string;
|
|
153
|
+
online: boolean;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Fetch agent info by resolving through relay then hitting /info endpoint.
|
|
157
|
+
* Reuses the same resolution logic as connect() internally.
|
|
158
|
+
*
|
|
159
|
+
* @param agentAddress - Agent's public address (0x...)
|
|
160
|
+
* @param relayUrl - Relay server URL (default: wss://oo.openonion.ai)
|
|
161
|
+
* @returns Agent info including name, tools, trust level, and online status
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* import { fetchAgentInfo } from 'connectonion';
|
|
166
|
+
*
|
|
167
|
+
* const info = await fetchAgentInfo('0x3d4017c3...');
|
|
168
|
+
* console.log(info.name); // "my-agent"
|
|
169
|
+
* console.log(info.online); // true
|
|
170
|
+
* console.log(info.tools); // ["search", "calculate"]
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
export declare function fetchAgentInfo(agentAddress: string, relayUrl?: string): Promise<AgentInfo>;
|
|
138
174
|
export interface ConnectOptions {
|
|
139
175
|
/** Signing keys for authenticated requests */
|
|
140
176
|
keys?: address.AddressData;
|
|
@@ -197,6 +233,8 @@ export declare class RemoteAgent {
|
|
|
197
233
|
private _keys?;
|
|
198
234
|
private _relayUrl;
|
|
199
235
|
private _directUrl?;
|
|
236
|
+
private _resolvedEndpoint?;
|
|
237
|
+
private _endpointResolved;
|
|
200
238
|
private _WS;
|
|
201
239
|
/** Current status: 'idle' | 'working' | 'waiting' */
|
|
202
240
|
private _status;
|
|
@@ -303,9 +341,14 @@ export declare class RemoteAgent {
|
|
|
303
341
|
* Stop health check interval.
|
|
304
342
|
*/
|
|
305
343
|
private _stopHealthCheck;
|
|
344
|
+
/**
|
|
345
|
+
* Try to resolve endpoint for the agent address.
|
|
346
|
+
* Only attempts once, caches result.
|
|
347
|
+
*/
|
|
348
|
+
private _tryResolveEndpoint;
|
|
306
349
|
/**
|
|
307
350
|
* Stream input to agent with real-time UI events.
|
|
308
|
-
* Uses directUrl if provided, otherwise
|
|
351
|
+
* Uses directUrl if provided, otherwise tries auto-discovery, then falls back to relay.
|
|
309
352
|
*/
|
|
310
353
|
private _streamInput;
|
|
311
354
|
/**
|
package/dist/connect.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAM7C;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAMD,qBAAqB;AACrB,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAM7C;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAMD,qBAAqB;AACrB,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,iBA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AC,QAAQ,EAAE,OAAO,EAAE,KAAK,GAAE,MAAM,GAAG,SAAkB,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,gBAAgB,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAa1J;;;;;OAKG;IACH,aAAa,CAAC,OAAO,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAuBvE;;;OAGG;IACH,OAAO,CAAC,WAAW;IAqBnB;;;OAGG;YACW,cAAc;IAsC5B;;OAEG;IACH,OAAO,CAAC,cAAc;IAUtB;;OAEG;IACH,OAAO,CAAC,eAAe;IAUvB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAmCzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;;OAGG;YACW,mBAAmB;IAgBjC;;;OAGG;YACW,YAAY;IA8U1B;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAOjC;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IA2M1B;;;;OAIG;IACH,OAAO,CAAC,YAAY;IASpB,2CAA2C;IAC3C,OAAO,CAAC,YAAY;IAmBpB,QAAQ,IAAI,MAAM;CAInB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,OAAO,CACrB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,cAAmB,GAC3B,WAAW,CAEb"}
|
package/dist/connect.js
CHANGED
|
@@ -62,6 +62,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
62
62
|
})();
|
|
63
63
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
64
|
exports.RemoteAgent = void 0;
|
|
65
|
+
exports.fetchAgentInfo = fetchAgentInfo;
|
|
65
66
|
exports.connect = connect;
|
|
66
67
|
const address = __importStar(require("./address"));
|
|
67
68
|
function defaultWebSocketCtor() {
|
|
@@ -113,6 +114,150 @@ function normalizeRelayBase(relayUrl) {
|
|
|
113
114
|
}
|
|
114
115
|
return normalized;
|
|
115
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Sort endpoints by priority: localhost first, then local network, then public.
|
|
119
|
+
*/
|
|
120
|
+
function sortEndpoints(endpoints) {
|
|
121
|
+
return [...endpoints].sort((a, b) => {
|
|
122
|
+
const getPriority = (url) => {
|
|
123
|
+
if (url.includes('localhost') || url.includes('127.0.0.1'))
|
|
124
|
+
return 0;
|
|
125
|
+
if (url.includes('192.168.') || url.includes('10.') || url.includes('172.16.'))
|
|
126
|
+
return 1;
|
|
127
|
+
return 2;
|
|
128
|
+
};
|
|
129
|
+
return getPriority(a) - getPriority(b);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Resolve the best endpoint for an agent address.
|
|
134
|
+
*
|
|
135
|
+
* Steps:
|
|
136
|
+
* 1. Query relay server for agent endpoints
|
|
137
|
+
* 2. Sort by priority (localhost → local network → public)
|
|
138
|
+
* 3. Verify each HTTP endpoint by checking /info
|
|
139
|
+
* 4. Return first working endpoint where address matches
|
|
140
|
+
*
|
|
141
|
+
* @param agentAddress - Agent's public address (0x...)
|
|
142
|
+
* @param relayUrl - Relay server URL
|
|
143
|
+
* @param timeoutMs - Timeout for each endpoint check (default: 3000ms)
|
|
144
|
+
* @returns Resolved endpoint or null if none work
|
|
145
|
+
*/
|
|
146
|
+
async function resolveEndpoint(agentAddress, relayUrl, timeoutMs = 3000) {
|
|
147
|
+
const normalizedRelay = normalizeRelayBase(relayUrl);
|
|
148
|
+
const httpsRelay = normalizedRelay.replace(/^wss?:\/\//, 'https://');
|
|
149
|
+
// Step 1: Query relay for agent info
|
|
150
|
+
let agentInfo;
|
|
151
|
+
try {
|
|
152
|
+
const response = await fetch(`${httpsRelay}/api/relay/agents/${agentAddress}`, {
|
|
153
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
154
|
+
});
|
|
155
|
+
if (!response.ok) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
agentInfo = await response.json();
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
if (!agentInfo.online || !agentInfo.endpoints?.length) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
// Step 2: Sort endpoints (localhost first)
|
|
167
|
+
const sortedEndpoints = sortEndpoints(agentInfo.endpoints);
|
|
168
|
+
// Step 3: Try each HTTP endpoint
|
|
169
|
+
const httpEndpoints = sortedEndpoints.filter(ep => ep.startsWith('http://') || ep.startsWith('https://'));
|
|
170
|
+
for (const httpUrl of httpEndpoints) {
|
|
171
|
+
try {
|
|
172
|
+
const infoResponse = await fetch(`${httpUrl}/info`, {
|
|
173
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
174
|
+
});
|
|
175
|
+
if (!infoResponse.ok)
|
|
176
|
+
continue;
|
|
177
|
+
const info = await infoResponse.json();
|
|
178
|
+
// Step 4: Verify address matches
|
|
179
|
+
if (info.address === agentAddress) {
|
|
180
|
+
// Find corresponding WebSocket URL
|
|
181
|
+
const baseUrl = httpUrl.replace(/^https?:\/\//, '');
|
|
182
|
+
const protocol = httpUrl.startsWith('https') ? 'wss' : 'ws';
|
|
183
|
+
const wsUrl = `${protocol}://${baseUrl}/ws`;
|
|
184
|
+
return { httpUrl, wsUrl };
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
// This endpoint failed, try next
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
const DEFAULT_RELAY = 'wss://oo.openonion.ai';
|
|
195
|
+
/**
|
|
196
|
+
* Fetch agent info by resolving through relay then hitting /info endpoint.
|
|
197
|
+
* Reuses the same resolution logic as connect() internally.
|
|
198
|
+
*
|
|
199
|
+
* @param agentAddress - Agent's public address (0x...)
|
|
200
|
+
* @param relayUrl - Relay server URL (default: wss://oo.openonion.ai)
|
|
201
|
+
* @returns Agent info including name, tools, trust level, and online status
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* import { fetchAgentInfo } from 'connectonion';
|
|
206
|
+
*
|
|
207
|
+
* const info = await fetchAgentInfo('0x3d4017c3...');
|
|
208
|
+
* console.log(info.name); // "my-agent"
|
|
209
|
+
* console.log(info.online); // true
|
|
210
|
+
* console.log(info.tools); // ["search", "calculate"]
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
async function fetchAgentInfo(agentAddress, relayUrl = DEFAULT_RELAY) {
|
|
214
|
+
const normalizedRelay = normalizeRelayBase(relayUrl);
|
|
215
|
+
const httpsRelay = normalizedRelay.replace(/^wss?:\/\//, 'https://');
|
|
216
|
+
// Step 1: Query relay for agent endpoints
|
|
217
|
+
let agentData;
|
|
218
|
+
try {
|
|
219
|
+
const response = await fetch(`${httpsRelay}/api/relay/agents/${agentAddress}`, {
|
|
220
|
+
signal: AbortSignal.timeout(5000),
|
|
221
|
+
});
|
|
222
|
+
if (!response.ok) {
|
|
223
|
+
return { address: agentAddress, online: false };
|
|
224
|
+
}
|
|
225
|
+
agentData = await response.json();
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
return { address: agentAddress, online: false };
|
|
229
|
+
}
|
|
230
|
+
if (!agentData.online || !agentData.endpoints?.length) {
|
|
231
|
+
return { address: agentAddress, online: false };
|
|
232
|
+
}
|
|
233
|
+
// Step 2: Try /info on sorted endpoints (same priority as connect)
|
|
234
|
+
const httpEndpoints = sortEndpoints(agentData.endpoints.filter(ep => ep.startsWith('http://') || ep.startsWith('https://')));
|
|
235
|
+
for (const httpUrl of httpEndpoints) {
|
|
236
|
+
try {
|
|
237
|
+
const infoResponse = await fetch(`${httpUrl}/info`, {
|
|
238
|
+
signal: AbortSignal.timeout(3000),
|
|
239
|
+
});
|
|
240
|
+
if (!infoResponse.ok)
|
|
241
|
+
continue;
|
|
242
|
+
const info = await infoResponse.json();
|
|
243
|
+
if (info.address === agentAddress) {
|
|
244
|
+
return {
|
|
245
|
+
address: agentAddress,
|
|
246
|
+
name: info.name,
|
|
247
|
+
tools: info.tools,
|
|
248
|
+
trust: info.trust,
|
|
249
|
+
version: info.version,
|
|
250
|
+
online: true,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
catch {
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// Endpoints exist but /info didn't work — still online via relay
|
|
259
|
+
return { address: agentAddress, online: true };
|
|
260
|
+
}
|
|
116
261
|
/**
|
|
117
262
|
* Proxy to a remote agent with streaming support.
|
|
118
263
|
*
|
|
@@ -136,6 +281,7 @@ class RemoteAgent {
|
|
|
136
281
|
return this.address;
|
|
137
282
|
}
|
|
138
283
|
constructor(agentAddress, options = {}) {
|
|
284
|
+
this._endpointResolved = false;
|
|
139
285
|
/** Current status: 'idle' | 'working' | 'waiting' */
|
|
140
286
|
this._status = 'idle';
|
|
141
287
|
/** Session state synced from server */
|
|
@@ -416,13 +562,33 @@ class RemoteAgent {
|
|
|
416
562
|
this._healthCheckInterval = null;
|
|
417
563
|
}
|
|
418
564
|
}
|
|
565
|
+
/**
|
|
566
|
+
* Try to resolve endpoint for the agent address.
|
|
567
|
+
* Only attempts once, caches result.
|
|
568
|
+
*/
|
|
569
|
+
async _tryResolveEndpoint() {
|
|
570
|
+
// Skip if already resolved or directUrl was provided
|
|
571
|
+
if (this._endpointResolved || this._directUrl)
|
|
572
|
+
return;
|
|
573
|
+
this._endpointResolved = true;
|
|
574
|
+
// Only try resolution for valid addresses (0x + 64 hex = 66 chars)
|
|
575
|
+
// Short addresses like "0xabc123" in tests will skip resolution
|
|
576
|
+
if (!this.address.startsWith('0x') || this.address.length !== 66)
|
|
577
|
+
return;
|
|
578
|
+
const resolved = await resolveEndpoint(this.address, this._relayUrl);
|
|
579
|
+
if (resolved) {
|
|
580
|
+
this._resolvedEndpoint = resolved;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
419
583
|
/**
|
|
420
584
|
* Stream input to agent with real-time UI events.
|
|
421
|
-
* Uses directUrl if provided, otherwise
|
|
585
|
+
* Uses directUrl if provided, otherwise tries auto-discovery, then falls back to relay.
|
|
422
586
|
*/
|
|
423
587
|
async _streamInput(prompt, timeoutMs) {
|
|
424
588
|
// Lazy-load keys on first use
|
|
425
589
|
this._ensureKeys();
|
|
590
|
+
// Try endpoint resolution (once, cached)
|
|
591
|
+
await this._tryResolveEndpoint();
|
|
426
592
|
// Add user event to UI
|
|
427
593
|
this._addChatItem({ type: 'user', content: prompt });
|
|
428
594
|
// Add optimistic thinking (shows immediately, removed when real events arrive)
|
|
@@ -433,16 +599,23 @@ class RemoteAgent {
|
|
|
433
599
|
// Generate or reuse session_id for tracking and polling fallback
|
|
434
600
|
const sessionId = this._currentSession?.session_id || generateUUID();
|
|
435
601
|
this._saveSessionId(sessionId);
|
|
436
|
-
// Choose connection mode: direct
|
|
602
|
+
// Choose connection mode: direct (explicit or resolved) or via relay
|
|
437
603
|
let wsUrl;
|
|
604
|
+
let isDirect = false;
|
|
438
605
|
if (this._directUrl) {
|
|
439
|
-
//
|
|
606
|
+
// Explicit direct URL provided
|
|
440
607
|
const baseUrl = this._directUrl.replace(/^https?:\/\//, '');
|
|
441
608
|
const protocol = this._directUrl.startsWith('https') ? 'wss' : 'ws';
|
|
442
609
|
wsUrl = `${protocol}://${baseUrl}/ws`;
|
|
610
|
+
isDirect = true;
|
|
611
|
+
}
|
|
612
|
+
else if (this._resolvedEndpoint) {
|
|
613
|
+
// Auto-discovered endpoint
|
|
614
|
+
wsUrl = this._resolvedEndpoint.wsUrl;
|
|
615
|
+
isDirect = true;
|
|
443
616
|
}
|
|
444
617
|
else {
|
|
445
|
-
//
|
|
618
|
+
// Fallback to relay
|
|
446
619
|
wsUrl = `${this._relayUrl}/ws/input`;
|
|
447
620
|
}
|
|
448
621
|
const ws = new this._WS(wsUrl);
|
|
@@ -484,7 +657,7 @@ class RemoteAgent {
|
|
|
484
657
|
timestamp: Math.floor(Date.now() / 1000),
|
|
485
658
|
};
|
|
486
659
|
// Only include 'to' when using relay (not needed for direct connection)
|
|
487
|
-
if (!
|
|
660
|
+
if (!isDirect) {
|
|
488
661
|
payload.to = this.address;
|
|
489
662
|
}
|
|
490
663
|
const signed = this._signPayload(payload);
|
|
@@ -495,7 +668,7 @@ class RemoteAgent {
|
|
|
495
668
|
...signed,
|
|
496
669
|
};
|
|
497
670
|
// Only include 'to' for relay mode
|
|
498
|
-
if (!
|
|
671
|
+
if (!isDirect) {
|
|
499
672
|
inputMessage.to = this.address;
|
|
500
673
|
}
|
|
501
674
|
// Include session if we have one, or create new session with session_id
|
|
@@ -544,7 +717,8 @@ class RemoteAgent {
|
|
|
544
717
|
if (data?.type === 'llm_call' || data?.type === 'llm_result' ||
|
|
545
718
|
data?.type === 'tool_call' || data?.type === 'tool_result' ||
|
|
546
719
|
data?.type === 'thinking' || data?.type === 'assistant' ||
|
|
547
|
-
data?.type === 'intent' || data?.type === 'eval' || data?.type === 'compact'
|
|
720
|
+
data?.type === 'intent' || data?.type === 'eval' || data?.type === 'compact' ||
|
|
721
|
+
data?.type === 'tool_blocked') {
|
|
548
722
|
this._handleStreamEvent(data);
|
|
549
723
|
}
|
|
550
724
|
// Handle ask_user event (agent needs more input)
|
|
@@ -600,7 +774,7 @@ class RemoteAgent {
|
|
|
600
774
|
prompt: retryPrompt,
|
|
601
775
|
timestamp: Math.floor(Date.now() / 1000),
|
|
602
776
|
};
|
|
603
|
-
if (!
|
|
777
|
+
if (!isDirect) {
|
|
604
778
|
retryPayload.to = this.address;
|
|
605
779
|
}
|
|
606
780
|
const retrySigned = this._signPayload(retryPayload);
|
|
@@ -610,7 +784,7 @@ class RemoteAgent {
|
|
|
610
784
|
prompt: retryPrompt,
|
|
611
785
|
...retrySigned,
|
|
612
786
|
};
|
|
613
|
-
if (!
|
|
787
|
+
if (!isDirect) {
|
|
614
788
|
retryMessage.to = this.address;
|
|
615
789
|
}
|
|
616
790
|
if (this._currentSession) {
|
|
@@ -626,7 +800,7 @@ class RemoteAgent {
|
|
|
626
800
|
// Handle OUTPUT (final response)
|
|
627
801
|
// Direct mode: accept any OUTPUT (1:1 connection, no routing needed)
|
|
628
802
|
// Relay mode: match input_id for proper routing
|
|
629
|
-
const isOutputForUs =
|
|
803
|
+
const isOutputForUs = isDirect
|
|
630
804
|
? data?.type === 'OUTPUT'
|
|
631
805
|
: data?.type === 'OUTPUT' && data?.input_id === inputId;
|
|
632
806
|
if (isOutputForUs) {
|
|
@@ -907,6 +1081,16 @@ class RemoteAgent {
|
|
|
907
1081
|
}
|
|
908
1082
|
break;
|
|
909
1083
|
}
|
|
1084
|
+
case 'tool_blocked': {
|
|
1085
|
+
// Tool was blocked (e.g., bash file creation blocked by prefer_write_tool)
|
|
1086
|
+
this._addChatItem({
|
|
1087
|
+
type: 'tool_blocked',
|
|
1088
|
+
tool: event.tool,
|
|
1089
|
+
reason: event.reason,
|
|
1090
|
+
message: event.message,
|
|
1091
|
+
});
|
|
1092
|
+
break;
|
|
1093
|
+
}
|
|
910
1094
|
}
|
|
911
1095
|
}
|
|
912
1096
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export * from './trust/tools';
|
|
|
17
17
|
export * from './types';
|
|
18
18
|
export { llmDo } from './llm/llm-do';
|
|
19
19
|
export { transcribe, type TranscribeOptions } from './transcribe';
|
|
20
|
-
export { connect, RemoteAgent, Response, ChatItem, ChatItemType, AgentStatus, ConnectOptions, SessionState, } from './connect';
|
|
20
|
+
export { connect, RemoteAgent, Response, ChatItem, ChatItemType, AgentStatus, ConnectOptions, SessionState, fetchAgentInfo, AgentInfo, } from './connect';
|
|
21
21
|
export * as address from './address';
|
|
22
22
|
export * as addressBrowser from './address-browser';
|
|
23
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,0BAA0B,EAC1B,YAAY,EACZ,IAAI,GACL,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChE,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAE9B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EACL,OAAO,EACP,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,cAAc,EACd,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,0BAA0B,EAC1B,YAAY,EACZ,IAAI,GACL,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChE,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAE9B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EACL,OAAO,EACP,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,cAAc,EACd,YAAY,EACZ,cAAc,EACd,SAAS,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
44
44
|
};
|
|
45
45
|
})();
|
|
46
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
-
exports.addressBrowser = exports.address = exports.RemoteAgent = exports.connect = exports.transcribe = exports.llmDo = exports.replay = exports.xrayReplay = exports.withReplay = exports.xrayTrace = exports.xray = exports.processTools = exports.extractMethodsFromInstance = exports.isClassInstance = exports.createToolFromFunction = exports.GeminiLLM = exports.AnthropicLLM = exports.OpenAILLM = exports.createLLM = exports.Agent = void 0;
|
|
47
|
+
exports.addressBrowser = exports.address = exports.fetchAgentInfo = exports.RemoteAgent = exports.connect = exports.transcribe = exports.llmDo = exports.replay = exports.xrayReplay = exports.withReplay = exports.xrayTrace = exports.xray = exports.processTools = exports.extractMethodsFromInstance = exports.isClassInstance = exports.createToolFromFunction = exports.GeminiLLM = exports.AnthropicLLM = exports.OpenAILLM = exports.createLLM = exports.Agent = void 0;
|
|
48
48
|
var agent_1 = require("./core/agent");
|
|
49
49
|
Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return agent_1.Agent; } });
|
|
50
50
|
var llm_1 = require("./llm");
|
|
@@ -75,5 +75,6 @@ Object.defineProperty(exports, "transcribe", { enumerable: true, get: function (
|
|
|
75
75
|
var connect_1 = require("./connect");
|
|
76
76
|
Object.defineProperty(exports, "connect", { enumerable: true, get: function () { return connect_1.connect; } });
|
|
77
77
|
Object.defineProperty(exports, "RemoteAgent", { enumerable: true, get: function () { return connect_1.RemoteAgent; } });
|
|
78
|
+
Object.defineProperty(exports, "fetchAgentInfo", { enumerable: true, get: function () { return connect_1.fetchAgentInfo; } });
|
|
78
79
|
exports.address = __importStar(require("./address"));
|
|
79
80
|
exports.addressBrowser = __importStar(require("./address-browser"));
|
package/dist/react/index.d.ts
CHANGED
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
import { Response, ChatItem, AgentStatus, ConnectOptions } from '../connect';
|
|
21
|
-
export type { Response, ChatItem, ChatItemType, AgentStatus, ConnectOptions, } from '../connect';
|
|
21
|
+
export type { Response, ChatItem, ChatItemType, AgentStatus, ConnectOptions, AgentInfo, } from '../connect';
|
|
22
|
+
export { fetchAgentInfo } from '../connect';
|
|
22
23
|
/** @deprecated Use ChatItem instead */
|
|
23
24
|
export type UIEvent = ChatItem;
|
|
24
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAGL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,cAAc,EACf,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAGL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,cAAc,EACf,MAAM,YAAY,CAAC;AAGp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,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5E,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,cAAmB,GAC3B,cAAc,CAwGhB;AAMD,wBAAgB,cAAc,CAAC,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,EACvD,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,CAAC,GACN,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,CAExC;AAED,6CAA6C;AAC7C,eAAO,MAAM,WAAW,uBAAiB,CAAC;AAG1C,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,eAAe,EACf,WAAW,EACX,WAAW,EACX,WAAW,EACX,0BAA0B,EAC1B,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC"}
|
package/dist/react/index.js
CHANGED
|
@@ -19,13 +19,15 @@
|
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.createSignedPayloadBrowser = exports.signBrowser = exports.loadBrowser = exports.saveBrowser = exports.generateBrowser = exports.useVoiceInput = exports.isEventType = void 0;
|
|
22
|
+
exports.createSignedPayloadBrowser = exports.signBrowser = exports.loadBrowser = exports.saveBrowser = exports.generateBrowser = exports.useVoiceInput = exports.isEventType = exports.fetchAgentInfo = void 0;
|
|
23
23
|
exports.useAgent = useAgent;
|
|
24
24
|
exports.isChatItemType = isChatItemType;
|
|
25
25
|
const react_1 = require("react");
|
|
26
26
|
const zustand_1 = require("zustand");
|
|
27
27
|
const middleware_1 = require("zustand/middleware");
|
|
28
28
|
const connect_1 = require("../connect");
|
|
29
|
+
var connect_2 = require("../connect");
|
|
30
|
+
Object.defineProperty(exports, "fetchAgentInfo", { enumerable: true, get: function () { return connect_2.fetchAgentInfo; } });
|
|
29
31
|
// =============================================================================
|
|
30
32
|
// Utilities
|
|
31
33
|
// =============================================================================
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "connectonion",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Connect to Python AI agents from TypeScript apps - Use powerful Python agents in your React, Next.js, Node.js, and Electron applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|