MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / pickAgentWire

Function pickAgentWire

ui/src/lib/presetHelpers.ts:60–69  ·  view source on GitHub ↗
(
  wires: Partial<Record<WireShape, string>>,
  agentId: string,
)

Source from the content-addressed store, hash-verified

58
59/** Pick the wire an agent should use from a credential's capabilities (null = none compatible). */
60export function pickAgentWire(
61 wires: Partial<Record<WireShape, string>>,
62 agentId: string,
63): { shape: WireShape; baseUrl: string } | null {
64 const pref = AGENT_WIRE_PREFERENCE[agentId] ?? SHAPE_ORDER
65 for (const shape of pref) {
66 if (shape in wires) return { shape, baseUrl: wires[shape] ?? '' }
67 }
68 return null
69}
70
71function schemaProps(schema: Preset['schema']): Record<string, Record<string, unknown>> {
72 return (schema?.properties as Record<string, Record<string, unknown>>) ?? {}

Callers 2

applyCredentialFunction · 0.90
WorkspaceAIConfigModalFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected