@latitude-data/telemetry 1.0.1 → 1.0.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/dist/index.cjs CHANGED
@@ -141,14 +141,16 @@ const env = { GATEWAY_BASE_URL: GET_GATEWAY_BASE_URL() };
141
141
  var SegmentSource;
142
142
  (function (SegmentSource) {
143
143
  SegmentSource["API"] = "api";
144
- SegmentSource["Playground"] = "playground";
145
- SegmentSource["Evaluation"] = "evaluation";
146
- SegmentSource["Experiment"] = "experiment";
147
- SegmentSource["User"] = "user";
148
- SegmentSource["SharedPrompt"] = "shared_prompt";
149
144
  SegmentSource["AgentAsTool"] = "agent_as_tool";
145
+ SegmentSource["Copilot"] = "copilot";
150
146
  SegmentSource["EmailTrigger"] = "email_trigger";
147
+ SegmentSource["Evaluation"] = "evaluation";
148
+ SegmentSource["Experiment"] = "experiment";
149
+ SegmentSource["Playground"] = "playground";
151
150
  SegmentSource["ScheduledTrigger"] = "scheduled_trigger";
151
+ SegmentSource["IntegrationTrigger"] = "integration_trigger";
152
+ SegmentSource["SharedPrompt"] = "shared_prompt";
153
+ SegmentSource["User"] = "user";
152
154
  })(SegmentSource || (SegmentSource = {}));
153
155
  var SegmentType;
154
156
  (function (SegmentType) {
@@ -248,7 +250,7 @@ const SPAN_SPECIFICATIONS = {
248
250
  name: 'Segment',
249
251
  description: 'A (partial) segment of a trace',
250
252
  isGenAI: false,
251
- isHidden: true,
253
+ isHidden: false,
252
254
  },
253
255
  [SpanType.Unknown]: {
254
256
  name: 'Unknown',
@@ -431,16 +433,6 @@ zod.z.object({
431
433
  isError: zod.z.boolean().optional(),
432
434
  text: zod.z.string().optional(),
433
435
  });
434
- var FinishReason;
435
- (function (FinishReason) {
436
- FinishReason["Stop"] = "stop";
437
- FinishReason["Length"] = "length";
438
- FinishReason["ContentFilter"] = "content-filter";
439
- FinishReason["ToolCalls"] = "tool-calls";
440
- FinishReason["Error"] = "error";
441
- FinishReason["Other"] = "other";
442
- FinishReason["Unknown"] = "unknown";
443
- })(FinishReason || (FinishReason = {}));
444
436
 
445
437
  var ParameterType;
446
438
  (function (ParameterType) {
@@ -778,17 +770,18 @@ var LegacyChainEventTypes;
778
770
 
779
771
  var ChainEventTypes;
780
772
  (function (ChainEventTypes) {
773
+ ChainEventTypes["ChainCompleted"] = "chain-completed";
774
+ ChainEventTypes["ChainError"] = "chain-error";
781
775
  ChainEventTypes["ChainStarted"] = "chain-started";
782
- ChainEventTypes["StepStarted"] = "step-started";
783
- ChainEventTypes["ProviderStarted"] = "provider-started";
776
+ ChainEventTypes["IntegrationWakingUp"] = "integration-waking-up";
784
777
  ChainEventTypes["ProviderCompleted"] = "provider-completed";
785
- ChainEventTypes["ToolsStarted"] = "tools-started";
786
- ChainEventTypes["ToolCompleted"] = "tool-completed";
778
+ ChainEventTypes["ProviderStarted"] = "provider-started";
787
779
  ChainEventTypes["StepCompleted"] = "step-completed";
788
- ChainEventTypes["ChainCompleted"] = "chain-completed";
789
- ChainEventTypes["ChainError"] = "chain-error";
780
+ ChainEventTypes["StepStarted"] = "step-started";
781
+ ChainEventTypes["ToolCompleted"] = "tool-completed";
790
782
  ChainEventTypes["ToolsRequested"] = "tools-requested";
791
- ChainEventTypes["IntegrationWakingUp"] = "integration-waking-up";
783
+ ChainEventTypes["ToolResult"] = "tool-result";
784
+ ChainEventTypes["ToolsStarted"] = "tools-started";
792
785
  })(ChainEventTypes || (ChainEventTypes = {}));
793
786
 
794
787
  var IntegrationType;
@@ -901,6 +894,14 @@ var EvaluationResultableType;
901
894
  EvaluationResultableType["Number"] = "evaluation_resultable_numbers";
902
895
  })(EvaluationResultableType || (EvaluationResultableType = {}));
903
896
 
897
+ var MessageRole;
898
+ (function (MessageRole) {
899
+ MessageRole["system"] = "system";
900
+ MessageRole["user"] = "user";
901
+ MessageRole["assistant"] = "assistant";
902
+ MessageRole["tool"] = "tool";
903
+ })(MessageRole || (MessageRole = {}));
904
+
904
905
  var ModifiedDocumentType;
905
906
  (function (ModifiedDocumentType) {
906
907
  ModifiedDocumentType["Created"] = "created";
@@ -936,6 +937,7 @@ var DocumentTriggerType;
936
937
  (function (DocumentTriggerType) {
937
938
  DocumentTriggerType["Email"] = "email";
938
939
  DocumentTriggerType["Scheduled"] = "scheduled";
940
+ DocumentTriggerType["Integration"] = "integration";
939
941
  })(DocumentTriggerType || (DocumentTriggerType = {}));
940
942
  var DocumentTriggerParameters;
941
943
  (function (DocumentTriggerParameters) {
@@ -1607,11 +1609,11 @@ class LatitudeInstrumentation {
1607
1609
  }
1608
1610
  async wrapToolHandler(fn, ...args) {
1609
1611
  const toolArguments = args[0];
1610
- const { toolId, toolName } = args[1];
1612
+ const { id, name } = args[1];
1611
1613
  const $tool = this.telemetry.tool(otel.context.active(), {
1612
- name: toolName,
1614
+ name,
1613
1615
  call: {
1614
- id: toolId,
1616
+ id,
1615
1617
  arguments: toolArguments,
1616
1618
  },
1617
1619
  });
@@ -1659,25 +1661,6 @@ class LatitudeInstrumentation {
1659
1661
  $prompt.end();
1660
1662
  return result;
1661
1663
  }
1662
- async wrapRenderAgent(fn, ...args) {
1663
- const { prompt, parameters } = args[0];
1664
- const $prompt = this.telemetry.prompt(otel.context.active(), {
1665
- versionUuid: prompt.versionUuid,
1666
- promptUuid: prompt.uuid,
1667
- template: prompt.content,
1668
- parameters: parameters,
1669
- });
1670
- let result;
1671
- try {
1672
- result = await otel.context.with($prompt.context, async () => await fn(...args));
1673
- }
1674
- catch (error) {
1675
- $prompt.fail(error);
1676
- throw error;
1677
- }
1678
- $prompt.end();
1679
- return result;
1680
- }
1681
1664
  async wrapRenderStep(fn, ...args) {
1682
1665
  const $step = this.telemetry.step(otel.context.active());
1683
1666
  let result;