@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
package/dist/prompt/index.d.ts
CHANGED
|
@@ -1,228 +1,39 @@
|
|
|
1
|
-
import { bV as ModelFamily, bd as EnvironmentInfo, by as InstructionFile } from '../instance-Bg61WSyz.js';
|
|
2
|
-
export { cc as PromptBuildContext, P as PromptBuilder, cd as PromptConfig, ce as PromptSection, cD as SkillConfig, dT as createPromptBuilder } from '../instance-Bg61WSyz.js';
|
|
3
|
-
import { LanguageModel } from 'ai';
|
|
4
|
-
import '../types-C_LCeYNg.js';
|
|
5
|
-
import '../types-RSCv7nQ4.js';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import '../types-CQaXbRsS.js';
|
|
8
|
-
import '../types-DMjoFKKv.js';
|
|
9
|
-
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
10
|
-
import '@modelcontextprotocol/sdk/types.js';
|
|
11
|
-
import '@ai-sdk/provider-utils';
|
|
12
|
-
import '../sandbox/index.js';
|
|
13
|
-
import '../llm-error-D93FNNLY.js';
|
|
14
|
-
|
|
15
1
|
/**
|
|
16
|
-
* Prompt
|
|
2
|
+
* Prompt Pipeline Module
|
|
17
3
|
*
|
|
18
|
-
*
|
|
19
|
-
* These establish the agent's general approach and tool-use discipline
|
|
20
|
-
* without assuming a specific domain (coding, browsing, etc.).
|
|
4
|
+
* Composable system prompt architecture for @cuylabs/agent-core.
|
|
21
5
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* - computer-agent → computer-use templates
|
|
25
|
-
* - your-custom-agent → whatever you need
|
|
26
|
-
*
|
|
27
|
-
* Consumer packages inject their templates via:
|
|
28
|
-
* createPromptBuilder({ baseTemplate: MY_CODING_TEMPLATE })
|
|
29
|
-
* builder.addSection({ id: "coding", ... })
|
|
30
|
-
*
|
|
31
|
-
* This file also contains model family detection, which IS infrastructure
|
|
32
|
-
* and belongs here — any consumer benefits from knowing the model family
|
|
33
|
-
* to optimize prompt formatting.
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Detect which model family a LanguageModel belongs to.
|
|
38
|
-
*
|
|
39
|
-
* Uses the provider string first (most reliable), then falls back
|
|
40
|
-
* to pattern matching on the model ID.
|
|
6
|
+
* The prompt pipeline builds system prompts from layered sections:
|
|
7
|
+
* Base Template → Environment → Instructions → Custom Sections → Per-Turn
|
|
41
8
|
*
|
|
42
9
|
* @example
|
|
43
10
|
* ```typescript
|
|
44
|
-
* import {
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Environment Block — Runtime context for the system prompt
|
|
67
|
-
*
|
|
68
|
-
* Gathers information about the working environment (cwd, platform,
|
|
69
|
-
* git status, date, shell) and formats it as a structured block
|
|
70
|
-
* that gets injected into the prompt at priority 20.
|
|
71
|
-
*
|
|
72
|
-
* This gives the model awareness of:
|
|
73
|
-
* - Where it's working (directory, project)
|
|
74
|
-
* - What platform it's on (affects path separators, commands)
|
|
75
|
-
* - Current time (useful for time-sensitive tasks)
|
|
76
|
-
* - Git state (branch, clean/dirty)
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Gather runtime environment information.
|
|
81
|
-
*
|
|
82
|
-
* Collects cwd, platform, git status, date, and shell.
|
|
83
|
-
* Git commands use a short timeout to avoid hanging on slow repos.
|
|
84
|
-
*
|
|
85
|
-
* @param cwd - Working directory to gather info for
|
|
86
|
-
* @returns Environment info object
|
|
87
|
-
*/
|
|
88
|
-
declare function gatherEnvironment(cwd: string): EnvironmentInfo;
|
|
89
|
-
/**
|
|
90
|
-
* Format environment info as a prompt-friendly block.
|
|
91
|
-
*
|
|
92
|
-
* Output example:
|
|
93
|
-
* ```
|
|
94
|
-
* <workspace>
|
|
95
|
-
* Directory: /Users/dev/my-project
|
|
96
|
-
* Project: my-project
|
|
97
|
-
* Platform: macOS (darwin arm64)
|
|
98
|
-
* Date: Saturday, February 8, 2026
|
|
99
|
-
* Shell: /bin/zsh
|
|
100
|
-
* Git: main (clean)
|
|
101
|
-
* </workspace>
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
declare function formatEnvironment(info: EnvironmentInfo): string;
|
|
105
|
-
/**
|
|
106
|
-
* Create a short one-line summary of the environment.
|
|
107
|
-
* Useful for compact contexts or logging.
|
|
108
|
-
*/
|
|
109
|
-
declare function summarizeEnvironment(info: EnvironmentInfo): string;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Instruction File Discovery — Project rules from the filesystem
|
|
113
|
-
*
|
|
114
|
-
* Discovers instruction files (AGENTS.md, CLAUDE.md, COPILOT.md, etc.)
|
|
115
|
-
* by walking up the directory tree from cwd. These files provide
|
|
116
|
-
* project-specific or workspace-level guidance to the agent.
|
|
117
|
-
*
|
|
118
|
-
* Discovery order (general → specific):
|
|
119
|
-
* 1. Global instruction files (from config)
|
|
120
|
-
* 2. Workspace-level files (found near git root or higher directories)
|
|
121
|
-
* 3. Project-level files (found in or near cwd)
|
|
122
|
-
*
|
|
123
|
-
* All discovered files are included, ordered from most general to most
|
|
124
|
-
* specific. This means project-level instructions appear last and
|
|
125
|
-
* effectively take precedence in case of conflicting guidance.
|
|
126
|
-
*
|
|
127
|
-
* Compatible with:
|
|
128
|
-
* - AGENTS.md convention
|
|
129
|
-
* - CLAUDE.md convention
|
|
130
|
-
* - COPILOT.md convention
|
|
131
|
-
* - CuyLabs' own .cuylabs/instructions.md
|
|
132
|
-
*/
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Default file patterns to search for.
|
|
136
|
-
* Checked in each directory when walking up from cwd.
|
|
137
|
-
*/
|
|
138
|
-
declare const DEFAULT_INSTRUCTION_PATTERNS: string[];
|
|
139
|
-
/**
|
|
140
|
-
* Maximum file size for instruction files (50KB).
|
|
141
|
-
* Files larger than this are skipped to prevent prompt bloat.
|
|
142
|
-
*/
|
|
143
|
-
declare const DEFAULT_MAX_FILE_SIZE = 51200;
|
|
144
|
-
/**
|
|
145
|
-
* Maximum directories to walk up from cwd.
|
|
146
|
-
*/
|
|
147
|
-
declare const DEFAULT_MAX_DEPTH = 10;
|
|
148
|
-
/**
|
|
149
|
-
* Discover instruction files by walking up the directory tree from cwd.
|
|
150
|
-
*
|
|
151
|
-
* Searches for files matching the given patterns in each directory,
|
|
152
|
-
* starting from `cwd` and walking up to the filesystem root (or until
|
|
153
|
-
* `maxDepth` is reached).
|
|
154
|
-
*
|
|
155
|
-
* Results are ordered from **most general** (shallowest/root-level) to
|
|
156
|
-
* **most specific** (deepest/cwd-level), so that specific project rules
|
|
157
|
-
* appear last and take natural precedence.
|
|
158
|
-
*
|
|
159
|
-
* @param cwd - Starting directory for the search
|
|
160
|
-
* @param patterns - File name patterns to look for (e.g. ["AGENTS.md"])
|
|
161
|
-
* @param options - Discovery options
|
|
162
|
-
* @returns Array of discovered instruction files, general → specific
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* ```typescript
|
|
166
|
-
* const files = await discoverInstructions("/Users/dev/project/src", [
|
|
167
|
-
* "AGENTS.md",
|
|
168
|
-
* "CLAUDE.md",
|
|
169
|
-
* ]);
|
|
170
|
-
*
|
|
171
|
-
* // Might find:
|
|
172
|
-
* // 1. /Users/dev/project/AGENTS.md (depth: 1, workspace)
|
|
173
|
-
* // 2. /Users/dev/project/src/AGENTS.md (depth: 0, project)
|
|
174
|
-
* ```
|
|
175
|
-
*/
|
|
176
|
-
declare function discoverInstructions(cwd: string, patterns?: string[], options?: {
|
|
177
|
-
maxDepth?: number;
|
|
178
|
-
maxFileSize?: number;
|
|
179
|
-
stopAtGitRoot?: boolean;
|
|
180
|
-
}): Promise<InstructionFile[]>;
|
|
181
|
-
/**
|
|
182
|
-
* Load global instruction files from explicit paths.
|
|
183
|
-
*
|
|
184
|
-
* Global instructions are always included regardless of cwd.
|
|
185
|
-
* Useful for organization-wide coding standards or team rules.
|
|
186
|
-
*
|
|
187
|
-
* @param paths - Absolute paths to global instruction files
|
|
188
|
-
* @param maxSize - Maximum file size in bytes
|
|
189
|
-
* @returns Array of loaded instruction files
|
|
190
|
-
*/
|
|
191
|
-
declare function loadGlobalInstructions(paths: string[], maxSize?: number): Promise<InstructionFile[]>;
|
|
192
|
-
/**
|
|
193
|
-
* Format discovered instruction files into a prompt block.
|
|
194
|
-
*
|
|
195
|
-
* Each file is wrapped in a tagged block with its source path
|
|
196
|
-
* for transparency. Files are already ordered general → specific.
|
|
197
|
-
*
|
|
198
|
-
* Output example:
|
|
199
|
-
* ```
|
|
200
|
-
* <project-instructions>
|
|
201
|
-
*
|
|
202
|
-
* <instructions source="AGENTS.md" scope="workspace">
|
|
203
|
-
* ... workspace-level content ...
|
|
204
|
-
* </instructions>
|
|
205
|
-
*
|
|
206
|
-
* <instructions source="src/AGENTS.md" scope="project">
|
|
207
|
-
* ... project-specific content ...
|
|
208
|
-
* </instructions>
|
|
209
|
-
*
|
|
210
|
-
* </project-instructions>
|
|
11
|
+
* import { createPromptBuilder } from "@cuylabs/agent-core";
|
|
12
|
+
*
|
|
13
|
+
* const builder = createPromptBuilder({
|
|
14
|
+
* includeEnvironment: true,
|
|
15
|
+
* includeInstructions: true,
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* // Add custom context
|
|
19
|
+
* builder.addSection({
|
|
20
|
+
* id: "team-rules",
|
|
21
|
+
* label: "Team Rules",
|
|
22
|
+
* content: "Always use TypeScript strict mode.",
|
|
23
|
+
* priority: 40,
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Build the prompt
|
|
27
|
+
* const prompt = await builder.build({
|
|
28
|
+
* cwd: "/path/to/project",
|
|
29
|
+
* model: myModel,
|
|
30
|
+
* });
|
|
211
31
|
* ```
|
|
212
32
|
*/
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
declare const PRIORITY_INSTRUCTIONS = 30;
|
|
221
|
-
/** Priority for custom user-defined sections. */
|
|
222
|
-
declare const PRIORITY_CUSTOM = 50;
|
|
223
|
-
/** Priority for skill summary injection. */
|
|
224
|
-
declare const PRIORITY_SKILLS = 70;
|
|
225
|
-
/** Priority for per-turn override content. */
|
|
226
|
-
declare const PRIORITY_OVERRIDE = 90;
|
|
227
|
-
|
|
228
|
-
export { DEFAULT_INSTRUCTION_PATTERNS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_FILE_SIZE, EnvironmentInfo, InstructionFile, ModelFamily, PRIORITY_BASE, PRIORITY_CUSTOM, PRIORITY_ENVIRONMENT, PRIORITY_INSTRUCTIONS, PRIORITY_OVERRIDE, PRIORITY_SKILLS, detectModelFamily, discoverInstructions, formatEnvironment, formatInstructions, gatherEnvironment, getAvailableFamilies, getTemplate, loadGlobalInstructions, summarizeEnvironment };
|
|
33
|
+
export type { ModelFamily, EnvironmentInfo, InstructionFile, PromptSection, PromptBuildContext, PromptConfig, } from "./types.js";
|
|
34
|
+
export { DEFAULT_SYSTEM_PROMPT, detectModelFamily, getTemplate, getAvailableFamilies, } from "./templates.js";
|
|
35
|
+
export { gatherEnvironment, formatEnvironment, summarizeEnvironment, } from "./environment.js";
|
|
36
|
+
export { discoverInstructions, loadGlobalInstructions, formatInstructions, DEFAULT_INSTRUCTION_PATTERNS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_DEPTH, } from "./instructions.js";
|
|
37
|
+
export { PromptBuilder, createPromptBuilder, PRIORITY_BASE, PRIORITY_ENVIRONMENT, PRIORITY_INSTRUCTIONS, PRIORITY_CUSTOM, PRIORITY_SKILLS, PRIORITY_OVERRIDE, } from "./builder/index.js";
|
|
38
|
+
export type { SkillConfig } from "../skill/types.js";
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompt/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,YAAY,EACV,WAAW,EACX,eAAe,EACf,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,4BAA4B,EAC5B,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/prompt/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
DEFAULT_INSTRUCTION_PATTERNS,
|
|
3
3
|
DEFAULT_MAX_DEPTH,
|
|
4
4
|
DEFAULT_MAX_FILE_SIZE,
|
|
5
|
+
DEFAULT_SYSTEM_PROMPT,
|
|
5
6
|
PRIORITY_BASE,
|
|
6
7
|
PRIORITY_CUSTOM,
|
|
7
8
|
PRIORITY_ENVIRONMENT,
|
|
@@ -19,13 +20,14 @@ import {
|
|
|
19
20
|
getTemplate,
|
|
20
21
|
loadGlobalInstructions,
|
|
21
22
|
summarizeEnvironment
|
|
22
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-V4MIDL5B.js";
|
|
23
24
|
import "../chunk-I7EJGKUP.js";
|
|
24
25
|
import "../chunk-I6PKJ7XQ.js";
|
|
25
26
|
export {
|
|
26
27
|
DEFAULT_INSTRUCTION_PATTERNS,
|
|
27
28
|
DEFAULT_MAX_DEPTH,
|
|
28
29
|
DEFAULT_MAX_FILE_SIZE,
|
|
30
|
+
DEFAULT_SYSTEM_PROMPT,
|
|
29
31
|
PRIORITY_BASE,
|
|
30
32
|
PRIORITY_CUSTOM,
|
|
31
33
|
PRIORITY_ENVIRONMENT,
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Instruction File Discovery — Project rules from the filesystem
|
|
3
|
+
*
|
|
4
|
+
* Discovers instruction files (AGENTS.md, CLAUDE.md, COPILOT.md, etc.)
|
|
5
|
+
* by walking up the directory tree from cwd. These files provide
|
|
6
|
+
* project-specific or workspace-level guidance to the agent.
|
|
7
|
+
*
|
|
8
|
+
* Discovery order (general → specific):
|
|
9
|
+
* 1. Global instruction files (from config)
|
|
10
|
+
* 2. Workspace-level files (found near git root or higher directories)
|
|
11
|
+
* 3. Project-level files (found in or near cwd)
|
|
12
|
+
*
|
|
13
|
+
* All discovered files are included, ordered from most general to most
|
|
14
|
+
* specific. This means project-level instructions appear last and
|
|
15
|
+
* effectively take precedence in case of conflicting guidance.
|
|
16
|
+
*
|
|
17
|
+
* Compatible with:
|
|
18
|
+
* - AGENTS.md convention
|
|
19
|
+
* - CLAUDE.md convention
|
|
20
|
+
* - COPILOT.md convention
|
|
21
|
+
* - CuyLabs' own .cuylabs/instructions.md
|
|
22
|
+
*/
|
|
23
|
+
import type { InstructionFile } from "./types.js";
|
|
24
|
+
/**
|
|
25
|
+
* Default file patterns to search for.
|
|
26
|
+
* Checked in each directory when walking up from cwd.
|
|
27
|
+
*/
|
|
28
|
+
export declare const DEFAULT_INSTRUCTION_PATTERNS: string[];
|
|
29
|
+
/**
|
|
30
|
+
* Maximum file size for instruction files (50KB).
|
|
31
|
+
* Files larger than this are skipped to prevent prompt bloat.
|
|
32
|
+
*/
|
|
33
|
+
export declare const DEFAULT_MAX_FILE_SIZE = 51200;
|
|
34
|
+
/**
|
|
35
|
+
* Maximum directories to walk up from cwd.
|
|
36
|
+
*/
|
|
37
|
+
export declare const DEFAULT_MAX_DEPTH = 10;
|
|
38
|
+
/**
|
|
39
|
+
* Discover instruction files by walking up the directory tree from cwd.
|
|
40
|
+
*
|
|
41
|
+
* Searches for files matching the given patterns in each directory,
|
|
42
|
+
* starting from `cwd` and walking up to the filesystem root (or until
|
|
43
|
+
* `maxDepth` is reached).
|
|
44
|
+
*
|
|
45
|
+
* Results are ordered from **most general** (shallowest/root-level) to
|
|
46
|
+
* **most specific** (deepest/cwd-level), so that specific project rules
|
|
47
|
+
* appear last and take natural precedence.
|
|
48
|
+
*
|
|
49
|
+
* @param cwd - Starting directory for the search
|
|
50
|
+
* @param patterns - File name patterns to look for (e.g. ["AGENTS.md"])
|
|
51
|
+
* @param options - Discovery options
|
|
52
|
+
* @returns Array of discovered instruction files, general → specific
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* const files = await discoverInstructions("/Users/dev/project/src", [
|
|
57
|
+
* "AGENTS.md",
|
|
58
|
+
* "CLAUDE.md",
|
|
59
|
+
* ]);
|
|
60
|
+
*
|
|
61
|
+
* // Might find:
|
|
62
|
+
* // 1. /Users/dev/project/AGENTS.md (depth: 1, workspace)
|
|
63
|
+
* // 2. /Users/dev/project/src/AGENTS.md (depth: 0, project)
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function discoverInstructions(cwd: string, patterns?: string[], options?: {
|
|
67
|
+
maxDepth?: number;
|
|
68
|
+
maxFileSize?: number;
|
|
69
|
+
stopAtGitRoot?: boolean;
|
|
70
|
+
}): Promise<InstructionFile[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Load global instruction files from explicit paths.
|
|
73
|
+
*
|
|
74
|
+
* Global instructions are always included regardless of cwd.
|
|
75
|
+
* Useful for organization-wide coding standards or team rules.
|
|
76
|
+
*
|
|
77
|
+
* @param paths - Absolute paths to global instruction files
|
|
78
|
+
* @param maxSize - Maximum file size in bytes
|
|
79
|
+
* @returns Array of loaded instruction files
|
|
80
|
+
*/
|
|
81
|
+
export declare function loadGlobalInstructions(paths: string[], maxSize?: number): Promise<InstructionFile[]>;
|
|
82
|
+
/**
|
|
83
|
+
* Format discovered instruction files into a prompt block.
|
|
84
|
+
*
|
|
85
|
+
* Each file is wrapped in a tagged block with its source path
|
|
86
|
+
* for transparency. Files are already ordered general → specific.
|
|
87
|
+
*
|
|
88
|
+
* Output example:
|
|
89
|
+
* ```
|
|
90
|
+
* <project-instructions>
|
|
91
|
+
*
|
|
92
|
+
* <instructions source="AGENTS.md" scope="workspace">
|
|
93
|
+
* ... workspace-level content ...
|
|
94
|
+
* </instructions>
|
|
95
|
+
*
|
|
96
|
+
* <instructions source="src/AGENTS.md" scope="project">
|
|
97
|
+
* ... project-specific content ...
|
|
98
|
+
* </instructions>
|
|
99
|
+
*
|
|
100
|
+
* </project-instructions>
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function formatInstructions(files: InstructionFile[], basePath?: string): string;
|
|
104
|
+
//# sourceMappingURL=instructions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../src/prompt/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAMlD;;;GAGG;AACH,eAAO,MAAM,4BAA4B,UAKxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAwDpC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,MAAM,EAAiC,EACjD,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GACA,OAAO,CAAC,eAAe,EAAE,CAAC,CAuD5B;AAED;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,GAAE,MAA8B,GACtC,OAAO,CAAC,eAAe,EAAE,CAAC,CAgB5B;AAMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,eAAe,EAAE,EACxB,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAwBR"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt Templates — Base system prompts per model family
|
|
3
|
+
*
|
|
4
|
+
* agent-core provides **generic, domain-agnostic** templates.
|
|
5
|
+
* These establish the agent's general approach and tool-use discipline
|
|
6
|
+
* without assuming a specific domain (coding, browsing, etc.).
|
|
7
|
+
*
|
|
8
|
+
* Domain-specific templates belong in consumer packages:
|
|
9
|
+
* - agent-code → coding templates ("read files before editing", etc.)
|
|
10
|
+
* - computer-agent → computer-use templates
|
|
11
|
+
* - your-custom-agent → whatever you need
|
|
12
|
+
*
|
|
13
|
+
* Consumer packages inject their templates via:
|
|
14
|
+
* createPromptBuilder({ baseTemplate: MY_CODING_TEMPLATE })
|
|
15
|
+
* builder.addSection({ id: "coding", ... })
|
|
16
|
+
*
|
|
17
|
+
* This file also contains model family detection, which IS infrastructure
|
|
18
|
+
* and belongs here — any consumer benefits from knowing the model family
|
|
19
|
+
* to optimize prompt formatting.
|
|
20
|
+
*/
|
|
21
|
+
import type { LanguageModel } from "ai";
|
|
22
|
+
import type { ModelFamily } from "./types.js";
|
|
23
|
+
/**
|
|
24
|
+
* Detect which model family a LanguageModel belongs to.
|
|
25
|
+
*
|
|
26
|
+
* Uses the provider string first (most reliable), then falls back
|
|
27
|
+
* to pattern matching on the model ID.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import { anthropic } from "@ai-sdk/anthropic";
|
|
32
|
+
* detectModelFamily(anthropic("claude-sonnet-4-20250514")); // "anthropic"
|
|
33
|
+
*
|
|
34
|
+
* import { openai } from "@ai-sdk/openai";
|
|
35
|
+
* detectModelFamily(openai("gpt-4o")); // "openai"
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function detectModelFamily(model: LanguageModel): ModelFamily;
|
|
39
|
+
/**
|
|
40
|
+
* Generic flat system-prompt fallback for callers that bypass the prompt
|
|
41
|
+
* pipeline and use `systemPrompt` directly.
|
|
42
|
+
*/
|
|
43
|
+
export declare const DEFAULT_SYSTEM_PROMPT = "You are a capable AI assistant with access to tools.\n\nThink step by step about what you need to do.\nUse the available tools to accomplish tasks.\nVerify your results after each action.\n\nIf a tool fails, try an alternative approach \u2014 do not give up after a single error.\nKeep working until the task is fully resolved or you have exhausted all options.";
|
|
44
|
+
/**
|
|
45
|
+
* Get the base template for a model family.
|
|
46
|
+
*
|
|
47
|
+
* @param family - Model family identifier
|
|
48
|
+
* @returns The generic system prompt template
|
|
49
|
+
*/
|
|
50
|
+
export declare function getTemplate(family: ModelFamily): string;
|
|
51
|
+
/**
|
|
52
|
+
* Get all available template families.
|
|
53
|
+
* Useful for debugging or letting users choose.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getAvailableFamilies(): ModelFamily[];
|
|
56
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/prompt/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO9C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,WAAW,CAuBnE;AAMD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,8WAO+C,CAAC;AAgIlF;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAEvD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,WAAW,EAAE,CAEpD"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt Pipeline Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the layered system prompt architecture.
|
|
5
|
+
* The prompt pipeline composes a system prompt from multiple sources:
|
|
6
|
+
*
|
|
7
|
+
* Base Template → Environment → Instructions → Custom Sections → Per-Turn
|
|
8
|
+
*
|
|
9
|
+
* Each layer is optional, composable, and can be toggled on/off.
|
|
10
|
+
*/
|
|
11
|
+
import type { LanguageModel } from "ai";
|
|
12
|
+
import type { SkillConfig } from "../skill/types.js";
|
|
13
|
+
/**
|
|
14
|
+
* Model family identifier for prompt template selection.
|
|
15
|
+
*
|
|
16
|
+
* Each family gets a base template optimized for its strengths:
|
|
17
|
+
* - `anthropic`: Claude models — structured sections with XML tags
|
|
18
|
+
* - `openai`: GPT/o-series models — clear directives with markdown
|
|
19
|
+
* - `google`: Gemini models — balanced approach
|
|
20
|
+
* - `deepseek`: DeepSeek models — code-focused emphasis
|
|
21
|
+
* - `default`: Generic template for any model
|
|
22
|
+
*/
|
|
23
|
+
export type ModelFamily = "anthropic" | "openai" | "google" | "deepseek" | "default";
|
|
24
|
+
/**
|
|
25
|
+
* Runtime environment information injected into the system prompt.
|
|
26
|
+
* Gives the model awareness of the working context.
|
|
27
|
+
*/
|
|
28
|
+
export interface EnvironmentInfo {
|
|
29
|
+
/** Current working directory */
|
|
30
|
+
cwd: string;
|
|
31
|
+
/** Operating system (e.g. "macOS (darwin arm64)") */
|
|
32
|
+
platform: string;
|
|
33
|
+
/** Current date/time formatted string */
|
|
34
|
+
date: string;
|
|
35
|
+
/** User's shell (e.g. "/bin/zsh") */
|
|
36
|
+
shell?: string;
|
|
37
|
+
/** Active git branch, if inside a repo */
|
|
38
|
+
gitBranch?: string;
|
|
39
|
+
/** Whether the working tree is clean */
|
|
40
|
+
gitClean?: boolean;
|
|
41
|
+
/** Git repo root path */
|
|
42
|
+
gitRoot?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* An instruction file discovered on disk (e.g. AGENTS.md).
|
|
46
|
+
*
|
|
47
|
+
* Instruction files provide project-specific or workspace-level guidance
|
|
48
|
+
* that gets injected into every prompt. They're discovered by walking up
|
|
49
|
+
* the directory tree from cwd.
|
|
50
|
+
*/
|
|
51
|
+
export interface InstructionFile {
|
|
52
|
+
/** Absolute path to the file */
|
|
53
|
+
path: string;
|
|
54
|
+
/** File content (trimmed) */
|
|
55
|
+
content: string;
|
|
56
|
+
/** How the file was discovered */
|
|
57
|
+
source: "project" | "workspace" | "global";
|
|
58
|
+
/** Depth from cwd (0 = same directory) */
|
|
59
|
+
depth: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A composable section in the prompt pipeline.
|
|
63
|
+
*
|
|
64
|
+
* Sections are the building blocks of the final system prompt.
|
|
65
|
+
* Each section has a priority that determines its position in the output.
|
|
66
|
+
*
|
|
67
|
+
* Default priority ranges:
|
|
68
|
+
* - 10: Base template
|
|
69
|
+
* - 20: Environment block
|
|
70
|
+
* - 30: Instruction files
|
|
71
|
+
* - 50: Custom sections (default for user-added)
|
|
72
|
+
* - 70: Reserved for future use (e.g. Skills)
|
|
73
|
+
* - 90: Per-turn overrides
|
|
74
|
+
*/
|
|
75
|
+
export interface PromptSection {
|
|
76
|
+
/** Unique identifier for this section */
|
|
77
|
+
id: string;
|
|
78
|
+
/** Human-readable label (useful for debugging/logging) */
|
|
79
|
+
label: string;
|
|
80
|
+
/** The text content of this section */
|
|
81
|
+
content: string;
|
|
82
|
+
/** Sort priority — lower values appear earlier (default: 50) */
|
|
83
|
+
priority?: number;
|
|
84
|
+
/** Whether this section is active (default: true) */
|
|
85
|
+
enabled?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Context passed to the builder for each prompt build.
|
|
89
|
+
*
|
|
90
|
+
* This provides the runtime information needed to compose
|
|
91
|
+
* the system prompt for a specific conversation turn.
|
|
92
|
+
*/
|
|
93
|
+
export interface PromptBuildContext {
|
|
94
|
+
/** Current working directory */
|
|
95
|
+
cwd: string;
|
|
96
|
+
/** The language model being used */
|
|
97
|
+
model: LanguageModel;
|
|
98
|
+
/** Names of available tools (for template customization) */
|
|
99
|
+
toolNames?: string[];
|
|
100
|
+
/** Per-turn additional instructions (from chat options) */
|
|
101
|
+
override?: string;
|
|
102
|
+
/** Current session ID */
|
|
103
|
+
sessionId?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Configuration for the prompt pipeline.
|
|
107
|
+
*
|
|
108
|
+
* Controls which layers are active and how they behave.
|
|
109
|
+
* All options have sensible defaults — an empty config `{}` gives you
|
|
110
|
+
* the full pipeline with auto-detection.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* // Minimal — use all defaults
|
|
115
|
+
* const builder = createPromptBuilder();
|
|
116
|
+
*
|
|
117
|
+
* // Custom base template but keep environment + instructions
|
|
118
|
+
* const builder = createPromptBuilder({
|
|
119
|
+
* baseTemplate: "You are a security auditor...",
|
|
120
|
+
* includeEnvironment: true,
|
|
121
|
+
* includeInstructions: true,
|
|
122
|
+
* });
|
|
123
|
+
*
|
|
124
|
+
* // Fully custom — disable auto features, add your own sections
|
|
125
|
+
* const builder = createPromptBuilder({
|
|
126
|
+
* includeEnvironment: false,
|
|
127
|
+
* includeInstructions: false,
|
|
128
|
+
* sections: [
|
|
129
|
+
* { id: "role", label: "Role", content: "You audit code.", priority: 10 },
|
|
130
|
+
* { id: "rules", label: "Rules", content: "Never modify files.", priority: 20 },
|
|
131
|
+
* ],
|
|
132
|
+
* });
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export interface PromptConfig {
|
|
136
|
+
/**
|
|
137
|
+
* Override the base template entirely.
|
|
138
|
+
* If set, replaces the model-family-specific template.
|
|
139
|
+
*/
|
|
140
|
+
baseTemplate?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Force a specific model family for template selection.
|
|
143
|
+
* Auto-detected from the model if not provided.
|
|
144
|
+
*/
|
|
145
|
+
modelFamily?: ModelFamily;
|
|
146
|
+
/**
|
|
147
|
+
* Inject runtime environment info (cwd, platform, git, date).
|
|
148
|
+
* @default true
|
|
149
|
+
*/
|
|
150
|
+
includeEnvironment?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Discover and include instruction files (AGENTS.md, etc.).
|
|
153
|
+
* @default true
|
|
154
|
+
*/
|
|
155
|
+
includeInstructions?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* File name patterns to search for when discovering instructions.
|
|
158
|
+
* Searched in each directory walking up from cwd.
|
|
159
|
+
*
|
|
160
|
+
* @default ["AGENTS.md", "CLAUDE.md", "COPILOT.md", ".cuylabs/instructions.md"]
|
|
161
|
+
*/
|
|
162
|
+
instructionPatterns?: string[];
|
|
163
|
+
/**
|
|
164
|
+
* Absolute paths to global instruction files (always included
|
|
165
|
+
* regardless of cwd). Useful for organization-wide rules.
|
|
166
|
+
*/
|
|
167
|
+
globalInstructions?: string[];
|
|
168
|
+
/**
|
|
169
|
+
* Maximum depth to walk up from cwd when searching for instructions.
|
|
170
|
+
* Prevents scanning the entire filesystem.
|
|
171
|
+
* @default 10
|
|
172
|
+
*/
|
|
173
|
+
instructionMaxDepth?: number;
|
|
174
|
+
/**
|
|
175
|
+
* Maximum file size in bytes for instruction files.
|
|
176
|
+
* Files larger than this are skipped to avoid bloating the prompt.
|
|
177
|
+
* @default 51200 (50KB)
|
|
178
|
+
*/
|
|
179
|
+
instructionMaxSize?: number;
|
|
180
|
+
/**
|
|
181
|
+
* Pre-defined sections to include in every prompt build.
|
|
182
|
+
* These are merged with auto-generated sections (template, environment, etc.).
|
|
183
|
+
*/
|
|
184
|
+
sections?: PromptSection[];
|
|
185
|
+
/**
|
|
186
|
+
* Separator between sections in the final composed prompt.
|
|
187
|
+
* @default "\n\n"
|
|
188
|
+
*/
|
|
189
|
+
separator?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Skill discovery and loading configuration.
|
|
192
|
+
*
|
|
193
|
+
* When provided, the prompt pipeline will:
|
|
194
|
+
* 1. Discover SKILL.md files from project, user, and global directories
|
|
195
|
+
* 2. Inject skill summaries at PRIORITY_SKILLS (70) in the system prompt
|
|
196
|
+
* 3. Make `skill` and `skill_resource` tools available to the agent
|
|
197
|
+
*
|
|
198
|
+
* Skills use progressive disclosure:
|
|
199
|
+
* - L1 (summary): always in system prompt — names + descriptions
|
|
200
|
+
* - L2 (content): loaded on demand via `skill` tool
|
|
201
|
+
* - L3 (resources): loaded on demand via `skill_resource` tool
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* const agent = createAgent({
|
|
206
|
+
* model: anthropic("claude-sonnet-4-20250514"),
|
|
207
|
+
* prompt: {
|
|
208
|
+
* skills: {
|
|
209
|
+
* externalDirs: [".agents", ".claude"],
|
|
210
|
+
* roots: ["./company-skills"],
|
|
211
|
+
* },
|
|
212
|
+
* },
|
|
213
|
+
* });
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
skills?: SkillConfig;
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/prompt/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMrD;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GACnB,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,SAAS,CAAC;AAMd;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAMD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3C,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;CACf;AAMD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAMD;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,KAAK,EAAE,aAAa,CAAC;IACrB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE9B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB"}
|