raindrop-ai 0.9.0 → 0.9.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 +38 -0
- package/dist/{chunk-VBZXQNJY.mjs → chunk-SUW3YBV3.mjs} +1 -1
- package/dist/{chunk-RIL2CV7Q.mjs → chunk-WLBBPTI6.mjs} +224 -3
- package/dist/evals/cli.js +226 -5
- package/dist/evals/cli.mjs +2 -2
- package/dist/{index-DZB7DoZS.d.mts → index-C5Aj6zuo.d.mts} +37 -1
- package/dist/{index-DZB7DoZS.d.ts → index-C5Aj6zuo.d.ts} +37 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +226 -5
- package/dist/index.mjs +2 -2
- package/dist/tracing/index.d.mts +2 -2
- package/dist/tracing/index.d.ts +2 -2
- package/dist/tracing/index.js +224 -3
- package/dist/tracing/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -154,6 +154,32 @@ declare global {
|
|
|
154
154
|
var RAINDROP_CONTEXT_MANAGER: (new () => ContextManager) | undefined;
|
|
155
155
|
var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => AsyncLocalStorageLike<T>) | undefined;
|
|
156
156
|
}
|
|
157
|
+
type JsonSchema = Record<string, unknown>;
|
|
158
|
+
type FunctionToolDeclaration = {
|
|
159
|
+
type: "function";
|
|
160
|
+
name: string;
|
|
161
|
+
description?: string;
|
|
162
|
+
inputSchema?: JsonSchema;
|
|
163
|
+
};
|
|
164
|
+
type ProviderDefinedToolDeclaration = {
|
|
165
|
+
type: "provider-defined";
|
|
166
|
+
id?: string;
|
|
167
|
+
name: string;
|
|
168
|
+
args?: Record<string, unknown>;
|
|
169
|
+
};
|
|
170
|
+
type ToolDeclaration = FunctionToolDeclaration | ProviderDefinedToolDeclaration;
|
|
171
|
+
/**
|
|
172
|
+
* What callers hand to a `tools` override. The canonical `ToolDeclaration`
|
|
173
|
+
* shape is accepted as-is; so is any framework shape `normalizeToolDeclarations`
|
|
174
|
+
* recognizes (OpenAI, Anthropic, Bedrock, LangChain, Pi, Mastra, AI SDK).
|
|
175
|
+
*/
|
|
176
|
+
type ToolDeclarationInput = ToolDeclaration | {
|
|
177
|
+
name: string;
|
|
178
|
+
description?: string;
|
|
179
|
+
inputSchema?: JsonSchema;
|
|
180
|
+
parameters?: JsonSchema;
|
|
181
|
+
};
|
|
182
|
+
type PromptToolsOverride = ReadonlyArray<ToolDeclarationInput | unknown>;
|
|
157
183
|
|
|
158
184
|
/**
|
|
159
185
|
* Version-agnostic SpanProcessor interface.
|
|
@@ -420,6 +446,15 @@ interface TraceContext {
|
|
|
420
446
|
type BeginInteractionOptions = PartialAiTrackEvent & {
|
|
421
447
|
eventId: string;
|
|
422
448
|
};
|
|
449
|
+
/** `begin()` input: the interaction's event context plus interaction-scoped tracing options. */
|
|
450
|
+
type BeginParams = PartialAiTrackEvent & {
|
|
451
|
+
/**
|
|
452
|
+
* Overrides the tool catalog recorded as `ai.prompt.tools` on every model
|
|
453
|
+
* span started inside this interaction. Use when the integration cannot see
|
|
454
|
+
* the tools the model was given. `[]` records an empty catalog.
|
|
455
|
+
*/
|
|
456
|
+
tools?: PromptToolsOverride;
|
|
457
|
+
};
|
|
423
458
|
type FinishInteractionOptions = Omit<PartialAiTrackEvent, "eventId"> & {
|
|
424
459
|
output: string;
|
|
425
460
|
eventId?: string;
|
|
@@ -61678,6 +61713,7 @@ declare class Raindrop {
|
|
|
61678
61713
|
begin(traceContext: PartialAiTrackEvent & {
|
|
61679
61714
|
event: string;
|
|
61680
61715
|
userId: string;
|
|
61716
|
+
tools?: PromptToolsOverride;
|
|
61681
61717
|
}): Interaction;
|
|
61682
61718
|
private propertiesWithAppGit;
|
|
61683
61719
|
/**
|
|
@@ -61900,4 +61936,4 @@ declare const EVAL_CORRELATION_ID_ATTRIBUTE: "raindrop.eval_correlation_id";
|
|
|
61900
61936
|
declare const currentEvalScope: () => EvalScope | undefined;
|
|
61901
61937
|
declare const withEvalScope: <Result>(scope: EvalScope, callback: () => Result) => Result;
|
|
61902
61938
|
|
|
61903
|
-
export { type EvalSuiteDefinition as $, type AiTrackUsage as A, type
|
|
61939
|
+
export { type EvalSuiteDefinition as $, type AiTrackUsage as A, type BeginParams as B, type CarrierHeaders as C, DEFAULT_EVAL_POLL_INTERVAL_MS as D, EVAL_CORRELATION_ID_ATTRIBUTE as E, EvalDatasetPublishConflictError as F, type EvalDatasetRowInput as G, EvalDatasetRowInputSchema as H, type InitializeOptions as I, type EvalDestination as J, type EvalEvaluator as K, type EvalHandlerOptions as L, type EvalLocalEvaluator as M, type EvalManifest as N, EvalParameterError as O, type EvalParameterField as P, type EvalParameterFields as Q, Raindrop as R, type SpanProcessorOptions as S, type TraceCarrier as T, type EvalParameters as U, type EvalProgram as V, EvalPublishError as W, type EvalRowResult as X, type EvalRowTracePair as Y, type EvalRunReading as Z, type EvalScope as _, type RaindropSpanProcessor as a, ReplayVerdictSchema as a$, type EvalSuiteDefinitionInput as a0, type EvalSuiteManifest as a1, EvalSuiteManifestSchema as a2, type EvalSuiteResult as a3, type EvalSuiteRunSession as a4, type EvalVerdictAssessment as a5, type EvaluateReplayOptions as a6, type FinishInteractionOptions as a7, type HostedEvaluatorPin as a8, type IdentifyEvent as a9, type PulledEvalSnapshot as aA, type RaindropConnection as aB, type RaindropFeatureFlagValue as aC, type RaindropFeatureFlags as aD, type RaindropProperties as aE, type RaindropPropertyLeaf as aF, type RaindropPropertyValue as aG, type ReplayClient as aH, type ReplayCounts as aI, ReplayCountsSchema as aJ, type ReplayEvaluator as aK, type ReplayEvaluatorCounts as aL, ReplayEvaluatorCountsSchema as aM, type ReplayEvaluatorStats as aN, ReplayEvaluatorStatsSchema as aO, type ReplayEvaluatorSummary as aP, ReplayEvaluatorSummarySchema as aQ, type ReplayHandle as aR, type LocalEvaluatorContext$1 as aS, type ReplayOptions as aT, type ReplayReading as aU, type ReplayResult as aV, type ReplayResultRow as aW, ReplayResultRowSchema as aX, type ReplayRow as aY, type ReplayRowOutcome as aZ, type ReplayVerdict as a_, type LocalBooleanVerdict as aa, LocalBooleanVerdictSchema as ab, type LocalDebuggerLiveEventInput as ac, type LocalEvaluator as ad, type LocalEvaluatorContext as ae, type LocalNumberVerdict as af, LocalNumberVerdictSchema as ag, type LocalScoreVerdict as ah, LocalScoreVerdictSchema as ai, type LocalVerdict as aj, LocalVerdictSchema as ak, MAX_EVAL_STATUS_RETRIES as al, MAX_INGEST_SIZE_BYTES as am, type NumericThreshold as an, NumericThresholdSchema as ao, type PartialAiTrackEvent as ap, type PortableEvalArtifact as aq, type PortableEvalLimits as ar, type PortableEvalOutcome as as, type PortableEvalResult as at, type PortableEvaluator as au, type PortableJudgeRequest as av, type PortableJudgeVerdict as aw, type PublishEvalDatasetOptions as ax, type PublishEvalSuiteOptions as ay, type PullEvalOptions as az, type Interaction as b, type RunEvalSuiteOptions as b0, type RunReplayOptions as b1, type SelfDiagnoseOptions as b2, type SelfDiagnosticsExecuteContext as b3, type SelfDiagnosticsExecuteResult as b4, type SelfDiagnosticsSignalDefinition as b5, type SelfDiagnosticsSignalDefinitions as b6, type SelfDiagnosticsTool as b7, type SelfDiagnosticsToolInputSchema as b8, type SelfDiagnosticsToolOptions as b9, importPortableEvaluator as bA, isEvalDataset as bB, isEvalSuiteDefinition as bC, isPublishedEvalSuite as bD, loadEvalSnapshot as bE, projectWorkshopTrace as bF, publishEvalDataset as bG, publishEvalSuite as bH, pullEval as bI, readEvalDataset as bJ, readEvalManifest as bK, readEvalRun as bL, readEvaluator as bM, readReplay as bN, replay as bO, resolveDisableBatching as bP, runEvalSuite as bQ, runReplay as bR, traceOutput as bS, traceToolCalls as bT, traceTools as bU, verifyPortableEvalArtifact as bV, withEvalScope as bW, type SignalEvent as ba, type SpanParams as bb, type SubagentDispatch as bc, type SubagentDispatchOptions as bd, type SubagentFinishOptions as be, type ToolParams as bf, type ToolSpan as bg, type Trace as bh, type TraceContext as bi, TraceSchema as bj, type TrackToolParams as bk, type WorkflowParams as bl, claimReplay as bm, compareEvalRuns as bn, createEvalHandler as bo, createEvalSuiteRun as bp, createReplay as bq, currentEvalScope as br, defineAgent as bs, defineDataset as bt, defineEvalSuite as bu, defineEvaluatorProgram as bv, defineLocalEvaluator as bw, evaluateEvalRun as bx, evaluatePortableEvaluator as by, evaluateReplay as bz, type AppGitSnapshot as c, type SubagentResumeOptions as d, type SubagentRun as e, type Tracer as f, type AiTrackEvent as g, type AppGitOptions as h, type Attachment as i, type AttachmentType as j, type BeginInteractionOptions as k, type BooleanThreshold as l, BooleanThresholdSchema as m, type CreateEvalSuiteRunOptions as n, type CreateReplayOptions as o, DEFAULT_EVAL_WAIT_MS as p, DEFAULT_QUERY_URL as q, DEFAULT_TRACE_WAIT_MS as r, type DefinedEvalAgent as s, type DefinedEvalDataset as t, type EvalAgentDefinition as u, type EvalAgentExecution as v, type EvalClient as w, type EvalDataset as x, type EvalDatasetInput as y, type EvalDatasetManifest as z };
|
|
@@ -154,6 +154,32 @@ declare global {
|
|
|
154
154
|
var RAINDROP_CONTEXT_MANAGER: (new () => ContextManager) | undefined;
|
|
155
155
|
var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => AsyncLocalStorageLike<T>) | undefined;
|
|
156
156
|
}
|
|
157
|
+
type JsonSchema = Record<string, unknown>;
|
|
158
|
+
type FunctionToolDeclaration = {
|
|
159
|
+
type: "function";
|
|
160
|
+
name: string;
|
|
161
|
+
description?: string;
|
|
162
|
+
inputSchema?: JsonSchema;
|
|
163
|
+
};
|
|
164
|
+
type ProviderDefinedToolDeclaration = {
|
|
165
|
+
type: "provider-defined";
|
|
166
|
+
id?: string;
|
|
167
|
+
name: string;
|
|
168
|
+
args?: Record<string, unknown>;
|
|
169
|
+
};
|
|
170
|
+
type ToolDeclaration = FunctionToolDeclaration | ProviderDefinedToolDeclaration;
|
|
171
|
+
/**
|
|
172
|
+
* What callers hand to a `tools` override. The canonical `ToolDeclaration`
|
|
173
|
+
* shape is accepted as-is; so is any framework shape `normalizeToolDeclarations`
|
|
174
|
+
* recognizes (OpenAI, Anthropic, Bedrock, LangChain, Pi, Mastra, AI SDK).
|
|
175
|
+
*/
|
|
176
|
+
type ToolDeclarationInput = ToolDeclaration | {
|
|
177
|
+
name: string;
|
|
178
|
+
description?: string;
|
|
179
|
+
inputSchema?: JsonSchema;
|
|
180
|
+
parameters?: JsonSchema;
|
|
181
|
+
};
|
|
182
|
+
type PromptToolsOverride = ReadonlyArray<ToolDeclarationInput | unknown>;
|
|
157
183
|
|
|
158
184
|
/**
|
|
159
185
|
* Version-agnostic SpanProcessor interface.
|
|
@@ -420,6 +446,15 @@ interface TraceContext {
|
|
|
420
446
|
type BeginInteractionOptions = PartialAiTrackEvent & {
|
|
421
447
|
eventId: string;
|
|
422
448
|
};
|
|
449
|
+
/** `begin()` input: the interaction's event context plus interaction-scoped tracing options. */
|
|
450
|
+
type BeginParams = PartialAiTrackEvent & {
|
|
451
|
+
/**
|
|
452
|
+
* Overrides the tool catalog recorded as `ai.prompt.tools` on every model
|
|
453
|
+
* span started inside this interaction. Use when the integration cannot see
|
|
454
|
+
* the tools the model was given. `[]` records an empty catalog.
|
|
455
|
+
*/
|
|
456
|
+
tools?: PromptToolsOverride;
|
|
457
|
+
};
|
|
423
458
|
type FinishInteractionOptions = Omit<PartialAiTrackEvent, "eventId"> & {
|
|
424
459
|
output: string;
|
|
425
460
|
eventId?: string;
|
|
@@ -61678,6 +61713,7 @@ declare class Raindrop {
|
|
|
61678
61713
|
begin(traceContext: PartialAiTrackEvent & {
|
|
61679
61714
|
event: string;
|
|
61680
61715
|
userId: string;
|
|
61716
|
+
tools?: PromptToolsOverride;
|
|
61681
61717
|
}): Interaction;
|
|
61682
61718
|
private propertiesWithAppGit;
|
|
61683
61719
|
/**
|
|
@@ -61900,4 +61936,4 @@ declare const EVAL_CORRELATION_ID_ATTRIBUTE: "raindrop.eval_correlation_id";
|
|
|
61900
61936
|
declare const currentEvalScope: () => EvalScope | undefined;
|
|
61901
61937
|
declare const withEvalScope: <Result>(scope: EvalScope, callback: () => Result) => Result;
|
|
61902
61938
|
|
|
61903
|
-
export { type EvalSuiteDefinition as $, type AiTrackUsage as A, type
|
|
61939
|
+
export { type EvalSuiteDefinition as $, type AiTrackUsage as A, type BeginParams as B, type CarrierHeaders as C, DEFAULT_EVAL_POLL_INTERVAL_MS as D, EVAL_CORRELATION_ID_ATTRIBUTE as E, EvalDatasetPublishConflictError as F, type EvalDatasetRowInput as G, EvalDatasetRowInputSchema as H, type InitializeOptions as I, type EvalDestination as J, type EvalEvaluator as K, type EvalHandlerOptions as L, type EvalLocalEvaluator as M, type EvalManifest as N, EvalParameterError as O, type EvalParameterField as P, type EvalParameterFields as Q, Raindrop as R, type SpanProcessorOptions as S, type TraceCarrier as T, type EvalParameters as U, type EvalProgram as V, EvalPublishError as W, type EvalRowResult as X, type EvalRowTracePair as Y, type EvalRunReading as Z, type EvalScope as _, type RaindropSpanProcessor as a, ReplayVerdictSchema as a$, type EvalSuiteDefinitionInput as a0, type EvalSuiteManifest as a1, EvalSuiteManifestSchema as a2, type EvalSuiteResult as a3, type EvalSuiteRunSession as a4, type EvalVerdictAssessment as a5, type EvaluateReplayOptions as a6, type FinishInteractionOptions as a7, type HostedEvaluatorPin as a8, type IdentifyEvent as a9, type PulledEvalSnapshot as aA, type RaindropConnection as aB, type RaindropFeatureFlagValue as aC, type RaindropFeatureFlags as aD, type RaindropProperties as aE, type RaindropPropertyLeaf as aF, type RaindropPropertyValue as aG, type ReplayClient as aH, type ReplayCounts as aI, ReplayCountsSchema as aJ, type ReplayEvaluator as aK, type ReplayEvaluatorCounts as aL, ReplayEvaluatorCountsSchema as aM, type ReplayEvaluatorStats as aN, ReplayEvaluatorStatsSchema as aO, type ReplayEvaluatorSummary as aP, ReplayEvaluatorSummarySchema as aQ, type ReplayHandle as aR, type LocalEvaluatorContext$1 as aS, type ReplayOptions as aT, type ReplayReading as aU, type ReplayResult as aV, type ReplayResultRow as aW, ReplayResultRowSchema as aX, type ReplayRow as aY, type ReplayRowOutcome as aZ, type ReplayVerdict as a_, type LocalBooleanVerdict as aa, LocalBooleanVerdictSchema as ab, type LocalDebuggerLiveEventInput as ac, type LocalEvaluator as ad, type LocalEvaluatorContext as ae, type LocalNumberVerdict as af, LocalNumberVerdictSchema as ag, type LocalScoreVerdict as ah, LocalScoreVerdictSchema as ai, type LocalVerdict as aj, LocalVerdictSchema as ak, MAX_EVAL_STATUS_RETRIES as al, MAX_INGEST_SIZE_BYTES as am, type NumericThreshold as an, NumericThresholdSchema as ao, type PartialAiTrackEvent as ap, type PortableEvalArtifact as aq, type PortableEvalLimits as ar, type PortableEvalOutcome as as, type PortableEvalResult as at, type PortableEvaluator as au, type PortableJudgeRequest as av, type PortableJudgeVerdict as aw, type PublishEvalDatasetOptions as ax, type PublishEvalSuiteOptions as ay, type PullEvalOptions as az, type Interaction as b, type RunEvalSuiteOptions as b0, type RunReplayOptions as b1, type SelfDiagnoseOptions as b2, type SelfDiagnosticsExecuteContext as b3, type SelfDiagnosticsExecuteResult as b4, type SelfDiagnosticsSignalDefinition as b5, type SelfDiagnosticsSignalDefinitions as b6, type SelfDiagnosticsTool as b7, type SelfDiagnosticsToolInputSchema as b8, type SelfDiagnosticsToolOptions as b9, importPortableEvaluator as bA, isEvalDataset as bB, isEvalSuiteDefinition as bC, isPublishedEvalSuite as bD, loadEvalSnapshot as bE, projectWorkshopTrace as bF, publishEvalDataset as bG, publishEvalSuite as bH, pullEval as bI, readEvalDataset as bJ, readEvalManifest as bK, readEvalRun as bL, readEvaluator as bM, readReplay as bN, replay as bO, resolveDisableBatching as bP, runEvalSuite as bQ, runReplay as bR, traceOutput as bS, traceToolCalls as bT, traceTools as bU, verifyPortableEvalArtifact as bV, withEvalScope as bW, type SignalEvent as ba, type SpanParams as bb, type SubagentDispatch as bc, type SubagentDispatchOptions as bd, type SubagentFinishOptions as be, type ToolParams as bf, type ToolSpan as bg, type Trace as bh, type TraceContext as bi, TraceSchema as bj, type TrackToolParams as bk, type WorkflowParams as bl, claimReplay as bm, compareEvalRuns as bn, createEvalHandler as bo, createEvalSuiteRun as bp, createReplay as bq, currentEvalScope as br, defineAgent as bs, defineDataset as bt, defineEvalSuite as bu, defineEvaluatorProgram as bv, defineLocalEvaluator as bw, evaluateEvalRun as bx, evaluatePortableEvaluator as by, evaluateReplay as bz, type AppGitSnapshot as c, type SubagentResumeOptions as d, type SubagentRun as e, type Tracer as f, type AiTrackEvent as g, type AppGitOptions as h, type Attachment as i, type AttachmentType as j, type BeginInteractionOptions as k, type BooleanThreshold as l, BooleanThresholdSchema as m, type CreateEvalSuiteRunOptions as n, type CreateReplayOptions as o, DEFAULT_EVAL_WAIT_MS as p, DEFAULT_QUERY_URL as q, DEFAULT_TRACE_WAIT_MS as r, type DefinedEvalAgent as s, type DefinedEvalDataset as t, type EvalAgentDefinition as u, type EvalAgentExecution as v, type EvalClient as w, type EvalDataset as x, type EvalDatasetInput as y, type EvalDatasetManifest as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@opentelemetry/instrumentation';
|
|
2
|
-
export { g as AiTrackEvent, A as AiTrackUsage, h as AppGitOptions, c as AppGitSnapshot, i as Attachment, j as AttachmentType,
|
|
2
|
+
export { g as AiTrackEvent, A as AiTrackUsage, h as AppGitOptions, c as AppGitSnapshot, i as Attachment, j as AttachmentType, k as BeginInteractionOptions, l as BooleanThreshold, m as BooleanThresholdSchema, n as CreateEvalSuiteRunOptions, o as CreateReplayOptions, D as DEFAULT_EVAL_POLL_INTERVAL_MS, p as DEFAULT_EVAL_WAIT_MS, q as DEFAULT_QUERY_URL, r as DEFAULT_TRACE_WAIT_MS, s as DefinedEvalAgent, t as DefinedEvalDataset, E as EVAL_CORRELATION_ID_ATTRIBUTE, u as EvalAgentDefinition, v as EvalAgentExecution, w as EvalClient, x as EvalDataset, y as EvalDatasetInput, z as EvalDatasetManifest, F as EvalDatasetPublishConflictError, G as EvalDatasetRowInput, H as EvalDatasetRowInputSchema, J as EvalDestination, K as EvalEvaluator, L as EvalHandlerOptions, M as EvalLocalEvaluator, N as EvalManifest, O as EvalParameterError, P as EvalParameterField, Q as EvalParameterFields, U as EvalParameters, V as EvalProgram, W as EvalPublishError, X as EvalRowResult, Y as EvalRowTracePair, Z as EvalRunReading, _ as EvalScope, $ as EvalSuiteDefinition, a0 as EvalSuiteDefinitionInput, a1 as EvalSuiteManifest, a2 as EvalSuiteManifestSchema, a3 as EvalSuiteResult, a4 as EvalSuiteRunSession, a5 as EvalVerdictAssessment, a6 as EvaluateReplayOptions, a7 as FinishInteractionOptions, a8 as HostedEvaluatorPin, a9 as IdentifyEvent, b as Interaction, aa as LocalBooleanVerdict, ab as LocalBooleanVerdictSchema, ac as LocalDebuggerLiveEventInput, ad as LocalEvaluator, ae as LocalEvaluatorContext, af as LocalNumberVerdict, ag as LocalNumberVerdictSchema, ah as LocalScoreVerdict, ai as LocalScoreVerdictSchema, aj as LocalVerdict, ak as LocalVerdictSchema, al as MAX_EVAL_STATUS_RETRIES, am as MAX_INGEST_SIZE_BYTES, an as NumericThreshold, ao as NumericThresholdSchema, ap as PartialAiTrackEvent, aq as PortableEvalArtifact, ar as PortableEvalLimits, as as PortableEvalOutcome, at as PortableEvalResult, au as PortableEvaluator, av as PortableJudgeRequest, aw as PortableJudgeVerdict, ax as PublishEvalDatasetOptions, ay as PublishEvalSuiteOptions, az as PullEvalOptions, aA as PulledEvalSnapshot, R as Raindrop, aB as RaindropConnection, aC as RaindropFeatureFlagValue, aD as RaindropFeatureFlags, aE as RaindropProperties, aF as RaindropPropertyLeaf, aG as RaindropPropertyValue, a as RaindropSpanProcessor, aH as ReplayClient, aI as ReplayCounts, aJ as ReplayCountsSchema, aK as ReplayEvaluator, aL as ReplayEvaluatorCounts, aM as ReplayEvaluatorCountsSchema, aN as ReplayEvaluatorStats, aO as ReplayEvaluatorStatsSchema, aP as ReplayEvaluatorSummary, aQ as ReplayEvaluatorSummarySchema, aR as ReplayHandle, aS as ReplayLocalEvaluatorContext, aT as ReplayOptions, aU as ReplayReading, aV as ReplayResult, aW as ReplayResultRow, aX as ReplayResultRowSchema, aY as ReplayRow, aZ as ReplayRowOutcome, a_ as ReplayVerdict, a$ as ReplayVerdictSchema, b0 as RunEvalSuiteOptions, b1 as RunReplayOptions, b2 as SelfDiagnoseOptions, b3 as SelfDiagnosticsExecuteContext, b4 as SelfDiagnosticsExecuteResult, b5 as SelfDiagnosticsSignalDefinition, b6 as SelfDiagnosticsSignalDefinitions, b7 as SelfDiagnosticsTool, b8 as SelfDiagnosticsToolInputSchema, b9 as SelfDiagnosticsToolOptions, ba as SignalEvent, bb as SpanParams, bc as SubagentDispatch, bd as SubagentDispatchOptions, be as SubagentFinishOptions, d as SubagentResumeOptions, e as SubagentRun, bf as ToolParams, bg as ToolSpan, bh as Trace, bi as TraceContext, bj as TraceSchema, f as Tracer, bk as TrackToolParams, bl as WorkflowParams, bm as claimReplay, bn as compareEvalRuns, bo as createEvalHandler, bp as createEvalSuiteRun, bq as createReplay, br as currentEvalScope, R as default, bs as defineAgent, bt as defineDataset, bu as defineEvalSuite, bv as defineEvaluatorProgram, bw as defineLocalEvaluator, bx as evaluateEvalRun, by as evaluatePortableEvaluator, bz as evaluateReplay, bA as importPortableEvaluator, bB as isEvalDataset, bC as isEvalSuiteDefinition, bD as isPublishedEvalSuite, bE as loadEvalSnapshot, bF as projectWorkshopTrace, bG as publishEvalDataset, bH as publishEvalSuite, bI as pullEval, bJ as readEvalDataset, bK as readEvalManifest, bL as readEvalRun, bM as readEvaluator, bN as readReplay, bO as replay, bP as resolveDisableBatching, bQ as runEvalSuite, bR as runReplay, bS as traceOutput, bT as traceToolCalls, bU as traceTools, bV as verifyPortableEvalArtifact, bW as withEvalScope } from './index-C5Aj6zuo.mjs';
|
|
3
3
|
import '@opentelemetry/api';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '@opentelemetry/sdk-trace-base';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@opentelemetry/instrumentation';
|
|
2
|
-
export { g as AiTrackEvent, A as AiTrackUsage, h as AppGitOptions, c as AppGitSnapshot, i as Attachment, j as AttachmentType,
|
|
2
|
+
export { g as AiTrackEvent, A as AiTrackUsage, h as AppGitOptions, c as AppGitSnapshot, i as Attachment, j as AttachmentType, k as BeginInteractionOptions, l as BooleanThreshold, m as BooleanThresholdSchema, n as CreateEvalSuiteRunOptions, o as CreateReplayOptions, D as DEFAULT_EVAL_POLL_INTERVAL_MS, p as DEFAULT_EVAL_WAIT_MS, q as DEFAULT_QUERY_URL, r as DEFAULT_TRACE_WAIT_MS, s as DefinedEvalAgent, t as DefinedEvalDataset, E as EVAL_CORRELATION_ID_ATTRIBUTE, u as EvalAgentDefinition, v as EvalAgentExecution, w as EvalClient, x as EvalDataset, y as EvalDatasetInput, z as EvalDatasetManifest, F as EvalDatasetPublishConflictError, G as EvalDatasetRowInput, H as EvalDatasetRowInputSchema, J as EvalDestination, K as EvalEvaluator, L as EvalHandlerOptions, M as EvalLocalEvaluator, N as EvalManifest, O as EvalParameterError, P as EvalParameterField, Q as EvalParameterFields, U as EvalParameters, V as EvalProgram, W as EvalPublishError, X as EvalRowResult, Y as EvalRowTracePair, Z as EvalRunReading, _ as EvalScope, $ as EvalSuiteDefinition, a0 as EvalSuiteDefinitionInput, a1 as EvalSuiteManifest, a2 as EvalSuiteManifestSchema, a3 as EvalSuiteResult, a4 as EvalSuiteRunSession, a5 as EvalVerdictAssessment, a6 as EvaluateReplayOptions, a7 as FinishInteractionOptions, a8 as HostedEvaluatorPin, a9 as IdentifyEvent, b as Interaction, aa as LocalBooleanVerdict, ab as LocalBooleanVerdictSchema, ac as LocalDebuggerLiveEventInput, ad as LocalEvaluator, ae as LocalEvaluatorContext, af as LocalNumberVerdict, ag as LocalNumberVerdictSchema, ah as LocalScoreVerdict, ai as LocalScoreVerdictSchema, aj as LocalVerdict, ak as LocalVerdictSchema, al as MAX_EVAL_STATUS_RETRIES, am as MAX_INGEST_SIZE_BYTES, an as NumericThreshold, ao as NumericThresholdSchema, ap as PartialAiTrackEvent, aq as PortableEvalArtifact, ar as PortableEvalLimits, as as PortableEvalOutcome, at as PortableEvalResult, au as PortableEvaluator, av as PortableJudgeRequest, aw as PortableJudgeVerdict, ax as PublishEvalDatasetOptions, ay as PublishEvalSuiteOptions, az as PullEvalOptions, aA as PulledEvalSnapshot, R as Raindrop, aB as RaindropConnection, aC as RaindropFeatureFlagValue, aD as RaindropFeatureFlags, aE as RaindropProperties, aF as RaindropPropertyLeaf, aG as RaindropPropertyValue, a as RaindropSpanProcessor, aH as ReplayClient, aI as ReplayCounts, aJ as ReplayCountsSchema, aK as ReplayEvaluator, aL as ReplayEvaluatorCounts, aM as ReplayEvaluatorCountsSchema, aN as ReplayEvaluatorStats, aO as ReplayEvaluatorStatsSchema, aP as ReplayEvaluatorSummary, aQ as ReplayEvaluatorSummarySchema, aR as ReplayHandle, aS as ReplayLocalEvaluatorContext, aT as ReplayOptions, aU as ReplayReading, aV as ReplayResult, aW as ReplayResultRow, aX as ReplayResultRowSchema, aY as ReplayRow, aZ as ReplayRowOutcome, a_ as ReplayVerdict, a$ as ReplayVerdictSchema, b0 as RunEvalSuiteOptions, b1 as RunReplayOptions, b2 as SelfDiagnoseOptions, b3 as SelfDiagnosticsExecuteContext, b4 as SelfDiagnosticsExecuteResult, b5 as SelfDiagnosticsSignalDefinition, b6 as SelfDiagnosticsSignalDefinitions, b7 as SelfDiagnosticsTool, b8 as SelfDiagnosticsToolInputSchema, b9 as SelfDiagnosticsToolOptions, ba as SignalEvent, bb as SpanParams, bc as SubagentDispatch, bd as SubagentDispatchOptions, be as SubagentFinishOptions, d as SubagentResumeOptions, e as SubagentRun, bf as ToolParams, bg as ToolSpan, bh as Trace, bi as TraceContext, bj as TraceSchema, f as Tracer, bk as TrackToolParams, bl as WorkflowParams, bm as claimReplay, bn as compareEvalRuns, bo as createEvalHandler, bp as createEvalSuiteRun, bq as createReplay, br as currentEvalScope, R as default, bs as defineAgent, bt as defineDataset, bu as defineEvalSuite, bv as defineEvaluatorProgram, bw as defineLocalEvaluator, bx as evaluateEvalRun, by as evaluatePortableEvaluator, bz as evaluateReplay, bA as importPortableEvaluator, bB as isEvalDataset, bC as isEvalSuiteDefinition, bD as isPublishedEvalSuite, bE as loadEvalSnapshot, bF as projectWorkshopTrace, bG as publishEvalDataset, bH as publishEvalSuite, bI as pullEval, bJ as readEvalDataset, bK as readEvalManifest, bL as readEvalRun, bM as readEvaluator, bN as readReplay, bO as replay, bP as resolveDisableBatching, bQ as runEvalSuite, bR as runReplay, bS as traceOutput, bT as traceToolCalls, bU as traceTools, bV as verifyPortableEvalArtifact, bW as withEvalScope } from './index-C5Aj6zuo.js';
|
|
3
3
|
import '@opentelemetry/api';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '@opentelemetry/sdk-trace-base';
|
package/dist/index.js
CHANGED
|
@@ -7363,7 +7363,7 @@ function evalScopeAttributes() {
|
|
|
7363
7363
|
return { [EVAL_CORRELATION_ID_ATTRIBUTE]: scope.correlationId };
|
|
7364
7364
|
}
|
|
7365
7365
|
|
|
7366
|
-
// ../core/dist/chunk-
|
|
7366
|
+
// ../core/dist/chunk-I6TVJQEC.js
|
|
7367
7367
|
var STATE_KEY = /* @__PURE__ */ Symbol.for("raindrop.tracing.replayTraceRoutingState");
|
|
7368
7368
|
function state() {
|
|
7369
7369
|
const holder = globalThis;
|
|
@@ -8751,6 +8751,178 @@ var DEFAULT_REDACT_ATTRIBUTE_KEYS = [
|
|
|
8751
8751
|
"ai.response.providerMetadata"
|
|
8752
8752
|
];
|
|
8753
8753
|
var REDACT_JSON_ATTRIBUTE_KEYS = new Set(DEFAULT_REDACT_ATTRIBUTE_KEYS);
|
|
8754
|
+
var PROMPT_TOOLS_ATTRIBUTE = "ai.prompt.tools";
|
|
8755
|
+
function isRecord(value) {
|
|
8756
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8757
|
+
}
|
|
8758
|
+
var JSON_SCHEMA_KEYS = [
|
|
8759
|
+
"type",
|
|
8760
|
+
"properties",
|
|
8761
|
+
"$schema",
|
|
8762
|
+
"$ref",
|
|
8763
|
+
"anyOf",
|
|
8764
|
+
"oneOf",
|
|
8765
|
+
"allOf",
|
|
8766
|
+
"enum",
|
|
8767
|
+
"const",
|
|
8768
|
+
"items",
|
|
8769
|
+
"additionalProperties",
|
|
8770
|
+
"required"
|
|
8771
|
+
];
|
|
8772
|
+
function isJsonSchema(value) {
|
|
8773
|
+
if (!isRecord(value)) return false;
|
|
8774
|
+
if (typeof value["~standard"] === "object") return false;
|
|
8775
|
+
if (isRecord(value._def) || isRecord(value._zod)) return false;
|
|
8776
|
+
if (Object.keys(value).length === 0) return true;
|
|
8777
|
+
return JSON_SCHEMA_KEYS.some((key) => key in value);
|
|
8778
|
+
}
|
|
8779
|
+
function toJsonSchema(value, options) {
|
|
8780
|
+
if (value === void 0 || value === null) return void 0;
|
|
8781
|
+
if (isJsonSchema(value)) return value;
|
|
8782
|
+
if (isRecord(value) && isJsonSchema(value.jsonSchema)) return value.jsonSchema;
|
|
8783
|
+
if (isRecord(value) && isJsonSchema(value.json)) return value.json;
|
|
8784
|
+
if (options == null ? void 0 : options.schema) {
|
|
8785
|
+
try {
|
|
8786
|
+
return options.schema(value);
|
|
8787
|
+
} catch (e) {
|
|
8788
|
+
return void 0;
|
|
8789
|
+
}
|
|
8790
|
+
}
|
|
8791
|
+
return void 0;
|
|
8792
|
+
}
|
|
8793
|
+
function pickString(value) {
|
|
8794
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
8795
|
+
}
|
|
8796
|
+
function functionTool(name, description, schema, options) {
|
|
8797
|
+
const tool = { type: "function", name };
|
|
8798
|
+
const desc = pickString(description);
|
|
8799
|
+
if (desc !== void 0) tool.description = desc;
|
|
8800
|
+
const inputSchema = toJsonSchema(schema, options);
|
|
8801
|
+
if (inputSchema !== void 0) tool.inputSchema = inputSchema;
|
|
8802
|
+
return tool;
|
|
8803
|
+
}
|
|
8804
|
+
function normalizeToolDeclaration(tool, options, fallbackName) {
|
|
8805
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
8806
|
+
if (!isRecord(tool)) return void 0;
|
|
8807
|
+
if (tool.type === "provider-defined" || tool.type === "provider") {
|
|
8808
|
+
const name2 = (_b = (_a = pickString(tool.name)) != null ? _a : pickString(tool.id)) != null ? _b : fallbackName;
|
|
8809
|
+
if (name2 === void 0) return void 0;
|
|
8810
|
+
const declaration = { type: "provider-defined", name: name2 };
|
|
8811
|
+
const id = pickString(tool.id);
|
|
8812
|
+
if (id !== void 0) declaration.id = id;
|
|
8813
|
+
if (isRecord(tool.args)) declaration.args = tool.args;
|
|
8814
|
+
return declaration;
|
|
8815
|
+
}
|
|
8816
|
+
if (isRecord(tool.toolSpec)) {
|
|
8817
|
+
const spec = tool.toolSpec;
|
|
8818
|
+
const name2 = (_c = pickString(spec.name)) != null ? _c : fallbackName;
|
|
8819
|
+
if (name2 === void 0) return void 0;
|
|
8820
|
+
return functionTool(name2, spec.description, spec.inputSchema, options);
|
|
8821
|
+
}
|
|
8822
|
+
if (isRecord(tool.function)) {
|
|
8823
|
+
const fn = tool.function;
|
|
8824
|
+
const name2 = (_d = pickString(fn.name)) != null ? _d : fallbackName;
|
|
8825
|
+
if (name2 === void 0) return void 0;
|
|
8826
|
+
return functionTool(name2, fn.description, (_e = fn.parameters) != null ? _e : fn.input_schema, options);
|
|
8827
|
+
}
|
|
8828
|
+
const name = (_g = (_f = pickString(tool.name)) != null ? _f : pickString(tool.id)) != null ? _g : fallbackName;
|
|
8829
|
+
if (name === void 0) return void 0;
|
|
8830
|
+
const type = pickString(tool.type);
|
|
8831
|
+
if (type !== void 0 && type !== "function" && type !== "dynamic" && type !== "custom") {
|
|
8832
|
+
if (!("input_schema" in tool) && !("inputSchema" in tool) && !("parameters" in tool)) {
|
|
8833
|
+
return { type: "provider-defined", id: type, name };
|
|
8834
|
+
}
|
|
8835
|
+
}
|
|
8836
|
+
return functionTool(
|
|
8837
|
+
name,
|
|
8838
|
+
tool.description,
|
|
8839
|
+
(_j = (_i = (_h = tool.inputSchema) != null ? _h : tool.input_schema) != null ? _i : tool.parameters) != null ? _j : tool.schema,
|
|
8840
|
+
options
|
|
8841
|
+
);
|
|
8842
|
+
}
|
|
8843
|
+
var NOT_A_GEMINI_GROUP_KEYS = ["name", "id", "type", "function", "toolSpec", "cachePoint"];
|
|
8844
|
+
function isGeminiToolGroup(tool) {
|
|
8845
|
+
if (Array.isArray(tool.functionDeclarations)) return true;
|
|
8846
|
+
const keys = Object.keys(tool);
|
|
8847
|
+
if (keys.length === 0 || NOT_A_GEMINI_GROUP_KEYS.some((key) => key in tool)) return false;
|
|
8848
|
+
return keys.every((key) => isRecord(tool[key]));
|
|
8849
|
+
}
|
|
8850
|
+
function expandGeminiTool(tool, options) {
|
|
8851
|
+
const declarations = [];
|
|
8852
|
+
for (const [key, value] of Object.entries(tool)) {
|
|
8853
|
+
if (key === "functionDeclarations" && Array.isArray(value)) {
|
|
8854
|
+
for (const declaration of value) {
|
|
8855
|
+
const normalized = normalizeToolDeclaration(declaration, options);
|
|
8856
|
+
if (normalized) declarations.push(normalized);
|
|
8857
|
+
}
|
|
8858
|
+
} else if (isRecord(value)) {
|
|
8859
|
+
declarations.push({ type: "provider-defined", id: key, name: key, args: value });
|
|
8860
|
+
}
|
|
8861
|
+
}
|
|
8862
|
+
return declarations;
|
|
8863
|
+
}
|
|
8864
|
+
function normalizeToolDeclarations(tools, options) {
|
|
8865
|
+
if (tools === void 0 || tools === null) return void 0;
|
|
8866
|
+
if (Array.isArray(tools)) {
|
|
8867
|
+
return tools.flatMap((tool) => {
|
|
8868
|
+
if (isRecord(tool) && isGeminiToolGroup(tool)) {
|
|
8869
|
+
return expandGeminiTool(tool, options);
|
|
8870
|
+
}
|
|
8871
|
+
const declaration = normalizeToolDeclaration(tool, options);
|
|
8872
|
+
return declaration ? [declaration] : [];
|
|
8873
|
+
});
|
|
8874
|
+
}
|
|
8875
|
+
if (!isRecord(tools)) return void 0;
|
|
8876
|
+
return Object.entries(tools).flatMap(([key, tool]) => {
|
|
8877
|
+
const declaration = normalizeToolDeclaration(tool, options, key);
|
|
8878
|
+
return declaration ? [declaration] : [];
|
|
8879
|
+
});
|
|
8880
|
+
}
|
|
8881
|
+
function promptToolsAttributeValue(tools) {
|
|
8882
|
+
if (tools === void 0) return void 0;
|
|
8883
|
+
return tools.map((tool) => {
|
|
8884
|
+
try {
|
|
8885
|
+
return JSON.stringify(tool);
|
|
8886
|
+
} catch (e) {
|
|
8887
|
+
return JSON.stringify({ type: tool.type, name: tool.name });
|
|
8888
|
+
}
|
|
8889
|
+
});
|
|
8890
|
+
}
|
|
8891
|
+
function promptToolsFromTraceloopAttributes(attributes) {
|
|
8892
|
+
var _a;
|
|
8893
|
+
const byIndex = /* @__PURE__ */ new Map();
|
|
8894
|
+
const prefix = "llm.request.functions.";
|
|
8895
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
8896
|
+
if (!key.startsWith(prefix)) continue;
|
|
8897
|
+
const rest = key.slice(prefix.length);
|
|
8898
|
+
const dot = rest.indexOf(".");
|
|
8899
|
+
if (dot <= 0) continue;
|
|
8900
|
+
const index = Number(rest.slice(0, dot));
|
|
8901
|
+
if (!Number.isInteger(index) || index < 0) continue;
|
|
8902
|
+
const field = rest.slice(dot + 1);
|
|
8903
|
+
const entry = (_a = byIndex.get(index)) != null ? _a : {};
|
|
8904
|
+
if (field === "name" && typeof value === "string") entry.name = value;
|
|
8905
|
+
else if (field === "description" && typeof value === "string") entry.description = value;
|
|
8906
|
+
else if (field === "parameters") entry.parameters = value;
|
|
8907
|
+
byIndex.set(index, entry);
|
|
8908
|
+
}
|
|
8909
|
+
if (byIndex.size === 0) return void 0;
|
|
8910
|
+
const tools = [];
|
|
8911
|
+
for (const index of [...byIndex.keys()].sort((a, b) => a - b)) {
|
|
8912
|
+
const entry = byIndex.get(index);
|
|
8913
|
+
if (!(entry == null ? void 0 : entry.name)) continue;
|
|
8914
|
+
let parameters = entry.parameters;
|
|
8915
|
+
if (typeof parameters === "string") {
|
|
8916
|
+
try {
|
|
8917
|
+
parameters = JSON.parse(parameters);
|
|
8918
|
+
} catch (e) {
|
|
8919
|
+
parameters = void 0;
|
|
8920
|
+
}
|
|
8921
|
+
}
|
|
8922
|
+
tools.push(functionTool(entry.name, entry.description, parameters, void 0));
|
|
8923
|
+
}
|
|
8924
|
+
return tools;
|
|
8925
|
+
}
|
|
8754
8926
|
|
|
8755
8927
|
// ../core/dist/index.node.js
|
|
8756
8928
|
var import_async_hooks = require("async_hooks");
|
|
@@ -13010,7 +13182,7 @@ var SignalEventSchema = external_exports.object({
|
|
|
13010
13182
|
// package.json
|
|
13011
13183
|
var package_default = {
|
|
13012
13184
|
name: "raindrop-ai",
|
|
13013
|
-
version: "0.9.
|
|
13185
|
+
version: "0.9.1",
|
|
13014
13186
|
main: "dist/index.js",
|
|
13015
13187
|
module: "dist/index.mjs",
|
|
13016
13188
|
types: "dist/index.d.ts",
|
|
@@ -14319,6 +14491,34 @@ function enrichStart(span) {
|
|
|
14319
14491
|
}
|
|
14320
14492
|
}
|
|
14321
14493
|
}
|
|
14494
|
+
var PROMPT_TOOLS_OVERRIDE_MARKER = "raindrop.prompt_tools.override";
|
|
14495
|
+
var MODEL_SPAN_ATTRIBUTES = ["llm.request.type", "gen_ai.request.model", "ai.model.id"];
|
|
14496
|
+
function isModelSpan(attributes) {
|
|
14497
|
+
return MODEL_SPAN_ATTRIBUTES.some((key) => attributes[key] !== void 0);
|
|
14498
|
+
}
|
|
14499
|
+
function applyPromptTools(span) {
|
|
14500
|
+
var _a;
|
|
14501
|
+
const attributes = span.attributes;
|
|
14502
|
+
const marker = attributes[PROMPT_TOOLS_OVERRIDE_MARKER];
|
|
14503
|
+
if (marker !== void 0) {
|
|
14504
|
+
delete attributes[PROMPT_TOOLS_OVERRIDE_MARKER];
|
|
14505
|
+
if (!isModelSpan(attributes) || !shouldSendTraceContent()) return;
|
|
14506
|
+
let parsed;
|
|
14507
|
+
try {
|
|
14508
|
+
parsed = JSON.parse(String(marker));
|
|
14509
|
+
} catch (e) {
|
|
14510
|
+
return;
|
|
14511
|
+
}
|
|
14512
|
+
const tools = (_a = normalizeToolDeclarations(parsed)) != null ? _a : [];
|
|
14513
|
+
attributes[PROMPT_TOOLS_ATTRIBUTE] = promptToolsAttributeValue(tools);
|
|
14514
|
+
return;
|
|
14515
|
+
}
|
|
14516
|
+
if (attributes[PROMPT_TOOLS_ATTRIBUTE] !== void 0) return;
|
|
14517
|
+
if (!shouldSendTraceContent()) return;
|
|
14518
|
+
const inferred = promptToolsFromTraceloopAttributes(attributes);
|
|
14519
|
+
if (inferred === void 0) return;
|
|
14520
|
+
attributes[PROMPT_TOOLS_ATTRIBUTE] = promptToolsAttributeValue(inferred);
|
|
14521
|
+
}
|
|
14322
14522
|
function createSpanProcessor(options) {
|
|
14323
14523
|
var _a, _b;
|
|
14324
14524
|
const baseUrl = options.baseUrl || process.env.TRACELOOP_BASE_URL || "https://api.traceloop.com";
|
|
@@ -14344,6 +14544,7 @@ function createSpanProcessor(options) {
|
|
|
14344
14544
|
if (allowed !== ALL_INSTRUMENTATION_LIBRARIES && ![...INSTRUMENTATION_LIBRARIES, ...allowed != null ? allowed : []].includes((_a2 = scopeName(span)) != null ? _a2 : "")) {
|
|
14345
14545
|
return;
|
|
14346
14546
|
}
|
|
14547
|
+
applyPromptTools(span);
|
|
14347
14548
|
outgoing = transformAiSdkSpan(span);
|
|
14348
14549
|
if (outgoing !== span) copyReplayTraceDestination(span, outgoing);
|
|
14349
14550
|
} catch (e) {
|
|
@@ -15459,6 +15660,22 @@ var LiveInteraction = class {
|
|
|
15459
15660
|
if (this.toolEventsFrame) return;
|
|
15460
15661
|
this.toolEventsFrame = bindSpanAttributes(attributes, this);
|
|
15461
15662
|
}
|
|
15663
|
+
/**
|
|
15664
|
+
* Carry a `begin({ tools })` override to every span started inside this
|
|
15665
|
+
* interaction. Frames stamp strings, so the normalized catalog rides as one
|
|
15666
|
+
* JSON marker attribute; the span processor turns it into `ai.prompt.tools`
|
|
15667
|
+
* on model spans (and drops it from every other span) when the span ends.
|
|
15668
|
+
* Same lifetime as the tool-events frame: removed by `finish()`.
|
|
15669
|
+
*/
|
|
15670
|
+
bindPromptToolsOverride(tools) {
|
|
15671
|
+
var _a;
|
|
15672
|
+
if (tools === void 0 || this.promptToolsFrame) return;
|
|
15673
|
+
const declarations = (_a = normalizeToolDeclarations(tools)) != null ? _a : [];
|
|
15674
|
+
this.promptToolsFrame = bindSpanAttributes(
|
|
15675
|
+
{ [PROMPT_TOOLS_OVERRIDE_MARKER]: JSON.stringify(declarations) },
|
|
15676
|
+
this
|
|
15677
|
+
);
|
|
15678
|
+
}
|
|
15462
15679
|
subagent(options) {
|
|
15463
15680
|
return recordSubagentDispatch(this, options);
|
|
15464
15681
|
}
|
|
@@ -15586,6 +15803,8 @@ var LiveInteraction = class {
|
|
|
15586
15803
|
this.boundContext = void 0;
|
|
15587
15804
|
unbindSpanAttributes(this.toolEventsFrame);
|
|
15588
15805
|
this.toolEventsFrame = void 0;
|
|
15806
|
+
unbindSpanAttributes(this.promptToolsFrame);
|
|
15807
|
+
this.promptToolsFrame = void 0;
|
|
15589
15808
|
if (!this.traceId) {
|
|
15590
15809
|
this.resolveLiveTraceId();
|
|
15591
15810
|
}
|
|
@@ -16611,8 +16830,9 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
|
|
|
16611
16830
|
} catch (e) {
|
|
16612
16831
|
}
|
|
16613
16832
|
}) : void 0;
|
|
16614
|
-
const beginInteraction = (
|
|
16833
|
+
const beginInteraction = (params) => {
|
|
16615
16834
|
var _a2;
|
|
16835
|
+
const { tools, ...traceContext } = params;
|
|
16616
16836
|
if (!traceContext.eventId) {
|
|
16617
16837
|
traceContext.eventId = crypto.randomUUID();
|
|
16618
16838
|
}
|
|
@@ -16626,6 +16846,7 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
|
|
|
16626
16846
|
);
|
|
16627
16847
|
const bound = bindRoutingContext({ projectId, authHint, appGit: analytics.getAppGitSnapshot(traceContext.properties, traceContext.eventId) }, interaction);
|
|
16628
16848
|
interaction.setBoundContext(bound);
|
|
16849
|
+
interaction.bindPromptToolsOverride(tools);
|
|
16629
16850
|
try {
|
|
16630
16851
|
analytics._trackAiPartial({
|
|
16631
16852
|
...traceContext,
|
|
@@ -20206,7 +20427,7 @@ var SELF_DIAGNOSTICS_SIGNALS_DEFAULT = {
|
|
|
20206
20427
|
sentiment: "NEGATIVE"
|
|
20207
20428
|
}
|
|
20208
20429
|
};
|
|
20209
|
-
function
|
|
20430
|
+
function isRecord2(value) {
|
|
20210
20431
|
return typeof value === "object" && value !== null;
|
|
20211
20432
|
}
|
|
20212
20433
|
function normalizeSelfDiagnosticsSignals(signals) {
|
|
@@ -20643,7 +20864,7 @@ var Raindrop = class {
|
|
|
20643
20864
|
const onMissingEventId = (_b = options.onMissingEventId) != null ? _b : "warn";
|
|
20644
20865
|
const execute = async (rawInput, context8) => {
|
|
20645
20866
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
20646
|
-
const input =
|
|
20867
|
+
const input = isRecord2(rawInput) ? rawInput : void 0;
|
|
20647
20868
|
const fallbackCategory = (_a2 = signalKeys[0]) != null ? _a2 : "unknown";
|
|
20648
20869
|
const categoryCandidate = normalizeEventId(input == null ? void 0 : input["category"]);
|
|
20649
20870
|
const category = categoryCandidate && signalKeySet.has(categoryCandidate) ? categoryCandidate : fallbackCategory;
|
package/dist/index.mjs
CHANGED
|
@@ -46,8 +46,8 @@ import {
|
|
|
46
46
|
runReplay,
|
|
47
47
|
traceTools,
|
|
48
48
|
withEvalScope
|
|
49
|
-
} from "./chunk-
|
|
50
|
-
import "./chunk-
|
|
49
|
+
} from "./chunk-SUW3YBV3.mjs";
|
|
50
|
+
import "./chunk-WLBBPTI6.mjs";
|
|
51
51
|
import {
|
|
52
52
|
BooleanThresholdSchema,
|
|
53
53
|
EvalSuiteManifestSchema,
|
package/dist/tracing/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Instrumentation } from '@opentelemetry/instrumentation';
|
|
2
|
-
import { R as Raindrop, I as InitializeOptions, S as SpanProcessorOptions, a as RaindropSpanProcessor,
|
|
2
|
+
import { R as Raindrop, I as InitializeOptions, S as SpanProcessorOptions, a as RaindropSpanProcessor, B as BeginParams, b as Interaction, A as AiTrackUsage, c as AppGitSnapshot, C as CarrierHeaders, T as TraceCarrier, d as SubagentResumeOptions, e as SubagentRun, f as Tracer } from '../index-C5Aj6zuo.mjs';
|
|
3
3
|
import '@opentelemetry/api';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '@opentelemetry/sdk-trace-base';
|
|
@@ -87,7 +87,7 @@ declare const tracing: (analytics: Raindrop, apiUrl: string, writeKey: string, o
|
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
89
|
createSpanProcessor(processorOptions?: SpanProcessorOptions): RaindropSpanProcessor;
|
|
90
|
-
begin(traceContext:
|
|
90
|
+
begin(traceContext: BeginParams): Interaction;
|
|
91
91
|
recordModelUsage: (params: {
|
|
92
92
|
eventId: string;
|
|
93
93
|
model: string;
|
package/dist/tracing/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Instrumentation } from '@opentelemetry/instrumentation';
|
|
2
|
-
import { R as Raindrop, I as InitializeOptions, S as SpanProcessorOptions, a as RaindropSpanProcessor,
|
|
2
|
+
import { R as Raindrop, I as InitializeOptions, S as SpanProcessorOptions, a as RaindropSpanProcessor, B as BeginParams, b as Interaction, A as AiTrackUsage, c as AppGitSnapshot, C as CarrierHeaders, T as TraceCarrier, d as SubagentResumeOptions, e as SubagentRun, f as Tracer } from '../index-C5Aj6zuo.js';
|
|
3
3
|
import '@opentelemetry/api';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '@opentelemetry/sdk-trace-base';
|
|
@@ -87,7 +87,7 @@ declare const tracing: (analytics: Raindrop, apiUrl: string, writeKey: string, o
|
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
89
|
createSpanProcessor(processorOptions?: SpanProcessorOptions): RaindropSpanProcessor;
|
|
90
|
-
begin(traceContext:
|
|
90
|
+
begin(traceContext: BeginParams): Interaction;
|
|
91
91
|
recordModelUsage: (params: {
|
|
92
92
|
eventId: string;
|
|
93
93
|
model: string;
|