@inline-openclaw/inline 0.0.68 → 0.0.70
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.
|
@@ -70363,7 +70363,7 @@ function countInlineExecApprovalEligibleAccounts(params) {
|
|
|
70363
70363
|
}).length;
|
|
70364
70364
|
}
|
|
70365
70365
|
function isExecApprovalRequest(request) {
|
|
70366
|
-
return "command" in request.request;
|
|
70366
|
+
return request.approvalKind != null ? request.approvalKind === "exec" : ("command" in request.request) && !("proposalHash" in request.request);
|
|
70367
70367
|
}
|
|
70368
70368
|
function isTargetForwardingMode(mode) {
|
|
70369
70369
|
return mode === "targets" || mode === "both";
|
|
@@ -74293,7 +74293,9 @@ ${entityLines.slice(-ATTACHMENT_CONTEXT_LIMIT).join(`
|
|
|
74293
74293
|
}
|
|
74294
74294
|
async function monitorInlineProvider(params) {
|
|
74295
74295
|
let { cfg } = params;
|
|
74296
|
-
const { account, runtime,
|
|
74296
|
+
const { account, runtime, log, statusSink } = params;
|
|
74297
|
+
const shutdown = new AbortController;
|
|
74298
|
+
const abortSignal = AbortSignal.any([params.abortSignal, shutdown.signal]);
|
|
74297
74299
|
const core3 = getInlineRuntime();
|
|
74298
74300
|
if (!account.configured || !account.baseUrl) {
|
|
74299
74301
|
throw new Error(`Inline not configured for account "${account.accountId}" (missing baseUrl or token)`);
|
|
@@ -74786,6 +74788,8 @@ async function monitorInlineProvider(params) {
|
|
|
74786
74788
|
});
|
|
74787
74789
|
};
|
|
74788
74790
|
const handleInboundNow = async (input) => {
|
|
74791
|
+
if (abortSignal.aborted)
|
|
74792
|
+
return;
|
|
74789
74793
|
const chatId = input.chatId;
|
|
74790
74794
|
const msg = input.msg;
|
|
74791
74795
|
const rawBodyOverride = input.rawBodyOverride ?? null;
|
|
@@ -75933,7 +75937,7 @@ This model will be used for your next message.`, []);
|
|
|
75933
75937
|
closing: false
|
|
75934
75938
|
};
|
|
75935
75939
|
const renderInlineProgressPlaceholder = async () => {
|
|
75936
|
-
if (!progressPlaceholderEnabled || progressState.closing || adoptingThread)
|
|
75940
|
+
if (abortSignal.aborted || !progressPlaceholderEnabled || progressState.closing || adoptingThread)
|
|
75937
75941
|
return;
|
|
75938
75942
|
const text = sanitizeInlineDeliveryText(formatChannelProgressDraftText({
|
|
75939
75943
|
entry: account.config,
|
|
@@ -75943,7 +75947,7 @@ This model will be used for your next message.`, []);
|
|
|
75943
75947
|
if (!text || text === progressState.text)
|
|
75944
75948
|
return;
|
|
75945
75949
|
progressState.opChain = progressState.opChain.then(async () => {
|
|
75946
|
-
if (progressState.closing || text === progressState.text)
|
|
75950
|
+
if (abortSignal.aborted || progressState.closing || text === progressState.text)
|
|
75947
75951
|
return;
|
|
75948
75952
|
if (progressState.messageId == null) {
|
|
75949
75953
|
const sent = await client.sendMessage({
|
|
@@ -76046,6 +76050,8 @@ This model will be used for your next message.`, []);
|
|
|
76046
76050
|
};
|
|
76047
76051
|
const nextEditStreamInterval = (requestDurationMs) => Math.min(INLINE_EDIT_STREAM_MAX_INTERVAL_MS, Math.max(INLINE_EDIT_STREAM_MIN_INTERVAL_MS, Math.ceil(requestDurationMs * 1.25)));
|
|
76048
76052
|
const sendEditStreamSnapshot = async (snapshot) => {
|
|
76053
|
+
if (abortSignal.aborted)
|
|
76054
|
+
return;
|
|
76049
76055
|
try {
|
|
76050
76056
|
if (editStreamState.messageId == null) {
|
|
76051
76057
|
let sent;
|
|
@@ -76101,6 +76107,11 @@ This model will be used for your next message.`, []);
|
|
|
76101
76107
|
}
|
|
76102
76108
|
};
|
|
76103
76109
|
const scheduleEditStreamDrain = () => {
|
|
76110
|
+
if (abortSignal.aborted) {
|
|
76111
|
+
editStreamState.pendingSnapshot = null;
|
|
76112
|
+
clearEditStreamTimer();
|
|
76113
|
+
return;
|
|
76114
|
+
}
|
|
76104
76115
|
if (editStreamState.failed || editStreamState.inFlight != null || editStreamState.timer != null || editStreamState.pendingSnapshot == null) {
|
|
76105
76116
|
return;
|
|
76106
76117
|
}
|
|
@@ -76310,7 +76321,7 @@ This model will be used for your next message.`, []);
|
|
|
76310
76321
|
await resetEditStreamForAssistantMessage();
|
|
76311
76322
|
};
|
|
76312
76323
|
const handlePartialStreamPayload = (payload) => {
|
|
76313
|
-
if (adoptingThread)
|
|
76324
|
+
if (abortSignal.aborted || adoptingThread)
|
|
76314
76325
|
return;
|
|
76315
76326
|
const visiblePayload = resolveInlineChatVisibleReplyPayload(payload);
|
|
76316
76327
|
if (!visiblePayload)
|
|
@@ -76396,6 +76407,7 @@ This model will be used for your next message.`, []);
|
|
|
76396
76407
|
}
|
|
76397
76408
|
};
|
|
76398
76409
|
const replyOptions = {
|
|
76410
|
+
abortSignal,
|
|
76399
76411
|
onObservedReplyDelivery: async () => {
|
|
76400
76412
|
delivered = true;
|
|
76401
76413
|
},
|
|
@@ -76538,7 +76550,7 @@ This model will be used for your next message.`, []);
|
|
|
76538
76550
|
let undeliveredFinalActions;
|
|
76539
76551
|
try {
|
|
76540
76552
|
const dispatch = await dispatchInlineReplyWithSessionInitRetry({
|
|
76541
|
-
shouldRetry: () => !delivered && !skippedNonSilent && !failedNonSilent,
|
|
76553
|
+
shouldRetry: () => !abortSignal.aborted && !delivered && !skippedNonSilent && !failedNonSilent,
|
|
76542
76554
|
onRetry: (retry, delayMs) => {
|
|
76543
76555
|
log?.warn(`[${account.accountId}] AGENT_DISPATCH_TRACE phase=session_init_conflict_retry ` + `retry=${retry} delay_ms=${delayMs}`);
|
|
76544
76556
|
},
|
|
@@ -76549,6 +76561,8 @@ This model will be used for your next message.`, []);
|
|
|
76549
76561
|
...dispatcherPipelineOptions,
|
|
76550
76562
|
...buildInlineTypingDispatcherOptions(typingCallbacks),
|
|
76551
76563
|
deliver: async (payload, info) => {
|
|
76564
|
+
if (abortSignal.aborted)
|
|
76565
|
+
return inlineReplyDeliveryResult(false);
|
|
76552
76566
|
let payloadVisible = false;
|
|
76553
76567
|
const markPayloadVisible = () => {
|
|
76554
76568
|
delivered = true;
|
|
@@ -76850,7 +76864,7 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
|
|
|
76850
76864
|
const skipFallbackSuppressed = dispatchResult.sourceReplyDeliveryMode === "message_tool_only";
|
|
76851
76865
|
const hostRequestedNoVisibleRecovery = dispatchResult.noVisibleReplyFallbackEligible === true;
|
|
76852
76866
|
const explicitFailure = dispatchError != null || failedNonSilent;
|
|
76853
|
-
if (!delivered && !hostDeliveredReply && !deferredToActiveRun && !adoptingThread && (explicitFailure || !hostHandledTurn && !deliberateSilence &&
|
|
76867
|
+
if (!abortSignal.aborted && dispatchResult.sendPolicyDenied !== true && !delivered && !hostDeliveredReply && !deferredToActiveRun && !adoptingThread && (explicitFailure || !hostHandledTurn && !deliberateSilence && !skipFallbackSuppressed && (skippedNonSilent || hostRequestedNoVisibleRecovery))) {
|
|
76854
76868
|
botPresenceLifecycle.fail();
|
|
76855
76869
|
const fallbackText = undeliveredFinalText.trim() ? undeliveredFinalText : dispatchError != null ? INLINE_REQUEST_ERROR_FALLBACK : EMPTY_RESPONSE_FALLBACK;
|
|
76856
76870
|
const sent = await client.sendMessage({
|
|
@@ -76869,12 +76883,16 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
|
|
|
76869
76883
|
}
|
|
76870
76884
|
} finally {
|
|
76871
76885
|
endActiveThreadRoute();
|
|
76886
|
+
if (abortSignal.aborted) {
|
|
76887
|
+
runTypingCleanup();
|
|
76888
|
+
botPresenceLifecycle.cleanup();
|
|
76889
|
+
}
|
|
76872
76890
|
if (adoptedThreadThisTurn) {
|
|
76873
76891
|
await sendDeliveryTyping(deliveryChatId, false).catch((error51) => runtime.error?.(`inline adopted thread typing cleanup failed: ${String(error51)}`));
|
|
76874
76892
|
botPresenceLifecycle.cleanup();
|
|
76875
76893
|
}
|
|
76876
76894
|
await setParentThreadCreationTyping(false);
|
|
76877
|
-
if (callbackActionEvent && !callbackActionAnswered) {
|
|
76895
|
+
if (!abortSignal.aborted && callbackActionEvent && !callbackActionAnswered) {
|
|
76878
76896
|
try {
|
|
76879
76897
|
await answerCallbackIfNeeded();
|
|
76880
76898
|
} catch (error51) {
|
|
@@ -77460,6 +77478,8 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
|
|
|
77460
77478
|
});
|
|
77461
77479
|
};
|
|
77462
77480
|
const scheduleInboundTask = (label, run, options) => {
|
|
77481
|
+
if (abortSignal.aborted)
|
|
77482
|
+
return;
|
|
77463
77483
|
let task;
|
|
77464
77484
|
try {
|
|
77465
77485
|
if (options?.serialKey) {
|
|
@@ -77467,7 +77487,10 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
|
|
|
77467
77487
|
const previous = inboundTaskChains.get(serialKey) ?? Promise.resolve();
|
|
77468
77488
|
task = previous.catch(() => {
|
|
77469
77489
|
return;
|
|
77470
|
-
}).then(
|
|
77490
|
+
}).then(() => {
|
|
77491
|
+
if (!abortSignal.aborted)
|
|
77492
|
+
return run();
|
|
77493
|
+
});
|
|
77471
77494
|
const settled = task.catch(() => {
|
|
77472
77495
|
return;
|
|
77473
77496
|
});
|
|
@@ -77616,8 +77639,33 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
|
|
|
77616
77639
|
suppressedVoiceMessageEditTimeouts.clear();
|
|
77617
77640
|
};
|
|
77618
77641
|
const drainInboundTasks = async () => {
|
|
77619
|
-
|
|
77620
|
-
|
|
77642
|
+
let timer;
|
|
77643
|
+
const drained = (async () => {
|
|
77644
|
+
while (pendingInboundTasks.size > 0) {
|
|
77645
|
+
await Promise.allSettled(pendingInboundTasks);
|
|
77646
|
+
}
|
|
77647
|
+
})();
|
|
77648
|
+
let onAbort;
|
|
77649
|
+
try {
|
|
77650
|
+
await Promise.race([
|
|
77651
|
+
drained,
|
|
77652
|
+
new Promise((resolve) => {
|
|
77653
|
+
onAbort = () => {
|
|
77654
|
+
timer = setTimeout(() => {
|
|
77655
|
+
log?.warn(`[${account.accountId}] inline shutdown grace expired with pending inbound work`);
|
|
77656
|
+
resolve();
|
|
77657
|
+
}, 15000);
|
|
77658
|
+
};
|
|
77659
|
+
if (abortSignal.aborted)
|
|
77660
|
+
onAbort();
|
|
77661
|
+
else
|
|
77662
|
+
abortSignal.addEventListener("abort", onAbort, { once: true });
|
|
77663
|
+
})
|
|
77664
|
+
]);
|
|
77665
|
+
} finally {
|
|
77666
|
+
clearTimeout(timer);
|
|
77667
|
+
if (onAbort)
|
|
77668
|
+
abortSignal.removeEventListener("abort", onAbort);
|
|
77621
77669
|
}
|
|
77622
77670
|
};
|
|
77623
77671
|
const loop = (async () => {
|
|
@@ -77810,6 +77858,7 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
|
|
|
77810
77858
|
return;
|
|
77811
77859
|
}
|
|
77812
77860
|
stopPromise = (async () => {
|
|
77861
|
+
shutdown.abort();
|
|
77813
77862
|
clearInterval(diagnosticsTimer);
|
|
77814
77863
|
clearPendingInlineVoiceMessages();
|
|
77815
77864
|
await client.close().catch(() => {});
|
|
@@ -77818,11 +77867,13 @@ Attachment: ${mediaUrl}` : `Attachment: ${mediaUrl}`;
|
|
|
77818
77867
|
})();
|
|
77819
77868
|
await stopPromise;
|
|
77820
77869
|
};
|
|
77821
|
-
abortSignal.addEventListener("abort", () => {
|
|
77870
|
+
params.abortSignal.addEventListener("abort", () => {
|
|
77822
77871
|
stop();
|
|
77823
77872
|
}, { once: true });
|
|
77873
|
+
if (params.abortSignal.aborted)
|
|
77874
|
+
stop();
|
|
77824
77875
|
const done = loop.then(drainInboundTasks, async (error51) => {
|
|
77825
|
-
await
|
|
77876
|
+
await stop();
|
|
77826
77877
|
throw error51;
|
|
77827
77878
|
});
|
|
77828
77879
|
return { stop, done };
|
|
@@ -78826,6 +78877,11 @@ import {
|
|
|
78826
78877
|
normalizeLowercaseStringOrEmpty as normalizeLowercaseStringOrEmpty3,
|
|
78827
78878
|
normalizeOptionalString as normalizeOptionalString4
|
|
78828
78879
|
} from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
78880
|
+
|
|
78881
|
+
// src/inline/approval-contract.ts
|
|
78882
|
+
var INLINE_APPROVAL_EVENT_KINDS = ["exec", "plugin", "system-agent"];
|
|
78883
|
+
|
|
78884
|
+
// src/inline/approval-native.ts
|
|
78829
78885
|
function accountParams(params) {
|
|
78830
78886
|
return {
|
|
78831
78887
|
cfg: params.cfg,
|
|
@@ -78964,7 +79020,7 @@ var inlineNativeApprovalCapability = createApproverRestrictedNativeApprovalCapab
|
|
|
78964
79020
|
resolveApproverDmTargets: resolveInlineApproverDmTargets,
|
|
78965
79021
|
notifyOriginWhenDmOnly: true,
|
|
78966
79022
|
nativeRuntime: createLazyChannelApprovalNativeRuntimeAdapter({
|
|
78967
|
-
eventKinds:
|
|
79023
|
+
eventKinds: INLINE_APPROVAL_EVENT_KINDS,
|
|
78968
79024
|
isConfigured: ({ cfg, accountId }) => isInlineExecApprovalClientEnabled(accountParams({ cfg, accountId })),
|
|
78969
79025
|
shouldHandle: ({ cfg, accountId, request }) => shouldHandleInlineExecApprovalRequest(requestParams({ cfg, accountId, request })),
|
|
78970
79026
|
load: async () => loadBundledEntryExportSync(import.meta.url, {
|
|
@@ -80828,5 +80884,5 @@ export {
|
|
|
80828
80884
|
inlineChannelPlugin2 as inlineChannelPlugin
|
|
80829
80885
|
};
|
|
80830
80886
|
|
|
80831
|
-
//# debugId=
|
|
80887
|
+
//# debugId=D6C0042DF79E773F64756E2164756E21
|
|
80832
80888
|
//# sourceMappingURL=channel-plugin-api.js.map
|