Skip to content

Commit 11f84ca

Browse files
fix: address review findings for accuracy
- Fix plugin discovery docs: uses __all__ exports, not @tool scanning - Fix widget markdown claims: no syntax highlighting or strikethrough - Add source_repo field to DocSource schema reference table - Fix widget API response: tool_calls not session_id - Add note about cf_turnstile_response handled by Worker proxy - Add missing widget config options: repoUrl, repoName, pageContext* - Fix communityId validation description to match actual regex - Fix extensions loading order to match actual init sequence
1 parent 3f77a8b commit 11f84ca

3 files changed

Lines changed: 27 additions & 13 deletions

File tree

docs/osa/deployment/widget.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ The widget appears as a chat bubble in the bottom-right corner of the page.
3030
| `storageKey` | string | Auto-derived | localStorage key for chat history |
3131
| `turnstileSiteKey` | string | `null` | Cloudflare Turnstile site key |
3232
| `showExperimentalBadge` | boolean | `true` | Show beta/experimental badge |
33+
| `repoUrl` | string | OSA GitHub URL | URL for the "Powered by" footer link |
34+
| `repoName` | string | `'Open Science Assistant'` | Display name in footer |
3335
| `allowPageContext` | boolean | `true` | Show page context toggle |
3436
| `pageContextDefaultEnabled` | boolean | `true` | Default state of page context |
37+
| `pageContextStorageKey` | string | `'osa-page-context-enabled'` | localStorage key for page context preference |
38+
| `pageContextLabel` | string | `'Share page URL...'` | Label text for the page context checkbox |
3539
| `fullscreen` | boolean | `false` | Open chat in fullscreen mode |
3640

3741
### Minimal Configuration
@@ -99,10 +103,10 @@ Users can open the chat in a separate browser window for a larger workspace. The
99103
Assistant responses support full Markdown rendering including:
100104

101105
- Tables
102-
- Code blocks with syntax highlighting
106+
- Code blocks with copy button
103107
- Lists (ordered and unordered)
104108
- Links
105-
- Bold, italic, strikethrough
109+
- Bold and italic
106110

107111
## Environment Detection
108112

@@ -153,17 +157,18 @@ The widget communicates with two backend endpoints:
153157
"page_context": {
154158
"url": "https://hedtags.org/docs/getting-started",
155159
"title": "Getting Started - HED"
156-
},
157-
"cf_turnstile_response": "token..."
160+
}
158161
}
159162
```
160163

164+
The `cf_turnstile_response` field is also sent by the widget when Turnstile is configured, but this is consumed by the Cloudflare Worker proxy, not the backend API.
165+
161166
### Response Format
162167

163168
```json
164169
{
165170
"answer": "HED (Hierarchical Event Descriptors) is...",
166-
"session_id": "abc123"
171+
"tool_calls": []
167172
}
168173
```
169174

@@ -203,7 +208,7 @@ Each community page auto-configures the widget with the appropriate settings.
203208

204209
- Check browser console for JavaScript errors
205210
- Verify the script URL is accessible
206-
- Ensure `communityId` contains only lowercase letters, numbers, and hyphens
211+
- Ensure `communityId` contains only letters, numbers, hyphens, and underscores (the backend registry uses kebab-case IDs)
207212

208213
**"Offline" status:**
209214

docs/osa/registry/extensions.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,20 @@ extensions:
9393
- search_examples
9494
```
9595
96-
If `tools` is omitted, all `@tool`-decorated functions in the module are loaded:
96+
If `tools` is omitted, all names exported in the module's `__all__` list that are valid tool objects are loaded:
9797

9898
```yaml
9999
extensions:
100100
python_plugins:
101101
- module: src.assistants.my-tool.tools
102-
# All @tool functions loaded
102+
# All tools listed in __all__ are loaded
103+
```
104+
105+
Your module must define `__all__` listing the tools to export:
106+
107+
```python
108+
# src/assistants/my-tool/tools.py
109+
__all__ = ["validate_config", "search_examples"]
103110
```
104111

105112
### Example: HED Tools
@@ -174,13 +181,14 @@ Exactly one of `command` or `url` must be provided for each server.
174181

175182
When a `CommunityAssistant` is created, tools are loaded in this order:
176183

177-
1. **Auto-generated tools** from YAML config:
178-
- `retrieve_{community}_docs` - Document retrieval
184+
1. **Knowledge tools** from YAML config:
179185
- `list_{community}_recent` - Recent GitHub activity
180186
- `search_{community}_discussions` - GitHub search
181187
- `search_{community}_papers` - Academic paper search
182-
- `fetch_current_page` - Page context (if enabled)
183-
2. **Python plugin tools** from `extensions.python_plugins`
184-
3. **MCP server tools** from `extensions.mcp_servers` (when implemented)
188+
2. **Documentation retrieval** - `retrieve_{community}_docs`
189+
3. **Page context** - `fetch_current_page` (if `enable_page_context: true`)
190+
4. **Additional tools** passed programmatically (if any)
191+
5. **Python plugin tools** from `extensions.python_plugins`
192+
6. **MCP server tools** from `extensions.mcp_servers` (when implemented)
185193

186194
All tools are available to the LLM simultaneously. The system prompt should guide the LLM on when to use each tool.

docs/osa/registry/schema-reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ List of documentation sources. Each entry creates a retrievable document.
7777
| `preload` | boolean | No | `false` | Embed in system prompt at startup |
7878
| `category` | string | No | `general` | Category for organization |
7979
| `type` | enum | No | `html` | Format: `sphinx`, `mkdocs`, `html`, `markdown`, `json` |
80+
| `source_repo` | string | No | `null` | GitHub repo for raw markdown sources (e.g., 'org/repo') |
8081
| `description` | string | No | `null` | Short description of document content |
8182

8283
### Preloaded vs On-Demand

0 commit comments

Comments
 (0)