ltcai 11.5.2 → 11.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -148
- package/bin/ltcai.js +234 -24
- package/docs/CHANGELOG.md +119 -0
- package/docs/COMMUNITY_AND_PLUGINS.md +1 -1
- package/docs/DEVELOPMENT.md +8 -6
- package/docs/ENTERPRISE.md +2 -1
- package/docs/MULTI_AGENT_RUNTIME.md +12 -5
- package/docs/ONBOARDING.md +1 -1
- package/docs/OPERATIONS.md +6 -3
- package/docs/REALTIME_COLLABORATION.md +1 -1
- package/docs/TRUST_MODEL.md +1 -1
- package/docs/WHY_LATTICE.md +1 -1
- package/docs/WORKFLOW_DESIGNER.md +3 -2
- package/docs/kg-schema.md +1 -1
- package/docs/v11.6.0_ONE_DOOR_PLAN.md +170 -0
- package/lattice_brain/__init__.py +42 -79
- package/lattice_brain/graph/__init__.py +9 -24
- package/lattice_brain/graph/_kg_common/__init__.py +13 -24
- package/lattice_brain/ingestion/__init__.py +19 -58
- package/lattice_brain/ingestion/pipeline.py +20 -398
- package/lattice_brain/multimodal/__init__.py +7 -18
- package/lattice_brain/multimodal/images.py +6 -264
- package/lattice_brain/multimodal/video.py +8 -247
- package/lattice_brain/runtime/__init__.py +8 -79
- package/lattice_brain/runtime/hooks.py +22 -584
- package/latticeai/__init__.py +1 -1
- package/latticeai/api/agent_worker_seam.py +7 -80
- package/latticeai/api/health.py +6 -20
- package/latticeai/api/local_files.py +16 -613
- package/latticeai/api/models.py +12 -87
- package/latticeai/api/search.py +17 -255
- package/latticeai/api/tools.py +69 -750
- package/latticeai/api/voice_capture.py +8 -70
- package/latticeai/api/worker_compute.py +842 -0
- package/latticeai/api/worker_seams.py +216 -0
- package/latticeai/app_factory.py +23 -232
- package/latticeai/cli/entrypoint.py +36 -249
- package/latticeai/core/agent_permission.py +16 -91
- package/latticeai/core/messages.py +89 -531
- package/latticeai/runtime/access_runtime.py +0 -14
- package/latticeai/runtime/bootstrap.py +10 -21
- package/latticeai/runtime/brain_runtime.py +35 -43
- package/latticeai/runtime/build_phases/__init__.py +21 -37
- package/latticeai/runtime/build_phases/features.py +99 -389
- package/latticeai/runtime/build_phases/foundation.py +82 -392
- package/latticeai/runtime/build_phases/web.py +91 -408
- package/latticeai/runtime/build_phases/worker_profile.py +244 -0
- package/latticeai/runtime/lifespan_runtime.py +7 -16
- package/latticeai/runtime/platform_services_runtime.py +1 -15
- package/latticeai/runtime/runtime_context.py +13 -130
- package/latticeai/runtime/security_runtime.py +10 -103
- package/latticeai/services/architecture_readiness.py +82 -43
- package/latticeai/services/model_runtime/__init__.py +2 -11
- package/latticeai/services/model_runtime/service.py +4 -28
- package/latticeai/services/p_reinforce.py +10 -261
- package/latticeai/services/product_readiness.py +31 -38
- package/latticeai/services/search_service.py +37 -795
- package/latticeai/services/tool_dispatch.py +30 -386
- package/latticeai/services/voice_capture.py +13 -107
- package/latticeai/tools/__init__.py +22 -49
- package/latticeai/tools/commands.py +0 -163
- package/latticeai/tools/computer.py +0 -39
- package/latticeai/tools/documents.py +1 -134
- package/latticeai/tools/filesystem.py +1 -247
- package/latticeai/tools/knowledge.py +1 -52
- package/latticeai/tools/local_files.py +0 -20
- package/latticeai/worker_app.py +75 -0
- package/package.json +2 -3
- package/requirements.txt +0 -5
- package/scripts/agent_eval.py +16 -28
- package/scripts/brain_quality_eval.py +20 -183
- package/scripts/bump_version.py +5 -5
- package/scripts/check_current_release_docs.mjs +7 -4
- package/scripts/check_openapi_drift.mjs +10 -0
- package/scripts/check_server_i18n.mjs +2 -18
- package/scripts/compose_openapi.py +377 -0
- package/scripts/export_openapi.py +32 -4
- package/scripts/gen_messages_catalog_fixture.py +302 -0
- package/scripts/gen_openapi_fragments.py +365 -0
- package/scripts/gen_redact_fixture.py +196 -0
- package/scripts/gen_worker_allowlist_fixture.py +115 -0
- package/scripts/generate_agent_parity_fixtures.py +33 -14
- package/scripts/openapi_route_families.json +2161 -0
- package/scripts/release_screen_claims.json +54 -0
- package/scripts/run_integration_tests.mjs +134 -29
- package/scripts/run_sidecar_e2e.mjs +104 -11
- package/scripts/wheel_smoke.py +32 -22
- package/src-tauri/Cargo.lock +375 -9
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/src/backend.rs +151 -45
- package/src-tauri/src/main.rs +18 -18
- package/src-tauri/src/topology.rs +58 -88
- package/src-tauri/tauri.conf.json +1 -2
- package/static/app/asset-manifest.json +41 -41
- package/static/app/assets/{Act-DcQizkl1.js → Act-BPcVAbOL.js} +1 -1
- package/static/app/assets/AdminConsole-Bw1ATQL0.js +1 -0
- package/static/app/assets/{Brain-3VCSHFcn.js → Brain-CT92Kos0.js} +2 -2
- package/static/app/assets/{BrainHome-Qm8eaztx.js → BrainHome-CFBkt1K_.js} +1 -1
- package/static/app/assets/{BrainSignals-DS9BtKOW.js → BrainSignals-ReLWF2H8.js} +1 -1
- package/static/app/assets/Capture-BsTokYkk.js +1 -0
- package/static/app/assets/{Chronicle-BGvuAchH.js → Chronicle-B6f0T9id.js} +1 -1
- package/static/app/assets/{CommandPalette-Bqhm0Urn.js → CommandPalette-CuvjTv1u.js} +1 -1
- package/static/app/assets/{Library-BV6NnF0a.js → Library-BGJbG9Hd.js} +1 -1
- package/static/app/assets/{LivingBrain-GzenJchP.js → LivingBrain-DGYK_Jsa.js} +1 -1
- package/static/app/assets/{ProductFlow-DEP6-vML.js → ProductFlow-DXBC6brE.js} +1 -1
- package/static/app/assets/{ReviewCard-CNZ7XjWG.js → ReviewCard-HXRle3qq.js} +2 -2
- package/static/app/assets/System-CMHSO9qM.js +1 -0
- package/static/app/assets/arrow-left-BfmkskWx.js +1 -0
- package/static/app/assets/{bot-B_K1Tdmw.js → bot-Cn8bWRuq.js} +1 -1
- package/static/app/assets/{brain-DWyaV1L1.js → brain-CQJberbE.js} +1 -1
- package/static/app/assets/{button-aTn4s84A.js → button-Ct9f2_oT.js} +1 -1
- package/static/app/assets/circle-check-DruOxB-4.js +1 -0
- package/static/app/assets/{circle-pause-xKgeGXkT.js → circle-pause-CmzC_apg.js} +1 -1
- package/static/app/assets/{circle-play-DkT6tYPX.js → circle-play-D8mW2aQ7.js} +1 -1
- package/static/app/assets/{cpu-85xYObUC.js → cpu-DZcdd0PZ.js} +1 -1
- package/static/app/assets/{download-B5Fm7YXo.js → download-bv1KEPGQ.js} +1 -1
- package/static/app/assets/{folder-open-kk2Xa52u.js → folder-open-d-Pip5gr.js} +1 -1
- package/static/app/assets/{hard-drive-DkA3zBW_.js → hard-drive-D20iavUb.js} +1 -1
- package/static/app/assets/index-D9x-kSNy.css +2 -0
- package/static/app/assets/{index-BMPdTmlY.js → index-Do83hDzJ.js} +3 -3
- package/static/app/assets/{input-B0nRf2jO.js → input-BLXVNmj1.js} +1 -1
- package/static/app/assets/{link-2-Dwb4gnTc.js → link-2-BPJOFlAy.js} +1 -1
- package/static/app/assets/{permissionCopy-CQDUBrOZ.js → permissionCopy-ChdJd493.js} +1 -1
- package/static/app/assets/primitives-Cv5tbZBY.js +1 -0
- package/static/app/assets/search-CT9aho2j.js +1 -0
- package/static/app/assets/{share-2-BsrxFglO.js → share-2-YNX_NtMU.js} +1 -1
- package/static/app/assets/{shield-alert-5BStfp2_.js → shield-alert-DuQ3zrVL.js} +1 -1
- package/static/app/assets/{textarea-Cg8IUA-k.js → textarea-DqwLnli4.js} +1 -1
- package/static/app/assets/{useFocusTrap-CYKvE46M.js → useFocusTrap-ZVI98jaW.js} +1 -1
- package/static/app/assets/{useMutation-CSn9t1op.js → useMutation-CVC4qv_D.js} +1 -1
- package/static/app/assets/{useQuery-CY2OI2uy.js → useQuery-C7BeG4HU.js} +1 -1
- package/static/app/assets/{utils-Ddol2RWD.js → utils-CiFtIdZq.js} +1 -1
- package/static/app/assets/{workspace-BqDwOz_p.js → workspace-DQz9vIId.js} +1 -1
- package/static/app/index.html +4 -4
- package/static/sw.js +1 -1
- package/lattice_brain/archive.py +0 -522
- package/lattice_brain/context.py +0 -325
- package/lattice_brain/conversations.py +0 -382
- package/lattice_brain/core.py +0 -82
- package/lattice_brain/graph/_kg_contract.py +0 -249
- package/lattice_brain/graph/curator.py +0 -676
- package/lattice_brain/graph/discovery.py +0 -595
- package/lattice_brain/graph/discovery_index/__init__.py +0 -35
- package/lattice_brain/graph/discovery_index/cleanup.py +0 -182
- package/lattice_brain/graph/discovery_index/extract.py +0 -137
- package/lattice_brain/graph/discovery_index/scan.py +0 -411
- package/lattice_brain/graph/discovery_index/upsert.py +0 -495
- package/lattice_brain/graph/documents.py +0 -380
- package/lattice_brain/graph/fusion.py +0 -395
- package/lattice_brain/graph/identity.py +0 -175
- package/lattice_brain/graph/image_vectors.py +0 -230
- package/lattice_brain/graph/ingest.py +0 -829
- package/lattice_brain/graph/network.py +0 -205
- package/lattice_brain/graph/proactive.py +0 -724
- package/lattice_brain/graph/projection/__init__.py +0 -42
- package/lattice_brain/graph/projection/curation.py +0 -500
- package/lattice_brain/graph/projection/v2_schema.py +0 -518
- package/lattice_brain/graph/provenance.py +0 -524
- package/lattice_brain/graph/rerank.py +0 -163
- package/lattice_brain/graph/retrieval/__init__.py +0 -54
- package/lattice_brain/graph/retrieval/context.py +0 -197
- package/lattice_brain/graph/retrieval/graph_view.py +0 -319
- package/lattice_brain/graph/retrieval/hybrid.py +0 -488
- package/lattice_brain/graph/retrieval/maintenance.py +0 -121
- package/lattice_brain/graph/retrieval/signals.py +0 -95
- package/lattice_brain/graph/retrieval_docgen.py +0 -253
- package/lattice_brain/graph/retrieval_policy.py +0 -180
- package/lattice_brain/graph/retrieval_reads.py +0 -769
- package/lattice_brain/graph/retrieval_vector/__init__.py +0 -42
- package/lattice_brain/graph/retrieval_vector/fingerprint.py +0 -97
- package/lattice_brain/graph/retrieval_vector/indexing.py +0 -347
- package/lattice_brain/graph/retrieval_vector/search.py +0 -560
- package/lattice_brain/graph/retrieval_vector/status.py +0 -374
- package/lattice_brain/graph/schema.py +0 -792
- package/lattice_brain/graph/store.py +0 -268
- package/lattice_brain/graph/vector_index/__init__.py +0 -85
- package/lattice_brain/graph/vector_index/base.py +0 -167
- package/lattice_brain/graph/vector_index/brute_force.py +0 -110
- package/lattice_brain/graph/vector_index/hnsw.py +0 -290
- package/lattice_brain/graph/vector_index/jobs.py +0 -287
- package/lattice_brain/graph/vector_index/quantized.py +0 -148
- package/lattice_brain/graph/vector_index/selector.py +0 -161
- package/lattice_brain/graph/write_master.py +0 -308
- package/lattice_brain/ingestion/_contract.py +0 -90
- package/lattice_brain/ingestion/folder_scan.py +0 -57
- package/lattice_brain/ingestion/folders.py +0 -258
- package/lattice_brain/ingestion/jobs_api.py +0 -107
- package/lattice_brain/ingestion/routing.py +0 -295
- package/lattice_brain/ingestion_jobs.py +0 -380
- package/lattice_brain/memory.py +0 -75
- package/lattice_brain/portability/__init__.py +0 -90
- package/lattice_brain/portability/_contract.py +0 -42
- package/lattice_brain/portability/backups.py +0 -338
- package/lattice_brain/portability/bundles.py +0 -136
- package/lattice_brain/portability/constants.py +0 -93
- package/lattice_brain/portability/fsops.py +0 -138
- package/lattice_brain/portability/service.py +0 -41
- package/lattice_brain/portability/sharing.py +0 -710
- package/lattice_brain/quality.py +0 -543
- package/lattice_brain/retrieval_benchmark_fixtures.py +0 -92
- package/lattice_brain/runtime/agent_runtime.py +0 -859
- package/lattice_brain/runtime/contracts.py +0 -460
- package/lattice_brain/runtime/multi_agent.py +0 -942
- package/lattice_brain/runtime/statuses.py +0 -10
- package/lattice_brain/sealed_box.py +0 -240
- package/lattice_brain/self_model.py +0 -675
- package/lattice_brain/sensitivity.py +0 -94
- package/lattice_brain/storage/__init__.py +0 -22
- package/lattice_brain/storage/base.py +0 -100
- package/lattice_brain/storage/docker.py +0 -105
- package/lattice_brain/storage/factory.py +0 -31
- package/lattice_brain/storage/migration.py +0 -191
- package/lattice_brain/storage/postgres.py +0 -123
- package/lattice_brain/storage/sqlite.py +0 -143
- package/lattice_brain/synthesis.py +0 -824
- package/lattice_brain/workflow.py +0 -497
- package/latticeai/api/admin.py +0 -471
- package/latticeai/api/agent_registry.py +0 -105
- package/latticeai/api/agents.py +0 -228
- package/latticeai/api/auth.py +0 -383
- package/latticeai/api/automation_intelligence.py +0 -401
- package/latticeai/api/brain_intelligence.py +0 -199
- package/latticeai/api/browser.py +0 -493
- package/latticeai/api/change_proposals.py +0 -89
- package/latticeai/api/chat.py +0 -572
- package/latticeai/api/chat_agent_http.py +0 -892
- package/latticeai/api/chat_contracts.py +0 -73
- package/latticeai/api/chat_documents.py +0 -276
- package/latticeai/api/chat_helpers.py +0 -460
- package/latticeai/api/chat_history.py +0 -101
- package/latticeai/api/chat_hybrid.py +0 -113
- package/latticeai/api/chat_intents.py +0 -646
- package/latticeai/api/chat_stream.py +0 -216
- package/latticeai/api/chronicle.py +0 -63
- package/latticeai/api/command_center.py +0 -51
- package/latticeai/api/computer_use.py +0 -474
- package/latticeai/api/evidence_actions.py +0 -48
- package/latticeai/api/features.py +0 -70
- package/latticeai/api/funnel_metrics.py +0 -31
- package/latticeai/api/garden.py +0 -34
- package/latticeai/api/hooks.py +0 -165
- package/latticeai/api/index_jobs.py +0 -145
- package/latticeai/api/invitations.py +0 -100
- package/latticeai/api/knowledge_graph.py +0 -536
- package/latticeai/api/marketplace.py +0 -105
- package/latticeai/api/mcp.py +0 -482
- package/latticeai/api/memory.py +0 -270
- package/latticeai/api/network.py +0 -81
- package/latticeai/api/network_boundary.py +0 -225
- package/latticeai/api/permission_mode.py +0 -61
- package/latticeai/api/permissions.py +0 -436
- package/latticeai/api/plugins.py +0 -126
- package/latticeai/api/portability.py +0 -391
- package/latticeai/api/project_sessions.py +0 -114
- package/latticeai/api/realtime.py +0 -118
- package/latticeai/api/review_queue.py +0 -364
- package/latticeai/api/security_dashboard.py +0 -604
- package/latticeai/api/setup.py +0 -319
- package/latticeai/api/static_routes.py +0 -354
- package/latticeai/api/ui_redirects.py +0 -26
- package/latticeai/api/workflow_designer.py +0 -394
- package/latticeai/api/workspace.py +0 -856
- package/latticeai/api/workspace_scope.py +0 -125
- package/latticeai/core/agent/__init__.py +0 -93
- package/latticeai/core/agent/_contract.py +0 -79
- package/latticeai/core/agent/context.py +0 -57
- package/latticeai/core/agent/deps.py +0 -125
- package/latticeai/core/agent/execution.py +0 -622
- package/latticeai/core/agent/planning.py +0 -145
- package/latticeai/core/agent/recovery.py +0 -157
- package/latticeai/core/agent/runtime.py +0 -210
- package/latticeai/core/agent/verification.py +0 -231
- package/latticeai/core/agent_eval.py +0 -739
- package/latticeai/core/agent_helpers.py +0 -493
- package/latticeai/core/agent_profiles.py +0 -110
- package/latticeai/core/agent_prompts.py +0 -171
- package/latticeai/core/agent_registry.py +0 -232
- package/latticeai/core/agent_state.py +0 -41
- package/latticeai/core/agent_trace.py +0 -104
- package/latticeai/core/artifact_ledger.py +0 -109
- package/latticeai/core/audit.py +0 -260
- package/latticeai/core/builtin_hooks.py +0 -105
- package/latticeai/core/context_builder.py +0 -394
- package/latticeai/core/document_generator.py +0 -103
- package/latticeai/core/enterprise.py +0 -154
- package/latticeai/core/enterprise_admin.py +0 -158
- package/latticeai/core/file_generation/__init__.py +0 -115
- package/latticeai/core/file_generation/bundles.py +0 -76
- package/latticeai/core/file_generation/extraction.py +0 -154
- package/latticeai/core/file_generation/inference.py +0 -235
- package/latticeai/core/file_generation/orchestration.py +0 -152
- package/latticeai/core/file_generation/prompting.py +0 -117
- package/latticeai/core/file_generation/repair.py +0 -114
- package/latticeai/core/file_generation/sanitize.py +0 -61
- package/latticeai/core/file_generation/validation.py +0 -201
- package/latticeai/core/invitations.py +0 -132
- package/latticeai/core/legacy_compatibility.py +0 -243
- package/latticeai/core/logging_safety.py +0 -46
- package/latticeai/core/marketplace.py +0 -293
- package/latticeai/core/mcp_catalog.py +0 -452
- package/latticeai/core/mcp_registry.py +0 -506
- package/latticeai/core/network_boundary.py +0 -168
- package/latticeai/core/oidc.py +0 -208
- package/latticeai/core/plugins.py +0 -432
- package/latticeai/core/product_hardening.py +0 -218
- package/latticeai/core/project_sessions.py +0 -337
- package/latticeai/core/realtime.py +0 -238
- package/latticeai/core/run_explain.py +0 -426
- package/latticeai/core/run_store.py +0 -252
- package/latticeai/core/timezones.py +0 -80
- package/latticeai/core/workspace_computer_memory.py +0 -84
- package/latticeai/core/workspace_graph_trace.py +0 -155
- package/latticeai/core/workspace_indexing.py +0 -102
- package/latticeai/core/workspace_memory.py +0 -77
- package/latticeai/core/workspace_onboarding.py +0 -104
- package/latticeai/core/workspace_os.py +0 -978
- package/latticeai/core/workspace_os_constants.py +0 -126
- package/latticeai/core/workspace_os_state.py +0 -180
- package/latticeai/core/workspace_os_utils.py +0 -103
- package/latticeai/core/workspace_permissions.py +0 -101
- package/latticeai/core/workspace_plugins.py +0 -97
- package/latticeai/core/workspace_relationships.py +0 -99
- package/latticeai/core/workspace_reorganization.py +0 -335
- package/latticeai/core/workspace_review_items.py +0 -112
- package/latticeai/core/workspace_runs.py +0 -726
- package/latticeai/core/workspace_skills.py +0 -109
- package/latticeai/core/workspace_snapshots.py +0 -198
- package/latticeai/core/workspace_timeline.py +0 -110
- package/latticeai/integrations/__init__.py +0 -0
- package/latticeai/integrations/telegram_bot/__init__.py +0 -123
- package/latticeai/integrations/telegram_bot/__main__.py +0 -17
- package/latticeai/integrations/telegram_bot/config.py +0 -86
- package/latticeai/integrations/telegram_bot/dispatch.py +0 -311
- package/latticeai/integrations/telegram_bot/flows.py +0 -478
- package/latticeai/integrations/telegram_bot/helpers.py +0 -322
- package/latticeai/integrations/telegram_bot/screens.py +0 -394
- package/latticeai/runtime/audit_runtime.py +0 -76
- package/latticeai/runtime/automation_runtime.py +0 -81
- package/latticeai/runtime/chat_wiring.py +0 -141
- package/latticeai/runtime/context_runtime.py +0 -66
- package/latticeai/runtime/feature_toggle_wiring.py +0 -157
- package/latticeai/runtime/history_runtime.py +0 -163
- package/latticeai/runtime/history_writer.py +0 -138
- package/latticeai/runtime/hooks_runtime.py +0 -77
- package/latticeai/runtime/model_wiring.py +0 -68
- package/latticeai/runtime/namespace_runtime.py +0 -163
- package/latticeai/runtime/network_boundary_wiring.py +0 -117
- package/latticeai/runtime/network_config_runtime.py +0 -56
- package/latticeai/runtime/permission_mode_wiring.py +0 -112
- package/latticeai/runtime/persistence_runtime.py +0 -159
- package/latticeai/runtime/platform_runtime_wiring.py +0 -89
- package/latticeai/runtime/review_wiring.py +0 -42
- package/latticeai/runtime/router_registration.py +0 -693
- package/latticeai/runtime/service_singletons.py +0 -55
- package/latticeai/runtime/sso_config_runtime.py +0 -128
- package/latticeai/runtime/user_key_runtime.py +0 -106
- package/latticeai/runtime/web_runtime.py +0 -92
- package/latticeai/server_app.py +0 -51
- package/latticeai/services/app_context.py +0 -130
- package/latticeai/services/automation_execution.py +0 -266
- package/latticeai/services/automation_intelligence.py +0 -614
- package/latticeai/services/brain_automation.py +0 -191
- package/latticeai/services/brain_intelligence/__init__.py +0 -58
- package/latticeai/services/brain_intelligence/_contract.py +0 -71
- package/latticeai/services/brain_intelligence/consistency.py +0 -193
- package/latticeai/services/brain_intelligence/constants.py +0 -47
- package/latticeai/services/brain_intelligence/digest.py +0 -258
- package/latticeai/services/brain_intelligence/health.py +0 -331
- package/latticeai/services/brain_intelligence/proposals.py +0 -259
- package/latticeai/services/brain_intelligence/sampling.py +0 -84
- package/latticeai/services/brain_intelligence/service.py +0 -48
- package/latticeai/services/change_proposals.py +0 -471
- package/latticeai/services/chat_service.py +0 -243
- package/latticeai/services/chronicle.py +0 -555
- package/latticeai/services/cloud_egress_audit.py +0 -85
- package/latticeai/services/cloud_extraction.py +0 -129
- package/latticeai/services/cloud_streaming.py +0 -268
- package/latticeai/services/cloud_token_guard.py +0 -84
- package/latticeai/services/command_center.py +0 -548
- package/latticeai/services/evidence_actions.py +0 -258
- package/latticeai/services/feature_toggles.py +0 -502
- package/latticeai/services/folder_watch.py +0 -520
- package/latticeai/services/funnel_metrics.py +0 -307
- package/latticeai/services/hybrid_chat.py +0 -316
- package/latticeai/services/hybrid_context.py +0 -228
- package/latticeai/services/hybrid_policy.py +0 -129
- package/latticeai/services/interop_bridges.py +0 -978
- package/latticeai/services/local_knowledge.py +0 -465
- package/latticeai/services/memory_service/__init__.py +0 -52
- package/latticeai/services/memory_service/_contract.py +0 -100
- package/latticeai/services/memory_service/brief.py +0 -431
- package/latticeai/services/memory_service/constants.py +0 -57
- package/latticeai/services/memory_service/maintenance.py +0 -138
- package/latticeai/services/memory_service/manager.py +0 -186
- package/latticeai/services/memory_service/proof.py +0 -136
- package/latticeai/services/memory_service/recall.py +0 -225
- package/latticeai/services/memory_service/service.py +0 -48
- package/latticeai/services/memory_service/stores.py +0 -110
- package/latticeai/services/mode_store.py +0 -132
- package/latticeai/services/model_recommendation.py +0 -224
- package/latticeai/services/model_runtime/cloud.py +0 -87
- package/latticeai/services/network_boundary_service.py +0 -117
- package/latticeai/services/obsidian_bridge.py +0 -609
- package/latticeai/services/openai_compatible_adapter.py +0 -101
- package/latticeai/services/permission_mode_service.py +0 -122
- package/latticeai/services/platform_runtime.py +0 -366
- package/latticeai/services/review_queue.py +0 -380
- package/latticeai/services/router_context.py +0 -59
- package/latticeai/services/run_executor.py +0 -387
- package/latticeai/services/self_model_service.py +0 -171
- package/latticeai/services/setup_detection.py +0 -147
- package/latticeai/services/triggers.py +0 -378
- package/latticeai/services/upload_service.py +0 -172
- package/latticeai/services/workspace_service.py +0 -165
- package/latticeai/setup/__init__.py +0 -25
- package/latticeai/setup/auto_setup.py +0 -846
- package/latticeai/setup/demo_corpus.py +0 -98
- package/latticeai/setup/wizard/__init__.py +0 -126
- package/latticeai/setup/wizard/catalog.py +0 -175
- package/latticeai/setup/wizard/detect.py +0 -302
- package/latticeai/setup/wizard/install.py +0 -348
- package/latticeai/setup/wizard/paths.py +0 -165
- package/latticeai/setup/wizard/plans.py +0 -74
- package/latticeai/setup/wizard/recommend.py +0 -320
- package/scripts/bench_agent_smoke.py +0 -409
- package/scripts/bench_models.py +0 -540
- package/scripts/bench_vector_index.py +0 -295
- package/scripts/funnel_soft_gate.py +0 -192
- package/scripts/generate_agent_loop_fixtures.py +0 -994
- package/scripts/generate_rust_parity_fixtures.py +0 -908
- package/scripts/migrate_brain_storage.py +0 -57
- package/scripts/parity_fixture_corpus_context.py +0 -162
- package/scripts/parity_fixture_corpus_docgen.py +0 -341
- package/scripts/profile_kg.py +0 -355
- package/server.py +0 -30
- package/static/app/assets/AdminConsole-cf4npybT.js +0 -1
- package/static/app/assets/Capture-DiQ219jW.js +0 -1
- package/static/app/assets/System-CieofHQa.js +0 -1
- package/static/app/assets/arrow-left-kfsrk0mv.js +0 -1
- package/static/app/assets/circle-check-qqLug9nU.js +0 -1
- package/static/app/assets/index-DxmOfNRi.css +0 -2
- package/static/app/assets/primitives-SNp0LRJz.js +0 -1
- package/static/app/assets/search-BcHqkjoy.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,_ as t,a as n,b as r,d as i,m as a,n as o,o as s,t as c,x as l}from"./utils-Ddol2RWD.js";import{r as u,t as d}from"./useQuery-CY2OI2uy.js";import{t as f}from"./useMutation-CSn9t1op.js";import{t as p}from"./circle-check-qqLug9nU.js";import{t as m}from"./circle-pause-xKgeGXkT.js";import{d as ee,l as h,s as g}from"./index-BMPdTmlY.js";var te=t(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),_=t(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),v=t(`database-backup`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 12a9 3 0 0 0 5 2.69`,key:`1ui2ym`}],[`path`,{d:`M21 9.3V5`,key:`6k6cib`}],[`path`,{d:`M3 5v14a9 3 0 0 0 6.47 2.88`,key:`i62tjy`}],[`path`,{d:`M12 12v4h4`,key:`1bxaet`}],[`path`,{d:`M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16`,key:`1f4ei9`}]]),y=t(`folder-sync`,[[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5`,key:`1dkoa9`}],[`path`,{d:`M12 10v4h4`,key:`1czhmt`}],[`path`,{d:`m12 14 1.535-1.605a5 5 0 0 1 8 1.5`,key:`lvuxfi`}],[`path`,{d:`M22 22v-4h-4`,key:`1ewp4q`}],[`path`,{d:`m22 18-1.535 1.605a5 5 0 0 1-8-1.5`,key:`14ync0`}]]),b=e(l());function ne(e){return c(e).flatMap(e=>{let t=V(e,[`id`,`conversation_id`]);return t?[{id:t,title:V(e,[`title`,`summary`,`last_message`],t).trim(),messageCount:Math.max(0,Math.round(G(e,[`message_count`,`messages`]))),updatedAt:U(e,[`updated_at`,`updatedAt`,`created_at`,`createdAt`])}]:[]}).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0))}function re(e){return c((B(e)?e:{}).messages).flatMap(e=>{let t=V(e,[`role`]),n=typeof e.content==`string`?e.content:``;return t!==`user`&&t!==`assistant`||!n.trim()?[]:[{role:t,content:n}]})}function ie(e,t,n){let r=V(e,[`id`]);if(r){let e=`brain.memoryTier.${r}`,n=a(t,e);if(n!==e)return n}return n}function ae(e,t,n=`ko`){let r=B(e)?e:{},i=(c(r.sources).length?c(r.sources):c(r.tiers)).map((e,t)=>({id:V(e,[`id`,`source`,`label`],`memory-${t}`),title:ie(e,n,V(e,[`title`,`label`,`source`,`path`,`name`],`Workspace memory`)),kind:H(e,[`type`,`source_type`,`kind`,`health`],`Memory`),tags:[],agentGenerated:!1})),a=c(r.recent_memories||r.recentMemories).map((e,t)=>{let n=B(e.metadata)?e.metadata:{},r=W(e,[`tags`]),i=V(e,[`content`,`summary`,`detail`]),a=V(n,[`source`]),o=r.includes(`agent-synthesis`)||a===`agent_runtime`||a===`agent_runtime_synthesis`;return{id:V(e,[`id`],`recent-memory-${t}`),title:i?i.replace(/\s+/g,` `).slice(0,96):H(e,[`kind`],`Memory`),kind:H(e,[`kind`],`Memory`),detail:i,tags:r,agentGenerated:o}}),o=c(t).map((e,t)=>({id:V(e,[`id`,`conversation_id`],`conversation-${t}`),title:V(e,[`title`,`summary`,`id`],`Conversation`),kind:`Conversation`,tags:[],agentGenerated:!1}));return F([...a,...i,...o]).slice(0,12)}function oe(e){let t=B(e)?e:{},n=c(t.nodes),r=c(t.edges),i=n.flatMap(e=>{let t=V(e,[`id`,`node_id`,`title`,`label`]);if(!t)return[];let n=B(e.metadata)?e.metadata:{},r=H(e,[`type`,`kind`,`category`],`Concept`),i=V(e,[`title`,`label`,`name`],t.replace(/^[^:]+:/,``)),a=V(e,[`summary`,`description`,`snippet`])||V(n,[`summary`,`description`,`relative_path`,`filename`]),s=o(G(e,[`importance_norm`,`importance`,`score`])||.5,.08,1),c=U(e,[`created_at`,`createdAt`,`added_at`,`addedAt`,`timestamp`,`updated_at`,`updatedAt`])??U(n,[`created_at`,`createdAt`,`added_at`,`addedAt`,`timestamp`,`updated_at`,`updatedAt`]);return[{id:t,label:i,type:r,summary:a,importance:s,...c===void 0?{}:{createdAt:c}}]}).sort((e,t)=>t.importance-e.importance),a=new Set(i.map(e=>e.id));return{nodes:i,edges:r.flatMap((e,t)=>{let n=V(e,[`from`,`source`,`source_id`]),r=V(e,[`to`,`target`,`target_id`]);return!n||!r||!a.has(n)||!a.has(r)?[]:[{id:V(e,[`id`],`edge-${t}`),source:n,target:r,label:H(e,[`type`,`label`,`relationship`],`Relates`),weight:G(e,[`weight`,`score`,`confidence`])||1}]})}}function se(e){let t=B(e)?e:{},n=[t,t.knowledge_graph,t.ingestion,t.result].filter(B),r=new Set,i=0,a,o;for(let e of n){let t=V(e,[`node_id`,`graph_node`,`graph_node_id`]);t&&r.add(t);for(let t of c(e.indexed_nodes))if(typeof t==`string`&&t.trim())r.add(t.trim());else if(B(t)){let e=V(t,[`node_id`,`graph_node_id`,`id`]);e&&r.add(e)}i=Math.max(i,G(e,[`chunk_count`,`chunks`,`indexed_count`])),typeof e.duplicate==`boolean`&&(a=e.duplicate),o||=V(e,[`provenance_id`])}let s;for(let e of n){let t=ce(e);if(t){s=t;break}}return{nodeIds:Array.from(r),chunkCount:i,...a===void 0?{}:{duplicate:a},...o?{provenanceId:o}:{},...s?{extraction:s}:{}}}function ce(e){let t=B(e)?e:{},n=B(t.extraction_quality)?t.extraction_quality:null;if(!n)return null;let r=V(n,[`level`]);if(r!==`high`&&r!==`medium`&&r!==`low`)return null;let i=W(t,[`warnings`]).length?W(t,[`warnings`]):W(n,[`warnings`]);return{score:G(n,[`score`]),level:r,reasons:W(n,[`reasons`]),warnings:i}}function le(e){let t=B(e)?e:{},n=B(t.context_quality)?t.context_quality:null,r=!n&&B(t.trace)&&B(t.trace.context_quality)?t.trace.context_quality:null,i=n||r||(typeof t.mode==`string`&&typeof t.limited==`boolean`?t:null);if(!i)return null;let a=V(i,[`mode`]);if(!a)return null;let o=typeof i.reason==`string`&&i.reason.trim()?i.reason.trim():null;return{mode:a,nodes:Math.max(0,Math.round(G(i,[`nodes`]))),limited:K(i,[`limited`],!1),reason:o}}function ue(e){let t=B(e)?e:{},n=(B(t.grounding)?t.grounding:null)||(typeof t.status==`string`&&`label`in t?t:null);if(!n)return null;let r=V(n,[`status`]);return[`supported`,`unsupported`,`no_context`].includes(r)?{status:r,reason:typeof n.reason==`string`&&n.reason.trim()?n.reason.trim():null}:null}function x(e){if(!B(e))return null;let t=V(e,[`status`]);if(t!==`ok`&&t!==`pending`&&t!==`failed`)return null;let n=V(e,[`detail`]);return{status:t,...n?{detail:n}:{}}}function de(e){let t=!!e.generation?.repaired,n=new Map;for(let t of e.artifacts||[])t&&typeof t.path==`string`&&n.set(t.path,!!t.previewable);let r=new Map,i=null;if(Array.isArray(e.brain_ingest))for(let t of e.brain_ingest){let e=x(t);e&&B(t)&&typeof t.path==`string`&&r.set(t.path,e)}else i=x(e.brain_ingest);let a=e.created_files||[];return a.map(e=>{let o=r.get(e.path)||(a.length===1?i:null);return{path:e.path,filename:e.filename||e.path.split(`/`).pop()||e.path,bytes:e.bytes||0,repaired:t,...n.has(e.path)?{previewable:n.get(e.path)}:{},...o?{brainIngest:o}:{}}})}function fe(e){if(!B(e))return null;let t=V(e,[`phase`]),n=V(e,[`event`]);if(!t||!n)return null;let r=Number(e.step);return{phase:t,event:n,...V(e,[`action`])?{action:V(e,[`action`])}:{},...V(e,[`path`])?{path:V(e,[`path`])}:{},...Number.isFinite(r)?{step:Math.round(r)}:{},...typeof e.ok==`boolean`?{ok:e.ok}:{},...V(e,[`decision`])?{decision:V(e,[`decision`])}:{},...V(e,[`verdict`])?{verdict:V(e,[`verdict`])}:{},...V(e,[`state`])?{state:V(e,[`state`])}:{},...V(e,[`detail`,`error`])?{detail:V(e,[`detail`,`error`])}:{}}}function pe(e){return c(e).flatMap(e=>{if(!B(e))return[];let t=V(e,[`action`,`tool`]),n=V(e,[`state`]),r=V(e,[`error`]);if(!t&&!n&&!r)return[];let i=V(B(e.args)?e.args:{},[`path`,`target`,`file`]);return t?[{phase:`execute`,event:`tool`,action:t,...i?{path:i}:{},ok:!r,...r?{detail:r}:{}}]:r?[{phase:`execute`,event:`state`,...n?{state:n}:{},ok:!1,detail:r}]:[{phase:`terminal`,event:`state`,state:n}]})}function me(e){if(!B(e))return null;let t={};if(B(e.repairs))for(let[n,r]of Object.entries(e.repairs)){let e=Number(r);Number.isFinite(e)&&e>0&&(t[n]=Math.round(e))}let n=Math.max(0,Math.round(G(e,[`parse_errors`,`parseErrors`]))),r=Math.max(0,Math.round(G(e,[`parse_recovered`,`parseRecovered`]))),i=Object.values(t).reduce((e,t)=>e+t,0)+r;return i<1?null:{repairs:t,parseErrors:n,parseRecovered:r,total:i}}function S(e,t){if(!B(e))return null;let n=e=>{if(!B(e))return``;let n=e[t];return typeof n==`string`?n:``},r=n(e.headline),i=c(e.details).map(n).filter(Boolean),a=V(e,[`code`]);if(!r&&!i.length)return null;let o=B(e.model_strain)?V(e.model_strain,[`level`]):``,s=o===`light`||o===`moderate`||o===`heavy`?o:`none`,l=e.ok===!0;return l&&!i.length?null:{code:a,ok:l,headline:r,details:i,strainLevel:s}}function C(e){return c((B(e)?e:{}).pending).flatMap(e=>{let t=V(e,[`run_id`,`runId`]);return t?[{runId:t,goal:V(e,[`goal`]),expiresAt:V(e,[`expires_at`,`expiresAt`])}]:[]})}function w(e){let t=B(e)?e:{},n=c(t.watches).flatMap(e=>{if(!B(e))return[];let t=V(e,[`id`]),n=V(e,[`path`]);if(!t&&!n)return[];let r=B(e.last_result)?e.last_result:null,i=c(e.last_errors).flatMap(e=>{if(typeof e==`string`&&e.trim())return[{path:``,detail:e.trim()}];if(!B(e))return[];let t=V(e,[`detail`,`reason`,`error`]),n=V(e,[`path`,`source`,`file`]);return!t&&!n?[]:[{path:n,detail:t}]});return[{id:t||n,path:n,enabled:K(e,[`enabled`],!1),lastScanAt:V(e,[`last_scan_at`,`lastScanAt`]),lastResult:r?{status:V(r,[`status`]),ingested:Math.max(0,Math.round(G(r,[`ingested`]))),failed:Math.max(0,Math.round(G(r,[`failed`])))}:null,trackedFiles:Math.max(0,Math.round(G(e,[`tracked_files`,`trackedFiles`]))),lastErrors:i.slice(0,3)}]});return{enabledCount:Math.max(0,Math.round(G(t,[`enabled_count`,`enabledCount`]))),polling:K(t,[`polling`],!1),intervalSeconds:Math.max(0,Math.round(G(t,[`interval_seconds`,`intervalSeconds`]))),watches:n}}function T(e){let t=B(e)?e:{};return{status:V(t,[`status`],`unavailable`),pendingItems:Math.max(0,Math.round(G(t,[`pending_items`,`pendingItems`]))),totalItems:Math.max(0,Math.round(G(t,[`total_items`,`totalItems`]))),detail:V(t,[`detail`])}}function E(e){return typeof e==`string`?e.trim():B(e)?[V(e,[`source`,`path`,`file`]),V(e,[`detail`,`reason`,`error`])].filter(Boolean).join(` — `):``}function D(e){return c((B(e)?e:{}).jobs).flatMap(e=>{let t=V(e,[`job_id`,`jobId`,`id`]);if(!t)return[];let n=V(e,[`created_at`,`createdAt`]),r=V(e,[`updated_at`,`updatedAt`]);return[{jobId:t,status:V(e,[`status`],`queued`),total:Math.max(0,Math.round(G(e,[`total`]))),processed:Math.max(0,Math.round(G(e,[`processed`]))),failed:Math.max(0,Math.round(G(e,[`failed`]))),errors:c(e.errors).map(E).filter(Boolean).slice(0,10),...n?{createdAt:n}:{},...r?{updatedAt:r}:{}}]})}function O(e,t){for(let n of[`recommended`,`cloud`,`loaded`,`loaded_models`,`models`])for(let r of c(e[n])){if(V(r,[`id`,`model_id`,`name`])!==t)continue;let e=V(r,[`display_name`,`model_name`,`name`]);if(e&&e!==t)return e}return``}function k(e){let t=B(e)?e:{},r=V(t,[`current`,`current_model`,`local_model`]);if(r)return O(t,r)||n(r);let i=c(t.loaded||t.loaded_models).find(e=>e.id||e.name||e.model_id);if(!i)return`local mind`;let a=V(i,[`display_name`,`model_name`,`name`]),o=V(i,[`id`,`model_id`]);return a&&a!==o?a:o?O(t,o)||n(o):`local mind`}function A(e){let t=B(e)?e:{};return V(t,[`current`,`current_model`,`local_model`])?!0:c(t.loaded||t.loaded_models).some(e=>e.id||e.name||e.model_id)}function j(e,t,n){let r=B(e)?e:{},i=B(r.brain_readiness)?r.brain_readiness:{},a=V(i,[`state`]),s=G(i,[`depth`]),c=G(i,[`score`]);if((a===`quiet`||a===`forming`||a===`alive`)&&z(s)){let e=B(i.signals)?i.signals:{};return{score:o(Math.round(c||0),0,100),state:a,depth:s,titleKey:V(i,[`title_key`,`titleKey`],`brain.readiness.${a}`),actionKey:V(i,[`action_key`,`actionKey`],R(a)),source:`memory_service`,signals:{memoryCount:G(e,[`memory_count`,`memoryCount`]),conceptCount:G(e,[`concept_count`,`conceptCount`]),relationshipCount:G(e,[`relationship_count`,`relationshipCount`]),healthySources:G(e,[`healthy_sources`,`healthySources`])}}}return L(t,n)}function M(e,t=``){let n=B(e)&&typeof e.ok==`boolean`&&`data`in e?e:null;if(n&&!n.ok)return N(t);let r=n?n.data:e,i=B(r)?r:{},a=B(i.model_continuity)?i.model_continuity:{},o=B(i.proofs)?i.proofs:{},s=B(i.recall)?i.recall:{},l=B(i.claims)?i.claims:{},u=G(o,[`durable_items`,`durableItems`]);return{status:V(i,[`status`],`quiet`),modelContinuity:{activeModel:V(a,[`active_model`,`activeModel`],t),brainOwner:V(a,[`brain_owner`,`brainOwner`],`lattice_brain`),capability:K(a,[`capability`],!0),survivesModelSwitch:K(a,[`survives_model_switch`,`survivesModelSwitch`],!1),proven:K(a,[`proven`],!1),contextStore:V(a,[`context_store`,`contextStore`],`workspace + conversation + graph + vector`)},proofs:{durableItems:u,hasDurableEvidence:K(o,[`has_durable_evidence`,`hasDurableEvidence`],u>0),workspaceMemories:G(o,[`workspace_memories`,`workspaceMemories`]),conversations:G(o,[`conversations`]),graphConcepts:G(o,[`graph_concepts`,`graphConcepts`]),vectorItems:G(o,[`vector_items`,`vectorItems`]),healthySources:G(o,[`healthy_sources`,`healthySources`])},recall:{query:V(s,[`query`]),count:G(s,[`count`]),items:c(s.items).map((e,t)=>({id:V(e,[`id`],`recall-${t}`),source:H(e,[`source`],`Memory`),title:V(e,[`title`],`Memory`),snippet:V(e,[`snippet`]),score:G(e,[`score`]),matchedTerms:W(e,[`matched_terms`,`matchedTerms`]),confidence:ge(e,G(e,[`score`])),locator:V(e,[`locator`]),kind:V(e,[`kind`]),caption:V(e,[`caption`]),thumbnail:he(e)}))},claims:{canRecallUserContext:K(l,[`can_recall_user_context`,`canRecallUserContext`],!1),keepsContextAcrossModels:K(l,[`keeps_context_across_models`,`keepsContextAcrossModels`],!1),isKnowledgeStore:K(l,[`is_knowledge_store`,`isKnowledgeStore`],!1)}}}function N(e){return{status:`unavailable`,modelContinuity:{activeModel:e,brainOwner:``,capability:!1,survivesModelSwitch:!1,proven:!1,contextStore:``},proofs:{durableItems:0,hasDurableEvidence:!1,workspaceMemories:0,conversations:0,graphConcepts:0,vectorItems:0,healthySources:0},recall:{query:``,count:0,items:[]},claims:{canRecallUserContext:!1,keepsContextAcrossModels:!1,isKnowledgeStore:!1}}}function P(e){let t=B(e)?e:{},n=B(t.focus)?t.focus:{},r=c(t.next_actions||t.nextActions),i=c(t.suggested_questions||t.suggestedQuestions),a=c(t.proactive_actions||t.proactiveActions),s=c(t.evidence),l=r.length?r:[{id:`add_source`,label_key:`brain.brief.action.add`,detail_key:`brain.brief.action.add.detail`,route:`/capture`,priority:10},{id:`ask_brain`,label_key:`brain.brief.action.ask`,detail_key:`brain.brief.action.ask.detail`,route:``,priority:9}],u=s.length?s:[{id:`durable`,label_key:`brain.brief.evidence.durable`,value:0,detail_key:`brain.brief.evidence.durable.detail`},{id:`graph`,label_key:`brain.brief.evidence.graph`,value:0,detail_key:`brain.brief.evidence.graph.detail`},{id:`sources`,label_key:`brain.brief.evidence.sources`,value:0,detail_key:`brain.brief.evidence.sources.detail`}];return{status:V(t,[`status`],`quiet`),score:o(Math.round(G(t,[`score`])),0,100),headlineKey:V(t,[`headline_key`,`headlineKey`],`brain.brief.headline.quiet`),bodyKey:V(t,[`body_key`,`bodyKey`],`brain.brief.body.quiet`),focus:{kind:V(n,[`kind`],`empty`),title:V(n,[`title`]),detail:V(n,[`detail`]),source:H(n,[`source`],`Memory`),score:G(n,[`score`]),empty:K(n,[`empty`],!V(n,[`title`]))},nextActions:l.map(e=>({id:V(e,[`id`],`ask_brain`),labelKey:V(e,[`label_key`,`labelKey`],`brain.brief.action.ask`),detailKey:V(e,[`detail_key`,`detailKey`],`brain.brief.action.ask.detail`),route:V(e,[`route`]),priority:G(e,[`priority`])})),suggestedQuestions:i.map(e=>({id:V(e,[`id`],`suggested-question`),labelKey:V(e,[`label_key`,`labelKey`],`brain.suggestion.focus.label`),detailKey:V(e,[`detail_key`,`detailKey`],`brain.suggestion.focus.detail`),promptKey:V(e,[`prompt_key`,`promptKey`],`brain.suggestion.focus.prompt`),params:I(e.params),priority:G(e,[`priority`])})).sort((e,t)=>t.priority-e.priority),proactiveActions:a.map(e=>({id:V(e,[`id`],`proactive-action`),intent:V(e,[`intent`],`ask`),labelKey:V(e,[`label_key`,`labelKey`],`brain.proactive.evidence.label`),detailKey:V(e,[`detail_key`,`detailKey`],`brain.proactive.evidence.detail`),prompt:V(e,[`prompt`]),route:V(e,[`route`]),priority:G(e,[`priority`]),context:I(e.context)})).sort((e,t)=>t.priority-e.priority),evidence:u.map(e=>({id:V(e,[`id`],`evidence`),labelKey:V(e,[`label_key`,`labelKey`],`brain.brief.evidence.durable`),value:G(e,[`value`]),detailKey:V(e,[`detail_key`,`detailKey`],`brain.brief.evidence.durable.detail`)})),generatedAt:V(t,[`generated_at`,`generatedAt`])}}function F(e){let t=new Set;return e.filter(e=>t.has(e.id)?!1:(t.add(e.id),!0))}function I(e){return B(e)?Object.entries(e).reduce((e,[t,n])=>((typeof n==`string`||typeof n==`number`)&&(e[t]=n),e),{}):{}}function L(e,t){let n=Math.min(100,Math.round(e*12+t*10));return e<1?{score:Math.max(12,n),state:`quiet`,depth:2,titleKey:`brain.readiness.quiet`,actionKey:`brain.readiness.start`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}:t<3?{score:Math.max(38,n),state:`forming`,depth:3,titleKey:`brain.readiness.forming`,actionKey:`brain.readiness.grow`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}:{score:Math.max(72,n),state:`alive`,depth:5,titleKey:`brain.readiness.alive`,actionKey:`brain.readiness.map`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}}function R(e){return e===`quiet`?`brain.readiness.start`:e===`forming`?`brain.readiness.grow`:`brain.readiness.map`}function z(e){return e>=1&&e<=5&&Number.isInteger(e)}var B=s;function V(e,t,n=``){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t;if(typeof t==`number`&&Number.isFinite(t))return String(t)}return n}function H(e,t,n=``){return V(e,t,n).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function U(e,t){for(let n of t){let t=e[n];if(typeof t==`number`&&Number.isFinite(t))return t<0xe8d4a51000?t*1e3:t;if(typeof t==`string`&&t.trim()){let e=Number(t);if(Number.isFinite(e)&&/^\d+$/.test(t.trim()))return e<0xe8d4a51000?e*1e3:e;let n=Date.parse(t);if(Number.isFinite(n))return n}}}function W(e,t){for(let n of t){let t=e[n];if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&e.trim().length>0)}return[]}function he(e){let t=e.thumbnail;return typeof t==`string`&&t.startsWith(`data:image/`)?t:``}function ge(e,t){let n=e.confidence;return n===`high`||n===`medium`||n===`low`?n:t>=.65?`high`:t>=.3?`medium`:`low`}function G(e,t){for(let n of t){let t=Number(e[n]);if(Number.isFinite(t))return t}return 0}function K(e,t,n){for(let n of t){let t=e[n];if(typeof t==`boolean`)return t}return n}var q=r();function J(){let e=d({queryKey:[`vectorFreshness`],queryFn:i.brainVectorFreshness,staleTime:6e4,refetchOnWindowFocus:!1,retry:!1});return b.useMemo(()=>e.data?.ok?T(e.data.data):null,[e.data])}function _e({language:e}){let t=u(),n=J(),r=f({mutationFn:()=>i.memoryRebuild(),onSuccess:async()=>{await t.invalidateQueries({queryKey:[`vectorFreshness`]})}});if(!n||n.status!==`stale_embedder`)return null;let o=r.isSuccess&&r.data&&!r.data.ok;return(0,q.jsxs)(`div`,{className:`brain-stale-embedder`,role:`status`,"data-testid":`stale-embedder-notice`,children:[(0,q.jsx)(h,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:a(e,`brain.freshness.staleEmbedder`)}),(0,q.jsx)(`small`,{children:a(e,`brain.freshness.staleEmbedder.detail`)}),o?(0,q.jsx)(`small`,{className:`is-error`,children:a(e,`brain.freshness.reindex.failed`)}):null]}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`stale-embedder-reindex`,disabled:r.isPending,onClick:()=>r.mutate(),children:a(e,r.isPending?`brain.freshness.reindex.running`:`brain.freshness.reindex`)})]})}function ve({language:e}){let t=J();return!t||t.status!==`pending`||t.pendingItems<1?null:(0,q.jsxs)(`p`,{className:`brain-freshness-chip`,role:`status`,"data-testid":`vector-freshness-chip`,children:[(0,q.jsx)(_,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:a(e,`brain.freshness.pending`,{count:t.pendingItems})})]})}var Y=new Set([`queued`,`running`]),X=new Set([`failed`,`partial`]);function Z(e){return Y.has(e.status)}function ye(e){return e===`queued`||e===`running`||e===`completed`||e===`failed`||e===`partial`?`brain.jobs.status.${e}`:`brain.jobs.status.queued`}var be=new Set([`completed`,`partial`]),xe=3;function Se({language:e,job:t,freshness:n,onDismiss:r}){let i=n&&n.totalItems>0&&(n.status===`ready`||n.status===`pending`)?Math.max(0,Math.min(100,Math.round((n.totalItems-n.pendingItems)/n.totalItems*100))):null,o=t.errors.slice(0,xe);return(0,q.jsxs)(`div`,{className:`brain-jobs-report lattice-success-pulse is-${t.status}`,role:`status`,"data-testid":`ingestion-job-report`,children:[(0,q.jsxs)(`div`,{className:`brain-jobs-report-head`,children:[(0,q.jsx)(p,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,q.jsx)(`strong`,{children:a(e,t.status===`partial`?`brain.jobs.report.titlePartial`:`brain.jobs.report.title`)}),r?(0,q.jsx)(`button`,{type:`button`,className:`brain-jobs-report-dismiss`,"aria-label":a(e,`brain.jobs.report.dismiss`),onClick:r,children:(0,q.jsx)(g,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}):null]}),(0,q.jsxs)(`div`,{className:`brain-jobs-report-stats`,children:[t.processed>0?(0,q.jsx)(`span`,{className:`brain-jobs-report-stat`,children:a(e,`brain.jobs.report.documents`,{count:t.processed})}):null,t.failed>0?(0,q.jsx)(`span`,{className:`brain-jobs-report-stat is-failed`,children:a(e,`brain.jobs.failedCount`,{count:t.failed})}):null,i===null?null:(0,q.jsx)(`span`,{className:`brain-jobs-report-stat`,children:a(e,`brain.jobs.report.vector`,{percent:i})})]}),o.length?(0,q.jsxs)(`div`,{className:`brain-jobs-report-samples`,children:[(0,q.jsx)(`small`,{children:a(e,`brain.jobs.report.skipped`)}),(0,q.jsx)(`ul`,{children:o.map(e=>(0,q.jsx)(`li`,{children:e},e))})]}):null]})}function Ce({language:e}){let t=u(),n=J(),r=d({queryKey:[`ingestionJobs`],queryFn:i.ingestionJobs,refetchOnWindowFocus:!1,retry:!1,refetchInterval:e=>{let t=e.state.data;return t?.ok&&D(t.data).some(Z)?4e3:!1}}),o=f({mutationFn:e=>i.resumeIngestionJob(e),onSettled:()=>void t.invalidateQueries({queryKey:[`ingestionJobs`]})}),s=b.useMemo(()=>r.data?.ok?D(r.data.data):[],[r.data]),c=b.useRef(new Map),[l,p]=b.useState([]);b.useEffect(()=>{let e=c.current,t=[];for(let n of s){let r=e.get(n.jobId);r&&Y.has(r)&&be.has(n.status)&&t.push(n.jobId),e.set(n.jobId,n.status)}t.length&&p(e=>[...t,...e.filter(e=>!t.includes(e))].slice(0,2))},[s]);let m=l.map(e=>s.find(t=>t.jobId===e)).filter(e=>!!e),g=s.filter(e=>Z(e)||X.has(e.status)).slice(0,4);return!g.length&&!m.length?null:(0,q.jsxs)(`section`,{className:`brain-jobs-panel`,"aria-label":a(e,`brain.jobs.aria`),"data-testid":`ingestion-jobs-panel`,children:[m.map(t=>(0,q.jsx)(Se,{language:e,job:t,freshness:n,onDismiss:()=>p(e=>e.filter(e=>e!==t.jobId))},t.jobId)),g.length?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`header`,{className:`brain-jobs-head`,children:(0,q.jsx)(`strong`,{children:a(e,`brain.jobs.title`)})}),(0,q.jsx)(`ul`,{className:`brain-jobs-list`,children:g.map(t=>{let n=Math.max(t.total,t.processed,1),r=Math.min(100,Math.round(t.processed/n*100)),i=X.has(t.status),s=o.isPending&&o.variables===t.jobId;return(0,q.jsxs)(`li`,{className:`brain-jobs-item is-${t.status}`,children:[(0,q.jsxs)(`div`,{className:`brain-jobs-item-row`,children:[(0,q.jsx)(`span`,{className:`brain-jobs-status`,children:a(e,ye(t.status))}),(0,q.jsx)(`span`,{className:`brain-jobs-counts`,children:a(e,`brain.jobs.progress`,{processed:t.processed,total:t.total})}),t.failed>0?(0,q.jsxs)(`span`,{className:`brain-jobs-failed`,children:[(0,q.jsx)(h,{className:`h-3 w-3`,"aria-hidden":`true`}),a(e,`brain.jobs.failedCount`,{count:t.failed})]}):null]}),(0,q.jsx)(`div`,{className:`brain-jobs-bar`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,"aria-label":a(e,`brain.jobs.progressAria`,{processed:t.processed,total:t.total}),children:(0,q.jsx)(`span`,{className:`brain-jobs-bar-fill`,style:{width:`${r}%`}})}),i?(0,q.jsxs)(`button`,{type:`button`,className:`brain-jobs-resume`,disabled:o.isPending,onClick:()=>o.mutate(t.jobId),children:[(0,q.jsx)(ee,{className:`h-3 w-3`,"aria-hidden":`true`}),s?a(e,`brain.jobs.resuming`):a(e,`brain.jobs.resume`)]}):null]},t.jobId)})})]}):null]})}function Q(e){return e.split(/[\\/]/).filter(Boolean).pop()||e}function $(e,t){if(!t)return a(e,`brain.watch.scan.never`);let n=Date.parse(t);if(!Number.isFinite(n))return a(e,`brain.watch.scan.never`);let r=Math.max(0,Date.now()-n),i=Math.floor(r/6e4);if(i<1)return a(e,`brain.watch.scan.now`);if(i<60)return a(e,`brain.watch.scan.minutes`,{count:i});let o=Math.floor(i/60);return o<24?a(e,`brain.watch.scan.hours`,{count:o}):a(e,`brain.watch.scan.days`,{count:Math.floor(o/24)})}var we=4;function Te({language:e}){let t=d({queryKey:[`ingestionWatch`],queryFn:i.ingestionWatchStatus,staleTime:3e4,refetchOnWindowFocus:!1,retry:!1}),n=b.useMemo(()=>t.data?.ok?w(t.data.data):null,[t.data]);if(!n||n.enabledCount<1)return null;let r=n.watches.filter(e=>e.enabled).slice(0,we);return r.length?(0,q.jsxs)(`section`,{className:`brain-watch-card`,"aria-label":a(e,`brain.watch.aria`),"data-testid":`watch-health-card`,children:[(0,q.jsxs)(`header`,{className:`brain-watch-head`,children:[(0,q.jsx)(y,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,q.jsx)(`strong`,{children:a(e,`brain.watch.title`)})]}),n.polling?null:(0,q.jsxs)(`p`,{className:`brain-watch-note`,role:`note`,"data-testid":`watch-polling-note`,children:[(0,q.jsx)(m,{className:`h-3 w-3`,"aria-hidden":`true`}),a(e,`brain.watch.notLive`)]}),(0,q.jsx)(`ul`,{className:`brain-watch-list`,children:r.map(t=>(0,q.jsx)(Ee,{language:e,watch:t},t.id))})]}):null}function Ee({language:e,watch:t}){return(0,q.jsxs)(`li`,{className:`brain-watch-item`,children:[(0,q.jsxs)(`div`,{className:`brain-watch-item-row`,children:[(0,q.jsx)(`span`,{className:`brain-watch-path`,title:t.path,children:Q(t.path)}),(0,q.jsx)(`small`,{className:`brain-watch-scan`,children:$(e,t.lastScanAt)})]}),(0,q.jsxs)(`div`,{className:`brain-watch-item-row`,children:[t.lastResult&&t.lastResult.ingested>0?(0,q.jsx)(`span`,{className:`brain-watch-stat`,children:a(e,`brain.watch.ingested`,{count:t.lastResult.ingested})}):null,t.lastResult&&t.lastResult.failed>0?(0,q.jsxs)(`span`,{className:`brain-watch-stat is-failed`,children:[(0,q.jsx)(h,{className:`h-3 w-3`,"aria-hidden":`true`}),a(e,`brain.jobs.failedCount`,{count:t.lastResult.failed})]}):null,t.trackedFiles>0?(0,q.jsx)(`small`,{className:`brain-watch-tracked`,children:a(e,`brain.watch.tracked`,{count:t.trackedFiles})}):null]}),t.lastErrors.length?(0,q.jsxs)(`div`,{className:`brain-watch-errors`,children:[(0,q.jsx)(`small`,{children:a(e,`brain.watch.errors`)}),(0,q.jsx)(`ul`,{children:t.lastErrors.slice(0,3).map((e,t)=>(0,q.jsx)(`li`,{children:[e.path?Q(e.path):``,e.detail].filter(Boolean).join(` — `)},`${e.path}-${t}`))})]}):null]})}function De(e,t){if(!t)return``;let n=new Date(t);return Number.isNaN(n.getTime())?``:n.toLocaleTimeString(e===`ko`?`ko-KR`:`en-US`,{hour:`2-digit`,minute:`2-digit`})}function Oe({language:e,knownRunIds:t}){let n=d({queryKey:[`agentApprovals`],queryFn:i.agentApprovals,staleTime:1/0,refetchOnWindowFocus:!1,retry:!1}),r=b.useMemo(()=>n.data?.ok?C(n.data.data):[],[n.data]),o=b.useMemo(()=>new Set(t),[t]),s=r.filter(e=>!o.has(e.runId));return s.length?(0,q.jsx)(`aside`,{className:`brain-pending-approvals`,role:`note`,"aria-label":a(e,`brain.approval.pendingNotice.aria`),"data-testid":`pending-approvals-notice`,children:s.slice(0,2).map(t=>{let n=De(e,t.expiresAt);return(0,q.jsxs)(`p`,{children:[(0,q.jsx)(`span`,{children:t.goal?a(e,`brain.approval.pendingNotice`,{goal:t.goal}):a(e,`brain.approval.pendingNotice.generic`)}),(0,q.jsx)(`small`,{children:n?a(e,`brain.approval.pendingNotice.expiry`,{time:n}):a(e,`brain.approval.pendingNotice.hint`)})]},t.runId)})}):null}export{S as C,te as E,me as S,v as T,pe as _,Te as a,ue as b,M as c,ae as d,k as f,fe as g,B as h,ve as i,j as l,A as m,Oe as n,de as o,se as p,_e as r,P as s,Ce as t,ne as u,le as v,V as w,oe as x,re as y};
|
|
1
|
+
import{C as e,_ as t,a as n,b as r,d as i,m as a,n as o,o as s,t as c,x as l}from"./utils-CiFtIdZq.js";import{r as u,t as d}from"./useQuery-C7BeG4HU.js";import{t as f}from"./useMutation-CVC4qv_D.js";import{t as p}from"./circle-check-DruOxB-4.js";import{t as m}from"./circle-pause-CmzC_apg.js";import{d as ee,l as h,s as g}from"./index-Do83hDzJ.js";var te=t(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),_=t(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),v=t(`database-backup`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 12a9 3 0 0 0 5 2.69`,key:`1ui2ym`}],[`path`,{d:`M21 9.3V5`,key:`6k6cib`}],[`path`,{d:`M3 5v14a9 3 0 0 0 6.47 2.88`,key:`i62tjy`}],[`path`,{d:`M12 12v4h4`,key:`1bxaet`}],[`path`,{d:`M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16`,key:`1f4ei9`}]]),y=t(`folder-sync`,[[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5`,key:`1dkoa9`}],[`path`,{d:`M12 10v4h4`,key:`1czhmt`}],[`path`,{d:`m12 14 1.535-1.605a5 5 0 0 1 8 1.5`,key:`lvuxfi`}],[`path`,{d:`M22 22v-4h-4`,key:`1ewp4q`}],[`path`,{d:`m22 18-1.535 1.605a5 5 0 0 1-8-1.5`,key:`14ync0`}]]),b=e(l());function ne(e){return c(e).flatMap(e=>{let t=V(e,[`id`,`conversation_id`]);return t?[{id:t,title:V(e,[`title`,`summary`,`last_message`],t).trim(),messageCount:Math.max(0,Math.round(G(e,[`message_count`,`messages`]))),updatedAt:U(e,[`updated_at`,`updatedAt`,`created_at`,`createdAt`])}]:[]}).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0))}function re(e){return c((B(e)?e:{}).messages).flatMap(e=>{let t=V(e,[`role`]),n=typeof e.content==`string`?e.content:``;return t!==`user`&&t!==`assistant`||!n.trim()?[]:[{role:t,content:n}]})}function ie(e,t,n){let r=V(e,[`id`]);if(r){let e=`brain.memoryTier.${r}`,n=a(t,e);if(n!==e)return n}return n}function ae(e,t,n=`ko`){let r=B(e)?e:{},i=(c(r.sources).length?c(r.sources):c(r.tiers)).map((e,t)=>({id:V(e,[`id`,`source`,`label`],`memory-${t}`),title:ie(e,n,V(e,[`title`,`label`,`source`,`path`,`name`],`Workspace memory`)),kind:H(e,[`type`,`source_type`,`kind`,`health`],`Memory`),tags:[],agentGenerated:!1})),a=c(r.recent_memories||r.recentMemories).map((e,t)=>{let n=B(e.metadata)?e.metadata:{},r=W(e,[`tags`]),i=V(e,[`content`,`summary`,`detail`]),a=V(n,[`source`]),o=r.includes(`agent-synthesis`)||a===`agent_runtime`||a===`agent_runtime_synthesis`;return{id:V(e,[`id`],`recent-memory-${t}`),title:i?i.replace(/\s+/g,` `).slice(0,96):H(e,[`kind`],`Memory`),kind:H(e,[`kind`],`Memory`),detail:i,tags:r,agentGenerated:o}}),o=c(t).map((e,t)=>({id:V(e,[`id`,`conversation_id`],`conversation-${t}`),title:V(e,[`title`,`summary`,`id`],`Conversation`),kind:`Conversation`,tags:[],agentGenerated:!1}));return F([...a,...i,...o]).slice(0,12)}function oe(e){let t=B(e)?e:{},n=c(t.nodes),r=c(t.edges),i=n.flatMap(e=>{let t=V(e,[`id`,`node_id`,`title`,`label`]);if(!t)return[];let n=B(e.metadata)?e.metadata:{},r=H(e,[`type`,`kind`,`category`],`Concept`),i=V(e,[`title`,`label`,`name`],t.replace(/^[^:]+:/,``)),a=V(e,[`summary`,`description`,`snippet`])||V(n,[`summary`,`description`,`relative_path`,`filename`]),s=o(G(e,[`importance_norm`,`importance`,`score`])||.5,.08,1),c=U(e,[`created_at`,`createdAt`,`added_at`,`addedAt`,`timestamp`,`updated_at`,`updatedAt`])??U(n,[`created_at`,`createdAt`,`added_at`,`addedAt`,`timestamp`,`updated_at`,`updatedAt`]);return[{id:t,label:i,type:r,summary:a,importance:s,...c===void 0?{}:{createdAt:c}}]}).sort((e,t)=>t.importance-e.importance),a=new Set(i.map(e=>e.id));return{nodes:i,edges:r.flatMap((e,t)=>{let n=V(e,[`from`,`source`,`source_id`]),r=V(e,[`to`,`target`,`target_id`]);return!n||!r||!a.has(n)||!a.has(r)?[]:[{id:V(e,[`id`],`edge-${t}`),source:n,target:r,label:H(e,[`type`,`label`,`relationship`],`Relates`),weight:G(e,[`weight`,`score`,`confidence`])||1}]})}}function se(e){let t=B(e)?e:{},n=[t,t.knowledge_graph,t.ingestion,t.result].filter(B),r=new Set,i=0,a,o;for(let e of n){let t=V(e,[`node_id`,`graph_node`,`graph_node_id`]);t&&r.add(t);for(let t of c(e.indexed_nodes))if(typeof t==`string`&&t.trim())r.add(t.trim());else if(B(t)){let e=V(t,[`node_id`,`graph_node_id`,`id`]);e&&r.add(e)}i=Math.max(i,G(e,[`chunk_count`,`chunks`,`indexed_count`])),typeof e.duplicate==`boolean`&&(a=e.duplicate),o||=V(e,[`provenance_id`])}let s;for(let e of n){let t=ce(e);if(t){s=t;break}}return{nodeIds:Array.from(r),chunkCount:i,...a===void 0?{}:{duplicate:a},...o?{provenanceId:o}:{},...s?{extraction:s}:{}}}function ce(e){let t=B(e)?e:{},n=B(t.extraction_quality)?t.extraction_quality:null;if(!n)return null;let r=V(n,[`level`]);if(r!==`high`&&r!==`medium`&&r!==`low`)return null;let i=W(t,[`warnings`]).length?W(t,[`warnings`]):W(n,[`warnings`]);return{score:G(n,[`score`]),level:r,reasons:W(n,[`reasons`]),warnings:i}}function le(e){let t=B(e)?e:{},n=B(t.context_quality)?t.context_quality:null,r=!n&&B(t.trace)&&B(t.trace.context_quality)?t.trace.context_quality:null,i=n||r||(typeof t.mode==`string`&&typeof t.limited==`boolean`?t:null);if(!i)return null;let a=V(i,[`mode`]);if(!a)return null;let o=typeof i.reason==`string`&&i.reason.trim()?i.reason.trim():null;return{mode:a,nodes:Math.max(0,Math.round(G(i,[`nodes`]))),limited:K(i,[`limited`],!1),reason:o}}function ue(e){let t=B(e)?e:{},n=(B(t.grounding)?t.grounding:null)||(typeof t.status==`string`&&`label`in t?t:null);if(!n)return null;let r=V(n,[`status`]);return[`supported`,`unsupported`,`no_context`].includes(r)?{status:r,reason:typeof n.reason==`string`&&n.reason.trim()?n.reason.trim():null}:null}function x(e){if(!B(e))return null;let t=V(e,[`status`]);if(t!==`ok`&&t!==`pending`&&t!==`failed`)return null;let n=V(e,[`detail`]);return{status:t,...n?{detail:n}:{}}}function de(e){let t=!!e.generation?.repaired,n=new Map;for(let t of e.artifacts||[])t&&typeof t.path==`string`&&n.set(t.path,!!t.previewable);let r=new Map,i=null;if(Array.isArray(e.brain_ingest))for(let t of e.brain_ingest){let e=x(t);e&&B(t)&&typeof t.path==`string`&&r.set(t.path,e)}else i=x(e.brain_ingest);let a=e.created_files||[];return a.map(e=>{let o=r.get(e.path)||(a.length===1?i:null);return{path:e.path,filename:e.filename||e.path.split(`/`).pop()||e.path,bytes:e.bytes||0,repaired:t,...n.has(e.path)?{previewable:n.get(e.path)}:{},...o?{brainIngest:o}:{}}})}function fe(e){if(!B(e))return null;let t=V(e,[`phase`]),n=V(e,[`event`]);if(!t||!n)return null;let r=Number(e.step);return{phase:t,event:n,...V(e,[`action`])?{action:V(e,[`action`])}:{},...V(e,[`path`])?{path:V(e,[`path`])}:{},...Number.isFinite(r)?{step:Math.round(r)}:{},...typeof e.ok==`boolean`?{ok:e.ok}:{},...V(e,[`decision`])?{decision:V(e,[`decision`])}:{},...V(e,[`verdict`])?{verdict:V(e,[`verdict`])}:{},...V(e,[`state`])?{state:V(e,[`state`])}:{},...V(e,[`detail`,`error`])?{detail:V(e,[`detail`,`error`])}:{}}}function pe(e){return c(e).flatMap(e=>{if(!B(e))return[];let t=V(e,[`action`,`tool`]),n=V(e,[`state`]),r=V(e,[`error`]);if(!t&&!n&&!r)return[];let i=V(B(e.args)?e.args:{},[`path`,`target`,`file`]);return t?[{phase:`execute`,event:`tool`,action:t,...i?{path:i}:{},ok:!r,...r?{detail:r}:{}}]:r?[{phase:`execute`,event:`state`,...n?{state:n}:{},ok:!1,detail:r}]:[{phase:`terminal`,event:`state`,state:n}]})}function me(e){if(!B(e))return null;let t={};if(B(e.repairs))for(let[n,r]of Object.entries(e.repairs)){let e=Number(r);Number.isFinite(e)&&e>0&&(t[n]=Math.round(e))}let n=Math.max(0,Math.round(G(e,[`parse_errors`,`parseErrors`]))),r=Math.max(0,Math.round(G(e,[`parse_recovered`,`parseRecovered`]))),i=Object.values(t).reduce((e,t)=>e+t,0)+r;return i<1?null:{repairs:t,parseErrors:n,parseRecovered:r,total:i}}function S(e,t){if(!B(e))return null;let n=e=>{if(!B(e))return``;let n=e[t];return typeof n==`string`?n:``},r=n(e.headline),i=c(e.details).map(n).filter(Boolean),a=V(e,[`code`]);if(!r&&!i.length)return null;let o=B(e.model_strain)?V(e.model_strain,[`level`]):``,s=o===`light`||o===`moderate`||o===`heavy`?o:`none`,l=e.ok===!0;return l&&!i.length?null:{code:a,ok:l,headline:r,details:i,strainLevel:s}}function C(e){return c((B(e)?e:{}).pending).flatMap(e=>{let t=V(e,[`run_id`,`runId`]);return t?[{runId:t,goal:V(e,[`goal`]),expiresAt:V(e,[`expires_at`,`expiresAt`])}]:[]})}function w(e){let t=B(e)?e:{},n=c(t.watches).flatMap(e=>{if(!B(e))return[];let t=V(e,[`id`]),n=V(e,[`path`]);if(!t&&!n)return[];let r=B(e.last_result)?e.last_result:null,i=c(e.last_errors).flatMap(e=>{if(typeof e==`string`&&e.trim())return[{path:``,detail:e.trim()}];if(!B(e))return[];let t=V(e,[`detail`,`reason`,`error`]),n=V(e,[`path`,`source`,`file`]);return!t&&!n?[]:[{path:n,detail:t}]});return[{id:t||n,path:n,enabled:K(e,[`enabled`],!1),lastScanAt:V(e,[`last_scan_at`,`lastScanAt`]),lastResult:r?{status:V(r,[`status`]),ingested:Math.max(0,Math.round(G(r,[`ingested`]))),failed:Math.max(0,Math.round(G(r,[`failed`])))}:null,trackedFiles:Math.max(0,Math.round(G(e,[`tracked_files`,`trackedFiles`]))),lastErrors:i.slice(0,3)}]});return{enabledCount:Math.max(0,Math.round(G(t,[`enabled_count`,`enabledCount`]))),polling:K(t,[`polling`],!1),intervalSeconds:Math.max(0,Math.round(G(t,[`interval_seconds`,`intervalSeconds`]))),watches:n}}function T(e){let t=B(e)?e:{};return{status:V(t,[`status`],`unavailable`),pendingItems:Math.max(0,Math.round(G(t,[`pending_items`,`pendingItems`]))),totalItems:Math.max(0,Math.round(G(t,[`total_items`,`totalItems`]))),detail:V(t,[`detail`])}}function E(e){return typeof e==`string`?e.trim():B(e)?[V(e,[`source`,`path`,`file`]),V(e,[`detail`,`reason`,`error`])].filter(Boolean).join(` — `):``}function D(e){return c((B(e)?e:{}).jobs).flatMap(e=>{let t=V(e,[`job_id`,`jobId`,`id`]);if(!t)return[];let n=V(e,[`created_at`,`createdAt`]),r=V(e,[`updated_at`,`updatedAt`]);return[{jobId:t,status:V(e,[`status`],`queued`),total:Math.max(0,Math.round(G(e,[`total`]))),processed:Math.max(0,Math.round(G(e,[`processed`]))),failed:Math.max(0,Math.round(G(e,[`failed`]))),errors:c(e.errors).map(E).filter(Boolean).slice(0,10),...n?{createdAt:n}:{},...r?{updatedAt:r}:{}}]})}function O(e,t){for(let n of[`recommended`,`cloud`,`loaded`,`loaded_models`,`models`])for(let r of c(e[n])){if(V(r,[`id`,`model_id`,`name`])!==t)continue;let e=V(r,[`display_name`,`model_name`,`name`]);if(e&&e!==t)return e}return``}function k(e){let t=B(e)?e:{},r=V(t,[`current`,`current_model`,`local_model`]);if(r)return O(t,r)||n(r);let i=c(t.loaded||t.loaded_models).find(e=>e.id||e.name||e.model_id);if(!i)return`local mind`;let a=V(i,[`display_name`,`model_name`,`name`]),o=V(i,[`id`,`model_id`]);return a&&a!==o?a:o?O(t,o)||n(o):`local mind`}function A(e){let t=B(e)?e:{};return V(t,[`current`,`current_model`,`local_model`])?!0:c(t.loaded||t.loaded_models).some(e=>e.id||e.name||e.model_id)}function j(e,t,n){let r=B(e)?e:{},i=B(r.brain_readiness)?r.brain_readiness:{},a=V(i,[`state`]),s=G(i,[`depth`]),c=G(i,[`score`]);if((a===`quiet`||a===`forming`||a===`alive`)&&z(s)){let e=B(i.signals)?i.signals:{};return{score:o(Math.round(c||0),0,100),state:a,depth:s,titleKey:V(i,[`title_key`,`titleKey`],`brain.readiness.${a}`),actionKey:V(i,[`action_key`,`actionKey`],R(a)),source:`memory_service`,signals:{memoryCount:G(e,[`memory_count`,`memoryCount`]),conceptCount:G(e,[`concept_count`,`conceptCount`]),relationshipCount:G(e,[`relationship_count`,`relationshipCount`]),healthySources:G(e,[`healthy_sources`,`healthySources`])}}}return L(t,n)}function M(e,t=``){let n=B(e)&&typeof e.ok==`boolean`&&`data`in e?e:null;if(n&&!n.ok)return N(t);let r=n?n.data:e,i=B(r)?r:{},a=B(i.model_continuity)?i.model_continuity:{},o=B(i.proofs)?i.proofs:{},s=B(i.recall)?i.recall:{},l=B(i.claims)?i.claims:{},u=G(o,[`durable_items`,`durableItems`]);return{status:V(i,[`status`],`quiet`),modelContinuity:{activeModel:V(a,[`active_model`,`activeModel`],t),brainOwner:V(a,[`brain_owner`,`brainOwner`],`lattice_brain`),capability:K(a,[`capability`],!0),survivesModelSwitch:K(a,[`survives_model_switch`,`survivesModelSwitch`],!1),proven:K(a,[`proven`],!1),contextStore:V(a,[`context_store`,`contextStore`],`workspace + conversation + graph + vector`)},proofs:{durableItems:u,hasDurableEvidence:K(o,[`has_durable_evidence`,`hasDurableEvidence`],u>0),workspaceMemories:G(o,[`workspace_memories`,`workspaceMemories`]),conversations:G(o,[`conversations`]),graphConcepts:G(o,[`graph_concepts`,`graphConcepts`]),vectorItems:G(o,[`vector_items`,`vectorItems`]),healthySources:G(o,[`healthy_sources`,`healthySources`])},recall:{query:V(s,[`query`]),count:G(s,[`count`]),items:c(s.items).map((e,t)=>({id:V(e,[`id`],`recall-${t}`),source:H(e,[`source`],`Memory`),title:V(e,[`title`],`Memory`),snippet:V(e,[`snippet`]),score:G(e,[`score`]),matchedTerms:W(e,[`matched_terms`,`matchedTerms`]),confidence:ge(e,G(e,[`score`])),locator:V(e,[`locator`]),kind:V(e,[`kind`]),caption:V(e,[`caption`]),thumbnail:he(e)}))},claims:{canRecallUserContext:K(l,[`can_recall_user_context`,`canRecallUserContext`],!1),keepsContextAcrossModels:K(l,[`keeps_context_across_models`,`keepsContextAcrossModels`],!1),isKnowledgeStore:K(l,[`is_knowledge_store`,`isKnowledgeStore`],!1)}}}function N(e){return{status:`unavailable`,modelContinuity:{activeModel:e,brainOwner:``,capability:!1,survivesModelSwitch:!1,proven:!1,contextStore:``},proofs:{durableItems:0,hasDurableEvidence:!1,workspaceMemories:0,conversations:0,graphConcepts:0,vectorItems:0,healthySources:0},recall:{query:``,count:0,items:[]},claims:{canRecallUserContext:!1,keepsContextAcrossModels:!1,isKnowledgeStore:!1}}}function P(e){let t=B(e)?e:{},n=B(t.focus)?t.focus:{},r=c(t.next_actions||t.nextActions),i=c(t.suggested_questions||t.suggestedQuestions),a=c(t.proactive_actions||t.proactiveActions),s=c(t.evidence),l=r.length?r:[{id:`add_source`,label_key:`brain.brief.action.add`,detail_key:`brain.brief.action.add.detail`,route:`/capture`,priority:10},{id:`ask_brain`,label_key:`brain.brief.action.ask`,detail_key:`brain.brief.action.ask.detail`,route:``,priority:9}],u=s.length?s:[{id:`durable`,label_key:`brain.brief.evidence.durable`,value:0,detail_key:`brain.brief.evidence.durable.detail`},{id:`graph`,label_key:`brain.brief.evidence.graph`,value:0,detail_key:`brain.brief.evidence.graph.detail`},{id:`sources`,label_key:`brain.brief.evidence.sources`,value:0,detail_key:`brain.brief.evidence.sources.detail`}];return{status:V(t,[`status`],`quiet`),score:o(Math.round(G(t,[`score`])),0,100),headlineKey:V(t,[`headline_key`,`headlineKey`],`brain.brief.headline.quiet`),bodyKey:V(t,[`body_key`,`bodyKey`],`brain.brief.body.quiet`),focus:{kind:V(n,[`kind`],`empty`),title:V(n,[`title`]),detail:V(n,[`detail`]),source:H(n,[`source`],`Memory`),score:G(n,[`score`]),empty:K(n,[`empty`],!V(n,[`title`]))},nextActions:l.map(e=>({id:V(e,[`id`],`ask_brain`),labelKey:V(e,[`label_key`,`labelKey`],`brain.brief.action.ask`),detailKey:V(e,[`detail_key`,`detailKey`],`brain.brief.action.ask.detail`),route:V(e,[`route`]),priority:G(e,[`priority`])})),suggestedQuestions:i.map(e=>({id:V(e,[`id`],`suggested-question`),labelKey:V(e,[`label_key`,`labelKey`],`brain.suggestion.focus.label`),detailKey:V(e,[`detail_key`,`detailKey`],`brain.suggestion.focus.detail`),promptKey:V(e,[`prompt_key`,`promptKey`],`brain.suggestion.focus.prompt`),params:I(e.params),priority:G(e,[`priority`])})).sort((e,t)=>t.priority-e.priority),proactiveActions:a.map(e=>({id:V(e,[`id`],`proactive-action`),intent:V(e,[`intent`],`ask`),labelKey:V(e,[`label_key`,`labelKey`],`brain.proactive.evidence.label`),detailKey:V(e,[`detail_key`,`detailKey`],`brain.proactive.evidence.detail`),prompt:V(e,[`prompt`]),route:V(e,[`route`]),priority:G(e,[`priority`]),context:I(e.context)})).sort((e,t)=>t.priority-e.priority),evidence:u.map(e=>({id:V(e,[`id`],`evidence`),labelKey:V(e,[`label_key`,`labelKey`],`brain.brief.evidence.durable`),value:G(e,[`value`]),detailKey:V(e,[`detail_key`,`detailKey`],`brain.brief.evidence.durable.detail`)})),generatedAt:V(t,[`generated_at`,`generatedAt`])}}function F(e){let t=new Set;return e.filter(e=>t.has(e.id)?!1:(t.add(e.id),!0))}function I(e){return B(e)?Object.entries(e).reduce((e,[t,n])=>((typeof n==`string`||typeof n==`number`)&&(e[t]=n),e),{}):{}}function L(e,t){let n=Math.min(100,Math.round(e*12+t*10));return e<1?{score:Math.max(12,n),state:`quiet`,depth:2,titleKey:`brain.readiness.quiet`,actionKey:`brain.readiness.start`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}:t<3?{score:Math.max(38,n),state:`forming`,depth:3,titleKey:`brain.readiness.forming`,actionKey:`brain.readiness.grow`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}:{score:Math.max(72,n),state:`alive`,depth:5,titleKey:`brain.readiness.alive`,actionKey:`brain.readiness.map`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}}function R(e){return e===`quiet`?`brain.readiness.start`:e===`forming`?`brain.readiness.grow`:`brain.readiness.map`}function z(e){return e>=1&&e<=5&&Number.isInteger(e)}var B=s;function V(e,t,n=``){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t;if(typeof t==`number`&&Number.isFinite(t))return String(t)}return n}function H(e,t,n=``){return V(e,t,n).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function U(e,t){for(let n of t){let t=e[n];if(typeof t==`number`&&Number.isFinite(t))return t<0xe8d4a51000?t*1e3:t;if(typeof t==`string`&&t.trim()){let e=Number(t);if(Number.isFinite(e)&&/^\d+$/.test(t.trim()))return e<0xe8d4a51000?e*1e3:e;let n=Date.parse(t);if(Number.isFinite(n))return n}}}function W(e,t){for(let n of t){let t=e[n];if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&e.trim().length>0)}return[]}function he(e){let t=e.thumbnail;return typeof t==`string`&&t.startsWith(`data:image/`)?t:``}function ge(e,t){let n=e.confidence;return n===`high`||n===`medium`||n===`low`?n:t>=.65?`high`:t>=.3?`medium`:`low`}function G(e,t){for(let n of t){let t=Number(e[n]);if(Number.isFinite(t))return t}return 0}function K(e,t,n){for(let n of t){let t=e[n];if(typeof t==`boolean`)return t}return n}var q=r();function J(){let e=d({queryKey:[`vectorFreshness`],queryFn:i.brainVectorFreshness,staleTime:6e4,refetchOnWindowFocus:!1,retry:!1});return b.useMemo(()=>e.data?.ok?T(e.data.data):null,[e.data])}function _e({language:e}){let t=u(),n=J(),r=f({mutationFn:()=>i.memoryRebuild(),onSuccess:async()=>{await t.invalidateQueries({queryKey:[`vectorFreshness`]})}});if(!n||n.status!==`stale_embedder`)return null;let o=r.isSuccess&&r.data&&!r.data.ok;return(0,q.jsxs)(`div`,{className:`brain-stale-embedder`,role:`status`,"data-testid":`stale-embedder-notice`,children:[(0,q.jsx)(h,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:a(e,`brain.freshness.staleEmbedder`)}),(0,q.jsx)(`small`,{children:a(e,`brain.freshness.staleEmbedder.detail`)}),o?(0,q.jsx)(`small`,{className:`is-error`,children:a(e,`brain.freshness.reindex.failed`)}):null]}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`stale-embedder-reindex`,disabled:r.isPending,onClick:()=>r.mutate(),children:a(e,r.isPending?`brain.freshness.reindex.running`:`brain.freshness.reindex`)})]})}function ve({language:e}){let t=J();return!t||t.status!==`pending`||t.pendingItems<1?null:(0,q.jsxs)(`p`,{className:`brain-freshness-chip`,role:`status`,"data-testid":`vector-freshness-chip`,children:[(0,q.jsx)(_,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:a(e,`brain.freshness.pending`,{count:t.pendingItems})})]})}var Y=new Set([`queued`,`running`]),X=new Set([`failed`,`partial`]);function Z(e){return Y.has(e.status)}function ye(e){return e===`queued`||e===`running`||e===`completed`||e===`failed`||e===`partial`?`brain.jobs.status.${e}`:`brain.jobs.status.queued`}var be=new Set([`completed`,`partial`]),xe=3;function Se({language:e,job:t,freshness:n,onDismiss:r}){let i=n&&n.totalItems>0&&(n.status===`ready`||n.status===`pending`)?Math.max(0,Math.min(100,Math.round((n.totalItems-n.pendingItems)/n.totalItems*100))):null,o=t.errors.slice(0,xe);return(0,q.jsxs)(`div`,{className:`brain-jobs-report lattice-success-pulse is-${t.status}`,role:`status`,"data-testid":`ingestion-job-report`,children:[(0,q.jsxs)(`div`,{className:`brain-jobs-report-head`,children:[(0,q.jsx)(p,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,q.jsx)(`strong`,{children:a(e,t.status===`partial`?`brain.jobs.report.titlePartial`:`brain.jobs.report.title`)}),r?(0,q.jsx)(`button`,{type:`button`,className:`brain-jobs-report-dismiss`,"aria-label":a(e,`brain.jobs.report.dismiss`),onClick:r,children:(0,q.jsx)(g,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}):null]}),(0,q.jsxs)(`div`,{className:`brain-jobs-report-stats`,children:[t.processed>0?(0,q.jsx)(`span`,{className:`brain-jobs-report-stat`,children:a(e,`brain.jobs.report.documents`,{count:t.processed})}):null,t.failed>0?(0,q.jsx)(`span`,{className:`brain-jobs-report-stat is-failed`,children:a(e,`brain.jobs.failedCount`,{count:t.failed})}):null,i===null?null:(0,q.jsx)(`span`,{className:`brain-jobs-report-stat`,children:a(e,`brain.jobs.report.vector`,{percent:i})})]}),o.length?(0,q.jsxs)(`div`,{className:`brain-jobs-report-samples`,children:[(0,q.jsx)(`small`,{children:a(e,`brain.jobs.report.skipped`)}),(0,q.jsx)(`ul`,{children:o.map(e=>(0,q.jsx)(`li`,{children:e},e))})]}):null]})}function Ce({language:e}){let t=u(),n=J(),r=d({queryKey:[`ingestionJobs`],queryFn:i.ingestionJobs,refetchOnWindowFocus:!1,retry:!1,refetchInterval:e=>{let t=e.state.data;return t?.ok&&D(t.data).some(Z)?4e3:!1}}),o=f({mutationFn:e=>i.resumeIngestionJob(e),onSettled:()=>void t.invalidateQueries({queryKey:[`ingestionJobs`]})}),s=b.useMemo(()=>r.data?.ok?D(r.data.data):[],[r.data]),c=b.useRef(new Map),[l,p]=b.useState([]);b.useEffect(()=>{let e=c.current,t=[];for(let n of s){let r=e.get(n.jobId);r&&Y.has(r)&&be.has(n.status)&&t.push(n.jobId),e.set(n.jobId,n.status)}t.length&&p(e=>[...t,...e.filter(e=>!t.includes(e))].slice(0,2))},[s]);let m=l.map(e=>s.find(t=>t.jobId===e)).filter(e=>!!e),g=s.filter(e=>Z(e)||X.has(e.status)).slice(0,4);return!g.length&&!m.length?null:(0,q.jsxs)(`section`,{className:`brain-jobs-panel`,"aria-label":a(e,`brain.jobs.aria`),"data-testid":`ingestion-jobs-panel`,children:[m.map(t=>(0,q.jsx)(Se,{language:e,job:t,freshness:n,onDismiss:()=>p(e=>e.filter(e=>e!==t.jobId))},t.jobId)),g.length?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`header`,{className:`brain-jobs-head`,children:(0,q.jsx)(`strong`,{children:a(e,`brain.jobs.title`)})}),(0,q.jsx)(`ul`,{className:`brain-jobs-list`,children:g.map(t=>{let n=Math.max(t.total,t.processed,1),r=Math.min(100,Math.round(t.processed/n*100)),i=X.has(t.status),s=o.isPending&&o.variables===t.jobId;return(0,q.jsxs)(`li`,{className:`brain-jobs-item is-${t.status}`,children:[(0,q.jsxs)(`div`,{className:`brain-jobs-item-row`,children:[(0,q.jsx)(`span`,{className:`brain-jobs-status`,children:a(e,ye(t.status))}),(0,q.jsx)(`span`,{className:`brain-jobs-counts`,children:a(e,`brain.jobs.progress`,{processed:t.processed,total:t.total})}),t.failed>0?(0,q.jsxs)(`span`,{className:`brain-jobs-failed`,children:[(0,q.jsx)(h,{className:`h-3 w-3`,"aria-hidden":`true`}),a(e,`brain.jobs.failedCount`,{count:t.failed})]}):null]}),(0,q.jsx)(`div`,{className:`brain-jobs-bar`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,"aria-label":a(e,`brain.jobs.progressAria`,{processed:t.processed,total:t.total}),children:(0,q.jsx)(`span`,{className:`brain-jobs-bar-fill`,style:{width:`${r}%`}})}),i?(0,q.jsxs)(`button`,{type:`button`,className:`brain-jobs-resume`,disabled:o.isPending,onClick:()=>o.mutate(t.jobId),children:[(0,q.jsx)(ee,{className:`h-3 w-3`,"aria-hidden":`true`}),s?a(e,`brain.jobs.resuming`):a(e,`brain.jobs.resume`)]}):null]},t.jobId)})})]}):null]})}function Q(e){return e.split(/[\\/]/).filter(Boolean).pop()||e}function $(e,t){if(!t)return a(e,`brain.watch.scan.never`);let n=Date.parse(t);if(!Number.isFinite(n))return a(e,`brain.watch.scan.never`);let r=Math.max(0,Date.now()-n),i=Math.floor(r/6e4);if(i<1)return a(e,`brain.watch.scan.now`);if(i<60)return a(e,`brain.watch.scan.minutes`,{count:i});let o=Math.floor(i/60);return o<24?a(e,`brain.watch.scan.hours`,{count:o}):a(e,`brain.watch.scan.days`,{count:Math.floor(o/24)})}var we=4;function Te({language:e}){let t=d({queryKey:[`ingestionWatch`],queryFn:i.ingestionWatchStatus,staleTime:3e4,refetchOnWindowFocus:!1,retry:!1}),n=b.useMemo(()=>t.data?.ok?w(t.data.data):null,[t.data]);if(!n||n.enabledCount<1)return null;let r=n.watches.filter(e=>e.enabled).slice(0,we);return r.length?(0,q.jsxs)(`section`,{className:`brain-watch-card`,"aria-label":a(e,`brain.watch.aria`),"data-testid":`watch-health-card`,children:[(0,q.jsxs)(`header`,{className:`brain-watch-head`,children:[(0,q.jsx)(y,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,q.jsx)(`strong`,{children:a(e,`brain.watch.title`)})]}),n.polling?null:(0,q.jsxs)(`p`,{className:`brain-watch-note`,role:`note`,"data-testid":`watch-polling-note`,children:[(0,q.jsx)(m,{className:`h-3 w-3`,"aria-hidden":`true`}),a(e,`brain.watch.notLive`)]}),(0,q.jsx)(`ul`,{className:`brain-watch-list`,children:r.map(t=>(0,q.jsx)(Ee,{language:e,watch:t},t.id))})]}):null}function Ee({language:e,watch:t}){return(0,q.jsxs)(`li`,{className:`brain-watch-item`,children:[(0,q.jsxs)(`div`,{className:`brain-watch-item-row`,children:[(0,q.jsx)(`span`,{className:`brain-watch-path`,title:t.path,children:Q(t.path)}),(0,q.jsx)(`small`,{className:`brain-watch-scan`,children:$(e,t.lastScanAt)})]}),(0,q.jsxs)(`div`,{className:`brain-watch-item-row`,children:[t.lastResult&&t.lastResult.ingested>0?(0,q.jsx)(`span`,{className:`brain-watch-stat`,children:a(e,`brain.watch.ingested`,{count:t.lastResult.ingested})}):null,t.lastResult&&t.lastResult.failed>0?(0,q.jsxs)(`span`,{className:`brain-watch-stat is-failed`,children:[(0,q.jsx)(h,{className:`h-3 w-3`,"aria-hidden":`true`}),a(e,`brain.jobs.failedCount`,{count:t.lastResult.failed})]}):null,t.trackedFiles>0?(0,q.jsx)(`small`,{className:`brain-watch-tracked`,children:a(e,`brain.watch.tracked`,{count:t.trackedFiles})}):null]}),t.lastErrors.length?(0,q.jsxs)(`div`,{className:`brain-watch-errors`,children:[(0,q.jsx)(`small`,{children:a(e,`brain.watch.errors`)}),(0,q.jsx)(`ul`,{children:t.lastErrors.slice(0,3).map((e,t)=>(0,q.jsx)(`li`,{children:[e.path?Q(e.path):``,e.detail].filter(Boolean).join(` — `)},`${e.path}-${t}`))})]}):null]})}function De(e,t){if(!t)return``;let n=new Date(t);return Number.isNaN(n.getTime())?``:n.toLocaleTimeString(e===`ko`?`ko-KR`:`en-US`,{hour:`2-digit`,minute:`2-digit`})}function Oe({language:e,knownRunIds:t}){let n=d({queryKey:[`agentApprovals`],queryFn:i.agentApprovals,staleTime:1/0,refetchOnWindowFocus:!1,retry:!1}),r=b.useMemo(()=>n.data?.ok?C(n.data.data):[],[n.data]),o=b.useMemo(()=>new Set(t),[t]),s=r.filter(e=>!o.has(e.runId));return s.length?(0,q.jsx)(`aside`,{className:`brain-pending-approvals`,role:`note`,"aria-label":a(e,`brain.approval.pendingNotice.aria`),"data-testid":`pending-approvals-notice`,children:s.slice(0,2).map(t=>{let n=De(e,t.expiresAt);return(0,q.jsxs)(`p`,{children:[(0,q.jsx)(`span`,{children:t.goal?a(e,`brain.approval.pendingNotice`,{goal:t.goal}):a(e,`brain.approval.pendingNotice.generic`)}),(0,q.jsx)(`small`,{children:n?a(e,`brain.approval.pendingNotice.expiry`,{time:n}):a(e,`brain.approval.pendingNotice.hint`)})]},t.runId)})}):null}export{S as C,te as E,me as S,v as T,pe as _,Te as a,ue as b,M as c,ae as d,k as f,fe as g,B as h,ve as i,j as l,A as m,Oe as n,de as o,se as p,_e as r,P as s,Ce as t,ne as u,le as v,V as w,oe as x,re as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,_ as t,b as n,d as r,i,m as a,o,t as s,v as c,x as l}from"./utils-CiFtIdZq.js";import{r as u,t as d}from"./useQuery-C7BeG4HU.js";import{t as f}from"./useMutation-CVC4qv_D.js";import{_ as p,b as m,c as h,g,h as _,i as v,m as y,n as b,p as x,t as S,u as C,v as w,x as T,y as E}from"./primitives-Cv5tbZBY.js";import{t as ee}from"./circle-check-DruOxB-4.js";import{n as D,r as O,t as k}from"./hard-drive-D20iavUb.js";import{t as A}from"./folder-open-d-Pip5gr.js";import{t as j}from"./share-2-YNX_NtMU.js";import{d as M,i as N}from"./index-Do83hDzJ.js";import{t as P}from"./button-Ct9f2_oT.js";import{t as F}from"./input-BLXVNmj1.js";import"./workspace-DQz9vIId.js";var I=t(`clipboard-paste`,[[`path`,{d:`M11 14h10`,key:`1w8e9d`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v1.344`,key:`1e62lh`}],[`path`,{d:`m17 18 4-4-4-4`,key:`z2g111`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113`,key:`bjbb7m`}],[`rect`,{x:`8`,y:`2`,width:`8`,height:`4`,rx:`1`,key:`ublpy`}]]),L=t(`scan-line`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]),R=t(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),z=e(l()),B=n();function V(e,t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}return``}function H(e,t){let n=Number(e[t]);return Number.isFinite(n)&&n>0?Math.round(n):0}function U(e){let t=o(e)?e:{},n=o(t.vector_freshness_global)?t.vector_freshness_global:{};return{vectorStatus:V(n,[`status`])||`unavailable`,vectorPending:H(n,`pending_items`),folders:s(t.folders).flatMap(e=>{let t=o(e)?e:{},n=V(t,[`id`]);if(!n)return[];let r=o(t.files)?t.files:{},i=t.coverage;return[{id:n,label:V(t,[`label`,`root_path`])||n,status:V(t,[`status`]),watchActive:t.watch_active===!0,total:H(r,`total`),indexed:H(r,`indexed`),failed:H(r,`failed`),coverage:typeof i==`number`&&Number.isFinite(i)?i:null,errors:s(t.recent_errors).flatMap(e=>{let t=o(e)?e:{},n=V(t,[`detail`]);return n?[{path:V(t,[`path`]),detail:n}]:[]})}]})}}function W({language:e}){let t=d({queryKey:[`folderMemoryHealth`],queryFn:()=>r.localFolderHealth(),staleTime:3e4}),n=z.useMemo(()=>t.data?.ok?U(t.data.data):null,[t.data]);return!n||!n.folders.length?null:(0,B.jsxs)(`section`,{className:`folder-memory-health`,"data-testid":`folder-memory-health`,children:[(0,B.jsx)(`h3`,{children:a(e,`capture.folderHealth.title`)}),(0,B.jsx)(`ul`,{children:n.folders.map(t=>(0,B.jsxs)(`li`,{"data-testid":`folder-health-${t.id}`,children:[(0,B.jsxs)(`div`,{className:`folder-memory-head`,children:[(0,B.jsx)(`strong`,{children:t.label}),(0,B.jsx)(`span`,{className:`folder-memory-coverage`,children:t.coverage===null?a(e,`capture.folderHealth.unknown`):a(e,`capture.folderHealth.coverage`,{percent:Math.round(t.coverage*100),indexed:t.indexed,total:t.total})})]}),t.coverage===null?null:(0,B.jsx)(`div`,{className:`folder-memory-bar`,role:`progressbar`,"aria-valuenow":Math.round(t.coverage*100),"aria-valuemin":0,"aria-valuemax":100,children:(0,B.jsx)(`span`,{style:{width:`${Math.round(t.coverage*100)}%`}})}),t.watchActive?(0,B.jsx)(`small`,{children:a(e,`capture.folderHealth.watching`)}):null,t.failed>0?(0,B.jsxs)(`details`,{className:`folder-memory-errors`,children:[(0,B.jsx)(`summary`,{children:a(e,`capture.folderHealth.failed`,{count:t.failed})}),(0,B.jsx)(`ul`,{children:t.errors.map(e=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`code`,{children:e.path}),(0,B.jsx)(`span`,{children:e.detail})]},`${t.id}-${e.path}-${e.detail}`))})]}):null]},t.id))}),n.vectorPending>0?(0,B.jsx)(`small`,{className:`folder-memory-vector`,children:a(e,`capture.folderHealth.vectorGlobal`,{count:n.vectorPending})}):null]})}var G=[{id:`files`,labelKey:`capture.method.files`,icon:R,path:`capture`},{id:`local`,labelKey:`capture.method.local`,icon:D,path:`my-computer`},{id:`browser`,labelKey:`capture.method.browser`,icon:O,path:`capture-browser`}];function K(e){return G.some(t=>t.id===e)?e:`files`}function q({initialTab:e}){let t=c(e=>e.language),[n,r]=z.useState(()=>K(e));z.useEffect(()=>{r(K(e))},[e]);let i=e=>{r(e),N(`/`+G.find(t=>t.id===e).path)};return(0,B.jsxs)(`div`,{className:`product-page capture-page space-y-5`,children:[(0,B.jsxs)(`header`,{className:`page-hero`,children:[(0,B.jsxs)(`div`,{className:`page-kicker`,children:[(0,B.jsx)(R,{className:`h-4 w-4`}),` `,a(t,`capture.kicker`)]}),(0,B.jsx)(`h1`,{className:`page-title`,children:a(t,`capture.title`)}),(0,B.jsx)(`p`,{className:`page-copy`,children:a(t,`capture.body`)})]}),(0,B.jsxs)(`section`,{className:`capture-station`,"aria-label":a(t,`capture.station.aria`),children:[(0,B.jsxs)(`div`,{className:`capture-station-head`,children:[(0,B.jsx)(`h2`,{children:a(t,`capture.station.title`)}),(0,B.jsx)(`p`,{children:a(t,`capture.station.detail`)})]}),(0,B.jsx)(`div`,{className:`capture-method-switch`,role:`group`,"aria-label":a(t,`capture.method.aria`),children:G.map(({id:e,labelKey:r,icon:o})=>(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":n===e,className:n===e?`is-active`:``,"data-testid":`capture-method-${e}`,onClick:()=>i(e),children:[(0,B.jsx)(o,{className:`h-4 w-4`,"aria-hidden":`true`}),a(t,r)]},e))}),(0,B.jsxs)(`div`,{className:`capture-station-body`,children:[n===`files`?(0,B.jsx)(J,{}):null,n===`local`?(0,B.jsx)(ce,{}):null,n===`browser`?(0,B.jsx)(le,{}):null]})]}),(0,B.jsxs)(`div`,{className:`capture-secondary`,children:[(0,B.jsx)(de,{}),(0,B.jsx)(te,{})]})]})}function J(){let e=c(e=>e.language),t=u(),[n,r]=z.useState([]),i=f({mutationFn:e=>Y(e,r),onSuccess:()=>{t.invalidateQueries({queryKey:[`documents`]}),t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),o=z.useCallback(e=>{let t=Array.from(e);t.length&&i.mutate(t)},[i]);return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`label`,{className:`capture-dropzone`,onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),o(e.dataTransfer.files)},children:[(0,B.jsx)(`div`,{className:`capture-dropzone-mark`,children:(0,B.jsx)(R,{className:`h-6 w-6`})}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(`span`,{className:`text-lg font-semibold block`,children:a(e,`capture.files.drop`)}),(0,B.jsx)(`span`,{className:`max-w-md text-sm text-muted-foreground block`,children:a(e,`capture.files.dropDetail`)})]}),(0,B.jsx)(`input`,{type:`file`,multiple:!0,className:`sr-only`,onChange:e=>e.target.files&&o(e.target.files)})]}),(0,B.jsx)(X,{queue:n,onRetry:e=>o([e])})]})}function te(){let e=c(e=>e.language),t=c(e=>e.mode),n=d({queryKey:[`documents`],queryFn:()=>r.documents(200)}),i=d({queryKey:[`localSources`],queryFn:r.localSources}),o=d({queryKey:[`localAgent`],queryFn:r.localAgent});return(0,B.jsxs)(`div`,{className:`capture-secondary-column space-y-4`,children:[(0,B.jsx)(b,{title:a(e,`capture.files.uploaded`),result:n.data,children:t=>(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(v,{items:t.documents||t,titleKey:`filename`,metaKey:`ingest_state`,limit:12}),(0,B.jsx)(`div`,{className:`rounded-md border border-border bg-background/55 p-3 text-sm text-muted-foreground`,children:a(e,`capture.files.completed`)})]})}),(0,B.jsx)(W,{language:e}),(0,B.jsx)(b,{title:a(e,`capture.local.sources`),result:i.data,children:t=>(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(v,{items:t.sources,titleKey:`path`,metaKey:`status`}),s(t.sources).map(t=>(0,B.jsx)(S,{label:a(e,`capture.local.stop`,{source:String(t.path||t.id||a(e,`capture.local.source`))}),action:()=>r.localWatchStop(String(t.id||t.source_id)),invalidate:[`localSources`]},String(t.id||t.source_id||t.path)))]})}),t===`basic`?null:(0,B.jsx)(b,{title:a(e,`capture.local.access`),result:o.data,children:e=>(0,B.jsx)(C,{value:e})})]})}async function Y(e,t){let n=e.map(e=>({id:`${e.name}-${e.size}-${e.lastModified}-${Date.now()}`,file:e,name:ie(e),size:e.size,status:`queued`}));t(e=>[...n,...e].slice(0,12));let i=[];for(let e of n){t(t=>t.map(t=>t.id===e.id?{...t,status:`uploading`}:t));let n=await r.uploadDocument(e.file);i.push(n),t(t=>t.map(t=>t.id===e.id?{...t,status:n.ok?`done`:`failed`,result:n}:t))}return i}function X({queue:e,onRetry:t}){let n=c(e=>e.language);return e.length?(0,B.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.map(e=>{let r=ne(e,n);return(0,B.jsxs)(`div`,{className:`rounded-md border border-border bg-background/55 p-3 text-sm`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[e.status===`done`?(0,B.jsx)(ee,{className:`h-4 w-4 text-emerald-400`}):e.status===`failed`?(0,B.jsx)(T,{className:`h-4 w-4 text-amber-400`}):(0,B.jsx)(m,{className:`h-4 w-4 animate-spin text-primary`}),e.name]}),(0,B.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[Math.max(1,Math.round(e.size/1024)),` KB · `,r]})]}),e.status===`failed`?(0,B.jsxs)(P,{size:`sm`,variant:`outline`,onClick:()=>t(e.file),children:[(0,B.jsx)(M,{className:`h-3.5 w-3.5`}),` `,a(n,`capture.retry`)]}):null]}),e.result?(0,B.jsx)(h,{result:e.result,successLabel:a(n,`capture.files.success`)}):null]},e.id)})}):null}function ne(e,t){if(e.status===`queued`)return a(t,`capture.files.queued`);if(e.status===`uploading`)return a(t,`capture.files.uploading`);if(!e.result?.ok)return e.result?.error||a(t,`capture.files.failed`);let n=e.result.data||{},r=String(n.node_id||n.graph_node||n.provenance_id||``);return r?a(t,`capture.files.capturedWithNode`,{node:r}):a(t,`capture.files.captured`)}var re={webkitdirectory:``,directory:``};function ie(e){return e.webkitRelativePath||e.name}function ae(e){return(e[0]?.webkitRelativePath||``).split(`/`).filter(Boolean)[0]||``}function Z(){let e=window;return!!(e.__TAURI__?.core?.invoke||e.latticeDesktop?.selectFolder||e.__TAURI_INTERNALS__&&window.location.protocol===`tauri:`)}function oe(e){return e instanceof DOMException&&e.name===`AbortError`}async function se(e){let t=[];if(typeof e.values==`function`){for await(let n of e.values())t.push(n);return t}if(typeof e.entries==`function`)for await(let[,n]of e.entries())t.push(n);return t}async function Q(e){let t=[];for(let n of await se(e)){if(n.kind===`file`){t.push(await n.getFile());continue}t.push(...await Q(n))}return t}function ce(){let e=c(e=>e.language),t=u(),n=z.useRef(null),[i,o]=z.useState(``),[s,l]=z.useState(null),[d,p]=z.useState(``),[g,_]=z.useState(!1),[v,y]=z.useState([]),b=f({mutationFn:e=>r.connectFolder(e.trim()),onSuccess:()=>{l(null),t.invalidateQueries({queryKey:[`localSources`]}),t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),x=f({mutationFn:e=>Y(e,y),onSuccess:()=>{t.invalidateQueries({queryKey:[`documents`]}),t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),S=z.useCallback((t,n)=>{if(!t.length){l(a(e,`capture.local.emptyFolder`));return}l(null),p(n||ae(t)||a(e,`capture.local.browserFolder`)),x.mutate(t)},[x,e]),C=z.useCallback(async()=>{if(!g){_(!0),l(null);try{let t=window.showDirectoryPicker;if(!Z()&&typeof t==`function`){let e=await t.call(window);S(await Q(e),e.name);return}if(Z()){let e=await r.selectFolder();if(e){p(``),o(e),b.mutate(e);return}}if(typeof t==`function`){let e=await t.call(window);S(await Q(e),e.name);return}if(n.current){n.current.click();return}l(a(e,`capture.local.pickUnavailable`))}catch(t){oe(t)||l(a(e,`capture.local.pickUnavailable`))}finally{_(!1)}}},[S,g,b,e]),w=z.useCallback(()=>{let e=i.trim();e&&(l(null),p(``),b.mutate(e))},[b,i]),T=(x.data||[]).find(e=>!e.ok)?.error,E=!!(x.error||T);return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`capture-intake-lead`,children:[(0,B.jsx)(D,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:a(e,`capture.local.title`)}),(0,B.jsx)(`p`,{children:a(e,`capture.local.description`)})]})]}),(0,B.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),w()},children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,B.jsx)(F,{value:i,onChange:e=>o(e.target.value),placeholder:a(e,`capture.local.placeholder`)}),(0,B.jsxs)(P,{type:`button`,variant:`outline`,disabled:g||b.isPending||x.isPending,onClick:()=>void C(),children:[g?(0,B.jsx)(m,{className:`h-4 w-4 animate-spin`}):(0,B.jsx)(A,{className:`h-4 w-4`}),g?a(e,`capture.local.choosing`):a(e,`capture.local.choose`)]})]}),(0,B.jsx)(`input`,{ref:n,type:`file`,multiple:!0,className:`sr-only`,"aria-hidden":`true`,tabIndex:-1,...re,onChange:e=>{let t=Array.from(e.currentTarget.files||[]);e.currentTarget.value=``,S(t)}}),(0,B.jsxs)(P,{type:`submit`,disabled:!i.trim()||b.isPending,children:[b.isPending?(0,B.jsx)(m,{className:`h-4 w-4 animate-spin`}):(0,B.jsx)(L,{className:`h-4 w-4`}),a(e,`capture.local.connect`)]})]}),s?(0,B.jsx)(h,{result:{ok:!1,status:0,data:{},source:`unavailable`,error:s}}):null,b.data?(0,B.jsx)(h,{result:b.data,successLabel:a(e,`capture.local.success`)}):null,d?(0,B.jsx)(h,{result:{ok:x.isPending||!E,status:E?0:200,data:{folder:d},source:E?`unavailable`:`live`,error:x.error?a(e,`capture.local.browserImportFailed`):T},successLabel:x.isPending?a(e,`capture.local.browserImporting`):a(e,`capture.local.browserImportSuccess`,{folder:d})}):null,(0,B.jsx)(X,{queue:v,onRetry:e=>S([e],d)})]})}function le(){let e=c(e=>e.language),t=u(),[n,i]=z.useState(``),o=f({mutationFn:e=>r.browserReadUrl(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),s=z.useCallback(()=>{let e=$(n);e&&(i(e),o.mutate(e))},[o,n]),l=z.useCallback(async()=>{let e=$(await navigator.clipboard?.readText().catch(()=>``)||``);e&&(i(e),o.mutate(e))},[o]);return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`capture-intake-lead`,children:[(0,B.jsx)(O,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:a(e,`capture.browser.title`)}),(0,B.jsx)(`p`,{children:a(e,`capture.browser.description`)})]})]}),(0,B.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:e=>{e.preventDefault(),s()},children:[(0,B.jsx)(F,{value:n,onChange:e=>i(e.target.value),placeholder:a(e,`capture.browser.placeholder`),inputMode:`url`}),(0,B.jsxs)(P,{type:`button`,variant:`outline`,disabled:o.isPending,onClick:()=>void l(),children:[(0,B.jsx)(I,{className:`h-4 w-4`}),` `,a(e,`capture.browser.paste`)]}),(0,B.jsxs)(P,{type:`submit`,disabled:!n.trim()||o.isPending,children:[o.isPending?(0,B.jsx)(m,{className:`h-4 w-4 animate-spin`}):(0,B.jsx)(L,{className:`h-4 w-4`}),a(e,`capture.browser.capture`)]})]}),o.data?(0,B.jsx)(h,{result:o.data,successLabel:a(e,`capture.browser.success`)}):null]})}function $(e){let t=e.trim();return t?/^https?:\/\//i.test(t)?t:/^[\w.-]+\.[a-z]{2,}([/:?#].*)?$/i.test(t)?`https://${t}`:t:``}function ue(e,t,n){let r=o(e)?e:{},i=o(t)?t:{},a=o(n)?n:{};o(i.pipelines)&&i.pipelines;let s=(...e)=>{for(let t of e){if(typeof t==`number`&&Number.isFinite(t)&&t>=0)return Math.round(t);let e=Number(t);if(Number.isFinite(e)&&e>0)return Math.round(e)}},c=s(r.received),l=s(r.extracted),u=s(r.connected),d=s(l,i.total,i.total_items,a.nodes,a.total_nodes)||0,f=s(u,a.edges,a.total_edges)||0,p=s(i.pending,i.pending_items)||0,m=(e,t)=>{let n=r.stages||{};for(let t of e){let e=n[t],r=typeof e==`object`&&e?e.status:e;if(r===`done`||r===`working`||r===`waiting`||r===`error`)return r}return t},h=c===void 0?p?`working`:d?`done`:`waiting`:c>0?`done`:`waiting`,g=l===void 0?d?`done`:`waiting`:l>0?`done`:`waiting`,_=u===void 0?f?`done`:`waiting`:u>0?`done`:`waiting`,v=m([`read`,`received`],h),y=m([`understand`,`extracted`],g),b=m([`connect`,`connected`],_);return{remembered:d,connections:f,waiting:p,received:c??p,extracted:l??d,connected:u??f,steps:[{key:`read`,state:v,count:c??(d||p)},{key:`understand`,state:y,count:l??d},{key:`connect`,state:b,count:u??f}]}}function de(){let e=c(e=>e.language),t=c(e=>e.mode),n=d({queryKey:[`index`],queryFn:r.indexStatus}),o=d({queryKey:[`graphStats`],queryFn:r.graphStats}),s=d({queryKey:[`pipelineStatus`],queryFn:r.pipelineStatus}),l=ue(s.data?.data||s.data,n.data?.data,o.data?.data),u={read:L,understand:E,connect:j},f=!!(l.remembered||l.connections||l.received&&l.received>0);return(0,B.jsxs)(`div`,{className:`capture-secondary-column space-y-4`,children:[(0,B.jsxs)(x,{children:[(0,B.jsxs)(g,{children:[(0,B.jsxs)(p,{className:`flex items-center gap-2`,children:[(0,B.jsx)(L,{className:`h-4 w-4`}),` `,a(e,`capture.pipeline.journey.title`)]}),(0,B.jsx)(_,{children:a(e,`capture.pipeline.journey.detail`)})]}),(0,B.jsxs)(y,{className:`space-y-4`,children:[(0,B.jsx)(`ol`,{className:`capture-journey flex flex-col md:flex-row gap-3 items-stretch`,"aria-label":a(e,`capture.pipeline.journey.aria`),children:l.steps.map(({key:t,state:n,count:r})=>{let i=u[t];return(0,B.jsxs)(`li`,{className:`capture-journey-step is-${n} flex-1 p-3 rounded-lg border border-border/60 bg-muted/20 flex flex-col justify-between`,children:[(0,B.jsxs)(`div`,{className:`capture-journey-step-header flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`capture-journey-mark`,"aria-hidden":`true`,children:(0,B.jsx)(i,{className:`h-4 w-4`})}),(0,B.jsxs)(`div`,{className:`capture-journey-copy min-w-0 flex-1`,children:[(0,B.jsx)(`strong`,{className:`block text-sm`,children:a(e,`capture.pipeline.step.${t}`)}),(0,B.jsx)(`small`,{className:`block text-xs text-muted-foreground`,children:a(e,`capture.pipeline.step.${t}.detail`)})]})]}),(0,B.jsxs)(`div`,{className:`capture-journey-step-meta flex items-center justify-between gap-2 mt-3 pt-2 border-t border-border/40 text-xs`,children:[(0,B.jsx)(w,{variant:`muted`,className:`capture-journey-count`,children:a(e,`ui.value.records`,{count:r})}),(0,B.jsx)(`span`,{className:`capture-journey-state`,children:a(e,`capture.pipeline.step.${n}`)})]})]},t)})}),f?(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm pt-2`,children:[(0,B.jsx)(w,{variant:`success`,children:a(e,`capture.pipeline.count.remembered`,{count:i(l.extracted)})}),(0,B.jsx)(w,{variant:`muted`,children:a(e,`capture.pipeline.count.connections`,{count:i(l.connected)})}),(0,B.jsx)(w,{variant:l.waiting?`warning`:`muted`,children:l.waiting?a(e,`capture.pipeline.count.waiting`,{count:i(l.waiting)}):a(e,`capture.pipeline.count.none`)})]}):(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(e,`capture.pipeline.empty`)})]})]}),(0,B.jsxs)(x,{children:[(0,B.jsxs)(g,{children:[(0,B.jsxs)(p,{className:`flex items-center gap-2`,children:[(0,B.jsx)(k,{className:`h-4 w-4`}),` `,a(e,`capture.pipeline.refresh`)]}),(0,B.jsx)(_,{children:a(e,`capture.pipeline.description`)})]}),(0,B.jsx)(y,{children:(0,B.jsx)(S,{label:a(e,`capture.pipeline.rebuild`),action:()=>r.rebuildIndex(),invalidate:[`index`]})})]}),t===`basic`?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(b,{title:a(e,`capture.pipeline.status`),result:n.data,children:e=>(0,B.jsx)(C,{value:e})}),(0,B.jsx)(b,{title:a(e,`capture.pipeline.growth`),result:o.data,children:e=>(0,B.jsx)(C,{value:e})})]})]})}export{q as CapturePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,_ as t,b as n,d as r,g as i,i as a,m as o,v as s,x as c}from"./utils-Ddol2RWD.js";import{t as l}from"./useQuery-CY2OI2uy.js";import{c as u,o as d,r as f,y as p}from"./primitives-SNp0LRJz.js";import{t as m}from"./link-2-Dwb4gnTc.js";import{d as h,f as g,i as _}from"./index-BMPdTmlY.js";var v=t(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),y=t(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),b=e(c());i({ko:{"chronicle.kicker":`기억의 연대기`,"chronicle.title":`두뇌가 자라온 시간`,"chronicle.copy":`언제 무엇이 들어왔고 무엇이 달라졌는지, 날짜로 되짚어 봅니다.`,"chronicle.loading":`연대기를 불러오는 중입니다.`,"chronicle.empty.title":`오늘부터 기록이 쌓입니다`,"chronicle.empty.detail":`자료를 넣거나 대화를 나누면, 그날부터 이 자리에 하루하루가 남습니다.`,"chronicle.lane.sources":`자료`,"chronicle.lane.entities":`개념`,"chronicle.lane.connections":`연결`,"chronicle.lane.conversations":`대화`,"chronicle.growth.title":`쌓인 기억`,"chronicle.growth.hint":`손잡이를 좌우로 옮기면 그 시점으로 돌아갑니다. 방향키로도 하루씩 움직일 수 있어요.`,"chronicle.growth.aria":`시점 고르기`,"chronicle.growth.valueText":`{date} · 자료 {sources} · 개념 {entities} · 연결 {connections} · 대화 {conversations}`,"chronicle.growth.first":`처음`,"chronicle.growth.latest":`지금`,"chronicle.heatmap.title":`활동 달력`,"chronicle.heatmap.hint":`진한 칸일수록 그날 많이 쌓였다는 뜻이에요. 칸을 누르면 그날 이야기가 아래에 열립니다.`,"chronicle.heatmap.aria":`날짜별 활동`,"chronicle.heatmap.cell":`{date}, {count}가지`,"chronicle.heatmap.cellEmpty":`{date}, 쌓인 것 없음`,"chronicle.heatmap.less":`적음`,"chronicle.heatmap.more":`많음`,"chronicle.weekday.sun":`일`,"chronicle.weekday.mon":`월`,"chronicle.weekday.tue":`화`,"chronicle.weekday.wed":`수`,"chronicle.weekday.thu":`목`,"chronicle.weekday.fri":`금`,"chronicle.weekday.sat":`토`,"chronicle.day.title":`그날의 이야기`,"chronicle.day.loading":`그날 이야기를 불러오는 중입니다.`,"chronicle.day.quiet":`이 날은 조용했습니다. 남은 기록이 없어요.`,"chronicle.group.sources":`자료`,"chronicle.group.entities":`새로 생긴 개념`,"chronicle.group.conversations":`나눈 대화`,"chronicle.group.changes":`달라진 사실`,"chronicle.group.count":`{count}개`,"chronicle.group.empty":`이 날은 없어요.`,"chronicle.group.more":`이 밖에 {count}개가 더 있어요.`,"chronicle.open.source":`기억에서 찾아보기`,"chronicle.open.entity":`지도에서 보기`,"chronicle.open.conversation":`대화로 가기`,"chronicle.open.change":`지도에서 보기`,"chronicle.sourceType.upload":`올린 파일`,"chronicle.sourceType.note":`메모`,"chronicle.sourceType.web_url":`웹 페이지`,"chronicle.sourceType.conversation":`대화`,"chronicle.sourceType.local_file":`내 컴퓨터 파일`,"chronicle.sourceType.image":`그림`,"chronicle.sourceType.other":`자료`,"chronicle.entityType.other":`개념`,"chronicle.conversation.untitled":`제목 없는 대화`,"chronicle.conversation.messages":`{count}번 주고받음`,"chronicle.change.fact_superseded":`새 내용으로 바뀐 사실`,"chronicle.change.fact_retired":`더 이상 사실이 아닌 것`,"chronicle.change.connection_superseded":`다시 이어진 관계`,"chronicle.change.connection_ended":`끊어진 관계`,"chronicle.change.other":`달라진 것`,"chronicle.rewind.title":`그때의 두뇌`,"chronicle.rewind.subtitle":`{date}에 두뇌가 알고 있던 것`,"chronicle.rewind.loading":`그때 모습을 불러오는 중입니다.`,"chronicle.rewind.entities":`기억 조각`,"chronicle.rewind.connections":`이어진 관계`,"chronicle.rewind.note":`여기 두 숫자는 그때 저장돼 있던 모든 것을 셉니다. 위 곡선의 ‘개념’과는 세는 방식이 달라요.`,"chronicle.rewind.top":`그때 중요했던 개념`,"chronicle.rewind.topEmpty":`그때는 아직 눈에 띄는 개념이 없었어요.`,"chronicle.rewind.reset":`지금으로 돌아오기`},en:{"chronicle.kicker":`Brain Chronicle`,"chronicle.title":`How your Brain grew`,"chronicle.copy":`Walk back through what arrived, and what changed, one day at a time.`,"chronicle.loading":`Loading the chronicle.`,"chronicle.empty.title":`The record starts today`,"chronicle.empty.detail":`Add something or have a conversation, and that day will show up right here.`,"chronicle.lane.sources":`Sources`,"chronicle.lane.entities":`Ideas`,"chronicle.lane.connections":`Links`,"chronicle.lane.conversations":`Chats`,"chronicle.growth.title":`What has piled up`,"chronicle.growth.hint":`Drag the handle to travel back to that moment. Arrow keys move a day at a time.`,"chronicle.growth.aria":`Pick a moment`,"chronicle.growth.valueText":`{date} · {sources} sources · {entities} ideas · {connections} links · {conversations} chats`,"chronicle.growth.first":`First`,"chronicle.growth.latest":`Now`,"chronicle.heatmap.title":`Activity calendar`,"chronicle.heatmap.hint":`A darker square means more arrived that day. Pick one and its story opens below.`,"chronicle.heatmap.aria":`Activity by day`,"chronicle.heatmap.cell":`{date}, {count} things`,"chronicle.heatmap.cellEmpty":`{date}, nothing arrived`,"chronicle.heatmap.less":`Less`,"chronicle.heatmap.more":`More`,"chronicle.weekday.sun":`Sun`,"chronicle.weekday.mon":`Mon`,"chronicle.weekday.tue":`Tue`,"chronicle.weekday.wed":`Wed`,"chronicle.weekday.thu":`Thu`,"chronicle.weekday.fri":`Fri`,"chronicle.weekday.sat":`Sat`,"chronicle.day.title":`That day's story`,"chronicle.day.loading":`Loading that day.`,"chronicle.day.quiet":`A quiet day — nothing was recorded.`,"chronicle.group.sources":`Sources`,"chronicle.group.entities":`New ideas`,"chronicle.group.conversations":`Conversations`,"chronicle.group.changes":`What changed`,"chronicle.group.count":`{count}`,"chronicle.group.empty":`Nothing this day.`,"chronicle.group.more":`And {count} more.`,"chronicle.open.source":`Find it in memory`,"chronicle.open.entity":`See it on the map`,"chronicle.open.conversation":`Go to conversations`,"chronicle.open.change":`See it on the map`,"chronicle.sourceType.upload":`Uploaded file`,"chronicle.sourceType.note":`Note`,"chronicle.sourceType.web_url":`Web page`,"chronicle.sourceType.conversation":`Conversation`,"chronicle.sourceType.local_file":`File on this computer`,"chronicle.sourceType.image":`Picture`,"chronicle.sourceType.other":`Source`,"chronicle.entityType.other":`Idea`,"chronicle.conversation.untitled":`Untitled conversation`,"chronicle.conversation.messages":`{count} messages`,"chronicle.change.fact_superseded":`Replaced by newer wording`,"chronicle.change.fact_retired":`No longer true`,"chronicle.change.connection_superseded":`Relinked a different way`,"chronicle.change.connection_ended":`Link ended`,"chronicle.change.other":`Changed`,"chronicle.rewind.title":`Your Brain back then`,"chronicle.rewind.subtitle":`What it knew on {date}`,"chronicle.rewind.loading":`Loading how it looked then.`,"chronicle.rewind.entities":`Pieces of memory`,"chronicle.rewind.connections":`Links between them`,"chronicle.rewind.note":`These two count everything stored at that moment. That is a different measure from the “ideas” line in the curve above.`,"chronicle.rewind.top":`What mattered most then`,"chronicle.rewind.topEmpty":`Nothing stood out yet at that point.`,"chronicle.rewind.reset":`Back to now`}});var x=n(),S=[`chronicle.weekday.sun`,`chronicle.weekday.mon`,`chronicle.weekday.tue`,`chronicle.weekday.wed`,`chronicle.weekday.thu`,`chronicle.weekday.fri`,`chronicle.weekday.sat`];function ee({weeks:e,selectedDate:t,onSelect:n,language:r}){return(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-heatmap`,"data-testid":`chronicle-heatmap`,children:[(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:o(r,`chronicle.heatmap.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,children:o(r,`chronicle.heatmap.hint`)})]}),(0,x.jsxs)(`div`,{className:`chronicle-heatmap-scroll`,children:[(0,x.jsx)(`div`,{className:`chronicle-heatmap-weekdays`,"aria-hidden":`true`,children:S.map(e=>(0,x.jsx)(`span`,{children:o(r,e)},e))}),(0,x.jsx)(`div`,{className:`chronicle-heatmap-grid`,role:`group`,"aria-label":o(r,`chronicle.heatmap.aria`),children:e.map(e=>(0,x.jsx)(`div`,{className:`chronicle-heatmap-week`,children:e.cells.map((i,s)=>i?(0,x.jsx)(`button`,{type:`button`,className:`chronicle-heatmap-cell`,"data-level":i.level,"data-testid":`chronicle-heatmap-cell`,"aria-pressed":i.date===t,"aria-label":o(r,i.daily>0?`chronicle.heatmap.cell`:`chronicle.heatmap.cellEmpty`,{date:i.date,count:a(i.daily)}),onClick:()=>n(i.date)},i.date):(0,x.jsx)(`span`,{className:`chronicle-heatmap-cell is-blank`,"aria-hidden":`true`},`${e.key}-${s}`))},e.key))})]}),(0,x.jsxs)(`p`,{className:`chronicle-heatmap-legend`,children:[(0,x.jsx)(`span`,{children:o(r,`chronicle.heatmap.less`)}),(0,x.jsx)(`span`,{className:`chronicle-heatmap-swatches`,"aria-hidden":`true`,children:[0,1,2,3,4].map(e=>(0,x.jsx)(`span`,{className:`chronicle-heatmap-cell`,"data-level":e},e))}),(0,x.jsx)(`span`,{children:o(r,`chronicle.heatmap.more`)})]})]})}var C=864e5,w=/^(\d{4})-(\d{2})-(\d{2})$/;function T(e){let t=w.exec(e);if(!t)return null;let n=Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3]));return E(n)===e?n:null}function E(e){return new Date(e).toISOString().slice(0,10)}function D(e){let t=T(e);return t===null?0:new Date(t).getUTCDay()}function O(e){let t=new Map;for(let n of e){let e=T(n.date);e!==null&&t.set(E(e),n)}let n=[...t.keys()].sort();if(!n.length)return[];let r=T(n[0]),i=T(n[n.length-1]),a=[],o=0,s=0,c=0,l=0;for(let e=r;e<=i;e+=C){let n=E(e),r=t.get(n),i=r?k(r.sources)+k(r.entities)+k(r.connections)+k(r.conversations):0;r&&(o+=k(r.sources),s+=k(r.entities),c+=k(r.connections),l+=k(r.conversations)),a.push({date:n,sources:o,entities:s,connections:c,conversations:l,total:o+s+c+l,daily:i})}return a}function k(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function A(e,t){if(e<=0)return 0;if(t<=0)return 1;let n=e/t;return n>.66?4:n>.33?3:n>.12?2:1}function j(e){if(!e.length)return[];let t=e.reduce((e,t)=>Math.max(e,t.daily),0),n=T(e[0].date),r=T(e[e.length-1].date),i=n-D(e[0].date)*C,a=r+(6-D(e[e.length-1].date))*C,o=new Map(e.map(e=>[e.date,e.daily])),s=[];for(let e=i;e<=a;e+=7*C){let n=[];for(let r=0;r<7;r+=1){let i=E(e+r*C),a=o.get(i);n.push(a===void 0?null:{date:i,daily:a,level:A(a,t)})}s.push({key:E(e),cells:n})}return s}function M(e,t,n){if(!e.length)return{area:``,line:``};let r=e[e.length-1].total,i=Math.max(e.length-1,1),a=e.map((e,a)=>({x:a/i*t,y:n-(r>0?e.total/r*n:0)})),o=[`M ${N(a[0].x)} ${N(a[0].y)}`];for(let e=1;e<a.length;e+=1)o.push(`L ${N(a[e].x)} ${N(a[e-1].y)}`),o.push(`L ${N(a[e].x)} ${N(a[e].y)}`);let s=o.join(` `);return{area:`${s} ${`L ${N(a[a.length-1].x)} ${n} L ${N(a[0].x)} ${n} Z`}`,line:s}}function N(e){return Math.round(e*100)/100}function P(e){return`${e}T23:59:59`}var F=8,I=`/hybrid-search`,L=`/knowledge-graph`,R=`/brain`;function z({day:e,loading:t,language:n}){let r=(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:o(n,`chronicle.day.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,"data-testid":`chronicle-day-date`,children:e?e.date:``})]});return t||!e?(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-day`,"data-testid":`chronicle-day`,children:[r,(0,x.jsx)(`p`,{className:`chronicle-note`,role:`status`,children:o(n,`chronicle.day.loading`)})]}):(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-day`,"data-testid":`chronicle-day`,children:[r,e.counts.sources+e.counts.entities+e.counts.conversations+e.counts.changes===0?(0,x.jsx)(`p`,{className:`chronicle-note`,"data-testid":`chronicle-day-quiet`,children:o(n,`chronicle.day.quiet`)}):(0,x.jsxs)(`div`,{className:`chronicle-day-groups`,children:[(0,x.jsx)(B,{titleKey:`chronicle.group.sources`,icon:(0,x.jsx)(v,{"aria-hidden":`true`}),count:e.counts.sources,items:V(e,n),language:n}),(0,x.jsx)(B,{titleKey:`chronicle.group.entities`,icon:(0,x.jsx)(p,{"aria-hidden":`true`}),count:e.counts.entities,items:H(e,n),language:n}),(0,x.jsx)(B,{titleKey:`chronicle.group.conversations`,icon:(0,x.jsx)(y,{"aria-hidden":`true`}),count:e.counts.conversations,items:U(e,n),language:n}),(0,x.jsx)(B,{titleKey:`chronicle.group.changes`,icon:(0,x.jsx)(m,{"aria-hidden":`true`}),count:e.counts.changes,items:W(e,n),language:n})]})]})}function B({titleKey:e,icon:t,count:n,items:r,language:i}){let s=r.slice(0,F),c=Math.max(n-s.length,0);return(0,x.jsxs)(`article`,{className:`chronicle-group`,"data-testid":`chronicle-group`,children:[(0,x.jsxs)(`h3`,{className:`chronicle-group-title`,children:[(0,x.jsx)(`span`,{className:`chronicle-group-icon`,children:t}),o(i,e),(0,x.jsx)(`span`,{className:`chronicle-group-count`,children:o(i,`chronicle.group.count`,{count:a(n)})})]}),s.length===0?(0,x.jsx)(`p`,{className:`chronicle-group-empty`,children:o(i,`chronicle.group.empty`)}):(0,x.jsx)(`ul`,{className:`chronicle-group-list`,children:s.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsxs)(`button`,{type:`button`,className:`chronicle-item`,"aria-label":`${e.title} — ${e.openLabel}`,onClick:()=>_(e.target),children:[(0,x.jsx)(`span`,{className:`chronicle-item-title`,children:e.title}),(0,x.jsx)(`span`,{className:`chronicle-item-meta`,children:e.meta})]})},e.key))}),c>0?(0,x.jsx)(`p`,{className:`chronicle-group-more`,children:o(i,`chronicle.group.more`,{count:a(c)})}):null]})}function V(e,t){let n=o(t,`chronicle.open.source`);return e.groups.sources.map(e=>({key:e.id,title:e.title,meta:K(e.source_type,t),target:I,openLabel:n}))}function H(e,t){let n=o(t,`chronicle.open.entity`);return e.groups.entities.map(e=>({key:e.id,title:e.label,meta:q(e.type,t),target:L,openLabel:n}))}function U(e,t){let n=o(t,`chronicle.open.conversation`);return e.groups.conversations.map((e,r)=>({key:e.conversation_id||`loose-${r}`,title:e.preview||o(t,`chronicle.conversation.untitled`),meta:o(t,`chronicle.conversation.messages`,{count:a(e.messages)}),target:R,openLabel:n}))}function W(e,t){let n=o(t,`chronicle.open.change`);return e.groups.changes.map((e,r)=>({key:`${e.node_id}-${r}`,title:e.label,meta:Y(e.kind,t),target:L,openLabel:n}))}var G={upload:`chronicle.sourceType.upload`,note:`chronicle.sourceType.note`,web_url:`chronicle.sourceType.web_url`,conversation:`chronicle.sourceType.conversation`,local_file:`chronicle.sourceType.local_file`,image:`chronicle.sourceType.image`};function K(e,t){return o(t,G[e]||`chronicle.sourceType.other`)}function q(e,t){let n=`ui.entity.${e}`,r=o(t,n);return r===n?o(t,`chronicle.entityType.other`):r}var J={fact_superseded:`chronicle.change.fact_superseded`,fact_retired:`chronicle.change.fact_retired`,connection_superseded:`chronicle.change.connection_superseded`,connection_ended:`chronicle.change.connection_ended`};function Y(e,t){return o(t,J[e]||`chronicle.change.other`)}var X=1e3,Z=220,Q=7;function te({timeline:e,index:t,onIndexChange:n,language:r}){let[i,s]=b.useState(null),c=Math.max(e.length-1,0),l=e[t],u=b.useMemo(()=>M(e,X,Z),[e]),d=c>0?t/c*100:100,f=b.useCallback((e,t)=>{let r=t.getBoundingClientRect();if(r.width<=0)return;let i=(e-r.left)/r.width;n(Math.round(Math.min(Math.max(i,0),1)*c))},[c,n]);b.useEffect(()=>{if(!i)return;let e=e=>f(e.clientX,i),t=()=>s(null);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[i,f]);let p=e=>{let r=ne(e.key,t,c);r!==null&&(e.preventDefault(),n(r))},m=l?o(r,`chronicle.growth.valueText`,{date:l.date,sources:a(l.sources),entities:a(l.entities),connections:a(l.connections),conversations:a(l.conversations)}):o(r,`chronicle.growth.aria`);return(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-growth`,"data-testid":`chronicle-growth`,children:[(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:o(r,`chronicle.growth.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,children:o(r,`chronicle.growth.hint`)})]}),(0,x.jsxs)(`div`,{className:`chronicle-growth-plot`,children:[(0,x.jsxs)(`svg`,{className:`chronicle-growth-chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,x.jsx)(`path`,{className:`chronicle-growth-area`,d:u.area}),(0,x.jsx)(`path`,{className:`chronicle-growth-line`,d:u.line,vectorEffect:`non-scaling-stroke`})]}),(0,x.jsxs)(`div`,{className:`chronicle-growth-track${i?` is-dragging`:``}`,"data-testid":`chronicle-scrubber`,role:`slider`,tabIndex:0,"aria-label":o(r,`chronicle.growth.aria`),"aria-valuemin":0,"aria-valuemax":c,"aria-valuenow":t,"aria-valuetext":m,onKeyDown:p,onPointerDown:e=>{s(e.currentTarget),f(e.clientX,e.currentTarget)},children:[(0,x.jsx)(`span`,{className:`chronicle-growth-marker`,style:{left:`${d}%`},"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`chronicle-growth-handle`,style:{left:`${d}%`},"aria-hidden":`true`})]})]}),(0,x.jsxs)(`div`,{className:`chronicle-growth-axis`,children:[(0,x.jsx)(`span`,{children:o(r,`chronicle.growth.first`)}),(0,x.jsx)(`strong`,{"data-testid":`chronicle-scrubber-date`,children:l?l.date:o(r,`chronicle.growth.latest`)}),(0,x.jsx)(`span`,{children:o(r,`chronicle.growth.latest`)})]}),(0,x.jsxs)(`dl`,{className:`chronicle-lane-row`,children:[(0,x.jsx)($,{labelKey:`chronicle.lane.sources`,value:l?.sources,language:r}),(0,x.jsx)($,{labelKey:`chronicle.lane.entities`,value:l?.entities,language:r}),(0,x.jsx)($,{labelKey:`chronicle.lane.connections`,value:l?.connections,language:r}),(0,x.jsx)($,{labelKey:`chronicle.lane.conversations`,value:l?.conversations,language:r})]})]})}function $({labelKey:e,value:t,language:n}){return(0,x.jsxs)(`div`,{className:`chronicle-lane`,children:[(0,x.jsx)(`dt`,{children:o(n,e)}),(0,x.jsx)(`dd`,{children:a(t)})]})}function ne(e,t,n){let r={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-7,PageUp:Q};if(e===`Home`)return 0;if(e===`End`)return n;let i=r[e];return i===void 0?null:Math.min(Math.max(t+i,0),n)}function re({asOf:e,date:t,loading:n,onReset:r,language:i}){return(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-rewind`,"data-testid":`chronicle-rewind`,children:[(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:o(i,`chronicle.rewind.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,children:o(i,`chronicle.rewind.subtitle`,{date:t})}),(0,x.jsxs)(`button`,{type:`button`,className:`chronicle-reset`,onClick:r,children:[(0,x.jsx)(h,{"aria-hidden":`true`}),o(i,`chronicle.rewind.reset`)]})]}),n||!e?(0,x.jsx)(`p`,{className:`chronicle-note`,role:`status`,children:o(i,`chronicle.rewind.loading`)}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`dl`,{className:`chronicle-lane-row chronicle-rewind-stats`,children:[(0,x.jsxs)(`div`,{className:`chronicle-lane`,children:[(0,x.jsx)(`dt`,{children:o(i,`chronicle.rewind.entities`)}),(0,x.jsx)(`dd`,{"data-testid":`chronicle-rewind-entities`,children:a(e.stats.entities)})]}),(0,x.jsxs)(`div`,{className:`chronicle-lane`,children:[(0,x.jsx)(`dt`,{children:o(i,`chronicle.rewind.connections`)}),(0,x.jsx)(`dd`,{children:a(e.stats.connections)})]})]}),(0,x.jsx)(`p`,{className:`chronicle-note chronicle-rewind-note`,children:o(i,`chronicle.rewind.note`)}),(0,x.jsx)(`h3`,{className:`chronicle-group-title`,children:o(i,`chronicle.rewind.top`)}),e.top_entities.length===0?(0,x.jsx)(`p`,{className:`chronicle-group-empty`,children:o(i,`chronicle.rewind.topEmpty`)}):(0,x.jsx)(`ul`,{className:`chronicle-group-list chronicle-rewind-list`,children:e.top_entities.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsxs)(`button`,{type:`button`,className:`chronicle-item`,"aria-label":`${e.label} — ${o(i,`chronicle.open.entity`)}`,onClick:()=>_(`/knowledge-graph`),children:[(0,x.jsx)(`span`,{className:`chronicle-item-title`,children:e.label}),(0,x.jsx)(`span`,{className:`chronicle-item-meta`,children:q(e.type,i)})]})},e.id))})]})]})}function ie(){let e=s(e=>e.language),t=l({queryKey:[`chronicleOverview`],queryFn:r.chronicleOverview}),n=t.data,i=n?.data,a=b.useMemo(()=>O(i?.series??[]),[i]),c=b.useMemo(()=>j(a),[a]),[p,m]=b.useState(null),h=Math.max(a.length-1,0),_=p===null?-1:a.findIndex(e=>e.date===p),v=_>=0?_:h,y=a[v],S=y?y.date:``,C=!!y&&v<h,w=l({queryKey:[`chronicleDay`,S],queryFn:()=>r.chronicleDay(S),enabled:S!==``}),T=l({queryKey:[`chronicleAsOf`,S],queryFn:()=>r.chronicleAsOf(P(S)),enabled:C});return(0,x.jsxs)(`div`,{className:`product-page chronicle-page`,"data-testid":`page-chronicle`,children:[(0,x.jsxs)(`header`,{className:`page-hero`,children:[(0,x.jsxs)(`div`,{className:`page-kicker`,children:[(0,x.jsx)(g,{className:`h-4 w-4`}),` `,o(e,`chronicle.kicker`)]}),(0,x.jsx)(`h1`,{className:`page-title`,children:o(e,`chronicle.title`)}),(0,x.jsx)(`p`,{className:`page-copy`,children:o(e,`chronicle.copy`)})]}),t.isLoading?(0,x.jsx)(d,{title:o(e,`chronicle.loading`)}):n&&!n.ok?(0,x.jsx)(u,{result:n}):a.length===0?(0,x.jsx)(f,{title:o(e,`chronicle.empty.title`),detail:o(e,`chronicle.empty.detail`)}):(0,x.jsxs)(`div`,{className:`chronicle-stack`,children:[(0,x.jsx)(te,{timeline:a,index:v,onIndexChange:e=>m(a[e].date),language:e}),(0,x.jsx)(ee,{weeks:c,selectedDate:S,onSelect:m,language:e}),C?(0,x.jsx)(re,{asOf:T.data?.data??null,date:S,loading:T.isPending,onReset:()=>m(null),language:e}):null,(0,x.jsx)(z,{day:w.data?.data??null,loading:w.isPending,language:e})]})]})}export{ie as ChroniclePage};
|
|
1
|
+
import{C as e,_ as t,b as n,d as r,g as i,i as a,m as o,v as s,x as c}from"./utils-CiFtIdZq.js";import{t as l}from"./useQuery-C7BeG4HU.js";import{c as u,o as d,r as f,y as p}from"./primitives-Cv5tbZBY.js";import{t as m}from"./link-2-BPJOFlAy.js";import{d as h,f as g,i as _}from"./index-Do83hDzJ.js";var v=t(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),y=t(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),b=e(c());i({ko:{"chronicle.kicker":`기억의 연대기`,"chronicle.title":`두뇌가 자라온 시간`,"chronicle.copy":`언제 무엇이 들어왔고 무엇이 달라졌는지, 날짜로 되짚어 봅니다.`,"chronicle.loading":`연대기를 불러오는 중입니다.`,"chronicle.empty.title":`오늘부터 기록이 쌓입니다`,"chronicle.empty.detail":`자료를 넣거나 대화를 나누면, 그날부터 이 자리에 하루하루가 남습니다.`,"chronicle.lane.sources":`자료`,"chronicle.lane.entities":`개념`,"chronicle.lane.connections":`연결`,"chronicle.lane.conversations":`대화`,"chronicle.growth.title":`쌓인 기억`,"chronicle.growth.hint":`손잡이를 좌우로 옮기면 그 시점으로 돌아갑니다. 방향키로도 하루씩 움직일 수 있어요.`,"chronicle.growth.aria":`시점 고르기`,"chronicle.growth.valueText":`{date} · 자료 {sources} · 개념 {entities} · 연결 {connections} · 대화 {conversations}`,"chronicle.growth.first":`처음`,"chronicle.growth.latest":`지금`,"chronicle.heatmap.title":`활동 달력`,"chronicle.heatmap.hint":`진한 칸일수록 그날 많이 쌓였다는 뜻이에요. 칸을 누르면 그날 이야기가 아래에 열립니다.`,"chronicle.heatmap.aria":`날짜별 활동`,"chronicle.heatmap.cell":`{date}, {count}가지`,"chronicle.heatmap.cellEmpty":`{date}, 쌓인 것 없음`,"chronicle.heatmap.less":`적음`,"chronicle.heatmap.more":`많음`,"chronicle.weekday.sun":`일`,"chronicle.weekday.mon":`월`,"chronicle.weekday.tue":`화`,"chronicle.weekday.wed":`수`,"chronicle.weekday.thu":`목`,"chronicle.weekday.fri":`금`,"chronicle.weekday.sat":`토`,"chronicle.day.title":`그날의 이야기`,"chronicle.day.loading":`그날 이야기를 불러오는 중입니다.`,"chronicle.day.quiet":`이 날은 조용했습니다. 남은 기록이 없어요.`,"chronicle.group.sources":`자료`,"chronicle.group.entities":`새로 생긴 개념`,"chronicle.group.conversations":`나눈 대화`,"chronicle.group.changes":`달라진 사실`,"chronicle.group.count":`{count}개`,"chronicle.group.empty":`이 날은 없어요.`,"chronicle.group.more":`이 밖에 {count}개가 더 있어요.`,"chronicle.open.source":`기억에서 찾아보기`,"chronicle.open.entity":`지도에서 보기`,"chronicle.open.conversation":`대화로 가기`,"chronicle.open.change":`지도에서 보기`,"chronicle.sourceType.upload":`올린 파일`,"chronicle.sourceType.note":`메모`,"chronicle.sourceType.web_url":`웹 페이지`,"chronicle.sourceType.conversation":`대화`,"chronicle.sourceType.local_file":`내 컴퓨터 파일`,"chronicle.sourceType.image":`그림`,"chronicle.sourceType.other":`자료`,"chronicle.entityType.other":`개념`,"chronicle.conversation.untitled":`제목 없는 대화`,"chronicle.conversation.messages":`{count}번 주고받음`,"chronicle.change.fact_superseded":`새 내용으로 바뀐 사실`,"chronicle.change.fact_retired":`더 이상 사실이 아닌 것`,"chronicle.change.connection_superseded":`다시 이어진 관계`,"chronicle.change.connection_ended":`끊어진 관계`,"chronicle.change.other":`달라진 것`,"chronicle.rewind.title":`그때의 두뇌`,"chronicle.rewind.subtitle":`{date}에 두뇌가 알고 있던 것`,"chronicle.rewind.loading":`그때 모습을 불러오는 중입니다.`,"chronicle.rewind.entities":`기억 조각`,"chronicle.rewind.connections":`이어진 관계`,"chronicle.rewind.note":`여기 두 숫자는 그때 저장돼 있던 모든 것을 셉니다. 위 곡선의 ‘개념’과는 세는 방식이 달라요.`,"chronicle.rewind.top":`그때 중요했던 개념`,"chronicle.rewind.topEmpty":`그때는 아직 눈에 띄는 개념이 없었어요.`,"chronicle.rewind.reset":`지금으로 돌아오기`},en:{"chronicle.kicker":`Brain Chronicle`,"chronicle.title":`How your Brain grew`,"chronicle.copy":`Walk back through what arrived, and what changed, one day at a time.`,"chronicle.loading":`Loading the chronicle.`,"chronicle.empty.title":`The record starts today`,"chronicle.empty.detail":`Add something or have a conversation, and that day will show up right here.`,"chronicle.lane.sources":`Sources`,"chronicle.lane.entities":`Ideas`,"chronicle.lane.connections":`Links`,"chronicle.lane.conversations":`Chats`,"chronicle.growth.title":`What has piled up`,"chronicle.growth.hint":`Drag the handle to travel back to that moment. Arrow keys move a day at a time.`,"chronicle.growth.aria":`Pick a moment`,"chronicle.growth.valueText":`{date} · {sources} sources · {entities} ideas · {connections} links · {conversations} chats`,"chronicle.growth.first":`First`,"chronicle.growth.latest":`Now`,"chronicle.heatmap.title":`Activity calendar`,"chronicle.heatmap.hint":`A darker square means more arrived that day. Pick one and its story opens below.`,"chronicle.heatmap.aria":`Activity by day`,"chronicle.heatmap.cell":`{date}, {count} things`,"chronicle.heatmap.cellEmpty":`{date}, nothing arrived`,"chronicle.heatmap.less":`Less`,"chronicle.heatmap.more":`More`,"chronicle.weekday.sun":`Sun`,"chronicle.weekday.mon":`Mon`,"chronicle.weekday.tue":`Tue`,"chronicle.weekday.wed":`Wed`,"chronicle.weekday.thu":`Thu`,"chronicle.weekday.fri":`Fri`,"chronicle.weekday.sat":`Sat`,"chronicle.day.title":`That day's story`,"chronicle.day.loading":`Loading that day.`,"chronicle.day.quiet":`A quiet day — nothing was recorded.`,"chronicle.group.sources":`Sources`,"chronicle.group.entities":`New ideas`,"chronicle.group.conversations":`Conversations`,"chronicle.group.changes":`What changed`,"chronicle.group.count":`{count}`,"chronicle.group.empty":`Nothing this day.`,"chronicle.group.more":`And {count} more.`,"chronicle.open.source":`Find it in memory`,"chronicle.open.entity":`See it on the map`,"chronicle.open.conversation":`Go to conversations`,"chronicle.open.change":`See it on the map`,"chronicle.sourceType.upload":`Uploaded file`,"chronicle.sourceType.note":`Note`,"chronicle.sourceType.web_url":`Web page`,"chronicle.sourceType.conversation":`Conversation`,"chronicle.sourceType.local_file":`File on this computer`,"chronicle.sourceType.image":`Picture`,"chronicle.sourceType.other":`Source`,"chronicle.entityType.other":`Idea`,"chronicle.conversation.untitled":`Untitled conversation`,"chronicle.conversation.messages":`{count} messages`,"chronicle.change.fact_superseded":`Replaced by newer wording`,"chronicle.change.fact_retired":`No longer true`,"chronicle.change.connection_superseded":`Relinked a different way`,"chronicle.change.connection_ended":`Link ended`,"chronicle.change.other":`Changed`,"chronicle.rewind.title":`Your Brain back then`,"chronicle.rewind.subtitle":`What it knew on {date}`,"chronicle.rewind.loading":`Loading how it looked then.`,"chronicle.rewind.entities":`Pieces of memory`,"chronicle.rewind.connections":`Links between them`,"chronicle.rewind.note":`These two count everything stored at that moment. That is a different measure from the “ideas” line in the curve above.`,"chronicle.rewind.top":`What mattered most then`,"chronicle.rewind.topEmpty":`Nothing stood out yet at that point.`,"chronicle.rewind.reset":`Back to now`}});var x=n(),S=[`chronicle.weekday.sun`,`chronicle.weekday.mon`,`chronicle.weekday.tue`,`chronicle.weekday.wed`,`chronicle.weekday.thu`,`chronicle.weekday.fri`,`chronicle.weekday.sat`];function ee({weeks:e,selectedDate:t,onSelect:n,language:r}){return(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-heatmap`,"data-testid":`chronicle-heatmap`,children:[(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:o(r,`chronicle.heatmap.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,children:o(r,`chronicle.heatmap.hint`)})]}),(0,x.jsxs)(`div`,{className:`chronicle-heatmap-scroll`,children:[(0,x.jsx)(`div`,{className:`chronicle-heatmap-weekdays`,"aria-hidden":`true`,children:S.map(e=>(0,x.jsx)(`span`,{children:o(r,e)},e))}),(0,x.jsx)(`div`,{className:`chronicle-heatmap-grid`,role:`group`,"aria-label":o(r,`chronicle.heatmap.aria`),children:e.map(e=>(0,x.jsx)(`div`,{className:`chronicle-heatmap-week`,children:e.cells.map((i,s)=>i?(0,x.jsx)(`button`,{type:`button`,className:`chronicle-heatmap-cell`,"data-level":i.level,"data-testid":`chronicle-heatmap-cell`,"aria-pressed":i.date===t,"aria-label":o(r,i.daily>0?`chronicle.heatmap.cell`:`chronicle.heatmap.cellEmpty`,{date:i.date,count:a(i.daily)}),onClick:()=>n(i.date)},i.date):(0,x.jsx)(`span`,{className:`chronicle-heatmap-cell is-blank`,"aria-hidden":`true`},`${e.key}-${s}`))},e.key))})]}),(0,x.jsxs)(`p`,{className:`chronicle-heatmap-legend`,children:[(0,x.jsx)(`span`,{children:o(r,`chronicle.heatmap.less`)}),(0,x.jsx)(`span`,{className:`chronicle-heatmap-swatches`,"aria-hidden":`true`,children:[0,1,2,3,4].map(e=>(0,x.jsx)(`span`,{className:`chronicle-heatmap-cell`,"data-level":e},e))}),(0,x.jsx)(`span`,{children:o(r,`chronicle.heatmap.more`)})]})]})}var C=864e5,w=/^(\d{4})-(\d{2})-(\d{2})$/;function T(e){let t=w.exec(e);if(!t)return null;let n=Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3]));return E(n)===e?n:null}function E(e){return new Date(e).toISOString().slice(0,10)}function D(e){let t=T(e);return t===null?0:new Date(t).getUTCDay()}function O(e){let t=new Map;for(let n of e){let e=T(n.date);e!==null&&t.set(E(e),n)}let n=[...t.keys()].sort();if(!n.length)return[];let r=T(n[0]),i=T(n[n.length-1]),a=[],o=0,s=0,c=0,l=0;for(let e=r;e<=i;e+=C){let n=E(e),r=t.get(n),i=r?k(r.sources)+k(r.entities)+k(r.connections)+k(r.conversations):0;r&&(o+=k(r.sources),s+=k(r.entities),c+=k(r.connections),l+=k(r.conversations)),a.push({date:n,sources:o,entities:s,connections:c,conversations:l,total:o+s+c+l,daily:i})}return a}function k(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function A(e,t){if(e<=0)return 0;if(t<=0)return 1;let n=e/t;return n>.66?4:n>.33?3:n>.12?2:1}function j(e){if(!e.length)return[];let t=e.reduce((e,t)=>Math.max(e,t.daily),0),n=T(e[0].date),r=T(e[e.length-1].date),i=n-D(e[0].date)*C,a=r+(6-D(e[e.length-1].date))*C,o=new Map(e.map(e=>[e.date,e.daily])),s=[];for(let e=i;e<=a;e+=7*C){let n=[];for(let r=0;r<7;r+=1){let i=E(e+r*C),a=o.get(i);n.push(a===void 0?null:{date:i,daily:a,level:A(a,t)})}s.push({key:E(e),cells:n})}return s}function M(e,t,n){if(!e.length)return{area:``,line:``};let r=e[e.length-1].total,i=Math.max(e.length-1,1),a=e.map((e,a)=>({x:a/i*t,y:n-(r>0?e.total/r*n:0)})),o=[`M ${N(a[0].x)} ${N(a[0].y)}`];for(let e=1;e<a.length;e+=1)o.push(`L ${N(a[e].x)} ${N(a[e-1].y)}`),o.push(`L ${N(a[e].x)} ${N(a[e].y)}`);let s=o.join(` `);return{area:`${s} ${`L ${N(a[a.length-1].x)} ${n} L ${N(a[0].x)} ${n} Z`}`,line:s}}function N(e){return Math.round(e*100)/100}function P(e){return`${e}T23:59:59`}var F=8,I=`/hybrid-search`,L=`/knowledge-graph`,R=`/brain`;function z({day:e,loading:t,language:n}){let r=(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:o(n,`chronicle.day.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,"data-testid":`chronicle-day-date`,children:e?e.date:``})]});return t||!e?(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-day`,"data-testid":`chronicle-day`,children:[r,(0,x.jsx)(`p`,{className:`chronicle-note`,role:`status`,children:o(n,`chronicle.day.loading`)})]}):(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-day`,"data-testid":`chronicle-day`,children:[r,e.counts.sources+e.counts.entities+e.counts.conversations+e.counts.changes===0?(0,x.jsx)(`p`,{className:`chronicle-note`,"data-testid":`chronicle-day-quiet`,children:o(n,`chronicle.day.quiet`)}):(0,x.jsxs)(`div`,{className:`chronicle-day-groups`,children:[(0,x.jsx)(B,{titleKey:`chronicle.group.sources`,icon:(0,x.jsx)(v,{"aria-hidden":`true`}),count:e.counts.sources,items:V(e,n),language:n}),(0,x.jsx)(B,{titleKey:`chronicle.group.entities`,icon:(0,x.jsx)(p,{"aria-hidden":`true`}),count:e.counts.entities,items:H(e,n),language:n}),(0,x.jsx)(B,{titleKey:`chronicle.group.conversations`,icon:(0,x.jsx)(y,{"aria-hidden":`true`}),count:e.counts.conversations,items:U(e,n),language:n}),(0,x.jsx)(B,{titleKey:`chronicle.group.changes`,icon:(0,x.jsx)(m,{"aria-hidden":`true`}),count:e.counts.changes,items:W(e,n),language:n})]})]})}function B({titleKey:e,icon:t,count:n,items:r,language:i}){let s=r.slice(0,F),c=Math.max(n-s.length,0);return(0,x.jsxs)(`article`,{className:`chronicle-group`,"data-testid":`chronicle-group`,children:[(0,x.jsxs)(`h3`,{className:`chronicle-group-title`,children:[(0,x.jsx)(`span`,{className:`chronicle-group-icon`,children:t}),o(i,e),(0,x.jsx)(`span`,{className:`chronicle-group-count`,children:o(i,`chronicle.group.count`,{count:a(n)})})]}),s.length===0?(0,x.jsx)(`p`,{className:`chronicle-group-empty`,children:o(i,`chronicle.group.empty`)}):(0,x.jsx)(`ul`,{className:`chronicle-group-list`,children:s.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsxs)(`button`,{type:`button`,className:`chronicle-item`,"aria-label":`${e.title} — ${e.openLabel}`,onClick:()=>_(e.target),children:[(0,x.jsx)(`span`,{className:`chronicle-item-title`,children:e.title}),(0,x.jsx)(`span`,{className:`chronicle-item-meta`,children:e.meta})]})},e.key))}),c>0?(0,x.jsx)(`p`,{className:`chronicle-group-more`,children:o(i,`chronicle.group.more`,{count:a(c)})}):null]})}function V(e,t){let n=o(t,`chronicle.open.source`);return e.groups.sources.map(e=>({key:e.id,title:e.title,meta:K(e.source_type,t),target:I,openLabel:n}))}function H(e,t){let n=o(t,`chronicle.open.entity`);return e.groups.entities.map(e=>({key:e.id,title:e.label,meta:q(e.type,t),target:L,openLabel:n}))}function U(e,t){let n=o(t,`chronicle.open.conversation`);return e.groups.conversations.map((e,r)=>({key:e.conversation_id||`loose-${r}`,title:e.preview||o(t,`chronicle.conversation.untitled`),meta:o(t,`chronicle.conversation.messages`,{count:a(e.messages)}),target:R,openLabel:n}))}function W(e,t){let n=o(t,`chronicle.open.change`);return e.groups.changes.map((e,r)=>({key:`${e.node_id}-${r}`,title:e.label,meta:Y(e.kind,t),target:L,openLabel:n}))}var G={upload:`chronicle.sourceType.upload`,note:`chronicle.sourceType.note`,web_url:`chronicle.sourceType.web_url`,conversation:`chronicle.sourceType.conversation`,local_file:`chronicle.sourceType.local_file`,image:`chronicle.sourceType.image`};function K(e,t){return o(t,G[e]||`chronicle.sourceType.other`)}function q(e,t){let n=`ui.entity.${e}`,r=o(t,n);return r===n?o(t,`chronicle.entityType.other`):r}var J={fact_superseded:`chronicle.change.fact_superseded`,fact_retired:`chronicle.change.fact_retired`,connection_superseded:`chronicle.change.connection_superseded`,connection_ended:`chronicle.change.connection_ended`};function Y(e,t){return o(t,J[e]||`chronicle.change.other`)}var X=1e3,Z=220,Q=7;function te({timeline:e,index:t,onIndexChange:n,language:r}){let[i,s]=b.useState(null),c=Math.max(e.length-1,0),l=e[t],u=b.useMemo(()=>M(e,X,Z),[e]),d=c>0?t/c*100:100,f=b.useCallback((e,t)=>{let r=t.getBoundingClientRect();if(r.width<=0)return;let i=(e-r.left)/r.width;n(Math.round(Math.min(Math.max(i,0),1)*c))},[c,n]);b.useEffect(()=>{if(!i)return;let e=e=>f(e.clientX,i),t=()=>s(null);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[i,f]);let p=e=>{let r=ne(e.key,t,c);r!==null&&(e.preventDefault(),n(r))},m=l?o(r,`chronicle.growth.valueText`,{date:l.date,sources:a(l.sources),entities:a(l.entities),connections:a(l.connections),conversations:a(l.conversations)}):o(r,`chronicle.growth.aria`);return(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-growth`,"data-testid":`chronicle-growth`,children:[(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:o(r,`chronicle.growth.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,children:o(r,`chronicle.growth.hint`)})]}),(0,x.jsxs)(`div`,{className:`chronicle-growth-plot`,children:[(0,x.jsxs)(`svg`,{className:`chronicle-growth-chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,x.jsx)(`path`,{className:`chronicle-growth-area`,d:u.area}),(0,x.jsx)(`path`,{className:`chronicle-growth-line`,d:u.line,vectorEffect:`non-scaling-stroke`})]}),(0,x.jsxs)(`div`,{className:`chronicle-growth-track${i?` is-dragging`:``}`,"data-testid":`chronicle-scrubber`,role:`slider`,tabIndex:0,"aria-label":o(r,`chronicle.growth.aria`),"aria-valuemin":0,"aria-valuemax":c,"aria-valuenow":t,"aria-valuetext":m,onKeyDown:p,onPointerDown:e=>{s(e.currentTarget),f(e.clientX,e.currentTarget)},children:[(0,x.jsx)(`span`,{className:`chronicle-growth-marker`,style:{left:`${d}%`},"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`chronicle-growth-handle`,style:{left:`${d}%`},"aria-hidden":`true`})]})]}),(0,x.jsxs)(`div`,{className:`chronicle-growth-axis`,children:[(0,x.jsx)(`span`,{children:o(r,`chronicle.growth.first`)}),(0,x.jsx)(`strong`,{"data-testid":`chronicle-scrubber-date`,children:l?l.date:o(r,`chronicle.growth.latest`)}),(0,x.jsx)(`span`,{children:o(r,`chronicle.growth.latest`)})]}),(0,x.jsxs)(`dl`,{className:`chronicle-lane-row`,children:[(0,x.jsx)($,{labelKey:`chronicle.lane.sources`,value:l?.sources,language:r}),(0,x.jsx)($,{labelKey:`chronicle.lane.entities`,value:l?.entities,language:r}),(0,x.jsx)($,{labelKey:`chronicle.lane.connections`,value:l?.connections,language:r}),(0,x.jsx)($,{labelKey:`chronicle.lane.conversations`,value:l?.conversations,language:r})]})]})}function $({labelKey:e,value:t,language:n}){return(0,x.jsxs)(`div`,{className:`chronicle-lane`,children:[(0,x.jsx)(`dt`,{children:o(n,e)}),(0,x.jsx)(`dd`,{children:a(t)})]})}function ne(e,t,n){let r={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-7,PageUp:Q};if(e===`Home`)return 0;if(e===`End`)return n;let i=r[e];return i===void 0?null:Math.min(Math.max(t+i,0),n)}function re({asOf:e,date:t,loading:n,onReset:r,language:i}){return(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-rewind`,"data-testid":`chronicle-rewind`,children:[(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:o(i,`chronicle.rewind.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,children:o(i,`chronicle.rewind.subtitle`,{date:t})}),(0,x.jsxs)(`button`,{type:`button`,className:`chronicle-reset`,onClick:r,children:[(0,x.jsx)(h,{"aria-hidden":`true`}),o(i,`chronicle.rewind.reset`)]})]}),n||!e?(0,x.jsx)(`p`,{className:`chronicle-note`,role:`status`,children:o(i,`chronicle.rewind.loading`)}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`dl`,{className:`chronicle-lane-row chronicle-rewind-stats`,children:[(0,x.jsxs)(`div`,{className:`chronicle-lane`,children:[(0,x.jsx)(`dt`,{children:o(i,`chronicle.rewind.entities`)}),(0,x.jsx)(`dd`,{"data-testid":`chronicle-rewind-entities`,children:a(e.stats.entities)})]}),(0,x.jsxs)(`div`,{className:`chronicle-lane`,children:[(0,x.jsx)(`dt`,{children:o(i,`chronicle.rewind.connections`)}),(0,x.jsx)(`dd`,{children:a(e.stats.connections)})]})]}),(0,x.jsx)(`p`,{className:`chronicle-note chronicle-rewind-note`,children:o(i,`chronicle.rewind.note`)}),(0,x.jsx)(`h3`,{className:`chronicle-group-title`,children:o(i,`chronicle.rewind.top`)}),e.top_entities.length===0?(0,x.jsx)(`p`,{className:`chronicle-group-empty`,children:o(i,`chronicle.rewind.topEmpty`)}):(0,x.jsx)(`ul`,{className:`chronicle-group-list chronicle-rewind-list`,children:e.top_entities.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsxs)(`button`,{type:`button`,className:`chronicle-item`,"aria-label":`${e.label} — ${o(i,`chronicle.open.entity`)}`,onClick:()=>_(`/knowledge-graph`),children:[(0,x.jsx)(`span`,{className:`chronicle-item-title`,children:e.label}),(0,x.jsx)(`span`,{className:`chronicle-item-meta`,children:q(e.type,i)})]})},e.id))})]})]})}function ie(){let e=s(e=>e.language),t=l({queryKey:[`chronicleOverview`],queryFn:r.chronicleOverview}),n=t.data,i=n?.data,a=b.useMemo(()=>O(i?.series??[]),[i]),c=b.useMemo(()=>j(a),[a]),[p,m]=b.useState(null),h=Math.max(a.length-1,0),_=p===null?-1:a.findIndex(e=>e.date===p),v=_>=0?_:h,y=a[v],S=y?y.date:``,C=!!y&&v<h,w=l({queryKey:[`chronicleDay`,S],queryFn:()=>r.chronicleDay(S),enabled:S!==``}),T=l({queryKey:[`chronicleAsOf`,S],queryFn:()=>r.chronicleAsOf(P(S)),enabled:C});return(0,x.jsxs)(`div`,{className:`product-page chronicle-page`,"data-testid":`page-chronicle`,children:[(0,x.jsxs)(`header`,{className:`page-hero`,children:[(0,x.jsxs)(`div`,{className:`page-kicker`,children:[(0,x.jsx)(g,{className:`h-4 w-4`}),` `,o(e,`chronicle.kicker`)]}),(0,x.jsx)(`h1`,{className:`page-title`,children:o(e,`chronicle.title`)}),(0,x.jsx)(`p`,{className:`page-copy`,children:o(e,`chronicle.copy`)})]}),t.isLoading?(0,x.jsx)(d,{title:o(e,`chronicle.loading`)}):n&&!n.ok?(0,x.jsx)(u,{result:n}):a.length===0?(0,x.jsx)(f,{title:o(e,`chronicle.empty.title`),detail:o(e,`chronicle.empty.detail`)}):(0,x.jsxs)(`div`,{className:`chronicle-stack`,children:[(0,x.jsx)(te,{timeline:a,index:v,onIndexChange:e=>m(a[e].date),language:e}),(0,x.jsx)(ee,{weeks:c,selectedDate:S,onSelect:m,language:e}),C?(0,x.jsx)(re,{asOf:T.data?.data??null,date:S,loading:T.isPending,onReset:()=>m(null),language:e}):null,(0,x.jsx)(z,{day:w.data?.data??null,loading:w.isPending,language:e})]})]})}export{ie as ChroniclePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,_ as t,b as n,d as r,m as i,t as a,x as o}from"./utils-
|
|
1
|
+
import{C as e,_ as t,b as n,d as r,m as i,t as a,x as o}from"./utils-CiFtIdZq.js";import{t as s}from"./useQuery-C7BeG4HU.js";import{t as c}from"./bot-Cn8bWRuq.js";import{t as l}from"./search-CT9aho2j.js";import{n as u,t as d}from"./useFocusTrap-ZVI98jaW.js";import{h as f,i as p,o as m,p as h}from"./index-Do83hDzJ.js";var g=t(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),_=t(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),v=t(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),y=e(o()),b=n(),x=m.map(e=>{let t=e.icon;return{...e,icon:(0,b.jsx)(t,{className:`h-4 w-4`})}});function S(e,t){let[n,r]=y.useState(e);return y.useEffect(()=>{let n=window.setTimeout(()=>r(e),t);return()=>window.clearTimeout(n)},[e,t]),n}function C({language:e,initialOpen:t=!1}){let[n,o]=y.useState(t),[m,C]=y.useState(``),[w,T]=y.useState(0),E=y.useRef(null),D=S(m.trim(),220);y.useEffect(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),o(e=>!e))},t=()=>o(!0);return window.addEventListener(`keydown`,e),window.addEventListener(`lattice:open-command`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`lattice:open-command`,t)}},[]),y.useEffect(()=>{n&&(C(``),T(0),window.setTimeout(()=>E.current?.focus(),0))},[n]);let O=s({queryKey:[`commandSearch`,D],queryFn:()=>r.commandSearch(D),enabled:n&&D.length>0}),k=s({queryKey:[`commandBriefing`],queryFn:r.commandBriefing,enabled:n,staleTime:6e4}),A=y.useMemo(()=>{let t=m.trim().toLowerCase(),n=[];if(!t&&k.data?.ok){let t=(k.data.data||{}).sections||{},r=t.review||{},a=t.suggestions||{},o=Number(a.count??0)||0,s=Number(r.pending??0)||0;n.push({id:`proactive-briefing`,group:`proactive`,title:i(e,`command.proactive.briefing`),detail:o>0?i(e,`command.proactive.suggestions`,{count:o}):void 0,icon:(0,b.jsx)(u,{className:`h-4 w-4`}),target:`/brain`,action:`open-briefing`}),n.push({id:`proactive-review`,group:`proactive`,title:i(e,`command.proactive.review`),detail:s>0?i(e,`command.proactive.pending`,{count:s}):void 0,icon:(0,b.jsx)(h,{className:`h-4 w-4`}),target:`/act/review`}),n.push({id:`proactive-ask`,group:`proactive`,title:i(e,`briefing.action.askBrain`),icon:(0,b.jsx)(v,{className:`h-4 w-4`}),target:`/brain`})}let r=x.map(t=>({id:t.id,group:`pages`,title:i(e,t.labelKey),icon:t.icon,target:t.target})).filter(e=>!t||e.title.toLowerCase().includes(t)),o=a(O.data?.data?.groups),s=[];for(let t of o)for(let n of a(t.items))t.kind===`knowledge`?s.push({id:`kg-${String(n.id??s.length)}`,group:`knowledge`,title:String(n.title||n.id||``),detail:String(n.summary||n.type||``),icon:(0,b.jsx)(f,{className:`h-4 w-4`}),target:`/brain/graph`}):t.kind===`conversation`?s.push({id:`conv-${String(n.conversation_id??s.length)}`,group:`conversation`,title:String(n.snippet||``),detail:String(n.timestamp||``).slice(0,10),icon:(0,b.jsx)(v,{className:`h-4 w-4`}),target:`/brain`}):t.kind===`automation`&&s.push({id:`wf-${String(n.id??s.length)}`,group:`automation`,title:String(n.name||``),detail:n.enabled?i(e,`command.automation.enabled`):i(e,`command.automation.draft`),icon:(0,b.jsx)(c,{className:`h-4 w-4`}),target:`/act/workflows`});return[...n,...s,...r]},[e,m,O.data,k.data]);y.useEffect(()=>{T(0)},[A.length,D]);let j=y.useCallback(()=>o(!1),[]),M=d(j,n),N=y.useCallback(e=>{e&&(j(),p(e.target),e.action===`open-briefing`&&window.dispatchEvent(new Event(`lattice:open-briefing`)))},[j]),P=e=>{e.key===`Escape`?(e.preventDefault(),j()):e.key===`ArrowDown`?(e.preventDefault(),T(e=>Math.min(e+1,Math.max(A.length-1,0)))):e.key===`ArrowUp`?(e.preventDefault(),T(e=>Math.max(e-1,0))):e.key===`Enter`&&(e.preventDefault(),N(A[w]))};if(!n)return null;let F={proactive:i(e,`command.proactive.title`),pages:i(e,`command.group.pages`),knowledge:i(e,`command.group.knowledge`),conversation:i(e,`command.group.conversation`),automation:i(e,`command.group.automation`)},I=null;return(0,b.jsx)(`div`,{className:`command-palette-backdrop`,role:`presentation`,onMouseDown:e=>{e.target===e.currentTarget&&j()},children:(0,b.jsxs)(`div`,{ref:M,className:`command-palette`,role:`dialog`,"aria-modal":`true`,"aria-label":i(e,`command.title`),"data-testid":`command-palette`,children:[(0,b.jsxs)(`div`,{className:`command-palette-input`,children:[(0,b.jsx)(l,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,b.jsx)(`input`,{ref:E,value:m,onChange:e=>C(e.target.value),onKeyDown:P,placeholder:i(e,`command.placeholder`),"aria-label":i(e,`command.title`),autoComplete:`off`,spellCheck:!1}),(0,b.jsxs)(`span`,{className:`command-palette-hint`,"aria-hidden":`true`,children:[(0,b.jsx)(g,{className:`h-3 w-3`}),i(e,`command.shortcutKey`)]})]}),(0,b.jsxs)(`div`,{className:`command-palette-results`,role:`listbox`,"aria-label":i(e,`command.results`),children:[O.isFetching?(0,b.jsx)(`p`,{className:`command-palette-note`,children:i(e,`command.searching`)}):null,A.length===0&&!O.isFetching?(0,b.jsx)(`p`,{className:`command-palette-note`,children:i(e,`command.empty`)}):null,A.map((e,t)=>{let n=e.group===I?null:(0,b.jsx)(`p`,{className:`command-palette-group`,children:F[e.group]},`h-${e.group}`);return I=e.group,(0,b.jsxs)(y.Fragment,{children:[n,(0,b.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t===w,className:`command-palette-item ${t===w?`is-active`:``}`,onMouseEnter:()=>T(t),onClick:()=>N(e),children:[e.icon,(0,b.jsx)(`span`,{className:`command-palette-item-title`,children:e.title}),e.detail?(0,b.jsx)(`span`,{className:`command-palette-item-detail`,children:e.detail}):null,t===w?(0,b.jsx)(_,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}):null]})]},e.id)})]}),(0,b.jsx)(`p`,{className:`command-palette-footer`,children:i(e,`command.footer`)})]})})}export{C as CommandPalette};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,_ as t,a as n,b as r,d as i,m as a,t as o,v as s,x as c}from"./utils-Ddol2RWD.js";import{r as l,t as u}from"./useQuery-CY2OI2uy.js";import{t as d}from"./useMutation-CSn9t1op.js";import{_ as f,b as p,c as m,d as h,f as g,g as _,h as v,i as y,l as b,m as x,n as S,p as C,r as w,t as T,u as E,v as D}from"./primitives-SNp0LRJz.js";import{t as O}from"./circle-check-qqLug9nU.js";import{t as k}from"./circle-play-DkT6tYPX.js";import{t as A}from"./cpu-85xYObUC.js";import{t as j}from"./download-B5Fm7YXo.js";import{t as M}from"./shield-alert-5BStfp2_.js";import{i as N}from"./index-BMPdTmlY.js";import{t as P}from"./button-aTn4s84A.js";import{t as F}from"./input-B0nRf2jO.js";import"./workspace-BqDwOz_p.js";var I=t(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),L=t(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),R=t(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),z=e(c()),B=r();function V(e,t){let n=String(e||``).toLowerCase();return n===`production`?a(t,`library.embedding.state.production`):n===`fallback`||n===`hash`||n===`local`?a(t,`library.embedding.state.fallback`):a(t,`library.embedding.state.unknown`)}function H(e,t){let n=String(e?.os||``).toLowerCase(),r=String(e?.arch||``).toLowerCase();return n?n===`darwin`&&r.startsWith(`arm`)?a(t,`library.runtime.appleSilicon`):n===`darwin`?`Mac`:n===`win32`||n.startsWith(`win`)?`Windows`:n===`linux`?`Linux`:a(t,`library.runtime.thisComputer`):a(t,`library.value.detected`)}function ee(e){return/[ㄱ-힝]/u.test(e)?!1:e.trim().split(/\s+/).length>=6}var te=new Set([`loaded`,`ready`,`download_required`,`unavailable`,`unsupported`]),U=[{id:`models`,labelKey:`library.tab.models`},{id:`skills`,labelKey:`library.tab.skills`},{id:`mcp`,labelKey:`library.tab.mcp`},{id:`marketplace`,labelKey:`library.tab.marketplace`}];function W({initialTab:e}){let t=s(e=>e.mode),n=s(e=>e.language),[r,i]=z.useState(e||`models`);z.useEffect(()=>{U.some(t=>t.id===e)&&i(e)},[e]);let o=(t===`basic`?U.filter(e=>e.id===`models`):U).map(e=>({id:e.id,label:a(n,e.labelKey)})),c=e=>{i(e),N(`/`+e)};return(0,B.jsxs)(`div`,{className:`product-page library-page space-y-5`,children:[(0,B.jsxs)(`header`,{className:`page-hero`,children:[(0,B.jsxs)(`div`,{className:`page-kicker`,children:[(0,B.jsx)(I,{className:`h-4 w-4`}),` `,a(n,`library.kicker`)]}),(0,B.jsx)(`h1`,{className:`page-title`,children:a(n,`library.title`)}),(0,B.jsx)(`p`,{className:`page-copy`,children:a(n,`library.body`)})]}),(0,B.jsx)(G,{}),(0,B.jsx)(h,{tabs:o,value:r,onChange:e=>c(e)}),r===`models`?(0,B.jsx)(K,{}):null,r===`skills`?(0,B.jsx)(J,{}):null,r===`mcp`?(0,B.jsx)(Y,{}):null,r===`marketplace`?(0,B.jsx)(X,{}):null]})}function G(){let e=l(),t=s(e=>e.language),r=u({queryKey:[`models`],queryFn:i.models}),[c,d]=z.useState(null),[f,m]=z.useState(null),h=r.data?.data||{},g=o(h.loaded),_=String(h.current||g[0]||``),v=[...o(h.catalog),...o(h.recommended),...o(h.models)],y=e=>String(e.id||e.model_id||``),b=_?v.find(e=>y(e)===_):void 0,x=String(b?.name||``)||(_?n(_):``),S=v.filter(e=>{let t=y(e);return!t||t===_||g.includes(t)||e.download_required||q(e.runtime_compatibility).supported===!1||e.load_status===`unsupported`?!1:!!e.load_available||e.load_status===`ready`}).slice(0,3);async function C(n){let r=y(n);d(r),m(null);let o=String(n.recommended_engine||n.engine||``)||void 0,s=await i.loadModel(String(n.recommended_load_id||r),o,!1);d(null),s.ok||m(s.error||a(t,`library.active.switchFailed`)),await e.invalidateQueries({queryKey:[`models`]})}let w=!!(r.data&&!r.data.ok);return(0,B.jsxs)(`section`,{className:`library-active`,"aria-label":a(t,`library.active.title`),"data-testid":`library-active-model`,children:[(0,B.jsxs)(`div`,{className:`library-active-main`,children:[(0,B.jsx)(`span`,{className:`library-active-mark`,"aria-hidden":`true`,children:x&&!w?(0,B.jsx)(k,{className:`h-5 w-5`}):(0,B.jsx)(A,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`library-active-copy`,children:[(0,B.jsx)(`span`,{className:`library-active-kicker`,children:a(t,`library.active.title`)}),w?(0,B.jsx)(`strong`,{children:a(t,`library.active.unknown`)}):x?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`strong`,{children:x}),(0,B.jsx)(`small`,{children:a(t,`library.active.ready`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`strong`,{children:a(t,`library.active.none`)}),(0,B.jsx)(`small`,{children:a(t,`library.active.noneHint`)})]})]}),x&&!w?(0,B.jsx)(D,{variant:`success`,children:a(t,`library.model.loaded`)}):null]}),S.length&&!w?(0,B.jsxs)(`div`,{className:`library-active-switch`,children:[(0,B.jsxs)(`span`,{className:`library-active-switch-label`,children:[a(t,`library.active.switchTitle`),(0,B.jsx)(`small`,{children:a(t,`library.active.switchHint`)})]}),(0,B.jsx)(`div`,{className:`library-active-switch-options`,children:S.map(e=>{let r=y(e),i=String(e.name||``)||n(r);return(0,B.jsxs)(`button`,{type:`button`,disabled:!!c,"data-testid":`library-switch-${r}`,onClick:()=>void C(e),children:[c===r?(0,B.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":`true`}):(0,B.jsx)(O,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),c===r?a(t,`library.active.switching`):i]},r)})})]}):null,f?(0,B.jsx)(`p`,{className:`library-active-error`,role:`status`,children:f}):null]})}function K(){let e=l(),t=s(e=>e.mode),n=s(e=>e.language),r=u({queryKey:[`models`],queryFn:i.models}),c=u({queryKey:[`modelRecommendations`,`local_mlx`],queryFn:()=>i.modelRecommendations(`local_mlx`)}),d=u({queryKey:[`embeddings`],queryFn:i.embeddingsStatus}),[f,p]=z.useState(!1),[m,h]=z.useState(null),[_,v]=z.useState([]),[b,x]=z.useState(null),[C,N]=z.useState(null),[F,I]=z.useState(!1),R=z.useRef(!1),H=o(r.data?.data?.loaded),U=String(r.data?.data?.current||``),W=e=>{let t=String(e.id||e.model_id||``);return t&&(H.includes(t)||t===U)?0:e.load_available||e.load_status===`ready`?1:e.pulled?2:3},G=[...o(r.data?.data?.catalog),...o(r.data?.data?.recommended)].map((e,t)=>({model:e,index:t})).sort((e,t)=>W(e.model)-W(t.model)||e.index-t.index).map(e=>e.model),K=o(c.data?.data?.recommendations?.models),J=new Map(K.map(e=>[String(e.id),e])),Y=G.find(e=>{let t=String(e.id||``);return!!t&&(H.includes(t)||t===U)}),X=c.data?.data?.recommendations?.top_pick||null,Z=_[_.length-1]||null,Q=z.useCallback((e,r=`library.model.notReady`)=>{let i=String(e);if(n===`ko`&&ee(i))return a(n,r);if(t!==`basic`)return i;let o=i.replace(/gemma4_unified/gi,a(n,`library.model.localFormat`)).replace(/mlx[-_ ]?vlm|mlx[-_ ]?lm|local_mlx|\bmlx\b|\bgguf\b|\bollama\b|hugging face/gi,a(n,`library.model.localSupport`)).replace(/runtime/gi,a(n,`library.model.support`)).replace(/model_type/gi,a(n,`library.model.format`));return n===`en`?o.replace(/this local model format local model support format/gi,a(n,`library.model.localFormat`)).replace(/local model support model support/gi,a(n,`library.model.localSupport`)):o},[n,t]);async function $(t,n,r){I(!0),h(t),v([]),x(null),N(null),R.current=!1;let a=await i.streamModelPrepare({model:t,engine:n||`local_mlx`,allow_download:r},{onProgress:e=>v(t=>[...t.slice(-8),e]),onDone:e=>x(e),onError:e=>{R.current=!0,N(e)}});I(!1),await e.invalidateQueries({queryKey:[`models`]}),await e.invalidateQueries({queryKey:[`modelRecommendations`,`local_mlx`]}),!a.ok&&!R.current&&N(a.data)}return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(S,{title:a(n,`library.models.setup.title`),description:a(n,`library.models.setup.desc`),result:c.data,children:r=>{let o=r.recommendations,s=r.profile;return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(re,{language:n,mode:t,profile:s||{},recommendation:o||{},current:Y,currentId:U,latestProgress:Z,lastResult:b,onReload:()=>{if(Y){let e=Y.recommended_load_id||Y.id;$(String(e||U),String(Y.recommended_engine||Y.engine||`local_mlx`),f)}},onUnload:()=>{U&&i.unloadModel(U).then(()=>e.invalidateQueries({queryKey:[`models`]}))}}),(0,B.jsx)(`ol`,{className:`library-setup-track`,"aria-label":a(n,`library.steps.aria`),children:[[a(n,`library.step.environment`),!0,A],[a(n,`library.step.recommend`),!!(X||G.length),O],[a(n,`library.step.install`),!!(Y||Z?.stage===`engine`),L],[a(n,`library.step.download`),!!(Y||Z?.stage===`download`),j],[a(n,`library.step.validate`),!!(Y||Z?.stage===`smoke_test`),M],[a(n,`library.step.ready`),!!(Y||b),k]].map(([e,t,r])=>(0,B.jsxs)(`li`,{className:t?`is-done`:``,children:[(0,B.jsx)(`span`,{className:`library-setup-mark`,"aria-hidden":`true`,children:z.createElement(r,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`span`,{className:`library-setup-label`,children:String(e)}),(0,B.jsx)(`span`,{className:`library-setup-state`,children:t?a(n,`library.step.done`):a(n,`library.step.pending`)})]},String(e)))}),(0,B.jsxs)(`label`,{className:`flex items-start gap-2 rounded-lg border border-border bg-background/55 p-3 text-sm leading-6`,children:[(0,B.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:f,onChange:e=>p(e.target.checked)}),(0,B.jsx)(`span`,{children:a(n,`library.consent`)})]}),Z?(0,B.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(Z.message||a(n,`library.preparing`))}),(0,B.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-muted`,children:(0,B.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(Z.percent||8)}%`}})}),Z.detail?(0,B.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:String(Z.detail)}):null]}):null,C?(0,B.jsx)(ie,{error:C}):null]})}}),(0,B.jsx)(S,{title:t===`basic`?a(n,`library.panel.recommended.basic`):a(n,`library.panel.recommended.other`),result:r.data,children:e=>(0,B.jsxs)(`div`,{className:`grid gap-2`,children:[(G.length?G:o(e.loaded)).slice(0,t===`basic`?3:14).map((r,s)=>{let c=String(r.id||r.model_id||r.name||s),l=o(e.loaded).includes(c)||e.current===c||r.state===`loaded`,u=String(r.recommended_load_id||c),d=String(r.recommended_engine||r.engine||``),p=J.get(c)||J.get(u)||{},h=q(r.verification),g=q(p.verification),_=q(r.hardware),v=q(p.hardware),y=!!r.download_required,b=_.recommended_ram_gb||v.recommended_ram_gb,x=b?a(n,`library.model.ramRecommended`,{ram:String(b)}):t===`basic`?``:String(_.notes||v.notes||``),S=r.safety_notes||p.safety_notes,C=r.license||p.license,w=r.runtime_compatibility||p.runtime_compatibility||{},E=String(w.status||``)===`fallback_available`,O=r.load_status===`unsupported`||w.supported===!1,k=(!!r.load_available||l)&&!O,A=String(r.load_status||(l?`loaded`:`unavailable`)),j=y?a(n,`library.model.needsDownloadFirst`):Q(r.unavailable_reason||a(n,`library.model.notReady`)),M=String(r.runtime_label||w.preferred_runtime||d||`local_mlx`),N=String(w.action||A.replace(/_/g,` `)),I=te.has(A)?a(n,`library.model.status.${A}`):a(n,`library.model.status.unknown`),L=O&&t===`basic`?a(n,`library.model.needsAttention`):I,R=k||y,z=r.download_size||r.estimated_size||p.download_size||p.estimated_size||r.size||p.size,V=r.provider||p.provider||r.organization||p.organization;return(0,B.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 rounded-lg border border-border bg-background/55 p-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`div`,{className:`text-base font-semibold`,children:String(r.name||c)}),X?.id===c||r.recommended_default?(0,B.jsx)(D,{variant:`success`,children:a(n,`library.model.recommended`)}):null,String(r.modality||p.modality||``).includes(`multi`)||String(r.modality||``)===`multimodal`?(0,B.jsx)(D,{variant:`muted`,children:a(n,`library.model.multimodal`)}):null,h.verified||g.verified?(0,B.jsx)(D,{variant:`success`,title:a(n,`library.model.hfVerified`),children:a(n,`library.model.sourceVerified`)}):null]}),(0,B.jsx)(`div`,{className:`mt-1 text-sm text-muted-foreground`,children:t===`basic`?[Q(r.family||p.family||a(n,`library.model.local`)),/mlx|gguf|ollama/i.test(String(r.size||p.size||``))?``:r.size||p.size].filter(Boolean).map(String).join(` · `):[r.family||p.family||a(n,`library.value.local`),r.size||p.size].filter(Boolean).map(String).join(` · `)}),r.hardware||p.hardware?(0,B.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground/80`,children:String(x)}):null,(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1 text-[11px] text-muted-foreground`,children:[(0,B.jsx)(D,{variant:`muted`,children:y?a(n,`library.model.downloadSize`,{size:String(z||a(n,`library.model.downloadRequired`))}):a(n,`library.model.noDownload`)}),(0,B.jsx)(D,{variant:`muted`,children:y?a(n,`library.model.internetDuringDownload`):a(n,`library.model.runsLocally`)}),V?(0,B.jsx)(D,{variant:`muted`,children:String(V)}):null]}),O?(0,B.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:t===`basic`?a(n,`library.model.attentionBeforeLoad`):N}),(0,B.jsx)(`div`,{className:`text-muted-foreground`,children:Q(w.user_message||j,`library.model.unsupportedHere`)})]}):E?(0,B.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:t===`basic`?a(n,`library.model.compatiblePath`):a(n,`library.model.runtimeFallback`)}),(0,B.jsx)(`div`,{className:`text-muted-foreground`,children:Q(w.user_message||a(n,`library.model.compatibilityFallback`),`library.model.compatibilityFallback`)})]}):!l&&!k?(0,B.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:j}):null,t===`basic`?null:(0,B.jsxs)(`div`,{className:`mt-2 space-y-1 text-xs text-muted-foreground`,children:[(0,B.jsxs)(`div`,{children:[M,` · `,u,r.load_strategy||p.load_strategy?` · ${String(r.load_strategy||p.load_strategy)}`:``,h.notes?` · ${String(h.notes).slice(0,60)}`:``]}),S||C?(0,B.jsx)(`div`,{children:[C?a(n,`library.model.license`,{license:String(C)}):``,S?String(S):``].filter(Boolean).join(` · `)}):null]}),O||E?(0,B.jsx)(ne,{compatibility:w}):null]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:justify-end`,children:[(0,B.jsx)(D,{variant:l?`success`:k?`muted`:`warning`,children:l?a(n,`library.model.loaded`):L}),l?(0,B.jsx)(T,{label:a(n,`library.runtime.unload`),action:()=>i.unloadModel(u),invalidate:[`models`]}):(0,B.jsx)(P,{variant:`outline`,disabled:F||O||!R||y&&!f,title:O?a(n,`library.model.status.unsupported`):y&&!f?a(n,`library.btn.needsConsent`):R?void 0:j,onClick:()=>$(u,d,f),children:m===u&&F?a(n,`library.btn.preparing`):y?a(n,`library.btn.installLoad`):a(n,`library.btn.validateLoad`)})]})]},c)}),t===`basic`&&G.length>3?(0,B.jsx)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm text-muted-foreground`,children:a(n,`library.model.shortListHint`)}):null]})})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(S,{title:t===`basic`?a(n,`library.models.embedding.basic`):a(n,`library.models.embedding.advanced`),result:d.data,children:e=>(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(g,{value:V(e.state,n)}),t===`basic`?null:(0,B.jsx)(E,{value:e})]})}),(0,B.jsx)(S,{title:t===`basic`?a(n,`library.models.validation`):a(n,`library.models.validationAdvanced`),result:r.data,children:e=>{let r=o(e.compat_profiles);return r.length?(0,B.jsx)(y,{items:r.map(e=>({...e,name:t===`basic`?e.name||e.display_name||a(n,`library.model.loadedName`):e.name||e.display_name||e.model_id,status:e.quality_status||e.load_status||a(n,`library.model.checked`)})),titleKey:`name`,metaKey:`status`,limit:6}):(0,B.jsx)(w,{title:a(n,`library.model.noneChecked`),detail:a(n,`library.model.noneCheckedHint`)})}})]})]})}function ne({compatibility:e}){let t=s(e=>e.mode),n=s(e=>e.language),r=o(e.alternatives);return r.length?(0,B.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:r.slice(0,3).map(e=>(0,B.jsx)(D,{variant:`muted`,children:t===`basic`&&/mlx|gguf|ollama|lm studio/i.test(String(e.name||e.id))?a(n,`library.model.compatibleAlternative`):String(e.name||e.id)},String(e.id||e.name)))}):null}function re({language:e=`en`,mode:t=`advanced`,profile:r,recommendation:i,current:o,currentId:s,latestProgress:c,lastResult:l,onReload:u,onUnload:d}){let f=String(o?.id||s||``),p=String(o?.name||``)||(f?n(f):``),m=String(o?.engine||o?.recommended_engine||c?.engine||`local_mlx`),h=String(o?.local_path||o?.storage_location||i.cache_path||i.storage_location||`~/.cache/huggingface / ~/.latticeai/models`),g=String(c?.stage||l?.stage||(p?a(e,`library.value.ready`):a(e,`library.value.idle`))),_=t===`basic`;return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(b,{stats:_?[{label:a(e,`library.runtime.computer`),value:H(r,e)},{label:a(e,`library.runtime.loaded`),value:p||a(e,`library.runtime.noneShort`)}]:[{label:a(e,`library.runtime.computer`),value:H(r,e)},{label:a(e,`library.runtime.engine`),value:m},{label:a(e,`library.runtime.loaded`),value:p||a(e,`library.runtime.noLoaded`)},{label:a(e,`library.runtime.state`),value:g}]}),(0,B.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-medium`,children:p?a(e,`library.models.runtime.available`):a(e,`library.models.runtime.none`)}),_?null:(0,B.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:a(e,`library.runtime.cacheStorage`,{path:h})})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)(P,{variant:`outline`,size:`sm`,disabled:!p,onClick:u,children:a(e,`library.runtime.reload`)}),(0,B.jsx)(P,{variant:`outline`,size:`sm`,disabled:!p,onClick:d,children:a(e,`library.runtime.unload`)})]})]}),c?(0,B.jsxs)(`div`,{className:`mt-3`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:String(c.message||a(e,`library.preparing`))}),(0,B.jsxs)(`span`,{children:[Number(c.percent||0),`%`]})]}),(0,B.jsx)(`div`,{className:`mt-1 h-2 overflow-hidden rounded-full bg-muted`,children:(0,B.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(c.percent||8)}%`}})})]}):null]})]})}function ie({error:e}){let t=s(e=>e.language),n=o(e.recovery_guidance);return(0,B.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(e.user_message||a(t,`library.model.setupAttention`))}),n.length?(0,B.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-muted-foreground`,children:n.slice(0,3).map(e=>(0,B.jsx)(`li`,{children:e},e))}):null]})}function q(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function J(){let e=l(),t=s(e=>e.language),n=u({queryKey:[`skills`],queryFn:i.skills}),r=u({queryKey:[`skillsMarketplace`],queryFn:i.skillsMarketplace}),c=d({mutationFn:e=>i.skillInstall(String(e.name||e.id),String(e.plugin||``)),onSuccess:()=>e.invalidateQueries({queryKey:[`skills`]})});return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(S,{title:a(t,`library.skills.installed`),result:n.data,children:e=>(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:o(e.skills).map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,B.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.plugin||e.description||``)})]}),(0,B.jsx)(T,{label:a(t,e.enabled?`library.skills.disable`:`library.skills.enable`),action:()=>i.skillToggle(String(e.name||e.id),!!e.enabled),invalidate:[`skills`]})]},String(e.name||e.id)))})}),(0,B.jsx)(S,{title:a(t,`library.skills.marketplace`),result:r.data,children:e=>(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:o(e.skills).slice(0,10).map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,B.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.description||e.category||``)})]}),(0,B.jsx)(P,{variant:`outline`,disabled:c.isPending,onClick:()=>c.mutate(e),children:a(t,`library.skills.install`)})]},String(e.name||e.id)))})})]})}function Y(){let e=s(e=>e.mode),t=s(e=>e.language),[n,r]=z.useState(`github`),o=u({queryKey:[`mcpTools`],queryFn:i.mcpTools}),c=d({mutationFn:()=>i.mcpRecommend(n)});return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(S,{title:a(t,e===`basic`?`library.connector.connections`:`library.connector.mcpTools`),result:o.data,children:e=>(0,B.jsx)(y,{items:e.tools||e.installed_mcps,titleKey:`name`,metaKey:`status`})}),(0,B.jsxs)(C,{children:[(0,B.jsxs)(_,{children:[(0,B.jsxs)(f,{className:`flex items-center gap-2`,children:[(0,B.jsx)(R,{className:`h-4 w-4`}),` `,a(t,`library.connector.recommend`)]}),(0,B.jsx)(v,{children:a(t,`library.connector.recommendHint`)})]}),(0,B.jsxs)(x,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(F,{value:n,onChange:e=>r(e.target.value)}),(0,B.jsx)(P,{onClick:()=>c.mutate(),disabled:!n.trim()||c.isPending,children:a(t,`library.connector.recommendAction`)})]}),c.data?(0,B.jsx)(m,{result:c.data,successLabel:a(t,`library.connector.recommendDone`)}):null]})]})]})}function X(){let e=s(e=>e.language),t=u({queryKey:[`templates`],queryFn:i.templates}),n=u({queryKey:[`plugins`],queryFn:i.pluginsRegistry}),r=u({queryKey:[`pluginsDirectory`],queryFn:i.pluginsDirectory});return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(S,{title:a(e,`library.market.templates`),result:t.data,children:e=>(0,B.jsx)(y,{items:e.templates,titleKey:`name`,metaKey:`kind`})}),(0,B.jsx)(S,{title:a(e,`library.market.installedPlugins`),result:n.data,children:e=>(0,B.jsx)(y,{items:e.plugins,titleKey:`name`,metaKey:`status`})}),(0,B.jsx)(S,{title:a(e,`library.market.pluginDirectory`),result:r.data,children:e=>(0,B.jsx)(y,{items:e.plugins,titleKey:`name`,metaKey:`category`})}),(0,B.jsxs)(C,{className:`xl:col-span-3`,children:[(0,B.jsxs)(_,{children:[(0,B.jsxs)(f,{className:`flex items-center gap-2`,children:[(0,B.jsx)(L,{className:`h-4 w-4`}),` `,a(e,`library.market.templateInstall`)]}),(0,B.jsx)(v,{children:a(e,`library.market.templateInstallHint`)})]}),(0,B.jsx)(x,{children:o(t.data?.data?.templates).length?(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:o(t.data?.data?.templates).slice(0,6).map(t=>(0,B.jsx)(T,{label:a(e,`library.market.installTemplate`,{name:String(t.name||t.id)}),action:()=>i.installTemplate(t)},String(t.id||t.name)))}):(0,B.jsx)(y,{items:[]})})]})]})}export{W as LibraryPage};
|
|
1
|
+
import{C as e,_ as t,a as n,b as r,d as i,m as a,t as o,v as s,x as c}from"./utils-CiFtIdZq.js";import{r as l,t as u}from"./useQuery-C7BeG4HU.js";import{t as d}from"./useMutation-CVC4qv_D.js";import{_ as f,b as p,c as m,d as h,f as g,g as _,h as v,i as y,l as b,m as x,n as S,p as C,r as w,t as T,u as E,v as D}from"./primitives-Cv5tbZBY.js";import{t as O}from"./circle-check-DruOxB-4.js";import{t as k}from"./circle-play-D8mW2aQ7.js";import{t as A}from"./cpu-DZcdd0PZ.js";import{t as j}from"./download-bv1KEPGQ.js";import{t as M}from"./shield-alert-DuQ3zrVL.js";import{i as N}from"./index-Do83hDzJ.js";import{t as P}from"./button-Ct9f2_oT.js";import{t as F}from"./input-BLXVNmj1.js";import"./workspace-DQz9vIId.js";var I=t(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),L=t(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),R=t(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),z=e(c()),B=r();function V(e,t){let n=String(e||``).toLowerCase();return n===`production`?a(t,`library.embedding.state.production`):n===`fallback`||n===`hash`||n===`local`?a(t,`library.embedding.state.fallback`):a(t,`library.embedding.state.unknown`)}function H(e,t){let n=String(e?.os||``).toLowerCase(),r=String(e?.arch||``).toLowerCase();return n?n===`darwin`&&r.startsWith(`arm`)?a(t,`library.runtime.appleSilicon`):n===`darwin`?`Mac`:n===`win32`||n.startsWith(`win`)?`Windows`:n===`linux`?`Linux`:a(t,`library.runtime.thisComputer`):a(t,`library.value.detected`)}function ee(e){return/[ㄱ-힝]/u.test(e)?!1:e.trim().split(/\s+/).length>=6}var te=new Set([`loaded`,`ready`,`download_required`,`unavailable`,`unsupported`]),U=[{id:`models`,labelKey:`library.tab.models`},{id:`skills`,labelKey:`library.tab.skills`},{id:`mcp`,labelKey:`library.tab.mcp`},{id:`marketplace`,labelKey:`library.tab.marketplace`}];function W({initialTab:e}){let t=s(e=>e.mode),n=s(e=>e.language),[r,i]=z.useState(e||`models`);z.useEffect(()=>{U.some(t=>t.id===e)&&i(e)},[e]);let o=(t===`basic`?U.filter(e=>e.id===`models`):U).map(e=>({id:e.id,label:a(n,e.labelKey)})),c=e=>{i(e),N(`/`+e)};return(0,B.jsxs)(`div`,{className:`product-page library-page space-y-5`,children:[(0,B.jsxs)(`header`,{className:`page-hero`,children:[(0,B.jsxs)(`div`,{className:`page-kicker`,children:[(0,B.jsx)(I,{className:`h-4 w-4`}),` `,a(n,`library.kicker`)]}),(0,B.jsx)(`h1`,{className:`page-title`,children:a(n,`library.title`)}),(0,B.jsx)(`p`,{className:`page-copy`,children:a(n,`library.body`)})]}),(0,B.jsx)(G,{}),(0,B.jsx)(h,{tabs:o,value:r,onChange:e=>c(e)}),r===`models`?(0,B.jsx)(K,{}):null,r===`skills`?(0,B.jsx)(J,{}):null,r===`mcp`?(0,B.jsx)(Y,{}):null,r===`marketplace`?(0,B.jsx)(X,{}):null]})}function G(){let e=l(),t=s(e=>e.language),r=u({queryKey:[`models`],queryFn:i.models}),[c,d]=z.useState(null),[f,m]=z.useState(null),h=r.data?.data||{},g=o(h.loaded),_=String(h.current||g[0]||``),v=[...o(h.catalog),...o(h.recommended),...o(h.models)],y=e=>String(e.id||e.model_id||``),b=_?v.find(e=>y(e)===_):void 0,x=String(b?.name||``)||(_?n(_):``),S=v.filter(e=>{let t=y(e);return!t||t===_||g.includes(t)||e.download_required||q(e.runtime_compatibility).supported===!1||e.load_status===`unsupported`?!1:!!e.load_available||e.load_status===`ready`}).slice(0,3);async function C(n){let r=y(n);d(r),m(null);let o=String(n.recommended_engine||n.engine||``)||void 0,s=await i.loadModel(String(n.recommended_load_id||r),o,!1);d(null),s.ok||m(s.error||a(t,`library.active.switchFailed`)),await e.invalidateQueries({queryKey:[`models`]})}let w=!!(r.data&&!r.data.ok);return(0,B.jsxs)(`section`,{className:`library-active`,"aria-label":a(t,`library.active.title`),"data-testid":`library-active-model`,children:[(0,B.jsxs)(`div`,{className:`library-active-main`,children:[(0,B.jsx)(`span`,{className:`library-active-mark`,"aria-hidden":`true`,children:x&&!w?(0,B.jsx)(k,{className:`h-5 w-5`}):(0,B.jsx)(A,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`library-active-copy`,children:[(0,B.jsx)(`span`,{className:`library-active-kicker`,children:a(t,`library.active.title`)}),w?(0,B.jsx)(`strong`,{children:a(t,`library.active.unknown`)}):x?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`strong`,{children:x}),(0,B.jsx)(`small`,{children:a(t,`library.active.ready`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`strong`,{children:a(t,`library.active.none`)}),(0,B.jsx)(`small`,{children:a(t,`library.active.noneHint`)})]})]}),x&&!w?(0,B.jsx)(D,{variant:`success`,children:a(t,`library.model.loaded`)}):null]}),S.length&&!w?(0,B.jsxs)(`div`,{className:`library-active-switch`,children:[(0,B.jsxs)(`span`,{className:`library-active-switch-label`,children:[a(t,`library.active.switchTitle`),(0,B.jsx)(`small`,{children:a(t,`library.active.switchHint`)})]}),(0,B.jsx)(`div`,{className:`library-active-switch-options`,children:S.map(e=>{let r=y(e),i=String(e.name||``)||n(r);return(0,B.jsxs)(`button`,{type:`button`,disabled:!!c,"data-testid":`library-switch-${r}`,onClick:()=>void C(e),children:[c===r?(0,B.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":`true`}):(0,B.jsx)(O,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),c===r?a(t,`library.active.switching`):i]},r)})})]}):null,f?(0,B.jsx)(`p`,{className:`library-active-error`,role:`status`,children:f}):null]})}function K(){let e=l(),t=s(e=>e.mode),n=s(e=>e.language),r=u({queryKey:[`models`],queryFn:i.models}),c=u({queryKey:[`modelRecommendations`,`local_mlx`],queryFn:()=>i.modelRecommendations(`local_mlx`)}),d=u({queryKey:[`embeddings`],queryFn:i.embeddingsStatus}),[f,p]=z.useState(!1),[m,h]=z.useState(null),[_,v]=z.useState([]),[b,x]=z.useState(null),[C,N]=z.useState(null),[F,I]=z.useState(!1),R=z.useRef(!1),H=o(r.data?.data?.loaded),U=String(r.data?.data?.current||``),W=e=>{let t=String(e.id||e.model_id||``);return t&&(H.includes(t)||t===U)?0:e.load_available||e.load_status===`ready`?1:e.pulled?2:3},G=[...o(r.data?.data?.catalog),...o(r.data?.data?.recommended)].map((e,t)=>({model:e,index:t})).sort((e,t)=>W(e.model)-W(t.model)||e.index-t.index).map(e=>e.model),K=o(c.data?.data?.recommendations?.models),J=new Map(K.map(e=>[String(e.id),e])),Y=G.find(e=>{let t=String(e.id||``);return!!t&&(H.includes(t)||t===U)}),X=c.data?.data?.recommendations?.top_pick||null,Z=_[_.length-1]||null,Q=z.useCallback((e,r=`library.model.notReady`)=>{let i=String(e);if(n===`ko`&&ee(i))return a(n,r);if(t!==`basic`)return i;let o=i.replace(/gemma4_unified/gi,a(n,`library.model.localFormat`)).replace(/mlx[-_ ]?vlm|mlx[-_ ]?lm|local_mlx|\bmlx\b|\bgguf\b|\bollama\b|hugging face/gi,a(n,`library.model.localSupport`)).replace(/runtime/gi,a(n,`library.model.support`)).replace(/model_type/gi,a(n,`library.model.format`));return n===`en`?o.replace(/this local model format local model support format/gi,a(n,`library.model.localFormat`)).replace(/local model support model support/gi,a(n,`library.model.localSupport`)):o},[n,t]);async function $(t,n,r){I(!0),h(t),v([]),x(null),N(null),R.current=!1;let a=await i.streamModelPrepare({model:t,engine:n||`local_mlx`,allow_download:r},{onProgress:e=>v(t=>[...t.slice(-8),e]),onDone:e=>x(e),onError:e=>{R.current=!0,N(e)}});I(!1),await e.invalidateQueries({queryKey:[`models`]}),await e.invalidateQueries({queryKey:[`modelRecommendations`,`local_mlx`]}),!a.ok&&!R.current&&N(a.data)}return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(S,{title:a(n,`library.models.setup.title`),description:a(n,`library.models.setup.desc`),result:c.data,children:r=>{let o=r.recommendations,s=r.profile;return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(re,{language:n,mode:t,profile:s||{},recommendation:o||{},current:Y,currentId:U,latestProgress:Z,lastResult:b,onReload:()=>{if(Y){let e=Y.recommended_load_id||Y.id;$(String(e||U),String(Y.recommended_engine||Y.engine||`local_mlx`),f)}},onUnload:()=>{U&&i.unloadModel(U).then(()=>e.invalidateQueries({queryKey:[`models`]}))}}),(0,B.jsx)(`ol`,{className:`library-setup-track`,"aria-label":a(n,`library.steps.aria`),children:[[a(n,`library.step.environment`),!0,A],[a(n,`library.step.recommend`),!!(X||G.length),O],[a(n,`library.step.install`),!!(Y||Z?.stage===`engine`),L],[a(n,`library.step.download`),!!(Y||Z?.stage===`download`),j],[a(n,`library.step.validate`),!!(Y||Z?.stage===`smoke_test`),M],[a(n,`library.step.ready`),!!(Y||b),k]].map(([e,t,r])=>(0,B.jsxs)(`li`,{className:t?`is-done`:``,children:[(0,B.jsx)(`span`,{className:`library-setup-mark`,"aria-hidden":`true`,children:z.createElement(r,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`span`,{className:`library-setup-label`,children:String(e)}),(0,B.jsx)(`span`,{className:`library-setup-state`,children:t?a(n,`library.step.done`):a(n,`library.step.pending`)})]},String(e)))}),(0,B.jsxs)(`label`,{className:`flex items-start gap-2 rounded-lg border border-border bg-background/55 p-3 text-sm leading-6`,children:[(0,B.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:f,onChange:e=>p(e.target.checked)}),(0,B.jsx)(`span`,{children:a(n,`library.consent`)})]}),Z?(0,B.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(Z.message||a(n,`library.preparing`))}),(0,B.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-muted`,children:(0,B.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(Z.percent||8)}%`}})}),Z.detail?(0,B.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:String(Z.detail)}):null]}):null,C?(0,B.jsx)(ie,{error:C}):null]})}}),(0,B.jsx)(S,{title:t===`basic`?a(n,`library.panel.recommended.basic`):a(n,`library.panel.recommended.other`),result:r.data,children:e=>(0,B.jsxs)(`div`,{className:`grid gap-2`,children:[(G.length?G:o(e.loaded)).slice(0,t===`basic`?3:14).map((r,s)=>{let c=String(r.id||r.model_id||r.name||s),l=o(e.loaded).includes(c)||e.current===c||r.state===`loaded`,u=String(r.recommended_load_id||c),d=String(r.recommended_engine||r.engine||``),p=J.get(c)||J.get(u)||{},h=q(r.verification),g=q(p.verification),_=q(r.hardware),v=q(p.hardware),y=!!r.download_required,b=_.recommended_ram_gb||v.recommended_ram_gb,x=b?a(n,`library.model.ramRecommended`,{ram:String(b)}):t===`basic`?``:String(_.notes||v.notes||``),S=r.safety_notes||p.safety_notes,C=r.license||p.license,w=r.runtime_compatibility||p.runtime_compatibility||{},E=String(w.status||``)===`fallback_available`,O=r.load_status===`unsupported`||w.supported===!1,k=(!!r.load_available||l)&&!O,A=String(r.load_status||(l?`loaded`:`unavailable`)),j=y?a(n,`library.model.needsDownloadFirst`):Q(r.unavailable_reason||a(n,`library.model.notReady`)),M=String(r.runtime_label||w.preferred_runtime||d||`local_mlx`),N=String(w.action||A.replace(/_/g,` `)),I=te.has(A)?a(n,`library.model.status.${A}`):a(n,`library.model.status.unknown`),L=O&&t===`basic`?a(n,`library.model.needsAttention`):I,R=k||y,z=r.download_size||r.estimated_size||p.download_size||p.estimated_size||r.size||p.size,V=r.provider||p.provider||r.organization||p.organization;return(0,B.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 rounded-lg border border-border bg-background/55 p-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`div`,{className:`text-base font-semibold`,children:String(r.name||c)}),X?.id===c||r.recommended_default?(0,B.jsx)(D,{variant:`success`,children:a(n,`library.model.recommended`)}):null,String(r.modality||p.modality||``).includes(`multi`)||String(r.modality||``)===`multimodal`?(0,B.jsx)(D,{variant:`muted`,children:a(n,`library.model.multimodal`)}):null,h.verified||g.verified?(0,B.jsx)(D,{variant:`success`,title:a(n,`library.model.hfVerified`),children:a(n,`library.model.sourceVerified`)}):null]}),(0,B.jsx)(`div`,{className:`mt-1 text-sm text-muted-foreground`,children:t===`basic`?[Q(r.family||p.family||a(n,`library.model.local`)),/mlx|gguf|ollama/i.test(String(r.size||p.size||``))?``:r.size||p.size].filter(Boolean).map(String).join(` · `):[r.family||p.family||a(n,`library.value.local`),r.size||p.size].filter(Boolean).map(String).join(` · `)}),r.hardware||p.hardware?(0,B.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground/80`,children:String(x)}):null,(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1 text-[11px] text-muted-foreground`,children:[(0,B.jsx)(D,{variant:`muted`,children:y?a(n,`library.model.downloadSize`,{size:String(z||a(n,`library.model.downloadRequired`))}):a(n,`library.model.noDownload`)}),(0,B.jsx)(D,{variant:`muted`,children:y?a(n,`library.model.internetDuringDownload`):a(n,`library.model.runsLocally`)}),V?(0,B.jsx)(D,{variant:`muted`,children:String(V)}):null]}),O?(0,B.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:t===`basic`?a(n,`library.model.attentionBeforeLoad`):N}),(0,B.jsx)(`div`,{className:`text-muted-foreground`,children:Q(w.user_message||j,`library.model.unsupportedHere`)})]}):E?(0,B.jsxs)(`div`,{className:`mt-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:t===`basic`?a(n,`library.model.compatiblePath`):a(n,`library.model.runtimeFallback`)}),(0,B.jsx)(`div`,{className:`text-muted-foreground`,children:Q(w.user_message||a(n,`library.model.compatibilityFallback`),`library.model.compatibilityFallback`)})]}):!l&&!k?(0,B.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:j}):null,t===`basic`?null:(0,B.jsxs)(`div`,{className:`mt-2 space-y-1 text-xs text-muted-foreground`,children:[(0,B.jsxs)(`div`,{children:[M,` · `,u,r.load_strategy||p.load_strategy?` · ${String(r.load_strategy||p.load_strategy)}`:``,h.notes?` · ${String(h.notes).slice(0,60)}`:``]}),S||C?(0,B.jsx)(`div`,{children:[C?a(n,`library.model.license`,{license:String(C)}):``,S?String(S):``].filter(Boolean).join(` · `)}):null]}),O||E?(0,B.jsx)(ne,{compatibility:w}):null]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:justify-end`,children:[(0,B.jsx)(D,{variant:l?`success`:k?`muted`:`warning`,children:l?a(n,`library.model.loaded`):L}),l?(0,B.jsx)(T,{label:a(n,`library.runtime.unload`),action:()=>i.unloadModel(u),invalidate:[`models`]}):(0,B.jsx)(P,{variant:`outline`,disabled:F||O||!R||y&&!f,title:O?a(n,`library.model.status.unsupported`):y&&!f?a(n,`library.btn.needsConsent`):R?void 0:j,onClick:()=>$(u,d,f),children:m===u&&F?a(n,`library.btn.preparing`):y?a(n,`library.btn.installLoad`):a(n,`library.btn.validateLoad`)})]})]},c)}),t===`basic`&&G.length>3?(0,B.jsx)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm text-muted-foreground`,children:a(n,`library.model.shortListHint`)}):null]})})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(S,{title:t===`basic`?a(n,`library.models.embedding.basic`):a(n,`library.models.embedding.advanced`),result:d.data,children:e=>(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(g,{value:V(e.state,n)}),t===`basic`?null:(0,B.jsx)(E,{value:e})]})}),(0,B.jsx)(S,{title:t===`basic`?a(n,`library.models.validation`):a(n,`library.models.validationAdvanced`),result:r.data,children:e=>{let r=o(e.compat_profiles);return r.length?(0,B.jsx)(y,{items:r.map(e=>({...e,name:t===`basic`?e.name||e.display_name||a(n,`library.model.loadedName`):e.name||e.display_name||e.model_id,status:e.quality_status||e.load_status||a(n,`library.model.checked`)})),titleKey:`name`,metaKey:`status`,limit:6}):(0,B.jsx)(w,{title:a(n,`library.model.noneChecked`),detail:a(n,`library.model.noneCheckedHint`)})}})]})]})}function ne({compatibility:e}){let t=s(e=>e.mode),n=s(e=>e.language),r=o(e.alternatives);return r.length?(0,B.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:r.slice(0,3).map(e=>(0,B.jsx)(D,{variant:`muted`,children:t===`basic`&&/mlx|gguf|ollama|lm studio/i.test(String(e.name||e.id))?a(n,`library.model.compatibleAlternative`):String(e.name||e.id)},String(e.id||e.name)))}):null}function re({language:e=`en`,mode:t=`advanced`,profile:r,recommendation:i,current:o,currentId:s,latestProgress:c,lastResult:l,onReload:u,onUnload:d}){let f=String(o?.id||s||``),p=String(o?.name||``)||(f?n(f):``),m=String(o?.engine||o?.recommended_engine||c?.engine||`local_mlx`),h=String(o?.local_path||o?.storage_location||i.cache_path||i.storage_location||`~/.cache/huggingface / ~/.latticeai/models`),g=String(c?.stage||l?.stage||(p?a(e,`library.value.ready`):a(e,`library.value.idle`))),_=t===`basic`;return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(b,{stats:_?[{label:a(e,`library.runtime.computer`),value:H(r,e)},{label:a(e,`library.runtime.loaded`),value:p||a(e,`library.runtime.noneShort`)}]:[{label:a(e,`library.runtime.computer`),value:H(r,e)},{label:a(e,`library.runtime.engine`),value:m},{label:a(e,`library.runtime.loaded`),value:p||a(e,`library.runtime.noLoaded`)},{label:a(e,`library.runtime.state`),value:g}]}),(0,B.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/55 p-3 text-sm`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-medium`,children:p?a(e,`library.models.runtime.available`):a(e,`library.models.runtime.none`)}),_?null:(0,B.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:a(e,`library.runtime.cacheStorage`,{path:h})})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)(P,{variant:`outline`,size:`sm`,disabled:!p,onClick:u,children:a(e,`library.runtime.reload`)}),(0,B.jsx)(P,{variant:`outline`,size:`sm`,disabled:!p,onClick:d,children:a(e,`library.runtime.unload`)})]})]}),c?(0,B.jsxs)(`div`,{className:`mt-3`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground`,children:[(0,B.jsx)(`span`,{children:String(c.message||a(e,`library.preparing`))}),(0,B.jsxs)(`span`,{children:[Number(c.percent||0),`%`]})]}),(0,B.jsx)(`div`,{className:`mt-1 h-2 overflow-hidden rounded-full bg-muted`,children:(0,B.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${Number(c.percent||8)}%`}})})]}):null]})]})}function ie({error:e}){let t=s(e=>e.language),n=o(e.recovery_guidance);return(0,B.jsxs)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-sm`,children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(e.user_message||a(t,`library.model.setupAttention`))}),n.length?(0,B.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-muted-foreground`,children:n.slice(0,3).map(e=>(0,B.jsx)(`li`,{children:e},e))}):null]})}function q(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function J(){let e=l(),t=s(e=>e.language),n=u({queryKey:[`skills`],queryFn:i.skills}),r=u({queryKey:[`skillsMarketplace`],queryFn:i.skillsMarketplace}),c=d({mutationFn:e=>i.skillInstall(String(e.name||e.id),String(e.plugin||``)),onSuccess:()=>e.invalidateQueries({queryKey:[`skills`]})});return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(S,{title:a(t,`library.skills.installed`),result:n.data,children:e=>(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:o(e.skills).map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,B.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.plugin||e.description||``)})]}),(0,B.jsx)(T,{label:a(t,e.enabled?`library.skills.disable`:`library.skills.enable`),action:()=>i.skillToggle(String(e.name||e.id),!!e.enabled),invalidate:[`skills`]})]},String(e.name||e.id)))})}),(0,B.jsx)(S,{title:a(t,`library.skills.marketplace`),result:r.data,children:e=>(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:o(e.skills).slice(0,10).map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`font-medium`,children:String(e.name||e.id)}),(0,B.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:String(e.description||e.category||``)})]}),(0,B.jsx)(P,{variant:`outline`,disabled:c.isPending,onClick:()=>c.mutate(e),children:a(t,`library.skills.install`)})]},String(e.name||e.id)))})})]})}function Y(){let e=s(e=>e.mode),t=s(e=>e.language),[n,r]=z.useState(`github`),o=u({queryKey:[`mcpTools`],queryFn:i.mcpTools}),c=d({mutationFn:()=>i.mcpRecommend(n)});return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(S,{title:a(t,e===`basic`?`library.connector.connections`:`library.connector.mcpTools`),result:o.data,children:e=>(0,B.jsx)(y,{items:e.tools||e.installed_mcps,titleKey:`name`,metaKey:`status`})}),(0,B.jsxs)(C,{children:[(0,B.jsxs)(_,{children:[(0,B.jsxs)(f,{className:`flex items-center gap-2`,children:[(0,B.jsx)(R,{className:`h-4 w-4`}),` `,a(t,`library.connector.recommend`)]}),(0,B.jsx)(v,{children:a(t,`library.connector.recommendHint`)})]}),(0,B.jsxs)(x,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(F,{value:n,onChange:e=>r(e.target.value)}),(0,B.jsx)(P,{onClick:()=>c.mutate(),disabled:!n.trim()||c.isPending,children:a(t,`library.connector.recommendAction`)})]}),c.data?(0,B.jsx)(m,{result:c.data,successLabel:a(t,`library.connector.recommendDone`)}):null]})]})]})}function X(){let e=s(e=>e.language),t=u({queryKey:[`templates`],queryFn:i.templates}),n=u({queryKey:[`plugins`],queryFn:i.pluginsRegistry}),r=u({queryKey:[`pluginsDirectory`],queryFn:i.pluginsDirectory});return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,B.jsx)(S,{title:a(e,`library.market.templates`),result:t.data,children:e=>(0,B.jsx)(y,{items:e.templates,titleKey:`name`,metaKey:`kind`})}),(0,B.jsx)(S,{title:a(e,`library.market.installedPlugins`),result:n.data,children:e=>(0,B.jsx)(y,{items:e.plugins,titleKey:`name`,metaKey:`status`})}),(0,B.jsx)(S,{title:a(e,`library.market.pluginDirectory`),result:r.data,children:e=>(0,B.jsx)(y,{items:e.plugins,titleKey:`name`,metaKey:`category`})}),(0,B.jsxs)(C,{className:`xl:col-span-3`,children:[(0,B.jsxs)(_,{children:[(0,B.jsxs)(f,{className:`flex items-center gap-2`,children:[(0,B.jsx)(L,{className:`h-4 w-4`}),` `,a(e,`library.market.templateInstall`)]}),(0,B.jsx)(v,{children:a(e,`library.market.templateInstallHint`)})]}),(0,B.jsx)(x,{children:o(t.data?.data?.templates).length?(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:o(t.data?.data?.templates).slice(0,6).map(t=>(0,B.jsx)(T,{label:a(e,`library.market.installTemplate`,{name:String(t.name||t.id)}),action:()=>i.installTemplate(t)},String(t.id||t.name)))}):(0,B.jsx)(y,{items:[]})})]})]})}export{W as LibraryPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,_ as t,b as n,m as r,r as i,v as a,x as o}from"./utils-
|
|
1
|
+
import{C as e,_ as t,b as n,m as r,r as i,v as a,x as o}from"./utils-CiFtIdZq.js";var s=t(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),c=t(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),l=e(o()),u=n(),d=Array.from({length:12},(e,t)=>t),f=[{x:22,y:32,delay:-.4,duration:5.8},{x:36,y:18,delay:-2.1,duration:6.4},{x:65,y:22,delay:-3.7,duration:5.4},{x:79,y:42,delay:-1.3,duration:6.8},{x:68,y:72,delay:-4.5,duration:5.9},{x:31,y:75,delay:-2.8,duration:6.2}];function p({state:e=`idle`,intensity:t=.6,onPulse:n,size:o=`large`,label:s,className:c,showLabel:p=!0,depth:h=0,onInteract:g}){let _=a(e=>e.language),v=l.useRef(null),y=l.useRef(null),b=l.useRef(null),x=l.useRef({x:0,y:0}),S=l.useId().replace(/:/g,``),C={left:`${S}-lobe-left`,right:`${S}-lobe-right`,bridge:`${S}-bridge`,stem:`${S}-stem`,sheen:`${S}-sheen`},w=l.useCallback(()=>{v.current&&(v.current.classList.add(`pulse`),y.current!==null&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>{v.current&&v.current.classList.remove(`pulse`)},1350)),n?.()},[n]);l.useEffect(()=>{let e=()=>w();return window.addEventListener(`brain:recall`,e),()=>{window.removeEventListener(`brain:recall`,e),y.current!==null&&window.clearTimeout(y.current)}},[w]),l.useEffect(()=>{if(e===`recalling`||t>.82){let e=window.setTimeout(()=>w(),180);return()=>clearTimeout(e)}},[e,t,w]);let T=e,E=o===`large`,D=o===`trace`,O=Math.max(.35,Math.min(1,t)),k=Math.max(0,Math.min(5,h||0)),A=e===`thinking`||e===`recalling`||e===`synthesizing`||e===`acting`,j=()=>{w(),!A&&g?.()},M=l.useRef(!1);l.useEffect(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>{M.current=e.matches};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let N=l.useCallback(e=>{if(M.current||e.pointerType===`touch`)return;let t=e.currentTarget.getBoundingClientRect(),n=(e.clientX-t.left)/t.width*2-1;x.current={x:((e.clientY-t.top)/t.height*2-1)*-9,y:n*11},b.current===null&&(b.current=window.requestAnimationFrame(()=>{b.current=null;let e=v.current;e&&(e.style.setProperty(`--tilt-y`,`${x.current.y.toFixed(2)}deg`),e.style.setProperty(`--tilt-x`,`${x.current.x.toFixed(2)}deg`))}))},[]),P=l.useCallback(e=>{b.current!==null&&(window.cancelAnimationFrame(b.current),b.current=null);let t=e.currentTarget;t.style.setProperty(`--tilt-y`,`0deg`),t.style.setProperty(`--tilt-x`,`0deg`)},[]);return l.useEffect(()=>()=>{b.current!==null&&window.cancelAnimationFrame(b.current)},[]),(0,u.jsxs)(`div`,{className:i(`brain-presence select-none`,E&&`large`,D&&`trace`,c,k>0&&`is-exploring`),"aria-label":r(_,`brain.living.aria`),role:`group`,"data-depth":k,children:[(0,u.jsxs)(`button`,{type:`button`,ref:v,className:i(`brain-organism`,`size-${o}`,`depth-${k}`),"data-state":T,"data-testid":`living-brain`,"aria-label":r(_,k<5?`brain.living.open`:`brain.living.graph`),"aria-busy":A,style:{"--brain-scale":`${.96+(O-.5)*.09+k*.015}`},onClick:j,onPointerMove:N,onPointerLeave:P,title:r(_,k<5?`brain.living.open`:`brain.living.graph`),children:[(0,u.jsxs)(`div`,{className:`brain-vital-field`,"aria-hidden":`true`,children:[(0,u.jsx)(`span`,{className:`brain-vital-ring is-primary`}),(0,u.jsx)(`span`,{className:`brain-vital-ring is-echo`}),(0,u.jsx)(`span`,{className:`brain-orbit is-near`,children:(0,u.jsx)(`i`,{})}),(0,u.jsx)(`span`,{className:`brain-orbit is-far`,children:(0,u.jsx)(`i`,{})}),f.map((e,t)=>(0,u.jsx)(`i`,{className:`brain-vital-spark`,style:{left:`${e.x}%`,top:`${e.y}%`,animationDelay:`${e.delay}s`,animationDuration:`${e.duration}s`,"--spark-index":t}},`${e.x}-${e.y}`))]}),(0,u.jsx)(`div`,{className:`brain-core`,style:{"--core-scale":`${1+k*.045}`},children:(0,u.jsx)(`div`,{className:`brain-body-motion`,children:(0,u.jsxs)(`svg`,{className:`brain-anatomy`,viewBox:`0 0 220 174`,"aria-hidden":!0,children:[(0,u.jsxs)(`defs`,{children:[(0,u.jsxs)(`radialGradient`,{id:C.left,cx:`34%`,cy:`26%`,r:`85%`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--brain-halo) / 0.8)`}),(0,u.jsx)(`stop`,{offset:`42%`,stopColor:`hsl(var(--brain-core) / 0.46)`}),(0,u.jsx)(`stop`,{offset:`78%`,stopColor:`hsl(var(--brain-core) / 0.2)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--brain-shade) / 0.28)`})]}),(0,u.jsxs)(`radialGradient`,{id:C.right,cx:`62%`,cy:`24%`,r:`88%`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--connection) / 0.66)`}),(0,u.jsx)(`stop`,{offset:`46%`,stopColor:`hsl(var(--connection) / 0.32)`}),(0,u.jsx)(`stop`,{offset:`80%`,stopColor:`hsl(var(--connection) / 0.14)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--brain-shade) / 0.3)`})]}),(0,u.jsxs)(`radialGradient`,{id:C.bridge,cx:`50%`,cy:`30%`,r:`80%`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--memory) / 0.55)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--memory) / 0.1)`})]}),(0,u.jsxs)(`linearGradient`,{id:C.stem,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--knowledge) / 0.42)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--knowledge) / 0.08)`})]}),(0,u.jsxs)(`linearGradient`,{id:C.sheen,x1:`0`,y1:`0`,x2:`0.4`,y2:`1`,children:[(0,u.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--brain-sheen) / 0.5)`}),(0,u.jsx)(`stop`,{offset:`70%`,stopColor:`hsl(var(--brain-sheen) / 0.06)`}),(0,u.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--brain-sheen) / 0)`})]})]}),(0,u.jsx)(`path`,{className:`brain-lobe brain-lobe-left`,style:{fill:`url(#${C.left})`},d:`M102 30c-13-20-44-19-55 1-18 1-29 16-28 33-13 8-18 25-11 39-9 16-1 36 17 42 5 19 27 26 43 15 13 10 33 8 43-5 5-7 8-16 8-27V52c0-8-6-17-17-22Z`}),(0,u.jsx)(`path`,{className:`brain-lobe brain-lobe-right`,style:{fill:`url(#${C.right})`},d:`M118 30c13-20 44-19 55 1 18 1 29 16 28 33 13 8 18 25 11 39 9 16 1 36-17 42-5 19-27 26-43 15-13 10-33 8-43-5-5-7-8-16-8-27V52c0-8 6-17 17-22Z`}),(0,u.jsx)(`path`,{className:`brain-bridge`,style:{fill:`url(#${C.bridge})`},d:`M103 48c9-8 24-8 33 0 7 6 9 16 5 25-5 11-16 15-31 12-15 3-26-1-31-12-4-9-2-19 5-25 5-4 12-6 19 0Z`}),(0,u.jsx)(`path`,{className:`brain-stem`,style:{fill:`url(#${C.stem})`},d:`M92 137c10 9 26 9 36 0 1 14 7 25 20 33H76c12-8 17-19 16-33Z`}),(0,u.jsx)(`path`,{className:`brain-fold fold-a`,d:`M48 50c18-11 38-8 47 8`}),(0,u.jsx)(`path`,{className:`brain-fold fold-b`,d:`M34 82c22-8 45-5 58 8`}),(0,u.jsx)(`path`,{className:`brain-fold fold-c`,d:`M43 119c18 5 35 2 49-11`}),(0,u.jsx)(`path`,{className:`brain-fold fold-d`,d:`M172 50c-18-11-38-8-47 8`}),(0,u.jsx)(`path`,{className:`brain-fold fold-e`,d:`M186 82c-22-8-45-5-58 8`}),(0,u.jsx)(`path`,{className:`brain-fold fold-f`,d:`M177 119c-18 5-35 2-49-11`}),(0,u.jsx)(`path`,{className:`brain-fold fold-mid`,d:`M110 38c-5 30-5 70 0 112`}),(0,u.jsx)(`path`,{className:`brain-sheen`,style:{fill:`url(#${C.sheen})`},d:`M58 38c22-16 52-20 78-10-30-2-58 6-74 22-8 8-16 6-4-12Z`})]})})}),(0,u.jsx)(`div`,{className:`brain-aura`,style:{animationDuration:e===`thinking`?`1.65s`:e===`recalling`?`2.4s`:`6.8s`,"--aura-scale":`${1+k*.12}`,opacity:.65+k*.05,boxShadow:k>2?`0 0 var(--aura-blur, 60px) hsl(var(--brain-core) / 0.25)`:`none`}}),(0,u.jsx)(`div`,{className:`thought-activity`,"aria-hidden":!0,children:d.slice(0,Math.min(12,5+k*2)).map(e=>(0,u.jsx)(`div`,{className:i(`thought-particle`,k>=3&&`resolving`),style:{left:`${18+(e*13+k*4)%64}%`,top:`${22+e%5*14}%`,animationDelay:`-${e*.55+t*1.1-k*.2}s`,animationDuration:`${2.8+(1-O)*1.6-k*.15}s`}},e))}),Array.from({length:1+Math.floor(k/1.5)}).map((e,t)=>(0,u.jsx)(`div`,{className:`memory-ripple`,"aria-hidden":!0,style:{inset:`${18+t*6}%`,animationDelay:`${180+t*220}ms`,opacity:.55+k*.06}},t))]}),p&&!D&&(0,u.jsxs)(`div`,{className:`brain-presence-label`,"data-state":e,children:[(0,u.jsx)(`span`,{className:`dot`}),s||(k>0?r(_,`brain.living.depth`,{depth:k}):r(_,m(e)))]})]})}function m(e){switch(e){case`listening`:return`brain.living.state.listening`;case`thinking`:return`brain.living.state.thinking`;case`recalling`:return`brain.living.state.recalling`;case`synthesizing`:return`brain.living.state.synthesizing`;case`planning`:return`brain.living.state.planning`;case`acting`:return`brain.living.state.acting`;case`resting`:return`brain.living.state.resting`;default:return`brain.living.state.idle`}}function h(){typeof window<`u`&&window.dispatchEvent(new CustomEvent(`brain:recall`))}export{s as i,h as n,c as r,p as t};
|