ummaya 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -2
- package/bin/ummaya +10 -1
- package/npm-shrinkwrap.json +253 -2
- package/package.json +5 -1
- package/prompts/manifest.yaml +1 -1
- package/prompts/system_v1.md +1 -0
- package/pyproject.toml +26 -2
- package/specs/2803-document-production-hardening/contracts/document-tools.schema.json +1043 -0
- package/src/ummaya/_canonical/__init__.py +2 -0
- package/src/ummaya/engine/engine.py +29 -132
- package/src/ummaya/evidence/__init__.py +21 -2
- package/src/ummaya/evidence/dataset_contract.py +193 -0
- package/src/ummaya/evidence/document_authoring_cases.py +33 -0
- package/src/ummaya/evidence/document_harness.py +313 -0
- package/src/ummaya/evidence/document_viewer_ux.py +391 -0
- package/src/ummaya/evidence/gates.py +70 -0
- package/src/ummaya/evidence/json_types.py +20 -0
- package/src/ummaya/evidence/models.py +88 -1
- package/src/ummaya/evidence/output_payload.py +89 -0
- package/src/ummaya/evidence/payload_documents.py +233 -0
- package/src/ummaya/evidence/route_contracts.py +224 -0
- package/src/ummaya/evidence/route_helpers.py +150 -0
- package/src/ummaya/evidence/runner.py +81 -212
- package/src/ummaya/evidence/source_provenance.py +246 -0
- package/src/ummaya/evidence/source_provenance_redaction.py +176 -0
- package/src/ummaya/evidence/tool_layer.py +39 -0
- package/src/ummaya/evidence/tool_layer_models.py +151 -0
- package/src/ummaya/ipc/adapter_manifest_emitter.py +26 -10
- package/src/ummaya/ipc/document_intent_normalization.py +185 -0
- package/src/ummaya/ipc/frame_schema.py +5 -5
- package/src/ummaya/ipc/route_diagnostics.py +73 -0
- package/src/ummaya/ipc/stdio.py +1109 -477
- package/src/ummaya/llm/client.py +102 -3
- package/src/ummaya/llm/config.py +8 -3
- package/src/ummaya/primitives/__init__.py +6 -2
- package/src/ummaya/primitives/delegation.py +1 -1
- package/src/ummaya/primitives/document.py +28 -0
- package/src/ummaya/settings.py +0 -3
- package/src/ummaya/tools/discovery_bridge.py +17 -1
- package/src/ummaya/tools/documents/__init__.py +297 -0
- package/src/ummaya/tools/documents/adapter_registry.py +487 -0
- package/src/ummaya/tools/documents/archive_container_probe.py +167 -0
- package/src/ummaya/tools/documents/artifact_store.py +454 -0
- package/src/ummaya/tools/documents/authoring.py +283 -0
- package/src/ummaya/tools/documents/baselines.py +114 -0
- package/src/ummaya/tools/documents/capability.py +331 -0
- package/src/ummaya/tools/documents/contracts.py +112 -0
- package/src/ummaya/tools/documents/conversion.py +521 -0
- package/src/ummaya/tools/documents/diff.py +275 -0
- package/src/ummaya/tools/documents/engines.py +163 -0
- package/src/ummaya/tools/documents/evaluation.py +291 -0
- package/src/ummaya/tools/documents/explicit_values.py +108 -0
- package/src/ummaya/tools/documents/fixtures.py +174 -0
- package/src/ummaya/tools/documents/format_completion_audit.py +471 -0
- package/src/ummaya/tools/documents/formats/__init__.py +2 -0
- package/src/ummaya/tools/documents/formats/archive.py +528 -0
- package/src/ummaya/tools/documents/formats/base.py +41 -0
- package/src/ummaya/tools/documents/formats/code_file.py +211 -0
- package/src/ummaya/tools/documents/formats/data_file.py +272 -0
- package/src/ummaya/tools/documents/formats/hwp.py +284 -0
- package/src/ummaya/tools/documents/formats/hwpx.py +1837 -0
- package/src/ummaya/tools/documents/formats/odf.py +435 -0
- package/src/ummaya/tools/documents/formats/ooxml.py +1030 -0
- package/src/ummaya/tools/documents/formats/passive.py +766 -0
- package/src/ummaya/tools/documents/formats/pdf.py +702 -0
- package/src/ummaya/tools/documents/formats/text_web.py +268 -0
- package/src/ummaya/tools/documents/hwp_conversion_probe.py +178 -0
- package/src/ummaya/tools/documents/hwp_direct_candidate.py +141 -0
- package/src/ummaya/tools/documents/inspection.py +289 -0
- package/src/ummaya/tools/documents/intake.py +1079 -0
- package/src/ummaya/tools/documents/legacy_office_promotion_probe.py +366 -0
- package/src/ummaya/tools/documents/models.py +1598 -0
- package/src/ummaya/tools/documents/odf_promotion_probe.py +167 -0
- package/src/ummaya/tools/documents/orchestrator.py +96 -0
- package/src/ummaya/tools/documents/passive_capability_probe.py +251 -0
- package/src/ummaya/tools/documents/patch.py +170 -0
- package/src/ummaya/tools/documents/pdfa_conformance.py +284 -0
- package/src/ummaya/tools/documents/pdfa_promotion_probe.py +198 -0
- package/src/ummaya/tools/documents/permissions.py +110 -0
- package/src/ummaya/tools/documents/planner.py +616 -0
- package/src/ummaya/tools/documents/registry.py +2733 -0
- package/src/ummaya/tools/documents/render.py +978 -0
- package/src/ummaya/tools/documents/render_comparison.py +113 -0
- package/src/ummaya/tools/documents/render_comparison_models.py +74 -0
- package/src/ummaya/tools/documents/render_comparison_regions.py +73 -0
- package/src/ummaya/tools/documents/render_comparison_style.py +161 -0
- package/src/ummaya/tools/documents/reread.py +157 -0
- package/src/ummaya/tools/documents/runtime_authoring.py +244 -0
- package/src/ummaya/tools/documents/runtime_authoring_bundle.py +76 -0
- package/src/ummaya/tools/documents/scorecard.py +184 -0
- package/src/ummaya/tools/documents/socratic_planner.py +193 -0
- package/src/ummaya/tools/documents/style.py +48 -0
- package/src/ummaya/tools/documents/tool_defs.py +523 -0
- package/src/ummaya/tools/documents/validate.py +347 -0
- package/src/ummaya/tools/executor.py +29 -0
- package/src/ummaya/tools/live_proxy.py +0 -3
- package/src/ummaya/tools/models.py +5 -1
- package/src/ummaya/tools/register_all.py +8 -0
- package/src/ummaya/tools/registry.py +10 -1
- package/src/ummaya/tools/routing/__init__.py +59 -0
- package/src/ummaya/tools/routing/builder.py +105 -0
- package/src/ummaya/tools/routing/cards.py +29 -0
- package/src/ummaya/tools/routing/decision_service.py +534 -0
- package/src/ummaya/tools/routing/decision_types.py +74 -0
- package/src/ummaya/tools/routing/feasibility.py +122 -0
- package/src/ummaya/tools/routing/intent.py +17 -0
- package/src/ummaya/tools/routing/intent_extractor.py +207 -0
- package/src/ummaya/tools/routing/intent_patterns.py +160 -0
- package/src/ummaya/tools/routing/intent_public_data.py +150 -0
- package/src/ummaya/tools/routing/intent_types.py +48 -0
- package/src/ummaya/tools/routing/lint.py +78 -0
- package/src/ummaya/tools/routing/metadata.py +174 -0
- package/src/ummaya/tools/routing/projection.py +340 -0
- package/src/ummaya/tools/routing/retrieval_policy.py +629 -0
- package/src/ummaya/tools/routing/schema.py +81 -0
- package/src/ummaya/tools/routing/types.py +96 -0
- package/src/ummaya/tools/routing_index.py +2 -2
- package/src/ummaya/tools/search.py +34 -746
- package/tests/fixtures/documents/public_forms/baselines.yaml +113 -0
- package/tui/package.json +1 -1
- package/tui/src/.cc-byte-identical-whitelist.yaml +266 -0
- package/tui/src/QueryEngine.ts +12 -8
- package/tui/src/bridge/inboundAttachments.ts +3 -3
- package/tui/src/cli/handlers/auth.ts +3 -12
- package/tui/src/cli/print.ts +7 -7
- package/tui/src/commands/insights.ts +1 -1
- package/tui/src/commands/install-github-app/types.ts +8 -30
- package/tui/src/commands/plugin/types.ts +6 -28
- package/tui/src/commands/plugin/unifiedTypes.ts +4 -26
- package/tui/src/commands/rename/generateSessionName.ts +1 -1
- package/tui/src/components/Feedback.tsx +1 -1
- package/tui/src/components/LogoV2/EmergencyTip.tsx +11 -2
- package/tui/src/components/LogoV2/WelcomeV2.tsx +1 -3
- package/tui/src/components/ScrollKeybindingHandler.tsx +6 -6
- package/tui/src/components/Spinner/types.ts +6 -28
- package/tui/src/components/agents/generateAgent.ts +1 -1
- package/tui/src/components/agents/new-agent-creation/types.ts +4 -26
- package/tui/src/components/config/EnvSecretIsolatedEditor.tsx +1 -1
- package/tui/src/components/mcp/types.ts +16 -38
- package/tui/src/components/messages/AssistantToolUseMessage.tsx +3 -2
- package/tui/src/components/messages/UserCrossSessionMessage.ts +16 -4
- package/tui/src/components/messages/UserForkBoilerplateMessage.ts +16 -4
- package/tui/src/components/messages/UserGitHubWebhookMessage.ts +16 -4
- package/tui/src/components/messages/UserToolResultMessage/utils.tsx +3 -2
- package/tui/src/components/permissions/MonitorPermissionRequest/MonitorPermissionRequest.ts +9 -4
- package/tui/src/components/permissions/ReviewArtifactPermissionRequest/ReviewArtifactPermissionRequest.ts +9 -4
- package/tui/src/components/primitive/DocumentSocraticReviewBlock.tsx +129 -0
- package/tui/src/components/primitive/DocumentToolResultCard.tsx +224 -0
- package/tui/src/components/primitive/documentSocraticReview.ts +215 -0
- package/tui/src/components/primitive/index.tsx +43 -1
- package/tui/src/components/primitive/types.ts +137 -0
- package/tui/src/components/ui/option.ts +4 -26
- package/tui/src/constants/common.ts +0 -2
- package/tui/src/constants/prompts.ts +4 -3
- package/tui/src/constants/querySource.ts +4 -26
- package/tui/src/entrypoints/sdk/controlTypes.ts +26 -48
- package/tui/src/entrypoints/sdk/coreTypes.generated.ts +3 -25
- package/tui/src/entrypoints/sdk/runtimeTypes.ts +38 -60
- package/tui/src/entrypoints/sdk/sdkUtilityTypes.ts +4 -26
- package/tui/src/entrypoints/sdk/settingsTypes.generated.ts +3 -25
- package/tui/src/entrypoints/sdk/toolTypes.ts +3 -25
- package/tui/src/hooks/toolPermission/handlers/interactiveHandler.ts +10 -0
- package/tui/src/hooks/useApiKeyVerification.ts +1 -1
- package/tui/src/hooks/useVirtualScroll.ts +1 -1
- package/tui/src/ink/ink.tsx +33 -14
- package/tui/src/ink/reconciler.ts +2 -3
- package/tui/src/ink/render-to-screen.ts +30 -10
- package/tui/src/ipc/bridge.ts +62 -15
- package/tui/src/ipc/bridgeSingleton.ts +5 -1
- package/tui/src/ipc/codec.ts +3 -3
- package/tui/src/ipc/frames.generated.ts +12 -12
- package/tui/src/ipc/llmClient.ts +151 -27
- package/tui/src/ipc/schema/frame.schema.json +1 -1
- package/tui/src/keybindings/defaultBindings.ts +4 -0
- package/tui/src/main.tsx +29 -11
- package/tui/src/native-ts/file-index/index.ts +33 -3
- package/tui/src/observability/surface.ts +2 -2
- package/tui/src/probes/toolRegistryProbe.tsx +3 -1
- package/tui/src/projectOnboardingState.ts +7 -6
- package/tui/src/query/chatMessageTypes.ts +18 -0
- package/tui/src/query/chatMessagesBuilder.ts +1 -1
- package/tui/src/query/deps.ts +1 -1
- package/tui/src/query/messageGuards.ts +106 -0
- package/tui/src/query/publicDataTerminalRepair.ts +384 -0
- package/tui/src/query/run.ts +1075 -0
- package/tui/src/query/supportBoundary.ts +168 -0
- package/tui/src/query/toolResultErrors.ts +103 -0
- package/tui/src/query/toolRunner.ts +687 -0
- package/tui/src/query/unavailableToolRepair.ts +118 -0
- package/tui/src/query.ts +9 -2186
- package/tui/src/screens/REPL.tsx +40 -29
- package/tui/src/services/api/adapterManifest.ts +4 -0
- package/tui/src/services/api/backendChat/events.ts +117 -0
- package/tui/src/services/api/backendChat/finalMessage.ts +40 -0
- package/tui/src/services/api/backendChat/frame.ts +9 -0
- package/tui/src/services/api/backendChat/streaming.ts +430 -0
- package/tui/src/services/api/backendChat/types.ts +62 -0
- package/tui/src/services/api/backendChat.ts +1 -0
- package/tui/src/services/api/client.ts +65 -2
- package/tui/src/services/api/errorUtils.ts +5 -5
- package/tui/src/services/api/errors.ts +1 -1
- package/tui/src/services/api/logging.ts +1 -1
- package/tui/src/services/api/ummaya/evidence.ts +194 -0
- package/tui/src/services/api/ummaya/messages.ts +255 -0
- package/tui/src/services/api/ummaya/nonStreaming.ts +66 -0
- package/tui/src/services/api/ummaya/provider.ts +200 -0
- package/tui/src/services/api/ummaya/reasoning.ts +24 -0
- package/tui/src/services/api/ummaya/request.ts +200 -0
- package/tui/src/services/api/ummaya/selectionContext.ts +240 -0
- package/tui/src/services/api/ummaya/streaming.ts +365 -0
- package/tui/src/services/api/ummaya/streamingPayload.ts +129 -0
- package/tui/src/services/api/ummaya/streamingReader.ts +40 -0
- package/tui/src/services/api/ummaya/toolSelection.ts +217 -0
- package/tui/src/services/api/ummaya/types.ts +110 -0
- package/tui/src/services/api/ummaya/usage.ts +30 -0
- package/tui/src/services/api/ummaya.ts +26 -418
- package/tui/src/services/api/withRetry.ts +1 -1
- package/tui/src/services/awaySummary.ts +2 -2
- package/tui/src/services/claudeAiLimits.ts +1 -1
- package/tui/src/services/compact/autoCompact.ts +1 -1
- package/tui/src/services/compact/compact.ts +1 -1
- package/tui/src/services/lsp/types.ts +8 -30
- package/tui/src/services/tips/types.ts +6 -28
- package/tui/src/services/tokenEstimation.ts +1 -1
- package/tui/src/services/toolRegistry/bootGuard.ts +5 -5
- package/tui/src/services/toolUseSummary/toolUseSummaryGenerator.ts +1 -1
- package/tui/src/services/tools/toolExecution.ts +94 -1
- package/tui/src/store/pendingPermissionSlot.ts +1 -1
- package/tui/src/store/session-store.ts +10 -36
- package/tui/src/stubs/any-stub.ts +15 -10
- package/tui/src/stubs/color-diff-napi.ts +37 -23
- package/tui/src/stubs/globals.d.ts +3 -3
- package/tui/src/stubs/macro-preload.ts +23 -12
- package/tui/src/tools/AdapterTool/AdapterTool.ts +1207 -714
- package/tui/src/tools/AdapterTool/routeDiagnostics.ts +75 -0
- package/tui/src/tools/AgentTool/AgentTool.tsx +84 -1371
- package/tui/src/tools/AgentTool/agentToolHandoff.ts +114 -0
- package/tui/src/tools/AgentTool/agentToolPartialResult.ts +16 -0
- package/tui/src/tools/AgentTool/agentToolProgress.ts +32 -0
- package/tui/src/tools/AgentTool/agentToolResolver.ts +161 -0
- package/tui/src/tools/AgentTool/agentToolResult.ts +163 -0
- package/tui/src/tools/AgentTool/agentToolUtils.ts +14 -686
- package/tui/src/tools/AgentTool/asyncAgentLifecycle.ts +208 -0
- package/tui/src/tools/AgentTool/asyncLifecycle.ts +153 -0
- package/tui/src/tools/AgentTool/backgroundedCompletion.ts +126 -0
- package/tui/src/tools/AgentTool/backgroundedLifecycle.ts +174 -0
- package/tui/src/tools/AgentTool/foregroundBackground.ts +83 -0
- package/tui/src/tools/AgentTool/foregroundDrain.tsx +133 -0
- package/tui/src/tools/AgentTool/foregroundFinalize.ts +98 -0
- package/tui/src/tools/AgentTool/foregroundLifecycle.tsx +237 -0
- package/tui/src/tools/AgentTool/foregroundProgress.tsx +169 -0
- package/tui/src/tools/AgentTool/foregroundTask.ts +89 -0
- package/tui/src/tools/AgentTool/forkSubagent.ts +1 -12
- package/tui/src/tools/AgentTool/forkSubagentGate.ts +34 -0
- package/tui/src/tools/AgentTool/launchRouting.ts +203 -0
- package/tui/src/tools/AgentTool/lifecycle.ts +244 -0
- package/tui/src/tools/AgentTool/mcpRouting.ts +73 -0
- package/tui/src/tools/AgentTool/orchestrationSupport.ts +70 -0
- package/tui/src/tools/AgentTool/permissions.ts +39 -0
- package/tui/src/tools/AgentTool/promptSetup.ts +181 -0
- package/tui/src/tools/AgentTool/remoteRouting.ts +62 -0
- package/tui/src/tools/AgentTool/resultMapping.ts +116 -0
- package/tui/src/tools/AgentTool/resumeAgent.ts +39 -107
- package/tui/src/tools/AgentTool/resumeAgentHelpers.ts +140 -0
- package/tui/src/tools/AgentTool/runAgent.ts +1 -1
- package/tui/src/tools/AgentTool/runtimeConfig.ts +57 -0
- package/tui/src/tools/AgentTool/schemas.ts +196 -0
- package/tui/src/tools/AgentTool/sourceVerificationPropagation.ts +263 -0
- package/tui/src/tools/AgentTool/worktreeLifecycle.ts +105 -0
- package/tui/src/tools/AskUserQuestionTool/AskUserQuestionTool.tsx +174 -202
- package/tui/src/tools/BashTool/BashTool.tsx +71 -1072
- package/tui/src/tools/BashTool/bashCommandHelpers.ts +12 -12
- package/tui/src/tools/BashTool/bashPermissions/astPreflight.ts +173 -0
- package/tui/src/tools/BashTool/bashPermissions/classifierChecks.ts +199 -0
- package/tui/src/tools/BashTool/bashPermissions/compoundGuards.ts +53 -0
- package/tui/src/tools/BashTool/bashPermissions/constants.ts +99 -0
- package/tui/src/tools/BashTool/bashPermissions/index.ts +38 -0
- package/tui/src/tools/BashTool/bashPermissions/legacyMisparsing.ts +62 -0
- package/tui/src/tools/BashTool/bashPermissions/main.ts +135 -0
- package/tui/src/tools/BashTool/bashPermissions/normalizedCommands.ts +33 -0
- package/tui/src/tools/BashTool/bashPermissions/operatorFlow.ts +98 -0
- package/tui/src/tools/BashTool/bashPermissions/permissionChecks.ts +200 -0
- package/tui/src/tools/BashTool/bashPermissions/prefixSuggestions.ts +88 -0
- package/tui/src/tools/BashTool/bashPermissions/promptClassifierRules.ts +125 -0
- package/tui/src/tools/BashTool/bashPermissions/ruleDelegates.ts +19 -0
- package/tui/src/tools/BashTool/bashPermissions/ruleMatching.ts +145 -0
- package/tui/src/tools/BashTool/bashPermissions/sandboxAutoAllow.ts +75 -0
- package/tui/src/tools/BashTool/bashPermissions/subcommandFlow.ts +205 -0
- package/tui/src/tools/BashTool/bashPermissions/subcommandGuards.ts +73 -0
- package/tui/src/tools/BashTool/bashPermissions/subcommandResultHelpers.ts +116 -0
- package/tui/src/tools/BashTool/bashPermissions/types.ts +26 -0
- package/tui/src/tools/BashTool/bashPermissions/wrapperStripping.ts +139 -0
- package/tui/src/tools/BashTool/bashPermissions.ts +26 -2621
- package/tui/src/tools/BashTool/call.ts +202 -0
- package/tui/src/tools/BashTool/callLoader.ts +35 -0
- package/tui/src/tools/BashTool/commandClassification.ts +151 -0
- package/tui/src/tools/BashTool/commandClassificationLoader.ts +40 -0
- package/tui/src/tools/BashTool/cwdReset.ts +33 -0
- package/tui/src/tools/BashTool/lineTruncation.ts +11 -0
- package/tui/src/tools/BashTool/modeValidation.ts +13 -1
- package/tui/src/tools/BashTool/outputPersistence.ts +42 -0
- package/tui/src/tools/BashTool/permissionClassification.ts +66 -0
- package/tui/src/tools/BashTool/permissionLoader.ts +44 -0
- package/tui/src/tools/BashTool/resultLoader.ts +29 -0
- package/tui/src/tools/BashTool/resultMapping.ts +83 -0
- package/tui/src/tools/BashTool/sandboxPolicy.ts +79 -0
- package/tui/src/tools/BashTool/schemas.ts +65 -0
- package/tui/src/tools/BashTool/sedEditExecution.ts +59 -0
- package/tui/src/tools/BashTool/shellExecution.tsx +245 -0
- package/tui/src/tools/BashTool/shellOutputUtils.ts +85 -0
- package/tui/src/tools/BashTool/shellPermissionGauntlet.ts +97 -0
- package/tui/src/tools/BashTool/uiLoader.ts +37 -0
- package/tui/src/tools/BriefTool/upload.ts +1 -1
- package/tui/src/tools/CalculatorTool/parser.ts +2 -2
- package/tui/src/tools/DocumentPrimitive/DocumentPrimitive.ts +262 -0
- package/tui/src/tools/DocumentPrimitive/dispatchNormalization.ts +270 -0
- package/tui/src/tools/DocumentPrimitive/documentDestinationPath.ts +18 -0
- package/tui/src/tools/DocumentPrimitive/documentMutationGuard.ts +22 -0
- package/tui/src/tools/DocumentPrimitive/documentPatchNormalization.ts +248 -0
- package/tui/src/tools/DocumentPrimitive/documentSourceVerification.ts +245 -0
- package/tui/src/tools/DocumentPrimitive/documentSourceVerificationFields.ts +103 -0
- package/tui/src/tools/DocumentPrimitive/modelVisibleOutput.ts +40 -0
- package/tui/src/tools/DocumentPrimitive/prompt.ts +35 -0
- package/tui/src/tools/FileEditTool/FileEditTool.ts +9 -507
- package/tui/src/tools/FileEditTool/call.ts +228 -0
- package/tui/src/tools/FileEditTool/validateInput.ts +196 -0
- package/tui/src/tools/FileReadTool/imageProcessor.ts +13 -0
- package/tui/src/tools/FileWriteTool/FileWriteTool.ts +7 -300
- package/tui/src/tools/FileWriteTool/call.ts +223 -0
- package/tui/src/tools/FileWriteTool/validateInput.ts +80 -0
- package/tui/src/tools/ListMcpResourcesTool/ListMcpResourcesTool.ts +19 -3
- package/tui/src/tools/LookupPrimitive/LookupPrimitive.ts +25 -32
- package/tui/src/tools/LookupPrimitive/prompt.ts +0 -2
- package/tui/src/tools/MCPTool/trustPolicy.ts +118 -0
- package/tui/src/tools/McpAuthTool/McpAuthTool.ts +21 -3
- package/tui/src/tools/NotebookEditTool/NotebookEditTool.ts +7 -326
- package/tui/src/tools/NotebookEditTool/call.ts +254 -0
- package/tui/src/tools/NotebookEditTool/notebookModel.ts +51 -0
- package/tui/src/tools/NotebookEditTool/validateInput.ts +142 -0
- package/tui/src/tools/PowerShellTool/PowerShellTool.tsx +46 -937
- package/tui/src/tools/PowerShellTool/acceptEditsCommandValidation.ts +162 -0
- package/tui/src/tools/PowerShellTool/call.ts +179 -0
- package/tui/src/tools/PowerShellTool/callLoader.ts +37 -0
- package/tui/src/tools/PowerShellTool/commandClassification.ts +86 -0
- package/tui/src/tools/PowerShellTool/modeValidation.ts +25 -332
- package/tui/src/tools/PowerShellTool/outputPersistence.ts +42 -0
- package/tui/src/tools/PowerShellTool/permissionClassification.ts +28 -0
- package/tui/src/tools/PowerShellTool/resultLoader.ts +31 -0
- package/tui/src/tools/PowerShellTool/resultMapping.ts +75 -0
- package/tui/src/tools/PowerShellTool/schemas.ts +40 -0
- package/tui/src/tools/PowerShellTool/shellExecution.tsx +258 -0
- package/tui/src/tools/PowerShellTool/symlinkModeValidation.ts +44 -0
- package/tui/src/tools/PowerShellTool/uiLoader.ts +37 -0
- package/tui/src/tools/PowerShellTool/validation.ts +39 -0
- package/tui/src/tools/ReadMcpResourceTool/ReadMcpResourceTool.ts +19 -3
- package/tui/src/tools/ResolveLocationPrimitive/ResolveLocationPrimitive.ts +1 -11
- package/tui/src/tools/ResolveLocationPrimitive/prompt.ts +2 -6
- package/tui/src/tools/SkillTool/SkillTool.ts +2 -2
- package/tui/src/tools/SubmitPrimitive/SubmitPrimitive.ts +27 -10
- package/tui/src/tools/TaskCreateTool/TaskCreateTool.ts +16 -2
- package/tui/src/tools/TaskGetTool/TaskGetTool.ts +23 -3
- package/tui/src/tools/TaskListTool/TaskListTool.ts +22 -4
- package/tui/src/tools/TaskOutputTool/TaskOutputTool.tsx +46 -547
- package/tui/src/tools/TaskOutputTool/lookup.ts +216 -0
- package/tui/src/tools/TaskOutputTool/render.tsx +257 -0
- package/tui/src/tools/TaskOutputTool/schemas.ts +55 -0
- package/tui/src/tools/TaskOutputTool/serialization.ts +36 -0
- package/tui/src/tools/TaskStopTool/TaskStopTool.ts +10 -0
- package/tui/src/tools/TaskUpdateTool/TaskUpdateTool.ts +14 -364
- package/tui/src/tools/TaskUpdateTool/completion.ts +62 -0
- package/tui/src/tools/TaskUpdateTool/schemas.ts +62 -0
- package/tui/src/tools/TaskUpdateTool/serialization.ts +46 -0
- package/tui/src/tools/TaskUpdateTool/statusUpdate.ts +247 -0
- package/tui/src/tools/TodoWriteTool/TodoWriteTool.ts +21 -2
- package/tui/src/tools/ToolSearchTool/ToolSearchTool.ts +21 -302
- package/tui/src/tools/ToolSearchTool/ccSupportTools.ts +223 -0
- package/tui/src/tools/ToolSearchTool/descriptionCache.ts +50 -0
- package/tui/src/tools/ToolSearchTool/keywordSearch.ts +216 -0
- package/tui/src/tools/ToolSearchTool/prompt.ts +10 -4
- package/tui/src/tools/ToolSearchTool/resultMapping.ts +30 -0
- package/tui/src/tools/ToolSearchTool/schemas.ts +30 -0
- package/tui/src/tools/ToolSearchTool/searchPool.ts +47 -0
- package/tui/src/tools/ToolSearchTool/supportIntentHints.ts +140 -0
- package/tui/src/tools/TranslateTool/TranslateTool.ts +1 -1
- package/tui/src/tools/VerifyPrimitive/VerifyPrimitive.ts +2 -1
- package/tui/src/tools/WebFetchTool/WebFetchTool.ts +43 -138
- package/tui/src/tools/WebFetchTool/call.ts +227 -0
- package/tui/src/tools/WebFetchTool/resolvedAddressSafety.ts +78 -0
- package/tui/src/tools/WebFetchTool/sourceVerification.ts +204 -0
- package/tui/src/tools/WebFetchTool/types.ts +23 -0
- package/tui/src/tools/WebFetchTool/urlSafety.ts +181 -0
- package/tui/src/tools/WebFetchTool/utils.ts +1 -1
- package/tui/src/tools/WebSearchTool/UI.tsx +0 -1
- package/tui/src/tools/WebSearchTool/WebSearchTool.ts +9 -313
- package/tui/src/tools/WebSearchTool/call.ts +33 -0
- package/tui/src/tools/WebSearchTool/responseMapping.ts +190 -0
- package/tui/src/tools/WebSearchTool/resultBlock.ts +47 -0
- package/tui/src/tools/WebSearchTool/schemas.ts +47 -0
- package/tui/src/tools/WebSearchTool/toolSchema.ts +12 -0
- package/tui/src/tools/WorkspaceToolAdapter/WorkspaceToolAdapter.ts +79 -0
- package/tui/src/tools/WorkspaceToolAdapter/allowedRootPolicy.ts +85 -0
- package/tui/src/tools/WorkspaceToolAdapter/documentFormatGuards.ts +73 -0
- package/tui/src/tools/WorkspaceToolAdapter/inputNormalization.ts +105 -0
- package/tui/src/tools/WorkspaceToolAdapter/mcpExposurePolicy.ts +64 -0
- package/tui/src/tools/WorkspaceToolAdapter/toolDefFactory.ts +215 -0
- package/tui/src/tools/WorkspaceToolAdapter/toolNames.ts +6 -0
- package/tui/src/tools/WorkspaceToolAdapter/workspacePolicy.ts +15 -0
- package/tui/src/tools/_shared/dispatchPrimitive.ts +6 -6
- package/tui/src/tools/_shared/documentChangeToPatch.ts +125 -0
- package/tui/src/tools/_shared/documentDispatchArguments.ts +87 -0
- package/tui/src/tools/_shared/documentPrimitiveTimeout.ts +13 -0
- package/tui/src/tools/_shared/documentToolResultRender.ts +98 -0
- package/tui/src/tools/_shared/pendingCallRegistry.ts +1 -6
- package/tui/src/tools/_shared/rootPrimitiveInput.ts +1 -0
- package/tui/src/tools/_shared/toolChoiceRepair/documentCompletionPatterns.ts +58 -0
- package/tui/src/tools/_shared/toolChoiceRepair/documentCompletionPrompt.ts +271 -0
- package/tui/src/tools/_shared/toolChoiceRepair/documentRepair.ts +452 -0
- package/tui/src/tools/_shared/toolChoiceRepair/messageAccess.ts +80 -0
- package/tui/src/tools/_shared/toolChoiceRepair/publicDataRepair.ts +92 -0
- package/tui/src/tools/_shared/toolChoiceRepair/supportRepair.ts +135 -0
- package/tui/src/tools/_shared/toolChoiceRepair.ts +55 -860
- package/tui/src/tools/shared/mockDisclaimer.ts +1 -1
- package/tui/src/tools.ts +39 -190
- package/tui/src/types/fileSuggestion.ts +4 -26
- package/tui/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.ts +186 -148
- package/tui/src/types/generated/events_mono/common/v1/auth.ts +25 -11
- package/tui/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.ts +47 -30
- package/tui/src/types/generated/google/protobuf/timestamp.ts +21 -7
- package/tui/src/types/message.ts +80 -102
- package/tui/src/types/messageQueueTypes.ts +6 -28
- package/tui/src/types/notebook.ts +16 -38
- package/tui/src/types/statusLine.ts +4 -26
- package/tui/src/types/tools.ts +24 -46
- package/tui/src/types/utils.ts +6 -28
- package/tui/src/upstreamproxy/relay.ts +7 -3
- package/tui/src/upstreamproxy/upstreamproxy.ts +1 -1
- package/tui/src/utils/assistantMessageFactories.ts +9 -3
- package/tui/src/utils/auth.ts +129 -139
- package/tui/src/utils/bash/ast.ts +23 -23
- package/tui/src/utils/bash/bashParser.ts +5 -5
- package/tui/src/utils/billing.ts +1 -1
- package/tui/src/utils/collapseReadSearch.ts +3 -3
- package/tui/src/utils/cronTasks.ts +1 -1
- package/tui/src/utils/execFileNoThrow.ts +1 -1
- package/tui/src/utils/filePersistence/types.ts +16 -38
- package/tui/src/utils/forkedAgent.ts +1 -1
- package/tui/src/utils/gracefulShutdown.ts +4 -4
- package/tui/src/utils/heapDumpService.ts +12 -8
- package/tui/src/utils/hooks/apiQueryHookHelper.ts +1 -1
- package/tui/src/utils/hooks/execPromptHook.ts +1 -1
- package/tui/src/utils/hooks/skillImprovement.ts +1 -1
- package/tui/src/utils/mcp/dateTimeParser.ts +1 -1
- package/tui/src/utils/messages.ts +18 -0
- package/tui/src/utils/migrateSessions.ts +3 -3
- package/tui/src/utils/model/model.ts +6 -6
- package/tui/src/utils/permissions/yoloClassifier.ts +1 -1
- package/tui/src/utils/plugins/headlessPluginInstall.ts +1 -1
- package/tui/src/utils/plugins/mcpPluginIntegration.ts +1 -1
- package/tui/src/utils/plugins/mcpbHandler.ts +1 -1
- package/tui/src/utils/plugins/pluginLoader.ts +8 -8
- package/tui/src/utils/protectedNamespace.ts +5 -3
- package/tui/src/utils/rawJsonToolCall.ts +242 -0
- package/tui/src/utils/ripgrep.ts +16 -7
- package/tui/src/utils/sessionTitle.ts +1 -1
- package/tui/src/utils/settings/permissionValidation.ts +14 -2
- package/tui/src/utils/shell/prefix.ts +1 -1
- package/tui/src/utils/sideQuery.ts +1 -1
- package/tui/src/utils/systemThemeWatcher.ts +13 -3
- package/tui/src/utils/teleport.tsx +1 -1
- package/uv.lock +400 -14
- package/tui/src/services/api/claude.ts +0 -3540
- package/tui/src/tools/_shared/directPublicDataGuard.ts +0 -362
- package/tui/src/tools/_shared/kmaAnalysisGuard.ts +0 -197
- package/tui/src/tools/_shared/kmaAviationGuard.ts +0 -70
- package/tui/src/tools/_shared/nmcAedGuard.ts +0 -234
- package/tui/src/tools/_shared/protectedCheckGuard.ts +0 -207
- package/tui/src/tools/_shared/textToolCallGuard.ts +0 -91
|
@@ -1,47 +1,12 @@
|
|
|
1
|
-
import { dirname, sep } from 'path'
|
|
2
|
-
import { logEvent } from 'src/services/analytics/index.js'
|
|
3
1
|
import { z } from 'zod/v4'
|
|
4
|
-
import { getFeatureValue_CACHED_MAY_BE_STALE } from '../../services/analytics/growthbook.js'
|
|
5
|
-
import { diagnosticTracker } from '../../services/diagnosticTracking.js'
|
|
6
|
-
import { clearDeliveredDiagnosticsForFile } from '../../services/lsp/LSPDiagnosticRegistry.js'
|
|
7
|
-
import { getLspServerManager } from '../../services/lsp/manager.js'
|
|
8
|
-
import { notifyVscodeFileUpdated } from '../../services/mcp/vscodeSdkMcp.js'
|
|
9
|
-
import { checkTeamMemSecrets } from '../../services/teamMemorySync/teamMemSecretGuard.js'
|
|
10
|
-
import {
|
|
11
|
-
activateConditionalSkillsForPaths,
|
|
12
|
-
addSkillDirectories,
|
|
13
|
-
discoverSkillDirsForPaths,
|
|
14
|
-
} from '../../skills/loadSkillsDir.js'
|
|
15
|
-
import type { ToolUseContext } from '../../Tool.js'
|
|
16
2
|
import { buildTool, type ToolDef } from '../../Tool.js'
|
|
17
|
-
import { getCwd } from '../../utils/cwd.js'
|
|
18
|
-
import { logForDebugging } from '../../utils/debug.js'
|
|
19
|
-
import { countLinesChanged, getPatchForDisplay } from '../../utils/diff.js'
|
|
20
|
-
import { isEnvTruthy } from '../../utils/envUtils.js'
|
|
21
|
-
import { isENOENT } from '../../utils/errors.js'
|
|
22
|
-
import { getFileModificationTime, writeTextContent } from '../../utils/file.js'
|
|
23
|
-
import {
|
|
24
|
-
fileHistoryEnabled,
|
|
25
|
-
fileHistoryTrackEdit,
|
|
26
|
-
} from '../../utils/fileHistory.js'
|
|
27
|
-
import { logFileOperation } from '../../utils/fileOperationAnalytics.js'
|
|
28
|
-
import { readFileSyncWithMetadata } from '../../utils/fileRead.js'
|
|
29
|
-
import { getFsImplementation } from '../../utils/fsOperations.js'
|
|
30
|
-
import {
|
|
31
|
-
fetchSingleFileGitDiff,
|
|
32
|
-
type ToolUseDiff,
|
|
33
|
-
} from '../../utils/gitDiff.js'
|
|
34
3
|
import { lazySchema } from '../../utils/lazySchema.js'
|
|
35
|
-
import { logError } from '../../utils/log.js'
|
|
36
4
|
import { expandPath } from '../../utils/path.js'
|
|
37
|
-
import {
|
|
38
|
-
checkWritePermissionForTool,
|
|
39
|
-
matchingRuleForInput,
|
|
40
|
-
} from '../../utils/permissions/filesystem.js'
|
|
5
|
+
import { checkWritePermissionForTool } from '../../utils/permissions/filesystem.js'
|
|
41
6
|
import type { PermissionDecision } from '../../utils/permissions/PermissionResult.js'
|
|
42
7
|
import { matchWildcardPattern } from '../../utils/permissions/shellRuleMatching.js'
|
|
43
|
-
import { FILE_UNEXPECTEDLY_MODIFIED_ERROR } from '../FileEditTool/constants.js'
|
|
44
8
|
import { gitDiffSchema, hunkSchema } from '../FileEditTool/types.js'
|
|
9
|
+
import { callFileWriteTool } from './call.js'
|
|
45
10
|
import { FILE_WRITE_TOOL_NAME, getWriteToolDescription } from './prompt.js'
|
|
46
11
|
import {
|
|
47
12
|
getToolUseSummary,
|
|
@@ -52,6 +17,7 @@ import {
|
|
|
52
17
|
renderToolUseRejectedMessage,
|
|
53
18
|
userFacingName,
|
|
54
19
|
} from './UI.js'
|
|
20
|
+
import { validateFileWriteInput } from './validateInput.js'
|
|
55
21
|
|
|
56
22
|
const inputSchema = lazySchema(() =>
|
|
57
23
|
z.strictObject({
|
|
@@ -150,270 +116,11 @@ export const FileWriteTool = buildTool({
|
|
|
150
116
|
// shown — phantom. Under-count: tool_use already indexes file_path.
|
|
151
117
|
return ''
|
|
152
118
|
},
|
|
153
|
-
async validateInput(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
// Reject writes to team memory files that contain secrets
|
|
157
|
-
const secretError = checkTeamMemSecrets(fullFilePath, content)
|
|
158
|
-
if (secretError) {
|
|
159
|
-
return { result: false, message: secretError, errorCode: 0 }
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// Check if path should be ignored based on permission settings
|
|
163
|
-
const appState = toolUseContext.getAppState()
|
|
164
|
-
const denyRule = matchingRuleForInput(
|
|
165
|
-
fullFilePath,
|
|
166
|
-
appState.toolPermissionContext,
|
|
167
|
-
'edit',
|
|
168
|
-
'deny',
|
|
169
|
-
)
|
|
170
|
-
if (denyRule !== null) {
|
|
171
|
-
return {
|
|
172
|
-
result: false,
|
|
173
|
-
message:
|
|
174
|
-
'File is in a directory that is denied by your permission settings.',
|
|
175
|
-
errorCode: 1,
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// SECURITY: Skip filesystem operations for UNC paths to prevent NTLM credential leaks.
|
|
180
|
-
// On Windows, fs.existsSync() on UNC paths triggers SMB authentication which could
|
|
181
|
-
// leak credentials to malicious servers. Let the permission check handle UNC paths.
|
|
182
|
-
if (fullFilePath.startsWith('\\\\') || fullFilePath.startsWith('//')) {
|
|
183
|
-
return { result: true }
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const fs = getFsImplementation()
|
|
187
|
-
let fileMtimeMs: number
|
|
188
|
-
try {
|
|
189
|
-
const fileStat = await fs.stat(fullFilePath)
|
|
190
|
-
fileMtimeMs = fileStat.mtimeMs
|
|
191
|
-
} catch (e) {
|
|
192
|
-
if (isENOENT(e)) {
|
|
193
|
-
return { result: true }
|
|
194
|
-
}
|
|
195
|
-
throw e
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const readTimestamp = toolUseContext.readFileState.get(fullFilePath)
|
|
199
|
-
if (!readTimestamp || readTimestamp.isPartialView) {
|
|
200
|
-
return {
|
|
201
|
-
result: false,
|
|
202
|
-
message:
|
|
203
|
-
'File has not been read yet. Read it first before writing to it.',
|
|
204
|
-
errorCode: 2,
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// Reuse mtime from the stat above — avoids a redundant statSync via
|
|
209
|
-
// getFileModificationTime. The readTimestamp guard above ensures this
|
|
210
|
-
// block is always reached when the file exists.
|
|
211
|
-
const lastWriteTime = Math.floor(fileMtimeMs)
|
|
212
|
-
if (lastWriteTime > readTimestamp.timestamp) {
|
|
213
|
-
return {
|
|
214
|
-
result: false,
|
|
215
|
-
message:
|
|
216
|
-
'File has been modified since read, either by the user or by a linter. Read it again before attempting to write it.',
|
|
217
|
-
errorCode: 3,
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return { result: true }
|
|
119
|
+
async validateInput(input, toolUseContext) {
|
|
120
|
+
return validateFileWriteInput(input, toolUseContext)
|
|
222
121
|
},
|
|
223
|
-
async call(
|
|
224
|
-
|
|
225
|
-
{ readFileState, updateFileHistoryState, dynamicSkillDirTriggers },
|
|
226
|
-
_,
|
|
227
|
-
parentMessage,
|
|
228
|
-
) {
|
|
229
|
-
const fullFilePath = expandPath(file_path)
|
|
230
|
-
const dir = dirname(fullFilePath)
|
|
231
|
-
|
|
232
|
-
// Discover skills from this file's path (fire-and-forget, non-blocking)
|
|
233
|
-
const cwd = getCwd()
|
|
234
|
-
const newSkillDirs = await discoverSkillDirsForPaths([fullFilePath], cwd)
|
|
235
|
-
if (newSkillDirs.length > 0) {
|
|
236
|
-
// Store discovered dirs for attachment display
|
|
237
|
-
for (const dir of newSkillDirs) {
|
|
238
|
-
dynamicSkillDirTriggers?.add(dir)
|
|
239
|
-
}
|
|
240
|
-
// Don't await - let skill loading happen in the background
|
|
241
|
-
addSkillDirectories(newSkillDirs).catch(() => {})
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Activate conditional skills whose path patterns match this file
|
|
245
|
-
activateConditionalSkillsForPaths([fullFilePath], cwd)
|
|
246
|
-
|
|
247
|
-
await diagnosticTracker.beforeFileEdited(fullFilePath)
|
|
248
|
-
|
|
249
|
-
// Ensure parent directory exists before the atomic read-modify-write section.
|
|
250
|
-
// Must stay OUTSIDE the critical section below (a yield between the staleness
|
|
251
|
-
// check and writeTextContent lets concurrent edits interleave), and BEFORE the
|
|
252
|
-
// write (lazy-mkdir-on-ENOENT would fire a spurious tengu_atomic_write_error
|
|
253
|
-
// inside writeFileSyncAndFlush_DEPRECATED before ENOENT propagates back).
|
|
254
|
-
await getFsImplementation().mkdir(dir)
|
|
255
|
-
if (fileHistoryEnabled()) {
|
|
256
|
-
// Backup captures pre-edit content — safe to call before the staleness
|
|
257
|
-
// check (idempotent v1 backup keyed on content hash; if staleness fails
|
|
258
|
-
// later we just have an unused backup, not corrupt state).
|
|
259
|
-
await fileHistoryTrackEdit(
|
|
260
|
-
updateFileHistoryState,
|
|
261
|
-
fullFilePath,
|
|
262
|
-
parentMessage.uuid,
|
|
263
|
-
)
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// Load current state and confirm no changes since last read.
|
|
267
|
-
// Please avoid async operations between here and writing to disk to preserve atomicity.
|
|
268
|
-
let meta: ReturnType<typeof readFileSyncWithMetadata> | null
|
|
269
|
-
try {
|
|
270
|
-
meta = readFileSyncWithMetadata(fullFilePath)
|
|
271
|
-
} catch (e) {
|
|
272
|
-
if (isENOENT(e)) {
|
|
273
|
-
meta = null
|
|
274
|
-
} else {
|
|
275
|
-
throw e
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if (meta !== null) {
|
|
280
|
-
const lastWriteTime = getFileModificationTime(fullFilePath)
|
|
281
|
-
const lastRead = readFileState.get(fullFilePath)
|
|
282
|
-
if (!lastRead || lastWriteTime > lastRead.timestamp) {
|
|
283
|
-
// Timestamp indicates modification, but on Windows timestamps can change
|
|
284
|
-
// without content changes (cloud sync, antivirus, etc.). For full reads,
|
|
285
|
-
// compare content as a fallback to avoid false positives.
|
|
286
|
-
const isFullRead =
|
|
287
|
-
lastRead &&
|
|
288
|
-
lastRead.offset === undefined &&
|
|
289
|
-
lastRead.limit === undefined
|
|
290
|
-
// meta.content is CRLF-normalized — matches readFileState's normalized form.
|
|
291
|
-
if (!isFullRead || meta.content !== lastRead.content) {
|
|
292
|
-
throw new Error(FILE_UNEXPECTEDLY_MODIFIED_ERROR)
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
const enc = meta?.encoding ?? 'utf8'
|
|
298
|
-
const oldContent = meta?.content ?? null
|
|
299
|
-
|
|
300
|
-
// Write is a full content replacement — the model sent explicit line endings
|
|
301
|
-
// in `content` and meant them. Do not rewrite them. Previously we preserved
|
|
302
|
-
// the old file's line endings (or sampled the repo via ripgrep for new
|
|
303
|
-
// files), which silently corrupted e.g. bash scripts with \r on Linux when
|
|
304
|
-
// overwriting a CRLF file or when binaries in cwd poisoned the repo sample.
|
|
305
|
-
writeTextContent(fullFilePath, content, enc, 'LF')
|
|
306
|
-
|
|
307
|
-
// Notify LSP servers about file modification (didChange) and save (didSave)
|
|
308
|
-
const lspManager = getLspServerManager()
|
|
309
|
-
if (lspManager) {
|
|
310
|
-
// Clear previously delivered diagnostics so new ones will be shown
|
|
311
|
-
clearDeliveredDiagnosticsForFile(`file://${fullFilePath}`)
|
|
312
|
-
// didChange: Content has been modified
|
|
313
|
-
lspManager.changeFile(fullFilePath, content).catch((err: Error) => {
|
|
314
|
-
logForDebugging(
|
|
315
|
-
`LSP: Failed to notify server of file change for ${fullFilePath}: ${err.message}`,
|
|
316
|
-
)
|
|
317
|
-
logError(err)
|
|
318
|
-
})
|
|
319
|
-
// didSave: File has been saved to disk (triggers diagnostics in TypeScript server)
|
|
320
|
-
lspManager.saveFile(fullFilePath).catch((err: Error) => {
|
|
321
|
-
logForDebugging(
|
|
322
|
-
`LSP: Failed to notify server of file save for ${fullFilePath}: ${err.message}`,
|
|
323
|
-
)
|
|
324
|
-
logError(err)
|
|
325
|
-
})
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
// Notify VSCode about the file change for diff view
|
|
329
|
-
notifyVscodeFileUpdated(fullFilePath, oldContent, content)
|
|
330
|
-
|
|
331
|
-
// Update read timestamp, to invalidate stale writes
|
|
332
|
-
readFileState.set(fullFilePath, {
|
|
333
|
-
content,
|
|
334
|
-
timestamp: getFileModificationTime(fullFilePath),
|
|
335
|
-
offset: undefined,
|
|
336
|
-
limit: undefined,
|
|
337
|
-
})
|
|
338
|
-
|
|
339
|
-
// Log when writing to CLAUDE.md
|
|
340
|
-
if (fullFilePath.endsWith(`${sep}CLAUDE.md`)) {
|
|
341
|
-
logEvent('tengu_write_claudemd', {})
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
let gitDiff: ToolUseDiff | undefined
|
|
345
|
-
if (
|
|
346
|
-
isEnvTruthy(process.env.CLAUDE_CODE_REMOTE) &&
|
|
347
|
-
getFeatureValue_CACHED_MAY_BE_STALE('tengu_quartz_lantern', false)
|
|
348
|
-
) {
|
|
349
|
-
const startTime = Date.now()
|
|
350
|
-
const diff = await fetchSingleFileGitDiff(fullFilePath)
|
|
351
|
-
if (diff) gitDiff = diff
|
|
352
|
-
logEvent('tengu_tool_use_diff_computed', {
|
|
353
|
-
isWriteTool: true,
|
|
354
|
-
durationMs: Date.now() - startTime,
|
|
355
|
-
hasDiff: !!diff,
|
|
356
|
-
})
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
if (oldContent) {
|
|
360
|
-
const patch = getPatchForDisplay({
|
|
361
|
-
filePath: file_path,
|
|
362
|
-
fileContents: oldContent,
|
|
363
|
-
edits: [
|
|
364
|
-
{
|
|
365
|
-
old_string: oldContent,
|
|
366
|
-
new_string: content,
|
|
367
|
-
replace_all: false,
|
|
368
|
-
},
|
|
369
|
-
],
|
|
370
|
-
})
|
|
371
|
-
|
|
372
|
-
const data = {
|
|
373
|
-
type: 'update' as const,
|
|
374
|
-
filePath: file_path,
|
|
375
|
-
content,
|
|
376
|
-
structuredPatch: patch,
|
|
377
|
-
originalFile: oldContent,
|
|
378
|
-
...(gitDiff && { gitDiff }),
|
|
379
|
-
}
|
|
380
|
-
// Track lines added and removed for file updates, right before yielding result
|
|
381
|
-
countLinesChanged(patch)
|
|
382
|
-
|
|
383
|
-
logFileOperation({
|
|
384
|
-
operation: 'write',
|
|
385
|
-
tool: 'FileWriteTool',
|
|
386
|
-
filePath: fullFilePath,
|
|
387
|
-
type: 'update',
|
|
388
|
-
})
|
|
389
|
-
|
|
390
|
-
return {
|
|
391
|
-
data,
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
const data = {
|
|
396
|
-
type: 'create' as const,
|
|
397
|
-
filePath: file_path,
|
|
398
|
-
content,
|
|
399
|
-
structuredPatch: [],
|
|
400
|
-
originalFile: null,
|
|
401
|
-
...(gitDiff && { gitDiff }),
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
// For creation of new files, count all lines as additions, right before yielding the result
|
|
405
|
-
countLinesChanged([], content)
|
|
406
|
-
|
|
407
|
-
logFileOperation({
|
|
408
|
-
operation: 'write',
|
|
409
|
-
tool: 'FileWriteTool',
|
|
410
|
-
filePath: fullFilePath,
|
|
411
|
-
type: 'create',
|
|
412
|
-
})
|
|
413
|
-
|
|
414
|
-
return {
|
|
415
|
-
data,
|
|
416
|
-
}
|
|
122
|
+
async call(input, context, _, parentMessage) {
|
|
123
|
+
return callFileWriteTool(input, context, parentMessage)
|
|
417
124
|
},
|
|
418
125
|
mapToolResultToToolResultBlockParam({ filePath, type }, toolUseID) {
|
|
419
126
|
switch (type) {
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { dirname, sep } from 'path'
|
|
2
|
+
import { logEvent } from 'src/services/analytics/index.js'
|
|
3
|
+
import { getFeatureValue_CACHED_MAY_BE_STALE } from '../../services/analytics/growthbook.js'
|
|
4
|
+
import { diagnosticTracker } from '../../services/diagnosticTracking.js'
|
|
5
|
+
import { clearDeliveredDiagnosticsForFile } from '../../services/lsp/LSPDiagnosticRegistry.js'
|
|
6
|
+
import { notifyVscodeFileUpdated } from '../../services/mcp/vscodeSdkMcp.js'
|
|
7
|
+
import {
|
|
8
|
+
activateConditionalSkillsForPaths,
|
|
9
|
+
addSkillDirectories,
|
|
10
|
+
discoverSkillDirsForPaths,
|
|
11
|
+
} from '../../skills/loadSkillsDir.js'
|
|
12
|
+
import type { ToolResult, ToolUseContext } from '../../Tool.js'
|
|
13
|
+
import type { AssistantMessage } from '../../types/message.js'
|
|
14
|
+
import { getCwd } from '../../utils/cwd.js'
|
|
15
|
+
import { logForDebugging } from '../../utils/debug.js'
|
|
16
|
+
import { countLinesChanged, getPatchForDisplay } from '../../utils/diff.js'
|
|
17
|
+
import { isEnvTruthy } from '../../utils/envUtils.js'
|
|
18
|
+
import { isENOENT } from '../../utils/errors.js'
|
|
19
|
+
import { getFileModificationTime, writeTextContent } from '../../utils/file.js'
|
|
20
|
+
import { logFileOperation } from '../../utils/fileOperationAnalytics.js'
|
|
21
|
+
import { readFileSyncWithMetadata } from '../../utils/fileRead.js'
|
|
22
|
+
import { getFsImplementation } from '../../utils/fsOperations.js'
|
|
23
|
+
import {
|
|
24
|
+
fetchSingleFileGitDiff,
|
|
25
|
+
type ToolUseDiff,
|
|
26
|
+
} from '../../utils/gitDiff.js'
|
|
27
|
+
import { logError } from '../../utils/log.js'
|
|
28
|
+
import { expandPath } from '../../utils/path.js'
|
|
29
|
+
import { documentDerivativeMutationValidationForResolvedTarget } from '../DocumentPrimitive/documentMutationGuard.js'
|
|
30
|
+
import { FILE_UNEXPECTEDLY_MODIFIED_ERROR } from '../FileEditTool/constants.js'
|
|
31
|
+
import type { FileWriteInput } from './validateInput.js'
|
|
32
|
+
|
|
33
|
+
type FileWritePatch = ReturnType<typeof getPatchForDisplay>
|
|
34
|
+
|
|
35
|
+
type FileWriteUpdateData = {
|
|
36
|
+
type: 'update'
|
|
37
|
+
filePath: string
|
|
38
|
+
content: string
|
|
39
|
+
structuredPatch: FileWritePatch
|
|
40
|
+
originalFile: string
|
|
41
|
+
gitDiff?: ToolUseDiff
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type FileWriteCreateData = {
|
|
45
|
+
type: 'create'
|
|
46
|
+
filePath: string
|
|
47
|
+
content: string
|
|
48
|
+
structuredPatch: FileWritePatch
|
|
49
|
+
originalFile: null
|
|
50
|
+
gitDiff?: ToolUseDiff
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
type FileWriteData = FileWriteUpdateData | FileWriteCreateData
|
|
54
|
+
|
|
55
|
+
export async function callFileWriteTool(
|
|
56
|
+
{ file_path, content }: FileWriteInput,
|
|
57
|
+
{
|
|
58
|
+
readFileState,
|
|
59
|
+
updateFileHistoryState,
|
|
60
|
+
dynamicSkillDirTriggers,
|
|
61
|
+
}: ToolUseContext,
|
|
62
|
+
parentMessage: AssistantMessage,
|
|
63
|
+
): Promise<ToolResult<FileWriteData>> {
|
|
64
|
+
const fullFilePath = expandPath(file_path)
|
|
65
|
+
const documentValidation =
|
|
66
|
+
documentDerivativeMutationValidationForResolvedTarget(fullFilePath)
|
|
67
|
+
if (documentValidation !== null) throw new Error(documentValidation.message)
|
|
68
|
+
|
|
69
|
+
const dir = dirname(fullFilePath)
|
|
70
|
+
|
|
71
|
+
const cwd = getCwd()
|
|
72
|
+
const newSkillDirs = await discoverSkillDirsForPaths([fullFilePath], cwd)
|
|
73
|
+
if (newSkillDirs.length > 0) {
|
|
74
|
+
for (const dir of newSkillDirs) {
|
|
75
|
+
dynamicSkillDirTriggers?.add(dir)
|
|
76
|
+
}
|
|
77
|
+
addSkillDirectories(newSkillDirs).catch(() => {})
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
activateConditionalSkillsForPaths([fullFilePath], cwd)
|
|
81
|
+
|
|
82
|
+
await diagnosticTracker.beforeFileEdited(fullFilePath)
|
|
83
|
+
|
|
84
|
+
await getFsImplementation().mkdir(dir)
|
|
85
|
+
const { fileHistoryEnabled, fileHistoryTrackEdit } = await import(
|
|
86
|
+
'../../utils/fileHistory.js'
|
|
87
|
+
)
|
|
88
|
+
if (fileHistoryEnabled()) {
|
|
89
|
+
await fileHistoryTrackEdit(
|
|
90
|
+
updateFileHistoryState,
|
|
91
|
+
fullFilePath,
|
|
92
|
+
parentMessage.uuid,
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let meta: ReturnType<typeof readFileSyncWithMetadata> | null
|
|
97
|
+
try {
|
|
98
|
+
meta = readFileSyncWithMetadata(fullFilePath)
|
|
99
|
+
} catch (e) {
|
|
100
|
+
if (isENOENT(e)) {
|
|
101
|
+
meta = null
|
|
102
|
+
} else {
|
|
103
|
+
throw e
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (meta !== null) {
|
|
108
|
+
const lastWriteTime = getFileModificationTime(fullFilePath)
|
|
109
|
+
const lastRead = readFileState.get(fullFilePath)
|
|
110
|
+
if (!lastRead || lastWriteTime > lastRead.timestamp) {
|
|
111
|
+
const isFullRead =
|
|
112
|
+
lastRead &&
|
|
113
|
+
lastRead.offset === undefined &&
|
|
114
|
+
lastRead.limit === undefined
|
|
115
|
+
if (!isFullRead || meta.content !== lastRead.content) {
|
|
116
|
+
throw new Error(FILE_UNEXPECTEDLY_MODIFIED_ERROR)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const enc = meta?.encoding ?? 'utf8'
|
|
122
|
+
const oldContent = meta?.content ?? null
|
|
123
|
+
writeTextContent(fullFilePath, content, enc, 'LF')
|
|
124
|
+
|
|
125
|
+
const { getLspServerManager } = await import('../../services/lsp/manager.js')
|
|
126
|
+
const lspManager = getLspServerManager()
|
|
127
|
+
if (lspManager) {
|
|
128
|
+
clearDeliveredDiagnosticsForFile(`file://${fullFilePath}`)
|
|
129
|
+
lspManager.changeFile(fullFilePath, content).catch((err: Error) => {
|
|
130
|
+
logForDebugging(
|
|
131
|
+
`LSP: Failed to notify server of file change for ${fullFilePath}: ${err.message}`,
|
|
132
|
+
)
|
|
133
|
+
logError(err)
|
|
134
|
+
})
|
|
135
|
+
lspManager.saveFile(fullFilePath).catch((err: Error) => {
|
|
136
|
+
logForDebugging(
|
|
137
|
+
`LSP: Failed to notify server of file save for ${fullFilePath}: ${err.message}`,
|
|
138
|
+
)
|
|
139
|
+
logError(err)
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
notifyVscodeFileUpdated(fullFilePath, oldContent, content)
|
|
144
|
+
|
|
145
|
+
readFileState.set(fullFilePath, {
|
|
146
|
+
content,
|
|
147
|
+
timestamp: getFileModificationTime(fullFilePath),
|
|
148
|
+
offset: undefined,
|
|
149
|
+
limit: undefined,
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
if (fullFilePath.endsWith(`${sep}CLAUDE.md`)) {
|
|
153
|
+
logEvent('tengu_write_claudemd', {})
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
let gitDiff: ToolUseDiff | undefined
|
|
157
|
+
if (
|
|
158
|
+
isEnvTruthy(process.env.CLAUDE_CODE_REMOTE) &&
|
|
159
|
+
getFeatureValue_CACHED_MAY_BE_STALE('tengu_quartz_lantern', false)
|
|
160
|
+
) {
|
|
161
|
+
const startTime = Date.now()
|
|
162
|
+
const diff = await fetchSingleFileGitDiff(fullFilePath)
|
|
163
|
+
if (diff) gitDiff = diff
|
|
164
|
+
logEvent('tengu_tool_use_diff_computed', {
|
|
165
|
+
isWriteTool: true,
|
|
166
|
+
durationMs: Date.now() - startTime,
|
|
167
|
+
hasDiff: !!diff,
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (oldContent) {
|
|
172
|
+
const patch = getPatchForDisplay({
|
|
173
|
+
filePath: file_path,
|
|
174
|
+
fileContents: oldContent,
|
|
175
|
+
edits: [
|
|
176
|
+
{
|
|
177
|
+
old_string: oldContent,
|
|
178
|
+
new_string: content,
|
|
179
|
+
replace_all: false,
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
const data: FileWriteUpdateData = {
|
|
185
|
+
type: 'update',
|
|
186
|
+
filePath: file_path,
|
|
187
|
+
content,
|
|
188
|
+
structuredPatch: patch,
|
|
189
|
+
originalFile: oldContent,
|
|
190
|
+
...(gitDiff && { gitDiff }),
|
|
191
|
+
}
|
|
192
|
+
countLinesChanged(patch)
|
|
193
|
+
|
|
194
|
+
logFileOperation({
|
|
195
|
+
operation: 'write',
|
|
196
|
+
tool: 'FileWriteTool',
|
|
197
|
+
filePath: fullFilePath,
|
|
198
|
+
type: 'update',
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
return { data }
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const data: FileWriteCreateData = {
|
|
205
|
+
type: 'create',
|
|
206
|
+
filePath: file_path,
|
|
207
|
+
content,
|
|
208
|
+
structuredPatch: [],
|
|
209
|
+
originalFile: null,
|
|
210
|
+
...(gitDiff && { gitDiff }),
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
countLinesChanged([], content)
|
|
214
|
+
|
|
215
|
+
logFileOperation({
|
|
216
|
+
operation: 'write',
|
|
217
|
+
tool: 'FileWriteTool',
|
|
218
|
+
filePath: fullFilePath,
|
|
219
|
+
type: 'create',
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
return { data }
|
|
223
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { ToolUseContext, ValidationResult } from '../../Tool.js'
|
|
2
|
+
import { checkTeamMemSecrets } from '../../services/teamMemorySync/teamMemSecretGuard.js'
|
|
3
|
+
import { isENOENT } from '../../utils/errors.js'
|
|
4
|
+
import { getFsImplementation } from '../../utils/fsOperations.js'
|
|
5
|
+
import { expandPath } from '../../utils/path.js'
|
|
6
|
+
import { matchingRuleForInput } from '../../utils/permissions/filesystem.js'
|
|
7
|
+
import { documentDerivativeMutationValidationForResolvedTarget } from '../DocumentPrimitive/documentMutationGuard.js'
|
|
8
|
+
|
|
9
|
+
export type FileWriteInput = {
|
|
10
|
+
file_path: string
|
|
11
|
+
content: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function validateFileWriteInput(
|
|
15
|
+
{ file_path, content }: FileWriteInput,
|
|
16
|
+
toolUseContext: ToolUseContext,
|
|
17
|
+
): Promise<ValidationResult> {
|
|
18
|
+
const fullFilePath = expandPath(file_path)
|
|
19
|
+
const documentValidation =
|
|
20
|
+
documentDerivativeMutationValidationForResolvedTarget(fullFilePath)
|
|
21
|
+
if (documentValidation !== null) return documentValidation
|
|
22
|
+
|
|
23
|
+
const secretError = checkTeamMemSecrets(fullFilePath, content)
|
|
24
|
+
if (secretError) {
|
|
25
|
+
return { result: false, message: secretError, errorCode: 0 }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const appState = toolUseContext.getAppState()
|
|
29
|
+
const denyRule = matchingRuleForInput(
|
|
30
|
+
fullFilePath,
|
|
31
|
+
appState.toolPermissionContext,
|
|
32
|
+
'edit',
|
|
33
|
+
'deny',
|
|
34
|
+
)
|
|
35
|
+
if (denyRule !== null) {
|
|
36
|
+
return {
|
|
37
|
+
result: false,
|
|
38
|
+
message:
|
|
39
|
+
'File is in a directory that is denied by your permission settings.',
|
|
40
|
+
errorCode: 1,
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (fullFilePath.startsWith('\\\\') || fullFilePath.startsWith('//')) {
|
|
45
|
+
return { result: true }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const fs = getFsImplementation()
|
|
49
|
+
let fileMtimeMs: number
|
|
50
|
+
try {
|
|
51
|
+
const fileStat = await fs.stat(fullFilePath)
|
|
52
|
+
fileMtimeMs = fileStat.mtimeMs
|
|
53
|
+
} catch (e) {
|
|
54
|
+
if (isENOENT(e)) {
|
|
55
|
+
return { result: true }
|
|
56
|
+
}
|
|
57
|
+
throw e
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const readTimestamp = toolUseContext.readFileState.get(fullFilePath)
|
|
61
|
+
if (!readTimestamp || readTimestamp.isPartialView) {
|
|
62
|
+
return {
|
|
63
|
+
result: false,
|
|
64
|
+
message: 'File has not been read yet. Read it first before writing to it.',
|
|
65
|
+
errorCode: 2,
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const lastWriteTime = Math.floor(fileMtimeMs)
|
|
70
|
+
if (lastWriteTime > readTimestamp.timestamp) {
|
|
71
|
+
return {
|
|
72
|
+
result: false,
|
|
73
|
+
message:
|
|
74
|
+
'File has been modified since read, either by the user or by a linter. Read it again before attempting to write it.',
|
|
75
|
+
errorCode: 3,
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return { result: true }
|
|
80
|
+
}
|
|
@@ -9,6 +9,10 @@ import { lazySchema } from '../../utils/lazySchema.js'
|
|
|
9
9
|
import { logMCPError } from '../../utils/log.js'
|
|
10
10
|
import { jsonStringify } from '../../utils/slowOperations.js'
|
|
11
11
|
import { isOutputLineTruncated } from '../../utils/terminal.js'
|
|
12
|
+
import {
|
|
13
|
+
assertTrustedMcpServerForResourceAccess,
|
|
14
|
+
isTrustedMcpServer,
|
|
15
|
+
} from '../MCPTool/trustPolicy.js'
|
|
12
16
|
import { DESCRIPTION, LIST_MCP_RESOURCES_TOOL_NAME, PROMPT } from './prompt.js'
|
|
13
17
|
import { renderToolResultMessage, renderToolUseMessage } from './UI.js'
|
|
14
18
|
|
|
@@ -16,6 +20,8 @@ const inputSchema = lazySchema(() =>
|
|
|
16
20
|
z.object({
|
|
17
21
|
server: z
|
|
18
22
|
.string()
|
|
23
|
+
.trim()
|
|
24
|
+
.min(1, 'Server name cannot be empty')
|
|
19
25
|
.optional()
|
|
20
26
|
.describe('Optional server name to filter resources by'),
|
|
21
27
|
}),
|
|
@@ -49,7 +55,7 @@ export const ListMcpResourcesTool = buildTool({
|
|
|
49
55
|
},
|
|
50
56
|
shouldDefer: true,
|
|
51
57
|
name: LIST_MCP_RESOURCES_TOOL_NAME,
|
|
52
|
-
searchHint: 'list resources from connected MCP servers',
|
|
58
|
+
searchHint: 'list resources from connected MCP servers with trust boundary checks',
|
|
53
59
|
maxResultSizeChars: 100_000,
|
|
54
60
|
async description() {
|
|
55
61
|
return DESCRIPTION
|
|
@@ -63,12 +69,19 @@ export const ListMcpResourcesTool = buildTool({
|
|
|
63
69
|
get outputSchema(): OutputSchema {
|
|
64
70
|
return outputSchema()
|
|
65
71
|
},
|
|
66
|
-
async call(input, { options: { mcpClients } }) {
|
|
72
|
+
async call(input, { options: { mcpClients }, getAppState }) {
|
|
67
73
|
const { server: targetServer } = input
|
|
74
|
+
const permissionContext = getAppState().toolPermissionContext
|
|
75
|
+
|
|
76
|
+
if (targetServer !== undefined) {
|
|
77
|
+
assertTrustedMcpServerForResourceAccess(permissionContext, targetServer)
|
|
78
|
+
}
|
|
68
79
|
|
|
69
80
|
const clientsToProcess = targetServer
|
|
70
81
|
? mcpClients.filter(client => client.name === targetServer)
|
|
71
|
-
: mcpClients
|
|
82
|
+
: mcpClients.filter(client =>
|
|
83
|
+
isTrustedMcpServer(permissionContext, client.name),
|
|
84
|
+
)
|
|
72
85
|
|
|
73
86
|
if (targetServer && clientsToProcess.length === 0) {
|
|
74
87
|
throw new Error(
|
|
@@ -88,6 +101,9 @@ export const ListMcpResourcesTool = buildTool({
|
|
|
88
101
|
const fresh = await ensureConnectedClient(client)
|
|
89
102
|
return await fetchResourcesForClient(fresh)
|
|
90
103
|
} catch (error) {
|
|
104
|
+
if (!(error instanceof Error)) {
|
|
105
|
+
throw error
|
|
106
|
+
}
|
|
91
107
|
// One server's reconnect failure shouldn't sink the whole result.
|
|
92
108
|
logMCPError(client.name, errorMessage(error))
|
|
93
109
|
return []
|