fix: make apiProxy injection optional
Resolves the optional apiProxy injection, keeps HTML as the compatibility default, synchronizes generated entrypoints, and adds a regression test.
This commit is contained in:
+2
-1
@@ -61,7 +61,8 @@ export class TelegramBridge {
|
||||
});
|
||||
this.sleep = options.sleep ?? defaultSleep;
|
||||
this.maxMessageLength = options.maxMessageLength ?? 4096;
|
||||
this.renderingMode = options.rendering === 'html' ? 'html' : 'rich';
|
||||
// HTML is the compatibility default; opt into Rich Messages explicitly.
|
||||
this.renderingMode = options.rendering === 'rich' ? 'rich' : 'html';
|
||||
}
|
||||
start() {
|
||||
this.disposeSessionListener?.();
|
||||
|
||||
Vendored
+2
-1
@@ -1,7 +1,8 @@
|
||||
import type { Context } from '@deepseek-ai/cordis';
|
||||
import Schema from '@deepseek-ai/schemastery';
|
||||
export declare const name = "dsh-telegram-channel";
|
||||
/** agents: followup; apiProxy: workspace/session catalog + /model (Cordis requires inject to read ctx.apiProxy). */
|
||||
/** agents: followup; apiProxy is optional and resolved at runtime via ctx.get;
|
||||
* when absent, catalog helpers degrade to the live-agents view. */
|
||||
export declare const inject: string[];
|
||||
export interface TelegramChannelConfig {
|
||||
token?: string;
|
||||
|
||||
+5
-4
@@ -1,15 +1,16 @@
|
||||
import Schema from '@deepseek-ai/schemastery';
|
||||
import { TelegramBridge } from './bridge.js';
|
||||
export const name = 'dsh-telegram-channel';
|
||||
/** agents: followup; apiProxy: workspace/session catalog + /model (Cordis requires inject to read ctx.apiProxy). */
|
||||
export const inject = ['agents', 'apiProxy'];
|
||||
/** agents: followup; apiProxy is optional and resolved at runtime via ctx.get;
|
||||
* when absent, catalog helpers degrade to the live-agents view. */
|
||||
export const inject = ['agents'];
|
||||
export const Config = Schema.object({
|
||||
token: Schema.string().default(''),
|
||||
allowedUserIds: Schema.array(Schema.number()).default([]),
|
||||
allowAllUsers: Schema.boolean().default(false),
|
||||
maxMessageLength: Schema.number().default(4096),
|
||||
pollingTimeoutSec: Schema.number().default(30),
|
||||
rendering: Schema.string().default('rich'),
|
||||
rendering: Schema.string().default('html'),
|
||||
});
|
||||
function resolveAllowedUserIds(config) {
|
||||
if (config.allowedUserIds && config.allowedUserIds.length > 0) {
|
||||
@@ -37,7 +38,7 @@ export function apply(ctx, config) {
|
||||
allowAllUsers: config.allowAllUsers ?? false,
|
||||
maxMessageLength: config.maxMessageLength ?? 4096,
|
||||
pollingTimeoutSec: config.pollingTimeoutSec ?? 30,
|
||||
rendering: config.rendering === 'html' ? 'html' : 'rich',
|
||||
rendering: config.rendering === 'rich' ? 'rich' : 'html',
|
||||
});
|
||||
ctx.effect(() => {
|
||||
bridge.start();
|
||||
|
||||
Reference in New Issue
Block a user