@77-zhike/app-sdk 0.2.0-d7b1.17 → 0.2.0-d7b1.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@77-zhike/app-sdk",
3
- "version": "0.2.0-d7b1.17",
3
+ "version": "0.2.0-d7b1.18",
4
4
  "description": "智客 Integration App 一期 SDK 与本地 Toolchain",
5
5
  "repository": {
6
6
  "type": "git",
@@ -67,5 +67,5 @@
67
67
  "optional": true
68
68
  }
69
69
  },
70
- "gitHead": "df9d8e305f4b9d603b33d41840847ee3d28a654b"
70
+ "gitHead": "9494f3959fd49fe5dd4d2f500ab6d3c041c7db00"
71
71
  }
@@ -21,7 +21,10 @@ export interface AppToolDefinition<Input, Output> {
21
21
  /** 缺省私有;公开查询声明不代替执行授权。 */
22
22
  aiExposure?: AppActionExposure;
23
23
  /** 同 App 静态 Tool Renderer;展示不授予服务端执行或业务写入权限。 */
24
- toolRenderer?: { key: string; showByDefault: boolean };
24
+ toolRenderer?: { key: string; showByDefault: boolean;
25
+ /** 成功结果中的标量身份路径(最多四段);同轮同安装/Action/Renderer/身份仅展示一次。仅控制展示,不跳过取数或授权。 */
26
+ dedupeBy?: string;
27
+ };
25
28
  /** 仅在所属安装的服务端执行环境运行,凭据沿用现有 Server SDK。 */
26
29
  execute(input: Input): Output | Promise<Output>;
27
30
  }
@@ -75,7 +75,10 @@ export function assertToolManifest(tool, entry) {
75
75
  }
76
76
 
77
77
  export function assertToolRendererReference(value) {
78
- record(value); keys(value, ['key', 'showByDefault']);
78
+ record(value); keys(value, ['key', 'showByDefault', 'dedupeBy']);
79
79
  if (typeof value.key !== 'string' || !KEY.test(value.key) || typeof value.showByDefault !== 'boolean') invalid();
80
+ if (value.dedupeBy !== undefined && (typeof value.dedupeBy !== 'string' || value.dedupeBy.length > 100
81
+ || !/^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*){0,3}$/.test(value.dedupeBy)
82
+ || value.dedupeBy.split('.').some(key => ['__proto__', 'prototype', 'constructor'].includes(key)))) invalid();
80
83
  return value;
81
84
  }