@proflandrigan/shards 1.1.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 +475 -0
- package/package.json +37 -0
- package/src/agents/academic.md +276 -0
- package/src/agents/ai-engineer.md +377 -0
- package/src/agents/analytics-engineer.md +364 -0
- package/src/agents/applied-ml-scientist.md +410 -0
- package/src/agents/backend-engineer.md +255 -0
- package/src/agents/bi-engineer.md +333 -0
- package/src/agents/data-analyst.md +343 -0
- package/src/agents/data-engineer.md +260 -0
- package/src/agents/data-modeller.md +386 -0
- package/src/agents/data-scientist.md +366 -0
- package/src/agents/deep-learning-engineer.md +389 -0
- package/src/agents/ml-engineer.md +424 -0
- package/src/agents/mlops-engineer.md +339 -0
- package/src/agents/researcher.md +187 -0
- package/src/agents/specific_instructions/academic/critical_review.md +263 -0
- package/src/agents/specific_instructions/academic/report.md +113 -0
- package/src/agents/specific_instructions/ai_engineer/advise.md +162 -0
- package/src/agents/specific_instructions/ai_engineer/bi_engineer_handoff.md +86 -0
- package/src/agents/specific_instructions/ai_engineer/experiment.md +471 -0
- package/src/agents/specific_instructions/ai_engineer/experiment_ui_mode.md +44 -0
- package/src/agents/specific_instructions/ai_engineer/phases/index.md +45 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-1.md +55 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-2.md +86 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-3.md +96 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-4.md +138 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-5.md +157 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-6.md +196 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-7.md +313 -0
- package/src/agents/specific_instructions/ai_engineer/phases.md +1011 -0
- package/src/agents/specific_instructions/ai_engineer/prompt_lab.md +161 -0
- package/src/agents/specific_instructions/ai_engineer/prompt_lab_ui_mode.md +28 -0
- package/src/agents/specific_instructions/ai_engineer/research.md +393 -0
- package/src/agents/specific_instructions/ai_engineer/research_ui_mode.md +66 -0
- package/src/agents/specific_instructions/ai_engineer/review.md +159 -0
- package/src/agents/specific_instructions/ai_engineer/validation_checklist.md +182 -0
- package/src/agents/specific_instructions/analytics_engineer/advise.md +155 -0
- package/src/agents/specific_instructions/analytics_engineer/bi_engineer_handoff.md +91 -0
- package/src/agents/specific_instructions/analytics_engineer/data_analyst_handoff.md +84 -0
- package/src/agents/specific_instructions/analytics_engineer/deep_phases.md +818 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/index.md +24 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-1.md +77 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-2.md +106 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-3.md +93 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-4.md +79 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-5.md +61 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-6.md +45 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-7.md +235 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-8.md +221 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_quick/index.md +19 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_quick/phase-1.md +47 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_quick/phase-2.md +78 -0
- package/src/agents/specific_instructions/analytics_engineer/quick_phases.md +112 -0
- package/src/agents/specific_instructions/analytics_engineer/review.md +167 -0
- package/src/agents/specific_instructions/analytics_engineer/service_mode.md +369 -0
- package/src/agents/specific_instructions/analytics_engineer/ui_mode.md +45 -0
- package/src/agents/specific_instructions/analytics_engineer/update.md +162 -0
- package/src/agents/specific_instructions/analytics_engineer/validation_checklist.md +121 -0
- package/src/agents/specific_instructions/applied_ml_scientist/advise.md +143 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases/index.md +21 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-1.md +51 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-2.md +66 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-3.md +113 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-4.md +104 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-5.md +156 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases.md +428 -0
- package/src/agents/specific_instructions/applied_ml_scientist/research.md +379 -0
- package/src/agents/specific_instructions/applied_ml_scientist/review.md +142 -0
- package/src/agents/specific_instructions/applied_ml_scientist/validation_checklist.md +136 -0
- package/src/agents/specific_instructions/backend_engineer/clean.md +149 -0
- package/src/agents/specific_instructions/backend_engineer/review.md +91 -0
- package/src/agents/specific_instructions/backend_engineer/review_checklist.md +54 -0
- package/src/agents/specific_instructions/backend_engineer/service_mode.md +67 -0
- package/src/agents/specific_instructions/bi_engineer/advise.md +137 -0
- package/src/agents/specific_instructions/bi_engineer/data_analyst_handoff.md +77 -0
- package/src/agents/specific_instructions/bi_engineer/incoming_handoff.md +45 -0
- package/src/agents/specific_instructions/bi_engineer/phases/index.md +20 -0
- package/src/agents/specific_instructions/bi_engineer/phases/phase-1.md +164 -0
- package/src/agents/specific_instructions/bi_engineer/phases/phase-2.md +92 -0
- package/src/agents/specific_instructions/bi_engineer/phases/phase-3.md +121 -0
- package/src/agents/specific_instructions/bi_engineer/phases/phase-4.md +106 -0
- package/src/agents/specific_instructions/bi_engineer/phases.md +451 -0
- package/src/agents/specific_instructions/bi_engineer/review.md +166 -0
- package/src/agents/specific_instructions/bi_engineer/update.md +147 -0
- package/src/agents/specific_instructions/bi_engineer/validation_checklist.md +124 -0
- package/src/agents/specific_instructions/data_analyst/advise.md +138 -0
- package/src/agents/specific_instructions/data_analyst/explain.md +221 -0
- package/src/agents/specific_instructions/data_analyst/incoming_handoff.md +40 -0
- package/src/agents/specific_instructions/data_analyst/phases/index.md +20 -0
- package/src/agents/specific_instructions/data_analyst/phases/phase-1.md +159 -0
- package/src/agents/specific_instructions/data_analyst/phases/phase-2.md +112 -0
- package/src/agents/specific_instructions/data_analyst/phases/phase-3.md +265 -0
- package/src/agents/specific_instructions/data_analyst/phases/phase-4.md +100 -0
- package/src/agents/specific_instructions/data_analyst/phases.md +501 -0
- package/src/agents/specific_instructions/data_analyst/review.md +138 -0
- package/src/agents/specific_instructions/data_analyst/ui_mode.md +26 -0
- package/src/agents/specific_instructions/data_analyst/update.md +144 -0
- package/src/agents/specific_instructions/data_analyst/validation_checklist.md +95 -0
- package/src/agents/specific_instructions/data_engineer/advise.md +137 -0
- package/src/agents/specific_instructions/data_engineer/phases.md +466 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/index.md +23 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-1.md +49 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-2.md +93 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-3.md +55 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-4.md +48 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-5.md +40 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-6.md +102 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-7.md +87 -0
- package/src/agents/specific_instructions/data_engineer/phases_quick/index.md +19 -0
- package/src/agents/specific_instructions/data_engineer/phases_quick/phase-1.md +45 -0
- package/src/agents/specific_instructions/data_engineer/phases_quick/phase-2.md +54 -0
- package/src/agents/specific_instructions/data_engineer/review.md +135 -0
- package/src/agents/specific_instructions/data_engineer/validation_checklist.md +136 -0
- package/src/agents/specific_instructions/data_modeller/advise.md +137 -0
- package/src/agents/specific_instructions/data_modeller/phases.md +581 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/index.md +23 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-1.md +52 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-2.md +113 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-3.md +47 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-4.md +51 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-5.md +45 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-6.md +105 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-7.md +136 -0
- package/src/agents/specific_instructions/data_modeller/phases_quick/index.md +19 -0
- package/src/agents/specific_instructions/data_modeller/phases_quick/phase-1.md +47 -0
- package/src/agents/specific_instructions/data_modeller/phases_quick/phase-2.md +65 -0
- package/src/agents/specific_instructions/data_modeller/review.md +141 -0
- package/src/agents/specific_instructions/data_modeller/service_mode.md +218 -0
- package/src/agents/specific_instructions/data_modeller/validation_checklist.md +125 -0
- package/src/agents/specific_instructions/data_scientist/advise.md +158 -0
- package/src/agents/specific_instructions/data_scientist/bi_engineer_handoff.md +63 -0
- package/src/agents/specific_instructions/data_scientist/experiment.md +482 -0
- package/src/agents/specific_instructions/data_scientist/experiment_ui_mode.md +44 -0
- package/src/agents/specific_instructions/data_scientist/explain.md +247 -0
- package/src/agents/specific_instructions/data_scientist/greenfield_data.md +35 -0
- package/src/agents/specific_instructions/data_scientist/ml_engineer_handoff.md +52 -0
- package/src/agents/specific_instructions/data_scientist/notebook_walkthrough.md +76 -0
- package/src/agents/specific_instructions/data_scientist/phases/index.md +24 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-1.md +45 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-2.md +67 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-3.md +89 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-4.md +143 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-5.md +71 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-6.md +239 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-7.md +207 -0
- package/src/agents/specific_instructions/data_scientist/phases.md +651 -0
- package/src/agents/specific_instructions/data_scientist/research.md +345 -0
- package/src/agents/specific_instructions/data_scientist/research_ui_mode.md +52 -0
- package/src/agents/specific_instructions/data_scientist/review.md +136 -0
- package/src/agents/specific_instructions/data_scientist/service_mode.md +247 -0
- package/src/agents/specific_instructions/data_scientist/validation_checklist.md +183 -0
- package/src/agents/specific_instructions/deep_learning_engineer/advise.md +145 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases/index.md +21 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-1.md +74 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-2.md +98 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-3.md +76 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-4.md +128 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-5.md +292 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases.md +567 -0
- package/src/agents/specific_instructions/deep_learning_engineer/research.md +389 -0
- package/src/agents/specific_instructions/deep_learning_engineer/review.md +155 -0
- package/src/agents/specific_instructions/deep_learning_engineer/validation_checklist.md +147 -0
- package/src/agents/specific_instructions/ml_engineer/advise.md +174 -0
- package/src/agents/specific_instructions/ml_engineer/bi_engineer_handoff.md +71 -0
- package/src/agents/specific_instructions/ml_engineer/experiment.md +474 -0
- package/src/agents/specific_instructions/ml_engineer/experiment_ui_mode.md +44 -0
- package/src/agents/specific_instructions/ml_engineer/notebook_walkthrough.md +75 -0
- package/src/agents/specific_instructions/ml_engineer/phases/index.md +25 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-1.md +49 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-2.md +75 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-3.md +124 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-4.md +279 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-5.md +160 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-6-5.md +170 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-6.md +295 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-7.md +337 -0
- package/src/agents/specific_instructions/ml_engineer/phases.md +1068 -0
- package/src/agents/specific_instructions/ml_engineer/research.md +437 -0
- package/src/agents/specific_instructions/ml_engineer/research_ui_mode.md +71 -0
- package/src/agents/specific_instructions/ml_engineer/review.md +187 -0
- package/src/agents/specific_instructions/ml_engineer/service_mode.md +273 -0
- package/src/agents/specific_instructions/ml_engineer/validation_checklist.md +185 -0
- package/src/agents/specific_instructions/mlops_engineer/advise.md +139 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/index.md +23 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-1.md +52 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-2.md +86 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-3.md +105 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-4.md +128 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-5.md +106 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-6.md +128 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-7.md +144 -0
- package/src/agents/specific_instructions/mlops_engineer/phases.md +671 -0
- package/src/agents/specific_instructions/mlops_engineer/review.md +164 -0
- package/src/agents/specific_instructions/mlops_engineer/service_mode.md +81 -0
- package/src/agents/specific_instructions/mlops_engineer/validation_checklist.md +151 -0
- package/src/agents/specific_instructions/researcher/critical_review.md +292 -0
- package/src/agents/specific_instructions/researcher/review_checklist.md +67 -0
- package/src/agents/specific_instructions/researcher/service_mode.md +224 -0
- package/src/agents/specific_instructions/shared/auto_verify_mode.md +141 -0
- package/src/agents/specific_instructions/shared/autonomous_research.md +1289 -0
- package/src/agents/specific_instructions/shared/behavioral_rules.md +36 -0
- package/src/agents/specific_instructions/shared/diverge_protocol.md +387 -0
- package/src/agents/specific_instructions/shared/engineering_guidelines.md +136 -0
- package/src/agents/specific_instructions/shared/experiment_versioning.md +184 -0
- package/src/agents/specific_instructions/shared/goal_mode.md +187 -0
- package/src/agents/specific_instructions/shared/incremental_testing.md +139 -0
- package/src/agents/specific_instructions/shared/intent_discovery.md +223 -0
- package/src/agents/specific_instructions/shared/join_path_protocol.md +168 -0
- package/src/agents/specific_instructions/shared/knowledge_checkpoint.md +83 -0
- package/src/agents/specific_instructions/shared/knowledge_harvest.md +220 -0
- package/src/agents/specific_instructions/shared/knowledge_retrieval.md +100 -0
- package/src/agents/specific_instructions/shared/notebook_walkthrough_protocol.md +367 -0
- package/src/agents/specific_instructions/shared/reviewer_verdict_protocol.md +74 -0
- package/src/agents/specific_instructions/shared/swarm_protocol.md +97 -0
- package/src/agents/specific_instructions/shared/validation_protocol.md +139 -0
- package/src/agents/specific_instructions/syn/arbiter.md +140 -0
- package/src/agents/specific_instructions/syn/brainstorm.md +550 -0
- package/src/agents/specific_instructions/syn/code_review.md +232 -0
- package/src/agents/specific_instructions/syn/diff.md +239 -0
- package/src/agents/specific_instructions/syn/final_review.md +65 -0
- package/src/agents/specific_instructions/syn/fixer.md +240 -0
- package/src/agents/specific_instructions/syn/free_form.md +130 -0
- package/src/agents/specific_instructions/syn/knowledge.md +468 -0
- package/src/agents/specific_instructions/syn/notebook_walkthrough.md +78 -0
- package/src/agents/specific_instructions/syn/panel_review.md +634 -0
- package/src/agents/specific_instructions/syn/pm.md +453 -0
- package/src/agents/specific_instructions/syn/pr_review.md +255 -0
- package/src/agents/specific_instructions/syn/slides.md +417 -0
- package/src/agents/syn.md +729 -0
- package/src/commands/academic.md +41 -0
- package/src/commands/ai-engineer.md +45 -0
- package/src/commands/analytics-engineer.md +48 -0
- package/src/commands/applied-ml-scientist.md +45 -0
- package/src/commands/backend-engineer.md +35 -0
- package/src/commands/bi-engineer.md +40 -0
- package/src/commands/brainstorm.md +24 -0
- package/src/commands/data-analyst.md +38 -0
- package/src/commands/data-engineer.md +37 -0
- package/src/commands/data-modeller.md +38 -0
- package/src/commands/data-scientist.md +38 -0
- package/src/commands/deep-learning-engineer.md +47 -0
- package/src/commands/end.md +49 -0
- package/src/commands/knowledge.md +24 -0
- package/src/commands/ml-engineer.md +42 -0
- package/src/commands/mlops-engineer.md +47 -0
- package/src/commands/notebook-walkthrough.md +58 -0
- package/src/commands/researcher.md +40 -0
- package/src/commands/resume.md +57 -0
- package/src/commands/review-pr.md +26 -0
- package/src/commands/shards-guide.md +41 -0
- package/src/commands/shards-ui.md +32 -0
- package/src/commands/shards.md +41 -0
- package/src/docs/01-getting-started/concepts.md +109 -0
- package/src/docs/01-getting-started/first-session.md +79 -0
- package/src/docs/01-getting-started/install.md +61 -0
- package/src/docs/02-agents/academic.md +71 -0
- package/src/docs/02-agents/ai-engineer.md +78 -0
- package/src/docs/02-agents/analytics-engineer.md +58 -0
- package/src/docs/02-agents/applied-ml-scientist.md +59 -0
- package/src/docs/02-agents/backend-engineer.md +58 -0
- package/src/docs/02-agents/bi-engineer.md +65 -0
- package/src/docs/02-agents/data-analyst.md +67 -0
- package/src/docs/02-agents/data-engineer.md +57 -0
- package/src/docs/02-agents/data-modeller.md +51 -0
- package/src/docs/02-agents/data-scientist.md +78 -0
- package/src/docs/02-agents/deep-learning-engineer.md +64 -0
- package/src/docs/02-agents/ml-engineer.md +80 -0
- package/src/docs/02-agents/mlops-engineer.md +59 -0
- package/src/docs/02-agents/overview.md +62 -0
- package/src/docs/02-agents/researcher.md +73 -0
- package/src/docs/02-agents/syn.md +88 -0
- package/src/docs/03-protocols/auto-verify.md +82 -0
- package/src/docs/03-protocols/autonomous-research.md +59 -0
- package/src/docs/03-protocols/behavioral-rules.md +35 -0
- package/src/docs/03-protocols/diverge.md +50 -0
- package/src/docs/03-protocols/engineering-guidelines.md +56 -0
- package/src/docs/03-protocols/experiment-versioning.md +38 -0
- package/src/docs/03-protocols/gate-pattern.md +65 -0
- package/src/docs/03-protocols/incremental-testing.md +68 -0
- package/src/docs/03-protocols/join-path.md +46 -0
- package/src/docs/03-protocols/knowledge-ledger.md +70 -0
- package/src/docs/03-protocols/reviewer-verdicts.md +39 -0
- package/src/docs/03-protocols/swarm.md +40 -0
- package/src/docs/03-protocols/validation.md +174 -0
- package/src/docs/04-ui/activity-bar.md +70 -0
- package/src/docs/04-ui/chat-pane.md +80 -0
- package/src/docs/04-ui/code-intel.md +62 -0
- package/src/docs/04-ui/file-editing.md +61 -0
- package/src/docs/04-ui/git.md +54 -0
- package/src/docs/04-ui/keybindings.md +79 -0
- package/src/docs/04-ui/knowledge-map.md +76 -0
- package/src/docs/04-ui/overview.md +93 -0
- package/src/docs/04-ui/panels.md +49 -0
- package/src/docs/04-ui/pinboard-selection.md +66 -0
- package/src/docs/04-ui/quick-open-palette.md +56 -0
- package/src/docs/04-ui/sessions.md +81 -0
- package/src/docs/04-ui/settings-permissions.md +56 -0
- package/src/docs/05-commands/reference.md +59 -0
- package/src/docs/06-outputs/directory-map.md +116 -0
- package/src/docs/07-workflows/ai-eval-first.md +57 -0
- package/src/docs/07-workflows/deep-study-to-production.md +76 -0
- package/src/docs/07-workflows/diverge-exploration.md +77 -0
- package/src/docs/07-workflows/quick-analysis.md +45 -0
- package/src/docs/08-integrations/claude-code-auto-mode.md +191 -0
- package/src/docs/08-integrations/google-slides.md +175 -0
- package/src/docs/README.md +30 -0
- package/src/docs/manifest.json +108 -0
- package/src/templates/analysis-template.md +20 -0
- package/src/templates/branch-report.md +46 -0
- package/src/templates/diff-report.md +88 -0
- package/src/templates/knowledge-index.md +7 -0
- package/src/templates/model-card-schema.json +186 -0
- package/src/templates/model-card-schema.md +88 -0
- package/src/templates/model-card.md +124 -0
- package/src/templates/project-plan.md +47 -0
- package/src/templates/project-specs.md +81 -0
- package/src/templates/report-template.md +43 -0
- package/src/templates/study-template.md +25 -0
- package/src/ui/cc-readonly.js +181 -0
- package/src/ui/chat-session.js +466 -0
- package/src/ui/css/base.css +136 -0
- package/src/ui/css/brainstorm.css +525 -0
- package/src/ui/css/chat.css +1405 -0
- package/src/ui/css/editor.css +546 -0
- package/src/ui/css/eval-dashboard.css +157 -0
- package/src/ui/css/experiment.css +237 -0
- package/src/ui/css/guide.css +186 -0
- package/src/ui/css/knowledge-map.css +383 -0
- package/src/ui/css/layout.css +431 -0
- package/src/ui/css/model-card.css +161 -0
- package/src/ui/css/notebook-walkthrough.css +271 -0
- package/src/ui/css/pr-review.css +403 -0
- package/src/ui/css/prompt-lab.css +325 -0
- package/src/ui/css/sessions.css +258 -0
- package/src/ui/css/sidebar.css +661 -0
- package/src/ui/css/terminal.css +113 -0
- package/src/ui/css/theme-light.css +542 -0
- package/src/ui/index.html +389 -0
- package/src/ui/js/agents.js +32 -0
- package/src/ui/js/bookmarks.js +230 -0
- package/src/ui/js/chat.js +1776 -0
- package/src/ui/js/code-intel.js +328 -0
- package/src/ui/js/command-palette.js +142 -0
- package/src/ui/js/events.js +591 -0
- package/src/ui/js/explorer.js +317 -0
- package/src/ui/js/file-view.js +477 -0
- package/src/ui/js/git.js +536 -0
- package/src/ui/js/guide.js +198 -0
- package/src/ui/js/hud.js +75 -0
- package/src/ui/js/init.js +351 -0
- package/src/ui/js/knowledge-map.js +906 -0
- package/src/ui/js/markdown.js +114 -0
- package/src/ui/js/monaco.js +164 -0
- package/src/ui/js/notebook-walkthrough.js +272 -0
- package/src/ui/js/notebook.js +448 -0
- package/src/ui/js/panels.js +2681 -0
- package/src/ui/js/pinboard.js +186 -0
- package/src/ui/js/quick-open.js +164 -0
- package/src/ui/js/selection-context.js +131 -0
- package/src/ui/js/sessions.js +256 -0
- package/src/ui/js/settings.js +476 -0
- package/src/ui/js/split-view.js +82 -0
- package/src/ui/js/state.js +343 -0
- package/src/ui/js/table.js +161 -0
- package/src/ui/js/tabs.js +284 -0
- package/src/ui/js/tabular.js +125 -0
- package/src/ui/js/terminal.js +354 -0
- package/src/ui/js/timeline.js +137 -0
- package/src/ui/js/utils.js +293 -0
- package/src/ui/notebook-kernel.py +790 -0
- package/src/ui/open-browser.js +55 -0
- package/src/ui/permission-pattern.js +42 -0
- package/src/ui/relay.js +513 -0
- package/src/ui/server.js +3072 -0
- package/src/ui/session-index.js +225 -0
- package/src/ui/shards_icon.png +0 -0
- package/src/ui/spawn-server.js +41 -0
- package/src/ui/symbol-index.js +813 -0
- package/src/ui/ui-push.js +177 -0
- package/tools/gate-hook/VALIDATION_SPEC.md +273 -0
- package/tools/gate-hook/__tests__/auto-verify.test.js +343 -0
- package/tools/gate-hook/auto-allowlist.js +179 -0
- package/tools/gate-hook/auto-state.js +68 -0
- package/tools/gate-hook/classify.js +21 -0
- package/tools/gate-hook/log.js +57 -0
- package/tools/gate-hook/parser.js +205 -0
- package/tools/gate-hook/sql-guard.js +230 -0
- package/tools/gate-hook/state.js +170 -0
- package/tools/gate-hook/sweep.js +139 -0
- package/tools/gate-hook/transcript.js +45 -0
- package/tools/gate-hook/validation.js +321 -0
- package/tools/gate-hook.js +475 -0
- package/tools/install.js +914 -0
- package/tools/shards-gates.js +311 -0
- package/tools/shards-sessions.js +261 -0
- package/tools/shards-ui.js +377 -0
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════
|
|
2
|
+
// Notebook data model
|
|
3
|
+
// ═══════════════════════════════════════════════════════════════
|
|
4
|
+
|
|
5
|
+
function parseNotebookData(jsonString) {
|
|
6
|
+
var nb = JSON.parse(jsonString);
|
|
7
|
+
var cells = (nb.cells || []).map(function(cell, i) {
|
|
8
|
+
return {
|
|
9
|
+
id: 'cell-' + i + '-' + Date.now(),
|
|
10
|
+
cell_type: cell.cell_type || 'code',
|
|
11
|
+
source: Array.isArray(cell.source) ? cell.source.join('') : (cell.source || ''),
|
|
12
|
+
outputs: cell.outputs || [],
|
|
13
|
+
metadata: cell.metadata || {},
|
|
14
|
+
execution_count: cell.execution_count || null,
|
|
15
|
+
monacoInstance: null,
|
|
16
|
+
editing: false,
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
return {
|
|
20
|
+
metadata: nb.metadata || {},
|
|
21
|
+
nbformat: nb.nbformat || 4,
|
|
22
|
+
nbformat_minor: nb.nbformat_minor || 0,
|
|
23
|
+
cells: cells,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function serializeNotebook(notebookData) {
|
|
28
|
+
var nb = {
|
|
29
|
+
metadata: notebookData.metadata,
|
|
30
|
+
nbformat: notebookData.nbformat,
|
|
31
|
+
nbformat_minor: notebookData.nbformat_minor,
|
|
32
|
+
cells: notebookData.cells.map(function(cell) {
|
|
33
|
+
// Split source into lines with \n endings (Jupyter format)
|
|
34
|
+
var lines = cell.source.split('\n');
|
|
35
|
+
var sourceArr = lines.map(function(line, i) { return i < lines.length - 1 ? line + '\n' : line; });
|
|
36
|
+
// Remove trailing empty string if source ends with \n
|
|
37
|
+
if (sourceArr.length > 0 && sourceArr[sourceArr.length - 1] === '') {
|
|
38
|
+
sourceArr.pop();
|
|
39
|
+
}
|
|
40
|
+
var out = {
|
|
41
|
+
cell_type: cell.cell_type,
|
|
42
|
+
source: sourceArr,
|
|
43
|
+
metadata: cell.metadata || {},
|
|
44
|
+
};
|
|
45
|
+
if (cell.cell_type === 'code') {
|
|
46
|
+
out.outputs = cell.outputs || [];
|
|
47
|
+
out.execution_count = cell.execution_count;
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
}),
|
|
51
|
+
};
|
|
52
|
+
return JSON.stringify(nb, null, 1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function renderCellOutputs(outputs) {
|
|
56
|
+
if (!outputs || outputs.length === 0) return '';
|
|
57
|
+
var html = '';
|
|
58
|
+
for (var i = 0; i < outputs.length; i++) {
|
|
59
|
+
var output = outputs[i];
|
|
60
|
+
if (output.output_type === 'stream') {
|
|
61
|
+
var text = Array.isArray(output.text) ? output.text.join('') : (output.text || '');
|
|
62
|
+
var cls = output.name === 'stderr' ? 'nb-output-error' : '';
|
|
63
|
+
html += '<div class="nb-cell-output ' + cls + '"><pre>' + esc(text) + '</pre></div>';
|
|
64
|
+
} else if (output.output_type === 'execute_result' || output.output_type === 'display_data') {
|
|
65
|
+
var data = output.data || {};
|
|
66
|
+
if (data['text/html']) {
|
|
67
|
+
var raw = Array.isArray(data['text/html']) ? data['text/html'].join('') : data['text/html'];
|
|
68
|
+
html += '<div class="nb-cell-output nb-output-html">' + raw + '</div>';
|
|
69
|
+
} else if (data['image/png']) {
|
|
70
|
+
html += '<div class="nb-cell-output"><img src="data:image/png;base64,' + data['image/png'] + '"></div>';
|
|
71
|
+
} else if (data['image/jpeg']) {
|
|
72
|
+
html += '<div class="nb-cell-output"><img src="data:image/jpeg;base64,' + data['image/jpeg'] + '"></div>';
|
|
73
|
+
} else if (data['image/svg+xml']) {
|
|
74
|
+
var svg = Array.isArray(data['image/svg+xml']) ? data['image/svg+xml'].join('') : data['image/svg+xml'];
|
|
75
|
+
html += '<div class="nb-cell-output">' + svg + '</div>';
|
|
76
|
+
} else if (data['text/plain']) {
|
|
77
|
+
var plainText = Array.isArray(data['text/plain']) ? data['text/plain'].join('') : data['text/plain'];
|
|
78
|
+
html += '<div class="nb-cell-output"><pre>' + esc(plainText) + '</pre></div>';
|
|
79
|
+
}
|
|
80
|
+
} else if (output.output_type === 'error') {
|
|
81
|
+
var tb = (output.traceback || []).join('\n').replace(/\x1b\[[0-9;]*m/g, '');
|
|
82
|
+
html += '<div class="nb-cell-output nb-output-error"><pre>' + esc(tb) + '</pre></div>';
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return html;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Render one cell's input + outputs as static HTML. Used by the standalone
|
|
89
|
+
// notebook view below and by the notebook-walkthrough panel renderer.
|
|
90
|
+
// No Monaco, no edit handlers — read-only display only.
|
|
91
|
+
function renderStaticCellHtml(cell) {
|
|
92
|
+
if (!cell) return '';
|
|
93
|
+
var html = '';
|
|
94
|
+
if (cell.cell_type === 'markdown') {
|
|
95
|
+
html += '<div class="file-rendered">' + renderMarkdown(cell.source || '') + '</div>';
|
|
96
|
+
} else {
|
|
97
|
+
html += '<pre><code>' + highlightCode(esc(cell.source || ''), 'python') + '</code></pre>';
|
|
98
|
+
}
|
|
99
|
+
html += renderCellOutputs(cell.outputs);
|
|
100
|
+
return html;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ═══════════════════════════════════════════════════════════════
|
|
104
|
+
// Notebook rendering and cell operations
|
|
105
|
+
// ═══════════════════════════════════════════════════════════════
|
|
106
|
+
|
|
107
|
+
function renderNotebookView(relPath) {
|
|
108
|
+
var f = openFiles[relPath];
|
|
109
|
+
if (!f || !f.notebookData) return;
|
|
110
|
+
var nb = f.notebookData;
|
|
111
|
+
var renderedView = document.getElementById('file-rendered-view');
|
|
112
|
+
|
|
113
|
+
var html = '<div class="notebook-container">';
|
|
114
|
+
html += renderAddCellRow(relPath, -1);
|
|
115
|
+
|
|
116
|
+
for (var i = 0; i < nb.cells.length; i++) {
|
|
117
|
+
var cell = nb.cells[i];
|
|
118
|
+
var isActive = i === activeCellIdx;
|
|
119
|
+
var badge = cell.cell_type === 'code'
|
|
120
|
+
? '<span class="nb-cell-badge code">Code</span>'
|
|
121
|
+
: '<span class="nb-cell-badge markdown">Md</span>';
|
|
122
|
+
var execCount = cell.cell_type === 'code' && cell.execution_count != null
|
|
123
|
+
? '<span class="nb-exec-count">[' + cell.execution_count + ']</span>' : '';
|
|
124
|
+
|
|
125
|
+
html += '<div class="nb-cell ' + (isActive ? 'nb-cell-active' : '') + '" data-cell-idx="' + i + '">';
|
|
126
|
+
html += '<div class="nb-cell-sidebar">' + badge + execCount;
|
|
127
|
+
html += '<div class="nb-cell-actions">';
|
|
128
|
+
html += '<button class="nb-cell-action-btn" data-nb-action="move-up" data-cell-idx="' + i + '" title="Move up">↑</button>';
|
|
129
|
+
html += '<button class="nb-cell-action-btn" data-nb-action="move-down" data-cell-idx="' + i + '" title="Move down">↓</button>';
|
|
130
|
+
html += '<button class="nb-cell-action-btn" data-nb-action="toggle-type" data-cell-idx="' + i + '" title="Toggle type">↔</button>';
|
|
131
|
+
html += '<button class="nb-cell-action-btn" data-nb-action="delete" data-cell-idx="' + i + '" title="Delete">×</button>';
|
|
132
|
+
html += '</div></div>';
|
|
133
|
+
html += '<div class="nb-cell-content">';
|
|
134
|
+
html += '<div class="nb-cell-input" data-nb-action="cell-click" data-cell-idx="' + i + '" data-cell-input="' + i + '">';
|
|
135
|
+
if (cell.cell_type === 'markdown') {
|
|
136
|
+
if (cell.editing) {
|
|
137
|
+
html += '<div class="monaco-container" data-md-monaco="' + i + '"></div>';
|
|
138
|
+
} else {
|
|
139
|
+
html += '<div class="file-rendered">' + renderMarkdown(cell.source) + '</div>';
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
// Code cell — static view (Monaco will be injected on click)
|
|
143
|
+
html += '<pre><code>' + highlightCode(esc(cell.source), 'python') + '</code></pre>';
|
|
144
|
+
}
|
|
145
|
+
html += '</div>';
|
|
146
|
+
// Outputs
|
|
147
|
+
html += renderCellOutputs(cell.outputs);
|
|
148
|
+
html += '</div></div>';
|
|
149
|
+
html += renderAddCellRow(relPath, i);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
html += '</div>';
|
|
153
|
+
renderedView.innerHTML = html;
|
|
154
|
+
|
|
155
|
+
// Wire up button/click handlers (replaces inline onclicks so that paths
|
|
156
|
+
// containing apostrophes don't break the HTML attribute parser).
|
|
157
|
+
renderedView.querySelectorAll('[data-nb-action]').forEach(function(el) {
|
|
158
|
+
el.addEventListener('click', function(ev) {
|
|
159
|
+
var action = el.getAttribute('data-nb-action');
|
|
160
|
+
var idx = parseInt(el.getAttribute('data-cell-idx'), 10);
|
|
161
|
+
if (action === 'move-up') {
|
|
162
|
+
nbMoveCellUp(relPath, idx);
|
|
163
|
+
} else if (action === 'move-down') {
|
|
164
|
+
nbMoveCellDown(relPath, idx);
|
|
165
|
+
} else if (action === 'toggle-type') {
|
|
166
|
+
nbToggleCellType(relPath, idx);
|
|
167
|
+
} else if (action === 'delete') {
|
|
168
|
+
nbDeleteCell(relPath, idx);
|
|
169
|
+
} else if (action === 'cell-click') {
|
|
170
|
+
nbCellClick(relPath, idx);
|
|
171
|
+
} else if (action === 'add-cell') {
|
|
172
|
+
var afterIdx = parseInt(el.getAttribute('data-after-idx'), 10);
|
|
173
|
+
var cellType = el.getAttribute('data-cell-type');
|
|
174
|
+
nbAddCell(relPath, afterIdx, cellType);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// Mount Monaco for editing markdown cell (if any), otherwise eagerly load Monaco
|
|
180
|
+
var editingMdIdx = null;
|
|
181
|
+
for (var ci = 0; ci < nb.cells.length; ci++) {
|
|
182
|
+
if (nb.cells[ci].cell_type === 'markdown' && nb.cells[ci].editing) {
|
|
183
|
+
editingMdIdx = ci;
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (editingMdIdx !== null) {
|
|
188
|
+
mountMarkdownMonacoInView(relPath, editingMdIdx);
|
|
189
|
+
} else {
|
|
190
|
+
loadMonaco().catch(function() {});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function renderAddCellRow(relPath, afterIdx) {
|
|
195
|
+
return '<div class="nb-add-cell-row">' +
|
|
196
|
+
'<button class="nb-add-cell-btn" data-nb-action="add-cell" data-cell-type="code" data-after-idx="' + afterIdx + '">+ Code</button>' +
|
|
197
|
+
'<button class="nb-add-cell-btn" data-nb-action="add-cell" data-cell-type="markdown" data-after-idx="' + afterIdx + '">+ Markdown</button>' +
|
|
198
|
+
'</div>';
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function nbCellClick(relPath, cellIdx) {
|
|
202
|
+
var f = openFiles[relPath];
|
|
203
|
+
if (!f || !f.notebookData) return;
|
|
204
|
+
var cell = f.notebookData.cells[cellIdx];
|
|
205
|
+
if (!cell) return;
|
|
206
|
+
|
|
207
|
+
activeCellIdx = cellIdx;
|
|
208
|
+
|
|
209
|
+
if (cell.cell_type === 'markdown') {
|
|
210
|
+
if (activeNotebookCellIdx === cellIdx) return; // Already editing this cell
|
|
211
|
+
disposeNotebookCellMonaco();
|
|
212
|
+
activeCellIdx = cellIdx;
|
|
213
|
+
cell.editing = true;
|
|
214
|
+
renderNotebookView(relPath);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Code cell — open Monaco editor
|
|
219
|
+
if (activeNotebookCellIdx === cellIdx) return; // Already editing this cell
|
|
220
|
+
disposeNotebookCellMonaco();
|
|
221
|
+
|
|
222
|
+
var inputEl = document.querySelector('[data-cell-input="' + cellIdx + '"]');
|
|
223
|
+
if (!inputEl) return;
|
|
224
|
+
|
|
225
|
+
if (monacoFailed) {
|
|
226
|
+
// Fallback: textarea for code cell
|
|
227
|
+
cell.editing = true;
|
|
228
|
+
inputEl.innerHTML = '<textarea style="width:100%;min-height:80px;background:#0a0a16;color:#c0c0d0;border:none;outline:none;font-family:inherit;font-size:13px;line-height:1.55;resize:vertical;padding:0">' + esc(cell.source) + '</textarea>';
|
|
229
|
+
var fallbackTa = inputEl.querySelector('textarea');
|
|
230
|
+
fallbackTa.addEventListener('blur', function() { nbFinishCodeEdit(relPath, cellIdx); });
|
|
231
|
+
fallbackTa.focus();
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
loadMonaco().then(function() {
|
|
236
|
+
// Re-check that we're still editing this cell
|
|
237
|
+
if (activeCellIdx !== cellIdx) return;
|
|
238
|
+
inputEl.innerHTML = '<div class="monaco-container"></div>';
|
|
239
|
+
var container = inputEl.querySelector('.monaco-container');
|
|
240
|
+
var editor = createMonacoEditor(container, {
|
|
241
|
+
value: cell.source,
|
|
242
|
+
language: 'python',
|
|
243
|
+
readOnly: false,
|
|
244
|
+
scrollBeyondLastLine: false,
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
// Auto-size
|
|
248
|
+
var updateHeight = function() {
|
|
249
|
+
var contentHeight = Math.min(500, Math.max(40, editor.getContentHeight()));
|
|
250
|
+
container.style.height = contentHeight + 'px';
|
|
251
|
+
editor.layout();
|
|
252
|
+
};
|
|
253
|
+
editor.onDidContentSizeChange(updateHeight);
|
|
254
|
+
updateHeight();
|
|
255
|
+
|
|
256
|
+
editor.onDidChangeModelContent(function() {
|
|
257
|
+
cell.source = editor.getValue();
|
|
258
|
+
f.modified = true;
|
|
259
|
+
renderWsTabs();
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
activeNotebookCellMonaco = editor;
|
|
263
|
+
activeNotebookCellIdx = cellIdx;
|
|
264
|
+
editor.focus();
|
|
265
|
+
}).catch(function() {
|
|
266
|
+
// Fallback
|
|
267
|
+
cell.editing = true;
|
|
268
|
+
renderNotebookView(relPath);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function nbFinishMarkdownEdit(relPath, cellIdx) {
|
|
273
|
+
var f = openFiles[relPath];
|
|
274
|
+
if (!f || !f.notebookData) return;
|
|
275
|
+
var cell = f.notebookData.cells[cellIdx];
|
|
276
|
+
if (!cell) return;
|
|
277
|
+
var textarea = document.querySelector('textarea[data-md-edit="' + cellIdx + '"]');
|
|
278
|
+
if (textarea) {
|
|
279
|
+
cell.source = textarea.value;
|
|
280
|
+
f.modified = true;
|
|
281
|
+
renderWsTabs();
|
|
282
|
+
}
|
|
283
|
+
cell.editing = false;
|
|
284
|
+
renderNotebookView(relPath);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function nbFinishCodeEdit(relPath, cellIdx) {
|
|
288
|
+
var f = openFiles[relPath];
|
|
289
|
+
if (!f || !f.notebookData) return;
|
|
290
|
+
var cell = f.notebookData.cells[cellIdx];
|
|
291
|
+
if (!cell) return;
|
|
292
|
+
var textarea = document.querySelector('[data-cell-input="' + cellIdx + '"] textarea');
|
|
293
|
+
if (textarea) {
|
|
294
|
+
cell.source = textarea.value;
|
|
295
|
+
f.modified = true;
|
|
296
|
+
renderWsTabs();
|
|
297
|
+
}
|
|
298
|
+
cell.editing = false;
|
|
299
|
+
disposeNotebookCellMonaco();
|
|
300
|
+
renderNotebookView(relPath);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function nbAddCell(relPath, afterIdx, cellType) {
|
|
304
|
+
var f = openFiles[relPath];
|
|
305
|
+
if (!f || !f.notebookData) return;
|
|
306
|
+
disposeNotebookCellMonaco();
|
|
307
|
+
var newCell = {
|
|
308
|
+
id: 'cell-new-' + Date.now(),
|
|
309
|
+
cell_type: cellType,
|
|
310
|
+
source: '',
|
|
311
|
+
outputs: [],
|
|
312
|
+
metadata: {},
|
|
313
|
+
execution_count: null,
|
|
314
|
+
monacoInstance: null,
|
|
315
|
+
editing: true,
|
|
316
|
+
};
|
|
317
|
+
f.notebookData.cells.splice(afterIdx + 1, 0, newCell);
|
|
318
|
+
f.modified = true;
|
|
319
|
+
activeCellIdx = afterIdx + 1;
|
|
320
|
+
renderWsTabs();
|
|
321
|
+
renderNotebookView(relPath);
|
|
322
|
+
// Scroll to new cell
|
|
323
|
+
setTimeout(function() {
|
|
324
|
+
var el = document.querySelector('[data-cell-idx="' + (afterIdx + 1) + '"]');
|
|
325
|
+
if (el) el.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
326
|
+
if (newCell.cell_type === 'code') {
|
|
327
|
+
nbCellClick(relPath, afterIdx + 1);
|
|
328
|
+
}
|
|
329
|
+
}, 50);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function nbDeleteCell(relPath, cellIdx) {
|
|
333
|
+
var f = openFiles[relPath];
|
|
334
|
+
if (!f || !f.notebookData) return;
|
|
335
|
+
var cell = f.notebookData.cells[cellIdx];
|
|
336
|
+
if (cell.source.trim() && !confirm('Delete this cell?')) return;
|
|
337
|
+
if (activeNotebookCellIdx === cellIdx) disposeNotebookCellMonaco();
|
|
338
|
+
f.notebookData.cells.splice(cellIdx, 1);
|
|
339
|
+
f.modified = true;
|
|
340
|
+
activeCellIdx = null;
|
|
341
|
+
renderWsTabs();
|
|
342
|
+
renderNotebookView(relPath);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function nbMoveCellUp(relPath, cellIdx) {
|
|
346
|
+
if (cellIdx === 0) return;
|
|
347
|
+
var f = openFiles[relPath];
|
|
348
|
+
if (!f || !f.notebookData) return;
|
|
349
|
+
disposeNotebookCellMonaco();
|
|
350
|
+
var cells = f.notebookData.cells;
|
|
351
|
+
var tmp = cells[cellIdx - 1];
|
|
352
|
+
cells[cellIdx - 1] = cells[cellIdx];
|
|
353
|
+
cells[cellIdx] = tmp;
|
|
354
|
+
f.modified = true;
|
|
355
|
+
activeCellIdx = cellIdx - 1;
|
|
356
|
+
renderWsTabs();
|
|
357
|
+
renderNotebookView(relPath);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function nbMoveCellDown(relPath, cellIdx) {
|
|
361
|
+
var f = openFiles[relPath];
|
|
362
|
+
if (!f || !f.notebookData) return;
|
|
363
|
+
if (cellIdx >= f.notebookData.cells.length - 1) return;
|
|
364
|
+
disposeNotebookCellMonaco();
|
|
365
|
+
var cells = f.notebookData.cells;
|
|
366
|
+
var tmp = cells[cellIdx];
|
|
367
|
+
cells[cellIdx] = cells[cellIdx + 1];
|
|
368
|
+
cells[cellIdx + 1] = tmp;
|
|
369
|
+
f.modified = true;
|
|
370
|
+
activeCellIdx = cellIdx + 1;
|
|
371
|
+
renderWsTabs();
|
|
372
|
+
renderNotebookView(relPath);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function mountMarkdownMonacoInView(relPath, cellIdx) {
|
|
376
|
+
var f = openFiles[relPath];
|
|
377
|
+
if (!f || !f.notebookData) return;
|
|
378
|
+
var cell = f.notebookData.cells[cellIdx];
|
|
379
|
+
if (!cell) return;
|
|
380
|
+
var container = document.querySelector('[data-md-monaco="' + cellIdx + '"]');
|
|
381
|
+
if (!container) return;
|
|
382
|
+
|
|
383
|
+
if (monacoFailed) {
|
|
384
|
+
// Fallback: textarea
|
|
385
|
+
var ta = document.createElement('textarea');
|
|
386
|
+
ta.setAttribute('data-md-edit', cellIdx);
|
|
387
|
+
ta.value = cell.source;
|
|
388
|
+
ta.addEventListener('blur', function() { nbFinishMarkdownEdit(relPath, cellIdx); });
|
|
389
|
+
container.parentNode.replaceChild(ta, container);
|
|
390
|
+
ta.focus();
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
loadMonaco().then(function() {
|
|
395
|
+
if (activeCellIdx !== cellIdx) return;
|
|
396
|
+
var cont = document.querySelector('[data-md-monaco="' + cellIdx + '"]');
|
|
397
|
+
if (!cont) return;
|
|
398
|
+
var editor = createMonacoEditor(cont, {
|
|
399
|
+
value: cell.source,
|
|
400
|
+
language: 'markdown',
|
|
401
|
+
wordWrap: 'on',
|
|
402
|
+
scrollBeyondLastLine: false,
|
|
403
|
+
});
|
|
404
|
+
var updateHeight = function() {
|
|
405
|
+
var contentHeight = Math.min(500, Math.max(40, editor.getContentHeight()));
|
|
406
|
+
cont.style.height = contentHeight + 'px';
|
|
407
|
+
editor.layout();
|
|
408
|
+
};
|
|
409
|
+
editor.onDidContentSizeChange(updateHeight);
|
|
410
|
+
updateHeight();
|
|
411
|
+
editor.onDidChangeModelContent(function() {
|
|
412
|
+
cell.source = editor.getValue();
|
|
413
|
+
f.modified = true;
|
|
414
|
+
renderWsTabs();
|
|
415
|
+
});
|
|
416
|
+
activeNotebookCellMonaco = editor;
|
|
417
|
+
activeNotebookCellIdx = cellIdx;
|
|
418
|
+
editor.focus();
|
|
419
|
+
}).catch(function() {
|
|
420
|
+
var cont = document.querySelector('[data-md-monaco="' + cellIdx + '"]');
|
|
421
|
+
if (!cont) return;
|
|
422
|
+
var ta = document.createElement('textarea');
|
|
423
|
+
ta.setAttribute('data-md-edit', cellIdx);
|
|
424
|
+
ta.value = cell.source;
|
|
425
|
+
ta.addEventListener('blur', function() { nbFinishMarkdownEdit(relPath, cellIdx); });
|
|
426
|
+
cont.parentNode.replaceChild(ta, cont);
|
|
427
|
+
ta.focus();
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
function nbToggleCellType(relPath, cellIdx) {
|
|
432
|
+
var f = openFiles[relPath];
|
|
433
|
+
if (!f || !f.notebookData) return;
|
|
434
|
+
disposeNotebookCellMonaco();
|
|
435
|
+
var cell = f.notebookData.cells[cellIdx];
|
|
436
|
+
if (!cell) return;
|
|
437
|
+
if (cell.cell_type === 'code') {
|
|
438
|
+
cell.cell_type = 'markdown';
|
|
439
|
+
cell.outputs = [];
|
|
440
|
+
cell.execution_count = null;
|
|
441
|
+
} else {
|
|
442
|
+
cell.cell_type = 'code';
|
|
443
|
+
}
|
|
444
|
+
cell.editing = false;
|
|
445
|
+
f.modified = true;
|
|
446
|
+
renderWsTabs();
|
|
447
|
+
renderNotebookView(relPath);
|
|
448
|
+
}
|