@mongodb-js/agent-engine-runner-shared 0.11.3

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 (220) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/LICENSE.md +201 -0
  3. package/README.md +29 -0
  4. package/dist/agent_config.d.ts +167 -0
  5. package/dist/agent_config.d.ts.map +1 -0
  6. package/dist/agent_config.js +544 -0
  7. package/dist/call_interrupted.d.ts +12 -0
  8. package/dist/call_interrupted.d.ts.map +1 -0
  9. package/dist/call_interrupted.js +11 -0
  10. package/dist/checkpoint_workspace.d.ts +25 -0
  11. package/dist/checkpoint_workspace.d.ts.map +1 -0
  12. package/dist/checkpoint_workspace.js +44 -0
  13. package/dist/context.d.ts +235 -0
  14. package/dist/context.d.ts.map +1 -0
  15. package/dist/context.js +322 -0
  16. package/dist/db_config.d.ts +28 -0
  17. package/dist/db_config.d.ts.map +1 -0
  18. package/dist/db_config.js +66 -0
  19. package/dist/db_naming.d.ts +54 -0
  20. package/dist/db_naming.d.ts.map +1 -0
  21. package/dist/db_naming.js +94 -0
  22. package/dist/error_reporting.d.ts +67 -0
  23. package/dist/error_reporting.d.ts.map +1 -0
  24. package/dist/error_reporting.js +311 -0
  25. package/dist/generated/workflow/v1/activity_pb.d.ts +342 -0
  26. package/dist/generated/workflow/v1/activity_pb.d.ts.map +1 -0
  27. package/dist/generated/workflow/v1/activity_pb.js +115 -0
  28. package/dist/generated/workflow/v1/common_pb.d.ts +184 -0
  29. package/dist/generated/workflow/v1/common_pb.d.ts.map +1 -0
  30. package/dist/generated/workflow/v1/common_pb.js +86 -0
  31. package/dist/generated/workflow/v1/runtime_pb.d.ts +200 -0
  32. package/dist/generated/workflow/v1/runtime_pb.d.ts.map +1 -0
  33. package/dist/generated/workflow/v1/runtime_pb.js +40 -0
  34. package/dist/generated/workflow/v1/state_pb.d.ts +254 -0
  35. package/dist/generated/workflow/v1/state_pb.d.ts.map +1 -0
  36. package/dist/generated/workflow/v1/state_pb.js +68 -0
  37. package/dist/guardrails_evaluator/core.d.ts +23 -0
  38. package/dist/guardrails_evaluator/core.d.ts.map +1 -0
  39. package/dist/guardrails_evaluator/core.js +122 -0
  40. package/dist/guardrails_evaluator/index.d.ts +10 -0
  41. package/dist/guardrails_evaluator/index.d.ts.map +1 -0
  42. package/dist/guardrails_evaluator/index.js +11 -0
  43. package/dist/guardrails_evaluator/regex.d.ts +20 -0
  44. package/dist/guardrails_evaluator/regex.d.ts.map +1 -0
  45. package/dist/guardrails_evaluator/regex.js +233 -0
  46. package/dist/hooks.d.ts +109 -0
  47. package/dist/hooks.d.ts.map +1 -0
  48. package/dist/hooks.js +216 -0
  49. package/dist/http_path.d.ts +18 -0
  50. package/dist/http_path.d.ts.map +1 -0
  51. package/dist/http_path.js +53 -0
  52. package/dist/index.d.ts +35 -0
  53. package/dist/index.d.ts.map +1 -0
  54. package/dist/index.js +41 -0
  55. package/dist/launcher.d.ts +130 -0
  56. package/dist/launcher.d.ts.map +1 -0
  57. package/dist/launcher.js +325 -0
  58. package/dist/logger.d.ts +96 -0
  59. package/dist/logger.d.ts.map +1 -0
  60. package/dist/logger.js +204 -0
  61. package/dist/mcp_oauth.d.ts +51 -0
  62. package/dist/mcp_oauth.d.ts.map +1 -0
  63. package/dist/mcp_oauth.js +389 -0
  64. package/dist/mcp_oauth_secret.d.ts +21 -0
  65. package/dist/mcp_oauth_secret.d.ts.map +1 -0
  66. package/dist/mcp_oauth_secret.js +122 -0
  67. package/dist/mcp_tools.d.ts +71 -0
  68. package/dist/mcp_tools.d.ts.map +1 -0
  69. package/dist/mcp_tools.js +301 -0
  70. package/dist/memory_appbound.d.ts +42 -0
  71. package/dist/memory_appbound.d.ts.map +1 -0
  72. package/dist/memory_appbound.js +159 -0
  73. package/dist/memory_writer.d.ts +49 -0
  74. package/dist/memory_writer.d.ts.map +1 -0
  75. package/dist/memory_writer.js +171 -0
  76. package/dist/metrics.d.ts +84 -0
  77. package/dist/metrics.d.ts.map +1 -0
  78. package/dist/metrics.js +205 -0
  79. package/dist/models.d.ts +1458 -0
  80. package/dist/models.d.ts.map +1 -0
  81. package/dist/models.js +1726 -0
  82. package/dist/node_logger.d.ts +43 -0
  83. package/dist/node_logger.d.ts.map +1 -0
  84. package/dist/node_logger.js +158 -0
  85. package/dist/owner_callback.d.ts +16 -0
  86. package/dist/owner_callback.d.ts.map +1 -0
  87. package/dist/owner_callback.js +40 -0
  88. package/dist/progress.d.ts +57 -0
  89. package/dist/progress.d.ts.map +1 -0
  90. package/dist/progress.js +140 -0
  91. package/dist/runtime.d.ts +131 -0
  92. package/dist/runtime.d.ts.map +1 -0
  93. package/dist/runtime.js +351 -0
  94. package/dist/secure_llm_proxy.d.ts +115 -0
  95. package/dist/secure_llm_proxy.d.ts.map +1 -0
  96. package/dist/secure_llm_proxy.js +922 -0
  97. package/dist/secure_wrapper.d.ts +332 -0
  98. package/dist/secure_wrapper.d.ts.map +1 -0
  99. package/dist/secure_wrapper.js +1249 -0
  100. package/dist/server/aer.d.ts +61 -0
  101. package/dist/server/aer.d.ts.map +1 -0
  102. package/dist/server/aer.js +1124 -0
  103. package/dist/server/auth.d.ts +56 -0
  104. package/dist/server/auth.d.ts.map +1 -0
  105. package/dist/server/auth.js +132 -0
  106. package/dist/server/base.d.ts +104 -0
  107. package/dist/server/base.d.ts.map +1 -0
  108. package/dist/server/base.js +150 -0
  109. package/dist/server/callInterrupt.d.ts +49 -0
  110. package/dist/server/callInterrupt.d.ts.map +1 -0
  111. package/dist/server/callInterrupt.js +68 -0
  112. package/dist/server/callback_delivery.d.ts +14 -0
  113. package/dist/server/callback_delivery.d.ts.map +1 -0
  114. package/dist/server/callback_delivery.js +141 -0
  115. package/dist/server/chunk_types.d.ts +50 -0
  116. package/dist/server/chunk_types.d.ts.map +1 -0
  117. package/dist/server/chunk_types.js +62 -0
  118. package/dist/server/cors.d.ts +52 -0
  119. package/dist/server/cors.d.ts.map +1 -0
  120. package/dist/server/cors.js +107 -0
  121. package/dist/server/drain.d.ts +169 -0
  122. package/dist/server/drain.d.ts.map +1 -0
  123. package/dist/server/drain.js +455 -0
  124. package/dist/server/function.d.ts +77 -0
  125. package/dist/server/function.d.ts.map +1 -0
  126. package/dist/server/function.js +337 -0
  127. package/dist/server/http_retry.d.ts +37 -0
  128. package/dist/server/http_retry.d.ts.map +1 -0
  129. package/dist/server/http_retry.js +157 -0
  130. package/dist/server/index.d.ts +7 -0
  131. package/dist/server/index.d.ts.map +1 -0
  132. package/dist/server/index.js +5 -0
  133. package/dist/server/metadata.d.ts +50 -0
  134. package/dist/server/metadata.d.ts.map +1 -0
  135. package/dist/server/metadata.js +193 -0
  136. package/dist/server/oe_url.d.ts +36 -0
  137. package/dist/server/oe_url.d.ts.map +1 -0
  138. package/dist/server/oe_url.js +50 -0
  139. package/dist/server/owner_url.d.ts +35 -0
  140. package/dist/server/owner_url.d.ts.map +1 -0
  141. package/dist/server/owner_url.js +146 -0
  142. package/dist/server/query.d.ts +42 -0
  143. package/dist/server/query.d.ts.map +1 -0
  144. package/dist/server/query.js +28 -0
  145. package/dist/server/tool.d.ts +138 -0
  146. package/dist/server/tool.d.ts.map +1 -0
  147. package/dist/server/tool.js +1017 -0
  148. package/dist/span_names.d.ts +21 -0
  149. package/dist/span_names.d.ts.map +1 -0
  150. package/dist/span_names.js +31 -0
  151. package/dist/structured_logging/constants.d.ts +17 -0
  152. package/dist/structured_logging/constants.d.ts.map +1 -0
  153. package/dist/structured_logging/constants.js +71 -0
  154. package/dist/structured_logging/env.d.ts +18 -0
  155. package/dist/structured_logging/env.d.ts.map +1 -0
  156. package/dist/structured_logging/env.js +39 -0
  157. package/dist/structured_logging/install.d.ts +56 -0
  158. package/dist/structured_logging/install.d.ts.map +1 -0
  159. package/dist/structured_logging/install.js +107 -0
  160. package/dist/structured_logging/layout.d.ts +9 -0
  161. package/dist/structured_logging/layout.d.ts.map +1 -0
  162. package/dist/structured_logging/layout.js +144 -0
  163. package/dist/structured_logging/serialize.d.ts +27 -0
  164. package/dist/structured_logging/serialize.d.ts.map +1 -0
  165. package/dist/structured_logging/serialize.js +61 -0
  166. package/dist/structured_logging/stdio_capture.d.ts +59 -0
  167. package/dist/structured_logging/stdio_capture.d.ts.map +1 -0
  168. package/dist/structured_logging/stdio_capture.js +164 -0
  169. package/dist/structured_logging/uncaught.d.ts +14 -0
  170. package/dist/structured_logging/uncaught.d.ts.map +1 -0
  171. package/dist/structured_logging/uncaught.js +58 -0
  172. package/dist/structured_logging.d.ts +48 -0
  173. package/dist/structured_logging.d.ts.map +1 -0
  174. package/dist/structured_logging.js +47 -0
  175. package/dist/tls_client.d.ts +61 -0
  176. package/dist/tls_client.d.ts.map +1 -0
  177. package/dist/tls_client.js +298 -0
  178. package/dist/tool_api_error.d.ts +62 -0
  179. package/dist/tool_api_error.d.ts.map +1 -0
  180. package/dist/tool_api_error.js +399 -0
  181. package/dist/tool_memory_ownership.d.ts +10 -0
  182. package/dist/tool_memory_ownership.d.ts.map +1 -0
  183. package/dist/tool_memory_ownership.js +36 -0
  184. package/dist/toolpod_handlers.d.ts +126 -0
  185. package/dist/toolpod_handlers.d.ts.map +1 -0
  186. package/dist/toolpod_handlers.js +1016 -0
  187. package/dist/tracing/exporters.d.ts +51 -0
  188. package/dist/tracing/exporters.d.ts.map +1 -0
  189. package/dist/tracing/exporters.js +327 -0
  190. package/dist/tracing/index.d.ts +3 -0
  191. package/dist/tracing/index.d.ts.map +1 -0
  192. package/dist/tracing/index.js +2 -0
  193. package/dist/tracing/setup.d.ts +76 -0
  194. package/dist/tracing/setup.d.ts.map +1 -0
  195. package/dist/tracing/setup.js +436 -0
  196. package/dist/utils.d.ts +204 -0
  197. package/dist/utils.d.ts.map +1 -0
  198. package/dist/utils.js +867 -0
  199. package/dist/workflow/activity.d.ts +71 -0
  200. package/dist/workflow/activity.d.ts.map +1 -0
  201. package/dist/workflow/activity.js +357 -0
  202. package/dist/workflow/attempt.d.ts +12 -0
  203. package/dist/workflow/attempt.d.ts.map +1 -0
  204. package/dist/workflow/attempt.js +96 -0
  205. package/dist/workflow/client.d.ts +46 -0
  206. package/dist/workflow/client.d.ts.map +1 -0
  207. package/dist/workflow/client.js +299 -0
  208. package/dist/workflow/context.d.ts +37 -0
  209. package/dist/workflow/context.d.ts.map +1 -0
  210. package/dist/workflow/context.js +350 -0
  211. package/dist/workflow/heartbeat.d.ts +15 -0
  212. package/dist/workflow/heartbeat.d.ts.map +1 -0
  213. package/dist/workflow/heartbeat.js +78 -0
  214. package/dist/workflow/index.d.ts +14 -0
  215. package/dist/workflow/index.d.ts.map +1 -0
  216. package/dist/workflow/index.js +10 -0
  217. package/dist/workflow/memory.d.ts +17 -0
  218. package/dist/workflow/memory.d.ts.map +1 -0
  219. package/dist/workflow/memory.js +184 -0
  220. package/package.json +73 -0
@@ -0,0 +1,436 @@
1
+ /**
2
+ * Tracing setup for Runner SDK.
3
+ *
4
+ * Ported from `agent_engine_runner_shared/tracing/setup.py`. Initializes OpenTelemetry
5
+ * with `BasicTracerProvider` and optionally a Mongo exporter. Calls the
6
+ * framework instrumentor hook
7
+ * registered via `agent_engine_runner_shared/hooks.ts:registerInstrumentor`.
8
+ */
9
+ import { isSpanContextValid, propagation, trace } from "@opentelemetry/api";
10
+ import { W3CTraceContextPropagator } from "@opentelemetry/core";
11
+ import { resourceFromAttributes } from "@opentelemetry/resources";
12
+ import { BasicTracerProvider, BatchSpanProcessor, } from "@opentelemetry/sdk-trace-base";
13
+ import { getCurrentExecutionId, getCurrentSessionId, getCurrentWorkspaceId, } from "../context.js";
14
+ import { getInstrumentor } from "../hooks.js";
15
+ import { getLogger } from "../logger.js";
16
+ import { ContentPolicyOTLPSpanExporter, getContentCaptureMode, MongoDBSpanExporter, } from "./exporters.js";
17
+ const logger = getLogger("agent_engine_runner_shared.tracing");
18
+ let tracerProvider = null;
19
+ // MongoClient instance built by `resolveTracingCollection`. Held here so
20
+ // `shutdownTracing` can close the pool — `MongoDBSpanExporter.shutdown()`
21
+ // is a no-op, so without this reference the client (and its connection
22
+ // pool, monitor threads, heartbeat intervals) would leak until process exit.
23
+ let tracingMongoClient = null;
24
+ // In-flight initialization promise. `setupTracing` sets `tracerProvider` late
25
+ // (after awaiting dynamic imports + the MongoClient connect), so the entry
26
+ // guard alone can't stop concurrent callers from both running full setup —
27
+ // which would open two Mongo clients and leak the first when the second
28
+ // overwrites `tracingMongoClient`. Sharing this promise serializes them.
29
+ let setupPromise = null;
30
+ // MongoDB trace-store exporter state — mirrors Python's setup.py. The store
31
+ // connection can fail at pod startup (e.g. a transient Atlas TLS error); without
32
+ // retry the pod permanently lost database tracing for its whole lifetime.
33
+ // `mongodbExporterAttached` tracks whether a MongoDB span processor
34
+ // is live; `mongodbDegraded` marks a configured-but-unreachable store so /health
35
+ // can surface DEGRADED. The retry timer re-attempts the connection in the
36
+ // background and attaches the exporter on recovery.
37
+ let mongodbExporterAttached = false;
38
+ let mongodbDegraded = false;
39
+ let retryTimer = null;
40
+ // Stop signal for the background retry loop, mirroring Python's
41
+ // `_retry_stop_event`. `shutdownTracing` sets this so an in-flight retry
42
+ // attempt (past `retryTimer = null`, mid-`await resolveTracingCollection`)
43
+ // can't reschedule a new timer or overwrite `tracingMongoClient` with a
44
+ // client whose pool shutdown already closed — both would leak past shutdown.
45
+ let retryStopped = false;
46
+ // The lazy Mongo exporter registered with the tracer provider at setup time
47
+ // when a store URI is configured. `BasicTracerProvider` (v2.x) takes span
48
+ // processors only via its constructor — there is no `addSpanProcessor`, and
49
+ // `setGlobalTracerProvider` rejects re-registration — so the provider is built
50
+ // once with the lazy Mongo processor and the collection is wired in later by
51
+ // `attachMongoTracing` once the store recovers. While the collection
52
+ // is unset, `export` is a no-op.
53
+ let lazyMongoExporter = null;
54
+ class ExecutionContextSpanProcessor {
55
+ onStart(span, _parentContext) {
56
+ const sessionId = getCurrentSessionId();
57
+ const attributes = {
58
+ "execution.id": getCurrentExecutionId(),
59
+ "session.id": sessionId,
60
+ "thread.id": sessionId,
61
+ "workspace.id": getCurrentWorkspaceId(),
62
+ };
63
+ for (const [key, value] of Object.entries(attributes)) {
64
+ if (value)
65
+ span.setAttribute(key, value);
66
+ }
67
+ }
68
+ onEnd(_span) { }
69
+ shutdown() {
70
+ return Promise.resolve();
71
+ }
72
+ forceFlush() {
73
+ return Promise.resolve();
74
+ }
75
+ }
76
+ /** A SpanExporter whose Mongo collection is wired in after construction. */
77
+ class LazyMongoSpanExporter {
78
+ inner = null;
79
+ setCollection(collection) {
80
+ this.inner = new MongoDBSpanExporter(collection);
81
+ }
82
+ export(spans, resultCallback) {
83
+ if (this.inner === null || spans.length === 0) {
84
+ resultCallback({ code: 0 });
85
+ return;
86
+ }
87
+ this.inner.export(spans, resultCallback);
88
+ }
89
+ shutdown() {
90
+ return this.inner?.shutdown() ?? Promise.resolve();
91
+ }
92
+ forceFlush() {
93
+ return this.inner?.forceFlush() ?? Promise.resolve();
94
+ }
95
+ }
96
+ async function resolveTracingCollection(args) {
97
+ if (!args.mongodbUri) {
98
+ return { collection: null, errorMessage: null };
99
+ }
100
+ const collName = args.mongodbCollectionName ?? "traces";
101
+ let client;
102
+ try {
103
+ const { MongoClient } = await import("mongodb");
104
+ client = new MongoClient(args.mongodbUri, {
105
+ serverSelectionTimeoutMS: 5000,
106
+ });
107
+ await client.connect();
108
+ // Mirrors Python's `client.admin.command("ping")` — surfaces a dead
109
+ // server immediately rather than waiting for the first span insert.
110
+ await client.db("admin").command({ ping: 1 });
111
+ // Resolve the per-project-scoped store DB now that a client exists, so
112
+ // traces land in the same database the OE reads.
113
+ const { resolveStoreDbName } = await import("../db_config.js");
114
+ const dbName = await resolveStoreDbName(client, args.mongodbDatabaseName ?? undefined);
115
+ // Retain the client so `shutdownTracing` can close it.
116
+ tracingMongoClient = client;
117
+ return {
118
+ collection: client.db(dbName).collection(collName),
119
+ errorMessage: null,
120
+ };
121
+ }
122
+ catch (err) {
123
+ // Close on failure so a half-open client doesn't leak. `connect()` may
124
+ // not have completed, but `close()` is safe to call on a never-connected
125
+ // client per the driver docs. The scrubbed error message is returned for
126
+ // the caller to log at the severity it chooses (ERROR at startup, DEBUG
127
+ // on retries) — this function stays log-free so retries don't spam.
128
+ if (client !== undefined) {
129
+ try {
130
+ await client.close();
131
+ }
132
+ catch {
133
+ // best-effort cleanup
134
+ }
135
+ }
136
+ return {
137
+ collection: null,
138
+ errorMessage: scrubCredentials(err.message),
139
+ };
140
+ }
141
+ }
142
+ /**
143
+ * Mask the userinfo of any `mongodb://` / `mongodb+srv://` URI embedded in a
144
+ * credential-bearing error message (driver parse/connect errors echo the raw
145
+ * connection string).
146
+ *
147
+ * The userinfo run is GREEDY up to the LAST '@' that a host-shaped token
148
+ * follows, so passwords containing an unescaped '@', space, or '/' are still
149
+ * fully masked — the old `:\/\/[^@\s]+@` pattern stopped at the first '@' and
150
+ * could not cross whitespace, leaking the password tail (or the whole
151
+ * userinfo) to the centralized log sink. The run is tempered so it never
152
+ * crosses into a second URI's scheme; when message text after the URI
153
+ * contains its own '@' the mask may extend to it — over-redaction is the
154
+ * fail-closed direction, a leak is not recoverable. Keep in sync with
155
+ * `scrub_credentials` in Python's `agent_engine_runner_shared/tracing/setup.py`.
156
+ *
157
+ * Accepts `unknown` and coerces: error paths hand this whatever a rejection
158
+ * carried (string throws, objects without a string `message`, undefined) —
159
+ * it must never throw itself, or a degraded trace store turns into a
160
+ * startup failure.
161
+ */
162
+ export function scrubCredentials(message) {
163
+ // The run is [^"'] (any char except quotes): it still crosses embedded
164
+ // newlines in a password (a --stdin-set secret can carry one), but stops
165
+ // at a JSON string boundary — a credential echoed inside a compact JSON
166
+ // body must not fold later siblings into the mask.
167
+ return String(message).replace(/(mongodb(?:\+srv)?:\/\/)((?:(?!mongodb(?:\+srv)?:\/\/)[^"'])*)@(?=[^\s@/?#"'][^\s@?"']*(?:[/?#:\s"']|$))/gi, "$1***@");
168
+ }
169
+ /**
170
+ * Whether an OTLP endpoint was explicitly configured.
171
+ *
172
+ * `OTLPTraceExporter` defaults to `http://localhost:4318` when no endpoint
173
+ * env var is set, which would silently start exporting to a collector that
174
+ * doesn't exist in this cell architecture. Gate on explicit configuration so
175
+ * "no endpoint configured" truly means "no OTLP traffic." Mirrors Python's
176
+ * `_otlp_endpoint_configured`.
177
+ */
178
+ function otlpEndpointConfigured() {
179
+ return Boolean(process.env["OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"] ||
180
+ process.env["OTEL_EXPORTER_OTLP_ENDPOINT"]);
181
+ }
182
+ /**
183
+ * Upper bound (ms) on how long a `TenantRuntime.shutdown()` flush can spend
184
+ * waiting on the OTLP exporter. `TOOL_FUNCTION` mode calls `shutdown()`
185
+ * synchronously on every invocation (its process-exit flush timer is
186
+ * unref'd and would otherwise never fire), so an unreachable/slow collector
187
+ * would otherwise add up to the OTel default export timeout (10s) of tail
188
+ * latency to *every* one-shot invocation. Deliberately short relative to
189
+ * that default.
190
+ */
191
+ const OTLP_EXPORT_TIMEOUT_MILLIS = 3000;
192
+ /**
193
+ * Build the OTLP export span processor, if an endpoint was explicitly
194
+ * configured. Additive and never replaces Mongo. Content-capture redaction
195
+ * (`AGENTIC_PLATFORM_OTEL_CONTENT_CAPTURE`) applies only to this path.
196
+ * Guarded: a missing dependency or bad endpoint must not take down tracing
197
+ * setup entirely — mirrors Python's try/except around the same block.
198
+ */
199
+ async function buildOtlpSpanProcessor() {
200
+ if (!otlpEndpointConfigured())
201
+ return null;
202
+ try {
203
+ const { OTLPTraceExporter } = await import("@opentelemetry/exporter-trace-otlp-http");
204
+ const contentCaptureMode = getContentCaptureMode();
205
+ if (contentCaptureMode === "full") {
206
+ logger.warn("AGENTIC_PLATFORM_OTEL_CONTENT_CAPTURE=full — OTLP export includes " +
207
+ "unredacted prompt/completion/tool content. This should only be " +
208
+ "set intentionally (e.g. local debugging).");
209
+ }
210
+ const otlpExporter = new ContentPolicyOTLPSpanExporter(new OTLPTraceExporter({ timeoutMillis: OTLP_EXPORT_TIMEOUT_MILLIS }), contentCaptureMode);
211
+ logger.info({ contentCaptureMode }, "Tracing: OTLP output enabled");
212
+ return new BatchSpanProcessor(otlpExporter);
213
+ }
214
+ catch (err) {
215
+ logger.warn({ err: err.message }, "Failed to set up OTLP exporter — OTLP export disabled, MongoDB tracing unaffected");
216
+ return null;
217
+ }
218
+ }
219
+ /** Retry interval (seconds) for the background trace-store reconnection. */
220
+ function getRetryIntervalSeconds() {
221
+ const raw = Number(process.env["AGENTIC_TRACE_STORE_RETRY_INTERVAL_SECONDS"]);
222
+ return Number.isFinite(raw) && raw > 0 ? raw : 30;
223
+ }
224
+ export async function setupTracing(args = {}) {
225
+ if (tracerProvider !== null) {
226
+ logger.debug("Tracing already initialized");
227
+ return;
228
+ }
229
+ // Serialize concurrent callers onto the first call's promise. Cleared in
230
+ // `finally` so a degraded run (e.g. OTEL deps absent) can be retried later.
231
+ if (setupPromise !== null)
232
+ return setupPromise;
233
+ setupPromise = doSetupTracing(args).finally(() => {
234
+ setupPromise = null;
235
+ });
236
+ return setupPromise;
237
+ }
238
+ async function doSetupTracing(args) {
239
+ const serviceName = args.serviceName ?? "runner-sdk";
240
+ const spanProcessors = [new ExecutionContextSpanProcessor()];
241
+ const { collection, errorMessage } = await resolveTracingCollection(args);
242
+ if (args.mongodbUri) {
243
+ // A store URI was configured — register the lazy Mongo exporter up front
244
+ // (the provider is built once, below, with it in the processor list). If
245
+ // the store was reachable at startup, wire the collection in immediately;
246
+ // otherwise leave it unset and retry in the background.
247
+ const lazy = new LazyMongoSpanExporter();
248
+ lazyMongoExporter = lazy;
249
+ spanProcessors.push(new BatchSpanProcessor(lazy));
250
+ if (collection) {
251
+ lazy.setCollection(collection);
252
+ mongodbExporterAttached = true;
253
+ mongodbDegraded = false;
254
+ logger.info({ db: collection.dbName, collection: collection.collectionName }, "Tracing: MongoDB output enabled");
255
+ }
256
+ else {
257
+ mongodbDegraded = true;
258
+ const intervalSec = getRetryIntervalSeconds();
259
+ logger.error(`Trace store unavailable at startup; will retry every ${intervalSec}s. Error: ${errorMessage ?? "unknown"}`);
260
+ startMongoRetry(args);
261
+ }
262
+ }
263
+ const otlpProcessor = await buildOtlpSpanProcessor();
264
+ if (otlpProcessor !== null)
265
+ spanProcessors.push(otlpProcessor);
266
+ const provider = new BasicTracerProvider({
267
+ resource: resourceFromAttributes({
268
+ "service.name": serviceName,
269
+ }),
270
+ spanProcessors,
271
+ });
272
+ trace.setGlobalTracerProvider(provider);
273
+ tracerProvider = provider;
274
+ // Restrict the global propagator to W3C trace-context only, mirroring
275
+ // Python's set_global_textmap(TraceContextTextMapPropagator()). The API's
276
+ // own default (once anything registers a composite propagator, e.g. an
277
+ // auto-instrumentation package) also propagates Baggage, which would leak
278
+ // arbitrary unredacted key/value pairs onto every outbound call that goes
279
+ // through the global propagator once something starts writing to it.
280
+ // AER/Tool-Pod -> OE calls (tls_client.ts's fetchPlatform) already sidestep
281
+ // this by injecting through their own local propagator instance regardless
282
+ // of this setting, but this closes the gap for any future code path that
283
+ // uses the global API directly.
284
+ propagation.setGlobalPropagator(new W3CTraceContextPropagator());
285
+ runInstrumentor();
286
+ logger.info({ serviceName }, "Tracing enabled");
287
+ }
288
+ export function runInstrumentor() {
289
+ const instrumentor = getInstrumentor();
290
+ if (instrumentor === null) {
291
+ logger.warn("No instrumentor hook registered. Framework SDK should call registerInstrumentor() to enable tracing.");
292
+ return;
293
+ }
294
+ try {
295
+ instrumentor();
296
+ logger.info("Framework instrumentation enabled");
297
+ }
298
+ catch (err) {
299
+ logger.warn({ err: err.message }, "Framework instrumentor failed — tracing disabled");
300
+ }
301
+ }
302
+ export async function shutdownTracing() {
303
+ // Signal in-flight retry attempts to stop before tearing down the provider
304
+ // they attach exporters to. Set before clearing the timer so an attempt
305
+ // that resumes mid-shutdown sees the flag and cleans up its own client
306
+ // rather than rescheduling or overwriting `tracingMongoClient`.
307
+ retryStopped = true;
308
+ // Cleared unconditionally so a partially-failed setup
309
+ // (provider never created but retry scheduled) still cleans up.
310
+ if (retryTimer !== null) {
311
+ clearTimeout(retryTimer);
312
+ retryTimer = null;
313
+ }
314
+ if (tracerProvider !== null) {
315
+ await tracerProvider.shutdown();
316
+ tracerProvider = null;
317
+ logger.info("Tracing shutdown complete");
318
+ }
319
+ if (tracingMongoClient !== null) {
320
+ try {
321
+ await tracingMongoClient.close();
322
+ }
323
+ catch (err) {
324
+ logger.warn(`Tracing MongoClient close failed: ${err.message}`);
325
+ }
326
+ tracingMongoClient = null;
327
+ }
328
+ // Reset store-exporter state so a fresh setupTracing() in the same
329
+ // process (e.g. tests) starts clean.
330
+ mongodbExporterAttached = false;
331
+ mongodbDegraded = false;
332
+ lazyMongoExporter = null;
333
+ }
334
+ /**
335
+ * Snapshot of the database trace-store exporter for /health. Mirrors Python's
336
+ * `tracing_status`: `"attached"` (MongoDB span processor live), `"degraded"`
337
+ * (store URI configured but unreachable at startup, retrying), or `"disabled"`
338
+ * (no store URI configured, not a degradation).
339
+ */
340
+ export function tracingStatus() {
341
+ if (mongodbExporterAttached)
342
+ return { database_exporter: "attached" };
343
+ if (mongodbDegraded)
344
+ return { database_exporter: "degraded" };
345
+ return { database_exporter: "disabled" };
346
+ }
347
+ /**
348
+ * Wire the recovered trace-store collection into the lazy Mongo exporter
349
+ * registered at setup time. Called from the background retry loop
350
+ * once a failed connection recovers. Idempotent — a no-op if already attached.
351
+ * New spans created after this call route to the store; spans emitted while the
352
+ * store was unreachable are not retroactively recovered.
353
+ */
354
+ export function attachMongoTracing(collection) {
355
+ if (mongodbExporterAttached)
356
+ return;
357
+ if (lazyMongoExporter === null) {
358
+ logger.warn("Cannot attach MongoDB tracing: no store URI was configured at setup");
359
+ return;
360
+ }
361
+ lazyMongoExporter.setCollection(collection);
362
+ mongodbExporterAttached = true;
363
+ mongodbDegraded = false;
364
+ if (retryTimer !== null) {
365
+ clearTimeout(retryTimer);
366
+ retryTimer = null;
367
+ }
368
+ logger.info({ db: collection.dbName, collection: collection.collectionName }, "Tracing: MongoDB output attached (trace store recovered)");
369
+ }
370
+ /**
371
+ * Schedule a retry attempt. The timer is unref'd: TOOL_FUNCTION runtimes
372
+ * return after a single invocation without calling shutdownTracing, so a
373
+ * referenced retry timer would pin the event loop and keep the supposedly
374
+ * one-shot process alive while the store is down (Python's retry thread is a
375
+ * daemon for the same reason). The retry is best-effort background work — it
376
+ * must never be the handle keeping the process running.
377
+ */
378
+ function scheduleRetry(attempt, intervalMs) {
379
+ const timer = setTimeout(attempt, intervalMs);
380
+ if (typeof timer.unref === "function")
381
+ timer.unref();
382
+ return timer;
383
+ }
384
+ /** Retry the trace-store connection in the background. */
385
+ function startMongoRetry(args) {
386
+ if (mongodbExporterAttached)
387
+ return;
388
+ if (retryTimer !== null)
389
+ return;
390
+ retryStopped = false;
391
+ const intervalMs = getRetryIntervalSeconds() * 1000;
392
+ const runAttempt = async () => {
393
+ retryTimer = null;
394
+ if (mongodbExporterAttached || retryStopped)
395
+ return;
396
+ const { collection, errorMessage } = await resolveTracingCollection(args);
397
+ // Shutdown may have raced with this attempt while it was awaiting the
398
+ // store connection. `resolveTracingCollection` already assigned a fresh
399
+ // client to `tracingMongoClient` on success — close it so its pool
400
+ // doesn't leak, then bail without rescheduling.
401
+ if (retryStopped) {
402
+ if (tracingMongoClient !== null) {
403
+ try {
404
+ await tracingMongoClient.close();
405
+ }
406
+ catch {
407
+ // best-effort cleanup
408
+ }
409
+ tracingMongoClient = null;
410
+ }
411
+ return;
412
+ }
413
+ if (collection) {
414
+ attachMongoTracing(collection);
415
+ }
416
+ else {
417
+ logger.debug(`Trace store retry failed: ${errorMessage ?? "unknown"}`);
418
+ if (!mongodbExporterAttached && !retryStopped) {
419
+ retryTimer = scheduleRetry(runAttempt, intervalMs);
420
+ }
421
+ }
422
+ };
423
+ retryTimer = scheduleRetry(runAttempt, intervalMs);
424
+ }
425
+ export function getCurrentTraceContext() {
426
+ const span = trace.getActiveSpan();
427
+ if (!span)
428
+ return { traceId: null, spanId: null };
429
+ const ctx = span.spanContext();
430
+ if (!isSpanContextValid(ctx))
431
+ return { traceId: null, spanId: null };
432
+ return { traceId: ctx.traceId, spanId: ctx.spanId };
433
+ }
434
+ export function getTracer(name = "runner-sdk") {
435
+ return trace.getTracer(name);
436
+ }
@@ -0,0 +1,204 @@
1
+ /**
2
+ * Utility functions for Runner SDK.
3
+ */
4
+ /** Runtime mode for the Runner SDK. */
5
+ export declare enum RuntimeMode {
6
+ AER = "aer",
7
+ TOOL = "tool",
8
+ TOOL_FUNCTION = "tool_function"
9
+ }
10
+ /**
11
+ * Get the current runtime mode from environment variable.
12
+ *
13
+ * @returns RuntimeMode based on RUNNER_MODE environment variable.
14
+ * @throws Error If RUNNER_MODE is not set or is not a valid mode.
15
+ */
16
+ export declare function getRuntimeMode(): RuntimeMode;
17
+ /**
18
+ * Return `true` if `name` matches a platform-owned env var.
19
+ *
20
+ * Public-API view of the same membership check used by `tenantEnvVars`.
21
+ */
22
+ export declare function isPlatformEnvVar(name: string): boolean;
23
+ /**
24
+ * Return the tenant-owned subset of environment variables.
25
+ *
26
+ * `source` defaults to `process.env`. Names in `PLATFORM_ENV_VARS` or
27
+ * matching any prefix in `PLATFORM_ENV_VAR_PREFIXES` are excluded, so the
28
+ * result is safe to pass as the substitution mapping to
29
+ * `loadRuntimeAgentConfig({ envVars: ... })`.
30
+ */
31
+ export declare function tenantEnvVars(source?: Record<string, string | undefined>): Record<string, string>;
32
+ /** Get environment variable with default. */
33
+ export declare function getEnv(name: string, defaultValue?: string): string;
34
+ /** Get integer environment variable with default. */
35
+ export declare function getEnvInt(name: string, defaultValue: number): number;
36
+ /** Get float environment variable with default. */
37
+ export declare function getEnvFloat(name: string, defaultValue: number): number;
38
+ /** Get boolean environment variable with default. */
39
+ export declare function getEnvBool(name: string, defaultValue?: boolean): boolean;
40
+ /**
41
+ * Get the HTTP request timeout from environment.
42
+ *
43
+ * Uses RUNNER_REQUEST_TIMEOUT env var, defaults to 60.0 seconds.
44
+ */
45
+ export declare function getRequestTimeout(): number;
46
+ /**
47
+ * Get the tool-call read timeout from environment.
48
+ *
49
+ * The OE holds /tool/execute open until the tool result comes back, so this
50
+ * bounds the tool's own runtime rather than the handshake. It matches the OE's
51
+ * own tool deadline: a smaller value abandons a tool the platform is still
52
+ * happily running, leaving the SDK with no result to report.
53
+ *
54
+ * Uses RUNNER_TOOL_READ_TIMEOUT env var, defaults to 600.0 seconds.
55
+ */
56
+ export declare function getToolReadTimeout(): number;
57
+ export declare const LLM_MAX_RETRIES: number;
58
+ export declare const LLM_INITIAL_BACKOFF: number;
59
+ export declare const LLM_BACKOFF_MULTIPLIER: number;
60
+ export declare const LLM_MAX_BACKOFF: number;
61
+ /** Same-step retries of /tool/execute (and the SSE relay) after OE advertises retryable=true, and after an SSE transport disconnect. 1 initial + 2 extras; lockstep with Python. */
62
+ export declare const OE_RETRYABLE_MAX_ATTEMPTS = 3;
63
+ /**
64
+ * Wait after a dropped SSE connection so the next attempt can land after
65
+ * dispatch_heartbeat TTL (30s). Do not reuse HTTP Retry-After's 10s cap.
66
+ * Lockstep with Python.
67
+ */
68
+ export declare const OE_DISPATCH_TAKEOVER_RETRY_DELAY_MS = 30000;
69
+ export declare const OE_DISPATCH_RETRY_MAX_WAIT_MS = 60000;
70
+ /** Honor a server-provided SSE retry_after_ms, capped. Absent means retry immediately. */
71
+ export declare function oeStreamRetryDelayMs(retryAfterMs?: number | null): number;
72
+ /** Sleep before an SSE same-URL retry. Tests spy this to avoid wall-clock waits. */
73
+ export declare const oeStreamRetry: {
74
+ sleep(delayMs: number): Promise<void>;
75
+ };
76
+ export declare const LLM_READ_TIMEOUT: number;
77
+ /** Classify provider failures before any LLM output has been exposed. */
78
+ export declare function isRetryableError(error: unknown): boolean;
79
+ /**
80
+ * Render an LLM provider error for display, without escaped-JSON text.
81
+ *
82
+ * Some provider SDKs attach the raw API error body as an object on the
83
+ * error or its `cause` (`.details`, `.body`). That object's values are
84
+ * often themselves JSON-encoded strings containing real newlines (e.g. a
85
+ * pretty-printed nested error payload), so `String()`/template-literal
86
+ * stringification ends up producing a repr that turns the newlines into
87
+ * literal `\n` sequences. Decode any JSON-encoded string values
88
+ * first and re-serialize with `JSON.stringify(..., null, 2)` so the result
89
+ * renders as readable, indented JSON instead.
90
+ */
91
+ export declare function formatLlmError(error: unknown): string;
92
+ /**
93
+ * True when an LLM provider error is an auth rejection (HTTP 401/403).
94
+ *
95
+ * Reads only the provider SDK's own status fields — `status` (openai-node /
96
+ * anthropic-node style), `status_code`, `response.status` /
97
+ * `response.status_code` (fetch/axios style), and an integer `code` —
98
+ * walking the `cause` chain because adapters occasionally re-throw. Text is
99
+ * never matched: the caller maps a positive result onto the wire-level
100
+ * credential error code, and anything unrecognized returns false so the
101
+ * failure keeps its existing generic classification.
102
+ */
103
+ export declare function isLlmCredentialRejection(error: unknown): boolean;
104
+ /**
105
+ * Normalize LLM message content to a string.
106
+ *
107
+ * LLM content can be:
108
+ * - A string (normal text)
109
+ * - A list (multimodal content with text and other parts)
110
+ * - null/undefined or empty
111
+ *
112
+ * This handles cases where LangChain's AIMessageChunk.content is a list
113
+ * of content blocks (e.g., from Gemini multimodal responses) rather than
114
+ * a simple string.
115
+ *
116
+ * @param content The content to normalize (string, list, or null/undefined)
117
+ * @returns A string representation of the content
118
+ */
119
+ export declare function normalizeContent(content: unknown): string;
120
+ /** Normalize streamed tool-call args into the wire-format string payload. */
121
+ export declare function normalizeToolCallArgs(args: unknown): string | null;
122
+ /**
123
+ * Trim a string tool-metadata value, collapsing blank/non-string to null.
124
+ *
125
+ * Shared by the framework SDKs' tool-wrapping code so metadata values written
126
+ * as "" or " " are treated the same as absent rather
127
+ * than sent to the OE as a non-empty-looking but meaningless string.
128
+ */
129
+ export declare function normalizeOptionalStr(value: unknown): string | null;
130
+ /** Remove `<think>...</think>` blocks and unclosed `<think>` tails. */
131
+ export declare function stripThinking(text: string): string;
132
+ /**
133
+ * Filter `<think>` blocks from a stream of token chunks.
134
+ *
135
+ * Accumulates text in *buffer* until we can determine whether content
136
+ * is inside a thinking block. Returns `[streamable, newBuffer, inside]`
137
+ * where *streamable* is the text safe to send to the client.
138
+ */
139
+ export declare function filterThinkingTokens(token: string, buffer: string, inside: boolean): [streamable: string, newBuffer: string, inside: boolean];
140
+ /** Log a minor section separator (for individual operations). */
141
+ export declare function logSeparator(): void;
142
+ /** Log a major section separator (for execution boundaries). */
143
+ export declare function logSection(): void;
144
+ /**
145
+ * Log LLM conversation messages in a consistent format.
146
+ *
147
+ * @param messages List of message dicts or LangChain message objects
148
+ * @param prefix Log line prefix (e.g., "OE", "LLM", "AER")
149
+ * @param countOnly If true, only log message count (for info level)
150
+ */
151
+ export declare function logLLMMessages(messages: unknown[], prefix?: string, countOnly?: boolean): void;
152
+ /**
153
+ * Log an LLM response in a consistent format.
154
+ *
155
+ * @param result LLM response (dict or AIMessage)
156
+ * @param step Step number
157
+ * @param prefix Log line prefix
158
+ */
159
+ export declare function logLLMResponse(result: unknown, step: number, prefix?: string): void;
160
+ /**
161
+ * Redact sensitive fields from an arguments record.
162
+ *
163
+ * Returns a copy with each listed field replaced by "[REDACTED]"; unlisted
164
+ * fields pass through unchanged, and an empty list returns the input as-is.
165
+ */
166
+ export declare function redactFields(data: Record<string, unknown>, fieldsToRedact: readonly string[]): Record<string, unknown>;
167
+ /**
168
+ * Extract a tool's `redact_fields` policy from its registered definition.
169
+ * The definition is an opaque metadata record (framework-SDK populated), so
170
+ * non-string-array values degrade to no redaction rather than throwing.
171
+ */
172
+ export declare function toolRedactFields(toolDefinitions: Record<string, Record<string, unknown>>, toolName: string | undefined): readonly string[];
173
+ /**
174
+ * Log a tool execution request.
175
+ *
176
+ * @param toolName Name of the tool
177
+ * @param args Tool arguments
178
+ * @param step Step number
179
+ * @param prefix Log line prefix
180
+ * @param fieldsToRedact Catalog sensitive-field policy. Matching fields omit
181
+ * even their type/length metadata; no values are logged.
182
+ */
183
+ export declare function logToolRequest(toolName: string, args: Record<string, unknown>, step: number, prefix?: string, fieldsToRedact?: readonly string[]): void;
184
+ /**
185
+ * Log a tool execution result.
186
+ *
187
+ * @param toolName Name of the tool
188
+ * @param step Step number
189
+ * @param status Execution status (success, error, suspend, interrupted)
190
+ * @param result Tool result
191
+ * @param error Error message if failed
192
+ * @param durationMs Execution duration in milliseconds
193
+ * @param prefix Log line prefix
194
+ */
195
+ export declare function logToolResult(toolName: string, step: number, status: string, result?: unknown, error?: string | null, durationMs?: number, prefix?: string): void;
196
+ /** Log that a cached result is being used (replay scenario). */
197
+ export declare function logCachedResult(toolName: string, step: number, prefix?: string): void;
198
+ /** Log that a tool call was blocked by policy. */
199
+ export declare function logPolicyBlocked(toolName: string, step: number, reason: string, prefix?: string): void;
200
+ /** Log the start of an execution. */
201
+ export declare function logExecutionStart(executionId: string, inputKeys: string[], prefix?: string): void;
202
+ /** Log an execution callback (completion/suspension/error). */
203
+ export declare function logExecutionCallback(executionId: string, status: string, result?: unknown, error?: string | null, suspendReason?: string | null, prefix?: string): void;
204
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,uCAAuC;AACvC,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,IAAI,SAAS;IAOb,aAAa,kBAAkB;CAChC;AAQD;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAe5C;AAoID;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKtD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAC1C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASxB;AAMD,6CAA6C;AAC7C,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,SAAK,GAAG,MAAM,CAE9D;AAED,qDAAqD;AACrD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE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