ummaya 0.2.4 → 0.2.6
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/bun.lock +180 -244
- package/npm-shrinkwrap.json +760 -1760
- package/package.json +39 -22
- package/prompts/manifest.yaml +1 -1
- package/prompts/system_v1.md +1 -0
- package/pyproject.toml +27 -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/_canonical/baselines.yaml +113 -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 +132 -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/bun.lock +126 -305
- package/tui/package.json +35 -22
- 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/handlers/mcp.tsx +0 -1
- package/tui/src/cli/print.ts +8 -9
- 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 +32 -15
- 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/claudeDesktop.ts +4 -4
- 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 +426 -45
- 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
package/tui/src/main.tsx
CHANGED
|
@@ -92,8 +92,8 @@ import { validateUuid } from './utils/uuid.js';
|
|
|
92
92
|
|
|
93
93
|
import { registerMcpAddCommand } from 'src/commands/mcp/addCommand.js';
|
|
94
94
|
import { registerMcpXaaIdpCommand } from 'src/commands/mcp/xaaIdpCommand.js';
|
|
95
|
-
//
|
|
96
|
-
//
|
|
95
|
+
// Managed MCP proxy removed in P1+P2 (Spec 1633); UMMAYA does not consume
|
|
96
|
+
// upstream enterprise MCP configs. The eligibility check is now a no-op.
|
|
97
97
|
const fetchClaudeAIMcpConfigsIfEligible = async (): Promise<Record<string, never>> => ({});
|
|
98
98
|
import { clearServerCache } from 'src/services/mcp/client.js';
|
|
99
99
|
import { areMcpConfigsAllowedWithEnterpriseMcpConfig, dedupClaudeAiMcpServers, doesEnterpriseMcpConfigExist, filterMcpServersByPolicy, getClaudeCodeMcpConfigs, getMcpServerSignature, parseMcpConfig, parseMcpConfigFromFilePath } from 'src/services/mcp/config.js';
|
|
@@ -137,6 +137,27 @@ import { getTmuxInstallInstructions, isTmuxAvailable, parsePRReference } from '.
|
|
|
137
137
|
|
|
138
138
|
|
|
139
139
|
|
|
140
|
+
type ModuleRequire = (specifier: string) => unknown
|
|
141
|
+
type InspectorModule = {
|
|
142
|
+
url: () => string | undefined
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function isModuleRequire(value: unknown): value is ModuleRequire {
|
|
146
|
+
return typeof value === 'function'
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function isInspectorModule(value: unknown): value is InspectorModule {
|
|
150
|
+
return typeof value === 'object' && value !== null && 'url' in value && typeof value.url === 'function'
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function getInspectorFromGlobal(): InspectorModule | undefined {
|
|
154
|
+
const globalRequire: unknown = Reflect.get(globalThis, 'require')
|
|
155
|
+
if (!isModuleRequire(globalRequire)) return undefined
|
|
156
|
+
|
|
157
|
+
const inspector = globalRequire('inspector')
|
|
158
|
+
return isInspectorModule(inspector) ? inspector : undefined
|
|
159
|
+
}
|
|
160
|
+
|
|
140
161
|
// Check if running in debug/inspection mode
|
|
141
162
|
function isBeingDebugged() {
|
|
142
163
|
const isBun = isRunningWithBun();
|
|
@@ -161,9 +182,8 @@ function isBeingDebugged() {
|
|
|
161
182
|
// Check if inspector is available and active (indicates debugging)
|
|
162
183
|
try {
|
|
163
184
|
// Dynamic import would be better but is async - use global object instead
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
const hasInspectorUrl = !!inspector.url();
|
|
185
|
+
const inspector = getInspectorFromGlobal();
|
|
186
|
+
const hasInspectorUrl = !!inspector?.url();
|
|
167
187
|
return hasInspectorUrl || hasInspectArg || hasInspectEnv;
|
|
168
188
|
} catch {
|
|
169
189
|
// Ignore error and fall back to argument detection
|
|
@@ -539,7 +559,7 @@ async function run(): Promise<CommanderCommand> {
|
|
|
539
559
|
// If not provided but flag is present, value will be true
|
|
540
560
|
// The actual filtering is handled in debug.ts by parsing process.argv
|
|
541
561
|
return true;
|
|
542
|
-
}).addOption(new Option('--debug-to-stderr', 'Enable debug mode (to stderr)').hideHelp()).option('--debug-file <path>', 'Write debug logs to a specific file path (implicitly enables debug mode)', () => true).option('--verbose', 'Override verbose mode setting from config', () => true).option('-p, --print', 'Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when UMMAYA is run with the -p mode. Only use this flag in directories you trust.', () => true).option('--bare', 'Minimal mode: skip hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and
|
|
562
|
+
}).addOption(new Option('--debug-to-stderr', 'Enable debug mode (to stderr)').hideHelp()).option('--debug-file <path>', 'Write debug logs to a specific file path (implicitly enables debug mode)', () => true).option('--verbose', 'Override verbose mode setting from config', () => true).option('-p, --print', 'Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when UMMAYA is run with the -p mode. Only use this flag in directories you trust.', () => true).option('--bare', 'Minimal mode: skip hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and project-memory auto-discovery. Enables minimal compatibility mode. FriendliAI auth still requires an active /login session. Skills still resolve via /skill-name. Explicitly provide context via: --system-prompt[-file], --append-system-prompt[-file], --add-dir, --mcp-config, --settings, --agents, --plugin-dir.', () => true).addOption(new Option('--init', 'Run Setup hooks with init trigger, then continue').hideHelp()).addOption(new Option('--init-only', 'Run Setup and SessionStart:startup hooks, then exit').hideHelp()).addOption(new Option('--maintenance', 'Run Setup hooks with maintenance trigger, then continue').hideHelp()).addOption(new Option('--output-format <format>', 'Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming)').choices(['text', 'json', 'stream-json'])).addOption(new Option('--json-schema <schema>', 'JSON Schema for structured output validation. ' + 'Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}').argParser(String)).option('--include-hook-events', 'Include all hook lifecycle events in the output stream (only works with --output-format=stream-json)', () => true).option('--include-partial-messages', 'Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)', () => true).addOption(new Option('--input-format <format>', 'Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input)').choices(['text', 'stream-json'])).option('--mcp-debug', '[DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)', () => true).option('--dangerously-skip-permissions', 'Bypass all permission checks. Recommended only for sandboxes with no internet access.', () => true).option('--allow-dangerously-skip-permissions', 'Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.', () => true).addOption(new Option('--thinking <mode>', 'Thinking mode: enabled (equivalent to adaptive), disabled').choices(['enabled', 'adaptive', 'disabled']).hideHelp()).addOption(new Option('--max-thinking-tokens <tokens>', '[DEPRECATED. Use --thinking instead for newer models] Maximum number of thinking tokens (only works with --print)').argParser(Number).hideHelp()).addOption(new Option('--max-turns <turns>', 'Maximum number of agentic turns in non-interactive mode. This will early exit the conversation after the specified number of turns. (only works with --print)').argParser(Number).hideHelp()).addOption(new Option('--max-budget-usd <amount>', 'Maximum dollar amount to spend on API calls (only works with --print)').argParser(value => {
|
|
543
563
|
const amount = Number(value);
|
|
544
564
|
if (isNaN(amount) || amount <= 0) {
|
|
545
565
|
throw new Error('--max-budget-usd must be a positive number greater than 0');
|
|
@@ -1095,12 +1115,12 @@ async function run(): Promise<CommanderCommand> {
|
|
|
1095
1115
|
});
|
|
1096
1116
|
void assertMinVersion();
|
|
1097
1117
|
|
|
1098
|
-
//
|
|
1118
|
+
// UMMAYA connector config fetch: -p mode only (interactive uses useManageMCPConnections
|
|
1099
1119
|
// two-phase loading). Kicked off here to overlap with setup(); awaited
|
|
1100
1120
|
// before runHeadless so single-turn -p sees connectors. Skipped under
|
|
1101
1121
|
// enterprise/strict MCP to preserve policy boundaries.
|
|
1102
1122
|
const claudeaiConfigPromise: Promise<Record<string, ScopedMcpServerConfig>> = isNonInteractiveSession && !strictMcpConfig && !doesEnterpriseMcpConfigExist() &&
|
|
1103
|
-
// --bare / SIMPLE: skip
|
|
1123
|
+
// --bare / SIMPLE: skip managed connector proxy servers (datadog, Gmail,
|
|
1104
1124
|
// Slack, BigQuery, PubMed — 6-14s each to connect). Scripted calls
|
|
1105
1125
|
// that need MCP pass --mcp-config explicitly.
|
|
1106
1126
|
!isBareMode() ? fetchClaudeAIMcpConfigsIfEligible().then(configs => {
|
|
@@ -1109,7 +1129,7 @@ async function run(): Promise<CommanderCommand> {
|
|
|
1109
1129
|
blocked
|
|
1110
1130
|
} = filterMcpServersByPolicy(configs);
|
|
1111
1131
|
if (blocked.length > 0) {
|
|
1112
|
-
process.stderr.write(`Warning:
|
|
1132
|
+
process.stderr.write(`Warning: UMMAYA MCP ${plural(blocked.length, 'server')} blocked by enterprise policy: ${blocked.join(', ')}\n`);
|
|
1113
1133
|
}
|
|
1114
1134
|
return allowed;
|
|
1115
1135
|
}) : Promise.resolve({});
|
|
@@ -2460,7 +2480,7 @@ async function run(): Promise<CommanderCommand> {
|
|
|
2460
2480
|
} = await import('./cli/handlers/mcp.js');
|
|
2461
2481
|
await mcpAddJsonHandler(name, json, options);
|
|
2462
2482
|
});
|
|
2463
|
-
mcp.command('add-from-
|
|
2483
|
+
mcp.command('add-from-desktop').description('Import MCP servers from a desktop MCP config (Mac and WSL only)').option('-s, --scope <scope>', 'Configuration scope (local, user, or project)', 'local').action(async (options: {
|
|
2464
2484
|
scope?: string;
|
|
2465
2485
|
}) => {
|
|
2466
2486
|
const {
|
|
@@ -2477,16 +2497,14 @@ async function run(): Promise<CommanderCommand> {
|
|
|
2477
2497
|
|
|
2478
2498
|
|
|
2479
2499
|
const auth = program.command('auth').description('Show UMMAYA FriendliAI session-auth status').configureHelp(createSortedHelpConfig());
|
|
2480
|
-
auth.command('login').description('Show how to log in with /login inside the TUI').option('--email <email>', 'Ignored in UMMAYA').option('--sso', 'Ignored in UMMAYA').option('--console', 'Ignored in UMMAYA').
|
|
2500
|
+
auth.command('login').description('Show how to log in with /login inside the TUI').option('--email <email>', 'Ignored in UMMAYA').option('--sso', 'Ignored in UMMAYA').option('--console', 'Ignored in UMMAYA').action(async ({
|
|
2481
2501
|
email,
|
|
2482
2502
|
sso,
|
|
2483
2503
|
console: useConsole,
|
|
2484
|
-
claudeai
|
|
2485
2504
|
}: {
|
|
2486
2505
|
email?: string;
|
|
2487
2506
|
sso?: boolean;
|
|
2488
2507
|
console?: boolean;
|
|
2489
|
-
claudeai?: boolean;
|
|
2490
2508
|
}) => {
|
|
2491
2509
|
const {
|
|
2492
2510
|
authLogin
|
|
@@ -2494,8 +2512,7 @@ async function run(): Promise<CommanderCommand> {
|
|
|
2494
2512
|
await authLogin({
|
|
2495
2513
|
email,
|
|
2496
2514
|
sso,
|
|
2497
|
-
console: useConsole
|
|
2498
|
-
claudeai
|
|
2515
|
+
console: useConsole
|
|
2499
2516
|
});
|
|
2500
2517
|
});
|
|
2501
2518
|
auth.command('status').description('Show authentication status').option('--json', 'Output as JSON (default)').option('--text', 'Output as human-readable text').action(async (opts: {
|
|
@@ -49,6 +49,7 @@ export class FileIndex {
|
|
|
49
49
|
// During async build, tracks how many paths have bitmap/lowerPath filled.
|
|
50
50
|
// search() uses this to search the ready prefix while build continues.
|
|
51
51
|
private readyCount = 0
|
|
52
|
+
private buildGeneration = 0
|
|
52
53
|
|
|
53
54
|
/**
|
|
54
55
|
* Load paths from an array of strings.
|
|
@@ -56,6 +57,7 @@ export class FileIndex {
|
|
|
56
57
|
* Automatically deduplicates paths.
|
|
57
58
|
*/
|
|
58
59
|
loadFromFileList(fileList: string[]): void {
|
|
60
|
+
const generation = this.startBuild()
|
|
59
61
|
// Deduplicate and filter empty strings (matches Rust HashSet behavior)
|
|
60
62
|
const seen = new Set<string>()
|
|
61
63
|
const paths: string[] = []
|
|
@@ -66,7 +68,7 @@ export class FileIndex {
|
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
this.buildIndex(paths)
|
|
71
|
+
this.buildIndex(paths, generation)
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
/**
|
|
@@ -88,18 +90,24 @@ export class FileIndex {
|
|
|
88
90
|
const queryable = new Promise<void>(resolve => {
|
|
89
91
|
markQueryable = resolve
|
|
90
92
|
})
|
|
91
|
-
const
|
|
93
|
+
const generation = this.startBuild()
|
|
94
|
+
const done = this.buildAsync(fileList, markQueryable, generation)
|
|
92
95
|
return { queryable, done }
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
private async buildAsync(
|
|
96
99
|
fileList: string[],
|
|
97
100
|
markQueryable: () => void,
|
|
101
|
+
generation: number,
|
|
98
102
|
): Promise<void> {
|
|
99
103
|
const seen = new Set<string>()
|
|
100
104
|
const paths: string[] = []
|
|
101
105
|
let chunkStart = performance.now()
|
|
102
106
|
for (let i = 0; i < fileList.length; i++) {
|
|
107
|
+
if (generation !== this.buildGeneration) {
|
|
108
|
+
markQueryable()
|
|
109
|
+
return
|
|
110
|
+
}
|
|
103
111
|
const line = fileList[i]!
|
|
104
112
|
if (line.length > 0 && !seen.has(line)) {
|
|
105
113
|
seen.add(line)
|
|
@@ -112,11 +120,19 @@ export class FileIndex {
|
|
|
112
120
|
}
|
|
113
121
|
}
|
|
114
122
|
|
|
123
|
+
if (generation !== this.buildGeneration) {
|
|
124
|
+
markQueryable()
|
|
125
|
+
return
|
|
126
|
+
}
|
|
115
127
|
this.resetArrays(paths)
|
|
116
128
|
|
|
117
129
|
chunkStart = performance.now()
|
|
118
130
|
let firstChunk = true
|
|
119
131
|
for (let i = 0; i < paths.length; i++) {
|
|
132
|
+
if (generation !== this.buildGeneration) {
|
|
133
|
+
markQueryable()
|
|
134
|
+
return
|
|
135
|
+
}
|
|
120
136
|
this.indexPath(i)
|
|
121
137
|
if ((i & 0xff) === 0xff && performance.now() - chunkStart > CHUNK_MS) {
|
|
122
138
|
this.readyCount = i + 1
|
|
@@ -125,21 +141,35 @@ export class FileIndex {
|
|
|
125
141
|
firstChunk = false
|
|
126
142
|
}
|
|
127
143
|
await yieldToEventLoop()
|
|
144
|
+
if (generation !== this.buildGeneration) {
|
|
145
|
+
return
|
|
146
|
+
}
|
|
128
147
|
chunkStart = performance.now()
|
|
129
148
|
}
|
|
130
149
|
}
|
|
150
|
+
if (generation !== this.buildGeneration) {
|
|
151
|
+
return
|
|
152
|
+
}
|
|
131
153
|
this.readyCount = paths.length
|
|
132
154
|
markQueryable()
|
|
133
155
|
}
|
|
134
156
|
|
|
135
|
-
private buildIndex(paths: string[]): void {
|
|
157
|
+
private buildIndex(paths: string[], generation: number): void {
|
|
136
158
|
this.resetArrays(paths)
|
|
137
159
|
for (let i = 0; i < paths.length; i++) {
|
|
160
|
+
if (generation !== this.buildGeneration) {
|
|
161
|
+
return
|
|
162
|
+
}
|
|
138
163
|
this.indexPath(i)
|
|
139
164
|
}
|
|
140
165
|
this.readyCount = paths.length
|
|
141
166
|
}
|
|
142
167
|
|
|
168
|
+
private startBuild(): number {
|
|
169
|
+
this.buildGeneration += 1
|
|
170
|
+
return this.buildGeneration
|
|
171
|
+
}
|
|
172
|
+
|
|
143
173
|
private resetArrays(paths: string[]): void {
|
|
144
174
|
const n = paths.length
|
|
145
175
|
this.paths = paths
|
|
@@ -32,11 +32,11 @@ const SURFACE_ATTRIBUTE_KEY = 'ummaya.ui.surface';
|
|
|
32
32
|
const TRACER_NAME = 'ummaya/ui-l2';
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* Emit `ummaya.ui.surface=<surface>` on the active span
|
|
35
|
+
* Emit `ummaya.ui.surface=<surface>` on the active span when present. When no span
|
|
36
36
|
* is active (e.g., outside a tracing context), open and immediately close a
|
|
37
37
|
* one-shot span so the surface activation is recorded.
|
|
38
38
|
*
|
|
39
|
-
* The function is fail-soft:
|
|
39
|
+
* The function is fail-soft: OTEL provider failures become a console
|
|
40
40
|
* warning rather than a crash so a logging fault never blocks the UI.
|
|
41
41
|
*/
|
|
42
42
|
export function emitSurfaceActivation(surface: UiSurface, attrs?: Record<string, string | number | boolean>): void {
|
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
// bun run probe:tool-registry
|
|
10
10
|
//
|
|
11
11
|
// Expected success output:
|
|
12
|
-
// tool_registry: <N> entries verified (
|
|
12
|
+
// tool_registry: <N> entries verified (5 primitives) in <D>ms
|
|
13
13
|
|
|
14
14
|
import { LookupPrimitive } from '../tools/LookupPrimitive/LookupPrimitive.js'
|
|
15
15
|
import { ResolveLocationPrimitive } from '../tools/ResolveLocationPrimitive/ResolveLocationPrimitive.js'
|
|
16
16
|
import { SubmitPrimitive } from '../tools/SubmitPrimitive/SubmitPrimitive.js'
|
|
17
17
|
import { VerifyPrimitive } from '../tools/VerifyPrimitive/VerifyPrimitive.js'
|
|
18
|
+
import { DocumentPrimitive } from '../tools/DocumentPrimitive/DocumentPrimitive.js'
|
|
18
19
|
import { verifyBootRegistry } from '../services/toolRegistry/bootGuard.js'
|
|
19
20
|
import type { Tool } from '../Tool.js'
|
|
20
21
|
|
|
@@ -23,6 +24,7 @@ const primitiveRegistry: readonly Tool[] = [
|
|
|
23
24
|
ResolveLocationPrimitive as unknown as Tool,
|
|
24
25
|
SubmitPrimitive as unknown as Tool,
|
|
25
26
|
VerifyPrimitive as unknown as Tool,
|
|
27
|
+
DocumentPrimitive as unknown as Tool,
|
|
26
28
|
]
|
|
27
29
|
|
|
28
30
|
const result = verifyBootRegistry(primitiveRegistry)
|
|
@@ -47,17 +47,18 @@ export function isProjectOnboardingComplete(): boolean {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export function maybeMarkProjectOnboardingComplete(): void {
|
|
50
|
-
// Short-circuit on cached config — isProjectOnboardingComplete() hits
|
|
51
|
-
// the filesystem, and REPL.tsx calls this on every prompt submit.
|
|
52
50
|
if (getCurrentProjectConfig().hasCompletedProjectOnboarding) {
|
|
53
51
|
return
|
|
54
52
|
}
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
saveCurrentProjectConfig(current => {
|
|
54
|
+
if (current.hasCompletedProjectOnboarding) {
|
|
55
|
+
return current
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
57
58
|
...current,
|
|
58
59
|
hasCompletedProjectOnboarding: true,
|
|
59
|
-
}
|
|
60
|
-
}
|
|
60
|
+
}
|
|
61
|
+
})
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
export const shouldShowProjectOnboarding = memoize((): boolean => {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ChatMessageRole = 'system' | 'user' | 'assistant' | 'tool'
|
|
2
|
+
|
|
3
|
+
export type ChatMessageToolCall = {
|
|
4
|
+
readonly id: string
|
|
5
|
+
readonly type: 'function'
|
|
6
|
+
readonly function: {
|
|
7
|
+
readonly name: string
|
|
8
|
+
readonly arguments: string
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type ChatMessage = {
|
|
13
|
+
readonly role: ChatMessageRole
|
|
14
|
+
readonly content: string
|
|
15
|
+
readonly name?: string | null
|
|
16
|
+
readonly tool_call_id?: string | null
|
|
17
|
+
readonly tool_calls?: readonly ChatMessageToolCall[] | null
|
|
18
|
+
}
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
import type {
|
|
45
45
|
ChatMessage,
|
|
46
46
|
ChatMessageToolCall,
|
|
47
|
-
} from '
|
|
47
|
+
} from './chatMessageTypes.js'
|
|
48
48
|
|
|
49
49
|
// ---------------------------------------------------------------------------
|
|
50
50
|
// Loose input types — mirror the CC ``Message`` shape WITHOUT importing
|
package/tui/src/query/deps.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from 'crypto'
|
|
2
|
-
import { queryModelWithStreaming } from '../services/api/
|
|
2
|
+
import { queryModelWithStreaming } from '../services/api/ummaya.js'
|
|
3
3
|
import { autoCompactIfNeeded } from '../services/compact/autoCompact.js'
|
|
4
4
|
import { microcompactMessages } from '../services/compact/microCompact.js'
|
|
5
5
|
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AssistantMessage,
|
|
3
|
+
Message,
|
|
4
|
+
UserMessage,
|
|
5
|
+
} from '../types/message.js'
|
|
6
|
+
|
|
7
|
+
export type TextBlock = {
|
|
8
|
+
readonly type: 'text'
|
|
9
|
+
readonly text: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type ToolUseBlock = {
|
|
13
|
+
readonly type: 'tool_use'
|
|
14
|
+
readonly id: string
|
|
15
|
+
readonly name: string
|
|
16
|
+
readonly input: Record<string, unknown>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type ContentBlock = TextBlock | ToolUseBlock | Record<string, unknown>
|
|
20
|
+
type MessageContentCarrier = {
|
|
21
|
+
readonly message?: {
|
|
22
|
+
readonly content?: unknown
|
|
23
|
+
}
|
|
24
|
+
readonly content?: unknown
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
28
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function contentBlocks(message: Message): readonly ContentBlock[] {
|
|
32
|
+
const content = messageContent(message)
|
|
33
|
+
return Array.isArray(content) ? content.filter(isRecord) : []
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function messageText(message: Message): string {
|
|
37
|
+
const content = messageContent(message)
|
|
38
|
+
if (typeof content === 'string') return content
|
|
39
|
+
if (!Array.isArray(content)) return ''
|
|
40
|
+
return content
|
|
41
|
+
.filter(isRecord)
|
|
42
|
+
.filter((block): block is TextBlock => block.type === 'text')
|
|
43
|
+
.map(block => block.text)
|
|
44
|
+
.join('')
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function messageContent(message: Message): unknown {
|
|
48
|
+
const candidate = message as MessageContentCarrier
|
|
49
|
+
return candidate.message?.content ?? candidate.content
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function toolUseBlocks(message: Message): readonly ToolUseBlock[] {
|
|
53
|
+
return contentBlocks(message).filter(
|
|
54
|
+
(block): block is ToolUseBlock =>
|
|
55
|
+
block.type === 'tool_use' &&
|
|
56
|
+
typeof block.id === 'string' &&
|
|
57
|
+
typeof block.name === 'string' &&
|
|
58
|
+
isRecord(block.input),
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function isAssistantMessage(message: Message): message is AssistantMessage {
|
|
63
|
+
return message.type === 'assistant'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function isUserMessage(message: Message): message is UserMessage {
|
|
67
|
+
return message.type === 'user'
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function hasVisibleUserText(message: Message): boolean {
|
|
71
|
+
return isUserMessage(message) && message.isMeta !== true &&
|
|
72
|
+
messageText(message).trim().length > 0
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function latestTextUserMessageIndex(messages: readonly Message[]): number {
|
|
76
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
77
|
+
const message = messages[index]
|
|
78
|
+
if (message && hasVisibleUserText(message)) return index
|
|
79
|
+
}
|
|
80
|
+
return -1
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function hasAssistantToolUseNamedAfterLatestTextUser(
|
|
84
|
+
messages: readonly Message[],
|
|
85
|
+
toolName: string,
|
|
86
|
+
): boolean {
|
|
87
|
+
const latestUserIndex = latestTextUserMessageIndex(messages)
|
|
88
|
+
return messages.slice(latestUserIndex + 1).some(
|
|
89
|
+
message =>
|
|
90
|
+
isAssistantMessage(message) &&
|
|
91
|
+
toolUseBlocks(message).some(block => block.name === toolName),
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function cloneAssistantWithoutText(
|
|
96
|
+
message: AssistantMessage,
|
|
97
|
+
): AssistantMessage {
|
|
98
|
+
const blocks = contentBlocks(message).filter(block => block.type !== 'text')
|
|
99
|
+
return {
|
|
100
|
+
...message,
|
|
101
|
+
message: {
|
|
102
|
+
...message.message,
|
|
103
|
+
content: blocks,
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
}
|