mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-21 16:27:18 +02:00
Persist optional connection instructions and deliver authorized snapshots to agent execution prompts. Keep provider templates with each app definition, preserve edits and opt-outs, and replace sessions when guidance or access changes. Use shared production settings across setup and Permissions, with source visibility in agent Instructions. Add the initial memory-provider defaults and managed Honcho workspace configuration. Include migration 0298 and regression coverage for generic providers, runtime delivery, authorization, and catalog regeneration. Co-Authored-By: Paperclip <noreply@paperclip.ing>
25 lines
1.1 KiB
TypeScript
25 lines
1.1 KiB
TypeScript
import { connectionInstructionsConfig } from "@paperclipai/shared";
|
|
|
|
type ConfiguredConnection = { config: Record<string, unknown>; transportConfig?: Record<string, unknown> };
|
|
|
|
/** Honcho's workspace is connection configuration, independent of its prompt. */
|
|
export function honchoWorkspace(connection: ConfiguredConnection): string | null {
|
|
const config = connectionInstructionsConfig(connection);
|
|
if (config.sourceTemplateKey !== "honcho") return null;
|
|
const settings = config.methodConfig;
|
|
if (!settings || typeof settings !== "object" || Array.isArray(settings)) return null;
|
|
const value = (settings as Record<string, unknown>).workspaceId;
|
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
}
|
|
|
|
export function honchoManagedArguments(
|
|
connection: ConfiguredConnection,
|
|
schema: Record<string, unknown>,
|
|
): Record<string, unknown> | undefined {
|
|
const workspace = honchoWorkspace(connection);
|
|
const properties = schema.properties;
|
|
return workspace && properties && typeof properties === "object" && "workspace_id" in properties
|
|
? { workspace_id: workspace }
|
|
: undefined;
|
|
}
|