Files
dsh-easy-desktop/plugins/agentrq/src/config.ts
TommyFang d6f5359873 fix: ship a loadable AgentRQ bundle that stays idle without a workspace URL
The first integration copied sources without lib/, skipped packaging paths, and could fail the default web profile when url was unset.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-16 12:36:04 +08:00

99 lines
4.6 KiB
TypeScript

/**
* Plugin configuration schema.
*
* Everything two deployments might reasonably set differently is a config
* field, per the harness configuration guidance: nothing tunable is hardcoded.
*
* @module @agentrq/dsh-plugin-agentrq
*/
import Schema from '@deepseek-ai/schemastery'
/** How many of a process's agents may take work from the same workspace. */
export type DeliveryScope = 'single-agent' | 'every-agent'
/** Reconnection backoff for a dropped workspace session. */
export interface ReconnectConfig {
/** Delay before the first retry, in milliseconds. */
initialDelayMs: number
/** Ceiling for the exponential backoff, in milliseconds. */
maxDelayMs: number
}
/** Resolved plugin configuration. */
export interface Config {
/**
* The workspace's AgentRQ MCP endpoint. Copy it from Workspace Settings —
* the URL there already carries `?token=…`, which is how AgentRQ
* authenticates a headless client. Empty keeps the plugin loaded but idle
* so a desktop profile can ship the bundle without an endpoint.
*/
url: string
/**
* Optional bearer token, for deployments that prefer an `Authorization`
* header over the `?token=` query parameter. Empty means "the URL carries
* its own credential".
*/
token: string
/**
* Whether to mount the MCP bridge that gives the model AgentRQ's tools.
*
* The plugin mounts one `@deepseek-ai/dsh-mcp-client` instance itself, so a
* deployment configures the workspace endpoint once. Set false only to mount
* that bridge as your own row — a second instance on the same `serverName`
* fails at load.
*/
mountBridge: boolean
/**
* Namespace the bridged AgentRQ tools are registered under: the model sees
* `mcp__<serverName>__reply` and friends. The working-agreement section and
* every framing derive their tool names from this, so the two can never drift.
*/
serverName: string
/**
* Whether the workspace's pushes — new tasks, the periodic next-task
* reminder, status checks, and the human's messages — are delivered into the
* session as they arrive.
*/
deliverPushes: boolean
/**
* Whether to dequeue one task at startup. The workspace re-pushes an
* unclaimed task on its own schedule, so this only shortens the wait for
* work that predates the connection.
*/
catchUpOnStart: boolean
/**
* One AgentRQ workspace queue serves one worker, and pushes are broadcast to
* every connected session. Under `single-agent` (the default) exactly one
* live root agent holds the workspace session, so opening a second chat
* session does not get every task delivered twice. `every-agent` suits a
* deployment that wants deliberate fan-out.
*/
scope: DeliveryScope
/** Reconnection backoff for a dropped workspace session. */
reconnect: ReconnectConfig
/**
* Whether to contribute the AgentRQ working-agreement system-prompt section.
* Turn it off when a deployment states the same protocol in its own persona.
*/
guidance: boolean
/** Per-request timeout for AgentRQ tool calls, in milliseconds. */
requestTimeoutMs: number
}
export const Config = Schema.object({
url: Schema.string().default('').description('AgentRQ workspace MCP endpoint, including its ?token= credential. Empty keeps the plugin idle.'),
token: Schema.string().default('').description('Optional bearer token, when the URL carries no ?token= credential.'),
mountBridge: Schema.boolean().default(true).description('Mount the MCP bridge that gives the model AgentRQ\'s tools.'),
serverName: Schema.string().default('agentrq').description('Namespace for the bridged tools: mcp__<serverName>__reply, and so on.'),
deliverPushes: Schema.boolean().default(true).description('Deliver the workspace\'s tasks and messages into the live session.'),
catchUpOnStart: Schema.boolean().default(true).description('Dequeue one task at startup, for work that predates the connection.'),
scope: Schema.union(['single-agent', 'every-agent'] as const).default('single-agent').description('Whether one root agent or every root agent holds a workspace session.'),
reconnect: Schema.object({
initialDelayMs: Schema.number().min(100).default(1000).description('Delay before the first reconnect attempt.'),
maxDelayMs: Schema.number().min(1000).default(900000).description('Ceiling for the reconnect backoff.'),
}).default({ initialDelayMs: 1000, maxDelayMs: 900000 }),
guidance: Schema.boolean().default(true).description('Contribute the AgentRQ working-agreement system-prompt section.'),
requestTimeoutMs: Schema.number().min(1000).default(30000).description('Timeout for a single AgentRQ tool call.'),
})