opencode-feishu-plugin 0.2.3 → 0.2.4
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 +43 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -147161,7 +147161,11 @@ async function touchLocationOverHttp(directory, deps) {
|
|
|
147161
147161
|
var WATCHDOG_SLOT = /* @__PURE__ */ Symbol.for("opencode-feishu-v2/gateway-watchdog");
|
|
147162
147162
|
function ensureGatewayWatchdog(input) {
|
|
147163
147163
|
const g = globalThis;
|
|
147164
|
-
|
|
147164
|
+
let existing = g[WATCHDOG_SLOT];
|
|
147165
|
+
if (existing && !existing.state) {
|
|
147166
|
+
clearWatchdogSlot(existing);
|
|
147167
|
+
existing = void 0;
|
|
147168
|
+
}
|
|
147165
147169
|
if (existing) {
|
|
147166
147170
|
if (input.authoritative && existing.target !== input.directory) {
|
|
147167
147171
|
existing.target = input.directory;
|
|
@@ -147201,6 +147205,13 @@ function ensureGatewayWatchdog(input) {
|
|
|
147201
147205
|
});
|
|
147202
147206
|
return true;
|
|
147203
147207
|
}
|
|
147208
|
+
function clearWatchdogSlot(slot) {
|
|
147209
|
+
const s = slot ?? {};
|
|
147210
|
+
if (s.timer) clearInterval(s.timer);
|
|
147211
|
+
if (s.initial) clearTimeout(s.initial);
|
|
147212
|
+
const g = globalThis;
|
|
147213
|
+
if (g[WATCHDOG_SLOT] === slot) delete g[WATCHDOG_SLOT];
|
|
147214
|
+
}
|
|
147204
147215
|
function startKeepalive(deps) {
|
|
147205
147216
|
const setIntervalImpl = deps.setIntervalImpl ?? setInterval;
|
|
147206
147217
|
const clearIntervalImpl = deps.clearIntervalImpl ?? clearInterval;
|
|
@@ -150973,23 +150984,31 @@ var index_default = plugin_exports.define({
|
|
|
150973
150984
|
if (config.keepalive) {
|
|
150974
150985
|
const watchdogTarget = config.gatewayLocation ?? here;
|
|
150975
150986
|
if (watchdogTarget) {
|
|
150976
|
-
|
|
150977
|
-
|
|
150978
|
-
|
|
150979
|
-
|
|
150980
|
-
|
|
150987
|
+
try {
|
|
150988
|
+
startedWatchdog = ensureGatewayWatchdog({
|
|
150989
|
+
log: log2,
|
|
150990
|
+
directory: watchdogTarget,
|
|
150991
|
+
intervalMs: config.keepaliveIntervalMs
|
|
150992
|
+
});
|
|
150993
|
+
} catch (err2) {
|
|
150994
|
+
log2.warn("\u7F51\u5173\u770B\u95E8\u72D7\u542F\u52A8\u5931\u8D25\uFF08\u5DF2\u5FFD\u7565\uFF09", { error: errorMessage(err2) });
|
|
150995
|
+
}
|
|
150981
150996
|
}
|
|
150982
150997
|
}
|
|
150983
150998
|
if (config.gatewayLocation) {
|
|
150984
150999
|
const matched = Boolean(here) && isUnder(here, config.gatewayLocation);
|
|
150985
151000
|
const keepSink = matched || startedWatchdog;
|
|
150986
|
-
|
|
150987
|
-
|
|
150988
|
-
|
|
150989
|
-
|
|
150990
|
-
|
|
150991
|
-
|
|
150992
|
-
|
|
151001
|
+
try {
|
|
151002
|
+
trackGatewayLocationSeen({
|
|
151003
|
+
here: here ?? "(unknown)",
|
|
151004
|
+
expected: config.gatewayLocation,
|
|
151005
|
+
matched,
|
|
151006
|
+
warn: (message) => log2.warn(message),
|
|
151007
|
+
...keepSink ? {} : { onSettled: () => logSink?.close() }
|
|
151008
|
+
});
|
|
151009
|
+
} catch (err2) {
|
|
151010
|
+
log2.warn("\u7F51\u5173\u4F4D\u7F6E\u8DDF\u8E2A\u5931\u8D25\uFF08\u5DF2\u5FFD\u7565\uFF09", { error: errorMessage(err2) });
|
|
151011
|
+
}
|
|
150993
151012
|
if (!matched) {
|
|
150994
151013
|
log2.debug("\u8DF3\u8FC7\u975E\u7F51\u5173 location", { here, expected: config.gatewayLocation });
|
|
150995
151014
|
if (!keepSink) logSink?.close();
|
|
@@ -151553,13 +151572,17 @@ async function start(ctx, config, log2, logSink) {
|
|
|
151553
151572
|
const here = ctx.location?.directory;
|
|
151554
151573
|
const keepaliveDirectory = here ?? config.gatewayLocation;
|
|
151555
151574
|
if (config.keepalive && keepaliveDirectory) {
|
|
151556
|
-
|
|
151557
|
-
|
|
151558
|
-
|
|
151559
|
-
|
|
151560
|
-
|
|
151561
|
-
|
|
151562
|
-
|
|
151575
|
+
try {
|
|
151576
|
+
ensureGatewayWatchdog({
|
|
151577
|
+
log: log2,
|
|
151578
|
+
directory: keepaliveDirectory,
|
|
151579
|
+
intervalMs: config.keepaliveIntervalMs,
|
|
151580
|
+
authoritative: true,
|
|
151581
|
+
immediateDelayMs: 0
|
|
151582
|
+
});
|
|
151583
|
+
} catch (err2) {
|
|
151584
|
+
log2.warn("\u7F51\u5173\u770B\u95E8\u72D7\u767B\u8BB0\u5931\u8D25\uFF08\u5DF2\u5FFD\u7565\uFF09", { error: errorMessage(err2) });
|
|
151585
|
+
}
|
|
151563
151586
|
}
|
|
151564
151587
|
const stopKeepalive = config.keepalive && keepaliveDirectory ? startKeepalive({
|
|
151565
151588
|
log: log2,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-feishu-plugin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Feishu/Lark plugin for OpenCode V2 — single-user topics as sessions, in-card permission approvals, streaming cards. Minimal permissions, no public endpoint.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|