@ethisyscore/plugin-ui 1.92.1 → 1.94.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,374 +1,166 @@
1
+ import { C as ConnectorCanonicalField } from '../../mappingQueryKeys-BcbA0TGy.cjs';
2
+ export { a as CONNECTOR_CONTROL_LABEL, b as ConnectorCanonicalFieldKind, c as ConnectorMappingSuggestionResult, d as ConnectorMappingTranslationEditorProps, e as ConnectorMappingTranslationEditorView, M as MappingCompletenessBanner, f as MappingCompletenessBannerProps, g as MappingCompletenessItem, h as MappingCompletenessResult, i as MappingReadiness, P as PLUGIN_PROVIDER_CONTROL_LABEL, j as PROVIDER_CONTROL_LABEL, k as PROVIDER_OPTION_LABEL, T as TestToolMappingExtractedField, l as TestToolMappingRequest, m as TestToolMappingResult, n as connectorMappingCompletenessQueryKey, o as connectorMappingsQueryKey, p as connectorMappingsRootQueryKey, q as pluginTargetMappingsQueryKey, s as selectIncompleteOperations, r as selectMappingReadiness, t as selectOptionalIncompleteOperations, u as selectRequiredIncompleteOperations } from '../../mappingQueryKeys-BcbA0TGy.cjs';
1
3
  import * as react from 'react';
4
+ import { ReactNode } from 'react';
2
5
 
3
- /**
4
- * Per-operation mapping completeness for one connector + module, as returned by the host's
5
- * `connectors:mappings:completeness` tool.
6
- *
7
- * Declared here rather than imported from a plugin's generated contracts because this package sits
8
- * BELOW the plugins: every plugin that shows a Tool Mappings page had its own copy of this shape,
9
- * and the copies are what let the surfaces drift apart.
10
- *
11
- * @remarks
12
- * The distinction that matters, and the one every copy of the banner got wrong at least once:
13
- * `isToolMapped` and `unmappedRequiredCanonicalFields` are INDEPENDENT. An operation can have a tool
14
- * mapped and still be incomplete, because the tool's schema does not accept a field the operation
15
- * requires. Copy that says "not mapped" when it means "fields not mapped" sends the operator to
16
- * auto-match, which maps tools and cannot close a field gap.
17
- */
18
- interface MappingCompletenessItem {
19
- /** Canonical operation key, e.g. `list-commits`. */
20
- operationKey: string;
21
- /** Human label for the operation, as declared by the module's catalogue. */
22
- label: string;
23
- /**
24
- * Whether the module declares this operation as required. Required gaps block the module from
25
- * working; optional ones only leave an extra capability switched off.
26
- */
27
- isRequired: boolean;
28
- /**
29
- * Whether ANY tool is mapped to the operation. False means the operator has not chosen a tool
30
- * yet; true says nothing about whether the mapping is complete.
31
- */
32
- isToolMapped: boolean;
33
- /**
34
- * Canonical request fields the operation requires that do not map onto a property the live tool
35
- * actually accepts. Non-empty means incomplete, whether or not a tool is mapped.
36
- */
37
- unmappedRequiredCanonicalFields: string[];
38
- }
39
- /** Response envelope for the completeness read, post-unwrap. */
40
- interface MappingCompletenessResult {
41
- operations: MappingCompletenessItem[];
6
+ declare const SOURCE: {
7
+ readonly keyword: "keyword";
8
+ readonly ai: "ai";
9
+ readonly manual: "manual";
10
+ };
11
+ /** The vocabulary of `ToolMapping.Source` values the backend writes. Derived so the two cannot drift. */
12
+ type MappingSourceValue = (typeof SOURCE)[keyof typeof SOURCE];
13
+ /** A connector offered in the picker. */
14
+ interface ConnectorMappingViewConnector {
15
+ id: string;
16
+ name: string;
42
17
  }
43
18
  /**
44
- * Type discriminator for a canonical field. Mirrors the backend `CanonicalFieldKind` enum.
45
- *
46
- * Wire format is the enum member name (e.g. `"String"`, `"StringArray"`); the editor renders the
47
- * value verbatim as the field-kind chip, so an unrecognised kind degrades to a label rather than
48
- * a blank.
19
+ * What serves the module, as this view spells it. Structurally identical to `MappingTargetKind` in
20
+ * the hooks module, declared here for the reason every shape in this file is: the two barrels share
21
+ * types across the boundary only as type-only imports, and this one is two literals.
49
22
  */
50
- type ConnectorCanonicalFieldKind = "String" | "Integer" | "Boolean" | "DateTime" | "Object" | "StringArray";
51
- /**
52
- * A single canonical field on an operation's request or response schema. Carried on the mapping row
53
- * so the editor can render an input per field without a separate schema fetch.
54
- */
55
- interface ConnectorCanonicalField {
23
+ type ConnectorMappingViewProviderKind = "connector" | "plugin";
24
+ /** An installed application offered in the provider picker. */
25
+ interface ConnectorMappingViewPluginProvider {
26
+ extensionId: string;
56
27
  name: string;
57
- kind: ConnectorCanonicalFieldKind;
58
- isRequired: boolean;
59
28
  }
60
- /**
61
- * Arguments the editor hands to the consumer-supplied `onTestMapping` callback. The consumer builds
62
- * the full service request from these plus its own `connectorId` / `operationKey` / `toolName` — the
63
- * editor owns no network call.
64
- */
65
- interface TestToolMappingRequest {
66
- /** Sample values the operator typed — one entry per canonical request field. */
67
- sampleArgs: Record<string, unknown>;
68
- /** Current unsaved request-field map (empty inputs stripped; `null` if all blank). */
29
+ /** A tool offered in the per-row picker. */
30
+ interface ConnectorMappingViewTool {
31
+ name: string;
32
+ description: string;
33
+ }
34
+ /** The operator-editable translation on one row, as handed to `onEditTranslation`. */
35
+ interface ConnectorMappingViewTranslationState {
69
36
  requestFieldMap: Record<string, string> | null;
70
- /** Current unsaved response-field paths (empty inputs stripped; `null` if all blank). */
71
37
  responseFieldPaths: Record<string, string> | null;
72
- /**
73
- * Current unsaved static request parameters (blank-key rows dropped; `null` if none). Optional and
74
- * backward-compatible: it lets the dry-run exercise the DRAFT static params — a consolidated
75
- * tool's `method` discriminator, say — that the operator typed but has not saved yet. A consumer
76
- * whose test endpoint does not accept static fields simply ignores it.
77
- */
78
- staticRequestFields?: Record<string, string> | null;
79
- }
80
- /**
81
- * Result of extracting one canonical response field from the tool's raw response. Mirrors the
82
- * backend `ExtractedFieldResult` DTO.
83
- */
84
- interface TestToolMappingExtractedField {
85
- canonicalField: string;
86
- /** Extracted value, or `null` when the path matched nothing. */
87
- value: string | null;
88
- /** `true` when the JSON path resolved to a node in the response. */
89
- present: boolean;
90
- /**
91
- * `true` when the extracted value looks like Base64 content (long string, charset
92
- * `[A-Za-z0-9+/=]`, no whitespace). The editor shows a "prefix with base64:" hint so the operator
93
- * adjusts the JSON path rather than concluding the mapping is broken.
94
- */
95
- looksBase64: boolean;
96
- }
97
- /** Result the consumer's `onTestMapping` callback resolves with, after the dry-run. */
98
- interface TestToolMappingResult {
99
- success: boolean;
100
- /** Error message when `success` is false. */
101
- error: string | null;
102
- /**
103
- * Raw JSON string of the tool's response, shown in a collapsible so the operator can find the
104
- * right JSON path.
105
- */
106
- rawResponseJson: string | null;
107
- /** Per-field extraction result. */
108
- extractedFields: TestToolMappingExtractedField[];
38
+ staticRequestFields: Record<string, string> | null;
109
39
  }
110
- /**
111
- * Result the consumer's `onSuggestTranslation` callback resolves with. When `success` is true, the
112
- * editor merges the two dictionaries over its current inputs so the operator can review the
113
- * AI proposal before saving.
114
- */
115
- interface ConnectorMappingSuggestionResult {
116
- success: boolean;
117
- /** Error message when `success` is false. `null` when `success` is true. */
118
- error: string | null;
119
- /**
120
- * Proposed canonical-request → tool-field-name rewrite. Empty object `{}` when the model found no
121
- * request-side rewrites to apply.
122
- */
123
- requestFieldMap: Record<string, string>;
124
- /**
125
- * Proposed canonical-response → JSON-path rewrite (e.g. `{ "content": "base64:$.content" }`).
126
- * Empty object `{}` when the model found no response-side rewrites.
127
- */
128
- responseFieldPaths: Record<string, string>;
40
+ /** One row of the mapping table. */
41
+ interface ConnectorMappingViewRow {
42
+ operationKey: string;
43
+ label: string;
44
+ isRequired: boolean;
45
+ mappedToolName: string | null;
46
+ source: MappingSourceValue | null;
47
+ confidence: number | null;
48
+ /** `null` when no stored row exists yet; the view sends `""` up so the host upserts. */
49
+ rowVersion: string | null;
50
+ requiresReview?: boolean;
51
+ canonicalRequestFields?: ConnectorCanonicalField[] | null;
52
+ canonicalResponseFields?: ConnectorCanonicalField[] | null;
53
+ requestFieldMap?: Record<string, string> | null;
54
+ responseFieldPaths?: Record<string, string> | null;
55
+ staticRequestFields?: Record<string, string> | null;
129
56
  }
130
-
131
- interface MappingCompletenessBannerProps {
132
- /**
133
- * Per-operation completeness for the selected connector + module. The banner splits these into
134
- * REQUIRED operations with gaps (a blocking warning) and OPTIONAL ones (an informational note);
135
- * it renders nothing when neither group has gaps.
136
- */
137
- operations: MappingCompletenessItem[];
138
- /**
139
- * Opt-in AI assist. Invoked with the operation the operator chose to fix. The consumer wires this
140
- * to the suggest-translation mutation and decides what to do with the result (open the editor
141
- * seeded with the suggestion, apply it, and so on).
142
- */
143
- onSuggestWithAi: (operation: MappingCompletenessItem) => void;
144
- /**
145
- * Opens the manual mapping editor for an operation. The consumer owns the editor surface and
146
- * routing; the banner only raises intent.
147
- */
148
- onOpenMappingEditor: (operation: MappingCompletenessItem) => void;
149
- /**
150
- * Operation key currently awaiting an AI suggestion, or `null`. Drives the per-row spinner and
151
- * disabled state so a slow suggestion does not lock the whole banner.
152
- */
153
- suggestingOperationKey?: string | null;
154
- /** Disables the AI assist affordance entirely, e.g. AI not configured for the organisation. */
155
- disableSuggest?: boolean;
57
+ /** Outcome of the most recent auto-match run, as the banner reads it. */
58
+ interface ConnectorMappingViewBannerState {
59
+ aiAvailable: boolean;
60
+ unmatchedRequiredCount: number;
61
+ matchedByKeyword: number;
62
+ matchedByAi: number;
63
+ conflictReason: string | null;
156
64
  }
157
- /**
158
- * Connector-setup "mapping completeness" banner, shared by every plugin with a Tool Mappings page.
159
- *
160
- * Presentational and props-driven: the consumer fetches completeness and owns the editor, so the
161
- * same banner serves Repo Monitoring, Timesheets, Error Monitoring and anything added later.
162
- *
163
- * It separates two cases:
164
- *
165
- * - **Required** operations with unmapped required fields, a warning the operator must act on
166
- * because the module cannot run them.
167
- * - **Optional** operations with unmapped required fields, a calm note. These power extra
168
- * capabilities that stay off until their fields are mapped, and the connector may legitimately
169
- * expose no suitable tool, so they must never read as a blocking error.
170
- *
171
- * Renders nothing when neither group has gaps.
172
- *
173
- * @remarks
174
- * **The wording is load-bearing, and was wrong in the copy this was promoted from.** Both groups are
175
- * selected on `unmappedRequiredCanonicalFields`, which is about FIELD mapping. The original optional
176
- * alert was titled "Optional operations not mapped" and said they "stay off until mapped", which
177
- * describes TOOL mapping. Auto-match maps tools and cannot close a field gap, so an operator who
178
- * pressed auto-match saw the count refuse to move and reported the banner as broken. It was
179
- * accurate; the text was not. Every string here therefore says "fields", and both alerts say plainly
180
- * that auto-match will not clear them.
181
- *
182
- * A row without the "No tool mapped" chip already HAS a tool and needs its fields mapped. That chip
183
- * is the only thing distinguishing the two states, which is why the prose points at it.
184
- */
185
- declare function MappingCompletenessBanner({ operations, onSuggestWithAi, onOpenMappingEditor, suggestingOperationKey, disableSuggest, }: MappingCompletenessBannerProps): react.JSX.Element | null;
186
-
187
- interface ConnectorMappingTranslationEditorProps {
188
- open: boolean;
65
+ interface ConnectorMappingViewProps {
66
+ isLoading: boolean;
67
+ /** Wire key of the mapping module, e.g. `repo-monitoring`. Not rendered; kept for parity. */
68
+ moduleKey: string;
69
+ /** Human-readable module label, used in the header and the empty state. */
70
+ moduleLabel: string;
189
71
  /**
190
- * Human-readable operation label for the dialog title (e.g. "Get File").
191
- *
192
- * Optional because it is derived from a looked-up operation that may not be found: every caller
193
- * passes `string | undefined`. The contract claimed required while reality was optional, so this
194
- * states the truth rather than changing any runtime value.
72
+ * When `true` (the default), the view renders its own `<h1>` plus {@link breadcrumbs}. Set it to
73
+ * `false` on a page that already renders a `PageHeader`, or the title appears twice.
195
74
  */
196
- operationLabel?: string;
75
+ withHeader?: boolean;
197
76
  /**
198
- * Tool name the mapping currently points at — shown in the dialog header for context.
77
+ * Breadcrumb trail rendered under the built-in `<h1>`, and only when {@link withHeader} is true.
199
78
  *
200
- * Optional and nullable because the editor opens for an operation that may not be mapped yet:
201
- * every caller passes `string | null | undefined`.
79
+ * A node rather than an import. Breadcrumbs are plugin-specific — they need that plugin's route
80
+ * table and its menu context — and one of the three plugins this was promoted from had deleted
81
+ * the whole header block rather than lift `PageBreadcrumbs` plus its context and router shim for
82
+ * an import that could never execute. Injecting it means a consumer that wants the built-in
83
+ * header can have it without this package taking on a router dependency, and a consumer that
84
+ * does not simply omits both.
202
85
  */
203
- toolName?: string | null;
86
+ breadcrumbs?: ReactNode;
204
87
  /**
205
- * Canonical request fields the editor renders one input per.
88
+ * What to render while {@link isLoading}. Defaults to a plain skeleton block.
206
89
  *
207
- * Optional and nullable: an operation may declare no canonical schema, and the editor already
208
- * gates on their presence. See the coalescing note in the component body — this is not cosmetic.
209
- */
210
- canonicalRequestFields?: ConnectorCanonicalField[] | null;
211
- /** Canonical response fields the editor renders one JSON-path input per. Same nullability. */
212
- canonicalResponseFields?: ConnectorCanonicalField[] | null;
213
- /** Currently-persisted request-field translation, or `null` if the operator hasn't supplied one. */
214
- requestFieldMap: Record<string, string> | null;
215
- /** Currently-persisted response-field translation, or `null` if the operator hasn't supplied one. */
216
- responseFieldPaths: Record<string, string> | null;
217
- /**
218
- * Currently-persisted static request parameters (tool field name → constant literal value), or
219
- * `null` if the operator hasn't supplied any. Seeds the "Static request parameters" rows.
220
- */
221
- staticRequestFields: Record<string, string> | null;
222
- /**
223
- * Called with the operator's translation dictionaries when they click Save. Empty inputs are
224
- * stripped before this fires; if every input on a side was blank, that side is delivered as `null`
225
- * rather than `{}` so the consumer can pass it straight through and the BE writes a NULL column
226
- * (which the resolver treats as "no operator override" and falls back to the connector's
227
- * vendor-default translation). A populated dictionary means "rewrite these fields explicitly"; the
228
- * BE persists it verbatim and the resolver applies it on top of vendor defaults.
229
- *
230
- * `staticRequestFields` carries the constant tool-request parameters (e.g. `{ method: "get" }`);
231
- * same null-vs-populated semantics — `null` when every static row was left blank.
232
- */
233
- onSave: (requestFieldMap: Record<string, string> | null, responseFieldPaths: Record<string, string> | null, staticRequestFields: Record<string, string> | null) => void;
234
- onCancel: () => void;
235
- /**
236
- * Optional. When provided, the editor renders a Test section below the field tables and a "Test
237
- * mapping" button inside it. The consumer supplies this callback so the editor never owns a
238
- * network call. Invoked with the sample args and the current (unsaved) field maps — stripped to
239
- * `null` when every input is blank, matching `onSave`.
90
+ * Injected for the same reason as {@link breadcrumbs}: each plugin has its own page skeleton, and
91
+ * a shared one that did not match would be a visible regression on adoption.
240
92
  */
241
- onTestMapping?: (request: TestToolMappingRequest) => Promise<TestToolMappingResult>;
93
+ loadingFallback?: ReactNode;
94
+ connectors: ConnectorMappingViewConnector[];
95
+ selectedConnectorId: string;
96
+ onConnectorChange: (connectorId: string) => void;
242
97
  /**
243
- * Optional. When provided, the editor renders an "Auto-configure" button in the Test section. The
244
- * consumer invokes the AI suggestion endpoint with the sample inputs the Test section collects,
245
- * then returns the suggested field maps so the editor can populate the request / response inputs.
246
- * The operator reviews and clicks Save.
98
+ * What currently serves the module, or `undefined` when the operator has made no choice.
247
99
  *
248
- * @param sampleArgs - Sample values the operator typed, one entry per canonical request field.
249
- * @returns The suggestion result (success/error + proposed maps).
250
- */
251
- onSuggestTranslation?: (sampleArgs: Record<string, unknown>) => Promise<ConnectorMappingSuggestionResult>;
252
- }
253
- /**
254
- * Per-mapping translation editor — surfaced when the operator picks a tool whose schema doesn't
255
- * match the operation's canonical request/response field names. Renders two stacked tables
256
- * (request / response): left column shows the canonical field's name + kind chip + required
257
- * indicator; right column captures the operator-supplied tool field name (request side) or JSON
258
- * path (response side).
259
- *
260
- * <p><b>Identity semantics.</b> An empty input on a field means "identity — pass the canonical name
261
- * through unchanged". On Save the editor strips empty values; if every input on a side was blank,
262
- * that side is delivered to `onSave` as <code>null</code> (not <code>{}</code>) so the BE writes a
263
- * NULL column. The resolver then treats the NULL as "no operator override" and falls back to the
264
- * connector's vendor-default translation; a populated dictionary means "rewrite these fields
265
- * explicitly" and applies on top of the vendor default.</p>
266
- *
267
- * <p><b>State seeding.</b> The consumer page mounts/unmounts this dialog every time the editor opens
268
- * (the `open` prop is always `true` in practice — the parent gates rendering via conditional mount),
269
- * so local state initialises lazily from the props on each mount. This avoids the "setState in
270
- * useEffect" pattern the eslint react-hooks ruleset blocks, AND keeps the operator's in-flight edits
271
- * sovereign once the dialog is open — a concurrent refresh of the mapping row doesn't clobber what
272
- * they're typing.</p>
273
- *
274
- * <p><b>Promoted, not designed here.</b> This file existed FOUR times — the host's gogo-ui adapter
275
- * plus `self-healing`, `tech` and `timesheets` — and the copies had already drifted. Three
276
- * differences were adjudicated on the way in, and each is a reason the duplication was expensive:</p>
277
- *
278
- * <ol>
279
- * <li><b>The Test button is gated on `onTestMapping`.</b> The enclosing block is gated on
280
- * <code>(onTestMapping || onSuggestTranslation)</code>, so without the inner guard a consumer
281
- * supplying only <code>onSuggestTranslation</code> rendered a "Test mapping" button whose
282
- * handler returns immediately — a DEAD CONTROL. `self-healing` shipped that; `tech` and
283
- * `timesheets` had fixed it. Nothing noticed, because there was no single source to notice
284
- * it against.</li>
285
- * <li><b>Backgrounds come from the theme (`action.hover`), never a hardcoded
286
- * <code>rgba()</code>.</b> A literal <code>rgba(0,0,0,0.03)</code> is invisible in dark mode
287
- * and is what `coreconnect/no-hardcoded-colors` exists to stop.</li>
288
- * <li><b>No emoji in chip labels.</b> The chips already carry an icon and a semantic colour, so
289
- * the emoji was a third, untranslatable, screen-reader-hostile encoding of the same state.</li>
290
- * </ol>
291
- *
292
- * <p>The null tolerance below came from the HOST copy, which was the most hardened of the four.
293
- * `coreconnect/no-local-mapping-editor` stops a fifth being written.</p>
294
- */
295
- declare function ConnectorMappingTranslationEditorView({ open, operationLabel, toolName, canonicalRequestFields: canonicalRequestFieldsProp, canonicalResponseFields: canonicalResponseFieldsProp, requestFieldMap, responseFieldPaths, staticRequestFields, onSave, onCancel, onTestMapping, onSuggestTranslation, }: ConnectorMappingTranslationEditorProps): react.JSX.Element;
296
-
297
- /**
298
- * Every operation with a gap, required or optional. Use it to decide whether to mount a banner at
299
- * all, without duplicating the predicate.
300
- */
301
- declare function selectIncompleteOperations(operations: MappingCompletenessItem[]): MappingCompletenessItem[];
302
- /**
303
- * REQUIRED operations with a gap. These genuinely block the module: the connector cannot run them.
304
- */
305
- declare function selectRequiredIncompleteOperations(operations: MappingCompletenessItem[]): MappingCompletenessItem[];
306
- /**
307
- * OPTIONAL operations with a gap. Informational only: the operation powers an extra capability that
308
- * stays off until its fields are mapped, and the connector may legitimately expose no suitable tool.
309
- *
310
- * @remarks
311
- * Treat these as a note, never a warning. A connector need not expose every operation a module can
312
- * use, so a correctly configured connector can sit here indefinitely — and a banner that never
313
- * clears is a banner operators learn to ignore, which costs you the required warnings too.
314
- */
315
- declare function selectOptionalIncompleteOperations(operations: MappingCompletenessItem[]): MappingCompletenessItem[];
316
- /** A module's readiness, counted over REQUIRED operations only. */
317
- interface MappingReadiness {
318
- /** Required operations that are mapped AND have no field gaps. */
319
- complete: number;
320
- /** Total required operations declared by the module's catalogue. */
321
- total: number;
322
- /** True when every required operation is mapped and complete. */
323
- isReady: boolean;
100
+ * `undefined` is a real state and is NOT rendered as "connector". An unconfigured module and a
101
+ * module pointed at a connector with nothing mapped yet look similar and need different actions,
102
+ * and defaulting here is how an operator ends up sent to the wrong control.
103
+ */
104
+ providerKind?: ConnectorMappingViewProviderKind;
105
+ /** Supplying this is what turns the provider picker on. See the block comment above. */
106
+ onProviderKindChange?: (kind: ConnectorMappingViewProviderKind) => void;
107
+ /** The installed applications on offer. Only read while {@link providerKind} is `"plugin"`. */
108
+ pluginProviders?: ConnectorMappingViewPluginProvider[];
109
+ /** The chosen application, or `""`. */
110
+ selectedPluginExtensionId?: string;
111
+ onPluginProviderChange?: (extensionId: string) => void;
112
+ mappings: ConnectorMappingViewRow[];
113
+ availableTools: ConnectorMappingViewTool[];
114
+ /**
115
+ * Called with `toolName === ""` when the operator clears a row's picker. The consumer routes that
116
+ * to the host's delete tool — see `useConnectorMappingMutations`, which does it — because the
117
+ * set validator rejects an empty tool name.
118
+ */
119
+ onUpdateMapping: (operationKey: string, toolName: string, rowVersion: string) => void;
120
+ onAutoMatch: () => void;
121
+ isUpdating: boolean;
122
+ isAutoMatching: boolean;
123
+ /** `null` when no outcome banner should render (nothing to say, or the operator dismissed it). */
124
+ bannerState: ConnectorMappingViewBannerState | null;
125
+ onDismissBanner: () => void;
126
+ /**
127
+ * Href of the host's AI-providers settings page. The view owns no routing; the consumer passes
128
+ * the href so the link stays correct across templates and route changes.
129
+ */
130
+ aiProvidersHref: string;
131
+ /** Href of the selected connector's settings page. Same routing-ownership rule. */
132
+ connectorSettingsHref: string;
133
+ /**
134
+ * Raised by the per-row "Configure field translation" button. Rows with no mapped tool, or with
135
+ * no declared canonical schema, never raise it — the view hides the button for those, because
136
+ * there is nothing operator-meaningful to translate.
137
+ */
138
+ onEditTranslation: (operationKey: string, current: ConnectorMappingViewTranslationState) => void;
324
139
  }
325
140
  /**
326
- * Readiness over REQUIRED operations only, for a progress indicator or a "ready" badge.
141
+ * The Tool Mappings table: a connector picker, one row per canonical operation with a tool picker
142
+ * and a source chip, the auto-match control, and the per-row translation affordance.
327
143
  *
328
- * @remarks
329
- * Optional operations are excluded on purpose. Counting them would leave a properly configured
330
- * connector permanently short of 100%, for operations the operator was never expected to map. This
331
- * rule came from `ethisyscore-plugin-timesheets`, which had it right while another plugin was
332
- * reporting optional field gaps in a standing banner.
333
- */
334
- declare function selectMappingReadiness(operations: MappingCompletenessItem[]): MappingReadiness;
335
-
336
- /**
337
- * React-query keys for a connector's tool mappings and the completeness read derived from them.
144
+ * ## Promoted, not designed here
338
145
  *
339
- * @remarks
340
- * The completeness key is built as a CHILD of the mappings key, and that nesting is the whole point
341
- * of shipping these from the SDK rather than letting each plugin declare its own.
146
+ * This file existed three times — `sales`, `tech` and `timesheets` — and two of the three were
147
+ * BYTE-IDENTICAL at 329 lines. The third was the same file with the header block deleted and one
148
+ * behaviour difference that was a live defect (see {@link renderBanner}). Nothing about it was
149
+ * plugin-specific except two imports, which are now props: the breadcrumbs and the loading
150
+ * skeleton.
342
151
  *
343
- * Completeness is derived state: it is the mappings joined against the live tool schemas. Every write
344
- * that changes a mapping can change it. When the two keys are siblings, a mutation has to remember to
345
- * invalidate both, and one plugin duly invalidated only the mappings key — so its "operations aren't
346
- * fully mapped" banner went stale after every save, clear and auto-match, and stayed stale until the
347
- * operator navigated away. Nesting means a single `invalidateQueries({ queryKey: mappings })` takes
348
- * the completeness read with it, and there is nothing left to forget.
152
+ * ## What it owns and what it does not
349
153
  *
350
- * @example
351
- * ```ts
352
- * const mappings = connectorMappingsQueryKey(connectorId, moduleKey);
154
+ * Presentational and fully props-driven. It fetches nothing, writes nothing and routes nowhere —
155
+ * `aiProvidersHref` and `connectorSettingsHref` arrive as strings, and clearing a row's picker
156
+ * emits `onUpdateMapping(key, "", rowVersion)` for the consumer to route. Pair it with
157
+ * `useConnectorToolMappings` from `@ethisyscore/plugin-ui/connector-mappings`, whose `view` bundle
158
+ * spreads straight onto these props.
353
159
  *
354
- * useQuery({ queryKey: mappings, queryFn: ... });
355
- * useQuery({ queryKey: connectorMappingCompletenessQueryKey(connectorId, moduleKey), queryFn: ... });
356
- *
357
- * // One call. Covers both, and any future query keyed beneath the mappings key.
358
- * queryClient.invalidateQueries({ queryKey: mappings });
359
- * ```
360
- */
361
- /**
362
- * Key for the mappings list of one connector + module.
363
- *
364
- * `connectorId` is accepted as possibly-undefined because the page renders before a connector is
365
- * chosen; pair it with `enabled: !!connectorId` rather than branching on the key.
366
- */
367
- declare function connectorMappingsQueryKey(connectorId: string | undefined, moduleKey: string): readonly ["connector-mappings", string | undefined, string];
368
- /**
369
- * Key for the completeness read, nested UNDER {@link connectorMappingsQueryKey} so invalidating the
370
- * mappings prefix always covers it. Do not flatten this into a sibling key.
160
+ * The translation affordance appears only when a row HAS a mapped tool AND declares both canonical
161
+ * schemas. A row with no schema has nothing to translate, and offering the button anyway opens an
162
+ * editor with no fields in it.
371
163
  */
372
- declare function connectorMappingCompletenessQueryKey(connectorId: string | undefined, moduleKey: string): readonly ["connector-mappings", string | undefined, string, "completeness"];
164
+ declare function ConnectorMappingView({ isLoading, moduleLabel, breadcrumbs, loadingFallback, connectors, selectedConnectorId, onConnectorChange, providerKind, onProviderKindChange, pluginProviders, selectedPluginExtensionId, onPluginProviderChange, mappings, availableTools, onUpdateMapping, onAutoMatch, isUpdating, isAutoMatching, bannerState, onDismissBanner, onEditTranslation, withHeader, }: ConnectorMappingViewProps): react.JSX.Element;
373
165
 
374
- export { type ConnectorCanonicalField, type ConnectorCanonicalFieldKind, type ConnectorMappingSuggestionResult, type ConnectorMappingTranslationEditorProps, ConnectorMappingTranslationEditorView, MappingCompletenessBanner, type MappingCompletenessBannerProps, type MappingCompletenessItem, type MappingCompletenessResult, type MappingReadiness, type TestToolMappingExtractedField, type TestToolMappingRequest, type TestToolMappingResult, connectorMappingCompletenessQueryKey, connectorMappingsQueryKey, selectIncompleteOperations, selectMappingReadiness, selectOptionalIncompleteOperations, selectRequiredIncompleteOperations };
166
+ export { ConnectorCanonicalField, ConnectorMappingView, type ConnectorMappingViewBannerState, type ConnectorMappingViewConnector, type ConnectorMappingViewPluginProvider, type ConnectorMappingViewProps, type ConnectorMappingViewProviderKind, type ConnectorMappingViewRow, type ConnectorMappingViewTool, type ConnectorMappingViewTranslationState };