@lunora/agent 1.0.0-alpha.3 → 1.0.0-alpha.5
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/channels.d.mts +39 -31
- package/dist/channels.d.ts +39 -31
- package/dist/channels.mjs +1 -1
- package/dist/component.d.mts +57 -68
- package/dist/component.d.ts +57 -68
- package/dist/component.mjs +20 -9
- package/dist/inbound.d.mts +20 -20
- package/dist/inbound.d.ts +20 -20
- package/dist/index.d.mts +474 -490
- package/dist/index.d.ts +474 -490
- package/dist/index.mjs +4 -4
- package/dist/naming.d.mts +19 -19
- package/dist/naming.d.ts +19 -19
- package/dist/packem_shared/{agentAsTool-Dt8NlU6k.mjs → agentAsTool-CUHlWsmt.mjs} +5 -1
- package/dist/packem_shared/{compileAgentWorkflow-BxJjHgtD.mjs → compileAgentWorkflow-DX90058f.mjs} +1 -1
- package/dist/packem_shared/{defineAgent-D6maSbVc.mjs → defineAgent-DAwAZC9P.mjs} +1 -1
- package/dist/packem_shared/{graph-component-aoUwO-f0.mjs → graph-component-Bbaxxymp.mjs} +3 -2
- package/dist/packem_shared/{normalizeEntityName-CyEEWFkR.mjs → normalizeEntityName-BouctxLC.mjs} +1 -1
- package/dist/packem_shared/{runAgentLoop-Dhg4ZNvw.mjs → runAgentLoop-B3Q2o-Uz.mjs} +1 -1
- package/dist/packem_shared/types.d-boAM2Yi1.d.mts +1114 -0
- package/dist/packem_shared/types.d-boAM2Yi1.d.ts +1114 -0
- package/dist/sandbox.d.mts +126 -122
- package/dist/sandbox.d.ts +126 -122
- package/dist/sandbox.mjs +5 -1
- package/dist/telemetry/index.d.mts +103 -103
- package/dist/telemetry/index.d.ts +103 -103
- package/package.json +8 -8
- package/dist/packem_shared/types.d-BhJFTvz_.d.mts +0 -1114
- package/dist/packem_shared/types.d-BhJFTvz_.d.ts +0 -1114
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { Telemetry } from 'ai';
|
|
2
2
|
/**
|
|
3
|
-
* Privacy options shared by every telemetry integration in this package.
|
|
4
|
-
*
|
|
5
|
-
* Both flags default to **FALSE**. Without an explicit opt-in, no prompt,
|
|
6
|
-
* message, tool input, generated model text, or tool output is ever forwarded
|
|
7
|
-
* to a downstream tracer — only structural metadata (model id, finish reason,
|
|
8
|
-
* token counts, tool name, timing, success/failure) is recorded. This is the
|
|
9
|
-
* privacy-safe default: turn recording on deliberately, per integration.
|
|
10
|
-
* @experimental
|
|
11
|
-
*/
|
|
3
|
+
* Privacy options shared by every telemetry integration in this package.
|
|
4
|
+
*
|
|
5
|
+
* Both flags default to **FALSE**. Without an explicit opt-in, no prompt,
|
|
6
|
+
* message, tool input, generated model text, or tool output is ever forwarded
|
|
7
|
+
* to a downstream tracer — only structural metadata (model id, finish reason,
|
|
8
|
+
* token counts, tool name, timing, success/failure) is recorded. This is the
|
|
9
|
+
* privacy-safe default: turn recording on deliberately, per integration.
|
|
10
|
+
* @experimental
|
|
11
|
+
*/
|
|
12
12
|
interface CommonOptions {
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
* When `true`, record model/tool **input** — prompts, messages, and tool
|
|
15
|
+
* call arguments. Default `false`.
|
|
16
|
+
*/
|
|
17
17
|
recordInputs?: boolean;
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
* When `true`, record model/tool **output** — generated text and tool
|
|
20
|
+
* results. Default `false`.
|
|
21
|
+
*/
|
|
22
22
|
recordOutputs?: boolean;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* The span handle a {@link BraintrustLike.traced} callback receives.
|
|
26
|
-
* @experimental
|
|
27
|
-
*/
|
|
25
|
+
* The span handle a {@link BraintrustLike.traced} callback receives.
|
|
26
|
+
* @experimental
|
|
27
|
+
*/
|
|
28
28
|
interface BraintrustSpan {
|
|
29
29
|
/** Attach structured fields to the current span. */
|
|
30
30
|
log: (event: Record<string, unknown>) => void;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* The minimal, **structural** slice of the `braintrust` SDK this bridge needs.
|
|
34
|
-
* `braintrust` is intentionally **not** a dependency — the app passes its own
|
|
35
|
-
* initialized logger, so this package stays dependency-free and works with any
|
|
36
|
-
* compatible Braintrust SDK version.
|
|
37
|
-
* @experimental
|
|
38
|
-
*/
|
|
33
|
+
* The minimal, **structural** slice of the `braintrust` SDK this bridge needs.
|
|
34
|
+
* `braintrust` is intentionally **not** a dependency — the app passes its own
|
|
35
|
+
* initialized logger, so this package stays dependency-free and works with any
|
|
36
|
+
* compatible Braintrust SDK version.
|
|
37
|
+
* @experimental
|
|
38
|
+
*/
|
|
39
39
|
interface BraintrustLike {
|
|
40
40
|
/** Run `callback` inside a new traced span and return its result. */
|
|
41
41
|
traced: <T>(callback: (span: BraintrustSpan) => T, args?: {
|
|
@@ -44,92 +44,92 @@ interface BraintrustLike {
|
|
|
44
44
|
}) => T;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* Options for {@link braintrustTelemetry}.
|
|
48
|
-
* @experimental
|
|
49
|
-
*/
|
|
47
|
+
* Options for {@link braintrustTelemetry}.
|
|
48
|
+
* @experimental
|
|
49
|
+
*/
|
|
50
50
|
interface BraintrustTelemetryOptions extends CommonOptions {
|
|
51
51
|
/** Span-name prefix for the language-model call (e.g. the agent name). */
|
|
52
52
|
functionId?: string;
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
* The caller's initialized Braintrust logger (dependency-injected). Import
|
|
55
|
+
* and initialize `braintrust` in your app and pass it as `logger`.
|
|
56
|
+
*/
|
|
57
57
|
logger: BraintrustLike;
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* A dependency-injected Braintrust bridge for the ai@7 telemetry surface.
|
|
61
|
-
*
|
|
62
|
-
* It wraps model calls (`type: "llm"`) and tool executions (`type: "tool"`) in
|
|
63
|
-
* `logger.traced` spans and logs structural metadata. Prompts / tool arguments
|
|
64
|
-
* are logged only when `recordInputs` is set; generated text / tool results
|
|
65
|
-
* only when `recordOutputs` is set. `onError` opens a span and logs the error.
|
|
66
|
-
*
|
|
67
|
-
* The app owns Braintrust initialization; pass the logger in as `logger`.
|
|
68
|
-
* @experimental
|
|
69
|
-
*/
|
|
60
|
+
* A dependency-injected Braintrust bridge for the ai@7 telemetry surface.
|
|
61
|
+
*
|
|
62
|
+
* It wraps model calls (`type: "llm"`) and tool executions (`type: "tool"`) in
|
|
63
|
+
* `logger.traced` spans and logs structural metadata. Prompts / tool arguments
|
|
64
|
+
* are logged only when `recordInputs` is set; generated text / tool results
|
|
65
|
+
* only when `recordOutputs` is set. `onError` opens a span and logs the error.
|
|
66
|
+
*
|
|
67
|
+
* The app owns Braintrust initialization; pass the logger in as `logger`.
|
|
68
|
+
* @experimental
|
|
69
|
+
*/
|
|
70
70
|
declare const braintrustTelemetry: (options: BraintrustTelemetryOptions) => Telemetry;
|
|
71
71
|
/**
|
|
72
|
-
* Combine several {@link Telemetry} integrations into a single one that fans
|
|
73
|
-
* every lifecycle callback out to all of them and nests the two execution
|
|
74
|
-
* wrappers so multiple span-context wrappers compose correctly.
|
|
75
|
-
*
|
|
76
|
-
* Value callbacks (`onStart`, `onStepEnd`, `onToolExecutionEnd`, …) invoke each
|
|
77
|
-
* integration's matching callback (guarding `undefined`) and await them all in
|
|
78
|
-
* parallel. The wrappers (`executeLanguageModelCall`, `executeTool`) are
|
|
79
|
-
* composed by nesting right-to-left; integrations without a wrapper are skipped,
|
|
80
|
-
* and with none defined the plain `execute` still runs.
|
|
81
|
-
* @experimental
|
|
82
|
-
*/
|
|
72
|
+
* Combine several {@link Telemetry} integrations into a single one that fans
|
|
73
|
+
* every lifecycle callback out to all of them and nests the two execution
|
|
74
|
+
* wrappers so multiple span-context wrappers compose correctly.
|
|
75
|
+
*
|
|
76
|
+
* Value callbacks (`onStart`, `onStepEnd`, `onToolExecutionEnd`, …) invoke each
|
|
77
|
+
* integration's matching callback (guarding `undefined`) and await them all in
|
|
78
|
+
* parallel. The wrappers (`executeLanguageModelCall`, `executeTool`) are
|
|
79
|
+
* composed by nesting right-to-left; integrations without a wrapper are skipped,
|
|
80
|
+
* and with none defined the plain `execute` still runs.
|
|
81
|
+
* @experimental
|
|
82
|
+
*/
|
|
83
83
|
declare const combineTelemetry: (...integrations: Telemetry[]) => Telemetry;
|
|
84
84
|
/**
|
|
85
|
-
* Severity level passed to a {@link ConsoleLogger}.
|
|
86
|
-
* @experimental
|
|
87
|
-
*/
|
|
85
|
+
* Severity level passed to a {@link ConsoleLogger}.
|
|
86
|
+
* @experimental
|
|
87
|
+
*/
|
|
88
88
|
type ConsoleLogLevel = "error" | "info" | "warn";
|
|
89
89
|
/**
|
|
90
|
-
* Structured log sink. Receives a level, a static human message, and a bag of
|
|
91
|
-
* structured fields (never interpolated into the message, so log processors can
|
|
92
|
-
* index them). The default sink writes to `globalThis.console`.
|
|
93
|
-
* @experimental
|
|
94
|
-
*/
|
|
90
|
+
* Structured log sink. Receives a level, a static human message, and a bag of
|
|
91
|
+
* structured fields (never interpolated into the message, so log processors can
|
|
92
|
+
* index them). The default sink writes to `globalThis.console`.
|
|
93
|
+
* @experimental
|
|
94
|
+
*/
|
|
95
95
|
type ConsoleLogger = (level: ConsoleLogLevel, message: string, fields: Record<string, unknown>) => void;
|
|
96
96
|
/**
|
|
97
|
-
* Options for {@link consoleTelemetry}.
|
|
98
|
-
* @experimental
|
|
99
|
-
*/
|
|
97
|
+
* Options for {@link consoleTelemetry}.
|
|
98
|
+
* @experimental
|
|
99
|
+
*/
|
|
100
100
|
interface ConsoleTelemetryOptions extends CommonOptions {
|
|
101
101
|
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
* Identifier prefixed into every log message (e.g. the agent name). Helps
|
|
103
|
+
* correlate lines when several agents share one process. Optional.
|
|
104
|
+
*/
|
|
105
105
|
functionId?: string;
|
|
106
106
|
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
* Sink for structured log lines. Defaults to a `globalThis.console`-backed
|
|
108
|
+
* writer that routes `info`/`warn`/`error` to the matching console method.
|
|
109
|
+
*/
|
|
110
110
|
logger?: ConsoleLogger;
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
|
-
* A zero-dependency structured tracer for the ai@7 telemetry surface.
|
|
114
|
-
*
|
|
115
|
-
* It maps the generation lifecycle onto {@link ConsoleLogger} calls: operation
|
|
116
|
-
* start/end, per-step start/end, model-call end (model + finish reason +
|
|
117
|
-
* usage), and tool start/end (name, success, timing). By default it records
|
|
118
|
-
* **only structural metadata** — set `recordInputs` to also log prompts / tool
|
|
119
|
-
* arguments, and `recordOutputs` to log generated text / tool results.
|
|
120
|
-
*
|
|
121
|
-
* Every callback is defensive (event fields may be absent) and synchronous.
|
|
122
|
-
* @experimental
|
|
123
|
-
*/
|
|
113
|
+
* A zero-dependency structured tracer for the ai@7 telemetry surface.
|
|
114
|
+
*
|
|
115
|
+
* It maps the generation lifecycle onto {@link ConsoleLogger} calls: operation
|
|
116
|
+
* start/end, per-step start/end, model-call end (model + finish reason +
|
|
117
|
+
* usage), and tool start/end (name, success, timing). By default it records
|
|
118
|
+
* **only structural metadata** — set `recordInputs` to also log prompts / tool
|
|
119
|
+
* arguments, and `recordOutputs` to log generated text / tool results.
|
|
120
|
+
*
|
|
121
|
+
* Every callback is defensive (event fields may be absent) and synchronous.
|
|
122
|
+
* @experimental
|
|
123
|
+
*/
|
|
124
124
|
declare const consoleTelemetry: (options?: ConsoleTelemetryOptions) => Telemetry;
|
|
125
125
|
/**
|
|
126
|
-
* The minimal, **structural** slice of `@sentry/cloudflare` (equivalently
|
|
127
|
-
* `@sentry/node`/`@sentry/browser`) this bridge needs. `@sentry/cloudflare` is
|
|
128
|
-
* intentionally **not** a dependency — the app passes its own already-initialized
|
|
129
|
-
* Sentry namespace, so this package stays dependency-free and works with any
|
|
130
|
-
* compatible Sentry SDK version.
|
|
131
|
-
* @experimental
|
|
132
|
-
*/
|
|
126
|
+
* The minimal, **structural** slice of `@sentry/cloudflare` (equivalently
|
|
127
|
+
* `@sentry/node`/`@sentry/browser`) this bridge needs. `@sentry/cloudflare` is
|
|
128
|
+
* intentionally **not** a dependency — the app passes its own already-initialized
|
|
129
|
+
* Sentry namespace, so this package stays dependency-free and works with any
|
|
130
|
+
* compatible Sentry SDK version.
|
|
131
|
+
* @experimental
|
|
132
|
+
*/
|
|
133
133
|
interface SentryLike {
|
|
134
134
|
/** Capture a thrown value / exception. */
|
|
135
135
|
captureException: (exception: unknown) => unknown;
|
|
@@ -145,29 +145,29 @@ interface SentryLike {
|
|
|
145
145
|
}) => T) => T;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
|
-
* Options for {@link sentryTelemetry}.
|
|
149
|
-
* @experimental
|
|
150
|
-
*/
|
|
148
|
+
* Options for {@link sentryTelemetry}.
|
|
149
|
+
* @experimental
|
|
150
|
+
*/
|
|
151
151
|
interface SentryTelemetryOptions extends CommonOptions {
|
|
152
152
|
/** Span-name prefix for the language-model call (e.g. the agent name). */
|
|
153
153
|
functionId?: string;
|
|
154
154
|
/**
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
* The caller's already-initialized Sentry namespace (dependency-injected).
|
|
156
|
+
* `import * as Sentry from "@sentry/cloudflare"` and pass it as `Sentry`.
|
|
157
|
+
*/
|
|
158
158
|
Sentry: SentryLike;
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
|
-
* A dependency-injected Sentry bridge for the ai@7 telemetry surface.
|
|
162
|
-
*
|
|
163
|
-
* It wraps model calls and tool executions in Sentry spans (via
|
|
164
|
-
* `Sentry.startSpan`) so nested provider/tool work is correctly parented, and
|
|
165
|
-
* routes `onError` to `Sentry.captureException`. Span attributes carry only
|
|
166
|
-
* structural metadata (model, provider, tool name) unless `recordInputs` is
|
|
167
|
-
* set, in which case prompts / tool arguments are attached too.
|
|
168
|
-
*
|
|
169
|
-
* The app owns Sentry initialization; pass the namespace in as `Sentry`.
|
|
170
|
-
* @experimental
|
|
171
|
-
*/
|
|
161
|
+
* A dependency-injected Sentry bridge for the ai@7 telemetry surface.
|
|
162
|
+
*
|
|
163
|
+
* It wraps model calls and tool executions in Sentry spans (via
|
|
164
|
+
* `Sentry.startSpan`) so nested provider/tool work is correctly parented, and
|
|
165
|
+
* routes `onError` to `Sentry.captureException`. Span attributes carry only
|
|
166
|
+
* structural metadata (model, provider, tool name) unless `recordInputs` is
|
|
167
|
+
* set, in which case prompts / tool arguments are attached too.
|
|
168
|
+
*
|
|
169
|
+
* The app owns Sentry initialization; pass the namespace in as `Sentry`.
|
|
170
|
+
* @experimental
|
|
171
|
+
*/
|
|
172
172
|
declare const sentryTelemetry: (options: SentryTelemetryOptions) => Telemetry;
|
|
173
173
|
export { type BraintrustLike, type BraintrustSpan, type BraintrustTelemetryOptions, type CommonOptions, type ConsoleLogLevel, type ConsoleLogger, type ConsoleTelemetryOptions, type SentryLike, type SentryTelemetryOptions, braintrustTelemetry, combineTelemetry, consoleTelemetry, sentryTelemetry };
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { Telemetry } from 'ai';
|
|
2
2
|
/**
|
|
3
|
-
* Privacy options shared by every telemetry integration in this package.
|
|
4
|
-
*
|
|
5
|
-
* Both flags default to **FALSE**. Without an explicit opt-in, no prompt,
|
|
6
|
-
* message, tool input, generated model text, or tool output is ever forwarded
|
|
7
|
-
* to a downstream tracer — only structural metadata (model id, finish reason,
|
|
8
|
-
* token counts, tool name, timing, success/failure) is recorded. This is the
|
|
9
|
-
* privacy-safe default: turn recording on deliberately, per integration.
|
|
10
|
-
* @experimental
|
|
11
|
-
*/
|
|
3
|
+
* Privacy options shared by every telemetry integration in this package.
|
|
4
|
+
*
|
|
5
|
+
* Both flags default to **FALSE**. Without an explicit opt-in, no prompt,
|
|
6
|
+
* message, tool input, generated model text, or tool output is ever forwarded
|
|
7
|
+
* to a downstream tracer — only structural metadata (model id, finish reason,
|
|
8
|
+
* token counts, tool name, timing, success/failure) is recorded. This is the
|
|
9
|
+
* privacy-safe default: turn recording on deliberately, per integration.
|
|
10
|
+
* @experimental
|
|
11
|
+
*/
|
|
12
12
|
interface CommonOptions {
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
* When `true`, record model/tool **input** — prompts, messages, and tool
|
|
15
|
+
* call arguments. Default `false`.
|
|
16
|
+
*/
|
|
17
17
|
recordInputs?: boolean;
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
* When `true`, record model/tool **output** — generated text and tool
|
|
20
|
+
* results. Default `false`.
|
|
21
|
+
*/
|
|
22
22
|
recordOutputs?: boolean;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* The span handle a {@link BraintrustLike.traced} callback receives.
|
|
26
|
-
* @experimental
|
|
27
|
-
*/
|
|
25
|
+
* The span handle a {@link BraintrustLike.traced} callback receives.
|
|
26
|
+
* @experimental
|
|
27
|
+
*/
|
|
28
28
|
interface BraintrustSpan {
|
|
29
29
|
/** Attach structured fields to the current span. */
|
|
30
30
|
log: (event: Record<string, unknown>) => void;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* The minimal, **structural** slice of the `braintrust` SDK this bridge needs.
|
|
34
|
-
* `braintrust` is intentionally **not** a dependency — the app passes its own
|
|
35
|
-
* initialized logger, so this package stays dependency-free and works with any
|
|
36
|
-
* compatible Braintrust SDK version.
|
|
37
|
-
* @experimental
|
|
38
|
-
*/
|
|
33
|
+
* The minimal, **structural** slice of the `braintrust` SDK this bridge needs.
|
|
34
|
+
* `braintrust` is intentionally **not** a dependency — the app passes its own
|
|
35
|
+
* initialized logger, so this package stays dependency-free and works with any
|
|
36
|
+
* compatible Braintrust SDK version.
|
|
37
|
+
* @experimental
|
|
38
|
+
*/
|
|
39
39
|
interface BraintrustLike {
|
|
40
40
|
/** Run `callback` inside a new traced span and return its result. */
|
|
41
41
|
traced: <T>(callback: (span: BraintrustSpan) => T, args?: {
|
|
@@ -44,92 +44,92 @@ interface BraintrustLike {
|
|
|
44
44
|
}) => T;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* Options for {@link braintrustTelemetry}.
|
|
48
|
-
* @experimental
|
|
49
|
-
*/
|
|
47
|
+
* Options for {@link braintrustTelemetry}.
|
|
48
|
+
* @experimental
|
|
49
|
+
*/
|
|
50
50
|
interface BraintrustTelemetryOptions extends CommonOptions {
|
|
51
51
|
/** Span-name prefix for the language-model call (e.g. the agent name). */
|
|
52
52
|
functionId?: string;
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
* The caller's initialized Braintrust logger (dependency-injected). Import
|
|
55
|
+
* and initialize `braintrust` in your app and pass it as `logger`.
|
|
56
|
+
*/
|
|
57
57
|
logger: BraintrustLike;
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* A dependency-injected Braintrust bridge for the ai@7 telemetry surface.
|
|
61
|
-
*
|
|
62
|
-
* It wraps model calls (`type: "llm"`) and tool executions (`type: "tool"`) in
|
|
63
|
-
* `logger.traced` spans and logs structural metadata. Prompts / tool arguments
|
|
64
|
-
* are logged only when `recordInputs` is set; generated text / tool results
|
|
65
|
-
* only when `recordOutputs` is set. `onError` opens a span and logs the error.
|
|
66
|
-
*
|
|
67
|
-
* The app owns Braintrust initialization; pass the logger in as `logger`.
|
|
68
|
-
* @experimental
|
|
69
|
-
*/
|
|
60
|
+
* A dependency-injected Braintrust bridge for the ai@7 telemetry surface.
|
|
61
|
+
*
|
|
62
|
+
* It wraps model calls (`type: "llm"`) and tool executions (`type: "tool"`) in
|
|
63
|
+
* `logger.traced` spans and logs structural metadata. Prompts / tool arguments
|
|
64
|
+
* are logged only when `recordInputs` is set; generated text / tool results
|
|
65
|
+
* only when `recordOutputs` is set. `onError` opens a span and logs the error.
|
|
66
|
+
*
|
|
67
|
+
* The app owns Braintrust initialization; pass the logger in as `logger`.
|
|
68
|
+
* @experimental
|
|
69
|
+
*/
|
|
70
70
|
declare const braintrustTelemetry: (options: BraintrustTelemetryOptions) => Telemetry;
|
|
71
71
|
/**
|
|
72
|
-
* Combine several {@link Telemetry} integrations into a single one that fans
|
|
73
|
-
* every lifecycle callback out to all of them and nests the two execution
|
|
74
|
-
* wrappers so multiple span-context wrappers compose correctly.
|
|
75
|
-
*
|
|
76
|
-
* Value callbacks (`onStart`, `onStepEnd`, `onToolExecutionEnd`, …) invoke each
|
|
77
|
-
* integration's matching callback (guarding `undefined`) and await them all in
|
|
78
|
-
* parallel. The wrappers (`executeLanguageModelCall`, `executeTool`) are
|
|
79
|
-
* composed by nesting right-to-left; integrations without a wrapper are skipped,
|
|
80
|
-
* and with none defined the plain `execute` still runs.
|
|
81
|
-
* @experimental
|
|
82
|
-
*/
|
|
72
|
+
* Combine several {@link Telemetry} integrations into a single one that fans
|
|
73
|
+
* every lifecycle callback out to all of them and nests the two execution
|
|
74
|
+
* wrappers so multiple span-context wrappers compose correctly.
|
|
75
|
+
*
|
|
76
|
+
* Value callbacks (`onStart`, `onStepEnd`, `onToolExecutionEnd`, …) invoke each
|
|
77
|
+
* integration's matching callback (guarding `undefined`) and await them all in
|
|
78
|
+
* parallel. The wrappers (`executeLanguageModelCall`, `executeTool`) are
|
|
79
|
+
* composed by nesting right-to-left; integrations without a wrapper are skipped,
|
|
80
|
+
* and with none defined the plain `execute` still runs.
|
|
81
|
+
* @experimental
|
|
82
|
+
*/
|
|
83
83
|
declare const combineTelemetry: (...integrations: Telemetry[]) => Telemetry;
|
|
84
84
|
/**
|
|
85
|
-
* Severity level passed to a {@link ConsoleLogger}.
|
|
86
|
-
* @experimental
|
|
87
|
-
*/
|
|
85
|
+
* Severity level passed to a {@link ConsoleLogger}.
|
|
86
|
+
* @experimental
|
|
87
|
+
*/
|
|
88
88
|
type ConsoleLogLevel = "error" | "info" | "warn";
|
|
89
89
|
/**
|
|
90
|
-
* Structured log sink. Receives a level, a static human message, and a bag of
|
|
91
|
-
* structured fields (never interpolated into the message, so log processors can
|
|
92
|
-
* index them). The default sink writes to `globalThis.console`.
|
|
93
|
-
* @experimental
|
|
94
|
-
*/
|
|
90
|
+
* Structured log sink. Receives a level, a static human message, and a bag of
|
|
91
|
+
* structured fields (never interpolated into the message, so log processors can
|
|
92
|
+
* index them). The default sink writes to `globalThis.console`.
|
|
93
|
+
* @experimental
|
|
94
|
+
*/
|
|
95
95
|
type ConsoleLogger = (level: ConsoleLogLevel, message: string, fields: Record<string, unknown>) => void;
|
|
96
96
|
/**
|
|
97
|
-
* Options for {@link consoleTelemetry}.
|
|
98
|
-
* @experimental
|
|
99
|
-
*/
|
|
97
|
+
* Options for {@link consoleTelemetry}.
|
|
98
|
+
* @experimental
|
|
99
|
+
*/
|
|
100
100
|
interface ConsoleTelemetryOptions extends CommonOptions {
|
|
101
101
|
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
* Identifier prefixed into every log message (e.g. the agent name). Helps
|
|
103
|
+
* correlate lines when several agents share one process. Optional.
|
|
104
|
+
*/
|
|
105
105
|
functionId?: string;
|
|
106
106
|
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
* Sink for structured log lines. Defaults to a `globalThis.console`-backed
|
|
108
|
+
* writer that routes `info`/`warn`/`error` to the matching console method.
|
|
109
|
+
*/
|
|
110
110
|
logger?: ConsoleLogger;
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
|
-
* A zero-dependency structured tracer for the ai@7 telemetry surface.
|
|
114
|
-
*
|
|
115
|
-
* It maps the generation lifecycle onto {@link ConsoleLogger} calls: operation
|
|
116
|
-
* start/end, per-step start/end, model-call end (model + finish reason +
|
|
117
|
-
* usage), and tool start/end (name, success, timing). By default it records
|
|
118
|
-
* **only structural metadata** — set `recordInputs` to also log prompts / tool
|
|
119
|
-
* arguments, and `recordOutputs` to log generated text / tool results.
|
|
120
|
-
*
|
|
121
|
-
* Every callback is defensive (event fields may be absent) and synchronous.
|
|
122
|
-
* @experimental
|
|
123
|
-
*/
|
|
113
|
+
* A zero-dependency structured tracer for the ai@7 telemetry surface.
|
|
114
|
+
*
|
|
115
|
+
* It maps the generation lifecycle onto {@link ConsoleLogger} calls: operation
|
|
116
|
+
* start/end, per-step start/end, model-call end (model + finish reason +
|
|
117
|
+
* usage), and tool start/end (name, success, timing). By default it records
|
|
118
|
+
* **only structural metadata** — set `recordInputs` to also log prompts / tool
|
|
119
|
+
* arguments, and `recordOutputs` to log generated text / tool results.
|
|
120
|
+
*
|
|
121
|
+
* Every callback is defensive (event fields may be absent) and synchronous.
|
|
122
|
+
* @experimental
|
|
123
|
+
*/
|
|
124
124
|
declare const consoleTelemetry: (options?: ConsoleTelemetryOptions) => Telemetry;
|
|
125
125
|
/**
|
|
126
|
-
* The minimal, **structural** slice of `@sentry/cloudflare` (equivalently
|
|
127
|
-
* `@sentry/node`/`@sentry/browser`) this bridge needs. `@sentry/cloudflare` is
|
|
128
|
-
* intentionally **not** a dependency — the app passes its own already-initialized
|
|
129
|
-
* Sentry namespace, so this package stays dependency-free and works with any
|
|
130
|
-
* compatible Sentry SDK version.
|
|
131
|
-
* @experimental
|
|
132
|
-
*/
|
|
126
|
+
* The minimal, **structural** slice of `@sentry/cloudflare` (equivalently
|
|
127
|
+
* `@sentry/node`/`@sentry/browser`) this bridge needs. `@sentry/cloudflare` is
|
|
128
|
+
* intentionally **not** a dependency — the app passes its own already-initialized
|
|
129
|
+
* Sentry namespace, so this package stays dependency-free and works with any
|
|
130
|
+
* compatible Sentry SDK version.
|
|
131
|
+
* @experimental
|
|
132
|
+
*/
|
|
133
133
|
interface SentryLike {
|
|
134
134
|
/** Capture a thrown value / exception. */
|
|
135
135
|
captureException: (exception: unknown) => unknown;
|
|
@@ -145,29 +145,29 @@ interface SentryLike {
|
|
|
145
145
|
}) => T) => T;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
|
-
* Options for {@link sentryTelemetry}.
|
|
149
|
-
* @experimental
|
|
150
|
-
*/
|
|
148
|
+
* Options for {@link sentryTelemetry}.
|
|
149
|
+
* @experimental
|
|
150
|
+
*/
|
|
151
151
|
interface SentryTelemetryOptions extends CommonOptions {
|
|
152
152
|
/** Span-name prefix for the language-model call (e.g. the agent name). */
|
|
153
153
|
functionId?: string;
|
|
154
154
|
/**
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
* The caller's already-initialized Sentry namespace (dependency-injected).
|
|
156
|
+
* `import * as Sentry from "@sentry/cloudflare"` and pass it as `Sentry`.
|
|
157
|
+
*/
|
|
158
158
|
Sentry: SentryLike;
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
|
-
* A dependency-injected Sentry bridge for the ai@7 telemetry surface.
|
|
162
|
-
*
|
|
163
|
-
* It wraps model calls and tool executions in Sentry spans (via
|
|
164
|
-
* `Sentry.startSpan`) so nested provider/tool work is correctly parented, and
|
|
165
|
-
* routes `onError` to `Sentry.captureException`. Span attributes carry only
|
|
166
|
-
* structural metadata (model, provider, tool name) unless `recordInputs` is
|
|
167
|
-
* set, in which case prompts / tool arguments are attached too.
|
|
168
|
-
*
|
|
169
|
-
* The app owns Sentry initialization; pass the namespace in as `Sentry`.
|
|
170
|
-
* @experimental
|
|
171
|
-
*/
|
|
161
|
+
* A dependency-injected Sentry bridge for the ai@7 telemetry surface.
|
|
162
|
+
*
|
|
163
|
+
* It wraps model calls and tool executions in Sentry spans (via
|
|
164
|
+
* `Sentry.startSpan`) so nested provider/tool work is correctly parented, and
|
|
165
|
+
* routes `onError` to `Sentry.captureException`. Span attributes carry only
|
|
166
|
+
* structural metadata (model, provider, tool name) unless `recordInputs` is
|
|
167
|
+
* set, in which case prompts / tool arguments are attached too.
|
|
168
|
+
*
|
|
169
|
+
* The app owns Sentry initialization; pass the namespace in as `Sentry`.
|
|
170
|
+
* @experimental
|
|
171
|
+
*/
|
|
172
172
|
declare const sentryTelemetry: (options: SentryTelemetryOptions) => Telemetry;
|
|
173
173
|
export { type BraintrustLike, type BraintrustSpan, type BraintrustTelemetryOptions, type CommonOptions, type ConsoleLogLevel, type ConsoleLogger, type ConsoleTelemetryOptions, type SentryLike, type SentryTelemetryOptions, braintrustTelemetry, combineTelemetry, consoleTelemetry, sentryTelemetry };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/agent",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.5",
|
|
4
4
|
"description": "Durable AI agents for Lunora: defineAgent compiles a replay-safe tool-loop onto Cloudflare Workflows, with DO SQLite threads and live message subscriptions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -76,14 +76,14 @@
|
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@lunora/ai": "1.0.0-alpha.
|
|
80
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
81
|
-
"@lunora/mail": "1.0.0-alpha.
|
|
82
|
-
"@lunora/server": "1.0.0-alpha.
|
|
83
|
-
"@lunora/values": "1.0.0-alpha.
|
|
84
|
-
"@lunora/workflow": "1.0.0-alpha.
|
|
79
|
+
"@lunora/ai": "1.0.0-alpha.17",
|
|
80
|
+
"@lunora/errors": "1.0.0-alpha.6",
|
|
81
|
+
"@lunora/mail": "1.0.0-alpha.16",
|
|
82
|
+
"@lunora/server": "1.0.0-alpha.28",
|
|
83
|
+
"@lunora/values": "1.0.0-alpha.9",
|
|
84
|
+
"@lunora/workflow": "1.0.0-alpha.11",
|
|
85
85
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
86
|
-
"ai": "7.0.
|
|
86
|
+
"ai": "7.0.31"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|
|
89
89
|
"node": "^22.15.0 || >=24.11.0"
|