@superbased/sdk 0.0.1-placeholder.0 → 0.1.0
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/NOTICE +4 -0
- package/README.md +434 -5
- package/dist/cjs/admit.d.ts +139 -0
- package/dist/cjs/admit.js +442 -0
- package/dist/cjs/admit.js.map +1 -0
- package/dist/cjs/attrs.d.ts +113 -0
- package/dist/cjs/attrs.js +183 -0
- package/dist/cjs/attrs.js.map +1 -0
- package/dist/cjs/config.d.ts +202 -0
- package/dist/cjs/config.js +386 -0
- package/dist/cjs/config.js.map +1 -0
- package/dist/cjs/context.d.ts +102 -0
- package/dist/cjs/context.js +234 -0
- package/dist/cjs/context.js.map +1 -0
- package/dist/cjs/control.d.ts +99 -0
- package/dist/cjs/control.js +243 -0
- package/dist/cjs/control.js.map +1 -0
- package/dist/cjs/cost.d.ts +108 -0
- package/dist/cjs/cost.js +211 -0
- package/dist/cjs/cost.js.map +1 -0
- package/dist/cjs/destination.d.ts +125 -0
- package/dist/cjs/destination.js +357 -0
- package/dist/cjs/destination.js.map +1 -0
- package/dist/cjs/experiments.d.ts +237 -0
- package/dist/cjs/experiments.js +678 -0
- package/dist/cjs/experiments.js.map +1 -0
- package/dist/cjs/export.d.ts +84 -0
- package/dist/cjs/export.js +328 -0
- package/dist/cjs/export.js.map +1 -0
- package/dist/cjs/index.d.ts +168 -0
- package/dist/cjs/index.js +581 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/instrument.d.ts +88 -0
- package/dist/cjs/instrument.js +397 -0
- package/dist/cjs/instrument.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/policy.d.ts +77 -0
- package/dist/cjs/policy.js +252 -0
- package/dist/cjs/policy.js.map +1 -0
- package/dist/cjs/prompts.d.ts +175 -0
- package/dist/cjs/prompts.js +476 -0
- package/dist/cjs/prompts.js.map +1 -0
- package/dist/cjs/propagation.d.ts +34 -0
- package/dist/cjs/propagation.js +151 -0
- package/dist/cjs/propagation.js.map +1 -0
- package/dist/cjs/req.d.ts +10 -0
- package/dist/cjs/req.js +3 -0
- package/dist/cjs/req.js.map +1 -0
- package/dist/cjs/runtime.d.ts +44 -0
- package/dist/cjs/runtime.js +67 -0
- package/dist/cjs/runtime.js.map +1 -0
- package/dist/cjs/scores.d.ts +102 -0
- package/dist/cjs/scores.js +226 -0
- package/dist/cjs/scores.js.map +1 -0
- package/dist/cjs/spans.d.ts +193 -0
- package/dist/cjs/spans.js +398 -0
- package/dist/cjs/spans.js.map +1 -0
- package/dist/cjs/vendor.d.ts +33 -0
- package/dist/cjs/vendor.js +67 -0
- package/dist/cjs/vendor.js.map +1 -0
- package/dist/esm/admit.d.ts +139 -0
- package/dist/esm/admit.js +432 -0
- package/dist/esm/admit.js.map +1 -0
- package/dist/esm/attrs.d.ts +113 -0
- package/dist/esm/attrs.js +179 -0
- package/dist/esm/attrs.js.map +1 -0
- package/dist/esm/config.d.ts +202 -0
- package/dist/esm/config.js +364 -0
- package/dist/esm/config.js.map +1 -0
- package/dist/esm/context.d.ts +102 -0
- package/dist/esm/context.js +221 -0
- package/dist/esm/context.js.map +1 -0
- package/dist/esm/control.d.ts +99 -0
- package/dist/esm/control.js +230 -0
- package/dist/esm/control.js.map +1 -0
- package/dist/esm/cost.d.ts +108 -0
- package/dist/esm/cost.js +202 -0
- package/dist/esm/cost.js.map +1 -0
- package/dist/esm/destination.d.ts +125 -0
- package/dist/esm/destination.js +346 -0
- package/dist/esm/destination.js.map +1 -0
- package/dist/esm/experiments.d.ts +237 -0
- package/dist/esm/experiments.js +666 -0
- package/dist/esm/experiments.js.map +1 -0
- package/dist/esm/export.d.ts +84 -0
- package/dist/esm/export.js +314 -0
- package/dist/esm/export.js.map +1 -0
- package/dist/esm/index.d.ts +168 -0
- package/dist/esm/index.js +500 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/instrument.d.ts +88 -0
- package/dist/esm/instrument.js +391 -0
- package/dist/esm/instrument.js.map +1 -0
- package/dist/esm/policy.d.ts +77 -0
- package/dist/esm/policy.js +240 -0
- package/dist/esm/policy.js.map +1 -0
- package/dist/esm/prompts.d.ts +175 -0
- package/dist/esm/prompts.js +460 -0
- package/dist/esm/prompts.js.map +1 -0
- package/dist/esm/propagation.d.ts +34 -0
- package/dist/esm/propagation.js +145 -0
- package/dist/esm/propagation.js.map +1 -0
- package/dist/esm/req.d.ts +10 -0
- package/dist/esm/req.js +2 -0
- package/dist/esm/req.js.map +1 -0
- package/dist/esm/runtime.d.ts +44 -0
- package/dist/esm/runtime.js +59 -0
- package/dist/esm/runtime.js.map +1 -0
- package/dist/esm/scores.d.ts +102 -0
- package/dist/esm/scores.js +219 -0
- package/dist/esm/scores.js.map +1 -0
- package/dist/esm/spans.d.ts +193 -0
- package/dist/esm/spans.js +378 -0
- package/dist/esm/spans.js.map +1 -0
- package/dist/esm/vendor.d.ts +33 -0
- package/dist/esm/vendor.js +61 -0
- package/dist/esm/vendor.js.map +1 -0
- package/package.json +121 -4
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Every span-attribute key the SDK writes, in one place.
|
|
4
|
+
*
|
|
5
|
+
* The keys come from the Observer vocabulary: `internal/genaiattr` (GenAI
|
|
6
|
+
* semconv pinned to open-telemetry/semantic-conventions-genai at
|
|
7
|
+
* `SEMCONV_COMMIT`, plus the OpenInference names Observer reads) and
|
|
8
|
+
* `internal/otelident` (identity), plus the SDK-owned `sbo.*` keys of
|
|
9
|
+
* contract sdk-api-surface.md section 9. The SDK never invents a key:
|
|
10
|
+
* `vocabulary.test.mjs` checks each one against those Go files and against
|
|
11
|
+
* `sdk/contract/sdk-attribute-keys.json`.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.LIMITS = exports.REQUEST_PARAMS = exports.CONTENT_PREFIX_EXEMPT_SUFFIXES = exports.EXTRA_CONTENT_PREFIXES = exports.CONTENT_PREFIXES = exports.CONTENT_KEYS = exports.K = exports.SEMCONV_SCHEMA_URL = exports.SEMCONV_COMMIT = void 0;
|
|
15
|
+
exports.isContentKey = isContentKey;
|
|
16
|
+
/** The pinned GenAI semconv state (`internal/genaiattr.SemconvCommit`). */
|
|
17
|
+
exports.SEMCONV_COMMIT = "76e0c19e7fe11dc693fe258642363a438af4d3aa";
|
|
18
|
+
exports.SEMCONV_SCHEMA_URL = "https://opentelemetry.io/schemas/gen-ai-dev/1.42.0-dev";
|
|
19
|
+
exports.K = {
|
|
20
|
+
// OpenInference span kind (Observer normalizes either case).
|
|
21
|
+
spanKind: "openinference.span.kind",
|
|
22
|
+
// GenAI semconv.
|
|
23
|
+
operation: "gen_ai.operation.name",
|
|
24
|
+
provider: "gen_ai.provider.name",
|
|
25
|
+
systemLegacy: "gen_ai.system",
|
|
26
|
+
requestModel: "gen_ai.request.model",
|
|
27
|
+
responseModel: "gen_ai.response.model",
|
|
28
|
+
responseId: "gen_ai.response.id",
|
|
29
|
+
finishReasons: "gen_ai.response.finish_reasons",
|
|
30
|
+
inputTokens: "gen_ai.usage.input_tokens",
|
|
31
|
+
totalTokens: "gen_ai.usage.total_tokens",
|
|
32
|
+
outputTokens: "gen_ai.usage.output_tokens",
|
|
33
|
+
cacheReadTokens: "gen_ai.usage.cache_read.input_tokens",
|
|
34
|
+
cacheWriteTokens: "gen_ai.usage.cache_write.input_tokens",
|
|
35
|
+
reasoningTokens: "gen_ai.usage.reasoning.output_tokens",
|
|
36
|
+
cost: "gen_ai.usage.cost",
|
|
37
|
+
toolName: "gen_ai.tool.name",
|
|
38
|
+
toolCallId: "gen_ai.tool.call.id",
|
|
39
|
+
toolArguments: "gen_ai.tool.call.arguments",
|
|
40
|
+
toolResult: "gen_ai.tool.call.result",
|
|
41
|
+
agentName: "gen_ai.agent.name",
|
|
42
|
+
agentId: "gen_ai.agent.id",
|
|
43
|
+
retrievalQuery: "gen_ai.retrieval.query.text",
|
|
44
|
+
retrievalDocuments: "gen_ai.retrieval.documents",
|
|
45
|
+
inputMessages: "gen_ai.input.messages",
|
|
46
|
+
outputMessages: "gen_ai.output.messages",
|
|
47
|
+
systemInstructions: "gen_ai.system_instructions",
|
|
48
|
+
errorType: "error.type",
|
|
49
|
+
// OpenInference.
|
|
50
|
+
oiModel: "llm.model_name",
|
|
51
|
+
oiProvider: "llm.provider",
|
|
52
|
+
oiToolName: "tool.name",
|
|
53
|
+
oiAgentName: "agent.name",
|
|
54
|
+
inputValue: "input.value",
|
|
55
|
+
outputValue: "output.value",
|
|
56
|
+
// Generic.
|
|
57
|
+
requestId: "request_id",
|
|
58
|
+
// Identity (internal/otelident).
|
|
59
|
+
tenant: "sbo.tenant",
|
|
60
|
+
user: "sbo.user",
|
|
61
|
+
session: "session.id",
|
|
62
|
+
environment: "sbo.environment",
|
|
63
|
+
release: "sbo.release",
|
|
64
|
+
tags: "sbo.tags",
|
|
65
|
+
metadataPrefix: "sbo.metadata.",
|
|
66
|
+
serviceVersion: "service.version",
|
|
67
|
+
deploymentEnvironment: "deployment.environment.name",
|
|
68
|
+
sdk: "sbo.sdk",
|
|
69
|
+
// Experiment item (W3-2, SDK-owned).
|
|
70
|
+
experimentRunId: "sbo.experiment.run_id",
|
|
71
|
+
experimentItemId: "sbo.experiment.item_id",
|
|
72
|
+
// Prompt registry stamp (W3-3).
|
|
73
|
+
promptName: "sbo.prompt.name",
|
|
74
|
+
promptVersion: "sbo.prompt.version",
|
|
75
|
+
promptLabel: "sbo.prompt.label",
|
|
76
|
+
/** Which side of a staged rollout served the prompt (prompts.md v2 section 9.4; genaiattr field prompt_cohort, lane C8). */
|
|
77
|
+
promptCohort: "sbo.prompt.cohort",
|
|
78
|
+
// Admission verdict stamp (W2-1).
|
|
79
|
+
admissionAllowed: "sbo.admission.allowed",
|
|
80
|
+
admissionDecision: "sbo.admission.decision",
|
|
81
|
+
admissionVerdictId: "sbo.admission.verdict_id",
|
|
82
|
+
admissionDegraded: "sbo.admission.degraded",
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Content-bearing keys and prefixes: the ones `captureContent`, the
|
|
86
|
+
* `maxContentChars` clip and the `mask` hook apply to at export, whichever
|
|
87
|
+
* instrumentation wrote them (genaiattr content fields, every dialect).
|
|
88
|
+
*/
|
|
89
|
+
exports.CONTENT_KEYS = new Set([
|
|
90
|
+
"input.value",
|
|
91
|
+
"output.value",
|
|
92
|
+
"gen_ai.input.messages",
|
|
93
|
+
"gen_ai.output.messages",
|
|
94
|
+
"gen_ai.system_instructions",
|
|
95
|
+
"gen_ai.tool.call.arguments",
|
|
96
|
+
"gen_ai.tool.call.result",
|
|
97
|
+
"gen_ai.retrieval.query.text",
|
|
98
|
+
"gen_ai.retrieval.documents",
|
|
99
|
+
"gen_ai.prompt",
|
|
100
|
+
"gen_ai.completion",
|
|
101
|
+
"gen_ai.output.value",
|
|
102
|
+
"gen_ai.tool.input",
|
|
103
|
+
"gen_ai.tool.output",
|
|
104
|
+
"tool.parameters",
|
|
105
|
+
"tool.result",
|
|
106
|
+
"tool_call.function.arguments",
|
|
107
|
+
"tool_call.result",
|
|
108
|
+
"traceloop.entity.input",
|
|
109
|
+
"traceloop.entity.output",
|
|
110
|
+
// The langfuse dialect (W5-2): a Langfuse SDK's observation and trace
|
|
111
|
+
// input/output.
|
|
112
|
+
"langfuse.observation.input",
|
|
113
|
+
"langfuse.observation.output",
|
|
114
|
+
"langfuse.trace.input",
|
|
115
|
+
"langfuse.trace.output",
|
|
116
|
+
"llm.prompt",
|
|
117
|
+
"llm.completion",
|
|
118
|
+
"prompt",
|
|
119
|
+
"completion",
|
|
120
|
+
]);
|
|
121
|
+
exports.CONTENT_PREFIXES = [
|
|
122
|
+
"gen_ai.prompt.",
|
|
123
|
+
"gen_ai.completion.",
|
|
124
|
+
"llm.input_messages.",
|
|
125
|
+
"llm.output_messages.",
|
|
126
|
+
];
|
|
127
|
+
/**
|
|
128
|
+
* Content an instrumentation emits under keys the Go vocabulary does not map
|
|
129
|
+
* (yet): the contract's `extra_content_prefixes`, exactly as Python's
|
|
130
|
+
* EXTRA_CONTENT_PREFIXES. The SDK never writes them, but an instrumentation
|
|
131
|
+
* does, so they are masked, clipped and dropped like the rest: content never
|
|
132
|
+
* leaves unmasked because Observer does not read it. Each is a prefix (an
|
|
133
|
+
* exact key is its own prefix: OpenInference's `llm.prompts` is one key).
|
|
134
|
+
*/
|
|
135
|
+
exports.EXTRA_CONTENT_PREFIXES = [
|
|
136
|
+
// OpenInference embedding inputs (text and vectors).
|
|
137
|
+
"embedding.embeddings.",
|
|
138
|
+
// OpenInference retriever documents, prompt templates and their variables,
|
|
139
|
+
// and the rendered prompt list of a completion call.
|
|
140
|
+
"retrieval.documents.",
|
|
141
|
+
"llm.prompt_template.",
|
|
142
|
+
"llm.prompts",
|
|
143
|
+
// Pydantic AI's own agent-span content.
|
|
144
|
+
"final_result",
|
|
145
|
+
"pydantic_ai.all_messages",
|
|
146
|
+
// OpenInference CrewAI: the crew's inputs, task descriptions and agents.
|
|
147
|
+
"crew_inputs",
|
|
148
|
+
"crew_tasks",
|
|
149
|
+
"crew_agents",
|
|
150
|
+
];
|
|
151
|
+
/** Indexed-list members that are structure, not content (`gen_ai.prompt.0.role`). */
|
|
152
|
+
exports.CONTENT_PREFIX_EXEMPT_SUFFIXES = [".role", ".finish_reason"];
|
|
153
|
+
/** True when `key` carries prompt, response or tool I/O content (Python's is_content_key). */
|
|
154
|
+
function isContentKey(key) {
|
|
155
|
+
if (exports.CONTENT_KEYS.has(key))
|
|
156
|
+
return true;
|
|
157
|
+
if (exports.CONTENT_PREFIXES.some((p) => key.startsWith(p)))
|
|
158
|
+
return !exports.CONTENT_PREFIX_EXEMPT_SUFFIXES.some((s) => key.endsWith(s));
|
|
159
|
+
return exports.EXTRA_CONTENT_PREFIXES.some((p) => key.startsWith(p));
|
|
160
|
+
}
|
|
161
|
+
/** `setRequestParams` option -> `gen_ai.request.*` key (the genaiattr Params names). */
|
|
162
|
+
exports.REQUEST_PARAMS = {
|
|
163
|
+
maxTokens: "gen_ai.request.max_tokens",
|
|
164
|
+
temperature: "gen_ai.request.temperature",
|
|
165
|
+
topP: "gen_ai.request.top_p",
|
|
166
|
+
topK: "gen_ai.request.top_k",
|
|
167
|
+
stopSequences: "gen_ai.request.stop_sequences",
|
|
168
|
+
frequencyPenalty: "gen_ai.request.frequency_penalty",
|
|
169
|
+
presencePenalty: "gen_ai.request.presence_penalty",
|
|
170
|
+
seed: "gen_ai.request.seed",
|
|
171
|
+
stream: "gen_ai.request.stream",
|
|
172
|
+
reasoningLevel: "gen_ai.request.reasoning.level",
|
|
173
|
+
};
|
|
174
|
+
/** Bounds of the identity contract (`internal/otelident`): ingest clamps with the same numbers. */
|
|
175
|
+
exports.LIMITS = {
|
|
176
|
+
valueLen: 256,
|
|
177
|
+
tags: 32,
|
|
178
|
+
tagLen: 128,
|
|
179
|
+
metadataKeys: 32,
|
|
180
|
+
metadataKeyLen: 128,
|
|
181
|
+
metadataValueLen: 512,
|
|
182
|
+
};
|
|
183
|
+
//# sourceMappingURL=attrs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attrs.js","sourceRoot":"","sources":["../../src/attrs.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Every span-attribute key the SDK writes, in one place.\n *\n * The keys come from the Observer vocabulary: `internal/genaiattr` (GenAI\n * semconv pinned to open-telemetry/semantic-conventions-genai at\n * `SEMCONV_COMMIT`, plus the OpenInference names Observer reads) and\n * `internal/otelident` (identity), plus the SDK-owned `sbo.*` keys of\n * contract sdk-api-surface.md section 9. The SDK never invents a key:\n * `vocabulary.test.mjs` checks each one against those Go files and against\n * `sdk/contract/sdk-attribute-keys.json`.\n */\n\n/** The pinned GenAI semconv state (`internal/genaiattr.SemconvCommit`). */\nexport const SEMCONV_COMMIT = \"76e0c19e7fe11dc693fe258642363a438af4d3aa\";\nexport const SEMCONV_SCHEMA_URL = \"https://opentelemetry.io/schemas/gen-ai-dev/1.42.0-dev\";\n\nexport const K = {\n // OpenInference span kind (Observer normalizes either case).\n spanKind: \"openinference.span.kind\",\n // GenAI semconv.\n operation: \"gen_ai.operation.name\",\n provider: \"gen_ai.provider.name\",\n systemLegacy: \"gen_ai.system\",\n requestModel: \"gen_ai.request.model\",\n responseModel: \"gen_ai.response.model\",\n responseId: \"gen_ai.response.id\",\n finishReasons: \"gen_ai.response.finish_reasons\",\n inputTokens: \"gen_ai.usage.input_tokens\",\n totalTokens: \"gen_ai.usage.total_tokens\",\n outputTokens: \"gen_ai.usage.output_tokens\",\n cacheReadTokens: \"gen_ai.usage.cache_read.input_tokens\",\n cacheWriteTokens: \"gen_ai.usage.cache_write.input_tokens\",\n reasoningTokens: \"gen_ai.usage.reasoning.output_tokens\",\n cost: \"gen_ai.usage.cost\",\n toolName: \"gen_ai.tool.name\",\n toolCallId: \"gen_ai.tool.call.id\",\n toolArguments: \"gen_ai.tool.call.arguments\",\n toolResult: \"gen_ai.tool.call.result\",\n agentName: \"gen_ai.agent.name\",\n agentId: \"gen_ai.agent.id\",\n retrievalQuery: \"gen_ai.retrieval.query.text\",\n retrievalDocuments: \"gen_ai.retrieval.documents\",\n inputMessages: \"gen_ai.input.messages\",\n outputMessages: \"gen_ai.output.messages\",\n systemInstructions: \"gen_ai.system_instructions\",\n errorType: \"error.type\",\n // OpenInference.\n oiModel: \"llm.model_name\",\n oiProvider: \"llm.provider\",\n oiToolName: \"tool.name\",\n oiAgentName: \"agent.name\",\n inputValue: \"input.value\",\n outputValue: \"output.value\",\n // Generic.\n requestId: \"request_id\",\n // Identity (internal/otelident).\n tenant: \"sbo.tenant\",\n user: \"sbo.user\",\n session: \"session.id\",\n environment: \"sbo.environment\",\n release: \"sbo.release\",\n tags: \"sbo.tags\",\n metadataPrefix: \"sbo.metadata.\",\n serviceVersion: \"service.version\",\n deploymentEnvironment: \"deployment.environment.name\",\n sdk: \"sbo.sdk\",\n // Experiment item (W3-2, SDK-owned).\n experimentRunId: \"sbo.experiment.run_id\",\n experimentItemId: \"sbo.experiment.item_id\",\n // Prompt registry stamp (W3-3).\n promptName: \"sbo.prompt.name\",\n promptVersion: \"sbo.prompt.version\",\n promptLabel: \"sbo.prompt.label\",\n /** Which side of a staged rollout served the prompt (prompts.md v2 section 9.4; genaiattr field prompt_cohort, lane C8). */\n promptCohort: \"sbo.prompt.cohort\",\n // Admission verdict stamp (W2-1).\n admissionAllowed: \"sbo.admission.allowed\",\n admissionDecision: \"sbo.admission.decision\",\n admissionVerdictId: \"sbo.admission.verdict_id\",\n admissionDegraded: \"sbo.admission.degraded\",\n} as const;\n\n/**\n * Content-bearing keys and prefixes: the ones `captureContent`, the\n * `maxContentChars` clip and the `mask` hook apply to at export, whichever\n * instrumentation wrote them (genaiattr content fields, every dialect).\n */\nexport const CONTENT_KEYS: ReadonlySet<string> = new Set([\n \"input.value\",\n \"output.value\",\n \"gen_ai.input.messages\",\n \"gen_ai.output.messages\",\n \"gen_ai.system_instructions\",\n \"gen_ai.tool.call.arguments\",\n \"gen_ai.tool.call.result\",\n \"gen_ai.retrieval.query.text\",\n \"gen_ai.retrieval.documents\",\n \"gen_ai.prompt\",\n \"gen_ai.completion\",\n \"gen_ai.output.value\",\n \"gen_ai.tool.input\",\n \"gen_ai.tool.output\",\n \"tool.parameters\",\n \"tool.result\",\n \"tool_call.function.arguments\",\n \"tool_call.result\",\n \"traceloop.entity.input\",\n \"traceloop.entity.output\",\n // The langfuse dialect (W5-2): a Langfuse SDK's observation and trace\n // input/output.\n \"langfuse.observation.input\",\n \"langfuse.observation.output\",\n \"langfuse.trace.input\",\n \"langfuse.trace.output\",\n \"llm.prompt\",\n \"llm.completion\",\n \"prompt\",\n \"completion\",\n]);\nexport const CONTENT_PREFIXES: readonly string[] = [\n \"gen_ai.prompt.\",\n \"gen_ai.completion.\",\n \"llm.input_messages.\",\n \"llm.output_messages.\",\n];\n/**\n * Content an instrumentation emits under keys the Go vocabulary does not map\n * (yet): the contract's `extra_content_prefixes`, exactly as Python's\n * EXTRA_CONTENT_PREFIXES. The SDK never writes them, but an instrumentation\n * does, so they are masked, clipped and dropped like the rest: content never\n * leaves unmasked because Observer does not read it. Each is a prefix (an\n * exact key is its own prefix: OpenInference's `llm.prompts` is one key).\n */\nexport const EXTRA_CONTENT_PREFIXES: readonly string[] = [\n // OpenInference embedding inputs (text and vectors).\n \"embedding.embeddings.\",\n // OpenInference retriever documents, prompt templates and their variables,\n // and the rendered prompt list of a completion call.\n \"retrieval.documents.\",\n \"llm.prompt_template.\",\n \"llm.prompts\",\n // Pydantic AI's own agent-span content.\n \"final_result\",\n \"pydantic_ai.all_messages\",\n // OpenInference CrewAI: the crew's inputs, task descriptions and agents.\n \"crew_inputs\",\n \"crew_tasks\",\n \"crew_agents\",\n];\n\n/** Indexed-list members that are structure, not content (`gen_ai.prompt.0.role`). */\nexport const CONTENT_PREFIX_EXEMPT_SUFFIXES: readonly string[] = [\".role\", \".finish_reason\"];\n\n/** True when `key` carries prompt, response or tool I/O content (Python's is_content_key). */\nexport function isContentKey(key: string): boolean {\n if (CONTENT_KEYS.has(key)) return true;\n if (CONTENT_PREFIXES.some((p) => key.startsWith(p))) return !CONTENT_PREFIX_EXEMPT_SUFFIXES.some((s) => key.endsWith(s));\n return EXTRA_CONTENT_PREFIXES.some((p) => key.startsWith(p));\n}\n\n/** `setRequestParams` option -> `gen_ai.request.*` key (the genaiattr Params names). */\nexport const REQUEST_PARAMS = {\n maxTokens: \"gen_ai.request.max_tokens\",\n temperature: \"gen_ai.request.temperature\",\n topP: \"gen_ai.request.top_p\",\n topK: \"gen_ai.request.top_k\",\n stopSequences: \"gen_ai.request.stop_sequences\",\n frequencyPenalty: \"gen_ai.request.frequency_penalty\",\n presencePenalty: \"gen_ai.request.presence_penalty\",\n seed: \"gen_ai.request.seed\",\n stream: \"gen_ai.request.stream\",\n reasoningLevel: \"gen_ai.request.reasoning.level\",\n} as const;\n\n/** Bounds of the identity contract (`internal/otelident`): ingest clamps with the same numbers. */\nexport const LIMITS = {\n valueLen: 256,\n tags: 32,\n tagLen: 128,\n metadataKeys: 32,\n metadataKeyLen: 128,\n metadataValueLen: 512,\n} as const;\n"]}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK settings: one options object, each field mapped to an env var.
|
|
3
|
+
*
|
|
4
|
+
* Resolution for every field: explicit `init()` option, then the
|
|
5
|
+
* `SUPERBASED_*` variable, then the standard OpenTelemetry variable (where
|
|
6
|
+
* one exists), then (destination, gateway URL and credential only) what the
|
|
7
|
+
* local Observer advertises, then the default. Pure over an env record, so it
|
|
8
|
+
* is testable without touching `process.env`.
|
|
9
|
+
*
|
|
10
|
+
* Export goes to a list of destinations (endpoint, headers, timeout each):
|
|
11
|
+
* this machine's Observer, the org or SaaS gateway, or both (D18, contract
|
|
12
|
+
* `contracts/destination.md`). `destinations()` turns the resolved choice
|
|
13
|
+
* into that list; destination.ts makes the choice.
|
|
14
|
+
*/
|
|
15
|
+
export type Env = Record<string, string | undefined>;
|
|
16
|
+
export declare const DEFAULT_ENDPOINT = "http://127.0.0.1:4318/v1/traces";
|
|
17
|
+
export declare const DEFAULT_SERVICE_NAME = "custom-app";
|
|
18
|
+
export declare const DEFAULT_MAX_CONTENT_CHARS = 8000;
|
|
19
|
+
export declare const DEFAULT_EXPORT_TIMEOUT_MS = 5000;
|
|
20
|
+
export declare const DEFAULT_SHUTDOWN_TIMEOUT_MS = 2000;
|
|
21
|
+
/** This machine's Observer dashboard API (admission, discovery, the local control API). */
|
|
22
|
+
export declare const DEFAULT_NODE_URL = "http://127.0.0.1:8081";
|
|
23
|
+
/** Discovery timeout (contract destination.md section 4: 500 ms total, one attempt). */
|
|
24
|
+
export declare const DEFAULT_DISCOVER_TIMEOUT_MS = 500;
|
|
25
|
+
export declare const DEFAULT_API_TIMEOUT_MS = 5000;
|
|
26
|
+
export declare const DEFAULT_PROMPT_CACHE_TTL_MS = 60000;
|
|
27
|
+
export declare const TRACES_PATH = "/v1/traces";
|
|
28
|
+
/** Where SDK data is saved (D18). */
|
|
29
|
+
export type DestinationChoice = "local" | "online" | "both";
|
|
30
|
+
export declare const DESTINATION_CHOICES: readonly DestinationChoice[];
|
|
31
|
+
/** One OTLP/HTTP export target. */
|
|
32
|
+
export interface Destination {
|
|
33
|
+
/** `local` (this machine, or the collector `endpoint` names) or `online` (the org or SaaS gateway). */
|
|
34
|
+
name: "local" | "online";
|
|
35
|
+
endpoint: string;
|
|
36
|
+
headers: Record<string, string>;
|
|
37
|
+
timeoutMs: number;
|
|
38
|
+
}
|
|
39
|
+
/** Every SDK option, fully resolved. See the README's settings table. */
|
|
40
|
+
export interface Settings {
|
|
41
|
+
/**
|
|
42
|
+
* The local destination's OTLP traces URL: the option > SUPERBASED_OTLP_ENDPOINT >
|
|
43
|
+
* (destination `local` only) OTEL_EXPORTER_OTLP_TRACES_ENDPOINT > OTEL_EXPORTER_OTLP_ENDPOINT
|
|
44
|
+
* (+ /v1/traces) > what the machine advertises > the built-in receiver.
|
|
45
|
+
* This field holds the first of the option / env values (or the default);
|
|
46
|
+
* `localTracesUrl(settings, choice)` applies the rest.
|
|
47
|
+
*/
|
|
48
|
+
endpoint: string;
|
|
49
|
+
/** Where `endpoint` came from: `argument`, `env` (SUPERBASED_OTLP_ENDPOINT), `otel` (an OTEL_* variable) or `default`. */
|
|
50
|
+
endpointSource: "argument" | "env" | "otel" | "default";
|
|
51
|
+
/** OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_TRACES_HEADERS, SUPERBASED_OTLP_HEADERS (merged, option on top). The OTEL ones go to the local destination only when it is `local`. */
|
|
52
|
+
headers: Record<string, string>;
|
|
53
|
+
/** SUPERBASED_API_KEY, sent as `Authorization: Bearer` to the gateway only. */
|
|
54
|
+
apiKey: string;
|
|
55
|
+
/** SUPERBASED_SERVICE_NAME > OTEL_SERVICE_NAME > service.name in OTEL_RESOURCE_ATTRIBUTES. */
|
|
56
|
+
serviceName: string;
|
|
57
|
+
/** OTEL_RESOURCE_ATTRIBUTES. */
|
|
58
|
+
resourceAttributes: Record<string, string>;
|
|
59
|
+
/** SUPERBASED_TENANT. */
|
|
60
|
+
tenant: string;
|
|
61
|
+
/** SUPERBASED_USER. */
|
|
62
|
+
user: string;
|
|
63
|
+
/** SUPERBASED_SESSION_ID. */
|
|
64
|
+
sessionId: string;
|
|
65
|
+
/** SUPERBASED_CAPTURE_CONTENT (legacy OBSERVER_CAPTURE_CONTENT). */
|
|
66
|
+
captureContent: boolean;
|
|
67
|
+
/** SUPERBASED_MAX_CONTENT_CHARS. */
|
|
68
|
+
maxContentChars: number;
|
|
69
|
+
/** SUPERBASED_EXPORT_TIMEOUT_MS > OTEL_EXPORTER_OTLP_TRACES_TIMEOUT > OTEL_EXPORTER_OTLP_TIMEOUT. */
|
|
70
|
+
exportTimeoutMs: number;
|
|
71
|
+
/** SUPERBASED_SHUTDOWN_TIMEOUT_MS: bound on flush() and shutdown(). */
|
|
72
|
+
shutdownTimeoutMs: number;
|
|
73
|
+
/** SUPERBASED_EXIT_HOOK: flush pending spans on process `beforeExit`. */
|
|
74
|
+
exitHook: boolean;
|
|
75
|
+
/** SUPERBASED_DEBUG: log each failure to the console (default: at most one line a minute). */
|
|
76
|
+
debug: boolean;
|
|
77
|
+
/** SUPERBASED_RELEASE: the app's release, on the resource as `service.version`. */
|
|
78
|
+
release: string;
|
|
79
|
+
/** SUPERBASED_ENVIRONMENT: the app's environment, on the resource as `deployment.environment.name`. */
|
|
80
|
+
environment: string;
|
|
81
|
+
/** SUPERBASED_TAGS (comma list): tags on every trace (`sbo.tags`). */
|
|
82
|
+
tags: string[];
|
|
83
|
+
/** SUPERBASED_METADATA (`k=v,k2=v2`): metadata on every trace (`sbo.metadata.<k>`). */
|
|
84
|
+
metadata: Record<string, string>;
|
|
85
|
+
/** SUPERBASED_SAMPLE_RATE (0..1), else OTEL_TRACES_SAMPLER[_ARG]. Whole traces are kept or dropped. */
|
|
86
|
+
sampleRate: number;
|
|
87
|
+
/** Whether the sampler is parent-based (a sampled parent keeps its children). */
|
|
88
|
+
parentBased: boolean;
|
|
89
|
+
/** SUPERBASED_DESTINATION: local, online or both. Empty = not chosen (ask the machine, then local). */
|
|
90
|
+
destination: DestinationChoice | "";
|
|
91
|
+
/** Why an explicit destination value was refused ("" when none was, or it was valid). */
|
|
92
|
+
destinationInvalid: string;
|
|
93
|
+
/** Why an environment sampling value was ignored ("" when none was). */
|
|
94
|
+
samplingInvalid: string;
|
|
95
|
+
/** The OTLP traces URL the machine advertised in discovery ("" when none). Internal. */
|
|
96
|
+
advertisedEndpoint: string;
|
|
97
|
+
/** SUPERBASED_ORG_URL: base URL of the org or SaaS gateway (OTLP at `/v1/traces`, control API at `/v1/sdk`). */
|
|
98
|
+
orgUrl: string;
|
|
99
|
+
/** Headers for the gateway: the `headers` option and SUPERBASED_OTLP_HEADERS, never the OTEL_* ones. */
|
|
100
|
+
onlineHeaders: Record<string, string>;
|
|
101
|
+
/** SUPERBASED_NODE_URL: this machine's Observer dashboard API (scheme, host and port). */
|
|
102
|
+
nodeUrl: string;
|
|
103
|
+
/** SUPERBASED_DISCOVER: ask the machine for its destination default. */
|
|
104
|
+
discover: boolean;
|
|
105
|
+
/** SUPERBASED_DISCOVER_TIMEOUT_MS: bound on that request. */
|
|
106
|
+
discoverTimeoutMs: number;
|
|
107
|
+
/** SUPERBASED_API_TIMEOUT_MS: bound on each control API call (scores, prompts, datasets, experiments). */
|
|
108
|
+
apiTimeoutMs: number;
|
|
109
|
+
/** SUPERBASED_PROMPT_CACHE_TTL_MS: how long a fetched prompt is fresh. */
|
|
110
|
+
promptCacheTtlMs: number;
|
|
111
|
+
/** True when `endpoint` was set explicitly (option, SUPERBASED_OTLP_ENDPOINT or an OTEL_* variable). */
|
|
112
|
+
endpointExplicit: boolean;
|
|
113
|
+
/** Where `apiKey` came from: `argument`, `env`, `file` (the machine's credential file) or "". */
|
|
114
|
+
credentialSource: "argument" | "env" | "file" | "";
|
|
115
|
+
}
|
|
116
|
+
/** The subset a caller may pass to `init()`; unset fields come from env. */
|
|
117
|
+
export type SettingsInput = Partial<Omit<Settings, "endpointExplicit" | "endpointSource" | "onlineHeaders" | "destinationInvalid" | "samplingInvalid" | "parentBased" | "destination" | "advertisedEndpoint" | "credentialSource">> & {
|
|
118
|
+
destination?: string;
|
|
119
|
+
};
|
|
120
|
+
/** Parse the first set boolean-ish env var in `names`; none set gives `def`. */
|
|
121
|
+
export declare function envFlag(env: Env, names: string[], def: boolean): boolean;
|
|
122
|
+
/** Parse the OTel `k1=v1,k2=v2` list (percent-decoded); malformed members skipped. */
|
|
123
|
+
export declare function parseKvList(raw: string | undefined): Record<string, string>;
|
|
124
|
+
/** Parse a comma list (empty members dropped). */
|
|
125
|
+
export declare function parseList(raw: string | undefined): string[];
|
|
126
|
+
export declare function resolveEndpoint(explicit: string | undefined, env: Env): string;
|
|
127
|
+
/** The endpoint and where it came from (see `Settings.endpoint`). */
|
|
128
|
+
export declare function resolveEndpointWithSource(explicit: string | undefined, env: Env): [string, Settings["endpointSource"]];
|
|
129
|
+
export declare function resolveHeaders(explicit: Record<string, string> | undefined, env: Env): Record<string, string>;
|
|
130
|
+
export declare function resolveServiceName(explicit: string | undefined, env: Env): string;
|
|
131
|
+
/**
|
|
132
|
+
* The head sampling rate and whether it is parent-based: the option,
|
|
133
|
+
* SUPERBASED_SAMPLE_RATE, then the standard OTEL_TRACES_SAMPLER (+ _ARG). An
|
|
134
|
+
* explicit rate outside 0..1 is a programmer error (RangeError); a bad
|
|
135
|
+
* environment value is ignored and named in `invalid` (review E-38; as
|
|
136
|
+
* Python), so a stray host variable never stops the app.
|
|
137
|
+
*/
|
|
138
|
+
export declare function resolveSampling(explicit: number | undefined, env: Env): {
|
|
139
|
+
rate: number;
|
|
140
|
+
parentBased: boolean;
|
|
141
|
+
invalid: string;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* The destination from the option, then SUPERBASED_DESTINATION. An invalid
|
|
145
|
+
* value is refused loudly (reported in `invalid`) and the next source is
|
|
146
|
+
* used (contract destination.md section 1).
|
|
147
|
+
*/
|
|
148
|
+
export declare function resolveDestinationChoice(explicit: string | undefined, env: Env): {
|
|
149
|
+
choice: DestinationChoice | "";
|
|
150
|
+
source: string;
|
|
151
|
+
invalid: string;
|
|
152
|
+
};
|
|
153
|
+
export declare function trimSlash(u: string): string;
|
|
154
|
+
/** Build settings from explicit options (undefined = unset) over env. */
|
|
155
|
+
export declare function resolveSettings(env: Env, explicit?: SettingsInput): Settings;
|
|
156
|
+
/** The online OTLP traces URL ("" when no gateway is configured). */
|
|
157
|
+
export declare function onlineTracesUrl(s: Settings): string;
|
|
158
|
+
/**
|
|
159
|
+
* The local OTLP traces URL for a destination choice: the `endpoint` option
|
|
160
|
+
* or SUPERBASED_OTLP_ENDPOINT as given; an OTEL_* endpoint only when the
|
|
161
|
+
* destination is `local` (so an app's existing OTEL variables, pointing at
|
|
162
|
+
* another vendor, never replace the machine under `both`); else what the
|
|
163
|
+
* machine advertised; else the built-in receiver.
|
|
164
|
+
*/
|
|
165
|
+
export declare function localTracesUrl(s: Settings, choice?: DestinationChoice | ""): string;
|
|
166
|
+
/**
|
|
167
|
+
* Whether the app named the local destination's endpoint itself (the
|
|
168
|
+
* first rungs of `localTracesUrl`), so the machine's advertised receiver is
|
|
169
|
+
* not needed.
|
|
170
|
+
*/
|
|
171
|
+
export declare function localEndpointNamed(s: Settings, choice?: DestinationChoice | ""): boolean;
|
|
172
|
+
/** Whether the online destination is usable: a gateway URL and a credential. */
|
|
173
|
+
export declare function onlineUsable(s: Settings): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Whether the local exporter may carry the credential: only to a collector
|
|
176
|
+
* the app named itself (the `endpoint` option or SUPERBASED_OTLP_ENDPOINT)
|
|
177
|
+
* that is not on loopback. Never to this machine, and never to an endpoint
|
|
178
|
+
* that came from OTEL_EXPORTER_OTLP_* (an app exporting to another vendor
|
|
179
|
+
* must not leak the superbased key there; review finding R-B26).
|
|
180
|
+
*/
|
|
181
|
+
export declare function localCarriesKey(s: Settings, endpoint: string): boolean;
|
|
182
|
+
/** Whether a URL's host is loopback. */
|
|
183
|
+
export declare function isLoopbackHost(url: string): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Where spans are exported, for a destination choice (D18).
|
|
186
|
+
*
|
|
187
|
+
* - `local`: this machine's Observer (or the collector `endpoint` names).
|
|
188
|
+
* Headers: the OTEL_* ones (destination `local` only), SUPERBASED_OTLP_HEADERS
|
|
189
|
+
* and the `headers` option. The credential only per `localCarriesKey`.
|
|
190
|
+
* - `online`: the gateway with `apiKey` as the bearer, configured only from
|
|
191
|
+
* the SDK's own settings (an app's OTEL_* variables never redirect it).
|
|
192
|
+
* - `both`: one exporter for each; one failing never blocks the other.
|
|
193
|
+
*
|
|
194
|
+
* The degraded cases (contract destination.md section 7): `online` with no
|
|
195
|
+
* usable gateway exports nothing, `both` exports to the machine only; the
|
|
196
|
+
* caller reports why (`destinationProblems`).
|
|
197
|
+
*/
|
|
198
|
+
export declare function destinations(s: Settings, choice?: DestinationChoice | ""): Destination[];
|
|
199
|
+
/** The fix to name when the online destination is not usable (the verb is `observer sdk sign-in`, R-B17). */
|
|
200
|
+
export declare const ONLINE_FIX = "run `observer sdk sign-in`, or set SUPERBASED_ORG_URL and SUPERBASED_API_KEY";
|
|
201
|
+
/** Why a destination choice cannot be honoured in full (empty = fine). */
|
|
202
|
+
export declare function destinationProblems(s: Settings, choice: DestinationChoice | ""): string[];
|