@tbox.cn/app-module-shopping-guide 0.9.0 → 0.9.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.
Files changed (36) hide show
  1. package/AGENTS.md +1 -1
  2. package/dist/{chunk-AYQZO2FV.js → chunk-HWPVP7N5.js} +2 -2
  3. package/dist/{chunk-VKDA6RXQ.js → chunk-PAYDOSCV.js} +12 -12
  4. package/dist/client/index.d.ts +1 -1
  5. package/dist/client/index.js +1 -1
  6. package/dist/index.d.ts +3 -2
  7. package/dist/index.js +2 -2
  8. package/dist/server/index.d.ts +855 -846
  9. package/dist/server/index.js +1 -1
  10. package/dist/{shopping-guide-EGRHPEDA.css → shopping-guide-62BDCPW5.css} +2 -0
  11. package/package.json +5 -4
  12. package/src/client/cards/category-list/index.tsx +1 -1
  13. package/src/client/cards/human-guide-list/index.tsx +1 -1
  14. package/src/client/cards/location-handoff/index.tsx +1 -1
  15. package/src/client/cards/mall-directory/index.tsx +1 -1
  16. package/src/client/cards/nearby-mall-list/index.tsx +1 -1
  17. package/src/client/cards/product-detail/index.tsx +1 -1
  18. package/src/client/cards/product-list/index.tsx +1 -1
  19. package/src/client/cards/shop-detail/index.tsx +1 -1
  20. package/src/client/cards/shop-list/index.tsx +2 -2
  21. package/src/client/components/ShopDetailSheet.tsx +1 -1
  22. package/src/client/index.ts +1 -1
  23. package/src/client/styles/shopping-guide.css +2 -0
  24. package/src/server/handler.ts +1 -1
  25. package/src/server/index.ts +2 -2
  26. package/src/server/ports/index.ts +1 -1
  27. package/src/server/tools/index.ts +2 -2
  28. package/tbox.module.json +26 -12
  29. package/tests/cards-render.test.tsx +3 -3
  30. package/tests/floor-pretool.test.ts +4 -4
  31. package/tests/handler.test.ts +3 -3
  32. package/tests/ports-resolve.test.ts +2 -2
  33. package/tests/samples.test.ts +1 -1
  34. package/tests/shopping-guide.test.ts +4 -4
  35. package/tests/skill.test.ts +1 -1
  36. package/tsup.config.ts +2 -1
@@ -3,7 +3,7 @@ import {
3
3
  resolveShoppingGuidePorts,
4
4
  serverModule,
5
5
  shoppingGuideCards
6
- } from "../chunk-AYQZO2FV.js";
6
+ } from "../chunk-HWPVP7N5.js";
7
7
  export {
8
8
  createShoppingGuideTools,
9
9
  resolveShoppingGuidePorts,
@@ -1859,6 +1859,8 @@
1859
1859
  width: 136px;
1860
1860
  height: 136px;
1861
1861
  border-radius: 18px;
1862
+ object-fit: contain;
1863
+ background: var(--tbox-bg-card);
1862
1864
  }
1863
1865
  .sg-merchant-row .sg-rm-item-meta {
1864
1866
  gap: 8px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-module-shopping-guide",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "type": "module",
5
5
  "description": "商圈导购模块:商品/商户搜索、推荐、对比、商场目录、人工导购、位置导航。",
6
6
  "exports": {
@@ -19,9 +19,10 @@
19
19
  "./package.json": "./package.json"
20
20
  },
21
21
  "dependencies": {
22
- "@tbox.cn/app-sdk": "0.20.0",
23
- "@tbox.cn/app-contracts": "0.11.0",
24
- "@tbox.cn/app-contracts-mall": "0.11.0"
22
+ "@tbox.cn/app-contracts": "0.12.0",
23
+ "@tbox.cn/app-contracts-mall": "0.12.1",
24
+ "@tbox.cn/app-agent-sdk-client": "0.1.1",
25
+ "@tbox.cn/app-agent-sdk-server": "0.1.1"
25
26
  },
26
27
  "peerDependencies": {
27
28
  "zod": "3.25.76",
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { useState } from 'react';
6
6
  import { CaretDown } from '@phosphor-icons/react';
7
- import { sendCardAction } from '@tbox.cn/app-sdk/client';
7
+ import { sendCardAction } from '@tbox.cn/app-agent-sdk-client';
8
8
  import { categoryIcon } from '../view';
9
9
  import type { CategoryListCardData } from '@tbox.cn/app-contracts-mall';
10
10
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * human-guide-list 富卡(0.4.0 D6):头像占位 + 渠道标签 + 在线状态 + 联系按钮 + 隐私声明。
3
3
  */
4
- import { sendCardAction } from '@tbox.cn/app-sdk/client';
4
+ import { sendCardAction } from '@tbox.cn/app-agent-sdk-client';
5
5
  import { ImageWithFallback } from '../../components/ImageWithFallback';
6
6
  import type { HumanGuideListCardData } from '@tbox.cn/app-contracts-mall';
7
7
 
@@ -2,7 +2,7 @@
2
2
  * location-handoff 富卡(0.4.0 D6):地图预览 + 地址 + 三级降级(view.deriveLocationLevel)。
3
3
  */
4
4
  import { MapPin, NavigationArrow } from '@phosphor-icons/react';
5
- import { sendCardAction } from '@tbox.cn/app-sdk/client';
5
+ import { sendCardAction } from '@tbox.cn/app-agent-sdk-client';
6
6
  import { ImageWithFallback } from '../../components/ImageWithFallback';
7
7
  import { deriveLocationLevel } from '../view';
8
8
  import type { LocationHandoffCardData } from '@tbox.cn/app-contracts-mall';
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { useState } from 'react';
5
5
  import { CaretDown, Storefront } from '@phosphor-icons/react';
6
- import { sendCardAction } from '@tbox.cn/app-sdk/client';
6
+ import { sendCardAction } from '@tbox.cn/app-agent-sdk-client';
7
7
  import type { MallDirectoryCardData } from '@tbox.cn/app-contracts-mall';
8
8
 
9
9
  export function MallDirectoryCard(props: {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * nearby-mall-list 富卡(0.4.0 D6):商场名 + 地址 + 距离(formatDistance)+ 营业状态 + 条目动作。
3
3
  */
4
- import { ItemActionsRow } from '@tbox.cn/app-sdk/client';
4
+ import { ItemActionsRow } from '@tbox.cn/app-agent-sdk-client';
5
5
  import { formatDistance } from '../view';
6
6
  import type { NearbyMallListCardData } from '@tbox.cn/app-contracts-mall';
7
7
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { useState } from 'react';
5
5
  import { ImageWithFallback } from '../../components/ImageWithFallback';
6
- import { ItemActionsRow } from '@tbox.cn/app-sdk/client';
6
+ import { ItemActionsRow } from '@tbox.cn/app-agent-sdk-client';
7
7
  import type { ProductDetailCardData } from '@tbox.cn/app-contracts-mall';
8
8
 
9
9
  export function ProductDetailCard(props: {
@@ -5,7 +5,7 @@
5
5
  import { useState } from 'react';
6
6
  import { createPortal } from 'react-dom';
7
7
  import { X } from '@phosphor-icons/react';
8
- import { ItemActionsRow, sendCardAction } from '@tbox.cn/app-sdk/client';
8
+ import { ItemActionsRow, sendCardAction } from '@tbox.cn/app-agent-sdk-client';
9
9
  import { ImageWithFallback } from '../../components/ImageWithFallback';
10
10
  import type { ProductListCardData } from '@tbox.cn/app-contracts-mall';
11
11
 
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useRef, useState } from 'react';
2
2
  import { Clock, Phone } from '@phosphor-icons/react';
3
- import { httpGet, markSelfRendering } from '@tbox.cn/app-sdk/client';
3
+ import { httpGet, markSelfRendering } from '@tbox.cn/app-agent-sdk-client';
4
4
  import { MerchantRow } from '../../components/MerchantRow';
5
5
  import { ShopGuideHeader } from '../../components/ShopGuideHeader';
6
6
  import { ShopDetailSheet } from '../../components/ShopDetailSheet';
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useMemo, useRef, useState } from 'react';
2
2
  import { CaretRight } from '@phosphor-icons/react';
3
- import { markSelfRendering } from '@tbox.cn/app-sdk/client';
3
+ import { markSelfRendering } from '@tbox.cn/app-agent-sdk-client';
4
4
  import { ShopDetailSheet } from '../../components/ShopDetailSheet';
5
5
  import type { ShopDetailSheetData } from '../../components/ShopDetailSheet';
6
6
  import { MerchantRow } from '../../components/MerchantRow';
@@ -8,7 +8,7 @@ import { resolveCategoryTabs } from '../../categories';
8
8
  import { ShopGuideHeader } from '../../components/ShopGuideHeader';
9
9
  import { ShopGuideSectionLabel } from '../../components/ShopGuideSectionLabel';
10
10
  import { ShopListSheet } from '../../components/ShopListSheet';
11
- import { httpGet } from '@tbox.cn/app-sdk/client';
11
+ import { httpGet } from '@tbox.cn/app-agent-sdk-client';
12
12
  import type { ShopListCardData, ShopDetailCardData } from '@tbox.cn/app-contracts-mall';
13
13
 
14
14
  const PREVIEW_ITEM_COUNT = 3;
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useEffect, useId, useRef, useState } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
  import { Clock, MapPin, Phone, Star, Tag, X } from '@phosphor-icons/react';
4
- import { ItemActionsRow, navigateToAlipayPage, sendCardAction } from '@tbox.cn/app-sdk/client';
4
+ import { ItemActionsRow, navigateToAlipayPage, sendCardAction } from '@tbox.cn/app-agent-sdk-client';
5
5
  import { ImageWithFallback } from './ImageWithFallback';
6
6
  import type { ActionDraft } from '@tbox.cn/app-contracts-mall';
7
7
 
@@ -4,7 +4,7 @@
4
4
  import './styles/shopping-guide.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
  ProductListCard,
10
10
  ProductDetailCard,
@@ -1859,6 +1859,8 @@
1859
1859
  width: 136px;
1860
1860
  height: 136px;
1861
1861
  border-radius: 18px;
1862
+ object-fit: contain;
1863
+ background: var(--tbox-bg-card);
1862
1864
  }
1863
1865
  .sg-merchant-row .sg-rm-item-meta {
1864
1866
  gap: 8px;
@@ -6,7 +6,7 @@
6
6
  * - 固定通用文案:计数 N 取接口分页字段 ShoppingPage.total(投影 pageInfo.total 同源);
7
7
  * - 防御兜底:非整句内容放行 LLM(洋葱守卫:未识别 = 放行,不吞——同 member handler 惯例)。
8
8
  */
9
- import type { HandlerDefinition, ServerContext } from '@tbox.cn/app-sdk/server';
9
+ import type { HandlerDefinition, ServerContext } from '@tbox.cn/app-agent-sdk-server';
10
10
  import { parseMallScope } from '@tbox.cn/app-contracts-mall';
11
11
  import { resolveShoppingGuidePorts } from './ports';
12
12
  import { buildShopListCard, toContext } from './tools';
@@ -12,8 +12,8 @@ import type {
12
12
  ServerModule,
13
13
  TypedBus,
14
14
  PreToolDef,
15
- } from '@tbox.cn/app-sdk/server';
16
- import { definePreTool, loadModuleSkills, getRequestContext } from '@tbox.cn/app-sdk/server';
15
+ } from '@tbox.cn/app-agent-sdk-server';
16
+ import { definePreTool, loadModuleSkills, getRequestContext } from '@tbox.cn/app-agent-sdk-server';
17
17
  import { Router } from 'express';
18
18
  import type { Request, Response } from 'express';
19
19
  import { toMallQueryContext, withMallScopeFromQuery, mallSlot } from '@tbox.cn/app-contracts-mall';
@@ -13,7 +13,7 @@ import type {
13
13
  ShopDirectoryQueryPort,
14
14
  NavigationPort,
15
15
  } from '@tbox.cn/app-contracts-mall';
16
- import type { ServerContext } from '@tbox.cn/app-sdk/server';
16
+ import type { ServerContext } from '@tbox.cn/app-agent-sdk-server';
17
17
  import {
18
18
  mallScopeOf,
19
19
  parseMallScope,
@@ -3,9 +3,9 @@
3
3
  * 全部经 createTool;coerceStringifiedFields 首行转换(JSON 字符串化数值/数组还原)。
4
4
  * 出卡见文件头注释(v2 出参 cards 契约);product-facets 返回分面原始数据、search-knowledge 返回 text 汇总。
5
5
  */
6
- import { createTool, coerceStringifiedFields, requireToolRequestContext, withCardEmissionHint, internalTool } from '@tbox.cn/app-sdk/server';
6
+ import { createTool, coerceStringifiedFields, requireToolRequestContext, withCardEmissionHint, internalTool } from '@tbox.cn/app-agent-sdk-server';
7
7
  import { z } from 'zod';
8
- import type { ServerContext, ToolExecContextLike } from '@tbox.cn/app-sdk/server';
8
+ import type { ServerContext, ToolExecContextLike } from '@tbox.cn/app-agent-sdk-server';
9
9
  import { mallSubjectIdOf } from '@tbox.cn/app-contracts-mall';
10
10
  import type {
11
11
  CommercialCategoryQueryPort,
package/tbox.module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "name": "module-shopping-guide",
4
- "title": "智能导购",
3
+ "id": "module-shopping-guide",
4
+ "name": "智能导购",
5
5
  "description": "商户检索、楼层类目浏览、券导与真人导览预约",
6
6
  "version": "0.3.0",
7
7
  "kind": "business",
@@ -12,7 +12,16 @@
12
12
  "distribution": {
13
13
  "defaultMode": "codegen"
14
14
  },
15
- "contributes": {
15
+ "dependencies": {
16
+ "modules": [
17
+ {
18
+ "id": "contracts-mall",
19
+ "required": true
20
+ }
21
+ ]
22
+ },
23
+ "env": [],
24
+ "declare": {
16
25
  "handlers": [
17
26
  "shopping-guide"
18
27
  ],
@@ -84,7 +93,7 @@
84
93
  "skills": [
85
94
  "shopping-guide"
86
95
  ],
87
- "services": [
96
+ "consumes": [
88
97
  {
89
98
  "service": "shopping-guide.catalog",
90
99
  "optional": false,
@@ -125,15 +134,20 @@
125
134
  }
126
135
  ]
127
136
  }
128
- ]
129
- },
130
- "dependencies": {
131
- "modules": [
137
+ ],
138
+ "owns": [
132
139
  {
133
- "id": "contracts-mall",
134
- "required": true
140
+ "service": "shopping-guide.catalog"
141
+ },
142
+ {
143
+ "service": "shopping-guide.shops"
144
+ },
145
+ {
146
+ "service": "shopping-guide.categories"
147
+ },
148
+ {
149
+ "service": "shopping-guide.directory"
135
150
  }
136
151
  ]
137
- },
138
- "env": []
152
+ }
139
153
  }
@@ -7,7 +7,7 @@
7
7
  import { afterEach, describe, expect, it, vi } from 'vitest';
8
8
  import { createRoot } from 'react-dom/client';
9
9
  import { act } from 'react-dom/test-utils';
10
- import { httpGet, navigateToAlipayPage, sendCardAction } from '@tbox.cn/app-sdk/client';
10
+ import { httpGet, navigateToAlipayPage, sendCardAction } from '@tbox.cn/app-agent-sdk-client';
11
11
  import {
12
12
  CategoryListCard,
13
13
  ProductComparisonCard,
@@ -17,8 +17,8 @@ import {
17
17
  ShopListCard,
18
18
  } from '../src/client/cards';
19
19
 
20
- vi.mock('@tbox.cn/app-sdk/client', async (importOriginal) => {
21
- const mod = await importOriginal<typeof import('@tbox.cn/app-sdk/client')>();
20
+ vi.mock('@tbox.cn/app-agent-sdk-client', async (importOriginal) => {
21
+ const mod = await importOriginal<typeof import('@tbox.cn/app-agent-sdk-client')>();
22
22
  return { ...mod, httpGet: vi.fn(), navigateToAlipayPage: vi.fn(() => Promise.resolve()), sendCardAction: vi.fn() };
23
23
  });
24
24
 
@@ -5,14 +5,14 @@
5
5
  * - 失败语义:楼层不存在 / 目录不可用 / 引用不可解析 → 无卡 summary(模型降级自答)。
6
6
  */
7
7
  import { describe, expect, it } from 'vitest';
8
- import { createInMemoryStateStore, createToolExecContext } from '@tbox.cn/app-sdk/server';
9
- import { createServerContext } from '@tbox.cn/app-sdk/server';
10
- import type { ServerContext } from '@tbox.cn/app-sdk/server';
8
+ import { createInMemoryStateStore, createToolExecContext } from '@tbox.cn/app-agent-sdk-server';
9
+ import { createServerContext } from '@tbox.cn/app-agent-sdk-server';
10
+ import type { ServerContext } from '@tbox.cn/app-agent-sdk-server';
11
11
  import {
12
12
  createIntegrationsRegistry,
13
13
  createAuthStrategyRegistry,
14
14
  createEnvironmentSecretProvider,
15
- } from '@tbox.cn/app-sdk/server';
15
+ } from '@tbox.cn/app-agent-sdk-server';
16
16
  import { createShoppingGuideTools, extractFloorMentions, normalizeFloorKey } from '../src/server/tools';
17
17
  import { serverModule } from '../src/server/index';
18
18
  import { shopListCardDataSchema } from '@tbox.cn/app-contracts-mall';
@@ -8,13 +8,13 @@
8
8
  * - 失败语义:非整句放行 LLM(continueWith)/ reqCtx 缺失 / scope 缺失 / 空门店 → 无卡文案。
9
9
  */
10
10
  import { describe, expect, it } from 'vitest';
11
- import { createInMemoryStateStore, createServerContext } from '@tbox.cn/app-sdk/server';
11
+ import { createInMemoryStateStore, createServerContext } from '@tbox.cn/app-agent-sdk-server';
12
12
  import {
13
13
  createIntegrationsRegistry,
14
14
  createAuthStrategyRegistry,
15
15
  createEnvironmentSecretProvider,
16
- } from '@tbox.cn/app-sdk/server';
17
- import type { ServerContext } from '@tbox.cn/app-sdk/server';
16
+ } from '@tbox.cn/app-agent-sdk-server';
17
+ import type { ServerContext } from '@tbox.cn/app-agent-sdk-server';
18
18
  import { shopListCardDataSchema } from '@tbox.cn/app-contracts-mall';
19
19
  import type { RequestContext } from '@tbox.cn/app-contracts';
20
20
  import { createShoppingGuideHandler } from '../src/server/handler';
@@ -7,8 +7,8 @@
7
7
  */
8
8
  import { describe, expect, it, vi } 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 { resolveShoppingGuidePorts } from '../src/server/ports';
13
13
 
14
14
  function requestContext(mallId = 'mall-demo'): RequestContext {
@@ -5,7 +5,7 @@
5
5
  * 不含促销词汇——brand-guide 卡的中立定位)。
6
6
  */
7
7
  import { describe, expect, it } from 'vitest';
8
- import { findSampleShapeViolations } from '@tbox.cn/app-sdk/server';
8
+ import { findSampleShapeViolations } from '@tbox.cn/app-agent-sdk-server';
9
9
  import shopListMeta from '../src/server/cards/shop-list/meta';
10
10
  import shopDetailMeta from '../src/server/cards/shop-detail/meta';
11
11
  import recommendMerchantsMeta from '../src/server/cards/recommend-merchants/meta';
@@ -4,14 +4,14 @@
4
4
  * adapter/解码层行为归 provider 包测试覆盖;本文件锁定工具投影与本地知识库域。
5
5
  */
6
6
  import { describe, expect, it, vi } from 'vitest';
7
- import { createInMemoryStateStore, createToolExecContext } from '@tbox.cn/app-sdk/server';
8
- import { createServerContext } from '@tbox.cn/app-sdk/server';
9
- import type { ServerContext } from '@tbox.cn/app-sdk/server';
7
+ import { createInMemoryStateStore, createToolExecContext } from '@tbox.cn/app-agent-sdk-server';
8
+ import { createServerContext } from '@tbox.cn/app-agent-sdk-server';
9
+ import type { ServerContext } from '@tbox.cn/app-agent-sdk-server';
10
10
  import {
11
11
  createIntegrationsRegistry,
12
12
  createAuthStrategyRegistry,
13
13
  createEnvironmentSecretProvider,
14
- } from '@tbox.cn/app-sdk/server';
14
+ } from '@tbox.cn/app-agent-sdk-server';
15
15
  import { createShoppingGuideTools, shopListNote } from '../src/server/tools';
16
16
  import { resolveShoppingGuidePorts } from '../src/server/ports';
17
17
  import { shopListCardDataSchema } from '@tbox.cn/app-contracts-mall';
@@ -22,7 +22,7 @@
22
22
  * 实证出现后再补(证据驱动)。
23
23
  */
24
24
  import { describe, expect, it } from 'vitest';
25
- import { decideSkillInjection } from '@tbox.cn/app-sdk/server';
25
+ import { decideSkillInjection } from '@tbox.cn/app-agent-sdk-server';
26
26
  import { serverModule } from '../src/server/index';
27
27
 
28
28
  type LoadedSkill = {
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',