cct-cli 0.7.9.0__py3-none-any.whl
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.
- calc_terminal/__init__.py +14 -0
- calc_terminal/__main__.py +14 -0
- calc_terminal/activity.py +1334 -0
- calc_terminal/agent.py +3387 -0
- calc_terminal/agent_runtime.py +519 -0
- calc_terminal/ai_context.py +447 -0
- calc_terminal/ai_modes.py +752 -0
- calc_terminal/ai_personalization.py +286 -0
- calc_terminal/ai_preview_feedback.py +213 -0
- calc_terminal/aicore.py +2572 -0
- calc_terminal/anim.py +367 -0
- calc_terminal/app.py +3685 -0
- calc_terminal/art.py +639 -0
- calc_terminal/atomsim.py +368 -0
- calc_terminal/attachments.py +743 -0
- calc_terminal/benchmark_system.py +414 -0
- calc_terminal/browser/__init__.py +36 -0
- calc_terminal/browser/browser_state.py +346 -0
- calc_terminal/browser/devserver.py +176 -0
- calc_terminal/browser/engine.py +494 -0
- calc_terminal/browser/navigation.py +84 -0
- calc_terminal/browser/preview.py +429 -0
- calc_terminal/browser/preview_entry.py +95 -0
- calc_terminal/browser/project_detector.py +144 -0
- calc_terminal/browser/server.py +449 -0
- calc_terminal/browser/state.py +75 -0
- calc_terminal/browser/watcher.py +99 -0
- calc_terminal/browser_gui/__init__.py +1 -0
- calc_terminal/browser_gui/__main__.py +3 -0
- calc_terminal/browser_gui/launcher.py +173 -0
- calc_terminal/browser_gui/playwright_browser.py +117 -0
- calc_terminal/browser_gui/qt_browser.py +1501 -0
- calc_terminal/browser_gui/webview_browser.py +57 -0
- calc_terminal/capabilities/__init__.py +35 -0
- calc_terminal/capabilities/adapters/__init__.py +33 -0
- calc_terminal/capabilities/adapters/bioinformatics.py +204 -0
- calc_terminal/capabilities/adapters/browser_adapter.py +205 -0
- calc_terminal/capabilities/adapters/filesystem.py +206 -0
- calc_terminal/capabilities/adapters/git_adapter.py +202 -0
- calc_terminal/capabilities/adapters/jupyter_adapter.py +138 -0
- calc_terminal/capabilities/adapters/ml_frameworks.py +158 -0
- calc_terminal/capabilities/adapters/platforms.py +200 -0
- calc_terminal/capabilities/adapters/python_exec.py +93 -0
- calc_terminal/capabilities/adapters/quantum_adapter.py +150 -0
- calc_terminal/capabilities/adapters/scientific_comp.py +123 -0
- calc_terminal/capabilities/adapters/structural_bio.py +161 -0
- calc_terminal/capabilities/adapters/terminal.py +99 -0
- calc_terminal/capabilities/bus.py +178 -0
- calc_terminal/capabilities/discovery.py +207 -0
- calc_terminal/capabilities/schema.py +221 -0
- calc_terminal/cat.ico +0 -0
- calc_terminal/cat_browser.py +2018 -0
- calc_terminal/chat_store.py +703 -0
- calc_terminal/cli.py +1178 -0
- calc_terminal/code_editor.py +640 -0
- calc_terminal/collaboration.py +723 -0
- calc_terminal/commands_data.py +139 -0
- calc_terminal/compatibility_engine.py +352 -0
- calc_terminal/compute/__init__.py +31 -0
- calc_terminal/compute/fabric.py +350 -0
- calc_terminal/config.py +227 -0
- calc_terminal/core/__init__.py +41 -0
- calc_terminal/core/checkpoint.py +156 -0
- calc_terminal/core/input/__init__.py +45 -0
- calc_terminal/core/mode_registry.py +300 -0
- calc_terminal/core/project_graph.py +172 -0
- calc_terminal/core/recovery.py +129 -0
- calc_terminal/core/security_layer.py +112 -0
- calc_terminal/core/task_graph.py +202 -0
- calc_terminal/core/unified_runtime.py +184 -0
- calc_terminal/core/verification.py +257 -0
- calc_terminal/customization.py +1566 -0
- calc_terminal/derivations.py +153 -0
- calc_terminal/device_control.py +263 -0
- calc_terminal/diagnostics/__init__.py +27 -0
- calc_terminal/diagnostics/doctor_engine.py +382 -0
- calc_terminal/diagnostics/self_test.py +247 -0
- calc_terminal/doctor.py +519 -0
- calc_terminal/easter_eggs.py +274 -0
- calc_terminal/editor/__init__.py +1 -0
- calc_terminal/editor/actions.py +263 -0
- calc_terminal/editor/commands.py +160 -0
- calc_terminal/editor/shortcuts.py +226 -0
- calc_terminal/engine.py +259 -0
- calc_terminal/errors.py +120 -0
- calc_terminal/event_stream.py +146 -0
- calc_terminal/eventbus.py +133 -0
- calc_terminal/extensions.py +733 -0
- calc_terminal/fallback_cli.py +1321 -0
- calc_terminal/first_run.py +265 -0
- calc_terminal/fomoji_auth.py +1043 -0
- calc_terminal/formulas.py +82 -0
- calc_terminal/fs_cache.py +121 -0
- calc_terminal/fs_watcher.py +277 -0
- calc_terminal/game.py +193 -0
- calc_terminal/gen1.py +5 -0
- calc_terminal/generators.py +245 -0
- calc_terminal/gestures/__init__.py +42 -0
- calc_terminal/gestures/bindings.py +175 -0
- calc_terminal/gestures/manager.py +477 -0
- calc_terminal/goodbye.py +363 -0
- calc_terminal/gpu3d.py +290 -0
- calc_terminal/graphs.py +358 -0
- calc_terminal/hardware_analyzer.py +440 -0
- calc_terminal/host/__init__.py +30 -0
- calc_terminal/host/browser_manager.py +187 -0
- calc_terminal/host/desktop.py +1386 -0
- calc_terminal/host/launcher.py +395 -0
- calc_terminal/host/terminal.py +279 -0
- calc_terminal/identity.py +216 -0
- calc_terminal/input/__init__.py +54 -0
- calc_terminal/input/capabilities.py +258 -0
- calc_terminal/input/focus.py +87 -0
- calc_terminal/input/gestures.py +64 -0
- calc_terminal/input/pointer.py +114 -0
- calc_terminal/input/touch.py +345 -0
- calc_terminal/keys.py +84 -0
- calc_terminal/live_automation.py +165 -0
- calc_terminal/mathtext.py +433 -0
- calc_terminal/mcp.py +386 -0
- calc_terminal/memory.py +337 -0
- calc_terminal/memory_v2.py +479 -0
- calc_terminal/metrics.py +333 -0
- calc_terminal/mode_detection.py +146 -0
- calc_terminal/model.py +2431 -0
- calc_terminal/model_router.py +665 -0
- calc_terminal/models/__init__.py +0 -0
- calc_terminal/models/active_state.py +187 -0
- calc_terminal/models/dynamic_registry.py +584 -0
- calc_terminal/models/manager.py +781 -0
- calc_terminal/models/model_metadata.json +3526 -0
- calc_terminal/models/profiles.py +194 -0
- calc_terminal/models/registry.py +265 -0
- calc_terminal/models/schema.py +197 -0
- calc_terminal/models/validator.py +287 -0
- calc_terminal/models/verification_engine.py +368 -0
- calc_terminal/native_picker.py +215 -0
- calc_terminal/ollama_catalog.py +279 -0
- calc_terminal/ollama_download.py +233 -0
- calc_terminal/orchestrator.py +304 -0
- calc_terminal/package_research.py +322 -0
- calc_terminal/packages.py +1024 -0
- calc_terminal/pc_specs.py +116 -0
- calc_terminal/permissions.py +334 -0
- calc_terminal/pet.py +106 -0
- calc_terminal/pipeline.py +505 -0
- calc_terminal/platform/__init__.py +491 -0
- calc_terminal/platform/desktop.py +491 -0
- calc_terminal/platform/web.py +781 -0
- calc_terminal/preview/__init__.py +1 -0
- calc_terminal/preview/dev_server.py +303 -0
- calc_terminal/preview/diagnostics.py +131 -0
- calc_terminal/preview/live_reload.py +66 -0
- calc_terminal/preview/manager.py +129 -0
- calc_terminal/project_stats.py +209 -0
- calc_terminal/projects.py +328 -0
- calc_terminal/providers/__init__.py +0 -0
- calc_terminal/providers/adapters/__init__.py +80 -0
- calc_terminal/providers/adapters/anthropic_adapter.py +127 -0
- calc_terminal/providers/adapters/base.py +106 -0
- calc_terminal/providers/adapters/chinese_adapters.py +420 -0
- calc_terminal/providers/adapters/gemini_adapter.py +101 -0
- calc_terminal/providers/adapters/ollama_adapter.py +83 -0
- calc_terminal/providers/adapters/openai_adapter.py +159 -0
- calc_terminal/providers/adapters/other_adapters.py +246 -0
- calc_terminal/providers/anthropic_provider.py +172 -0
- calc_terminal/providers/auto_update.py +416 -0
- calc_terminal/providers/base_provider.py +105 -0
- calc_terminal/providers/discovery_manager.py +207 -0
- calc_terminal/providers/gemini_provider.py +178 -0
- calc_terminal/providers/lifecycle.py +767 -0
- calc_terminal/providers/ollama_adapter.py +707 -0
- calc_terminal/providers/openai_provider.py +254 -0
- calc_terminal/providers/provider_manager.py +1827 -0
- calc_terminal/providers/providers.json +4075 -0
- calc_terminal/reactionsim.py +279 -0
- calc_terminal/registry.py +337 -0
- calc_terminal/report.py +162 -0
- calc_terminal/research/__init__.py +45 -0
- calc_terminal/research/artifact_intel.py +126 -0
- calc_terminal/research/data_lineage.py +123 -0
- calc_terminal/research/experiment_ledger.py +303 -0
- calc_terminal/research/reproducibility.py +131 -0
- calc_terminal/resilience/__init__.py +47 -0
- calc_terminal/resilience/agent_state.py +121 -0
- calc_terminal/resilience/capability_matcher.py +174 -0
- calc_terminal/resilience/circuit_breaker.py +158 -0
- calc_terminal/resilience/failover_engine.py +230 -0
- calc_terminal/resilience/health_monitor.py +192 -0
- calc_terminal/resilience/ollama_adapter.py +125 -0
- calc_terminal/resilience/orchestrator.py +312 -0
- calc_terminal/resilience/types.py +134 -0
- calc_terminal/sandbox.py +98 -0
- calc_terminal/scires.py +558 -0
- calc_terminal/security_scanner.py +126 -0
- calc_terminal/session.py +294 -0
- calc_terminal/sim3d.py +206 -0
- calc_terminal/solver.py +276 -0
- calc_terminal/sound.py +127 -0
- calc_terminal/task_reports.py +287 -0
- calc_terminal/terminal_host.py +201 -0
- calc_terminal/terminal_identity.py +411 -0
- calc_terminal/test_ai_mode_reliability.py +344 -0
- calc_terminal/test_browser.py +368 -0
- calc_terminal/test_code_editor_upgrade.py +485 -0
- calc_terminal/test_customization.py +1148 -0
- calc_terminal/test_customization_ui.py +612 -0
- calc_terminal/test_dynamic_registry.py +304 -0
- calc_terminal/test_extensions.py +436 -0
- calc_terminal/test_overhaul.py +557 -0
- calc_terminal/test_project_detect.py +255 -0
- calc_terminal/test_root_cause_fix.py +527 -0
- calc_terminal/test_stability.py +532 -0
- calc_terminal/test_terminal_identity.py +132 -0
- calc_terminal/test_v079_speed.py +460 -0
- calc_terminal/theme.py +1107 -0
- calc_terminal/timeline.py +139 -0
- calc_terminal/todos.py +246 -0
- calc_terminal/tool_call_normalizer.py +419 -0
- calc_terminal/tui.py +104 -0
- calc_terminal/ui/__init__.py +8 -0
- calc_terminal/ui/activity_panel.py +231 -0
- calc_terminal/ui/activity_stream_panel.py +238 -0
- calc_terminal/ui/animations.py +122 -0
- calc_terminal/ui/app.py +7271 -0
- calc_terminal/ui/attach_panel.py +597 -0
- calc_terminal/ui/attachments.py +424 -0
- calc_terminal/ui/backup_panel.py +810 -0
- calc_terminal/ui/browser_shell.py +887 -0
- calc_terminal/ui/cat_agent.py +357 -0
- calc_terminal/ui/chats_panel.py +899 -0
- calc_terminal/ui/command_palette.py +125 -0
- calc_terminal/ui/command_palette_modal.py +166 -0
- calc_terminal/ui/composer.py +1141 -0
- calc_terminal/ui/context_menu.py +197 -0
- calc_terminal/ui/conversation.py +1435 -0
- calc_terminal/ui/customization_panel.py +1229 -0
- calc_terminal/ui/dashboard.py +404 -0
- calc_terminal/ui/design_system.py +557 -0
- calc_terminal/ui/diff_panel.py +213 -0
- calc_terminal/ui/editor.py +2102 -0
- calc_terminal/ui/empty_state.py +302 -0
- calc_terminal/ui/events.py +487 -0
- calc_terminal/ui/extensions_panel.py +815 -0
- calc_terminal/ui/footer.py +166 -0
- calc_terminal/ui/gestures_panel.py +383 -0
- calc_terminal/ui/goodbye_screen.py +100 -0
- calc_terminal/ui/header.py +1034 -0
- calc_terminal/ui/help_panel.py +254 -0
- calc_terminal/ui/live_activities.py +914 -0
- calc_terminal/ui/mcp_panel.py +570 -0
- calc_terminal/ui/memory_center.py +524 -0
- calc_terminal/ui/mode_colors_panel.py +525 -0
- calc_terminal/ui/nav_screens.py +747 -0
- calc_terminal/ui/ollama_panel.py +536 -0
- calc_terminal/ui/palette.py +221 -0
- calc_terminal/ui/permission_panel.py +269 -0
- calc_terminal/ui/personalization_panel.py +517 -0
- calc_terminal/ui/personalize_center.py +1568 -0
- calc_terminal/ui/preview_panel.py +441 -0
- calc_terminal/ui/resizers.py +402 -0
- calc_terminal/ui/sidebar.py +1285 -0
- calc_terminal/ui/statusbar.py +168 -0
- calc_terminal/ui/theme_css.py +1396 -0
- calc_terminal/ui/thinking.py +226 -0
- calc_terminal/ui/timeline_panel.py +102 -0
- calc_terminal/ui/todo_panel.py +193 -0
- calc_terminal/ui/viewport.py +136 -0
- calc_terminal/ui/vision_panel.py +489 -0
- calc_terminal/ui/welcome_modal.py +343 -0
- calc_terminal/ui/widgets.py +160 -0
- calc_terminal/ui/workspace.py +831 -0
- calc_terminal/viewers/__init__.py +1 -0
- calc_terminal/viewers/document_viewer.py +252 -0
- calc_terminal/viewers/image_viewer.py +241 -0
- calc_terminal/viewers/pdf_viewer.py +203 -0
- calc_terminal/viewers/presentation_viewer.py +164 -0
- calc_terminal/viewers/registry.py +120 -0
- calc_terminal/viewers/spreadsheet_viewer.py +204 -0
- calc_terminal/vision/__init__.py +89 -0
- calc_terminal/vision/analysis.py +194 -0
- calc_terminal/vision/annotations.py +297 -0
- calc_terminal/vision/capture.py +171 -0
- calc_terminal/vision/context.py +231 -0
- calc_terminal/vision/correlation.py +169 -0
- calc_terminal/vision/cursor.py +258 -0
- calc_terminal/vision/events.py +66 -0
- calc_terminal/vision/frame_pipeline.py +259 -0
- calc_terminal/vision/priority.py +218 -0
- calc_terminal/vision/provider.py +180 -0
- calc_terminal/vision/safety.py +149 -0
- calc_terminal/vision/session.py +281 -0
- calc_terminal/vision/verify.py +162 -0
- calc_terminal/vision.py +514 -0
- calc_terminal/vscode_integration.py +113 -0
- calc_terminal/web/__init__.py +8 -0
- calc_terminal/web/cat_runtime.py +710 -0
- calc_terminal/web/server.py +2891 -0
- calc_terminal/web/static/css/app.css +3152 -0
- calc_terminal/web/static/icons/badge-72.png +0 -0
- calc_terminal/web/static/icons/cat.ico +0 -0
- calc_terminal/web/static/icons/icon-128.png +0 -0
- calc_terminal/web/static/icons/icon-144.png +0 -0
- calc_terminal/web/static/icons/icon-152.png +0 -0
- calc_terminal/web/static/icons/icon-192.png +0 -0
- calc_terminal/web/static/icons/icon-384.png +0 -0
- calc_terminal/web/static/icons/icon-512.png +0 -0
- calc_terminal/web/static/icons/icon-72.png +0 -0
- calc_terminal/web/static/icons/icon-96.png +0 -0
- calc_terminal/web/static/icons/icon.svg +34 -0
- calc_terminal/web/static/icons/new-project.png +0 -0
- calc_terminal/web/static/icons/open-project.png +0 -0
- calc_terminal/web/static/index.html +734 -0
- calc_terminal/web/static/js/app.js +2403 -0
- calc_terminal/web/static/manifest.json +88 -0
- calc_terminal/web/static/sw.js +230 -0
- calc_terminal/workflow_engine.py +769 -0
- calc_terminal/workspace.py +593 -0
- calc_terminal/workspace_index.py +385 -0
- cct_cli-0.7.9.0.dist-info/METADATA +210 -0
- cct_cli-0.7.9.0.dist-info/RECORD +325 -0
- cct_cli-0.7.9.0.dist-info/WHEEL +5 -0
- cct_cli-0.7.9.0.dist-info/entry_points.txt +4 -0
- cct_cli-0.7.9.0.dist-info/licenses/LICENSE +21 -0
- cct_cli-0.7.9.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Random numerical generators. Each returns a dict describing one full
|
|
3
|
+
notebook: Question -> Given -> Find -> Formula -> Substitution ->
|
|
4
|
+
Calculation -> Units -> Verification -> Final Answer.
|
|
5
|
+
|
|
6
|
+
`formula` / `substitution` are lists of parts consumed by
|
|
7
|
+
mathtext.compose() (plain strings or frac_part(num, den) tuples).
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import math
|
|
11
|
+
import random
|
|
12
|
+
|
|
13
|
+
from .mathtext import frac_part as F, sub, sup
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def r(n, d=3):
|
|
17
|
+
return round(n, d)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def first_order():
|
|
21
|
+
t = random.choice([10, 15, 20, 25, 30, 40])
|
|
22
|
+
ratio = random.choice([2, 3, 4, 5])
|
|
23
|
+
R = random.choice([0.1, 0.2, 0.4, 0.5, 0.8, 1.0])
|
|
24
|
+
R0 = r(R * ratio, 3)
|
|
25
|
+
k = (2.303 / t) * math.log10(ratio)
|
|
26
|
+
half_life = 0.693 / k
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
"intent": "first",
|
|
30
|
+
"topic": "Chemical Kinetics \u00b7 First Order",
|
|
31
|
+
"question": f"A first order reaction has an initial concentration [R]{sub(0)} = {R0} mol/L, "
|
|
32
|
+
f"which falls to [R] = {R} mol/L in {t} minutes. Find the rate constant k.",
|
|
33
|
+
"given": [
|
|
34
|
+
f"Initial concentration [R]{sub(0)} = {R0} mol/L",
|
|
35
|
+
f"Concentration after time t, [R] = {R} mol/L",
|
|
36
|
+
f"Time, t = {t} min",
|
|
37
|
+
],
|
|
38
|
+
"find": "Rate constant, k",
|
|
39
|
+
"formula": ["k = ", F("2.303", "t"), f" log([R]{sub(0)}/[R])"],
|
|
40
|
+
"substitution": ["k = ", F("2.303", str(t)), f" log({R0}/{R})"],
|
|
41
|
+
"calculation": [
|
|
42
|
+
f"[R]{sub(0)}/[R] = {R0}/{R} = {r(R0/R,3)}",
|
|
43
|
+
f"log({r(R0/R,3)}) = {r(math.log10(ratio),4)}",
|
|
44
|
+
f"k = (2.303 / {t}) \u00d7 {r(math.log10(ratio),4)} = {r(k,5)} min{sup('-1')}",
|
|
45
|
+
],
|
|
46
|
+
"unit": f"k is expressed in time{sup('-1')} (here, min{sup('-1')}) — first-order rate constants are independent of concentration units.",
|
|
47
|
+
"verification": f"Using k = {r(k,5)} min{sup('-1')}, half-life t\u00bd = 0.693/k \u2248 {r(half_life,2)} min, "
|
|
48
|
+
f"consistent with the concentration more than halving over {t} min. \u2713",
|
|
49
|
+
"final_answer": f"k \u2248 {r(k,5)} min{sup('-1')}",
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def zero_order():
|
|
54
|
+
R0 = random.choice([1.0, 0.8, 0.6, 0.5])
|
|
55
|
+
t = random.choice([10, 20, 30, 40])
|
|
56
|
+
frac_remaining = random.choice([0.9, 0.85, 0.8, 0.75, 0.7])
|
|
57
|
+
R = r(R0 * frac_remaining, 3)
|
|
58
|
+
k = r((R0 - R) / t, 5)
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
"intent": "zero",
|
|
62
|
+
"topic": "Chemical Kinetics \u00b7 Zero Order",
|
|
63
|
+
"question": f"A zero order reaction starts with [R]{sub(0)} = {R0} mol/L and after {t} minutes "
|
|
64
|
+
f"the concentration falls to [R] = {R} mol/L. Find k.",
|
|
65
|
+
"given": [
|
|
66
|
+
f"Initial concentration [R]{sub(0)} = {R0} mol/L",
|
|
67
|
+
f"Concentration after time t, [R] = {R} mol/L",
|
|
68
|
+
f"Time, t = {t} min",
|
|
69
|
+
],
|
|
70
|
+
"find": "Rate constant, k",
|
|
71
|
+
"formula": ["k = ", F(f"[R]{sub(0)} \u2212 [R]", "t")],
|
|
72
|
+
"substitution": ["k = ", F(f"{R0} \u2212 {R}", str(t))],
|
|
73
|
+
"calculation": [
|
|
74
|
+
f"[R]{sub(0)} \u2212 [R] = {R0} \u2212 {R} = {r(R0-R,3)} mol/L",
|
|
75
|
+
f"k = {r(R0-R,3)} / {t} = {k} mol L{sup(-1)} min{sup(-1)}",
|
|
76
|
+
],
|
|
77
|
+
"unit": f"k is expressed in mol L{sup(-1)} time{sup(-1)} for a zero order reaction, since rate is concentration-independent.",
|
|
78
|
+
"verification": f"Check: [R] = [R]{sub(0)} \u2212 kt = {R0} \u2212 ({k}\u00d7{t}) = {r(R0-k*t,3)} mol/L, matching the given value. \u2713",
|
|
79
|
+
"final_answer": f"k \u2248 {k} mol L{sup(-1)} min{sup(-1)}",
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def second_order():
|
|
84
|
+
R0 = random.choice([0.5, 1, 1.5, 2])
|
|
85
|
+
t = random.choice([10, 20, 30])
|
|
86
|
+
k = random.choice([0.01, 0.02, 0.03, 0.05])
|
|
87
|
+
R = r(1 / ((1 / R0) + k * t), 4)
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
"intent": "second",
|
|
91
|
+
"topic": "Chemical Kinetics \u00b7 Second Order",
|
|
92
|
+
"question": f"For a second order reaction, [R]{sub(0)} = {R0} mol/L and k = {k} L mol{sup(-1)} min{sup(-1)}. "
|
|
93
|
+
f"Find [R] after {t} minutes.",
|
|
94
|
+
"given": [
|
|
95
|
+
f"Initial concentration [R]{sub(0)} = {R0} mol/L",
|
|
96
|
+
f"Rate constant k = {k} L mol{sup(-1)} min{sup(-1)}",
|
|
97
|
+
f"Time, t = {t} min",
|
|
98
|
+
],
|
|
99
|
+
"find": "Concentration [R] at time t",
|
|
100
|
+
"formula": [F("1", "[R]"), " = ", F("1", f"[R]{sub(0)}"), " + kt"],
|
|
101
|
+
"substitution": [F("1", "[R]"), " = ", F("1", str(R0)), f" + ({k})({t})"],
|
|
102
|
+
"calculation": [
|
|
103
|
+
f"1/{R0} = {r(1/R0,4)}",
|
|
104
|
+
f"kt = {k} \u00d7 {t} = {r(k*t,4)}",
|
|
105
|
+
f"1/[R] = {r(1/R0,4)} + {r(k*t,4)} = {r((1/R0)+k*t,4)}",
|
|
106
|
+
f"[R] = 1 / {r((1/R0)+k*t,4)} = {R} mol/L",
|
|
107
|
+
],
|
|
108
|
+
"unit": f"k is expressed in L mol{sup(-1)} time{sup(-1)} for a second order reaction.",
|
|
109
|
+
"verification": f"[R] = {R} mol/L is less than [R]{sub(0)} = {R0} mol/L, confirming concentration decreased over time. \u2713",
|
|
110
|
+
"final_answer": f"[R] \u2248 {R} mol/L",
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
def third_order():
|
|
114
|
+
R0 = random.choice([0.5, 1, 1.5, 2])
|
|
115
|
+
t = random.choice([5, 10, 15])
|
|
116
|
+
k = random.choice([0.005, 0.01, 0.015])
|
|
117
|
+
R_sq_inv = (1 / R0**2) + 2 * k * t
|
|
118
|
+
R = r(1 / math.sqrt(R_sq_inv), 4)
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
"intent": "third",
|
|
122
|
+
"topic": "Chemical Kinetics \u00b7 Third Order",
|
|
123
|
+
"question": f"For a third order reaction, [R]{sub(0)} = {R0} mol/L and k = {k} L{sup(2)} mol{sup(-2)} min{sup(-1)}. "
|
|
124
|
+
f"Find [R] after {t} minutes.",
|
|
125
|
+
"given": [
|
|
126
|
+
f"Initial concentration [R]{sub(0)} = {R0} mol/L",
|
|
127
|
+
f"Rate constant k = {k} L{sup(2)} mol{sup(-2)} min{sup(-1)}",
|
|
128
|
+
f"Time, t = {t} min",
|
|
129
|
+
],
|
|
130
|
+
"find": "Concentration [R] at time t",
|
|
131
|
+
"formula": [F("1", "[R]" + sup(2)), " = ", F("1", f"[R]{sub(0)}" + sup(2)), " + 2kt"],
|
|
132
|
+
"substitution": [F("1", "[R]" + sup(2)), " = ", F("1", str(R0) + sup(2)), f" + 2({k})({t})"],
|
|
133
|
+
"calculation": [
|
|
134
|
+
f"1/({R0}){sup(2)} = {r(1/R0**2,4)}",
|
|
135
|
+
f"2kt = 2 \u00d7 {k} \u00d7 {t} = {r(2*k*t,4)}",
|
|
136
|
+
f"1/[R]{sup(2)} = {r(1/R0**2,4)} + {r(2*k*t,4)} = {r(R_sq_inv,4)}",
|
|
137
|
+
f"[R] = \u221a(1 / {r(R_sq_inv,4)}) = {R} mol/L",
|
|
138
|
+
],
|
|
139
|
+
"unit": f"k is expressed in L{sup(2)} mol{sup(-2)} time{sup(-1)} for a third order reaction.",
|
|
140
|
+
"verification": f"[R] = {R} mol/L is less than [R]{sub(0)} = {R0} mol/L, confirming concentration decreased over time. \u2713",
|
|
141
|
+
"final_answer": f"[R] \u2248 {R} mol/L",
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def half_life():
|
|
146
|
+
t_half = random.choice([10, 15, 20, 25, 30, 40, 60])
|
|
147
|
+
k = r(0.693 / t_half, 5)
|
|
148
|
+
t75 = r(2 * t_half, 2)
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
"intent": "halflife",
|
|
152
|
+
"topic": "Chemical Kinetics \u00b7 Half-Life",
|
|
153
|
+
"question": f"A first order reaction has a half-life of {t_half} minutes. "
|
|
154
|
+
f"Find the rate constant k and the time required for 75% completion.",
|
|
155
|
+
"given": [f"Half-life, t\u00bd = {t_half} min", "Reaction order = first order"],
|
|
156
|
+
"find": "Rate constant k, and time for 75% completion",
|
|
157
|
+
"formula": ["k = ", F("0.693", "t\u00bd")],
|
|
158
|
+
"substitution": ["k = ", F("0.693", str(t_half))],
|
|
159
|
+
"calculation": [
|
|
160
|
+
f"k = 0.693 / {t_half} = {k} min{sup(-1)}",
|
|
161
|
+
"75% completion = 2 half-lives elapsed",
|
|
162
|
+
f"t(75%) = 2 \u00d7 t\u00bd = 2 \u00d7 {t_half} = {t75} min",
|
|
163
|
+
],
|
|
164
|
+
"unit": f"k is in min{sup(-1)}; t(75%) is in minutes.",
|
|
165
|
+
"verification": f"After 2 half-lives, concentration falls to (1/2)\u00b2 = 1/4 of initial — "
|
|
166
|
+
f"i.e. 75% has reacted, consistent with t(75%) = {t75} min. \u2713",
|
|
167
|
+
"final_answer": f"k \u2248 {k} min{sup(-1)}, t(75%) \u2248 {t75} min",
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def arrhenius():
|
|
172
|
+
Ea = random.choice([50, 60, 75, 90, 100]) * 1000
|
|
173
|
+
T1 = random.choice([290, 300, 310])
|
|
174
|
+
T2 = T1 + random.choice([10, 15, 20])
|
|
175
|
+
k1 = random.choice([1e-4, 2e-4, 3.2e-4, 5e-4])
|
|
176
|
+
R = 8.314
|
|
177
|
+
ln_ratio = (-Ea / R) * ((1 / T2) - (1 / T1))
|
|
178
|
+
k2 = k1 * math.exp(ln_ratio)
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
"intent": "arrhenius",
|
|
182
|
+
"topic": "Chemical Kinetics \u00b7 Arrhenius Equation",
|
|
183
|
+
"question": f"A reaction has activation energy Ea = {Ea/1000} kJ/mol and rate constant "
|
|
184
|
+
f"k{sub(1)} = {k1:.2e} s{sup(-1)} at T{sub(1)} = {T1} K. Find k{sub(2)} at T{sub(2)} = {T2} K.",
|
|
185
|
+
"given": [
|
|
186
|
+
f"Activation energy, Ea = {Ea/1000} kJ/mol = {Ea} J/mol",
|
|
187
|
+
f"k{sub(1)} = {k1:.2e} s{sup(-1)} at T{sub(1)} = {T1} K",
|
|
188
|
+
f"T{sub(2)} = {T2} K",
|
|
189
|
+
"R = 8.314 J mol\u207b\u00b9 K\u207b\u00b9",
|
|
190
|
+
],
|
|
191
|
+
"find": f"Rate constant k{sub(2)} at T{sub(2)}",
|
|
192
|
+
"formula": [f"ln", F(f"k{sub(2)}", f"k{sub(1)}"), " = ", F("\u2212Ea", "R"),
|
|
193
|
+
" \u00d7 (", F("1", f"T{sub(2)}"), " \u2212 ", F("1", f"T{sub(1)}"), ")"],
|
|
194
|
+
"substitution": [f"ln", F(f"k{sub(2)}", f"k{sub(1)}"), " = ", F(f"\u2212{Ea}", "8.314"),
|
|
195
|
+
f" \u00d7 (", F("1", str(T2)), " \u2212 ", F("1", str(T1)), ")"],
|
|
196
|
+
"calculation": [
|
|
197
|
+
f"1/T{sub(2)} \u2212 1/T{sub(1)} = {r((1/T2)-(1/T1),8)} K{sup(-1)}",
|
|
198
|
+
f"ln(k{sub(2)}/k{sub(1)}) = {r(ln_ratio,4)}",
|
|
199
|
+
f"k{sub(2)}/k{sub(1)} = e^{r(ln_ratio,4)} = {r(math.exp(ln_ratio),4)}",
|
|
200
|
+
f"k{sub(2)} = {k1:.2e} \u00d7 {r(math.exp(ln_ratio),4)} = {k2:.3e} s{sup(-1)}",
|
|
201
|
+
],
|
|
202
|
+
"unit": f"k keeps the units of the given rate constant (s{sup(-1)}); Ea is in J/mol when paired with R = 8.314 J mol{sup(-1)} K{sup(-1)}.",
|
|
203
|
+
"verification": f"Since T{sub(2)} > T{sub(1)}, k should increase — k{sub(2)} = {k2:.3e} s{sup(-1)} "
|
|
204
|
+
f"is indeed larger than k{sub(1)} = {k1:.2e} s{sup(-1)}. \u2713",
|
|
205
|
+
"final_answer": f"k{sub(2)} \u2248 {k2:.3e} s{sup(-1)}",
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
COMPOUNDS = [
|
|
210
|
+
("NaOH", 40), ("CaCO3", 100), ("H2SO4", 98),
|
|
211
|
+
("C6H12O6 (glucose)", 180), ("NaCl", 58.5), ("CO2", 44),
|
|
212
|
+
]
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def mole_concept():
|
|
216
|
+
name, M = random.choice(COMPOUNDS)
|
|
217
|
+
mass = random.choice([2, 4, 5, 8, 10, 20, 25])
|
|
218
|
+
moles = r(mass / M, 4)
|
|
219
|
+
|
|
220
|
+
return {
|
|
221
|
+
"intent": "mole",
|
|
222
|
+
"topic": "Mole Concept",
|
|
223
|
+
"question": f"Calculate the number of moles present in {mass} g of {name}.",
|
|
224
|
+
"given": [f"Mass of {name} = {mass} g", f"Molar mass of {name}, M = {M} g/mol"],
|
|
225
|
+
"find": "Number of moles, n",
|
|
226
|
+
"formula": ["n = ", F("Given mass", "Molar mass"), " = ", F("m", "M")],
|
|
227
|
+
"substitution": ["n = ", F(f"{mass} g", f"{M} g/mol")],
|
|
228
|
+
"calculation": [f"n = {mass} / {M} = {moles} mol"],
|
|
229
|
+
"unit": "Moles are a pure count and carry the unit mol.",
|
|
230
|
+
"verification": f"Reversing: mass = n \u00d7 M = {moles} \u00d7 {M} = {r(moles*M,2)} g, matching the given mass. \u2713",
|
|
231
|
+
"final_answer": f"n \u2248 {moles} mol",
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
GENERATORS = {
|
|
236
|
+
"first": first_order,
|
|
237
|
+
"zero": zero_order,
|
|
238
|
+
"second": second_order,
|
|
239
|
+
"third": third_order,
|
|
240
|
+
"halflife": half_life,
|
|
241
|
+
"arrhenius": arrhenius,
|
|
242
|
+
"mole": mole_concept,
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
KINETICS_ORDER = ["zero", "first", "second", "third", "halflife", "arrhenius"]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CAT Gestures — configurable gesture -> action -> handler system.
|
|
3
|
+
|
|
4
|
+
Each gesture maps a user input (double-click, triple-click, etc.) on a
|
|
5
|
+
specific UI surface to an action handled by the app.
|
|
6
|
+
|
|
7
|
+
Storage: ~/.cct_gestures.json (JSON list of gesture dicts)
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from .manager import (
|
|
11
|
+
Gesture,
|
|
12
|
+
list_gestures,
|
|
13
|
+
get_gesture,
|
|
14
|
+
add_gesture,
|
|
15
|
+
update_gesture,
|
|
16
|
+
delete_gesture,
|
|
17
|
+
toggle_gesture,
|
|
18
|
+
reset_defaults,
|
|
19
|
+
handle_gesture,
|
|
20
|
+
)
|
|
21
|
+
from .bindings import (
|
|
22
|
+
ACTION_HANDLERS,
|
|
23
|
+
GESTURE_TARGETS,
|
|
24
|
+
GESTURE_TRIGGERS,
|
|
25
|
+
DEFAULT_GESTURES,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
__all__ = [
|
|
29
|
+
"Gesture",
|
|
30
|
+
"list_gestures",
|
|
31
|
+
"get_gesture",
|
|
32
|
+
"add_gesture",
|
|
33
|
+
"update_gesture",
|
|
34
|
+
"delete_gesture",
|
|
35
|
+
"toggle_gesture",
|
|
36
|
+
"reset_defaults",
|
|
37
|
+
"handle_gesture",
|
|
38
|
+
"ACTION_HANDLERS",
|
|
39
|
+
"GESTURE_TARGETS",
|
|
40
|
+
"GESTURE_TRIGGERS",
|
|
41
|
+
"DEFAULT_GESTURES",
|
|
42
|
+
]
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CAT Gestures — bindings.py: action registry and default mappings.
|
|
3
|
+
|
|
4
|
+
Conceptually:
|
|
5
|
+
Gesture (trigger + target) -> Action -> Handler
|
|
6
|
+
e.g. double_click on editor -> open_vscode -> handler opens VS Code
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
# Valid gesture triggers
|
|
10
|
+
GESTURE_TRIGGERS = (
|
|
11
|
+
"double_click",
|
|
12
|
+
"triple_click",
|
|
13
|
+
"long_press",
|
|
14
|
+
"swipe_left",
|
|
15
|
+
"swipe_right",
|
|
16
|
+
"shortcut", # custom keyboard shortcut (user-defined key combo)
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
# Valid gesture targets (UI surfaces)
|
|
20
|
+
GESTURE_TARGETS = (
|
|
21
|
+
"editor",
|
|
22
|
+
"preview",
|
|
23
|
+
"file",
|
|
24
|
+
"diff",
|
|
25
|
+
"chat",
|
|
26
|
+
"explorer",
|
|
27
|
+
"global", # shortcut can be global
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# Valid shortcut key combos (user-typed, validated against this allow-list pattern)
|
|
31
|
+
# We allow any combo matching: [ctrl+][shift+][alt+]<key> where key is a-z,0-9,f1-f12,enter,space,tab, etc.
|
|
32
|
+
# The manager validates via regex, not this tuple — this is just for the picker hint.
|
|
33
|
+
SHORTCUT_HINTS = (
|
|
34
|
+
"ctrl+s",
|
|
35
|
+
"ctrl+o",
|
|
36
|
+
"ctrl+enter",
|
|
37
|
+
"shift+enter",
|
|
38
|
+
"ctrl+shift+p",
|
|
39
|
+
"ctrl+shift+f",
|
|
40
|
+
"f5",
|
|
41
|
+
"alt+enter",
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
# Valid actions
|
|
45
|
+
GESTURE_ACTIONS = (
|
|
46
|
+
"open_vscode",
|
|
47
|
+
"fullscreen_preview",
|
|
48
|
+
"fullscreen_editor",
|
|
49
|
+
"quick_actions",
|
|
50
|
+
"reveal_actions",
|
|
51
|
+
"open_diff",
|
|
52
|
+
"before_after",
|
|
53
|
+
"edit_message",
|
|
54
|
+
"copy_path",
|
|
55
|
+
"toggle_gesture",
|
|
56
|
+
"show_preview", # web preview (▷ / Shift+Enter)
|
|
57
|
+
"toggle_preview", # Ctrl+Shift+P
|
|
58
|
+
"save_file", # Ctrl+S
|
|
59
|
+
"toggle_sidebar", # Ctrl+B
|
|
60
|
+
"open_palette", # Ctrl+P
|
|
61
|
+
"open_gestures", # open this panel
|
|
62
|
+
"open_vision", # open CAT Vision
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Default gestures as shipped — covers spec examples
|
|
66
|
+
DEFAULT_GESTURES = [
|
|
67
|
+
{
|
|
68
|
+
"id": "gesture_editor_vscode",
|
|
69
|
+
"name": "Double-click editor → VS Code",
|
|
70
|
+
"trigger": "double_click",
|
|
71
|
+
"target": "editor",
|
|
72
|
+
"action": "open_vscode",
|
|
73
|
+
"enabled": True,
|
|
74
|
+
"description": "Double-click Code Editor → Open project in VS Code",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"id": "gesture_preview_fullscreen",
|
|
78
|
+
"name": "Double-click preview → Fullscreen",
|
|
79
|
+
"trigger": "double_click",
|
|
80
|
+
"target": "preview",
|
|
81
|
+
"action": "fullscreen_preview",
|
|
82
|
+
"enabled": True,
|
|
83
|
+
"description": "Double-click Preview → Fullscreen Preview",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"id": "gesture_file_quick",
|
|
87
|
+
"name": "Triple-click file → Quick actions",
|
|
88
|
+
"trigger": "triple_click",
|
|
89
|
+
"target": "file",
|
|
90
|
+
"action": "quick_actions",
|
|
91
|
+
"enabled": True,
|
|
92
|
+
"description": "Triple-click file → Open quick actions",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"id": "gesture_file_reveal",
|
|
96
|
+
"name": "Gesture on file → Reveal actions",
|
|
97
|
+
"trigger": "long_press",
|
|
98
|
+
"target": "file",
|
|
99
|
+
"action": "reveal_actions",
|
|
100
|
+
"enabled": True,
|
|
101
|
+
"description": "Gesture on file → Reveal actions",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"id": "gesture_diff_beforeafter",
|
|
105
|
+
"name": "Gesture on diff → Before/After",
|
|
106
|
+
"trigger": "double_click",
|
|
107
|
+
"target": "diff",
|
|
108
|
+
"action": "before_after",
|
|
109
|
+
"enabled": True,
|
|
110
|
+
"description": "Gesture on diff → Open before/after view",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"id": "gesture_chat_edit",
|
|
114
|
+
"name": "Gesture on chat → Edit message",
|
|
115
|
+
"trigger": "double_click",
|
|
116
|
+
"target": "chat",
|
|
117
|
+
"action": "edit_message",
|
|
118
|
+
"enabled": True,
|
|
119
|
+
"description": "Gesture on chat message → Edit message",
|
|
120
|
+
},
|
|
121
|
+
# --- Shortcut defaults (user can edit/disable/create new) ---
|
|
122
|
+
{
|
|
123
|
+
"id": "gesture_shortcut_preview",
|
|
124
|
+
"name": "Shift+Enter → Preview",
|
|
125
|
+
"trigger": "shortcut",
|
|
126
|
+
"target": "editor",
|
|
127
|
+
"action": "show_preview",
|
|
128
|
+
"enabled": True,
|
|
129
|
+
"description": "Shift+Enter (editor) → Show Web Preview",
|
|
130
|
+
"keys": "shift+enter",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"id": "gesture_shortcut_save",
|
|
134
|
+
"name": "Ctrl+S → Save",
|
|
135
|
+
"trigger": "shortcut",
|
|
136
|
+
"target": "editor",
|
|
137
|
+
"action": "save_file",
|
|
138
|
+
"enabled": True,
|
|
139
|
+
"description": "Ctrl+S (editor) → Save File",
|
|
140
|
+
"keys": "ctrl+s",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"id": "gesture_shortcut_toggle_preview",
|
|
144
|
+
"name": "Ctrl+Shift+P → Toggle Preview",
|
|
145
|
+
"trigger": "shortcut",
|
|
146
|
+
"target": "global",
|
|
147
|
+
"action": "toggle_preview",
|
|
148
|
+
"enabled": True,
|
|
149
|
+
"description": "Ctrl+Shift+P (global) → Toggle Web Preview",
|
|
150
|
+
"keys": "ctrl+shift+p",
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"id": "gesture_shortcut_fullscreen",
|
|
154
|
+
"name": "F11 → Fullscreen Code Editor",
|
|
155
|
+
"trigger": "shortcut",
|
|
156
|
+
"target": "editor",
|
|
157
|
+
"action": "fullscreen_editor",
|
|
158
|
+
"enabled": True,
|
|
159
|
+
"description": "F11 (editor) → Fullscreen Code Editor",
|
|
160
|
+
"keys": "f11",
|
|
161
|
+
},
|
|
162
|
+
]
|
|
163
|
+
|
|
164
|
+
# Action -> handler mapping (filled at runtime by manager)
|
|
165
|
+
# Handlers are callables: handler(app, context_dict) -> bool
|
|
166
|
+
ACTION_HANDLERS = {}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def register_handler(action, func):
|
|
170
|
+
"""Register a handler for an action."""
|
|
171
|
+
ACTION_HANDLERS[action] = func
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def get_handler(action):
|
|
175
|
+
return ACTION_HANDLERS.get(action)
|