@modesto_ma/dsh-channels 0.6.0 → 0.7.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/README.md CHANGED
@@ -302,7 +302,7 @@ npm 发行包已包含构建产物:Host 入口是 `lib/index.js`(profile 直
302
302
  dmAllowWhitelist: false # guarded 下用户白名单里的人也可私聊(默认关:私聊仅管理员)
303
303
  adminUserId: 'a1b2c3d4' # 管理员 user_id(可留空,留空时自动使用应用所有者;都没有时 guarded 下拒绝所有对话;面板可改)
304
304
  authRequestTtlDays: 7 # 入群/用户授权申请卡有效期(天,1–30)
305
- analyzeEnabled: false # 日志平台分析接口开关(POST /api/dsh-channels.logalyze,挂在 DSH Web 端口;改后立即生效)
305
+ analyzeEnabled: false # 日志平台分析接口开关(POST /open-api/logalyze,挂在 DSH Web 端口;改后立即生效)
306
306
  analyzeToken: 'DSH_CHANNELS_ANALYZE_TOKEN' # 分析接口 Bearer 令牌的凭据引用名(值在面板填写或写进 .credentials.yaml)
307
307
  loggerLevel: 'info'
308
308
  ```
@@ -379,12 +379,12 @@ FEISHU_APP_SECRET: xxxxxxxx
379
379
 
380
380
  日志平台调用插件的分析接口:插件在指定群里发一张分析卡(发起人、触发时间、应用、错误码和日志详情页表格),在卡片下开话题,把平台给的 prompt 原样交给一个新 Session(prompt 开头的斜杠命令由 DSH 展开成对应 skill),分析过程在话题内流式输出,和用户自己发起的会话一样。分析结束后分析卡的状态标签随之更新。群里通过准入的成员都可以在该话题内追问。插件只负责接收 prompt 和开会话:日志包地址写在 prompt 里,下载、解压、超时都由日志分析 skill 自己处理(Session 的沙箱需要能访问日志存储地址)。
381
381
 
382
- **开启**:在面板「高级 → 日志分析接口」打开开关(`analyzeEnabled`,默认关,改后立即生效、不需要重连),并在同一处的「访问令牌」卡片填写令牌(建议 32 位以上随机串;写入 DSH 凭据库的 `DSH_CHANNELS_ANALYZE_TOKEN`,也可直接写进 `$DSH_HOME/.credentials.yaml`,引用名可用 `analyzeToken` 修改)。接口挂在 DSH Web 服务上(与 Web 界面同一端口),路径 `/api/dsh-channels.logalyze` 按 DSH 纯 HTTP 路由 `/api/<名字>.<方法>` 的命名;只有带 Web 的 profile(web、desktop)有这个接口,headless 没有。DSH 通过反向代理挂在前缀下时,地址随之带上前缀(如 `https://<域名>/dsh/api/dsh-channels.logalyze`)。该路由不走 DSH 登录 cookie,访问令牌是唯一凭据。开关关闭时所有请求返回 404;令牌每次请求都重新解析,轮换后下一次请求生效;令牌缺失时所有请求返回 503。
382
+ **开启**:在面板「高级 → 日志分析接口」打开开关(`analyzeEnabled`,默认关,改后立即生效、不需要重连),并在同一处的「访问令牌」卡片填写令牌(建议 32 位以上随机串;写入 DSH 凭据库的 `DSH_CHANNELS_ANALYZE_TOKEN`,也可直接写进 `$DSH_HOME/.credentials.yaml`,引用名可用 `analyzeToken` 修改)。接口挂在 DSH Web 服务上(与 Web 界面同一端口),路径 `/open-api/logalyze` 刻意放在 DSH 的 `/api` 之外,网关可以把它与需要登录的 DSH API 分开放行;只有带 Web 的 profile(web、desktop)有这个接口,headless 没有。DSH 通过反向代理挂在前缀下时,地址随之带上前缀(如 `https://<域名>/dsh/open-api/logalyze`)。该路由不走 DSH 登录 cookie,访问令牌是唯一凭据。开关关闭时所有请求返回 404;令牌每次请求都重新解析,轮换后下一次请求生效;令牌缺失时所有请求返回 503。
383
383
 
384
384
  **请求**:
385
385
 
386
386
  ```http
387
- POST /api/dsh-channels.logalyze
387
+ POST /open-api/logalyze
388
388
  Authorization: Bearer <令牌>
389
389
  Idempotency-Key: <平台生成的唯一值,1-200 个可见 ASCII 字符>
390
390
  Content-Type: application/json
package/lib/index.js CHANGED
@@ -7465,7 +7465,7 @@ var InboundRouter = class {
7465
7465
  /**
7466
7466
  * Wire contract of the log-platform analyze API.
7467
7467
  *
7468
- * `POST /api/dsh-channels.logalyze` on the DSH Web server, with
7468
+ * `POST /open-api/logalyze` on the DSH Web server, with
7469
7469
  * `Authorization: Bearer <token>`, an `Idempotency-Key` header, and a JSON
7470
7470
  * body naming the requester, the trigger time, the subject (application +
7471
7471
  * error code), the log-platform detail pages, the target group, and the
@@ -7477,11 +7477,12 @@ var InboundRouter = class {
7477
7477
  * @module dsh-channels/analyze/contract
7478
7478
  */
7479
7479
  /**
7480
- * Exact DSH Web route of the analyze API. It follows the host's plain-HTTP
7481
- * `/api/<name>.<method>` naming; an exact route wins over the `/api` RPC prefix
7482
- * route, so the request carries this API's bearer token, not a DSH login.
7480
+ * Exact DSH Web route of the analyze API. It sits outside DSH's `/api`
7481
+ * namespace so a gateway in front of DSH can expose it separately from the
7482
+ * login-protected DSH API; the request carries this API's bearer token, not a
7483
+ * DSH login.
7483
7484
  */
7484
- const ANALYZE_ROUTE = "/api/dsh-channels.logalyze";
7485
+ const ANALYZE_ROUTE = "/open-api/logalyze";
7485
7486
  /** Largest accepted request body (the prompt dominates it). */
7486
7487
  const ANALYZE_MAX_BODY_BYTES = 1024 * 1024;
7487
7488
  /** Largest accepted prompt, in characters. */
@@ -16228,7 +16229,7 @@ const configSchema = z.object({
16228
16229
  */
16229
16230
  questionTimeoutMs: z.number().int().min(1e4).max(36e5).default(DEFAULT_QUESTION_TIMEOUT_MS),
16230
16231
  /**
16231
- * Switch for the log-platform analyze API (`POST /api/dsh-channels.logalyze`
16232
+ * Switch for the log-platform analyze API (`POST /open-api/logalyze`
16232
16233
  * on the DSH Web server). Off (default) answers 404; read per request, so
16233
16234
  * toggling it needs no reconnect. Needs a host with a Web server.
16234
16235
  */
@@ -19676,7 +19677,7 @@ function mountSettingsRoutes(ctx, surface) {
19676
19677
  /**
19677
19678
  * The analyze API's HTTP route on the DSH Web server.
19678
19679
  *
19679
- * Registers the exact route `POST /api/dsh-channels.logalyze` (see
19680
+ * Registers the exact route `POST /open-api/logalyze` (see
19680
19681
  * `./contract.ts`) on the host `webServer`; hosts without one (headless) have
19681
19682
  * no analyze API. This module owns the transport-level checks, in order:
19682
19683
  * path, the `analyzeEnabled` switch, method, bearer token, `Idempotency-Key`,
@@ -19743,7 +19744,7 @@ async function readBody(req) {
19743
19744
  * @param handler - the business side.
19744
19745
  */
19745
19746
  async function handleAnalyzeHttp(req, res, handler) {
19746
- if (new URL(req.url ?? "/", "http://analyze.invalid").pathname !== "/api/dsh-channels.logalyze") {
19747
+ if (new URL(req.url ?? "/", "http://analyze.invalid").pathname !== "/open-api/logalyze") {
19747
19748
  refuse(res, 404, "未知路径");
19748
19749
  return;
19749
19750
  }
@@ -20312,7 +20313,7 @@ const FIELD_META = {
20312
20313
  label: "日志分析接口",
20313
20314
  group: "analyze",
20314
20315
  summary: "关闭时接口返回 404",
20315
- help: "接口挂在 DSH Web 端口上:POST /api/dsh-channels.logalyze,请求需带 Authorization: Bearer <访问令牌>。只有带 Web 的 profile 才有这个接口。改后立即生效,不需要重连。"
20316
+ help: "接口挂在 DSH Web 端口上:POST /open-api/logalyze,请求需带 Authorization: Bearer <访问令牌>。只有带 Web 的 profile 才有这个接口。改后立即生效,不需要重连。"
20316
20317
  },
20317
20318
  loggerLevel: {
20318
20319
  label: "SDK 日志级别",