@ai-setting/roy-agent-core 1.7.52 → 1.7.53
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/config/config-component.d.ts +346 -0
- package/dist/config/config-parser.d.ts +45 -0
- package/dist/config/env-key.d.ts +97 -0
- package/dist/config/env-source.d.ts +113 -0
- package/dist/config/file-source.d.ts +90 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/protocol-resolver.d.ts +94 -0
- package/dist/env/agent/agent-component.d.ts +646 -0
- package/dist/env/agent/agent-config-registration.d.ts +18 -0
- package/dist/env/agent/agent-registry.d.ts +500 -0
- package/dist/env/agent/index.d.ts +9 -0
- package/dist/env/agent/summary-agent.d.ts +44 -0
- package/dist/env/agent/types.d.ts +503 -0
- package/dist/env/commands/commands-component.d.ts +97 -0
- package/dist/env/commands/commands-config-registration.d.ts +19 -0
- package/dist/env/commands/index.d.ts +7 -0
- package/dist/env/commands/parser.d.ts +18 -0
- package/dist/env/commands/types.d.ts +133 -0
- package/dist/env/component.d.ts +186 -0
- package/dist/env/constants.d.ts +112 -0
- package/dist/env/context/env-context.d.ts +420 -0
- package/dist/env/context/env-event.d.ts +144 -0
- package/dist/env/context/index.d.ts +13 -0
- package/dist/env/debug/debug-component.d.ts +160 -0
- package/dist/env/debug/formatters/index.d.ts +8 -0
- package/dist/env/debug/formatters/repl-formatter.d.ts +80 -0
- package/dist/env/debug/formatters/trace-formatter.d.ts +43 -0
- package/dist/env/debug/formatters/tree-formatter.d.ts +72 -0
- package/dist/env/debug/index.d.ts +15 -0
- package/dist/env/debug/index.js +1 -1
- package/dist/env/debug/parser/regex-parser.d.ts +49 -0
- package/dist/env/debug/parser/span-builder.d.ts +79 -0
- package/dist/env/debug/reader/log-reader.d.ts +55 -0
- package/dist/env/debug/reader/span-db-reader.d.ts +70 -0
- package/dist/env/debug/types.d.ts +145 -0
- package/dist/env/environment.d.ts +185 -0
- package/dist/env/errors.d.ts +120 -0
- package/dist/env/event-source/bounty-cli-handler.d.ts +42 -0
- package/dist/env/event-source/bounty-im-handler.d.ts +232 -0
- package/dist/env/event-source/event-source-component.d.ts +177 -0
- package/dist/env/event-source/event-source-config-registration.d.ts +18 -0
- package/dist/env/event-source/event-source-handlers.d.ts +486 -0
- package/dist/env/event-source/event-store.d.ts +110 -0
- package/dist/env/event-source/idempotency-key.d.ts +19 -0
- package/dist/env/event-source/index.d.ts +15 -0
- package/dist/env/event-source/index.js +2 -2
- package/dist/env/event-source/timer-handler.d.ts +74 -0
- package/dist/env/event-source/types.d.ts +803 -0
- package/dist/env/hook/global-hook-manager.d.ts +73 -0
- package/dist/env/hook/hook-manager.d.ts +139 -0
- package/dist/env/hook/index.d.ts +9 -0
- package/dist/env/hook/types.d.ts +107 -0
- package/dist/env/index.d.ts +24 -0
- package/dist/env/index.js +4 -4
- package/dist/env/interface.d.ts +156 -0
- package/dist/env/lark-mention-utils.d.ts +59 -0
- package/dist/env/llm/adapter-ai-sdk.d.ts +10 -0
- package/dist/env/llm/adapter-pi-ai.d.ts +39 -0
- package/dist/env/llm/adapter.d.ts +80 -0
- package/dist/env/llm/factory.d.ts +13 -0
- package/dist/env/llm/hooks.d.ts +150 -0
- package/dist/env/llm/index.d.ts +16 -0
- package/dist/env/llm/invoke.d.ts +264 -0
- package/dist/env/llm/llm-cache.d.ts +38 -0
- package/dist/env/llm/llm.d.ts +238 -0
- package/dist/env/llm/opencode-session.d.ts +79 -0
- package/dist/env/llm/provider.d.ts +40 -0
- package/dist/env/llm/tool-args-parser.d.ts +77 -0
- package/dist/env/llm/tool-schema.d.ts +54 -0
- package/dist/env/llm/transform.d.ts +57 -0
- package/dist/env/llm/types.d.ts +818 -0
- package/dist/env/log-trace/decorator.d.ts +88 -0
- package/dist/env/log-trace/index.d.ts +14 -0
- package/dist/env/log-trace/log-trace-component.d.ts +268 -0
- package/dist/env/log-trace/log-trace-config-registration.d.ts +25 -0
- package/dist/env/log-trace/logger.d.ts +83 -0
- package/dist/env/log-trace/opentelemetry/cli-propagation.d.ts +105 -0
- package/dist/env/log-trace/opentelemetry/mod.d.ts +24 -0
- package/dist/env/log-trace/opentelemetry/propagation-env.d.ts +81 -0
- package/dist/env/log-trace/opentelemetry/propagation.d.ts +79 -0
- package/dist/env/log-trace/opentelemetry/tracer-provider.d.ts +157 -0
- package/dist/env/log-trace/span-storage.d.ts +37 -0
- package/dist/env/log-trace/trace-context.d.ts +28 -0
- package/dist/env/log-trace/types.d.ts +127 -0
- package/dist/env/mcp/command-resolver.d.ts +12 -0
- package/dist/env/mcp/config.d.ts +103 -0
- package/dist/env/mcp/index.d.ts +13 -0
- package/dist/env/mcp/loader.d.ts +78 -0
- package/dist/env/mcp/mcp-component.d.ts +54 -0
- package/dist/env/mcp/mcp-config-registration.d.ts +19 -0
- package/dist/env/mcp/npm-prefix/index.d.ts +17 -0
- package/dist/env/mcp/scanner.d.ts +38 -0
- package/dist/env/mcp/tool/adapter.d.ts +32 -0
- package/dist/env/mcp/tool/index.d.ts +4 -0
- package/dist/env/mcp/types.d.ts +131 -0
- package/dist/env/memory/built-in/index.d.ts +41 -0
- package/dist/env/memory/built-in/recall-memory.d.ts +29 -0
- package/dist/env/memory/built-in/record-memory.d.ts +44 -0
- package/dist/env/memory/index.d.ts +10 -0
- package/dist/env/memory/memory-component.d.ts +114 -0
- package/dist/env/memory/memory-config-registration.d.ts +18 -0
- package/dist/env/memory/memory-config.d.ts +18 -0
- package/dist/env/memory/plugin/index.d.ts +16 -0
- package/dist/env/memory/plugin/memory-agent.d.ts +126 -0
- package/dist/env/memory/plugin/memory-manager.d.ts +71 -0
- package/dist/env/memory/plugin/memory-plugin.d.ts +103 -0
- package/dist/env/memory/plugin/recall-memory.d.ts +16 -0
- package/dist/env/memory/plugin/types.d.ts +75 -0
- package/dist/env/memory/tools/memory-agent-tools.d.ts +109 -0
- package/dist/env/memory/types.d.ts +80 -0
- package/dist/env/paths.d.ts +46 -0
- package/dist/env/plugin/bounty-cli-notification-channel.d.ts +60 -0
- package/dist/env/plugin/event-bus-notification-channel.d.ts +50 -0
- package/dist/env/plugin/index.d.ts +13 -0
- package/dist/env/plugin/lark-cli-notification-channel.d.ts +61 -0
- package/dist/env/plugin/notification-channel.d.ts +143 -0
- package/dist/env/plugin/plugin-component.d.ts +232 -0
- package/dist/env/plugin/types.d.ts +146 -0
- package/dist/env/prompt/index.d.ts +7 -0
- package/dist/env/prompt/prompt-component.d.ts +194 -0
- package/dist/env/prompt/prompt-config-registration.d.ts +18 -0
- package/dist/env/prompt/prompt-store.d.ts +26 -0
- package/dist/env/prompt/prompts-index.d.ts +146 -0
- package/dist/env/prompt/renderer.d.ts +21 -0
- package/dist/env/prompt/types.d.ts +176 -0
- package/dist/env/session/hooks.d.ts +14 -0
- package/dist/env/session/index.d.ts +19 -0
- package/dist/env/session/search-query-parser.d.ts +41 -0
- package/dist/env/session/session-component.d.ts +464 -0
- package/dist/env/session/session-config-registration.d.ts +18 -0
- package/dist/env/session/session-id.d.ts +26 -0
- package/dist/env/session/session-message-converter.d.ts +142 -0
- package/dist/env/session/session-store.d.ts +188 -0
- package/dist/env/session/storage/index.d.ts +5 -0
- package/dist/env/session/storage/memory.d.ts +119 -0
- package/dist/env/session/storage/sqlite.d.ts +108 -0
- package/dist/env/session/types.d.ts +705 -0
- package/dist/env/session-tree-stopper.d.ts +79 -0
- package/dist/env/skill/config.d.ts +13 -0
- package/dist/env/skill/index.d.ts +6 -0
- package/dist/env/skill/parser.d.ts +9 -0
- package/dist/env/skill/scanner.d.ts +25 -0
- package/dist/env/skill/skill-component.d.ts +89 -0
- package/dist/env/skill/skill-config-registration.d.ts +18 -0
- package/dist/env/skill/tool/index.d.ts +1 -0
- package/dist/env/skill/tool/skill-tool.d.ts +15 -0
- package/dist/env/skill/types.d.ts +61 -0
- package/dist/env/task/backend/index.d.ts +24 -0
- package/dist/env/task/backend/index.js +704 -0
- package/dist/env/task/backend/roy-sidecar-task-port.d.ts +148 -0
- package/dist/env/task/backend/sqlite-task-port.d.ts +28 -0
- package/dist/env/task/backend/task-store-backend.d.ts +107 -0
- package/dist/env/task/backend/types.d.ts +293 -0
- package/dist/env/task/delegate/bg-task-id-storage.d.ts +9 -0
- package/dist/env/task/delegate/delegate-tool.d.ts +681 -0
- package/dist/env/task/delegate/index.d.ts +8 -0
- package/dist/env/task/delegate/process-registry.d.ts +58 -0
- package/dist/env/task/delegate/stop-tool.d.ts +12 -0
- package/dist/env/task/delegate/subagent-resolver.d.ts +25 -0
- package/dist/env/task/events/index.d.ts +7 -0
- package/dist/env/task/events/task-event-payloads.d.ts +101 -0
- package/dist/env/task/events/task-event-types.d.ts +23 -0
- package/dist/env/task/hooks/contexts.d.ts +191 -0
- package/dist/env/task/hooks/index.d.ts +7 -0
- package/dist/env/task/hooks/task-hook-points.d.ts +42 -0
- package/dist/env/task/index.d.ts +7 -0
- package/dist/env/task/plugins/auto-task-plugin.d.ts +38 -0
- package/dist/env/task/plugins/card-chat-routing.d.ts +135 -0
- package/dist/env/task/plugins/fake-user-message-helper.d.ts +90 -0
- package/dist/env/task/plugins/index.d.ts +8 -0
- package/dist/env/task/plugins/index.js +1 -1
- package/dist/env/task/plugins/lark-card-action-handler.d.ts +166 -0
- package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +651 -0
- package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +248 -0
- package/dist/env/task/plugins/max-iteration-reminder-plugin.d.ts +112 -0
- package/dist/env/task/plugins/per-task-group-chat-plugin.d.ts +561 -0
- package/dist/env/task/plugins/task-tag-plugin.d.ts +70 -0
- package/dist/env/task/plugins/workflow-extractor-agent.d.ts +43 -0
- package/dist/env/task/registry-hook-installer.d.ts +43 -0
- package/dist/env/task/storage/index.d.ts +5 -0
- package/dist/env/task/storage/migrations/001_add_project_path_context.d.ts +14 -0
- package/dist/env/task/storage/migrations/002_add_task_type.d.ts +14 -0
- package/dist/env/task/storage/migrations/003_add_process_description.d.ts +20 -0
- package/dist/env/task/storage/migrations/004_rename_action_to_milestone.d.ts +37 -0
- package/dist/env/task/storage/migrations/005_convert_blob_description_to_text.d.ts +51 -0
- package/dist/env/task/storage/sqlite-task-store.d.ts +241 -0
- package/dist/env/task/tag-service.d.ts +138 -0
- package/dist/env/task/task-child-context.d.ts +70 -0
- package/dist/env/task/task-component.d.ts +270 -0
- package/dist/env/task/task-config-registration.d.ts +19 -0
- package/dist/env/task/task-creation-registry.d.ts +181 -0
- package/dist/env/task/task-reuse-context.d.ts +52 -0
- package/dist/env/task/task-reuse-registry.d.ts +31 -0
- package/dist/env/task/tools/batch-archive-tool.d.ts +9 -0
- package/dist/env/task/tools/batch-delete-tool.d.ts +9 -0
- package/dist/env/task/tools/complete-tool.d.ts +12 -0
- package/dist/env/task/tools/create-tool.d.ts +6 -0
- package/dist/env/task/tools/delete-tool.d.ts +6 -0
- package/dist/env/task/tools/get-tool.d.ts +6 -0
- package/dist/env/task/tools/index.d.ts +13 -0
- package/dist/env/task/tools/list-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/create-tool.d.ts +12 -0
- package/dist/env/task/tools/operation/delete-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/get-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/index.d.ts +8 -0
- package/dist/env/task/tools/operation/list-tool.d.ts +6 -0
- package/dist/env/task/tools/operation/operation-types.d.ts +225 -0
- package/dist/env/task/tools/operation/update-tool.d.ts +6 -0
- package/dist/env/task/tools/search-tool.d.ts +9 -0
- package/dist/env/task/tools/task-tree-tool.d.ts +65 -0
- package/dist/env/task/tools/task-types.d.ts +255 -0
- package/dist/env/task/tools/update-tool.d.ts +6 -0
- package/dist/env/task/types.d.ts +290 -0
- package/dist/env/tool/built-in/bash-effect.d.ts +36 -0
- package/dist/env/tool/built-in/bash.d.ts +16 -0
- package/dist/env/tool/built-in/echo.d.ts +7 -0
- package/dist/env/tool/built-in/edit-file.d.ts +6 -0
- package/dist/env/tool/built-in/glob.d.ts +6 -0
- package/dist/env/tool/built-in/grep.d.ts +6 -0
- package/dist/env/tool/built-in/index.d.ts +39 -0
- package/dist/env/tool/built-in/query-background-process-tool.d.ts +113 -0
- package/dist/env/tool/built-in/read-file.d.ts +5 -0
- package/dist/env/tool/built-in/understand-image.d.ts +59 -0
- package/dist/env/tool/built-in/write-file.d.ts +5 -0
- package/dist/env/tool/index.d.ts +16 -0
- package/dist/env/tool/registry.d.ts +61 -0
- package/dist/env/tool/tool-component.d.ts +242 -0
- package/dist/env/tool/tool-config-registration.d.ts +18 -0
- package/dist/env/tool/types.d.ts +274 -0
- package/dist/env/tool/validator.d.ts +14 -0
- package/dist/env/types.d.ts +184 -0
- package/dist/env/workflow/decorators/decorator-node.d.ts +76 -0
- package/dist/env/workflow/decorators/edge.d.ts +42 -0
- package/dist/env/workflow/decorators/index.d.ts +13 -0
- package/dist/env/workflow/decorators/node-as.d.ts +40 -0
- package/dist/env/workflow/decorators/workflow.d.ts +30 -0
- package/dist/env/workflow/engine/dag-manager.d.ts +176 -0
- package/dist/env/workflow/engine/engine.d.ts +375 -0
- package/dist/env/workflow/engine/event-bus.d.ts +54 -0
- package/dist/env/workflow/engine/executor.d.ts +122 -0
- package/dist/env/workflow/engine/index.d.ts +15 -0
- package/dist/env/workflow/engine/node-registry.d.ts +159 -0
- package/dist/env/workflow/engine/scheduler.d.ts +164 -0
- package/dist/env/workflow/extractor/workflow-converter.d.ts +55 -0
- package/dist/env/workflow/fixtures.d.ts +401 -0
- package/dist/env/workflow/hooks/index.d.ts +4 -0
- package/dist/env/workflow/hooks/workflow-hook-points.d.ts +161 -0
- package/dist/env/workflow/index.d.ts +30 -0
- package/dist/env/workflow/index.js +1 -1
- package/dist/env/workflow/metadata/keys.d.ts +6 -0
- package/dist/env/workflow/nodes/agent-component-adapter.d.ts +175 -0
- package/dist/env/workflow/nodes/agent-node.d.ts +206 -0
- package/dist/env/workflow/nodes/ask-user-node.d.ts +66 -0
- package/dist/env/workflow/nodes/condition-node.d.ts +39 -0
- package/dist/env/workflow/nodes/index.d.ts +8 -0
- package/dist/env/workflow/nodes/merge-node.d.ts +40 -0
- package/dist/env/workflow/nodes/python-call-node.d.ts +95 -0
- package/dist/env/workflow/nodes/skill-node.d.ts +29 -0
- package/dist/env/workflow/nodes/tool-node.d.ts +58 -0
- package/dist/env/workflow/nodes/workflow-node.d.ts +118 -0
- package/dist/env/workflow/plugins/index.d.ts +6 -0
- package/dist/env/workflow/plugins/lark-cli-workflow-notify-plugin.d.ts +107 -0
- package/dist/env/workflow/plugins/workflow-json-output-plugin.d.ts +166 -0
- package/dist/env/workflow/runtime/runtime-cancellation-scope.d.ts +121 -0
- package/dist/env/workflow/service/index.d.ts +9 -0
- package/dist/env/workflow/service/registry.d.ts +37 -0
- package/dist/env/workflow/service/workflow-service.d.ts +422 -0
- package/dist/env/workflow/storage/index.d.ts +11 -0
- package/dist/env/workflow/storage/mock-repositories.d.ts +106 -0
- package/dist/env/workflow/storage/safe-json.d.ts +62 -0
- package/dist/env/workflow/storage/sqlite.d.ts +57 -0
- package/dist/env/workflow/storage/tag-repo.d.ts +65 -0
- package/dist/env/workflow/storage/workflow-repo.d.ts +161 -0
- package/dist/env/workflow/tools/ask-user-tool.d.ts +35 -0
- package/dist/env/workflow/tools/index.d.ts +16 -0
- package/dist/env/workflow/tools/run-workflow.d.ts +130 -0
- package/dist/env/workflow/tools/submit-json-output-tool.d.ts +38 -0
- package/dist/env/workflow/tools/workflow-add-tool.d.ts +47 -0
- package/dist/env/workflow/tools/workflow-get-tool.d.ts +29 -0
- package/dist/env/workflow/tools/workflow-list-tool.d.ts +55 -0
- package/dist/env/workflow/tools/workflow-run-status-tool.d.ts +26 -0
- package/dist/env/workflow/tools/workflow-run-stop-tool.d.ts +29 -0
- package/dist/env/workflow/tools/workflow-search-tool.d.ts +33 -0
- package/dist/env/workflow/tools/workflow-tag-list-tool.d.ts +59 -0
- package/dist/env/workflow/tools/workflow-validate-tool.d.ts +60 -0
- package/dist/env/workflow/types/context.d.ts +17 -0
- package/dist/env/workflow/types/decorators-types.d.ts +182 -0
- package/dist/env/workflow/types/edge.d.ts +33 -0
- package/dist/env/workflow/types/event.d.ts +869 -0
- package/dist/env/workflow/types/index.d.ts +16 -0
- package/dist/env/workflow/types/run.d.ts +235 -0
- package/dist/env/workflow/types/workflow-error.d.ts +79 -0
- package/dist/env/workflow/types/workflow-hil.d.ts +57 -0
- package/dist/env/workflow/types/workflow-message.d.ts +193 -0
- package/dist/env/workflow/types/workflow-session.d.ts +17 -0
- package/dist/env/workflow/types/workflow.d.ts +654 -0
- package/dist/env/workflow/types_compat.d.ts +10 -0
- package/dist/env/workflow/utils/agent-session-metadata.d.ts +35 -0
- package/dist/env/workflow/utils/build-agent-node-output.d.ts +11 -0
- package/dist/env/workflow/utils/create-workflow.d.ts +35 -0
- package/dist/env/workflow/utils/dependency-prescan.d.ts +67 -0
- package/dist/env/workflow/utils/execution-state.d.ts +46 -0
- package/dist/env/workflow/utils/extract-agent-json-output.d.ts +6 -0
- package/dist/env/workflow/utils/index.d.ts +14 -0
- package/dist/env/workflow/utils/json-schema-to-zod.d.ts +23 -0
- package/dist/env/workflow/utils/node-id-utils.d.ts +20 -0
- package/dist/env/workflow/utils/node-output-contracts.d.ts +137 -0
- package/dist/env/workflow/utils/node-registry-helper.d.ts +36 -0
- package/dist/env/workflow/utils/output-schema-hint.d.ts +7 -0
- package/dist/env/workflow/utils/parse-agent-output-config.d.ts +9 -0
- package/dist/env/workflow/utils/recovery-validator.d.ts +30 -0
- package/dist/env/workflow/utils/sensitive-redact.d.ts +37 -0
- package/dist/env/workflow/utils/session-parser.d.ts +23 -0
- package/dist/env/workflow/utils/session-recovery.d.ts +122 -0
- package/dist/env/workflow/utils/template-contract-validator.d.ts +87 -0
- package/dist/env/workflow/utils/template-resolver.d.ts +285 -0
- package/dist/env/workflow/utils/validate-workflow-definition.d.ts +57 -0
- package/dist/env/workflow/utils/validation-rules.d.ts +103 -0
- package/dist/env/workflow/utils/workflow-message-metadata.d.ts +20 -0
- package/dist/env/workflow/utils/workflow-sanitize.d.ts +51 -0
- package/dist/env/workflow/workflow-component.d.ts +138 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +5 -5
- package/dist/shared/@ai-setting/{roy-agent-core-rcfewbzr.js → roy-agent-core-4sx6sdb2.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-ezgsem94.js → roy-agent-core-ph5qbqcx.js} +1 -1
- package/dist/util/process/process-tree-killer.d.ts +67 -0
- package/dist/utils/id.d.ts +11 -0
- package/dist/utils/loose-json.d.ts +30 -0
- package/dist/utils/media.d.ts +70 -0
- package/dist/utils/temp-file-manager/index.d.ts +99 -0
- package/package.json +4 -2
- /package/dist/shared/@ai-setting/{roy-agent-core-s214vmmd.js → roy-agent-core-4vpk40ss.js} +0 -0
- /package/dist/shared/@ai-setting/{roy-agent-core-pkpkctvf.js → roy-agent-core-hch2geta.js} +0 -0
- /package/dist/shared/@ai-setting/{roy-agent-core-0cfaqnz9.js → roy-agent-core-k25gv86p.js} +0 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Debug Component
|
|
3
|
+
*
|
|
4
|
+
* Provides debugging capabilities for roy-agent applications by parsing
|
|
5
|
+
* trace logs and presenting formatted output.
|
|
6
|
+
*/
|
|
7
|
+
import { BaseComponent, type ComponentConfig } from '../component';
|
|
8
|
+
import { LogReader } from './reader/log-reader';
|
|
9
|
+
import { SpanDbReader } from './reader/span-db-reader';
|
|
10
|
+
import { RegexParser } from './parser/regex-parser';
|
|
11
|
+
import { SpanBuilder } from './parser/span-builder';
|
|
12
|
+
import { TraceFormatter, TreeFormatter } from './formatters';
|
|
13
|
+
import type { ParserOptions, TraceEntry, TraceTreeNode, TraceSummary, FormatOptions } from './types';
|
|
14
|
+
/**
|
|
15
|
+
* Data source type for trace retrieval
|
|
16
|
+
*/
|
|
17
|
+
export type TraceDataSource = 'log' | 'sqlite';
|
|
18
|
+
/**
|
|
19
|
+
* Extended parser options with data source support
|
|
20
|
+
*/
|
|
21
|
+
export interface TraceParserOptions extends ParserOptions {
|
|
22
|
+
/** Data source type: 'log' (default) or 'sqlite' */
|
|
23
|
+
source?: TraceDataSource;
|
|
24
|
+
/** SQLite database path (required when source is 'sqlite') */
|
|
25
|
+
dbPath?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* DebugComponent configuration options
|
|
29
|
+
*/
|
|
30
|
+
export interface DebugComponentOptions {
|
|
31
|
+
/** Log directory path */
|
|
32
|
+
logDir?: string;
|
|
33
|
+
/** Default log file */
|
|
34
|
+
defaultLogFile?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Debug Component for trace analysis and debugging
|
|
38
|
+
*/
|
|
39
|
+
export declare class DebugComponent extends BaseComponent {
|
|
40
|
+
name: string;
|
|
41
|
+
version: string;
|
|
42
|
+
private reader;
|
|
43
|
+
private spanDbReader;
|
|
44
|
+
private parser;
|
|
45
|
+
private spanBuilder;
|
|
46
|
+
private traceFormatter;
|
|
47
|
+
private treeFormatter;
|
|
48
|
+
private options;
|
|
49
|
+
constructor(options?: DebugComponentOptions);
|
|
50
|
+
/**
|
|
51
|
+
* Initialize the span database reader
|
|
52
|
+
*/
|
|
53
|
+
initSpanDbReader(dbPath?: string): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Get the span database reader
|
|
56
|
+
*/
|
|
57
|
+
getSpanDbReader(): SpanDbReader | null;
|
|
58
|
+
/**
|
|
59
|
+
* Get trace by ID from live Tracer storage
|
|
60
|
+
*
|
|
61
|
+
* This method retrieves traces directly from the Tracer's span storage,
|
|
62
|
+
* which includes spans from the current session that may not yet be persisted
|
|
63
|
+
* to log files.
|
|
64
|
+
*/
|
|
65
|
+
getLiveTrace(traceId: string): Promise<any | null>;
|
|
66
|
+
/**
|
|
67
|
+
* List all available traces from live Tracer storage
|
|
68
|
+
*/
|
|
69
|
+
listLiveTraces(limit?: number): Promise<any>;
|
|
70
|
+
/**
|
|
71
|
+
* Format a live trace for display
|
|
72
|
+
*/
|
|
73
|
+
formatLiveTrace(traceId: string): Promise<string>;
|
|
74
|
+
/**
|
|
75
|
+
* Initialize the component
|
|
76
|
+
*/
|
|
77
|
+
init(config?: ComponentConfig): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Stop the component
|
|
80
|
+
*/
|
|
81
|
+
stop(): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Get traces matching the options
|
|
84
|
+
*/
|
|
85
|
+
getTraces(options?: TraceParserOptions): Promise<TraceEntry[]>;
|
|
86
|
+
/**
|
|
87
|
+
* Get traces from SQLite database
|
|
88
|
+
*/
|
|
89
|
+
private getTracesFromSqlite;
|
|
90
|
+
/**
|
|
91
|
+
* List available trace IDs
|
|
92
|
+
*/
|
|
93
|
+
listTraceIds(options?: TraceParserOptions & {
|
|
94
|
+
limit?: number;
|
|
95
|
+
}): Promise<TraceSummary>;
|
|
96
|
+
/**
|
|
97
|
+
* List trace IDs from SQLite database
|
|
98
|
+
*/
|
|
99
|
+
private listTraceIdsFromSqlite;
|
|
100
|
+
/**
|
|
101
|
+
* Get call tree for a specific trace
|
|
102
|
+
*/
|
|
103
|
+
getCallTree(options?: TraceParserOptions): Promise<TraceTreeNode | null>;
|
|
104
|
+
/**
|
|
105
|
+
* Get the log reader instance
|
|
106
|
+
*/
|
|
107
|
+
getReader(): LogReader;
|
|
108
|
+
/**
|
|
109
|
+
* Get the parser instance
|
|
110
|
+
*/
|
|
111
|
+
getParser(): RegexParser;
|
|
112
|
+
/**
|
|
113
|
+
* Get the span builder instance
|
|
114
|
+
*/
|
|
115
|
+
getSpanBuilder(): SpanBuilder;
|
|
116
|
+
/**
|
|
117
|
+
* Get the trace formatter instance
|
|
118
|
+
*/
|
|
119
|
+
getTraceFormatter(): TraceFormatter;
|
|
120
|
+
/**
|
|
121
|
+
* Get the tree formatter instance
|
|
122
|
+
*/
|
|
123
|
+
getTreeFormatter(): TreeFormatter;
|
|
124
|
+
/**
|
|
125
|
+
* Format traces for display
|
|
126
|
+
*/
|
|
127
|
+
formatTraces(entries: TraceEntry[], options?: FormatOptions): string;
|
|
128
|
+
/**
|
|
129
|
+
* Format a single trace entry
|
|
130
|
+
*/
|
|
131
|
+
formatTraceEntry(entry: TraceEntry, options?: FormatOptions): string;
|
|
132
|
+
/**
|
|
133
|
+
* Format traces as JSON
|
|
134
|
+
*/
|
|
135
|
+
tracesToJSON(entries: TraceEntry[]): string;
|
|
136
|
+
/**
|
|
137
|
+
* Format traces as summary
|
|
138
|
+
*/
|
|
139
|
+
tracesToSummary(entries: TraceEntry[]): string;
|
|
140
|
+
/**
|
|
141
|
+
* Format call tree for display
|
|
142
|
+
*/
|
|
143
|
+
formatTree(node: TraceTreeNode): string;
|
|
144
|
+
/**
|
|
145
|
+
* Format multiple call trees
|
|
146
|
+
*/
|
|
147
|
+
formatTrees(trees: TraceTreeNode[]): string;
|
|
148
|
+
/**
|
|
149
|
+
* Format trees as JSON
|
|
150
|
+
*/
|
|
151
|
+
treesToJSON(trees: TraceTreeNode[]): string;
|
|
152
|
+
/**
|
|
153
|
+
* Format tree summary (sorted by duration)
|
|
154
|
+
*/
|
|
155
|
+
formatTreeSummary(node: TraceTreeNode): string;
|
|
156
|
+
/**
|
|
157
|
+
* Format tree with timeline visualization
|
|
158
|
+
*/
|
|
159
|
+
formatTreeTimeline(node: TraceTreeNode): string;
|
|
160
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview REPL Formatter for Interactive Debugging
|
|
3
|
+
*
|
|
4
|
+
* Provides an interactive REPL interface for debugging with:
|
|
5
|
+
* - Command parsing
|
|
6
|
+
* - Output formatting
|
|
7
|
+
* - Help text generation
|
|
8
|
+
*/
|
|
9
|
+
export interface ReplContext {
|
|
10
|
+
traceId?: string;
|
|
11
|
+
function?: string;
|
|
12
|
+
limit?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ParsedCommand {
|
|
15
|
+
command: string;
|
|
16
|
+
args: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Formats output for REPL interface and provides command parsing
|
|
20
|
+
*/
|
|
21
|
+
export declare class ReplFormatter {
|
|
22
|
+
private context;
|
|
23
|
+
private history;
|
|
24
|
+
/**
|
|
25
|
+
* Get welcome message for REPL
|
|
26
|
+
*/
|
|
27
|
+
getWelcomeMessage(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Format prompt with current context
|
|
30
|
+
*/
|
|
31
|
+
formatPrompt(context?: Partial<ReplContext>): string;
|
|
32
|
+
/**
|
|
33
|
+
* Get help text
|
|
34
|
+
*/
|
|
35
|
+
getHelpText(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Format command result
|
|
38
|
+
*/
|
|
39
|
+
formatCommandResult(command: string, data: unknown): string;
|
|
40
|
+
/**
|
|
41
|
+
* Format list command result
|
|
42
|
+
*/
|
|
43
|
+
private formatListResult;
|
|
44
|
+
/**
|
|
45
|
+
* Format trace command result
|
|
46
|
+
*/
|
|
47
|
+
private formatTraceResult;
|
|
48
|
+
/**
|
|
49
|
+
* Format tree command result
|
|
50
|
+
*/
|
|
51
|
+
private formatTreeResult;
|
|
52
|
+
/**
|
|
53
|
+
* Format a single tree node recursively
|
|
54
|
+
*/
|
|
55
|
+
private formatTreeNode;
|
|
56
|
+
/**
|
|
57
|
+
* Format JSON in compact form
|
|
58
|
+
*/
|
|
59
|
+
private formatJsonCompact;
|
|
60
|
+
/**
|
|
61
|
+
* Parse command string
|
|
62
|
+
*/
|
|
63
|
+
parseCommand(input: string): ParsedCommand;
|
|
64
|
+
/**
|
|
65
|
+
* Update context
|
|
66
|
+
*/
|
|
67
|
+
setContext(context: Partial<ReplContext>): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get current context
|
|
70
|
+
*/
|
|
71
|
+
getContext(): ReplContext;
|
|
72
|
+
/**
|
|
73
|
+
* Add to history
|
|
74
|
+
*/
|
|
75
|
+
addToHistory(command: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* Get history
|
|
78
|
+
*/
|
|
79
|
+
getHistory(): string[];
|
|
80
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Trace Formatter
|
|
3
|
+
*
|
|
4
|
+
* Formats trace entries for console output with support for:
|
|
5
|
+
* - Pretty printing with indentation
|
|
6
|
+
* - Multi-line content handling
|
|
7
|
+
* - JSON output
|
|
8
|
+
* - Depth-limited nested object display
|
|
9
|
+
*/
|
|
10
|
+
import type { TraceEntry, FormatOptions } from '../types';
|
|
11
|
+
/**
|
|
12
|
+
* Formats trace entries for human-readable output
|
|
13
|
+
*/
|
|
14
|
+
export declare class TraceFormatter {
|
|
15
|
+
/**
|
|
16
|
+
* Format a single trace entry
|
|
17
|
+
*/
|
|
18
|
+
formatEntry(entry: TraceEntry, options?: FormatOptions): string;
|
|
19
|
+
/**
|
|
20
|
+
* Indent all lines after the first one
|
|
21
|
+
*/
|
|
22
|
+
private indentMultilineContent;
|
|
23
|
+
/**
|
|
24
|
+
* Format multiple trace entries
|
|
25
|
+
*/
|
|
26
|
+
formatEntries(entries: TraceEntry[], options?: FormatOptions): string;
|
|
27
|
+
/**
|
|
28
|
+
* Format data with proper indentation for multi-line content
|
|
29
|
+
*/
|
|
30
|
+
private formatData;
|
|
31
|
+
/**
|
|
32
|
+
* Format data with pretty printing and indentation
|
|
33
|
+
*/
|
|
34
|
+
private formatPretty;
|
|
35
|
+
/**
|
|
36
|
+
* Output as JSON
|
|
37
|
+
*/
|
|
38
|
+
toJSON(entries: TraceEntry[]): string;
|
|
39
|
+
/**
|
|
40
|
+
* Generate a summary of trace entries
|
|
41
|
+
*/
|
|
42
|
+
toSummary(entries: TraceEntry[]): string;
|
|
43
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Tree Formatter
|
|
3
|
+
*
|
|
4
|
+
* Formats trace call trees for console output with:
|
|
5
|
+
* - ANSI color support
|
|
6
|
+
* - Duration display with percentage
|
|
7
|
+
* - Time bar visualization
|
|
8
|
+
* - Proper indentation
|
|
9
|
+
*/
|
|
10
|
+
import type { TraceTreeNode } from '../types';
|
|
11
|
+
/**
|
|
12
|
+
* Options for tree formatting
|
|
13
|
+
*/
|
|
14
|
+
export interface TreeFormatOptions {
|
|
15
|
+
/** Show duration percentage (default: true) */
|
|
16
|
+
showPercent?: boolean;
|
|
17
|
+
/** Show time bar (default: false) */
|
|
18
|
+
showTimeBar?: boolean;
|
|
19
|
+
/** Width of time bar (default: 10) */
|
|
20
|
+
barWidth?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Formats trace call trees for human-readable output
|
|
24
|
+
*/
|
|
25
|
+
export declare class TreeFormatter {
|
|
26
|
+
private options;
|
|
27
|
+
constructor(options?: TreeFormatOptions);
|
|
28
|
+
/**
|
|
29
|
+
* Color function based on percentage
|
|
30
|
+
*/
|
|
31
|
+
private colorByPercent;
|
|
32
|
+
/**
|
|
33
|
+
* Format a single trace tree
|
|
34
|
+
*/
|
|
35
|
+
formatTree(node: TraceTreeNode): string;
|
|
36
|
+
/**
|
|
37
|
+
* Format a single node
|
|
38
|
+
*/
|
|
39
|
+
private formatNode;
|
|
40
|
+
/**
|
|
41
|
+
* Recursively format children
|
|
42
|
+
*/
|
|
43
|
+
private formatChildren;
|
|
44
|
+
/**
|
|
45
|
+
* Render a time bar showing relative duration
|
|
46
|
+
*/
|
|
47
|
+
private renderTimeBar;
|
|
48
|
+
/**
|
|
49
|
+
* Format duration in human-readable form
|
|
50
|
+
*/
|
|
51
|
+
private formatDuration;
|
|
52
|
+
/**
|
|
53
|
+
* Format multiple trace trees
|
|
54
|
+
*/
|
|
55
|
+
formatTrees(trees: TraceTreeNode[]): string;
|
|
56
|
+
/**
|
|
57
|
+
* Output as JSON
|
|
58
|
+
*/
|
|
59
|
+
toJSON(trees: TraceTreeNode[]): string;
|
|
60
|
+
/**
|
|
61
|
+
* Generate a summary table of all spans sorted by duration
|
|
62
|
+
*/
|
|
63
|
+
formatSummary(node: TraceTreeNode): string;
|
|
64
|
+
/**
|
|
65
|
+
* Format tree with timeline visualization
|
|
66
|
+
*/
|
|
67
|
+
formatTimeline(node: TraceTreeNode): string;
|
|
68
|
+
/**
|
|
69
|
+
* Build timeline visualization with absolute positioning
|
|
70
|
+
*/
|
|
71
|
+
private buildTimeline;
|
|
72
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Debug Component Index
|
|
3
|
+
*
|
|
4
|
+
* Export all debug-related types and classes.
|
|
5
|
+
*/
|
|
6
|
+
export type { TraceEntry, TraceTreeNode, ParserOptions, LogDiscoveryOptions, ParsedLogLine, TraceIdInfo, TraceSummary, FormatOptions, TraceAction, LogLevel, } from './types';
|
|
7
|
+
export type { TraceDataSource, TraceParserOptions } from './debug-component';
|
|
8
|
+
export { DebugComponent } from './debug-component';
|
|
9
|
+
export { LogReader } from './reader/log-reader';
|
|
10
|
+
export { SpanDbReader } from './reader/span-db-reader';
|
|
11
|
+
export { RegexParser } from './parser/regex-parser';
|
|
12
|
+
export { SpanBuilder } from './parser/span-builder';
|
|
13
|
+
export { TraceFormatter } from './formatters/trace-formatter';
|
|
14
|
+
export { TreeFormatter } from './formatters/tree-formatter';
|
|
15
|
+
export { ReplFormatter } from './formatters/repl-formatter';
|
package/dist/env/debug/index.js
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Regex Parser for Log Lines
|
|
3
|
+
*
|
|
4
|
+
* Parses log files with trace format:
|
|
5
|
+
* [TRACE] >>> {method} enter: {args}
|
|
6
|
+
* [TRACE] <<< {method} quit: {result}
|
|
7
|
+
* [TRACE] !!! {method} error: {error}
|
|
8
|
+
*/
|
|
9
|
+
import type { ParsedLogLine, LogLevel } from '../types';
|
|
10
|
+
/**
|
|
11
|
+
* Regex Parser for trace log lines
|
|
12
|
+
*/
|
|
13
|
+
export declare class RegexParser {
|
|
14
|
+
/**
|
|
15
|
+
* Parse a single log line
|
|
16
|
+
*/
|
|
17
|
+
parseLogLine(line: string): ParsedLogLine | null;
|
|
18
|
+
/**
|
|
19
|
+
* Parse arguments from raw args string
|
|
20
|
+
*/
|
|
21
|
+
parseArgs(raw: string): unknown | unknown[] | null;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a line is a trace line
|
|
24
|
+
*/
|
|
25
|
+
isTraceLine(line: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Filter lines by log level
|
|
28
|
+
*/
|
|
29
|
+
filterByLevel(lines: string[], level?: LogLevel): string[];
|
|
30
|
+
/**
|
|
31
|
+
* Filter lines by function name
|
|
32
|
+
*/
|
|
33
|
+
filterByFunction(lines: string[], functionName?: string): string[];
|
|
34
|
+
/**
|
|
35
|
+
* Extract trace ID from log line
|
|
36
|
+
* Checks for requestId in two places:
|
|
37
|
+
* 1. Category field: [source][requestId=req_123]
|
|
38
|
+
* 2. After method name: [requestId=req_abc]
|
|
39
|
+
*/
|
|
40
|
+
extractTraceId(line: string): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Extract trace IDs from multiple lines
|
|
43
|
+
*/
|
|
44
|
+
extractTraceIds(lines: string[]): Map<string, string[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Parse multiple lines
|
|
47
|
+
*/
|
|
48
|
+
parseLines(lines: string[]): ParsedLogLine[];
|
|
49
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Span Builder
|
|
3
|
+
*
|
|
4
|
+
* Builds TraceEntry objects from parsed log lines and constructs call trees.
|
|
5
|
+
*/
|
|
6
|
+
import type { ParsedLogLine, TraceEntry, TraceTreeNode } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Paired enter/quit entries
|
|
9
|
+
*/
|
|
10
|
+
interface PairedSpan {
|
|
11
|
+
enter: TraceEntry;
|
|
12
|
+
quit: TraceEntry;
|
|
13
|
+
durationMs: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Span Builder for constructing trace entries and call trees
|
|
17
|
+
*/
|
|
18
|
+
export declare class SpanBuilder {
|
|
19
|
+
private parser;
|
|
20
|
+
constructor();
|
|
21
|
+
/**
|
|
22
|
+
* Build trace entries from parsed log lines
|
|
23
|
+
*/
|
|
24
|
+
buildTraceEntries(lines: ParsedLogLine[]): TraceEntry[];
|
|
25
|
+
/**
|
|
26
|
+
* Build a single trace entry from a parsed log line
|
|
27
|
+
*/
|
|
28
|
+
private buildTraceEntry;
|
|
29
|
+
/**
|
|
30
|
+
* Generate a virtual trace ID when no real traceId is present
|
|
31
|
+
* Uses function name and timestamp to create a pseudo-traceId
|
|
32
|
+
*/
|
|
33
|
+
generateVirtualTraceId(functionName: string, timestamp: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Extract trace ID from log line
|
|
36
|
+
*/
|
|
37
|
+
private extractTraceId;
|
|
38
|
+
/**
|
|
39
|
+
* Calculate duration between enter and quit entries
|
|
40
|
+
*/
|
|
41
|
+
calculateDuration(enter: TraceEntry, quit: TraceEntry): number;
|
|
42
|
+
/**
|
|
43
|
+
* Pair enter and quit entries
|
|
44
|
+
*/
|
|
45
|
+
pairEnterQuit(entries: TraceEntry[]): PairedSpan[];
|
|
46
|
+
/**
|
|
47
|
+
* Build a call tree from trace entries using call stack tracking
|
|
48
|
+
*
|
|
49
|
+
* Enhanced to support both:
|
|
50
|
+
* 1. Traditional enter/quit pair-based tree building (from log files)
|
|
51
|
+
* 2. Parent-child hierarchy-based tree building (from SQLite spans)
|
|
52
|
+
*/
|
|
53
|
+
buildCallTree(entries: TraceEntry[]): TraceTreeNode | null;
|
|
54
|
+
/**
|
|
55
|
+
* Build call tree from parent-child span hierarchy (for SQLite spans)
|
|
56
|
+
*/
|
|
57
|
+
buildCallTreeFromHierarchy(entries: TraceEntry[]): TraceTreeNode | null;
|
|
58
|
+
/**
|
|
59
|
+
* Build call tree from traditional enter/quit pairs (for log files)
|
|
60
|
+
*/
|
|
61
|
+
buildCallTreeFromPairs(entries: TraceEntry[]): TraceTreeNode | null;
|
|
62
|
+
/**
|
|
63
|
+
* Build a tree node from a paired span
|
|
64
|
+
*/
|
|
65
|
+
private buildNodeFromPaired;
|
|
66
|
+
/**
|
|
67
|
+
* Merge entries from multiple functions into a single call tree
|
|
68
|
+
*/
|
|
69
|
+
buildMergedTree(entriesByFunction: Map<string, TraceEntry[]>): TraceTreeNode | null;
|
|
70
|
+
/**
|
|
71
|
+
* Get duration summary for entries
|
|
72
|
+
*/
|
|
73
|
+
getDurationSummary(entries: TraceEntry[]): Map<string, {
|
|
74
|
+
count: number;
|
|
75
|
+
totalMs: number;
|
|
76
|
+
avgMs: number;
|
|
77
|
+
}>;
|
|
78
|
+
}
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Log Reader
|
|
3
|
+
*
|
|
4
|
+
* Reads log files with support for streaming and filtering.
|
|
5
|
+
*/
|
|
6
|
+
import type { ParserOptions } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Get XDG data home directory
|
|
9
|
+
*/
|
|
10
|
+
export declare function getXDGDataHome(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Log Reader for reading and parsing log files
|
|
13
|
+
*/
|
|
14
|
+
export declare class LogReader {
|
|
15
|
+
private logDir;
|
|
16
|
+
constructor(options?: {
|
|
17
|
+
logDir?: string;
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Get the full path to a log file
|
|
21
|
+
*/
|
|
22
|
+
getLogPath(filename?: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Find log files matching a pattern
|
|
25
|
+
*
|
|
26
|
+
* Uses forward slashes for glob patterns to ensure cross-platform compatibility.
|
|
27
|
+
* The glob library requires forward slashes regardless of OS.
|
|
28
|
+
*/
|
|
29
|
+
findLogFiles(pattern?: string): Promise<string[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Get default log directory
|
|
32
|
+
*/
|
|
33
|
+
getDefaultLogDir(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Read lines from a log file with optional filtering
|
|
36
|
+
*/
|
|
37
|
+
readLines(filepath: string, options?: ParserOptions): AsyncGenerator<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Extract timestamp from a log line
|
|
40
|
+
*/
|
|
41
|
+
extractTimestamp(line: string): number | null;
|
|
42
|
+
/**
|
|
43
|
+
* Parse time string to timestamp
|
|
44
|
+
* Supports ISO format and relative time like "1h", "30m"
|
|
45
|
+
*/
|
|
46
|
+
parseTime(timeStr: string): number;
|
|
47
|
+
/**
|
|
48
|
+
* Read file content directly (for small files)
|
|
49
|
+
*/
|
|
50
|
+
readFile(filepath: string): Promise<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Check if a log file exists
|
|
53
|
+
*/
|
|
54
|
+
exists(filepath: string): boolean;
|
|
55
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Span DB Reader - Read spans from SQLite database
|
|
3
|
+
*
|
|
4
|
+
* This reader fetches trace data directly from SQLite span storage,
|
|
5
|
+
* which is used for persisting spans in production environments.
|
|
6
|
+
*/
|
|
7
|
+
import type { TraceEntry, TraceSummary } from '../types';
|
|
8
|
+
import type { SpanStorage } from '../../log-trace/types';
|
|
9
|
+
/**
|
|
10
|
+
* Options for SpanDbReader
|
|
11
|
+
*/
|
|
12
|
+
export interface SpanDbReaderOptions {
|
|
13
|
+
/** Database path (for file-based SQLite) */
|
|
14
|
+
dbPath?: string;
|
|
15
|
+
/** Storage instance to use directly */
|
|
16
|
+
storage?: SpanStorage;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Span Database Reader
|
|
20
|
+
*
|
|
21
|
+
* Reads span data from SQLite storage for trace debugging and analysis.
|
|
22
|
+
*/
|
|
23
|
+
export declare class SpanDbReader {
|
|
24
|
+
private storage;
|
|
25
|
+
private dbPath;
|
|
26
|
+
private sqliteDb;
|
|
27
|
+
constructor(options?: SpanDbReaderOptions);
|
|
28
|
+
/**
|
|
29
|
+
* Initialize the reader with storage
|
|
30
|
+
*/
|
|
31
|
+
initialize(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Initialize SQLite storage directly
|
|
34
|
+
*/
|
|
35
|
+
private initSqliteStorage;
|
|
36
|
+
/**
|
|
37
|
+
* Get trace entries for a specific traceId
|
|
38
|
+
*/
|
|
39
|
+
getTraceEntries(traceId: string): Promise<TraceEntry[]>;
|
|
40
|
+
/**
|
|
41
|
+
* List all trace IDs
|
|
42
|
+
*/
|
|
43
|
+
listTraceIds(limit?: number): Promise<TraceSummary>;
|
|
44
|
+
/**
|
|
45
|
+
* Convert spans to TraceEntry format
|
|
46
|
+
*
|
|
47
|
+
* Now properly extracts spanId and parentSpanId for tree building
|
|
48
|
+
*/
|
|
49
|
+
private spansToEntries;
|
|
50
|
+
/**
|
|
51
|
+
* Convert span attributes to params format
|
|
52
|
+
*/
|
|
53
|
+
private attributesToParams;
|
|
54
|
+
/**
|
|
55
|
+
* Get the underlying storage
|
|
56
|
+
*/
|
|
57
|
+
getStorage(): SpanStorage | null;
|
|
58
|
+
/**
|
|
59
|
+
* Close the reader and cleanup resources
|
|
60
|
+
*/
|
|
61
|
+
close(): void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create a SpanDbReader from a database path
|
|
65
|
+
*/
|
|
66
|
+
export declare function createSpanDbReader(dbPath: string): Promise<SpanDbReader>;
|
|
67
|
+
/**
|
|
68
|
+
* Create a SpanDbReader from an existing storage instance
|
|
69
|
+
*/
|
|
70
|
+
export declare function createSpanDbReaderFromStorage(storage: SpanStorage): SpanDbReader;
|