@wrongstack/telegram 1.0.4 → 1.0.6

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 CHANGED
@@ -799,7 +799,7 @@ function truncateForTelegram(text, maxLen = 4e3) {
799
799
  const effectiveMaxLen = Math.min(maxLen, MAX_TELEGRAM_MESSAGE_LENGTH);
800
800
  if (text.length <= effectiveMaxLen) return text;
801
801
  const cutoff = effectiveMaxLen - 30;
802
- if (cutoff <= 0) return `${text.slice(0, effectiveMaxLen - 1)}\u2026`;
802
+ if (cutoff <= 0) return `${text.slice(0, Math.max(0, effectiveMaxLen - 1))}\u2026`;
803
803
  const paraSearchEnd = effectiveMaxLen - 3;
804
804
  const paraIdx = text.lastIndexOf("\n\n", paraSearchEnd);
805
805
  if (paraIdx > cutoff) {
@@ -1628,7 +1628,7 @@ function makeTelegramApproveTool(opts) {
1628
1628
  },
1629
1629
  required: ["prompt"]
1630
1630
  },
1631
- permission: "auto",
1631
+ permission: "confirm",
1632
1632
  mutating: true,
1633
1633
  riskTier: "standard",
1634
1634
  capabilities: [TELEGRAM_APPROVAL_CAPABILITY],
@@ -27,15 +27,14 @@ interface TelegramApproveOutput {
27
27
  * auto-denies). Useful when the agent wants explicit approval before
28
28
  * continuing and the user is on their phone rather than the TUI.
29
29
  *
30
- * The agent calls this tool directly. It does not replace the host-level
31
- * `permission: 'confirm'` flow for that, see the future B4 work.
30
+ * The Telegram button is the remote authorization for the proposed action;
31
+ * it does not authorize sending the outbound approval request itself.
32
32
  *
33
- * Permission: `auto` (NOT `confirm`). This is intentional the tool's
34
- * purpose IS to obtain user approval; gating it behind another host-level
35
- * confirm dialog would be circular and would block the agent in
36
- * headless mode. The user-side approval (Telegram button press) is
37
- * the only confirm gate. The 600 s tool `timeoutMs` ceiling is the
38
- * safety net for the case where the user never responds.
33
+ * Permission: `confirm`. Sending a persistent approval request to a remote
34
+ * user is a high-impact external side effect, so the host must confirm it
35
+ * before dispatch. After that confirmation, the Telegram button remains the
36
+ * only remote authorization for the proposed action. The 600 s tool
37
+ * `timeoutMs` ceiling auto-denies when the user never responds.
39
38
  */
40
39
  export declare function makeTelegramApproveTool(opts: {
41
40
  bot: TelegramBot;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/telegram",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "license": "MIT",
5
5
  "description": "WrongStack plugin — Telegram bridge: send messages, receive prompts, get notified.",
6
6
  "repository": {
@@ -26,11 +26,11 @@
26
26
  "!dist/**/*.map"
27
27
  ],
28
28
  "peerDependencies": {
29
- "@wrongstack/core": "1.0.4"
29
+ "@wrongstack/core": "1.0.6"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^26.2.0",
33
- "@wrongstack/core": "1.0.4",
33
+ "@wrongstack/core": "1.0.6",
34
34
  "typescript": "^7.0.2"
35
35
  },
36
36
  "publishConfig": {