@withgateway/sdk 0.3.0 → 0.3.1
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/README.md +5 -1
- package/dist/cli.js +1497 -712
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1500 -715
- package/dist/cli.mjs.map +1 -1
- package/dist/files/index.js +34 -0
- package/dist/files/index.js.map +1 -1
- package/dist/files/index.mjs +34 -0
- package/dist/files/index.mjs.map +1 -1
- package/dist/{index-DAb-FCMg.d.ts → index-CBqbB_0J.d.ts} +2 -12
- package/dist/{index-D6oi1TWE.d.mts → index-D-AMnAMa.d.mts} +2 -12
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +173 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +171 -50
- package/dist/index.mjs.map +1 -1
- package/dist/traces/index.js +34 -0
- package/dist/traces/index.js.map +1 -1
- package/dist/traces/index.mjs +34 -0
- 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 +39 -20
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +39 -20
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.d.mts +66 -18
- package/dist/worlds/index.d.ts +66 -18
- package/dist/worlds/index.js +171 -50
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +171 -50
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +1 -1
- package/runtime/gatewaysdk/environment/schema/api.py +7 -8
- package/runtime/gatewaysdk/environment/schema/cast.py +31 -4
- package/runtime/gatewaysdk/environment/schema/platform.py +1 -7
- package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +3 -3
- package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +2 -2
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +6 -6
- package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +1 -1
- package/skills/connector-schema-authoring/SKILL.md +3 -3
- package/skills/connector-schema-authoring/connector-worlds.md +12 -5
- package/skills/connector-schema-authoring/world-schema.md +8 -0
- package/skills/world-data-ingestion/SKILL.md +2 -2
- package/skills/worlds-getting-started/SKILL.md +6 -6
- package/skills/worlds-getting-started/references/cli-mcp-map.md +1 -1
package/dist/tracing/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { I as IdentifyOptions, a as IdentitySpanProcessor, O as ObservationKind, b as ObserveClaudeOptions, c as ObserveOptions, S as SECRET_KEYS, d as SESSION_ID_ATTRIBUTE, e as SecretRedactingSpanProcessor, f as SessionSpanProcessor, g as SpanSecrets, T as TracingConfig, h as TracingHandle, j as TracingState, U as USER_ID_ATTRIBUTE, W as WORLD_SESSION_ID_ATTRIBUTE, k as flush, l as getAmbientSessionId, m as getCurrentWorldSessionId, i as identify, n as init, o as initIsolated, p as isGatewayConfigured, q as isInitialized, s as observe, t as observeAnthropic, u as observeClaude, v as observeOpenAI, w as resetAmbientUser, r as resolveUserId, x as shutdown, y as withSession, z as withWorldSession } from '../index-
|
|
1
|
+
export { I as IdentifyOptions, a as IdentitySpanProcessor, O as ObservationKind, b as ObserveClaudeOptions, c as ObserveOptions, S as SECRET_KEYS, d as SESSION_ID_ATTRIBUTE, e as SecretRedactingSpanProcessor, f as SessionSpanProcessor, g as SpanSecrets, T as TracingConfig, h as TracingHandle, j as TracingState, U as USER_ID_ATTRIBUTE, W as WORLD_SESSION_ID_ATTRIBUTE, k as flush, l as getAmbientSessionId, m as getCurrentWorldSessionId, i as identify, n as init, o as initIsolated, p as isGatewayConfigured, q as isInitialized, s as observe, t as observeAnthropic, u as observeClaude, v as observeOpenAI, w as resetAmbientUser, r as resolveUserId, x as shutdown, y as withSession, z as withWorldSession } from '../index-D-AMnAMa.mjs';
|
|
2
2
|
export { M as MAX_MEDIA_BYTES, f as MediaField, g as MediaReference, h as MediaUploadError, i as MediaUploader } from '../media-CbcAfQvd.mjs';
|
|
3
3
|
import '@opentelemetry/api';
|
|
4
4
|
import '../scores/index.mjs';
|
package/dist/tracing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { I as IdentifyOptions, a as IdentitySpanProcessor, O as ObservationKind, b as ObserveClaudeOptions, c as ObserveOptions, S as SECRET_KEYS, d as SESSION_ID_ATTRIBUTE, e as SecretRedactingSpanProcessor, f as SessionSpanProcessor, g as SpanSecrets, T as TracingConfig, h as TracingHandle, j as TracingState, U as USER_ID_ATTRIBUTE, W as WORLD_SESSION_ID_ATTRIBUTE, k as flush, l as getAmbientSessionId, m as getCurrentWorldSessionId, i as identify, n as init, o as initIsolated, p as isGatewayConfigured, q as isInitialized, s as observe, t as observeAnthropic, u as observeClaude, v as observeOpenAI, w as resetAmbientUser, r as resolveUserId, x as shutdown, y as withSession, z as withWorldSession } from '../index-
|
|
1
|
+
export { I as IdentifyOptions, a as IdentitySpanProcessor, O as ObservationKind, b as ObserveClaudeOptions, c as ObserveOptions, S as SECRET_KEYS, d as SESSION_ID_ATTRIBUTE, e as SecretRedactingSpanProcessor, f as SessionSpanProcessor, g as SpanSecrets, T as TracingConfig, h as TracingHandle, j as TracingState, U as USER_ID_ATTRIBUTE, W as WORLD_SESSION_ID_ATTRIBUTE, k as flush, l as getAmbientSessionId, m as getCurrentWorldSessionId, i as identify, n as init, o as initIsolated, p as isGatewayConfigured, q as isInitialized, s as observe, t as observeAnthropic, u as observeClaude, v as observeOpenAI, w as resetAmbientUser, r as resolveUserId, x as shutdown, y as withSession, z as withWorldSession } from '../index-CBqbB_0J.js';
|
|
2
2
|
export { M as MAX_MEDIA_BYTES, f as MediaField, g as MediaReference, h as MediaUploadError, i as MediaUploader } from '../media-CbcAfQvd.js';
|
|
3
3
|
import '@opentelemetry/api';
|
|
4
4
|
import '../scores/index.js';
|
package/dist/tracing/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var require_package = __commonJS({
|
|
|
29
29
|
"package.json"(exports2, module2) {
|
|
30
30
|
module2.exports = {
|
|
31
31
|
name: "@withgateway/sdk",
|
|
32
|
-
version: "0.3.
|
|
32
|
+
version: "0.3.1",
|
|
33
33
|
description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
|
|
34
34
|
main: "./dist/index.js",
|
|
35
35
|
module: "./dist/index.mjs",
|
|
@@ -1204,22 +1204,49 @@ async function registerBuild(params) {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
}
|
|
1206
1206
|
|
|
1207
|
-
// src/tracing/
|
|
1208
|
-
var
|
|
1207
|
+
// src/tracing/prerequisites.ts
|
|
1208
|
+
var GATEWAY_ENV = {
|
|
1209
1209
|
HOST: "GATEWAY_HOST",
|
|
1210
1210
|
PUBLIC_KEY: "GATEWAY_PUBLIC_KEY",
|
|
1211
1211
|
SECRET_KEY: "GATEWAY_SECRET_KEY",
|
|
1212
1212
|
ENDPOINT: "GATEWAY_OTLP_ENDPOINT"
|
|
1213
1213
|
};
|
|
1214
|
+
var OPENTELEMETRY_PEERS = [
|
|
1215
|
+
"@opentelemetry/api",
|
|
1216
|
+
"@opentelemetry/exporter-trace-otlp-http",
|
|
1217
|
+
"@opentelemetry/resources",
|
|
1218
|
+
"@opentelemetry/sdk-trace-base",
|
|
1219
|
+
"@opentelemetry/sdk-trace-node"
|
|
1220
|
+
];
|
|
1221
|
+
var MODULE_NOT_FOUND = /* @__PURE__ */ new Set(["MODULE_NOT_FOUND", "ERR_MODULE_NOT_FOUND"]);
|
|
1222
|
+
function getEnv(key) {
|
|
1223
|
+
const value = process.env[key];
|
|
1224
|
+
return value ? value : void 0;
|
|
1225
|
+
}
|
|
1226
|
+
function isGatewayConfigured() {
|
|
1227
|
+
return !!(getEnv(GATEWAY_ENV.HOST) && getEnv(GATEWAY_ENV.PUBLIC_KEY) && getEnv(GATEWAY_ENV.SECRET_KEY));
|
|
1228
|
+
}
|
|
1229
|
+
var OpenTelemetryMissing = class _OpenTelemetryMissing extends Error {
|
|
1230
|
+
constructor() {
|
|
1231
|
+
super(
|
|
1232
|
+
`OpenTelemetry packages not found. Install them with:
|
|
1233
|
+
npm install ${OPENTELEMETRY_PEERS.join(" ")}`
|
|
1234
|
+
);
|
|
1235
|
+
this.name = "OpenTelemetryMissing";
|
|
1236
|
+
}
|
|
1237
|
+
static explains(error) {
|
|
1238
|
+
if (error instanceof _OpenTelemetryMissing) return true;
|
|
1239
|
+
const { code, message } = error ?? {};
|
|
1240
|
+
return MODULE_NOT_FOUND.has(String(code)) && String(message).includes("@opentelemetry/");
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
|
|
1244
|
+
// src/tracing/init.ts
|
|
1214
1245
|
var DEFAULT_OTLP_PATH = "/api/public/otel/v1/traces";
|
|
1215
1246
|
var state = {
|
|
1216
1247
|
initialized: false,
|
|
1217
1248
|
provider: null
|
|
1218
1249
|
};
|
|
1219
|
-
function getEnv(key) {
|
|
1220
|
-
const value = process.env[key];
|
|
1221
|
-
return value ? value : void 0;
|
|
1222
|
-
}
|
|
1223
1250
|
function log(message, ...args) {
|
|
1224
1251
|
if (state.debug) {
|
|
1225
1252
|
console.log(`[gatewaysdk.tracing] ${message}`, ...args);
|
|
@@ -1229,10 +1256,10 @@ function warn(message, ...args) {
|
|
|
1229
1256
|
console.warn(`[gatewaysdk.tracing] ${message}`, ...args);
|
|
1230
1257
|
}
|
|
1231
1258
|
function buildProvider(config, logFn) {
|
|
1232
|
-
const host = config.host ?? getEnv(
|
|
1233
|
-
const publicKey = config.publicKey ?? getEnv(
|
|
1234
|
-
const secretKey = config.secretKey ?? getEnv(
|
|
1235
|
-
const endpoint = config.endpoint ?? getEnv(
|
|
1259
|
+
const host = config.host ?? getEnv(GATEWAY_ENV.HOST);
|
|
1260
|
+
const publicKey = config.publicKey ?? getEnv(GATEWAY_ENV.PUBLIC_KEY);
|
|
1261
|
+
const secretKey = config.secretKey ?? getEnv(GATEWAY_ENV.SECRET_KEY);
|
|
1262
|
+
const endpoint = config.endpoint ?? getEnv(GATEWAY_ENV.ENDPOINT) ?? (host ? `${host.replace(/\/$/, "")}${DEFAULT_OTLP_PATH}` : void 0);
|
|
1236
1263
|
const missing = [];
|
|
1237
1264
|
if (!host) missing.push("host (or GATEWAY_HOST env var)");
|
|
1238
1265
|
if (!publicKey) missing.push("publicKey (or GATEWAY_PUBLIC_KEY env var)");
|
|
@@ -1269,9 +1296,7 @@ function buildProvider(config, logFn) {
|
|
|
1269
1296
|
ATTR_SERVICE_NAME = "service.name";
|
|
1270
1297
|
}
|
|
1271
1298
|
} catch {
|
|
1272
|
-
throw new
|
|
1273
|
-
"OpenTelemetry packages not found. Install them with:\nnpm install @opentelemetry/sdk-trace-node @opentelemetry/sdk-trace-base @opentelemetry/exporter-trace-otlp-http @opentelemetry/resources"
|
|
1274
|
-
);
|
|
1299
|
+
throw new OpenTelemetryMissing();
|
|
1275
1300
|
}
|
|
1276
1301
|
const resourceAttrs = {
|
|
1277
1302
|
[ATTR_SERVICE_NAME]: config.serviceName ?? "gatewaysdk-tracing"
|
|
@@ -1477,12 +1502,6 @@ async function shutdown() {
|
|
|
1477
1502
|
function isInitialized() {
|
|
1478
1503
|
return state.initialized;
|
|
1479
1504
|
}
|
|
1480
|
-
function isGatewayConfigured() {
|
|
1481
|
-
const host = getEnv(ENV_VARS.HOST);
|
|
1482
|
-
const publicKey = getEnv(ENV_VARS.PUBLIC_KEY);
|
|
1483
|
-
const secretKey = getEnv(ENV_VARS.SECRET_KEY);
|
|
1484
|
-
return !!(host && publicKey && secretKey);
|
|
1485
|
-
}
|
|
1486
1505
|
|
|
1487
1506
|
// src/tracing/observe.ts
|
|
1488
1507
|
var import_api3 = require("@opentelemetry/api");
|