session-viewer-plugin 0.1.2 → 0.1.4
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/README.md +8 -13
- package/frontend/dist-ui/index.mjs +4070 -4452
- package/frontend/dist-ui/style.css +1 -1
- package/package.json +3 -4
- package/server/dist/app.js +1 -2
- package/server/dist/bin.js +3 -3
- package/server/dist/index.js +1 -1
- package/server/dist/services/assembler.js +106 -20
- package/server/dist/services/config.js +1 -0
- package/server/dist/types/index.js +0 -1
- package/server/dist/api/cloudApi.js +0 -267
- package/server/dist/services/agcCredentials.js +0 -117
- package/server/dist/services/cloudError.js +0 -15
- package/server/dist/services/cloudStorage.js +0 -305
- package/server/dist/types/cloud.js +0 -1
package/README.md
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# session-viewer-plugin
|
|
2
2
|
|
|
3
|
-
会话指标查看插件:为 Vue3 + Element Plus
|
|
3
|
+
会话指标查看插件:为 Vue3 + Element Plus 宿主应用提供「本地会话浏览」页面组件,配套可挂载的服务端路由。云端文件管理能力已迁移至宿主 tnnotix。
|
|
4
4
|
|
|
5
5
|
- **本地会话**:扫描本机会话快照 JSON,按会话卡片、月度分组、收藏筛选浏览,并提供步骤时间线 / Token / 工具调用等图表的详情页。
|
|
6
|
-
- **云端数据**:管理 AGC(华为云存储)桶内文件:前缀浏览、全桶模糊搜索(定位 + 剪枝)、下载、重命名、删除、文件夹递归删除、复制下载令牌。
|
|
7
6
|
|
|
8
7
|
完整接入说明见 **[INTEGRATION.md](./INTEGRATION.md)**。
|
|
9
8
|
|
|
@@ -14,10 +13,10 @@
|
|
|
14
13
|
┌───────────────────────────────┐
|
|
15
14
|
│ 宿主服务进程 (:3000) │
|
|
16
15
|
│ 静态页面 + 插件组件(同源fetch) │
|
|
17
|
-
│ createApp() 挂载 /api 路由 ───┼──▶ 本机会话快照目录
|
|
16
|
+
│ createApp() 挂载 /api 路由 ───┼──▶ 本机会话快照目录
|
|
18
17
|
└───────────────────────────────┘
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
形态二(可选):独立运行 —— 分进程部署
|
|
21
20
|
宿主页面 ──baseUrl──▶ session-viewer-plugin bin (:3001) ──▶ 同上数据源
|
|
22
21
|
```
|
|
23
22
|
|
|
@@ -38,10 +37,10 @@ const svApp = createApp() // 未监听的 Express 实例,直接挂载/转发
|
|
|
38
37
|
```js
|
|
39
38
|
// 宿主前端(同源模式,不传 baseUrl)
|
|
40
39
|
import 'session-viewer-plugin/ui.css'
|
|
41
|
-
import { SessionViewer } from 'session-viewer-plugin/ui'
|
|
40
|
+
import { SessionViewer, SessionDetail } from 'session-viewer-plugin/ui'
|
|
42
41
|
```
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
**形态二(独立运行)**:
|
|
45
44
|
|
|
46
45
|
```bash
|
|
47
46
|
npx session-viewer-plugin # 默认 http://127.0.0.1:3001
|
|
@@ -51,7 +50,7 @@ npx session-viewer-plugin # 默认 http://127.0.0.1:3001
|
|
|
51
50
|
|
|
52
51
|
| 导出 | 说明 |
|
|
53
52
|
| --- | --- |
|
|
54
|
-
| `session-viewer-plugin/ui` | `SessionViewer` / `SessionDetail` / `
|
|
53
|
+
| `session-viewer-plugin/ui` | `SessionViewer` / `SessionDetail` / `API_BASE_KEY` / `setApiBase` 等基址工具 |
|
|
55
54
|
| `session-viewer-plugin/ui.css` | 组件样式 |
|
|
56
55
|
| `session-viewer-plugin/server` | `createApp()` 工厂(未监听的 Express 实例) |
|
|
57
56
|
| `npx session-viewer-plugin` | 独立服务 bin(`PORT` / `HOST` 环境变量) |
|
|
@@ -63,18 +62,14 @@ npx session-viewer-plugin # 默认 http://127.0.0.1:3001
|
|
|
63
62
|
| 变量 | 默认值 | 说明 |
|
|
64
63
|
| --- | --- | --- |
|
|
65
64
|
| `LOG_DIR` | 内置目录集 | 会话快照扫描目录(单目录);默认自动探测 hm-plugin-nodejs 与 opencode-metrics-plugin 的标准落盘目录(Linux 为 `~/.local/state/opencode-metrics-plugin/metrics`) |
|
|
66
|
-
| `AGC_CREDENTIALS_FILE` | - | AGC 凭证 JSON 文件路径 |
|
|
67
|
-
| `AGC_CREDENTIALS_JSON` | - | AGC 凭证内联 JSON 字符串 |
|
|
68
65
|
| `PORT` | `3001` | 独立服务监听端口(bin 形态) |
|
|
69
|
-
| `HOST` | `127.0.0.1` |
|
|
66
|
+
| `HOST` | `127.0.0.1` | 独立服务绑定地址;容器/跨机访问需设 `0.0.0.0`(bin 形态) |
|
|
70
67
|
|
|
71
68
|
**样本目录**:默认扫描目录还包含 `<opencode-metrics-plugin 日志根>/samples`(Windows `%LOCALAPPDATA%\opencode-metrics-plugin\Log\samples`,macOS `~/Library/Logs/opencode-metrics-plugin/samples`)。外部/分析样本(他人机器的会话快照)请放入该目录:仅用于可视化查看,插件孤儿补传只扫 metrics 目录本身,不会上传此处文件。服务启动时自动创建该目录。
|
|
72
69
|
|
|
73
|
-
**AGC 凭证**:npm 包不含凭证文件。凭证归属 opencode-metrics-plugin(AGC 桶上传方),运行时通过 `AGC_CREDENTIALS_FILE` / `AGC_CREDENTIALS_JSON` 注入;必填字段 `client_id`、`client_secret`、`project_id`、`bucket_name`,`region` 缺省 `CN`。未配置时本地会话功能不受影响,云端功能返回 503。
|
|
74
|
-
|
|
75
70
|
## 开发
|
|
76
71
|
|
|
77
|
-
|
|
72
|
+
仓库为前后端双包结构,既可作为 npm 包发布,也可独立运行:
|
|
78
73
|
|
|
79
74
|
```bash
|
|
80
75
|
npm run setup # 安装 server + frontend 依赖
|