@tbox.cn/app-module-member 0.9.6 → 0.9.8

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/AGENTS.md CHANGED
@@ -1,16 +1,14 @@
1
1
  # module-member —— 集成指引(AI 助手用)
2
2
 
3
- 本模块为商圈业务模块,声明消费以下服务槽(Port 接口定义见 `src/server/ports/`):
4
-
5
- - 服务槽清单:见 `tbox.module.json` 的 `contributes.services`(demand 侧,含 title/description meta)。
3
+ 本模块为商圈业务模块(会员:会员注册、卡面与权益查询)。服务槽、接口清单、接入依赖与可选降级见本包
4
+ `INTEGRATION.md`(真源);结构事实(槽位/必选性)见本包 `tbox.module.json`。
6
5
 
7
6
  ## 自定义 API 对接(AI 集成)
8
7
 
9
- 用户为本模块服务槽配置「自定义 API」后,adapter 实施落点 = `packages/provider-custom/`
10
- (会员:会员注册、卡面与权益查询)。实施步骤与完成判据见 `packages/provider-custom/AGENTS.md`;
11
- 本模块 Port 接口为 adapter 的实现契约(输入 `ServiceAdapterInput`:config/instanceId/credentialRef)。
8
+ 见本包 `INTEGRATION.md`(接入语义真源);实施落点与流程见应用根 `INTEGRATION.md`
9
+ 与 `packages/provider-custom/INTEGRATION.md`。
12
10
 
13
11
  ## 真实厂商接入
14
12
 
15
- 官方 provider 包形态(manifest 槽声明 + 独立包发布)参照 `modules/provider-mock`(极简形态)/ `modules/provider-mocktest`(带 configSchema 形态)结构样例与
16
- docs/reference/providers.md;厂商中立措辞纪律见该参考(本文件受 vendor-neutrality 门禁扫描)。
13
+ 见本包 `INTEGRATION.md`;官方 provider 包形态用 `tbox-app new provider <name>` 骨架
14
+ (应用态 `packages/provider-<id>` local 形态 / 仓库态 `modules/provider-<id>` 发布形态)。
package/INTEGRATION.md ADDED
@@ -0,0 +1,21 @@
1
+ # INTEGRATION —— module-member(会员积分)接入指引
2
+
3
+ > 结构事实以本包 `tbox.module.json` 为准(`declare.consumes`:槽位与必选性、`declare.owns`:
4
+ > 服务归属);接口签名以消费的契约包 Port 为准(`packages/contracts-mall/src/services/`);本文件只写二者推不出的接入语义。
5
+
6
+ ## 服务与依赖
7
+
8
+ - **五槽全必选**(consumes `optional:false`):member.account / member.profile / member.card /
9
+ member.benefits / member.enrollment——自定义 API 接入须逐一落声明并实现;`member.snapshot`
10
+ 聚合槽由底层槽派生,落声明时跳过。
11
+ - **身份键**:各 Port 方法入参 `userId` 由平台传入(登录态身份)——你的后端需能以该标识
12
+ 定位会员;若后端会员体系与平台 userId 无映射,需在接入时约定映射方案。
13
+ - **接入顺序**:入会链(member.enrollment 两步授权)依赖平台登录态先行(登录换码由
14
+ mall-core 承接——见 `packages/module-mall-core/INTEGRATION.md`);账户/卡面/权益/积分
15
+ 四读槽相互独立可并行实施。
16
+ - **可选能力**:`MemberEnrollmentPort.getEnrollmentFormDefinition?` 可选——后端无表单端点
17
+ 可不实现,调用方降级(入会走固定授权流,不出动态表单)。
18
+ - **幂等**:入会 `enroll` 由模块生成幂等键(`sha256(userId\0mallId\0formVersion)`)——
19
+ 同键重入应返回首果。
20
+ - **验收注意**:本模块无 InMemory 兜底(fail-visible)——绑定后未实施 adapter,工具调用
21
+ 报 `PROVIDER_NOT_IMPLEMENTED`,消失即接入完成。
@@ -867,7 +867,7 @@ function createQueryMemberInfoTool(ports) {
867
867
  const infoCard = {
868
868
  cardType: "member-info",
869
869
  data: facts,
870
- // note 契约(W7):账户态中文化 + 姓名要点
870
+ // note 契约:账户态中文化 + 姓名要点
871
871
  note: `\u4F1A\u5458\u8D26\u6237\uFF08${memberStateLabel(facts.state)}\uFF09${facts.displayName ? ` \xB7 ${facts.displayName}` : ""}`
872
872
  };
873
873
  if (account.state !== "active") {
@@ -1080,7 +1080,7 @@ function createMemberHandler(ctx) {
1080
1080
  return {
1081
1081
  id: "member",
1082
1082
  // match:'exact':偏好按钮发出的是固定整句值(member-card-summary 按钮组),
1083
- // 整句全等命中——不入 BM25 词袋(相似查询「2楼有啥美食可逛」曾被词袋误吞,F3)
1083
+ // 整句全等命中——不入 BM25 词袋(相似查询「2楼有啥美食可逛」曾被词袋误吞)
1084
1084
  intents: [{ patterns: [...MEMBER_PREFERENCE_VALUES], match: "exact" }],
1085
1085
  handle: async (action, payload, _ctx, reqCtx) => {
1086
1086
  if (action === "intent") {
@@ -1426,7 +1426,7 @@ function createMemberActions(ctx, resolveMember) {
1426
1426
  };
1427
1427
  }
1428
1428
  },
1429
- /** 4. 入会状态显式刷新(R4:无自动轮询) */
1429
+ /** 4. 入会状态显式刷新(无自动轮询) */
1430
1430
  queryEnrollmentStatus: {
1431
1431
  actionId: "member.query-enrollment-status",
1432
1432
  moduleId: "member",
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  resolveMemberEnrollmentPort,
8
8
  resolveMemberProfilePort,
9
9
  serverModule
10
- } from "./chunk-VU73BWYZ.js";
10
+ } from "./chunk-KLQHDDSD.js";
11
11
  import {
12
12
  clientModule
13
13
  } from "./chunk-GMHJMLRV.js";
@@ -6,13 +6,13 @@ import { ServerContext } from '@tbox.cn/app-agent-sdk-server';
6
6
  import { MemberAccountPort, MemberProfilePort, MemberCardPort, MemberBenefitsPort, MemberEnrollmentPort, MemberAccountSnapshot, MemberProfileSnapshot, MemberCardSnapshot, Points, MemberBenefitsSnapshot, MemberEnrollmentFormDefinition, PointUsageRecord, DiscountRule, MemberEnrollmentInput, MemberEnrollmentResult, MemberEnrollmentStatus } from '@tbox.cn/app-contracts-mall';
7
7
 
8
8
  /**
9
- * MemberService:商圈会员完整实现(011 K2 六 Port + 015 入会升级)。
9
+ * MemberService:商圈会员完整实现(六 Port + 015 入会升级)。
10
10
  * extends 契约 Port(保证满足消费方子集约束);完整接口只在本模块包内。
11
11
  */
12
12
  /**
13
13
  * InMemory 演示实现(仅供隔离单测;运行时注册与 Provider 解析不得使用)。
14
14
  * 017 槽位原子化后非 Port 成员归位:getEnrollmentFormDefinition 已收编
15
- * MemberEnrollmentPort optional 方法(R13);enrollUrl/loginUrl 为槽产物自由属性
15
+ * MemberEnrollmentPort optional 方法;enrollUrl/loginUrl 为槽产物自由属性
16
16
  * (enrollment/account 槽的类型视图见 ports.ts);audit 转 InMemory 私有观测成员。
17
17
  */
18
18
  interface MemberService extends MemberAccountPort, MemberProfilePort, MemberCardPort, MemberBenefitsPort, MemberEnrollmentPort {
@@ -151,10 +151,10 @@ declare const memberCards: {
151
151
  variant: zod.ZodEnum<["blue", "silver", "gold", "black"]>;
152
152
  labelsEmbedded: zod.ZodOptional<zod.ZodBoolean>;
153
153
  }, "strip", zod.ZodTypeAny, {
154
- variant: "silver" | "gold" | "blue" | "black";
154
+ variant: "blue" | "silver" | "gold" | "black";
155
155
  labelsEmbedded?: boolean | undefined;
156
156
  }, {
157
- variant: "silver" | "gold" | "blue" | "black";
157
+ variant: "blue" | "silver" | "gold" | "black";
158
158
  labelsEmbedded?: boolean | undefined;
159
159
  }>>;
160
160
  progress: zod.ZodOptional<zod.ZodObject<{
@@ -184,38 +184,38 @@ declare const memberCards: {
184
184
  title: zod.ZodOptional<zod.ZodString>;
185
185
  text: zod.ZodOptional<zod.ZodString>;
186
186
  }, "strip", zod.ZodTypeAny, {
187
- kind: "toast" | "miniapp" | "dialog";
188
- title?: string | undefined;
187
+ kind: "miniapp" | "dialog" | "toast";
189
188
  url?: string | undefined;
189
+ title?: string | undefined;
190
190
  text?: string | undefined;
191
191
  }, {
192
- kind: "toast" | "miniapp" | "dialog";
193
- title?: string | undefined;
192
+ kind: "miniapp" | "dialog" | "toast";
194
193
  url?: string | undefined;
194
+ title?: string | undefined;
195
195
  text?: string | undefined;
196
196
  }>>;
197
197
  }, "strip", zod.ZodTypeAny, {
198
198
  name: string;
199
199
  benefitRef: string;
200
+ iconUrl?: string | undefined;
200
201
  description?: string | undefined;
201
202
  action?: {
202
- kind: "toast" | "miniapp" | "dialog";
203
- title?: string | undefined;
203
+ kind: "miniapp" | "dialog" | "toast";
204
204
  url?: string | undefined;
205
+ title?: string | undefined;
205
206
  text?: string | undefined;
206
207
  } | undefined;
207
- iconUrl?: string | undefined;
208
208
  }, {
209
209
  name: string;
210
210
  benefitRef: string;
211
+ iconUrl?: string | undefined;
211
212
  description?: string | undefined;
212
213
  action?: {
213
- kind: "toast" | "miniapp" | "dialog";
214
- title?: string | undefined;
214
+ kind: "miniapp" | "dialog" | "toast";
215
215
  url?: string | undefined;
216
+ title?: string | undefined;
216
217
  text?: string | undefined;
217
218
  } | undefined;
218
- iconUrl?: string | undefined;
219
219
  }>, "many">>;
220
220
  preferencePrompts: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
221
221
  value: zod.ZodEnum<["我常来买衣服", "我常带娃来玩", "我常来吃美食"]>;
@@ -233,15 +233,15 @@ declare const memberCards: {
233
233
  cardRef: string;
234
234
  cardDisplay: string;
235
235
  availablePoints: number;
236
- presentation?: {
237
- variant: "silver" | "gold" | "blue" | "black";
238
- labelsEmbedded?: boolean | undefined;
239
- } | undefined;
240
236
  levelName?: string | undefined;
241
237
  cardImageUrl?: string | undefined;
242
238
  pointsRuleImageUrl?: string | undefined;
243
239
  pointsRuleContent?: string | undefined;
244
240
  pointsUrl?: string | undefined;
241
+ presentation?: {
242
+ variant: "blue" | "silver" | "gold" | "black";
243
+ labelsEmbedded?: boolean | undefined;
244
+ } | undefined;
245
245
  progress?: {
246
246
  message: string;
247
247
  daySpentCents: number;
@@ -251,14 +251,14 @@ declare const memberCards: {
251
251
  benefits?: {
252
252
  name: string;
253
253
  benefitRef: string;
254
+ iconUrl?: string | undefined;
254
255
  description?: string | undefined;
255
256
  action?: {
256
- kind: "toast" | "miniapp" | "dialog";
257
- title?: string | undefined;
257
+ kind: "miniapp" | "dialog" | "toast";
258
258
  url?: string | undefined;
259
+ title?: string | undefined;
259
260
  text?: string | undefined;
260
261
  } | undefined;
261
- iconUrl?: string | undefined;
262
262
  }[] | undefined;
263
263
  preferencePrompts?: {
264
264
  value: "我常来买衣服" | "我常带娃来玩" | "我常来吃美食";
@@ -270,15 +270,15 @@ declare const memberCards: {
270
270
  cardRef: string;
271
271
  cardDisplay: string;
272
272
  availablePoints: number;
273
- presentation?: {
274
- variant: "silver" | "gold" | "blue" | "black";
275
- labelsEmbedded?: boolean | undefined;
276
- } | undefined;
277
273
  levelName?: string | undefined;
278
274
  cardImageUrl?: string | undefined;
279
275
  pointsRuleImageUrl?: string | undefined;
280
276
  pointsRuleContent?: string | undefined;
281
277
  pointsUrl?: string | undefined;
278
+ presentation?: {
279
+ variant: "blue" | "silver" | "gold" | "black";
280
+ labelsEmbedded?: boolean | undefined;
281
+ } | undefined;
282
282
  progress?: {
283
283
  message: string;
284
284
  daySpentCents: number;
@@ -288,14 +288,14 @@ declare const memberCards: {
288
288
  benefits?: {
289
289
  name: string;
290
290
  benefitRef: string;
291
+ iconUrl?: string | undefined;
291
292
  description?: string | undefined;
292
293
  action?: {
293
- kind: "toast" | "miniapp" | "dialog";
294
- title?: string | undefined;
294
+ kind: "miniapp" | "dialog" | "toast";
295
295
  url?: string | undefined;
296
+ title?: string | undefined;
296
297
  text?: string | undefined;
297
298
  } | undefined;
298
- iconUrl?: string | undefined;
299
299
  }[] | undefined;
300
300
  preferencePrompts?: {
301
301
  value: "我常来买衣服" | "我常带娃来玩" | "我常来吃美食";
@@ -313,28 +313,28 @@ declare const memberCards: {
313
313
  usedAt: zod.ZodOptional<zod.ZodString>;
314
314
  description: zod.ZodOptional<zod.ZodString>;
315
315
  }, "strip", zod.ZodTypeAny, {
316
- usageRecordRef: string;
317
316
  title: string;
317
+ usageRecordRef: string;
318
318
  amount: string;
319
- usedAt?: string | undefined;
320
319
  description?: string | undefined;
320
+ usedAt?: string | undefined;
321
321
  }, {
322
- usageRecordRef: string;
323
322
  title: string;
323
+ usageRecordRef: string;
324
324
  amount: string;
325
- usedAt?: string | undefined;
326
325
  description?: string | undefined;
326
+ usedAt?: string | undefined;
327
327
  }>, "many">;
328
328
  total: zod.ZodNumber;
329
329
  }, "strip", zod.ZodTypeAny, {
330
330
  userId: string;
331
331
  balance: number;
332
332
  items: {
333
- usageRecordRef: string;
334
333
  title: string;
334
+ usageRecordRef: string;
335
335
  amount: string;
336
- usedAt?: string | undefined;
337
336
  description?: string | undefined;
337
+ usedAt?: string | undefined;
338
338
  }[];
339
339
  total: number;
340
340
  membershipLabel?: string | undefined;
@@ -342,11 +342,11 @@ declare const memberCards: {
342
342
  userId: string;
343
343
  balance: number;
344
344
  items: {
345
- usageRecordRef: string;
346
345
  title: string;
346
+ usageRecordRef: string;
347
347
  amount: string;
348
- usedAt?: string | undefined;
349
348
  description?: string | undefined;
349
+ usedAt?: string | undefined;
350
350
  }[];
351
351
  total: number;
352
352
  membershipLabel?: string | undefined;
@@ -366,18 +366,18 @@ declare const memberCards: {
366
366
  options: zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
367
367
  }, "strip", zod.ZodTypeAny, {
368
368
  type: "date" | "text" | "tel" | "select";
369
- required: boolean;
370
- label: string;
371
369
  fieldId: string;
370
+ label: string;
371
+ required: boolean;
372
372
  options?: string[] | undefined;
373
373
  readOnly?: boolean | undefined;
374
374
  prefill?: string | undefined;
375
375
  placeholder?: string | undefined;
376
376
  }, {
377
377
  type: "date" | "text" | "tel" | "select";
378
- required: boolean;
379
- label: string;
380
378
  fieldId: string;
379
+ label: string;
380
+ required: boolean;
381
381
  options?: string[] | undefined;
382
382
  readOnly?: boolean | undefined;
383
383
  prefill?: string | undefined;
@@ -392,78 +392,78 @@ declare const memberCards: {
392
392
  }, "strip", zod.ZodTypeAny, {
393
393
  title: string;
394
394
  required: boolean;
395
- version: string;
396
395
  consentId: string;
396
+ version: string;
397
397
  url?: string | undefined;
398
398
  }, {
399
399
  title: string;
400
400
  required: boolean;
401
- version: string;
402
401
  consentId: string;
402
+ version: string;
403
403
  url?: string | undefined;
404
404
  }>, "many">;
405
405
  authorization: zod.ZodObject<{
406
406
  status: zod.ZodEnum<["required", "authorized", "unavailable"]>;
407
407
  mobileMasked: zod.ZodOptional<zod.ZodString>;
408
408
  }, "strip", zod.ZodTypeAny, {
409
- status: "unavailable" | "required" | "authorized";
409
+ status: "required" | "authorized" | "unavailable";
410
410
  mobileMasked?: string | undefined;
411
411
  }, {
412
- status: "unavailable" | "required" | "authorized";
412
+ status: "required" | "authorized" | "unavailable";
413
413
  mobileMasked?: string | undefined;
414
414
  }>;
415
415
  manualNotice: zod.ZodOptional<zod.ZodString>;
416
416
  }, "strip", zod.ZodTypeAny, {
417
417
  userId: string;
418
418
  state: "unknown" | "active" | "not_enrolled" | "closed";
419
- authorization: {
420
- status: "unavailable" | "required" | "authorized";
421
- mobileMasked?: string | undefined;
422
- };
419
+ formVersion: string;
423
420
  fields: {
424
421
  type: "date" | "text" | "tel" | "select";
425
- required: boolean;
426
- label: string;
427
422
  fieldId: string;
423
+ label: string;
424
+ required: boolean;
428
425
  options?: string[] | undefined;
429
426
  readOnly?: boolean | undefined;
430
427
  prefill?: string | undefined;
431
428
  placeholder?: string | undefined;
432
429
  }[];
433
- formVersion: string;
434
430
  consents: {
435
431
  title: string;
436
432
  required: boolean;
437
- version: string;
438
433
  consentId: string;
434
+ version: string;
439
435
  url?: string | undefined;
440
436
  }[];
437
+ authorization: {
438
+ status: "required" | "authorized" | "unavailable";
439
+ mobileMasked?: string | undefined;
440
+ };
441
441
  manualNotice?: string | undefined;
442
442
  }, {
443
443
  userId: string;
444
444
  state: "unknown" | "active" | "not_enrolled" | "closed";
445
- authorization: {
446
- status: "unavailable" | "required" | "authorized";
447
- mobileMasked?: string | undefined;
448
- };
445
+ formVersion: string;
449
446
  fields: {
450
447
  type: "date" | "text" | "tel" | "select";
451
- required: boolean;
452
- label: string;
453
448
  fieldId: string;
449
+ label: string;
450
+ required: boolean;
454
451
  options?: string[] | undefined;
455
452
  readOnly?: boolean | undefined;
456
453
  prefill?: string | undefined;
457
454
  placeholder?: string | undefined;
458
455
  }[];
459
- formVersion: string;
460
456
  consents: {
461
457
  title: string;
462
458
  required: boolean;
463
- version: string;
464
459
  consentId: string;
460
+ version: string;
465
461
  url?: string | undefined;
466
462
  }[];
463
+ authorization: {
464
+ status: "required" | "authorized" | "unavailable";
465
+ mobileMasked?: string | undefined;
466
+ };
467
467
  manualNotice?: string | undefined;
468
468
  }>>;
469
469
  readonly 'member-enrollment-status': _tbox_cn_app_contracts.CardMeta<zod.ZodObject<{
@@ -474,13 +474,13 @@ declare const memberCards: {
474
474
  message: zod.ZodOptional<zod.ZodString>;
475
475
  }, "strip", zod.ZodTypeAny, {
476
476
  userId: string;
477
- state: "active" | "failed" | "pending_confirmation" | "confirmation_timeout";
477
+ state: "active" | "pending_confirmation" | "confirmation_timeout" | "failed";
478
478
  memberRef?: string | undefined;
479
479
  message?: string | undefined;
480
480
  attemptRef?: string | undefined;
481
481
  }, {
482
482
  userId: string;
483
- state: "active" | "failed" | "pending_confirmation" | "confirmation_timeout";
483
+ state: "active" | "pending_confirmation" | "confirmation_timeout" | "failed";
484
484
  memberRef?: string | undefined;
485
485
  message?: string | undefined;
486
486
  attemptRef?: string | undefined;
@@ -498,16 +498,16 @@ declare const memberCards: {
498
498
  authState: "authenticated";
499
499
  state: "not_enrolled" | "closed";
500
500
  title?: string | undefined;
501
- subtitle?: string | undefined;
502
501
  enrollUrl?: string | undefined;
502
+ subtitle?: string | undefined;
503
503
  perks?: string[] | undefined;
504
504
  }, {
505
505
  userId: string;
506
506
  authState: "authenticated";
507
507
  state: "not_enrolled" | "closed";
508
508
  title?: string | undefined;
509
- subtitle?: string | undefined;
510
509
  enrollUrl?: string | undefined;
510
+ subtitle?: string | undefined;
511
511
  perks?: string[] | undefined;
512
512
  }>>;
513
513
  readonly 'member-login-cta': _tbox_cn_app_contracts.CardMeta<zod.ZodObject<{
@@ -589,10 +589,10 @@ declare const serverModule: {
589
589
  variant: zod.ZodEnum<["blue", "silver", "gold", "black"]>;
590
590
  labelsEmbedded: zod.ZodOptional<zod.ZodBoolean>;
591
591
  }, "strip", zod.ZodTypeAny, {
592
- variant: "silver" | "gold" | "blue" | "black";
592
+ variant: "blue" | "silver" | "gold" | "black";
593
593
  labelsEmbedded?: boolean | undefined;
594
594
  }, {
595
- variant: "silver" | "gold" | "blue" | "black";
595
+ variant: "blue" | "silver" | "gold" | "black";
596
596
  labelsEmbedded?: boolean | undefined;
597
597
  }>>;
598
598
  progress: zod.ZodOptional<zod.ZodObject<{
@@ -622,38 +622,38 @@ declare const serverModule: {
622
622
  title: zod.ZodOptional<zod.ZodString>;
623
623
  text: zod.ZodOptional<zod.ZodString>;
624
624
  }, "strip", zod.ZodTypeAny, {
625
- kind: "toast" | "miniapp" | "dialog";
626
- title?: string | undefined;
625
+ kind: "miniapp" | "dialog" | "toast";
627
626
  url?: string | undefined;
627
+ title?: string | undefined;
628
628
  text?: string | undefined;
629
629
  }, {
630
- kind: "toast" | "miniapp" | "dialog";
631
- title?: string | undefined;
630
+ kind: "miniapp" | "dialog" | "toast";
632
631
  url?: string | undefined;
632
+ title?: string | undefined;
633
633
  text?: string | undefined;
634
634
  }>>;
635
635
  }, "strip", zod.ZodTypeAny, {
636
636
  name: string;
637
637
  benefitRef: string;
638
+ iconUrl?: string | undefined;
638
639
  description?: string | undefined;
639
640
  action?: {
640
- kind: "toast" | "miniapp" | "dialog";
641
- title?: string | undefined;
641
+ kind: "miniapp" | "dialog" | "toast";
642
642
  url?: string | undefined;
643
+ title?: string | undefined;
643
644
  text?: string | undefined;
644
645
  } | undefined;
645
- iconUrl?: string | undefined;
646
646
  }, {
647
647
  name: string;
648
648
  benefitRef: string;
649
+ iconUrl?: string | undefined;
649
650
  description?: string | undefined;
650
651
  action?: {
651
- kind: "toast" | "miniapp" | "dialog";
652
- title?: string | undefined;
652
+ kind: "miniapp" | "dialog" | "toast";
653
653
  url?: string | undefined;
654
+ title?: string | undefined;
654
655
  text?: string | undefined;
655
656
  } | undefined;
656
- iconUrl?: string | undefined;
657
657
  }>, "many">>;
658
658
  preferencePrompts: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
659
659
  value: zod.ZodEnum<["我常来买衣服", "我常带娃来玩", "我常来吃美食"]>;
@@ -671,15 +671,15 @@ declare const serverModule: {
671
671
  cardRef: string;
672
672
  cardDisplay: string;
673
673
  availablePoints: number;
674
- presentation?: {
675
- variant: "silver" | "gold" | "blue" | "black";
676
- labelsEmbedded?: boolean | undefined;
677
- } | undefined;
678
674
  levelName?: string | undefined;
679
675
  cardImageUrl?: string | undefined;
680
676
  pointsRuleImageUrl?: string | undefined;
681
677
  pointsRuleContent?: string | undefined;
682
678
  pointsUrl?: string | undefined;
679
+ presentation?: {
680
+ variant: "blue" | "silver" | "gold" | "black";
681
+ labelsEmbedded?: boolean | undefined;
682
+ } | undefined;
683
683
  progress?: {
684
684
  message: string;
685
685
  daySpentCents: number;
@@ -689,14 +689,14 @@ declare const serverModule: {
689
689
  benefits?: {
690
690
  name: string;
691
691
  benefitRef: string;
692
+ iconUrl?: string | undefined;
692
693
  description?: string | undefined;
693
694
  action?: {
694
- kind: "toast" | "miniapp" | "dialog";
695
- title?: string | undefined;
695
+ kind: "miniapp" | "dialog" | "toast";
696
696
  url?: string | undefined;
697
+ title?: string | undefined;
697
698
  text?: string | undefined;
698
699
  } | undefined;
699
- iconUrl?: string | undefined;
700
700
  }[] | undefined;
701
701
  preferencePrompts?: {
702
702
  value: "我常来买衣服" | "我常带娃来玩" | "我常来吃美食";
@@ -708,15 +708,15 @@ declare const serverModule: {
708
708
  cardRef: string;
709
709
  cardDisplay: string;
710
710
  availablePoints: number;
711
- presentation?: {
712
- variant: "silver" | "gold" | "blue" | "black";
713
- labelsEmbedded?: boolean | undefined;
714
- } | undefined;
715
711
  levelName?: string | undefined;
716
712
  cardImageUrl?: string | undefined;
717
713
  pointsRuleImageUrl?: string | undefined;
718
714
  pointsRuleContent?: string | undefined;
719
715
  pointsUrl?: string | undefined;
716
+ presentation?: {
717
+ variant: "blue" | "silver" | "gold" | "black";
718
+ labelsEmbedded?: boolean | undefined;
719
+ } | undefined;
720
720
  progress?: {
721
721
  message: string;
722
722
  daySpentCents: number;
@@ -726,14 +726,14 @@ declare const serverModule: {
726
726
  benefits?: {
727
727
  name: string;
728
728
  benefitRef: string;
729
+ iconUrl?: string | undefined;
729
730
  description?: string | undefined;
730
731
  action?: {
731
- kind: "toast" | "miniapp" | "dialog";
732
- title?: string | undefined;
732
+ kind: "miniapp" | "dialog" | "toast";
733
733
  url?: string | undefined;
734
+ title?: string | undefined;
734
735
  text?: string | undefined;
735
736
  } | undefined;
736
- iconUrl?: string | undefined;
737
737
  }[] | undefined;
738
738
  preferencePrompts?: {
739
739
  value: "我常来买衣服" | "我常带娃来玩" | "我常来吃美食";
@@ -751,28 +751,28 @@ declare const serverModule: {
751
751
  usedAt: zod.ZodOptional<zod.ZodString>;
752
752
  description: zod.ZodOptional<zod.ZodString>;
753
753
  }, "strip", zod.ZodTypeAny, {
754
- usageRecordRef: string;
755
754
  title: string;
755
+ usageRecordRef: string;
756
756
  amount: string;
757
- usedAt?: string | undefined;
758
757
  description?: string | undefined;
758
+ usedAt?: string | undefined;
759
759
  }, {
760
- usageRecordRef: string;
761
760
  title: string;
761
+ usageRecordRef: string;
762
762
  amount: string;
763
- usedAt?: string | undefined;
764
763
  description?: string | undefined;
764
+ usedAt?: string | undefined;
765
765
  }>, "many">;
766
766
  total: zod.ZodNumber;
767
767
  }, "strip", zod.ZodTypeAny, {
768
768
  userId: string;
769
769
  balance: number;
770
770
  items: {
771
- usageRecordRef: string;
772
771
  title: string;
772
+ usageRecordRef: string;
773
773
  amount: string;
774
- usedAt?: string | undefined;
775
774
  description?: string | undefined;
775
+ usedAt?: string | undefined;
776
776
  }[];
777
777
  total: number;
778
778
  membershipLabel?: string | undefined;
@@ -780,11 +780,11 @@ declare const serverModule: {
780
780
  userId: string;
781
781
  balance: number;
782
782
  items: {
783
- usageRecordRef: string;
784
783
  title: string;
784
+ usageRecordRef: string;
785
785
  amount: string;
786
- usedAt?: string | undefined;
787
786
  description?: string | undefined;
787
+ usedAt?: string | undefined;
788
788
  }[];
789
789
  total: number;
790
790
  membershipLabel?: string | undefined;
@@ -804,18 +804,18 @@ declare const serverModule: {
804
804
  options: zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
805
805
  }, "strip", zod.ZodTypeAny, {
806
806
  type: "date" | "text" | "tel" | "select";
807
- required: boolean;
808
- label: string;
809
807
  fieldId: string;
808
+ label: string;
809
+ required: boolean;
810
810
  options?: string[] | undefined;
811
811
  readOnly?: boolean | undefined;
812
812
  prefill?: string | undefined;
813
813
  placeholder?: string | undefined;
814
814
  }, {
815
815
  type: "date" | "text" | "tel" | "select";
816
- required: boolean;
817
- label: string;
818
816
  fieldId: string;
817
+ label: string;
818
+ required: boolean;
819
819
  options?: string[] | undefined;
820
820
  readOnly?: boolean | undefined;
821
821
  prefill?: string | undefined;
@@ -830,78 +830,78 @@ declare const serverModule: {
830
830
  }, "strip", zod.ZodTypeAny, {
831
831
  title: string;
832
832
  required: boolean;
833
- version: string;
834
833
  consentId: string;
834
+ version: string;
835
835
  url?: string | undefined;
836
836
  }, {
837
837
  title: string;
838
838
  required: boolean;
839
- version: string;
840
839
  consentId: string;
840
+ version: string;
841
841
  url?: string | undefined;
842
842
  }>, "many">;
843
843
  authorization: zod.ZodObject<{
844
844
  status: zod.ZodEnum<["required", "authorized", "unavailable"]>;
845
845
  mobileMasked: zod.ZodOptional<zod.ZodString>;
846
846
  }, "strip", zod.ZodTypeAny, {
847
- status: "unavailable" | "required" | "authorized";
847
+ status: "required" | "authorized" | "unavailable";
848
848
  mobileMasked?: string | undefined;
849
849
  }, {
850
- status: "unavailable" | "required" | "authorized";
850
+ status: "required" | "authorized" | "unavailable";
851
851
  mobileMasked?: string | undefined;
852
852
  }>;
853
853
  manualNotice: zod.ZodOptional<zod.ZodString>;
854
854
  }, "strip", zod.ZodTypeAny, {
855
855
  userId: string;
856
856
  state: "unknown" | "active" | "not_enrolled" | "closed";
857
- authorization: {
858
- status: "unavailable" | "required" | "authorized";
859
- mobileMasked?: string | undefined;
860
- };
857
+ formVersion: string;
861
858
  fields: {
862
859
  type: "date" | "text" | "tel" | "select";
863
- required: boolean;
864
- label: string;
865
860
  fieldId: string;
861
+ label: string;
862
+ required: boolean;
866
863
  options?: string[] | undefined;
867
864
  readOnly?: boolean | undefined;
868
865
  prefill?: string | undefined;
869
866
  placeholder?: string | undefined;
870
867
  }[];
871
- formVersion: string;
872
868
  consents: {
873
869
  title: string;
874
870
  required: boolean;
875
- version: string;
876
871
  consentId: string;
872
+ version: string;
877
873
  url?: string | undefined;
878
874
  }[];
875
+ authorization: {
876
+ status: "required" | "authorized" | "unavailable";
877
+ mobileMasked?: string | undefined;
878
+ };
879
879
  manualNotice?: string | undefined;
880
880
  }, {
881
881
  userId: string;
882
882
  state: "unknown" | "active" | "not_enrolled" | "closed";
883
- authorization: {
884
- status: "unavailable" | "required" | "authorized";
885
- mobileMasked?: string | undefined;
886
- };
883
+ formVersion: string;
887
884
  fields: {
888
885
  type: "date" | "text" | "tel" | "select";
889
- required: boolean;
890
- label: string;
891
886
  fieldId: string;
887
+ label: string;
888
+ required: boolean;
892
889
  options?: string[] | undefined;
893
890
  readOnly?: boolean | undefined;
894
891
  prefill?: string | undefined;
895
892
  placeholder?: string | undefined;
896
893
  }[];
897
- formVersion: string;
898
894
  consents: {
899
895
  title: string;
900
896
  required: boolean;
901
- version: string;
902
897
  consentId: string;
898
+ version: string;
903
899
  url?: string | undefined;
904
900
  }[];
901
+ authorization: {
902
+ status: "required" | "authorized" | "unavailable";
903
+ mobileMasked?: string | undefined;
904
+ };
905
905
  manualNotice?: string | undefined;
906
906
  }>>;
907
907
  readonly 'member-enrollment-status': _tbox_cn_app_contracts.CardMeta<zod.ZodObject<{
@@ -912,13 +912,13 @@ declare const serverModule: {
912
912
  message: zod.ZodOptional<zod.ZodString>;
913
913
  }, "strip", zod.ZodTypeAny, {
914
914
  userId: string;
915
- state: "active" | "failed" | "pending_confirmation" | "confirmation_timeout";
915
+ state: "active" | "pending_confirmation" | "confirmation_timeout" | "failed";
916
916
  memberRef?: string | undefined;
917
917
  message?: string | undefined;
918
918
  attemptRef?: string | undefined;
919
919
  }, {
920
920
  userId: string;
921
- state: "active" | "failed" | "pending_confirmation" | "confirmation_timeout";
921
+ state: "active" | "pending_confirmation" | "confirmation_timeout" | "failed";
922
922
  memberRef?: string | undefined;
923
923
  message?: string | undefined;
924
924
  attemptRef?: string | undefined;
@@ -936,16 +936,16 @@ declare const serverModule: {
936
936
  authState: "authenticated";
937
937
  state: "not_enrolled" | "closed";
938
938
  title?: string | undefined;
939
- subtitle?: string | undefined;
940
939
  enrollUrl?: string | undefined;
940
+ subtitle?: string | undefined;
941
941
  perks?: string[] | undefined;
942
942
  }, {
943
943
  userId: string;
944
944
  authState: "authenticated";
945
945
  state: "not_enrolled" | "closed";
946
946
  title?: string | undefined;
947
- subtitle?: string | undefined;
948
947
  enrollUrl?: string | undefined;
948
+ subtitle?: string | undefined;
949
949
  perks?: string[] | undefined;
950
950
  }>>;
951
951
  readonly 'member-login-cta': _tbox_cn_app_contracts.CardMeta<zod.ZodObject<{
@@ -7,7 +7,7 @@ import {
7
7
  resolveMemberEnrollmentPort,
8
8
  resolveMemberProfilePort,
9
9
  serverModule
10
- } from "../chunk-VU73BWYZ.js";
10
+ } from "../chunk-KLQHDDSD.js";
11
11
  export {
12
12
  InMemoryMemberService,
13
13
  memberCards,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-module-member",
3
- "version": "0.9.6",
3
+ "version": "0.9.8",
4
4
  "type": "module",
5
5
  "description": "商圈会员模块:会员账户、会员卡、积分流水与入会流程(codegen 源)。",
6
6
  "exports": {
@@ -18,10 +18,10 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "@tbox.cn/app-contracts": "0.12.3",
22
- "@tbox.cn/app-contracts-mall": "0.12.4",
23
- "@tbox.cn/app-agent-sdk-client": "0.1.3",
24
- "@tbox.cn/app-agent-sdk-server": "0.1.4"
21
+ "@tbox.cn/app-contracts": "0.13.0",
22
+ "@tbox.cn/app-contracts-mall": "0.13.0",
23
+ "@tbox.cn/app-agent-sdk-client": "0.1.6",
24
+ "@tbox.cn/app-agent-sdk-server": "0.2.3"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "zod": "3.25.76",
@@ -50,7 +50,8 @@
50
50
  "README.md",
51
51
  "LICENSE",
52
52
  "skills",
53
- "AGENTS.md"
53
+ "AGENTS.md",
54
+ "INTEGRATION.md"
54
55
  ],
55
56
  "engines": {
56
57
  "node": ">=20.0.0"
@@ -1,5 +1,5 @@
1
1
  /**
2
- * module-member 客户端卡片聚合(0.4.0 D6:一卡一目录;券面 0.4.0 净删——promotion 承接)。
2
+ * module-member 客户端卡片聚合(0.4.0 一卡一目录;券面 0.4.0 净删——promotion 承接)。
3
3
  */
4
4
  export { default as MemberInfoCard } from './member-info';
5
5
  export { default as MemberCardSummaryCard } from './member-card-summary';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * member-enrollment-form 富卡(0.4.0 D6/D10):受控表单 + select 渲染 + readOnly 预填锁定
2
+ * member-enrollment-form 富卡(0.4.0/):受控表单 + select 渲染 + readOnly 预填锁定
3
3
  * + 用户显式授权(无 mount 副作用)+ 客户端必填/必选校验。
4
4
  * payload 形状与 server inputSchema 一致(fieldValues Record / acceptedConsentIds / formVersion)。
5
5
  */
@@ -177,5 +177,5 @@ export function MemberEnrollmentFormCard(props: {
177
177
  );
178
178
  }
179
179
 
180
- // 0.4.0 D10 评审补位:提交/授权按钮全在卡内(依赖表单/授权上下文),自持动作跳过 SDK 默认按钮条
180
+ // 0.4.0 评审补位:提交/授权按钮全在卡内(依赖表单/授权上下文),自持动作跳过 SDK 默认按钮条
181
181
  export default markSelfRendering(MemberEnrollmentFormCard);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * member-enrollment-status 富卡(0.4.0 D6/D10):四态变体 + pending 刷新。
2
+ * member-enrollment-status 富卡(0.4.0/):四态变体 + pending 刷新。
3
3
  */
4
4
  import { useRef, useState } from 'react';
5
5
  import { ArrowClockwise, CheckCircle, Clock, WarningCircle } from '@phosphor-icons/react';
@@ -61,5 +61,5 @@ export function MemberEnrollmentStatusCard(props: {
61
61
  );
62
62
  }
63
63
 
64
- // 0.4.0 D10 评审补位:卡内"刷新状态"按钮(attemptRef 依赖卡数据)自持动作,跳过 SDK 默认按钮条
64
+ // 0.4.0 评审补位:卡内"刷新状态"按钮(attemptRef 依赖卡数据)自持动作,跳过 SDK 默认按钮条
65
65
  export default markSelfRendering(MemberEnrollmentStatusCard);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * member 展示纯函数(0.4.0 D6:状态文案/金额色/图标映射,可单测;券面函数 0.4.0 净删——promotion 承接)。
2
+ * member 展示纯函数(0.4.0 状态文案/金额色/图标映射,可单测;券面函数 0.4.0 净删——promotion 承接)。
3
3
  */
4
4
  /** 积分流水金额类:负支出 → 红(--tbox-primary),正收入 → 绿(--tbox-success) */
5
5
  export function pointAmountClass(amount: string): 'member-pu__amount--spend' | 'member-pu__amount--income' {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 图片 + 加载失败占位(0.4.0 D6:模块自持 ~20 行,禁跨模块依赖/基元封顶不破)。
2
+ * 图片 + 加载失败占位(0.4.0 模块自持 ~20 行,禁跨模块依赖/基元封顶不破)。
3
3
  * 源:POC shopping-guide 占位语义。src 缺省或加载失败 → 图标占位。
4
4
  */
5
5
  import { useEffect, useState } from 'react';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * module-member 客户端入口(与服务端 serverModule 对称)。
3
3
  */
4
- import './styles/member.css'; // 0.4.0 D1:模块自持 CSS(副作用 import,首行保证先行加载)
4
+ import './styles/member.css'; // 0.4.0 模块自持 CSS(副作用 import,首行保证先行加载)
5
5
 
6
6
  import type { CardComponent } from '@tbox.cn/app-contracts';
7
7
  import type { ClientContext, ClientModule } from '@tbox.cn/app-agent-sdk-client';
@@ -1,2 +1,2 @@
1
- /** 0.4.0 D1:模块自持 CSS(经 tsup loader: { '.css': 'copy' } 出货,样式在应用侧生效) */
1
+ /** 0.4.0 模块自持 CSS(经 tsup loader: { '.css': 'copy' } 出货,样式在应用侧生效) */
2
2
  declare module '*.css';
@@ -1,13 +1,13 @@
1
1
  /**
2
- * member 写动作(015 S4:入会协议首验切片)。
2
+ * member 写动作(入会协议首验切片)。
3
3
  *
4
4
  * 四动作(全 singleUse + grant 闭环;cards key = meta.cardType):
5
5
  * - member.request-alipay-authorization:返回授权 effect(dispatcher 补签 → client getAuthCode)
6
6
  * - member.complete-alipay-authorization:回调动作——消费 SDK createAlipayUserAuthorization
7
- * (011 J7 下沉物首个消费方),PII 经 ctx.state TTL 30min 最小集暂存(F2)
7
+ * 入会授权 PII 暂存(下沉物首个消费方):PII 经 ctx.state TTL 30min 最小集暂存
8
8
  * - member.enroll:身份解析(授权 profile 可信 mobile 强制覆盖 / manual 正则)+ consent 校验
9
- * + 幂等键 sha256(userId\0mallId\0formVersion)(W3:模块顶层 InMemoryIdempotencyStore)
10
- * - member.query-enrollment-status:显式刷新(R4:POC 自动轮询不迁)
9
+ * + 幂等键 sha256(userId\0mallId\0formVersion)(模块顶层 InMemoryIdempotencyStore)
10
+ * - member.query-enrollment-status:显式刷新(POC 自动轮询不迁)
11
11
  */
12
12
  import { createHash } from 'node:crypto';
13
13
  import type { ServerContext } from '@tbox.cn/app-agent-sdk-server';
@@ -16,13 +16,13 @@ import { parseMallScope } from '@tbox.cn/app-contracts-mall';
16
16
  import type { CardActionResult, RequestContext } from '@tbox.cn/app-contracts';
17
17
  import { z } from 'zod';
18
18
 
19
- /** PII 暂存命名空间(F2:TTL 30min + 最小字段 + enroll 成功即 consume 删除) */
19
+ /** PII 暂存命名空间(TTL 30min + 最小字段 + enroll 成功即 consume 删除) */
20
20
  export const MEMBER_PROFILE_NAMESPACE = 'member.enrollment.profile';
21
21
  const PROFILE_TTL_MS = 30 * 60 * 1000;
22
22
 
23
23
  const MOBILE_PATTERN = /^1[3-9]\d{9}$/;
24
24
 
25
- /** 授权 profile 最小集(F2:不落完整厂商响应) */
25
+ /** 授权 profile 最小集(不落完整厂商响应) */
26
26
  export interface StoredAuthorizationProfile {
27
27
  readonly mobile?: string;
28
28
  readonly displayName?: string;
@@ -37,7 +37,7 @@ const ENROLLMENT_CONSENTS = [
37
37
  { consentId: 'membership-terms', version: '1', title: '会员服务条款', required: false },
38
38
  ] as const;
39
39
 
40
- /** 模块顶层幂等单例(W3:IdempotencyStore 挂 HTTP gateway 非 ctx,模块自持) */
40
+ /** 模块顶层幂等单例(IdempotencyStore 挂 HTTP gateway 非 ctx,模块自持) */
41
41
  const enrollmentIdempotency = new InMemoryIdempotencyStore();
42
42
 
43
43
  export function buildEnrollmentIdempotencyKey(userId: string, mallId: string, formVersion: string): string {
@@ -145,7 +145,7 @@ export function createMemberActions(
145
145
  text: '授权未完成,已切换手动填写模式',
146
146
  };
147
147
  }
148
- // 011 J7 下沉物首个消费方:authCode → alipay.user.info.share
148
+ // 下沉物首个消费方:authCode → alipay.user.info.share
149
149
  let profile: StoredAuthorizationProfile;
150
150
  try {
151
151
  const authorized = await createAlipayUserAuthorization().authorizeUserProfile(authCode);
@@ -167,7 +167,7 @@ export function createMemberActions(
167
167
  text: '授权资料获取失败,已切换手动填写模式',
168
168
  };
169
169
  }
170
- // F2:PII 最小集 TTL 30min 暂存(enroll 时 consume 取走 = 用后即删)
170
+ // PII 最小集 TTL 30min 暂存(enroll 时 consume 取走 = 用后即删)
171
171
  await state.put(MEMBER_PROFILE_NAMESPACE, userId, profile, PROFILE_TTL_MS);
172
172
  return {
173
173
  card: buildFormCard({
@@ -222,7 +222,7 @@ export function createMemberActions(
222
222
  };
223
223
  }
224
224
 
225
- // 身份解析:授权 profile(consume 取走 = F2 用后即删)可信 mobile 强制覆盖
225
+ // 身份解析:授权 profile(consume 取走 = 用后即删)可信 mobile 强制覆盖
226
226
  const authorized = (await state.consume<StoredAuthorizationProfile>(MEMBER_PROFILE_NAMESPACE, userId)) ?? undefined;
227
227
  const manualMobile = fieldValues.mobile ?? '';
228
228
  const mobile = authorized?.mobile ?? manualMobile;
@@ -234,8 +234,8 @@ export function createMemberActions(
234
234
  };
235
235
  }
236
236
 
237
- // 幂等(W3:同键重入返回首果)
238
- // 评审修复(015 #5):payload 存 sha256 摘要——幂等占位不再驻留明文手机号(F2 单一暂存位语义)
237
+ // 幂等(同键重入返回首果)
238
+ // 评审修复(015 #5):payload 存 sha256 摘要——幂等占位不再驻留明文手机号(单一暂存位语义)
239
239
  const idempotencyKey = buildEnrollmentIdempotencyKey(userId, mallIdOf(reqCtx), ENROLLMENT_FORM_VERSION);
240
240
  const payloadTag = createHash('sha256').update(`${identity}:${mobile}`).digest('hex').slice(0, 16);
241
241
  const acquired = await enrollmentIdempotency.tryAcquire(idempotencyKey, payloadTag);
@@ -294,7 +294,7 @@ export function createMemberActions(
294
294
  },
295
295
  },
296
296
 
297
- /** 4. 入会状态显式刷新(R4:无自动轮询) */
297
+ /** 4. 入会状态显式刷新(无自动轮询) */
298
298
  queryEnrollmentStatus: {
299
299
  actionId: 'member.query-enrollment-status',
300
300
  moduleId: 'member',
@@ -307,7 +307,7 @@ export function createMemberActions(
307
307
  const userId = reqCtx?.identity?.userId ?? '';
308
308
  const member = await resolveMember(reqCtx);
309
309
  if (!userId || !attemptRef || !member) {
310
- // P0 原地更新:防御分支返回可见失败态(原 text 在 update 路径无消费者)
310
+ // 原地更新:防御分支返回可见失败态(原 text 在 update 路径无消费者)
311
311
  return {
312
312
  update: {
313
313
  data: {
@@ -1,9 +1,9 @@
1
1
  /**
2
- * member handler(011 K2;015:写动作拆至 action.ts,此处只保留意图路径出卡)。
2
+ * member handler;015:写动作拆至 action.ts,此处只保留意图路径出卡)。
3
3
  * - 查积分/信息/卡 → 出对应卡(LLM 路径走同名工具)。
4
4
  * - 会员偏好长期记忆(017 PRD):三项声明式 intent → ctx.memory 保存 + continueWith 续接导购。
5
5
  * - 上下文统一化:userId 来源 = 运行身份(reqCtx.identity.userId,handler 第四参)——
6
- * 旧 payload.userId 是模型注入面(P4-3),已删除;偏好分支同经 reqCtx 显式读取。
6
+ * 旧 payload.userId 是模型注入面,已删除;偏好分支同经 reqCtx 显式读取。
7
7
  */
8
8
  import type { HandlerDefinition, ServerContext } from '@tbox.cn/app-agent-sdk-server';
9
9
  import {
@@ -33,7 +33,7 @@ export function createMemberHandler(ctx: ServerContext): HandlerDefinition {
33
33
  return {
34
34
  id: 'member',
35
35
  // match:'exact':偏好按钮发出的是固定整句值(member-card-summary 按钮组),
36
- // 整句全等命中——不入 BM25 词袋(相似查询「2楼有啥美食可逛」曾被词袋误吞,F3)
36
+ // 整句全等命中——不入 BM25 词袋(相似查询「2楼有啥美食可逛」曾被词袋误吞)
37
37
  intents: [{ patterns: [...MEMBER_PREFERENCE_VALUES], match: 'exact' }],
38
38
  handle: async (action, payload, _ctx, reqCtx) => {
39
39
  if (action === 'intent') {
@@ -1,3 +1,10 @@
1
+ /**
2
+ * module-member 服务端入口(双端自注册闭环——见模块 AGENTS.md 与 INTEGRATION.md)。
3
+ * 职责:会员账户/资料/卡面/权益积分/入会五槽解析 + 查询工具四枚 + 门禁卡与入会表单卡六枚 +
4
+ * 会员门禁状态服务('member.status')与跨模块快览工厂('member.snapshot')。
5
+ * 入口约定:register 只注册不解析(resolveService 仅 handle/事件回调内);cards map 的
6
+ * key = meta.cardType;模块对象 satisfies ServerModule(禁类型标注——cards 泛化失效)。
7
+ */
1
8
  import type { ServerContext, ServerModule } from '@tbox.cn/app-agent-sdk-server';
2
9
  import { loadModuleSkills, withCardEmissionHint, withEarlyExecution } from '@tbox.cn/app-agent-sdk-server';
3
10
  import type { RequestContext } from '@tbox.cn/app-contracts';
@@ -57,7 +64,7 @@ const memberPorts = {
57
64
  };
58
65
 
59
66
  /** 工具实例顶层创建;每次 execute 解析当前请求的真实 C 端 Provider。
60
- * W2(2026-09-01):出卡工具创建点单点 wrap(description 追加预告知句)——
67
+ * (2026-09-01):出卡工具创建点单点 wrap(description 追加预告知句)——
61
68
  * 注册即 wrapped 实例;CTA/表单卡承载操作入口带 actions 句。
62
69
  * PR-2:三个纯查询工具(只读/幂等/execCtx 仅消费 requestContext)标注尽早执行
63
70
  * 白名单——env TBOX_EARLY_TOOL_EXECUTION=1 时参数流完即预执行;缺省 off 零行为。 */
@@ -145,16 +152,16 @@ export const serverModule = {
145
152
  ctx.cards.registerMap(cards);
146
153
  ctx.handlers.register(createMemberHandler(ctx));
147
154
 
148
- // 015 S4:入会四动作(register 闭包 ctx——动作 execute 内经 enrollment 槽解析 + ctx.state PII 暂存)
155
+ // 入会四动作(register 闭包 ctx——动作 execute 内经 enrollment 槽解析 + ctx.state PII 暂存)
149
156
  const actions = createMemberActions(ctx, (reqCtx) => resolveMemberEnrollmentPort(reqCtx, ctx));
150
157
  for (const action of Object.values(actions)) {
151
158
  ctx.cardActions.register(action);
152
159
  }
153
160
 
154
- // 015 D9:主体绑定(promotion acquire 消费;ctx.services 跨模块 resolveService)
161
+ // 主体绑定(promotion acquire 消费;ctx.services 跨模块 resolveService)
155
162
  ctx.services.register('member.subject-binding', createSubjectBinding(ctx));
156
163
 
157
- // 会员快览工厂(member.snapshot,W3-3):首页联单面板跨模块消费面
164
+ // 会员快览工厂(member.snapshot):首页联单面板跨模块消费面
158
165
  // (账户/授权三态 + 积分 + 入会引导)。三槽组装——enrollment 槽 fail-soft
159
166
  // (缺席不拖垮账户/积分主面);工厂运行期执行(注册期纯净铁律)。
160
167
  ctx.services.register(
@@ -20,13 +20,13 @@ import type {
20
20
  } from '@tbox.cn/app-contracts-mall';
21
21
 
22
22
  /**
23
- * MemberService:商圈会员完整实现(011 K2 六 Port + 015 入会升级)。
23
+ * MemberService:商圈会员完整实现(六 Port + 015 入会升级)。
24
24
  * extends 契约 Port(保证满足消费方子集约束);完整接口只在本模块包内。
25
25
  */
26
26
  /**
27
27
  * InMemory 演示实现(仅供隔离单测;运行时注册与 Provider 解析不得使用)。
28
28
  * 017 槽位原子化后非 Port 成员归位:getEnrollmentFormDefinition 已收编
29
- * MemberEnrollmentPort optional 方法(R13);enrollUrl/loginUrl 为槽产物自由属性
29
+ * MemberEnrollmentPort optional 方法;enrollUrl/loginUrl 为槽产物自由属性
30
30
  * (enrollment/account 槽的类型视图见 ports.ts);audit 转 InMemory 私有观测成员。
31
31
  */
32
32
  export interface MemberService
@@ -44,7 +44,7 @@ export interface MemberService
44
44
  readonly loginUrl?: string;
45
45
  }
46
46
 
47
- // Form 族归源 TIER1(F5 下沉:provider 出参与模块投影共用同一契约面)
47
+ // Form 族归源 TIER1(下沉:provider 出参与模块投影共用同一契约面)
48
48
  export type {
49
49
  MemberEnrollmentConsentDefinition,
50
50
  MemberEnrollmentFormFieldDefinition,
@@ -196,7 +196,7 @@ export class InMemoryMemberService implements MemberService {
196
196
  // ===== 6. MemberEnrollmentPort(015:授权预填 + 幂等 + pending 收口) =====
197
197
 
198
198
  async enroll(input: MemberEnrollmentInput): Promise<MemberEnrollmentResult> {
199
- // 幂等:同 idempotencyKey 重入返回首果(015 W3 语义,模块顶层 IdempotencyStore 之上的双保险)
199
+ // 幂等:同 idempotencyKey 重入返回首果(语义,模块顶层 IdempotencyStore 之上的双保险)
200
200
  const existing = this.enrollmentAttempts.get(input.idempotencyKey);
201
201
  if (existing) return existing.result;
202
202
 
@@ -276,7 +276,7 @@ export function createQueryMemberInfoTool(
276
276
  const infoCard = {
277
277
  cardType: 'member-info',
278
278
  data: facts,
279
- // note 契约(W7):账户态中文化 + 姓名要点
279
+ // note 契约:账户态中文化 + 姓名要点
280
280
  note: `会员账户(${memberStateLabel(facts.state)})${facts.displayName ? ` · ${facts.displayName}` : ''}`,
281
281
  };
282
282
  if (account.state !== 'active') {
@@ -463,7 +463,7 @@ export function createQueryEnrollmentFormTool(
463
463
  const notEnrolled =
464
464
  account.authState === 'authenticated' &&
465
465
  (account.state === 'not_enrolled' || account.state === 'closed');
466
- // getEnrollmentFormDefinition = Port optional 能力口(R13 收编):无表单端点厂商可缺省,typeof 守卫降级
466
+ // getEnrollmentFormDefinition = Port optional 能力口(收编):无表单端点厂商可缺省,typeof 守卫降级
467
467
  const definition =
468
468
  notEnrolled && typeof enrollmentPort.getEnrollmentFormDefinition === 'function'
469
469
  ? await enrollmentPort.getEnrollmentFormDefinition(userId)
@@ -1,4 +1,4 @@
1
- /** 会员模块工具辅助(011 K2) */
1
+ /** 会员模块工具辅助 */
2
2
  export function nowIso(): string {
3
3
  return new Date().toISOString();
4
4
  }