@levelcode/sdk 0.2.3 → 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
package/dist/index.cjs
CHANGED
|
@@ -7269,8 +7269,8 @@ var require_uri_all = __commonJS((exports3, module2) => {
|
|
|
7269
7269
|
wsComponents.secure = undefined;
|
|
7270
7270
|
}
|
|
7271
7271
|
if (wsComponents.resourceName) {
|
|
7272
|
-
var _wsComponents$resourc = wsComponents.resourceName.split("?"), _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
|
|
7273
|
-
wsComponents.path =
|
|
7272
|
+
var _wsComponents$resourc = wsComponents.resourceName.split("?"), _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), path8 = _wsComponents$resourc2[0], query = _wsComponents$resourc2[1];
|
|
7273
|
+
wsComponents.path = path8 && path8 !== "/" ? path8 : undefined;
|
|
7274
7274
|
wsComponents.query = query;
|
|
7275
7275
|
wsComponents.resourceName = undefined;
|
|
7276
7276
|
}
|
|
@@ -7663,12 +7663,12 @@ var require_util = __commonJS((exports3, module2) => {
|
|
|
7663
7663
|
return "'" + escapeQuotes(str) + "'";
|
|
7664
7664
|
}
|
|
7665
7665
|
function getPathExpr(currentPath, expr, jsonPointers, isNumber2) {
|
|
7666
|
-
var
|
|
7667
|
-
return joinPaths(currentPath,
|
|
7666
|
+
var path8 = jsonPointers ? "'/' + " + expr + (isNumber2 ? "" : ".replace(/~/g, '~0').replace(/\\//g, '~1')") : isNumber2 ? "'[' + " + expr + " + ']'" : "'[\\'' + " + expr + " + '\\']'";
|
|
7667
|
+
return joinPaths(currentPath, path8);
|
|
7668
7668
|
}
|
|
7669
7669
|
function getPath(currentPath, prop, jsonPointers) {
|
|
7670
|
-
var
|
|
7671
|
-
return joinPaths(currentPath,
|
|
7670
|
+
var path8 = jsonPointers ? toQuotedString("/" + escapeJsonPointer(prop)) : toQuotedString(getProperty(prop));
|
|
7671
|
+
return joinPaths(currentPath, path8);
|
|
7672
7672
|
}
|
|
7673
7673
|
var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
|
|
7674
7674
|
var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
|
@@ -12634,7 +12634,7 @@ var require_windows = __commonJS((exports3, module2) => {
|
|
|
12634
12634
|
module2.exports = isexe;
|
|
12635
12635
|
isexe.sync = sync;
|
|
12636
12636
|
var fs7 = require("fs");
|
|
12637
|
-
function checkPathExt(
|
|
12637
|
+
function checkPathExt(path8, options) {
|
|
12638
12638
|
var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
|
|
12639
12639
|
if (!pathext) {
|
|
12640
12640
|
return true;
|
|
@@ -12645,25 +12645,25 @@ var require_windows = __commonJS((exports3, module2) => {
|
|
|
12645
12645
|
}
|
|
12646
12646
|
for (var i = 0;i < pathext.length; i++) {
|
|
12647
12647
|
var p = pathext[i].toLowerCase();
|
|
12648
|
-
if (p &&
|
|
12648
|
+
if (p && path8.substr(-p.length).toLowerCase() === p) {
|
|
12649
12649
|
return true;
|
|
12650
12650
|
}
|
|
12651
12651
|
}
|
|
12652
12652
|
return false;
|
|
12653
12653
|
}
|
|
12654
|
-
function checkStat(stat,
|
|
12654
|
+
function checkStat(stat, path8, options) {
|
|
12655
12655
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
12656
12656
|
return false;
|
|
12657
12657
|
}
|
|
12658
|
-
return checkPathExt(
|
|
12658
|
+
return checkPathExt(path8, options);
|
|
12659
12659
|
}
|
|
12660
|
-
function isexe(
|
|
12661
|
-
fs7.stat(
|
|
12662
|
-
cb(er, er ? false : checkStat(stat,
|
|
12660
|
+
function isexe(path8, options, cb) {
|
|
12661
|
+
fs7.stat(path8, function(er, stat) {
|
|
12662
|
+
cb(er, er ? false : checkStat(stat, path8, options));
|
|
12663
12663
|
});
|
|
12664
12664
|
}
|
|
12665
|
-
function sync(
|
|
12666
|
-
return checkStat(fs7.statSync(
|
|
12665
|
+
function sync(path8, options) {
|
|
12666
|
+
return checkStat(fs7.statSync(path8), path8, options);
|
|
12667
12667
|
}
|
|
12668
12668
|
});
|
|
12669
12669
|
|
|
@@ -12672,13 +12672,13 @@ var require_mode = __commonJS((exports3, module2) => {
|
|
|
12672
12672
|
module2.exports = isexe;
|
|
12673
12673
|
isexe.sync = sync;
|
|
12674
12674
|
var fs7 = require("fs");
|
|
12675
|
-
function isexe(
|
|
12676
|
-
fs7.stat(
|
|
12675
|
+
function isexe(path8, options, cb) {
|
|
12676
|
+
fs7.stat(path8, function(er, stat) {
|
|
12677
12677
|
cb(er, er ? false : checkStat(stat, options));
|
|
12678
12678
|
});
|
|
12679
12679
|
}
|
|
12680
|
-
function sync(
|
|
12681
|
-
return checkStat(fs7.statSync(
|
|
12680
|
+
function sync(path8, options) {
|
|
12681
|
+
return checkStat(fs7.statSync(path8), options);
|
|
12682
12682
|
}
|
|
12683
12683
|
function checkStat(stat, options) {
|
|
12684
12684
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -12709,7 +12709,7 @@ var require_isexe = __commonJS((exports3, module2) => {
|
|
|
12709
12709
|
}
|
|
12710
12710
|
module2.exports = isexe;
|
|
12711
12711
|
isexe.sync = sync;
|
|
12712
|
-
function isexe(
|
|
12712
|
+
function isexe(path8, options, cb) {
|
|
12713
12713
|
if (typeof options === "function") {
|
|
12714
12714
|
cb = options;
|
|
12715
12715
|
options = {};
|
|
@@ -12719,7 +12719,7 @@ var require_isexe = __commonJS((exports3, module2) => {
|
|
|
12719
12719
|
throw new TypeError("callback not provided");
|
|
12720
12720
|
}
|
|
12721
12721
|
return new Promise(function(resolve3, reject) {
|
|
12722
|
-
isexe(
|
|
12722
|
+
isexe(path8, options || {}, function(er, is) {
|
|
12723
12723
|
if (er) {
|
|
12724
12724
|
reject(er);
|
|
12725
12725
|
} else {
|
|
@@ -12728,7 +12728,7 @@ var require_isexe = __commonJS((exports3, module2) => {
|
|
|
12728
12728
|
});
|
|
12729
12729
|
});
|
|
12730
12730
|
}
|
|
12731
|
-
core(
|
|
12731
|
+
core(path8, options || {}, function(er, is) {
|
|
12732
12732
|
if (er) {
|
|
12733
12733
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
12734
12734
|
er = null;
|
|
@@ -12738,9 +12738,9 @@ var require_isexe = __commonJS((exports3, module2) => {
|
|
|
12738
12738
|
cb(er, is);
|
|
12739
12739
|
});
|
|
12740
12740
|
}
|
|
12741
|
-
function sync(
|
|
12741
|
+
function sync(path8, options) {
|
|
12742
12742
|
try {
|
|
12743
|
-
return core.sync(
|
|
12743
|
+
return core.sync(path8, options || {});
|
|
12744
12744
|
} catch (er) {
|
|
12745
12745
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
12746
12746
|
return false;
|
|
@@ -12754,7 +12754,7 @@ var require_isexe = __commonJS((exports3, module2) => {
|
|
|
12754
12754
|
// ../node_modules/which/which.js
|
|
12755
12755
|
var require_which = __commonJS((exports3, module2) => {
|
|
12756
12756
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
12757
|
-
var
|
|
12757
|
+
var path8 = require("path");
|
|
12758
12758
|
var COLON = isWindows ? ";" : ":";
|
|
12759
12759
|
var isexe = require_isexe();
|
|
12760
12760
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -12790,7 +12790,7 @@ var require_which = __commonJS((exports3, module2) => {
|
|
|
12790
12790
|
return opt.all && found.length ? resolve3(found) : reject(getNotFoundError(cmd));
|
|
12791
12791
|
const ppRaw = pathEnv[i];
|
|
12792
12792
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
12793
|
-
const pCmd =
|
|
12793
|
+
const pCmd = path8.join(pathPart, cmd);
|
|
12794
12794
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
12795
12795
|
resolve3(subStep(p, i, 0));
|
|
12796
12796
|
});
|
|
@@ -12817,7 +12817,7 @@ var require_which = __commonJS((exports3, module2) => {
|
|
|
12817
12817
|
for (let i = 0;i < pathEnv.length; i++) {
|
|
12818
12818
|
const ppRaw = pathEnv[i];
|
|
12819
12819
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
12820
|
-
const pCmd =
|
|
12820
|
+
const pCmd = path8.join(pathPart, cmd);
|
|
12821
12821
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
12822
12822
|
for (let j = 0;j < pathExt.length; j++) {
|
|
12823
12823
|
const cur = p + pathExt[j];
|
|
@@ -12858,7 +12858,7 @@ var require_path_key = __commonJS((exports3, module2) => {
|
|
|
12858
12858
|
|
|
12859
12859
|
// ../node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
12860
12860
|
var require_resolveCommand = __commonJS((exports3, module2) => {
|
|
12861
|
-
var
|
|
12861
|
+
var path8 = require("path");
|
|
12862
12862
|
var which = require_which();
|
|
12863
12863
|
var getPathKey = require_path_key();
|
|
12864
12864
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -12875,7 +12875,7 @@ var require_resolveCommand = __commonJS((exports3, module2) => {
|
|
|
12875
12875
|
try {
|
|
12876
12876
|
resolved = which.sync(parsed.command, {
|
|
12877
12877
|
path: env2[getPathKey({ env: env2 })],
|
|
12878
|
-
pathExt: withoutPathExt ?
|
|
12878
|
+
pathExt: withoutPathExt ? path8.delimiter : undefined
|
|
12879
12879
|
});
|
|
12880
12880
|
} catch (e) {} finally {
|
|
12881
12881
|
if (shouldSwitchCwd) {
|
|
@@ -12883,7 +12883,7 @@ var require_resolveCommand = __commonJS((exports3, module2) => {
|
|
|
12883
12883
|
}
|
|
12884
12884
|
}
|
|
12885
12885
|
if (resolved) {
|
|
12886
|
-
resolved =
|
|
12886
|
+
resolved = path8.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
12887
12887
|
}
|
|
12888
12888
|
return resolved;
|
|
12889
12889
|
}
|
|
@@ -12928,8 +12928,8 @@ var require_shebang_command = __commonJS((exports3, module2) => {
|
|
|
12928
12928
|
if (!match) {
|
|
12929
12929
|
return null;
|
|
12930
12930
|
}
|
|
12931
|
-
const [
|
|
12932
|
-
const binary =
|
|
12931
|
+
const [path8, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
12932
|
+
const binary = path8.split("/").pop();
|
|
12933
12933
|
if (binary === "env") {
|
|
12934
12934
|
return argument;
|
|
12935
12935
|
}
|
|
@@ -12957,7 +12957,7 @@ var require_readShebang = __commonJS((exports3, module2) => {
|
|
|
12957
12957
|
|
|
12958
12958
|
// ../node_modules/cross-spawn/lib/parse.js
|
|
12959
12959
|
var require_parse = __commonJS((exports3, module2) => {
|
|
12960
|
-
var
|
|
12960
|
+
var path8 = require("path");
|
|
12961
12961
|
var resolveCommand = require_resolveCommand();
|
|
12962
12962
|
var escape = require_escape();
|
|
12963
12963
|
var readShebang = require_readShebang();
|
|
@@ -12982,7 +12982,7 @@ var require_parse = __commonJS((exports3, module2) => {
|
|
|
12982
12982
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
12983
12983
|
if (parsed.options.forceShell || needsShell) {
|
|
12984
12984
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
12985
|
-
parsed.command =
|
|
12985
|
+
parsed.command = path8.normalize(parsed.command);
|
|
12986
12986
|
parsed.command = escape.command(parsed.command);
|
|
12987
12987
|
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
12988
12988
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -17433,6 +17433,13 @@ function loadTeamConfig(teamName) {
|
|
|
17433
17433
|
}
|
|
17434
17434
|
return result.data;
|
|
17435
17435
|
}
|
|
17436
|
+
async function saveTeamConfig(teamName, config) {
|
|
17437
|
+
const configPath = getTeamConfigPath(teamName);
|
|
17438
|
+
await withLock(configPath, () => {
|
|
17439
|
+
fs2.mkdirSync(path2.dirname(configPath), { recursive: true });
|
|
17440
|
+
fs2.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
17441
|
+
});
|
|
17442
|
+
}
|
|
17436
17443
|
function deleteTeam(teamName) {
|
|
17437
17444
|
const teamDir = getTeamDir(teamName);
|
|
17438
17445
|
if (fs2.existsSync(teamDir)) {
|
|
@@ -21643,18 +21650,165 @@ function getMinimumPhaseForTool(toolName39) {
|
|
|
21643
21650
|
var import_lodash13 = __toESM(require_lodash());
|
|
21644
21651
|
|
|
21645
21652
|
// ../packages/agent-runtime/src/team-context.ts
|
|
21653
|
+
var fs4 = __toESM(require("fs"));
|
|
21654
|
+
|
|
21655
|
+
// ../common/src/utils/team-discovery.ts
|
|
21646
21656
|
var fs3 = __toESM(require("fs"));
|
|
21657
|
+
var path3 = __toESM(require("path"));
|
|
21658
|
+
var os2 = __toESM(require("os"));
|
|
21659
|
+
function getLastActiveTeamPath() {
|
|
21660
|
+
return path3.join(os2.homedir(), ".config", "levelcode", "teams", ".last-active-team");
|
|
21661
|
+
}
|
|
21662
|
+
function setLastActiveTeam(teamName) {
|
|
21663
|
+
try {
|
|
21664
|
+
const filePath = getLastActiveTeamPath();
|
|
21665
|
+
fs3.mkdirSync(path3.dirname(filePath), { recursive: true });
|
|
21666
|
+
fs3.writeFileSync(filePath, teamName, "utf-8");
|
|
21667
|
+
} catch {}
|
|
21668
|
+
}
|
|
21669
|
+
function getLastActiveTeam() {
|
|
21670
|
+
try {
|
|
21671
|
+
const filePath = getLastActiveTeamPath();
|
|
21672
|
+
if (!fs3.existsSync(filePath)) {
|
|
21673
|
+
return null;
|
|
21674
|
+
}
|
|
21675
|
+
const name = fs3.readFileSync(filePath, "utf-8").trim();
|
|
21676
|
+
return name || null;
|
|
21677
|
+
} catch {
|
|
21678
|
+
return null;
|
|
21679
|
+
}
|
|
21680
|
+
}
|
|
21681
|
+
function readTeamEntries() {
|
|
21682
|
+
let teamsDir;
|
|
21683
|
+
try {
|
|
21684
|
+
teamsDir = getTeamsDir();
|
|
21685
|
+
} catch {
|
|
21686
|
+
return [];
|
|
21687
|
+
}
|
|
21688
|
+
if (!fs3.existsSync(teamsDir)) {
|
|
21689
|
+
return [];
|
|
21690
|
+
}
|
|
21691
|
+
try {
|
|
21692
|
+
return fs3.readdirSync(teamsDir, { withFileTypes: true });
|
|
21693
|
+
} catch {
|
|
21694
|
+
return [];
|
|
21695
|
+
}
|
|
21696
|
+
}
|
|
21697
|
+
function safeLoadTeamConfig(teamName) {
|
|
21698
|
+
try {
|
|
21699
|
+
const config = loadTeamConfig(teamName);
|
|
21700
|
+
if (!config || !Array.isArray(config.members)) {
|
|
21701
|
+
return null;
|
|
21702
|
+
}
|
|
21703
|
+
return config;
|
|
21704
|
+
} catch {
|
|
21705
|
+
return null;
|
|
21706
|
+
}
|
|
21707
|
+
}
|
|
21708
|
+
function loadAllTeamConfigs() {
|
|
21709
|
+
const entries = readTeamEntries();
|
|
21710
|
+
const results = [];
|
|
21711
|
+
for (const entry of entries) {
|
|
21712
|
+
if (!entry.isDirectory()) {
|
|
21713
|
+
continue;
|
|
21714
|
+
}
|
|
21715
|
+
const config = safeLoadTeamConfig(entry.name);
|
|
21716
|
+
if (config) {
|
|
21717
|
+
results.push({ teamName: config.name, config });
|
|
21718
|
+
}
|
|
21719
|
+
}
|
|
21720
|
+
return results;
|
|
21721
|
+
}
|
|
21722
|
+
function findCurrentTeam(agentId) {
|
|
21723
|
+
const allTeams = loadAllTeamConfigs();
|
|
21724
|
+
for (const { teamName, config } of allTeams) {
|
|
21725
|
+
if (config.leadAgentId === `lead-${agentId}`) {
|
|
21726
|
+
return { teamName, config };
|
|
21727
|
+
}
|
|
21728
|
+
for (const member of config.members) {
|
|
21729
|
+
if (member.agentId === `lead-${agentId}` || member.agentId === agentId) {
|
|
21730
|
+
return { teamName, config };
|
|
21731
|
+
}
|
|
21732
|
+
}
|
|
21733
|
+
}
|
|
21734
|
+
if (allTeams.length === 1) {
|
|
21735
|
+
return allTeams[0];
|
|
21736
|
+
}
|
|
21737
|
+
const lastActive = getLastActiveTeam();
|
|
21738
|
+
if (lastActive) {
|
|
21739
|
+
const match = allTeams.find((t) => t.teamName === lastActive);
|
|
21740
|
+
if (match) {
|
|
21741
|
+
return match;
|
|
21742
|
+
}
|
|
21743
|
+
}
|
|
21744
|
+
return null;
|
|
21745
|
+
}
|
|
21746
|
+
function findCurrentTeamAndAgent(agentId) {
|
|
21747
|
+
const allTeams = loadAllTeamConfigs();
|
|
21748
|
+
for (const { teamName, config } of allTeams) {
|
|
21749
|
+
for (const member of config.members) {
|
|
21750
|
+
if (member.agentId === `lead-${agentId}` || member.agentId === agentId) {
|
|
21751
|
+
return { teamName, agentName: member.name, config };
|
|
21752
|
+
}
|
|
21753
|
+
}
|
|
21754
|
+
}
|
|
21755
|
+
let resolved = null;
|
|
21756
|
+
if (allTeams.length === 1) {
|
|
21757
|
+
resolved = allTeams[0];
|
|
21758
|
+
} else {
|
|
21759
|
+
const lastActive = getLastActiveTeam();
|
|
21760
|
+
if (lastActive) {
|
|
21761
|
+
resolved = allTeams.find((t) => t.teamName === lastActive) ?? null;
|
|
21762
|
+
}
|
|
21763
|
+
}
|
|
21764
|
+
if (resolved) {
|
|
21765
|
+
const leadMember = resolved.config.members.find((m) => m.agentId === resolved.config.leadAgentId);
|
|
21766
|
+
const agentName = leadMember?.name ?? "team-lead";
|
|
21767
|
+
return { teamName: resolved.teamName, agentName, config: resolved.config };
|
|
21768
|
+
}
|
|
21769
|
+
return null;
|
|
21770
|
+
}
|
|
21771
|
+
function findTeamByName(name) {
|
|
21772
|
+
try {
|
|
21773
|
+
validateTeamName(name);
|
|
21774
|
+
} catch {
|
|
21775
|
+
return null;
|
|
21776
|
+
}
|
|
21777
|
+
return safeLoadTeamConfig(name);
|
|
21778
|
+
}
|
|
21779
|
+
function listAllTeams() {
|
|
21780
|
+
const entries = readTeamEntries();
|
|
21781
|
+
const results = [];
|
|
21782
|
+
for (const entry of entries) {
|
|
21783
|
+
if (!entry.isDirectory()) {
|
|
21784
|
+
continue;
|
|
21785
|
+
}
|
|
21786
|
+
const config = safeLoadTeamConfig(entry.name);
|
|
21787
|
+
if (!config) {
|
|
21788
|
+
continue;
|
|
21789
|
+
}
|
|
21790
|
+
results.push({
|
|
21791
|
+
name: config.name,
|
|
21792
|
+
phase: config.phase,
|
|
21793
|
+
memberCount: config.members.length
|
|
21794
|
+
});
|
|
21795
|
+
}
|
|
21796
|
+
return results;
|
|
21797
|
+
}
|
|
21798
|
+
|
|
21799
|
+
// ../packages/agent-runtime/src/team-context.ts
|
|
21647
21800
|
function findTeamContext(agentIdentifier) {
|
|
21648
21801
|
const teamsDir = getTeamsDir();
|
|
21649
|
-
if (!
|
|
21802
|
+
if (!fs4.existsSync(teamsDir)) {
|
|
21650
21803
|
return null;
|
|
21651
21804
|
}
|
|
21652
21805
|
let entries;
|
|
21653
21806
|
try {
|
|
21654
|
-
entries =
|
|
21807
|
+
entries = fs4.readdirSync(teamsDir, { withFileTypes: true });
|
|
21655
21808
|
} catch {
|
|
21656
21809
|
return null;
|
|
21657
21810
|
}
|
|
21811
|
+
const allTeams = [];
|
|
21658
21812
|
for (const entry of entries) {
|
|
21659
21813
|
if (!entry.isDirectory()) {
|
|
21660
21814
|
continue;
|
|
@@ -21663,12 +21817,30 @@ function findTeamContext(agentIdentifier) {
|
|
|
21663
21817
|
if (!config) {
|
|
21664
21818
|
continue;
|
|
21665
21819
|
}
|
|
21820
|
+
allTeams.push({ teamName: config.name, config });
|
|
21821
|
+
}
|
|
21822
|
+
for (const { teamName, config } of allTeams) {
|
|
21666
21823
|
for (const member of config.members) {
|
|
21667
21824
|
if (member.agentId === agentIdentifier || member.agentId === `lead-${agentIdentifier}`) {
|
|
21668
|
-
return { teamName
|
|
21825
|
+
return { teamName, agentName: member.name, config };
|
|
21669
21826
|
}
|
|
21670
21827
|
}
|
|
21671
21828
|
}
|
|
21829
|
+
function resolveFromTeam(team) {
|
|
21830
|
+
const leadMember = team.config.members.find((m) => m.agentId === team.config.leadAgentId);
|
|
21831
|
+
const agentName = leadMember?.name ?? "team-lead";
|
|
21832
|
+
return { teamName: team.teamName, agentName, config: team.config };
|
|
21833
|
+
}
|
|
21834
|
+
if (allTeams.length === 1) {
|
|
21835
|
+
return resolveFromTeam(allTeams[0]);
|
|
21836
|
+
}
|
|
21837
|
+
const lastActive = getLastActiveTeam();
|
|
21838
|
+
if (lastActive) {
|
|
21839
|
+
const match = allTeams.find((t) => t.teamName === lastActive);
|
|
21840
|
+
if (match) {
|
|
21841
|
+
return resolveFromTeam(match);
|
|
21842
|
+
}
|
|
21843
|
+
}
|
|
21672
21844
|
return null;
|
|
21673
21845
|
}
|
|
21674
21846
|
|
|
@@ -24623,8 +24795,8 @@ var import_lodash4 = __toESM(require_lodash());
|
|
|
24623
24795
|
init_model_config();
|
|
24624
24796
|
|
|
24625
24797
|
// ../common/src/util/file.ts
|
|
24626
|
-
var
|
|
24627
|
-
var
|
|
24798
|
+
var os3 = __toESM(require("os"));
|
|
24799
|
+
var path4 = __toESM(require("path"));
|
|
24628
24800
|
var import_v464 = require("zod/v4");
|
|
24629
24801
|
var FileTreeNodeSchema = import_v464.z.object({
|
|
24630
24802
|
name: import_v464.z.string(),
|
|
@@ -24702,9 +24874,9 @@ function printFileTree(nodes, depth = 0) {
|
|
|
24702
24874
|
}
|
|
24703
24875
|
return result;
|
|
24704
24876
|
}
|
|
24705
|
-
function printFileTreeWithTokens(nodes, fileTokenScores,
|
|
24877
|
+
function printFileTreeWithTokens(nodes, fileTokenScores, path5 = []) {
|
|
24706
24878
|
let result = "";
|
|
24707
|
-
const depth =
|
|
24879
|
+
const depth = path5.length;
|
|
24708
24880
|
const indentToken = " ";
|
|
24709
24881
|
const indentation = indentToken.repeat(depth);
|
|
24710
24882
|
const indentationWithFile = indentToken.repeat(depth + 1);
|
|
@@ -24713,8 +24885,8 @@ function printFileTreeWithTokens(nodes, fileTokenScores, path4 = []) {
|
|
|
24713
24885
|
continue;
|
|
24714
24886
|
}
|
|
24715
24887
|
result += `${indentation}${node.name}${node.type === "directory" ? "/" : ""}`;
|
|
24716
|
-
|
|
24717
|
-
const filePath =
|
|
24888
|
+
path5.push(node.name);
|
|
24889
|
+
const filePath = path5.join("/");
|
|
24718
24890
|
const tokenScores = fileTokenScores[filePath];
|
|
24719
24891
|
if (node.type === "file" && tokenScores) {
|
|
24720
24892
|
const tokens = Object.keys(tokenScores);
|
|
@@ -24726,16 +24898,16 @@ ${indentationWithFile}${tokens.join(" ")}`;
|
|
|
24726
24898
|
result += `
|
|
24727
24899
|
`;
|
|
24728
24900
|
if (node.type === "directory" && node.children) {
|
|
24729
|
-
result += printFileTreeWithTokens(node.children, fileTokenScores,
|
|
24901
|
+
result += printFileTreeWithTokens(node.children, fileTokenScores, path5);
|
|
24730
24902
|
}
|
|
24731
|
-
|
|
24903
|
+
path5.pop();
|
|
24732
24904
|
}
|
|
24733
24905
|
return result;
|
|
24734
24906
|
}
|
|
24735
24907
|
async function fileExists(params2) {
|
|
24736
|
-
const { filePath, fs:
|
|
24908
|
+
const { filePath, fs: fs5 } = params2;
|
|
24737
24909
|
try {
|
|
24738
|
-
await
|
|
24910
|
+
await fs5.stat(filePath);
|
|
24739
24911
|
return true;
|
|
24740
24912
|
} catch {
|
|
24741
24913
|
return false;
|
|
@@ -24746,19 +24918,19 @@ var cleanMarkdownCodeBlock = (content) => {
|
|
|
24746
24918
|
return cleanResponse;
|
|
24747
24919
|
};
|
|
24748
24920
|
function isSubdir(fromPath, toPath) {
|
|
24749
|
-
const resolvedFrom =
|
|
24750
|
-
const resolvedTo =
|
|
24921
|
+
const resolvedFrom = path4.resolve(fromPath);
|
|
24922
|
+
const resolvedTo = path4.resolve(toPath);
|
|
24751
24923
|
if (process.platform === "win32") {
|
|
24752
|
-
const fromDrive =
|
|
24753
|
-
const toDrive =
|
|
24924
|
+
const fromDrive = path4.parse(resolvedFrom).root.toLowerCase();
|
|
24925
|
+
const toDrive = path4.parse(resolvedTo).root.toLowerCase();
|
|
24754
24926
|
if (fromDrive !== toDrive) {
|
|
24755
24927
|
return false;
|
|
24756
24928
|
}
|
|
24757
24929
|
}
|
|
24758
|
-
return !
|
|
24930
|
+
return !path4.relative(resolvedFrom, resolvedTo).startsWith("..");
|
|
24759
24931
|
}
|
|
24760
24932
|
function isValidProjectRoot(dir) {
|
|
24761
|
-
return !isSubdir(dir,
|
|
24933
|
+
return !isSubdir(dir, os3.homedir());
|
|
24762
24934
|
}
|
|
24763
24935
|
|
|
24764
24936
|
// ../packages/agent-runtime/src/process-file-block.ts
|
|
@@ -30085,7 +30257,7 @@ function countTokensJson(text) {
|
|
|
30085
30257
|
// ../packages/agent-runtime/src/process-file-block.ts
|
|
30086
30258
|
async function processFileBlock(params2) {
|
|
30087
30259
|
const {
|
|
30088
|
-
path:
|
|
30260
|
+
path: path5,
|
|
30089
30261
|
initialContentPromise,
|
|
30090
30262
|
newContent,
|
|
30091
30263
|
messages,
|
|
@@ -30100,28 +30272,28 @@ async function processFileBlock(params2) {
|
|
|
30100
30272
|
const initialContent = await initialContentPromise;
|
|
30101
30273
|
if (initialContent === null) {
|
|
30102
30274
|
let cleanContent = cleanMarkdownCodeBlock(newContent);
|
|
30103
|
-
if (hasLazyEdit(cleanContent) && !
|
|
30104
|
-
logger2.debug({ path:
|
|
30275
|
+
if (hasLazyEdit(cleanContent) && !path5.endsWith(".md")) {
|
|
30276
|
+
logger2.debug({ path: path5, newContent }, `processFileBlock: New file contained a lazy edit for ${path5}. Aborting.`);
|
|
30105
30277
|
return promptSuccess({
|
|
30106
30278
|
tool: "write_file",
|
|
30107
|
-
path:
|
|
30279
|
+
path: path5,
|
|
30108
30280
|
error: "You created a new file with a placeholder comment like `// ... existing code ...` (or equivalent for other languages). Are you sure you have the file path right? You probably meant to modify an existing file instead of providing a path to a new file."
|
|
30109
30281
|
});
|
|
30110
30282
|
}
|
|
30111
|
-
logger2.debug({ path:
|
|
30283
|
+
logger2.debug({ path: path5, cleanContent }, `processFileBlock: Created new file ${path5}`);
|
|
30112
30284
|
return promptSuccess({
|
|
30113
30285
|
tool: "write_file",
|
|
30114
|
-
path:
|
|
30286
|
+
path: path5,
|
|
30115
30287
|
content: cleanContent,
|
|
30116
30288
|
patch: undefined,
|
|
30117
|
-
messages: [`Created new file ${
|
|
30289
|
+
messages: [`Created new file ${path5}`]
|
|
30118
30290
|
});
|
|
30119
30291
|
}
|
|
30120
30292
|
if (newContent === initialContent) {
|
|
30121
|
-
logger2.info({ newContent }, `processFileBlock: New was same as old, skipping ${
|
|
30293
|
+
logger2.info({ newContent }, `processFileBlock: New was same as old, skipping ${path5}`);
|
|
30122
30294
|
return promptSuccess({
|
|
30123
30295
|
tool: "write_file",
|
|
30124
|
-
path:
|
|
30296
|
+
path: path5,
|
|
30125
30297
|
error: "The new content was the same as the old content, skipping."
|
|
30126
30298
|
});
|
|
30127
30299
|
}
|
|
@@ -30142,7 +30314,7 @@ async function processFileBlock(params2) {
|
|
|
30142
30314
|
...params2,
|
|
30143
30315
|
oldContent: normalizedInitialContent,
|
|
30144
30316
|
editSnippet: normalizedEditSnippet,
|
|
30145
|
-
filePath:
|
|
30317
|
+
filePath: path5
|
|
30146
30318
|
});
|
|
30147
30319
|
if (largeFileResult.aborted) {
|
|
30148
30320
|
return promptAborted(largeFileResult.reason);
|
|
@@ -30151,7 +30323,7 @@ async function processFileBlock(params2) {
|
|
|
30151
30323
|
if (!largeFileContent) {
|
|
30152
30324
|
return promptSuccess({
|
|
30153
30325
|
tool: "write_file",
|
|
30154
|
-
path:
|
|
30326
|
+
path: path5,
|
|
30155
30327
|
error: "Failed to apply the write file change to this large file. You should try using the str_replace tool instead for large files."
|
|
30156
30328
|
});
|
|
30157
30329
|
}
|
|
@@ -30161,12 +30333,12 @@ async function processFileBlock(params2) {
|
|
|
30161
30333
|
...params2,
|
|
30162
30334
|
initialContent: normalizedInitialContent,
|
|
30163
30335
|
editSnippet: normalizedEditSnippet,
|
|
30164
|
-
filePath:
|
|
30336
|
+
filePath: path5,
|
|
30165
30337
|
userMessage: lastUserPrompt
|
|
30166
30338
|
});
|
|
30167
30339
|
const shouldAddPlaceholders = await shouldAddFilePlaceholders({
|
|
30168
30340
|
...params2,
|
|
30169
|
-
filePath:
|
|
30341
|
+
filePath: path5,
|
|
30170
30342
|
oldContent: normalizedInitialContent,
|
|
30171
30343
|
rewrittenNewContent: updatedContent,
|
|
30172
30344
|
messageHistory: messages
|
|
@@ -30180,12 +30352,12 @@ ${placeholderComment}`;
|
|
|
30180
30352
|
...params2,
|
|
30181
30353
|
initialContent: normalizedInitialContent,
|
|
30182
30354
|
editSnippet: updatedEditSnippet,
|
|
30183
|
-
filePath:
|
|
30355
|
+
filePath: path5,
|
|
30184
30356
|
userMessage: lastUserPrompt
|
|
30185
30357
|
});
|
|
30186
30358
|
}
|
|
30187
30359
|
}
|
|
30188
|
-
let patch = import_diff.createPatch(
|
|
30360
|
+
let patch = import_diff.createPatch(path5, normalizedInitialContent, updatedContent);
|
|
30189
30361
|
const lines = patch.split(`
|
|
30190
30362
|
`);
|
|
30191
30363
|
const hunkStartIndex = lines.findIndex((line) => line.startsWith("@@"));
|
|
@@ -30195,34 +30367,34 @@ ${placeholderComment}`;
|
|
|
30195
30367
|
} else {
|
|
30196
30368
|
editMessages.push("The new content was the same as the old content, skipping.");
|
|
30197
30369
|
logger2.debug({
|
|
30198
|
-
path:
|
|
30370
|
+
path: path5,
|
|
30199
30371
|
initialContent,
|
|
30200
30372
|
changes: newContent,
|
|
30201
30373
|
patch,
|
|
30202
30374
|
editMessages
|
|
30203
|
-
}, `processFileBlock: No change to ${
|
|
30375
|
+
}, `processFileBlock: No change to ${path5}`);
|
|
30204
30376
|
return promptSuccess({
|
|
30205
30377
|
tool: "write_file",
|
|
30206
|
-
path:
|
|
30378
|
+
path: path5,
|
|
30207
30379
|
error: editMessages.join(`
|
|
30208
30380
|
|
|
30209
30381
|
`)
|
|
30210
30382
|
});
|
|
30211
30383
|
}
|
|
30212
30384
|
logger2.debug({
|
|
30213
|
-
path:
|
|
30385
|
+
path: path5,
|
|
30214
30386
|
editSnippet: newContent,
|
|
30215
30387
|
updatedContent,
|
|
30216
30388
|
patch,
|
|
30217
30389
|
editMessages
|
|
30218
|
-
}, `processFileBlock: Updated file ${
|
|
30390
|
+
}, `processFileBlock: Updated file ${path5}`);
|
|
30219
30391
|
const patchOriginalLineEndings = patch.replaceAll(`
|
|
30220
30392
|
`, lineEnding);
|
|
30221
30393
|
const updatedContentOriginalLineEndings = updatedContent.replaceAll(`
|
|
30222
30394
|
`, lineEnding);
|
|
30223
30395
|
return promptSuccess({
|
|
30224
30396
|
tool: "write_file",
|
|
30225
|
-
path:
|
|
30397
|
+
path: path5,
|
|
30226
30398
|
content: updatedContentOriginalLineEndings,
|
|
30227
30399
|
patch: patchOriginalLineEndings,
|
|
30228
30400
|
messages: editMessages
|
|
@@ -30339,21 +30511,21 @@ var handleWriteFile = async (params2) => {
|
|
|
30339
30511
|
requestOptionalFile,
|
|
30340
30512
|
writeToClient
|
|
30341
30513
|
} = params2;
|
|
30342
|
-
const { path:
|
|
30514
|
+
const { path: path5, instructions, content } = toolCall.input;
|
|
30343
30515
|
const fileProcessingPromisesByPath = fileProcessingState2.promisesByPath;
|
|
30344
30516
|
const fileProcessingPromises = fileProcessingState2.allPromises;
|
|
30345
|
-
if (!fileProcessingPromisesByPath[
|
|
30346
|
-
fileProcessingPromisesByPath[
|
|
30517
|
+
if (!fileProcessingPromisesByPath[path5]) {
|
|
30518
|
+
fileProcessingPromisesByPath[path5] = [];
|
|
30347
30519
|
}
|
|
30348
|
-
const previousPromises = fileProcessingPromisesByPath[
|
|
30520
|
+
const previousPromises = fileProcessingPromisesByPath[path5];
|
|
30349
30521
|
const previousEdit = previousPromises[previousPromises.length - 1];
|
|
30350
|
-
const latestContentPromise = previousEdit ? previousEdit.then((maybeResult) => maybeResult && ("content" in maybeResult) ? maybeResult.content : requestOptionalFile({ ...params2, filePath:
|
|
30522
|
+
const latestContentPromise = previousEdit ? previousEdit.then((maybeResult) => maybeResult && ("content" in maybeResult) ? maybeResult.content : requestOptionalFile({ ...params2, filePath: path5 })) : requestOptionalFile({ ...params2, filePath: path5 });
|
|
30351
30523
|
const fileContentWithoutStartNewline = content.startsWith(`
|
|
30352
30524
|
`) ? content.slice(1) : content;
|
|
30353
|
-
logger2.debug({ path:
|
|
30525
|
+
logger2.debug({ path: path5, content }, `write_file ${path5}`);
|
|
30354
30526
|
const newPromise = processFileBlock({
|
|
30355
30527
|
...params2,
|
|
30356
|
-
path:
|
|
30528
|
+
path: path5,
|
|
30357
30529
|
instructions,
|
|
30358
30530
|
initialContentPromise: latestContentPromise,
|
|
30359
30531
|
newContent: fileContentWithoutStartNewline,
|
|
@@ -30375,14 +30547,14 @@ var handleWriteFile = async (params2) => {
|
|
|
30375
30547
|
logger2.error(error, "Error processing write_file block");
|
|
30376
30548
|
return {
|
|
30377
30549
|
tool: "write_file",
|
|
30378
|
-
path:
|
|
30550
|
+
path: path5,
|
|
30379
30551
|
error: `Error: Failed to process the write_file block. ${typeof error === "string" ? error : error.msg}`
|
|
30380
30552
|
};
|
|
30381
30553
|
}).then(async (fileProcessingResult) => ({
|
|
30382
30554
|
...fileProcessingResult,
|
|
30383
30555
|
toolCallId: toolCall.toolCallId
|
|
30384
30556
|
}));
|
|
30385
|
-
fileProcessingPromisesByPath[
|
|
30557
|
+
fileProcessingPromisesByPath[path5].push(newPromise);
|
|
30386
30558
|
fileProcessingPromises.push(newPromise);
|
|
30387
30559
|
await previousToolCallFinished;
|
|
30388
30560
|
return {
|
|
@@ -30412,12 +30584,12 @@ async function postStreamProcessing(toolCall, fileProcessingState2, writeToClien
|
|
|
30412
30584
|
if (errors.length > 1) {
|
|
30413
30585
|
throw new Error(`Internal error: Unexpected number of matching errors for ${JSON.stringify(toolCall)}, found ${errors.length}, expected 1`);
|
|
30414
30586
|
}
|
|
30415
|
-
const { path:
|
|
30587
|
+
const { path: path6, error } = errors[0];
|
|
30416
30588
|
return [
|
|
30417
30589
|
{
|
|
30418
30590
|
type: "json",
|
|
30419
30591
|
value: {
|
|
30420
|
-
file:
|
|
30592
|
+
file: path6,
|
|
30421
30593
|
errorMessage: error
|
|
30422
30594
|
}
|
|
30423
30595
|
}
|
|
@@ -30427,11 +30599,11 @@ async function postStreamProcessing(toolCall, fileProcessingState2, writeToClien
|
|
|
30427
30599
|
if (changes.length !== 1) {
|
|
30428
30600
|
throw new Error(`Internal error: Unexpected number of matching changes for ${JSON.stringify(toolCall)}, found ${changes.length}, expected 1`);
|
|
30429
30601
|
}
|
|
30430
|
-
const { patch, content, path:
|
|
30602
|
+
const { patch, content, path: path5 } = changes[0];
|
|
30431
30603
|
const clientToolCall = {
|
|
30432
30604
|
toolCallId: toolCall.toolCallId,
|
|
30433
30605
|
toolName: toolCall.tool,
|
|
30434
|
-
input: patch ? { type: "patch", path:
|
|
30606
|
+
input: patch ? { type: "patch", path: path5, content: patch } : { type: "file", path: path5, content }
|
|
30435
30607
|
};
|
|
30436
30608
|
return await requestClientToolCall(clientToolCall);
|
|
30437
30609
|
}
|
|
@@ -30446,19 +30618,19 @@ var handleCreatePlan = async (params2) => {
|
|
|
30446
30618
|
requestClientToolCall,
|
|
30447
30619
|
writeToClient
|
|
30448
30620
|
} = params2;
|
|
30449
|
-
const { path:
|
|
30621
|
+
const { path: path5, plan } = toolCall.input;
|
|
30450
30622
|
logger2.debug({
|
|
30451
|
-
path:
|
|
30623
|
+
path: path5,
|
|
30452
30624
|
plan
|
|
30453
30625
|
}, "Create plan");
|
|
30454
30626
|
const change = {
|
|
30455
30627
|
tool: "create_plan",
|
|
30456
|
-
path:
|
|
30628
|
+
path: path5,
|
|
30457
30629
|
content: plan,
|
|
30458
30630
|
messages: [],
|
|
30459
30631
|
toolCallId: toolCall.toolCallId
|
|
30460
30632
|
};
|
|
30461
|
-
fileProcessingState2.promisesByPath[
|
|
30633
|
+
fileProcessingState2.promisesByPath[path5].push(Promise.resolve(change));
|
|
30462
30634
|
fileProcessingState2.allPromises.push(Promise.resolve(change));
|
|
30463
30635
|
await previousToolCallFinished;
|
|
30464
30636
|
return {
|
|
@@ -30494,7 +30666,7 @@ function logFileTreeError(operation, filePath, error) {
|
|
|
30494
30666
|
var DEFAULT_MAX_FILES = 1e4;
|
|
30495
30667
|
async function getProjectFileTree(params2) {
|
|
30496
30668
|
const withDefaults = { maxFiles: DEFAULT_MAX_FILES, ...params2 };
|
|
30497
|
-
const { projectRoot, fs:
|
|
30669
|
+
const { projectRoot, fs: fs5 } = withDefaults;
|
|
30498
30670
|
let { maxFiles } = withDefaults;
|
|
30499
30671
|
const _start = Date.now();
|
|
30500
30672
|
const defaultIgnore = ignore.default();
|
|
@@ -30524,11 +30696,11 @@ async function getProjectFileTree(params2) {
|
|
|
30524
30696
|
const parsedIgnore = await parseGitignore({
|
|
30525
30697
|
fullDirPath: fullPath,
|
|
30526
30698
|
projectRoot,
|
|
30527
|
-
fs:
|
|
30699
|
+
fs: fs5
|
|
30528
30700
|
});
|
|
30529
30701
|
const mergedIgnore = ignore.default().add(currentIgnore).add(parsedIgnore);
|
|
30530
30702
|
try {
|
|
30531
|
-
const files = await
|
|
30703
|
+
const files = await fs5.readdir(fullPath);
|
|
30532
30704
|
for (const file of files) {
|
|
30533
30705
|
if (totalFiles >= maxFiles)
|
|
30534
30706
|
break;
|
|
@@ -30537,7 +30709,7 @@ async function getProjectFileTree(params2) {
|
|
|
30537
30709
|
if (mergedIgnore.ignores(relativeFilePath))
|
|
30538
30710
|
continue;
|
|
30539
30711
|
try {
|
|
30540
|
-
const stats = await
|
|
30712
|
+
const stats = await fs5.stat(filePath);
|
|
30541
30713
|
if (stats.isDirectory()) {
|
|
30542
30714
|
const childNode = {
|
|
30543
30715
|
name: file,
|
|
@@ -30599,7 +30771,7 @@ function rebaseGitignorePattern(rawPattern, relativeDirPath) {
|
|
|
30599
30771
|
return isNegated ? `!${rebased}` : rebased;
|
|
30600
30772
|
}
|
|
30601
30773
|
async function parseGitignore(params2) {
|
|
30602
|
-
const { fullDirPath, projectRoot, fs:
|
|
30774
|
+
const { fullDirPath, projectRoot, fs: fs5 } = params2;
|
|
30603
30775
|
const ig = ignore.default();
|
|
30604
30776
|
const relativeDirPath = import_path2.default.relative(projectRoot, fullDirPath);
|
|
30605
30777
|
const ignoreFiles = [
|
|
@@ -30608,12 +30780,12 @@ async function parseGitignore(params2) {
|
|
|
30608
30780
|
import_path2.default.join(fullDirPath, ".manicodeignore")
|
|
30609
30781
|
];
|
|
30610
30782
|
for (const ignoreFilePath of ignoreFiles) {
|
|
30611
|
-
const ignoreFileExists = await fileExists({ filePath: ignoreFilePath, fs:
|
|
30783
|
+
const ignoreFileExists = await fileExists({ filePath: ignoreFilePath, fs: fs5 });
|
|
30612
30784
|
if (!ignoreFileExists)
|
|
30613
30785
|
continue;
|
|
30614
30786
|
let ignoreContent;
|
|
30615
30787
|
try {
|
|
30616
|
-
ignoreContent = await
|
|
30788
|
+
ignoreContent = await fs5.readFile(ignoreFilePath, "utf8");
|
|
30617
30789
|
} catch (error) {
|
|
30618
30790
|
logFileTreeError("fs.readFile (ignore file)", ignoreFilePath, error);
|
|
30619
30791
|
continue;
|
|
@@ -30650,7 +30822,7 @@ function getLastReadFilePaths(flattenedNodes, count) {
|
|
|
30650
30822
|
return import_lodash5.sortBy(flattenedNodes.filter((node) => node.lastReadTime), "lastReadTime").reverse().slice(0, count).map((node) => node.filePath);
|
|
30651
30823
|
}
|
|
30652
30824
|
async function isFileIgnored(params2) {
|
|
30653
|
-
const { filePath, projectRoot, fs:
|
|
30825
|
+
const { filePath, projectRoot, fs: fs5 } = params2;
|
|
30654
30826
|
const defaultIgnore = ignore.default();
|
|
30655
30827
|
for (const pattern of DEFAULT_IGNORED_PATHS) {
|
|
30656
30828
|
defaultIgnore.add(pattern);
|
|
@@ -30660,7 +30832,7 @@ async function isFileIgnored(params2) {
|
|
|
30660
30832
|
const mergedIgnore = ignore.default().add(defaultIgnore);
|
|
30661
30833
|
let currentDir = dirPath;
|
|
30662
30834
|
while (currentDir.startsWith(projectRoot)) {
|
|
30663
|
-
mergedIgnore.add(await parseGitignore({ fullDirPath: currentDir, projectRoot, fs:
|
|
30835
|
+
mergedIgnore.add(await parseGitignore({ fullDirPath: currentDir, projectRoot, fs: fs5 }));
|
|
30664
30836
|
currentDir = import_path2.default.dirname(currentDir);
|
|
30665
30837
|
}
|
|
30666
30838
|
return mergedIgnore.ignores(relativeFilePath);
|
|
@@ -31202,9 +31374,9 @@ async function getFileReadingUpdates(params2) {
|
|
|
31202
31374
|
const { requestFiles, requestedFiles } = params2;
|
|
31203
31375
|
const allFilePaths = import_lodash9.uniq(requestedFiles);
|
|
31204
31376
|
const loadedFiles = await requestFiles({ filePaths: allFilePaths });
|
|
31205
|
-
const addedFiles = allFilePaths.filter((
|
|
31206
|
-
path:
|
|
31207
|
-
content: loadedFiles[
|
|
31377
|
+
const addedFiles = allFilePaths.filter((path6) => loadedFiles[path6] != null && loadedFiles[path6] !== undefined).map((path6) => ({
|
|
31378
|
+
path: path6,
|
|
31379
|
+
content: loadedFiles[path6]
|
|
31208
31380
|
}));
|
|
31209
31381
|
return addedFiles;
|
|
31210
31382
|
}
|
|
@@ -31618,7 +31790,7 @@ ${systemInfo.platform === "win32" ? windowsNote + `
|
|
|
31618
31790
|
Shell: ${systemInfo.shell}
|
|
31619
31791
|
|
|
31620
31792
|
<user_shell_config_files>
|
|
31621
|
-
${Object.entries(shellConfigFiles).map(([
|
|
31793
|
+
${Object.entries(shellConfigFiles).map(([path6, content]) => createMarkdownFileBlock(path6, content)).join(`
|
|
31622
31794
|
`)}
|
|
31623
31795
|
${closeXml("user_shell_config_files")}
|
|
31624
31796
|
|
|
@@ -31898,12 +32070,12 @@ function normalizeLineEndings(params2) {
|
|
|
31898
32070
|
`);
|
|
31899
32071
|
}
|
|
31900
32072
|
async function processStrReplace(params2) {
|
|
31901
|
-
const { path:
|
|
32073
|
+
const { path: path6, replacements, initialContentPromise, logger: logger2 } = params2;
|
|
31902
32074
|
const initialContent = await initialContentPromise;
|
|
31903
32075
|
if (initialContent === null) {
|
|
31904
32076
|
return {
|
|
31905
32077
|
tool: "str_replace",
|
|
31906
|
-
path:
|
|
32078
|
+
path: path6,
|
|
31907
32079
|
error: "The file does not exist, skipping. Please use the write_file tool to create the file."
|
|
31908
32080
|
};
|
|
31909
32081
|
}
|
|
@@ -31943,19 +32115,19 @@ async function processStrReplace(params2) {
|
|
|
31943
32115
|
`, lineEnding);
|
|
31944
32116
|
if (initialContent === currentContent) {
|
|
31945
32117
|
logger2.debug({
|
|
31946
|
-
path:
|
|
32118
|
+
path: path6,
|
|
31947
32119
|
initialContent
|
|
31948
|
-
}, `processStrReplace: No change to ${
|
|
32120
|
+
}, `processStrReplace: No change to ${path6}`);
|
|
31949
32121
|
messages.push("No change to the file");
|
|
31950
32122
|
return {
|
|
31951
32123
|
tool: "str_replace",
|
|
31952
|
-
path:
|
|
32124
|
+
path: path6,
|
|
31953
32125
|
error: messages.join(`
|
|
31954
32126
|
|
|
31955
32127
|
`)
|
|
31956
32128
|
};
|
|
31957
32129
|
}
|
|
31958
|
-
let patch = import_diff2.createPatch(
|
|
32130
|
+
let patch = import_diff2.createPatch(path6, initialContent, currentContent);
|
|
31959
32131
|
const lines = patch.split(`
|
|
31960
32132
|
`);
|
|
31961
32133
|
const hunkStartIndex = lines.findIndex((line) => line.startsWith("@@"));
|
|
@@ -31965,14 +32137,14 @@ async function processStrReplace(params2) {
|
|
|
31965
32137
|
}
|
|
31966
32138
|
const finalPatch = patch;
|
|
31967
32139
|
logger2.debug({
|
|
31968
|
-
path:
|
|
32140
|
+
path: path6,
|
|
31969
32141
|
newContent: currentContent,
|
|
31970
32142
|
patch: finalPatch,
|
|
31971
32143
|
messages
|
|
31972
|
-
}, `processStrReplace: Updated file ${
|
|
32144
|
+
}, `processStrReplace: Updated file ${path6}`);
|
|
31973
32145
|
return {
|
|
31974
32146
|
tool: "str_replace",
|
|
31975
|
-
path:
|
|
32147
|
+
path: path6,
|
|
31976
32148
|
content: currentContent,
|
|
31977
32149
|
patch: finalPatch,
|
|
31978
32150
|
messages
|
|
@@ -32044,17 +32216,17 @@ var handleProposeStrReplace = async (params2) => {
|
|
|
32044
32216
|
runId,
|
|
32045
32217
|
requestOptionalFile
|
|
32046
32218
|
} = params2;
|
|
32047
|
-
const { path:
|
|
32219
|
+
const { path: path6, replacements } = toolCall.input;
|
|
32048
32220
|
const getProposedOrDiskContent = async () => {
|
|
32049
|
-
const proposedContent = getProposedContent(runId,
|
|
32221
|
+
const proposedContent = getProposedContent(runId, path6);
|
|
32050
32222
|
if (proposedContent !== undefined) {
|
|
32051
32223
|
return proposedContent;
|
|
32052
32224
|
}
|
|
32053
|
-
return requestOptionalFile({ ...params2, filePath:
|
|
32225
|
+
return requestOptionalFile({ ...params2, filePath: path6 });
|
|
32054
32226
|
};
|
|
32055
32227
|
const latestContentPromise = getProposedOrDiskContent();
|
|
32056
32228
|
const strReplaceResultPromise = processStrReplace({
|
|
32057
|
-
path:
|
|
32229
|
+
path: path6,
|
|
32058
32230
|
replacements,
|
|
32059
32231
|
initialContentPromise: latestContentPromise,
|
|
32060
32232
|
logger: logger2
|
|
@@ -32062,11 +32234,11 @@ var handleProposeStrReplace = async (params2) => {
|
|
|
32062
32234
|
logger2.error(error, "Error processing propose_str_replace");
|
|
32063
32235
|
return {
|
|
32064
32236
|
tool: "str_replace",
|
|
32065
|
-
path:
|
|
32237
|
+
path: path6,
|
|
32066
32238
|
error: "Unknown error: Failed to process the propose_str_replace."
|
|
32067
32239
|
};
|
|
32068
32240
|
});
|
|
32069
|
-
setProposedContent(runId,
|
|
32241
|
+
setProposedContent(runId, path6, strReplaceResultPromise.then((result) => ("content" in result) ? result.content : null));
|
|
32070
32242
|
await previousToolCallFinished;
|
|
32071
32243
|
const strReplaceResult = await strReplaceResultPromise;
|
|
32072
32244
|
if ("error" in strReplaceResult) {
|
|
@@ -32075,7 +32247,7 @@ var handleProposeStrReplace = async (params2) => {
|
|
|
32075
32247
|
{
|
|
32076
32248
|
type: "json",
|
|
32077
32249
|
value: {
|
|
32078
|
-
file:
|
|
32250
|
+
file: path6,
|
|
32079
32251
|
errorMessage: strReplaceResult.error
|
|
32080
32252
|
}
|
|
32081
32253
|
}
|
|
@@ -32090,7 +32262,7 @@ var handleProposeStrReplace = async (params2) => {
|
|
|
32090
32262
|
{
|
|
32091
32263
|
type: "json",
|
|
32092
32264
|
value: {
|
|
32093
|
-
file:
|
|
32265
|
+
file: path6,
|
|
32094
32266
|
message,
|
|
32095
32267
|
unifiedDiff: strReplaceResult.patch
|
|
32096
32268
|
}
|
|
@@ -32109,21 +32281,21 @@ var handleProposeWriteFile = async (params2) => {
|
|
|
32109
32281
|
runId,
|
|
32110
32282
|
requestOptionalFile
|
|
32111
32283
|
} = params2;
|
|
32112
|
-
const { path:
|
|
32284
|
+
const { path: path6, content } = toolCall.input;
|
|
32113
32285
|
const getProposedOrDiskContent = async () => {
|
|
32114
|
-
const proposedContent = getProposedContent(runId,
|
|
32286
|
+
const proposedContent = getProposedContent(runId, path6);
|
|
32115
32287
|
if (proposedContent !== undefined) {
|
|
32116
32288
|
return proposedContent;
|
|
32117
32289
|
}
|
|
32118
|
-
return requestOptionalFile({ ...params2, filePath:
|
|
32290
|
+
return requestOptionalFile({ ...params2, filePath: path6 });
|
|
32119
32291
|
};
|
|
32120
32292
|
const initialContent = await getProposedOrDiskContent();
|
|
32121
32293
|
const newContent = content.startsWith(`
|
|
32122
32294
|
`) ? content.slice(1) : content;
|
|
32123
|
-
setProposedContent(runId,
|
|
32295
|
+
setProposedContent(runId, path6, Promise.resolve(newContent));
|
|
32124
32296
|
await previousToolCallFinished;
|
|
32125
32297
|
const oldContent = initialContent ?? "";
|
|
32126
|
-
let patch = import_diff3.createPatch(
|
|
32298
|
+
let patch = import_diff3.createPatch(path6, oldContent, newContent);
|
|
32127
32299
|
const lines = patch.split(`
|
|
32128
32300
|
`);
|
|
32129
32301
|
const hunkStartIndex = lines.findIndex((line) => line.startsWith("@@"));
|
|
@@ -32132,13 +32304,13 @@ var handleProposeWriteFile = async (params2) => {
|
|
|
32132
32304
|
`);
|
|
32133
32305
|
}
|
|
32134
32306
|
const isNewFile = initialContent === null;
|
|
32135
|
-
const message = isNewFile ? `Proposed new file ${
|
|
32307
|
+
const message = isNewFile ? `Proposed new file ${path6}` : `Proposed changes to ${path6}`;
|
|
32136
32308
|
return {
|
|
32137
32309
|
output: [
|
|
32138
32310
|
{
|
|
32139
32311
|
type: "json",
|
|
32140
32312
|
value: {
|
|
32141
|
-
file:
|
|
32313
|
+
file: path6,
|
|
32142
32314
|
message,
|
|
32143
32315
|
unifiedDiff: patch
|
|
32144
32316
|
}
|
|
@@ -33274,15 +33446,15 @@ var handleStrReplace = async (params2) => {
|
|
|
33274
33446
|
requestOptionalFile,
|
|
33275
33447
|
writeToClient
|
|
33276
33448
|
} = params2;
|
|
33277
|
-
const { path:
|
|
33278
|
-
if (!fileProcessingState2.promisesByPath[
|
|
33279
|
-
fileProcessingState2.promisesByPath[
|
|
33449
|
+
const { path: path6, replacements } = toolCall.input;
|
|
33450
|
+
if (!fileProcessingState2.promisesByPath[path6]) {
|
|
33451
|
+
fileProcessingState2.promisesByPath[path6] = [];
|
|
33280
33452
|
}
|
|
33281
|
-
const previousPromises = fileProcessingState2.promisesByPath[
|
|
33453
|
+
const previousPromises = fileProcessingState2.promisesByPath[path6];
|
|
33282
33454
|
const previousEdit = previousPromises[previousPromises.length - 1];
|
|
33283
|
-
const latestContentPromise = previousEdit ? previousEdit.then((maybeResult) => maybeResult && ("content" in maybeResult) ? maybeResult.content : requestOptionalFile({ ...params2, filePath:
|
|
33455
|
+
const latestContentPromise = previousEdit ? previousEdit.then((maybeResult) => maybeResult && ("content" in maybeResult) ? maybeResult.content : requestOptionalFile({ ...params2, filePath: path6 })) : requestOptionalFile({ ...params2, filePath: path6 });
|
|
33284
33456
|
const newPromise = processStrReplace({
|
|
33285
|
-
path:
|
|
33457
|
+
path: path6,
|
|
33286
33458
|
replacements,
|
|
33287
33459
|
initialContentPromise: latestContentPromise,
|
|
33288
33460
|
logger: logger2
|
|
@@ -33290,14 +33462,14 @@ var handleStrReplace = async (params2) => {
|
|
|
33290
33462
|
logger2.error(error, "Error processing str_replace block");
|
|
33291
33463
|
return {
|
|
33292
33464
|
tool: "str_replace",
|
|
33293
|
-
path:
|
|
33465
|
+
path: path6,
|
|
33294
33466
|
error: "Unknown error: Failed to process the str_replace block."
|
|
33295
33467
|
};
|
|
33296
33468
|
}).then((fileProcessingResult) => ({
|
|
33297
33469
|
...fileProcessingResult,
|
|
33298
33470
|
toolCallId: toolCall.toolCallId
|
|
33299
33471
|
}));
|
|
33300
|
-
fileProcessingState2.promisesByPath[
|
|
33472
|
+
fileProcessingState2.promisesByPath[path6].push(newPromise);
|
|
33301
33473
|
fileProcessingState2.allPromises.push(newPromise);
|
|
33302
33474
|
await previousToolCallFinished;
|
|
33303
33475
|
const strReplaceResult = await newPromise;
|
|
@@ -33320,7 +33492,7 @@ var handleSuggestFollowups = async (params2) => {
|
|
|
33320
33492
|
};
|
|
33321
33493
|
|
|
33322
33494
|
// ../packages/agent-runtime/src/tools/handlers/tool/task-completed.ts
|
|
33323
|
-
var
|
|
33495
|
+
var fs5 = __toESM(require("fs"));
|
|
33324
33496
|
|
|
33325
33497
|
// ../common/src/utils/team-hook-emitter.ts
|
|
33326
33498
|
var listeners = new Set;
|
|
@@ -33377,10 +33549,10 @@ function emitTaskCompleted(params2) {
|
|
|
33377
33549
|
// ../packages/agent-runtime/src/tools/handlers/tool/task-completed.ts
|
|
33378
33550
|
function getActiveTeamName() {
|
|
33379
33551
|
const teamsDir = getTeamsDir();
|
|
33380
|
-
if (!
|
|
33552
|
+
if (!fs5.existsSync(teamsDir)) {
|
|
33381
33553
|
return null;
|
|
33382
33554
|
}
|
|
33383
|
-
const entries =
|
|
33555
|
+
const entries = fs5.readdirSync(teamsDir, { withFileTypes: true });
|
|
33384
33556
|
const teamDirs = entries.filter((e) => e.isDirectory());
|
|
33385
33557
|
if (teamDirs.length === 0) {
|
|
33386
33558
|
return null;
|
|
@@ -33643,102 +33815,6 @@ var handleWriteTodos = async (params2) => {
|
|
|
33643
33815
|
return { output: jsonToolResult({ message: "Todos written" }) };
|
|
33644
33816
|
};
|
|
33645
33817
|
|
|
33646
|
-
// ../common/src/utils/team-discovery.ts
|
|
33647
|
-
var fs5 = __toESM(require("fs"));
|
|
33648
|
-
function readTeamEntries() {
|
|
33649
|
-
let teamsDir;
|
|
33650
|
-
try {
|
|
33651
|
-
teamsDir = getTeamsDir();
|
|
33652
|
-
} catch {
|
|
33653
|
-
return [];
|
|
33654
|
-
}
|
|
33655
|
-
if (!fs5.existsSync(teamsDir)) {
|
|
33656
|
-
return [];
|
|
33657
|
-
}
|
|
33658
|
-
try {
|
|
33659
|
-
return fs5.readdirSync(teamsDir, { withFileTypes: true });
|
|
33660
|
-
} catch {
|
|
33661
|
-
return [];
|
|
33662
|
-
}
|
|
33663
|
-
}
|
|
33664
|
-
function safeLoadTeamConfig(teamName) {
|
|
33665
|
-
try {
|
|
33666
|
-
const config = loadTeamConfig(teamName);
|
|
33667
|
-
if (!config || !Array.isArray(config.members)) {
|
|
33668
|
-
return null;
|
|
33669
|
-
}
|
|
33670
|
-
return config;
|
|
33671
|
-
} catch {
|
|
33672
|
-
return null;
|
|
33673
|
-
}
|
|
33674
|
-
}
|
|
33675
|
-
function findCurrentTeam(agentId) {
|
|
33676
|
-
const entries = readTeamEntries();
|
|
33677
|
-
for (const entry of entries) {
|
|
33678
|
-
if (!entry.isDirectory()) {
|
|
33679
|
-
continue;
|
|
33680
|
-
}
|
|
33681
|
-
const config = safeLoadTeamConfig(entry.name);
|
|
33682
|
-
if (!config) {
|
|
33683
|
-
continue;
|
|
33684
|
-
}
|
|
33685
|
-
if (config.leadAgentId === `lead-${agentId}`) {
|
|
33686
|
-
return { teamName: config.name, config };
|
|
33687
|
-
}
|
|
33688
|
-
for (const member of config.members) {
|
|
33689
|
-
if (member.agentId === `lead-${agentId}` || member.agentId === agentId) {
|
|
33690
|
-
return { teamName: config.name, config };
|
|
33691
|
-
}
|
|
33692
|
-
}
|
|
33693
|
-
}
|
|
33694
|
-
return null;
|
|
33695
|
-
}
|
|
33696
|
-
function findCurrentTeamAndAgent(agentId) {
|
|
33697
|
-
const entries = readTeamEntries();
|
|
33698
|
-
for (const entry of entries) {
|
|
33699
|
-
if (!entry.isDirectory()) {
|
|
33700
|
-
continue;
|
|
33701
|
-
}
|
|
33702
|
-
const config = safeLoadTeamConfig(entry.name);
|
|
33703
|
-
if (!config) {
|
|
33704
|
-
continue;
|
|
33705
|
-
}
|
|
33706
|
-
for (const member of config.members) {
|
|
33707
|
-
if (member.agentId === `lead-${agentId}` || member.agentId === agentId) {
|
|
33708
|
-
return { teamName: config.name, agentName: member.name, config };
|
|
33709
|
-
}
|
|
33710
|
-
}
|
|
33711
|
-
}
|
|
33712
|
-
return null;
|
|
33713
|
-
}
|
|
33714
|
-
function findTeamByName(name) {
|
|
33715
|
-
try {
|
|
33716
|
-
validateTeamName(name);
|
|
33717
|
-
} catch {
|
|
33718
|
-
return null;
|
|
33719
|
-
}
|
|
33720
|
-
return safeLoadTeamConfig(name);
|
|
33721
|
-
}
|
|
33722
|
-
function listAllTeams() {
|
|
33723
|
-
const entries = readTeamEntries();
|
|
33724
|
-
const results = [];
|
|
33725
|
-
for (const entry of entries) {
|
|
33726
|
-
if (!entry.isDirectory()) {
|
|
33727
|
-
continue;
|
|
33728
|
-
}
|
|
33729
|
-
const config = safeLoadTeamConfig(entry.name);
|
|
33730
|
-
if (!config) {
|
|
33731
|
-
continue;
|
|
33732
|
-
}
|
|
33733
|
-
results.push({
|
|
33734
|
-
name: config.name,
|
|
33735
|
-
phase: config.phase,
|
|
33736
|
-
memberCount: config.members.length
|
|
33737
|
-
});
|
|
33738
|
-
}
|
|
33739
|
-
return results;
|
|
33740
|
-
}
|
|
33741
|
-
|
|
33742
33818
|
// ../packages/agent-runtime/src/tools/handlers/tool/send-message.ts
|
|
33743
33819
|
function errorResult(message) {
|
|
33744
33820
|
return { output: jsonToolResult({ message }) };
|
|
@@ -34122,7 +34198,7 @@ var handleTaskList = async (params2) => {
|
|
|
34122
34198
|
|
|
34123
34199
|
// ../packages/agent-runtime/src/tools/handlers/tool/task-update.ts
|
|
34124
34200
|
var fs6 = __toESM(require("fs"));
|
|
34125
|
-
var
|
|
34201
|
+
var path6 = __toESM(require("path"));
|
|
34126
34202
|
var VALID_STATUSES = ["pending", "in_progress", "completed", "blocked", "deleted"];
|
|
34127
34203
|
function errorResult4(message) {
|
|
34128
34204
|
return { output: jsonToolResult({ error: message }) };
|
|
@@ -34173,7 +34249,7 @@ var handleTaskUpdate = async (params2) => {
|
|
|
34173
34249
|
}
|
|
34174
34250
|
if (status === "deleted") {
|
|
34175
34251
|
try {
|
|
34176
|
-
const taskPath =
|
|
34252
|
+
const taskPath = path6.join(getTasksDir(teamName), `${taskId}.json`);
|
|
34177
34253
|
if (fs6.existsSync(taskPath)) {
|
|
34178
34254
|
fs6.unlinkSync(taskPath);
|
|
34179
34255
|
}
|
|
@@ -34311,6 +34387,7 @@ var handleTeamCreate = async (params2) => {
|
|
|
34311
34387
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
34312
34388
|
return errorResult5(`Failed to create team "${team_name}": ${errorMessage}`);
|
|
34313
34389
|
}
|
|
34390
|
+
setLastActiveTeam(team_name);
|
|
34314
34391
|
trackTeamCreated({ trackEvent: trackEvent2, userId: userId ?? "", logger: logger2 }, team_name, teamConfig.members.length);
|
|
34315
34392
|
let teamFilePath;
|
|
34316
34393
|
let taskDirPath;
|
|
@@ -35296,6 +35373,70 @@ async function executeSegmentsArray(segments, params2) {
|
|
|
35296
35373
|
return toolResults2;
|
|
35297
35374
|
}
|
|
35298
35375
|
|
|
35376
|
+
// ../packages/agent-runtime/src/team-lifecycle.ts
|
|
35377
|
+
var registry = new Map;
|
|
35378
|
+
async function updateAgentStatus(teamName, agentId, status, logger2) {
|
|
35379
|
+
const teamMap = registry.get(teamName);
|
|
35380
|
+
if (teamMap) {
|
|
35381
|
+
const entry = teamMap.get(agentId);
|
|
35382
|
+
if (entry) {
|
|
35383
|
+
entry.status = status;
|
|
35384
|
+
}
|
|
35385
|
+
}
|
|
35386
|
+
const config = loadTeamConfig(teamName);
|
|
35387
|
+
if (!config) {
|
|
35388
|
+
logger2.debug({ teamName, agentId, status }, "updateAgentStatus: team config not found");
|
|
35389
|
+
return;
|
|
35390
|
+
}
|
|
35391
|
+
const memberIndex = config.members.findIndex((m) => m.agentId === agentId);
|
|
35392
|
+
if (memberIndex === -1) {
|
|
35393
|
+
logger2.debug({ teamName, agentId, status }, "updateAgentStatus: member not found in team config");
|
|
35394
|
+
return;
|
|
35395
|
+
}
|
|
35396
|
+
config.members[memberIndex].status = status;
|
|
35397
|
+
await saveTeamConfig(teamName, config);
|
|
35398
|
+
logger2.debug({ teamName, agentId, status }, `updateAgentStatus: set status to "${status}"`);
|
|
35399
|
+
}
|
|
35400
|
+
async function markAgentIdle(params2) {
|
|
35401
|
+
const { teamName, agentId, agentName, lastTaskId, trackEvent: trackEvent2, userId, logger: logger2 } = params2;
|
|
35402
|
+
await updateAgentStatus(teamName, agentId, "idle", logger2);
|
|
35403
|
+
const config = loadTeamConfig(teamName);
|
|
35404
|
+
if (config) {
|
|
35405
|
+
const member = config.members.find((m) => m.agentId === agentId);
|
|
35406
|
+
if (member) {
|
|
35407
|
+
member.currentTaskId = undefined;
|
|
35408
|
+
await saveTeamConfig(teamName, config);
|
|
35409
|
+
}
|
|
35410
|
+
}
|
|
35411
|
+
emitTeammateIdle({
|
|
35412
|
+
agentName,
|
|
35413
|
+
teamName,
|
|
35414
|
+
lastTaskId,
|
|
35415
|
+
trackEvent: trackEvent2,
|
|
35416
|
+
userId,
|
|
35417
|
+
logger: logger2
|
|
35418
|
+
});
|
|
35419
|
+
if (config) {
|
|
35420
|
+
const leadMember = config.members.find((m) => m.agentId === config.leadAgentId);
|
|
35421
|
+
const leadName = leadMember?.name ?? "team-lead";
|
|
35422
|
+
const notification = {
|
|
35423
|
+
type: "idle_notification",
|
|
35424
|
+
from: agentName,
|
|
35425
|
+
timestamp: new Date().toISOString(),
|
|
35426
|
+
summary: lastTaskId ? `Completed task ${lastTaskId}, now idle` : "Agent is idle and ready for work",
|
|
35427
|
+
completedTaskId: lastTaskId
|
|
35428
|
+
};
|
|
35429
|
+
await sendMessage(teamName, leadName, notification);
|
|
35430
|
+
logger2.debug({ teamName, agentName, leadName, lastTaskId }, "markAgentIdle: sent idle notification to team lead");
|
|
35431
|
+
}
|
|
35432
|
+
}
|
|
35433
|
+
async function checkIdleAfterTurn(params2) {
|
|
35434
|
+
const { producedOutput, ...rest } = params2;
|
|
35435
|
+
if (!producedOutput) {
|
|
35436
|
+
await markAgentIdle(rest);
|
|
35437
|
+
}
|
|
35438
|
+
}
|
|
35439
|
+
|
|
35299
35440
|
// ../common/src/constants/knowledge.ts
|
|
35300
35441
|
var import_path4 = __toESM(require("path"));
|
|
35301
35442
|
var PRIMARY_KNOWLEDGE_FILE_NAME = "knowledge.md";
|
|
@@ -35398,10 +35539,10 @@ async function formatPrompt(params2) {
|
|
|
35398
35539
|
...Object.fromEntries(Object.entries(fileContext.knowledgeFiles).filter(([filePath]) => {
|
|
35399
35540
|
const lowerPath = filePath.toLowerCase();
|
|
35400
35541
|
return KNOWLEDGE_FILE_NAMES_LOWERCASE.includes(lowerPath);
|
|
35401
|
-
}).map(([
|
|
35542
|
+
}).map(([path8, content]) => [path8, content.trim()])),
|
|
35402
35543
|
...fileContext.userKnowledgeFiles
|
|
35403
|
-
}).map(([
|
|
35404
|
-
return `\`\`\`${
|
|
35544
|
+
}).map(([path8, content]) => {
|
|
35545
|
+
return `\`\`\`${path8}
|
|
35405
35546
|
${content.trim()}
|
|
35406
35547
|
\`\`\``;
|
|
35407
35548
|
}).join(`
|
|
@@ -36489,6 +36630,69 @@ async function loopAgentSteps(params2) {
|
|
|
36489
36630
|
currentPrompt = undefined;
|
|
36490
36631
|
currentParams = undefined;
|
|
36491
36632
|
}
|
|
36633
|
+
const postLoopTeamContext = findTeamContext(userInputId2);
|
|
36634
|
+
if (postLoopTeamContext && !signal.aborted) {
|
|
36635
|
+
try {
|
|
36636
|
+
await checkIdleAfterTurn({
|
|
36637
|
+
teamName: postLoopTeamContext.teamName,
|
|
36638
|
+
agentId: currentAgentState.agentId,
|
|
36639
|
+
agentName: postLoopTeamContext.agentName,
|
|
36640
|
+
producedOutput: totalSteps > 0,
|
|
36641
|
+
trackEvent: params2.trackEvent,
|
|
36642
|
+
userId: userId ?? "",
|
|
36643
|
+
logger: logger2
|
|
36644
|
+
});
|
|
36645
|
+
} catch (idleErr) {
|
|
36646
|
+
logger2.debug({ error: idleErr }, "checkIdleAfterTurn failed (non-fatal)");
|
|
36647
|
+
}
|
|
36648
|
+
}
|
|
36649
|
+
if (postLoopTeamContext && !signal.aborted) {
|
|
36650
|
+
try {
|
|
36651
|
+
await new Promise((resolve3) => setTimeout(resolve3, 2000));
|
|
36652
|
+
if (!signal.aborted) {
|
|
36653
|
+
const wakeInbox = drainInbox({
|
|
36654
|
+
teamName: postLoopTeamContext.teamName,
|
|
36655
|
+
agentName: postLoopTeamContext.agentName,
|
|
36656
|
+
logger: logger2
|
|
36657
|
+
});
|
|
36658
|
+
if (wakeInbox.formattedContent) {
|
|
36659
|
+
logger2.debug({
|
|
36660
|
+
teamName: postLoopTeamContext.teamName,
|
|
36661
|
+
agentName: postLoopTeamContext.agentName,
|
|
36662
|
+
messageCount: wakeInbox.messages.length
|
|
36663
|
+
}, "Post-loop wake: new messages detected, running one more step");
|
|
36664
|
+
currentAgentState.messageHistory = [
|
|
36665
|
+
...currentAgentState.messageHistory,
|
|
36666
|
+
userMessage(withSystemTags(wakeInbox.formattedContent))
|
|
36667
|
+
];
|
|
36668
|
+
currentAgentState.stepsRemaining = Math.max(currentAgentState.stepsRemaining, 1);
|
|
36669
|
+
const wakeStep = await runAgentStep({
|
|
36670
|
+
...params2,
|
|
36671
|
+
agentState: currentAgentState,
|
|
36672
|
+
agentTemplate,
|
|
36673
|
+
prompt: undefined,
|
|
36674
|
+
runId,
|
|
36675
|
+
spawnParams: undefined,
|
|
36676
|
+
system,
|
|
36677
|
+
tools,
|
|
36678
|
+
additionalToolDefinitions: async () => {
|
|
36679
|
+
if (!cachedAdditionalToolDefinitions) {
|
|
36680
|
+
cachedAdditionalToolDefinitions = await additionalToolDefinitions({
|
|
36681
|
+
...params2,
|
|
36682
|
+
agentTemplate
|
|
36683
|
+
});
|
|
36684
|
+
}
|
|
36685
|
+
return cachedAdditionalToolDefinitions;
|
|
36686
|
+
}
|
|
36687
|
+
});
|
|
36688
|
+
totalSteps++;
|
|
36689
|
+
currentAgentState = wakeStep.agentState;
|
|
36690
|
+
}
|
|
36691
|
+
}
|
|
36692
|
+
} catch (wakeErr) {
|
|
36693
|
+
logger2.debug({ error: wakeErr }, "Post-loop wake check failed (non-fatal)");
|
|
36694
|
+
}
|
|
36695
|
+
}
|
|
36492
36696
|
if (clearUserPromptMessagesAfterResponse) {
|
|
36493
36697
|
currentAgentState.messageHistory = expireMessages(currentAgentState.messageHistory, "userPrompt");
|
|
36494
36698
|
}
|
|
@@ -43154,7 +43358,7 @@ function createOpenRouter(options = {}) {
|
|
|
43154
43358
|
});
|
|
43155
43359
|
const createChatModel = (modelId, settings = {}) => new OpenRouterChatLanguageModel(modelId, settings, {
|
|
43156
43360
|
provider: "openrouter.chat",
|
|
43157
|
-
url: ({ path:
|
|
43361
|
+
url: ({ path: path8 }) => `${baseURL}${path8}`,
|
|
43158
43362
|
headers: getHeaders,
|
|
43159
43363
|
compatibility,
|
|
43160
43364
|
fetch: options.fetch,
|
|
@@ -43162,7 +43366,7 @@ function createOpenRouter(options = {}) {
|
|
|
43162
43366
|
});
|
|
43163
43367
|
const createCompletionModel = (modelId, settings = {}) => new OpenRouterCompletionLanguageModel(modelId, settings, {
|
|
43164
43368
|
provider: "openrouter.completion",
|
|
43165
|
-
url: ({ path:
|
|
43369
|
+
url: ({ path: path8 }) => `${baseURL}${path8}`,
|
|
43166
43370
|
headers: getHeaders,
|
|
43167
43371
|
compatibility,
|
|
43168
43372
|
fetch: options.fetch,
|
|
@@ -44038,38 +44242,38 @@ var noopLogger = {
|
|
|
44038
44242
|
};
|
|
44039
44243
|
|
|
44040
44244
|
// src/run-state.ts
|
|
44041
|
-
var
|
|
44245
|
+
var os7 = __toESM(require("os"));
|
|
44042
44246
|
var import_path8 = __toESM(require("path"));
|
|
44043
44247
|
|
|
44044
44248
|
// ../packages/code-map/src/parse.ts
|
|
44045
44249
|
var fs10 = __toESM(require("fs"));
|
|
44046
|
-
var
|
|
44250
|
+
var path12 = __toESM(require("path"));
|
|
44047
44251
|
|
|
44048
44252
|
// ../packages/code-map/src/languages.ts
|
|
44049
44253
|
var fs9 = __toESM(require("fs"));
|
|
44050
|
-
var
|
|
44254
|
+
var path11 = __toESM(require("path"));
|
|
44051
44255
|
var import_web_tree_sitter2 = require("web-tree-sitter");
|
|
44052
44256
|
|
|
44053
44257
|
// ../packages/code-map/src/init-node.ts
|
|
44054
44258
|
var fs8 = __toESM(require("fs"));
|
|
44055
|
-
var
|
|
44259
|
+
var path10 = __toESM(require("path"));
|
|
44056
44260
|
var import_web_tree_sitter = require("web-tree-sitter");
|
|
44057
44261
|
async function initTreeSitterForNode() {
|
|
44058
44262
|
await import_web_tree_sitter.Parser.init({
|
|
44059
44263
|
locateFile: (name14, scriptDir) => {
|
|
44060
44264
|
if (name14 === "tree-sitter.wasm") {
|
|
44061
|
-
const fallback =
|
|
44265
|
+
const fallback = path10.join(scriptDir, name14);
|
|
44062
44266
|
if (fs8.existsSync(fallback)) {
|
|
44063
44267
|
return fallback;
|
|
44064
44268
|
}
|
|
44065
|
-
const pkgDir =
|
|
44066
|
-
const wasm =
|
|
44269
|
+
const pkgDir = path10.dirname(require.resolve("web-tree-sitter"));
|
|
44270
|
+
const wasm = path10.join(pkgDir, "tree-sitter.wasm");
|
|
44067
44271
|
if (fs8.existsSync(wasm)) {
|
|
44068
44272
|
return wasm;
|
|
44069
44273
|
}
|
|
44070
44274
|
throw new Error(`Internal error: web-tree-sitter/tree-sitter.wasm not found at ${wasm}. Ensure the file is included in your deployment bundle.`);
|
|
44071
44275
|
}
|
|
44072
|
-
return
|
|
44276
|
+
return path10.join(scriptDir, name14);
|
|
44073
44277
|
}
|
|
44074
44278
|
});
|
|
44075
44279
|
}
|
|
@@ -44409,23 +44613,23 @@ function getWasmDir() {
|
|
|
44409
44613
|
function resolveWasmPath(wasmFileName) {
|
|
44410
44614
|
const customWasmDirPath = getWasmDir();
|
|
44411
44615
|
if (customWasmDirPath) {
|
|
44412
|
-
return
|
|
44616
|
+
return path11.join(customWasmDirPath, wasmFileName);
|
|
44413
44617
|
}
|
|
44414
44618
|
const envWasmDir = process.env.LEVELCODE_WASM_DIR;
|
|
44415
44619
|
if (envWasmDir) {
|
|
44416
|
-
return
|
|
44620
|
+
return path11.join(envWasmDir, wasmFileName);
|
|
44417
44621
|
}
|
|
44418
44622
|
const moduleDir = (() => {
|
|
44419
|
-
const
|
|
44420
|
-
if (typeof
|
|
44421
|
-
return
|
|
44623
|
+
const dirname7 = getDirnameDynamically();
|
|
44624
|
+
if (typeof dirname7 !== "undefined") {
|
|
44625
|
+
return dirname7;
|
|
44422
44626
|
}
|
|
44423
44627
|
return process.cwd();
|
|
44424
44628
|
})();
|
|
44425
44629
|
const possiblePaths = [
|
|
44426
|
-
|
|
44427
|
-
|
|
44428
|
-
|
|
44630
|
+
path11.join(moduleDir, "..", "wasm", wasmFileName),
|
|
44631
|
+
path11.join(moduleDir, "wasm", wasmFileName),
|
|
44632
|
+
path11.join(process.cwd(), "dist", "wasm", wasmFileName)
|
|
44429
44633
|
];
|
|
44430
44634
|
for (const wasmPath of possiblePaths) {
|
|
44431
44635
|
try {
|
|
@@ -44469,7 +44673,7 @@ class UnifiedLanguageLoader {
|
|
|
44469
44673
|
}
|
|
44470
44674
|
}
|
|
44471
44675
|
function findLanguageConfigByExtension(filePath) {
|
|
44472
|
-
const ext =
|
|
44676
|
+
const ext = path11.extname(filePath);
|
|
44473
44677
|
return languageTable.find((c) => c.extensions.includes(ext));
|
|
44474
44678
|
}
|
|
44475
44679
|
async function createLanguageConfig(filePath, runtimeLoader) {
|
|
@@ -44483,7 +44687,7 @@ async function createLanguageConfig(filePath, runtimeLoader) {
|
|
|
44483
44687
|
const lang = await runtimeLoader.loadLanguage(cfg.wasmFile);
|
|
44484
44688
|
const parser = new import_web_tree_sitter2.Parser;
|
|
44485
44689
|
parser.setLanguage(lang);
|
|
44486
|
-
const queryContent =
|
|
44690
|
+
const queryContent = path11.isAbsolute(cfg.queryPathOrContent) ? fs9.readFileSync(cfg.queryPathOrContent, "utf8") : cfg.queryPathOrContent;
|
|
44487
44691
|
cfg.language = lang;
|
|
44488
44692
|
cfg.parser = parser;
|
|
44489
44693
|
cfg.query = new import_web_tree_sitter2.Query(lang, queryContent);
|
|
@@ -44515,7 +44719,7 @@ async function getFileTokenScores(projectRoot, filePaths, readFile) {
|
|
|
44515
44719
|
const externalCalls = {};
|
|
44516
44720
|
const fileCallsMap = new Map;
|
|
44517
44721
|
for (const filePath of filePaths) {
|
|
44518
|
-
const fullPath =
|
|
44722
|
+
const fullPath = path12.join(projectRoot, filePath);
|
|
44519
44723
|
const languageConfig = await getLanguageConfig(fullPath);
|
|
44520
44724
|
if (languageConfig) {
|
|
44521
44725
|
let parseResults;
|
|
@@ -44527,7 +44731,7 @@ async function getFileTokenScores(projectRoot, filePaths, readFile) {
|
|
|
44527
44731
|
const { identifiers, calls, numLines } = parseResults;
|
|
44528
44732
|
const tokenScoresForFile = {};
|
|
44529
44733
|
tokenScores[filePath] = tokenScoresForFile;
|
|
44530
|
-
const dirs =
|
|
44734
|
+
const dirs = path12.dirname(fullPath).split(path12.sep);
|
|
44531
44735
|
const depth = dirs.length;
|
|
44532
44736
|
const tokenBaseScore = 0.8 ** depth * Math.sqrt(numLines / (identifiers.length + 1));
|
|
44533
44737
|
for (const identifier of identifiers) {
|
|
@@ -45156,7 +45360,7 @@ async function discoverProjectFiles(params2) {
|
|
|
45156
45360
|
}
|
|
45157
45361
|
async function loadUserKnowledgeFiles(params2) {
|
|
45158
45362
|
const { fs: fs13, logger: logger2 } = params2;
|
|
45159
|
-
const homeDir = params2.homeDir ??
|
|
45363
|
+
const homeDir = params2.homeDir ?? os7.homedir();
|
|
45160
45364
|
const userKnowledgeFiles = {};
|
|
45161
45365
|
let entries;
|
|
45162
45366
|
try {
|
|
@@ -45305,8 +45509,8 @@ async function initialSessionState(params2) {
|
|
|
45305
45509
|
shell: "bash",
|
|
45306
45510
|
nodeVersion: process.version,
|
|
45307
45511
|
arch: process.arch,
|
|
45308
|
-
homedir:
|
|
45309
|
-
cpus:
|
|
45512
|
+
homedir: os7.homedir(),
|
|
45513
|
+
cpus: os7.cpus().length ?? 1
|
|
45310
45514
|
}
|
|
45311
45515
|
});
|
|
45312
45516
|
if (maxAgentSteps) {
|
|
@@ -45419,19 +45623,19 @@ function buildFileTree(filePaths) {
|
|
|
45419
45623
|
}
|
|
45420
45624
|
const rootNodes = [];
|
|
45421
45625
|
const processed = new Set;
|
|
45422
|
-
for (const [
|
|
45423
|
-
if (processed.has(
|
|
45626
|
+
for (const [path16, node] of Object.entries(tree)) {
|
|
45627
|
+
if (processed.has(path16))
|
|
45424
45628
|
continue;
|
|
45425
|
-
const parentPath =
|
|
45629
|
+
const parentPath = path16.substring(0, path16.lastIndexOf("/"));
|
|
45426
45630
|
if (parentPath && tree[parentPath]) {
|
|
45427
45631
|
const parent = tree[parentPath];
|
|
45428
|
-
if (parent.children && !parent.children.some((child) => child.filePath ===
|
|
45632
|
+
if (parent.children && !parent.children.some((child) => child.filePath === path16)) {
|
|
45429
45633
|
parent.children.push(node);
|
|
45430
45634
|
}
|
|
45431
45635
|
} else {
|
|
45432
45636
|
rootNodes.push(node);
|
|
45433
45637
|
}
|
|
45434
|
-
processed.add(
|
|
45638
|
+
processed.add(path16);
|
|
45435
45639
|
}
|
|
45436
45640
|
function sortNodes(nodes) {
|
|
45437
45641
|
nodes.sort((a, b) => {
|
|
@@ -45561,7 +45765,7 @@ async function applyChanges(params2) {
|
|
|
45561
45765
|
// src/tools/code-search.ts
|
|
45562
45766
|
var import_child_process = require("child_process");
|
|
45563
45767
|
var fs13 = __toESM(require("fs"));
|
|
45564
|
-
var
|
|
45768
|
+
var path17 = __toESM(require("path"));
|
|
45565
45769
|
|
|
45566
45770
|
// ../common/src/util/format-code-search.ts
|
|
45567
45771
|
function formatCodeSearchOutput(stdout) {
|
|
@@ -45659,13 +45863,13 @@ function getBundledRgPath(importMetaUrl, env2 = getSdkEnv()) {
|
|
|
45659
45863
|
}
|
|
45660
45864
|
}
|
|
45661
45865
|
if (!vendorPath) {
|
|
45662
|
-
const
|
|
45663
|
-
if (typeof
|
|
45664
|
-
const cjsPath = import_path10.join(
|
|
45866
|
+
const dirname9 = new Function(`try { return __dirname; } catch (e) { return undefined; }`)();
|
|
45867
|
+
if (typeof dirname9 !== "undefined") {
|
|
45868
|
+
const cjsPath = import_path10.join(dirname9, "..", "..", "vendor", "ripgrep", platformDir, binaryName);
|
|
45665
45869
|
if (import_fs4.existsSync(cjsPath)) {
|
|
45666
45870
|
vendorPath = cjsPath;
|
|
45667
45871
|
}
|
|
45668
|
-
const cjsPath2 = import_path10.join(
|
|
45872
|
+
const cjsPath2 = import_path10.join(dirname9, "vendor", "ripgrep", platformDir, binaryName);
|
|
45669
45873
|
if (import_fs4.existsSync(cjsPath2)) {
|
|
45670
45874
|
vendorPath = cjsPath2;
|
|
45671
45875
|
}
|
|
@@ -45703,9 +45907,9 @@ function codeSearch({
|
|
|
45703
45907
|
}) {
|
|
45704
45908
|
return new Promise((resolve4) => {
|
|
45705
45909
|
let isResolved = false;
|
|
45706
|
-
const projectRoot =
|
|
45707
|
-
const searchCwd = cwd ?
|
|
45708
|
-
if (!searchCwd.startsWith(projectRoot +
|
|
45910
|
+
const projectRoot = path17.resolve(projectPath);
|
|
45911
|
+
const searchCwd = cwd ? path17.resolve(projectRoot, cwd) : projectRoot;
|
|
45912
|
+
if (!searchCwd.startsWith(projectRoot + path17.sep) && searchCwd !== projectRoot) {
|
|
45709
45913
|
return resolve4([
|
|
45710
45914
|
{
|
|
45711
45915
|
type: "json",
|
|
@@ -45718,7 +45922,7 @@ function codeSearch({
|
|
|
45718
45922
|
const flagsArray = (flags || "").split(" ").filter(Boolean).map((token) => token.replace(/^['"]|['"]$/g, ""));
|
|
45719
45923
|
const existingHiddenDirs = INCLUDED_HIDDEN_DIRS.filter((dir) => {
|
|
45720
45924
|
try {
|
|
45721
|
-
return fs13.statSync(
|
|
45925
|
+
return fs13.statSync(path17.join(searchCwd, dir)).isDirectory();
|
|
45722
45926
|
} catch {
|
|
45723
45927
|
return false;
|
|
45724
45928
|
}
|
|
@@ -46000,11 +46204,11 @@ async function glob(params2) {
|
|
|
46000
46204
|
}
|
|
46001
46205
|
|
|
46002
46206
|
// src/tools/list-directory.ts
|
|
46003
|
-
var
|
|
46207
|
+
var path18 = __toESM(require("path"));
|
|
46004
46208
|
async function listDirectory(params2) {
|
|
46005
46209
|
const { directoryPath, projectPath, fs: fs14 } = params2;
|
|
46006
46210
|
try {
|
|
46007
|
-
const resolvedPath =
|
|
46211
|
+
const resolvedPath = path18.resolve(projectPath, directoryPath);
|
|
46008
46212
|
if (!resolvedPath.startsWith(projectPath)) {
|
|
46009
46213
|
return [
|
|
46010
46214
|
{
|
|
@@ -46108,8 +46312,8 @@ async function getFiles(params2) {
|
|
|
46108
46312
|
// src/tools/run-terminal-command.ts
|
|
46109
46313
|
var import_child_process2 = require("child_process");
|
|
46110
46314
|
var fs14 = __toESM(require("fs"));
|
|
46111
|
-
var
|
|
46112
|
-
var
|
|
46315
|
+
var os8 = __toESM(require("os"));
|
|
46316
|
+
var path20 = __toESM(require("path"));
|
|
46113
46317
|
var COMMAND_OUTPUT_LIMIT = 50000;
|
|
46114
46318
|
var GIT_BASH_COMMON_PATHS = [
|
|
46115
46319
|
"C:\\Program Files\\Git\\bin\\bash.exe",
|
|
@@ -46131,12 +46335,12 @@ function findWindowsBash(env2) {
|
|
|
46131
46335
|
}
|
|
46132
46336
|
}
|
|
46133
46337
|
const pathEnv = env2.PATH || env2.Path || "";
|
|
46134
|
-
const pathDirs = pathEnv.split(
|
|
46338
|
+
const pathDirs = pathEnv.split(path20.delimiter);
|
|
46135
46339
|
const wslFallbackPaths = [];
|
|
46136
46340
|
for (const dir of pathDirs) {
|
|
46137
46341
|
const dirLower = dir.toLowerCase();
|
|
46138
46342
|
const isWslPath = WSL_BASH_PATH_PATTERNS.some((pattern) => dirLower.includes(pattern));
|
|
46139
|
-
const bashPath =
|
|
46343
|
+
const bashPath = path20.join(dir, "bash.exe");
|
|
46140
46344
|
if (fs14.existsSync(bashPath)) {
|
|
46141
46345
|
if (isWslPath) {
|
|
46142
46346
|
wslFallbackPaths.push(bashPath);
|
|
@@ -46144,7 +46348,7 @@ function findWindowsBash(env2) {
|
|
|
46144
46348
|
return bashPath;
|
|
46145
46349
|
}
|
|
46146
46350
|
}
|
|
46147
|
-
const bashPathNoExt =
|
|
46351
|
+
const bashPathNoExt = path20.join(dir, "bash");
|
|
46148
46352
|
if (fs14.existsSync(bashPathNoExt)) {
|
|
46149
46353
|
if (isWslPath) {
|
|
46150
46354
|
wslFallbackPaths.push(bashPathNoExt);
|
|
@@ -46185,7 +46389,7 @@ function runTerminalCommand({
|
|
|
46185
46389
|
throw new Error("BACKGROUND process_type not implemented");
|
|
46186
46390
|
}
|
|
46187
46391
|
return new Promise((resolve6, reject) => {
|
|
46188
|
-
const isWindows =
|
|
46392
|
+
const isWindows = os8.platform() === "win32";
|
|
46189
46393
|
const processEnv2 = {
|
|
46190
46394
|
...getSystemProcessEnv(),
|
|
46191
46395
|
...env2 ?? {}
|
|
@@ -46204,7 +46408,7 @@ function runTerminalCommand({
|
|
|
46204
46408
|
shell = "bash";
|
|
46205
46409
|
shellArgs = ["-c"];
|
|
46206
46410
|
}
|
|
46207
|
-
const resolvedCwd =
|
|
46411
|
+
const resolvedCwd = path20.resolve(cwd);
|
|
46208
46412
|
const childProcess = import_child_process2.spawn(shell, [...shellArgs, command], {
|
|
46209
46413
|
cwd: resolvedCwd,
|
|
46210
46414
|
env: processEnv2,
|
|
@@ -47313,5 +47517,5 @@ function loadMCPConfigSync(options) {
|
|
|
47313
47517
|
return mergedConfig;
|
|
47314
47518
|
}
|
|
47315
47519
|
|
|
47316
|
-
//# debugId=
|
|
47520
|
+
//# debugId=56CBC8792F820FB664756E2164756E21
|
|
47317
47521
|
//# sourceMappingURL=index.cjs.map
|