@zhin.js/adapter-icqq 1.1.2 → 1.1.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @zhin.js/adapter-icqq
2
2
 
3
+ ## 1.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 5b5d270: Complete the canonical share segment contract and preserve native ICQQ share delivery through Core and AI outbound pipelines.
8
+ - Updated dependencies [5b5d270]
9
+ - Updated dependencies [36c2eb9]
10
+ - @zhin.js/im-contract@1.1.2
11
+ - @zhin.js/core@1.1.38
12
+ - @zhin.js/adapter@1.1.15
13
+ - @zhin.js/agent-feature@1.1.2
14
+ - @zhin.js/feature-kit@1.1.2
15
+ - @zhin.js/permission@1.1.2
16
+ - @zhin.js/skill@1.1.2
17
+ - @zhin.js/tool@1.1.2
18
+
3
19
  ## 1.1.2
4
20
 
5
21
  ### Patch Changes
@@ -360,6 +360,46 @@ export function icqqElementsToSegments(elements) {
360
360
  });
361
361
  break;
362
362
  }
363
+ case "share": {
364
+ const url = typeof el.url === "string" ? el.url.trim() : "";
365
+ const title = typeof el.title === "string" ? el.title.trim() : "";
366
+ if (!url || !title)
367
+ break;
368
+ const description = typeof el.summary === "string" && el.summary
369
+ ? el.summary
370
+ : undefined;
371
+ const image = typeof el.image === "string" && el.image ? el.image : undefined;
372
+ const audio = typeof el.audio === "string" && el.audio ? el.audio : undefined;
373
+ const content = typeof el.content === "string" && el.content ? el.content : undefined;
374
+ const rawConfig = el.config && typeof el.config === "object" && !Array.isArray(el.config)
375
+ ? el.config
376
+ : undefined;
377
+ const appid = Number(rawConfig?.appid);
378
+ const config = Number.isSafeInteger(appid) && appid > 0
379
+ ? {
380
+ appid,
381
+ ...(typeof rawConfig?.appname === "string" && rawConfig.appname
382
+ ? { package: rawConfig.appname }
383
+ : {}),
384
+ ...(typeof rawConfig?.appsign === "string" && rawConfig.appsign
385
+ ? { sign: rawConfig.appsign }
386
+ : {}),
387
+ }
388
+ : undefined;
389
+ out.push({
390
+ type: "share",
391
+ data: {
392
+ url,
393
+ title,
394
+ ...(description ? { description } : {}),
395
+ ...(image ? { image } : {}),
396
+ ...(audio ? { audio } : {}),
397
+ ...(content ? { content } : {}),
398
+ ...(config ? { config } : {}),
399
+ },
400
+ });
401
+ break;
402
+ }
363
403
  default:
364
404
  if (el.text != null && el.text !== "") {
365
405
  out.push({ type: "text", data: { text: String(el.text) } });
package/lib/protocol.js CHANGED
@@ -405,7 +405,7 @@ function formatShare(data) {
405
405
  ...(appsign ? { appsign } : {}),
406
406
  }
407
407
  : undefined;
408
- const summary = optionalString(data.artist);
408
+ const summary = optionalString(data.description) ?? optionalString(data.artist);
409
409
  const content = optionalString(data.content);
410
410
  const image = optionalString(data.image);
411
411
  const audio = optionalString(data.audio);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-icqq",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Zhin.js ICQQ adapter — direct connection to @icqqjs/icqq",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -34,24 +34,24 @@
34
34
  "directory": "plugins/adapters/icqq"
35
35
  },
36
36
  "dependencies": {
37
- "@zhin.js/adapter": "1.1.14",
38
- "@zhin.js/agent-feature": "1.1.1",
39
- "@zhin.js/core": "1.1.37",
40
- "@zhin.js/feature-kit": "1.1.1",
41
- "@zhin.js/im-contract": "1.1.1",
37
+ "@zhin.js/adapter": "1.1.15",
38
+ "@zhin.js/agent-feature": "1.1.2",
39
+ "@zhin.js/core": "1.1.38",
40
+ "@zhin.js/feature-kit": "1.1.2",
41
+ "@zhin.js/im-contract": "1.1.2",
42
42
  "@zhin.js/logger": "1.1.1",
43
- "@zhin.js/permission": "1.1.1",
44
- "@zhin.js/skill": "1.1.1",
45
- "@zhin.js/tool": "1.1.1"
43
+ "@zhin.js/permission": "1.1.2",
44
+ "@zhin.js/skill": "1.1.2",
45
+ "@zhin.js/tool": "1.1.2"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@icqqjs/icqq": "^1.12.2",
49
49
  "zod": "^4.0.0",
50
- "@zhin.js/adapter": "^1.1.14",
51
- "@zhin.js/command": "^1.1.1",
52
- "@zhin.js/core": "^1.1.37",
53
- "@zhin.js/prompt-section": "^1.1.1",
54
- "zhin.js": "^1.1.2"
50
+ "@zhin.js/adapter": "^1.1.15",
51
+ "@zhin.js/command": "^1.1.2",
52
+ "@zhin.js/core": "^1.1.38",
53
+ "@zhin.js/prompt-section": "^1.1.2",
54
+ "zhin.js": "^1.1.3"
55
55
  },
56
56
  "peerDependenciesMeta": {
57
57
  "@icqqjs/icqq": {
@@ -76,8 +76,8 @@
76
76
  "typescript": "^6.0.3",
77
77
  "vitest": "^4.1.10",
78
78
  "zod": "^4.4.3",
79
- "@zhin.js/prompt-section": "1.1.1",
80
- "zhin.js": "1.1.2"
79
+ "@zhin.js/prompt-section": "1.1.2",
80
+ "zhin.js": "1.1.3"
81
81
  },
82
82
  "files": [
83
83
  "adapters",
@@ -500,6 +500,45 @@ export function icqqElementsToSegments(
500
500
  });
501
501
  break;
502
502
  }
503
+ case "share": {
504
+ const url = typeof el.url === "string" ? el.url.trim() : "";
505
+ const title = typeof el.title === "string" ? el.title.trim() : "";
506
+ if (!url || !title) break;
507
+ const description = typeof el.summary === "string" && el.summary
508
+ ? el.summary
509
+ : undefined;
510
+ const image = typeof el.image === "string" && el.image ? el.image : undefined;
511
+ const audio = typeof el.audio === "string" && el.audio ? el.audio : undefined;
512
+ const content = typeof el.content === "string" && el.content ? el.content : undefined;
513
+ const rawConfig = el.config && typeof el.config === "object" && !Array.isArray(el.config)
514
+ ? el.config as Record<string, unknown>
515
+ : undefined;
516
+ const appid = Number(rawConfig?.appid);
517
+ const config = Number.isSafeInteger(appid) && appid > 0
518
+ ? {
519
+ appid,
520
+ ...(typeof rawConfig?.appname === "string" && rawConfig.appname
521
+ ? { package: rawConfig.appname }
522
+ : {}),
523
+ ...(typeof rawConfig?.appsign === "string" && rawConfig.appsign
524
+ ? { sign: rawConfig.appsign }
525
+ : {}),
526
+ }
527
+ : undefined;
528
+ out.push({
529
+ type: "share",
530
+ data: {
531
+ url,
532
+ title,
533
+ ...(description ? { description } : {}),
534
+ ...(image ? { image } : {}),
535
+ ...(audio ? { audio } : {}),
536
+ ...(content ? { content } : {}),
537
+ ...(config ? { config } : {}),
538
+ },
539
+ });
540
+ break;
541
+ }
503
542
  default:
504
543
  if (el.text != null && el.text !== "") {
505
544
  out.push({ type: "text", data: { text: String(el.text) } });
package/src/protocol.ts CHANGED
@@ -533,7 +533,7 @@ function formatShare(data: Record<string, unknown> | undefined): ShareElem {
533
533
  ...(appsign ? { appsign } : {}),
534
534
  }
535
535
  : undefined;
536
- const summary = optionalString(data.artist);
536
+ const summary = optionalString(data.description) ?? optionalString(data.artist);
537
537
  const content = optionalString(data.content);
538
538
  const image = optionalString(data.image);
539
539
  const audio = optionalString(data.audio);