@tbox.cn/app-module-alipay-activity 0.3.0 → 0.3.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 +1 -1
- package/dist/{chunk-RM7IUA3M.js → chunk-RLGO2HTZ.js} +3 -3
- package/dist/client/index.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/server/index.d.ts +6 -5
- package/dist/server/index.js +1 -1
- package/package.json +6 -5
- package/src/client/index.ts +1 -1
- package/src/server/handler.ts +1 -1
- package/src/server/index.ts +2 -2
- package/src/server/integrations/alipay/client.ts +1 -1
- package/src/server/ports.ts +2 -2
- package/src/server/tools.ts +2 -2
- package/tbox.module.json +19 -16
- package/tests/intent-routing.test.ts +2 -2
- package/tests/ports.test.ts +1 -1
- package/tests/pretool-routing.test.ts +1 -1
- package/tests/samples.test.ts +1 -1
- package/tests/tools.test.ts +1 -1
- package/tsup.config.ts +2 -1
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, loadModuleSkills } from "@tbox.cn/app-sdk
|
|
2
|
+
import { definePreTool, loadModuleSkills } from "@tbox.cn/app-agent-sdk-server";
|
|
3
3
|
|
|
4
4
|
// src/server/cards/bumpin-activity/meta.ts
|
|
5
5
|
import {
|
|
@@ -190,12 +190,12 @@ var meta_default = meta;
|
|
|
190
190
|
|
|
191
191
|
// src/server/tools.ts
|
|
192
192
|
import { z } from "zod";
|
|
193
|
-
import { createTool, withCardEmissionHint, requireToolRequestContext } from "@tbox.cn/app-sdk
|
|
193
|
+
import { createTool, withCardEmissionHint, requireToolRequestContext } from "@tbox.cn/app-agent-sdk-server";
|
|
194
194
|
import { memberGateCardOf, toMallQueryContext } from "@tbox.cn/app-contracts-mall";
|
|
195
195
|
|
|
196
196
|
// src/server/ports.ts
|
|
197
197
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
198
|
-
import { expandEnvVars } from "@tbox.cn/app-sdk
|
|
198
|
+
import { expandEnvVars } from "@tbox.cn/app-agent-sdk-server";
|
|
199
199
|
|
|
200
200
|
// src/server/integrations/alipay/adapter.ts
|
|
201
201
|
var ACT_STATUS_VALUES = /* @__PURE__ */ new Set(["NOT_START", "INIT", "PROCESSING", "FINISH", "RECEIVED"]);
|
package/dist/client/index.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { AlipayActivityBumpInCardData, AlipayBumpInFileConfig, AlipayBumpInService, alipayBumpInAuthStrategy, bumpInActivityMeta, configureAlipayBumpIn, createAlipayActivityHandler, createBumpInTools, parseAlipayRichText, readAlipayBumpInConfig, resolveAlipayBumpInService, default as serverModule, toBumpInCardData } from './server/index.js';
|
|
2
|
+
import '@tbox.cn/app-agent-sdk-server';
|
|
2
3
|
import '@mastra/core/tools';
|
|
3
|
-
import '@tbox.cn/app-sdk
|
|
4
|
+
import '@tbox.cn/app-sdk-server';
|
|
4
5
|
import '@tbox.cn/app-contracts';
|
|
5
6
|
import 'zod';
|
|
6
7
|
import 'alipay-sdk';
|
package/dist/index.js
CHANGED
package/dist/server/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as _tbox_cn_app_agent_sdk_server from '@tbox.cn/app-agent-sdk-server';
|
|
2
|
+
import { ServerContext, HandlerDefinition, ProviderAuthStrategy, 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
|
|
3
|
-
import { ServerContext, HandlerDefinition, ProviderAuthStrategy, 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 { CardMeta } from '@tbox.cn/app-contracts';
|
|
6
7
|
import * as zod from 'zod';
|
|
@@ -58,8 +59,8 @@ declare function parseAlipayRichText(text: string | undefined): string;
|
|
|
58
59
|
*/
|
|
59
60
|
declare function toBumpInCardData(detail: PromotionActivityDetail, mode: 'detail' | 'banner', backgroundUrl?: string): PromotionBumpInActivityCardData;
|
|
60
61
|
declare function createBumpInTools(getCtx: () => ServerContext): {
|
|
61
|
-
getBumpInActivity:
|
|
62
|
-
getBumpInActivityBanner:
|
|
62
|
+
getBumpInActivity: _tbox_cn_app_agent_sdk_server.Tool<{}, unknown, unknown, unknown, _mastra_core_tools.ToolExecutionContext<unknown, unknown, unknown>, "getBumpInActivity", unknown>;
|
|
63
|
+
getBumpInActivityBanner: _tbox_cn_app_agent_sdk_server.Tool<{}, unknown, unknown, unknown, _mastra_core_tools.ToolExecutionContext<unknown, unknown, unknown>, "getBumpInActivityBanner", unknown>;
|
|
63
64
|
};
|
|
64
65
|
|
|
65
66
|
/**
|
|
@@ -216,7 +217,7 @@ declare const serverModule: {
|
|
|
216
217
|
[k: string]: _tbox_cn_app_sdk_server.LocalSkill;
|
|
217
218
|
};
|
|
218
219
|
preTools: {
|
|
219
|
-
getBumpInActivity: PreToolDef<
|
|
220
|
+
getBumpInActivity: PreToolDef<_tbox_cn_app_agent_sdk_server.Tool<{}, unknown, unknown, unknown, _mastra_core_tools.ToolExecutionContext<unknown, unknown, unknown>, "getBumpInActivity", unknown>, {}>;
|
|
220
221
|
};
|
|
221
222
|
register(ctx: ServerContext): void;
|
|
222
223
|
};
|
package/dist/server/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/app-module-alipay-activity",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "支付宝互动营销活动模块:碰出惊喜(碰一下)活动查询与展示(codegen 源)。",
|
|
6
6
|
"exports": {
|
|
@@ -18,10 +18,11 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tbox.cn/app-
|
|
22
|
-
"@tbox.cn/app-contracts": "0.
|
|
23
|
-
"
|
|
24
|
-
"
|
|
21
|
+
"@tbox.cn/app-contracts": "0.12.0",
|
|
22
|
+
"@tbox.cn/app-contracts-mall": "0.12.0",
|
|
23
|
+
"alipay-sdk": "4.14.0",
|
|
24
|
+
"@tbox.cn/app-agent-sdk-client": "0.1.0",
|
|
25
|
+
"@tbox.cn/app-agent-sdk-server": "0.1.0"
|
|
25
26
|
},
|
|
26
27
|
"peerDependencies": {
|
|
27
28
|
"zod": "3.25.76",
|
package/src/client/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './styles/bumpin.css';
|
|
2
2
|
|
|
3
3
|
import type { CardComponent } from '@tbox.cn/app-contracts';
|
|
4
|
-
import type { ClientContext, ClientModule } from '@tbox.cn/app-sdk
|
|
4
|
+
import type { ClientContext, ClientModule } from '@tbox.cn/app-agent-sdk-client';
|
|
5
5
|
import { AlipayActivityBumpInCard } from './cards/bumpin-activity/index';
|
|
6
6
|
|
|
7
7
|
const cards = {
|
package/src/server/handler.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 可以充值」类无关长句误入本模块直出卡);「支付宝碰一下」/「我的惊喜活动」等句式仍可靠
|
|
7
7
|
* 碰一/一下/惊喜 bigram 桥接命中。
|
|
8
8
|
*/
|
|
9
|
-
import type { HandlerDefinition, ServerContext } from '@tbox.cn/app-sdk
|
|
9
|
+
import type { HandlerDefinition, ServerContext } from '@tbox.cn/app-agent-sdk-server';
|
|
10
10
|
import { memberGateCardOf, toMallQueryContext, PROMOTION_ACTIVITY_ROUTING_POLICY } from '@tbox.cn/app-contracts-mall';
|
|
11
11
|
import type {
|
|
12
12
|
MemberStatusFactory,
|
package/src/server/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ServerContext, ServerModule, PreToolDef } from '@tbox.cn/app-sdk
|
|
2
|
-
import { definePreTool, loadModuleSkills } from '@tbox.cn/app-sdk
|
|
1
|
+
import type { ServerContext, ServerModule, PreToolDef } from '@tbox.cn/app-agent-sdk-server';
|
|
2
|
+
import { definePreTool, loadModuleSkills } from '@tbox.cn/app-agent-sdk-server';
|
|
3
3
|
import bumpInActivityMeta from './cards/bumpin-activity/meta';
|
|
4
4
|
import { createBumpInTools } from './tools';
|
|
5
5
|
import { alipayBumpInAuthStrategy } from './integrations/alipay/client';
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { existsSync, readFileSync } from 'node:fs';
|
|
21
21
|
import path from 'node:path';
|
|
22
22
|
import { AlipaySdk } from 'alipay-sdk';
|
|
23
|
-
import type { ProviderAuthStrategy } from '@tbox.cn/app-sdk
|
|
23
|
+
import type { ProviderAuthStrategy } from '@tbox.cn/app-agent-sdk-server';
|
|
24
24
|
import type { AlipayBumpInProviderConfig } from './provider';
|
|
25
25
|
|
|
26
26
|
/** 凭证 JSON 文件的 value 结构 */
|
package/src/server/ports.ts
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* 的模块零路径魔法)。未注入/缺文件/缺字段 → null,工具层静默降级。
|
|
10
10
|
*/
|
|
11
11
|
import { existsSync, readFileSync } from 'node:fs';
|
|
12
|
-
import type { ServerContext } from '@tbox.cn/app-sdk
|
|
13
|
-
import { expandEnvVars } from '@tbox.cn/app-sdk
|
|
12
|
+
import type { ServerContext } from '@tbox.cn/app-agent-sdk-server';
|
|
13
|
+
import { expandEnvVars } from '@tbox.cn/app-agent-sdk-server';
|
|
14
14
|
import { AlipayBumpInService } from './integrations/alipay/adapter';
|
|
15
15
|
import { createAlipaySdkClient } from './integrations/alipay/client';
|
|
16
16
|
|
package/src/server/tools.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* getBumpInActivityBanner:首页 Banner 数据拉取,无需用户意图触发。
|
|
5
5
|
*/
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import type { ServerContext, ToolExecContextLike } from '@tbox.cn/app-sdk
|
|
8
|
-
import { createTool, withCardEmissionHint, requireToolRequestContext } from '@tbox.cn/app-sdk
|
|
7
|
+
import type { ServerContext, ToolExecContextLike } from '@tbox.cn/app-agent-sdk-server';
|
|
8
|
+
import { createTool, withCardEmissionHint, requireToolRequestContext } from '@tbox.cn/app-agent-sdk-server';
|
|
9
9
|
import { memberGateCardOf, toMallQueryContext } from '@tbox.cn/app-contracts-mall';
|
|
10
10
|
import type {
|
|
11
11
|
MemberStatusFactory,
|
package/tbox.module.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"id": "module-alipay-activity",
|
|
4
|
+
"name": "联单活动",
|
|
5
|
+
"description": "支付宝联单活动",
|
|
6
6
|
"version": "0.1.0",
|
|
7
7
|
"kind": "business",
|
|
8
8
|
"risk": {
|
|
@@ -12,8 +12,19 @@
|
|
|
12
12
|
"distribution": {
|
|
13
13
|
"defaultMode": "codegen"
|
|
14
14
|
},
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"modules": [
|
|
17
|
+
{
|
|
18
|
+
"id": "contracts-mall",
|
|
19
|
+
"required": true
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"env": [],
|
|
24
|
+
"declare": {
|
|
25
|
+
"handlers": [
|
|
26
|
+
"alipay-activity"
|
|
27
|
+
],
|
|
17
28
|
"tools": [
|
|
18
29
|
"getBumpInActivity",
|
|
19
30
|
"getBumpInActivityBanner"
|
|
@@ -27,15 +38,7 @@
|
|
|
27
38
|
"routes": [],
|
|
28
39
|
"pages": [],
|
|
29
40
|
"tabs": [],
|
|
30
|
-
"actions": []
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"modules": [
|
|
34
|
-
{
|
|
35
|
-
"id": "contracts-mall",
|
|
36
|
-
"required": true
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
"env": []
|
|
41
|
+
"actions": [],
|
|
42
|
+
"owns": []
|
|
43
|
+
}
|
|
41
44
|
}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* - 洋葱守卫:prefix 误送达 content 无域词时 handler 放行(continueWith 原文、零卡零文案不吞轮)。
|
|
8
8
|
*/
|
|
9
9
|
import { describe, expect, it, vi } from 'vitest';
|
|
10
|
-
import { createServerContext, matchIntent } from '@tbox.cn/app-sdk
|
|
11
|
-
import type { IntentRoute } from '@tbox.cn/app-sdk
|
|
10
|
+
import { createServerContext, matchIntent } from '@tbox.cn/app-agent-sdk-server';
|
|
11
|
+
import type { IntentRoute } from '@tbox.cn/app-agent-sdk-server';
|
|
12
12
|
import { PROMOTION_ACTIVITY_ROUTING_POLICY } from '@tbox.cn/app-contracts-mall';
|
|
13
13
|
import { BUMPIN_INTENTS, createAlipayActivityHandler } from '../src/server/handler';
|
|
14
14
|
|
package/tests/ports.test.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
readAlipayBumpInConfig,
|
|
14
14
|
resolveAlipayBumpInService,
|
|
15
15
|
} from '../src/server/ports.js';
|
|
16
|
-
import type { ServerContext } from '@tbox.cn/app-sdk
|
|
16
|
+
import type { ServerContext } from '@tbox.cn/app-agent-sdk-server';
|
|
17
17
|
|
|
18
18
|
/** 最小 ctx 桩(logger warn 收集;其余槽位不触达) */
|
|
19
19
|
function ctxStub(): { ctx: ServerContext; warns: string[] } {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* (镜像 server/index.ts bumpInPreTool 声明:真实工具实例 + 同词表)
|
|
5
5
|
*/
|
|
6
6
|
import { describe, expect, it } from 'vitest';
|
|
7
|
-
import { definePreTool, selectPreTools } from '@tbox.cn/app-sdk
|
|
7
|
+
import { definePreTool, selectPreTools } from '@tbox.cn/app-agent-sdk-server';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { createBumpInTools } from '../src/server/tools';
|
|
10
10
|
|
package/tests/samples.test.ts
CHANGED
|
@@ -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
|
|
6
|
+
import { findSampleShapeViolations } from '@tbox.cn/app-agent-sdk-server';
|
|
7
7
|
import meta from '../src/server/cards/bumpin-activity/meta';
|
|
8
8
|
|
|
9
9
|
describe('alipay-activity samples 双断言(样本即契约)', () => {
|
package/tests/tools.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest';
|
|
2
2
|
import { toBumpInCardData, parseAlipayRichText, createBumpInTools } from '../src/server/tools.js';
|
|
3
3
|
import type { PromotionActivityDetail } from '@tbox.cn/app-contracts-mall';
|
|
4
|
-
import { createServerContext, createToolExecContext } from '@tbox.cn/app-sdk
|
|
4
|
+
import { createServerContext, createToolExecContext } from '@tbox.cn/app-agent-sdk-server';
|
|
5
5
|
import { createAlipayActivityHandler } from '../src/server/handler.js';
|
|
6
6
|
|
|
7
7
|
// mock ports 的服务解析(工具内部 import;测试注入)
|
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',
|