elasticdash-test 0.1.18-alpha-19 → 0.1.18-alpha-21
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/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -103,3 +103,11 @@ export type { AgentTask, AgentPlan, AgentState, AgentTaskStatus, AgentPlanStatus
|
|
|
103
103
|
export { startPortalServer } from './portal-server.js'
|
|
104
104
|
export { executePortalTask } from './portal-executor.js'
|
|
105
105
|
export type { PortalTask, PortalTaskResult, PortalServerOptions, PortalServerHandle, PortalStatus } from './types/portal.js'
|
|
106
|
+
|
|
107
|
+
// ─── Eager auto-init ────────────────────────────────────────
|
|
108
|
+
// When ELASTICDASH_API_KEY is set, automatically initialise observability mode
|
|
109
|
+
// at import time so the socket connection is established immediately (e.g. for
|
|
110
|
+
// onboarding detection). tryAutoInitHttpContext is idempotent and deduplicates
|
|
111
|
+
// concurrent calls, so this is safe even if interceptors trigger it again later.
|
|
112
|
+
import { tryAutoInitHttpContext } from './interceptors/telemetry-push.js'
|
|
113
|
+
tryAutoInitHttpContext().catch(() => {})
|
|
@@ -436,7 +436,8 @@ export function installAIInterceptor(): void {
|
|
|
436
436
|
const ctx = getCaptureContext()
|
|
437
437
|
|
|
438
438
|
// Observability-only mode: no trace handle, no capture context — record via pushTelemetryEvent
|
|
439
|
-
|
|
439
|
+
// Skip when inside a wrapAI call to avoid duplicate events (wrapAI records its own)
|
|
440
|
+
if (!traceAtCall && !ctx && obsCtx && !isAIWrapperActive()) {
|
|
440
441
|
const id = obsCtx.nextId()
|
|
441
442
|
const start = rawDateNow()
|
|
442
443
|
const eventInput = { url, provider, model, prompt, messages }
|
|
@@ -476,7 +477,8 @@ export function installAIInterceptor(): void {
|
|
|
476
477
|
}
|
|
477
478
|
|
|
478
479
|
// HTTP mode (no capture context): replay frozen AI events or execute live + push telemetry
|
|
479
|
-
|
|
480
|
+
// Skip when inside a wrapAI call to avoid duplicate events (wrapAI records its own)
|
|
481
|
+
if (!ctx && httpCtx && !isAIWrapperActive()) {
|
|
480
482
|
const id = httpCtx.nextId()
|
|
481
483
|
const eventInput = { url, provider, model, prompt, messages }
|
|
482
484
|
|