@osovv/vv-opencode 2.2.1 → 2.3.0-rc.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/CHANGELOG.md +16 -0
- package/README.md +46 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/plugin-toggle-config.d.ts +1 -1
- package/dist/lib/plugin-toggle-config.js +3 -1
- package/dist/lib/plugin-toggle-config.js.map +1 -1
- package/dist/lib/vvoc-config.d.ts +89 -0
- package/dist/lib/vvoc-config.js +121 -1
- package/dist/lib/vvoc-config.js.map +1 -1
- package/dist/plugins/telegram/bot-api.d.ts +162 -0
- package/dist/plugins/telegram/bot-api.js +273 -0
- package/dist/plugins/telegram/bot-api.js.map +1 -0
- package/dist/plugins/telegram/commands.d.ts +167 -0
- package/dist/plugins/telegram/commands.js +709 -0
- package/dist/plugins/telegram/commands.js.map +1 -0
- package/dist/plugins/telegram/config.d.ts +38 -0
- package/dist/plugins/telegram/config.js +86 -0
- package/dist/plugins/telegram/config.js.map +1 -0
- package/dist/plugins/telegram/delivery.d.ts +121 -0
- package/dist/plugins/telegram/delivery.js +395 -0
- package/dist/plugins/telegram/delivery.js.map +1 -0
- package/dist/plugins/telegram/gateway.d.ts +61 -0
- package/dist/plugins/telegram/gateway.js +230 -0
- package/dist/plugins/telegram/gateway.js.map +1 -0
- package/dist/plugins/telegram/index.d.ts +110 -0
- package/dist/plugins/telegram/index.js +454 -0
- package/dist/plugins/telegram/index.js.map +1 -0
- package/dist/plugins/telegram/sessions.d.ts +147 -0
- package/dist/plugins/telegram/sessions.js +322 -0
- package/dist/plugins/telegram/sessions.js.map +1 -0
- package/dist/plugins/telegram/topology.d.ts +116 -0
- package/dist/plugins/telegram/topology.js +339 -0
- package/dist/plugins/telegram/topology.js.map +1 -0
- package/dist/plugins/web-tools/schemas.d.ts +19 -19
- package/dist/plugins/workflow/results.d.ts +39 -39
- package/package.json +6 -1
- package/schemas/vvoc/v3.json +89 -9
- package/templates/skills/vv-execute/references/tool-contracts.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 2.3.0-rc.1 (2026-10-04)
|
|
2
|
+
|
|
3
|
+
### Summary
|
|
4
|
+
|
|
5
|
+
This release fixes a Telegram gateway startup problem where awaiting the native client during plugin setup could stall server boot for an extended period until it was interrupted. The gateway bootstrap—including native client acquisition, session resync, General topic creation, pending-permission resurfacing, command registration, and polling—now runs as a supervised background task with bounded backoff retries after setup returns, so the plugin loads promptly instead of blocking. Each bootstrap attempt is contained and retried on failure, and every wait is abortable so cleanup still resolves even if the client never becomes ready, making Telegram integration startup more reliable and preventing the host from hanging on launch.
|
|
6
|
+
|
|
7
|
+
* fix(telegram): bootstrap the gateway in a supervised background task ([c8a0e82](https://github.com/osovv/vv-opencode/commit/c8a0e82))
|
|
8
|
+
|
|
9
|
+
## 2.3.0-rc.0 (2026-10-04)
|
|
10
|
+
|
|
11
|
+
### Summary
|
|
12
|
+
|
|
13
|
+
This release candidate introduces the TelegramBridgePlugin, a native server plugin that bridges OpenCode sessions to Telegram, letting users drive and monitor multiple parallel sessions directly from a phone. Each active session gets its own private-chat forum topic, with live status shown as an emoji in the topic title, so several sessions can run side by side without opening each conversation. Users can create and sync sessions, switch models through an inline picker, answer agent questions and permission requests with inline actions, view subagent activity, fork or revert messages, and send file attachments, while assistant output streams through durable, throttled delivery that survives server restarts without duplicating messages or topics. The plugin is configured through a new optional top-level telegram section in strict schema v3, including bot token with environment-placeholder substitution, an allowed-user list, an activity window defaulting to 240 minutes, and mutually exclusive custom API root or outbound proxy options for corporate networks, with the plugin toggling itself off via a value-free diagnostic when the token is missing. This matters because it turns OpenCode into a remotely controllable, multi-session workflow available from a chat client, while keeping bot credentials out of logs and stored state and preserving exactly-once delivery.
|
|
14
|
+
|
|
15
|
+
* feat(telegram): add TelegramBridgePlugin for parallel Telegram session control ([1e01e54](https://github.com/osovv/vv-opencode/commit/1e01e54))
|
|
16
|
+
|
|
1
17
|
## <small>2.2.1 (2026-10-04)</small>
|
|
2
18
|
|
|
3
19
|
### Summary
|
package/README.md
CHANGED
|
@@ -165,9 +165,9 @@ grep '<COMPONENT-' .vvoc/specs/*/*.xml # component map across spec and plan
|
|
|
165
165
|
|
|
166
166
|
## What's inside
|
|
167
167
|
|
|
168
|
-
### The
|
|
168
|
+
### The server plugins and the native TUI
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
The server plugins run inside the OpenCode server process; **ContextTuiPlugin** runs in the terminal UI through the same pinned package's `./tui` export.
|
|
171
171
|
|
|
172
172
|
| Plugin | What it does |
|
|
173
173
|
|---|---|
|
|
@@ -182,6 +182,7 @@ Eleven server plugins run inside the OpenCode server process; the twelfth entry,
|
|
|
182
182
|
| **AnalyticsPlugin** | Local-only token and cache telemetry per model step, a live `cache NN%` indicator in the TUI, and `vvoc analytics cache-hit-rate` for retrospective comparison. |
|
|
183
183
|
| **PeakHoursPlugin** | Warns or blocks models whose provider is in peak-priced hours right now, suggests connected off-peak providers, and shows a persistent orange banner in the TUI. |
|
|
184
184
|
| **SpecGuardPlugin** | Deterministic host-side verification of spec-package artifacts: annotates reads with lint verdicts and validates writes; in enforce mode refuses writes that would break the format. |
|
|
185
|
+
| **TelegramBridgePlugin** | Runs a single-owner Telegram bot inside the OpenCode server process: one private-chat DM topic per active session with a live status emoji in the topic title, a General control topic, manual permission and question buttons, and durable state that survives `opencode service restart`. |
|
|
185
186
|
| **ContextTuiPlugin** | The `/context` inspector: an honest, scrollable TUI dialog showing context-window usage by category, tool, and MCP server. |
|
|
186
187
|
|
|
187
188
|
### Managed agents
|
|
@@ -690,6 +691,49 @@ The engine checks well-formedness, the attribute ban, the template contract per
|
|
|
690
691
|
|
|
691
692
|
Conservatively materialized by `vvoc sync`/`init`; `enforce` blocks only ERROR states; internal failures degrade to a warning log and never break a tool call. Changes require an OpenCode restart, like other runtime plugin settings.
|
|
692
693
|
|
|
694
|
+
### Telegram bridge
|
|
695
|
+
|
|
696
|
+
`TelegramBridgePlugin` runs a single-owner Telegram bot inside the OpenCode server process — no second process, no exposed ports. Enable forum topics for the bot in @BotFather first; the bridge uses the private chat between you and the bot only.
|
|
697
|
+
|
|
698
|
+
The layout is one Telegram DM topic per active session, with a fixed **General** topic as the control lane. Topic titles carry a live status emoji (⚙️ running, 💤 idle, ❓ question, 🔐 permission, ‼️ error, ⏹ aborted) ahead of the session title. A session stays active while it is running or was updated within the activity window (default 240 minutes, or used through the bot); when it goes inactive its topic is closed — never deleted, history stays readable — and `/sync` reconciles topics to the actual active session set.
|
|
699
|
+
|
|
700
|
+
Commands:
|
|
701
|
+
|
|
702
|
+
| Command | Where | What it does |
|
|
703
|
+
|---|---|---|
|
|
704
|
+
| `/new` | General | Pick a project from an inline list; the session is created with that project's default agent and gets its own topic |
|
|
705
|
+
| `/sync` | General | Idempotent reconciliation: create topics for active sessions missing one, close stale ones, report counts |
|
|
706
|
+
| `/status` | General or session topic | Active sessions with context usage, or the current session's state |
|
|
707
|
+
| `/help` | anywhere | Command list |
|
|
708
|
+
| plain text | session topic | Prompt for that session; consecutive texts inside the merge window join into one prompt |
|
|
709
|
+
| `/model` | session topic | Inline provider and model picker; the current model is applied through the session model switch |
|
|
710
|
+
| `/rename <title>` | session topic | Rename the session and its topic |
|
|
711
|
+
| `/messages` | session topic | Browse user messages; Revert rolls the session back, Fork branches a new session that gets its own topic |
|
|
712
|
+
| `/abort` | session topic | Interrupt the session |
|
|
713
|
+
| `/settings` | anywhere | Toggle reasoning visibility, tool-call detail, and markdown/raw reply format |
|
|
714
|
+
|
|
715
|
+
Permissions and agent questions arrive as inline-button prompts in the owning session topic — `✅ Once / ♾ Always / ❌ Reject` for permissions, the offered options plus `✍️ Custom` for questions. Choosing Custom holds the topic's input gate so your next plain message becomes the answer (`/cancel` aborts); nothing is ever auto-approved and no decision is fabricated when a prompt is resolved outside Telegram. Subagent activity renders as bounded cards in the parent topic. Images, PDFs, and text files (bounded, albums included) can be attached to prompts; oversized files are rejected with an explicit notice.
|
|
716
|
+
|
|
717
|
+
Configuration is an optional top-level section of `vvoc.json` (schema v3). The bot never starts without it:
|
|
718
|
+
|
|
719
|
+
```json
|
|
720
|
+
"telegram": {
|
|
721
|
+
"enabled": true,
|
|
722
|
+
"botToken": "${TELEGRAM_BOT_TOKEN}",
|
|
723
|
+
"allowedUserIds": [123456789],
|
|
724
|
+
"activityWindowMinutes": 240,
|
|
725
|
+
"apiRoot": "https://tg.example.com"
|
|
726
|
+
}
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
- `botToken` — a literal or `${VAR}` placeholder resolved from the OpenCode process environment at startup; an unset variable disables the gateway with a value-free diagnostic naming the variable. Prefer the environment or the global vvoc layer; never commit a token.
|
|
730
|
+
- `allowedUserIds` — the numeric Telegram user ids allowed to talk to the bot (get yours from @userinfobot). This is the entire access boundary: single owner, private chat, non-owner messages are ignored.
|
|
731
|
+
- `activityWindowMinutes` — how long a session stays active after its last update (default 240).
|
|
732
|
+
- `apiRoot` or `proxyUrl` — mutually exclusive connectivity modes for restricted corporate networks: a custom Bot API root behind your own reverse proxy, or an outbound proxy URL for `api.telegram.org`.
|
|
733
|
+
- `settings` — delivery defaults: `showReasoning` (default false), `showToolCalls` (default false), `formatMode` (`markdown` default or `raw`), `codeFileMaxKb` (default 100; larger code blocks arrive as file documents), `mergeWindowMs` (default 1500).
|
|
734
|
+
|
|
735
|
+
Durable state (update offset, topic and session map, message mirror, pending finals, settings) lives in the OpenCode plugin storage, scoped to the plugin, and survives `opencode service restart`; a changed bot token resets the stored maps instead of reusing stale bindings. Assistant output streams through draft previews with a throttled edit fallback, finals are delivered exactly once per message across restarts, and all topics share one chat rate budget, so streaming is throttled adaptively. Telegram configuration changes require an OpenCode restart, like other runtime plugins; the `telegram` plugin toggle (`plugins["telegram"]`) is a kill-switch that registers nothing.
|
|
736
|
+
|
|
693
737
|
### Web tools
|
|
694
738
|
|
|
695
739
|
`WebToolsPlugin` exposes exactly two canonical model-facing tools:
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { ToolHistoryCompactionPlugin } from "./plugins/tool-history-compaction/i
|
|
|
10
10
|
export { AnalyticsPlugin } from "./plugins/analytics/index.js";
|
|
11
11
|
export { PeakHoursPlugin } from "./plugins/peak-hours/index.js";
|
|
12
12
|
export { SpecGuardPlugin } from "./plugins/spec-guard/index.js";
|
|
13
|
+
export { TelegramBridgePlugin } from "./plugins/telegram/index.js";
|
|
13
14
|
/**
|
|
14
15
|
* The eleven native server plugins in deterministic setup order. Model roles is
|
|
15
16
|
* first so the shared snapshot runtime exists before every consumer acquires it;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// VERSION: 1.1.0
|
|
3
3
|
// START_MODULE_CONTRACT
|
|
4
4
|
// PURPOSE: Re-export the public vv-opencode plugin entrypoints from the package root and assemble them into one native aggregate server plugin.
|
|
5
|
-
// SCOPE: Package-root exports for GuardianPlugin, HashlineEditPlugin, ModelRolesPlugin, SystemContextInjectionPlugin, WorkflowPlugin, SecretsRedactionPlugin, WebToolsPlugin, ToolHistoryCompactionPlugin, AnalyticsPlugin, PeakHoursPlugin, and
|
|
5
|
+
// SCOPE: Package-root exports for GuardianPlugin, HashlineEditPlugin, ModelRolesPlugin, SystemContextInjectionPlugin, WorkflowPlugin, SecretsRedactionPlugin, WebToolsPlugin, ToolHistoryCompactionPlugin, AnalyticsPlugin, PeakHoursPlugin, SpecGuardPlugin, and TelegramBridgePlugin, plus the native default definition that sets all of them up against one shared Context with complete reverse-order teardown and partial-setup rollback.
|
|
6
6
|
// DEPENDS: [@opencode/plugin, src/plugins/guardian/index.ts, src/plugins/hashline-edit/index.ts, src/plugins/model-roles/index.ts, src/plugins/system-context-injection/index.ts, src/plugins/workflow/index.ts, src/plugins/secrets-redaction.ts, src/plugins/web-tools/index.ts, src/plugins/tool-history-compaction/index.ts, src/plugins/analytics/index.ts, src/plugins/peak-hours/index.ts, src/plugins/spec-guard/index.ts]
|
|
7
7
|
// LINKS: [M-PLUGIN-GUARDIAN, M-PLUGIN-HASHLINE-EDIT, M-PLUGIN-MODEL-ROLES, M-PLUGIN-SYSTEM-CONTEXT-INJECTION, M-PLUGIN-WORKFLOW, M-PLUGIN-SECRETS-REDACTION, M-PLUGIN-WEB-TOOLS, M-PLUGIN-TOOL-HISTORY-COMPACTION, M-PLUGIN-ANALYTICS, M-PLUGIN-PEAK-HOURS, M-PLUGIN-SPEC-GUARD]
|
|
8
8
|
// ROLE: BARREL
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
// END_MODULE_CONTRACT
|
|
11
11
|
//
|
|
12
12
|
// START_MODULE_MAP
|
|
13
|
-
// GuardianPlugin, HashlineEditPlugin, ModelRolesPlugin, SystemContextInjectionPlugin, WorkflowPlugin, SecretsRedactionPlugin, WebToolsPlugin, ToolHistoryCompactionPlugin, AnalyticsPlugin, PeakHoursPlugin, SpecGuardPlugin - Public plugin exports available from @osovv/vv-opencode.
|
|
14
|
-
// VVOC_SERVER_PLUGINS - The
|
|
13
|
+
// GuardianPlugin, HashlineEditPlugin, ModelRolesPlugin, SystemContextInjectionPlugin, WorkflowPlugin, SecretsRedactionPlugin, WebToolsPlugin, ToolHistoryCompactionPlugin, AnalyticsPlugin, PeakHoursPlugin, SpecGuardPlugin, TelegramBridgePlugin - Public plugin exports available from @osovv/vv-opencode.
|
|
14
|
+
// VVOC_SERVER_PLUGINS - The native server plugins in deterministic setup order (model roles first so the shared snapshot runtime exists before consumers; the telegram bridge last as a standalone gateway).
|
|
15
15
|
// VvocPlugin - Native aggregate server plugin that sets up all eleven plugins on one Context and tears them down in reverse order.
|
|
16
16
|
// default - Native default server plugin definition loaded by OpenCode from the package or a local directory.
|
|
17
17
|
// END_MODULE_MAP
|
|
@@ -28,6 +28,7 @@ import { ModelRolesPlugin } from "./plugins/model-roles/index.js";
|
|
|
28
28
|
import { PeakHoursPlugin } from "./plugins/peak-hours/index.js";
|
|
29
29
|
import { SecretsRedactionPlugin } from "./plugins/secrets-redaction.js";
|
|
30
30
|
import { SpecGuardPlugin } from "./plugins/spec-guard/index.js";
|
|
31
|
+
import { TelegramBridgePlugin } from "./plugins/telegram/index.js";
|
|
31
32
|
import { SystemContextInjectionPlugin } from "./plugins/system-context-injection/index.js";
|
|
32
33
|
import { ToolHistoryCompactionPlugin } from "./plugins/tool-history-compaction/index.js";
|
|
33
34
|
import { WebToolsPlugin } from "./plugins/web-tools/index.js";
|
|
@@ -43,6 +44,7 @@ export { ToolHistoryCompactionPlugin } from "./plugins/tool-history-compaction/i
|
|
|
43
44
|
export { AnalyticsPlugin } from "./plugins/analytics/index.js";
|
|
44
45
|
export { PeakHoursPlugin } from "./plugins/peak-hours/index.js";
|
|
45
46
|
export { SpecGuardPlugin } from "./plugins/spec-guard/index.js";
|
|
47
|
+
export { TelegramBridgePlugin } from "./plugins/telegram/index.js";
|
|
46
48
|
// START_BLOCK_AGGREGATE
|
|
47
49
|
/**
|
|
48
50
|
* The eleven native server plugins in deterministic setup order. Model roles is
|
|
@@ -61,6 +63,7 @@ export const VVOC_SERVER_PLUGINS = [
|
|
|
61
63
|
AnalyticsPlugin,
|
|
62
64
|
PeakHoursPlugin,
|
|
63
65
|
SpecGuardPlugin,
|
|
66
|
+
TelegramBridgePlugin,
|
|
64
67
|
];
|
|
65
68
|
/**
|
|
66
69
|
* Native aggregate server plugin. Every plugin is set up against the exact same
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,iBAAiB;AACjB,wBAAwB;AACxB,kJAAkJ;AAClJ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,iBAAiB;AACjB,wBAAwB;AACxB,kJAAkJ;AAClJ,kbAAkb;AAClb,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AI,EAAE;YAChB,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE;gBAAE,MAAM,OAAO,EAAE,CAAC;QAC5D,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,eAAe,UAAU,CAAC;AAC1B,sBAAsB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const PLUGIN_TOGGLE_NAMES: readonly ["guardian", "hashline-edit", "model-roles", "system-context-injection", "workflow", "secrets-redaction", "context", "web-tools", "tool-history-compaction", "analytics", "peak-hours", "spec-guard", "systemone"];
|
|
1
|
+
export declare const PLUGIN_TOGGLE_NAMES: readonly ["guardian", "hashline-edit", "model-roles", "system-context-injection", "workflow", "secrets-redaction", "context", "web-tools", "tool-history-compaction", "analytics", "peak-hours", "spec-guard", "systemone", "telegram"];
|
|
2
2
|
export type VvocPluginEntryConfig = {
|
|
3
3
|
enabled?: boolean;
|
|
4
4
|
routing?: Record<string, unknown>;
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
// END_MODULE_MAP
|
|
31
31
|
//
|
|
32
32
|
// START_CHANGE_SUMMARY
|
|
33
|
-
// LAST_CHANGE: [C-
|
|
33
|
+
// LAST_CHANGE: [C-TELEGRAM-BRIDGE-PLUGIN T-001 - Added the telegram toggle name with no default materialization entry; the optional telegram section gates actual gateway behavior.]
|
|
34
|
+
// PREVIOUS: [C-SYSTEMONE-DECISION-BACKEND T-003 - Added the systemone provider toggle name.]
|
|
34
35
|
// END_CHANGE_SUMMARY
|
|
35
36
|
// START_BLOCK_CONSTANTS
|
|
36
37
|
export const PLUGIN_TOGGLE_NAMES = [
|
|
@@ -47,6 +48,7 @@ export const PLUGIN_TOGGLE_NAMES = [
|
|
|
47
48
|
"peak-hours",
|
|
48
49
|
"spec-guard",
|
|
49
50
|
"systemone",
|
|
51
|
+
"telegram",
|
|
50
52
|
];
|
|
51
53
|
// Default edit-routing table for the hashline-edit plugin. Materialized into vvoc.json
|
|
52
54
|
// on sync/init so it is visible and editable; kept as a plain config-shape object
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-toggle-config.js","sourceRoot":"","sources":["../../src/lib/plugin-toggle-config.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,iBAAiB;AACjB,wBAAwB;AACxB,+IAA+I;AAC/I,kTAAkT;AAClT,oBAAoB;AACpB,+FAA+F;AAC/F,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,uEAAuE;AACvE,mGAAmG;AACnG,iHAAiH;AACjH,2FAA2F;AAC3F,yHAAyH;AACzH,4HAA4H;AAC5H,6GAA6G;AAC7G,oGAAoG;AACpG,4GAA4G;AAC5G,8FAA8F;AAC9F,8FAA8F;AAC9F,mIAAmI;AACnI,0JAA0J;AAC1J,qHAAqH;AACrH,4HAA4H;AAC5H,kGAAkG;AAClG,+EAA+E;AAC/E,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"plugin-toggle-config.js","sourceRoot":"","sources":["../../src/lib/plugin-toggle-config.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,iBAAiB;AACjB,wBAAwB;AACxB,+IAA+I;AAC/I,kTAAkT;AAClT,oBAAoB;AACpB,+FAA+F;AAC/F,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,uEAAuE;AACvE,mGAAmG;AACnG,iHAAiH;AACjH,2FAA2F;AAC3F,yHAAyH;AACzH,4HAA4H;AAC5H,6GAA6G;AAC7G,oGAAoG;AACpG,4GAA4G;AAC5G,8FAA8F;AAC9F,8FAA8F;AAC9F,mIAAmI;AACnI,0JAA0J;AAC1J,qHAAqH;AACrH,4HAA4H;AAC5H,kGAAkG;AAClG,+EAA+E;AAC/E,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,uLAAuL;AAC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AI;QAChC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,wBAAwB,CAAC,IAAI;KACpD,CAAC;AACJ,CAAC;AACD,mCAAmC;AAEnC,kCAAkC;AAClC,0FAA0F;AAC1F,sKAAsK;AACtK,wHAAwH;AACxH,uBAAuB;AACvB,0BAA0B;AAC1B,gCAAgC;AAChC,6BAA6B;AAC7B,MAAM,UAAU,eAAe,CAC7B,MAA4C,EAC5C,UAAkB;IAElB,2BAA2B;IAC3B,gCAAgC;IAEhC,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC;IACjD,2DAA2D;IAC3D,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,WAAW,KAAK,SAAS,EAAE,CAAC;QACrC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACxC,OAAO,CAAC,GAAG,CACT,sEAAsE;gBACpE,UAAU;gBACV,YAAY;gBACZ,WAAW,CACd,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,mFAAmF;IACnF,OAAO,WAAW,CAAC,OAAO,KAAK,KAAK,CAAC;AACvC,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;AACnD,8BAA8B"}
|
|
@@ -78,6 +78,24 @@ export type VvocWebConfig = {
|
|
|
78
78
|
search?: VvocWebSearchConfig;
|
|
79
79
|
fetch?: VvocWebFetchConfig;
|
|
80
80
|
};
|
|
81
|
+
/** Owner-tunable Telegram delivery defaults; persisted runtime settings seed from these. */
|
|
82
|
+
export type VvocTelegramSettings = {
|
|
83
|
+
showReasoning?: boolean;
|
|
84
|
+
showToolCalls?: boolean;
|
|
85
|
+
formatMode?: "markdown" | "raw";
|
|
86
|
+
codeFileMaxKb?: number;
|
|
87
|
+
mergeWindowMs?: number;
|
|
88
|
+
};
|
|
89
|
+
/** Optional top-level telegram bridge section of canonical vvoc.json. */
|
|
90
|
+
export type VvocTelegramConfig = {
|
|
91
|
+
enabled?: boolean;
|
|
92
|
+
botToken: string;
|
|
93
|
+
allowedUserIds: number[];
|
|
94
|
+
activityWindowMinutes?: number;
|
|
95
|
+
apiRoot?: string;
|
|
96
|
+
proxyUrl?: string;
|
|
97
|
+
settings?: VvocTelegramSettings;
|
|
98
|
+
};
|
|
81
99
|
export type VvocConfig = {
|
|
82
100
|
$schema: string;
|
|
83
101
|
version: number;
|
|
@@ -89,6 +107,7 @@ export type VvocConfig = {
|
|
|
89
107
|
plugins: VvocPluginToggleConfig;
|
|
90
108
|
web?: VvocWebConfig;
|
|
91
109
|
systemone?: SystemOneConfig;
|
|
110
|
+
telegram?: VvocTelegramConfig;
|
|
92
111
|
};
|
|
93
112
|
export type ParsedVvocConfig = {
|
|
94
113
|
sourceSchema: string;
|
|
@@ -603,6 +622,75 @@ export declare const VVOC_CONFIG_SCHEMA: {
|
|
|
603
622
|
};
|
|
604
623
|
};
|
|
605
624
|
};
|
|
625
|
+
telegram: {
|
|
626
|
+
type: string;
|
|
627
|
+
description: string;
|
|
628
|
+
additionalProperties: boolean;
|
|
629
|
+
required: string[];
|
|
630
|
+
properties: {
|
|
631
|
+
enabled: {
|
|
632
|
+
type: string;
|
|
633
|
+
};
|
|
634
|
+
botToken: {
|
|
635
|
+
type: string;
|
|
636
|
+
minLength: number;
|
|
637
|
+
description: string;
|
|
638
|
+
};
|
|
639
|
+
allowedUserIds: {
|
|
640
|
+
type: string;
|
|
641
|
+
minItems: number;
|
|
642
|
+
items: {
|
|
643
|
+
type: string;
|
|
644
|
+
};
|
|
645
|
+
description: string;
|
|
646
|
+
};
|
|
647
|
+
activityWindowMinutes: {
|
|
648
|
+
type: string;
|
|
649
|
+
minimum: number;
|
|
650
|
+
description: string;
|
|
651
|
+
};
|
|
652
|
+
apiRoot: {
|
|
653
|
+
type: string;
|
|
654
|
+
minLength: number;
|
|
655
|
+
description: string;
|
|
656
|
+
};
|
|
657
|
+
proxyUrl: {
|
|
658
|
+
type: string;
|
|
659
|
+
minLength: number;
|
|
660
|
+
description: string;
|
|
661
|
+
};
|
|
662
|
+
settings: {
|
|
663
|
+
type: string;
|
|
664
|
+
additionalProperties: boolean;
|
|
665
|
+
properties: {
|
|
666
|
+
showReasoning: {
|
|
667
|
+
type: string;
|
|
668
|
+
};
|
|
669
|
+
showToolCalls: {
|
|
670
|
+
type: string;
|
|
671
|
+
};
|
|
672
|
+
formatMode: {
|
|
673
|
+
type: string;
|
|
674
|
+
enum: string[];
|
|
675
|
+
};
|
|
676
|
+
codeFileMaxKb: {
|
|
677
|
+
type: string;
|
|
678
|
+
minimum: number;
|
|
679
|
+
};
|
|
680
|
+
mergeWindowMs: {
|
|
681
|
+
type: string;
|
|
682
|
+
minimum: number;
|
|
683
|
+
};
|
|
684
|
+
};
|
|
685
|
+
};
|
|
686
|
+
};
|
|
687
|
+
allOf: {
|
|
688
|
+
if: {
|
|
689
|
+
required: string[];
|
|
690
|
+
};
|
|
691
|
+
then: boolean;
|
|
692
|
+
}[];
|
|
693
|
+
};
|
|
606
694
|
};
|
|
607
695
|
};
|
|
608
696
|
export declare function createGuardianConfig(overrides?: GuardianConfigOverrides): GuardianConfig;
|
|
@@ -618,6 +706,7 @@ export declare function renderSystemOneConfig(overrides?: Partial<SystemOneConfi
|
|
|
618
706
|
export declare function renderGuardianConfig(overrides?: GuardianConfigOverrides): string;
|
|
619
707
|
export declare function parseVersionedVvocConfigText(text: string, label: string): ParsedVvocConfig;
|
|
620
708
|
export declare function parseVvocConfigText(text: string, label: string): VvocConfig;
|
|
709
|
+
export declare function createTelegramConfig(value: unknown): VvocTelegramConfig | undefined;
|
|
621
710
|
export declare function renderVvocConfig(config?: VvocConfig): string;
|
|
622
711
|
export declare function validateVvocConfigDocument(document: unknown): string[];
|
|
623
712
|
export declare function createWebConfig(value: unknown): VvocWebConfig | undefined;
|
package/dist/lib/vvoc-config.js
CHANGED
|
@@ -46,10 +46,14 @@
|
|
|
46
46
|
// VvocWebFetchConfig - Optional web fetch provider section type.
|
|
47
47
|
// VvocWebConfig - Optional canonical web tools section type.
|
|
48
48
|
// createWebConfig - Normalizes an optional web section, returning undefined when empty.
|
|
49
|
+
// VvocTelegramSettings - Owner-tunable Telegram delivery defaults type.
|
|
50
|
+
// VvocTelegramConfig - Optional top-level telegram bridge section type.
|
|
51
|
+
// createTelegramConfig - Normalizes an optional telegram section, returning undefined when absent.
|
|
49
52
|
// END_MODULE_MAP
|
|
50
53
|
//
|
|
51
54
|
// START_CHANGE_SUMMARY
|
|
52
|
-
// LAST_CHANGE: [C-
|
|
55
|
+
// LAST_CHANGE: [C-TELEGRAM-BRIDGE-PLUGIN T-001 - Added the optional strict top-level telegram section with ${VAR} token convention, single-owner allowlist, activity window, mutually exclusive connectivity modes, and delivery settings defaults.]
|
|
56
|
+
// PREVIOUS: [C-SYSTEMONE-DECISION-BACKEND T-002 - Added the optional strict systemone connection section and the guardian decisionBackend and systemone policy fields.]
|
|
53
57
|
// END_CHANGE_SUMMARY
|
|
54
58
|
import { Ajv2020 } from "ajv/dist/2020.js";
|
|
55
59
|
import { BUILTIN_ROLE_NAMES, parseModelSelection } from "./model-roles.js";
|
|
@@ -121,6 +125,68 @@ const SYSTEMONE_CONFIG_SCHEMA = {
|
|
|
121
125
|
maxRetries: { type: "integer", minimum: 0, maximum: 5 },
|
|
122
126
|
},
|
|
123
127
|
};
|
|
128
|
+
const TELEGRAM_SETTINGS_SCHEMA = {
|
|
129
|
+
type: "object",
|
|
130
|
+
additionalProperties: false,
|
|
131
|
+
properties: {
|
|
132
|
+
showReasoning: { type: "boolean" },
|
|
133
|
+
showToolCalls: { type: "boolean" },
|
|
134
|
+
formatMode: { type: "string", enum: ["markdown", "raw"] },
|
|
135
|
+
codeFileMaxKb: { type: "integer", minimum: 1 },
|
|
136
|
+
mergeWindowMs: { type: "integer", minimum: 0 },
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
// START_BLOCK_TELEGRAM_SCHEMA
|
|
140
|
+
/**
|
|
141
|
+
* Optional top-level telegram bridge section. Present means configured: botToken
|
|
142
|
+
* and the single-owner allowlist are required, the activity window defaults are
|
|
143
|
+
* applied at resolution time, and apiRoot plus proxyUrl are mutually exclusive
|
|
144
|
+
* connectivity modes (configuring both is a validation error).
|
|
145
|
+
*/
|
|
146
|
+
const TELEGRAM_CONFIG_SCHEMA = {
|
|
147
|
+
type: "object",
|
|
148
|
+
description: "Optional Telegram bridge section enabling the vvoc.telegram server plugin gateway.",
|
|
149
|
+
additionalProperties: false,
|
|
150
|
+
required: ["botToken", "allowedUserIds"],
|
|
151
|
+
properties: {
|
|
152
|
+
enabled: { type: "boolean" },
|
|
153
|
+
botToken: {
|
|
154
|
+
type: "string",
|
|
155
|
+
minLength: 1,
|
|
156
|
+
description: "Telegram bot token. Either a literal value or ${VAR} placeholders resolved from the OpenCode process environment at startup; never committed to project config.",
|
|
157
|
+
},
|
|
158
|
+
allowedUserIds: {
|
|
159
|
+
type: "array",
|
|
160
|
+
minItems: 1,
|
|
161
|
+
items: { type: "integer" },
|
|
162
|
+
description: "Numeric Telegram user ids allowed to interact with the bot.",
|
|
163
|
+
},
|
|
164
|
+
activityWindowMinutes: {
|
|
165
|
+
type: "integer",
|
|
166
|
+
minimum: 1,
|
|
167
|
+
description: "Minutes a session stays active after its last update. Default 240.",
|
|
168
|
+
},
|
|
169
|
+
apiRoot: {
|
|
170
|
+
type: "string",
|
|
171
|
+
minLength: 1,
|
|
172
|
+
description: "Custom Telegram Bot API root URL for restricted networks.",
|
|
173
|
+
},
|
|
174
|
+
proxyUrl: {
|
|
175
|
+
type: "string",
|
|
176
|
+
minLength: 1,
|
|
177
|
+
description: "Outbound proxy URL for Telegram Bot API traffic.",
|
|
178
|
+
},
|
|
179
|
+
settings: TELEGRAM_SETTINGS_SCHEMA,
|
|
180
|
+
},
|
|
181
|
+
allOf: [
|
|
182
|
+
{
|
|
183
|
+
if: { required: ["apiRoot", "proxyUrl"] },
|
|
184
|
+
// oxlint-disable-next-line unicorn/no-thenable -- JSON Schema conditional keyword.
|
|
185
|
+
then: false,
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
};
|
|
189
|
+
// END_BLOCK_TELEGRAM_SCHEMA
|
|
124
190
|
const SECRETS_REDACTION_CONFIG_SCHEMA = {
|
|
125
191
|
type: "object",
|
|
126
192
|
additionalProperties: false,
|
|
@@ -393,6 +459,7 @@ export const VVOC_CONFIG_SCHEMA = {
|
|
|
393
459
|
},
|
|
394
460
|
web: WEB_CONFIG_SCHEMA,
|
|
395
461
|
systemone: SYSTEMONE_CONFIG_SCHEMA,
|
|
462
|
+
telegram: TELEGRAM_CONFIG_SCHEMA,
|
|
396
463
|
},
|
|
397
464
|
};
|
|
398
465
|
const ajv = new Ajv2020({ allErrors: true, strict: false });
|
|
@@ -562,6 +629,13 @@ export function renderGuardianConfig(overrides = {}) {
|
|
|
562
629
|
return renderJson(createGuardianConfig(overrides));
|
|
563
630
|
}
|
|
564
631
|
// END_BLOCK_SECTION_PARSE_AND_RENDER
|
|
632
|
+
// START_CONTRACT: createTelegramConfig
|
|
633
|
+
// PURPOSE: Normalize an optional telegram section from a validated document or in-memory config.
|
|
634
|
+
// INPUTS: { value: unknown - candidate telegram section }
|
|
635
|
+
// OUTPUTS: { VvocTelegramConfig | undefined - normalized section, or undefined when absent }
|
|
636
|
+
// SIDE_EFFECTS: none; the botToken value is preserved exactly and never logged
|
|
637
|
+
// LINKS: M-TELEGRAM-CONFIG, M-ENV-SUBSTITUTION
|
|
638
|
+
// END_CONTRACT: createTelegramConfig
|
|
565
639
|
// START_BLOCK_CANONICAL_CONFIG_PARSE_RENDER
|
|
566
640
|
export function parseVersionedVvocConfigText(text, label) {
|
|
567
641
|
const value = parseStrictJson(text, label);
|
|
@@ -574,9 +648,53 @@ export function parseVersionedVvocConfigText(text, label) {
|
|
|
574
648
|
export function parseVvocConfigText(text, label) {
|
|
575
649
|
return parseVersionedVvocConfigText(text, label).config;
|
|
576
650
|
}
|
|
651
|
+
export function createTelegramConfig(value) {
|
|
652
|
+
if (!isPlainObject(value)) {
|
|
653
|
+
return undefined;
|
|
654
|
+
}
|
|
655
|
+
assertAllowedKeys(value, [
|
|
656
|
+
"enabled",
|
|
657
|
+
"botToken",
|
|
658
|
+
"allowedUserIds",
|
|
659
|
+
"activityWindowMinutes",
|
|
660
|
+
"apiRoot",
|
|
661
|
+
"proxyUrl",
|
|
662
|
+
"settings",
|
|
663
|
+
], "telegram");
|
|
664
|
+
const settings = isPlainObject(value.settings) ? value.settings : {};
|
|
665
|
+
const allowedUserIds = Array.isArray(value.allowedUserIds)
|
|
666
|
+
? value.allowedUserIds.filter((id) => typeof id === "number")
|
|
667
|
+
: [];
|
|
668
|
+
return compactObject({
|
|
669
|
+
enabled: typeof value.enabled === "boolean" ? value.enabled : undefined,
|
|
670
|
+
botToken: readNonEmptyString(value.botToken, "telegram: botToken"),
|
|
671
|
+
allowedUserIds,
|
|
672
|
+
activityWindowMinutes: typeof value.activityWindowMinutes === "number" && value.activityWindowMinutes > 0
|
|
673
|
+
? value.activityWindowMinutes
|
|
674
|
+
: undefined,
|
|
675
|
+
apiRoot: normalizeOptionalString(typeof value.apiRoot === "string" ? value.apiRoot : undefined),
|
|
676
|
+
proxyUrl: normalizeOptionalString(typeof value.proxyUrl === "string" ? value.proxyUrl : undefined),
|
|
677
|
+
settings: compactObject({
|
|
678
|
+
showReasoning: typeof settings.showReasoning === "boolean" ? settings.showReasoning : undefined,
|
|
679
|
+
showToolCalls: typeof settings.showToolCalls === "boolean" ? settings.showToolCalls : undefined,
|
|
680
|
+
formatMode: settings.formatMode === "raw"
|
|
681
|
+
? "raw"
|
|
682
|
+
: settings.formatMode === "markdown"
|
|
683
|
+
? "markdown"
|
|
684
|
+
: undefined,
|
|
685
|
+
codeFileMaxKb: typeof settings.codeFileMaxKb === "number" && settings.codeFileMaxKb > 0
|
|
686
|
+
? settings.codeFileMaxKb
|
|
687
|
+
: undefined,
|
|
688
|
+
mergeWindowMs: typeof settings.mergeWindowMs === "number" && settings.mergeWindowMs >= 0
|
|
689
|
+
? settings.mergeWindowMs
|
|
690
|
+
: undefined,
|
|
691
|
+
}),
|
|
692
|
+
});
|
|
693
|
+
}
|
|
577
694
|
export function renderVvocConfig(config = createDefaultVvocConfig()) {
|
|
578
695
|
const web = createWebConfig(config.web);
|
|
579
696
|
const systemone = createSystemOneConfig(config.systemone);
|
|
697
|
+
const telegram = createTelegramConfig(config.telegram);
|
|
580
698
|
return renderJson({
|
|
581
699
|
$schema: VVOC_CONFIG_SCHEMA_URL,
|
|
582
700
|
version: VVOC_CONFIG_VERSION,
|
|
@@ -588,6 +706,7 @@ export function renderVvocConfig(config = createDefaultVvocConfig()) {
|
|
|
588
706
|
plugins: config.plugins,
|
|
589
707
|
...(web ? { web } : {}),
|
|
590
708
|
...(systemone ? { systemone } : {}),
|
|
709
|
+
...(telegram ? { telegram } : {}),
|
|
591
710
|
});
|
|
592
711
|
}
|
|
593
712
|
// END_BLOCK_CANONICAL_CONFIG_PARSE_RENDER
|
|
@@ -618,6 +737,7 @@ function normalizeStrictVvocConfig(value) {
|
|
|
618
737
|
plugins: createPluginToggleConfig(value.plugins),
|
|
619
738
|
web: createWebConfig(value.web),
|
|
620
739
|
systemone: createSystemOneConfig(value.systemone),
|
|
740
|
+
telegram: createTelegramConfig(value.telegram),
|
|
621
741
|
},
|
|
622
742
|
};
|
|
623
743
|
}
|