@cuylabs/agent-a365-observability 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # @cuylabs/agent-a365-observability
2
+
3
+ Microsoft Agent 365 observability adapter for `@cuylabs/agent-core`.
4
+
5
+ This package keeps the Microsoft-specific parts outside `agent-core`:
6
+
7
+ - starts Microsoft Agent 365 Observability
8
+ - wires the Agent 365 exporter token resolver
9
+ - wraps each request in Agent 365 baggage so spans include tenant and agent identity
10
+ - returns a small tracing config fragment for stable agent metadata
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pnpm add @cuylabs/agent-a365-observability @microsoft/agents-a365-observability @microsoft/agents-a365-runtime
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```typescript
21
+ import { createAgent } from "@cuylabs/agent-core";
22
+ import {
23
+ createA365TracingConfig,
24
+ initA365Observability,
25
+ runWithA365Context,
26
+ runWithA365TurnContext,
27
+ } from "@cuylabs/agent-a365-observability";
28
+
29
+ const observability = await initA365Observability({
30
+ serviceName: "email-agent-service",
31
+ serviceVersion: "1.0.0",
32
+ configuration: {
33
+ exporterEnabled: true,
34
+ logLevel: "info|warn|error",
35
+ },
36
+ tokenResolver: async (agentId, tenantId) => {
37
+ return getObservabilityToken(agentId, tenantId);
38
+ },
39
+ });
40
+
41
+ const agent = createAgent({
42
+ name: "email-assistant",
43
+ model,
44
+ tracing: createA365TracingConfig({
45
+ agentId: "agent-456",
46
+ agentDescription: "Organizes email and calendar work",
47
+ agentVersion: "1.0.0",
48
+ }),
49
+ });
50
+
51
+ await runWithA365Context(
52
+ {
53
+ tenantId: "tenant-123",
54
+ agentId: "agent-456",
55
+ agentName: "email-assistant",
56
+ conversationId: "conversation-789",
57
+ sessionId: "session-789",
58
+ channelName: "msteams",
59
+ },
60
+ async () => {
61
+ for await (const event of agent.chat("session-789", "Find urgent email")) {
62
+ // stream events to your channel
63
+ }
64
+ },
65
+ );
66
+
67
+ await agent.close();
68
+ await observability.shutdown();
69
+ ```
70
+
71
+ ## M365 / Teams bot turns
72
+
73
+ When your bot uses `@microsoft/agents-hosting` `TurnContext`, use the
74
+ TurnContext helper so tenant, agent, conversation, channel, and user identity
75
+ are derived from the incoming activity:
76
+
77
+ ```typescript
78
+ await runWithA365TurnContext(
79
+ context, // TurnContext from CloudAdapter
80
+ {
81
+ agentId: "agent-456",
82
+ agentName: "email-assistant",
83
+ agentDescription: "Organizes email and calendar work",
84
+ agentVersion: "1.0.0",
85
+ sessionId,
86
+ },
87
+ async () => {
88
+ for await (const event of agent.chat(sessionId, context.activity.text)) {
89
+ // stream events to the channel
90
+ }
91
+ },
92
+ );
93
+ ```
94
+
95
+ If you use `@cuylabs/agent-channel-m365`, this wrapper is built into the channel
96
+ adapter:
97
+
98
+ ```typescript
99
+ const m365 = createM365ChannelAdapter({
100
+ agent,
101
+ a365Observability: {
102
+ agentId: "agent-456",
103
+ agentName: "email-assistant",
104
+ agentDescription: "Organizes email and calendar work",
105
+ agentVersion: "1.0.0",
106
+ },
107
+ });
108
+ ```
109
+
110
+ The host process still needs to call `initA365Observability(...)` once during
111
+ startup so the Microsoft exporter and token resolver are registered.
112
+
113
+ ## Shape
114
+
115
+ Use `agent-core` for portable OpenTelemetry spans:
116
+
117
+ - `invoke_agent` agent spans
118
+ - `execute_tool` tool spans
119
+ - AI SDK model spans nested under the agent turn
120
+
121
+ Use this package for Agent 365-specific context:
122
+
123
+ - `microsoft.tenant.id`
124
+ - `gen_ai.agent.id`
125
+ - `microsoft.session.id`
126
+ - `gen_ai.conversation.id`
127
+ - channel and caller attributes
128
+ - A2A caller-agent attributes such as `microsoft.a365.caller.agent.id`
129
+
130
+ For multi-tenant agents, prefer `runWithA365Context()` over static tracing attributes. Static attributes are useful for stable agent metadata; baggage is the right place for per-request tenant and conversation identity.
131
+
132
+ ## Phoenix vs Agent 365
133
+
134
+ Phoenix is a normal OTLP destination. You pass a span processor/exporter into `agent-core` tracing, and `agent-core` owns the tracer provider lifecycle for that example.
135
+
136
+ Agent 365 is different. The Microsoft SDK owns the exporter and adds an Agent 365 span processor that copies baggage into span attributes. `agent-core` still emits the agent, tool, and AI SDK spans, while this package starts the Microsoft exporter and wraps each request with the tenant, agent, conversation, channel, and caller baggage that Agent 365 expects.
137
+
138
+ ## AI SDK Telemetry
139
+
140
+ `agent-core` uses AI SDK v7 telemetry and enables `@ai-sdk/otel`'s `GenAIOpenTelemetry` integration by default. That gives you current GenAI-shaped model spans such as `invoke_agent`, `agent_step`, `chat`, and `execute_tool`, with attributes like `gen_ai.operation.name`, `gen_ai.provider.name`, model IDs, and token usage.
141
+
142
+ This package does not replace that model telemetry. It adds the Microsoft Agent 365 layer: exporter startup, token resolution, and baggage that flows `microsoft.tenant.id`, `gen_ai.agent.id`, conversation, channel, and caller identity onto the spans.
143
+
144
+ If you need to plug in another AI SDK telemetry integration, pass it through `createA365TracingConfig()`:
145
+
146
+ ```typescript
147
+ const agent = createAgent({
148
+ name: "email-assistant",
149
+ model,
150
+ tracing: createA365TracingConfig({
151
+ agentId: "agent-456",
152
+ telemetryIntegrations: [myIntegration],
153
+ }),
154
+ });
155
+ ```
156
+
157
+ Set `useGenAIOpenTelemetry: false` only when you intentionally want to use global AI SDK telemetry integrations or another model-span integration.
158
+
159
+ ## Exporter Modes
160
+
161
+ For batch export, provide `tokenResolver` in `initA365Observability()`.
162
+
163
+ For per-request export, pass `exportToken` to `runWithA365Context()` and enable per-request export in the Microsoft SDK configuration or environment.
@@ -0,0 +1,178 @@
1
+ import { TelemetryOptions } from 'ai';
2
+
3
+ type A365TokenResolver = (agentId: string, tenantId: string) => string | null | Promise<string | null>;
4
+ type A365Logger = {
5
+ info(message: string, ...args: unknown[]): void;
6
+ warn(message: string, ...args: unknown[]): void;
7
+ error(message: string, ...args: unknown[]): void;
8
+ event?(eventName: string, success: boolean, durationMs: number, message?: string, details?: Record<string, string>): void;
9
+ };
10
+ type SpanAttributeValue = string | number | boolean | string[] | number[] | boolean[];
11
+ type A365ObservabilityConfiguration = {
12
+ exporterEnabled?: boolean;
13
+ domainOverride?: string | null;
14
+ logLevel?: string;
15
+ authenticationScopes?: string[];
16
+ };
17
+ type InitA365ObservabilityOptions = {
18
+ serviceName: string;
19
+ serviceVersion?: string;
20
+ serviceNamespace?: string;
21
+ tokenResolver?: A365TokenResolver;
22
+ clusterCategory?: string;
23
+ exporterOptions?: Record<string, unknown>;
24
+ customLogger?: A365Logger;
25
+ configuration?: A365ObservabilityConfiguration;
26
+ };
27
+ type A365ObservabilityHandle = {
28
+ shutdown(): Promise<void>;
29
+ };
30
+ type A365RequestContext = {
31
+ tenantId?: string;
32
+ agentId?: string;
33
+ agentName?: string;
34
+ agentDescription?: string;
35
+ agentVersion?: string;
36
+ agentPlatformId?: string;
37
+ agentAuid?: string;
38
+ agentEmail?: string;
39
+ agentBlueprintId?: string;
40
+ sessionId?: string;
41
+ sessionDescription?: string;
42
+ conversationId?: string;
43
+ conversationItemLink?: string;
44
+ channelName?: string;
45
+ channelLink?: string;
46
+ userId?: string;
47
+ userName?: string;
48
+ userEmail?: string;
49
+ callerClientIp?: string;
50
+ callerAgentId?: string;
51
+ callerAgentName?: string;
52
+ callerAgentAuid?: string;
53
+ callerAgentEmail?: string;
54
+ callerAgentBlueprintId?: string;
55
+ callerAgentPlatformId?: string;
56
+ callerAgentVersion?: string;
57
+ serviceName?: string;
58
+ serverAddress?: string;
59
+ serverPort?: number;
60
+ /**
61
+ * Optional bearer token used by Microsoft's per-request exporter mode.
62
+ *
63
+ * Batch export usually uses `tokenResolver` from `initA365Observability`.
64
+ */
65
+ exportToken?: string;
66
+ extraBaggage?: Record<string, string | number | boolean | null | undefined>;
67
+ };
68
+ type A365ActivityAccountLike = {
69
+ id?: string;
70
+ name?: string;
71
+ aadObjectId?: string;
72
+ agenticAppId?: string;
73
+ tenantId?: string;
74
+ userPrincipalName?: string;
75
+ email?: string;
76
+ [key: string]: unknown;
77
+ };
78
+ type A365ActivityLike = {
79
+ id?: string;
80
+ serviceUrl?: string;
81
+ channelId?: string;
82
+ from?: A365ActivityAccountLike;
83
+ recipient?: A365ActivityAccountLike;
84
+ conversation?: {
85
+ id?: string;
86
+ name?: string;
87
+ tenantId?: string;
88
+ conversationType?: string;
89
+ [key: string]: unknown;
90
+ };
91
+ channelData?: unknown;
92
+ [key: string]: unknown;
93
+ };
94
+ type A365TurnContextLike = {
95
+ activity?: A365ActivityLike;
96
+ identity?: Record<string, unknown>;
97
+ [key: string]: unknown;
98
+ };
99
+ type A365TurnContextOptions = Omit<A365RequestContext, "extraBaggage"> & {
100
+ /**
101
+ * Optional override for the activity service URL used to infer server
102
+ * address and port when explicit server values are not provided.
103
+ */
104
+ serviceUrl?: string;
105
+ /**
106
+ * Use `activity.recipient.id` as `agentId` when `agentId` and
107
+ * `activity.recipient.agenticAppId` are both unavailable.
108
+ *
109
+ * Keep this disabled when the recipient ID is only a Bot Framework ID and not
110
+ * the Agent 365 app ID.
111
+ */
112
+ useRecipientIdAsAgentId?: boolean;
113
+ extraBaggage?: Record<string, string | number | boolean | null | undefined>;
114
+ };
115
+ type A365TracingConfigOptions = {
116
+ agentId?: string;
117
+ agentDescription?: string;
118
+ agentVersion?: string;
119
+ /**
120
+ * Include tenant as a static span attribute. Prefer `runWithA365Context`
121
+ * when tenant varies per request.
122
+ */
123
+ tenantId?: string;
124
+ useGenAIOpenTelemetry?: boolean;
125
+ telemetryIntegrations?: TelemetryOptions["integrations"];
126
+ useGlobalTelemetryIntegrations?: boolean;
127
+ spanAttributes?: Record<string, SpanAttributeValue>;
128
+ };
129
+ type A365TracingConfig = {
130
+ agentId?: string;
131
+ agentDescription?: string;
132
+ agentVersion?: string;
133
+ useGenAIOpenTelemetry?: boolean;
134
+ telemetryIntegrations?: TelemetryOptions["integrations"];
135
+ useGlobalTelemetryIntegrations?: boolean;
136
+ spanAttributes?: Record<string, SpanAttributeValue>;
137
+ };
138
+ declare const A365_BAGGAGE_KEYS: {
139
+ readonly tenantId: "microsoft.tenant.id";
140
+ readonly agentId: "gen_ai.agent.id";
141
+ readonly agentName: "gen_ai.agent.name";
142
+ readonly agentDescription: "gen_ai.agent.description";
143
+ readonly agentVersion: "gen_ai.agent.version";
144
+ readonly agentPlatformId: "microsoft.a365.agent.platform.id";
145
+ readonly agentAuid: "microsoft.agent.user.id";
146
+ readonly agentEmail: "microsoft.agent.user.email";
147
+ readonly agentBlueprintId: "microsoft.a365.agent.blueprint.id";
148
+ readonly sessionId: "microsoft.session.id";
149
+ readonly sessionDescription: "microsoft.session.description";
150
+ readonly conversationId: "gen_ai.conversation.id";
151
+ readonly conversationItemLink: "microsoft.conversation.item.link";
152
+ readonly channelName: "microsoft.channel.name";
153
+ readonly channelLink: "microsoft.channel.link";
154
+ readonly userId: "user.id";
155
+ readonly userName: "user.name";
156
+ readonly userEmail: "user.email";
157
+ readonly callerClientIp: "client.address";
158
+ readonly callerAgentId: "microsoft.a365.caller.agent.id";
159
+ readonly callerAgentName: "microsoft.a365.caller.agent.name";
160
+ readonly callerAgentAuid: "microsoft.a365.caller.agent.user.id";
161
+ readonly callerAgentEmail: "microsoft.a365.caller.agent.user.email";
162
+ readonly callerAgentBlueprintId: "microsoft.a365.caller.agent.blueprint.id";
163
+ readonly callerAgentPlatformId: "microsoft.a365.caller.agent.platform.id";
164
+ readonly callerAgentVersion: "microsoft.a365.caller.agent.version";
165
+ readonly serviceName: "service.name";
166
+ readonly serverAddress: "server.address";
167
+ readonly serverPort: "server.port";
168
+ };
169
+ declare function createA365TracingConfig(options?: A365TracingConfigOptions): A365TracingConfig;
170
+ declare function buildA365BaggagePairs(context: A365RequestContext): Record<string, string>;
171
+ declare function createA365ContextFromTurnContext(turnContext: A365TurnContextLike, options?: A365TurnContextOptions): A365RequestContext;
172
+ declare function runWithA365TurnContext<T>(turnContext: A365TurnContextLike, fn: () => T): Promise<Awaited<T>>;
173
+ declare function runWithA365TurnContext<T>(turnContext: A365TurnContextLike, options: A365TurnContextOptions, fn: () => T): Promise<Awaited<T>>;
174
+ declare function initA365Observability(options: InitA365ObservabilityOptions): Promise<A365ObservabilityHandle>;
175
+ declare function runWithA365Context<T>(requestContext: A365RequestContext, fn: () => T): Promise<Awaited<T>>;
176
+ declare function updateA365ExportToken(token: string): Promise<boolean>;
177
+
178
+ export { type A365ActivityAccountLike, type A365ActivityLike, type A365Logger, type A365ObservabilityConfiguration, type A365ObservabilityHandle, type A365RequestContext, type A365TokenResolver, type A365TracingConfig, type A365TracingConfigOptions, type A365TurnContextLike, type A365TurnContextOptions, A365_BAGGAGE_KEYS, type InitA365ObservabilityOptions, type SpanAttributeValue, buildA365BaggagePairs, createA365ContextFromTurnContext, createA365TracingConfig, initA365Observability, runWithA365Context, runWithA365TurnContext, updateA365ExportToken };
package/dist/index.js ADDED
@@ -0,0 +1,351 @@
1
+ // src/index.ts
2
+ var A365_BAGGAGE_KEYS = {
3
+ tenantId: "microsoft.tenant.id",
4
+ agentId: "gen_ai.agent.id",
5
+ agentName: "gen_ai.agent.name",
6
+ agentDescription: "gen_ai.agent.description",
7
+ agentVersion: "gen_ai.agent.version",
8
+ agentPlatformId: "microsoft.a365.agent.platform.id",
9
+ agentAuid: "microsoft.agent.user.id",
10
+ agentEmail: "microsoft.agent.user.email",
11
+ agentBlueprintId: "microsoft.a365.agent.blueprint.id",
12
+ sessionId: "microsoft.session.id",
13
+ sessionDescription: "microsoft.session.description",
14
+ conversationId: "gen_ai.conversation.id",
15
+ conversationItemLink: "microsoft.conversation.item.link",
16
+ channelName: "microsoft.channel.name",
17
+ channelLink: "microsoft.channel.link",
18
+ userId: "user.id",
19
+ userName: "user.name",
20
+ userEmail: "user.email",
21
+ callerClientIp: "client.address",
22
+ callerAgentId: "microsoft.a365.caller.agent.id",
23
+ callerAgentName: "microsoft.a365.caller.agent.name",
24
+ callerAgentAuid: "microsoft.a365.caller.agent.user.id",
25
+ callerAgentEmail: "microsoft.a365.caller.agent.user.email",
26
+ callerAgentBlueprintId: "microsoft.a365.caller.agent.blueprint.id",
27
+ callerAgentPlatformId: "microsoft.a365.caller.agent.platform.id",
28
+ callerAgentVersion: "microsoft.a365.caller.agent.version",
29
+ serviceName: "service.name",
30
+ serverAddress: "server.address",
31
+ serverPort: "server.port"
32
+ };
33
+ var OBSERVABILITY_PACKAGE = "@microsoft/agents-a365-observability";
34
+ function createA365TracingConfig(options = {}) {
35
+ const spanAttributes = {
36
+ ...options.spanAttributes ?? {}
37
+ };
38
+ if (isNonEmpty(options.tenantId)) {
39
+ spanAttributes[A365_BAGGAGE_KEYS.tenantId] = options.tenantId.trim();
40
+ }
41
+ return {
42
+ ...isNonEmpty(options.agentId) ? { agentId: options.agentId.trim() } : {},
43
+ ...isNonEmpty(options.agentDescription) ? { agentDescription: options.agentDescription.trim() } : {},
44
+ ...isNonEmpty(options.agentVersion) ? { agentVersion: options.agentVersion.trim() } : {},
45
+ ...options.useGenAIOpenTelemetry !== void 0 ? { useGenAIOpenTelemetry: options.useGenAIOpenTelemetry } : {},
46
+ ...options.telemetryIntegrations ? { telemetryIntegrations: options.telemetryIntegrations } : {},
47
+ ...options.useGlobalTelemetryIntegrations !== void 0 ? {
48
+ useGlobalTelemetryIntegrations: options.useGlobalTelemetryIntegrations
49
+ } : {},
50
+ ...Object.keys(spanAttributes).length > 0 ? { spanAttributes } : {}
51
+ };
52
+ }
53
+ function buildA365BaggagePairs(context) {
54
+ const pairs = {};
55
+ setPair(pairs, A365_BAGGAGE_KEYS.tenantId, context.tenantId);
56
+ setPair(pairs, A365_BAGGAGE_KEYS.agentId, context.agentId);
57
+ setPair(pairs, A365_BAGGAGE_KEYS.agentName, context.agentName);
58
+ setPair(pairs, A365_BAGGAGE_KEYS.agentDescription, context.agentDescription);
59
+ setPair(pairs, A365_BAGGAGE_KEYS.agentVersion, context.agentVersion);
60
+ setPair(pairs, A365_BAGGAGE_KEYS.agentPlatformId, context.agentPlatformId);
61
+ setPair(pairs, A365_BAGGAGE_KEYS.agentAuid, context.agentAuid);
62
+ setPair(pairs, A365_BAGGAGE_KEYS.agentEmail, context.agentEmail);
63
+ setPair(pairs, A365_BAGGAGE_KEYS.agentBlueprintId, context.agentBlueprintId);
64
+ setPair(pairs, A365_BAGGAGE_KEYS.sessionId, context.sessionId);
65
+ setPair(
66
+ pairs,
67
+ A365_BAGGAGE_KEYS.sessionDescription,
68
+ context.sessionDescription
69
+ );
70
+ setPair(pairs, A365_BAGGAGE_KEYS.conversationId, context.conversationId);
71
+ setPair(
72
+ pairs,
73
+ A365_BAGGAGE_KEYS.conversationItemLink,
74
+ context.conversationItemLink
75
+ );
76
+ setPair(pairs, A365_BAGGAGE_KEYS.channelName, context.channelName);
77
+ setPair(pairs, A365_BAGGAGE_KEYS.channelLink, context.channelLink);
78
+ setPair(pairs, A365_BAGGAGE_KEYS.userId, context.userId);
79
+ setPair(pairs, A365_BAGGAGE_KEYS.userName, context.userName);
80
+ setPair(pairs, A365_BAGGAGE_KEYS.userEmail, context.userEmail);
81
+ setPair(pairs, A365_BAGGAGE_KEYS.callerClientIp, context.callerClientIp);
82
+ setPair(pairs, A365_BAGGAGE_KEYS.callerAgentId, context.callerAgentId);
83
+ setPair(pairs, A365_BAGGAGE_KEYS.callerAgentName, context.callerAgentName);
84
+ setPair(pairs, A365_BAGGAGE_KEYS.callerAgentAuid, context.callerAgentAuid);
85
+ setPair(pairs, A365_BAGGAGE_KEYS.callerAgentEmail, context.callerAgentEmail);
86
+ setPair(
87
+ pairs,
88
+ A365_BAGGAGE_KEYS.callerAgentBlueprintId,
89
+ context.callerAgentBlueprintId
90
+ );
91
+ setPair(
92
+ pairs,
93
+ A365_BAGGAGE_KEYS.callerAgentPlatformId,
94
+ context.callerAgentPlatformId
95
+ );
96
+ setPair(
97
+ pairs,
98
+ A365_BAGGAGE_KEYS.callerAgentVersion,
99
+ context.callerAgentVersion
100
+ );
101
+ setPair(pairs, A365_BAGGAGE_KEYS.serviceName, context.serviceName);
102
+ setPair(pairs, A365_BAGGAGE_KEYS.serverAddress, context.serverAddress);
103
+ setPair(pairs, A365_BAGGAGE_KEYS.serverPort, context.serverPort);
104
+ for (const [key, value] of Object.entries(context.extraBaggage ?? {})) {
105
+ setPair(pairs, key, value);
106
+ }
107
+ return pairs;
108
+ }
109
+ function createA365ContextFromTurnContext(turnContext, options = {}) {
110
+ const { serviceUrl, useRecipientIdAsAgentId, ...requestOptions } = options;
111
+ const activity = turnContext.activity ?? {};
112
+ const channelData = activity.channelData;
113
+ const endpoint = parseServiceEndpoint(serviceUrl ?? activity.serviceUrl);
114
+ const agentId = firstNonEmpty(
115
+ requestOptions.agentId,
116
+ activity.recipient?.agenticAppId,
117
+ useRecipientIdAsAgentId ? activity.recipient?.id : void 0
118
+ );
119
+ const tenantId = firstNonEmpty(
120
+ requestOptions.tenantId,
121
+ activity.recipient?.tenantId,
122
+ activity.conversation?.tenantId,
123
+ readPath(channelData, ["tenant", "id"]),
124
+ readPath(channelData, ["tenantId"])
125
+ );
126
+ return {
127
+ ...requestOptions,
128
+ ...tenantId ? { tenantId } : {},
129
+ ...agentId ? { agentId } : {},
130
+ ...firstNonEmpty(requestOptions.agentName, activity.recipient?.name) ? {
131
+ agentName: firstNonEmpty(
132
+ requestOptions.agentName,
133
+ activity.recipient?.name
134
+ )
135
+ } : {},
136
+ ...firstNonEmpty(requestOptions.conversationId, activity.conversation?.id) ? {
137
+ conversationId: firstNonEmpty(
138
+ requestOptions.conversationId,
139
+ activity.conversation?.id
140
+ )
141
+ } : {},
142
+ ...firstNonEmpty(
143
+ requestOptions.sessionId,
144
+ requestOptions.conversationId,
145
+ activity.conversation?.id
146
+ ) ? {
147
+ sessionId: firstNonEmpty(
148
+ requestOptions.sessionId,
149
+ requestOptions.conversationId,
150
+ activity.conversation?.id
151
+ )
152
+ } : {},
153
+ ...firstNonEmpty(requestOptions.channelName, activity.channelId) ? {
154
+ channelName: firstNonEmpty(
155
+ requestOptions.channelName,
156
+ activity.channelId
157
+ )
158
+ } : {},
159
+ ...firstNonEmpty(
160
+ requestOptions.userId,
161
+ activity.from?.aadObjectId,
162
+ activity.from?.id,
163
+ readPath(turnContext.identity, ["oid"]),
164
+ readPath(turnContext.identity, ["sub"])
165
+ ) ? {
166
+ userId: firstNonEmpty(
167
+ requestOptions.userId,
168
+ activity.from?.aadObjectId,
169
+ activity.from?.id,
170
+ readPath(turnContext.identity, ["oid"]),
171
+ readPath(turnContext.identity, ["sub"])
172
+ )
173
+ } : {},
174
+ ...firstNonEmpty(requestOptions.userName, activity.from?.name) ? {
175
+ userName: firstNonEmpty(requestOptions.userName, activity.from?.name)
176
+ } : {},
177
+ ...firstNonEmpty(
178
+ requestOptions.userEmail,
179
+ activity.from?.email,
180
+ activity.from?.userPrincipalName,
181
+ readPath(channelData, ["from", "userPrincipalName"]),
182
+ readPath(turnContext.identity, ["preferred_username"]),
183
+ readPath(turnContext.identity, ["upn"])
184
+ ) ? {
185
+ userEmail: firstNonEmpty(
186
+ requestOptions.userEmail,
187
+ activity.from?.email,
188
+ activity.from?.userPrincipalName,
189
+ readPath(channelData, ["from", "userPrincipalName"]),
190
+ readPath(turnContext.identity, ["preferred_username"]),
191
+ readPath(turnContext.identity, ["upn"])
192
+ )
193
+ } : {},
194
+ ...requestOptions.serverAddress ? { serverAddress: requestOptions.serverAddress } : endpoint?.serverAddress ? { serverAddress: endpoint.serverAddress } : {},
195
+ ...requestOptions.serverPort !== void 0 ? { serverPort: requestOptions.serverPort } : endpoint?.serverPort !== void 0 ? { serverPort: endpoint.serverPort } : {}
196
+ };
197
+ }
198
+ async function runWithA365TurnContext(turnContext, optionsOrFn, maybeFn) {
199
+ const options = typeof optionsOrFn === "function" ? {} : optionsOrFn ?? {};
200
+ const fn = typeof optionsOrFn === "function" ? optionsOrFn : maybeFn;
201
+ if (!fn) {
202
+ throw new Error("runWithA365TurnContext requires a callback.");
203
+ }
204
+ return await runWithA365Context(
205
+ createA365ContextFromTurnContext(turnContext, options),
206
+ fn
207
+ );
208
+ }
209
+ async function initA365Observability(options) {
210
+ const module = await loadObservabilityModule();
211
+ const configProvider = createConfigurationProvider(
212
+ module,
213
+ options.configuration
214
+ );
215
+ const builder = module.ObservabilityManager.configure((builder2) => {
216
+ builder2.withService(options.serviceName, options.serviceVersion);
217
+ if (options.serviceNamespace) {
218
+ builder2.withServiceNamespace?.(options.serviceNamespace);
219
+ }
220
+ if (options.tokenResolver) {
221
+ builder2.withTokenResolver?.(options.tokenResolver);
222
+ }
223
+ if (options.clusterCategory) {
224
+ builder2.withClusterCategory?.(options.clusterCategory);
225
+ }
226
+ if (options.exporterOptions) {
227
+ builder2.withExporterOptions?.(options.exporterOptions);
228
+ }
229
+ if (options.customLogger) {
230
+ builder2.withCustomLogger?.(options.customLogger);
231
+ }
232
+ if (configProvider) {
233
+ builder2.withConfigurationProvider?.(configProvider);
234
+ }
235
+ });
236
+ builder.start();
237
+ return {
238
+ shutdown: () => module.ObservabilityManager.shutdown()
239
+ };
240
+ }
241
+ async function runWithA365Context(requestContext, fn) {
242
+ const module = await loadObservabilityModule();
243
+ const runWithBaggage = () => {
244
+ const scope = new module.BaggageBuilder().setPairs(buildA365BaggagePairs(requestContext)).build();
245
+ return scope.run(fn);
246
+ };
247
+ const result = requestContext.exportToken && module.runWithExportToken ? module.runWithExportToken(requestContext.exportToken, runWithBaggage) : runWithBaggage();
248
+ return await result;
249
+ }
250
+ async function updateA365ExportToken(token) {
251
+ const module = await loadObservabilityModule();
252
+ return module.updateExportToken?.(token) ?? false;
253
+ }
254
+ async function loadObservabilityModule() {
255
+ try {
256
+ return await import(OBSERVABILITY_PACKAGE);
257
+ } catch (error) {
258
+ throw new Error(
259
+ `Unable to load ${OBSERVABILITY_PACKAGE}. Install @microsoft/agents-a365-observability and @microsoft/agents-a365-runtime before using @cuylabs/agent-a365-observability.`,
260
+ { cause: error }
261
+ );
262
+ }
263
+ }
264
+ function createConfigurationProvider(module, configuration) {
265
+ if (!configuration) {
266
+ return void 0;
267
+ }
268
+ if (!module.ObservabilityConfiguration) {
269
+ return void 0;
270
+ }
271
+ const overrides = {};
272
+ if (configuration.exporterEnabled !== void 0) {
273
+ overrides.isObservabilityExporterEnabled = () => configuration.exporterEnabled;
274
+ }
275
+ if (configuration.domainOverride !== void 0) {
276
+ overrides.observabilityDomainOverride = () => configuration.domainOverride ?? null;
277
+ }
278
+ if (configuration.logLevel !== void 0) {
279
+ overrides.observabilityLogLevel = () => configuration.logLevel;
280
+ }
281
+ if (configuration.authenticationScopes !== void 0) {
282
+ overrides.observabilityAuthenticationScopes = () => configuration.authenticationScopes ?? [];
283
+ }
284
+ return {
285
+ getConfiguration: () => new module.ObservabilityConfiguration(overrides)
286
+ };
287
+ }
288
+ function setPair(target, key, value) {
289
+ if (value === null || value === void 0) {
290
+ return;
291
+ }
292
+ const stringValue = String(value).trim();
293
+ if (!stringValue) {
294
+ return;
295
+ }
296
+ target[key] = stringValue;
297
+ }
298
+ function isNonEmpty(value) {
299
+ return typeof value === "string" && value.trim().length > 0;
300
+ }
301
+ function firstNonEmpty(...values) {
302
+ for (const value of values) {
303
+ if (value === null || value === void 0) {
304
+ continue;
305
+ }
306
+ const stringValue = String(value).trim();
307
+ if (stringValue) {
308
+ return stringValue;
309
+ }
310
+ }
311
+ return void 0;
312
+ }
313
+ function readPath(value, path) {
314
+ let current = value;
315
+ for (const segment of path) {
316
+ if (!isRecord(current)) {
317
+ return void 0;
318
+ }
319
+ current = current[segment];
320
+ }
321
+ return firstNonEmpty(
322
+ typeof current === "string" || typeof current === "number" || typeof current === "boolean" ? current : void 0
323
+ );
324
+ }
325
+ function parseServiceEndpoint(serviceUrl) {
326
+ if (!isNonEmpty(serviceUrl)) {
327
+ return void 0;
328
+ }
329
+ try {
330
+ const url = new URL(serviceUrl);
331
+ return {
332
+ serverAddress: url.hostname,
333
+ ...url.port ? { serverPort: Number(url.port) } : {}
334
+ };
335
+ } catch {
336
+ return void 0;
337
+ }
338
+ }
339
+ function isRecord(value) {
340
+ return typeof value === "object" && value !== null;
341
+ }
342
+ export {
343
+ A365_BAGGAGE_KEYS,
344
+ buildA365BaggagePairs,
345
+ createA365ContextFromTurnContext,
346
+ createA365TracingConfig,
347
+ initA365Observability,
348
+ runWithA365Context,
349
+ runWithA365TurnContext,
350
+ updateA365ExportToken
351
+ };
@@ -0,0 +1,115 @@
1
+ /**
2
+ * 01 — Microsoft Agent 365 Observability
3
+ *
4
+ * Similar goal to agent-core's Phoenix/Zipkin examples, but A365 owns the
5
+ * OpenTelemetry exporter setup and requires per-request tenant/agent identity
6
+ * through baggage.
7
+ *
8
+ * Simplified span hierarchy:
9
+ *
10
+ * invoke_agent calculator-bot (agent-core turn span)
11
+ * ├── invoke_agent gpt-4o-mini (AI SDK v7 / @ai-sdk/otel)
12
+ * │ └── chat gpt-4o-mini (model request)
13
+ * ├── execute_tool calculator (agent-core tool span)
14
+ * └── invoke_agent gpt-4o-mini (AI SDK final model span)
15
+ *
16
+ * Required env:
17
+ * ENABLE_A365_OBSERVABILITY_EXPORTER=true
18
+ * A365_AGENT_ID=...
19
+ * A365_TENANT_ID=...
20
+ * A365_OBSERVABILITY_TOKEN=... # demo token resolver only
21
+ *
22
+ * Run:
23
+ * npx tsx examples/01-a365-observability.ts
24
+ */
25
+
26
+ import {
27
+ createA365TracingConfig,
28
+ initA365Observability,
29
+ runWithA365Context,
30
+ } from "@cuylabs/agent-a365-observability";
31
+ import { createAgent, Tool } from "@cuylabs/agent-core";
32
+ import { openai } from "@ai-sdk/openai";
33
+ import { z } from "zod";
34
+
35
+ const agentId = requiredEnv("A365_AGENT_ID");
36
+ const tenantId = requiredEnv("A365_TENANT_ID");
37
+
38
+ const observability = await initA365Observability({
39
+ serviceName: "agent-a365-observability-example",
40
+ serviceVersion: "1.0.0",
41
+ configuration: {
42
+ exporterEnabled: process.env.ENABLE_A365_OBSERVABILITY_EXPORTER === "true",
43
+ logLevel: process.env.A365_OBSERVABILITY_LOG_LEVEL ?? "info|warn|error",
44
+ },
45
+ tokenResolver: async () => requiredEnv("A365_OBSERVABILITY_TOKEN"),
46
+ });
47
+
48
+ const calculator = Tool.define("calculator", {
49
+ description: "Evaluate a math expression",
50
+ parameters: z.object({
51
+ expression: z.string().describe("Expression like '2 + 3 * 4'"),
52
+ }),
53
+ execute: async ({ expression }) => ({
54
+ title: "Calculator",
55
+ output: String(eval(expression)), // demo only
56
+ }),
57
+ });
58
+
59
+ const agent = createAgent({
60
+ name: "calculator-bot",
61
+ model: openai("gpt-4o-mini"),
62
+ tools: [calculator],
63
+ systemPrompt:
64
+ "You have a calculator tool. Use it to answer math questions. Be concise.",
65
+ tracing: createA365TracingConfig({
66
+ agentId,
67
+ agentDescription: "Calculator example for Microsoft Agent 365 Observability",
68
+ agentVersion: "1.0.0",
69
+ }),
70
+ });
71
+
72
+ try {
73
+ await runWithA365Context(
74
+ {
75
+ tenantId,
76
+ agentId,
77
+ agentName: "calculator-bot",
78
+ agentDescription:
79
+ "Calculator example for Microsoft Agent 365 Observability",
80
+ agentVersion: "1.0.0",
81
+ sessionId: "demo",
82
+ conversationId: "demo",
83
+ channelName: "local",
84
+ },
85
+ async () => {
86
+ for await (const event of agent.chat(
87
+ "demo",
88
+ "What is 123 * 456 + 789?",
89
+ )) {
90
+ if (event.type === "text-delta") {
91
+ process.stdout.write(event.text);
92
+ }
93
+ if (event.type === "tool-start") {
94
+ console.log(`\n${event.toolName}(${JSON.stringify(event.input)})`);
95
+ }
96
+ if (event.type === "tool-result") {
97
+ console.log(` ${event.result}`);
98
+ }
99
+ }
100
+ },
101
+ );
102
+
103
+ console.log("\nSpans emitted with Agent 365 baggage.");
104
+ } finally {
105
+ await agent.close();
106
+ await observability.shutdown();
107
+ }
108
+
109
+ function requiredEnv(name: string): string {
110
+ const value = process.env[name];
111
+ if (!value) {
112
+ throw new Error(`${name} is required`);
113
+ }
114
+ return value;
115
+ }
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@cuylabs/agent-a365-observability",
3
+ "version": "1.0.0",
4
+ "description": "Microsoft Agent 365 observability adapter for @cuylabs/agent-core",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "examples",
18
+ "README.md"
19
+ ],
20
+ "devDependencies": {
21
+ "@ai-sdk/openai": "4.0.0-beta.38",
22
+ "@types/node": "^22.0.0",
23
+ "ai": "7.0.0-beta.111",
24
+ "tsup": "^8.0.0",
25
+ "typescript": "^5.7.0",
26
+ "vitest": "^4.0.18",
27
+ "zod": "^3.25.76 || ^4.1.8",
28
+ "@cuylabs/agent-core": "^1.0.0"
29
+ },
30
+ "peerDependencies": {
31
+ "@cuylabs/agent-core": "^1.0.0",
32
+ "ai": "7.0.0-beta.111",
33
+ "@microsoft/agents-a365-observability": ">=0.2.0-preview.5 <1.0.0",
34
+ "@microsoft/agents-a365-runtime": ">=0.2.0-preview.5 <1.0.0"
35
+ },
36
+ "peerDependenciesMeta": {
37
+ "@microsoft/agents-a365-observability": {
38
+ "optional": true
39
+ },
40
+ "@microsoft/agents-a365-runtime": {
41
+ "optional": true
42
+ }
43
+ },
44
+ "keywords": [
45
+ "agent",
46
+ "microsoft",
47
+ "agent365",
48
+ "a365",
49
+ "opentelemetry",
50
+ "observability"
51
+ ],
52
+ "author": "cuylabs",
53
+ "license": "Apache-2.0",
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "https://github.com/cuylabs-ai/agents-ts.git",
57
+ "directory": "packages/agent-a365-observability"
58
+ },
59
+ "engines": {
60
+ "node": ">=20"
61
+ },
62
+ "publishConfig": {
63
+ "access": "public"
64
+ },
65
+ "scripts": {
66
+ "build": "tsup src/index.ts --format esm --dts --clean",
67
+ "dev": "tsup src/index.ts --format esm --dts --watch",
68
+ "typecheck": "tsc --noEmit",
69
+ "test": "vitest run",
70
+ "test:watch": "vitest",
71
+ "clean": "rm -rf dist"
72
+ }
73
+ }