{"version":3,"file":"logSinkTelemetry-CAUggQQ0.mjs","names":[],"sources":["../src/services/logSinkTelemetry/index.ts"],"sourcesContent":["import { createDoomTelemetry, type DoomTelemetry, type DoomTelemetryOptions } from '@agimon-ai/doompi-telemetry';\n\nconst SERVICE_NAME = 'doom-plan';\nconst PACKAGE_NAME = '@agimon-ai/doompi-plan';\n\nexport const PLAN_EVENT = {\n  configLoadFailed: 'doom_plan.config_load_failed',\n  writePlanFailed: 'doom_plan.write_plan_failed',\n  writePlanTimedOut: 'doom_plan.write_plan_timed_out',\n  writePlanUnsafePath: 'doom_plan.write_plan_unsafe_path',\n  modelResolveFailed: 'doom_plan.model_resolve_failed',\n  modeEnabled: 'doom_plan.mode_enabled',\n  modeDisabled: 'doom_plan.mode_disabled',\n  planWritten: 'doom_plan.plan_written',\n  planPointerFailed: 'doom_plan.plan_pointer_failed',\n  planReviewCompleted: 'doom_plan.plan_review_completed',\n} as const;\n\nexport type PlanEventName = (typeof PLAN_EVENT)[keyof typeof PLAN_EVENT];\nexport type PlanEventAttributes = Record<string, string | number | boolean>;\n\nexport interface PlanTelemetryOptions {\n  cwd?: string;\n  workspaceRoot?: string;\n  env?: NodeJS.ProcessEnv;\n  telemetryFactory?: NonNullable<DoomTelemetryOptions['telemetryFactory']>;\n  warn?: (message: string) => void;\n}\n\nexport interface PlanTelemetry {\n  recordError(event: PlanEventName, error: unknown, attributes?: PlanEventAttributes): Promise<void>;\n  recordWarning(event: PlanEventName, error: unknown, attributes?: PlanEventAttributes): Promise<void>;\n  recordEvent(event: PlanEventName, attributes?: PlanEventAttributes): Promise<void>;\n  flush(): Promise<void>;\n  shutdown(): Promise<void>;\n}\n\nexport function createPlanTelemetry(options: PlanTelemetryOptions = {}): PlanTelemetry {\n  const telemetry: DoomTelemetry = createDoomTelemetry({\n    serviceName: SERVICE_NAME,\n    packageName: PACKAGE_NAME,\n    cwd: options.cwd,\n    workspaceRoot: options.workspaceRoot,\n    env: options.env,\n    telemetryFactory: options.telemetryFactory,\n    warn: options.warn,\n    enableLogs: true,\n    enableTraces: true,\n  });\n  return {\n    recordError: (event, error, attributes) => telemetry.recordError(event, error, attributes),\n    recordWarning: (event, error, attributes) => telemetry.recordWarning(event, error, attributes),\n    recordEvent: (event, attributes) => telemetry.recordEvent(event, attributes),\n    flush: () => telemetry.flush(),\n    shutdown: () => telemetry.shutdown(),\n  };\n}\n"],"mappings":";;AAEA,MAAM,eAAe;AACrB,MAAM,eAAe;AAErB,MAAa,aAAa;CACxB,kBAAkB;CAClB,iBAAiB;CACjB,mBAAmB;CACnB,qBAAqB;CACrB,oBAAoB;CACpB,aAAa;CACb,cAAc;CACd,aAAa;CACb,mBAAmB;CACnB,qBAAqB;AACvB;AAqBA,SAAgB,oBAAoB,UAAgC,CAAC,GAAkB;CACrF,MAAM,YAA2B,oBAAoB;EACnD,aAAa;EACb,aAAa;EACb,KAAK,QAAQ;EACb,eAAe,QAAQ;EACvB,KAAK,QAAQ;EACb,kBAAkB,QAAQ;EAC1B,MAAM,QAAQ;EACd,YAAY;EACZ,cAAc;CAChB,CAAC;CACD,OAAO;EACL,cAAc,OAAO,OAAO,eAAe,UAAU,YAAY,OAAO,OAAO,UAAU;EACzF,gBAAgB,OAAO,OAAO,eAAe,UAAU,cAAc,OAAO,OAAO,UAAU;EAC7F,cAAc,OAAO,eAAe,UAAU,YAAY,OAAO,UAAU;EAC3E,aAAa,UAAU,MAAM;EAC7B,gBAAgB,UAAU,SAAS;CACrC;AACF"}