@soimy/dingtalk 3.6.6 → 3.6.8
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/dist/index.js +1433 -344
- package/dist/index.js.map +4 -4
- package/dist/src/card/ask-user-question-context.d.ts +5 -2
- package/dist/src/card/ask-user-question-context.d.ts.map +1 -1
- package/dist/src/card/ask-user-question-store.d.ts +42 -0
- package/dist/src/card/ask-user-question-store.d.ts.map +1 -0
- package/dist/src/card/ask-user-question.d.ts +20 -0
- package/dist/src/card/ask-user-question.d.ts.map +1 -1
- package/dist/src/card/card-action-handler.d.ts +1 -0
- package/dist/src/card/card-action-handler.d.ts.map +1 -1
- package/dist/src/card-service.d.ts +4 -1
- package/dist/src/card-service.d.ts.map +1 -1
- package/dist/src/gateway/channel-gateway.d.ts.map +1 -1
- package/dist/src/gateway/inbound-session-queue-dispatcher.d.ts +23 -0
- package/dist/src/gateway/inbound-session-queue-dispatcher.d.ts.map +1 -0
- package/dist/src/gateway/inbound-session-queue.d.ts +46 -0
- package/dist/src/gateway/inbound-session-queue.d.ts.map +1 -0
- package/dist/src/gateway/reply-session-conflict.d.ts +22 -0
- package/dist/src/gateway/reply-session-conflict.d.ts.map +1 -0
- package/dist/src/inbound-handler.d.ts.map +1 -1
- package/dist/src/onboarding.d.ts.map +1 -1
- package/dist/src/targeting/agent-routing.d.ts +17 -1
- package/dist/src/targeting/agent-routing.d.ts.map +1 -1
- package/dist/src/types.d.ts +35 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/access-control.ts +1 -1
- package/src/card/ask-user-question-context.ts +9 -1
- package/src/card/ask-user-question-store.ts +294 -0
- package/src/card/ask-user-question.ts +398 -37
- package/src/card/card-action-handler.ts +2 -0
- package/src/card-service.ts +55 -3
- package/src/gateway/channel-gateway.ts +51 -30
- package/src/gateway/inbound-session-queue-dispatcher.ts +304 -0
- package/src/gateway/inbound-session-queue.ts +244 -0
- package/src/gateway/reply-session-conflict.ts +82 -0
- package/src/inbound-handler.ts +254 -57
- package/src/onboarding.ts +6 -2
- package/src/targeting/agent-routing.ts +84 -19
- package/src/types.ts +36 -0
package/src/types.ts
CHANGED
|
@@ -462,6 +462,16 @@ export interface SubAgentOptions {
|
|
|
462
462
|
commandText?: string;
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
+
/**
|
|
466
|
+
* A trusted route resolved by the plugin before recursive or synthetic inbound handling.
|
|
467
|
+
* It is runtime-only and must never be populated from DingTalk callback payload fields.
|
|
468
|
+
*/
|
|
469
|
+
export interface ResolvedDingTalkRoute {
|
|
470
|
+
agentId: string;
|
|
471
|
+
sessionKey: string;
|
|
472
|
+
mainSessionKey: string;
|
|
473
|
+
}
|
|
474
|
+
|
|
465
475
|
/**
|
|
466
476
|
* Message handler parameters
|
|
467
477
|
*/
|
|
@@ -472,6 +482,16 @@ export interface HandleDingTalkMessageParams {
|
|
|
472
482
|
sessionWebhook: string;
|
|
473
483
|
log?: Logger;
|
|
474
484
|
dingtalkConfig: DingTalkConfig;
|
|
485
|
+
/** Distinguishes real Stream messages from Ask User callback reinjection. */
|
|
486
|
+
inboundOrigin?: "stream" | "ask-user";
|
|
487
|
+
/**
|
|
488
|
+
* Explicitly enables handler-owned queueing for a real gateway Stream
|
|
489
|
+
* callback. Direct/synthetic callers must not be inferred from raw message
|
|
490
|
+
* shape, because they may already be inside another handler lifecycle.
|
|
491
|
+
*/
|
|
492
|
+
inboundQueueEligible?: boolean;
|
|
493
|
+
/** Reuses an already-resolved trusted route for recursive or synthetic handling. */
|
|
494
|
+
routeOverride?: ResolvedDingTalkRoute;
|
|
475
495
|
/**
|
|
476
496
|
* When set, routes message to the specified sub-agent instead of main agent.
|
|
477
497
|
* This enables reuse of the main message handling logic for sub-agents.
|
|
@@ -487,6 +507,22 @@ export interface HandleDingTalkMessageParams {
|
|
|
487
507
|
mediaPaths?: string[];
|
|
488
508
|
mediaTypes?: string[];
|
|
489
509
|
};
|
|
510
|
+
/**
|
|
511
|
+
* A pre-created AI Card to reuse instead of creating a new one. Set by the
|
|
512
|
+
* inbound session-queue dispatcher when a message was queued behind an active
|
|
513
|
+
* run: the card was already created and is showing a "已排队" acknowledgement,
|
|
514
|
+
* so the handler streams the real reply INTO this same card (in-place update)
|
|
515
|
+
* rather than spawning a second card. When unset, the handler creates a fresh
|
|
516
|
+
* card as usual.
|
|
517
|
+
*/
|
|
518
|
+
preCreatedCard?: AICardInstance;
|
|
519
|
+
/**
|
|
520
|
+
* Internal recursion guard for the authorized inbound session queue. The
|
|
521
|
+
* first handler pass performs access control and trusted route resolution;
|
|
522
|
+
* the queued continuation re-enters with this set so it can consume the
|
|
523
|
+
* pre-created card without queueing itself again.
|
|
524
|
+
*/
|
|
525
|
+
inboundQueueHandled?: boolean;
|
|
490
526
|
}
|
|
491
527
|
|
|
492
528
|
/**
|