@openclaw/line 2026.7.2-beta.3 → 2026.7.2-beta.5

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 (112) hide show
  1. package/README.md +1 -1
  2. package/dist/{accounts-BUBOoW5Q.js → accounts-CSH5sk8U.js} +9 -11
  3. package/dist/api.js +4 -3
  4. package/dist/{card-command-DQ-epsgt.js → card-command-BEMIm8D8.js} +1 -1
  5. package/dist/{channel-uT5RTtpi.js → channel-CTaWrzfl.js} +15 -11
  6. package/dist/channel-plugin-api.js +1 -1
  7. package/dist/channel.runtime-D4Paci2y.js +4 -0
  8. package/dist/contract-api.js +1 -1
  9. package/dist/{flex-templates-K1lS9i8L.js → flex-templates-DVy_wog4.js} +318 -107
  10. package/dist/index.js +1 -1
  11. package/dist/{markdown-to-line-D1vapcdP.js → markdown-to-line-Dn00k1bq.js} +239 -229
  12. package/dist/{monitor-Bk-lpoOZ.js → monitor-DzFU5UPV.js} +317 -323
  13. package/dist/monitor.runtime-B8xjVqev.js +2 -0
  14. package/dist/outbound.runtime-eHl7NNHu.js +2 -0
  15. package/dist/{probe-BslD77tJ.js → probe-CM03wo6r.js} +7 -9
  16. package/dist/probe.runtime-D13ZtXsd.js +2 -0
  17. package/dist/quick-reply-fallback-D86FwAfr.js +56 -0
  18. package/dist/{reply-payload-transform-r9sa-TYT.js → reply-payload-transform-BRM2fRvK.js} +3 -164
  19. package/dist/runtime-api.js +9 -8
  20. package/dist/send-receipt-CY2ey8XH.js +107 -0
  21. package/dist/setup-api.js +1 -1
  22. package/dist/{setup-surface-BEt4mazl.js → setup-surface-BHQOSD8R.js} +107 -67
  23. package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupCreateRoute.d.ts.map +1 -1
  24. package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupFailedType.d.ts.map +1 -1
  25. package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupJobFailedType.d.ts.map +1 -1
  26. package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupJobStatus.d.ts.map +1 -1
  27. package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/model/audienceGroupStatus.d.ts.map +1 -1
  28. package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexBoxBorderWidth.d.ts.map +1 -1
  29. package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexBoxCornerRadius.d.ts.map +1 -1
  30. package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexBubble.d.ts.map +1 -1
  31. package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexIconSize.d.ts.map +1 -1
  32. package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexSpanSize.d.ts.map +1 -1
  33. package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/flexTextFontSize.d.ts.map +1 -1
  34. package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/numberOfMessagesResponse.d.ts.map +1 -1
  35. package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/postbackAction.d.ts.map +1 -1
  36. package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/subscriptionPeriodDemographic.d.ts.map +1 -1
  37. package/node_modules/@line/bot-sdk/dist/cjs/version.d.ts +1 -1
  38. package/node_modules/@line/bot-sdk/dist/cjs/version.js +1 -1
  39. package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/event.d.ts +2 -1
  40. package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/event.d.ts.map +1 -1
  41. package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/messageEditedEvent.d.ts +24 -0
  42. package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/messageEditedEvent.d.ts.map +1 -0
  43. package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/messageEditedEvent.js +14 -0
  44. package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/messageEditedEvent.js.map +1 -0
  45. package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/models.d.ts +1 -0
  46. package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/models.d.ts.map +1 -1
  47. package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/models.js +1 -0
  48. package/node_modules/@line/bot-sdk/dist/cjs/webhook/model/models.js.map +1 -1
  49. package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupCreateRoute.d.ts.map +1 -1
  50. package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupFailedType.d.ts.map +1 -1
  51. package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupJobFailedType.d.ts.map +1 -1
  52. package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupJobStatus.d.ts.map +1 -1
  53. package/node_modules/@line/bot-sdk/dist/manage-audience/model/audienceGroupStatus.d.ts.map +1 -1
  54. package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexBoxBorderWidth.d.ts.map +1 -1
  55. package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexBoxCornerRadius.d.ts.map +1 -1
  56. package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexBubble.d.ts.map +1 -1
  57. package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexIconSize.d.ts.map +1 -1
  58. package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexSpanSize.d.ts.map +1 -1
  59. package/node_modules/@line/bot-sdk/dist/messaging-api/model/flexTextFontSize.d.ts.map +1 -1
  60. package/node_modules/@line/bot-sdk/dist/messaging-api/model/numberOfMessagesResponse.d.ts.map +1 -1
  61. package/node_modules/@line/bot-sdk/dist/messaging-api/model/postbackAction.d.ts.map +1 -1
  62. package/node_modules/@line/bot-sdk/dist/messaging-api/model/subscriptionPeriodDemographic.d.ts.map +1 -1
  63. package/node_modules/@line/bot-sdk/dist/version.d.ts +1 -1
  64. package/node_modules/@line/bot-sdk/dist/version.js +1 -1
  65. package/node_modules/@line/bot-sdk/dist/webhook/model/event.d.ts +2 -1
  66. package/node_modules/@line/bot-sdk/dist/webhook/model/event.d.ts.map +1 -1
  67. package/node_modules/@line/bot-sdk/dist/webhook/model/messageEditedEvent.d.ts +24 -0
  68. package/node_modules/@line/bot-sdk/dist/webhook/model/messageEditedEvent.d.ts.map +1 -0
  69. package/node_modules/@line/bot-sdk/dist/webhook/model/messageEditedEvent.js +13 -0
  70. package/node_modules/@line/bot-sdk/dist/webhook/model/messageEditedEvent.js.map +1 -0
  71. package/node_modules/@line/bot-sdk/dist/webhook/model/models.d.ts +1 -0
  72. package/node_modules/@line/bot-sdk/dist/webhook/model/models.d.ts.map +1 -1
  73. package/node_modules/@line/bot-sdk/dist/webhook/model/models.js +1 -0
  74. package/node_modules/@line/bot-sdk/dist/webhook/model/models.js.map +1 -1
  75. package/node_modules/@line/bot-sdk/lib/insight/model/getNumberOfFollowersResponse.ts +1 -1
  76. package/node_modules/@line/bot-sdk/lib/liff/model/liffScope.ts +1 -1
  77. package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupCreateRoute.ts +1 -4
  78. package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupFailedType.ts +1 -2
  79. package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupJobFailedType.ts +1 -2
  80. package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupJobStatus.ts +1 -4
  81. package/node_modules/@line/bot-sdk/lib/manage-audience/model/audienceGroupStatus.ts +1 -6
  82. package/node_modules/@line/bot-sdk/lib/messaging-api/model/botInfoResponse.ts +1 -1
  83. package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexBoxBorderWidth.ts +1 -6
  84. package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexBoxCornerRadius.ts +1 -7
  85. package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexBubble.ts +1 -7
  86. package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexIconSize.ts +1 -10
  87. package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexSpanSize.ts +1 -10
  88. package/node_modules/@line/bot-sdk/lib/messaging-api/model/flexTextFontSize.ts +1 -10
  89. package/node_modules/@line/bot-sdk/lib/messaging-api/model/getAggregationUnitNameListResponse.ts +1 -1
  90. package/node_modules/@line/bot-sdk/lib/messaging-api/model/getFollowersResponse.ts +1 -1
  91. package/node_modules/@line/bot-sdk/lib/messaging-api/model/getJoinedMembershipUsersResponse.ts +1 -1
  92. package/node_modules/@line/bot-sdk/lib/messaging-api/model/issueLinkTokenResponse.ts +1 -1
  93. package/node_modules/@line/bot-sdk/lib/messaging-api/model/numberOfMessagesResponse.ts +2 -5
  94. package/node_modules/@line/bot-sdk/lib/messaging-api/model/postbackAction.ts +1 -4
  95. package/node_modules/@line/bot-sdk/lib/messaging-api/model/subscriptionPeriodDemographic.ts +1 -5
  96. package/node_modules/@line/bot-sdk/lib/version.ts +1 -1
  97. package/node_modules/@line/bot-sdk/lib/webhook/.openapi-generator/FILES +1 -0
  98. package/node_modules/@line/bot-sdk/lib/webhook/model/event.ts +2 -0
  99. package/node_modules/@line/bot-sdk/lib/webhook/model/messageEditedEvent.ts +32 -0
  100. package/node_modules/@line/bot-sdk/lib/webhook/model/models.ts +1 -0
  101. package/node_modules/@line/bot-sdk/lib/webhook/model/stickerMessageContent.ts +1 -1
  102. package/node_modules/@line/bot-sdk/package.json +3 -3
  103. package/node_modules/@types/node/README.md +1 -1
  104. package/node_modules/@types/node/fs/promises.d.ts +16 -5
  105. package/node_modules/@types/node/package.json +3 -3
  106. package/openclaw.plugin.json +0 -18
  107. package/package.json +71 -7
  108. package/dist/channel.runtime-BqNglqnr.js +0 -4
  109. package/dist/monitor.runtime-CHlqxGVL.js +0 -2
  110. package/dist/outbound.runtime-ByZ0Dsvu.js +0 -2
  111. package/dist/probe.runtime-CRhVGqwl.js +0 -2
  112. package/npm-shrinkwrap.json +0 -60
@@ -1,4 +1,310 @@
1
1
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
2
+ //#region extensions/line/src/actions.ts
3
+ const LINE_ACTION_LABEL_LIMIT = 20;
4
+ const LINE_ACTION_DATA_LIMIT = 300;
5
+ const LINE_ACTION_URI_LIMIT = 1e3;
6
+ const LINE_CLIPBOARD_TEXT_LIMIT = 1e3;
7
+ const LINE_RICH_MENU_ALIAS_LIMIT = 32;
8
+ const LINE_IMAGEMAP_ACTION_LABEL_LIMIT = 100;
9
+ const LINE_IMAGEMAP_MESSAGE_TEXT_LIMIT = 400;
10
+ const LINE_IMAGEMAP_EXTERNAL_LINK_LABEL_LIMIT = 30;
11
+ const LINE_IMAGEMAP_ACTION_LIMIT = 50;
12
+ const graphemeSegmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
13
+ function truncateLineActionText(text, limit) {
14
+ let result = "";
15
+ let count = 0;
16
+ for (const { segment } of graphemeSegmenter.segment(text)) {
17
+ const codePointCount = Array.from(segment).length;
18
+ if (count + codePointCount > limit) break;
19
+ result += segment;
20
+ count += codePointCount;
21
+ }
22
+ return result;
23
+ }
24
+ function truncateLineActionLabel(label, limit = LINE_ACTION_LABEL_LIMIT) {
25
+ return truncateLineActionText(label, limit) || (label ? "…" : "");
26
+ }
27
+ function truncateLineActionData(data) {
28
+ return truncateUtf16Safe(data, LINE_ACTION_DATA_LIMIT);
29
+ }
30
+ const unavailableActionMarker = Symbol("lineUnavailableAction");
31
+ function unavailableAction(kind, reason) {
32
+ const action = {
33
+ type: "message",
34
+ label: "Unavailable",
35
+ text: `${kind} unavailable: ${reason}`
36
+ };
37
+ Object.defineProperty(action, unavailableActionMarker, { value: true });
38
+ return action;
39
+ }
40
+ const actionTypes = /* @__PURE__ */ new Set([
41
+ "camera",
42
+ "cameraRoll",
43
+ "clipboard",
44
+ "datetimepicker",
45
+ "location",
46
+ "message",
47
+ "postback",
48
+ "richmenuswitch",
49
+ "uri"
50
+ ]);
51
+ function isRecord(value) {
52
+ return typeof value === "object" && value !== null && !Array.isArray(value);
53
+ }
54
+ function isLineAction(value) {
55
+ return isRecord(value) && typeof value.type === "string" && actionTypes.has(value.type);
56
+ }
57
+ function isUnavailableAction(action) {
58
+ return action[unavailableActionMarker] === true;
59
+ }
60
+ function normalizeNestedActions(value, labelLimit, warnings) {
61
+ if (Array.isArray(value)) {
62
+ const normalized = [];
63
+ for (const item of value) normalized.push(normalizeNestedActions(item, labelLimit, warnings));
64
+ return normalized;
65
+ }
66
+ if (!isRecord(value)) return value;
67
+ const normalized = { ...value };
68
+ for (const [key, nested] of Object.entries(value)) if ((key === "action" || key === "defaultAction") && isLineAction(nested)) {
69
+ const action = normalizeLineAction(nested, labelLimit);
70
+ if (warnings && key === "action" && (value.type === "video" && action.type !== "uri" || value.type !== "button" && isUnavailableAction(action))) {
71
+ delete normalized[key];
72
+ warnings.push(isUnavailableAction(action) ? action.text ?? "Action unavailable." : "Action unavailable in this video.");
73
+ } else normalized[key] = action;
74
+ } else if (key === "actions" && Array.isArray(nested)) normalized[key] = nested.map((action) => isLineAction(action) ? normalizeLineAction(action, labelLimit) : action);
75
+ else normalized[key] = normalizeNestedActions(nested, labelLimit, warnings);
76
+ return normalized;
77
+ }
78
+ function normalizeFlexBubbleActions(value) {
79
+ if (!isRecord(value) || value.type !== "bubble") return normalizeNestedActions(value, 40);
80
+ const warnings = [];
81
+ const normalized = normalizeNestedActions(value, 40, warnings);
82
+ if (!isRecord(normalized) || warnings.length === 0) return normalized;
83
+ const warning = {
84
+ type: "text",
85
+ text: [...new Set(warnings)].join("\n"),
86
+ wrap: true,
87
+ size: "sm",
88
+ color: "#B45309",
89
+ margin: "md"
90
+ };
91
+ const body = normalized.body;
92
+ if (isRecord(body) && Array.isArray(body.contents)) normalized.body = {
93
+ ...body,
94
+ contents: [...body.contents, warning]
95
+ };
96
+ else normalized.body = {
97
+ type: "box",
98
+ layout: "vertical",
99
+ contents: [warning]
100
+ };
101
+ return normalized;
102
+ }
103
+ function normalizeFlexContainerActions(value) {
104
+ if (!isRecord(value)) return value;
105
+ if (value.type === "bubble") return normalizeFlexBubbleActions(value);
106
+ if (value.type === "carousel" && Array.isArray(value.contents)) return {
107
+ ...value,
108
+ contents: value.contents.map((bubble) => normalizeFlexBubbleActions(bubble))
109
+ };
110
+ return normalizeNestedActions(value, 40);
111
+ }
112
+ function unavailableImagemapAction(kind, reason, area) {
113
+ return {
114
+ type: "message",
115
+ label: "Unavailable",
116
+ text: `${kind} unavailable: ${reason}`,
117
+ area
118
+ };
119
+ }
120
+ function normalizeImagemapAction(action) {
121
+ const label = action.label === void 0 ? void 0 : truncateLineActionText(action.label, LINE_IMAGEMAP_ACTION_LABEL_LIMIT);
122
+ if (action.type === "uri") {
123
+ if (truncateUtf16Safe(action.linkUri, LINE_ACTION_URI_LIMIT) !== action.linkUri) return unavailableImagemapAction("Link", "URL exceeds LINE's limit.", action.area);
124
+ return {
125
+ ...action,
126
+ label
127
+ };
128
+ }
129
+ if (action.type === "message") {
130
+ const text = truncateUtf16Safe(action.text, LINE_IMAGEMAP_MESSAGE_TEXT_LIMIT);
131
+ if (text !== action.text) return unavailableImagemapAction("Action", "message text exceeds LINE's limit.", action.area);
132
+ return {
133
+ ...action,
134
+ label,
135
+ text
136
+ };
137
+ }
138
+ if (truncateUtf16Safe(action.clipboardText, LINE_CLIPBOARD_TEXT_LIMIT) !== action.clipboardText) return unavailableImagemapAction("Action", "clipboard text exceeds LINE's limit.", action.area);
139
+ return {
140
+ ...action,
141
+ label
142
+ };
143
+ }
144
+ function normalizeImagemapVideo(video) {
145
+ const externalLink = video.externalLink;
146
+ if (!externalLink) return { video };
147
+ const label = externalLink.label === void 0 ? void 0 : truncateUtf16Safe(externalLink.label, LINE_IMAGEMAP_EXTERNAL_LINK_LABEL_LIMIT) || (externalLink.label ? "…" : "");
148
+ if (externalLink.linkUri !== void 0 && truncateUtf16Safe(externalLink.linkUri, LINE_ACTION_URI_LIMIT) !== externalLink.linkUri) {
149
+ const normalizedVideo = { ...video };
150
+ delete normalizedVideo.externalLink;
151
+ return {
152
+ video: normalizedVideo,
153
+ fallbackAction: video.area === void 0 ? void 0 : unavailableImagemapAction("Link", "URL exceeds LINE's limit.", video.area)
154
+ };
155
+ }
156
+ return { video: {
157
+ ...video,
158
+ externalLink: {
159
+ ...externalLink,
160
+ label
161
+ }
162
+ } };
163
+ }
164
+ function normalizeLineMessageActions(message) {
165
+ let normalized;
166
+ if (message.type === "flex") normalized = {
167
+ ...message,
168
+ contents: normalizeFlexContainerActions(message.contents)
169
+ };
170
+ else if (message.type === "template") {
171
+ const labelLimit = message.template.type === "image_carousel" ? 12 : 20;
172
+ normalized = {
173
+ ...message,
174
+ template: normalizeNestedActions(message.template, labelLimit)
175
+ };
176
+ } else if (message.type === "imagemap") {
177
+ const actions = message.actions.map(normalizeImagemapAction);
178
+ const videoResult = message.video ? normalizeImagemapVideo(message.video) : void 0;
179
+ if (videoResult?.fallbackAction) {
180
+ if (actions.length < LINE_IMAGEMAP_ACTION_LIMIT) actions.push(videoResult.fallbackAction);
181
+ }
182
+ normalized = {
183
+ ...message,
184
+ actions,
185
+ video: videoResult?.video
186
+ };
187
+ } else normalized = { ...message };
188
+ if (message.quickReply) normalized = {
189
+ ...normalized,
190
+ quickReply: normalizeNestedActions(message.quickReply, 20)
191
+ };
192
+ return normalized;
193
+ }
194
+ function normalizeLineAction(action, labelLimit = LINE_ACTION_LABEL_LIMIT) {
195
+ if (isUnavailableAction(action)) return action;
196
+ const label = action.label === void 0 ? void 0 : truncateLineActionLabel(action.label, labelLimit);
197
+ if (action.type === "uri") {
198
+ const uriTooLong = action.uri !== void 0 && truncateUtf16Safe(action.uri, LINE_ACTION_URI_LIMIT) !== action.uri;
199
+ const desktopUri = action.altUri?.desktop;
200
+ const desktopUriTooLong = desktopUri !== void 0 && truncateUtf16Safe(desktopUri, LINE_ACTION_URI_LIMIT) !== desktopUri;
201
+ if (uriTooLong || desktopUriTooLong) return unavailableAction("Link", "URL exceeds LINE's limit.");
202
+ return {
203
+ ...action,
204
+ label
205
+ };
206
+ }
207
+ if (action.type === "postback") {
208
+ const data = action.data === void 0 ? void 0 : truncateLineActionData(action.data);
209
+ if (data !== action.data) return unavailableAction("Action", "callback data exceeds LINE's limit.");
210
+ const text = action.text === void 0 ? void 0 : truncateLineActionText(action.text, LINE_ACTION_DATA_LIMIT);
211
+ const fillInText = action.fillInText === void 0 ? void 0 : truncateLineActionText(action.fillInText, LINE_ACTION_DATA_LIMIT);
212
+ if (text !== action.text || fillInText !== action.fillInText) return unavailableAction("Action", "message text exceeds LINE's limit.");
213
+ return {
214
+ ...action,
215
+ label,
216
+ data,
217
+ displayText: action.displayText === void 0 ? void 0 : truncateLineActionText(action.displayText, LINE_ACTION_DATA_LIMIT),
218
+ text,
219
+ fillInText
220
+ };
221
+ }
222
+ if (action.type === "datetimepicker") {
223
+ const data = action.data === void 0 ? void 0 : truncateLineActionData(action.data);
224
+ if (data !== action.data) return unavailableAction("Action", "callback data exceeds LINE's limit.");
225
+ return {
226
+ ...action,
227
+ label,
228
+ data
229
+ };
230
+ }
231
+ if (action.type === "message") {
232
+ const text = action.text === void 0 ? void 0 : truncateLineActionText(action.text, LINE_ACTION_DATA_LIMIT);
233
+ if (text !== action.text) return unavailableAction("Action", "message text exceeds LINE's limit.");
234
+ return {
235
+ ...action,
236
+ label,
237
+ text
238
+ };
239
+ }
240
+ if (action.type === "clipboard") {
241
+ if (truncateUtf16Safe(action.clipboardText, LINE_CLIPBOARD_TEXT_LIMIT) !== action.clipboardText) return unavailableAction("Action", "clipboard text exceeds LINE's limit.");
242
+ return {
243
+ ...action,
244
+ label
245
+ };
246
+ }
247
+ if (action.type === "richmenuswitch") {
248
+ const data = action.data === void 0 ? void 0 : truncateLineActionData(action.data);
249
+ const aliasTooLong = action.richMenuAliasId !== void 0 && truncateUtf16Safe(action.richMenuAliasId, LINE_RICH_MENU_ALIAS_LIMIT) !== action.richMenuAliasId;
250
+ if (data !== action.data || aliasTooLong) return unavailableAction("Action", "rich menu data exceeds LINE's limit.");
251
+ return {
252
+ ...action,
253
+ label,
254
+ data
255
+ };
256
+ }
257
+ return action.label === label ? action : {
258
+ ...action,
259
+ label
260
+ };
261
+ }
262
+ /**
263
+ * Create a message action (sends text when tapped)
264
+ */
265
+ function messageAction(label, text) {
266
+ return normalizeLineAction({
267
+ type: "message",
268
+ label,
269
+ text: text ?? label
270
+ });
271
+ }
272
+ /**
273
+ * Create a URI action (opens a URL when tapped)
274
+ */
275
+ function uriAction(label, uri) {
276
+ return normalizeLineAction({
277
+ type: "uri",
278
+ label,
279
+ uri
280
+ });
281
+ }
282
+ /**
283
+ * Create a postback action (sends data to webhook when tapped)
284
+ */
285
+ function postbackAction(label, data, displayText) {
286
+ return normalizeLineAction({
287
+ type: "postback",
288
+ label,
289
+ data,
290
+ displayText
291
+ });
292
+ }
293
+ /**
294
+ * Create a datetime picker action
295
+ */
296
+ function datetimePickerAction(label, data, mode, options) {
297
+ return normalizeLineAction({
298
+ type: "datetimepicker",
299
+ label,
300
+ data,
301
+ mode,
302
+ initial: options?.initial,
303
+ max: options?.max,
304
+ min: options?.min
305
+ });
306
+ }
307
+ //#endregion
2
308
  //#region extensions/line/src/flex-templates/common.ts
3
309
  function attachFooterText(bubble, footer) {
4
310
  bubble.footer = {
@@ -124,7 +430,7 @@ function createListCard(title, items) {
124
430
  }],
125
431
  margin: index > 0 ? "lg" : void 0
126
432
  };
127
- if (item.action) itemBox.action = item.action;
433
+ if (item.action) itemBox.action = normalizeLineAction(item.action, 40);
128
434
  return itemBox;
129
435
  });
130
436
  return {
@@ -171,7 +477,7 @@ function createImageCard(imageUrl, title, body, options) {
171
477
  size: "full",
172
478
  aspectRatio: options?.aspectRatio ?? "20:13",
173
479
  aspectMode: options?.aspectMode ?? "cover",
174
- action: options?.action
480
+ action: options?.action === void 0 ? void 0 : normalizeLineAction(options.action, 40)
175
481
  },
176
482
  body: {
177
483
  type: "box",
@@ -226,7 +532,7 @@ function createActionCard(title, body, actions, options) {
226
532
  layout: "vertical",
227
533
  contents: actions.slice(0, 4).map((action, index) => ({
228
534
  type: "button",
229
- action: action.action,
535
+ action: normalizeLineAction(action.action, 40),
230
536
  style: index === 0 ? "primary" : "secondary",
231
537
  margin: index > 0 ? "sm" : void 0
232
538
  })),
@@ -564,7 +870,7 @@ function createEventCard(params) {
564
870
  contents: bodyContents,
565
871
  paddingAll: "xl",
566
872
  backgroundColor: "#FFFFFF",
567
- action
873
+ action: action === void 0 ? void 0 : normalizeLineAction(action, 40)
568
874
  }
569
875
  };
570
876
  }
@@ -662,61 +968,6 @@ function createAgendaCard(params) {
662
968
  });
663
969
  }
664
970
  //#endregion
665
- //#region extensions/line/src/actions.ts
666
- const LINE_ACTION_LABEL_LIMIT = 20;
667
- const LINE_ACTION_DATA_LIMIT = 300;
668
- function truncateLineActionLabel(label, limit = LINE_ACTION_LABEL_LIMIT) {
669
- return truncateUtf16Safe(label, limit);
670
- }
671
- function truncateLineActionData(data) {
672
- return truncateUtf16Safe(data, LINE_ACTION_DATA_LIMIT);
673
- }
674
- /**
675
- * Create a message action (sends text when tapped)
676
- */
677
- function messageAction(label, text) {
678
- return {
679
- type: "message",
680
- label: truncateLineActionLabel(label),
681
- text: text ?? label
682
- };
683
- }
684
- /**
685
- * Create a URI action (opens a URL when tapped)
686
- */
687
- function uriAction(label, uri) {
688
- return {
689
- type: "uri",
690
- label: truncateLineActionLabel(label),
691
- uri
692
- };
693
- }
694
- /**
695
- * Create a postback action (sends data to webhook when tapped)
696
- */
697
- function postbackAction(label, data, displayText) {
698
- return {
699
- type: "postback",
700
- label: truncateLineActionLabel(label),
701
- data: truncateLineActionData(data),
702
- displayText: displayText === void 0 ? void 0 : truncateLineActionData(displayText)
703
- };
704
- }
705
- /**
706
- * Create a datetime picker action
707
- */
708
- function datetimePickerAction(label, data, mode, options) {
709
- return {
710
- type: "datetimepicker",
711
- label: truncateLineActionLabel(label),
712
- data: truncateLineActionData(data),
713
- mode,
714
- initial: options?.initial,
715
- max: options?.max,
716
- min: options?.min
717
- };
718
- }
719
- //#endregion
720
971
  //#region extensions/line/src/flex-templates/media-control-cards.ts
721
972
  /**
722
973
  * Create a media player card for Sonos, Spotify, Apple Music, etc.
@@ -815,22 +1066,14 @@ function createMediaPlayerCard(params) {
815
1066
  const controlButtons = [];
816
1067
  if (controls.previous) controlButtons.push({
817
1068
  type: "button",
818
- action: {
819
- type: "postback",
820
- label: "⏮",
821
- data: controls.previous.data
822
- },
1069
+ action: postbackAction("⏮", controls.previous.data),
823
1070
  style: "secondary",
824
1071
  flex: 1,
825
1072
  height: "sm"
826
1073
  });
827
1074
  if (controls.play) controlButtons.push({
828
1075
  type: "button",
829
- action: {
830
- type: "postback",
831
- label: "▶",
832
- data: controls.play.data
833
- },
1076
+ action: postbackAction("▶", controls.play.data),
834
1077
  style: isPlaying ? "secondary" : "primary",
835
1078
  flex: 1,
836
1079
  height: "sm",
@@ -838,11 +1081,7 @@ function createMediaPlayerCard(params) {
838
1081
  });
839
1082
  if (controls.pause) controlButtons.push({
840
1083
  type: "button",
841
- action: {
842
- type: "postback",
843
- label: "⏸",
844
- data: controls.pause.data
845
- },
1084
+ action: postbackAction("⏸", controls.pause.data),
846
1085
  style: isPlaying ? "primary" : "secondary",
847
1086
  flex: 1,
848
1087
  height: "sm",
@@ -850,11 +1089,7 @@ function createMediaPlayerCard(params) {
850
1089
  });
851
1090
  if (controls.next) controlButtons.push({
852
1091
  type: "button",
853
- action: {
854
- type: "postback",
855
- label: "⏭",
856
- data: controls.next.data
857
- },
1092
+ action: postbackAction("⏭", controls.next.data),
858
1093
  style: "secondary",
859
1094
  flex: 1,
860
1095
  height: "sm",
@@ -871,11 +1106,7 @@ function createMediaPlayerCard(params) {
871
1106
  layout: "horizontal",
872
1107
  contents: extraActions.slice(0, 2).map((action, index) => ({
873
1108
  type: "button",
874
- action: {
875
- type: "postback",
876
- label: truncateLineActionLabel(action.label, 15),
877
- data: action.data
878
- },
1109
+ action: postbackAction(truncateLineActionLabel(action.label, 15), action.data),
879
1110
  style: "secondary",
880
1111
  flex: 1,
881
1112
  height: "sm",
@@ -916,11 +1147,7 @@ function createAppleTvRemoteCard(params) {
916
1147
  });
917
1148
  const makeButton = (label, data, style = "secondary") => ({
918
1149
  type: "button",
919
- action: {
920
- type: "postback",
921
- label,
922
- data
923
- },
1150
+ action: postbackAction(label, data),
924
1151
  style,
925
1152
  height: "sm",
926
1153
  flex: 1
@@ -1085,11 +1312,7 @@ function createDeviceControlCard(params) {
1085
1312
  const buttonLabel = ctrl.icon ? `${ctrl.icon} ${ctrl.label}` : ctrl.label;
1086
1313
  rowButtons.push({
1087
1314
  type: "button",
1088
- action: {
1089
- type: "postback",
1090
- label: truncateLineActionLabel(buttonLabel, 18),
1091
- data: ctrl.data
1092
- },
1315
+ action: postbackAction(truncateLineActionLabel(buttonLabel, 18), ctrl.data),
1093
1316
  style: ctrl.style ?? "secondary",
1094
1317
  flex: 1,
1095
1318
  height: "sm",
@@ -1115,16 +1338,4 @@ function createDeviceControlCard(params) {
1115
1338
  return bubble;
1116
1339
  }
1117
1340
  //#endregion
1118
- //#region extensions/line/src/flex-templates/message.ts
1119
- /**
1120
- * Wrap a FlexContainer in a FlexMessage
1121
- */
1122
- function toFlexMessage(altText, contents) {
1123
- return {
1124
- type: "flex",
1125
- altText,
1126
- contents
1127
- };
1128
- }
1129
- //#endregion
1130
- export { createNotificationBubble as _, datetimePickerAction as a, uriAction as c, createReceiptCard as d, createActionCard as f, createListCard as g, createInfoCard as h, createMediaPlayerCard as i, createAgendaCard as l, createImageCard as m, createAppleTvRemoteCard as n, messageAction as o, createCarousel as p, createDeviceControlCard as r, postbackAction as s, toFlexMessage as t, createEventCard as u };
1341
+ export { postbackAction as _, createEventCard as a, createCarousel as c, createListCard as d, createNotificationBubble as f, normalizeLineMessageActions as g, normalizeLineAction as h, createAgendaCard as i, createImageCard as l, messageAction as m, createDeviceControlCard as n, createReceiptCard as o, datetimePickerAction as p, createMediaPlayerCard as r, createActionCard as s, createAppleTvRemoteCard as t, createInfoCard as u, uriAction as v };
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
4
4
  function createLineCardCommandLoader(api) {
5
5
  return createLazyRuntimeModule(async () => {
6
6
  let registered = null;
7
- const { registerLineCardCommand } = await import("./card-command-DQ-epsgt.js");
7
+ const { registerLineCardCommand } = await import("./card-command-BEMIm8D8.js");
8
8
  registerLineCardCommand({
9
9
  ...api,
10
10
  registerCommand(command) {