/** * dsh-flomo — flomo (浮墨笔记) integration for DeepSeek Harness. Host half. * * Mounts the flomo tools (flomo_send / flomo_config / flomo_status), the * /api/dsh-flomo route family the settings panel talks to, and a * system-prompt announcement. Credentials live in ~/.dsh/dsh-flomo.json * (mode 0600). Everything rides official NPM SDK packages — no dsh source * changes. * * The flomo logging API accepts two credential shapes: * - webhookUrl: the API URL from the flomo settings page * (https://flomoapp.com/mine?source=incoming_webhook), typically * https://flomoapp.com/iwh// * - apiKey: the newer key format; the request URL is built as * https://flomoapp.com/api/prod/apis/webhook/v1/?apiKey= * When both are present, webhookUrl wins. Notes support **bold** and * ![](image-url) inline syntax. Tags are appended from the `tags` argument as * `#tag`; any ASCII '#' left in the *body* is escaped to the full-width '#' * before sending (buildContent), because flomo parses a body `#word` as a tag. */ import type { IncomingMessage, ServerResponse } from 'node:http'; import type { Context } from '@deepseek-ai/cordis'; /** Stable cordis plugin name. */ export declare const name = "flomo"; /** Services required before the flomo surfaces can mount. */ export declare const inject: string[]; /** Route family prefix. */ export declare const FLOMO_API: { readonly config: "/api/dsh-flomo/config"; readonly send: "/api/dsh-flomo/send"; readonly test: "/api/dsh-flomo/test"; }; /** Model-facing announcement: plugin presence, capabilities, and limits. */ export declare const FLOMO_GUIDANCE: string; /** Public config view (never the full credential). */ export interface FlomoConfigView { configured: boolean; /** 'webhookUrl' | 'apiKey', or '' when not configured. */ source: string; masked: string; configPath: string; } /** Persisted credential shape. */ interface FlomoCredentials { apiKey: string; webhookUrl: string; } /** * Small credential store backed by ~/.dsh/dsh-flomo.json. * Reads are lazy and cached; writes use mode 0600 so the webhook token * never leaks to other local users. */ export declare class FlomoStore { config: FlomoCredentials | null; load(): Promise; save(next: FlomoCredentials): Promise; /** Resolved request URL, or null when nothing is configured. */ url(): Promise; /** Public view: configured flag, source, masked credential, config path. */ view(): FlomoConfigView; /** Apply a set-config patch: strings replace, reset clears, undefined keeps. */ patch(args: Record | undefined): Promise; } /** * Full-width number sign (U+FF03). It reads as a hash mark but is a different * code point from the ASCII '#', so flomo's tag parser — which matches * `#word` against an ASCII hash — never turns it into a tag. */ export declare const HASH_SAFE = "\uFF03"; /** * Replace every ASCII '#' in a memo body with the full-width '#'. * * flomo parses `#word` in the body as a tag, so an unescaped body pollutes the * tag set with whatever happens to follow a hash (a PR number like `#91`, a * markdown heading, `#重要` inside prose). Replacing rather than deleting keeps * the text readable — `#91` survives as `#91`. Tags passed through the `tags` * argument are appended *after* escaping and keep their ASCII '#'. */ export declare function escapeHashes(value: string): string; /** One send outcome (never throws for HTTP/parse outcomes). */ export interface FlomoSendResult { ok: boolean; message: string; code?: number; } /** * POST one memo to the flomo logging API. Resolves { ok, message, code? } — * rejects only for transport-level failures. */ export declare function postMemo(url: string, content: string): Promise; /** The send-memo tool. */ export declare function flomoSendTool(store: FlomoStore): import("@deepseek-ai/dsh-tools").ToolDefinition; /** The configure tool. */ export declare function flomoConfigTool(store: FlomoStore): import("@deepseek-ai/dsh-tools").ToolDefinition; /** The status tool. */ export declare function flomoStatusTool(store: FlomoStore): import("@deepseek-ai/dsh-tools").ToolDefinition; /** * Build every /api/dsh-flomo route (exact paths). * @param store - the credential store. * @returns the route list. */ export declare function makeRoutes(store: FlomoStore): ({ kind: "exact"; path: "/api/dsh-flomo/config"; handler: (req: IncomingMessage, res: ServerResponse) => Promise; } | { kind: "exact"; path: "/api/dsh-flomo/send"; handler: (req: IncomingMessage, res: ServerResponse) => Promise; } | { kind: "exact"; path: "/api/dsh-flomo/test"; handler: (req: IncomingMessage, res: ServerResponse) => Promise; })[]; /** Plugin config, read from the composition row. */ export interface Config { /** When true (default), a system-prompt section announces the plugin. */ announceToAgent?: boolean; /** Master switch for the plugin (routes, tools, prompt section). */ enabled?: boolean; } /** * Mount the flomo tools, routes, and announcement. * @param ctx - host plugin context carrying tools/systemPrompt/webServer. * @param config - plugin config from the composition row. */ export declare function apply(ctx: Context, config?: Config): void; export {};