@cuylabs/channel-slack 0.5.0 → 0.5.1
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/bolt.js
CHANGED
|
@@ -528,10 +528,11 @@ function createSlackSocketModeRuntime({
|
|
|
528
528
|
runtimePolicy = "single-instance",
|
|
529
529
|
serverPingTimeoutMs = DEFAULT_SERVER_PING_TIMEOUT_MS
|
|
530
530
|
}) {
|
|
531
|
+
const processLockConfigured = lockEnabled && runtimePolicy === "single-instance";
|
|
531
532
|
const lock = acquireSlackSocketModeProcessLock({
|
|
532
533
|
appSlug,
|
|
533
534
|
appToken,
|
|
534
|
-
enabled:
|
|
535
|
+
enabled: processLockConfigured,
|
|
535
536
|
...lockDir ? { lockDir } : {},
|
|
536
537
|
...logger ? { logger } : {}
|
|
537
538
|
});
|
|
@@ -545,8 +546,9 @@ function createSlackSocketModeRuntime({
|
|
|
545
546
|
logger?.info?.("Slack Socket Mode runtime guard configured", {
|
|
546
547
|
autoReconnectEnabled,
|
|
547
548
|
clientPingTimeoutMs,
|
|
548
|
-
lockEnabled: Boolean(lock),
|
|
549
549
|
pingPongLoggingEnabled,
|
|
550
|
+
processLockAcquired: Boolean(lock),
|
|
551
|
+
processLockConfigured,
|
|
550
552
|
restartGuardEnabled,
|
|
551
553
|
restartGuardMaxWarnings,
|
|
552
554
|
restartGuardWindowMs,
|
|
@@ -29,6 +29,11 @@ that can:
|
|
|
29
29
|
|
|
30
30
|
Use `runtime.close()` during shutdown so a process lock is released.
|
|
31
31
|
|
|
32
|
+
The runtime log reports the SDK-local process lock separately as
|
|
33
|
+
`processLockConfigured` and `processLockAcquired`. These fields describe only
|
|
34
|
+
the SDK file/process lock created by `createSlackSocketModeRuntime`; they do not
|
|
35
|
+
describe a distributed Postgres lock acquired separately.
|
|
36
|
+
|
|
32
37
|
For distributed deployments, `acquireSlackSocketModePostgresLock` can acquire a
|
|
33
38
|
Postgres advisory lock before starting the Socket Mode app:
|
|
34
39
|
|
|
@@ -16,6 +16,10 @@ const decision = policy.resolve(activity);
|
|
|
16
16
|
if (!decision.accepted) return;
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
`decision.reason` is intended for host-owned logs, metrics, and audit records.
|
|
20
|
+
For example, a host can distinguish `bot-mentioned` from
|
|
21
|
+
`mentioned-thread-reply` without the SDK choosing log levels or log shape.
|
|
22
|
+
|
|
19
23
|
## Channel Message Policy
|
|
20
24
|
|
|
21
25
|
`messagePolicy` controls passive channel messages:
|
|
@@ -27,6 +31,15 @@ if (!decision.accepted) return;
|
|
|
27
31
|
|
|
28
32
|
DMs and direct mentions are always accepted unless they are duplicates.
|
|
29
33
|
|
|
34
|
+
Accepted decisions include one of these reasons:
|
|
35
|
+
|
|
36
|
+
- `direct-message`: the message came from a DM.
|
|
37
|
+
- `bot-mentioned`: the bot was directly mentioned.
|
|
38
|
+
- `mentioned-thread-reply`: a non-mentioned reply continued a remembered
|
|
39
|
+
mentioned thread.
|
|
40
|
+
- `allowed-channel`: a passive message matched `allowed-channels`.
|
|
41
|
+
- `any-added-channel`: a passive message matched `any-added-channel`.
|
|
42
|
+
|
|
30
43
|
## Thread Reply Policy
|
|
31
44
|
|
|
32
45
|
`threadReplyPolicy` controls non-mentioned replies inside remembered mentioned
|
|
@@ -19,6 +19,11 @@ app.event("app_mention", async ({ event, client }) => {
|
|
|
19
19
|
const activity = parseSlackMentionActivity(event);
|
|
20
20
|
const decision = policy.resolve(activity);
|
|
21
21
|
if (!decision.accepted) return;
|
|
22
|
+
logger.info("Slack message accepted", {
|
|
23
|
+
channelId: activity.channelId,
|
|
24
|
+
reason: decision.reason,
|
|
25
|
+
threadTs: activity.threadTs,
|
|
26
|
+
});
|
|
22
27
|
|
|
23
28
|
const answer = await runAgent({
|
|
24
29
|
input: decision.text,
|