@openclaw/discord 2026.10.5 → 2026.10.10-beta.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 (64) hide show
  1. package/dist/.setup/{approval-handler.runtime-D88-QVlO.mjs → approval-handler.runtime-BvF8oUpa.mjs} +9 -9
  2. package/dist/.setup/{approval-message-updates-CIGByUcE.mjs → approval-message-updates-wbUqLtLI.mjs} +2 -2
  3. package/dist/.setup/{audit-TGIPL0f_.mjs → audit-UwzCdDJk.mjs} +3 -3
  4. package/dist/.setup/{channel-C24afwHP.mjs → channel-BlvyeRAu.mjs} +72 -49
  5. package/dist/.setup/{channel.setup-B3KEh05g.mjs → channel.setup-By7wNopw.mjs} +1 -1
  6. package/dist/.setup/{command-owners-C7rUdqUX.mjs → command-owners-D78sAoOz.mjs} +1 -1
  7. package/dist/.setup/{components-HN9052L1.mjs → components-C_cuoW1q.mjs} +1 -1
  8. package/dist/.setup/conversation-binding-route-fdYsXexV.mjs +68 -0
  9. package/dist/.setup/{discord-BGqgx-yd.mjs → discord-Cl2OPTZ6.mjs} +18 -14
  10. package/dist/.setup/{doctor-9Ka20lDD.mjs → doctor-94GSI6lY.mjs} +2 -2
  11. package/dist/.setup/{handle-action-CsQmpfGZ.mjs → handle-action-0-FZD3Am.mjs} +7 -7
  12. package/dist/.setup/{handle-action.guild-admin-Aw-vutu3.mjs → handle-action.guild-admin-DfAWANBE.mjs} +2 -2
  13. package/dist/.setup/{message-handler-C_BQFYCW.mjs → message-handler-CtR2w7W_.mjs} +4 -4
  14. package/dist/.setup/{message-handler.preflight-C_xFOxPN.mjs → message-handler.preflight-BqUw7LWb.mjs} +11 -10
  15. package/dist/.setup/{message-handler.preflight-pluralkit-CfRsEwg4.mjs → message-handler.preflight-pluralkit-BU9I_X-b.mjs} +4 -6
  16. package/dist/.setup/{message-handler.process-_np9if7z.mjs → message-handler.process-BZeWmSNC.mjs} +40 -50
  17. package/dist/.setup/{outbound-adapter-L3UDoMOG.mjs → outbound-adapter-DBwgKemw.mjs} +5 -5
  18. package/dist/.setup/{outbound-session-route-iwnu6IK8.mjs → outbound-session-route-CsHHPxsQ.mjs} +24 -7
  19. package/dist/.setup/{provider-CbmXLYrW.mjs → provider-DUTsZJHz.mjs} +230 -205
  20. package/dist/.setup/{provider-session.runtime-BMOuDbod.mjs → provider-session.runtime-Ucr3XodI.mjs} +3 -3
  21. package/dist/.setup/provider.runtime-J8NuMCNs.mjs +1 -0
  22. package/dist/.setup/{realtime-session.runtime-YCumnRSE.mjs → realtime-session.runtime-bNnPOKP_.mjs} +161 -150
  23. package/dist/.setup/{receive-recovery-eVmK2_hl.mjs → receive-recovery-CKvaG2Hf.mjs} +4 -25
  24. package/dist/.setup/{runtime-DPm3gZXk.mjs → runtime-Cg5pIBm_.mjs} +1 -1
  25. package/dist/.setup/{runtime-CRTkKU1G.mjs → runtime-DE6W14G3.mjs} +7 -7
  26. package/dist/.setup/{send-DbILKgcm.mjs → send-yR1hfybW.mjs} +26 -12
  27. package/dist/.setup/{send.components-FxOS3CeP.mjs → send.components--dxMjc2O.mjs} +5 -5
  28. package/dist/.setup/{send.outbound-_jx4Xpd3.mjs → send.outbound-B5vQwgUK.mjs} +10 -4
  29. package/dist/.setup/{send.receipt-BAlzXd8e.mjs → send.receipt-eE3zLTDH.mjs} +3 -9
  30. package/dist/.setup/{send.shared-CjQ4jbMA.mjs → send.shared-iGf1rqAm.mjs} +4 -3
  31. package/dist/.setup/setup-plugin-api-DVpA_yqS.mjs +2 -0
  32. package/dist/.setup/{shared-C027f-lL.mjs → shared-DgzLizSt.mjs} +1 -1
  33. package/dist/.setup/{subagent-hooks-CME7dSGf.mjs → subagent-hooks-tBtaqWkD.mjs} +21 -12
  34. package/dist/.setup/{system-events-BwwSDCw4.mjs → system-events-DGsxf-l9.mjs} +1 -1
  35. package/dist/.setup/{target-resolver-Bse8fuTi.mjs → target-resolver-BFOKmBni.mjs} +1 -1
  36. package/dist/.setup/{targets-DZJjkzwv.mjs → targets-UbCpek5o.mjs} +1 -1
  37. package/dist/.setup/{thread-bindings-0hPTSK14.mjs → thread-bindings-Dsc3zsrI.mjs} +29 -7
  38. package/dist/.setup/{thread-bindings.manager-CdNa6UIs.mjs → thread-bindings.manager-BMpmKLQh.mjs} +63 -19
  39. package/dist/.setup/{thread-bindings.session-updates-DGSljVf6.mjs → thread-bindings.session-updates-BMdJeJMc.mjs} +39 -122
  40. package/dist/.setup/{threading-BWz5lW0p.mjs → threading-Cg_QRc8s.mjs} +2 -2
  41. package/dist/.setup/{transcripts-source-EMrQb132.mjs → transcripts-source-fRvFsZng.mjs} +12 -17
  42. package/dist/.setup/{voice-runtime-BFEBhf2B.mjs → voice-runtime-DHDNu0fz.mjs} +73 -120
  43. package/dist/action-runtime-api.js +1 -1
  44. package/dist/activities-api.js +3 -3
  45. package/dist/api.js +11 -11
  46. package/dist/channel-plugin-api.js +1 -1
  47. package/dist/runtime-api.js +15 -15
  48. package/dist/setup-entry.js +1 -1
  49. package/dist/setup-plugin-api.js +1 -1
  50. package/dist/src/voice/audio-worker.runtime.js +8 -11
  51. package/dist/subagent-hooks-api.js +1 -1
  52. package/dist/transcripts-source-api.js +1 -1
  53. package/node_modules/mdast-util-from-markdown/dev/lib/index.js +152 -45
  54. package/node_modules/mdast-util-from-markdown/dev/lib/types.d.ts +26 -0
  55. package/node_modules/mdast-util-from-markdown/lib/index.js +133 -40
  56. package/node_modules/mdast-util-from-markdown/lib/types.d.ts +26 -0
  57. package/node_modules/mdast-util-from-markdown/package.json +6 -7
  58. package/node_modules/mdast-util-from-markdown/readme.md +15 -1
  59. package/node_modules/typebox/build/value/clean/from_object.mjs +1 -1
  60. package/node_modules/typebox/package.json +1 -1
  61. package/package.json +6 -6
  62. package/dist/.setup/conversation-binding-route-r4XyytCE.mjs +0 -51
  63. package/dist/.setup/provider.runtime-1yN_05AK.mjs +0 -1
  64. package/dist/.setup/setup-plugin-api-BFl2FljJ.mjs +0 -2
@@ -97,6 +97,8 @@ export function fromMarkdown(value, encoding, options) {
97
97
  function compiler(options) {
98
98
  /** @type {Config} */
99
99
  const config = {
100
+ afterExit: [],
101
+ beforeEnter: [],
100
102
  transforms: [],
101
103
  canContainEols: ['emphasis', 'fragment', 'heading', 'paragraph', 'strong'],
102
104
  enter: {
@@ -212,7 +214,7 @@ function compiler(options) {
212
214
  */
213
215
  function compile(events) {
214
216
  /** @type {Root} */
215
- let tree = {type: 'root', children: []}
217
+ let tree = {type: 'root', children: [], position: undefined}
216
218
  /** @type {Omit<CompileContext, 'sliceSerialize'>} */
217
219
  const context = {
218
220
  stack: [tree],
@@ -226,36 +228,56 @@ function compiler(options) {
226
228
  }
227
229
  /** @type {Array<number>} */
228
230
  const listStack = []
231
+ /** @type {Array<Event>} */
232
+ const prepared = []
229
233
  let index = -1
230
234
 
235
+ // Add `listItem` tokens and infer spread.
236
+ // Each list is prepared while it is last in `prepared`, so nothing shifts.
231
237
  while (++index < events.length) {
232
- // We preprocess lists to add `listItem` tokens, and to infer whether
233
- // items the list itself are spread out.
238
+ prepared.push(events[index])
239
+
234
240
  if (
235
241
  events[index][1].type === types.listOrdered ||
236
242
  events[index][1].type === types.listUnordered
237
243
  ) {
238
244
  if (events[index][0] === 'enter') {
239
- listStack.push(index)
245
+ listStack.push(prepared.length - 1)
240
246
  } else {
241
247
  const tail = listStack.pop()
242
248
  assert(typeof tail === 'number', 'expected list to be open')
243
- index = prepareList(events, tail, index)
249
+ prepareList(prepared, tail)
244
250
  }
245
251
  }
246
252
  }
247
253
 
254
+ events = prepared
255
+
248
256
  index = -1
249
257
 
250
258
  while (++index < events.length) {
251
259
  const handler = config[events[index][0]]
252
260
 
261
+ if (events[index][0] === 'enter' && config.beforeEnter.length > 0) {
262
+ callListeners(
263
+ config.beforeEnter,
264
+ {...context, sliceSerialize: events[index][2].sliceSerialize},
265
+ events[index][1]
266
+ )
267
+ }
268
+
253
269
  if (own.call(handler, events[index][1].type)) {
270
+ // Note: spread first, V8 has optimizations for object shape cloning.
254
271
  handler[events[index][1].type].call(
255
- Object.assign(
256
- {sliceSerialize: events[index][2].sliceSerialize},
257
- context
258
- ),
272
+ {...context, sliceSerialize: events[index][2].sliceSerialize},
273
+ events[index][1]
274
+ )
275
+ }
276
+
277
+ if (events[index][0] === 'exit' && config.afterExit.length > 0) {
278
+ callListeners(
279
+ config.afterExit,
280
+ {...context, sliceSerialize: events[index][2].sliceSerialize},
259
281
  events[index][1]
260
282
  )
261
283
  }
@@ -289,13 +311,33 @@ function compiler(options) {
289
311
  return tree
290
312
  }
291
313
 
314
+ /**
315
+ * @param {Array<Handle>} listeners
316
+ * Listeners.
317
+ * @param {CompileContext} context
318
+ * Context.
319
+ * @param {Token} token
320
+ * Token.
321
+ * @returns {undefined}
322
+ * Nothing.
323
+ */
324
+ function callListeners(listeners, context, token) {
325
+ let index = -1
326
+
327
+ while (++index < listeners.length) {
328
+ listeners[index].call(context, token)
329
+ }
330
+ }
331
+
292
332
  /**
293
333
  * @param {Array<Event>} events
334
+ * Events, ending with the list to prepare.
294
335
  * @param {number} start
295
- * @param {number} length
296
- * @returns {number}
336
+ * Index of the list enter.
337
+ * @returns {undefined}
297
338
  */
298
- function prepareList(events, start, length) {
339
+ function prepareList(events, start) {
340
+ const end = events.length - 1
299
341
  let index = start - 1
300
342
  let containerBalance = -1
301
343
  let listSpread = false
@@ -307,8 +349,15 @@ function compiler(options) {
307
349
  let firstBlankLineIndex
308
350
  /** @type {boolean | undefined} */
309
351
  let atMarker
352
+ /**
353
+ * `listItem` events to insert before the event at `at`, in walk order.
354
+ * Merged in after the walk, as inserting while walking would shift the
355
+ * rest of the list once per item.
356
+ * @type {Array<{at: number, event: Event}>}
357
+ */
358
+ const insertions = []
310
359
 
311
- while (++index <= length) {
360
+ while (++index <= end) {
312
361
  const event = events[index]
313
362
 
314
363
  switch (event[1].type) {
@@ -413,9 +462,10 @@ function compiler(options) {
413
462
  lineIndex ? events[lineIndex][1].start : event[1].end
414
463
  )
415
464
 
416
- events.splice(lineIndex || index, 0, ['exit', listItem, event[2]])
417
- index++
418
- length++
465
+ insertions.push({
466
+ at: lineIndex || index,
467
+ event: ['exit', listItem, event[2]]
468
+ })
419
469
  }
420
470
 
421
471
  // Create a new list item.
@@ -429,17 +479,34 @@ function compiler(options) {
429
479
  end: undefined
430
480
  }
431
481
  listItem = item
432
- events.splice(index, 0, ['enter', item, event[2]])
433
- index++
434
- length++
482
+ insertions.push({at: index, event: ['enter', item, event[2]]})
435
483
  firstBlankLineIndex = undefined
436
484
  atMarker = true
437
485
  }
438
486
  }
439
487
  }
440
488
 
489
+ // The list is at the end of `events`: take it off, then push it back with
490
+ // the insertions merged in.
491
+ // Nothing follows the list, so nothing shifts.
492
+ const listEvents = events.splice(start)
493
+ let insertion = 0
494
+ index = -1
495
+
496
+ while (++index < listEvents.length) {
497
+ while (
498
+ insertion < insertions.length &&
499
+ insertions[insertion].at === start + index
500
+ ) {
501
+ events.push(insertions[insertion++].event)
502
+ }
503
+
504
+ events.push(listEvents[index])
505
+ }
506
+
507
+ assert(insertion === insertions.length, 'expected insertions to be merged')
508
+
441
509
  events[start][1]._spread = listSpread
442
- return length
443
510
  }
444
511
 
445
512
  /**
@@ -530,7 +597,9 @@ function compiler(options) {
530
597
  stringifyPosition({start: token.start, end: token.end}) +
531
598
  '): it’s not open'
532
599
  )
533
- } else if (open[0].type !== token.type) {
600
+ }
601
+
602
+ if (open[0].type !== token.type) {
534
603
  if (onExitError) {
535
604
  onExitError.call(this, token, open[0])
536
605
  } else {
@@ -1137,19 +1206,31 @@ function compiler(options) {
1137
1206
  // Creaters.
1138
1207
  //
1139
1208
 
1209
+ // Each node factory pre-declares `position` as undefined as the trailing
1210
+ // property. enter() patches it to a real value, but the property already
1211
+ // exists, so V8 sees a single hidden class for each node type from
1212
+ // construction through the rest of the pipeline. Without the pre-declare,
1213
+ // each node took a hidden-class transition when enter() added position.
1214
+
1140
1215
  /** @returns {Blockquote} */
1141
1216
  function blockQuote() {
1142
- return {type: 'blockquote', children: []}
1217
+ return {type: 'blockquote', children: [], position: undefined}
1143
1218
  }
1144
1219
 
1145
1220
  /** @returns {Code} */
1146
1221
  function codeFlow() {
1147
- return {type: 'code', lang: null, meta: null, value: ''}
1222
+ return {
1223
+ type: 'code',
1224
+ lang: null,
1225
+ meta: null,
1226
+ value: '',
1227
+ position: undefined
1228
+ }
1148
1229
  }
1149
1230
 
1150
1231
  /** @returns {InlineCode} */
1151
1232
  function codeText() {
1152
- return {type: 'inlineCode', value: ''}
1233
+ return {type: 'inlineCode', value: '', position: undefined}
1153
1234
  }
1154
1235
 
1155
1236
  /** @returns {Definition} */
@@ -1159,13 +1240,14 @@ function compiler(options) {
1159
1240
  identifier: '',
1160
1241
  label: null,
1161
1242
  title: null,
1162
- url: ''
1243
+ url: '',
1244
+ position: undefined
1163
1245
  }
1164
1246
  }
1165
1247
 
1166
1248
  /** @returns {Emphasis} */
1167
1249
  function emphasis() {
1168
- return {type: 'emphasis', children: []}
1250
+ return {type: 'emphasis', children: [], position: undefined}
1169
1251
  }
1170
1252
 
1171
1253
  /** @returns {Heading} */
@@ -1174,28 +1256,41 @@ function compiler(options) {
1174
1256
  type: 'heading',
1175
1257
  // @ts-expect-error `depth` will be set later.
1176
1258
  depth: 0,
1177
- children: []
1259
+ children: [],
1260
+ position: undefined
1178
1261
  }
1179
1262
  }
1180
1263
 
1181
1264
  /** @returns {Break} */
1182
1265
  function hardBreak() {
1183
- return {type: 'break'}
1266
+ return {type: 'break', position: undefined}
1184
1267
  }
1185
1268
 
1186
1269
  /** @returns {Html} */
1187
1270
  function html() {
1188
- return {type: 'html', value: ''}
1271
+ return {type: 'html', value: '', position: undefined}
1189
1272
  }
1190
1273
 
1191
1274
  /** @returns {Image} */
1192
1275
  function image() {
1193
- return {type: 'image', title: null, url: '', alt: null}
1276
+ return {
1277
+ type: 'image',
1278
+ title: null,
1279
+ url: '',
1280
+ alt: null,
1281
+ position: undefined
1282
+ }
1194
1283
  }
1195
1284
 
1196
1285
  /** @returns {Link} */
1197
1286
  function link() {
1198
- return {type: 'link', title: null, url: '', children: []}
1287
+ return {
1288
+ type: 'link',
1289
+ title: null,
1290
+ url: '',
1291
+ children: [],
1292
+ position: undefined
1293
+ }
1199
1294
  }
1200
1295
 
1201
1296
  /**
@@ -1208,7 +1303,8 @@ function compiler(options) {
1208
1303
  ordered: token.type === 'listOrdered',
1209
1304
  start: null,
1210
1305
  spread: token._spread,
1211
- children: []
1306
+ children: [],
1307
+ position: undefined
1212
1308
  }
1213
1309
  }
1214
1310
 
@@ -1221,28 +1317,29 @@ function compiler(options) {
1221
1317
  type: 'listItem',
1222
1318
  spread: token._spread,
1223
1319
  checked: null,
1224
- children: []
1320
+ children: [],
1321
+ position: undefined
1225
1322
  }
1226
1323
  }
1227
1324
 
1228
1325
  /** @returns {Paragraph} */
1229
1326
  function paragraph() {
1230
- return {type: 'paragraph', children: []}
1327
+ return {type: 'paragraph', children: [], position: undefined}
1231
1328
  }
1232
1329
 
1233
1330
  /** @returns {Strong} */
1234
1331
  function strong() {
1235
- return {type: 'strong', children: []}
1332
+ return {type: 'strong', children: [], position: undefined}
1236
1333
  }
1237
1334
 
1238
1335
  /** @returns {Text} */
1239
1336
  function text() {
1240
- return {type: 'text', value: ''}
1337
+ return {type: 'text', value: '', position: undefined}
1241
1338
  }
1242
1339
 
1243
1340
  /** @returns {ThematicBreak} */
1244
1341
  function thematicBreak() {
1245
- return {type: 'thematicBreak'}
1342
+ return {type: 'thematicBreak', position: undefined}
1246
1343
  }
1247
1344
  }
1248
1345
 
@@ -1307,6 +1404,16 @@ function extension(combined, extension) {
1307
1404
  break
1308
1405
  }
1309
1406
 
1407
+ case 'afterExit':
1408
+ case 'beforeEnter': {
1409
+ const right = extension[key]
1410
+ if (right) {
1411
+ combined[key].push(right)
1412
+ }
1413
+
1414
+ break
1415
+ }
1416
+
1310
1417
  case 'enter':
1311
1418
  case 'exit': {
1312
1419
  const right = extension[key]
@@ -1336,13 +1443,13 @@ function defaultOnError(left, right) {
1336
1443
  stringifyPosition({start: right.start, end: right.end}) +
1337
1444
  ') is open'
1338
1445
  )
1339
- } else {
1340
- throw new Error(
1341
- 'Cannot close document, a token (`' +
1342
- right.type +
1343
- '`, ' +
1344
- stringifyPosition({start: right.start, end: right.end}) +
1345
- ') is still open'
1346
- )
1347
1446
  }
1447
+
1448
+ throw new Error(
1449
+ 'Cannot close document, a token (`' +
1450
+ right.type +
1451
+ '`, ' +
1452
+ stringifyPosition({start: right.start, end: right.end}) +
1453
+ ') is still open'
1454
+ )
1348
1455
  }
@@ -159,6 +159,14 @@ export interface CompileData {
159
159
  * We have our defaults, but extensions will add more.
160
160
  */
161
161
  export interface Config {
162
+ /**
163
+ * Listeners called for every token, after closing handles.
164
+ */
165
+ afterExit: Array<Handle>
166
+ /**
167
+ * Listeners called for every token, before opening handles.
168
+ */
169
+ beforeEnter: Array<Handle>
162
170
  /**
163
171
  * Token types where line endings are used.
164
172
  */
@@ -179,8 +187,26 @@ export interface Config {
179
187
 
180
188
  /**
181
189
  * Change how markdown tokens from micromark are turned into mdast.
190
+ *
191
+ * ###### Notes
192
+ *
193
+ * Handles (`enter`, `exit`) create the tree;
194
+ * a later handle for a token type from an extension overwrites earlier ones.
195
+ * Listeners (`afterExit`, `beforeEnter`) observe all tokens including unhandled
196
+ * ones.
197
+ * The point of listeners is that they *do not* interfere with handling,
198
+ * potentially changed by extensions.
199
+ * Don’t modify unexpected things!
182
200
  */
183
201
  export interface Extension {
202
+ /**
203
+ * Listener called for every token, after closing handles.
204
+ */
205
+ afterExit?: Handle | null | undefined
206
+ /**
207
+ * Listener called for every token, before opening handles.
208
+ */
209
+ beforeEnter?: Handle | null | undefined
184
210
  /**
185
211
  * Token types where line endings are used.
186
212
  */