openclaw-lark-multi-agent 1.8.13 → 1.8.15

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.
@@ -22,8 +22,9 @@ export type LiveStatusView = {
22
22
  toolCalls: number;
23
23
  /** True when finished via noReply(): the model produced no user-visible reply. */
24
24
  noReply: boolean;
25
- /** Terminal state: running / done / failed (lets renderer pick color). */
26
- state: "running" | "done" | "failed";
25
+ /** Presentation only: queued/admitted do not claim model execution. */
26
+ state: "queued" | "admitted" | "running" | "done" | "failed";
27
+ phase?: "queued" | "admitted" | "working" | "waiting" | "done" | "failed";
27
28
  };
28
29
  /** Persisted metadata needed to turn the live-status card into the final answer. */
29
30
  export type LiveStatusFinalMeta = {
@@ -35,15 +36,55 @@ export type LiveStatusFinalMeta = {
35
36
  locale: "zh" | "en";
36
37
  noReply?: boolean;
37
38
  };
39
+ /** Optional external presentation owner (e.g. the durable outbox). A local
40
+ * execution outcome is NOT a platform delivery receipt. Once handed off, late
41
+ * card effects request reconciliation from this owner instead of writing a
42
+ * compact done view over its possibly-unknown final payload. */
43
+ export type LiveStatusTerminalOwner = {
44
+ onReconcileNeeded: (meta: LiveStatusFinalMeta) => void | Promise<void>;
45
+ };
46
+ /** The adapter MUST call run inside its ordered callback, immediately around
47
+ * the actual SDK invocation. Its receipt survives an outer queue deadline. */
48
+ export type LiveStatusEffect<T> = {
49
+ run: (send: () => Promise<T>) => Promise<T | undefined>;
50
+ };
51
+ /** A transport/observation error is not proof that a platform effect failed. */
52
+ export declare class LiveStatusEffectUnknownError extends Error {
53
+ readonly cause: unknown;
54
+ constructor(cause: unknown);
55
+ }
56
+ /** Only a definitive platform rejection is safe for the terminal retry loop. */
57
+ export declare class LiveStatusEffectRejectedError extends Error {
58
+ }
59
+ /** Proven local no-effect suppression (settings/epoch/lease), not an unknown
60
+ * transport outcome and not permission to retry an attempted SDK operation. */
61
+ export declare class LiveStatusEffectSuppressedError extends Error {
62
+ }
38
63
  export type LiveStatusCallbacks = {
39
64
  /** Create the status card; returns the new message id. */
40
- create: (view: LiveStatusView) => Promise<string | undefined>;
41
- /** Patch the existing status card. */
42
- edit: (messageId: string, view: LiveStatusView) => Promise<void>;
65
+ create: (view: LiveStatusView, effect: LiveStatusEffect<string | undefined>) => Promise<string | undefined>;
66
+ /** Patch the existing status card. Reject with LiveStatusEffectRejectedError
67
+ * only for a definitive no-effect failure; all other rejection is unknown. */
68
+ edit: (messageId: string, view: LiveStatusView, effect: LiveStatusEffect<void>) => Promise<void>;
43
69
  warn?: (message: string, err?: unknown) => void;
70
+ /** Synchronous journal checkpoint, before scheduling any new UI effect. */
71
+ desired?: (view: LiveStatusView) => void;
72
+ /** UI-only cohort completeness. A root outcome is not per-input proof. */
73
+ unconfirmedInputs?: (outcome: "done" | "failed") => {
74
+ title: string;
75
+ detail: string;
76
+ } | undefined;
44
77
  };
45
78
  export type LiveStatusOptions = {
46
79
  botName: string;
80
+ initialPhase?: "queued";
81
+ restore?: {
82
+ messageId?: string;
83
+ view?: LiveStatusView;
84
+ startedAt: number;
85
+ blockCreate: boolean;
86
+ blockEdits: boolean;
87
+ };
47
88
  locale?: "zh" | "en";
48
89
  delayMs?: number;
49
90
  maxChars?: number;
@@ -67,7 +108,19 @@ export declare class LiveStatusController {
67
108
  private createTimer?;
68
109
  private tickTimer?;
69
110
  private createPromise?;
111
+ private createSuppressed;
112
+ private waitingCreateAllowed;
70
113
  private finalized;
114
+ private terminalOutcome;
115
+ private disposed;
116
+ private generation;
117
+ /** Frozen/terminal presentation wins over every older progress snapshot. */
118
+ private pinnedView?;
119
+ private terminalOwner?;
120
+ private pendingEdit?;
121
+ private editPump?;
122
+ /** Timed-out SDK effects retain receipt ownership, but must not be replayed. */
123
+ private unknownEdits;
71
124
  private waitingForResult;
72
125
  private updatesFrozen;
73
126
  private disabled;
@@ -78,13 +131,25 @@ export declare class LiveStatusController {
78
131
  * A success resets the counter. */
79
132
  private consecutiveEditFailures;
80
133
  private state;
134
+ private blockedEdits;
81
135
  /** Total tool calls (tool_start events) seen during the run, for the summary. */
82
136
  private toolCallCount;
83
137
  /** True when finished via noReply(): show a "no content" summary. */
84
138
  private noReplyResult;
85
139
  constructor(callbacks: LiveStatusCallbacks, opts: LiveStatusOptions);
140
+ /** Receipt is durable locally, NOT Gateway admission. */
141
+ received(detail: string): void;
142
+ /** A proven never-attempted ordinary recovery may reuse its queued card.
143
+ * Merely observing an expected root never calls this method. */
144
+ resumeQueued(): void;
145
+ /** Enqueue/local receipt remains waiting, not actual-owner/model evidence.
146
+ * Keep one latest pinned view while allowing another input to coalesce. */
147
+ showInputWaiting(detail: string, title?: string): Promise<void>;
148
+ /** Only the exact ACK owner calls this; admission is not model execution. */
149
+ admitted(successor?: boolean): Promise<void>;
86
150
  get id(): string | undefined;
87
151
  start(initialDetail?: string): void;
152
+ setMetadata(model?: string, thinkingLevel?: string): void;
88
153
  progress(event: ProgressEvent | string): Promise<void>;
89
154
  /** Freeze recurring/progress edits, not the original result observer.
90
155
  * A single final/error summary remains allowed when the real outcome arrives. */
@@ -97,10 +162,14 @@ export declare class LiveStatusController {
97
162
  * Freeze any successful terminal state (text, attachment-only, or NO_REPLY)
98
163
  * without first emitting the compact done patch. The caller persists this
99
164
  * metadata in the outbox, which owns the final patch/cleanup. If no card was
100
- * created, the caller falls back to normal new-message delivery.
165
+ * created, the caller falls back to normal new-message delivery. Metadata is
166
+ * a target/execution snapshot, never a receipt. B2/outbox callers that may own
167
+ * an unknown or same-card final should supply owner BEFORE attempting it;
168
+ * late IDs/stale effects then delegate reconciliation instead of patching.
101
169
  */
102
- prepareTerminalDelivery(noReply?: boolean): Promise<LiveStatusFinalMeta | undefined>;
103
- prepareFinalDelivery(): Promise<LiveStatusFinalMeta | undefined>;
170
+ prepareTerminalDelivery(noReply?: boolean, owner?: LiveStatusTerminalOwner): Promise<LiveStatusFinalMeta | undefined>;
171
+ private finalMeta;
172
+ prepareFinalDelivery(owner?: LiveStatusTerminalOwner): Promise<LiveStatusFinalMeta | undefined>;
104
173
  fail(): Promise<void>;
105
174
  /**
106
175
  * Finish when the model explicitly produced no reply (NO_REPLY) or an empty
@@ -109,6 +178,9 @@ export declare class LiveStatusController {
109
178
  */
110
179
  noReply(): Promise<void>;
111
180
  dispose(): void;
181
+ private pinView;
182
+ private finishView;
183
+ private reconcilePinnedView;
112
184
  /**
113
185
  * Intermediate assistant text arrives as incremental fragments (each flush
114
186
  * sends only the newly-added slice). Consecutive fragments with no tool event
@@ -126,13 +198,11 @@ export declare class LiveStatusController {
126
198
  /** Refresh the elapsed-time footer periodically even with no new activity. */
127
199
  private startTicker;
128
200
  private safeEdit;
129
- /**
130
- * Terminal edits (complete/fail/noReply) are one-shot — there is no next tick to
131
- * recover them — so a transient Feishu error (code=2200 etc.) would leave the
132
- * card stuck on "running". Retry the final patch a few times with small backoff
133
- * so the card reliably reaches its terminal state.
134
- */
135
- private safeEditFinal;
201
+ /** One flight + one latest pending snapshot, regardless of tick/event rate. */
202
+ private queueEdit;
203
+ private canRunPendingEdit;
204
+ private flushEdits;
205
+ private performEdit;
136
206
  /** Dedupe key includes elapsed so the footer timer ticks even without new
137
207
  * activity, while identical content within the same second is still skipped. */
138
208
  private signature;