Skip to content

Commit 471b8d5

Browse files
committed
feat: add provider-aware OAuth login for memory-pro
1 parent e7fbcc1 commit 471b8d5

13 files changed

+1814
-18
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules/
33
memory-plugin-feature-dev
44
memory-plugin-host-validation
55
memory-plugin-release-consistency
6+
.memory-lancedb-pro/oauth.json

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,12 @@ When `smartExtraction` is enabled (default: `true`), the plugin uses an LLM to i
509509
| Field | Type | Default | Description |
510510
|-------|------|---------|-------------|
511511
| `smartExtraction` | boolean | `true` | Enable/disable LLM-powered 6-category extraction |
512+
| `llm.auth` | string | `api-key` | `api-key` uses `llm.apiKey` / `embedding.apiKey`; `oauth` uses a project-scoped OAuth token file |
512513
| `llm.apiKey` | string | *(falls back to `embedding.apiKey`)* | API key for the LLM provider |
513514
| `llm.model` | string | `openai/gpt-oss-120b` | LLM model name |
514515
| `llm.baseURL` | string | *(falls back to `embedding.baseURL`)* | LLM API endpoint |
516+
| `llm.oauthProvider` | string | `openai-codex` | OAuth provider id used when `llm.auth` is `oauth` |
517+
| `llm.oauthPath` | string | `.memory-lancedb-pro/oauth.json` | Project-scoped OAuth token file used when `llm.auth` is `oauth` |
515518
| `extractMinMessages` | number | `2` | Minimum messages before extraction triggers |
516519
| `extractMaxChars` | number | `8000` | Maximum characters sent to the LLM |
517520

@@ -534,6 +537,21 @@ Full config (separate LLM endpoint):
534537
}
535538
```
536539

540+
OAuth `llm` config (use existing Codex / ChatGPT login cache for LLM calls):
541+
```json
542+
{
543+
"llm": { "auth": "oauth", "oauthProvider": "openai-codex", "model": "gpt-5.4", "oauthPath": ".memory-lancedb-pro/oauth.json" }
544+
}
545+
```
546+
547+
Notes for `llm.auth: "oauth"`:
548+
549+
- `llm.oauthProvider` is currently `openai-codex`.
550+
- OAuth tokens are project-scoped by default and should live in `.memory-lancedb-pro/oauth.json`.
551+
- You can set `llm.oauthPath` if you want to store that file somewhere else inside the project.
552+
- In `oauth` mode, leave `llm.baseURL` unset unless you intentionally want a custom ChatGPT/Codex-compatible backend.
553+
- This makes token rotation and revocation local to the project instead of sharing `~/.codex/auth.json` across unrelated workspaces.
554+
537555
Disable: `{ "smartExtraction": false }`
538556

539557
</details>
@@ -748,6 +766,9 @@ The **agent workspace** is the agent's working directory (default: `~/.openclaw/
748766
openclaw memory-pro list [--scope global] [--category fact] [--limit 20] [--json]
749767
openclaw memory-pro search "query" [--scope global] [--limit 10] [--json]
750768
openclaw memory-pro stats [--scope global] [--json]
769+
openclaw memory-pro auth login [--provider openai-codex] [--model gpt-5.4] [--oauth-path /abs/path/oauth.json]
770+
openclaw memory-pro auth status
771+
openclaw memory-pro auth logout
751772
openclaw memory-pro delete <id>
752773
openclaw memory-pro delete-bulk --scope global [--before 2025-01-01] [--dry-run]
753774
openclaw memory-pro export [--scope global] [--output memories.json]
@@ -757,6 +778,13 @@ openclaw memory-pro upgrade [--dry-run] [--batch-size 10] [--no-llm] [--limit N]
757778
openclaw memory-pro migrate check [--source /path]
758779
openclaw memory-pro migrate run [--source /path] [--dry-run] [--skip-existing]
759780
openclaw memory-pro migrate verify [--source /path]
781+
782+
OAuth login flow:
783+
784+
1. Run `openclaw memory-pro auth login`
785+
2. If `--provider` is omitted in an interactive terminal, the CLI shows an OAuth provider picker before opening the browser
786+
3. The command prints an authorization URL and opens your browser unless `--no-browser` is set
787+
4. After the callback succeeds, the command saves a project OAuth file and replaces the plugin `llm` config with OAuth settings (`auth`, `oauthProvider`, `model`, `oauthPath`)
760788
```
761789

762790
---

README_CN.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,12 @@ OpenClaw 默认行为:
508508
| 字段 | 类型 | 默认值 | 说明 |
509509
|------|------|--------|------|
510510
| `smartExtraction` | boolean | `true` | 是否启用 LLM 智能 6 类别提取 |
511+
| `llm.auth` | string | `api-key` | `api-key` 使用 `llm.apiKey` / `embedding.apiKey``oauth` 使用项目级 OAuth token 文件 |
511512
| `llm.apiKey` | string | *(复用 `embedding.apiKey`* | LLM 提供商 API Key |
512513
| `llm.model` | string | `openai/gpt-oss-120b` | LLM 模型名称 |
513514
| `llm.baseURL` | string | *(复用 `embedding.baseURL`* | LLM API 端点 |
515+
| `llm.oauthProvider` | string | `openai-codex` | `llm.auth``oauth` 时使用的 OAuth provider id |
516+
| `llm.oauthPath` | string | `.memory-lancedb-pro/oauth.json` | `llm.auth``oauth` 时使用的项目级 OAuth token 文件 |
514517
| `extractMinMessages` | number | `2` | 触发提取所需最少消息数 |
515518
| `extractMaxChars` | number | `8000` | 发送给 LLM 的最大字符数 |
516519

@@ -533,6 +536,20 @@ OpenClaw 默认行为:
533536
}
534537
```
535538

539+
OAuth `llm` 配置(复用现有 Codex / ChatGPT 登录态进行 LLM 调用):
540+
```json
541+
{
542+
"llm": { "auth": "oauth", "oauthProvider": "openai-codex", "model": "gpt-5.4", "oauthPath": ".memory-lancedb-pro/oauth.json" }
543+
}
544+
```
545+
546+
`llm.auth: "oauth"` 说明:
547+
548+
- `llm.oauthProvider` 当前仅支持 `openai-codex`
549+
- OAuth token 默认按项目存放在 `.memory-lancedb-pro/oauth.json`
550+
- 如需自定义路径,可设置 `llm.oauthPath`
551+
- `oauth` 模式下除非你明确要覆盖为自定义 ChatGPT/Codex 兼容后端,否则不要设置 `llm.baseURL`
552+
536553
禁用:`{ "smartExtraction": false }`
537554

538555
</details>
@@ -747,6 +764,9 @@ Key 存储:不要提交到 git。使用 `${...}` 环境变量时确保 Gateway
747764
openclaw memory-pro list [--scope global] [--category fact] [--limit 20] [--json]
748765
openclaw memory-pro search "query" [--scope global] [--limit 10] [--json]
749766
openclaw memory-pro stats [--scope global] [--json]
767+
openclaw memory-pro auth login [--provider openai-codex] [--model gpt-5.4] [--oauth-path /abs/path/oauth.json]
768+
openclaw memory-pro auth status
769+
openclaw memory-pro auth logout
750770
openclaw memory-pro delete <id>
751771
openclaw memory-pro delete-bulk --scope global [--before 2025-01-01] [--dry-run]
752772
openclaw memory-pro export [--scope global] [--output memories.json]

0 commit comments

Comments
 (0)