@levelcode/sdk 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +493 -289
- package/dist/index.cjs.map +8 -7
- package/dist/index.mjs +564 -360
- package/dist/index.mjs.map +8 -7
- package/package.json +1 -1
- package/dist/agents/constants.d.ts +0 -1
- package/dist/agents/team/apprentice.d.ts +0 -3
- package/dist/agents/team/coordinator.d.ts +0 -3
- package/dist/agents/team/cto.d.ts +0 -3
- package/dist/agents/team/designer.d.ts +0 -3
- package/dist/agents/team/director.d.ts +0 -3
- package/dist/agents/team/distinguished-engineer.d.ts +0 -3
- package/dist/agents/team/fellow.d.ts +0 -3
- package/dist/agents/team/index.d.ts +0 -27
- package/dist/agents/team/intern.d.ts +0 -3
- package/dist/agents/team/junior-engineer.d.ts +0 -3
- package/dist/agents/team/manager.d.ts +0 -3
- package/dist/agents/team/mid-level-engineer.d.ts +0 -3
- package/dist/agents/team/principal-engineer.d.ts +0 -3
- package/dist/agents/team/product-lead.d.ts +0 -3
- package/dist/agents/team/researcher.d.ts +0 -3
- package/dist/agents/team/role-hierarchy.d.ts +0 -24
- package/dist/agents/team/scientist.d.ts +0 -3
- package/dist/agents/team/senior-engineer.d.ts +0 -3
- package/dist/agents/team/senior-staff-engineer.d.ts +0 -3
- package/dist/agents/team/staff-engineer.d.ts +0 -3
- package/dist/agents/team/sub-manager.d.ts +0 -3
- package/dist/agents/team/tester.d.ts +0 -3
- package/dist/agents/team/vp-engineering.d.ts +0 -3
- package/dist/agents/types/agent-definition.d.ts +0 -296
- package/dist/agents/types/secret-agent-definition.d.ts +0 -19
- package/dist/agents/types/tools.d.ts +0 -308
- package/dist/agents/types/util-types.d.ts +0 -134
- package/dist/common/src/actions.d.ts +0 -176
- package/dist/common/src/analytics-core.d.ts +0 -52
- package/dist/common/src/analytics.d.ts +0 -9
- package/dist/common/src/browser-actions.d.ts +0 -1200
- package/dist/common/src/constants/agents.d.ts +0 -47
- package/dist/common/src/constants/analytics-events.d.ts +0 -111
- package/dist/common/src/constants/byok.d.ts +0 -2
- package/dist/common/src/constants/claude-oauth.d.ts +0 -36
- package/dist/common/src/constants/index.d.ts +0 -4
- package/dist/common/src/constants/knowledge.d.ts +0 -21
- package/dist/common/src/constants/limits.d.ts +0 -14
- package/dist/common/src/constants/model-config.d.ts +0 -117
- package/dist/common/src/constants/paths.d.ts +0 -23
- package/dist/common/src/constants/skills.d.ts +0 -42
- package/dist/common/src/constants/ui.d.ts +0 -14
- package/dist/common/src/env-ci.d.ts +0 -22
- package/dist/common/src/env-process.d.ts +0 -28
- package/dist/common/src/env-schema.d.ts +0 -24
- package/dist/common/src/env.d.ts +0 -16
- package/dist/common/src/mcp/client.d.ts +0 -6
- package/dist/common/src/old-constants.d.ts +0 -10
- package/dist/common/src/project-file-tree.d.ts +0 -27
- package/dist/common/src/templates/agent-validation.d.ts +0 -48
- package/dist/common/src/templates/initial-agents-dir/types/agent-definition.d.ts +0 -296
- package/dist/common/src/templates/initial-agents-dir/types/tools.d.ts +0 -308
- package/dist/common/src/templates/initial-agents-dir/types/util-types.d.ts +0 -128
- package/dist/common/src/testing/errors.d.ts +0 -14
- package/dist/common/src/testing/mock-modules.d.ts +0 -11
- package/dist/common/src/testing/mock-types.d.ts +0 -97
- package/dist/common/src/testing/mocks/analytics.d.ts +0 -182
- package/dist/common/src/testing/mocks/child-process.d.ts +0 -29
- package/dist/common/src/testing/mocks/crypto.d.ts +0 -159
- package/dist/common/src/testing/mocks/database.d.ts +0 -197
- package/dist/common/src/testing/mocks/fetch.d.ts +0 -35
- package/dist/common/src/testing/mocks/filesystem.d.ts +0 -31
- package/dist/common/src/testing/mocks/index.d.ts +0 -25
- package/dist/common/src/testing/mocks/logger.d.ts +0 -35
- package/dist/common/src/testing/mocks/stream.d.ts +0 -203
- package/dist/common/src/testing/mocks/timers.d.ts +0 -27
- package/dist/common/src/testing/mocks/tree-sitter.d.ts +0 -58
- package/dist/common/src/testing-env-process.d.ts +0 -7
- package/dist/common/src/tools/constants.d.ts +0 -17
- package/dist/common/src/tools/list.d.ts +0 -1152
- package/dist/common/src/tools/params/tool/add-message.d.ts +0 -19
- package/dist/common/src/tools/params/tool/add-subgoal.d.ts +0 -26
- package/dist/common/src/tools/params/tool/ask-user.d.ts +0 -59
- package/dist/common/src/tools/params/tool/browser-logs.d.ts +0 -127
- package/dist/common/src/tools/params/tool/code-search.d.ts +0 -30
- package/dist/common/src/tools/params/tool/create-plan.d.ts +0 -30
- package/dist/common/src/tools/params/tool/end-turn.d.ts +0 -13
- package/dist/common/src/tools/params/tool/find-files.d.ts +0 -31
- package/dist/common/src/tools/params/tool/glob.d.ts +0 -26
- package/dist/common/src/tools/params/tool/list-directory.d.ts +0 -25
- package/dist/common/src/tools/params/tool/lookup-agent-info.d.ts +0 -13
- package/dist/common/src/tools/params/tool/propose-str-replace.d.ts +0 -40
- package/dist/common/src/tools/params/tool/propose-write-file.d.ts +0 -29
- package/dist/common/src/tools/params/tool/read-docs.d.ts +0 -19
- package/dist/common/src/tools/params/tool/read-files.d.ts +0 -35
- package/dist/common/src/tools/params/tool/read-subtree.d.ts +0 -40
- package/dist/common/src/tools/params/tool/run-file-change-hooks.d.ts +0 -63
- package/dist/common/src/tools/params/tool/run-terminal-command.d.ts +0 -88
- package/dist/common/src/tools/params/tool/send-message.d.ts +0 -26
- package/dist/common/src/tools/params/tool/set-messages.d.ts +0 -15
- package/dist/common/src/tools/params/tool/set-output.d.ts +0 -15
- package/dist/common/src/tools/params/tool/skill.d.ts +0 -28
- package/dist/common/src/tools/params/tool/spawn-agent-inline.d.ts +0 -17
- package/dist/common/src/tools/params/tool/spawn-agents.d.ts +0 -26
- package/dist/common/src/tools/params/tool/str-replace.d.ts +0 -43
- package/dist/common/src/tools/params/tool/suggest-followups.d.ts +0 -26
- package/dist/common/src/tools/params/tool/task-completed.d.ts +0 -13
- package/dist/common/src/tools/params/tool/task-create.d.ts +0 -24
- package/dist/common/src/tools/params/tool/task-get.d.ts +0 -15
- package/dist/common/src/tools/params/tool/task-list.d.ts +0 -13
- package/dist/common/src/tools/params/tool/task-update.d.ts +0 -29
- package/dist/common/src/tools/params/tool/team-create.d.ts +0 -17
- package/dist/common/src/tools/params/tool/team-delete.d.ts +0 -13
- package/dist/common/src/tools/params/tool/think-deeply.d.ts +0 -15
- package/dist/common/src/tools/params/tool/update-subgoal.d.ts +0 -25
- package/dist/common/src/tools/params/tool/web-search.d.ts +0 -25
- package/dist/common/src/tools/params/tool/write-file.d.ts +0 -31
- package/dist/common/src/tools/params/tool/write-todos.d.ts +0 -18
- package/dist/common/src/tools/params/utils.d.ts +0 -35
- package/dist/common/src/tools/utils.d.ts +0 -4
- package/dist/common/src/types/agent-template.d.ts +0 -156
- package/dist/common/src/types/contracts/agent-runtime.d.ts +0 -36
- package/dist/common/src/types/contracts/analytics.d.ts +0 -8
- package/dist/common/src/types/contracts/billing.d.ts +0 -40
- package/dist/common/src/types/contracts/client.d.ts +0 -45
- package/dist/common/src/types/contracts/database.d.ts +0 -80
- package/dist/common/src/types/contracts/env.d.ts +0 -150
- package/dist/common/src/types/contracts/llm.d.ts +0 -102
- package/dist/common/src/types/contracts/logger.d.ts +0 -8
- package/dist/common/src/types/dynamic-agent-template.d.ts +0 -227
- package/dist/common/src/types/filesystem.d.ts +0 -6
- package/dist/common/src/types/function-params.d.ts +0 -15
- package/dist/common/src/types/grant.d.ts +0 -2
- package/dist/common/src/types/json.d.ts +0 -9
- package/dist/common/src/types/mcp.d.ts +0 -31
- package/dist/common/src/types/messages/content-part.d.ts +0 -46
- package/dist/common/src/types/messages/data-content.d.ts +0 -3
- package/dist/common/src/types/messages/levelcode-message.d.ts +0 -37
- package/dist/common/src/types/messages/provider-metadata.d.ts +0 -3
- package/dist/common/src/types/print-mode.d.ts +0 -155
- package/dist/common/src/types/session-state.d.ts +0 -94
- package/dist/common/src/types/skill.d.ts +0 -31
- package/dist/common/src/types/source.d.ts +0 -8
- package/dist/common/src/types/spawn.d.ts +0 -8
- package/dist/common/src/types/team-config-schemas.d.ts +0 -217
- package/dist/common/src/types/team-config.d.ts +0 -42
- package/dist/common/src/types/team-hook-events.d.ts +0 -36
- package/dist/common/src/types/team-protocol.d.ts +0 -64
- package/dist/common/src/util/agent-id-parsing.d.ts +0 -22
- package/dist/common/src/util/agent-name-normalization.d.ts +0 -12
- package/dist/common/src/util/array.d.ts +0 -6
- package/dist/common/src/util/credentials.d.ts +0 -11
- package/dist/common/src/util/error.d.ts +0 -128
- package/dist/common/src/util/file.d.ts +0 -133
- package/dist/common/src/util/format-code-search.d.ts +0 -16
- package/dist/common/src/util/lru-cache.d.ts +0 -30
- package/dist/common/src/util/messages.d.ts +0 -46
- package/dist/common/src/util/model-utils.d.ts +0 -8
- package/dist/common/src/util/object.d.ts +0 -22
- package/dist/common/src/util/promise.d.ts +0 -16
- package/dist/common/src/util/random.d.ts +0 -1
- package/dist/common/src/util/skills.d.ts +0 -5
- package/dist/common/src/util/stop-sequence.d.ts +0 -14
- package/dist/common/src/util/string.d.ts +0 -82
- package/dist/common/src/util/xml.d.ts +0 -12
- package/dist/common/src/util/zod-schema.d.ts +0 -5
- package/dist/common/src/utils/dev-phases.d.ts +0 -23
- package/dist/common/src/utils/file-lock.d.ts +0 -13
- package/dist/common/src/utils/team-analytics.d.ts +0 -16
- package/dist/common/src/utils/team-discovery.d.ts +0 -47
- package/dist/common/src/utils/team-fs.d.ts +0 -20
- package/dist/common/src/utils/team-hook-emitter.d.ts +0 -40
- package/dist/common/src/utils/team-presets.d.ts +0 -35
- package/dist/packages/agent-runtime/src/constants.d.ts +0 -1
- package/dist/packages/agent-runtime/src/fast-rewrite.d.ts +0 -45
- package/dist/packages/agent-runtime/src/find-files/request-files-prompt.d.ts +0 -71
- package/dist/packages/agent-runtime/src/generate-diffs-prompt.d.ts +0 -53
- package/dist/packages/agent-runtime/src/get-file-reading-updates.d.ts +0 -8
- package/dist/packages/agent-runtime/src/inbox-poller.d.ts +0 -81
- package/dist/packages/agent-runtime/src/llm-api/claude.d.ts +0 -5
- package/dist/packages/agent-runtime/src/llm-api/context7-api.d.ts +0 -55
- package/dist/packages/agent-runtime/src/llm-api/gemini-with-fallbacks.d.ts +0 -40
- package/dist/packages/agent-runtime/src/llm-api/levelcode-web-api.d.ts +0 -49
- package/dist/packages/agent-runtime/src/llm-api/relace-api.d.ts +0 -16
- package/dist/packages/agent-runtime/src/main-prompt.d.ts +0 -29
- package/dist/packages/agent-runtime/src/mcp-constants.d.ts +0 -12
- package/dist/packages/agent-runtime/src/mcp.d.ts +0 -10
- package/dist/packages/agent-runtime/src/message-formatter.d.ts +0 -12
- package/dist/packages/agent-runtime/src/process-file-block.d.ts +0 -56
- package/dist/packages/agent-runtime/src/process-str-replace.d.ts +0 -21
- package/dist/packages/agent-runtime/src/prompt-agent-stream.d.ts +0 -28
- package/dist/packages/agent-runtime/src/run-agent-step.d.ts +0 -73
- package/dist/packages/agent-runtime/src/run-programmatic-step.d.ts +0 -40
- package/dist/packages/agent-runtime/src/system-prompt/prompts.d.ts +0 -19
- package/dist/packages/agent-runtime/src/system-prompt/search-system-prompt.d.ts +0 -14
- package/dist/packages/agent-runtime/src/system-prompt/team-context-prompt.d.ts +0 -9
- package/dist/packages/agent-runtime/src/system-prompt/team-prompt.d.ts +0 -9
- package/dist/packages/agent-runtime/src/system-prompt/truncate-file-tree.d.ts +0 -13
- package/dist/packages/agent-runtime/src/team-context.d.ts +0 -14
- package/dist/packages/agent-runtime/src/templates/agent-registry.d.ts +0 -35
- package/dist/packages/agent-runtime/src/templates/prompts.d.ts +0 -35
- package/dist/packages/agent-runtime/src/templates/strings.d.ts +0 -32
- package/dist/packages/agent-runtime/src/templates/types.d.ts +0 -13
- package/dist/packages/agent-runtime/src/tool-stream-parser.d.ts +0 -31
- package/dist/packages/agent-runtime/src/tools/handlers/handler-function-type.d.ts +0 -51
- package/dist/packages/agent-runtime/src/tools/handlers/list.d.ts +0 -370
- package/dist/packages/agent-runtime/src/tools/handlers/tool/add-message.d.ts +0 -9
- package/dist/packages/agent-runtime/src/tools/handlers/tool/add-subgoal.d.ts +0 -9
- package/dist/packages/agent-runtime/src/tools/handlers/tool/ask-user.d.ts +0 -10
- package/dist/packages/agent-runtime/src/tools/handlers/tool/browser-logs.d.ts +0 -8
- package/dist/packages/agent-runtime/src/tools/handlers/tool/code-search.d.ts +0 -8
- package/dist/packages/agent-runtime/src/tools/handlers/tool/create-plan.d.ts +0 -13
- package/dist/packages/agent-runtime/src/tools/handlers/tool/end-turn.d.ts +0 -7
- package/dist/packages/agent-runtime/src/tools/handlers/tool/find-files.d.ts +0 -27
- package/dist/packages/agent-runtime/src/tools/handlers/tool/glob.d.ts +0 -10
- package/dist/packages/agent-runtime/src/tools/handlers/tool/list-directory.d.ts +0 -10
- package/dist/packages/agent-runtime/src/tools/handlers/tool/lookup-agent-info.d.ts +0 -14
- package/dist/packages/agent-runtime/src/tools/handlers/tool/propose-str-replace.d.ts +0 -15
- package/dist/packages/agent-runtime/src/tools/handlers/tool/propose-write-file.d.ts +0 -7
- package/dist/packages/agent-runtime/src/tools/handlers/tool/proposed-content-store.d.ts +0 -27
- package/dist/packages/agent-runtime/src/tools/handlers/tool/read-docs.d.ts +0 -21
- package/dist/packages/agent-runtime/src/tools/handlers/tool/read-files.d.ts +0 -13
- package/dist/packages/agent-runtime/src/tools/handlers/tool/read-subtree.d.ts +0 -13
- package/dist/packages/agent-runtime/src/tools/handlers/tool/run-file-change-hooks.d.ts +0 -10
- package/dist/packages/agent-runtime/src/tools/handlers/tool/run-terminal-command.d.ts +0 -10
- package/dist/packages/agent-runtime/src/tools/handlers/tool/send-message.d.ts +0 -15
- package/dist/packages/agent-runtime/src/tools/handlers/tool/set-messages.d.ts +0 -9
- package/dist/packages/agent-runtime/src/tools/handlers/tool/set-output.d.ts +0 -18
- package/dist/packages/agent-runtime/src/tools/handlers/tool/skill.d.ts +0 -11
- package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-inline.d.ts +0 -29
- package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-utils.d.ts +0 -130
- package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agents.d.ts +0 -37
- package/dist/packages/agent-runtime/src/tools/handlers/tool/str-replace.d.ts +0 -16
- package/dist/packages/agent-runtime/src/tools/handlers/tool/suggest-followups.d.ts +0 -9
- package/dist/packages/agent-runtime/src/tools/handlers/tool/task-completed.d.ts +0 -15
- package/dist/packages/agent-runtime/src/tools/handlers/tool/task-create.d.ts +0 -10
- package/dist/packages/agent-runtime/src/tools/handlers/tool/task-get.d.ts +0 -10
- package/dist/packages/agent-runtime/src/tools/handlers/tool/task-list.d.ts +0 -10
- package/dist/packages/agent-runtime/src/tools/handlers/tool/task-update.d.ts +0 -15
- package/dist/packages/agent-runtime/src/tools/handlers/tool/team-create.d.ts +0 -15
- package/dist/packages/agent-runtime/src/tools/handlers/tool/team-delete.d.ts +0 -15
- package/dist/packages/agent-runtime/src/tools/handlers/tool/think-deeply.d.ts +0 -9
- package/dist/packages/agent-runtime/src/tools/handlers/tool/update-subgoal.d.ts +0 -11
- package/dist/packages/agent-runtime/src/tools/handlers/tool/web-search.d.ts +0 -22
- package/dist/packages/agent-runtime/src/tools/handlers/tool/write-file.d.ts +0 -49
- package/dist/packages/agent-runtime/src/tools/handlers/tool/write-todos.d.ts +0 -9
- package/dist/packages/agent-runtime/src/tools/prompts.d.ts +0 -31
- package/dist/packages/agent-runtime/src/tools/stream-parser.d.ts +0 -33
- package/dist/packages/agent-runtime/src/tools/tool-executor.d.ts +0 -87
- package/dist/packages/agent-runtime/src/util/agent-output.d.ts +0 -3
- package/dist/packages/agent-runtime/src/util/messages.d.ts +0 -68
- package/dist/packages/agent-runtime/src/util/parse-tool-calls-from-text.d.ts +0 -38
- package/dist/packages/agent-runtime/src/util/render-read-files-result.d.ts +0 -15
- package/dist/packages/agent-runtime/src/util/simplify-tool-results.d.ts +0 -7
- package/dist/packages/agent-runtime/src/util/stream-xml-parser.d.ts +0 -34
- package/dist/packages/agent-runtime/src/util/token-counter.d.ts +0 -3
- package/dist/packages/code-map/src/index.d.ts +0 -3
- package/dist/packages/code-map/src/init-node.d.ts +0 -4
- package/dist/packages/code-map/src/languages.d.ts +0 -36
- package/dist/packages/code-map/src/parse.d.ts +0 -21
- package/dist/packages/code-map/src/types.d.ts +0 -8
- package/dist/packages/code-map/src/utils.d.ts +0 -1
- package/dist/sdk/src/__tests__/client.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/code-search.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/credentials.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/database.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/env.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/error-utils.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/initial-session-state.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/knowledge-file-selection.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/load-agents.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/load-mcp-config.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/model-provider.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/read-files.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/run-cancellation.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/run-file-filter.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/run-handle-event.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/run.integration.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/team-api.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/user-knowledge-files.test.d.ts +0 -1
- package/dist/sdk/src/__tests__/validate-agents.test.d.ts +0 -1
- package/dist/sdk/src/agents/load-agents.d.ts +0 -106
- package/dist/sdk/src/agents/load-mcp-config.d.ts +0 -69
- package/dist/sdk/src/client.d.ts +0 -71
- package/dist/sdk/src/constants.d.ts +0 -4
- package/dist/sdk/src/credentials.d.ts +0 -58
- package/dist/sdk/src/custom-tool.d.ts +0 -32
- package/dist/sdk/src/env.d.ts +0 -31
- package/dist/sdk/src/error-utils.d.ts +0 -55
- package/dist/sdk/src/impl/__tests__/prompt-result.test.d.ts +0 -1
- package/dist/sdk/src/impl/agent-runtime.d.ts +0 -8
- package/dist/sdk/src/impl/database.d.ts +0 -7
- package/dist/sdk/src/impl/llm.d.ts +0 -8
- package/dist/sdk/src/impl/model-provider.d.ts +0 -61
- package/dist/sdk/src/index.d.ts +0 -42
- package/dist/sdk/src/native/ripgrep.d.ts +0 -7
- package/dist/sdk/src/retry-config.d.ts +0 -46
- package/dist/sdk/src/run-state.d.ts +0 -81
- package/dist/sdk/src/run.d.ts +0 -79
- package/dist/sdk/src/skills/load-skills.d.ts +0 -42
- package/dist/sdk/src/team.d.ts +0 -49
- package/dist/sdk/src/testing/env.d.ts +0 -5
- package/dist/sdk/src/tools/change-file.d.ts +0 -7
- package/dist/sdk/src/tools/code-search.d.ts +0 -13
- package/dist/sdk/src/tools/glob.d.ts +0 -8
- package/dist/sdk/src/tools/index.d.ts +0 -16
- package/dist/sdk/src/tools/list-directory.d.ts +0 -7
- package/dist/sdk/src/tools/read-files.d.ts +0 -16
- package/dist/sdk/src/tools/run-file-change-hooks.d.ts +0 -4
- package/dist/sdk/src/tools/run-terminal-command.d.ts +0 -8
- package/dist/sdk/src/types/env.d.ts +0 -30
- package/dist/sdk/src/validate-agents.d.ts +0 -45
- package/dist/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/dist/vendor/ripgrep/arm64-linux/rg +0 -0
- package/dist/vendor/ripgrep/x64-darwin/rg +0 -0
- package/dist/vendor/ripgrep/x64-linux/rg +0 -0
- package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/dist/wasm/tree-sitter-c-sharp.wasm +0 -0
- package/dist/wasm/tree-sitter-cpp.wasm +0 -0
- package/dist/wasm/tree-sitter-go.wasm +0 -0
- package/dist/wasm/tree-sitter-java.wasm +0 -0
- package/dist/wasm/tree-sitter-javascript.wasm +0 -0
- package/dist/wasm/tree-sitter-python.wasm +0 -0
- package/dist/wasm/tree-sitter-ruby.wasm +0 -0
- package/dist/wasm/tree-sitter-rust.wasm +0 -0
- package/dist/wasm/tree-sitter-tsx.wasm +0 -0
- package/dist/wasm/tree-sitter-typescript.wasm +0 -0
- package/dist/wasm/tree-sitter.wasm +0 -0
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed database mock factory for testing.
|
|
3
|
-
*
|
|
4
|
-
* Provides type-safe mocks for Drizzle database operations used throughout the codebase.
|
|
5
|
-
* Replaces the need for `as any` casts when setting up database spies.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { createMockDbOperations, setupDbSpies } from '@levelcode/common/testing/mocks/database'
|
|
10
|
-
*
|
|
11
|
-
* // Option 1: Create mock operations object
|
|
12
|
-
* const dbOps = createMockDbOperations()
|
|
13
|
-
*
|
|
14
|
-
* // Option 2: Setup spies on actual db module
|
|
15
|
-
* const spies = setupDbSpies(db)
|
|
16
|
-
* await runTest()
|
|
17
|
-
* spies.restore()
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
import { spyOn } from 'bun:test';
|
|
21
|
-
import type { Mock } from 'bun:test';
|
|
22
|
-
/**
|
|
23
|
-
* Type for the chainable insert result.
|
|
24
|
-
*/
|
|
25
|
-
export interface MockInsertResult<T = unknown> {
|
|
26
|
-
values: Mock<(data: T | T[]) => Promise<{
|
|
27
|
-
id: string;
|
|
28
|
-
}>>;
|
|
29
|
-
returning: Mock<() => Promise<T[]>>;
|
|
30
|
-
onConflictDoNothing: Mock<() => MockInsertResult<T>>;
|
|
31
|
-
onConflictDoUpdate: Mock<(config: {
|
|
32
|
-
target: unknown;
|
|
33
|
-
set: unknown;
|
|
34
|
-
}) => MockInsertResult<T>>;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Type for the chainable update result.
|
|
38
|
-
*/
|
|
39
|
-
export interface MockUpdateResult<T = unknown> {
|
|
40
|
-
set: Mock<(data: Partial<T>) => MockUpdateSetResult>;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Type for the update.set result.
|
|
44
|
-
*/
|
|
45
|
-
export interface MockUpdateSetResult {
|
|
46
|
-
where: Mock<(condition: unknown) => Promise<void>>;
|
|
47
|
-
returning: Mock<() => Promise<unknown[]>>;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Type for the chainable select result.
|
|
51
|
-
*/
|
|
52
|
-
export interface MockSelectResult<T = unknown> {
|
|
53
|
-
from: Mock<(table: unknown) => MockSelectFromResult<T>>;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Type for the select.from result.
|
|
57
|
-
*/
|
|
58
|
-
export interface MockSelectFromResult<T = unknown> {
|
|
59
|
-
where: Mock<(condition: unknown) => MockSelectWhereResult<T>>;
|
|
60
|
-
leftJoin: Mock<(table: unknown, condition: unknown) => MockSelectFromResult<T>>;
|
|
61
|
-
innerJoin: Mock<(table: unknown, condition: unknown) => MockSelectFromResult<T>>;
|
|
62
|
-
orderBy: Mock<(...columns: unknown[]) => MockSelectFromResult<T>>;
|
|
63
|
-
limit: Mock<(n: number) => MockSelectFromResult<T>>;
|
|
64
|
-
offset: Mock<(n: number) => MockSelectFromResult<T>>;
|
|
65
|
-
then: Mock<(resolve: (value: T[]) => void) => Promise<T[]>>;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Type for the select.from.where result.
|
|
69
|
-
*/
|
|
70
|
-
export interface MockSelectWhereResult<T = unknown> {
|
|
71
|
-
then: Mock<(resolve: (value: T[]) => void) => Promise<T[]>>;
|
|
72
|
-
leftJoin: Mock<(table: unknown, condition: unknown) => MockSelectWhereResult<T>>;
|
|
73
|
-
innerJoin: Mock<(table: unknown, condition: unknown) => MockSelectWhereResult<T>>;
|
|
74
|
-
orderBy: Mock<(...columns: unknown[]) => MockSelectWhereResult<T>>;
|
|
75
|
-
limit: Mock<(n: number) => MockSelectWhereResult<T>>;
|
|
76
|
-
offset: Mock<(n: number) => MockSelectWhereResult<T>>;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Type for the chainable delete result.
|
|
80
|
-
*/
|
|
81
|
-
export interface MockDeleteResult {
|
|
82
|
-
where: Mock<(condition: unknown) => Promise<void>>;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Interface for the complete mock database operations.
|
|
86
|
-
*/
|
|
87
|
-
export interface MockDbOperations {
|
|
88
|
-
insert: Mock<(table: unknown) => MockInsertResult>;
|
|
89
|
-
update: Mock<(table: unknown) => MockUpdateResult>;
|
|
90
|
-
select: Mock<(columns?: unknown) => MockSelectResult>;
|
|
91
|
-
delete: Mock<(table: unknown) => MockDeleteResult>;
|
|
92
|
-
transaction: Mock<(<T>(fn: (tx: MockDbOperations) => Promise<T>) => Promise<T>)>;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Options for creating mock database operations.
|
|
96
|
-
*/
|
|
97
|
-
export interface CreateMockDbOptions {
|
|
98
|
-
/**
|
|
99
|
-
* Default data to return from select queries.
|
|
100
|
-
*/
|
|
101
|
-
defaultSelectData?: unknown[];
|
|
102
|
-
/**
|
|
103
|
-
* Default ID to return from insert operations.
|
|
104
|
-
*/
|
|
105
|
-
defaultInsertId?: string;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Creates type-safe mock database operations for testing.
|
|
109
|
-
*
|
|
110
|
-
* @param options - Configuration options for the mock
|
|
111
|
-
* @returns A mock database operations object
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* ```typescript
|
|
115
|
-
* const dbOps = createMockDbOperations({
|
|
116
|
-
* defaultSelectData: [{ id: '1', name: 'Test' }],
|
|
117
|
-
* defaultInsertId: 'new-id',
|
|
118
|
-
* })
|
|
119
|
-
*
|
|
120
|
-
* // The mocks are chainable just like real Drizzle
|
|
121
|
-
* await dbOps.insert(users).values({ name: 'Test' })
|
|
122
|
-
* await dbOps.select().from(users).where(eq(users.id, '1'))
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
export declare function createMockDbOperations(options?: CreateMockDbOptions): MockDbOperations;
|
|
126
|
-
/**
|
|
127
|
-
* Result of setting up database spies.
|
|
128
|
-
*/
|
|
129
|
-
export interface DbSpies {
|
|
130
|
-
/** Spy on insert operations */
|
|
131
|
-
insert: ReturnType<typeof spyOn>;
|
|
132
|
-
/** Spy on update operations */
|
|
133
|
-
update: ReturnType<typeof spyOn>;
|
|
134
|
-
/** Restore all spies */
|
|
135
|
-
restore: () => void;
|
|
136
|
-
/** Clear all spy call history */
|
|
137
|
-
clear: () => void;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Sets up spies on a database module for insert and update operations.
|
|
141
|
-
* This is the most common pattern used in tests.
|
|
142
|
-
*
|
|
143
|
-
* @param db - The database module to spy on
|
|
144
|
-
* @param options - Configuration options
|
|
145
|
-
* @returns Object containing the spies and cleanup utilities
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* ```typescript
|
|
149
|
-
* import db from '@levelcode/internal/db'
|
|
150
|
-
*
|
|
151
|
-
* describe('my test', () => {
|
|
152
|
-
* let dbSpies: DbSpies
|
|
153
|
-
*
|
|
154
|
-
* beforeEach(() => {
|
|
155
|
-
* dbSpies = setupDbSpies(db)
|
|
156
|
-
* })
|
|
157
|
-
*
|
|
158
|
-
* afterEach(() => {
|
|
159
|
-
* dbSpies.restore()
|
|
160
|
-
* })
|
|
161
|
-
*
|
|
162
|
-
* it('inserts data', async () => {
|
|
163
|
-
* await createUser({ name: 'Test' })
|
|
164
|
-
* expect(dbSpies.insert).toHaveBeenCalled()
|
|
165
|
-
* })
|
|
166
|
-
* })
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
/**
|
|
170
|
-
* Sets up spies on a database module for insert and update operations.
|
|
171
|
-
* Accepts any object with insert and update methods.
|
|
172
|
-
*/
|
|
173
|
-
export declare function setupDbSpies(db: {
|
|
174
|
-
insert: unknown;
|
|
175
|
-
update: unknown;
|
|
176
|
-
}, options?: CreateMockDbOptions): DbSpies;
|
|
177
|
-
/**
|
|
178
|
-
* Creates a mock for a database query builder chain that returns specific data.
|
|
179
|
-
*
|
|
180
|
-
* @param data - The data to return from the query
|
|
181
|
-
* @returns A thenable mock that resolves to the data
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
* ```typescript
|
|
185
|
-
* const mockQuery = createMockQueryResult([
|
|
186
|
-
* { id: '1', name: 'User 1' },
|
|
187
|
-
* { id: '2', name: 'User 2' },
|
|
188
|
-
* ])
|
|
189
|
-
*
|
|
190
|
-
* spyOn(userService, 'findAll').mockReturnValue(mockQuery)
|
|
191
|
-
* ```
|
|
192
|
-
*/
|
|
193
|
-
export declare function createMockQueryResult<T>(data: T[]): Promise<T[]> & {
|
|
194
|
-
where: Mock<() => Promise<T[]>>;
|
|
195
|
-
orderBy: Mock<() => Promise<T[]>>;
|
|
196
|
-
limit: Mock<() => Promise<T[]>>;
|
|
197
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/** Typed fetch mock utilities for testing. */
|
|
2
|
-
import type { Mock } from 'bun:test';
|
|
3
|
-
export interface MockResponseOptions {
|
|
4
|
-
status?: number;
|
|
5
|
-
statusText?: string;
|
|
6
|
-
headers?: HeadersInit;
|
|
7
|
-
}
|
|
8
|
-
export type MockFetch = Mock<typeof globalThis.fetch>;
|
|
9
|
-
export interface InstallMockFetchResult {
|
|
10
|
-
mockFetch: MockFetch;
|
|
11
|
-
restore: () => void;
|
|
12
|
-
getCalls: () => MockFetchCall[];
|
|
13
|
-
clear: () => void;
|
|
14
|
-
}
|
|
15
|
-
export interface MockFetchCall {
|
|
16
|
-
url: string | URL | Request;
|
|
17
|
-
init?: RequestInit;
|
|
18
|
-
jsonBody?: unknown;
|
|
19
|
-
}
|
|
20
|
-
export interface CreateMockFetchOptions {
|
|
21
|
-
defaultImpl?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
22
|
-
}
|
|
23
|
-
/** Creates a Response with JSON body. */
|
|
24
|
-
export declare function mockJsonResponse(data: unknown, options?: MockResponseOptions): Response;
|
|
25
|
-
/** Creates a Response with text body. */
|
|
26
|
-
export declare function mockTextResponse(text: string, options?: MockResponseOptions): Response;
|
|
27
|
-
/** Creates an error Response with default status text. */
|
|
28
|
-
export declare function mockErrorResponse(status: number, body?: string | object, options?: Omit<MockResponseOptions, 'status'>): Response;
|
|
29
|
-
/** Creates a mock fetch function. */
|
|
30
|
-
export declare function createMockFetch(options?: CreateMockFetchOptions): MockFetch;
|
|
31
|
-
/**
|
|
32
|
-
* Installs mock fetch globally. Returns mockFetch for configuration -
|
|
33
|
-
* the wrapper always captures calls before delegating to mockFetch.
|
|
34
|
-
*/
|
|
35
|
-
export declare function installMockFetch(options?: CreateMockFetchOptions): InstallMockFetchResult;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { LevelCodeFileSystem } from '../../types/filesystem';
|
|
2
|
-
import type { Mock } from 'bun:test';
|
|
3
|
-
import type { PathLike, Stats } from 'node:fs';
|
|
4
|
-
export interface CreateMockFsOptions {
|
|
5
|
-
files?: Record<string, string>;
|
|
6
|
-
directories?: Record<string, string[]>;
|
|
7
|
-
readFileImpl?: (path: string) => Promise<string>;
|
|
8
|
-
readdirImpl?: (path: string) => Promise<string[]>;
|
|
9
|
-
writeFileImpl?: (path: string, content: string) => Promise<void>;
|
|
10
|
-
mkdirImpl?: (path: string, options?: {
|
|
11
|
-
recursive?: boolean;
|
|
12
|
-
}) => Promise<string | undefined>;
|
|
13
|
-
statImpl?: (path: string) => Promise<Stats>;
|
|
14
|
-
}
|
|
15
|
-
export interface MockFs extends LevelCodeFileSystem {
|
|
16
|
-
}
|
|
17
|
-
export interface MockFsWithMocks {
|
|
18
|
-
readFile: Mock<(path: PathLike, options?: {
|
|
19
|
-
encoding?: BufferEncoding;
|
|
20
|
-
}) => Promise<string>>;
|
|
21
|
-
readdir: Mock<(path: PathLike) => Promise<string[]>>;
|
|
22
|
-
writeFile: Mock<(path: PathLike, data: string) => Promise<void>>;
|
|
23
|
-
mkdir: Mock<(path: PathLike, options?: {
|
|
24
|
-
recursive?: boolean;
|
|
25
|
-
}) => Promise<string | undefined>>;
|
|
26
|
-
stat: Mock<(path: PathLike) => Promise<Stats>>;
|
|
27
|
-
}
|
|
28
|
-
/** Creates a mock filesystem compatible with LevelCodeFileSystem. */
|
|
29
|
-
export declare function createMockFs(options?: CreateMockFsOptions): MockFs;
|
|
30
|
-
export declare function restoreMockFs(mockFs: MockFs): void;
|
|
31
|
-
export declare function clearMockFs(mockFs: MockFs): void;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock utilities index.
|
|
3
|
-
*
|
|
4
|
-
* Re-exports all mock factories for convenient importing.
|
|
5
|
-
*/
|
|
6
|
-
export { createMockLogger, createMockLoggerWithCapture, restoreMockLogger, clearMockLogger, } from './logger';
|
|
7
|
-
export type { LogLevel, LogMethod, MockLogMethod, MockLogger, CreateMockLoggerOptions, CapturedLogEntry, MockLoggerWithCapture, } from './logger';
|
|
8
|
-
export { createMockAnalytics, createMockAnalyticsWithCapture, setupAnalyticsMocks, restoreMockAnalytics, } from './analytics';
|
|
9
|
-
export type { MockAnalytics, MockAnalyticsWithCapture, AnalyticsSpies, CreateMockAnalyticsOptions, TrackedEvent, EventProperties, } from './analytics';
|
|
10
|
-
export { createMockDbOperations, setupDbSpies } from './database';
|
|
11
|
-
export type { MockDbOperations, DbSpies, CreateMockDbOptions } from './database';
|
|
12
|
-
export { setupCryptoMocks, createMockUuid, TEST_UUIDS } from './crypto';
|
|
13
|
-
export type { CryptoMockSpies, UUID, SetupCryptoMocksOptions } from './crypto';
|
|
14
|
-
export { createUuidGenerator, setupSequentialCryptoMocks } from './crypto';
|
|
15
|
-
export { createToolCallChunk, createMockStream, createMockTextStream, } from './stream';
|
|
16
|
-
export { createMockTimers, installMockTimers } from './timers';
|
|
17
|
-
export type { PendingTimer, MockTimers } from './timers';
|
|
18
|
-
export { createMockFs, restoreMockFs, clearMockFs } from './filesystem';
|
|
19
|
-
export type { MockFs, MockFsWithMocks, CreateMockFsOptions } from './filesystem';
|
|
20
|
-
export { createMockFetch, installMockFetch, mockJsonResponse, mockTextResponse, mockErrorResponse, } from './fetch';
|
|
21
|
-
export type { MockFetch, MockFetchCall, MockResponseOptions, CreateMockFetchOptions, InstallMockFetchResult, } from './fetch';
|
|
22
|
-
export { createMockCapture, createMockTreeSitterCaptures, createMockTree, createMockTreeSitterParser, createMockTreeSitterQuery, createMockLanguageConfig, } from './tree-sitter';
|
|
23
|
-
export type { MockTreeNode, MockTree, MockCapture, MockParser, MockQuery, CreateMockParserOptions, CreateMockQueryOptions, CreateMockLanguageConfigOptions, } from './tree-sitter';
|
|
24
|
-
export { createMockChildProcess, createMockSpawn, asCodeSearchResult, createRgJsonMatch, createRgJsonContext, } from './child-process';
|
|
25
|
-
export type { MockChildProcess, CodeSearchResult, } from './child-process';
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { Mock } from 'bun:test';
|
|
2
|
-
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
3
|
-
export type LogMethod = (data: unknown, msg?: string, ...args: unknown[]) => unknown;
|
|
4
|
-
export type MockLogMethod = Mock<LogMethod>;
|
|
5
|
-
export interface MockLogger {
|
|
6
|
-
trace: MockLogMethod;
|
|
7
|
-
debug: MockLogMethod;
|
|
8
|
-
info: MockLogMethod;
|
|
9
|
-
warn: MockLogMethod;
|
|
10
|
-
error: MockLogMethod;
|
|
11
|
-
fatal: MockLogMethod;
|
|
12
|
-
child: Mock<(bindings: Record<string, unknown>) => MockLogger>;
|
|
13
|
-
}
|
|
14
|
-
export interface CreateMockLoggerOptions {
|
|
15
|
-
captureOutput?: boolean;
|
|
16
|
-
customImplementations?: Partial<Record<LogLevel, LogMethod>>;
|
|
17
|
-
}
|
|
18
|
-
export interface CapturedLogEntry {
|
|
19
|
-
level: LogLevel;
|
|
20
|
-
message: string;
|
|
21
|
-
meta?: Record<string, unknown>;
|
|
22
|
-
timestamp: Date;
|
|
23
|
-
}
|
|
24
|
-
export declare function createMockLogger(options?: CreateMockLoggerOptions): MockLogger;
|
|
25
|
-
export interface MockLoggerWithCapture {
|
|
26
|
-
logger: MockLogger;
|
|
27
|
-
captured: CapturedLogEntry[];
|
|
28
|
-
clearCaptured: () => void;
|
|
29
|
-
getByLevel: (level: LogLevel) => CapturedLogEntry[];
|
|
30
|
-
getByMessage: (pattern: string | RegExp) => CapturedLogEntry[];
|
|
31
|
-
}
|
|
32
|
-
/** Creates a mock logger that captures all output for inspection. */
|
|
33
|
-
export declare function createMockLoggerWithCapture(): MockLoggerWithCapture;
|
|
34
|
-
export declare function restoreMockLogger(logger: MockLogger): void;
|
|
35
|
-
export declare function clearMockLogger(logger: MockLogger): void;
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed stream mock factory for testing LLM streaming.
|
|
3
|
-
*
|
|
4
|
-
* Provides type-safe utilities for creating mock LLM streams
|
|
5
|
-
* and testing streaming behavior.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { createMockStream, createToolCallChunk } from '@levelcode/common/testing/mocks/stream'
|
|
10
|
-
*
|
|
11
|
-
* // Create a mock stream with text and tool calls
|
|
12
|
-
* const stream = createMockStream([
|
|
13
|
-
* { type: 'text', text: 'Hello ' },
|
|
14
|
-
* { type: 'text', text: 'world!' },
|
|
15
|
-
* createToolCallChunk('end_turn', {}),
|
|
16
|
-
* ])
|
|
17
|
-
*
|
|
18
|
-
* // Use in tests
|
|
19
|
-
* for await (const chunk of stream) {
|
|
20
|
-
* console.log(chunk)
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
import type { Mock } from 'bun:test';
|
|
25
|
-
/**
|
|
26
|
-
* A text chunk from an LLM stream.
|
|
27
|
-
*/
|
|
28
|
-
export interface TextChunk {
|
|
29
|
-
type: 'text';
|
|
30
|
-
text: string;
|
|
31
|
-
agentId?: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* A tool call chunk from an LLM stream.
|
|
35
|
-
*/
|
|
36
|
-
export interface ToolCallChunk {
|
|
37
|
-
type: 'tool-call';
|
|
38
|
-
toolName: string;
|
|
39
|
-
toolCallId: string;
|
|
40
|
-
input: Record<string, unknown>;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* A reasoning chunk from an LLM stream.
|
|
44
|
-
*/
|
|
45
|
-
export interface ReasoningChunk {
|
|
46
|
-
type: 'reasoning';
|
|
47
|
-
text: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Union of all stream chunk types.
|
|
51
|
-
*/
|
|
52
|
-
export type StreamChunk = TextChunk | ToolCallChunk | ReasoningChunk;
|
|
53
|
-
/**
|
|
54
|
-
* Options for creating a tool call chunk.
|
|
55
|
-
*/
|
|
56
|
-
export interface CreateToolCallOptions {
|
|
57
|
-
/**
|
|
58
|
-
* Custom tool call ID. If not provided, a random one is generated.
|
|
59
|
-
*/
|
|
60
|
-
toolCallId?: string;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Creates a tool call chunk for testing.
|
|
64
|
-
*
|
|
65
|
-
* @param toolName - The name of the tool being called
|
|
66
|
-
* @param input - The input parameters for the tool
|
|
67
|
-
* @param options - Additional options
|
|
68
|
-
* @returns A properly typed tool call chunk
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* ```typescript
|
|
72
|
-
* const chunk = createToolCallChunk('read_files', { paths: ['file.ts'] })
|
|
73
|
-
* // { type: 'tool-call', toolName: 'read_files', toolCallId: 'tool-call-1', input: { paths: ['file.ts'] } }
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
export declare function createToolCallChunk(toolName: string, input: Record<string, unknown>, options?: CreateToolCallOptions): ToolCallChunk;
|
|
77
|
-
/**
|
|
78
|
-
* Creates a text chunk for testing.
|
|
79
|
-
*
|
|
80
|
-
* @param text - The text content
|
|
81
|
-
* @param agentId - Optional agent ID for subagent chunks
|
|
82
|
-
* @returns A text chunk
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```typescript
|
|
86
|
-
* const chunk = createTextChunk('Hello world!')
|
|
87
|
-
* // { type: 'text', text: 'Hello world!' }
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
export declare function createTextChunk(text: string, agentId?: string): TextChunk;
|
|
91
|
-
/**
|
|
92
|
-
* Creates a reasoning chunk for testing.
|
|
93
|
-
*
|
|
94
|
-
* @param text - The reasoning text
|
|
95
|
-
* @returns A reasoning chunk
|
|
96
|
-
*/
|
|
97
|
-
export declare function createReasoningChunk(text: string): ReasoningChunk;
|
|
98
|
-
/**
|
|
99
|
-
* Creates a mock async generator that yields the provided chunks.
|
|
100
|
-
*
|
|
101
|
-
* @param chunks - The chunks to yield
|
|
102
|
-
* @param returnValue - The value to return when the generator completes
|
|
103
|
-
* @returns An async generator that yields the chunks
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```typescript
|
|
107
|
-
* const stream = createMockStream([
|
|
108
|
-
* createTextChunk('Processing...'),
|
|
109
|
-
* createToolCallChunk('read_files', { paths: ['test.ts'] }),
|
|
110
|
-
* createTextChunk('Done!'),
|
|
111
|
-
* createToolCallChunk('end_turn', {}),
|
|
112
|
-
* ])
|
|
113
|
-
*
|
|
114
|
-
* // Consume the stream
|
|
115
|
-
* const chunks = []
|
|
116
|
-
* for await (const chunk of stream) {
|
|
117
|
-
* chunks.push(chunk)
|
|
118
|
-
* }
|
|
119
|
-
* ```
|
|
120
|
-
*/
|
|
121
|
-
export declare function createMockStream(chunks: StreamChunk[], returnValue?: string | null): AsyncGenerator<StreamChunk, string | null, undefined>;
|
|
122
|
-
/**
|
|
123
|
-
* Creates a mock stream that yields text in multiple chunks.
|
|
124
|
-
* Useful for testing streaming text display.
|
|
125
|
-
*
|
|
126
|
-
* @param text - The complete text to stream
|
|
127
|
-
* @param chunkSize - Size of each chunk
|
|
128
|
-
* @param endWithTool - Whether to end with an end_turn tool call
|
|
129
|
-
* @returns A mock stream
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```typescript
|
|
133
|
-
* const stream = createMockTextStream('Hello world!', 3)
|
|
134
|
-
* // Yields: 'Hel', 'lo ', 'wor', 'ld!'
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
export declare function createMockTextStream(text: string, chunkSize?: number, endWithTool?: boolean): AsyncGenerator<StreamChunk, string | null, undefined>;
|
|
138
|
-
/**
|
|
139
|
-
* Options for creating a mock prompt function.
|
|
140
|
-
*/
|
|
141
|
-
export interface MockPromptOptions {
|
|
142
|
-
/**
|
|
143
|
-
* Default response text.
|
|
144
|
-
*/
|
|
145
|
-
defaultResponse?: string;
|
|
146
|
-
/**
|
|
147
|
-
* Whether to include an end_turn tool call.
|
|
148
|
-
*/
|
|
149
|
-
includeEndTurn?: boolean;
|
|
150
|
-
/**
|
|
151
|
-
* Custom chunks to yield.
|
|
152
|
-
*/
|
|
153
|
-
chunks?: StreamChunk[];
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Mock prompt function result type.
|
|
157
|
-
*/
|
|
158
|
-
export type MockPromptFn = Mock<(params: Record<string, unknown>) => AsyncGenerator<StreamChunk, string | null>>;
|
|
159
|
-
/**
|
|
160
|
-
* Creates a mock promptAiSdkStream function for testing.
|
|
161
|
-
*
|
|
162
|
-
* @param options - Configuration options
|
|
163
|
-
* @returns A mock function that returns streams
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
* ```typescript
|
|
167
|
-
* const mockPrompt = createMockPromptAiSdkStream({
|
|
168
|
-
* defaultResponse: 'I understand your request.',
|
|
169
|
-
* })
|
|
170
|
-
*
|
|
171
|
-
* loopAgentStepsBaseParams.promptAiSdkStream = mockPrompt
|
|
172
|
-
*
|
|
173
|
-
* await loopAgentSteps({ ...params })
|
|
174
|
-
*
|
|
175
|
-
* expect(mockPrompt).toHaveBeenCalledTimes(1)
|
|
176
|
-
* ```
|
|
177
|
-
*/
|
|
178
|
-
export declare function createMockPromptAiSdkStream(options?: MockPromptOptions): MockPromptFn;
|
|
179
|
-
/**
|
|
180
|
-
* Collects all chunks from a stream into an array.
|
|
181
|
-
* Useful for testing stream content.
|
|
182
|
-
*
|
|
183
|
-
* @param stream - The stream to collect from
|
|
184
|
-
* @returns An array of all chunks and the return value
|
|
185
|
-
*
|
|
186
|
-
* @example
|
|
187
|
-
* ```typescript
|
|
188
|
-
* const stream = createMockStream([...])
|
|
189
|
-
* const { chunks, returnValue } = await collectStreamChunks(stream)
|
|
190
|
-
*
|
|
191
|
-
* expect(chunks).toHaveLength(3)
|
|
192
|
-
* expect(returnValue).toBe('mock-message-id')
|
|
193
|
-
* ```
|
|
194
|
-
*/
|
|
195
|
-
export declare function collectStreamChunks<T, R>(stream: AsyncGenerator<T, R, undefined>): Promise<{
|
|
196
|
-
chunks: T[];
|
|
197
|
-
returnValue: R;
|
|
198
|
-
}>;
|
|
199
|
-
/**
|
|
200
|
-
* Resets the tool call ID counter.
|
|
201
|
-
* Call this in beforeEach to ensure deterministic IDs.
|
|
202
|
-
*/
|
|
203
|
-
export declare function resetToolCallIdCounter(): void;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated Use Bun's built-in mock.setSystemTime() instead.
|
|
3
|
-
*/
|
|
4
|
-
export interface PendingTimer {
|
|
5
|
-
id: number;
|
|
6
|
-
ms: number;
|
|
7
|
-
fn: () => void;
|
|
8
|
-
active: boolean;
|
|
9
|
-
createdAt: number;
|
|
10
|
-
}
|
|
11
|
-
export interface MockTimers {
|
|
12
|
-
setTimeout: typeof globalThis.setTimeout;
|
|
13
|
-
clearTimeout: typeof globalThis.clearTimeout;
|
|
14
|
-
install: () => void;
|
|
15
|
-
restore: () => void;
|
|
16
|
-
runAll: () => void;
|
|
17
|
-
advanceBy: (ms: number) => void;
|
|
18
|
-
getPending: () => PendingTimer[];
|
|
19
|
-
getPendingCount: () => number;
|
|
20
|
-
clearAll: () => void;
|
|
21
|
-
isPending: (id: number) => boolean;
|
|
22
|
-
getNext: () => PendingTimer | undefined;
|
|
23
|
-
}
|
|
24
|
-
/** @deprecated Use Bun's built-in mock.setSystemTime() instead. */
|
|
25
|
-
export declare function createMockTimers(): MockTimers;
|
|
26
|
-
/** @deprecated Use Bun's built-in mock.setSystemTime() instead. */
|
|
27
|
-
export declare function installMockTimers(): MockTimers;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export interface MockTreeNode {
|
|
2
|
-
text: string;
|
|
3
|
-
type?: string;
|
|
4
|
-
startPosition?: {
|
|
5
|
-
row: number;
|
|
6
|
-
column: number;
|
|
7
|
-
};
|
|
8
|
-
endPosition?: {
|
|
9
|
-
row: number;
|
|
10
|
-
column: number;
|
|
11
|
-
};
|
|
12
|
-
children?: MockTreeNode[];
|
|
13
|
-
}
|
|
14
|
-
export interface MockTree {
|
|
15
|
-
rootNode: MockTreeNode;
|
|
16
|
-
}
|
|
17
|
-
export interface MockCapture {
|
|
18
|
-
name: string;
|
|
19
|
-
node: MockTreeNode;
|
|
20
|
-
}
|
|
21
|
-
export interface MockParser {
|
|
22
|
-
parse: (input: string) => MockTree | null;
|
|
23
|
-
}
|
|
24
|
-
export interface MockQuery {
|
|
25
|
-
captures: (node: MockTreeNode) => MockCapture[];
|
|
26
|
-
}
|
|
27
|
-
export interface CreateMockParserOptions {
|
|
28
|
-
tree?: MockTree | null;
|
|
29
|
-
parseImpl?: (input: string) => MockTree | null;
|
|
30
|
-
}
|
|
31
|
-
export interface CreateMockQueryOptions {
|
|
32
|
-
captures?: MockCapture[];
|
|
33
|
-
capturesImpl?: (node: MockTreeNode) => MockCapture[];
|
|
34
|
-
}
|
|
35
|
-
export declare function createMockCapture(name: string, text: string): MockCapture;
|
|
36
|
-
export declare function createMockTreeSitterCaptures(items: Array<{
|
|
37
|
-
name: string;
|
|
38
|
-
text: string;
|
|
39
|
-
}>): MockCapture[];
|
|
40
|
-
export declare function createMockTree(rootNodeText?: string): MockTree;
|
|
41
|
-
export declare function createMockTreeSitterParser(options?: CreateMockParserOptions): MockParser;
|
|
42
|
-
export declare function createMockTreeSitterQuery(options?: CreateMockQueryOptions): MockQuery;
|
|
43
|
-
export interface CreateMockLanguageConfigOptions {
|
|
44
|
-
extensions?: string[];
|
|
45
|
-
wasmFile?: string;
|
|
46
|
-
queryText?: string;
|
|
47
|
-
parser?: MockParser | null;
|
|
48
|
-
query?: MockQuery | null;
|
|
49
|
-
captures?: MockCapture[];
|
|
50
|
-
tree?: MockTree | null;
|
|
51
|
-
}
|
|
52
|
-
export declare function createMockLanguageConfig(options?: CreateMockLanguageConfigOptions): {
|
|
53
|
-
extensions: string[];
|
|
54
|
-
wasmFile: string;
|
|
55
|
-
queryText: string;
|
|
56
|
-
parser: MockParser | null;
|
|
57
|
-
query: MockQuery | null;
|
|
58
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { BaseEnv, ProcessEnv } from './types/contracts/env';
|
|
2
|
-
/**
|
|
3
|
-
* Test-only helpers for process env snapshots.
|
|
4
|
-
* Keep production code using `@levelcode/common/env-process`.
|
|
5
|
-
*/
|
|
6
|
-
export declare const createTestBaseEnv: (overrides?: Partial<BaseEnv>) => BaseEnv;
|
|
7
|
-
export declare const createTestProcessEnv: (overrides?: Partial<ProcessEnv>) => ProcessEnv;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ToolResultOutput } from '../types/messages/content-part';
|
|
2
|
-
import type { Tool } from 'ai';
|
|
3
|
-
export declare const toolNameParam = "cb_tool_name";
|
|
4
|
-
export declare const endsAgentStepParam = "cb_easp";
|
|
5
|
-
export declare const toolXmlName = "levelcode_tool_call";
|
|
6
|
-
export declare const startToolTag = "<levelcode_tool_call>\n";
|
|
7
|
-
export declare const endToolTag = "\n</levelcode_tool_call>";
|
|
8
|
-
export declare const TOOLS_WHICH_WONT_FORCE_NEXT_STEP: string[];
|
|
9
|
-
export declare const toolNames: readonly ["add_subgoal", "add_message", "ask_user", "browser_logs", "code_search", "create_plan", "end_turn", "find_files", "glob", "list_directory", "lookup_agent_info", "propose_str_replace", "propose_write_file", "read_docs", "read_files", "read_subtree", "run_file_change_hooks", "run_terminal_command", "send_message", "set_messages", "set_output", "skill", "spawn_agents", "spawn_agent_inline", "str_replace", "suggest_followups", "task_completed", "task_create", "task_get", "task_list", "task_update", "team_create", "team_delete", "think_deeply", "update_subgoal", "web_search", "write_file", "write_todos"];
|
|
10
|
-
export declare const publishedTools: readonly ["add_message", "ask_user", "code_search", "end_turn", "find_files", "glob", "list_directory", "lookup_agent_info", "propose_str_replace", "propose_write_file", "read_docs", "read_files", "read_subtree", "run_file_change_hooks", "run_terminal_command", "set_messages", "set_output", "skill", "spawn_agents", "str_replace", "suggest_followups", "task_completed", "think_deeply", "web_search", "write_file", "write_todos"];
|
|
11
|
-
export type ToolName = (typeof toolNames)[number];
|
|
12
|
-
export type PublishedToolName = (typeof publishedTools)[number];
|
|
13
|
-
/** Only used for validating tool definitions */
|
|
14
|
-
export type $ToolParams<T extends ToolName = ToolName> = Required<Pick<Tool<any, ToolResultOutput[]>, 'description' | 'inputSchema' | 'outputSchema'>> & {
|
|
15
|
-
toolName: T;
|
|
16
|
-
endsAgentStep: boolean;
|
|
17
|
-
};
|