agentv 2.6.0 → 2.7.1-next.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.
Files changed (85) hide show
  1. package/README.md +128 -33
  2. package/dist/chunk-3L2L5GIL.js +51 -0
  3. package/dist/{chunk-BKMQNEUD.js.map → chunk-3L2L5GIL.js.map} +1 -1
  4. package/dist/{chunk-BKMQNEUD.js → chunk-5H446C7X.js} +2 -45
  5. package/dist/chunk-6MPKU3K7.js +5476 -0
  6. package/dist/chunk-6MPKU3K7.js.map +1 -0
  7. package/dist/{chunk-LJVS3JAK.js → chunk-BL4PVUAT.js} +6 -4
  8. package/dist/{chunk-LJVS3JAK.js.map → chunk-BL4PVUAT.js.map} +1 -1
  9. package/dist/{chunk-MGK6HHRR.js → chunk-BWLYFF5N.js} +9813 -11237
  10. package/dist/chunk-BWLYFF5N.js.map +1 -0
  11. package/dist/chunk-C5GOHBQM.js +84 -0
  12. package/dist/chunk-C5GOHBQM.js.map +1 -0
  13. package/dist/chunk-FV32QHPB.js +565 -0
  14. package/dist/chunk-FV32QHPB.js.map +1 -0
  15. package/dist/chunk-H5FFZCKI.js +2957 -0
  16. package/dist/chunk-H5FFZCKI.js.map +1 -0
  17. package/dist/chunk-JK6V4KVD.js +114 -0
  18. package/dist/chunk-JK6V4KVD.js.map +1 -0
  19. package/dist/chunk-LRULMAAA.js +1711 -0
  20. package/dist/chunk-LRULMAAA.js.map +1 -0
  21. package/dist/chunk-SR4I5KET.js +1238 -0
  22. package/dist/chunk-SR4I5KET.js.map +1 -0
  23. package/dist/chunk-VQ2ZO7XJ.js +2098 -0
  24. package/dist/chunk-VQ2ZO7XJ.js.map +1 -0
  25. package/dist/chunk-XALGXSKB.js +21 -0
  26. package/dist/chunk-XALGXSKB.js.map +1 -0
  27. package/dist/cli.js +8 -2
  28. package/dist/cli.js.map +1 -1
  29. package/dist/dist-R3OCWGXH.js +257 -0
  30. package/dist/dist-R3OCWGXH.js.map +1 -0
  31. package/dist/esm-5Q4BZALM-5REQWAUV.js +924 -0
  32. package/dist/esm-5Q4BZALM-5REQWAUV.js.map +1 -0
  33. package/dist/esm-DX3WQKEN.js +32 -0
  34. package/dist/esm-DX3WQKEN.js.map +1 -0
  35. package/dist/esm-QNEMCJPL.js +933 -0
  36. package/dist/esm-QNEMCJPL.js.map +1 -0
  37. package/dist/esm-R77SNOF5.js +65 -0
  38. package/dist/esm-R77SNOF5.js.map +1 -0
  39. package/dist/esm-RVQPUGWH.js +1207 -0
  40. package/dist/esm-RVQPUGWH.js.map +1 -0
  41. package/dist/getMachineId-bsd-HSK5LZMG.js +41 -0
  42. package/dist/getMachineId-bsd-HSK5LZMG.js.map +1 -0
  43. package/dist/getMachineId-darwin-4DP6CCJV.js +41 -0
  44. package/dist/getMachineId-darwin-4DP6CCJV.js.map +1 -0
  45. package/dist/getMachineId-linux-44LJ5UJB.js +33 -0
  46. package/dist/getMachineId-linux-44LJ5UJB.js.map +1 -0
  47. package/dist/getMachineId-unsupported-NVK6IATM.js +24 -0
  48. package/dist/getMachineId-unsupported-NVK6IATM.js.map +1 -0
  49. package/dist/getMachineId-win-YZ36S7VA.js +43 -0
  50. package/dist/getMachineId-win-YZ36S7VA.js.map +1 -0
  51. package/dist/index.js +10 -2
  52. package/dist/interactive-33TCZXLF.js +333 -0
  53. package/dist/interactive-33TCZXLF.js.map +1 -0
  54. package/dist/otlp-json-file-exporter-77FDBRSY-EZAPHWP6.js +9 -0
  55. package/dist/otlp-json-file-exporter-77FDBRSY-EZAPHWP6.js.map +1 -0
  56. package/dist/simple-trace-file-exporter-S76DMABU-5FCJESD2.js +9 -0
  57. package/dist/simple-trace-file-exporter-S76DMABU-5FCJESD2.js.map +1 -0
  58. package/dist/src-2N5EJ2N6.js +1733 -0
  59. package/dist/src-2N5EJ2N6.js.map +1 -0
  60. package/dist/templates/.agents/skills/agentv-chat-to-eval/README.md +84 -0
  61. package/dist/templates/.agents/skills/agentv-chat-to-eval/SKILL.md +144 -0
  62. package/dist/templates/.agents/skills/agentv-chat-to-eval/examples/transcript-json.md +67 -0
  63. package/dist/templates/.agents/skills/agentv-chat-to-eval/examples/transcript-markdown.md +101 -0
  64. package/dist/templates/.agents/skills/agentv-eval-builder/SKILL.md +433 -0
  65. package/dist/templates/.agents/skills/agentv-eval-builder/references/config-schema.json +36 -0
  66. package/dist/templates/.agents/skills/agentv-eval-builder/references/custom-evaluators.md +118 -0
  67. package/dist/templates/.agents/skills/agentv-eval-builder/references/eval-schema.json +251 -0
  68. package/dist/templates/.agents/skills/agentv-eval-builder/references/rubric-evaluator.md +77 -0
  69. package/dist/templates/.agents/skills/agentv-eval-orchestrator/SKILL.md +50 -0
  70. package/dist/templates/.agents/skills/agentv-prompt-optimizer/SKILL.md +78 -0
  71. package/dist/templates/.agentv/.env.example +23 -23
  72. package/dist/templates/.agentv/config.yaml +15 -15
  73. package/dist/templates/.claude/skills/agentv-eval-builder/SKILL.md +38 -13
  74. package/dist/templates/.claude/skills/agentv-eval-builder/references/custom-evaluators.md +9 -6
  75. package/dist/templates/.claude/skills/agentv-eval-builder/references/eval-schema.json +4 -4
  76. package/dist/templates/.claude/skills/agentv-eval-builder/references/rubric-evaluator.md +7 -9
  77. package/dist/templates/.github/prompts/agentv-eval-build.prompt.md +4 -4
  78. package/dist/templates/.github/prompts/agentv-optimize.prompt.md +3 -3
  79. package/dist/{token-D3IYDJQZ.js → token-POXF46NU.js} +6 -4
  80. package/dist/{token-D3IYDJQZ.js.map → token-POXF46NU.js.map} +1 -1
  81. package/dist/{token-util-FWFPR2BV.js → token-util-6GWYZWGE.js} +4 -3
  82. package/dist/token-util-6GWYZWGE.js.map +1 -0
  83. package/package.json +7 -3
  84. package/dist/chunk-MGK6HHRR.js.map +0 -1
  85. /package/dist/{token-util-FWFPR2BV.js.map → chunk-5H446C7X.js.map} +0 -0
@@ -0,0 +1,84 @@
1
+ import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
2
+
3
+ // ../../packages/core/dist/chunk-HFSYZHGF.js
4
+ import { mkdir } from "node:fs/promises";
5
+ import { dirname } from "node:path";
6
+ var OtlpJsonFileExporter = class {
7
+ // biome-ignore lint/suspicious/noExplicitAny: serialized span data
8
+ spans = [];
9
+ filePath;
10
+ constructor(filePath) {
11
+ this.filePath = filePath;
12
+ }
13
+ export(spans, resultCallback) {
14
+ for (const span of spans) {
15
+ this.spans.push({
16
+ traceId: span.spanContext().traceId,
17
+ spanId: span.spanContext().spanId,
18
+ parentSpanId: span.parentSpanId || void 0,
19
+ name: span.name,
20
+ kind: span.kind,
21
+ startTimeUnixNano: hrTimeToNanos(span.startTime),
22
+ endTimeUnixNano: hrTimeToNanos(span.endTime),
23
+ attributes: convertAttributes(span.attributes),
24
+ status: span.status,
25
+ events: span.events?.map(
26
+ (e) => ({
27
+ name: e.name,
28
+ timeUnixNano: hrTimeToNanos(e.time),
29
+ attributes: convertAttributes(e.attributes)
30
+ })
31
+ )
32
+ });
33
+ }
34
+ resultCallback({ code: 0 });
35
+ }
36
+ async shutdown() {
37
+ await this.flush();
38
+ }
39
+ async forceFlush() {
40
+ await this.flush();
41
+ }
42
+ async flush() {
43
+ if (this.spans.length === 0) return;
44
+ await mkdir(dirname(this.filePath), { recursive: true });
45
+ const otlpJson = {
46
+ resourceSpans: [
47
+ {
48
+ resource: { attributes: [] },
49
+ scopeSpans: [
50
+ {
51
+ scope: { name: "agentv", version: "1.0.0" },
52
+ spans: this.spans
53
+ }
54
+ ]
55
+ }
56
+ ]
57
+ };
58
+ const { writeFile } = await import("node:fs/promises");
59
+ await writeFile(this.filePath, JSON.stringify(otlpJson, null, 2));
60
+ }
61
+ };
62
+ function hrTimeToNanos(hrTime) {
63
+ return String(hrTime[0] * 1e9 + hrTime[1]);
64
+ }
65
+ function convertAttributes(attrs) {
66
+ return Object.entries(attrs || {}).map(([key, value]) => ({
67
+ key,
68
+ value: serializeAttributeValue(value)
69
+ }));
70
+ }
71
+ function serializeAttributeValue(value) {
72
+ if (typeof value === "string") return { stringValue: value };
73
+ if (typeof value === "number") {
74
+ return Number.isInteger(value) ? { intValue: value } : { doubleValue: value };
75
+ }
76
+ if (typeof value === "boolean") return { boolValue: value };
77
+ if (Array.isArray(value)) return { arrayValue: { values: value.map(serializeAttributeValue) } };
78
+ return { stringValue: String(value) };
79
+ }
80
+
81
+ export {
82
+ OtlpJsonFileExporter
83
+ };
84
+ //# sourceMappingURL=chunk-C5GOHBQM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/core/src/observability/otlp-json-file-exporter.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { dirname } from 'node:path';\n\n// biome-ignore lint/suspicious/noExplicitAny: OTel ReadableSpan loaded dynamically\ntype ReadableSpan = any;\n\n/**\n * SpanExporter that writes OTLP JSON (the standard OTel wire format) to a file.\n * The file can be imported by any OTel-compatible backend.\n */\nexport class OtlpJsonFileExporter {\n // biome-ignore lint/suspicious/noExplicitAny: serialized span data\n private spans: any[] = [];\n private filePath: string;\n\n constructor(filePath: string) {\n this.filePath = filePath;\n }\n\n export(spans: ReadableSpan[], resultCallback: (result: { code: number }) => void): void {\n for (const span of spans) {\n this.spans.push({\n traceId: span.spanContext().traceId,\n spanId: span.spanContext().spanId,\n parentSpanId: span.parentSpanId || undefined,\n name: span.name,\n kind: span.kind,\n startTimeUnixNano: hrTimeToNanos(span.startTime),\n endTimeUnixNano: hrTimeToNanos(span.endTime),\n attributes: convertAttributes(span.attributes),\n status: span.status,\n events: span.events?.map(\n (e: { name: string; time: [number, number]; attributes?: Record<string, unknown> }) => ({\n name: e.name,\n timeUnixNano: hrTimeToNanos(e.time),\n attributes: convertAttributes(e.attributes),\n }),\n ),\n });\n }\n resultCallback({ code: 0 }); // SUCCESS\n }\n\n async shutdown(): Promise<void> {\n await this.flush();\n }\n\n async forceFlush(): Promise<void> {\n await this.flush();\n }\n\n private async flush(): Promise<void> {\n if (this.spans.length === 0) return;\n\n await mkdir(dirname(this.filePath), { recursive: true });\n\n const otlpJson = {\n resourceSpans: [\n {\n resource: { attributes: [] },\n scopeSpans: [\n {\n scope: { name: 'agentv', version: '1.0.0' },\n spans: this.spans,\n },\n ],\n },\n ],\n };\n\n const { writeFile } = await import('node:fs/promises');\n await writeFile(this.filePath, JSON.stringify(otlpJson, null, 2));\n }\n}\n\nfunction hrTimeToNanos(hrTime: [number, number]): string {\n return String(hrTime[0] * 1_000_000_000 + hrTime[1]);\n}\n\nfunction convertAttributes(\n attrs: Record<string, unknown> | undefined,\n): Array<{ key: string; value: unknown }> {\n return Object.entries(attrs || {}).map(([key, value]) => ({\n key,\n value: serializeAttributeValue(value),\n }));\n}\n\nfunction serializeAttributeValue(value: unknown): unknown {\n if (typeof value === 'string') return { stringValue: value };\n if (typeof value === 'number') {\n return Number.isInteger(value) ? { intValue: value } : { doubleValue: value };\n }\n if (typeof value === 'boolean') return { boolValue: value };\n if (Array.isArray(value)) return { arrayValue: { values: value.map(serializeAttributeValue) } };\n return { stringValue: String(value) };\n}\n"],"mappings":";;;AAAA,SAAS,aAAa;AACtB,SAAS,eAAe;AASjB,IAAM,uBAAN,MAA2B;;EAExB,QAAe,CAAC;EAChB;EAER,YAAY,UAAkB;AAC5B,SAAK,WAAW;EAClB;EAEA,OAAO,OAAuB,gBAA0D;AACtF,eAAW,QAAQ,OAAO;AACxB,WAAK,MAAM,KAAK;QACd,SAAS,KAAK,YAAY,EAAE;QAC5B,QAAQ,KAAK,YAAY,EAAE;QAC3B,cAAc,KAAK,gBAAgB;QACnC,MAAM,KAAK;QACX,MAAM,KAAK;QACX,mBAAmB,cAAc,KAAK,SAAS;QAC/C,iBAAiB,cAAc,KAAK,OAAO;QAC3C,YAAY,kBAAkB,KAAK,UAAU;QAC7C,QAAQ,KAAK;QACb,QAAQ,KAAK,QAAQ;UACnB,CAAC,OAAuF;YACtF,MAAM,EAAE;YACR,cAAc,cAAc,EAAE,IAAI;YAClC,YAAY,kBAAkB,EAAE,UAAU;UAC5C;QACF;MACF,CAAC;IACH;AACA,mBAAe,EAAE,MAAM,EAAE,CAAC;EAC5B;EAEA,MAAM,WAA0B;AAC9B,UAAM,KAAK,MAAM;EACnB;EAEA,MAAM,aAA4B;AAChC,UAAM,KAAK,MAAM;EACnB;EAEA,MAAc,QAAuB;AACnC,QAAI,KAAK,MAAM,WAAW,EAAG;AAE7B,UAAM,MAAM,QAAQ,KAAK,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;AAEvD,UAAM,WAAW;MACf,eAAe;QACb;UACE,UAAU,EAAE,YAAY,CAAC,EAAE;UAC3B,YAAY;YACV;cACE,OAAO,EAAE,MAAM,UAAU,SAAS,QAAQ;cAC1C,OAAO,KAAK;YACd;UACF;QACF;MACF;IACF;AAEA,UAAM,EAAE,UAAU,IAAI,MAAM,OAAO,kBAAkB;AACrD,UAAM,UAAU,KAAK,UAAU,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;EAClE;AACF;AAEA,SAAS,cAAc,QAAkC;AACvD,SAAO,OAAO,OAAO,CAAC,IAAI,MAAgB,OAAO,CAAC,CAAC;AACrD;AAEA,SAAS,kBACP,OACwC;AACxC,SAAO,OAAO,QAAQ,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,OAAO;IACxD;IACA,OAAO,wBAAwB,KAAK;EACtC,EAAE;AACJ;AAEA,SAAS,wBAAwB,OAAyB;AACxD,MAAI,OAAO,UAAU,SAAU,QAAO,EAAE,aAAa,MAAM;AAC3D,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,OAAO,UAAU,KAAK,IAAI,EAAE,UAAU,MAAM,IAAI,EAAE,aAAa,MAAM;EAC9E;AACA,MAAI,OAAO,UAAU,UAAW,QAAO,EAAE,WAAW,MAAM;AAC1D,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,EAAE,YAAY,EAAE,QAAQ,MAAM,IAAI,uBAAuB,EAAE,EAAE;AAC9F,SAAO,EAAE,aAAa,OAAO,KAAK,EAAE;AACtC;","names":[]}
@@ -0,0 +1,565 @@
1
+ import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ SDK_INFO,
4
+ getStringFromEnv,
5
+ init_esm as init_esm3
6
+ } from "./chunk-SR4I5KET.js";
7
+ import {
8
+ ATTR_SERVICE_NAME,
9
+ ATTR_TELEMETRY_SDK_LANGUAGE,
10
+ ATTR_TELEMETRY_SDK_NAME,
11
+ ATTR_TELEMETRY_SDK_VERSION,
12
+ init_esm as init_esm2
13
+ } from "./chunk-VQ2ZO7XJ.js";
14
+ import {
15
+ diag,
16
+ init_esm
17
+ } from "./chunk-LRULMAAA.js";
18
+ import {
19
+ __esm
20
+ } from "./chunk-5H446C7X.js";
21
+
22
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/default-service-name.js
23
+ function defaultServiceName() {
24
+ if (serviceName === void 0) {
25
+ try {
26
+ const argv0 = globalThis.process.argv0;
27
+ serviceName = argv0 ? `unknown_service:${argv0}` : "unknown_service";
28
+ } catch {
29
+ serviceName = "unknown_service";
30
+ }
31
+ }
32
+ return serviceName;
33
+ }
34
+ var serviceName;
35
+ var init_default_service_name = __esm({
36
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/default-service-name.js"() {
37
+ "use strict";
38
+ }
39
+ });
40
+
41
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/utils.js
42
+ var isPromiseLike;
43
+ var init_utils = __esm({
44
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/utils.js"() {
45
+ "use strict";
46
+ isPromiseLike = (val) => {
47
+ return val !== null && typeof val === "object" && typeof val.then === "function";
48
+ };
49
+ }
50
+ });
51
+
52
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js
53
+ function resourceFromAttributes(attributes, options) {
54
+ return ResourceImpl.FromAttributeList(Object.entries(attributes), options);
55
+ }
56
+ function resourceFromDetectedResource(detectedResource, options) {
57
+ return new ResourceImpl(detectedResource, options);
58
+ }
59
+ function emptyResource() {
60
+ return resourceFromAttributes({});
61
+ }
62
+ function defaultResource() {
63
+ return resourceFromAttributes({
64
+ [ATTR_SERVICE_NAME]: defaultServiceName(),
65
+ [ATTR_TELEMETRY_SDK_LANGUAGE]: SDK_INFO[ATTR_TELEMETRY_SDK_LANGUAGE],
66
+ [ATTR_TELEMETRY_SDK_NAME]: SDK_INFO[ATTR_TELEMETRY_SDK_NAME],
67
+ [ATTR_TELEMETRY_SDK_VERSION]: SDK_INFO[ATTR_TELEMETRY_SDK_VERSION]
68
+ });
69
+ }
70
+ function guardedRawAttributes(attributes) {
71
+ return attributes.map(([k, v]) => {
72
+ if (isPromiseLike(v)) {
73
+ return [
74
+ k,
75
+ v.catch((err) => {
76
+ diag.debug("promise rejection for resource attribute: %s - %s", k, err);
77
+ return void 0;
78
+ })
79
+ ];
80
+ }
81
+ return [k, v];
82
+ });
83
+ }
84
+ function validateSchemaUrl(schemaUrl) {
85
+ if (typeof schemaUrl === "string" || schemaUrl === void 0) {
86
+ return schemaUrl;
87
+ }
88
+ diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.", schemaUrl);
89
+ return void 0;
90
+ }
91
+ function mergeSchemaUrl(old, updating) {
92
+ const oldSchemaUrl = old?.schemaUrl;
93
+ const updatingSchemaUrl = updating?.schemaUrl;
94
+ const isOldEmpty = oldSchemaUrl === void 0 || oldSchemaUrl === "";
95
+ const isUpdatingEmpty = updatingSchemaUrl === void 0 || updatingSchemaUrl === "";
96
+ if (isOldEmpty) {
97
+ return updatingSchemaUrl;
98
+ }
99
+ if (isUpdatingEmpty) {
100
+ return oldSchemaUrl;
101
+ }
102
+ if (oldSchemaUrl === updatingSchemaUrl) {
103
+ return oldSchemaUrl;
104
+ }
105
+ diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.', oldSchemaUrl, updatingSchemaUrl);
106
+ return void 0;
107
+ }
108
+ var ResourceImpl;
109
+ var init_ResourceImpl = __esm({
110
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js"() {
111
+ "use strict";
112
+ init_esm();
113
+ init_esm3();
114
+ init_esm2();
115
+ init_default_service_name();
116
+ init_utils();
117
+ ResourceImpl = class _ResourceImpl {
118
+ _rawAttributes;
119
+ _asyncAttributesPending = false;
120
+ _schemaUrl;
121
+ _memoizedAttributes;
122
+ static FromAttributeList(attributes, options) {
123
+ const res = new _ResourceImpl({}, options);
124
+ res._rawAttributes = guardedRawAttributes(attributes);
125
+ res._asyncAttributesPending = attributes.filter(([_, val]) => isPromiseLike(val)).length > 0;
126
+ return res;
127
+ }
128
+ constructor(resource, options) {
129
+ const attributes = resource.attributes ?? {};
130
+ this._rawAttributes = Object.entries(attributes).map(([k, v]) => {
131
+ if (isPromiseLike(v)) {
132
+ this._asyncAttributesPending = true;
133
+ }
134
+ return [k, v];
135
+ });
136
+ this._rawAttributes = guardedRawAttributes(this._rawAttributes);
137
+ this._schemaUrl = validateSchemaUrl(options?.schemaUrl);
138
+ }
139
+ get asyncAttributesPending() {
140
+ return this._asyncAttributesPending;
141
+ }
142
+ async waitForAsyncAttributes() {
143
+ if (!this.asyncAttributesPending) {
144
+ return;
145
+ }
146
+ for (let i = 0; i < this._rawAttributes.length; i++) {
147
+ const [k, v] = this._rawAttributes[i];
148
+ this._rawAttributes[i] = [k, isPromiseLike(v) ? await v : v];
149
+ }
150
+ this._asyncAttributesPending = false;
151
+ }
152
+ get attributes() {
153
+ if (this.asyncAttributesPending) {
154
+ diag.error("Accessing resource attributes before async attributes settled");
155
+ }
156
+ if (this._memoizedAttributes) {
157
+ return this._memoizedAttributes;
158
+ }
159
+ const attrs = {};
160
+ for (const [k, v] of this._rawAttributes) {
161
+ if (isPromiseLike(v)) {
162
+ diag.debug(`Unsettled resource attribute ${k} skipped`);
163
+ continue;
164
+ }
165
+ if (v != null) {
166
+ attrs[k] ??= v;
167
+ }
168
+ }
169
+ if (!this._asyncAttributesPending) {
170
+ this._memoizedAttributes = attrs;
171
+ }
172
+ return attrs;
173
+ }
174
+ getRawAttributes() {
175
+ return this._rawAttributes;
176
+ }
177
+ get schemaUrl() {
178
+ return this._schemaUrl;
179
+ }
180
+ merge(resource) {
181
+ if (resource == null)
182
+ return this;
183
+ const mergedSchemaUrl = mergeSchemaUrl(this, resource);
184
+ const mergedOptions = mergedSchemaUrl ? { schemaUrl: mergedSchemaUrl } : void 0;
185
+ return _ResourceImpl.FromAttributeList([...resource.getRawAttributes(), ...this.getRawAttributes()], mergedOptions);
186
+ }
187
+ };
188
+ }
189
+ });
190
+
191
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detect-resources.js
192
+ var detectResources;
193
+ var init_detect_resources = __esm({
194
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detect-resources.js"() {
195
+ "use strict";
196
+ init_esm();
197
+ init_ResourceImpl();
198
+ detectResources = (config = {}) => {
199
+ const resources = (config.detectors || []).map((d) => {
200
+ try {
201
+ const resource = resourceFromDetectedResource(d.detect(config));
202
+ diag.debug(`${d.constructor.name} found resource.`, resource);
203
+ return resource;
204
+ } catch (e) {
205
+ diag.debug(`${d.constructor.name} failed: ${e.message}`);
206
+ return emptyResource();
207
+ }
208
+ });
209
+ return resources.reduce((acc, resource) => acc.merge(resource), emptyResource());
210
+ };
211
+ }
212
+ });
213
+
214
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/EnvDetector.js
215
+ var EnvDetector, envDetector;
216
+ var init_EnvDetector = __esm({
217
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/EnvDetector.js"() {
218
+ "use strict";
219
+ init_esm();
220
+ init_esm2();
221
+ init_esm3();
222
+ EnvDetector = class {
223
+ // Type, attribute keys, and attribute values should not exceed 256 characters.
224
+ _MAX_LENGTH = 255;
225
+ // OTEL_RESOURCE_ATTRIBUTES is a comma-separated list of attributes.
226
+ _COMMA_SEPARATOR = ",";
227
+ // OTEL_RESOURCE_ATTRIBUTES contains key value pair separated by '='.
228
+ _LABEL_KEY_VALUE_SPLITTER = "=";
229
+ _ERROR_MESSAGE_INVALID_CHARS = "should be a ASCII string with a length greater than 0 and not exceed " + this._MAX_LENGTH + " characters.";
230
+ _ERROR_MESSAGE_INVALID_VALUE = "should be a ASCII string with a length not exceed " + this._MAX_LENGTH + " characters.";
231
+ /**
232
+ * Returns a {@link Resource} populated with attributes from the
233
+ * OTEL_RESOURCE_ATTRIBUTES environment variable. Note this is an async
234
+ * function to conform to the Detector interface.
235
+ *
236
+ * @param config The resource detection config
237
+ */
238
+ detect(_config) {
239
+ const attributes = {};
240
+ const rawAttributes = getStringFromEnv("OTEL_RESOURCE_ATTRIBUTES");
241
+ const serviceName2 = getStringFromEnv("OTEL_SERVICE_NAME");
242
+ if (rawAttributes) {
243
+ try {
244
+ const parsedAttributes = this._parseResourceAttributes(rawAttributes);
245
+ Object.assign(attributes, parsedAttributes);
246
+ } catch (e) {
247
+ diag.debug(`EnvDetector failed: ${e.message}`);
248
+ }
249
+ }
250
+ if (serviceName2) {
251
+ attributes[ATTR_SERVICE_NAME] = serviceName2;
252
+ }
253
+ return { attributes };
254
+ }
255
+ /**
256
+ * Creates an attribute map from the OTEL_RESOURCE_ATTRIBUTES environment
257
+ * variable.
258
+ *
259
+ * OTEL_RESOURCE_ATTRIBUTES: A comma-separated list of attributes describing
260
+ * the source in more detail, e.g. “key1=val1,key2=val2”. Domain names and
261
+ * paths are accepted as attribute keys. Values may be quoted or unquoted in
262
+ * general. If a value contains whitespace, =, or " characters, it must
263
+ * always be quoted.
264
+ *
265
+ * @param rawEnvAttributes The resource attributes as a comma-separated list
266
+ * of key/value pairs.
267
+ * @returns The sanitized resource attributes.
268
+ */
269
+ _parseResourceAttributes(rawEnvAttributes) {
270
+ if (!rawEnvAttributes)
271
+ return {};
272
+ const attributes = {};
273
+ const rawAttributes = rawEnvAttributes.split(this._COMMA_SEPARATOR, -1);
274
+ for (const rawAttribute of rawAttributes) {
275
+ const keyValuePair = rawAttribute.split(this._LABEL_KEY_VALUE_SPLITTER, -1);
276
+ if (keyValuePair.length !== 2) {
277
+ continue;
278
+ }
279
+ let [key, value] = keyValuePair;
280
+ key = key.trim();
281
+ value = value.trim().split(/^"|"$/).join("");
282
+ if (!this._isValidAndNotEmpty(key)) {
283
+ throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);
284
+ }
285
+ if (!this._isValid(value)) {
286
+ throw new Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);
287
+ }
288
+ attributes[key] = decodeURIComponent(value);
289
+ }
290
+ return attributes;
291
+ }
292
+ /**
293
+ * Determines whether the given String is a valid printable ASCII string with
294
+ * a length not exceed _MAX_LENGTH characters.
295
+ *
296
+ * @param str The String to be validated.
297
+ * @returns Whether the String is valid.
298
+ */
299
+ _isValid(name) {
300
+ return name.length <= this._MAX_LENGTH && this._isBaggageOctetString(name);
301
+ }
302
+ // https://www.w3.org/TR/baggage/#definition
303
+ _isBaggageOctetString(str) {
304
+ for (let i = 0; i < str.length; i++) {
305
+ const ch = str.charCodeAt(i);
306
+ if (ch < 33 || ch === 44 || ch === 59 || ch === 92 || ch > 126) {
307
+ return false;
308
+ }
309
+ }
310
+ return true;
311
+ }
312
+ /**
313
+ * Determines whether the given String is a valid printable ASCII string with
314
+ * a length greater than 0 and not exceed _MAX_LENGTH characters.
315
+ *
316
+ * @param str The String to be validated.
317
+ * @returns Whether the String is valid and not empty.
318
+ */
319
+ _isValidAndNotEmpty(str) {
320
+ return str.length > 0 && this._isValid(str);
321
+ }
322
+ };
323
+ envDetector = new EnvDetector();
324
+ }
325
+ });
326
+
327
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/semconv.js
328
+ var ATTR_HOST_ARCH, ATTR_HOST_ID, ATTR_HOST_NAME, ATTR_OS_TYPE, ATTR_OS_VERSION, ATTR_PROCESS_COMMAND, ATTR_PROCESS_COMMAND_ARGS, ATTR_PROCESS_EXECUTABLE_NAME, ATTR_PROCESS_EXECUTABLE_PATH, ATTR_PROCESS_OWNER, ATTR_PROCESS_PID, ATTR_PROCESS_RUNTIME_DESCRIPTION, ATTR_PROCESS_RUNTIME_NAME, ATTR_PROCESS_RUNTIME_VERSION, ATTR_SERVICE_INSTANCE_ID;
329
+ var init_semconv = __esm({
330
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/semconv.js"() {
331
+ "use strict";
332
+ ATTR_HOST_ARCH = "host.arch";
333
+ ATTR_HOST_ID = "host.id";
334
+ ATTR_HOST_NAME = "host.name";
335
+ ATTR_OS_TYPE = "os.type";
336
+ ATTR_OS_VERSION = "os.version";
337
+ ATTR_PROCESS_COMMAND = "process.command";
338
+ ATTR_PROCESS_COMMAND_ARGS = "process.command_args";
339
+ ATTR_PROCESS_EXECUTABLE_NAME = "process.executable.name";
340
+ ATTR_PROCESS_EXECUTABLE_PATH = "process.executable.path";
341
+ ATTR_PROCESS_OWNER = "process.owner";
342
+ ATTR_PROCESS_PID = "process.pid";
343
+ ATTR_PROCESS_RUNTIME_DESCRIPTION = "process.runtime.description";
344
+ ATTR_PROCESS_RUNTIME_NAME = "process.runtime.name";
345
+ ATTR_PROCESS_RUNTIME_VERSION = "process.runtime.version";
346
+ ATTR_SERVICE_INSTANCE_ID = "service.instance.id";
347
+ }
348
+ });
349
+
350
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/getMachineId.js
351
+ import * as process2 from "process";
352
+ async function getMachineId() {
353
+ if (!getMachineIdImpl) {
354
+ switch (process2.platform) {
355
+ case "darwin":
356
+ getMachineIdImpl = (await import("./getMachineId-darwin-4DP6CCJV.js")).getMachineId;
357
+ break;
358
+ case "linux":
359
+ getMachineIdImpl = (await import("./getMachineId-linux-44LJ5UJB.js")).getMachineId;
360
+ break;
361
+ case "freebsd":
362
+ getMachineIdImpl = (await import("./getMachineId-bsd-HSK5LZMG.js")).getMachineId;
363
+ break;
364
+ case "win32":
365
+ getMachineIdImpl = (await import("./getMachineId-win-YZ36S7VA.js")).getMachineId;
366
+ break;
367
+ default:
368
+ getMachineIdImpl = (await import("./getMachineId-unsupported-NVK6IATM.js")).getMachineId;
369
+ break;
370
+ }
371
+ }
372
+ return getMachineIdImpl();
373
+ }
374
+ var getMachineIdImpl;
375
+ var init_getMachineId = __esm({
376
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/machine-id/getMachineId.js"() {
377
+ "use strict";
378
+ }
379
+ });
380
+
381
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/utils.js
382
+ var normalizeArch, normalizeType;
383
+ var init_utils2 = __esm({
384
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/utils.js"() {
385
+ "use strict";
386
+ normalizeArch = (nodeArchString) => {
387
+ switch (nodeArchString) {
388
+ case "arm":
389
+ return "arm32";
390
+ case "ppc":
391
+ return "ppc32";
392
+ case "x64":
393
+ return "amd64";
394
+ default:
395
+ return nodeArchString;
396
+ }
397
+ };
398
+ normalizeType = (nodePlatform) => {
399
+ switch (nodePlatform) {
400
+ case "sunos":
401
+ return "solaris";
402
+ case "win32":
403
+ return "windows";
404
+ default:
405
+ return nodePlatform;
406
+ }
407
+ };
408
+ }
409
+ });
410
+
411
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/HostDetector.js
412
+ import { arch, hostname } from "os";
413
+ var HostDetector, hostDetector;
414
+ var init_HostDetector = __esm({
415
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/HostDetector.js"() {
416
+ "use strict";
417
+ init_semconv();
418
+ init_getMachineId();
419
+ init_utils2();
420
+ HostDetector = class {
421
+ detect(_config) {
422
+ const attributes = {
423
+ [ATTR_HOST_NAME]: hostname(),
424
+ [ATTR_HOST_ARCH]: normalizeArch(arch()),
425
+ [ATTR_HOST_ID]: getMachineId()
426
+ };
427
+ return { attributes };
428
+ }
429
+ };
430
+ hostDetector = new HostDetector();
431
+ }
432
+ });
433
+
434
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/OSDetector.js
435
+ import { platform as platform2, release } from "os";
436
+ var OSDetector, osDetector;
437
+ var init_OSDetector = __esm({
438
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/OSDetector.js"() {
439
+ "use strict";
440
+ init_semconv();
441
+ init_utils2();
442
+ OSDetector = class {
443
+ detect(_config) {
444
+ const attributes = {
445
+ [ATTR_OS_TYPE]: normalizeType(platform2()),
446
+ [ATTR_OS_VERSION]: release()
447
+ };
448
+ return { attributes };
449
+ }
450
+ };
451
+ osDetector = new OSDetector();
452
+ }
453
+ });
454
+
455
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/ProcessDetector.js
456
+ import * as os from "os";
457
+ var ProcessDetector, processDetector;
458
+ var init_ProcessDetector = __esm({
459
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/ProcessDetector.js"() {
460
+ "use strict";
461
+ init_esm();
462
+ init_semconv();
463
+ ProcessDetector = class {
464
+ detect(_config) {
465
+ const attributes = {
466
+ [ATTR_PROCESS_PID]: process.pid,
467
+ [ATTR_PROCESS_EXECUTABLE_NAME]: process.title,
468
+ [ATTR_PROCESS_EXECUTABLE_PATH]: process.execPath,
469
+ [ATTR_PROCESS_COMMAND_ARGS]: [
470
+ process.argv[0],
471
+ ...process.execArgv,
472
+ ...process.argv.slice(1)
473
+ ],
474
+ [ATTR_PROCESS_RUNTIME_VERSION]: process.versions.node,
475
+ [ATTR_PROCESS_RUNTIME_NAME]: "nodejs",
476
+ [ATTR_PROCESS_RUNTIME_DESCRIPTION]: "Node.js"
477
+ };
478
+ if (process.argv.length > 1) {
479
+ attributes[ATTR_PROCESS_COMMAND] = process.argv[1];
480
+ }
481
+ try {
482
+ const userInfo2 = os.userInfo();
483
+ attributes[ATTR_PROCESS_OWNER] = userInfo2.username;
484
+ } catch (e) {
485
+ diag.debug(`error obtaining process owner: ${e}`);
486
+ }
487
+ return { attributes };
488
+ }
489
+ };
490
+ processDetector = new ProcessDetector();
491
+ }
492
+ });
493
+
494
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/ServiceInstanceIdDetector.js
495
+ import { randomUUID } from "crypto";
496
+ var ServiceInstanceIdDetector, serviceInstanceIdDetector;
497
+ var init_ServiceInstanceIdDetector = __esm({
498
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/ServiceInstanceIdDetector.js"() {
499
+ "use strict";
500
+ init_semconv();
501
+ ServiceInstanceIdDetector = class {
502
+ detect(_config) {
503
+ return {
504
+ attributes: {
505
+ [ATTR_SERVICE_INSTANCE_ID]: randomUUID()
506
+ }
507
+ };
508
+ }
509
+ };
510
+ serviceInstanceIdDetector = new ServiceInstanceIdDetector();
511
+ }
512
+ });
513
+
514
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/index.js
515
+ var init_node = __esm({
516
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/node/index.js"() {
517
+ "use strict";
518
+ init_HostDetector();
519
+ init_OSDetector();
520
+ init_ProcessDetector();
521
+ init_ServiceInstanceIdDetector();
522
+ }
523
+ });
524
+
525
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/index.js
526
+ var init_platform = __esm({
527
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/platform/index.js"() {
528
+ "use strict";
529
+ init_node();
530
+ }
531
+ });
532
+
533
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/index.js
534
+ var init_detectors = __esm({
535
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/detectors/index.js"() {
536
+ "use strict";
537
+ init_EnvDetector();
538
+ init_platform();
539
+ }
540
+ });
541
+
542
+ // ../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/index.js
543
+ var init_esm4 = __esm({
544
+ "../../node_modules/.bun/@opentelemetry+resources@2.5.1+460773ef8ff1e07c/node_modules/@opentelemetry/resources/build/esm/index.js"() {
545
+ init_detect_resources();
546
+ init_detectors();
547
+ init_ResourceImpl();
548
+ init_default_service_name();
549
+ }
550
+ });
551
+
552
+ export {
553
+ defaultServiceName,
554
+ resourceFromAttributes,
555
+ emptyResource,
556
+ defaultResource,
557
+ detectResources,
558
+ envDetector,
559
+ hostDetector,
560
+ osDetector,
561
+ processDetector,
562
+ serviceInstanceIdDetector,
563
+ init_esm4 as init_esm
564
+ };
565
+ //# sourceMappingURL=chunk-FV32QHPB.js.map