omni-notify-mcp 1.3.482 → 1.3.487
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/agentGateway.js +2 -2
- package/dist/daemon.js +3 -3
- package/dist/gateway/conversationOwner.js +0 -2
- package/dist/gateway/tunnel.js +4 -4
- package/dist/messaging/messenger.js +1 -1
- package/dist/messaging/slackSetup.js +2 -2
- package/dist/notify.js +15 -1
- package/dist/shared/agentSession.js +240 -350
- package/dist/shared/conversation/claudeProvider.js +108 -3
- package/dist/shared/conversation/cliSession.js +1 -1
- package/dist/shared/conversation/codexProvider.js +1 -1
- package/dist/shared/conversation/conversationOwner.js +0 -1
- package/dist/shared/conversation/conversations.js +24 -30
- package/dist/shared/conversation/nativeTerminal.js +1 -1
- package/dist/shared/conversation/provider.js +8 -11
- package/dist/shared/conversation/sessionDriver.js +15 -52
- package/dist/shared/conversation/toolLine.js +13 -0
- package/dist/shared/webhost/autoSwitch.cjs +59 -18
- package/package.json +1 -1
package/dist/agentGateway.js
CHANGED
|
@@ -184,9 +184,9 @@ export class AgentGateway {
|
|
|
184
184
|
void (c.forkOf === undefined ? answered : answered.finally(() => this.end(c.id))).catch((err) => appendEvent(c.id, { role: "system", kind: "status", text: `❌ The answer could not be sent to this ${c.platform} thread after the BN restart: ${err instanceof Error ? err.message : String(err)}` }));
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
/** No chat message waiting on its conversation's creation: the gateway can pass to another process without losing
|
|
187
|
+
/** No chat message waiting on its conversation's creation and no CLI running a background subagent or shell: the gateway can pass to another process without losing either. A turn under way never holds it — the next build takes a cut turn up again on its session and sends its answer to its chat (#2116, #4584); background work cannot be taken up again, so its CLI is kept until that work ends (#4814). */
|
|
188
188
|
quiet() {
|
|
189
|
-
return !creationsPending();
|
|
189
|
+
return !creationsPending() && this.driver.backgroundHolders().length === 0;
|
|
190
190
|
}
|
|
191
191
|
/** Gives the store back when this process hands the gateway over. */
|
|
192
192
|
async shutdown() {
|
package/dist/daemon.js
CHANGED
|
@@ -12,7 +12,7 @@ import { spawn } from "child_process";
|
|
|
12
12
|
import { existsSync, readFileSync, mkdirSync } from "fs";
|
|
13
13
|
import { join } from "path";
|
|
14
14
|
import { fileURLToPath } from "url";
|
|
15
|
-
import { DAEMON_BEAT_PATH, CONFIG_DIR, DAEMON_TAG, PACKAGE_VERSION, startNotifyServer, takePendingInbox, yieldGateway } from "./notify.js";
|
|
15
|
+
import { DAEMON_BEAT_PATH, CONFIG_DIR, DAEMON_TAG, PACKAGE_VERSION, handoverWait, startNotifyServer, takePendingInbox, yieldGateway } from "./notify.js";
|
|
16
16
|
import { startNotifyDoor } from "./gateway/notifyDoor.js";
|
|
17
17
|
import { writeRecordFile } from "./gateway/conversationOwner.js";
|
|
18
18
|
import { announceTakeover, inThisBoot } from "./shared/webhost/originHandover.js";
|
|
@@ -106,8 +106,8 @@ const tunnel = new TunnelRunner();
|
|
|
106
106
|
const daemonHost = {
|
|
107
107
|
clientId: DAEMON_TAG, tag: DAEMON_TAG,
|
|
108
108
|
onDoorOwned: (port) => {
|
|
109
|
-
tunnel.beat(port);
|
|
110
|
-
setInterval(() => tunnel.beat(port), HEARTBEAT_MS);
|
|
109
|
+
tunnel.beat(port, handoverWait());
|
|
110
|
+
setInterval(() => tunnel.beat(port, handoverWait()), HEARTBEAT_MS);
|
|
111
111
|
},
|
|
112
112
|
onSuperseded: () => (handedOver === undefined ? replaceWithInstalledBuild() : void handedOver.then(() => process.exit(0))),
|
|
113
113
|
};
|
|
@@ -6,7 +6,6 @@ void import("./passkeyDoor.js").then((door) => { personId = door.personId; });
|
|
|
6
6
|
import { createConversationOwner } from "../shared/conversation/conversationOwner.js";
|
|
7
7
|
import { GatewayError } from "../shared/conversation/conversations.js";
|
|
8
8
|
import { sameRoot } from "../shared/webhost/workspaceList.js";
|
|
9
|
-
import { FLEET_OWNER } from "../shared/providerOwnership.js";
|
|
10
9
|
function driverOptions() {
|
|
11
10
|
const bundledGuard = new URL("../scripts/shared/", import.meta.url);
|
|
12
11
|
const guardDir = fileURLToPath(existsSync(bundledGuard) ? bundledGuard : new URL("../../scripts/shared/", import.meta.url));
|
|
@@ -35,7 +34,6 @@ function driverOptions() {
|
|
|
35
34
|
}
|
|
36
35
|
export const conversationOwner = createConversationOwner({
|
|
37
36
|
get configDir() { return CONFIG_DIR; },
|
|
38
|
-
startOwner: FLEET_OWNER,
|
|
39
37
|
personId: () => personId(),
|
|
40
38
|
driver: driverOptions(),
|
|
41
39
|
});
|
package/dist/gateway/tunnel.js
CHANGED
|
@@ -71,7 +71,7 @@ export class TunnelRunner {
|
|
|
71
71
|
reading;
|
|
72
72
|
firstBeat = true;
|
|
73
73
|
/** One heartbeat of the door holder: follow the saved setup (start, restart on a new save, stop when removed) and publish the state. */
|
|
74
|
-
beat(port) {
|
|
74
|
+
beat(port, handover) {
|
|
75
75
|
if (this.firstBeat) {
|
|
76
76
|
this.firstBeat = false;
|
|
77
77
|
this.endLeftover();
|
|
@@ -102,7 +102,7 @@ export class TunnelRunner {
|
|
|
102
102
|
// NULL-OK: field setup is OPTIONAL and therefore it is ok to check for NULL
|
|
103
103
|
if (setup && !this.child && this.reading === undefined)
|
|
104
104
|
this.start(setup.token);
|
|
105
|
-
this.publish(port);
|
|
105
|
+
this.publish(port, handover);
|
|
106
106
|
}
|
|
107
107
|
stop() {
|
|
108
108
|
const child = this.child;
|
|
@@ -112,11 +112,11 @@ export class TunnelRunner {
|
|
|
112
112
|
this.child = undefined;
|
|
113
113
|
child.kill();
|
|
114
114
|
}
|
|
115
|
-
publish(port) {
|
|
115
|
+
publish(port, handover) {
|
|
116
116
|
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
117
117
|
const path = join(CONFIG_DIR, GATEWAY_STATE_FILE);
|
|
118
118
|
const staged = `${path}.${process.pid}.tmp`;
|
|
119
|
-
writeFileSync(staged, JSON.stringify({ pid: process.pid, at: Date.now(), port, tunnel: this.reading ?? null }));
|
|
119
|
+
writeFileSync(staged, JSON.stringify({ pid: process.pid, at: Date.now(), port, tunnel: this.reading ?? null, handover: handover ?? null }));
|
|
120
120
|
renameSync(staged, path);
|
|
121
121
|
}
|
|
122
122
|
/** A connector a hard-killed predecessor left running is ended once, and only when its executable is BN's own copy of cloudflared. */
|
|
@@ -382,7 +382,7 @@ const SLACK_HINTS = {
|
|
|
382
382
|
not_authed: "no bot token was sent — paste one in BN settings",
|
|
383
383
|
token_revoked: "the bot token was revoked — reinstall the BN Slack app and paste its new token",
|
|
384
384
|
account_inactive: "the bot's Slack account is deactivated — reinstall the BN Slack app",
|
|
385
|
-
missing_scope: "the BN Slack app lacks a permission this needs (im:history,
|
|
385
|
+
missing_scope: "the BN Slack app lacks a permission this needs (im:history, chat:write, users:read) — add it and reinstall the app",
|
|
386
386
|
token_expired: "the configuration token expired — paste a new configuration token and its refresh token into BN settings, Slack",
|
|
387
387
|
invalid_refresh_token: "Slack refused the configuration refresh token — paste a new configuration token and its refresh token into BN settings, Slack",
|
|
388
388
|
messages_tab_disabled: "the app's App Home Messages tab does not let people message it — BN setup turns it on once it holds a configuration token",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SlackRefused, SlackUnreachable, SlackUnknown, slackCall } from "./messenger.js";
|
|
2
|
-
/** Every bot scope BN's Slack side uses: the DM chat (im
|
|
3
|
-
export const SLACK_BOT_SCOPES = ["chat:write", "channels:history", "channels:read", "channels:join", "groups:history", "groups:read", "im:history", "im:read", "
|
|
2
|
+
/** Every bot scope BN's Slack side uses: the DM chat (im:history, im:read, chat:write), the bus channel (channels:*, groups:*) and finding Meni (users:read). */
|
|
3
|
+
export const SLACK_BOT_SCOPES = ["chat:write", "channels:history", "channels:read", "channels:join", "groups:history", "groups:read", "im:history", "im:read", "users:read"];
|
|
4
4
|
/** The events BN's live link takes (#4585): his direct messages to the bot, and each opening of the App Home tab. */
|
|
5
5
|
export const SLACK_BOT_EVENTS = ["message.im", "app_home_opened"];
|
|
6
6
|
/** The app BN needs, as Slack's manifest states it: a bot user people can message from the App Home Messages tab, with every scope above, and (#4585) a Home tab, Socket Mode, interactivity for its buttons and the events its live link takes. */
|
package/dist/notify.js
CHANGED
|
@@ -3834,11 +3834,25 @@ function tryOwnGateway(polling, host) {
|
|
|
3834
3834
|
lastBindRefusal = cause;
|
|
3835
3835
|
}).finally(() => { ownershipAttempting = false; });
|
|
3836
3836
|
}
|
|
3837
|
+
let stepAsideHeldBy;
|
|
3838
|
+
let stepAsideWaitSince;
|
|
3839
|
+
/** #4814 — the conversations whose background subagents keep this build from handing the gateway to the installed release, and since when; undefined while none does. */
|
|
3840
|
+
export function handoverWait() {
|
|
3841
|
+
return stepAsideWaitSince === undefined ? undefined : { build: PACKAGE_VERSION, conversations: stepAsideHeldBy, since: stepAsideWaitSince };
|
|
3842
|
+
}
|
|
3837
3843
|
/** Hands the gateway over, a turn under way or not: the pollers finish their reads, the driver gives the store back, then the port is let go for the installed build, which takes a cut turn up again on its session and sends its answer to the chat it came from (#2116). */
|
|
3838
3844
|
async function stepAside(polling, host) {
|
|
3839
3845
|
const gateway = AgentGateway.instance();
|
|
3840
|
-
if (polling && !gateway.quiet())
|
|
3846
|
+
if (polling && !gateway.quiet()) {
|
|
3847
|
+
const holders = gateway.driver.backgroundHolders().join(", ");
|
|
3848
|
+
if (holders !== stepAsideHeldBy)
|
|
3849
|
+
log("·", "listener", holders === "" ? "the hand-over waits for a chat message mid-creation" : `the hand-over waits for the background subagents of conversation ${holders}; this build keeps their CLI until they end`);
|
|
3850
|
+
stepAsideHeldBy = holders;
|
|
3851
|
+
stepAsideWaitSince = holders === "" ? undefined : stepAsideWaitSince ?? Date.now();
|
|
3841
3852
|
return;
|
|
3853
|
+
}
|
|
3854
|
+
stepAsideHeldBy = undefined;
|
|
3855
|
+
stepAsideWaitSince = undefined;
|
|
3842
3856
|
ownershipAttempting = true;
|
|
3843
3857
|
try {
|
|
3844
3858
|
if (polling) {
|