@binarycheater/research-sidecar 0.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/LICENSE +21 -0
- package/README.md +244 -0
- package/README.zh.md +244 -0
- package/bin/research-sidecar.mjs +87 -0
- package/dist/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/client/assets/index-BpVgCKdz.css +1 -0
- package/dist/client/assets/index-D7VDrQ1Q.js +324 -0
- package/dist/client/index.html +13 -0
- package/dist-server/lib/context.js +70 -0
- package/dist-server/lib/files.js +118 -0
- package/dist-server/lib/graphDiscovery.js +69 -0
- package/dist-server/lib/openaiProvider.js +89 -0
- package/dist-server/lib/prompt.js +30 -0
- package/dist-server/lib/researchGraph.js +144 -0
- package/dist-server/lib/researchGraphManifest.js +221 -0
- package/dist-server/lib/sidebarLayout.js +17 -0
- package/dist-server/lib/store.js +190 -0
- package/dist-server/lib/tools.js +205 -0
- package/dist-server/lib/types.js +1 -0
- package/dist-server/lib/workspaceInstall.js +157 -0
- package/dist-server/lib/workspaceMeta.js +171 -0
- package/dist-server/server/config.js +82 -0
- package/dist-server/server/index.js +365 -0
- package/package.json +83 -0
- package/scripts/codex-sidecar.mjs +325 -0
- package/scripts/prepare-package.mjs +14 -0
- package/skills/research-graph-sop/SKILL.md +183 -0
- package/skills/research-graph-sop/agents/openai.yaml +4 -0
- package/skills/scholar-mode/SKILL.md +34 -0
- package/skills/scholar-mode/agents/openai.yaml +4 -0
- package/skills/sidecar-thinking/SKILL.md +67 -0
- package/skills/sidecar-thinking/agents/openai.yaml +4 -0
- package/skills/writing-explanatory-reports/SKILL.md +134 -0
- package/skills/writing-explanatory-reports/agents/openai.yaml +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BinaryCheater
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# Research Sidecar
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
Research Sidecar is a local web app and npm CLI for graph-backed research work. It is designed to run beside Codex: Codex can create or update research notes, while Research Sidecar gives you a readable graph, document preview, and explicit review surface for judging the work.
|
|
6
|
+
|
|
7
|
+
The important rule is simple: **the directory where you run `research-sidecar` is the workspace**. The app reads and writes only inside that workspace, and stores private local state under `.side/`.
|
|
8
|
+
|
|
9
|
+
## Why It Exists
|
|
10
|
+
|
|
11
|
+
Research work often starts from vague questions and evolves through experiments, reports, partial conclusions, and revisions. A linear folder of Markdown files becomes hard to inspect. Research Sidecar separates the problem into three layers:
|
|
12
|
+
|
|
13
|
+
- `graph.yaml`: the structural map of questions, methods, claims, evidence, tasks, and outputs.
|
|
14
|
+
- Markdown/HTML files: the detailed reasoning, experiment reports, tables, formulas, and drafts.
|
|
15
|
+
- `.side/`: local private app state, selected graph, sessions, and provider config.
|
|
16
|
+
|
|
17
|
+
This gives Codex a concrete structure to maintain while giving the human reader a compact interface for understanding what happened.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
Global install:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g @binarycheater/research-sidecar
|
|
25
|
+
cd ~/Research/project-a
|
|
26
|
+
research-sidecar
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Project-local install:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cd ~/Research/project-a
|
|
33
|
+
npm install -D @binarycheater/research-sidecar
|
|
34
|
+
npx research-sidecar
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Open:
|
|
38
|
+
|
|
39
|
+
```txt
|
|
40
|
+
http://localhost:4317
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## CLI Commands
|
|
44
|
+
|
|
45
|
+
Start the app for the current directory:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
research-sidecar
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Start with an explicit graph for this run:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
research-sidecar --graph dingyi/synthetic/graph.yaml
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Initialize workspace state:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
research-sidecar init --graph research/graph.yaml
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Install bundled skills into the workspace:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
research-sidecar install-skills
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Useful options:
|
|
70
|
+
|
|
71
|
+
- `--workspace /path/to/workspace`: override the current directory as workspace.
|
|
72
|
+
- `--graph path/to/graph.yaml`: set the graph manifest path inside the workspace.
|
|
73
|
+
- `--port 4317`: choose the HTTP port.
|
|
74
|
+
- `--force`: overwrite install-managed starter graph or skill files for `init` / `install-skills`.
|
|
75
|
+
- `--no-graph`: initialize `.side/` without creating a starter graph.
|
|
76
|
+
- `--no-skills`: initialize `.side/` without copying bundled skills.
|
|
77
|
+
|
|
78
|
+
## Workspace Config
|
|
79
|
+
|
|
80
|
+
Workspace config lives at:
|
|
81
|
+
|
|
82
|
+
```txt
|
|
83
|
+
<workspace>/.side/config.json
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Example:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"defaultModel": "deepseek-v4-pro",
|
|
91
|
+
"openaiBaseURL": "https://api.deepseek.com",
|
|
92
|
+
"apiMode": "chat",
|
|
93
|
+
"graph": {
|
|
94
|
+
"manifestPath": "dingyi/synthetic/graph.yaml"
|
|
95
|
+
},
|
|
96
|
+
"tools": {
|
|
97
|
+
"allowedWriteExtensions": [".md", ".markdown", ".html", ".htm", ".yaml", ".yml"]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The UI can update `graph.manifestPath`: choose a graph in the Graph panel and click **Save graph**. This writes the selected graph to `.side/config.json`.
|
|
103
|
+
|
|
104
|
+
Keep `.side/` out of git. It can contain API keys and private session history.
|
|
105
|
+
|
|
106
|
+
## Graph Discovery And Link Rules
|
|
107
|
+
|
|
108
|
+
The app searches the whole workspace for graph candidates:
|
|
109
|
+
|
|
110
|
+
- `graph.yaml`
|
|
111
|
+
- `graph.yml`
|
|
112
|
+
- `*.graph.yaml`
|
|
113
|
+
- `*.graph.yml`
|
|
114
|
+
|
|
115
|
+
It ignores dependency/build folders such as `node_modules`, `dist`, `dist-server`, `.git`, and `.side`.
|
|
116
|
+
|
|
117
|
+
If a workspace contains more than one graph, choose the current one in the UI. The selected graph is persisted in `.side/config.json`.
|
|
118
|
+
|
|
119
|
+
Inside a graph, file links are relative to the graph file's directory by default:
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
nodes:
|
|
123
|
+
- id: rq.main
|
|
124
|
+
title: Main question
|
|
125
|
+
type: question
|
|
126
|
+
file: ./rq.main.md
|
|
127
|
+
|
|
128
|
+
- id: evidence.stage1
|
|
129
|
+
title: Stage 1 report
|
|
130
|
+
type: evidence
|
|
131
|
+
file: reports/stage1.md
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
If the graph is at `dingyi/synthetic/graph.yaml`, those links resolve to:
|
|
135
|
+
|
|
136
|
+
```txt
|
|
137
|
+
dingyi/synthetic/rq.main.md
|
|
138
|
+
dingyi/synthetic/reports/stage1.md
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Use a leading `/` for a workspace-root-relative link:
|
|
142
|
+
|
|
143
|
+
```yaml
|
|
144
|
+
file: /shared/background.md
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Returned paths are normalized to workspace-relative paths so the UI, API, and tools use one stable form.
|
|
148
|
+
|
|
149
|
+
## Markdown, HTML, And LaTeX
|
|
150
|
+
|
|
151
|
+
Markdown previews support:
|
|
152
|
+
|
|
153
|
+
- GitHub-flavored Markdown
|
|
154
|
+
- tables
|
|
155
|
+
- fenced code blocks with readable colors
|
|
156
|
+
- inline math like `$x_i + y_i$`
|
|
157
|
+
- display math like:
|
|
158
|
+
|
|
159
|
+
```md
|
|
160
|
+
$$
|
|
161
|
+
\sum_i x_i
|
|
162
|
+
$$
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
HTML previews are sandboxed through workspace raw-file routes so relative links can resolve inside the workspace.
|
|
166
|
+
|
|
167
|
+
## Workspace Skills
|
|
168
|
+
|
|
169
|
+
Research Sidecar works best when workspace skills are installed:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
research-sidecar install-skills
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
This copies bundled skills into:
|
|
176
|
+
|
|
177
|
+
```txt
|
|
178
|
+
<workspace>/skills/
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Existing skill directories are skipped by default. Use `--force` when you intentionally want to overwrite install-managed skills.
|
|
182
|
+
|
|
183
|
+
The UI also has an **Install skills** button in the Graph sidebar. After installation, the app discovers `SKILL.md` files and can load relevant instructions into review context.
|
|
184
|
+
|
|
185
|
+
## Provider Configuration
|
|
186
|
+
|
|
187
|
+
Environment variables:
|
|
188
|
+
|
|
189
|
+
- `OPENAI_API_KEY`: required for model calls.
|
|
190
|
+
- `OPENAI_BASE_URL`: optional OpenAI-compatible endpoint, for example `https://api.deepseek.com`.
|
|
191
|
+
- `SIDECAR_DEFAULT_MODEL`: defaults to `gpt-5.5`.
|
|
192
|
+
- `SIDECAR_GRAPH_MANIFEST`: graph manifest path inside the workspace; overrides config for the run.
|
|
193
|
+
- `SIDECAR_WORKSPACE_ROOT`: workspace root; the CLI normally sets this from the current directory.
|
|
194
|
+
- `PORT`: defaults to `4317`.
|
|
195
|
+
|
|
196
|
+
Official OpenAI endpoints use the Responses API. OpenAI-compatible non-OpenAI endpoints use Chat Completions.
|
|
197
|
+
|
|
198
|
+
Example:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
OPENAI_BASE_URL=https://api.deepseek.com \
|
|
202
|
+
SIDECAR_DEFAULT_MODEL=deepseek-v4-pro \
|
|
203
|
+
research-sidecar
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Development
|
|
207
|
+
|
|
208
|
+
Use these commands when editing this source tree:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
npm install
|
|
212
|
+
npm run dev
|
|
213
|
+
npm test
|
|
214
|
+
npm run typecheck
|
|
215
|
+
npm run build
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
The development helper CLI is still available:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
npm run codex:install -- --workspace /path/to/workspace
|
|
222
|
+
npm run codex:call -- --title "Review" --context "Codex summary..." --file research/graph.yaml
|
|
223
|
+
npm run codex:ask -- --title "Review" --context "Codex summary..." --question "What is weak?"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Packaging
|
|
227
|
+
|
|
228
|
+
Before publishing or testing a local tarball:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
npm pack --dry-run
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
The `prepack` script builds the client and server, then copies bundled skills into the package. The package includes:
|
|
235
|
+
|
|
236
|
+
- `bin/research-sidecar.mjs`
|
|
237
|
+
- `dist/client`
|
|
238
|
+
- `dist-server`
|
|
239
|
+
- `skills/research-graph-sop`
|
|
240
|
+
- `skills/scholar-mode`
|
|
241
|
+
- `skills/sidecar-thinking`
|
|
242
|
+
- `skills/writing-explanatory-reports`
|
|
243
|
+
- CLI helper scripts
|
|
244
|
+
- README files
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# Research Sidecar
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
Research Sidecar 是一个用于 graph-backed research workflow 的本地 Web 应用和 npm CLI。它适合和 Codex 一起工作:Codex 可以生成、澄清、修改研究笔记;Research Sidecar 提供可读的研究图、文档预览和明确的 review 界面,帮助人判断这些工作是否合理。
|
|
6
|
+
|
|
7
|
+
最重要的规则是:**你在哪里运行 `research-sidecar`,哪里就是 workspace**。应用只在这个 workspace 内读写文件,并把私有本地状态保存在 `.side/`。
|
|
8
|
+
|
|
9
|
+
## 为什么需要它
|
|
10
|
+
|
|
11
|
+
研究工作通常从模糊问题开始,逐步形成实验、报告、局部结论和修订。如果所有内容只是散落在 Markdown 文件里,人很难快速理解当前状态。Research Sidecar 把研究拆成三层:
|
|
12
|
+
|
|
13
|
+
- `graph.yaml`:研究结构图,包括问题、方法、claim、证据、任务和输出。
|
|
14
|
+
- Markdown/HTML 文件:详细推理、实验报告、表格、公式和草稿。
|
|
15
|
+
- `.side/`:本地私有状态,包括当前选择的 graph、session 和 provider 配置。
|
|
16
|
+
|
|
17
|
+
这样 Codex 有一个明确结构可以维护,人也能通过 UI 快速理解研究进展。
|
|
18
|
+
|
|
19
|
+
## 安装
|
|
20
|
+
|
|
21
|
+
全局安装:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g @binarycheater/research-sidecar
|
|
25
|
+
cd ~/Research/project-a
|
|
26
|
+
research-sidecar
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
安装到项目:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cd ~/Research/project-a
|
|
33
|
+
npm install -D @binarycheater/research-sidecar
|
|
34
|
+
npx research-sidecar
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
打开:
|
|
38
|
+
|
|
39
|
+
```txt
|
|
40
|
+
http://localhost:4317
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## CLI 命令
|
|
44
|
+
|
|
45
|
+
把当前目录作为 workspace 启动:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
research-sidecar
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
本次启动指定 graph:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
research-sidecar --graph dingyi/synthetic/graph.yaml
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
初始化 workspace 状态:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
research-sidecar init --graph research/graph.yaml
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
安装 bundled skills:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
research-sidecar install-skills
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
常用选项:
|
|
70
|
+
|
|
71
|
+
- `--workspace /path/to/workspace`:不用当前目录,显式指定 workspace。
|
|
72
|
+
- `--graph path/to/graph.yaml`:指定 workspace 内的 graph manifest。
|
|
73
|
+
- `--port 4317`:指定 HTTP 端口。
|
|
74
|
+
- `--force`:覆盖 init 或 install-skills 管理的 starter graph / skill 文件。
|
|
75
|
+
- `--no-graph`:只初始化 `.side/`,不创建 starter graph。
|
|
76
|
+
- `--no-skills`:只初始化 `.side/`,不复制 bundled skills。
|
|
77
|
+
|
|
78
|
+
## Workspace 配置
|
|
79
|
+
|
|
80
|
+
workspace 配置文件位于:
|
|
81
|
+
|
|
82
|
+
```txt
|
|
83
|
+
<workspace>/.side/config.json
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
示例:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"defaultModel": "deepseek-v4-pro",
|
|
91
|
+
"openaiBaseURL": "https://api.deepseek.com",
|
|
92
|
+
"apiMode": "chat",
|
|
93
|
+
"graph": {
|
|
94
|
+
"manifestPath": "dingyi/synthetic/graph.yaml"
|
|
95
|
+
},
|
|
96
|
+
"tools": {
|
|
97
|
+
"allowedWriteExtensions": [".md", ".markdown", ".html", ".htm", ".yaml", ".yml"]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
UI 可以更新 `graph.manifestPath`:在 Graph 面板里选择 graph,然后点击 **Save graph**。这个选择会写入 `.side/config.json`。
|
|
103
|
+
|
|
104
|
+
`.side/` 不应该进入 git,因为它可能包含 API key 和私有 session 历史。
|
|
105
|
+
|
|
106
|
+
## Graph 发现和链接规则
|
|
107
|
+
|
|
108
|
+
应用会在整个 workspace 中搜索 graph 候选:
|
|
109
|
+
|
|
110
|
+
- `graph.yaml`
|
|
111
|
+
- `graph.yml`
|
|
112
|
+
- `*.graph.yaml`
|
|
113
|
+
- `*.graph.yml`
|
|
114
|
+
|
|
115
|
+
会跳过依赖和构建目录,例如 `node_modules`、`dist`、`dist-server`、`.git`、`.side`。
|
|
116
|
+
|
|
117
|
+
如果 workspace 里有多个 graph,在 UI 中选择当前 graph。保存后,选择会持久化到 `.side/config.json`。
|
|
118
|
+
|
|
119
|
+
graph 里的文件链接默认相对 graph 文件所在目录:
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
nodes:
|
|
123
|
+
- id: rq.main
|
|
124
|
+
title: Main question
|
|
125
|
+
type: question
|
|
126
|
+
file: ./rq.main.md
|
|
127
|
+
|
|
128
|
+
- id: evidence.stage1
|
|
129
|
+
title: Stage 1 report
|
|
130
|
+
type: evidence
|
|
131
|
+
file: reports/stage1.md
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
如果 graph 位于 `dingyi/synthetic/graph.yaml`,这些链接会解析成:
|
|
135
|
+
|
|
136
|
+
```txt
|
|
137
|
+
dingyi/synthetic/rq.main.md
|
|
138
|
+
dingyi/synthetic/reports/stage1.md
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
如果需要从 workspace 根目录开始寻址,使用 `/` 前缀:
|
|
142
|
+
|
|
143
|
+
```yaml
|
|
144
|
+
file: /shared/background.md
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
服务端返回的路径会统一成 workspace-relative,方便 UI、API 和工具使用同一种路径形式。
|
|
148
|
+
|
|
149
|
+
## Markdown、HTML 和 LaTeX
|
|
150
|
+
|
|
151
|
+
Markdown 预览支持:
|
|
152
|
+
|
|
153
|
+
- GitHub-flavored Markdown
|
|
154
|
+
- 表格
|
|
155
|
+
- 可读颜色的 fenced code block
|
|
156
|
+
- 内嵌公式,例如 `$x_i + y_i$`
|
|
157
|
+
- 块级公式,例如:
|
|
158
|
+
|
|
159
|
+
```md
|
|
160
|
+
$$
|
|
161
|
+
\sum_i x_i
|
|
162
|
+
$$
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
HTML 预览通过 workspace raw-file route 进行加载,因此普通相对链接可以在 workspace 内解析。
|
|
166
|
+
|
|
167
|
+
## Workspace Skills
|
|
168
|
+
|
|
169
|
+
Research Sidecar 最好配合 workspace skills 使用:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
research-sidecar install-skills
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
这会把 bundled skills 复制到:
|
|
176
|
+
|
|
177
|
+
```txt
|
|
178
|
+
<workspace>/skills/
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
默认不会覆盖已有 skill 目录。如果你明确想覆盖 install-managed skills,使用 `--force`。
|
|
182
|
+
|
|
183
|
+
Graph 侧栏里也有 **Install skills** 按钮。安装后,应用会发现 `SKILL.md`,并在 review context 中加载相关指令。
|
|
184
|
+
|
|
185
|
+
## Provider 配置
|
|
186
|
+
|
|
187
|
+
环境变量:
|
|
188
|
+
|
|
189
|
+
- `OPENAI_API_KEY`:模型调用需要。
|
|
190
|
+
- `OPENAI_BASE_URL`:可选的 OpenAI-compatible endpoint,例如 `https://api.deepseek.com`。
|
|
191
|
+
- `SIDECAR_DEFAULT_MODEL`:默认 `gpt-5.5`。
|
|
192
|
+
- `SIDECAR_GRAPH_MANIFEST`:workspace 内的 graph manifest 路径;会覆盖本次运行的 config。
|
|
193
|
+
- `SIDECAR_WORKSPACE_ROOT`:workspace root;CLI 通常会用当前目录自动设置。
|
|
194
|
+
- `PORT`:默认 `4317`。
|
|
195
|
+
|
|
196
|
+
官方 OpenAI endpoint 使用 Responses API。非 OpenAI 的 OpenAI-compatible endpoint 使用 Chat Completions。
|
|
197
|
+
|
|
198
|
+
示例:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
OPENAI_BASE_URL=https://api.deepseek.com \
|
|
202
|
+
SIDECAR_DEFAULT_MODEL=deepseek-v4-pro \
|
|
203
|
+
research-sidecar
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## 开发
|
|
207
|
+
|
|
208
|
+
修改这个源码目录时使用:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
npm install
|
|
212
|
+
npm run dev
|
|
213
|
+
npm test
|
|
214
|
+
npm run typecheck
|
|
215
|
+
npm run build
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
开发辅助 CLI 仍然可用:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
npm run codex:install -- --workspace /path/to/workspace
|
|
222
|
+
npm run codex:call -- --title "Review" --context "Codex summary..." --file research/graph.yaml
|
|
223
|
+
npm run codex:ask -- --title "Review" --context "Codex summary..." --question "What is weak?"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## 打包
|
|
227
|
+
|
|
228
|
+
发布或测试本地 tarball 前运行:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
npm pack --dry-run
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
`prepack` 会构建 client 和 server,然后把 bundled skills 复制进包里。npm 包包含:
|
|
235
|
+
|
|
236
|
+
- `bin/research-sidecar.mjs`
|
|
237
|
+
- `dist/client`
|
|
238
|
+
- `dist-server`
|
|
239
|
+
- `skills/research-graph-sop`
|
|
240
|
+
- `skills/scholar-mode`
|
|
241
|
+
- `skills/sidecar-thinking`
|
|
242
|
+
- `skills/writing-explanatory-reports`
|
|
243
|
+
- CLI helper scripts
|
|
244
|
+
- README files
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { dirname, resolve } from "node:path";
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
const command = args[0] && !args[0].startsWith("-") ? args[0] : "start";
|
|
9
|
+
const commandArgs = command === "start" ? args : args.slice(1);
|
|
10
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
11
|
+
|
|
12
|
+
if (command === "help" || commandArgs.includes("--help") || commandArgs.includes("-h")) {
|
|
13
|
+
printHelp();
|
|
14
|
+
process.exit(0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (command === "init") {
|
|
18
|
+
const workspaceRoot = resolve(readOption(commandArgs, "--workspace") || process.cwd());
|
|
19
|
+
const graphManifestPath = readOption(commandArgs, "--graph") || "research/graph.yaml";
|
|
20
|
+
const { installWorkspaceScaffold } = await import(pathToFileURL(resolve(packageRoot, "dist-server/lib/workspaceInstall.js")).href);
|
|
21
|
+
const result = await installWorkspaceScaffold(workspaceRoot, {
|
|
22
|
+
graphManifestPath,
|
|
23
|
+
createGraph: !commandArgs.includes("--no-graph"),
|
|
24
|
+
installSkills: !commandArgs.includes("--no-skills"),
|
|
25
|
+
force: commandArgs.includes("--force")
|
|
26
|
+
});
|
|
27
|
+
console.log("Research Sidecar workspace initialized");
|
|
28
|
+
console.log(`Workspace: ${result.workspaceRoot}`);
|
|
29
|
+
console.log(`Config: ${result.configPath}`);
|
|
30
|
+
console.log(`Graph: ${result.graphManifestPath}${commandArgs.includes("--no-graph") ? " (not created)" : ""}`);
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (command === "install-skills") {
|
|
35
|
+
const workspaceRoot = resolve(readOption(commandArgs, "--workspace") || process.cwd());
|
|
36
|
+
const { installBundledSkills } = await import(pathToFileURL(resolve(packageRoot, "dist-server/lib/workspaceInstall.js")).href);
|
|
37
|
+
const result = await installBundledSkills(workspaceRoot, { force: commandArgs.includes("--force") });
|
|
38
|
+
console.log("Research Sidecar workspace skills installed");
|
|
39
|
+
console.log(`Workspace: ${workspaceRoot}`);
|
|
40
|
+
console.log(`Installed: ${result.installed.length ? result.installed.join(", ") : "none"}`);
|
|
41
|
+
console.log(`Skipped: ${result.skipped.length ? result.skipped.join(", ") : "none"}`);
|
|
42
|
+
process.exit(0);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (command !== "start") {
|
|
46
|
+
console.error(`Unknown command: ${command}`);
|
|
47
|
+
printHelp();
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const workspaceRoot = resolve(readOption(commandArgs, "--workspace") || process.cwd());
|
|
52
|
+
const graphManifestPath = readOption(commandArgs, "--graph");
|
|
53
|
+
const port = readOption(commandArgs, "--port");
|
|
54
|
+
const serverEntry = resolve(packageRoot, "dist-server/server/index.js");
|
|
55
|
+
const child = spawn(process.execPath, [serverEntry], {
|
|
56
|
+
cwd: packageRoot,
|
|
57
|
+
stdio: "inherit",
|
|
58
|
+
env: {
|
|
59
|
+
...process.env,
|
|
60
|
+
SIDECAR_WORKSPACE_ROOT: workspaceRoot,
|
|
61
|
+
...(graphManifestPath ? { SIDECAR_GRAPH_MANIFEST: graphManifestPath } : {}),
|
|
62
|
+
...(port ? { PORT: port } : {})
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
child.on("exit", (code, signal) => {
|
|
67
|
+
if (signal) process.kill(process.pid, signal);
|
|
68
|
+
process.exit(code ?? 0);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
function readOption(values, name) {
|
|
72
|
+
const index = values.indexOf(name);
|
|
73
|
+
if (index < 0) return undefined;
|
|
74
|
+
return values[index + 1];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function printHelp() {
|
|
78
|
+
console.log(`Usage:
|
|
79
|
+
research-sidecar [--workspace /path/to/workspace] [--graph path/to/graph.yaml] [--port 4317]
|
|
80
|
+
research-sidecar init [--graph path/to/graph.yaml] [--no-graph] [--no-skills] [--force]
|
|
81
|
+
research-sidecar install-skills [--force]
|
|
82
|
+
|
|
83
|
+
Default behavior:
|
|
84
|
+
The directory where you run research-sidecar becomes the workspace.
|
|
85
|
+
Workspace config is stored in .side/config.json.
|
|
86
|
+
`);
|
|
87
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|