polygram 0.12.0-rc.16 → 0.12.0-rc.17

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.
@@ -1871,15 +1871,22 @@ class CliProcess extends Process {
1871
1871
  {
1872
1872
  const requestId = ev.toolUseId || `hook-notification-${Date.now()}`;
1873
1873
  const toolName = ev.toolName;
1874
- const toolInput = this._formatToolInputForApproval(
1875
- ev.prompt || null,
1876
- // Use the structured tool_input as the "preview" it's
1877
- // already structured by claude rather than truncated to
1878
- // 200 chars like the channels bridge perm_req does.
1879
- typeof ev.toolInput === 'string'
1880
- ? ev.toolInput
1881
- : JSON.stringify(ev.toolInput || {}),
1882
- );
1874
+ // Finding #11 fix: pass the STRUCTURED tool_input through. makeCanUseTool
1875
+ // matches gated patterns via matchesAnyPattern, which reads
1876
+ // input.command (Bash) / input.url (WebFetch) a formatted STRING
1877
+ // makes those undefined so a gated `Bash(rm *)` never matches and the
1878
+ // tool is allowed with NO approval card (silent gating bypass). The
1879
+ // hook Notification payload carries structured tool_input, so forward
1880
+ // it as-is; the approval card (approvalCardText) renders a structured
1881
+ // object fine — same shape the SDK canUseTool path already uses. Fall
1882
+ // back to the formatted-string preview only if claude sent no
1883
+ // structured tool_input (degenerate — tool needs perm but no input).
1884
+ const toolInput = (ev.toolInput && typeof ev.toolInput === 'object')
1885
+ ? ev.toolInput
1886
+ : this._formatToolInputForApproval(
1887
+ ev.prompt || null,
1888
+ typeof ev.toolInput === 'string' ? ev.toolInput : JSON.stringify(ev.toolInput || {}),
1889
+ );
1883
1890
  this.emit('approval-required', {
1884
1891
  id: requestId,
1885
1892
  toolName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polygram",
3
- "version": "0.12.0-rc.16",
3
+ "version": "0.12.0-rc.17",
4
4
  "description": "Telegram daemon for Claude Code that preserves the OpenClaw per-chat session model. Migration path for OpenClaw users moving to Claude Code.",
5
5
  "main": "lib/ipc/client.js",
6
6
  "bin": {