@cuylabs/agent-core 4.9.0 → 5.0.0
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/README.md +11 -12
- package/dist/agent/chat-loop/commit-batch.d.ts +10 -0
- package/dist/agent/chat-loop/commit-batch.d.ts.map +1 -0
- package/dist/agent/chat-loop/context-recovery.d.ts +33 -0
- package/dist/agent/chat-loop/context-recovery.d.ts.map +1 -0
- package/dist/agent/chat-loop/finalize-turn.d.ts +19 -0
- package/dist/agent/chat-loop/finalize-turn.d.ts.map +1 -0
- package/dist/agent/chat-loop/index.d.ts +7 -0
- package/dist/agent/chat-loop/index.d.ts.map +1 -0
- package/dist/agent/chat-loop/loop.d.ts +8 -0
- package/dist/agent/chat-loop/loop.d.ts.map +1 -0
- package/dist/agent/chat-loop/model-step-runner.d.ts +26 -0
- package/dist/agent/chat-loop/model-step-runner.d.ts.map +1 -0
- package/dist/agent/chat-loop/model-step-snapshot.d.ts +49 -0
- package/dist/agent/chat-loop/model-step-snapshot.d.ts.map +1 -0
- package/dist/agent/chat-loop/turn-tools.d.ts +19 -0
- package/dist/agent/chat-loop/turn-tools.d.ts.map +1 -0
- package/dist/agent/chat-loop/types.d.ts +60 -0
- package/dist/agent/chat-loop/types.d.ts.map +1 -0
- package/dist/agent/defaults.d.ts +69 -0
- package/dist/agent/defaults.d.ts.map +1 -0
- package/dist/agent/event-printer.d.ts +94 -0
- package/dist/agent/event-printer.d.ts.map +1 -0
- package/dist/agent/fork.d.ts +59 -0
- package/dist/agent/fork.d.ts.map +1 -0
- package/dist/agent/index.d.ts +17 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/instance/context-management.d.ts +42 -0
- package/dist/agent/instance/context-management.d.ts.map +1 -0
- package/dist/agent/instance/forking.d.ts +26 -0
- package/dist/agent/instance/forking.d.ts.map +1 -0
- package/dist/agent/instance/index.d.ts +182 -0
- package/dist/agent/instance/index.d.ts.map +1 -0
- package/dist/agent/instance/interventions.d.ts +10 -0
- package/dist/agent/instance/interventions.d.ts.map +1 -0
- package/dist/agent/instance/mcp.d.ts +21 -0
- package/dist/agent/instance/mcp.d.ts.map +1 -0
- package/dist/agent/instance/sessions.d.ts +8 -0
- package/dist/agent/instance/sessions.d.ts.map +1 -0
- package/dist/agent/instance/tools.d.ts +16 -0
- package/dist/agent/instance/tools.d.ts.map +1 -0
- package/dist/agent/instance/turn-lifecycle.d.ts +61 -0
- package/dist/agent/instance/turn-lifecycle.d.ts.map +1 -0
- package/dist/agent/session.d.ts +16 -0
- package/dist/agent/session.d.ts.map +1 -0
- package/dist/agent/setup/config.d.ts +8 -0
- package/dist/agent/setup/config.d.ts.map +1 -0
- package/dist/agent/setup/context-window.d.ts +4 -0
- package/dist/agent/setup/context-window.d.ts.map +1 -0
- package/dist/agent/setup/environment.d.ts +5 -0
- package/dist/agent/setup/environment.d.ts.map +1 -0
- package/dist/agent/setup/middleware.d.ts +9 -0
- package/dist/agent/setup/middleware.d.ts.map +1 -0
- package/dist/agent/setup/runtime-config.d.ts +9 -0
- package/dist/agent/setup/runtime-config.d.ts.map +1 -0
- package/dist/agent/setup/state.d.ts +4 -0
- package/dist/agent/setup/state.d.ts.map +1 -0
- package/dist/agent/setup/tools.d.ts +8 -0
- package/dist/agent/setup/tools.d.ts.map +1 -0
- package/dist/agent/setup.d.ts +47 -0
- package/dist/agent/setup.d.ts.map +1 -0
- package/dist/agent/stream-provider.d.ts +27 -0
- package/dist/agent/stream-provider.d.ts.map +1 -0
- package/dist/agent/turn-context/compaction/agent-context.d.ts +76 -0
- package/dist/agent/turn-context/compaction/agent-context.d.ts.map +1 -0
- package/dist/agent/turn-context/compaction/budget.d.ts +4 -0
- package/dist/agent/turn-context/compaction/budget.d.ts.map +1 -0
- package/dist/agent/turn-context/compaction/check.d.ts +45 -0
- package/dist/agent/turn-context/compaction/check.d.ts.map +1 -0
- package/dist/agent/turn-context/compaction/fragments.d.ts +4 -0
- package/dist/agent/turn-context/compaction/fragments.d.ts.map +1 -0
- package/dist/agent/turn-context/compaction/index.d.ts +5 -0
- package/dist/agent/turn-context/compaction/index.d.ts.map +1 -0
- package/dist/agent/turn-context/compaction/memory.d.ts +18 -0
- package/dist/agent/turn-context/compaction/memory.d.ts.map +1 -0
- package/dist/agent/turn-context/compaction/results.d.ts +25 -0
- package/dist/agent/turn-context/compaction/results.d.ts.map +1 -0
- package/dist/agent/turn-context/compaction/summary.d.ts +3 -0
- package/dist/agent/turn-context/compaction/summary.d.ts.map +1 -0
- package/dist/agent/turn-context/compaction/types.d.ts +30 -0
- package/dist/agent/turn-context/compaction/types.d.ts.map +1 -0
- package/dist/agent/turn-context/fit-model-context.d.ts +29 -0
- package/dist/agent/turn-context/fit-model-context.d.ts.map +1 -0
- package/dist/agent/turn-context/index.d.ts +5 -0
- package/dist/agent/turn-context/index.d.ts.map +1 -0
- package/dist/agent/turn-context/system-prompts.d.ts +12 -0
- package/dist/agent/turn-context/system-prompts.d.ts.map +1 -0
- package/dist/agent/types/config.d.ts +206 -0
- package/dist/agent/types/config.d.ts.map +1 -0
- package/dist/agent/types/index.d.ts +11 -0
- package/dist/agent/types/index.d.ts.map +1 -0
- package/dist/agent/types/state.d.ts +16 -0
- package/dist/agent/types/state.d.ts.map +1 -0
- package/dist/agent/types/tracing.d.ts +12 -0
- package/dist/agent/types/tracing.d.ts.map +1 -0
- package/dist/{chunk-KYLPMBHD.js → chunk-336EDIBL.js} +1 -1
- package/dist/chunk-346FIYKT.js +960 -0
- package/dist/{chunk-HSUPTXNV.js → chunk-556CPZ3J.js} +13 -10
- package/dist/chunk-AHDCR7SX.js +83 -0
- package/dist/{chunk-CSR75JVC.js → chunk-ASXF5AC6.js} +1 -1
- package/dist/{chunk-BJC46FIF.js → chunk-BKHWKKSG.js} +2 -2
- package/dist/{chunk-2TTOLHBT.js → chunk-CFBSQLP5.js} +1 -1
- package/dist/chunk-CGP6UNCQ.js +554 -0
- package/dist/{chunk-GJFP5L2V.js → chunk-CNM6OROH.js} +15 -3
- package/dist/chunk-DD7S7ZG4.js +274 -0
- package/dist/chunk-DYZGHHDB.js +1458 -0
- package/dist/chunk-E66PKKDL.js +772 -0
- package/dist/{chunk-H3GRHFFG.js → chunk-EDKZOPUV.js} +63 -306
- package/dist/{chunk-GEBFHREI.js → chunk-GHVW7L4P.js} +71 -5
- package/dist/chunk-JFH6HBUG.js +227 -0
- package/dist/{chunk-MWPU2EVV.js → chunk-JUIL2NJC.js} +4 -81
- package/dist/{chunk-NS7D7JJU.js → chunk-K453AFTL.js} +35 -16
- package/dist/chunk-MJRZ2ZRI.js +498 -0
- package/dist/{chunk-UMIVJDEJ.js → chunk-SAWRDGBE.js} +30 -7
- package/dist/chunk-TYQWH6XH.js +88 -0
- package/dist/{chunk-QJV5XPPS.js → chunk-UEEHZ4QH.js} +1 -1
- package/dist/chunk-UG5PVNZV.js +53 -0
- package/dist/{chunk-BGG2HVIR.js → chunk-V4MIDL5B.js} +9 -0
- package/dist/chunk-W6LWIMIX.js +8 -0
- package/dist/context/assembly/index.d.ts +3 -0
- package/dist/context/assembly/index.d.ts.map +1 -0
- package/dist/context/assembly/prepare.d.ts +11 -0
- package/dist/context/assembly/prepare.d.ts.map +1 -0
- package/dist/context/assembly/types.d.ts +64 -0
- package/dist/context/assembly/types.d.ts.map +1 -0
- package/dist/context/config.d.ts +20 -0
- package/dist/context/config.d.ts.map +1 -0
- package/dist/context/fragments/index.d.ts +4 -0
- package/dist/context/fragments/index.d.ts.map +1 -0
- package/dist/context/fragments/messages.d.ts +12 -0
- package/dist/context/fragments/messages.d.ts.map +1 -0
- package/dist/context/fragments/render.d.ts +16 -0
- package/dist/context/fragments/render.d.ts.map +1 -0
- package/dist/context/fragments/types.d.ts +87 -0
- package/dist/context/fragments/types.d.ts.map +1 -0
- package/dist/context/index.d.ts +13 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +96 -0
- package/dist/context/text/truncation.d.ts +13 -0
- package/dist/context/text/truncation.d.ts.map +1 -0
- package/dist/context/window/budget.d.ts +135 -0
- package/dist/context/window/budget.d.ts.map +1 -0
- package/dist/context/window/compactor.d.ts +89 -0
- package/dist/context/window/compactor.d.ts.map +1 -0
- package/dist/context/window/cut-planner.d.ts +67 -0
- package/dist/context/window/cut-planner.d.ts.map +1 -0
- package/dist/context/window/decision.d.ts +50 -0
- package/dist/context/window/decision.d.ts.map +1 -0
- package/dist/context/window/estimation.d.ts +60 -0
- package/dist/context/window/estimation.d.ts.map +1 -0
- package/dist/context/window/index.d.ts +28 -0
- package/dist/context/window/index.d.ts.map +1 -0
- package/dist/context/window/manager.d.ts +113 -0
- package/dist/context/window/manager.d.ts.map +1 -0
- package/dist/context/window/summary-policy.d.ts +50 -0
- package/dist/context/window/summary-policy.d.ts.map +1 -0
- package/dist/context/window/summary.d.ts +65 -0
- package/dist/context/window/summary.d.ts.map +1 -0
- package/dist/context/window/tool-pruning.d.ts +73 -0
- package/dist/context/window/tool-pruning.d.ts.map +1 -0
- package/dist/dispatch/executor.d.ts +56 -0
- package/dist/dispatch/executor.d.ts.map +1 -0
- package/dist/dispatch/index.d.ts +7 -95
- package/dist/dispatch/index.d.ts.map +1 -0
- package/dist/dispatch/index.js +4 -3
- package/dist/dispatch/results.d.ts +9 -0
- package/dist/dispatch/results.d.ts.map +1 -0
- package/dist/dispatch/runtime.d.ts +19 -0
- package/dist/dispatch/runtime.d.ts.map +1 -0
- package/dist/dispatch/tool-factories.d.ts +8 -0
- package/dist/dispatch/tool-factories.d.ts.map +1 -0
- package/dist/dispatch/tools.d.ts +10 -0
- package/dist/dispatch/tools.d.ts.map +1 -0
- package/dist/dispatch/types.d.ts +131 -0
- package/dist/dispatch/types.d.ts.map +1 -0
- package/dist/events/event-bus/index.d.ts +13 -0
- package/dist/events/event-bus/index.d.ts.map +1 -0
- package/dist/events/event-bus/index.js +6 -0
- package/dist/events/event-bus/local.d.ts +14 -0
- package/dist/events/event-bus/local.d.ts.map +1 -0
- package/dist/events/event-bus/types.d.ts +78 -0
- package/dist/events/event-bus/types.d.ts.map +1 -0
- package/dist/events/index.d.ts +10 -89
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +6 -1
- package/dist/events/signal/index.d.ts +18 -0
- package/dist/events/signal/index.d.ts.map +1 -0
- package/dist/events/signal/index.js +6 -0
- package/dist/events/signal/local.d.ts +22 -0
- package/dist/events/signal/local.d.ts.map +1 -0
- package/dist/events/signal/types.d.ts +69 -0
- package/dist/events/signal/types.d.ts.map +1 -0
- package/dist/execution/index.d.ts +33 -481
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +45 -19
- package/dist/execution/scope/index.d.ts +10 -0
- package/dist/execution/scope/index.d.ts.map +1 -0
- package/dist/execution/scope/index.js +12 -0
- package/dist/execution/scope/run.d.ts +8 -0
- package/dist/execution/scope/run.d.ts.map +1 -0
- package/dist/execution/scope/store.d.ts +6 -0
- package/dist/execution/scope/store.d.ts.map +1 -0
- package/dist/execution/scope/types.d.ts +28 -0
- package/dist/execution/scope/types.d.ts.map +1 -0
- package/dist/execution/shared/usage.d.ts +9 -0
- package/dist/execution/shared/usage.d.ts.map +1 -0
- package/dist/execution/task/index.d.ts +6 -0
- package/dist/execution/task/index.d.ts.map +1 -0
- package/dist/execution/task/observer.d.ts +80 -0
- package/dist/execution/task/observer.d.ts.map +1 -0
- package/dist/execution/task/runner.d.ts +39 -0
- package/dist/execution/task/runner.d.ts.map +1 -0
- package/dist/execution/task/types.d.ts +85 -0
- package/dist/execution/task/types.d.ts.map +1 -0
- package/dist/execution/turn/engine/commit-batch.d.ts +16 -0
- package/dist/execution/turn/engine/commit-batch.d.ts.map +1 -0
- package/dist/execution/turn/engine/engine.d.ts +32 -0
- package/dist/execution/turn/engine/engine.d.ts.map +1 -0
- package/dist/execution/turn/engine/index.d.ts +12 -0
- package/dist/execution/turn/engine/index.d.ts.map +1 -0
- package/dist/execution/turn/engine/types.d.ts +67 -0
- package/dist/execution/turn/engine/types.d.ts.map +1 -0
- package/dist/execution/turn/index.d.ts +18 -0
- package/dist/execution/turn/index.d.ts.map +1 -0
- package/dist/execution/turn/index.js +52 -0
- package/dist/execution/turn/runner/commit.d.ts +11 -0
- package/dist/execution/turn/runner/commit.d.ts.map +1 -0
- package/dist/execution/turn/runner/index.d.ts +16 -0
- package/dist/execution/turn/runner/index.d.ts.map +1 -0
- package/dist/execution/turn/runner/prepare.d.ts +6 -0
- package/dist/execution/turn/runner/prepare.d.ts.map +1 -0
- package/dist/execution/turn/runner/stream-step.d.ts +8 -0
- package/dist/execution/turn/runner/stream-step.d.ts.map +1 -0
- package/dist/execution/turn/runner/tool-batch.d.ts +13 -0
- package/dist/execution/turn/runner/tool-batch.d.ts.map +1 -0
- package/dist/execution/turn/runner/types.d.ts +111 -0
- package/dist/execution/turn/runner/types.d.ts.map +1 -0
- package/dist/execution/turn/state.d.ts +110 -0
- package/dist/execution/turn/state.d.ts.map +1 -0
- package/dist/execution/turn/step-ledger.d.ts +89 -0
- package/dist/execution/turn/step-ledger.d.ts.map +1 -0
- package/dist/execution/turn/step-processing/doom-loop.d.ts +28 -0
- package/dist/execution/turn/step-processing/doom-loop.d.ts.map +1 -0
- package/dist/execution/turn/step-processing/index.d.ts +14 -0
- package/dist/execution/turn/step-processing/index.d.ts.map +1 -0
- package/dist/execution/turn/step-processing/overflow.d.ts +17 -0
- package/dist/execution/turn/step-processing/overflow.d.ts.map +1 -0
- package/dist/execution/turn/step-processing/process.d.ts +7 -0
- package/dist/execution/turn/step-processing/process.d.ts.map +1 -0
- package/dist/execution/turn/step-processing/types.d.ts +65 -0
- package/dist/execution/turn/step-processing/types.d.ts.map +1 -0
- package/dist/execution/workflow/index.d.ts +12 -0
- package/dist/execution/workflow/index.d.ts.map +1 -0
- package/dist/execution/workflow/index.js +39 -0
- package/dist/execution/workflow/planner/apply.d.ts +30 -0
- package/dist/execution/workflow/planner/apply.d.ts.map +1 -0
- package/dist/execution/workflow/planner/helpers.d.ts +6 -0
- package/dist/execution/workflow/planner/helpers.d.ts.map +1 -0
- package/dist/execution/workflow/planner/index.d.ts +13 -0
- package/dist/execution/workflow/planner/index.d.ts.map +1 -0
- package/dist/execution/workflow/planner/plan.d.ts +7 -0
- package/dist/execution/workflow/planner/plan.d.ts.map +1 -0
- package/dist/execution/workflow/planner/types.d.ts +49 -0
- package/dist/execution/workflow/planner/types.d.ts.map +1 -0
- package/dist/execution/workflow/snapshot.d.ts +11 -0
- package/dist/execution/workflow/snapshot.d.ts.map +1 -0
- package/dist/execution/workflow/state.d.ts +161 -0
- package/dist/execution/workflow/state.d.ts.map +1 -0
- package/dist/human/controller.d.ts +24 -0
- package/dist/human/controller.d.ts.map +1 -0
- package/dist/human/handler.d.ts +15 -0
- package/dist/human/handler.d.ts.map +1 -0
- package/dist/human/index.d.ts +5 -0
- package/dist/human/index.d.ts.map +1 -0
- package/dist/human/tool.d.ts +17 -0
- package/dist/human/tool.d.ts.map +1 -0
- package/dist/human/types.d.ts +62 -0
- package/dist/human/types.d.ts.map +1 -0
- package/dist/index.d.ts +66 -567
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2681 -1859
- package/dist/inference/defaults.d.ts +8 -0
- package/dist/inference/defaults.d.ts.map +1 -0
- package/dist/inference/errors/classify.d.ts +5 -0
- package/dist/inference/errors/classify.d.ts.map +1 -0
- package/dist/inference/errors/extract.d.ts +3 -0
- package/dist/inference/errors/extract.d.ts.map +1 -0
- package/dist/inference/errors/index.d.ts +8 -11
- package/dist/inference/errors/index.d.ts.map +1 -0
- package/dist/inference/errors/llm-error.d.ts +14 -0
- package/dist/inference/errors/llm-error.d.ts.map +1 -0
- package/dist/inference/errors/types.d.ts +18 -0
- package/dist/inference/errors/types.d.ts.map +1 -0
- package/dist/inference/errors/utils.d.ts +5 -0
- package/dist/inference/errors/utils.d.ts.map +1 -0
- package/dist/inference/index.d.ts +17 -49
- package/dist/inference/index.d.ts.map +1 -0
- package/dist/inference/index.js +7 -7
- package/dist/inference/middleware-support.d.ts +14 -0
- package/dist/inference/middleware-support.d.ts.map +1 -0
- package/dist/{model-messages-n_ZMZwIm.d.ts → inference/model-messages.d.ts} +4 -6
- package/dist/inference/model-messages.d.ts.map +1 -0
- package/dist/inference/retry.d.ts +73 -0
- package/dist/inference/retry.d.ts.map +1 -0
- package/dist/inference/stream.d.ts +16 -0
- package/dist/inference/stream.d.ts.map +1 -0
- package/dist/inference/toolset.d.ts +26 -0
- package/dist/inference/toolset.d.ts.map +1 -0
- package/dist/inference/types.d.ts +129 -0
- package/dist/inference/types.d.ts.map +1 -0
- package/dist/intervention/follow-up-policy.d.ts +41 -0
- package/dist/intervention/follow-up-policy.d.ts.map +1 -0
- package/dist/intervention/index.d.ts +5 -0
- package/dist/intervention/index.d.ts.map +1 -0
- package/dist/intervention/intervention.d.ts +130 -0
- package/dist/intervention/intervention.d.ts.map +1 -0
- package/dist/intervention/types.d.ts +74 -0
- package/dist/intervention/types.d.ts.map +1 -0
- package/dist/logger/index.d.ts +5 -47
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/logger.d.ts +46 -0
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/{types-RSCv7nQ4.d.ts → logger/types.d.ts} +6 -7
- package/dist/logger/types.d.ts.map +1 -0
- package/dist/mcp/auth.d.ts +109 -0
- package/dist/mcp/auth.d.ts.map +1 -0
- package/dist/mcp/diagnostics.d.ts +23 -0
- package/dist/mcp/diagnostics.d.ts.map +1 -0
- package/dist/mcp/factories.d.ts +47 -0
- package/dist/mcp/factories.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +14 -175
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/manager.d.ts +45 -0
- package/dist/mcp/manager.d.ts.map +1 -0
- package/dist/mcp/modules.d.ts +6 -0
- package/dist/mcp/modules.d.ts.map +1 -0
- package/dist/{types-DMjoFKKv.d.ts → mcp/types.d.ts} +18 -19
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/memory/config.d.ts +4 -0
- package/dist/memory/config.d.ts.map +1 -0
- package/dist/memory/format.d.ts +8 -0
- package/dist/memory/format.d.ts.map +1 -0
- package/dist/memory/index.d.ts +5 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +14 -0
- package/dist/memory/middleware.d.ts +14 -0
- package/dist/memory/middleware.d.ts.map +1 -0
- package/dist/memory/types.d.ts +251 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/middleware/approval.d.ts +70 -0
- package/dist/middleware/approval.d.ts.map +1 -0
- package/dist/middleware/index.d.ts +25 -110
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +2 -2
- package/dist/middleware/prompt-cache/cache.d.ts +44 -0
- package/dist/middleware/prompt-cache/cache.d.ts.map +1 -0
- package/dist/middleware/prompt-cache/index.d.ts +14 -0
- package/dist/middleware/prompt-cache/index.d.ts.map +1 -0
- package/dist/middleware/prompt-cache/types.d.ts +50 -0
- package/dist/middleware/prompt-cache/types.d.ts.map +1 -0
- package/dist/middleware/runner.d.ts +115 -0
- package/dist/middleware/runner.d.ts.map +1 -0
- package/dist/middleware/telemetry/index.d.ts +12 -0
- package/dist/middleware/telemetry/index.d.ts.map +1 -0
- package/dist/middleware/telemetry/otel.d.ts +4 -0
- package/dist/middleware/telemetry/otel.d.ts.map +1 -0
- package/dist/middleware/telemetry/provider.d.ts +3 -0
- package/dist/middleware/telemetry/provider.d.ts.map +1 -0
- package/dist/middleware/telemetry/types.d.ts +150 -0
- package/dist/middleware/telemetry/types.d.ts.map +1 -0
- package/dist/middleware/types.d.ts +426 -0
- package/dist/middleware/types.d.ts.map +1 -0
- package/dist/models/cache/adapters.d.ts +4 -0
- package/dist/models/cache/adapters.d.ts.map +1 -0
- package/dist/models/cache/index.d.ts +5 -0
- package/dist/models/cache/index.d.ts.map +1 -0
- package/dist/models/cache/manager.d.ts +32 -0
- package/dist/models/cache/manager.d.ts.map +1 -0
- package/dist/models/cache/types.d.ts +17 -0
- package/dist/models/cache/types.d.ts.map +1 -0
- package/dist/models/capability-resolver.d.ts +104 -0
- package/dist/models/capability-resolver.d.ts.map +1 -0
- package/dist/models/identifiers.d.ts +23 -0
- package/dist/models/identifiers.d.ts.map +1 -0
- package/dist/models/index.d.ts +35 -256
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +1 -1
- package/dist/models/overrides.d.ts +10 -0
- package/dist/models/overrides.d.ts.map +1 -0
- package/dist/models/profiles.d.ts +38 -0
- package/dist/models/profiles.d.ts.map +1 -0
- package/dist/models/reasoning/config.d.ts +49 -0
- package/dist/models/reasoning/config.d.ts.map +1 -0
- package/dist/models/reasoning/index.d.ts +12 -4
- package/dist/models/reasoning/index.d.ts.map +1 -0
- package/dist/models/reasoning/index.js +1 -1
- package/dist/models/reasoning/providers.d.ts +63 -0
- package/dist/models/reasoning/providers.d.ts.map +1 -0
- package/dist/{types-CQaXbRsS.d.ts → models/reasoning/types.d.ts} +7 -8
- package/dist/models/reasoning/types.d.ts.map +1 -0
- package/dist/models/remote/fetcher.d.ts +13 -0
- package/dist/models/remote/fetcher.d.ts.map +1 -0
- package/dist/models/remote/index.d.ts +8 -0
- package/dist/models/remote/index.d.ts.map +1 -0
- package/dist/models/remote/network.d.ts +6 -0
- package/dist/models/remote/network.d.ts.map +1 -0
- package/dist/models/remote/source.d.ts +16 -0
- package/dist/models/remote/source.d.ts.map +1 -0
- package/dist/models/remote/transform.d.ts +4 -0
- package/dist/models/remote/transform.d.ts.map +1 -0
- package/dist/models/remote/types.d.ts +28 -0
- package/dist/models/remote/types.d.ts.map +1 -0
- package/dist/models/resolver.d.ts +26 -0
- package/dist/models/resolver.d.ts.map +1 -0
- package/dist/models/types.d.ts +137 -0
- package/dist/models/types.d.ts.map +1 -0
- package/dist/plugin/compatibility.d.ts +11 -0
- package/dist/plugin/compatibility.d.ts.map +1 -0
- package/dist/plugin/define.d.ts +77 -0
- package/dist/plugin/define.d.ts.map +1 -0
- package/dist/plugin/event-bus.d.ts +31 -0
- package/dist/plugin/event-bus.d.ts.map +1 -0
- package/dist/plugin/index.d.ts +9 -458
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/loader.d.ts +63 -0
- package/dist/plugin/loader.d.ts.map +1 -0
- package/dist/plugin/registry.d.ts +81 -0
- package/dist/plugin/registry.d.ts.map +1 -0
- package/dist/plugin/settings.d.ts +36 -0
- package/dist/plugin/settings.d.ts.map +1 -0
- package/dist/plugin/types.d.ts +168 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/dist/profiles/apply.d.ts +17 -0
- package/dist/profiles/apply.d.ts.map +1 -0
- package/dist/profiles/builtins.d.ts +18 -0
- package/dist/profiles/builtins.d.ts.map +1 -0
- package/dist/profiles/index.d.ts +12 -55
- package/dist/profiles/index.d.ts.map +1 -0
- package/dist/profiles/patterns.d.ts +12 -0
- package/dist/profiles/patterns.d.ts.map +1 -0
- package/dist/profiles/types.d.ts +48 -0
- package/dist/profiles/types.d.ts.map +1 -0
- package/dist/prompt/builder/builder.d.ts +27 -0
- package/dist/prompt/builder/builder.d.ts.map +1 -0
- package/dist/prompt/builder/index.d.ts +11 -0
- package/dist/prompt/builder/index.d.ts.map +1 -0
- package/dist/prompt/builder/priorities.d.ts +13 -0
- package/dist/prompt/builder/priorities.d.ts.map +1 -0
- package/dist/prompt/builder/sections.d.ts +30 -0
- package/dist/prompt/builder/sections.d.ts.map +1 -0
- package/dist/prompt/environment.d.ts +46 -0
- package/dist/prompt/environment.d.ts.map +1 -0
- package/dist/prompt/index.d.ts +31 -220
- package/dist/prompt/index.d.ts.map +1 -0
- package/dist/prompt/index.js +3 -1
- package/dist/prompt/instructions.d.ts +104 -0
- package/dist/prompt/instructions.d.ts.map +1 -0
- package/dist/prompt/templates.d.ts +56 -0
- package/dist/prompt/templates.d.ts.map +1 -0
- package/dist/prompt/types.d.ts +218 -0
- package/dist/prompt/types.d.ts.map +1 -0
- package/dist/safety/errors.d.ts +18 -0
- package/dist/safety/errors.d.ts.map +1 -0
- package/dist/safety/handler.d.ts +16 -0
- package/dist/safety/handler.d.ts.map +1 -0
- package/dist/safety/index.d.ts +11 -133
- package/dist/safety/index.d.ts.map +1 -0
- package/dist/safety/patterns.d.ts +17 -0
- package/dist/safety/patterns.d.ts.map +1 -0
- package/dist/safety/policy.d.ts +31 -0
- package/dist/safety/policy.d.ts.map +1 -0
- package/dist/safety/presets.d.ts +43 -0
- package/dist/safety/presets.d.ts.map +1 -0
- package/dist/safety/risk.d.ts +14 -0
- package/dist/safety/risk.d.ts.map +1 -0
- package/dist/safety/types.d.ts +165 -0
- package/dist/safety/types.d.ts.map +1 -0
- package/dist/sandbox/index.d.ts +2 -81
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/types.d.ts +79 -0
- package/dist/sandbox/types.d.ts.map +1 -0
- package/dist/sessions/index.d.ts +13 -0
- package/dist/sessions/index.d.ts.map +1 -0
- package/dist/{storage → sessions}/index.js +6 -17
- package/dist/sessions/manager/default.d.ts +11 -0
- package/dist/sessions/manager/default.d.ts.map +1 -0
- package/dist/sessions/manager/index.d.ts +12 -0
- package/dist/sessions/manager/index.d.ts.map +1 -0
- package/dist/sessions/manager/session-manager.d.ts +67 -0
- package/dist/sessions/manager/session-manager.d.ts.map +1 -0
- package/dist/sessions/manager/types.d.ts +42 -0
- package/dist/sessions/manager/types.d.ts.map +1 -0
- package/dist/sessions/store/lock.d.ts +18 -0
- package/dist/sessions/store/lock.d.ts.map +1 -0
- package/dist/sessions/store/memory.d.ts +22 -0
- package/dist/sessions/store/memory.d.ts.map +1 -0
- package/dist/sessions/types.d.ts +215 -0
- package/dist/sessions/types.d.ts.map +1 -0
- package/dist/sessions/utils.d.ts +77 -0
- package/dist/sessions/utils.d.ts.map +1 -0
- package/dist/skill/discovery/constants.d.ts +6 -0
- package/dist/skill/discovery/constants.d.ts.map +1 -0
- package/dist/skill/discovery/dedupe.d.ts +3 -0
- package/dist/skill/discovery/dedupe.d.ts.map +1 -0
- package/dist/skill/discovery/discover.d.ts +3 -0
- package/dist/skill/discovery/discover.d.ts.map +1 -0
- package/dist/skill/discovery/fs.d.ts +4 -0
- package/dist/skill/discovery/fs.d.ts.map +1 -0
- package/dist/skill/discovery/index.d.ts +6 -0
- package/dist/skill/discovery/index.d.ts.map +1 -0
- package/dist/skill/discovery/scan.d.ts +3 -0
- package/dist/skill/discovery/scan.d.ts.map +1 -0
- package/dist/skill/discovery/types.d.ts +15 -0
- package/dist/skill/discovery/types.d.ts.map +1 -0
- package/dist/skill/index.d.ts +67 -89
- package/dist/skill/index.d.ts.map +1 -0
- package/dist/skill/index.js +2 -2
- package/dist/skill/loader/constants.d.ts +5 -0
- package/dist/skill/loader/constants.d.ts.map +1 -0
- package/dist/skill/loader/frontmatter.d.ts +5 -0
- package/dist/skill/loader/frontmatter.d.ts.map +1 -0
- package/dist/skill/loader/index.d.ts +8 -0
- package/dist/skill/loader/index.d.ts.map +1 -0
- package/dist/skill/loader/metadata.d.ts +3 -0
- package/dist/skill/loader/metadata.d.ts.map +1 -0
- package/dist/skill/loader/resources.d.ts +5 -0
- package/dist/skill/loader/resources.d.ts.map +1 -0
- package/dist/skill/registry.d.ts +177 -0
- package/dist/skill/registry.d.ts.map +1 -0
- package/dist/skill/tools.d.ts +77 -0
- package/dist/skill/tools.d.ts.map +1 -0
- package/dist/skill/types.d.ts +291 -0
- package/dist/skill/types.d.ts.map +1 -0
- package/dist/subagents/index.d.ts +8 -179
- package/dist/subagents/index.d.ts.map +1 -0
- package/dist/subagents/index.js +5 -4
- package/dist/subagents/installation.d.ts +23 -0
- package/dist/subagents/installation.d.ts.map +1 -0
- package/dist/subagents/results.d.ts +15 -0
- package/dist/subagents/results.d.ts.map +1 -0
- package/dist/subagents/roles/discovery.d.ts +38 -0
- package/dist/subagents/roles/discovery.d.ts.map +1 -0
- package/dist/subagents/roles/index.d.ts +5 -0
- package/dist/subagents/roles/index.d.ts.map +1 -0
- package/dist/subagents/roles/markdown-profile.d.ts +61 -0
- package/dist/subagents/roles/markdown-profile.d.ts.map +1 -0
- package/dist/subagents/tool-factories.d.ts +11 -0
- package/dist/subagents/tool-factories.d.ts.map +1 -0
- package/dist/subagents/tools.d.ts +13 -0
- package/dist/subagents/tools.d.ts.map +1 -0
- package/dist/subagents/types.d.ts +21 -0
- package/dist/subagents/types.d.ts.map +1 -0
- package/dist/team/coordinator/coordinator.d.ts +342 -0
- package/dist/team/coordinator/coordinator.d.ts.map +1 -0
- package/dist/team/coordinator/inbox.d.ts +99 -0
- package/dist/team/coordinator/inbox.d.ts.map +1 -0
- package/dist/team/coordinator/index.d.ts +19 -0
- package/dist/team/coordinator/index.d.ts.map +1 -0
- package/dist/team/coordinator/planning.d.ts +33 -0
- package/dist/team/coordinator/planning.d.ts.map +1 -0
- package/dist/team/coordinator/policy.d.ts +31 -0
- package/dist/team/coordinator/policy.d.ts.map +1 -0
- package/dist/team/coordinator/round-engine.d.ts +25 -0
- package/dist/team/coordinator/round-engine.d.ts.map +1 -0
- package/dist/team/coordinator/synthesis.d.ts +20 -0
- package/dist/team/coordinator/synthesis.d.ts.map +1 -0
- package/dist/team/coordinator/turn.d.ts +107 -0
- package/dist/team/coordinator/turn.d.ts.map +1 -0
- package/dist/team/coordinator/types.d.ts +344 -0
- package/dist/team/coordinator/types.d.ts.map +1 -0
- package/dist/team/events.d.ts +148 -0
- package/dist/team/events.d.ts.map +1 -0
- package/dist/team/execution.d.ts +51 -0
- package/dist/team/execution.d.ts.map +1 -0
- package/dist/team/index.d.ts +23 -545
- package/dist/team/index.d.ts.map +1 -0
- package/dist/team/index.js +2 -2
- package/dist/team/mailbox.d.ts +91 -0
- package/dist/team/mailbox.d.ts.map +1 -0
- package/dist/team/notifications.d.ts +23 -0
- package/dist/team/notifications.d.ts.map +1 -0
- package/dist/team/permissions.d.ts +88 -0
- package/dist/team/permissions.d.ts.map +1 -0
- package/dist/team/shutdown.d.ts +38 -0
- package/dist/team/shutdown.d.ts.map +1 -0
- package/dist/team/task-board.d.ts +161 -0
- package/dist/team/task-board.d.ts.map +1 -0
- package/dist/team/types.d.ts +233 -0
- package/dist/team/types.d.ts.map +1 -0
- package/dist/team/work-loop.d.ts +30 -0
- package/dist/team/work-loop.d.ts.map +1 -0
- package/dist/tool/executor.d.ts +59 -0
- package/dist/tool/executor.d.ts.map +1 -0
- package/dist/tool/host/index.d.ts +7 -38
- package/dist/tool/host/index.d.ts.map +1 -0
- package/dist/tool/host/local.d.ts +15 -0
- package/dist/tool/host/local.d.ts.map +1 -0
- package/dist/tool/host/registry.d.ts +17 -0
- package/dist/tool/host/registry.d.ts.map +1 -0
- package/dist/{types-C_LCeYNg.d.ts → tool/host/types.d.ts} +6 -7
- package/dist/tool/host/types.d.ts.map +1 -0
- package/dist/tool/index.d.ts +21 -285
- package/dist/tool/index.d.ts.map +1 -0
- package/dist/tool/index.js +4 -3
- package/dist/tool/registry.d.ts +130 -0
- package/dist/tool/registry.d.ts.map +1 -0
- package/dist/tool/replay.d.ts +11 -0
- package/dist/tool/replay.d.ts.map +1 -0
- package/dist/tool/tool-search.d.ts +50 -0
- package/dist/tool/tool-search.d.ts.map +1 -0
- package/dist/tool/tool.d.ts +308 -0
- package/dist/tool/tool.d.ts.map +1 -0
- package/dist/tool/truncation.d.ts +34 -0
- package/dist/tool/truncation.d.ts.map +1 -0
- package/dist/tool/turn-tools.d.ts +71 -0
- package/dist/tool/turn-tools.d.ts.map +1 -0
- package/dist/tracking/file-tracking.d.ts +25 -0
- package/dist/tracking/file-tracking.d.ts.map +1 -0
- package/dist/tracking/index.d.ts +9 -0
- package/dist/tracking/index.d.ts.map +1 -0
- package/dist/tracking/turn-tracker/diff.d.ts +11 -0
- package/dist/tracking/turn-tracker/diff.d.ts.map +1 -0
- package/dist/tracking/turn-tracker/index.d.ts +11 -0
- package/dist/tracking/turn-tracker/index.d.ts.map +1 -0
- package/dist/tracking/turn-tracker/tracker.d.ts +31 -0
- package/dist/tracking/turn-tracker/tracker.d.ts.map +1 -0
- package/dist/tracking/turn-tracker/types.d.ts +66 -0
- package/dist/tracking/turn-tracker/types.d.ts.map +1 -0
- package/dist/types/compaction.d.ts +191 -0
- package/dist/types/compaction.d.ts.map +1 -0
- package/dist/types/doom-loop.d.ts +25 -0
- package/dist/types/doom-loop.d.ts.map +1 -0
- package/dist/types/events.d.ts +196 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/messages.d.ts +119 -0
- package/dist/types/messages.d.ts.map +1 -0
- package/dist/types/stream.d.ts +172 -0
- package/dist/types/stream.d.ts.map +1 -0
- package/dist/types/tool.d.ts +309 -0
- package/dist/types/tool.d.ts.map +1 -0
- package/dist/types/turn-source.d.ts +36 -0
- package/dist/types/turn-source.d.ts.map +1 -0
- package/dist/utils/sleep.d.ts +7 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/package.json +49 -12
- package/dist/chunk-CJI7PVS2.js +0 -58
- package/dist/chunk-V6ETEYST.js +0 -2091
- package/dist/index-BCqEGzBj.d.ts +0 -251
- package/dist/instance-Bg61WSyz.d.ts +0 -6004
- package/dist/llm-error-D93FNNLY.d.ts +0 -32
- package/dist/storage/index.d.ts +0 -191
- package/dist/turn-tools/index.d.ts +0 -12
- package/dist/turn-tools/index.js +0 -1
- package/dist/{chunk-O2WCYSXQ.js → chunk-3NBTQHVV.js} +0 -0
- package/dist/{chunk-Q742PSH3.js → chunk-MJML3A2F.js} +36 -36
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
createAgentContextFragmentMessage
|
|
3
|
+
} from "./chunk-CGP6UNCQ.js";
|
|
4
|
+
|
|
5
|
+
// src/sessions/types.ts
|
|
6
|
+
var SESSION_FORMAT_VERSION = 1;
|
|
3
7
|
|
|
4
|
-
// src/
|
|
8
|
+
// src/sessions/utils.ts
|
|
5
9
|
function generateEntryId(existingIds) {
|
|
6
10
|
for (let i = 0; i < 100; i++) {
|
|
7
11
|
const id = crypto.randomUUID().slice(0, 8);
|
|
@@ -34,7 +38,8 @@ function serializeMessage(message) {
|
|
|
34
38
|
id: message.id,
|
|
35
39
|
role: message.role,
|
|
36
40
|
content: typeof message.content === "string" ? message.content : JSON.stringify(message.content),
|
|
37
|
-
createdAt: message.createdAt.toISOString()
|
|
41
|
+
createdAt: message.createdAt.toISOString(),
|
|
42
|
+
...message.contextFragment ? { contextFragment: structuredClone(message.contextFragment) } : {}
|
|
38
43
|
};
|
|
39
44
|
if (message.role === "user" && "system" in message) {
|
|
40
45
|
serialized.system = message.system;
|
|
@@ -57,7 +62,8 @@ function serializeMessage(message) {
|
|
|
57
62
|
function deserializeMessage(serialized) {
|
|
58
63
|
const base = {
|
|
59
64
|
id: serialized.id,
|
|
60
|
-
createdAt: new Date(serialized.createdAt)
|
|
65
|
+
createdAt: new Date(serialized.createdAt),
|
|
66
|
+
...serialized.contextFragment ? { contextFragment: structuredClone(serialized.contextFragment) } : {}
|
|
61
67
|
};
|
|
62
68
|
switch (serialized.role) {
|
|
63
69
|
case "user":
|
|
@@ -129,7 +135,7 @@ function extractSessionInfo(entries, path) {
|
|
|
129
135
|
lastTimestamp = entry.timestamp;
|
|
130
136
|
if (entry.type === "message") {
|
|
131
137
|
messageCount++;
|
|
132
|
-
if (!firstMessage && entry.message.role === "user") {
|
|
138
|
+
if (!firstMessage && entry.message.role === "user" && !entry.message.contextFragment) {
|
|
133
139
|
firstMessage = entry.message.content.slice(0, 100);
|
|
134
140
|
}
|
|
135
141
|
}
|
|
@@ -208,14 +214,16 @@ function buildMessagesFromEntries(entries, leafId) {
|
|
|
208
214
|
if (entry.type === "compaction") {
|
|
209
215
|
messages.length = 0;
|
|
210
216
|
skipUntilId = entry.firstKeptEntryId !== entry.id ? entry.firstKeptEntryId : void 0;
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
217
|
+
if (entry.displaySummary !== false) {
|
|
218
|
+
messages.push({
|
|
219
|
+
id: entry.id,
|
|
220
|
+
role: "system",
|
|
221
|
+
content: `## Previous Conversation Summary
|
|
215
222
|
|
|
216
223
|
${entry.summary}`,
|
|
217
|
-
|
|
218
|
-
|
|
224
|
+
createdAt: new Date(entry.timestamp)
|
|
225
|
+
});
|
|
226
|
+
}
|
|
219
227
|
continue;
|
|
220
228
|
}
|
|
221
229
|
if (skipUntilId && entry.id !== skipUntilId) {
|
|
@@ -262,6 +270,9 @@ function buildRecentMessagesFromEntryMap(entriesById, leafId, options = {}) {
|
|
|
262
270
|
recent.push(message);
|
|
263
271
|
}
|
|
264
272
|
} else if (entry.type === "compaction") {
|
|
273
|
+
if (entry.displaySummary === false) {
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
265
276
|
recent.push({
|
|
266
277
|
id: entry.id,
|
|
267
278
|
role: "system",
|
|
@@ -287,8 +298,8 @@ function normalizeRecentMessagesLimit(limit) {
|
|
|
287
298
|
return Math.floor(limit);
|
|
288
299
|
}
|
|
289
300
|
|
|
290
|
-
// src/
|
|
291
|
-
var
|
|
301
|
+
// src/sessions/store/memory.ts
|
|
302
|
+
var InMemorySessionStore = class {
|
|
292
303
|
sessions = /* @__PURE__ */ new Map();
|
|
293
304
|
async create(header) {
|
|
294
305
|
if (this.sessions.has(header.id)) {
|
|
@@ -339,224 +350,7 @@ var MemoryStorage = class {
|
|
|
339
350
|
}
|
|
340
351
|
};
|
|
341
352
|
|
|
342
|
-
// src/
|
|
343
|
-
import {
|
|
344
|
-
appendFile,
|
|
345
|
-
mkdir,
|
|
346
|
-
readFile,
|
|
347
|
-
readdir,
|
|
348
|
-
stat,
|
|
349
|
-
unlink,
|
|
350
|
-
writeFile
|
|
351
|
-
} from "fs/promises";
|
|
352
|
-
import { existsSync } from "fs";
|
|
353
|
-
import { basename, join } from "path";
|
|
354
|
-
async function ensureStorageDirectory(directory) {
|
|
355
|
-
if (!existsSync(directory)) {
|
|
356
|
-
await mkdir(directory, { recursive: true });
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
function getSessionFilePath(directory, extension, sessionId) {
|
|
360
|
-
const safeId = sessionId.replace(/[^a-zA-Z0-9-_]/g, "_");
|
|
361
|
-
const needsHash = safeId !== sessionId;
|
|
362
|
-
if (needsHash) {
|
|
363
|
-
let hash = 2166136261;
|
|
364
|
-
for (let i = 0; i < sessionId.length; i++) {
|
|
365
|
-
hash ^= sessionId.charCodeAt(i);
|
|
366
|
-
hash = hash * 16777619 >>> 0;
|
|
367
|
-
}
|
|
368
|
-
const suffix = hash.toString(16).padStart(8, "0");
|
|
369
|
-
return join(directory, `${safeId}_${suffix}${extension}`);
|
|
370
|
-
}
|
|
371
|
-
return join(directory, `${safeId}${extension}`);
|
|
372
|
-
}
|
|
373
|
-
async function loadEntriesFromDisk(filePath, sessionId) {
|
|
374
|
-
try {
|
|
375
|
-
const content = await readFile(filePath, "utf-8");
|
|
376
|
-
return parseJSONL(content);
|
|
377
|
-
} catch (error) {
|
|
378
|
-
if (error.code === "ENOENT") {
|
|
379
|
-
throw new Error(`Session not found: ${sessionId}`);
|
|
380
|
-
}
|
|
381
|
-
throw error;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
async function createSessionFile(filePath, header) {
|
|
385
|
-
await writeFile(filePath, toJSONL(header), "utf-8");
|
|
386
|
-
}
|
|
387
|
-
async function appendSessionEntry(filePath, entry) {
|
|
388
|
-
await appendFile(filePath, toJSONL(entry), "utf-8");
|
|
389
|
-
}
|
|
390
|
-
async function appendSessionEntries(filePath, entries) {
|
|
391
|
-
await appendFile(filePath, toJSONLBatch(entries), "utf-8");
|
|
392
|
-
}
|
|
393
|
-
function sessionFileExists(filePath) {
|
|
394
|
-
return existsSync(filePath);
|
|
395
|
-
}
|
|
396
|
-
async function deleteSessionFile(filePath) {
|
|
397
|
-
if (!existsSync(filePath)) {
|
|
398
|
-
return false;
|
|
399
|
-
}
|
|
400
|
-
try {
|
|
401
|
-
await unlink(filePath);
|
|
402
|
-
return true;
|
|
403
|
-
} catch {
|
|
404
|
-
return false;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
async function listSessionIds(directory, extension) {
|
|
408
|
-
try {
|
|
409
|
-
const files = await readdir(directory);
|
|
410
|
-
return files.filter((file) => file.endsWith(extension)).map((file) => basename(file, extension));
|
|
411
|
-
} catch {
|
|
412
|
-
return [];
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
async function clearSessionFiles(directory, extension) {
|
|
416
|
-
try {
|
|
417
|
-
const files = await readdir(directory);
|
|
418
|
-
await Promise.all(
|
|
419
|
-
files.filter((file) => file.endsWith(extension)).map((file) => unlink(join(directory, file)).catch(() => {
|
|
420
|
-
}))
|
|
421
|
-
);
|
|
422
|
-
} catch {
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
async function getSessionFileStats(filePath) {
|
|
426
|
-
try {
|
|
427
|
-
const info = await stat(filePath);
|
|
428
|
-
return {
|
|
429
|
-
size: info.size,
|
|
430
|
-
mtime: info.mtime
|
|
431
|
-
};
|
|
432
|
-
} catch {
|
|
433
|
-
return null;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// src/storage/file/storage.ts
|
|
438
|
-
var FileStorage = class {
|
|
439
|
-
directory;
|
|
440
|
-
extension;
|
|
441
|
-
useCache;
|
|
442
|
-
cache = /* @__PURE__ */ new Map();
|
|
443
|
-
initialized = false;
|
|
444
|
-
constructor(options) {
|
|
445
|
-
this.directory = options.directory;
|
|
446
|
-
this.extension = options.extension ?? ".jsonl";
|
|
447
|
-
this.useCache = options.cache ?? true;
|
|
448
|
-
}
|
|
449
|
-
async ensureDir() {
|
|
450
|
-
if (this.initialized) return;
|
|
451
|
-
await ensureStorageDirectory(this.directory);
|
|
452
|
-
this.initialized = true;
|
|
453
|
-
}
|
|
454
|
-
getPath(sessionId) {
|
|
455
|
-
return getSessionFilePath(this.directory, this.extension, sessionId);
|
|
456
|
-
}
|
|
457
|
-
async getEntries(sessionId) {
|
|
458
|
-
if (this.useCache && this.cache.has(sessionId)) {
|
|
459
|
-
return this.cache.get(sessionId);
|
|
460
|
-
}
|
|
461
|
-
const entries = await loadEntriesFromDisk(
|
|
462
|
-
this.getPath(sessionId),
|
|
463
|
-
sessionId
|
|
464
|
-
);
|
|
465
|
-
if (this.useCache) {
|
|
466
|
-
this.cache.set(sessionId, entries);
|
|
467
|
-
}
|
|
468
|
-
return entries;
|
|
469
|
-
}
|
|
470
|
-
async create(header) {
|
|
471
|
-
await this.ensureDir();
|
|
472
|
-
const filePath = this.getPath(header.id);
|
|
473
|
-
if (sessionFileExists(filePath)) {
|
|
474
|
-
throw new Error(`Session already exists: ${header.id}`);
|
|
475
|
-
}
|
|
476
|
-
await createSessionFile(filePath, header);
|
|
477
|
-
if (this.useCache) {
|
|
478
|
-
this.cache.set(header.id, [header]);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
async append(sessionId, entry) {
|
|
482
|
-
await this.ensureDir();
|
|
483
|
-
const filePath = this.getPath(sessionId);
|
|
484
|
-
if (!sessionFileExists(filePath)) {
|
|
485
|
-
throw new Error(`Session not found: ${sessionId}`);
|
|
486
|
-
}
|
|
487
|
-
await appendSessionEntry(filePath, entry);
|
|
488
|
-
if (this.useCache) {
|
|
489
|
-
this.cache.get(sessionId)?.push(entry);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
async appendBatch(sessionId, entries) {
|
|
493
|
-
if (entries.length === 0) return;
|
|
494
|
-
await this.ensureDir();
|
|
495
|
-
const filePath = this.getPath(sessionId);
|
|
496
|
-
if (!sessionFileExists(filePath)) {
|
|
497
|
-
throw new Error(`Session not found: ${sessionId}`);
|
|
498
|
-
}
|
|
499
|
-
await appendSessionEntries(filePath, entries);
|
|
500
|
-
if (this.useCache) {
|
|
501
|
-
this.cache.get(sessionId)?.push(...entries);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
async read(sessionId) {
|
|
505
|
-
await this.ensureDir();
|
|
506
|
-
return [...await this.getEntries(sessionId)];
|
|
507
|
-
}
|
|
508
|
-
async delete(sessionId) {
|
|
509
|
-
this.cache.delete(sessionId);
|
|
510
|
-
return deleteSessionFile(this.getPath(sessionId));
|
|
511
|
-
}
|
|
512
|
-
async exists(sessionId) {
|
|
513
|
-
if (this.useCache && this.cache.has(sessionId)) {
|
|
514
|
-
return true;
|
|
515
|
-
}
|
|
516
|
-
return sessionFileExists(this.getPath(sessionId));
|
|
517
|
-
}
|
|
518
|
-
async list() {
|
|
519
|
-
await this.ensureDir();
|
|
520
|
-
const infos = [];
|
|
521
|
-
for (const sessionId of await listSessionIds(
|
|
522
|
-
this.directory,
|
|
523
|
-
this.extension
|
|
524
|
-
)) {
|
|
525
|
-
try {
|
|
526
|
-
const info = extractSessionInfo(
|
|
527
|
-
await this.getEntries(sessionId),
|
|
528
|
-
this.getPath(sessionId)
|
|
529
|
-
);
|
|
530
|
-
if (info) {
|
|
531
|
-
infos.push(info);
|
|
532
|
-
}
|
|
533
|
-
} catch {
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
infos.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
|
|
537
|
-
return infos;
|
|
538
|
-
}
|
|
539
|
-
async clear() {
|
|
540
|
-
this.cache.clear();
|
|
541
|
-
await clearSessionFiles(this.directory, this.extension);
|
|
542
|
-
}
|
|
543
|
-
flushCache() {
|
|
544
|
-
this.cache.clear();
|
|
545
|
-
}
|
|
546
|
-
async reload(sessionId) {
|
|
547
|
-
this.cache.delete(sessionId);
|
|
548
|
-
return this.read(sessionId);
|
|
549
|
-
}
|
|
550
|
-
async listIds() {
|
|
551
|
-
await this.ensureDir();
|
|
552
|
-
return listSessionIds(this.directory, this.extension);
|
|
553
|
-
}
|
|
554
|
-
async getStats(sessionId) {
|
|
555
|
-
return getSessionFileStats(this.getPath(sessionId));
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
|
|
559
|
-
// src/storage/lock.ts
|
|
353
|
+
// src/sessions/store/lock.ts
|
|
560
354
|
var LocalSessionTurnLock = class {
|
|
561
355
|
locks = /* @__PURE__ */ new Map();
|
|
562
356
|
async acquire(sessionId, options = {}) {
|
|
@@ -631,74 +425,29 @@ function createAbortError() {
|
|
|
631
425
|
return error;
|
|
632
426
|
}
|
|
633
427
|
|
|
634
|
-
// src/
|
|
635
|
-
import { homedir } from "os";
|
|
636
|
-
import { join as join2 } from "path";
|
|
637
|
-
import { execSync } from "child_process";
|
|
638
|
-
function getDataDir(appName = "cuylabs") {
|
|
639
|
-
const platform = process.platform;
|
|
640
|
-
if (platform === "darwin") {
|
|
641
|
-
return join2(homedir(), `.${appName}`);
|
|
642
|
-
}
|
|
643
|
-
if (platform === "win32") {
|
|
644
|
-
return join2(
|
|
645
|
-
process.env.APPDATA || join2(homedir(), "AppData", "Roaming"),
|
|
646
|
-
appName
|
|
647
|
-
);
|
|
648
|
-
}
|
|
649
|
-
const xdgData = process.env.XDG_DATA_HOME || join2(homedir(), ".local", "share");
|
|
650
|
-
return join2(xdgData, appName);
|
|
651
|
-
}
|
|
652
|
-
function getSessionsDir(appName = "cuylabs") {
|
|
653
|
-
return join2(getDataDir(appName), "sessions");
|
|
654
|
-
}
|
|
655
|
-
function getGitRootHash(cwd) {
|
|
656
|
-
try {
|
|
657
|
-
const result = execSync("git rev-list --max-parents=0 --all 2>/dev/null", {
|
|
658
|
-
cwd,
|
|
659
|
-
encoding: "utf-8"
|
|
660
|
-
});
|
|
661
|
-
const roots = result.split("\n").filter(Boolean).map((s) => s.trim()).sort();
|
|
662
|
-
return roots[0] || null;
|
|
663
|
-
} catch {
|
|
664
|
-
return null;
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
function getProjectId(cwd) {
|
|
668
|
-
const gitHash = getGitRootHash(cwd);
|
|
669
|
-
if (gitHash) {
|
|
670
|
-
return gitHash.slice(0, 12);
|
|
671
|
-
}
|
|
672
|
-
return cwd.replace(/^\//, "").replace(/[/\\:]/g, "-").replace(/\s+/g, "-").toLowerCase().slice(-50);
|
|
673
|
-
}
|
|
674
|
-
function getProjectSessionsDir(cwd, appName = "cuylabs") {
|
|
675
|
-
const projectId = getProjectId(cwd);
|
|
676
|
-
return join2(getSessionsDir(appName), projectId);
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
// src/storage/manager/session-manager.ts
|
|
428
|
+
// src/sessions/manager/session-manager.ts
|
|
680
429
|
var SessionManager = class {
|
|
681
|
-
|
|
430
|
+
store;
|
|
682
431
|
currentSessionId = null;
|
|
683
432
|
currentLeafId = null;
|
|
684
433
|
entriesCache = [];
|
|
685
434
|
idsCache = /* @__PURE__ */ new Set();
|
|
686
435
|
entriesByIdCache = /* @__PURE__ */ new Map();
|
|
687
|
-
constructor(
|
|
688
|
-
this.
|
|
436
|
+
constructor(store) {
|
|
437
|
+
this.store = store ?? new InMemorySessionStore();
|
|
689
438
|
}
|
|
690
439
|
async create(options) {
|
|
691
440
|
const id = options.id ?? crypto.randomUUID();
|
|
692
441
|
const header = {
|
|
693
442
|
type: "header",
|
|
694
|
-
version:
|
|
443
|
+
version: SESSION_FORMAT_VERSION,
|
|
695
444
|
id,
|
|
696
445
|
cwd: options.cwd,
|
|
697
446
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
698
447
|
title: options.title,
|
|
699
448
|
parentSessionId: options.parentSessionId
|
|
700
449
|
};
|
|
701
|
-
await this.
|
|
450
|
+
await this.store.create(header);
|
|
702
451
|
this.currentSessionId = id;
|
|
703
452
|
this.currentLeafId = null;
|
|
704
453
|
this.entriesCache = [header];
|
|
@@ -707,7 +456,7 @@ var SessionManager = class {
|
|
|
707
456
|
return id;
|
|
708
457
|
}
|
|
709
458
|
async load(sessionId) {
|
|
710
|
-
const entries = await this.
|
|
459
|
+
const entries = await this.store.read(sessionId);
|
|
711
460
|
if (entries.length === 0) {
|
|
712
461
|
throw new Error(`Empty session: ${sessionId}`);
|
|
713
462
|
}
|
|
@@ -739,7 +488,7 @@ var SessionManager = class {
|
|
|
739
488
|
this.currentLeafId,
|
|
740
489
|
this.idsCache
|
|
741
490
|
);
|
|
742
|
-
await this.
|
|
491
|
+
await this.store.append(this.currentSessionId, entry);
|
|
743
492
|
this.entriesCache.push(entry);
|
|
744
493
|
this.idsCache.add(entry.id);
|
|
745
494
|
this.entriesByIdCache.set(entry.id, entry);
|
|
@@ -762,11 +511,20 @@ var SessionManager = class {
|
|
|
762
511
|
this.entriesByIdCache.set(entry.id, entry);
|
|
763
512
|
parentId = entry.id;
|
|
764
513
|
}
|
|
765
|
-
await this.
|
|
514
|
+
await this.store.appendBatch(this.currentSessionId, entries);
|
|
766
515
|
this.entriesCache.push(...entries);
|
|
767
516
|
this.currentLeafId = entries[entries.length - 1].id;
|
|
768
517
|
return entries.map((entry) => entry.id);
|
|
769
518
|
}
|
|
519
|
+
async addContextFragment(contextFragment) {
|
|
520
|
+
return this.addMessage(
|
|
521
|
+
createAgentContextFragmentMessage({
|
|
522
|
+
lifetime: "session",
|
|
523
|
+
placement: "before-history",
|
|
524
|
+
...contextFragment
|
|
525
|
+
})
|
|
526
|
+
);
|
|
527
|
+
}
|
|
770
528
|
getMessages(leafId) {
|
|
771
529
|
return buildMessagesFromEntries(
|
|
772
530
|
this.entriesCache,
|
|
@@ -791,7 +549,7 @@ var SessionManager = class {
|
|
|
791
549
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
792
550
|
...options
|
|
793
551
|
};
|
|
794
|
-
await this.
|
|
552
|
+
await this.store.append(this.currentSessionId, entry);
|
|
795
553
|
this.entriesCache.push(entry);
|
|
796
554
|
this.idsCache.add(entry.id);
|
|
797
555
|
this.entriesByIdCache.set(entry.id, entry);
|
|
@@ -817,14 +575,19 @@ var SessionManager = class {
|
|
|
817
575
|
id: compactionId,
|
|
818
576
|
parentId: this.currentLeafId,
|
|
819
577
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
578
|
+
...options.phase ? { phase: options.phase } : {},
|
|
579
|
+
...options.trigger ? { trigger: options.trigger } : {},
|
|
580
|
+
...options.reason ? { reason: options.reason } : {},
|
|
820
581
|
summary: options.summary,
|
|
582
|
+
...options.displaySummary === false ? { displaySummary: false } : {},
|
|
821
583
|
firstKeptEntryId: messageEntries[0]?.id ?? compactionId,
|
|
822
584
|
tokensBefore: options.tokensBefore,
|
|
823
585
|
tokensAfter: options.tokensAfter,
|
|
586
|
+
...options.cutReason ? { cutReason: options.cutReason } : {},
|
|
824
587
|
...options.readFiles ? { readFiles: options.readFiles } : {},
|
|
825
588
|
...options.modifiedFiles ? { modifiedFiles: options.modifiedFiles } : {}
|
|
826
589
|
};
|
|
827
|
-
await this.
|
|
590
|
+
await this.store.appendBatch(this.currentSessionId, [
|
|
828
591
|
compactionEntry,
|
|
829
592
|
...messageEntries
|
|
830
593
|
]);
|
|
@@ -851,7 +614,7 @@ var SessionManager = class {
|
|
|
851
614
|
branchFromId: fromEntryId,
|
|
852
615
|
summary
|
|
853
616
|
};
|
|
854
|
-
await this.
|
|
617
|
+
await this.store.append(this.currentSessionId, entry);
|
|
855
618
|
this.entriesCache.push(entry);
|
|
856
619
|
this.idsCache.add(entry.id);
|
|
857
620
|
this.entriesByIdCache.set(entry.id, entry);
|
|
@@ -873,7 +636,7 @@ var SessionManager = class {
|
|
|
873
636
|
this.currentLeafId,
|
|
874
637
|
this.idsCache
|
|
875
638
|
);
|
|
876
|
-
await this.
|
|
639
|
+
await this.store.append(this.currentSessionId, entry);
|
|
877
640
|
this.entriesCache.push(entry);
|
|
878
641
|
this.idsCache.add(entry.id);
|
|
879
642
|
this.entriesByIdCache.set(entry.id, entry);
|
|
@@ -912,10 +675,10 @@ var SessionManager = class {
|
|
|
912
675
|
return header?.type === "header" ? header : null;
|
|
913
676
|
}
|
|
914
677
|
async listSessions() {
|
|
915
|
-
return this.
|
|
678
|
+
return this.store.list();
|
|
916
679
|
}
|
|
917
680
|
async deleteSession(sessionId) {
|
|
918
|
-
const result = await this.
|
|
681
|
+
const result = await this.store.delete(sessionId);
|
|
919
682
|
if (sessionId === this.currentSessionId) {
|
|
920
683
|
this.currentSessionId = null;
|
|
921
684
|
this.currentLeafId = null;
|
|
@@ -926,14 +689,14 @@ var SessionManager = class {
|
|
|
926
689
|
return result;
|
|
927
690
|
}
|
|
928
691
|
async sessionExists(sessionId) {
|
|
929
|
-
return this.
|
|
692
|
+
return this.store.exists(sessionId);
|
|
930
693
|
}
|
|
931
|
-
|
|
932
|
-
return this.
|
|
694
|
+
getStore() {
|
|
695
|
+
return this.store;
|
|
933
696
|
}
|
|
934
697
|
};
|
|
935
698
|
|
|
936
|
-
// src/
|
|
699
|
+
// src/sessions/manager/default.ts
|
|
937
700
|
var defaultManager = null;
|
|
938
701
|
function getDefaultSessionManager() {
|
|
939
702
|
if (!defaultManager) {
|
|
@@ -941,13 +704,13 @@ function getDefaultSessionManager() {
|
|
|
941
704
|
}
|
|
942
705
|
return defaultManager;
|
|
943
706
|
}
|
|
944
|
-
function configureDefaultSessionManager(
|
|
945
|
-
defaultManager = new SessionManager(
|
|
707
|
+
function configureDefaultSessionManager(store) {
|
|
708
|
+
defaultManager = new SessionManager(store);
|
|
946
709
|
return defaultManager;
|
|
947
710
|
}
|
|
948
711
|
|
|
949
712
|
export {
|
|
950
|
-
|
|
713
|
+
SESSION_FORMAT_VERSION,
|
|
951
714
|
generateEntryId,
|
|
952
715
|
parseJSONL,
|
|
953
716
|
toJSONL,
|
|
@@ -962,14 +725,8 @@ export {
|
|
|
962
725
|
buildMessagesFromEntries,
|
|
963
726
|
buildRecentMessagesFromEntries,
|
|
964
727
|
buildRecentMessagesFromEntryMap,
|
|
965
|
-
|
|
966
|
-
FileStorage,
|
|
728
|
+
InMemorySessionStore,
|
|
967
729
|
LocalSessionTurnLock,
|
|
968
|
-
getDataDir,
|
|
969
|
-
getSessionsDir,
|
|
970
|
-
getGitRootHash,
|
|
971
|
-
getProjectId,
|
|
972
|
-
getProjectSessionsDir,
|
|
973
730
|
SessionManager,
|
|
974
731
|
getDefaultSessionManager,
|
|
975
732
|
configureDefaultSessionManager
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DEFAULT_AGENT_NAME,
|
|
3
2
|
isBlockedModelCall
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-W6LWIMIX.js";
|
|
5
4
|
import {
|
|
6
5
|
extractModelId,
|
|
7
6
|
extractProvider
|
|
@@ -199,6 +198,70 @@ var MiddlewareRunner = class {
|
|
|
199
198
|
return sections;
|
|
200
199
|
}
|
|
201
200
|
// --------------------------------------------------------------------------
|
|
201
|
+
// contextFragments — array order, transient model-visible context
|
|
202
|
+
// --------------------------------------------------------------------------
|
|
203
|
+
async collectContextFragments(ctx) {
|
|
204
|
+
const contextFragments = [];
|
|
205
|
+
for (const mw of this.stack) {
|
|
206
|
+
if (!mw.contextFragments) continue;
|
|
207
|
+
try {
|
|
208
|
+
const result = await mw.contextFragments(ctx);
|
|
209
|
+
if (!result) continue;
|
|
210
|
+
if (Array.isArray(result)) {
|
|
211
|
+
contextFragments.push(...result);
|
|
212
|
+
} else {
|
|
213
|
+
contextFragments.push(result);
|
|
214
|
+
}
|
|
215
|
+
} catch (err) {
|
|
216
|
+
this.log.warn(
|
|
217
|
+
`"${mw.name}" contextFragments error: ${err instanceof Error ? err.message : String(err)}`
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return contextFragments;
|
|
222
|
+
}
|
|
223
|
+
// --------------------------------------------------------------------------
|
|
224
|
+
// context compaction commit lifecycle — before in array order, after in reverse order
|
|
225
|
+
// --------------------------------------------------------------------------
|
|
226
|
+
/**
|
|
227
|
+
* Run all `beforeContextCompactionCommit` hooks in order.
|
|
228
|
+
*
|
|
229
|
+
* Hooks are awaited because durability work, such as memory capture, must
|
|
230
|
+
* complete before old context is replaced. Errors are logged and do not abort
|
|
231
|
+
* compaction.
|
|
232
|
+
*/
|
|
233
|
+
async runBeforeContextCompactionCommit(ctx) {
|
|
234
|
+
for (const mw of this.stack) {
|
|
235
|
+
if (!mw.beforeContextCompactionCommit) continue;
|
|
236
|
+
try {
|
|
237
|
+
await mw.beforeContextCompactionCommit(ctx);
|
|
238
|
+
} catch (err) {
|
|
239
|
+
this.log.warn(
|
|
240
|
+
`"${mw.name}" beforeContextCompactionCommit error: ${err instanceof Error ? err.message : String(err)}`
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Run all `afterContextCompactionCommit` hooks in reverse order.
|
|
247
|
+
*
|
|
248
|
+
* This mirrors `afterToolCall` / `model.output` ordering. Errors are logged
|
|
249
|
+
* and do not abort the turn.
|
|
250
|
+
*/
|
|
251
|
+
async runAfterContextCompactionCommit(ctx) {
|
|
252
|
+
for (let i = this.stack.length - 1; i >= 0; i--) {
|
|
253
|
+
const mw = this.stack[i];
|
|
254
|
+
if (!mw.afterContextCompactionCommit) continue;
|
|
255
|
+
try {
|
|
256
|
+
await mw.afterContextCompactionCommit(ctx);
|
|
257
|
+
} catch (err) {
|
|
258
|
+
this.log.warn(
|
|
259
|
+
`"${mw.name}" afterContextCompactionCommit error: ${err instanceof Error ? err.message : String(err)}`
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
// --------------------------------------------------------------------------
|
|
202
265
|
// onEvent — fire-and-forget, all run
|
|
203
266
|
// --------------------------------------------------------------------------
|
|
204
267
|
/**
|
|
@@ -212,7 +275,10 @@ var MiddlewareRunner = class {
|
|
|
212
275
|
if (!mw.onEvent) continue;
|
|
213
276
|
try {
|
|
214
277
|
mw.onEvent(event);
|
|
215
|
-
} catch {
|
|
278
|
+
} catch (err) {
|
|
279
|
+
this.log.warn(
|
|
280
|
+
`"${mw.name}" onEvent error: ${err instanceof Error ? err.message : String(err)}`
|
|
281
|
+
);
|
|
216
282
|
}
|
|
217
283
|
}
|
|
218
284
|
}
|
|
@@ -375,6 +441,7 @@ function safeJsonStringify(value) {
|
|
|
375
441
|
}
|
|
376
442
|
}
|
|
377
443
|
var A365_MESSAGE_SCHEMA_VERSION = "0.1.0";
|
|
444
|
+
var DEFAULT_TELEMETRY_AGENT_NAME = "agent";
|
|
378
445
|
function createInputMessagesAttribute(content) {
|
|
379
446
|
return JSON.stringify({
|
|
380
447
|
version: A365_MESSAGE_SCHEMA_VERSION,
|
|
@@ -421,7 +488,7 @@ function scheduleSpanTimeout(options) {
|
|
|
421
488
|
function otelMiddleware(config = {}) {
|
|
422
489
|
const recordInputs = config.recordInputs ?? true;
|
|
423
490
|
const recordOutputs = config.recordOutputs ?? true;
|
|
424
|
-
const agentName = config.agentName ??
|
|
491
|
+
const agentName = config.agentName ?? DEFAULT_TELEMETRY_AGENT_NAME;
|
|
425
492
|
const emitToolSpans = config.emitToolSpans ?? true;
|
|
426
493
|
const spanTimeoutMs = config.spanTimeoutMs ?? 5 * 60 * 1e3;
|
|
427
494
|
const configuredSpanAttributes = config.spanAttributes ?? {};
|
|
@@ -776,7 +843,6 @@ async function createAndRegisterProvider(spanProcessor, serviceName) {
|
|
|
776
843
|
]);
|
|
777
844
|
const provider = new NodeTracerProvider({
|
|
778
845
|
resource: resourceFromAttributes({ [ATTR_SERVICE_NAME]: serviceName }),
|
|
779
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
780
846
|
spanProcessors: [spanProcessor]
|
|
781
847
|
});
|
|
782
848
|
provider.register();
|