History

Preview the connections.list item in the connection edit sheet (#1746)

The "What agents see" preview rendered a `- \`<prefix>\` — <description>` inventory line. That line left the execute description in #1230, when the inventory was slimmed to bare integration slugs, so the preview showed text no agent reads. The account label was also marked display-only, but `connections.list` returns it to agents next to the description. Render the `connections.list` item (name, identityLabel, description) in the preview, say in the sheet copy that both fields are agent-visible, and note that the callable name stays fixed at connect time.

Sergiy Dybskiy committed 2 months ago

Commit 9dff4e81 parent b83999f3 files · +42 −25Browse files

Unified · Split

3 files
  1. .changeset/connection-edit-sheet-agent-preview.md +9 −0
  2. packages/core/sdk/src/connection.ts +4 −4
  3. packages/react/src/components/metadata-edit-sheet.tsx +29 −21
.changeset/connection-edit-sheet-agent-preview.md+9−0
@@ -0,0 +1,9 @@
1+---
2+"@executor-js/react": patch
3+---
4+
5+**The connection edit sheet now previews what agents actually read**
6+
7+The "What agents see" preview in the connection edit sheet rendered a `- \`<prefix>\` — <description>`inventory line. That line left the`execute`tool description when the inventory was slimmed to bare integration slugs, so the preview showed text no agent reads. The account label was also marked "Display-only", but`connections.list` returns it to agents alongside the description.
8+
9+The preview now mirrors the `connections.list` item for the connection (`name`, `identityLabel`, `description`), and the sheet copy says that both fields are agent-visible while the callable name stays as it was at connect time.
packages/core/sdk/src/connection.ts+4−4
@@ -31,11 +31,11 @@ export interface Connection { · 30 unmodified lines
3131 /** Callable handle `tools.<integration>.<owner>.<connection>`. Append `.<tool>`
3232 * to reach one of its tools. */
3333 readonly address: ConnectionAddress;
34− /** Optional human label (which account). Not load-bearing. */
34+ /** Optional human label (which account). Not load-bearing for routing, but
35+ * agent-visible through `connections.list`. */
3536 readonly identityLabel?: string | null;
36− /** User-curated description of what this connection is for. Agent-visible:
37− * surfaces next to the connection's prefix in the execute-tool inventory
38− * and in `connections.list`, so it is the place to give agents context a
37+ /** User-curated description of what this connection is for. Agent-visible
38+ * through `connections.list`, so it is the place to give agents context a
3939 * spec can't (e.g. "the staging CRM — reads only"). */
4040 readonly description?: string | null;
4141 /** Epoch ms when an OAuth access token expires; null/absent for static creds. */
packages/react/src/components/metadata-edit-sheet.tsx+29−21
@@ -25,16 +25,24 @@ import { Textarea } from "./textarea"; · 24 unmodified lines
2525 // ---------------------------------------------------------------------------
2626 // Metadata edit sheets — the user-curated, AGENT-VISIBLE metadata for an
2727 // 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.
3030 // ---------------------------------------------------------------------------
3131
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(", ")}, ... }`;
3846 };
3947
4048 function AgentPreview(props: { readonly label: string; readonly line: string }) {
@@ -88,8 +96,13 @@ export function ConnectionEditSheet(props: { · 47 unmodified lines
8896 props.onOpenChange(false);
8997 };
9098
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+ : "";
93106
94107 return (
95108 <Sheet open={connection !== null} onOpenChange={props.onOpenChange}>
@@ -97,8 +110,9 @@ export function ConnectionEditSheet(props: { · 1 unmodified line
97110 <SheetHeader>
98111 <SheetTitle>Edit connection</SheetTitle>
99112 <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.
102116 </SheetDescription>
103117 </SheetHeader>
104118
@@ -128,18 +142,12 @@ export function ConnectionEditSheet(props: { · 23 unmodified lines
128142 disabled={saving}
129143 />
130144 <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.
132147 </p>
133148 </div>
134149
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}
143151 </div>
144152
145153 <SheetFooter>