switchroom 0.13.55 → 0.13.57
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/agent-scheduler/index.js +80 -80
- package/dist/auth-broker/index.js +80 -80
- package/dist/cli/ack-first-pretool.mjs +75 -0
- package/dist/cli/drive-write-pretool.mjs +10 -10
- package/dist/cli/notion-write-pretool.mjs +90 -84
- package/dist/cli/skill-validate-pretool.mjs +72 -72
- package/dist/cli/switchroom.js +367 -358
- package/dist/host-control/main.js +148 -148
- package/dist/vault/approvals/kernel-server.js +82 -82
- package/dist/vault/broker/server.js +83 -83
- package/package.json +1 -1
- package/skills/notion/SKILL.md +13 -9
- package/telegram-plugin/ack-flag.ts +66 -0
- package/telegram-plugin/dist/bridge/bridge.js +112 -112
- package/telegram-plugin/dist/gateway/gateway.js +991 -601
- package/telegram-plugin/dist/server.js +160 -160
- package/telegram-plugin/gateway/gateway.ts +151 -1
- package/telegram-plugin/runtime-metrics.ts +17 -0
- package/telegram-plugin/silence-poke.ts +82 -0
- package/telegram-plugin/tests/ack-flag.test.ts +65 -0
- package/telegram-plugin/tests/post-fallback-outbound-count.test.ts +78 -0
- package/telegram-plugin/tests/silence-poke.test.ts +117 -7
- package/telegram-plugin/tests/tool-intent-surface.test.ts +128 -0
- package/telegram-plugin/tool-intent-surface.ts +155 -0
package/package.json
CHANGED
package/skills/notion/SKILL.md
CHANGED
|
@@ -47,10 +47,12 @@ disallowed database, you'll get a clean block reason naming the DB.
|
|
|
47
47
|
The Notion MCP exposes the standard set:
|
|
48
48
|
|
|
49
49
|
- **Search.** `search` finds pages or databases by title/content
|
|
50
|
-
across what the integration can see. switchroom
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
across what the integration can see. **In switchroom v1, `search`
|
|
51
|
+
is BLOCKED for any agent with a non-empty
|
|
52
|
+
`notion_workspace.databases:` allowlist** — the post-filter that
|
|
53
|
+
would strip out-of-allowlist results isn't wired yet. Use
|
|
54
|
+
`query_database` against your allowed DBs instead. Admin-shaped
|
|
55
|
+
agents (no per-DB filter) can search normally.
|
|
54
56
|
- **Database queries.** `query_database` runs a filter+sort against
|
|
55
57
|
a database. You need the database's UUID (operator gives these
|
|
56
58
|
via friendly names in `notion_workspace.databases` — ask the
|
|
@@ -98,11 +100,13 @@ The Notion MCP exposes the standard set:
|
|
|
98
100
|
|
|
99
101
|
### "Find that thing about X"
|
|
100
102
|
|
|
101
|
-
1.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
1. If you have full search access (no `databases:` filter): `search`
|
|
104
|
+
with the query, take the top result unless ambiguous.
|
|
105
|
+
2. If `search` is blocked for you (the hook will return a clear
|
|
106
|
+
message naming the v1 limitation): `query_database` against
|
|
107
|
+
each of your allowed DBs in turn, with a title-contains or
|
|
108
|
+
property filter. List your allowed DBs by checking
|
|
109
|
+
`notion_workspace.databases:` in your config via `config_get`.
|
|
106
110
|
|
|
107
111
|
### "Update the page about X"
|
|
108
112
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ack-first state flag — load-bearing for the ack-first-pretool hook
|
|
3
|
+
* (see `src/cli/ack-first-pretool.ts` and
|
|
4
|
+
* `reference/conversational-pacing.md` beat 1).
|
|
5
|
+
*
|
|
6
|
+
* The gateway is the source of truth for "has the model called reply
|
|
7
|
+
* yet this turn?". The PreToolUse hook runs as a short-lived child
|
|
8
|
+
* process so it can't read gateway in-memory state; the hand-off is
|
|
9
|
+
* a single file inside `$TELEGRAM_STATE_DIR`:
|
|
10
|
+
*
|
|
11
|
+
* - `markAckSent()` touches the file on the first reply per turn.
|
|
12
|
+
* - `clearAckSent()` removes it at turn_started.
|
|
13
|
+
* - The hook checks `existsSync(path)` → allow / block.
|
|
14
|
+
*
|
|
15
|
+
* Per-agent isolation is built-in: `$TELEGRAM_STATE_DIR` is the
|
|
16
|
+
* agent's per-container state dir (~/.switchroom/agents/<name>/telegram,
|
|
17
|
+
* bind-mounted into /state/agent/home/.switchroom/agents/<name>/telegram
|
|
18
|
+
* inside the container).
|
|
19
|
+
*
|
|
20
|
+
* All operations are best-effort: a write or unlink failure logs to
|
|
21
|
+
* stderr and returns; the gate is informational UX, not a safety
|
|
22
|
+
* primitive, so a broken state-dir must never wedge reply itself.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { closeSync, existsSync, openSync, unlinkSync } from "node:fs";
|
|
26
|
+
import { join } from "node:path";
|
|
27
|
+
|
|
28
|
+
export const ACK_SENT_MARKER = "ack-sent.flag";
|
|
29
|
+
|
|
30
|
+
function markerPath(): string | null {
|
|
31
|
+
const dir = process.env.TELEGRAM_STATE_DIR;
|
|
32
|
+
if (!dir) return null;
|
|
33
|
+
return join(dir, ACK_SENT_MARKER);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Create the ack-sent marker. Idempotent (no-op if it exists). */
|
|
37
|
+
export function markAckSent(): void {
|
|
38
|
+
const path = markerPath();
|
|
39
|
+
if (path == null) return;
|
|
40
|
+
if (existsSync(path)) return;
|
|
41
|
+
try {
|
|
42
|
+
const fd = openSync(path, "w");
|
|
43
|
+
closeSync(fd);
|
|
44
|
+
} catch (err) {
|
|
45
|
+
process.stderr.write(
|
|
46
|
+
`ack-flag: markAckSent failed path=${path}: ${err}\n`,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Remove the ack-sent marker. Idempotent. */
|
|
52
|
+
export function clearAckSent(): void {
|
|
53
|
+
const path = markerPath();
|
|
54
|
+
if (path == null) return;
|
|
55
|
+
try {
|
|
56
|
+
unlinkSync(path);
|
|
57
|
+
} catch (err: unknown) {
|
|
58
|
+
// ENOENT is the common case (turn started before any prior turn
|
|
59
|
+
// ran a reply); silently swallow.
|
|
60
|
+
const code = (err as { code?: string } | undefined)?.code;
|
|
61
|
+
if (code === "ENOENT") return;
|
|
62
|
+
process.stderr.write(
|
|
63
|
+
`ack-flag: clearAckSent failed path=${path}: ${err}\n`,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|