@soimy/dingtalk 3.6.11 → 3.7.0
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.d.ts +1 -1
- package/dist/index.js +11684 -10583
- package/dist/src/{ack-reaction-service.d.ts → ack-reaction/ack-reaction-service.d.ts} +1 -1
- package/dist/src/ack-reaction/dynamic-ack-reaction-controller.d.ts +3 -3
- package/dist/src/card/ask-user-question-context.d.ts +1 -1
- package/dist/src/card/ask-user-question-store.d.ts +1 -1
- package/dist/src/card/ask-user-question.d.ts +1 -1
- package/dist/src/card/card-action-handler.d.ts +2 -2
- package/dist/src/{card-draft-controller.d.ts → card/card-draft-controller.d.ts} +5 -1
- package/dist/src/card/card-run-registry.d.ts +2 -2
- package/dist/src/{card-service.d.ts → card/card-service.d.ts} +1 -1
- package/dist/src/card/card-stop-handler.d.ts +1 -1
- package/dist/src/card/card-streaming-mode.d.ts +1 -1
- package/dist/src/card/card-task-progress.d.ts +60 -0
- package/dist/src/channel.d.ts +6 -6
- package/dist/src/command/card-stop-command.d.ts +1 -1
- package/dist/src/{feedback-learning-service.d.ts → command/feedback-learning-service.d.ts} +1 -1
- package/dist/src/command/inbound-command-dispatch-service.d.ts +2 -2
- package/dist/src/{learning-command-service.d.ts → command/learning-command-service.d.ts} +1 -1
- package/dist/src/gateway/channel-gateway.d.ts +1 -1
- package/dist/src/{connection-manager.d.ts → gateway/connection-manager.d.ts} +1 -1
- package/dist/src/{docs-service.d.ts → gateway/docs-service.d.ts} +1 -1
- package/dist/src/{inbound-handler.d.ts → gateway/inbound-handler.d.ts} +1 -1
- package/dist/src/gateway/inbound-session-queue-dispatcher.d.ts +1 -1
- package/dist/src/messaging/attachment-text-extractor.d.ts +1 -1
- package/dist/src/messaging/btw-deliver.d.ts +1 -1
- package/dist/src/messaging/channel-outbound.d.ts +1 -1
- package/dist/src/{media-utils.d.ts → messaging/media-utils.d.ts} +1 -1
- package/dist/src/{message-context-store.d.ts → messaging/message-context-store.d.ts} +7 -1
- package/dist/src/{message-utils.d.ts → messaging/message-utils.d.ts} +1 -1
- package/dist/src/messaging/quoted-context.d.ts +2 -2
- package/dist/src/messaging/quoted-file-service.d.ts +1 -1
- package/dist/src/messaging/quoted-ref.d.ts +2 -2
- package/dist/src/{reply-strategy-card.d.ts → messaging/reply-strategy-card.d.ts} +1 -1
- package/dist/src/{reply-strategy-types.d.ts → messaging/reply-strategy-types.d.ts} +10 -1
- package/dist/src/{reply-strategy-with-reaction.d.ts → messaging/reply-strategy-with-reaction.d.ts} +1 -1
- package/dist/src/{reply-strategy.d.ts → messaging/reply-strategy.d.ts} +1 -1
- package/dist/src/{send-service.d.ts → messaging/send-service.d.ts} +1 -1
- package/dist/src/platform/channel-status.d.ts +1 -1
- package/dist/src/platform/config.d.ts +110 -0
- package/dist/src/platform/runtime-events.d.ts +67 -0
- package/dist/src/{types.d.ts → platform/types.d.ts} +74 -1
- package/dist/src/{persistence-store.d.ts → shared/persistence-store.d.ts} +1 -1
- package/dist/src/{utils.d.ts → shared/utils.d.ts} +1 -1
- package/dist/src/targeting/agent-name-matcher.d.ts +1 -1
- package/dist/src/targeting/agent-routing.d.ts +3 -3
- package/dist/src/{session-routing.d.ts → targeting/session-routing.d.ts} +1 -1
- package/index.ts +193 -69
- package/openclaw.plugin.json +158 -2
- package/package.json +16 -16
- package/src/{ack-reaction-classifier.ts → ack-reaction/ack-reaction-classifier.ts} +85 -13
- package/src/{ack-reaction-service.ts → ack-reaction/ack-reaction-service.ts} +13 -7
- package/src/ack-reaction/dynamic-ack-reaction-controller.ts +46 -31
- package/src/ack-reaction/dynamic-ack-reaction-progress.ts +4 -1
- package/src/card/ask-user-question-context.ts +1 -1
- package/src/card/ask-user-question-store.ts +2 -2
- package/src/card/ask-user-question.ts +11 -7
- package/src/card/card-action-handler.ts +2 -2
- package/src/{card-callback-service.ts → card/card-callback-service.ts} +7 -9
- package/src/card/card-draft-controller.ts +770 -0
- package/src/card/card-markdown-image-reroute.ts +8 -2
- package/src/card/card-run-registry.ts +17 -7
- package/src/{card-service.ts → card/card-service.ts} +91 -61
- package/src/card/card-stop-handler.ts +12 -8
- package/src/card/card-streaming-mode.ts +1 -1
- package/src/card/card-task-progress.ts +330 -0
- package/src/card/draft-stream-loop.ts +119 -0
- package/src/card/reasoning-answer-split.ts +125 -121
- package/src/card/reasoning-block-assembler.ts +122 -123
- package/src/{run-usage-store.ts → card/run-usage-store.ts} +18 -6
- package/src/card/statusline-renderer.ts +14 -5
- package/src/card/task-model-metadata.ts +8 -3
- package/src/channel.ts +14 -16
- package/src/command/card-stop-command.ts +2 -2
- package/src/{feedback-learning-service.ts → command/feedback-learning-service.ts} +36 -16
- package/src/{feedback-learning-store.ts → command/feedback-learning-store.ts} +133 -81
- package/src/command/inbound-command-dispatch-service.ts +12 -6
- package/src/{learning-command-service.ts → command/learning-command-service.ts} +36 -29
- package/src/{session-command-service.ts → command/session-command-service.ts} +3 -1
- package/src/gateway/channel-gateway.ts +106 -28
- package/src/{connection-manager.ts → gateway/connection-manager.ts} +45 -30
- package/src/{docs-service.ts → gateway/docs-service.ts} +5 -5
- package/src/{inbound-handler.ts → gateway/inbound-handler.ts} +139 -84
- package/src/gateway/inbound-session-queue-dispatcher.ts +18 -14
- package/src/{session-lock.ts → gateway/session-lock.ts} +14 -14
- package/src/messaging/attachment-text-extractor.ts +21 -7
- package/src/messaging/btw-deliver.ts +2 -2
- package/src/messaging/channel-actions.ts +15 -7
- package/src/messaging/channel-outbound.ts +16 -11
- package/src/{media-utils.ts → messaging/media-utils.ts} +276 -72
- package/src/{message-context-store.ts → messaging/message-context-store.ts} +11 -2
- package/src/{message-utils.ts → messaging/message-utils.ts} +46 -11
- package/src/messaging/quoted-context.ts +2 -2
- package/src/messaging/quoted-file-service.ts +311 -294
- package/src/messaging/quoted-ref.ts +11 -7
- package/src/{reply-strategy-card.ts → messaging/reply-strategy-card.ts} +178 -101
- package/src/{reply-strategy-markdown.ts → messaging/reply-strategy-markdown.ts} +8 -2
- package/src/{reply-strategy-types.ts → messaging/reply-strategy-types.ts} +11 -1
- package/src/{reply-strategy-with-reaction.ts → messaging/reply-strategy-with-reaction.ts} +6 -1
- package/src/{reply-strategy.ts → messaging/reply-strategy.ts} +2 -2
- package/src/{send-service.ts → messaging/send-service.ts} +100 -65
- package/src/{auth.ts → platform/auth.ts} +2 -2
- package/src/platform/channel-status.ts +3 -3
- package/src/{config-schema.ts → platform/config-schema.ts} +81 -4
- package/src/{config.ts → platform/config.ts} +167 -19
- package/src/{device-registration.ts → platform/device-registration.ts} +5 -4
- package/src/{onboarding.ts → platform/onboarding.ts} +1 -4
- package/src/{plugin-sdk-channel-actions-augment.ts → platform/plugin-sdk-channel-actions-augment.ts} +6 -5
- package/src/platform/runtime-events.ts +202 -0
- package/src/{secret-input.ts → platform/secret-input.ts} +117 -11
- package/src/{types.ts → platform/types.ts} +76 -1
- package/src/{http-client.ts → shared/http-client.ts} +1 -3
- package/src/{persistence-store.ts → shared/persistence-store.ts} +6 -6
- package/src/{utils.ts → shared/utils.ts} +30 -13
- package/src/targeting/agent-name-matcher.ts +1 -1
- package/src/targeting/agent-routing.ts +7 -7
- package/src/targeting/group-members-store.ts +1 -1
- package/src/{session-peer-store.ts → targeting/session-peer-store.ts} +9 -4
- package/src/{session-routing.ts → targeting/session-routing.ts} +1 -1
- package/src/targeting/target-directory-adapter.ts +3 -3
- package/src/targeting/target-directory-store.ts +1 -1
- package/src/targeting/target-input.ts +1 -1
- package/dist/src/ack-reaction/dynamic-ack-reaction-events.d.ts +0 -35
- package/dist/src/config.d.ts +0 -59
- package/src/ack-reaction/dynamic-ack-reaction-events.ts +0 -123
- package/src/card-draft-controller.ts +0 -637
- package/src/draft-stream-loop.ts +0 -119
- /package/dist/src/{ack-reaction-classifier.d.ts → ack-reaction/ack-reaction-classifier.d.ts} +0 -0
- /package/dist/src/{card-callback-service.d.ts → card/card-callback-service.d.ts} +0 -0
- /package/dist/src/{draft-stream-loop.d.ts → card/draft-stream-loop.d.ts} +0 -0
- /package/dist/src/{run-usage-store.d.ts → card/run-usage-store.d.ts} +0 -0
- /package/dist/src/{feedback-learning-store.d.ts → command/feedback-learning-store.d.ts} +0 -0
- /package/dist/src/{session-command-service.d.ts → command/session-command-service.d.ts} +0 -0
- /package/dist/src/{session-lock.d.ts → gateway/session-lock.d.ts} +0 -0
- /package/dist/src/{proactive-risk-registry.d.ts → messaging/proactive-risk-registry.d.ts} +0 -0
- /package/dist/src/{reply-strategy-markdown.d.ts → messaging/reply-strategy-markdown.d.ts} +0 -0
- /package/dist/src/{access-control.d.ts → platform/access-control.d.ts} +0 -0
- /package/dist/src/{auth.d.ts → platform/auth.d.ts} +0 -0
- /package/dist/src/{config-schema.d.ts → platform/config-schema.d.ts} +0 -0
- /package/dist/src/{device-registration.d.ts → platform/device-registration.d.ts} +0 -0
- /package/dist/src/{logger-context.d.ts → platform/logger-context.d.ts} +0 -0
- /package/dist/src/{onboarding.d.ts → platform/onboarding.d.ts} +0 -0
- /package/dist/src/{plugin-sdk-channel-actions-augment.d.ts → platform/plugin-sdk-channel-actions-augment.d.ts} +0 -0
- /package/dist/src/{runtime.d.ts → platform/runtime.d.ts} +0 -0
- /package/dist/src/{secret-input.d.ts → platform/secret-input.d.ts} +0 -0
- /package/dist/src/{session-state.d.ts → platform/session-state.d.ts} +0 -0
- /package/dist/src/{signature.d.ts → platform/signature.d.ts} +0 -0
- /package/dist/src/{dedup.d.ts → shared/dedup.d.ts} +0 -0
- /package/dist/src/{http-client.d.ts → shared/http-client.d.ts} +0 -0
- /package/dist/src/{path-utils.d.ts → shared/path-utils.d.ts} +0 -0
- /package/dist/src/{peer-id-registry.d.ts → targeting/peer-id-registry.d.ts} +0 -0
- /package/dist/src/{session-peer-store.d.ts → targeting/session-peer-store.d.ts} +0 -0
- /package/src/{proactive-risk-registry.ts → messaging/proactive-risk-registry.ts} +0 -0
- /package/src/{access-control.ts → platform/access-control.ts} +0 -0
- /package/src/{logger-context.ts → platform/logger-context.ts} +0 -0
- /package/src/{runtime.ts → platform/runtime.ts} +0 -0
- /package/src/{session-state.ts → platform/session-state.ts} +0 -0
- /package/src/{signature.ts → platform/signature.ts} +0 -0
- /package/src/{dedup.ts → shared/dedup.ts} +0 -0
- /package/src/{path-utils.ts → shared/path-utils.ts} +0 -0
- /package/src/{peer-id-registry.ts → targeting/peer-id-registry.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import
|
|
1
|
+
import { type RuntimeEventsLogger, type RuntimeEventsSurface } from "../platform/runtime-events";
|
|
2
|
+
import type { DingTalkConfig } from "../platform/types";
|
|
3
3
|
type DynamicAckReactionControllerParams = {
|
|
4
4
|
enabled: boolean;
|
|
5
5
|
initialReaction: string;
|
|
@@ -9,7 +9,7 @@ type DynamicAckReactionControllerParams = {
|
|
|
9
9
|
msgId: string;
|
|
10
10
|
conversationId: string;
|
|
11
11
|
sessionKey: string;
|
|
12
|
-
log?:
|
|
12
|
+
log?: RuntimeEventsLogger;
|
|
13
13
|
runtimeEvents?: RuntimeEventsSurface;
|
|
14
14
|
onReactionDisposed?: () => void;
|
|
15
15
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DingTalkConfig, DingTalkInboundMessage, HandleDingTalkMessageParams, Logger, ResolvedDingTalkRoute, SubAgentOptions } from "../types";
|
|
1
|
+
import type { DingTalkConfig, DingTalkInboundMessage, HandleDingTalkMessageParams, Logger, ResolvedDingTalkRoute, SubAgentOptions } from "../platform/types";
|
|
2
2
|
export type DingTalkQuestionContext = {
|
|
3
3
|
cfg: HandleDingTalkMessageParams["cfg"];
|
|
4
4
|
accountId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Logger } from "../types";
|
|
1
|
+
import type { Logger } from "../platform/types";
|
|
2
2
|
export type AskUserActiveState = "reserved" | "pending" | "dispatching";
|
|
3
3
|
export type AskUserTerminalReason = "delivery_failed" | "superseded_by_question" | "superseded_by_message" | "expired" | "cancelled" | "empty" | "submitted" | "pause_failed" | "restart_invalidated" | "restart_during_dispatch" | "dispatch_failed";
|
|
4
4
|
export interface AskUserLifecycleRecord {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
|
|
2
|
-
import type { DingTalkConfig, Logger } from "../types";
|
|
2
|
+
import type { DingTalkConfig, Logger } from "../platform/types";
|
|
3
3
|
import { type DingTalkQuestionContext } from "./ask-user-question-context";
|
|
4
4
|
import { type AskUserLifecycleRecord } from "./ask-user-question-store";
|
|
5
5
|
type AskUserOption = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OpenClawConfig } from "openclaw/plugin-sdk/core";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { DingTalkConfig, Logger } from "../platform/types";
|
|
3
|
+
import type { CardCallbackAnalysis } from "./card-callback-service";
|
|
4
4
|
export interface CardActionResult {
|
|
5
5
|
handled: boolean;
|
|
6
6
|
}
|
|
@@ -9,8 +9,12 @@
|
|
|
9
9
|
* It delegates throttling and single-flight transport guarantees to
|
|
10
10
|
* {@link createDraftStreamLoop}.
|
|
11
11
|
*/
|
|
12
|
-
import type { AICardInstance, Logger } from "
|
|
12
|
+
import type { AICardInstance, Logger } from "../platform/types";
|
|
13
13
|
export interface CardDraftController {
|
|
14
|
+
updateProgress: (text: string) => Promise<void>;
|
|
15
|
+
clearProgress: (options?: {
|
|
16
|
+
clearRemoteWhenEmpty?: boolean;
|
|
17
|
+
}) => Promise<void>;
|
|
14
18
|
updateAnswer: (text: string, options?: {
|
|
15
19
|
stream?: boolean;
|
|
16
20
|
renderBlocks?: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AICardInstance } from "../platform/types";
|
|
1
2
|
/**
|
|
2
3
|
* In-process card run registry for tracking active AI card runs.
|
|
3
4
|
*
|
|
@@ -7,8 +8,7 @@
|
|
|
7
8
|
* the stop button to silently fail. Ensure single-process deployment or sticky
|
|
8
9
|
* routing per card callback when using the stop button feature.
|
|
9
10
|
*/
|
|
10
|
-
import type { CardDraftController } from "
|
|
11
|
-
import type { AICardInstance } from "../types";
|
|
11
|
+
import type { CardDraftController } from "./card-draft-controller";
|
|
12
12
|
export interface CardRunRecord {
|
|
13
13
|
outTrackId: string;
|
|
14
14
|
accountId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AICardInstance, DingTalkConfig, DingTalkTrackingMetadata, Logger, QuotedRef } from "
|
|
1
|
+
import type { AICardInstance, DingTalkConfig, DingTalkTrackingMetadata, Logger, QuotedRef } from "../platform/types";
|
|
2
2
|
export declare function hideCardStopButton(outTrackId: string, token: string, config?: {
|
|
3
3
|
bypassProxyForSend?: boolean;
|
|
4
4
|
}, retries?: number): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DingTalkConfig } from "../types";
|
|
1
|
+
import type { DingTalkConfig } from "../platform/types";
|
|
2
2
|
export type CardStreamingMode = "off" | "answer" | "all";
|
|
3
3
|
export declare function resolveCardStreamingMode(config: Pick<DingTalkConfig, "cardStreamingMode" | "cardRealTimeStream">): {
|
|
4
4
|
mode: CardStreamingMode;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type RuntimeEventsLogger, type RuntimeEventsSurface } from "../platform/runtime-events";
|
|
2
|
+
import type { CardTaskProgressRefresh, DingTalkConfig } from "../platform/types";
|
|
3
|
+
/**
|
|
4
|
+
* Decide whether the live task-progress block is allowed for this card.
|
|
5
|
+
*
|
|
6
|
+
* `cardTaskProgress` is tri-state on purpose: explicit `true`/`false` always
|
|
7
|
+
* wins. When unset the block is on by default, except for an explicit
|
|
8
|
+
* `cardStreamingMode: "off"` — that is a deliberate "keep card traffic
|
|
9
|
+
* minimal" request, so progress stays quiet until the user opts back in.
|
|
10
|
+
*
|
|
11
|
+
* The runtime normalizes an omitted `cardStreamingMode` to `"off"` before the
|
|
12
|
+
* config reaches this point, so the effective value alone cannot tell "omitted"
|
|
13
|
+
* apart from "explicitly off". `cardStreamingModeConfigured` carries that
|
|
14
|
+
* distinction; configs that never went through normalization (hand-built test
|
|
15
|
+
* or embedded configs) fall back to "was a mode present at all".
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveCardTaskProgressEnabled(config: Pick<DingTalkConfig, "cardTaskProgress" | "cardStreamingMode" | "cardStreamingModeConfigured">): boolean;
|
|
18
|
+
export interface CardTaskProgressController {
|
|
19
|
+
/** Wait for queued card updates to settle (test/observability helper). */
|
|
20
|
+
awaitDrain(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Release timers and the runtime-event subscription, then remove the
|
|
23
|
+
* progress block. Idempotent, and safe to call when nothing was rendered.
|
|
24
|
+
*
|
|
25
|
+
* `clearRemoteWhenEmpty` is for teardown paths that will never commit the
|
|
26
|
+
* card (for example ask-user question-card takeover): when the progress block
|
|
27
|
+
* was the only visible block, the local removal must also clear the remote
|
|
28
|
+
* card, otherwise the reader keeps seeing a live-looking "任务处理中" card.
|
|
29
|
+
*/
|
|
30
|
+
dispose(options?: {
|
|
31
|
+
clearRemoteWhenEmpty?: boolean;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
export interface ClearProgressOptions {
|
|
35
|
+
/** Clear the remote card when removing progress leaves no visible block. */
|
|
36
|
+
clearRemoteWhenEmpty?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Keep one replaceable "task in progress" block on an AI card.
|
|
40
|
+
*
|
|
41
|
+
* Returns a no-op controller when progress is disabled by config or when the
|
|
42
|
+
* session key is unknown: without a session key the correlator could only rely
|
|
43
|
+
* on its optimistic window, which surfaces as an intermittently missing block.
|
|
44
|
+
*/
|
|
45
|
+
export declare function createCardTaskProgressController(params: {
|
|
46
|
+
sessionKey: string;
|
|
47
|
+
enabled?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* `heartbeat` (default) coalesces stage/step changes into the 30s refresh;
|
|
50
|
+
* `interval` pushes them on every correlated tool event, throttled further
|
|
51
|
+
* down by the card draft loop's `cardStreamInterval`.
|
|
52
|
+
*/
|
|
53
|
+
refresh?: CardTaskProgressRefresh;
|
|
54
|
+
runtimeEvents?: RuntimeEventsSurface;
|
|
55
|
+
updateProgress: (text: string) => Promise<void>;
|
|
56
|
+
clearProgress: (options?: ClearProgressOptions) => Promise<void>;
|
|
57
|
+
startDelayMs?: number;
|
|
58
|
+
heartbeatIntervalMs?: number;
|
|
59
|
+
log?: RuntimeEventsLogger;
|
|
60
|
+
}): CardTaskProgressController;
|
package/dist/src/channel.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CHANNEL_INFLIGHT_NAMESPACE_POLICY } from "./gateway/channel-gateway";
|
|
2
|
-
import type { DingTalkChannelPlugin } from "./types";
|
|
2
|
+
import type { DingTalkChannelPlugin } from "./platform/types";
|
|
3
3
|
export declare const dingtalkPlugin: DingTalkChannelPlugin;
|
|
4
4
|
export { CHANNEL_INFLIGHT_NAMESPACE_POLICY };
|
|
5
|
-
export { getAccessToken } from "./auth";
|
|
6
|
-
export { createAICard, finishAICard, streamAICard } from "./card-service";
|
|
7
|
-
export { detectMediaTypeFromExtension } from "./media-utils";
|
|
8
|
-
export { getLogger } from "./logger-context";
|
|
9
|
-
export { sendBySession, sendMessage, sendProactiveMedia, uploadMedia, } from "./send-service";
|
|
5
|
+
export { getAccessToken } from "./platform/auth";
|
|
6
|
+
export { createAICard, finishAICard, streamAICard } from "./card/card-service";
|
|
7
|
+
export { detectMediaTypeFromExtension } from "./messaging/media-utils";
|
|
8
|
+
export { getLogger } from "./platform/logger-context";
|
|
9
|
+
export { sendBySession, sendMessage, sendProactiveMedia, uploadMedia, } from "./messaging/send-service";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OpenClawConfig } from "openclaw/plugin-sdk/core";
|
|
2
|
-
import type { Logger } from "../types";
|
|
2
|
+
import type { Logger } from "../platform/types";
|
|
3
3
|
/**
|
|
4
4
|
* Dispatch a native targeted `/stop` command through the OpenClaw SDK,
|
|
5
5
|
* replacing the previous self-built Gateway WebSocket `chat.abort` approach.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { DingTalkConfig, MessageContent } from "../platform/types";
|
|
1
2
|
import { ScopedLearnedRuleRecord, TargetSetRecord } from "./feedback-learning-store";
|
|
2
|
-
import type { DingTalkConfig, MessageContent } from "./types";
|
|
3
3
|
export declare function isLearningEnabled(config: DingTalkConfig | undefined): boolean;
|
|
4
4
|
export declare function isLearningAutoApplyEnabled(config: DingTalkConfig | undefined): boolean;
|
|
5
5
|
export declare function recordOutboundReplyForLearning(params: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { DingTalkConfig, HandleDingTalkMessageParams, MessageContent } from "../platform/types";
|
|
2
|
+
import type { SessionPeerSourceKind } from "../targeting/session-peer-store";
|
|
3
3
|
type InboundCommandDispatchParams = {
|
|
4
4
|
cfg: HandleDingTalkMessageParams["cfg"];
|
|
5
5
|
accountId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DingTalkConfig } from "
|
|
1
|
+
import type { DingTalkConfig } from "../platform/types";
|
|
2
2
|
export interface ParsedLearnCommand {
|
|
3
3
|
scope: "help" | "global" | "session" | "here" | "target" | "targets" | "list" | "disable" | "delete" | "whoami" | "whereami" | "owner-status" | "target-set-create" | "target-set-apply" | "unknown";
|
|
4
4
|
instruction?: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { DingTalkChannelPlugin } from "../types";
|
|
1
|
+
import type { DingTalkChannelPlugin } from "../platform/types";
|
|
2
2
|
export declare const CHANNEL_INFLIGHT_NAMESPACE_POLICY: "memory-only";
|
|
3
3
|
export declare function createDingTalkGateway(): NonNullable<DingTalkChannelPlugin["gateway"]>;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - Structured logging for all connection events
|
|
10
10
|
*/
|
|
11
11
|
import type { DWClient } from "dingtalk-stream";
|
|
12
|
-
import type { ConnectionState, ConnectionManagerConfig, Logger, StreamClientFactory } from "
|
|
12
|
+
import type { ConnectionState, ConnectionManagerConfig, Logger, StreamClientFactory } from "../platform/types";
|
|
13
13
|
/**
|
|
14
14
|
* Thrown when a runtime reconnection cycle exceeds the configured deadline.
|
|
15
15
|
* Identified via instanceof in reconnect() to skip cycle counting.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DingTalkConfig, HandleDingTalkMessageParams, MediaFile } from "
|
|
1
|
+
import type { DingTalkConfig, HandleDingTalkMessageParams, MediaFile } from "../platform/types";
|
|
2
2
|
export declare function resetProactivePermissionHintStateForTest(): void;
|
|
3
3
|
/**
|
|
4
4
|
* Download DingTalk media file via runtime media service (sandbox-compatible).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AICardInstance, DingTalkConfig, DingTalkInboundMessage, Logger } from "../types";
|
|
1
|
+
import type { AICardInstance, DingTalkConfig, DingTalkInboundMessage, Logger } from "../platform/types";
|
|
2
2
|
export interface InboundQueueDispatchInput {
|
|
3
3
|
accountId: string;
|
|
4
4
|
data: DingTalkInboundMessage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DingTalkConfig, Logger } from "../types";
|
|
1
|
+
import type { DingTalkConfig, Logger } from "../platform/types";
|
|
2
2
|
/**
|
|
3
3
|
* Strip leading `@mention` tokens from inbound text. Used by both the abort and
|
|
4
4
|
* BTW bypass branches in `inbound-handler.ts` so that command detection works
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DingTalkChannelPlugin } from "../types";
|
|
1
|
+
import type { DingTalkChannelPlugin } from "../platform/types";
|
|
2
2
|
export declare function createDingTalkOutbound(): NonNullable<DingTalkChannelPlugin["outbound"]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AttachmentTextSource, Logger, QuotedRef } from "
|
|
1
|
+
import type { AttachmentTextSource, Logger, QuotedRef } from "../platform/types";
|
|
2
2
|
export declare const DEFAULT_MESSAGE_CONTEXT_TTL_DAYS = 7;
|
|
3
3
|
export declare const DEFAULT_CARD_CONTENT_TTL_MS: number;
|
|
4
4
|
export declare const DEFAULT_MEDIA_CONTEXT_TTL_MS: number;
|
|
@@ -30,7 +30,10 @@ export interface MessageRecord {
|
|
|
30
30
|
quotedRef?: QuotedRef;
|
|
31
31
|
senderId?: string;
|
|
32
32
|
senderName?: string;
|
|
33
|
+
/** Display names parsed from mentions; not positionally aligned with mentionUserIds. */
|
|
33
34
|
mentions?: string[];
|
|
35
|
+
/** Raw DingTalk user IDs from structured @mention payloads (atUsers / richText atUserId). Not positionally aligned with mentions. */
|
|
36
|
+
mentionUserIds?: string[];
|
|
34
37
|
chatType?: "direct" | "group";
|
|
35
38
|
/** Flat quoted target for summary/history lookups; quotedRef remains the authoritative structured link. */
|
|
36
39
|
quotedMessageId?: string;
|
|
@@ -66,7 +69,10 @@ interface BaseUpsertParams {
|
|
|
66
69
|
quotedRef?: QuotedRef;
|
|
67
70
|
senderId?: string;
|
|
68
71
|
senderName?: string;
|
|
72
|
+
/** Display names parsed from mentions; not positionally aligned with mentionUserIds. */
|
|
69
73
|
mentions?: string[];
|
|
74
|
+
/** Raw DingTalk user IDs from structured @mention payloads (atUsers / richText atUserId). Not positionally aligned with mentions. */
|
|
75
|
+
mentionUserIds?: string[];
|
|
70
76
|
chatType?: "direct" | "group";
|
|
71
77
|
quotedMessageId?: string;
|
|
72
78
|
media?: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DingTalkInboundMessage, MessageContent, SendMessageOptions } from "
|
|
1
|
+
import type { DingTalkInboundMessage, MessageContent, SendMessageOptions } from "../platform/types";
|
|
2
2
|
/**
|
|
3
3
|
* Auto-detect markdown usage and derive message title.
|
|
4
4
|
* Title extraction follows DingTalk markdown card title constraints.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { Logger, QuotedRef } from "../platform/types";
|
|
2
|
+
import type { MessageRecord } from "./message-context-store";
|
|
3
3
|
export interface QuotedChainEntry {
|
|
4
4
|
depth: number;
|
|
5
5
|
direction: MessageRecord["direction"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DingTalkConfig, Logger, MediaFile } from "../types";
|
|
1
|
+
import type { DingTalkConfig, Logger, MediaFile } from "../platform/types";
|
|
2
2
|
export declare function parseDingTalkFileTime(timeStr: string): number;
|
|
3
3
|
export declare function getUnionIdByStaffId(config: DingTalkConfig, staffId: string, log?: Logger): Promise<string>;
|
|
4
4
|
export declare function getGroupFileSpaceId(config: DingTalkConfig, openConversationId: string, unionId: string, log?: Logger): Promise<string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { DingTalkInboundMessage, Logger, MessageContent, QuotedRef } from "../platform/types";
|
|
2
|
+
import { type MessageRecord } from "./message-context-store";
|
|
3
3
|
export declare function buildInboundQuotedRef(data: DingTalkInboundMessage, content: MessageContent): QuotedRef | undefined;
|
|
4
4
|
export declare function createReplyQuotedRef(msgId: string | undefined): QuotedRef | undefined;
|
|
5
5
|
export declare function resolveQuotedRecord(params: {
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* (final / tool / block), finalization, and failure fallback so that
|
|
6
6
|
* inbound-handler only coordinates — it no longer owns card state.
|
|
7
7
|
*/
|
|
8
|
+
import type { AICardInstance } from "../platform/types";
|
|
8
9
|
import type { ReplyStrategy, ReplyStrategyContext } from "./reply-strategy-types";
|
|
9
|
-
import type { AICardInstance } from "./types";
|
|
10
10
|
export declare function createCardReplyStrategy(ctx: ReplyStrategyContext & {
|
|
11
11
|
card: AICardInstance;
|
|
12
12
|
isStopRequested?: () => boolean;
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* can share these interfaces without circular imports.
|
|
7
7
|
*/
|
|
8
8
|
import type { GetReplyOptions } from "openclaw/plugin-sdk/reply-runtime";
|
|
9
|
-
import type {
|
|
9
|
+
import type { RuntimeEventsSurface } from "../platform/runtime-events";
|
|
10
|
+
import type { DingTalkConfig, Logger, QuotedRef } from "../platform/types";
|
|
10
11
|
export type InternalReplyStrategyConfig = DingTalkConfig & {
|
|
11
12
|
/** @deprecated Internal compatibility only. Removed from public config surface. */
|
|
12
13
|
cardStreamReasoning?: boolean;
|
|
@@ -47,6 +48,13 @@ export interface ReplyStrategy {
|
|
|
47
48
|
finalize(): Promise<void>;
|
|
48
49
|
/** Called when dispatch throws an error. */
|
|
49
50
|
abort(error: Error): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Release strategy-owned resources (timers, event subscriptions) without
|
|
53
|
+
* touching the delivery surface. Idempotent, and safe to call after
|
|
54
|
+
* `finalize()`/`abort()`. Callers must invoke this even on early-return
|
|
55
|
+
* paths so a strategy that never finalized cannot leak.
|
|
56
|
+
*/
|
|
57
|
+
dispose(): Promise<void>;
|
|
50
58
|
/** Last known final text (for external consumers such as logging). */
|
|
51
59
|
getFinalText(): string | undefined;
|
|
52
60
|
}
|
|
@@ -84,4 +92,5 @@ export interface ReplyStrategyContext {
|
|
|
84
92
|
isStopRequested?: () => boolean;
|
|
85
93
|
inboundText?: string;
|
|
86
94
|
taskMeta?: TaskMeta;
|
|
95
|
+
runtimeEvents?: RuntimeEventsSurface;
|
|
87
96
|
}
|
package/dist/src/{reply-strategy-with-reaction.d.ts → messaging/reply-strategy-with-reaction.d.ts}
RENAMED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
* cross-session reaction contamination when multiple messages are processed
|
|
24
24
|
* concurrently. The `sessionFilter` parameter is required for this reason.
|
|
25
25
|
*/
|
|
26
|
+
import type { DingTalkConfig, Logger } from "../platform/types";
|
|
26
27
|
import type { ReplyStrategy } from "./reply-strategy-types";
|
|
27
|
-
import type { DingTalkConfig, Logger } from "./types";
|
|
28
28
|
export interface DynamicReactionParams {
|
|
29
29
|
config: DingTalkConfig;
|
|
30
30
|
msgId: string;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Delegates the "how to deliver a reply" concern to card or markdown
|
|
5
5
|
* strategy implementations. Type definitions live in reply-strategy-types.ts.
|
|
6
6
|
*/
|
|
7
|
-
import type { AICardInstance } from "
|
|
7
|
+
import type { AICardInstance } from "../platform/types";
|
|
8
8
|
import type { ReplyStrategy, ReplyStrategyContext } from "./reply-strategy-types";
|
|
9
9
|
export type { DeliverPayload, ReplyOptions, ReplyStrategy, ReplyStrategyContext, TaskMeta, } from "./reply-strategy-types";
|
|
10
10
|
export declare function createReplyStrategy(params: ReplyStrategyContext & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { AICardInstance, AxiosResponse, DingTalkConfig, DingTalkTrackingMetadata, Logger, SendMessageOptions } from "../platform/types";
|
|
1
2
|
import type { UploadMediaResult } from "./media-utils";
|
|
2
|
-
import type { AICardInstance, AxiosResponse, DingTalkConfig, DingTalkTrackingMetadata, Logger, SendMessageOptions } from "./types";
|
|
3
3
|
export { detectMediaTypeFromExtension } from "./media-utils";
|
|
4
4
|
type ProactiveTextSendResult = AxiosResponse | {
|
|
5
5
|
tracking: DingTalkTrackingMetadata;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DingTalkChannelPlugin } from "
|
|
1
|
+
import type { DingTalkChannelPlugin } from "./types";
|
|
2
2
|
export declare function createDingTalkStatus(): NonNullable<DingTalkChannelPlugin["status"]>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { OpenClawConfig } from "openclaw/plugin-sdk/core";
|
|
2
|
+
import type { DingTalkConfig, DingTalkGatewayCapabilitiesConfig } from "./types";
|
|
3
|
+
export { resolveRelativePath, resolveUserPath } from "../shared/path-utils";
|
|
4
|
+
export type RuntimeDingTalkConfig = Omit<DingTalkConfig, "clientSecret"> & {
|
|
5
|
+
clientSecret: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Merge channel-level and account-level `gatewayCapabilities` gates by sub-key.
|
|
9
|
+
*
|
|
10
|
+
* `mergeAccountWithDefaults` is a shallow merge, so without this helper an
|
|
11
|
+
* account-level object would replace the whole channel-level `gatewayCapabilities` and
|
|
12
|
+
* silently drop a channel-level allowlist (fail-open). Merging `tools` /
|
|
13
|
+
* `docs` / `send` separately keeps channel-level restrictions in force unless
|
|
14
|
+
* the account explicitly overrides that exact sub-key.
|
|
15
|
+
*/
|
|
16
|
+
export declare function mergeGatewayCapabilitiesConfig(channelLevel: DingTalkGatewayCapabilitiesConfig | undefined, accountLevel: DingTalkGatewayCapabilitiesConfig | undefined): DingTalkGatewayCapabilitiesConfig | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Merge channel-level defaults into an account-specific config.
|
|
19
|
+
* Account-level values take precedence; `accounts` key is excluded to avoid recursion.
|
|
20
|
+
*/
|
|
21
|
+
export declare function mergeAccountWithDefaults(channelCfg: DingTalkConfig, accountCfg: DingTalkConfig): DingTalkConfig;
|
|
22
|
+
/**
|
|
23
|
+
* Resolve DingTalk config for an account.
|
|
24
|
+
* Named accounts inherit channel-level defaults with account-level overrides.
|
|
25
|
+
* Falls back to top-level config for single-account setups.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getConfig(cfg: OpenClawConfig, accountId?: string): DingTalkConfig;
|
|
28
|
+
export declare function isConfigured(cfg: OpenClawConfig, accountId?: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Resolved Gateway RPC capability settings (Issue #608, 问题 3).
|
|
31
|
+
* All capabilities default to enabled; allowlists default to unrestricted.
|
|
32
|
+
*/
|
|
33
|
+
export interface ResolvedGatewayCapabilities {
|
|
34
|
+
/** `dingtalk.docs.*` / `dingtalk-connector.docs.*` RPCs enabled (default: true) */
|
|
35
|
+
docsEnabled: boolean;
|
|
36
|
+
/** `dingtalk-connector.sendToUser/sendToGroup/send` RPCs enabled (default: true) */
|
|
37
|
+
proactiveSendEnabled: boolean;
|
|
38
|
+
/** When set, docs RPCs only accept these spaceId values */
|
|
39
|
+
allowedSpaceIds?: string[];
|
|
40
|
+
/** When set, proactive-send RPCs only accept these `user:*` / `group:*` targets */
|
|
41
|
+
allowedTargets?: string[];
|
|
42
|
+
}
|
|
43
|
+
/** Denial reason returned when `gatewayCapabilities.tools.docs` is explicitly false. */
|
|
44
|
+
export declare const DOCS_GATE_DISABLED_REASON = "dingtalk docs Gateway RPC is disabled by config (gatewayCapabilities.tools.docs = false)";
|
|
45
|
+
/** Denial reason returned when `gatewayCapabilities.tools.proactiveSend` is explicitly false. */
|
|
46
|
+
export declare const PROACTIVE_SEND_GATE_DISABLED_REASON = "dingtalk proactive-send Gateway RPC is disabled by config (gatewayCapabilities.tools.proactiveSend = false)";
|
|
47
|
+
/**
|
|
48
|
+
* Resolve Gateway RPC capability configuration for an account.
|
|
49
|
+
* Account-level `gatewayCapabilities` is merged with channel-level defaults by sub-key
|
|
50
|
+
* (see `mergeGatewayCapabilitiesConfig`); both default to all capabilities enabled.
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveGatewayCapabilityConfig(cfg: OpenClawConfig, accountId?: string): ResolvedGatewayCapabilities;
|
|
53
|
+
/**
|
|
54
|
+
* Check a docs RPC request against the configured capability gates.
|
|
55
|
+
* Returns null when allowed, or a human-readable denial reason.
|
|
56
|
+
*
|
|
57
|
+
* A configured allowlist is fail-closed: an empty list (possible only when
|
|
58
|
+
* config validation was bypassed) denies every docs RPC, and a request without
|
|
59
|
+
* a spaceId is denied as well because its doc space cannot be verified.
|
|
60
|
+
*/
|
|
61
|
+
export declare function checkDocsGatewayCapability(caps: ResolvedGatewayCapabilities, spaceId: string | undefined): string | null;
|
|
62
|
+
/**
|
|
63
|
+
* Check a proactive-send RPC request against the configured capability gates.
|
|
64
|
+
* Returns null when allowed, or a human-readable denial reason.
|
|
65
|
+
*
|
|
66
|
+
* A configured allowlist is fail-closed: an empty list (possible only when
|
|
67
|
+
* config validation was bypassed) denies every proactive-send RPC.
|
|
68
|
+
*/
|
|
69
|
+
export declare function checkProactiveSendGatewayCapability(caps: ResolvedGatewayCapabilities, target: string): string | null;
|
|
70
|
+
export declare function resolveRuntimeConfig(config: DingTalkConfig, log?: {
|
|
71
|
+
warn?: (message: string, data?: unknown) => void;
|
|
72
|
+
}): Promise<RuntimeDingTalkConfig>;
|
|
73
|
+
/**
|
|
74
|
+
* Resolve the robot code used by DingTalk APIs.
|
|
75
|
+
* DingTalk robotCode is always equal to clientId; this helper trims whitespace.
|
|
76
|
+
*/
|
|
77
|
+
export declare function resolveRobotCode(config: Pick<DingTalkConfig, "clientId">): string;
|
|
78
|
+
export declare function resolveGroupConfig(cfg: DingTalkConfig, groupId: string): {
|
|
79
|
+
systemPrompt?: string;
|
|
80
|
+
requireMention?: boolean;
|
|
81
|
+
groupAllowFrom?: string[];
|
|
82
|
+
} | undefined;
|
|
83
|
+
export declare function resolveAckReactionSetting(params: {
|
|
84
|
+
cfg: OpenClawConfig;
|
|
85
|
+
accountId?: string | null;
|
|
86
|
+
agentId?: string | null;
|
|
87
|
+
}): string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Strip group/user prefixes used by CLI targeting.
|
|
90
|
+
* Returns raw DingTalk target ID and whether caller explicitly requested a user target.
|
|
91
|
+
*/
|
|
92
|
+
export declare function stripTargetPrefix(target: string): {
|
|
93
|
+
targetId: string;
|
|
94
|
+
isExplicitUser: boolean;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* List all DingTalk account IDs from config
|
|
98
|
+
*/
|
|
99
|
+
export declare function listDingTalkAccountIds(cfg: OpenClawConfig): string[];
|
|
100
|
+
/**
|
|
101
|
+
* Resolved DingTalk account with configuration status
|
|
102
|
+
*/
|
|
103
|
+
export interface ResolvedDingTalkAccount extends DingTalkConfig {
|
|
104
|
+
accountId: string;
|
|
105
|
+
configured: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Resolve a specific DingTalk account configuration
|
|
109
|
+
*/
|
|
110
|
+
export declare function resolveDingTalkAccount(cfg: OpenClawConfig, accountId?: string | null): ResolvedDingTalkAccount;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-domain runtime agent-event infrastructure.
|
|
3
|
+
*
|
|
4
|
+
* Owns the generic OpenClaw `events.onAgentEvent` surface that several
|
|
5
|
+
* domains consume: event typing, reference-counted fan-out, field accessors,
|
|
6
|
+
* and run correlation. Domain owners (ack reactions, AI card task progress)
|
|
7
|
+
* build their own behavior on top of these primitives instead of importing
|
|
8
|
+
* each other's private modules.
|
|
9
|
+
*/
|
|
10
|
+
export type RuntimeEventsLogger = {
|
|
11
|
+
debug?: (msg: string) => void;
|
|
12
|
+
info?: (msg: string) => void;
|
|
13
|
+
warn?: (msg: string) => void;
|
|
14
|
+
};
|
|
15
|
+
export type RuntimeAgentEvent = {
|
|
16
|
+
stream?: string;
|
|
17
|
+
runId?: string;
|
|
18
|
+
sessionKey?: string;
|
|
19
|
+
data?: {
|
|
20
|
+
phase?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
args?: unknown;
|
|
23
|
+
runId?: string;
|
|
24
|
+
sessionKey?: string;
|
|
25
|
+
toolCallId?: string;
|
|
26
|
+
meta?: {
|
|
27
|
+
runId?: string;
|
|
28
|
+
sessionKey?: string;
|
|
29
|
+
} | null;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export type RuntimeEventsSurface = {
|
|
33
|
+
onAgentEvent?: (listener: (event: unknown) => void) => () => void;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Fan one upstream `onAgentEvent` subscription out to multiple local consumers.
|
|
37
|
+
*
|
|
38
|
+
* The upstream subscription is reference-counted: it is created with the first
|
|
39
|
+
* local listener and released with the last one. Each listener is isolated so a
|
|
40
|
+
* throwing consumer can neither starve the remaining consumers nor bubble back
|
|
41
|
+
* into the host event emitter.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createRuntimeEventsFanout(upstream: RuntimeEventsSurface | undefined, options?: {
|
|
44
|
+
log?: RuntimeEventsLogger;
|
|
45
|
+
}): RuntimeEventsSurface;
|
|
46
|
+
export declare function getEventRunId(event: RuntimeAgentEvent | undefined): string | undefined;
|
|
47
|
+
export declare function getEventSessionKey(event: RuntimeAgentEvent | undefined): string | undefined;
|
|
48
|
+
export declare function describeEvent(event: RuntimeAgentEvent | undefined): string;
|
|
49
|
+
/**
|
|
50
|
+
* Build a predicate that decides whether an agent event belongs to one reply.
|
|
51
|
+
*
|
|
52
|
+
* Correlation prefers an already captured `runId`; otherwise it accepts events
|
|
53
|
+
* whose `sessionKey` matches, and finally falls back to optimistically
|
|
54
|
+
* capturing the first session-less lifecycle start inside a short window.
|
|
55
|
+
*
|
|
56
|
+
* `consumer` labels the debug logs so two consumers sharing the same session
|
|
57
|
+
* (ack reactions and card task progress) stay distinguishable while triaging.
|
|
58
|
+
*/
|
|
59
|
+
export declare function createAgentEventCorrelator(params: {
|
|
60
|
+
/** Short label identifying the consuming domain in debug logs. */
|
|
61
|
+
consumer: string;
|
|
62
|
+
sessionKey: string;
|
|
63
|
+
enabled: boolean;
|
|
64
|
+
createdAt: number;
|
|
65
|
+
optimisticCaptureWindowMs: number;
|
|
66
|
+
log?: RuntimeEventsLogger;
|
|
67
|
+
}): (event: RuntimeAgentEvent | undefined) => boolean;
|