| @@ -25,16 +25,24 @@ import { Textarea } from "./textarea"; · 24 unmodified lines |
| 25 | 25 | // --------------------------------------------------------------------------- |
| 26 | 26 | // Metadata edit sheets — the user-curated, AGENT-VISIBLE metadata for an |
| 27 | 27 | // integration and for a connection. The point of the sheet (vs. an inline |
| 28 | | −// input) is the preview: it shows the exact inventory line an agent reads, so |
| 29 | | −// editing the description is editing what the model sees. |
| 28 | +// input) is the preview: it shows the record an agent reads, so editing a |
| 29 | +// field is editing what the model sees. |
| 30 | 30 | // --------------------------------------------------------------------------- |
| 31 | 31 | |
| 32 | | −/** The connection's callable prefix under `tools.`: the path an agent reaches |
| 33 | | − * this connection's tools through (`tools.<prefix>.<tool>`). The execute tool's |
| 34 | | − * inventory now lists integrations, not per-connection prefixes. */ |
| 35 | | −const connectionPrefix = (connection: Connection): string => { |
| 36 | | − const address = String(connection.address); |
| 37 | | − return address.startsWith("tools.") ? address.slice("tools.".length) : address; |
| 32 | +/** The `connections.list` item an agent reads for this connection, reduced to |
| 33 | + * the fields the sheet edits. The callable name is fixed at connect time and |
| 34 | + * is not editable here; only the label and description are. */ |
| 35 | +const connectionListItemPreview = (input: { |
| 36 | + readonly name: string; |
| 37 | + readonly identityLabel: string; |
| 38 | + readonly description: string; |
| 39 | +}): string => { |
| 40 | + const fields = [ |
| 41 | + `name: ${JSON.stringify(input.name)}`, |
| 42 | + ...(input.identityLabel ? [`identityLabel: ${JSON.stringify(input.identityLabel)}`] : []), |
| 43 | + ...(input.description ? [`description: ${JSON.stringify(input.description)}`] : []), |
| 44 | + ]; |
| 45 | + return `{ ${fields.join(", ")}, ... }`; |
| 38 | 46 | }; |
| 39 | 47 | |
| 40 | 48 | function AgentPreview(props: { readonly label: string; readonly line: string }) { |
| @@ -88,8 +96,13 @@ export function ConnectionEditSheet(props: { · 47 unmodified lines |
| 88 | 96 | props.onOpenChange(false); |
| 89 | 97 | }; |
| 90 | 98 | |
| 91 | | − const previewDescription = description.trim().split("\n", 1)[0]; |
| 92 | | − const prefix = connection ? connectionPrefix(connection) : ""; |
| 99 | + const previewLine = connection |
| 100 | + ? connectionListItemPreview({ |
| 101 | + name: String(connection.name), |
| 102 | + identityLabel: identityLabel.trim(), |
| 103 | + description: description.trim(), |
| 104 | + }) |
| 105 | + : ""; |
| 93 | 106 | |
| 94 | 107 | return ( |
| 95 | 108 | <Sheet open={connection !== null} onOpenChange={props.onOpenChange}> |
| @@ -97,8 +110,9 @@ export function ConnectionEditSheet(props: { · 1 unmodified line |
| 97 | 110 | <SheetHeader> |
| 98 | 111 | <SheetTitle>Edit connection</SheetTitle> |
| 99 | 112 | <SheetDescription> |
| 100 | | − The description is agent-visible: it rides this connection's prefix in the tool |
| 101 | | − inventory, so it is the place to say what this credential reaches and how to use it. |
| 113 | + Both fields are agent-visible: agents read them from <code>connections.list</code> when |
| 114 | + they pick an account, so this is the place to say which account this is and what it is |
| 115 | + for. |
| 102 | 116 | </SheetDescription> |
| 103 | 117 | </SheetHeader> |
| 104 | 118 | |
| @@ -128,18 +142,12 @@ export function ConnectionEditSheet(props: { · 23 unmodified lines |
| 128 | 142 | disabled={saving} |
| 129 | 143 | /> |
| 130 | 144 | <p className="text-xs text-muted-foreground"> |
| 131 | | − Display-only; shown in the accounts list instead of the connection name. |
| 145 | + Shown in the accounts list instead of the connection name. Agents see it too, but the |
| 146 | + callable name stays as it was at connect time. |
| 132 | 147 | </p> |
| 133 | 148 | </div> |
| 134 | 149 | |
| 135 | | − {connection ? ( |
| 136 | | − <AgentPreview |
| 137 | | − label="What agents see" |
| 138 | | − line={ |
| 139 | | − previewDescription ? `- \`${prefix}\` — ${previewDescription}` : `- \`${prefix}\`` |
| 140 | | − } |
| 141 | | − /> |
| 142 | | − ) : null} |
| 150 | + {connection ? <AgentPreview label="What agents see" line={previewLine} /> : null} |
| 143 | 151 | </div> |
| 144 | 152 | |
| 145 | 153 | <SheetFooter> |