@tangle-network/sandbox 0.60.78-develop.20261022130925.e788df6 → 0.60.78-develop.20261022172520.01f1bbb
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.
|
@@ -144,7 +144,7 @@ interface RunSpanWindow {
|
|
|
144
144
|
* `additionalProperties` on the wire — the row carries more columns than the
|
|
145
145
|
* documented core, so the type is open.
|
|
146
146
|
*/
|
|
147
|
-
interface
|
|
147
|
+
interface IntelligenceRun {
|
|
148
148
|
id: string;
|
|
149
149
|
tenantId: string;
|
|
150
150
|
runDir: string | null;
|
|
@@ -159,7 +159,7 @@ interface Run {
|
|
|
159
159
|
}
|
|
160
160
|
/** A page of eval-runs. Offset is legacy; follow `nextCursor` to paginate. */
|
|
161
161
|
interface RunList {
|
|
162
|
-
items:
|
|
162
|
+
items: IntelligenceRun[];
|
|
163
163
|
limit: number;
|
|
164
164
|
offset: number;
|
|
165
165
|
nextCursor: string | null;
|
|
@@ -234,14 +234,14 @@ interface RunSessionList {
|
|
|
234
234
|
/** Pass as `cursor` for the next page; null on the last page. */
|
|
235
235
|
nextCursor: string | null;
|
|
236
236
|
}
|
|
237
|
-
/** Query params for {@link
|
|
237
|
+
/** Query params for {@link IntelligenceTraceClient.listRunSessionFiles}. */
|
|
238
238
|
interface ListRunSessionFilesParams {
|
|
239
239
|
/** Files per page, clamped server-side to `[1, 5000]` (default 1000). */
|
|
240
240
|
limit?: number;
|
|
241
241
|
/** Opaque cursor from the prior page's `nextCursor`. */
|
|
242
242
|
cursor?: string;
|
|
243
243
|
}
|
|
244
|
-
/** Query params for {@link
|
|
244
|
+
/** Query params for {@link IntelligenceTraceClient.listTraces}. */
|
|
245
245
|
interface ListTracesParams {
|
|
246
246
|
/** Page size, clamped server-side to `[1, 200]` (default 50). */
|
|
247
247
|
limit?: number;
|
|
@@ -260,14 +260,14 @@ interface ListTracesParams {
|
|
|
260
260
|
/** Opaque cursor from the prior response's `nextCursor`. */
|
|
261
261
|
cursor?: string;
|
|
262
262
|
}
|
|
263
|
-
/** Query params for {@link
|
|
263
|
+
/** Query params for {@link IntelligenceTraceClient.getTraceSpans}. */
|
|
264
264
|
interface GetTraceSpansParams {
|
|
265
265
|
/** Page size, clamped server-side to `INTELLIGENCE_TRACE_SPAN_LIMIT`. */
|
|
266
266
|
limit?: number;
|
|
267
267
|
/** Opaque cursor over `(start_unix_nano, span id)` from the prior page. */
|
|
268
268
|
cursor?: string;
|
|
269
269
|
}
|
|
270
|
-
/** Query params for {@link
|
|
270
|
+
/** Query params for {@link IntelligenceTraceClient.listRuns}. */
|
|
271
271
|
interface ListRunsParams {
|
|
272
272
|
limit?: number;
|
|
273
273
|
/** Legacy offset pagination; ignored once `cursor` is supplied. */
|
|
@@ -282,7 +282,7 @@ interface ListRunsParams {
|
|
|
282
282
|
label?: string;
|
|
283
283
|
cursor?: string;
|
|
284
284
|
}
|
|
285
|
-
/** Query params for {@link
|
|
285
|
+
/** Query params for {@link IntelligenceTraceClient.listSessions}. */
|
|
286
286
|
interface ListSessionsParams {
|
|
287
287
|
limit?: number;
|
|
288
288
|
from?: string;
|
|
@@ -293,7 +293,7 @@ interface ListSessionsParams {
|
|
|
293
293
|
userId?: string;
|
|
294
294
|
cursor?: string;
|
|
295
295
|
}
|
|
296
|
-
/** Query params for {@link
|
|
296
|
+
/** Query params for {@link IntelligenceTraceClient.getSessionTraces}. */
|
|
297
297
|
interface GetSessionTracesParams {
|
|
298
298
|
limit?: number;
|
|
299
299
|
cursor?: string;
|
|
@@ -302,7 +302,7 @@ interface GetSessionTracesParams {
|
|
|
302
302
|
* Browser-safe typed client for the Tangle Intelligence trace-read surface.
|
|
303
303
|
* Construct via {@link createIntelligenceClient}.
|
|
304
304
|
*/
|
|
305
|
-
interface
|
|
305
|
+
interface IntelligenceTraceClient {
|
|
306
306
|
/** List tenant-wide trace summaries (one row per trace), newest first. */
|
|
307
307
|
listTraces(params?: ListTracesParams): Promise<TraceSummaryList>;
|
|
308
308
|
/** List one trace's spans, keyset-paginated. */
|
|
@@ -317,7 +317,7 @@ interface IntelligenceClient {
|
|
|
317
317
|
/** List the tenant's eval-runs, newest first. */
|
|
318
318
|
listRuns(params?: ListRunsParams): Promise<RunList>;
|
|
319
319
|
/** Fetch a single eval-run. */
|
|
320
|
-
getRun(runId: string): Promise<
|
|
320
|
+
getRun(runId: string): Promise<IntelligenceRun>;
|
|
321
321
|
/** List the spans pivoted to this run (by `run_id`), bounded window. */
|
|
322
322
|
getRunTraces(runId: string): Promise<RunSpanWindow>;
|
|
323
323
|
/**
|
|
@@ -361,6 +361,6 @@ interface IntelligenceClient {
|
|
|
361
361
|
* @param config.apiKey Customer key (`sk-tan-*`) — Bearer auth, resolved to a tenant.
|
|
362
362
|
* @param config.baseUrl Intelligence-api host; defaults to {@link DEFAULT_INTELLIGENCE_BASE_URL}.
|
|
363
363
|
*/
|
|
364
|
-
declare function createIntelligenceClient(config: IntelligenceClientConfig):
|
|
364
|
+
declare function createIntelligenceClient(config: IntelligenceClientConfig): IntelligenceTraceClient;
|
|
365
365
|
//#endregion
|
|
366
|
-
export { DEFAULT_INTELLIGENCE_BASE_URL, GetSessionTracesParams, GetTraceSpansParams, IntelligenceClient, IntelligenceClientConfig, ListRunSessionFilesParams, ListRunsParams, ListSessionsParams, ListTracesParams, NanoString,
|
|
366
|
+
export { DEFAULT_INTELLIGENCE_BASE_URL, GetSessionTracesParams, GetTraceSpansParams, type IntelligenceTraceClient as IntelligenceClient, IntelligenceTraceClient, IntelligenceClientConfig, IntelligenceRun, type IntelligenceRun as Run, ListRunSessionFilesParams, ListRunsParams, ListSessionsParams, ListTracesParams, NanoString, RunList, RunSessionFile, RunSessionList, RunSessionSeal, RunSpanWindow, SerializedSpan, SessionSummary, SessionSummaryList, SpanPage, TraceStatus, TraceSummary, TraceSummaryList, createIntelligenceClient };
|
package/dist/openai/index.d.ts
CHANGED
|
@@ -525,7 +525,7 @@ interface ToolOutput {
|
|
|
525
525
|
* terminal frame; the iterator itself does not classify frames.
|
|
526
526
|
*/
|
|
527
527
|
declare function runEvents(threadId: string | undefined, runId: string, source: RunEventSource): AsyncIterable<TangleSSEEvent>;
|
|
528
|
-
interface
|
|
528
|
+
interface OpenAIRunOptions {
|
|
529
529
|
id: string;
|
|
530
530
|
threadId?: string;
|
|
531
531
|
partnerId: string;
|
|
@@ -554,7 +554,7 @@ declare class Run {
|
|
|
554
554
|
private startPromise;
|
|
555
555
|
private pendingCalls;
|
|
556
556
|
private cancelRequested;
|
|
557
|
-
constructor(opts:
|
|
557
|
+
constructor(opts: OpenAIRunOptions);
|
|
558
558
|
get status(): RunStatus;
|
|
559
559
|
/**
|
|
560
560
|
* Subscribe to typed events. May only be consumed once per Run.
|
|
@@ -676,4 +676,4 @@ declare function outcomeToFinishReason(outcome: string, hasToolCall: boolean): O
|
|
|
676
676
|
*/
|
|
677
677
|
declare function openaiMessagesToSandboxInput(messages: ChatCompletionMessageParam[], tools: ChatCompletionTool[] | undefined, model: string): SandboxRunInput;
|
|
678
678
|
//#endregion
|
|
679
|
-
export { type ActionRateLimitOptions, type AfterHookOutcome, type AuditEvent, type AuditLogOptions, type BeforeHookOutcome, type BufferedToolCall, type CostCapOptions, type DestructiveActionGuardOptions, type EgressPolicyOptions, EmbeddingValidationError, HookChain, type HookSurface, InMemoryResponseStore, type MultimodalPart, type NormalizedEmbeddingInput, type NormalizedEmbeddingRequest, type OpenAIFinishReason, type OpenAITerminal, type PriorToolCall, type PriorToolResult, type PriorTurn, type RedactionRegion, type ResponseStore, ResponsesValidationError, Run, type RunEvent, type RunEventSource, type RunOptions, type RunStatus, type SandboxRunInput, type SandboxToolSpec, type ScreenshotRedactionOptions, type TangleRouterResponsesWebSearchOptions, type TangleSSEEvent, type ToolCallContext, type ToolOutput, type ToolResult, type TranslatorContext, actionRateLimitHook, assembleResponseOutput, auditLogHook, buildResponseShell, classifyOpenAITerminal, classifyOpenAITerminalEvents, costCapHook, createTranslatorContext, destructiveActionGuardHook, egressPolicyHook, normalizeResponsesWebSearchForTangleRouter, openaiMessagesToSandboxInput, outcomeToFinishReason, resolvePreviousResponseId, runEvents, sandboxEventToChatChunk, sandboxEventToCompletionChunk, sandboxEventToResponsesEvent, screenshotRedactionHook, usageFromEvents, validateEmbeddingRequest, validateResponsesRequest };
|
|
679
|
+
export { type ActionRateLimitOptions, type AfterHookOutcome, type AuditEvent, type AuditLogOptions, type BeforeHookOutcome, type BufferedToolCall, type CostCapOptions, type DestructiveActionGuardOptions, type EgressPolicyOptions, EmbeddingValidationError, HookChain, type HookSurface, InMemoryResponseStore, type MultimodalPart, type NormalizedEmbeddingInput, type NormalizedEmbeddingRequest, type OpenAIFinishReason, type OpenAITerminal, type PriorToolCall, type PriorToolResult, type PriorTurn, type RedactionRegion, type ResponseStore, ResponsesValidationError, Run, type RunEvent, type RunEventSource, type OpenAIRunOptions as RunOptions, type RunStatus, type SandboxRunInput, type SandboxToolSpec, type ScreenshotRedactionOptions, type TangleRouterResponsesWebSearchOptions, type TangleSSEEvent, type ToolCallContext, type ToolOutput, type ToolResult, type TranslatorContext, actionRateLimitHook, assembleResponseOutput, auditLogHook, buildResponseShell, classifyOpenAITerminal, classifyOpenAITerminalEvents, costCapHook, createTranslatorContext, destructiveActionGuardHook, egressPolicyHook, normalizeResponsesWebSearchForTangleRouter, openaiMessagesToSandboxInput, outcomeToFinishReason, resolvePreviousResponseId, runEvents, sandboxEventToChatChunk, sandboxEventToCompletionChunk, sandboxEventToResponsesEvent, screenshotRedactionHook, usageFromEvents, validateEmbeddingRequest, validateResponsesRequest };
|
|
@@ -431,7 +431,7 @@ interface SessionGatewayStats {
|
|
|
431
431
|
*/
|
|
432
432
|
declare function calculateConnectionQuality(metrics: ConnectionMetrics, isConnected: boolean): ConnectionQuality;
|
|
433
433
|
//#endregion
|
|
434
|
-
//#region ../../../packages/sdk/dist/client-
|
|
434
|
+
//#region ../../../packages/sdk/dist/client-DlMgBOqN.d.ts
|
|
435
435
|
//#region src/session-gateway/core-types.d.ts
|
|
436
436
|
interface SubscriptionDenial {
|
|
437
437
|
channel: string;
|
|
@@ -505,8 +505,6 @@ declare class SessionGatewayClientCore {
|
|
|
505
505
|
private state;
|
|
506
506
|
private readonly counters;
|
|
507
507
|
private readonly connectionWaiters;
|
|
508
|
-
private readonly reconnects;
|
|
509
|
-
private readonly heartbeat;
|
|
510
508
|
private readonly metrics;
|
|
511
509
|
private readonly replayCursor;
|
|
512
510
|
private readonly inbound;
|
|
@@ -33,7 +33,7 @@ function calculateConnectionQuality(metrics, isConnected) {
|
|
|
33
33
|
return "good";
|
|
34
34
|
}
|
|
35
35
|
//#endregion
|
|
36
|
-
//#region ../../../packages/sdk/dist/types-
|
|
36
|
+
//#region ../../../packages/sdk/dist/types-B1NMYFuB.js
|
|
37
37
|
function invokeClientCallback(name, callback, onError) {
|
|
38
38
|
try {
|
|
39
39
|
callback();
|
|
@@ -713,8 +713,8 @@ var SessionGatewayClientCore = class {
|
|
|
713
713
|
eventsReceived: 0
|
|
714
714
|
};
|
|
715
715
|
connectionWaiters;
|
|
716
|
-
reconnects;
|
|
717
|
-
heartbeat;
|
|
716
|
+
#reconnects;
|
|
717
|
+
#heartbeat;
|
|
718
718
|
metrics;
|
|
719
719
|
replayCursor;
|
|
720
720
|
inbound;
|
|
@@ -724,9 +724,9 @@ var SessionGatewayClientCore = class {
|
|
|
724
724
|
this.#config = resolveClientConfig(config);
|
|
725
725
|
this.handlers = config.handlers ?? {};
|
|
726
726
|
this.connectionWaiters = new ConnectionWaiters(this.#config.connectionEstablishmentTimeoutMs);
|
|
727
|
-
this
|
|
727
|
+
this.#reconnects = new ReconnectScheduler(this.#config);
|
|
728
728
|
this.metrics = new ConnectionMetricsTracker(initialMetrics, this.#config.latencyHistorySize, () => this.state === "connected", (metrics) => invokeClientCallback("onMetricsChange", () => this.handlers.onMetricsChange?.(metrics), this.handlers.onError));
|
|
729
|
-
this
|
|
729
|
+
this.#heartbeat = new Heartbeat(this.#config, this.metrics, () => this.ws, (message) => this.send(message));
|
|
730
730
|
this.replayCursor = new ReplayCursor(new ReplayStateStore(this.#config.enableReplayPersistence, replayStorage, this.#config.replayStorageKeyPrefix, this.#config.url, this.#config.sessionId), {
|
|
731
731
|
enabled: this.#config.enableDeduplication,
|
|
732
732
|
maxSize: this.#config.maxDeduplicationSize
|
|
@@ -749,7 +749,7 @@ var SessionGatewayClientCore = class {
|
|
|
749
749
|
*/
|
|
750
750
|
connect() {
|
|
751
751
|
if (this.state === "connected" || this.state === "connecting" || this.state === "reconnecting") return;
|
|
752
|
-
const nextState = this
|
|
752
|
+
const nextState = this.#reconnects.hasConnectedBefore ? "reconnecting" : "connecting";
|
|
753
753
|
this.setState(nextState);
|
|
754
754
|
if (this.getState() !== nextState) return;
|
|
755
755
|
this.connectWebSocket();
|
|
@@ -769,7 +769,7 @@ var SessionGatewayClientCore = class {
|
|
|
769
769
|
}
|
|
770
770
|
};
|
|
771
771
|
socket.onopen = () => {
|
|
772
|
-
if (this.ws === socket) this
|
|
772
|
+
if (this.ws === socket) this.#heartbeat.resetMissedPongs();
|
|
773
773
|
};
|
|
774
774
|
socket.onclose = (event) => this.handleClose(socket, event.code, event.reason);
|
|
775
775
|
socket.onerror = () => {
|
|
@@ -789,8 +789,8 @@ var SessionGatewayClientCore = class {
|
|
|
789
789
|
*/
|
|
790
790
|
disconnect() {
|
|
791
791
|
this.connectionWaiters.rejectAll(/* @__PURE__ */ new Error("Client disconnected"));
|
|
792
|
-
this
|
|
793
|
-
this
|
|
792
|
+
this.#heartbeat.stop();
|
|
793
|
+
this.#reconnects.cancel();
|
|
794
794
|
this.inbound.requests.rejectAll("Connection closed");
|
|
795
795
|
this.connectionWaiters.established = false;
|
|
796
796
|
const socket = this.ws;
|
|
@@ -870,9 +870,9 @@ var SessionGatewayClientCore = class {
|
|
|
870
870
|
return {
|
|
871
871
|
state: this.state,
|
|
872
872
|
connectedAt: this.counters.connectedAt,
|
|
873
|
-
lastPingAt: this
|
|
874
|
-
lastPongAt: this
|
|
875
|
-
reconnectAttempts: this
|
|
873
|
+
lastPingAt: this.#heartbeat.lastPingAt,
|
|
874
|
+
lastPongAt: this.#heartbeat.lastPongAt,
|
|
875
|
+
reconnectAttempts: this.#reconnects.attempts,
|
|
876
876
|
messagesReceived: this.counters.messagesReceived,
|
|
877
877
|
messagesSent: this.counters.messagesSent,
|
|
878
878
|
eventsReceived: this.counters.eventsReceived,
|
|
@@ -920,12 +920,12 @@ var SessionGatewayClientCore = class {
|
|
|
920
920
|
handleConnectionEstablished(sessionId) {
|
|
921
921
|
if (this.connectionWaiters.established) return;
|
|
922
922
|
this.connectionWaiters.clear();
|
|
923
|
-
const isReconnect = this
|
|
923
|
+
const isReconnect = this.#reconnects.hasConnectedBefore;
|
|
924
924
|
this.connectionWaiters.established = true;
|
|
925
|
-
this
|
|
925
|
+
this.#reconnects.hasConnectedBefore = true;
|
|
926
926
|
this.counters.connectedAt = Date.now();
|
|
927
|
-
this
|
|
928
|
-
this
|
|
927
|
+
this.#reconnects.attempts = 0;
|
|
928
|
+
this.#heartbeat.start();
|
|
929
929
|
const subscribe = this.replayCursor.subscribeMessage(this.#config.channels);
|
|
930
930
|
if (subscribe) this.send(subscribe);
|
|
931
931
|
this.setState("connected");
|
|
@@ -942,12 +942,12 @@ var SessionGatewayClientCore = class {
|
|
|
942
942
|
this.connectionWaiters.clear();
|
|
943
943
|
this.ws = null;
|
|
944
944
|
this.connectionWaiters.established = false;
|
|
945
|
-
this
|
|
946
|
-
this
|
|
945
|
+
this.#heartbeat.stop();
|
|
946
|
+
this.#reconnects.cancel();
|
|
947
947
|
this.inbound.requests.rejectAll("Connection closed");
|
|
948
|
-
if (this
|
|
948
|
+
if (this.#reconnects.canRetry()) {
|
|
949
949
|
this.setState("reconnecting");
|
|
950
|
-
if (this.state === "reconnecting") this
|
|
950
|
+
if (this.state === "reconnecting") this.#reconnects.schedule(() => {
|
|
951
951
|
if (this.state === "reconnecting" && this.ws === null) this.connectWebSocket();
|
|
952
952
|
});
|
|
953
953
|
} else {
|
|
@@ -962,7 +962,7 @@ var SessionGatewayClientCore = class {
|
|
|
962
962
|
const message = parseServerFrame(data, this.handlers);
|
|
963
963
|
if (!message) return;
|
|
964
964
|
if (CONTROL_MESSAGE_TYPES.has(message.type)) {
|
|
965
|
-
if (message.type === "pong") this
|
|
965
|
+
if (message.type === "pong") this.#heartbeat.handlePong(message.timestamp);
|
|
966
966
|
deliverServerMessage(message, this.inbound);
|
|
967
967
|
return;
|
|
968
968
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/sandbox",
|
|
3
|
-
"version": "0.60.78-develop.
|
|
3
|
+
"version": "0.60.78-develop.20261022172520.01f1bbb",
|
|
4
4
|
"description": "Client SDK for the Tangle Sandbox platform - build AI agent applications with dev containers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -159,13 +159,13 @@
|
|
|
159
159
|
"vitest": "^4.1.11",
|
|
160
160
|
"ws": "^8.20.0",
|
|
161
161
|
"yjs": "13.6.30",
|
|
162
|
-
"@products/sandbox-test-utils": "0.0.0",
|
|
163
162
|
"@repo/shared": "0.0.0",
|
|
164
|
-
"@tangle-network/agent-profile-materialize": "0.26.0",
|
|
165
163
|
"@tangle-network/cli-agent-registry": "0.10.2",
|
|
166
164
|
"@tangle-network/runtime-contracts": "0.19.0",
|
|
165
|
+
"@products/sandbox-test-utils": "0.0.0",
|
|
166
|
+
"@tangle-network/sse-core": "0.0.0",
|
|
167
167
|
"@tangle-network/sdk": "4.0.16",
|
|
168
|
-
"@tangle-network/
|
|
168
|
+
"@tangle-network/agent-profile-materialize": "0.26.0"
|
|
169
169
|
},
|
|
170
170
|
"scripts": {
|
|
171
171
|
"build": "node scripts/build-dist.mjs",
|