@appthen/sdk-core 0.0.0 → 0.0.2

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/dist/index.d.ts CHANGED
@@ -332,6 +332,29 @@ export interface ChatHubSubjectClassPreset {
332
332
  requiredExternalIdentity?: Record<string, unknown>;
333
333
  tags?: string[];
334
334
  notes?: string;
335
+ /**
336
+ * 类级 agent 运行配置(与服务端 SubjectClass.agentConfig 同形)。
337
+ * 人主体类缺省;agent 类用它声明能力/运行档偏好(provider/bindingDefaults 等)。
338
+ */
339
+ agentConfig?: {
340
+ capabilityId?: string;
341
+ capabilityIds?: string[];
342
+ provider?: string;
343
+ roleDefinition?: string;
344
+ toolPreset?: string;
345
+ permissionStrategy?: 'manual' | 'auto-allow' | 'auto-deny';
346
+ prompt?: Record<string, unknown>;
347
+ triggerModes?: string[];
348
+ bindingDefaults?: {
349
+ bindingId?: string;
350
+ projectId?: string;
351
+ workspaceId?: string;
352
+ modeId?: string;
353
+ model?: string;
354
+ thinkingOptionId?: string;
355
+ };
356
+ [key: string]: unknown;
357
+ };
335
358
  }
336
359
  export interface ChatHubSubjectPreset {
337
360
  subjectId: string;
@@ -612,5 +635,56 @@ export declare class PlatformApi extends BaseApi {
612
635
  syncSubject(targetTenantId: string, input: PlatformSyncSubjectInput): Promise<PlatformSyncSubjectResult>;
613
636
  resolveTenant(externalCorrelationId: string): Promise<PlatformResolveTenantResult>;
614
637
  toggleGrant(grantId: string, status: 'active' | 'revoked'): Promise<Record<string, unknown>>;
638
+ /**
639
+ * 按标签/条件圈人并直接触达(声明式,调用方无 subjectId 概念):
640
+ * 发送者/收件人按 {source, externalKey, displayName, avatarUrl?} 声明,
641
+ * 服务端 lazily create-or-get(幂等键 = externalIdentity,与成员同步同一内核);
642
+ * 收件人二选一:标签圈人(selector)或单点声明(receive,如微信客服消息迁移)。
643
+ */
644
+ notify(targetTenantId: string, request: PlatformNotifyRequest, notify: PlatformNotifyInput): Promise<PlatformNotifyResult>;
645
+ }
646
+ /** 声明式主体引用:调用方只需本地维护 id/昵称/头像,服务端 lazily create-or-get。 */
647
+ export interface PlatformLazySubject {
648
+ source: string;
649
+ externalKey: string;
650
+ displayName: string;
651
+ avatarUrl?: string;
652
+ }
653
+ export interface PlatformNotifySelector {
654
+ /** 圈人标签(多个取交集)。命名须带来源前缀,如 lims:role:admin。 */
655
+ tags: string[];
656
+ /** 限定主体类(可选)。 */
657
+ classId?: string;
658
+ }
659
+ export interface PlatformNotifyRequest {
660
+ /** 标签圈人(与 receive 二选一)。 */
661
+ selector?: PlatformNotifySelector;
662
+ /** 单点声明收件人(与 selector 二选一)。 */
663
+ receive?: PlatformLazySubject;
664
+ }
665
+ export interface PlatformNotifyInput {
666
+ /** 本次触达涉及的外部主体类(lazy 创建 sender/receiver 所用)。 */
667
+ classId: string;
668
+ /** 消息发送者(声明式,lazily create-or-get)。 */
669
+ sender: PlatformLazySubject;
670
+ /** 通知会话类型(须已存在;AppThen 侧预建或经 open/types 创建)。 */
671
+ typeId: string;
672
+ /** 消息类型('text' 起,语音播报后续走 kind 扩展)。 */
673
+ kind: string;
674
+ content: Record<string, unknown>;
675
+ /** 通知会话标题(首次创建时使用,默认「LIMS 通知」)。 */
676
+ title?: string;
677
+ metadata?: Record<string, unknown>;
678
+ }
679
+ export interface PlatformNotifyResult {
680
+ /** 圈中人数。 */
681
+ matched: number;
682
+ /** 成功送达人数。 */
683
+ delivered: number;
684
+ /** 失败明细(含原因,不中断整体)。 */
685
+ failed: Array<{
686
+ subjectId: string;
687
+ reason: string;
688
+ }>;
615
689
  }
616
690
  export {};
package/dist/index.js CHANGED
@@ -786,4 +786,17 @@ export class PlatformApi extends BaseApi {
786
786
  body: { status },
787
787
  });
788
788
  }
789
+ /**
790
+ * 按标签/条件圈人并直接触达(声明式,调用方无 subjectId 概念):
791
+ * 发送者/收件人按 {source, externalKey, displayName, avatarUrl?} 声明,
792
+ * 服务端 lazily create-or-get(幂等键 = externalIdentity,与成员同步同一内核);
793
+ * 收件人二选一:标签圈人(selector)或单点声明(receive,如微信客服消息迁移)。
794
+ */
795
+ async notify(targetTenantId, request, notify) {
796
+ return this.request({
797
+ method: 'POST',
798
+ path: '/open-platform/platform/messages:send',
799
+ body: { ...notify, ...request, targetTenantId },
800
+ });
801
+ }
789
802
  }
@@ -332,6 +332,29 @@ export interface ChatHubSubjectClassPreset {
332
332
  requiredExternalIdentity?: Record<string, unknown>;
333
333
  tags?: string[];
334
334
  notes?: string;
335
+ /**
336
+ * 类级 agent 运行配置(与服务端 SubjectClass.agentConfig 同形)。
337
+ * 人主体类缺省;agent 类用它声明能力/运行档偏好(provider/bindingDefaults 等)。
338
+ */
339
+ agentConfig?: {
340
+ capabilityId?: string;
341
+ capabilityIds?: string[];
342
+ provider?: string;
343
+ roleDefinition?: string;
344
+ toolPreset?: string;
345
+ permissionStrategy?: 'manual' | 'auto-allow' | 'auto-deny';
346
+ prompt?: Record<string, unknown>;
347
+ triggerModes?: string[];
348
+ bindingDefaults?: {
349
+ bindingId?: string;
350
+ projectId?: string;
351
+ workspaceId?: string;
352
+ modeId?: string;
353
+ model?: string;
354
+ thinkingOptionId?: string;
355
+ };
356
+ [key: string]: unknown;
357
+ };
335
358
  }
336
359
  export interface ChatHubSubjectPreset {
337
360
  subjectId: string;
@@ -612,5 +635,56 @@ export declare class PlatformApi extends BaseApi {
612
635
  syncSubject(targetTenantId: string, input: PlatformSyncSubjectInput): Promise<PlatformSyncSubjectResult>;
613
636
  resolveTenant(externalCorrelationId: string): Promise<PlatformResolveTenantResult>;
614
637
  toggleGrant(grantId: string, status: 'active' | 'revoked'): Promise<Record<string, unknown>>;
638
+ /**
639
+ * 按标签/条件圈人并直接触达(声明式,调用方无 subjectId 概念):
640
+ * 发送者/收件人按 {source, externalKey, displayName, avatarUrl?} 声明,
641
+ * 服务端 lazily create-or-get(幂等键 = externalIdentity,与成员同步同一内核);
642
+ * 收件人二选一:标签圈人(selector)或单点声明(receive,如微信客服消息迁移)。
643
+ */
644
+ notify(targetTenantId: string, request: PlatformNotifyRequest, notify: PlatformNotifyInput): Promise<PlatformNotifyResult>;
645
+ }
646
+ /** 声明式主体引用:调用方只需本地维护 id/昵称/头像,服务端 lazily create-or-get。 */
647
+ export interface PlatformLazySubject {
648
+ source: string;
649
+ externalKey: string;
650
+ displayName: string;
651
+ avatarUrl?: string;
652
+ }
653
+ export interface PlatformNotifySelector {
654
+ /** 圈人标签(多个取交集)。命名须带来源前缀,如 lims:role:admin。 */
655
+ tags: string[];
656
+ /** 限定主体类(可选)。 */
657
+ classId?: string;
658
+ }
659
+ export interface PlatformNotifyRequest {
660
+ /** 标签圈人(与 receive 二选一)。 */
661
+ selector?: PlatformNotifySelector;
662
+ /** 单点声明收件人(与 selector 二选一)。 */
663
+ receive?: PlatformLazySubject;
664
+ }
665
+ export interface PlatformNotifyInput {
666
+ /** 本次触达涉及的外部主体类(lazy 创建 sender/receiver 所用)。 */
667
+ classId: string;
668
+ /** 消息发送者(声明式,lazily create-or-get)。 */
669
+ sender: PlatformLazySubject;
670
+ /** 通知会话类型(须已存在;AppThen 侧预建或经 open/types 创建)。 */
671
+ typeId: string;
672
+ /** 消息类型('text' 起,语音播报后续走 kind 扩展)。 */
673
+ kind: string;
674
+ content: Record<string, unknown>;
675
+ /** 通知会话标题(首次创建时使用,默认「LIMS 通知」)。 */
676
+ title?: string;
677
+ metadata?: Record<string, unknown>;
678
+ }
679
+ export interface PlatformNotifyResult {
680
+ /** 圈中人数。 */
681
+ matched: number;
682
+ /** 成功送达人数。 */
683
+ delivered: number;
684
+ /** 失败明细(含原因,不中断整体)。 */
685
+ failed: Array<{
686
+ subjectId: string;
687
+ reason: string;
688
+ }>;
615
689
  }
616
690
  export {};
package/dist-cjs/index.js CHANGED
@@ -798,5 +798,18 @@ class PlatformApi extends BaseApi {
798
798
  body: { status },
799
799
  });
800
800
  }
801
+ /**
802
+ * 按标签/条件圈人并直接触达(声明式,调用方无 subjectId 概念):
803
+ * 发送者/收件人按 {source, externalKey, displayName, avatarUrl?} 声明,
804
+ * 服务端 lazily create-or-get(幂等键 = externalIdentity,与成员同步同一内核);
805
+ * 收件人二选一:标签圈人(selector)或单点声明(receive,如微信客服消息迁移)。
806
+ */
807
+ async notify(targetTenantId, request, notify) {
808
+ return this.request({
809
+ method: 'POST',
810
+ path: '/open-platform/platform/messages:send',
811
+ body: { ...notify, ...request, targetTenantId },
812
+ });
813
+ }
801
814
  }
802
815
  exports.PlatformApi = PlatformApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appthen/sdk-core",
3
- "version": "0.0.0",
3
+ "version": "0.0.2",
4
4
  "description": "AppThen Conversation Hub SDK - platform-agnostic core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",