@tbox.cn/app-module-promotion 0.9.4 → 0.10.1

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
@@ -12,5 +12,5 @@
12
12
 
13
13
  ## 真实厂商接入
14
14
 
15
- 官方 provider 包形态(manifest 槽声明 + 独立包发布)参照 `modules/provider-mock` 结构样例与
15
+ 官方 provider 包形态(manifest 槽声明 + 独立包发布)参照 `modules/provider-mock`(极简形态)/ `modules/provider-mocktest`(带 configSchema 形态)结构样例与
16
16
  docs/reference/providers.md;厂商中立措辞纪律见该参考(本文件受 vendor-neutrality 门禁扫描)。
@@ -1,5 +1,5 @@
1
1
  // src/server/index.ts
2
- import { definePreTool, getRequestContext, loadModuleSkills } from "@tbox.cn/app-sdk/server";
2
+ import { definePreTool, getRequestContext, loadModuleSkills } from "@tbox.cn/app-agent-sdk-server";
3
3
  import { Router } from "express";
4
4
  import { toMallQueryContext as toMallQueryContext4, withMallScopeFromQuery } from "@tbox.cn/app-contracts-mall";
5
5
 
@@ -513,8 +513,8 @@ var meta7 = {
513
513
  var meta_default7 = meta7;
514
514
 
515
515
  // src/server/tools.ts
516
- import { createTool, coerceStringifiedFields, withCardEmissionHint } from "@tbox.cn/app-sdk/server";
517
- import { requireToolRequestContext } from "@tbox.cn/app-sdk/server";
516
+ import { createTool, coerceStringifiedFields, withCardEmissionHint } from "@tbox.cn/app-agent-sdk-server";
517
+ import { requireToolRequestContext } from "@tbox.cn/app-agent-sdk-server";
518
518
  import { resolveMemberGate, toMallQueryContext } from "@tbox.cn/app-contracts-mall";
519
519
  import { z } from "zod";
520
520
 
@@ -1331,7 +1331,7 @@ function logText(value) {
1331
1331
  }
1332
1332
 
1333
1333
  // src/server/handler.ts
1334
- import { matchIntent } from "@tbox.cn/app-sdk/server";
1334
+ import { matchIntent } from "@tbox.cn/app-agent-sdk-server";
1335
1335
  import { resolveMemberGate as resolveMemberGate2, toMallQueryContext as toMallQueryContext3 } from "@tbox.cn/app-contracts-mall";
1336
1336
  var PROMOTION_INTENTS = {
1337
1337
  "list-entitlements": {
@@ -4,7 +4,7 @@ import "./promotion-6L7HLRC2.css";
4
4
  // src/client/cards/promotion-offer-list/index.tsx
5
5
  import { CalendarBlank, CalendarDots, CaretDown, Lightbulb, MapPin, Sparkle, Ticket } from "@phosphor-icons/react";
6
6
  import { useEffect as useEffect2, useLayoutEffect, useRef as useRef2, useState as useState3 } from "react";
7
- import { ItemActionsRow, markSelfRendering, navigateToAlipayPage, sendCardAction } from "@tbox.cn/app-sdk/client";
7
+ import { ItemActionsRow, markSelfRendering, navigateToAlipayPage, sendCardAction } from "@tbox.cn/app-agent-sdk-client";
8
8
 
9
9
  // src/client/components/CouponSheet.tsx
10
10
  import { X } from "@phosphor-icons/react";
@@ -525,7 +525,7 @@ var promotion_offer_list_default = PromotionOfferListCard;
525
525
  // src/client/cards/promotion-offer-detail/index.tsx
526
526
  import { CalendarBlank as CalendarBlank2, CheckCircle, Clock, Gift, Info, ListChecks, MapPin as MapPin2, SealCheck, Ticket as Ticket2 } from "@phosphor-icons/react";
527
527
  import { useEffect as useEffect3, useRef as useRef3, useState as useState4 } from "react";
528
- import { markSelfRendering as markSelfRendering2, navigateToAlipayPage as navigateToAlipayPage2, sendCardAction as sendCardAction2 } from "@tbox.cn/app-sdk/client";
528
+ import { markSelfRendering as markSelfRendering2, navigateToAlipayPage as navigateToAlipayPage2, sendCardAction as sendCardAction2 } from "@tbox.cn/app-agent-sdk-client";
529
529
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
530
530
  var modeText = {
531
531
  AUTOMATIC_DISCOUNT: "\u7ED3\u7B97\u65F6\u81EA\u52A8\u4F18\u60E0",
@@ -733,7 +733,7 @@ markSelfRendering2(PromotionOfferDetailCard);
733
733
  // src/client/cards/promotion-entitlement-list/index.tsx
734
734
  import { CalendarBlank as CalendarBlank3, CaretDown as CaretDown2, Copy, MapPinLine, NavigationArrow, ShieldCheck, Ticket as Ticket3 } from "@phosphor-icons/react";
735
735
  import { useEffect as useEffect5, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState6 } from "react";
736
- import { callJsapi, httpGet } from "@tbox.cn/app-sdk/client";
736
+ import { callJsapi, httpGet } from "@tbox.cn/app-agent-sdk-client";
737
737
 
738
738
  // src/client/components/CouponQrCode.tsx
739
739
  import QRCode from "qrcode";
@@ -978,7 +978,7 @@ var promotion_entitlement_list_default = PromotionEntitlementListCard;
978
978
 
979
979
  // src/client/cards/promotion-activity-list/index.tsx
980
980
  import { CalendarDots as CalendarDots2, Sparkle as Sparkle2, Ticket as Ticket4 } from "@phosphor-icons/react";
981
- import { sendCardAction as sendCardAction3 } from "@tbox.cn/app-sdk/client";
981
+ import { sendCardAction as sendCardAction3 } from "@tbox.cn/app-agent-sdk-client";
982
982
  import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
983
983
  var statusText2 = { AVAILABLE: "\u53EF\u62A5\u540D", FULL: "\u5DF2\u6EE1", ENDED: "\u5DF2\u7ED3\u675F", UPCOMING: "\u5373\u5C06\u5F00\u59CB", UNKNOWN: "\u5F85\u786E\u8BA4" };
984
984
  function PromotionActivityListCard(props) {
@@ -1046,7 +1046,7 @@ var promotion_activity_list_default = PromotionActivityListCard;
1046
1046
 
1047
1047
  // src/client/cards/promotion-activity-detail/index.tsx
1048
1048
  import { ArrowSquareOut, CalendarDots as CalendarDots3, CheckCircle as CheckCircle2, Clock as Clock2, Crown, ListChecks as ListChecks2, MapPin as MapPin3, Sparkle as Sparkle3, Users } from "@phosphor-icons/react";
1049
- import { sendCardAction as sendCardAction4 } from "@tbox.cn/app-sdk/client";
1049
+ import { sendCardAction as sendCardAction4 } from "@tbox.cn/app-agent-sdk-client";
1050
1050
  import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1051
1051
  var sessionText = { OPEN: "\u53EF\u9009", FULL: "\u5DF2\u6EE1", CLOSED: "\u5DF2\u7ED3\u675F", UNKNOWN: "\u5F85\u786E\u8BA4" };
1052
1052
  function PromotionActivityDetailCard({ data, cardId = "", isHistory = false }) {
@@ -1215,7 +1215,7 @@ var promotion_activity_detail_default = PromotionActivityDetailCard;
1215
1215
 
1216
1216
  // src/client/cards/promotion-activity-category-list/index.tsx
1217
1217
  import { GameController, Palette, Sparkle as Sparkle4, Storefront } from "@phosphor-icons/react";
1218
- import { ItemActionsRow as ItemActionsRow2 } from "@tbox.cn/app-sdk/client";
1218
+ import { ItemActionsRow as ItemActionsRow2 } from "@tbox.cn/app-agent-sdk-client";
1219
1219
  import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1220
1220
  var icons = [GameController, Storefront, Palette, Sparkle4];
1221
1221
  function PromotionActivityCategoryListCard(props) {
@@ -1,5 +1,5 @@
1
1
  import { CardComponent } from '@tbox.cn/app-contracts';
2
- import { ClientContext } from '@tbox.cn/app-sdk/client';
2
+ import { ClientContext } from '@tbox.cn/app-agent-sdk-client';
3
3
 
4
4
  /**
5
5
  * module-promotion 客户端入口:9 个稳定传输卡型,renderer 内覆盖多个展示语义。
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  cards,
3
3
  clientModule
4
- } from "../chunk-S7CVFCML.js";
4
+ } from "../chunk-DP2XDOBN.js";
5
5
  export {
6
6
  clientModule,
7
7
  cards as promotionClientCards
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export { InMemoryPromotionService, inMemoryPromotion, promotionCards, resolvePromotionAcquisitionPort, resolvePromotionActivitiesPort, resolvePromotionEntitlementsPort, resolvePromotionOffersPort, serverModule } from './server/index.js';
2
2
  export { clientModule, promotionClientCards } from './client/index.js';
3
+ import '@tbox.cn/app-agent-sdk-server';
3
4
  import '@mastra/core/tools';
4
- import '@tbox.cn/app-sdk/server';
5
+ import '@tbox.cn/app-sdk-server';
5
6
  import '@tbox.cn/app-contracts';
6
7
  import 'zod';
7
8
  import '@tbox.cn/app-contracts-mall';
8
- import '@tbox.cn/app-sdk/client';
9
+ import '@tbox.cn/app-agent-sdk-client';
package/dist/index.js CHANGED
@@ -7,11 +7,11 @@ import {
7
7
  resolvePromotionEntitlementsPort,
8
8
  resolvePromotionOffersPort,
9
9
  serverModule
10
- } from "./chunk-QOTX4XDS.js";
10
+ } from "./chunk-AI3K2MST.js";
11
11
  import {
12
12
  cards,
13
13
  clientModule
14
- } from "./chunk-S7CVFCML.js";
14
+ } from "./chunk-DP2XDOBN.js";
15
15
  export {
16
16
  InMemoryPromotionService,
17
17
  clientModule,
@@ -1,6 +1,7 @@
1
+ import * as _tbox_cn_app_agent_sdk_server from '@tbox.cn/app-agent-sdk-server';
2
+ import { ServerContext, PreToolDef } from '@tbox.cn/app-agent-sdk-server';
1
3
  import * as _mastra_core_tools from '@mastra/core/tools';
2
- import * as _tbox_cn_app_sdk_server from '@tbox.cn/app-sdk/server';
3
- import { ServerContext, PreToolDef } from '@tbox.cn/app-sdk/server';
4
+ import * as _tbox_cn_app_sdk_server from '@tbox.cn/app-sdk-server';
4
5
  import * as _tbox_cn_app_contracts from '@tbox.cn/app-contracts';
5
6
  import { RequestContext } from '@tbox.cn/app-contracts';
6
7
  import * as zod from 'zod';
@@ -2489,12 +2490,17 @@ declare const serverModule: {
2489
2490
  [k: string]: _tbox_cn_app_sdk_server.LocalSkill;
2490
2491
  };
2491
2492
  preTools: {
2492
- listCoupons: PreToolDef<_mastra_core_tools.Tool<{
2493
+ listCoupons: PreToolDef<_tbox_cn_app_agent_sdk_server.Tool<{
2493
2494
  mode: "CLAIMABLE" | "OWNED";
2494
2495
  limit?: string | undefined;
2495
2496
  keyword?: string | undefined;
2496
2497
  cursor?: string | undefined;
2497
- }, unknown, unknown, unknown, _mastra_core_tools.ToolExecutionContext<unknown, unknown, unknown>, "listCoupons", unknown>>;
2498
+ }, unknown, unknown, unknown, _mastra_core_tools.ToolExecutionContext<unknown, unknown, unknown>, "listCoupons", unknown>, {
2499
+ mode: "CLAIMABLE" | "OWNED";
2500
+ limit?: string | undefined;
2501
+ keyword?: string | undefined;
2502
+ cursor?: string | undefined;
2503
+ }>;
2498
2504
  };
2499
2505
  register(ctx: ServerContext): void;
2500
2506
  };
@@ -7,7 +7,7 @@ import {
7
7
  resolvePromotionEntitlementsPort,
8
8
  resolvePromotionOffersPort,
9
9
  serverModule
10
- } from "../chunk-QOTX4XDS.js";
10
+ } from "../chunk-AI3K2MST.js";
11
11
  export {
12
12
  InMemoryPromotionService,
13
13
  inMemoryPromotion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-module-promotion",
3
- "version": "0.9.4",
3
+ "version": "0.10.1",
4
4
  "type": "module",
5
5
  "description": "商圈营销模块:资格校验、推荐降级链、券卡(codegen 源)。",
6
6
  "exports": {
@@ -18,11 +18,12 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "@tbox.cn/app-contracts": "0.10.0",
22
- "@tbox.cn/app-contracts-mall": "0.10.0",
23
- "@tbox.cn/app-sdk": "0.19.0",
21
+ "@tbox.cn/app-contracts": "0.12.0",
22
+ "@tbox.cn/app-contracts-mall": "0.12.0",
24
23
  "jsbarcode": "^3.12.3",
25
- "qrcode": "^1.5.4"
24
+ "qrcode": "^1.5.4",
25
+ "@tbox.cn/app-agent-sdk-client": "0.1.0",
26
+ "@tbox.cn/app-agent-sdk-server": "0.1.0"
26
27
  },
27
28
  "peerDependencies": {
28
29
  "@phosphor-icons/react": "2.1.10",
@@ -1,5 +1,5 @@
1
1
  import { GameController, Palette, Sparkle, Storefront } from '@phosphor-icons/react';
2
- import { ItemActionsRow } from '@tbox.cn/app-sdk/client';
2
+ import { ItemActionsRow } from '@tbox.cn/app-agent-sdk-client';
3
3
  import type { PromotionActivityCategoryListCardData } from '@tbox.cn/app-contracts-mall';
4
4
 
5
5
  const icons = [GameController, Storefront, Palette, Sparkle] as const;
@@ -1,6 +1,6 @@
1
1
  import { ArrowSquareOut, CalendarDots, CheckCircle, Clock, Crown, ListChecks, MapPin, Sparkle, Users } from '@phosphor-icons/react';
2
2
  import type { PromotionActivityDetailCardData } from '@tbox.cn/app-contracts-mall';
3
- import { sendCardAction } from '@tbox.cn/app-sdk/client';
3
+ import { sendCardAction } from '@tbox.cn/app-agent-sdk-client';
4
4
  import { ImageWithFallback } from '../../components/ImageWithFallback';
5
5
 
6
6
  const sessionText: Record<string, string> = { OPEN: '可选', FULL: '已满', CLOSED: '已结束', UNKNOWN: '待确认' };
@@ -1,5 +1,5 @@
1
1
  import { CalendarDots, Sparkle, Ticket } from '@phosphor-icons/react';
2
- import { sendCardAction } from '@tbox.cn/app-sdk/client';
2
+ import { sendCardAction } from '@tbox.cn/app-agent-sdk-client';
3
3
  import type { PromotionActivityListCardData } from '@tbox.cn/app-contracts-mall';
4
4
  import { ImageWithFallback } from '../../components/ImageWithFallback';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { CalendarBlank, CaretDown, Copy, MapPinLine, NavigationArrow, ShieldCheck, Ticket } from '@phosphor-icons/react';
2
2
  import { useEffect, useLayoutEffect, useRef, useState } from 'react';
3
- import { callJsapi, httpGet } from '@tbox.cn/app-sdk/client';
3
+ import { callJsapi, httpGet } from '@tbox.cn/app-agent-sdk-client';
4
4
  import type { PromotionEntitlementListCardData } from '@tbox.cn/app-contracts-mall';
5
5
  import { CouponSheet } from '../../components/CouponSheet';
6
6
  import { CouponBarcode, CouponQrCode } from '../../components/CouponQrCode';
@@ -1,7 +1,7 @@
1
1
  import { CalendarBlank, CheckCircle, Clock, Gift, Info, ListChecks, MapPin, SealCheck, Ticket } from '@phosphor-icons/react';
2
2
  import { useEffect, useRef, useState } from 'react';
3
3
  import type { PromotionOfferDetailCardData } from '@tbox.cn/app-contracts-mall';
4
- import { markSelfRendering, navigateToAlipayPage, sendCardAction } from '@tbox.cn/app-sdk/client';
4
+ import { markSelfRendering, navigateToAlipayPage, sendCardAction } from '@tbox.cn/app-agent-sdk-client';
5
5
  import { ImageWithFallback } from '../../components/ImageWithFallback';
6
6
  import { offerTypeLabel } from '../view';
7
7
  import { sanitizeActivityHtml } from '../../utils/sanitize-activity-html';
@@ -1,6 +1,6 @@
1
1
  import { CalendarBlank, CalendarDots, CaretDown, Lightbulb, MapPin, Sparkle, Ticket } from '@phosphor-icons/react';
2
2
  import { useEffect, useLayoutEffect, useRef, useState } from 'react';
3
- import { ItemActionsRow, markSelfRendering, navigateToAlipayPage, sendCardAction } from '@tbox.cn/app-sdk/client';
3
+ import { ItemActionsRow, markSelfRendering, navigateToAlipayPage, sendCardAction } from '@tbox.cn/app-agent-sdk-client';
4
4
  import type { PromotionOfferListCardData } from '@tbox.cn/app-contracts-mall';
5
5
  import { CouponSheet } from '../../components/CouponSheet';
6
6
  import type { SheetFact } from '../../components/CouponSheet';
@@ -4,7 +4,7 @@
4
4
  import './styles/promotion.css'; // 0.4.0 D1:模块自持 CSS(副作用 import,首行保证先行加载)
5
5
 
6
6
  import type { CardComponent } from '@tbox.cn/app-contracts';
7
- import type { ClientContext, ClientModule } from '@tbox.cn/app-sdk/client';
7
+ import type { ClientContext, ClientModule } from '@tbox.cn/app-agent-sdk-client';
8
8
  import {
9
9
  PromotionOfferListCard,
10
10
  PromotionOfferDetailCard,
@@ -2,7 +2,7 @@
2
2
  * promotion 写动作(015 S6:唯一写动作 acquire;execute 内预检 R3 + member.status 会员门禁)。
3
3
  */
4
4
  import { randomUUID } from 'node:crypto';
5
- import type { ServerContext } from '@tbox.cn/app-sdk/server';
5
+ import type { ServerContext } from '@tbox.cn/app-agent-sdk-server';
6
6
  import type { CardActionResult } from '@tbox.cn/app-contracts';
7
7
  import { memberGateCardOf, externalMemberRefOf, toMallQueryContext } from '@tbox.cn/app-contracts-mall';
8
8
  import type {
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * promotion 意图 handler(015 S6:intents patterns 命中出搜索/推荐卡;写走 acquire 动作)。
3
3
  */
4
- import type { HandlerDefinition, ServerContext } from '@tbox.cn/app-sdk/server';
5
- import { matchIntent } from '@tbox.cn/app-sdk/server';
6
- import type { IntentRoute } from '@tbox.cn/app-sdk/server';
4
+ import type { HandlerDefinition, ServerContext } from '@tbox.cn/app-agent-sdk-server';
5
+ import { matchIntent } from '@tbox.cn/app-agent-sdk-server';
6
+ import type { IntentRoute } from '@tbox.cn/app-agent-sdk-server';
7
7
  import { resolveMemberGate, toMallQueryContext } from '@tbox.cn/app-contracts-mall';
8
8
  import type { MemberStatusFactory, PromotionActivityPort } from '@tbox.cn/app-contracts-mall';
9
9
  import {
@@ -1,5 +1,5 @@
1
- import type { ServerContext, ServerModule, PreToolDef } from '@tbox.cn/app-sdk/server';
2
- import { definePreTool, getRequestContext, loadModuleSkills } from '@tbox.cn/app-sdk/server';
1
+ import type { ServerContext, ServerModule, PreToolDef } from '@tbox.cn/app-agent-sdk-server';
2
+ import { definePreTool, getRequestContext, loadModuleSkills } from '@tbox.cn/app-agent-sdk-server';
3
3
  import { Router } from 'express';
4
4
  import type { Request, Response } from 'express';
5
5
  import { toMallQueryContext, withMallScopeFromQuery } from '@tbox.cn/app-contracts-mall';
@@ -69,7 +69,7 @@ const cards = {
69
69
  } as const;
70
70
 
71
71
  /**
72
- * 文件加载式 skill(009 两形态之二;模板 module-weather 同款):
72
+ * 文件加载式 skill(009 两形态之二;模块 skills/ 目录文件即唯一源):
73
73
  * 顶层 await loadModuleSkills → 填回声明式通道(装配端 registerAll 自动注册)。
74
74
  * codegen 展开改写约定:第一参随包名改写(@tbox.cn/app-module-promotion → @app/module-promotion)。
75
75
  */
@@ -19,7 +19,7 @@ import {
19
19
  type PromotionOfferQueryPort,
20
20
  } from '@tbox.cn/app-contracts-mall';
21
21
  import { isExpectedProviderAbsence, type RequestContext } from '@tbox.cn/app-contracts';
22
- import type { ServerContext } from '@tbox.cn/app-sdk/server';
22
+ import type { ServerContext } from '@tbox.cn/app-agent-sdk-server';
23
23
  import { InMemoryPromotionService } from './service';
24
24
 
25
25
  /** 缺省 InMemory 单例(模块包顶层,B14;跨模块消费方 resolveService('promotion') 兼容) */
@@ -1,8 +1,8 @@
1
1
  /** 营销域完整工具集:业务语义对齐 legacy marketing,传输遵循 tbox-app。
2
2
  * 上下文统一化:运行上下文 = 工具 execute 第二参(requireToolRequestContext 显式读取)。 */
3
- import { createTool, coerceStringifiedFields, withCardEmissionHint } from '@tbox.cn/app-sdk/server';
4
- import type { ServerContext, ToolExecContextLike } from '@tbox.cn/app-sdk/server';
5
- import { requireToolRequestContext } from '@tbox.cn/app-sdk/server';
3
+ import { createTool, coerceStringifiedFields, withCardEmissionHint } from '@tbox.cn/app-agent-sdk-server';
4
+ import type { ServerContext, ToolExecContextLike } from '@tbox.cn/app-agent-sdk-server';
5
+ import { requireToolRequestContext } from '@tbox.cn/app-agent-sdk-server';
6
6
  import { resolveMemberGate, toMallQueryContext } from '@tbox.cn/app-contracts-mall';
7
7
  import type {
8
8
  MemberStatusFactory,
package/tbox.module.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "name": "module-promotion",
3
+ "id": "module-promotion",
4
+ "name": "营销中心",
5
+ "description": "活动、优惠、权益、套餐查询与券领取,最划算计算",
4
6
  "version": "0.3.0",
5
7
  "kind": "business",
6
8
  "risk": {
@@ -10,7 +12,16 @@
10
12
  "distribution": {
11
13
  "defaultMode": "codegen"
12
14
  },
13
- "contributes": {
15
+ "dependencies": {
16
+ "modules": [
17
+ {
18
+ "id": "contracts-mall",
19
+ "required": true
20
+ }
21
+ ]
22
+ },
23
+ "env": [],
24
+ "declare": {
14
25
  "handlers": [
15
26
  "promotion"
16
27
  ],
@@ -71,7 +82,7 @@
71
82
  "skills": [
72
83
  "promotion"
73
84
  ],
74
- "services": [
85
+ "consumes": [
75
86
  {
76
87
  "service": "promotion.offers",
77
88
  "optional": false,
@@ -112,15 +123,20 @@
112
123
  }
113
124
  ]
114
125
  }
115
- ]
116
- },
117
- "dependencies": {
118
- "modules": [
126
+ ],
127
+ "owns": [
119
128
  {
120
- "id": "contracts-mall",
121
- "required": true
129
+ "service": "promotion.offers"
130
+ },
131
+ {
132
+ "service": "promotion.entitlements"
133
+ },
134
+ {
135
+ "service": "promotion.activities"
136
+ },
137
+ {
138
+ "service": "promotion.acquisition"
122
139
  }
123
140
  ]
124
- },
125
- "env": []
141
+ }
126
142
  }
@@ -2,7 +2,7 @@
2
2
  import { act } from 'react';
3
3
  import { afterEach, describe, expect, it, vi } from 'vitest';
4
4
  import { createRoot } from 'react-dom/client';
5
- import { navigateToAlipayPage, sendCardAction } from '@tbox.cn/app-sdk/client';
5
+ import { navigateToAlipayPage, sendCardAction } from '@tbox.cn/app-agent-sdk-client';
6
6
  import {
7
7
  PromotionActivityCategoryListCard,
8
8
  PromotionActivityDetailCard,
@@ -16,8 +16,8 @@ import { sanitizeActivityHtml } from '../src/client/utils/sanitize-activity-html
16
16
 
17
17
  (globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
18
18
 
19
- vi.mock('@tbox.cn/app-sdk/client', async (importOriginal) => {
20
- const mod = await importOriginal<typeof import('@tbox.cn/app-sdk/client')>();
19
+ vi.mock('@tbox.cn/app-agent-sdk-client', async (importOriginal) => {
20
+ const mod = await importOriginal<typeof import('@tbox.cn/app-agent-sdk-client')>();
21
21
  return { ...mod, navigateToAlipayPage: vi.fn(() => Promise.resolve()), sendCardAction: vi.fn() };
22
22
  });
23
23
 
@@ -7,8 +7,8 @@
7
7
  */
8
8
  import { describe, expect, it } from 'vitest';
9
9
  import type { RequestContext } from '@tbox.cn/app-contracts';
10
- import { createServerContext } from '@tbox.cn/app-sdk/server';
11
- import type { ServerContext } from '@tbox.cn/app-sdk/server';
10
+ import { createServerContext } from '@tbox.cn/app-agent-sdk-server';
11
+ import type { ServerContext } from '@tbox.cn/app-agent-sdk-server';
12
12
  import {
13
13
  inMemoryPromotion,
14
14
  resolvePromotionAcquisitionPort,
@@ -19,7 +19,7 @@ import {
19
19
 
20
20
  function requestContext(mallId = 'mall-demo'): RequestContext {
21
21
  return {
22
- identity: { userId: 'u_1001', source: 'dev' },
22
+ identity: { userId: 'u_1001', source: 'local' },
23
23
  credentials: { provider: 'dev', token: 'user-token' },
24
24
  attributes: { mall: { miniAppId: 'app', mallId } },
25
25
  };
@@ -7,7 +7,7 @@
7
7
  import { describe, expect, it } from 'vitest';
8
8
  import { InMemoryPromotionService } from '../src/server/service';
9
9
  import { createPromotionTools, offerSummary } from '../src/server/tools';
10
- import { CARD_EMISSION_HINT_BASE } from '@tbox.cn/app-sdk/server';
10
+ import { CARD_EMISSION_HINT_BASE } from '@tbox.cn/app-agent-sdk-server';
11
11
  import type { PromotionQueryContext } from '@tbox.cn/app-contracts-mall';
12
12
 
13
13
  const q = {
@@ -50,14 +50,14 @@ const mockAllSlots = (service: unknown) => {
50
50
  };
51
51
  import { createPromotionTools, offerDetail, offerSummary } from '../src/server/tools';
52
52
  import { createPromotionIntentHandler, PROMOTION_INTENTS } from '../src/server/handler';
53
- import { createServerContext, createToolExecContext, matchIntent } from '@tbox.cn/app-sdk/server';
54
- import type { IntentRoute } from '@tbox.cn/app-sdk/server';
53
+ import { createServerContext, createToolExecContext, matchIntent } from '@tbox.cn/app-agent-sdk-server';
54
+ import type { IntentRoute } from '@tbox.cn/app-agent-sdk-server';
55
55
 
56
56
  const q = { scope: { miniAppId: 'app', mallId: 'mall-1' }, subjectId: 'u_1' } as never;
57
57
 
58
58
  /** 上下文统一化:显式缝——reqCtx 由调用方透传(handle 第四参 / 工具 execute 第二参) */
59
59
  const testRequestContext = (userId = 'u_1') => ({
60
- identity: { userId, source: 'dev' as const },
60
+ identity: { userId, source: 'local' as const },
61
61
  attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } },
62
62
  });
63
63
 
@@ -310,7 +310,7 @@ describe('promotion 确定性意图路由', () => {
310
310
 
311
311
  it('“最近有什么营销活动”只返回活动卡,不经过会员积分候选卡', async () => {
312
312
  const ctx = createServerContext();
313
- const reqCtx = { identity: { userId: 'u_activity', source: 'dev' as const }, attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } } };
313
+ const reqCtx = { identity: { userId: 'u_activity', source: 'local' as const }, attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } } };
314
314
  const handler = createPromotionIntentHandler(ctx);
315
315
 
316
316
  expect(handler.intents?.flatMap((intent) => intent.patterns)).toEqual(
@@ -610,7 +610,7 @@ describe('createPromotionActions.acquire(actions 层闭环)', () => {
610
610
  providers: { resolve: async () => { throw new Error('no provider'); } },
611
611
  }) as never;
612
612
  const reqCtx = (userId: string) =>
613
- ({ identity: { userId, source: 'dev' }, attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } } }) as never;
613
+ ({ identity: { userId, source: 'local' }, attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } } }) as never;
614
614
 
615
615
  it('会员门禁:not_enrolled 拦截且不触 promotion 服务(门禁先于幂等占位;深链解耦后恒带卡)', async () => {
616
616
  vi.mocked(resolvePromotionAcquisitionPort).mockClear();
@@ -803,7 +803,7 @@ describe("M1' 承接:券详情收口到列表浮层", () => {
803
803
  const ctxFake = {
804
804
  auth: {
805
805
  getContext: () => ({
806
- identity: { userId: 'u_1', source: 'dev' },
806
+ identity: { userId: 'u_1', source: 'local' },
807
807
  attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } },
808
808
  }),
809
809
  },
@@ -832,7 +832,7 @@ describe('会员门禁(TIER1 门禁闭环,SPEC-3)', () => {
832
832
  const ctxWithGate = (factory: unknown) =>
833
833
  ({ services: { resolve: (key: string) => (key === 'member.status' ? factory : undefined) } }) as never;
834
834
  const reqCtxOf = (userId = 'u_gate') =>
835
- ({ identity: { userId, source: 'dev' as const }, attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } } }) as never;
835
+ ({ identity: { userId, source: 'local' as const }, attributes: { mall: { miniAppId: 'app', mallId: 'mall-1' } } }) as never;
836
836
  const execCtx = (userId = 'u_gate') => createToolExecContext(reqCtxOf(userId)) as never;
837
837
 
838
838
  it('listEntitlements:not_enrolled + enrollUrl → 出 member-enrollment-cta 且 found:false', async () => {
@@ -3,7 +3,7 @@
3
3
  * 全样本 dataSchema.safeParse 通过 + findSampleShapeViolations 无越界键(样本即契约)。
4
4
  */
5
5
  import { describe, expect, it } from 'vitest';
6
- import { findSampleShapeViolations } from '@tbox.cn/app-sdk/server';
6
+ import { findSampleShapeViolations } from '@tbox.cn/app-agent-sdk-server';
7
7
  import offerListMeta from '../src/server/cards/promotion-offer-list/meta';
8
8
  import entitlementListMeta from '../src/server/cards/promotion-entitlement-list/meta';
9
9
 
package/tsup.config.ts CHANGED
@@ -16,7 +16,8 @@ export default defineConfig({
16
16
  // 声明产物一次性构建无需增量——仅 dts 关闭,typecheck 的增量缓存不受影响。
17
17
  dts: { compilerOptions: { incremental: false } },
18
18
  external: [
19
- '@tbox.cn/app-sdk',
19
+ '@tbox.cn/app-agent-sdk-client',
20
+ '@tbox.cn/app-agent-sdk-server',
20
21
  '@tbox.cn/app-contracts',
21
22
  '@tbox.cn/app-contracts-mall',
22
23
  'react',