docs: amend v3 plan to v3-final (no settings, fully dynamic model picker)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
1e42459560
commit
74de18646f
@@ -2,9 +2,9 @@
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: superpowers:subagent-driven-development or superpowers:executing-plans. Steps use checkbox (`- [ ]`) syntax.
|
||||
|
||||
**Goal:** 把 4 个 server 连接字段(URL/User/Password/Timeout)从 JupyterLab Settings 移到启动环境变量;Settings 只剩 `opencodeProvider`/`opencodeModel`;在 inline 输入框增加模型选择器。
|
||||
**Goal:** 把全部 server 连接字段(URL/User/Password/Timeout)从 JupyterLab Settings 移到启动环境变量;**opencode_bridge 插件完全不再使用 JupyterLab Settings Editor**(`schema/plugin.json` `properties: {}`);inline 输入框增加**完全动态的**模型选择器(无 settings 默认,默认第一项)。
|
||||
|
||||
**Architecture:** `config.py` 4 字段全走 `os.environ.get(ENV) or DEFAULT`(不再 `bridge.get(...)` 兜底);`schema/plugin.json` 删 4 个 property;`src/types.ts` `OpenCodeSettings` 缩为 `{opencodeProvider, opencodeModel}`;前端 `index.ts` 把 `callOpenCodeProviders` 结果通过 `setOpenCodeProviders` 写到 `opencode_cell_actions.ts` 模块级缓存;`OpenCodeInlinePrompt` 加 `providers/defaultProviderId/defaultModelId` 构造参数,渲染 `<select>`,`onSubmit(text, providerId, modelId)` 带选中的 provider/model;`OpenCodeCellActions` 用它覆盖 `OpenCodeRequest` 的 `providerId`/`modelId`。
|
||||
**Architecture:** `config.py` 4 字段全走 `os.environ.get(ENV) or DEFAULT`(`jupyter_settings` 参数保留仅为 API 兼容,实际未读);`schema/plugin.json` `properties: {}`(schema 只保留 `jupyter.lab.toolbars` 贡献);`src/types.ts` 整个 `OpenCodeSettings` 类型 / `DEFAULT_OPENCODE_SETTINGS` / `readOpenCodeSettings` **删除**;`setOpenCodeRuntime` 改名为 `setOpenCodeServerSettings({ serverSettings })`,只设 Jupyter `ServerConnection.ISettings`,模块级 `_settings` 移除只留 `_serverSettings` 与 `_providers`;`index.ts` 去掉 `ISettingRegistry` 与 `settingRegistry.load(...)` 整段,激活时直接 `setOpenCodeServerSettings(serverSettings)` + 注册 toolbar factory + 拉 providers 写缓存;`OpenCodeInlinePrompt` 构造加 `providers`(无 `defaultProviderId`/`defaultModelId`),默认选中第一项,providers 为 `null`/空时不渲染 select,`onSubmit(text, providerId?, modelId?)` 把选中带回;`OpenCodeCellActions._onSubmit` 用 prompt 回传的 `providerId`/`modelId` 写进 `OpenCodeRequest`,无 settings 兜底(providers 拉取失败时提交时省略 provider/model 字段,OpenCode 用默认)。
|
||||
|
||||
**Tech Stack:** TypeScript / Python 3.12 / jest / pytest-jupyter / stylelint / prettier
|
||||
|
||||
@@ -12,12 +12,14 @@
|
||||
|
||||
## Global Constraints
|
||||
|
||||
- `schema/plugin.json` **只**删 `opencodeServerUrl` / `opencodeServerUser` / `opencodeServerPassword` / `requestTimeoutSeconds` 4 个 property;`opencodeProvider` / `opencodeModel` 保留。
|
||||
- `src/types.ts` `OpenCodeSettings` 缩为 `{ opencodeProvider: string; opencodeModel: string }`,`DEFAULT_OPENCODE_SETTINGS` 同步;`readOpenCodeSettings` 同步(其余字段不再读)。
|
||||
- `opencode_bridge/config.py` 新增 `ENV_TIMEOUT = "OPENCODE_BRIDGE_TIMEOUT"` 与 `DEFAULT_REQUEST_TIMEOUT = 120`;`resolve_config` 4 个字段(`url`/`user`/`password`/`request_timeout_seconds`)全走 env+default,**不再** `bridge.get(...)`。
|
||||
- `schema/plugin.json` `properties: {}`(删全部 properties;`jupyter.lab.toolbars` 贡献保留:item 名 `opencode-cell-actions`,rank 100)。
|
||||
- `src/types.ts` **删除** `OpenCodeSettings` / `DEFAULT_OPENCODE_SETTINGS` / `readOpenCodeSettings` 整组;`src/__tests__/opencode_bridge.spec.ts` 中相关测试删除(若文件仅含 types 测试则整文件 `git rm`)。
|
||||
- `opencode_bridge/config.py` 新增 `ENV_TIMEOUT = "OPENCODE_BRIDGE_TIMEOUT"` 与 `DEFAULT_REQUEST_TIMEOUT = 120`;`resolve_config` 4 个字段(`url`/`user`/`password`/`request_timeout_seconds`)全走 `os.environ.get(ENV) or DEFAULT`,**不再** `bridge.get(...)` 兜底。
|
||||
- `setOpenCodeRuntime` → `setOpenCodeServerSettings`,签名 `{ serverSettings: ServerConnection.ISettings }`;模块级 `_settings` 删除,只留 `_serverSettings`(给 `callOpenCodeEdit` 拼 baseUrl)与 `_providers`(给 inline prompt 渲染 select)。
|
||||
- `index.ts` `optional` 去掉 `ISettingRegistry`;删除整个 `settingRegistry.load(...).then(setOpenCodeRuntime)` 段;激活时:`setOpenCodeServerSettings(serverSettings)` + 注册 toolbar factory + `callOpenCodeProviders(...).then(setOpenCodeProviders)`。
|
||||
- 模型选择器 value 格式: `providerId|modelId`(`|` 分隔,`split("|", 2)` 解析)。
|
||||
- 默认选中: 若 settings 的 `opencodeProvider`/`opencodeModel` 能在 providers 列表里找到对应项 → 选中它;否则选中第一项;若 providers 为 `null`/空 → 不渲染 select。
|
||||
- Providers 缓存模块级: `let _providers: OpenCodeProvidersResponse | null = null; export function setOpenCodeProviders(p) { _providers = p; }` 放在 `opencode_cell_actions.ts`(`setOpenCodeRuntime` 同文件),`index.ts` 在 `callOpenCodeProviders(...).then(...)` 里调。
|
||||
- 默认选中: **第一项**(无 settings 可作默认);若 `providers` 为 `null` 或空 → **不渲染** select,提交时 `providerId`/`modelId` 为 `undefined` → **不发**这两个字段。
|
||||
- Providers 缓存模块级: `let _providers: OpenCodeProvidersResponse | null = null; export function setOpenCodeProviders(p) { _providers = p; }` 放在 `opencode_cell_actions.ts`(`setOpenCodeServerSettings` 同文件),`index.ts` 在 `callOpenCodeProviders(...).then(...)` 里调。
|
||||
- 工具栏 item 名 `opencode-cell-actions` / rank 100 不变。
|
||||
- 不发 `mode` 字段(v2 约束保持)。
|
||||
- 代码风格 / 单测 / CSS 约束同前。
|
||||
|
||||
Reference in New Issue
Block a user