Spaces:
Paused
Paused
Savestate: Fix research-canvas-overlay cleanup in catch block
Browse files
.superpowers/sdd/progress.md
CHANGED
|
@@ -2,3 +2,4 @@
|
|
| 2 |
|
| 3 |
Task 1: complete (commits b9d251b..def9924, review clean)
|
| 4 |
Task 2: complete (commits def9924..5d50418, review overridden - logging is sufficient)
|
|
|
|
|
|
| 2 |
|
| 3 |
Task 1: complete (commits b9d251b..def9924, review clean)
|
| 4 |
Task 2: complete (commits def9924..5d50418, review overridden - logging is sufficient)
|
| 5 |
+
Task 3: complete (commits 5d50418..53b6a96, review clean)
|
.superpowers/sdd/task-3-report.md
CHANGED
|
@@ -52,3 +52,6 @@ precache 23 entries (3566.22 KiB)
|
|
| 52 |
|
| 53 |
**Issues or concerns after fixes:**
|
| 54 |
- None. Build succeeded cleanly and all requested logic is implemented.
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
**Issues or concerns after fixes:**
|
| 54 |
- None. Build succeeded cleanly and all requested logic is implemented.
|
| 55 |
+
|
| 56 |
+
### Fixer Update 2
|
| 57 |
+
- Restored `runDeepResearch` signature to `async runDeepResearch(topic, updateUIStatus, targetModel, maxTimeMinutes = 3, onGraphEvent = () => {})` and refactored the method body to correctly use parameters, preventing TypeError crash.
|
.superpowers/sdd/task-4-brief.md
CHANGED
|
@@ -1,48 +1,57 @@
|
|
| 1 |
-
### Task 4:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
**Files:**
|
| 4 |
-
- Modify: `src/
|
| 5 |
|
| 6 |
**Interfaces:**
|
| 7 |
-
-
|
| 8 |
-
|
| 9 |
-
- [ ] **Step 1: Rewrite runDeepResearch to use DDG + Jina Iterative**
|
| 10 |
|
|
|
|
|
|
|
| 11 |
```javascript
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
// 1. Planning (same as before but limit to 4 queries to save time)
|
| 16 |
-
let queries = []; // (gemini call to get 4 queries)
|
| 17 |
-
// ...
|
| 18 |
-
|
| 19 |
-
// 2. Multi-Source Retrieval
|
| 20 |
-
let allSearchHits = [];
|
| 21 |
-
for (let i = 0; i < queries.length; i++) {
|
| 22 |
-
if (updateUIStatus) updateUIStatus(`Recherchiere: "${queries[i]}" (${i+1}/${queries.length})...`, 1);
|
| 23 |
-
const hits = await this.searchDDG(queries[i], 4);
|
| 24 |
-
allSearchHits = allSearchHits.concat(hits);
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
// Deduplicate links
|
| 28 |
-
const uniqueLinks = [...new Set(allSearchHits.map(h => h.link))];
|
| 29 |
-
|
| 30 |
-
if (updateUIStatus) updateUIStatus(`Lade ${uniqueLinks.length} Webseiten herunter...`, 2);
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
-
//
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
```
|
|
|
|
| 42 |
|
| 43 |
-
- [ ] **Step
|
|
|
|
|
|
|
| 44 |
|
|
|
|
| 45 |
```bash
|
| 46 |
-
git add src/
|
| 47 |
-
git commit -m "
|
| 48 |
```
|
|
|
|
| 1 |
+
### Task 4: Integrate Canvas into Chat View & Toggle
|
| 2 |
+
|
| 3 |
+
**Global Constraints:**
|
| 4 |
+
- Live Update Beweis: Bei jeder UI-Änderung in der index.html MUSS zwingend die Versionsnummer im `<div id="live-version-badge">` hochgezählt werden.
|
| 5 |
+
- Auto-Savestates: Immer am Ende eines Tasks oder nachdem eine Änderung am Code erfolgreich implementiert und verifiziert wurde, MUSST du automatisch per Git einen Commit erstellen (`git add .` und `git commit -m "Savestate: [Kurzbeschreibung]"`).
|
| 6 |
+
- Kostenlose APIs: Kein Tavily, nur DuckDuckGo (via Cheerio Parsen) und Jina Reader (`r.jina.ai`).
|
| 7 |
|
| 8 |
**Files:**
|
| 9 |
+
- Modify: `src/views/chat/chat-view.js`
|
| 10 |
|
| 11 |
**Interfaces:**
|
| 12 |
+
- Consumes: `initCanvas`, `addNode`, `addEdge` from `../../ai/research-canvas.js`, and `runDeepResearch` from `researchAgent`.
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
- [ ] **Step 1: Add Canvas Container to DOM**
|
| 15 |
+
In `src/views/chat/chat-view.js`, inside the `render()` method, add a canvas container overlay that starts hidden. Place it somewhere appropriate in the layout, e.g. covering the chat messages.
|
| 16 |
```javascript
|
| 17 |
+
<div id="research-canvas-overlay" style="display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 50; background: rgba(0,0,0,0.5);"></div>
|
| 18 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
- [ ] **Step 2: Add Toggle Checkbox**
|
| 21 |
+
In the input area of `chat-view.js`, add a "Detective Board" toggle checkbox to enable this visual mode.
|
| 22 |
|
| 23 |
+
- [ ] **Step 3: Wire up the Logic**
|
| 24 |
+
When `runDeepResearch` is triggered and the toggle is enabled:
|
| 25 |
+
```javascript
|
| 26 |
+
import { initCanvas, addNode, addEdge } from '../../ai/research-canvas.js';
|
| 27 |
+
// show overlay
|
| 28 |
+
const overlay = document.getElementById('research-canvas-overlay');
|
| 29 |
+
if (overlay) {
|
| 30 |
+
overlay.style.display = 'block';
|
| 31 |
+
initCanvas(overlay);
|
| 32 |
+
addNode('root', 'Research Topic', 'root');
|
| 33 |
+
}
|
| 34 |
|
| 35 |
+
// NOTE: The signature is runDeepResearch(topic, updateUIStatus, targetModel, maxTimeMinutes, onGraphEvent)
|
| 36 |
+
// Example assuming you have 'query', 'onProgress', 'model', 'time':
|
| 37 |
+
await researchAgent.runDeepResearch(query, (prog) => {
|
| 38 |
+
// update text progress
|
| 39 |
+
}, model, time, (evt) => {
|
| 40 |
+
if (evt.type === 'node') addNode(evt.id, evt.label, evt.group);
|
| 41 |
+
if (evt.type === 'edge') addEdge(evt.from, evt.to);
|
| 42 |
+
});
|
| 43 |
+
|
| 44 |
+
// hide overlay on finish
|
| 45 |
+
if (overlay) overlay.style.display = 'none';
|
| 46 |
```
|
| 47 |
+
Ensure you adapt this to the actual existing call in `chat-view.js` for Deep Research.
|
| 48 |
|
| 49 |
+
- [ ] **Step 4: Run build to verify**
|
| 50 |
+
Run: `npm run build`
|
| 51 |
+
Expected: PASS
|
| 52 |
|
| 53 |
+
- [ ] **Step 5: Commit**
|
| 54 |
```bash
|
| 55 |
+
git add src/views/chat/chat-view.js
|
| 56 |
+
git commit -m "Savestate: Integrate Canvas into Chat View"
|
| 57 |
```
|
.superpowers/sdd/task-4-report.md
CHANGED
|
@@ -1,20 +1,27 @@
|
|
| 1 |
-
# Task 4 Report:
|
| 2 |
|
| 3 |
-
|
| 4 |
-
1.
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
2. **`index.html`**:
|
| 12 |
-
- Bumped the Live-Update-Badge from `BUILD 1.8.143` to `BUILD 1.8.144` to prove the UI update.
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
-
-
|
| 19 |
-
-
|
| 20 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Task 4 Report: Integrate Canvas into Chat View & Toggle
|
| 2 |
|
| 3 |
+
## What was implemented
|
| 4 |
+
1. Added the `#research-canvas-overlay` to the DOM in `src/views/chat/chat-view.js` inside the `render()` method, just above the `#chat-messages` container.
|
| 5 |
+
2. Added the "Detective Board" toggle checkbox in `src/app.js` right under the "Vertiefte Recherche" toggle in the plus menu.
|
| 6 |
+
3. Updated `src/app.js` so the Detective Board toggle is shown/hidden whenever the Deep Research toggle state changes.
|
| 7 |
+
4. Updated `src/ai/router.js` to accept `options.onGraphEvent` and pass it to `researchAgent.runDeepResearch`.
|
| 8 |
+
5. Wired up the actual `isDetectiveBoard` toggle read and passing of `onGraphEvent` in `src/views/chat/chat-view.js` inside `handleChatSubmit`.
|
| 9 |
+
6. Incremented the Live Update Beweis version number in `index.html` from `1.8.153` to `1.8.154`.
|
| 10 |
+
7. Ran `npm run build` to verify the code compiles without errors.
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
## Test Results
|
| 13 |
+
`npm run build` ran successfully and completed with `✓ built in 2.94s`. No errors.
|
| 14 |
|
| 15 |
+
## Files changed
|
| 16 |
+
- `src/app.js` (Added toggle and logic)
|
| 17 |
+
- `src/views/chat/chat-view.js` (Added canvas container, imported canvas setup, wired up toggle logic)
|
| 18 |
+
- `src/ai/router.js` (Passed `onGraphEvent` to `runDeepResearch`)
|
| 19 |
+
- `index.html` (Bumped Live Version Badge)
|
| 20 |
+
|
| 21 |
+
## Self-Review Findings
|
| 22 |
+
- **Completeness:** The specs were implemented. The canvas overlay is in place, the toggle is created, and the events from Deep Research will now trigger `addNode` and `addEdge`.
|
| 23 |
+
- **Quality:** Code changes fit naturally with the existing codebase patterns.
|
| 24 |
+
- **Discipline:** No over-engineering.
|
| 25 |
+
|
| 26 |
+
## Concerns
|
| 27 |
+
None.
|
src/views/chat/chat-view.js
CHANGED
|
@@ -4982,7 +4982,10 @@ body { margin: 0; padding: 0; background: #000; overflow: hidden; display: flex;
|
|
| 4982 |
|
| 4983 |
} catch (e) {
|
| 4984 |
await this.hideTypingIndicator();
|
| 4985 |
-
if (isDeepResearch)
|
|
|
|
|
|
|
|
|
|
| 4986 |
|
| 4987 |
if (e.name === 'AbortError') {
|
| 4988 |
this.appendMessageElement('assistant', '**Anfrage wurde abgebrochen.**', false, true, text);
|
|
|
|
| 4982 |
|
| 4983 |
} catch (e) {
|
| 4984 |
await this.hideTypingIndicator();
|
| 4985 |
+
if (isDeepResearch) {
|
| 4986 |
+
deepResearchLoader.hide();
|
| 4987 |
+
if (isDetectiveBoard && overlay) overlay.style.display = 'none';
|
| 4988 |
+
}
|
| 4989 |
|
| 4990 |
if (e.name === 'AbortError') {
|
| 4991 |
this.appendMessageElement('assistant', '**Anfrage wurde abgebrochen.**', false, true, text);
|