@withgateway/sdk 0.2.3 → 0.2.5
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/cli.js +13267 -5869
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +13272 -5874
- package/dist/cli.mjs.map +1 -1
- package/dist/files/index.js +83 -31
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +79 -28
- package/dist/files/index.mjs.map +1 -1
- package/dist/hooks/index.d.mts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +4355 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +4243 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/{index-Dpo-t8iO.d.ts → index-1xnxt0Cc.d.ts} +58 -2
- package/dist/index-B0R3IgsV.d.mts +1279 -0
- package/dist/index-B0R3IgsV.d.ts +1279 -0
- package/dist/{index-B5HUQQDE.d.mts → index-C1wDEwH4.d.mts} +58 -2
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +6698 -1606
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6793 -1713
- package/dist/index.mjs.map +1 -1
- package/dist/traces/index.js +72 -20
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +68 -17
- package/dist/traces/index.mjs.map +1 -1
- package/dist/tracing/index.d.mts +1 -1
- package/dist/tracing/index.d.ts +1 -1
- package/dist/tracing/index.js +47 -3
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +42 -2
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +390 -27
- package/dist/worlds/index.d.ts +390 -27
- package/dist/worlds/index.js +2291 -366
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +2281 -356
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +7 -1
- package/runtime/gatewaysdk/environment/_bundle.py +14 -24
- package/runtime/gatewaysdk/environment/_materialize.py +3 -3
- package/runtime/gatewaysdk/environment/schema/api.py +153 -20
- package/runtime/gatewaysdk/environment/schema/compiler.py +14 -0
- package/runtime/gatewaysdk/environment/schema/data.py +21 -19
- package/runtime/gatewaysdk/environment/schema/grading.py +225 -0
- package/runtime/gatewaysdk/environment/schema/host.py +171 -535
- package/runtime/gatewaysdk/environment/schema/ingest.py +3 -11
- package/runtime/gatewaysdk/environment/schema/local.py +32 -126
- package/runtime/gatewaysdk/environment/schema/platform.py +14 -22
- package/runtime/gatewaysdk/environment/schema/proof.py +237 -0
- package/runtime/gatewaysdk/environment/schema/runtime.py +686 -0
- package/runtime/gatewaysdk/environment/schema/skill.py +1 -0
- package/runtime/gatewaysdk/environment/schema/skills/hooks-getting-started/SKILL.md +156 -0
- package/runtime/gatewaysdk/environment/schema/snapshot.py +6 -5
- package/runtime/gatewaysdk/environment/schema/tasks.py +12 -2
- package/runtime/gatewaysdk/environment/schema/tools_world.py +75 -23
- package/runtime/gatewaysdk/environment/schema/verbs.py +136 -0
- package/runtime/gatewaysdk/environment/schema/workers.py +44 -13
- package/runtime/gatewaysdk/environment/world.py +391 -0
- package/skills/hooks-getting-started/SKILL.md +156 -0
|
@@ -295,6 +295,57 @@ declare function isInitialized(): boolean;
|
|
|
295
295
|
*/
|
|
296
296
|
declare function isGatewayConfigured(): boolean;
|
|
297
297
|
|
|
298
|
+
/**
|
|
299
|
+
* Session grouping for GatewaySDK tracing.
|
|
300
|
+
*
|
|
301
|
+
* Mirrors the Python SDK's `gatewaysdk.tracing.session()` context manager
|
|
302
|
+
* (gatewaysdk/tracing/context.py): every trace recorded inside the block
|
|
303
|
+
* carries the same session id, so auto-instrumented LLM calls and tool
|
|
304
|
+
* spans are grouped into one session without threading the id through
|
|
305
|
+
* application code.
|
|
306
|
+
*
|
|
307
|
+
* The TS tracing package has no ContextVar/context-manager mechanism of its
|
|
308
|
+
* own — the identity half (`identify()` / `IdentitySpanProcessor` in
|
|
309
|
+
* identity.ts) is the closest analogue, so this follows the same shape: an
|
|
310
|
+
* AsyncLocalStorage the current async context reads, and a SpanProcessor
|
|
311
|
+
* that stamps it onto every span at start.
|
|
312
|
+
*/
|
|
313
|
+
|
|
314
|
+
declare const SESSION_ID_ATTRIBUTE = "gateway.session.id";
|
|
315
|
+
/** The ambient session id set by the innermost enclosing `withSession()`
|
|
316
|
+
* call, or `undefined` outside one. */
|
|
317
|
+
declare function getAmbientSessionId(): string | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* Group every trace recorded inside `fn` under one session id — the TS
|
|
320
|
+
* twin of the Python SDK's `with tracing.session(session_id): ...`.
|
|
321
|
+
*
|
|
322
|
+
* ```typescript
|
|
323
|
+
* import { withSession } from "@withgateway/sdk/tracing";
|
|
324
|
+
*
|
|
325
|
+
* await withSession("checkout-regression-001", async () => {
|
|
326
|
+
* await observe("turn-1", async () => { ... }); // carries the session id
|
|
327
|
+
* });
|
|
328
|
+
* ```
|
|
329
|
+
*
|
|
330
|
+
* Works via AsyncLocalStorage, so it groups auto-instrumented spans too;
|
|
331
|
+
* nesting is fine — the innermost session wins for the code that runs
|
|
332
|
+
* inside it, the same as Python's context propagation.
|
|
333
|
+
*/
|
|
334
|
+
declare function withSession<T>(sessionId: string, fn: () => T | Promise<T>): Promise<T>;
|
|
335
|
+
/**
|
|
336
|
+
* Stamps the ambient session id (set by `withSession()`) on every span at
|
|
337
|
+
* start. Registered automatically by `tracing.init()`/`initIsolated()`,
|
|
338
|
+
* alongside `IdentitySpanProcessor`. An explicit
|
|
339
|
+
* `setAttribute(SESSION_ID_ATTRIBUTE, ...)` call after span start wins over
|
|
340
|
+
* this ambient default — same rule as `IdentitySpanProcessor`.
|
|
341
|
+
*/
|
|
342
|
+
declare class SessionSpanProcessor implements SpanProcessor {
|
|
343
|
+
onStart(span: Span, _parentContext: Context): void;
|
|
344
|
+
onEnd(_span: ReadableSpan): void;
|
|
345
|
+
shutdown(): Promise<void>;
|
|
346
|
+
forceFlush(): Promise<void>;
|
|
347
|
+
}
|
|
348
|
+
|
|
298
349
|
type ObservationKind = "AGENT" | "CHAIN" | "TOOL" | "LLM" | "RETRIEVER";
|
|
299
350
|
interface ObserveOptions {
|
|
300
351
|
/** Recorded as input.value on the span (JSON-stringified if not a string). */
|
|
@@ -465,11 +516,15 @@ declare const _tracingModule_IdentitySpanProcessor: typeof IdentitySpanProcessor
|
|
|
465
516
|
type _tracingModule_ObservationKind = ObservationKind;
|
|
466
517
|
type _tracingModule_ObserveClaudeOptions = ObserveClaudeOptions;
|
|
467
518
|
type _tracingModule_ObserveOptions = ObserveOptions;
|
|
519
|
+
declare const _tracingModule_SESSION_ID_ATTRIBUTE: typeof SESSION_ID_ATTRIBUTE;
|
|
520
|
+
type _tracingModule_SessionSpanProcessor = SessionSpanProcessor;
|
|
521
|
+
declare const _tracingModule_SessionSpanProcessor: typeof SessionSpanProcessor;
|
|
468
522
|
type _tracingModule_TracingConfig = TracingConfig;
|
|
469
523
|
type _tracingModule_TracingHandle = TracingHandle;
|
|
470
524
|
type _tracingModule_TracingState = TracingState;
|
|
471
525
|
declare const _tracingModule_USER_ID_ATTRIBUTE: typeof USER_ID_ATTRIBUTE;
|
|
472
526
|
declare const _tracingModule_flush: typeof flush;
|
|
527
|
+
declare const _tracingModule_getAmbientSessionId: typeof getAmbientSessionId;
|
|
473
528
|
declare const _tracingModule_identify: typeof identify;
|
|
474
529
|
declare const _tracingModule_init: typeof init;
|
|
475
530
|
declare const _tracingModule_initIsolated: typeof initIsolated;
|
|
@@ -482,8 +537,9 @@ declare const _tracingModule_observeOpenAI: typeof observeOpenAI;
|
|
|
482
537
|
declare const _tracingModule_resetAmbientUser: typeof resetAmbientUser;
|
|
483
538
|
declare const _tracingModule_resolveUserId: typeof resolveUserId;
|
|
484
539
|
declare const _tracingModule_shutdown: typeof shutdown;
|
|
540
|
+
declare const _tracingModule_withSession: typeof withSession;
|
|
485
541
|
declare namespace _tracingModule {
|
|
486
|
-
export { type _tracingModule_IdentifyOptions as IdentifyOptions, _tracingModule_IdentitySpanProcessor as IdentitySpanProcessor, type _tracingModule_ObservationKind as ObservationKind, type _tracingModule_ObserveClaudeOptions as ObserveClaudeOptions, type _tracingModule_ObserveOptions as ObserveOptions, type _tracingModule_TracingConfig as TracingConfig, type _tracingModule_TracingHandle as TracingHandle, type _tracingModule_TracingState as TracingState, _tracingModule_USER_ID_ATTRIBUTE as USER_ID_ATTRIBUTE, _tracingModule_flush as flush, _tracingModule_identify as identify, _tracingModule_init as init, _tracingModule_initIsolated as initIsolated, _tracingModule_isGatewayConfigured as isGatewayConfigured, _tracingModule_isInitialized as isInitialized, _tracingModule_observe as observe, _tracingModule_observeAnthropic as observeAnthropic, _tracingModule_observeClaude as observeClaude, _tracingModule_observeOpenAI as observeOpenAI, _tracingModule_resetAmbientUser as resetAmbientUser, _tracingModule_resolveUserId as resolveUserId, _tracingModule_shutdown as shutdown };
|
|
542
|
+
export { type _tracingModule_IdentifyOptions as IdentifyOptions, _tracingModule_IdentitySpanProcessor as IdentitySpanProcessor, type _tracingModule_ObservationKind as ObservationKind, type _tracingModule_ObserveClaudeOptions as ObserveClaudeOptions, type _tracingModule_ObserveOptions as ObserveOptions, _tracingModule_SESSION_ID_ATTRIBUTE as SESSION_ID_ATTRIBUTE, _tracingModule_SessionSpanProcessor as SessionSpanProcessor, type _tracingModule_TracingConfig as TracingConfig, type _tracingModule_TracingHandle as TracingHandle, type _tracingModule_TracingState as TracingState, _tracingModule_USER_ID_ATTRIBUTE as USER_ID_ATTRIBUTE, _tracingModule_flush as flush, _tracingModule_getAmbientSessionId as getAmbientSessionId, _tracingModule_identify as identify, _tracingModule_init as init, _tracingModule_initIsolated as initIsolated, _tracingModule_isGatewayConfigured as isGatewayConfigured, _tracingModule_isInitialized as isInitialized, _tracingModule_observe as observe, _tracingModule_observeAnthropic as observeAnthropic, _tracingModule_observeClaude as observeClaude, _tracingModule_observeOpenAI as observeOpenAI, _tracingModule_resetAmbientUser as resetAmbientUser, _tracingModule_resolveUserId as resolveUserId, _tracingModule_shutdown as shutdown, _tracingModule_withSession as withSession };
|
|
487
543
|
}
|
|
488
544
|
|
|
489
|
-
export { type IdentifyOptions as I, type ObservationKind as O, type TracingConfig as T, USER_ID_ATTRIBUTE as U, _tracingModule as _, IdentitySpanProcessor as a, type ObserveClaudeOptions as b, type ObserveOptions as c,
|
|
545
|
+
export { type IdentifyOptions as I, type ObservationKind as O, SESSION_ID_ATTRIBUTE as S, type TracingConfig as T, USER_ID_ATTRIBUTE as U, _tracingModule as _, IdentitySpanProcessor as a, type ObserveClaudeOptions as b, type ObserveOptions as c, SessionSpanProcessor as d, type TracingHandle as e, type TracingState as f, flush as g, getAmbientSessionId as h, identify as i, init as j, initIsolated as k, isGatewayConfigured as l, isInitialized as m, observeAnthropic as n, observe as o, observeClaude as p, observeOpenAI as q, resolveUserId as r, resetAmbientUser as s, shutdown as t, withSession as w };
|