@cortex-agent/server 2026.6.15 → 2026.6.18
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/defaults/config/thread-templates.json +2 -2
- package/defaults/hooks/task-status-check.mjs +9 -7
- package/defaults/plugins/cortex-stage-gate/skills/task/SKILL.md +103 -16
- package/defaults/plugins/cortex-system/skills/orient/SKILL.md +6 -6
- package/defaults/plugins/cortex-system/skills/thread/SKILL.md +29 -35
- package/defaults/prompts/directives/manager.md +21 -11
- package/dist/agent-adapter/claude/spawn-args.d.ts +5 -0
- package/dist/agent-adapter/claude/spawn-args.js +6 -0
- package/dist/agent-adapter/types.d.ts +4 -0
- package/dist/core/task-parser.d.ts +6 -0
- package/dist/core/task-parser.js +10 -0
- package/dist/core/types/thread-types.d.ts +29 -0
- package/dist/domain/agents/facade.d.ts +4 -0
- package/dist/domain/agents/facade.js +3 -1
- package/dist/domain/mcp/core-server.js +15 -9
- package/dist/domain/mcp/tools/task-monitor.d.ts +2 -0
- package/dist/domain/mcp/tools/task-monitor.js +99 -0
- package/dist/domain/mcp/tools/thread-ops.js +50 -85
- package/dist/domain/scheduling/jobs/task-dispatch.js +12 -6
- package/dist/domain/tasks/dispatch-utils.d.ts +5 -0
- package/dist/domain/tasks/dispatch-utils.js +9 -1
- package/dist/domain/tasks/dispatcher.js +4 -4
- package/dist/domain/tasks/system/task-cli.d.ts +1 -0
- package/dist/domain/tasks/system/task-cli.js +82 -6
- package/dist/domain/tasks/system/task-mutations.d.ts +6 -1
- package/dist/domain/tasks/system/task-mutations.js +10 -1
- package/dist/domain/threads/hook-runner.js +1 -0
- package/dist/domain/threads/prompt-builder.js +15 -9
- package/dist/domain/threads/runner.d.ts +5 -0
- package/dist/domain/threads/runner.js +44 -11
- package/dist/domain/threads/state-machine.d.ts +9 -12
- package/dist/domain/threads/state-machine.js +27 -50
- package/dist/hooks/task-status-check.mjs +9 -7
- package/dist/orchestration/routing/webhook.js +38 -1
- package/dist/orchestration/thread-callback.d.ts +11 -1
- package/dist/orchestration/thread-callback.js +66 -30
- package/dist/platform/adapters/feishu.d.ts +11 -0
- package/dist/platform/adapters/feishu.js +74 -3
- package/package.json +1 -1
|
@@ -464,9 +464,15 @@ export class FeishuAdapter {
|
|
|
464
464
|
catch {
|
|
465
465
|
parsed = {};
|
|
466
466
|
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
467
|
+
// `post` (富文本/rich-text) is what Feishu sends when a message mixes text and
|
|
468
|
+
// images — the text is NOT a top-level `parsed.text` but buried in a 2D array
|
|
469
|
+
// of paragraph element-runs, so the simple text/raw-string path below would
|
|
470
|
+
// yield '' and drop the user's message. Parse post specially.
|
|
471
|
+
const text = messageType === 'post'
|
|
472
|
+
? this.parsePostContent(parsed).text
|
|
473
|
+
: (typeof parsed.text === 'string'
|
|
474
|
+
? parsed.text
|
|
475
|
+
: (typeof message.content === 'string' && !message.content.startsWith('{') ? message.content : ''));
|
|
470
476
|
const ref = {
|
|
471
477
|
conduit: this._wrap(chatId),
|
|
472
478
|
messageId,
|
|
@@ -527,10 +533,75 @@ export class FeishuAdapter {
|
|
|
527
533
|
if (!parsed.image_key)
|
|
528
534
|
return undefined;
|
|
529
535
|
return mk(parsed.image_key, `${parsed.image_key}.png`, 'image/png', 'image');
|
|
536
|
+
case 'post': {
|
|
537
|
+
// A rich-text post may embed any number of inline images (tag:'img'). Each
|
|
538
|
+
// image_key is a resource of THIS message, downloadable via the same
|
|
539
|
+
// messageResource.get(type:'image') path as a standalone image message.
|
|
540
|
+
const { imageKeys } = this.parsePostContent(parsed);
|
|
541
|
+
if (imageKeys.length === 0)
|
|
542
|
+
return undefined;
|
|
543
|
+
return imageKeys.map(k => ({
|
|
544
|
+
id: k,
|
|
545
|
+
name: `${k}.png`,
|
|
546
|
+
mimetype: 'image/png',
|
|
547
|
+
url: '',
|
|
548
|
+
conduit: this._wrap(chatId),
|
|
549
|
+
raw: { message_id: messageId, resourceType: 'image' },
|
|
550
|
+
}));
|
|
551
|
+
}
|
|
530
552
|
default:
|
|
531
553
|
return undefined;
|
|
532
554
|
}
|
|
533
555
|
}
|
|
556
|
+
/**
|
|
557
|
+
* Parse a Feishu `post` (富文本/rich-text) message content payload. Feishu wraps
|
|
558
|
+
* a single message that mixes text and images as a post, whose `content` is a 2D
|
|
559
|
+
* array of paragraphs, each a run of element nodes:
|
|
560
|
+
* { title?, content: [ [ {tag:'text',text}, {tag:'a',text,href}, {tag:'at',user_name},
|
|
561
|
+
* {tag:'img',image_key} ], ... ] }
|
|
562
|
+
* Returns the concatenated text (paragraphs joined by '\n', non-empty title
|
|
563
|
+
* prefixed) and the list of inline image_keys, so callers recover BOTH the text
|
|
564
|
+
* and the images from one mixed message.
|
|
565
|
+
*/
|
|
566
|
+
parsePostContent(parsed) {
|
|
567
|
+
const imageKeys = [];
|
|
568
|
+
const content = parsed?.content;
|
|
569
|
+
if (!Array.isArray(content))
|
|
570
|
+
return { text: '', imageKeys };
|
|
571
|
+
const lines = [];
|
|
572
|
+
for (const paragraph of content) {
|
|
573
|
+
if (!Array.isArray(paragraph))
|
|
574
|
+
continue;
|
|
575
|
+
let line = '';
|
|
576
|
+
for (const node of paragraph) {
|
|
577
|
+
if (!node || typeof node !== 'object')
|
|
578
|
+
continue;
|
|
579
|
+
switch (node.tag) {
|
|
580
|
+
case 'text':
|
|
581
|
+
case 'a':
|
|
582
|
+
if (typeof node.text === 'string')
|
|
583
|
+
line += node.text;
|
|
584
|
+
break;
|
|
585
|
+
case 'at':
|
|
586
|
+
if (typeof node.user_name === 'string')
|
|
587
|
+
line += `@${node.user_name}`;
|
|
588
|
+
break;
|
|
589
|
+
case 'img':
|
|
590
|
+
if (typeof node.image_key === 'string')
|
|
591
|
+
imageKeys.push(node.image_key);
|
|
592
|
+
break;
|
|
593
|
+
default:
|
|
594
|
+
break;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
lines.push(line);
|
|
598
|
+
}
|
|
599
|
+
let text = lines.join('\n').trim();
|
|
600
|
+
if (typeof parsed.title === 'string' && parsed.title.trim()) {
|
|
601
|
+
text = text ? `${parsed.title}\n${text}` : parsed.title.trim();
|
|
602
|
+
}
|
|
603
|
+
return { text, imageKeys };
|
|
604
|
+
}
|
|
534
605
|
async handleCardAction(data) {
|
|
535
606
|
const event = data.event || data;
|
|
536
607
|
const action = event.action || {};
|
package/package.json
CHANGED