@datagrok/grokky 1.0.4 → 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/.claude/skills/deploy-grokky/SKILL.md +193 -0
- package/.grokignore +2 -0
- package/.turbo/turbo-build.log +24 -0
- package/.vscode/settings.json +16 -0
- package/CHANGELOG.md +151 -8
- package/CLAUDE.md +284 -0
- package/CREDITS.md +173 -0
- package/LICENSE.md +16 -0
- package/README.md +24 -0
- package/bdd/bdd.config.json +1 -0
- package/bdd/bindings/elements.ts +9 -0
- package/bdd/bindings/steps.ts +787 -0
- package/bdd/features/ai-panel/platform-work.feature +63 -0
- package/bdd/features/ai-panel/session.feature +69 -0
- package/bdd/features/ai-panel/table-work.feature +99 -0
- package/bdd/generated/ai-panel/platform-work.test.ts +103 -0
- package/bdd/generated/ai-panel/session.test.ts +100 -0
- package/bdd/generated/ai-panel/table-work.test.ts +150 -0
- package/bdd/package.json +1 -0
- package/bdd/tsconfig.json +13 -0
- package/css/ai.css +637 -49
- package/dist/package-test.js +4 -1707
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +742 -92317
- package/dist/package.js.map +1 -1
- package/dockerfiles/claude-runtime/.dockerignore +1 -0
- package/{.eslintrc.json → dockerfiles/claude-runtime/.eslintrc.json} +7 -16
- package/dockerfiles/claude-runtime/Dockerfile +73 -13
- package/dockerfiles/claude-runtime/agent/grokky_agent/__init__.py +0 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/__main__.py +80 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/browser_tools.py +180 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/config.py +26 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/formats.py +155 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/guard.py +87 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/hermes.py +212 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/hermes.yaml +45 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/hermes_plugin/__init__.py +8 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/hermes_plugin/plugin.yaml +3 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/protocol.py +174 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/__init__.py +21 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/anthropic.py +21 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/azure.py +46 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/base.py +127 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/bedrock.py +46 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/custom.py +40 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/databricks.py +54 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/openai_platform.py +41 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/openrouter.py +46 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/session.py +471 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/skills.py +44 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/structured.py +40 -0
- package/dockerfiles/claude-runtime/container.json +2 -2
- package/dockerfiles/claude-runtime/entrypoint.sh +20 -0
- package/dockerfiles/claude-runtime/package-lock.json +1721 -306
- package/dockerfiles/claude-runtime/package.json +20 -5
- package/dockerfiles/claude-runtime/plugin/.claude-plugin/plugin.json +5 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-calc-column/SKILL.md +92 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-chem-data/SKILL.md +250 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-chem-toolkit/SKILL.md +395 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-df-and-columns/SKILL.md +454 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-entities/SKILL.md +38 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-exec/SKILL.md +209 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-filtering/SKILL.md +185 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-grid-customization/SKILL.md +270 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-projects/SKILL.md +100 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-selection/SKILL.md +344 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-undo/SKILL.md +78 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-viewers/SKILL.md +303 -0
- package/dockerfiles/claude-runtime/pyproject.toml +18 -0
- package/dockerfiles/claude-runtime/src/agent/pool.ts +411 -0
- package/dockerfiles/claude-runtime/src/agent/turn.ts +153 -0
- package/dockerfiles/claude-runtime/src/constants.ts +20 -0
- package/dockerfiles/claude-runtime/src/credentials.ts +45 -0
- package/dockerfiles/claude-runtime/src/grounding.ts +104 -0
- package/dockerfiles/claude-runtime/src/help-index.ts +118 -0
- package/dockerfiles/claude-runtime/src/privileges.ts +8 -0
- package/dockerfiles/claude-runtime/src/prompts.ts +211 -0
- package/dockerfiles/claude-runtime/src/server.ts +134 -234
- package/dockerfiles/claude-runtime/src/session.ts +328 -0
- package/dockerfiles/claude-runtime/src/shared-api-client.ts +112 -0
- package/dockerfiles/claude-runtime/src/stream-filter.ts +80 -0
- package/dockerfiles/claude-runtime/src/sync/home-files.ts +80 -0
- package/dockerfiles/claude-runtime/src/sync/orchestrator.ts +214 -0
- package/dockerfiles/claude-runtime/src/sync/packages.ts +145 -0
- package/dockerfiles/claude-runtime/src/sync/shared-connections.ts +87 -0
- package/dockerfiles/claude-runtime/src/sync/workspace.ts +68 -0
- package/dockerfiles/claude-runtime/src/tasks.ts +124 -0
- package/dockerfiles/claude-runtime/src/tool-summary.ts +66 -0
- package/dockerfiles/claude-runtime/src/types.ts +142 -23
- package/dockerfiles/claude-runtime/src/user/installed-packages.ts +17 -0
- package/dockerfiles/claude-runtime/src/user/staged-workspace.ts +80 -0
- package/dockerfiles/claude-runtime/src/user/user-dir.ts +108 -0
- package/dockerfiles/claude-runtime/src/verify.ts +136 -0
- package/dockerfiles/claude-runtime/src/watchdog.ts +115 -0
- package/dockerfiles/claude-runtime/test/credentials.test.js +43 -0
- package/dockerfiles/claude-runtime/test/grounding.test.js +191 -0
- package/dockerfiles/claude-runtime/test/help-index.test.js +115 -0
- package/dockerfiles/claude-runtime/test/plugin-skills.test.js +57 -0
- package/dockerfiles/claude-runtime/test/prompts.test.js +62 -0
- package/dockerfiles/claude-runtime/test/reaper.test.js +60 -0
- package/dockerfiles/claude-runtime/test/stream-filter.test.js +132 -0
- package/dockerfiles/claude-runtime/test/tasks.test.js +74 -0
- package/dockerfiles/claude-runtime/test/user-dir.test.js +71 -0
- package/dockerfiles/claude-runtime/test/verify.test.js +187 -0
- package/dockerfiles/claude-runtime/test/watchdog.test.js +43 -0
- package/dockerfiles/mcp-server/.eslintrc.json +39 -0
- package/dockerfiles/mcp-server/Dockerfile +10 -2
- package/dockerfiles/mcp-server/package-lock.json +1743 -98
- package/dockerfiles/mcp-server/package.json +27 -5
- package/dockerfiles/mcp-server/src/api-client.ts +123 -66
- package/dockerfiles/mcp-server/src/format.ts +51 -0
- package/dockerfiles/mcp-server/src/index.ts +44 -113
- package/dockerfiles/mcp-server/src/ops.ts +325 -0
- package/dockerfiles/mcp-server/src/shared-api-client.ts +81 -0
- package/dockerfiles/mcp-server/test/format.test.js +62 -0
- package/dockerfiles/mcp-server/test/ops.test.js +84 -0
- package/dockerfiles/mcp-server/test/shared-api-client.test.js +35 -0
- package/dockerfiles/queue/Dockerfile +2 -0
- package/dockerfiles/queue/container.json +7 -0
- package/docs/AUDIT-2026-08-03.md +1064 -0
- package/docs/BENCHMARK.md +292 -0
- package/docs/CLAUDE_CODE_FLOW.md +746 -0
- package/docs/EXAMPLES.md +82 -0
- package/docs/FEATURES.md +71 -0
- package/docs/IMPLEMENTATION.md +128 -0
- package/docs/LATENCY.md +170 -0
- package/docs/VISION.md +36 -0
- package/files/benchmark/suite.yaml +404 -0
- package/files/scripts/process-cro-results.md +14 -0
- package/files/suggestions.yaml +344 -0
- package/package.json +39 -97
- package/src/ai/ai-window.ts +157 -0
- package/src/ai/benchmark/benchmark.ts +737 -0
- package/src/ai/db-view-functions.ts +56 -0
- package/src/ai/engine.ts +98 -0
- package/src/ai/gemma-engine.ts +81 -0
- package/src/ai/panel.ts +1385 -0
- package/src/ai/prompt-suggestions.ts +209 -0
- package/src/ai/search/combined-search.ts +244 -0
- package/src/{llm-utils → ai/search}/query-matching.ts +46 -167
- package/src/{llm-utils → ai}/storage.ts +0 -1
- package/src/ai/table-tools.ts +145 -0
- package/src/ai/ui.ts +720 -0
- package/src/ai/usage-limiter.ts +105 -0
- package/src/ai/view-tools.ts +352 -0
- package/src/claude/ai-feature.ts +16 -0
- package/src/claude/exec-blocks.ts +176 -0
- package/src/claude/queue-task.ts +84 -0
- package/src/claude/runtime-client.ts +310 -0
- package/src/claude/turn-log.ts +114 -0
- package/src/claude/undoable.ts +105 -0
- package/src/{llm-utils → db}/db-index-tools.ts +24 -32
- package/src/db/sql-tools.ts +336 -0
- package/src/depr/LLM-client.ts +251 -0
- package/src/depr/ai-panel.ts +174 -0
- package/src/depr/chatgpt-assistant.ts +257 -0
- package/src/depr/creds.ts +30 -0
- package/src/depr/deepwikiclient.ts +118 -0
- package/src/depr/indexes/dg-repository-index.ts +266 -0
- package/src/depr/interfaces.ts +170 -0
- package/src/depr/is-help-request.ts +39 -0
- package/src/depr/prompt-engine.ts +52 -0
- package/src/depr/rendering-tools.ts +103 -0
- package/src/depr/script-tools.ts +785 -0
- package/src/depr/tableview-tools.ts +746 -0
- package/src/depr/viewers-ai.ts +67 -0
- package/src/package-api.ts +87 -28
- package/src/package-test.ts +1 -0
- package/src/package.g.ts +98 -48
- package/src/package.ts +211 -157
- package/src/polyfills.ts +12 -0
- package/src/utils.ts +128 -0
- package/tsconfig.json +8 -70
- package/webpack.config.js +3 -49
- package/.eslintignore +0 -2
- package/src/ai-panel.ts +0 -174
- package/src/claude-code/claude-panel.ts +0 -34
- package/src/claude-code/claude-runtime-client.ts +0 -148
- package/src/llm-utils/LLM-client.ts +0 -251
- package/src/llm-utils/combined-search.ts +0 -162
- package/src/llm-utils/creds.ts +0 -30
- package/src/llm-utils/deepwikiclient.ts +0 -118
- package/src/llm-utils/indexes/dg-repository-index.ts +0 -266
- package/src/llm-utils/panel.ts +0 -866
- package/src/llm-utils/script-tools.ts +0 -784
- package/src/llm-utils/sql-tools.ts +0 -840
- package/src/llm-utils/tableview-tools.ts +0 -704
- package/src/llm-utils/ui.ts +0 -315
- package/src/prompt-engine/chatgpt-assistant.ts +0 -257
- package/src/prompt-engine/interfaces.ts +0 -170
- package/src/prompt-engine/prompt-engine.ts +0 -52
- package/src/prompt-engine/rendering-tools.ts +0 -103
- package/src/prompts/is-help-request.ts +0 -26
- package/src/viewers-ai.ts +0 -67
- /package/src/{llm-utils → db}/indexes/biologics-index.ts +0 -0
- /package/src/{llm-utils → db}/indexes/chembl-index.ts +0 -0
- /package/src/{llm-utils → db}/query-meta-utils.ts +0 -0
- /package/src/{llm-utils/depr → depr}/AI-API-providers/openai-chat-completions-provider.ts +0 -0
- /package/src/{llm-utils/depr → depr}/AI-API-providers/openai-responses-provider.ts +0 -0
- /package/src/{llm-utils/depr → depr}/AI-API-providers/types.ts +0 -0
- /package/src/{llm-utils/depr → depr}/depr.ts +0 -0
- /package/src/{llm-utils/depr → depr}/embeddings.ts +0 -0
- /package/src/{llm-utils/depr → depr}/sql-utils.ts +0 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
# =====================================================================================
|
|
2
|
+
# Grokky prompt suggestions
|
|
3
|
+
#
|
|
4
|
+
# context: powerSearch -> global search bar (no view filter)
|
|
5
|
+
# panel -> AI panel empty state + wand-icon menu (filtered by current view)
|
|
6
|
+
# scope: global -> always applies
|
|
7
|
+
# view -> applies when the current view's `type` == match.type (e.g. TableView)
|
|
8
|
+
# column -> applies when the current table has a column with match.semType
|
|
9
|
+
#
|
|
10
|
+
# Slots: {name.filter} picks a live column where `filter` is truthy — isNumerical,
|
|
11
|
+
# isCategorical, semType (the block's match.semType), isDateTime — and biases the pick with `prefer` regexes.
|
|
12
|
+
# Extra path segments read column props, e.g. {x.stats.med}. A suggestion whose slot
|
|
13
|
+
# finds no matching column is dropped (and its block hides if all its suggestions drop),
|
|
14
|
+
# so type-specific blocks appear only when the data supports them.
|
|
15
|
+
#
|
|
16
|
+
# requires: [Pkg, ...] on a block or a suggestion hides it unless every listed package has
|
|
17
|
+
# registered functions on this deployment. Omit for prompts served by core or the LLM itself.
|
|
18
|
+
#
|
|
19
|
+
# provider: Help | Execute | Query on a powerSearch block opens its suggestions in that search tab
|
|
20
|
+
# directly, without asking the model which tab fits.
|
|
21
|
+
# =====================================================================================
|
|
22
|
+
|
|
23
|
+
# ---------------------------------------------------------------------------- powerSearch
|
|
24
|
+
- context: powerSearch
|
|
25
|
+
scope: global
|
|
26
|
+
key: function-chaining
|
|
27
|
+
label: Function chaining
|
|
28
|
+
provider: Execute
|
|
29
|
+
suggestions:
|
|
30
|
+
- prompt: ADME properties for aspirin
|
|
31
|
+
requires: [Admetica, Chem, Chembl]
|
|
32
|
+
- prompt: Gasteiger for CHEMBL1234
|
|
33
|
+
requires: [Chem, Chembl]
|
|
34
|
+
- prompt: Gasteiger for Apremilast
|
|
35
|
+
requires: [Chem, Chembl]
|
|
36
|
+
- label: Convert SMILES to HELM
|
|
37
|
+
prompt: Convert C[C@H](N)C(=O)N(C)CC(=O)N[C@@H](Cc1ccc(N)cc1)C(=O)O to HELM
|
|
38
|
+
requires: [Bio]
|
|
39
|
+
- prompt: 'Convert to SMILES: GATTACA'
|
|
40
|
+
requires: [Bio, Chem]
|
|
41
|
+
|
|
42
|
+
- context: powerSearch
|
|
43
|
+
scope: global
|
|
44
|
+
key: database-queries
|
|
45
|
+
label: Database queries
|
|
46
|
+
provider: Query
|
|
47
|
+
suggestions:
|
|
48
|
+
- prompt: ADCs with IC50 above 400
|
|
49
|
+
requires: [Biologics]
|
|
50
|
+
- prompt: ADCs with caspase activity > 8
|
|
51
|
+
requires: [Biologics]
|
|
52
|
+
- prompt: Shigella bioactivity
|
|
53
|
+
requires: [Chembl]
|
|
54
|
+
- prompt: PK for LEVOFLOXACIN
|
|
55
|
+
requires: [Chembl]
|
|
56
|
+
|
|
57
|
+
- context: powerSearch
|
|
58
|
+
scope: global
|
|
59
|
+
key: documentation
|
|
60
|
+
label: Documentation
|
|
61
|
+
provider: Help
|
|
62
|
+
suggestions:
|
|
63
|
+
- label: UMAP on sequences — parameters
|
|
64
|
+
prompt: How to perform UMAP on sequences and what parameters are available to tune?
|
|
65
|
+
- prompt: How to use lasso selection on a scatter plot?
|
|
66
|
+
|
|
67
|
+
# ==================================================================== panel :: by column
|
|
68
|
+
# --- Small molecules ---------------------------------------------------------------------
|
|
69
|
+
- context: panel
|
|
70
|
+
scope: column
|
|
71
|
+
key: molecule
|
|
72
|
+
match: { semType: Molecule }
|
|
73
|
+
label: Molecules
|
|
74
|
+
icon: atom
|
|
75
|
+
color: var(--blue-1)
|
|
76
|
+
requires: [Chem]
|
|
77
|
+
suggestions:
|
|
78
|
+
- label: Explore the chemical space
|
|
79
|
+
prompt: Show the chemical space of {mol.semType} — reduce structures to 2D and plot them with structure previews
|
|
80
|
+
- label: Calculate molecular descriptors
|
|
81
|
+
prompt: Calculate physicochemical and Lipinski descriptors for {mol.semType} and add them as columns
|
|
82
|
+
- label: Cluster by similarity
|
|
83
|
+
prompt: Cluster {mol.semType} by structural similarity and show a representative of each cluster
|
|
84
|
+
- label: Flag structural alerts
|
|
85
|
+
prompt: Screen {mol.semType} for PAINS and structural toxicity alerts and flag the hits
|
|
86
|
+
- label: R-group analysis
|
|
87
|
+
prompt: Run R-group analysis on {mol.semType} around the common scaffold and summarize the R-groups
|
|
88
|
+
- label: Most diverse subset
|
|
89
|
+
prompt: Select the 24 most structurally diverse molecules from {mol.semType}
|
|
90
|
+
- label: Standardize & deduplicate
|
|
91
|
+
prompt: Detect duplicates, salts and tautomers in {mol.semType}, then standardize the structures
|
|
92
|
+
- label: Murcko scaffolds
|
|
93
|
+
prompt: Extract Murcko scaffolds from {mol.semType} and show the most common ones
|
|
94
|
+
|
|
95
|
+
# --- Biomolecules / sequences ------------------------------------------------------------
|
|
96
|
+
- context: panel
|
|
97
|
+
scope: column
|
|
98
|
+
key: macromolecule
|
|
99
|
+
match: { semType: Macromolecule }
|
|
100
|
+
label: Sequences
|
|
101
|
+
icon: dna
|
|
102
|
+
color: var(--steel-4)
|
|
103
|
+
requires: [Bio]
|
|
104
|
+
suggestions:
|
|
105
|
+
- label: Explore the sequence space
|
|
106
|
+
prompt: Show the sequence space of {seq.semType} with clustering and previews
|
|
107
|
+
- label: Multiple sequence alignment
|
|
108
|
+
prompt: Run a multiple sequence alignment on {seq.semType}
|
|
109
|
+
- label: Composition & WebLogo
|
|
110
|
+
prompt: Show the monomer composition and a WebLogo for {seq.semType}
|
|
111
|
+
- label: Cluster sequences
|
|
112
|
+
prompt: Cluster {seq.semType} by similarity and show the clusters
|
|
113
|
+
- label: Detect modified monomers
|
|
114
|
+
prompt: Detect non-natural or modified monomers and gaps in {seq.semType}
|
|
115
|
+
|
|
116
|
+
- context: panel
|
|
117
|
+
scope: column
|
|
118
|
+
key: molecule3d
|
|
119
|
+
match: { semType: Molecule3D }
|
|
120
|
+
label: 3D structures
|
|
121
|
+
icon: cube
|
|
122
|
+
color: var(--green-3)
|
|
123
|
+
requires: [BiostructureViewer]
|
|
124
|
+
suggestions:
|
|
125
|
+
- label: Show 3D structures
|
|
126
|
+
prompt: Render the 3D structures in {mol.semType}
|
|
127
|
+
- label: Compare poses
|
|
128
|
+
prompt: Overlay and compare the binding poses in {mol.semType}
|
|
129
|
+
|
|
130
|
+
# --- Potency / assay readouts (semantic) -------------------------------------------------
|
|
131
|
+
- context: panel
|
|
132
|
+
scope: column
|
|
133
|
+
key: ic50
|
|
134
|
+
match: { semType: IC50 }
|
|
135
|
+
label: Potency (IC50)
|
|
136
|
+
icon: flask
|
|
137
|
+
color: var(--green-2)
|
|
138
|
+
suggestions:
|
|
139
|
+
- label: Convert to pIC50
|
|
140
|
+
prompt: Convert {act.semType} to pIC50 and show the distribution
|
|
141
|
+
- label: Flag potent compounds
|
|
142
|
+
prompt: Flag the most potent compounds by {act.semType} and select them
|
|
143
|
+
- label: Potency vs size
|
|
144
|
+
prompt: Plot potency ({act.semType}) against molecular weight and look for a size trend
|
|
145
|
+
requires: [Chem]
|
|
146
|
+
|
|
147
|
+
- context: panel
|
|
148
|
+
scope: column
|
|
149
|
+
key: ec50
|
|
150
|
+
match: { semType: EC50 }
|
|
151
|
+
label: Potency (EC50)
|
|
152
|
+
icon: flask
|
|
153
|
+
color: var(--green-3)
|
|
154
|
+
suggestions:
|
|
155
|
+
- label: Convert to pEC50
|
|
156
|
+
prompt: Convert {act.semType} to pEC50 and show the distribution
|
|
157
|
+
- label: Rank by potency
|
|
158
|
+
prompt: Sort the table by {act.semType} and highlight the most active compounds
|
|
159
|
+
|
|
160
|
+
- context: panel
|
|
161
|
+
scope: column
|
|
162
|
+
key: concentration
|
|
163
|
+
match: { semType: Concentration }
|
|
164
|
+
label: Concentration
|
|
165
|
+
icon: flask
|
|
166
|
+
color: var(--steel-4)
|
|
167
|
+
suggestions:
|
|
168
|
+
- label: Distribution
|
|
169
|
+
prompt: Show the distribution of {conc.semType} and flag out-of-range values
|
|
170
|
+
- label: Dose–response
|
|
171
|
+
prompt: Fit a dose–response curve using {conc.semType} as the dose
|
|
172
|
+
requires: [Curves]
|
|
173
|
+
|
|
174
|
+
# --- Geospatial --------------------------------------------------------------------------
|
|
175
|
+
- context: panel
|
|
176
|
+
scope: column
|
|
177
|
+
key: latlong
|
|
178
|
+
match: { semType: Latitude }
|
|
179
|
+
label: Geospatial
|
|
180
|
+
icon: map-marker
|
|
181
|
+
color: var(--steel-3)
|
|
182
|
+
requires: [GIS]
|
|
183
|
+
suggestions:
|
|
184
|
+
- label: Plot on a map
|
|
185
|
+
prompt: Plot the rows on a map using the latitude and longitude columns
|
|
186
|
+
- label: Density heatmap
|
|
187
|
+
prompt: Show a geographic density heatmap of the points
|
|
188
|
+
|
|
189
|
+
- context: panel
|
|
190
|
+
scope: column
|
|
191
|
+
key: country
|
|
192
|
+
match: { semType: Country }
|
|
193
|
+
label: Countries
|
|
194
|
+
icon: globe
|
|
195
|
+
color: var(--steel-5)
|
|
196
|
+
suggestions:
|
|
197
|
+
- label: Choropleth map
|
|
198
|
+
prompt: Build a choropleth map aggregated per {country.semType}, colored by {v.isNumerical}
|
|
199
|
+
- label: Aggregate by country
|
|
200
|
+
prompt: Group the rows by {country.semType} and summarize the numeric columns
|
|
201
|
+
|
|
202
|
+
# --- Money / financial -------------------------------------------------------------------
|
|
203
|
+
- context: panel
|
|
204
|
+
scope: column
|
|
205
|
+
key: money
|
|
206
|
+
match: { semType: Money }
|
|
207
|
+
label: Money
|
|
208
|
+
icon: dollar-sign
|
|
209
|
+
color: var(--grey-5)
|
|
210
|
+
suggestions:
|
|
211
|
+
- label: Summarize totals
|
|
212
|
+
prompt: Summarize the total, average and median of {money.semType}
|
|
213
|
+
- label: Outliers & trend
|
|
214
|
+
prompt: Find outliers in {money.semType} and show how it trends across categories
|
|
215
|
+
|
|
216
|
+
# --- Free text ---------------------------------------------------------------------------
|
|
217
|
+
- context: panel
|
|
218
|
+
scope: column
|
|
219
|
+
key: text
|
|
220
|
+
match: { semType: Text }
|
|
221
|
+
label: Text
|
|
222
|
+
icon: align-left
|
|
223
|
+
color: var(--grey-4)
|
|
224
|
+
suggestions:
|
|
225
|
+
- label: Summarize themes
|
|
226
|
+
prompt: Summarize the recurring themes across the values in {text.semType}
|
|
227
|
+
- label: Cluster by topic
|
|
228
|
+
prompt: Cluster the rows by the topic of {text.semType} and label each cluster
|
|
229
|
+
- label: Extract entities
|
|
230
|
+
prompt: Extract named entities (people, organizations, places) from {text.semType}
|
|
231
|
+
- label: Sentiment
|
|
232
|
+
prompt: Run sentiment analysis on {text.semType} and add a sentiment column
|
|
233
|
+
|
|
234
|
+
# ================================================================= panel :: whole table view
|
|
235
|
+
# --- Visualize ---------------------------------------------------------------------------
|
|
236
|
+
- context: panel
|
|
237
|
+
scope: view
|
|
238
|
+
key: visualize
|
|
239
|
+
match: { type: TableView }
|
|
240
|
+
label: Visualize
|
|
241
|
+
icon: chart-line
|
|
242
|
+
color: var(--steel-3)
|
|
243
|
+
suggestions:
|
|
244
|
+
- label: Scatter plot of {x.isNumerical} vs {y.isNumerical}, colored by {c.isCategorical}
|
|
245
|
+
prompt: Add a scatter plot of {x.isNumerical} vs {y.isNumerical}, colored by {c.isCategorical}
|
|
246
|
+
prefer:
|
|
247
|
+
x: 'name~="lipo|logp|logd|mw|weight"'
|
|
248
|
+
y: 'name~="affinity|ic50|ec50|ki|potency|activity"'
|
|
249
|
+
c: 'name~="stage|class|status|group|type|series"'
|
|
250
|
+
- prompt: Show a histogram of {n.isNumerical}
|
|
251
|
+
- prompt: Add a box plot of {n.isNumerical} grouped by {c.isCategorical}
|
|
252
|
+
- prompt: Add a bar chart of row counts per {c.isCategorical}
|
|
253
|
+
- label: Correlation matrix
|
|
254
|
+
prompt: Show a correlation matrix across the numerical columns
|
|
255
|
+
- prompt: Add a trellis plot of {n.isNumerical} split by {c.isCategorical}
|
|
256
|
+
|
|
257
|
+
# --- Analyze & model ---------------------------------------------------------------------
|
|
258
|
+
- context: panel
|
|
259
|
+
scope: view
|
|
260
|
+
key: analyze
|
|
261
|
+
match: { type: TableView }
|
|
262
|
+
label: Analyze & model
|
|
263
|
+
icon: calculator
|
|
264
|
+
color: var(--green-2)
|
|
265
|
+
suggestions:
|
|
266
|
+
- label: Descriptive statistics
|
|
267
|
+
prompt: Give me a descriptive statistics summary (count, mean, median, std, min/max) for every numerical column
|
|
268
|
+
- prompt: Detect outliers in {n.isNumerical} and select those rows
|
|
269
|
+
- label: Cluster the rows
|
|
270
|
+
prompt: Cluster the rows into groups using the numerical columns and add a cluster column
|
|
271
|
+
- label: Dimensionality reduction
|
|
272
|
+
prompt: Reduce the numerical columns to 2D with PCA (or UMAP) and plot the result
|
|
273
|
+
- label: Predict {y.isNumerical}
|
|
274
|
+
prompt: Build a model to predict {y.isNumerical} from the other columns and report the important features
|
|
275
|
+
requires: [EDA]
|
|
276
|
+
prefer:
|
|
277
|
+
y: 'name~="affinity|ic50|ec50|ki|potency|activity|yield|target|label"'
|
|
278
|
+
- label: What correlates with {y.isNumerical}?
|
|
279
|
+
prompt: Find which columns most strongly correlate with {y.isNumerical}
|
|
280
|
+
prefer:
|
|
281
|
+
y: 'name~="affinity|ic50|ec50|ki|potency|activity|yield|target"'
|
|
282
|
+
|
|
283
|
+
# --- Time trends (only shown when a datetime column exists) -------------------------------
|
|
284
|
+
- context: panel
|
|
285
|
+
scope: view
|
|
286
|
+
key: time-trends
|
|
287
|
+
match: { type: TableView }
|
|
288
|
+
label: Time trends
|
|
289
|
+
icon: clock
|
|
290
|
+
color: var(--blue-2)
|
|
291
|
+
suggestions:
|
|
292
|
+
- label: Trend of {y.isNumerical} over time
|
|
293
|
+
prompt: Plot {y.isNumerical} over {d.isDateTime} as a line chart
|
|
294
|
+
- label: Moving average over time
|
|
295
|
+
prompt: Show the moving average of {y.isNumerical} over {d.isDateTime}
|
|
296
|
+
- label: Aggregate by period
|
|
297
|
+
prompt: Aggregate {y.isNumerical} by month of {d.isDateTime} and chart it
|
|
298
|
+
|
|
299
|
+
# --- Clean & transform -------------------------------------------------------------------
|
|
300
|
+
- context: panel
|
|
301
|
+
scope: view
|
|
302
|
+
key: clean
|
|
303
|
+
match: { type: TableView }
|
|
304
|
+
label: Clean & transform
|
|
305
|
+
icon: broom
|
|
306
|
+
color: var(--steel-5)
|
|
307
|
+
suggestions:
|
|
308
|
+
- label: Missing-data report
|
|
309
|
+
prompt: Summarize missing values per column and suggest how to handle them
|
|
310
|
+
- prompt: Find and remove duplicate rows
|
|
311
|
+
- label: Normalize numerical columns
|
|
312
|
+
prompt: Normalize (standardize) the numerical columns into new columns
|
|
313
|
+
- label: Pivot {n.isNumerical} by {c.isCategorical}
|
|
314
|
+
prompt: Pivot the table — group by {c.isCategorical} and aggregate {n.isNumerical}
|
|
315
|
+
- prompt: Select the top 20 rows by {m.isNumerical}
|
|
316
|
+
prefer:
|
|
317
|
+
m: 'name~="affinity|ic50|ec50|ki|potency|activity|score|rank"'
|
|
318
|
+
- label: Color rows by {risk.isNumerical}
|
|
319
|
+
prompt: Color rows by {risk.isNumerical} (red high, green low, split at {risk.stats.med})
|
|
320
|
+
prefer:
|
|
321
|
+
risk: 'name~="risk|herg|tox|alert|liability"'
|
|
322
|
+
|
|
323
|
+
# ---------------------------------------------------------------------- panel :: global
|
|
324
|
+
- context: panel
|
|
325
|
+
scope: global
|
|
326
|
+
key: anywhere
|
|
327
|
+
label: Anywhere
|
|
328
|
+
icon: globe
|
|
329
|
+
color: var(--grey-4)
|
|
330
|
+
suggestions:
|
|
331
|
+
- prompt: Show my recent projects
|
|
332
|
+
|
|
333
|
+
- context: panel
|
|
334
|
+
scope: global
|
|
335
|
+
key: code-generation
|
|
336
|
+
label: Code generation
|
|
337
|
+
icon: code
|
|
338
|
+
color: var(--grey-5)
|
|
339
|
+
suggestions:
|
|
340
|
+
- label: 'JS: interactive sketcher with molecule properties'
|
|
341
|
+
prompt: 'JS: Add a view with the sketcher on the left, and the molecule properties on the right. As user sketches the molecule, the right part should update interactively'
|
|
342
|
+
requires: [Chem]
|
|
343
|
+
- label: 'Python: render Gasteiger partial charges'
|
|
344
|
+
prompt: 'Python: write a script that accepts a molecule and renders Gasteiger partial charges as a result'
|
package/package.json
CHANGED
|
@@ -1,54 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/grokky",
|
|
3
3
|
"friendlyName": "Grokky",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"description": "Grokky AI assistant for Datagrok",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Oleksandra Serhiienko",
|
|
8
8
|
"email": "oserhiienko@datagrok.ai"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"@
|
|
15
|
-
"
|
|
16
|
-
"@datagrok-libraries/test": "^1.
|
|
17
|
-
"@datagrok-libraries/utils": "^4.6.5",
|
|
18
|
-
"@modelcontextprotocol/sdk": "^1.21.1",
|
|
19
|
-
"@types/dom-chromium-ai": "^0.0.10",
|
|
20
|
-
"ai": "^6.0.62",
|
|
21
|
-
"cash-dom": "^8.1.5",
|
|
22
|
-
"datagrok-api": "^1.27.0",
|
|
23
|
-
"dayjs": "^1.11.19",
|
|
24
|
-
"openai": "^6.16.0"
|
|
11
|
+
"dayjs": "1.11.23",
|
|
12
|
+
"js-yaml": "^4.1.0",
|
|
13
|
+
"rxjs": "6.6.7",
|
|
14
|
+
"@datagrok-libraries/db-explorer": "^1.8.0",
|
|
15
|
+
"datagrok-api": "^1.28.1",
|
|
16
|
+
"@datagrok-libraries/test": "^1.6.0"
|
|
25
17
|
},
|
|
26
18
|
"devDependencies": {
|
|
27
19
|
"@types/dom-speech-recognition": "^0.0.7",
|
|
28
|
-
"@
|
|
29
|
-
"@typescript-eslint/parser": "^8.8.1",
|
|
30
|
-
"css-loader": "^7.1.2",
|
|
31
|
-
"datagrok-tools": "^5.0.0",
|
|
32
|
-
"eslint": "^8.57.1",
|
|
33
|
-
"eslint-config-google": "^0.14.0",
|
|
20
|
+
"@types/js-yaml": "^4.0.9",
|
|
34
21
|
"eslint-plugin-rxjs": "^5.0.3",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"typescript": "^5.9.3",
|
|
38
|
-
"webpack": "^5.104.1",
|
|
39
|
-
"webpack-cli": "^6.0.1"
|
|
40
|
-
},
|
|
41
|
-
"scripts": {
|
|
42
|
-
"link-all": "grok link",
|
|
43
|
-
"debug-grokky": "webpack && grok publish",
|
|
44
|
-
"release-grokky": "webpack && grok publish --release",
|
|
45
|
-
"build-grokky": "webpack",
|
|
46
|
-
"build": "grok api && grok check --soft && webpack",
|
|
47
|
-
"debug-grokky-dev": "webpack && grok publish dev",
|
|
48
|
-
"release-grokky-dev": "webpack && grok publish dev --release",
|
|
49
|
-
"debug-grokky-public": "webpack && grok publish public",
|
|
50
|
-
"release-grokky-public": "webpack && grok publish public --release"
|
|
22
|
+
"@playwright/test": "^1.48.0",
|
|
23
|
+
"@datagrok-libraries/bdd": "^1.0.0"
|
|
51
24
|
},
|
|
25
|
+
"properties": [
|
|
26
|
+
{
|
|
27
|
+
"name": "logPrompts",
|
|
28
|
+
"description": "Log the text of each AI prompt, as an ai-turn-content usage event",
|
|
29
|
+
"propertyType": "bool",
|
|
30
|
+
"defaultValue": "true",
|
|
31
|
+
"nullable": false
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "logResponses",
|
|
35
|
+
"description": "Log the text of each AI response, as an ai-turn-content usage event",
|
|
36
|
+
"propertyType": "bool",
|
|
37
|
+
"defaultValue": "false",
|
|
38
|
+
"nullable": false
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "logToolCalls",
|
|
42
|
+
"description": "Log a summary of the tools each AI turn used, as an ai-turn-content usage event",
|
|
43
|
+
"propertyType": "bool",
|
|
44
|
+
"defaultValue": "false",
|
|
45
|
+
"nullable": false
|
|
46
|
+
}
|
|
47
|
+
],
|
|
52
48
|
"canEdit": [
|
|
53
49
|
"Administrators"
|
|
54
50
|
],
|
|
@@ -63,64 +59,10 @@
|
|
|
63
59
|
"sources": [
|
|
64
60
|
"css/ai.css"
|
|
65
61
|
],
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"defaultValue": "",
|
|
72
|
-
"nullable": true
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"name": "defaultFastModel",
|
|
76
|
-
"propertyType": "string",
|
|
77
|
-
"description": "Fast Model name for simple tasks. This must match the model names supported by OpenAI or name of deployed model.",
|
|
78
|
-
"defaultValue": "gpt-4o-mini",
|
|
79
|
-
"nullable": false
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"name": "defaultDeepResearchModel",
|
|
83
|
-
"propertyType": "string",
|
|
84
|
-
"description": "Deep Research Model name for complex tasks. This must match the model names supported by OpenAI or name of deployed model.",
|
|
85
|
-
"defaultValue": "gpt-5.2",
|
|
86
|
-
"nullable": false
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"name": "defaultCodingModel",
|
|
90
|
-
"propertyType": "string",
|
|
91
|
-
"description": "Coding Model name for code generation tasks. This must match the model names supported by OpenAI or name of deployed model.",
|
|
92
|
-
"defaultValue": "gpt-5.1-codex-max",
|
|
93
|
-
"nullable": false
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"name": "APIName",
|
|
97
|
-
"propertyType": "string",
|
|
98
|
-
"description": "OpenAI API endpoint. Responses or Chat completions API can be used.",
|
|
99
|
-
"defaultValue": "OpenAI Chat Completions",
|
|
100
|
-
"nullable": false,
|
|
101
|
-
"choices": [
|
|
102
|
-
"OpenAI Chat Completions",
|
|
103
|
-
"OpenAI Responses",
|
|
104
|
-
"Antropic Messages",
|
|
105
|
-
"Amazon Bedrock"
|
|
106
|
-
]
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"name" : "region",
|
|
110
|
-
"propertyType": "string",
|
|
111
|
-
"description": "Region for Amazon Bedrock API. Required only if Amazon Bedrock is used as API.",
|
|
112
|
-
"defaultValue": "us-east-2",
|
|
113
|
-
"nullable": true
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"name": "apiVersion",
|
|
117
|
-
"propertyType": "string",
|
|
118
|
-
"description": "API version for OpenAI endpoint. v1 or v2.",
|
|
119
|
-
"defaultValue": "v1",
|
|
120
|
-
"nullable": true
|
|
121
|
-
}
|
|
122
|
-
],
|
|
123
|
-
"overrides": {
|
|
124
|
-
"datagrok-api": "$datagrok-api"
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "grok build",
|
|
64
|
+
"typecheck": "grok tsc --noEmit -p tsconfig.json",
|
|
65
|
+
"lint": "eslint --ext .ts,.tsx src",
|
|
66
|
+
"test:bdd": "grok-bdd run"
|
|
125
67
|
}
|
|
126
|
-
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import * as grok from 'datagrok-api/grok';
|
|
2
|
+
import * as DG from 'datagrok-api/dg';
|
|
3
|
+
|
|
4
|
+
import {AIPanel} from './panel';
|
|
5
|
+
import {getAIPanelToggleSubscription, isToggleKey} from '../utils';
|
|
6
|
+
|
|
7
|
+
type AnyPanel = AIPanel<any, any>;
|
|
8
|
+
|
|
9
|
+
const near = (a: number, b: number, tolerance = 2): boolean => Math.abs(a - b) <= tolerance;
|
|
10
|
+
|
|
11
|
+
export class AIWindowManager {
|
|
12
|
+
private static _instance: AIWindowManager | null = null;
|
|
13
|
+
static get instance(): AIWindowManager {
|
|
14
|
+
if (!AIWindowManager._instance)
|
|
15
|
+
AIWindowManager._instance = new AIWindowManager();
|
|
16
|
+
return AIWindowManager._instance;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private readonly byView = new WeakMap<DG.ViewBase, AnyPanel>();
|
|
20
|
+
/** Panels owned by a single view (e.g. DB query assistants) — disposed when that view closes. */
|
|
21
|
+
private readonly owned = new WeakSet<AnyPanel>();
|
|
22
|
+
private shell: AnyPanel | null = null;
|
|
23
|
+
private current: AnyPanel | null = null;
|
|
24
|
+
private initialized = false;
|
|
25
|
+
private props: HTMLElement | null = null;
|
|
26
|
+
private propsShown = false;
|
|
27
|
+
private stacked = false;
|
|
28
|
+
private moved: DG.DockContainer | null = null;
|
|
29
|
+
|
|
30
|
+
init(shell: AnyPanel): void {
|
|
31
|
+
this.shell = shell;
|
|
32
|
+
if (this.initialized)
|
|
33
|
+
return;
|
|
34
|
+
this.initialized = true;
|
|
35
|
+
|
|
36
|
+
// The mounted panel deliberately survives view switches: one panel, one session.
|
|
37
|
+
// It learns the current view at prompt time (buildWorkspaceContext), not by remounting.
|
|
38
|
+
|
|
39
|
+
grok.events.onViewRemoved.subscribe((v) => this.unregister(v));
|
|
40
|
+
|
|
41
|
+
// Keep the empty-state suggestion cards in sync with the current view.
|
|
42
|
+
grok.events.onCurrentViewChanged.subscribe(() => {
|
|
43
|
+
if (grok.shell.windows.showAI)
|
|
44
|
+
this.current?.activate(false);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const follow = () => Promise.resolve().then(() => this.followProperties());
|
|
48
|
+
follow();
|
|
49
|
+
grok.shell.windows.onPanelVisibilityChanged.subscribe(follow);
|
|
50
|
+
grok.shell.dockManager.onClosed.subscribe(follow);
|
|
51
|
+
|
|
52
|
+
getAIPanelToggleSubscription().subscribe((v) => this.toggle((v as DG.ViewBase) ?? grok.shell.v));
|
|
53
|
+
|
|
54
|
+
document.addEventListener('keydown', (e: KeyboardEvent) => {
|
|
55
|
+
if (isToggleKey(e)) {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
this.toggle(grok.shell.v);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
register(view: DG.ViewBase, panel: AnyPanel, opts: {owned?: boolean} = {}): void {
|
|
63
|
+
this.byView.set(view, panel);
|
|
64
|
+
if (opts.owned)
|
|
65
|
+
this.owned.add(panel);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
show(view: DG.ViewBase | null = grok.shell.v): void {
|
|
69
|
+
this.open(this.panelFor(view), true);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
showPanel(panel: AnyPanel, focus = true): void {
|
|
73
|
+
this.open(panel, focus);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
toggle(view: DG.ViewBase | null): void {
|
|
77
|
+
const panel = this.panelFor(view);
|
|
78
|
+
const showing = grok.shell.windows.showAI && grok.shell.windows.ai.contains(panel.root);
|
|
79
|
+
showing ? this.close() : this.open(panel, true);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private panelFor(view: DG.ViewBase | null): AnyPanel {
|
|
83
|
+
return (view && this.byView.get(view)) || this.current || this.shell!;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private open(panel: AnyPanel, focus: boolean): void {
|
|
87
|
+
const previouslyFocused = document.activeElement as HTMLElement | null;
|
|
88
|
+
this.mount(panel);
|
|
89
|
+
panel.activate(focus);
|
|
90
|
+
if (!focus)
|
|
91
|
+
previouslyFocused?.focus();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private close(): void {
|
|
95
|
+
grok.shell.windows.showAI = false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private mount(panel: AnyPanel): void {
|
|
99
|
+
const win = grok.shell.windows.ai;
|
|
100
|
+
if (this.current && this.current !== panel && win.contains(this.current.root))
|
|
101
|
+
win.removeChild(this.current.root);
|
|
102
|
+
if (!win.contains(panel.root))
|
|
103
|
+
win.appendChild(panel.root);
|
|
104
|
+
grok.shell.windows.showAI = true;
|
|
105
|
+
this.current = panel;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private followProperties(): void {
|
|
109
|
+
const {windows, dockManager: dm} = grok.shell;
|
|
110
|
+
const ai = dm.findNode(windows.ai);
|
|
111
|
+
if (!windows.showAI) {
|
|
112
|
+
if (ai)
|
|
113
|
+
dm.close(ai);
|
|
114
|
+
this.moved?.destroy();
|
|
115
|
+
this.moved = null;
|
|
116
|
+
}
|
|
117
|
+
const opened = windows.showContextPanel && !this.propsShown;
|
|
118
|
+
this.propsShown = windows.showContextPanel;
|
|
119
|
+
const propsNode = this.propsShown ? dm.findNode(windows.context.root!) : undefined;
|
|
120
|
+
const previous = this.props;
|
|
121
|
+
this.props = propsNode?.container.containerElement ?? null;
|
|
122
|
+
if (!ai || !windows.showAI)
|
|
123
|
+
return;
|
|
124
|
+
const a = ai.container.containerElement.getBoundingClientRect();
|
|
125
|
+
if (!a.width)
|
|
126
|
+
return;
|
|
127
|
+
if (this.props) {
|
|
128
|
+
const p = this.props.getBoundingClientRect();
|
|
129
|
+
const beside = opened && near(p.top, a.top) && near(p.bottom, a.bottom) &&
|
|
130
|
+
(near(p.left, a.right, 12) || near(a.left, p.right, 12));
|
|
131
|
+
if (beside)
|
|
132
|
+
this.moved = dm.dock(windows.ai, DG.DOCK_TYPE.DOWN, propsNode!, 'AI', 0.3).container;
|
|
133
|
+
this.stacked = beside || (near(p.left, a.left) && near(p.right, a.right));
|
|
134
|
+
} else if (previous && this.stacked) {
|
|
135
|
+
this.stacked = false;
|
|
136
|
+
const width = parseFloat(previous.style.width);
|
|
137
|
+
const area = dm.element.getBoundingClientRect();
|
|
138
|
+
if (width && !near(a.width, width) && near(a.right, area.right) && near(a.height, area.height))
|
|
139
|
+
this.moved = dm.dock(windows.ai, DG.DOCK_TYPE.RIGHT, null, 'AI', width / area.width).container;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
private unregister(view: DG.ViewBase): void {
|
|
144
|
+
const panel = this.byView.get(view);
|
|
145
|
+
if (!panel)
|
|
146
|
+
return;
|
|
147
|
+
this.byView.delete(view);
|
|
148
|
+
if (!this.owned.has(panel))
|
|
149
|
+
return; // shared panel (shell/scripting singleton) — keep it alive
|
|
150
|
+
if (this.current === panel) {
|
|
151
|
+
this.current = null;
|
|
152
|
+
if (grok.shell.windows.showAI && this.shell)
|
|
153
|
+
this.open(this.shell, false);
|
|
154
|
+
}
|
|
155
|
+
panel.dispose();
|
|
156
|
+
}
|
|
157
|
+
}
|