neatlogs 1.1.0 → 1.1.2
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 +2 -2
- package/dist/anthropic.cjs +68 -2
- package/dist/anthropic.cjs.map +1 -1
- package/dist/anthropic.mjs +68 -2
- package/dist/anthropic.mjs.map +1 -1
- package/dist/azure-openai.cjs +68 -2
- package/dist/azure-openai.cjs.map +1 -1
- package/dist/azure-openai.mjs +68 -2
- package/dist/azure-openai.mjs.map +1 -1
- package/dist/bedrock.cjs +68 -2
- package/dist/bedrock.cjs.map +1 -1
- package/dist/bedrock.mjs +68 -2
- package/dist/bedrock.mjs.map +1 -1
- package/dist/browser.cjs +19 -9
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +23 -5
- package/dist/browser.mjs +19 -9
- package/dist/browser.mjs.map +1 -1
- package/dist/index.cjs +225 -381
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +38 -19
- package/dist/index.mjs +224 -381
- package/dist/index.mjs.map +1 -1
- package/dist/langchain.cjs +68 -2
- package/dist/langchain.cjs.map +1 -1
- package/dist/langchain.mjs +68 -2
- package/dist/langchain.mjs.map +1 -1
- package/dist/openai.cjs +68 -2
- package/dist/openai.cjs.map +1 -1
- package/dist/openai.mjs +68 -2
- package/dist/openai.mjs.map +1 -1
- package/dist/opencode-plugin.cjs +2 -2
- package/dist/opencode-plugin.cjs.map +1 -1
- package/dist/opencode-plugin.d.ts +1 -1
- package/dist/opencode-plugin.mjs +2 -2
- package/dist/opencode-plugin.mjs.map +1 -1
- package/dist/openrouter-agent.cjs +68 -2
- package/dist/openrouter-agent.cjs.map +1 -1
- package/dist/openrouter-agent.mjs +68 -2
- package/dist/openrouter-agent.mjs.map +1 -1
- package/dist/vertex-ai.cjs +68 -2
- package/dist/vertex-ai.cjs.map +1 -1
- package/dist/vertex-ai.mjs +68 -2
- package/dist/vertex-ai.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -40,26 +40,16 @@ interface InitOptions {
|
|
|
40
40
|
baseUrl?: string;
|
|
41
41
|
/** Name of the workflow being traced. Defaults to process.argv[1]. */
|
|
42
42
|
workflowName?: string;
|
|
43
|
-
/** Explicit session ID for grouping traces. */
|
|
44
|
-
sessionId?: string;
|
|
45
|
-
/** Auto-generate a session ID if none provided. Defaults to false. */
|
|
46
|
-
autoSession?: boolean;
|
|
47
43
|
/**
|
|
48
44
|
* Operator identifier — whoever is RUNNING the SDK (a developer, a service
|
|
49
45
|
* account, a CI job). Attached to all spans as a resource attribute. This is
|
|
50
46
|
* NOT the end-user of your application.
|
|
47
|
+
*
|
|
48
|
+
* Session and end-user identity are PER-REQUEST, not process-global, so they
|
|
49
|
+
* are never set here. Declare them at the trace root via `trace()`/`span()`
|
|
50
|
+
* options, or for pure-`wrap()` code via the request-scoped `identify()`.
|
|
51
51
|
*/
|
|
52
52
|
userId?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Process-global default for the END-USER — the user of your application.
|
|
55
|
-
* Use this for single-user processes (CLI, per-user worker) and pure-`wrap()`
|
|
56
|
-
* setups, where it lands on the root span automatically. On a multi-tenant
|
|
57
|
-
* server set the end-user per request via `trace({ endUserId })` instead.
|
|
58
|
-
* One end-user per trace; the backend rolls it up to the trace and its session.
|
|
59
|
-
*/
|
|
60
|
-
endUserId?: string;
|
|
61
|
-
/** Optional arbitrary end-user fields stored as JSON (e.g. { plan: 'pro' }). */
|
|
62
|
-
endUserMetadata?: Record<string, any>;
|
|
63
53
|
/** Tags to attach to all spans. Must be string array. */
|
|
64
54
|
tags?: string[];
|
|
65
55
|
/** Custom metadata to attach to all spans. */
|
|
@@ -82,7 +72,7 @@ interface InitOptions {
|
|
|
82
72
|
pii?: 'redact' | 'hash' | false;
|
|
83
73
|
/** SDK version override. */
|
|
84
74
|
version?: string;
|
|
85
|
-
/**
|
|
75
|
+
/** Base ingest endpoint. Defaults to https://ingest.neatlogs.com. */
|
|
86
76
|
endpoint?: string;
|
|
87
77
|
/** Maximum spans per export batch. Defaults to 100. */
|
|
88
78
|
batchSize?: number;
|
|
@@ -121,6 +111,12 @@ interface SpanOptions {
|
|
|
121
111
|
parameters?: Record<string, any>;
|
|
122
112
|
/** JSON schema describing the tool interface (for kind: MCP_TOOL). */
|
|
123
113
|
toolJsonSchema?: Record<string, any>;
|
|
114
|
+
/**
|
|
115
|
+
* Session this trace belongs to — groups the traces of a multi-turn
|
|
116
|
+
* conversation (one turn = one trace). Usually set on the WORKFLOW root. The
|
|
117
|
+
* backend groups traces by it; when absent it falls back to the trace id.
|
|
118
|
+
*/
|
|
119
|
+
sessionId?: string;
|
|
124
120
|
/**
|
|
125
121
|
* Identifier of the END-USER this trace belongs to — the user of your
|
|
126
122
|
* application, not the operator running the SDK. The backend rolls it up to
|
|
@@ -216,8 +212,9 @@ declare function getSessionConfig(): Record<string, any>;
|
|
|
216
212
|
* and executes the provided callback within the span.
|
|
217
213
|
*
|
|
218
214
|
* **Session-Aware Trace Creation:**
|
|
219
|
-
* - If
|
|
220
|
-
*
|
|
215
|
+
* - If a session id is resolved (per-call `sessionId` or the request-scoped
|
|
216
|
+
* `identify()` context) AND no active parent span exists, this creates a NEW
|
|
217
|
+
* root trace (for multi-turn conversations).
|
|
221
218
|
* - Otherwise, creates a normal child span within the existing trace.
|
|
222
219
|
*
|
|
223
220
|
* @param options - Trace configuration options
|
|
@@ -323,6 +320,28 @@ declare function Span(options: SpanOptions): <T extends (...args: any[]) => any>
|
|
|
323
320
|
*/
|
|
324
321
|
declare function log(msgTemplate: string, options?: Record<string, any>): void;
|
|
325
322
|
|
|
323
|
+
interface IdentifyOptions {
|
|
324
|
+
sessionId?: string;
|
|
325
|
+
endUserId?: string;
|
|
326
|
+
endUserMetadata?: Record<string, any>;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Bind session / end-user identity for the duration of `fn`.
|
|
330
|
+
*
|
|
331
|
+
* Only defined fields are set, so a nested `identify()` overrides one field
|
|
332
|
+
* without clearing the others (it merges onto the enclosing store). The previous
|
|
333
|
+
* store is automatically restored when `fn` returns / rejects. Returns whatever
|
|
334
|
+
* `fn` returns (sync value or Promise).
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* ```typescript
|
|
338
|
+
* await neatlogs.identify({ sessionId: 'chat_123' }, async () => {
|
|
339
|
+
* await wrappedClient.chat.completions.create(...);
|
|
340
|
+
* });
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
declare function identify<T>(opts: IdentifyOptions, fn: () => T): T;
|
|
344
|
+
|
|
326
345
|
interface ContextSetter {
|
|
327
346
|
set(template: string, variables: Record<string, any>): void;
|
|
328
347
|
}
|
|
@@ -571,6 +590,6 @@ declare function registerCrewaiTask(task: {
|
|
|
571
590
|
* SDK version. Kept in sync with package.json by the `version:sync` script
|
|
572
591
|
* (runs automatically on `prebuild`). Do not edit by hand — bump package.json.
|
|
573
592
|
*/
|
|
574
|
-
declare const __version__ = "1.1.
|
|
593
|
+
declare const __version__ = "1.1.2";
|
|
575
594
|
|
|
576
|
-
export { type CachedPrompt, type InitOptions, type MaskFunction, PromptApiError, PromptClient, PromptClientError, PromptHandle, type PromptMessage, PromptNotFoundError, PromptTemplate, Span, type SpanKind, type SpanOptions, type TraceOptions, UserPromptTemplate, __version__, bindTemplates, createPrompt, deletePrompt, fetchPrompt, flush, getMastraObservability, getPrompt, getSessionConfig, init, isDebugEnabled, listPrompts, log, registerCrewaiTask, removeTag, saveAsVersion, shutdown, span, trace, updatePrompt };
|
|
595
|
+
export { type CachedPrompt, type InitOptions, type MaskFunction, PromptApiError, PromptClient, PromptClientError, PromptHandle, type PromptMessage, PromptNotFoundError, PromptTemplate, Span, type SpanKind, type SpanOptions, type TraceOptions, UserPromptTemplate, __version__, bindTemplates, createPrompt, deletePrompt, fetchPrompt, flush, getMastraObservability, getPrompt, getSessionConfig, identify, init, isDebugEnabled, listPrompts, log, registerCrewaiTask, removeTag, saveAsVersion, shutdown, span, trace, updatePrompt };
|