@michengai/dsh-automation 0.1.12 → 0.1.13

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/lib/index.js CHANGED
@@ -22511,6 +22511,9 @@ var WEEKDAYS = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"];
22511
22511
  var RpcRequestError = class extends Error {
22512
22512
  name = "RpcRequestError";
22513
22513
  };
22514
+ function isBadRequest(error51) {
22515
+ return error51 instanceof RpcRequestError || error51 instanceof AutomationRequestError;
22516
+ }
22514
22517
  function record2(value, label) {
22515
22518
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
22516
22519
  throw new RpcRequestError(`${label} must be an object`);
@@ -22581,7 +22584,7 @@ function errorResult(error51, aborted2 = false) {
22581
22584
  };
22582
22585
  }
22583
22586
  const message = error51 instanceof Error ? error51.message : String(error51);
22584
- const badRequest = error51 instanceof RpcRequestError || error51 instanceof AutomationRequestError;
22587
+ const badRequest = isBadRequest(error51);
22585
22588
  return {
22586
22589
  ok: false,
22587
22590
  error: {
@@ -22729,6 +22732,10 @@ function registerAutomationRpc(ctx, service) {
22729
22732
  throw new RpcRequestError(`unknown automation endpoint '${endpoint}'`);
22730
22733
  }
22731
22734
  } catch (error51) {
22735
+ if (!signal.aborted && !isBadRequest(error51)) {
22736
+ const detail = error51 instanceof Error ? error51.stack ?? error51.message : String(error51);
22737
+ ctx.logger.warn(`dsh-automation: RPC '${endpoint}' failed: ${detail}`);
22738
+ }
22732
22739
  return errorResult(error51, signal.aborted);
22733
22740
  }
22734
22741
  }, { authority: "loopback" });
@@ -1,6 +1,9 @@
1
1
  /** 仅 loopback 的 Web 客户端 RPC 适配器。 */
2
2
  import { type AutomationService } from './service.ts';
3
3
  interface RpcContext {
4
+ readonly logger: {
5
+ warn(message: string): void;
6
+ };
4
7
  readonly connection: {
5
8
  readonly rpc: {
6
9
  handle(channel: string, handler: (endpoint: string, payload: unknown, signal: AbortSignal) => Promise<unknown>, options: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-automation",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "在独立 DSH Session 中按计划执行编码任务,支持 Web 设置页与 Agent 双入口管理。",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",