@salesforce/metadata-core-sdk 1.7.0 → 1.9.0
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.
- package/README.md +61 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/sdk/hooks/vibe-edit/selection/selectionTelemetry.d.ts +34 -0
- package/dist/sdk/hooks/vibe-edit/selection/selectionTelemetry.d.ts.map +1 -0
- package/dist/sdk/hooks/vibe-edit/selection/selectionTelemetry.js +64 -0
- package/dist/sdk/hooks/vibe-edit/selection/selectionTelemetry.js.map +1 -0
- package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.css +5 -0
- package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.d.ts.map +1 -1
- package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.js +39 -2
- package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.js.map +1 -1
- package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.d.ts +5 -0
- package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.d.ts.map +1 -1
- package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.js +9 -7
- package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.js.map +1 -1
- package/dist/sdk/hooks/vibe-edit/ui/composer/VibeEditComposer.css +460 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/VibeEditComposer.d.ts +71 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/VibeEditComposer.d.ts.map +1 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/VibeEditComposer.js +461 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/VibeEditComposer.js.map +1 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/composerPlacement.d.ts +19 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/composerPlacement.d.ts.map +1 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/composerPlacement.js +23 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/composerPlacement.js.map +1 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/composerPlacement.test.d.ts +8 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/composerPlacement.test.d.ts.map +1 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/composerPlacement.test.js +33 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/composerPlacement.test.js.map +1 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/iconPaths.d.ts +12 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/iconPaths.d.ts.map +1 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/iconPaths.js +29 -0
- package/dist/sdk/hooks/vibe-edit/ui/composer/iconPaths.js.map +1 -0
- package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.d.ts +10 -0
- package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.d.ts.map +1 -1
- package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.js +279 -23
- package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.js.map +1 -1
- package/dist/sdk/utils/HostCommunicationUtils.d.ts +41 -1
- package/dist/sdk/utils/HostCommunicationUtils.d.ts.map +1 -1
- package/dist/sdk/utils/HostCommunicationUtils.js +115 -20
- package/dist/sdk/utils/HostCommunicationUtils.js.map +1 -1
- package/dist/sdk/utils/telemetry/telemetryBuffer.d.ts +54 -0
- package/dist/sdk/utils/telemetry/telemetryBuffer.d.ts.map +1 -0
- package/dist/sdk/utils/telemetry/telemetryBuffer.js +163 -0
- package/dist/sdk/utils/telemetry/telemetryBuffer.js.map +1 -0
- package/dist/sdk/utils/telemetry/telemetryEvents.d.ts +60 -0
- package/dist/sdk/utils/telemetry/telemetryEvents.d.ts.map +1 -0
- package/dist/sdk/utils/telemetry/telemetryEvents.js +243 -0
- package/dist/sdk/utils/telemetry/telemetryEvents.js.map +1 -0
- package/dist/sdk/utils/telemetry/telemetryRelay.d.ts +63 -0
- package/dist/sdk/utils/telemetry/telemetryRelay.d.ts.map +1 -0
- package/dist/sdk/utils/telemetry/telemetryRelay.js +64 -0
- package/dist/sdk/utils/telemetry/telemetryRelay.js.map +1 -0
- package/dist/sdk/webviewMessageTypes.d.ts +51 -7
- package/dist/sdk/webviewMessageTypes.d.ts.map +1 -1
- package/dist/sdk/webviewMessageTypes.js +10 -0
- package/dist/sdk/webviewMessageTypes.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
**/
|
|
7
|
+
/**
|
|
8
|
+
* Schema and strict validator for the iframe -> host TELEMETRY_EVENT message.
|
|
9
|
+
*
|
|
10
|
+
* The payload mirrors `ITelemetry.sendEvent(name, properties, measurements)` so a
|
|
11
|
+
* host can forward a validated event without reshaping it. Every property value
|
|
12
|
+
* comes from a closed list and every measurement is a bounded integer, so a
|
|
13
|
+
* payload can never carry free-form text (prompt text, api names, paths, ids).
|
|
14
|
+
*
|
|
15
|
+
* Node-safe on purpose: no React, no CSS, no `window`. This module is exported
|
|
16
|
+
* from the React-free main barrel and is imported by hosts.
|
|
17
|
+
*/
|
|
18
|
+
export const TELEMETRY_SCHEMA_VERSION = 1;
|
|
19
|
+
export const TELEMETRY_EVENT_NAMES = [
|
|
20
|
+
'vibeEdit.selectMode',
|
|
21
|
+
'vibeEdit.selection',
|
|
22
|
+
'vibeEdit.promptAbandoned',
|
|
23
|
+
];
|
|
24
|
+
export const SELECT_MODE_ACTIONS = ['enter', 'exit'];
|
|
25
|
+
export const SELECTION_ACTIONS = ['add', 'remove'];
|
|
26
|
+
/**
|
|
27
|
+
* `SelectableNode.type` values emitted by the first-party plugins, plus the
|
|
28
|
+
* `'other'` fallback. Anything outside this list is bucketed to `'other'` by
|
|
29
|
+
* `toElementTypeBucket` (iframe side) and by `parseTelemetryEvent` (host side),
|
|
30
|
+
* so a third-party plugin's custom type, or a type added after this host shipped,
|
|
31
|
+
* is counted but never named.
|
|
32
|
+
*
|
|
33
|
+
* Keep in step with the plugins repo: Flow emits its `FlowNodeKind`, Permission
|
|
34
|
+
* set emits its named-access section keys, Agent emits the types below. Every
|
|
35
|
+
* entry adds up to two buckets per flush (add and remove), so the default of
|
|
36
|
+
* `TelemetryRateLimiter` must stay above `2 * SELECTION_ELEMENT_TYPES.length`.
|
|
37
|
+
*/
|
|
38
|
+
export const SELECTION_ELEMENT_TYPES = [
|
|
39
|
+
// Agent
|
|
40
|
+
'agent',
|
|
41
|
+
'start-agent',
|
|
42
|
+
'subagent',
|
|
43
|
+
'topic',
|
|
44
|
+
'system-instructions',
|
|
45
|
+
'reasoning',
|
|
46
|
+
'reasoning-action',
|
|
47
|
+
'action',
|
|
48
|
+
'action-target',
|
|
49
|
+
'action-input',
|
|
50
|
+
'action-output',
|
|
51
|
+
'messages',
|
|
52
|
+
'description',
|
|
53
|
+
'heading',
|
|
54
|
+
// Flow (rows and stage steps, then FlowNodeKind minus the non-selectable end/group)
|
|
55
|
+
'step',
|
|
56
|
+
'detail',
|
|
57
|
+
'start',
|
|
58
|
+
'screen',
|
|
59
|
+
'apexAction',
|
|
60
|
+
'apexPluginCall',
|
|
61
|
+
'emailAction',
|
|
62
|
+
'externalCallout',
|
|
63
|
+
'routeWork',
|
|
64
|
+
'addScreenPop',
|
|
65
|
+
'addSkillRequirement',
|
|
66
|
+
'checkAvailability',
|
|
67
|
+
'setScreenProperty',
|
|
68
|
+
'assignment',
|
|
69
|
+
'addPromptInstructions',
|
|
70
|
+
'decision',
|
|
71
|
+
'loop',
|
|
72
|
+
'recordCreate',
|
|
73
|
+
'recordLookup',
|
|
74
|
+
'recordUpdate',
|
|
75
|
+
'recordDelete',
|
|
76
|
+
'recordRollback',
|
|
77
|
+
'subflow',
|
|
78
|
+
'wait',
|
|
79
|
+
'collectionProcessor',
|
|
80
|
+
'collectionSort',
|
|
81
|
+
'transform',
|
|
82
|
+
'customError',
|
|
83
|
+
'stage',
|
|
84
|
+
'interactiveStep',
|
|
85
|
+
'managedContentStep',
|
|
86
|
+
// Permission set
|
|
87
|
+
'permissionset',
|
|
88
|
+
'objectPermission',
|
|
89
|
+
'fieldPermission',
|
|
90
|
+
'recordTypeVisibility',
|
|
91
|
+
'tabSetting',
|
|
92
|
+
'apexClassAccesses',
|
|
93
|
+
'pageAccesses',
|
|
94
|
+
'flowAccesses',
|
|
95
|
+
'agentAccesses',
|
|
96
|
+
'customPermissions',
|
|
97
|
+
'customMetadataTypeAccesses',
|
|
98
|
+
'customSettingAccesses',
|
|
99
|
+
'externalDataSourceAccesses',
|
|
100
|
+
'externalCredentialPrincipalAccesses',
|
|
101
|
+
'servicePresenceStatusAccesses',
|
|
102
|
+
'emailRoutingAddressAccesses',
|
|
103
|
+
'genComputingSummaryDefAccesses',
|
|
104
|
+
'userPermissions',
|
|
105
|
+
'applicationVisibilities',
|
|
106
|
+
// Schema
|
|
107
|
+
'object',
|
|
108
|
+
'field',
|
|
109
|
+
// Flexipage
|
|
110
|
+
'region',
|
|
111
|
+
'block',
|
|
112
|
+
'dataProvider',
|
|
113
|
+
// Fallback
|
|
114
|
+
'other',
|
|
115
|
+
];
|
|
116
|
+
export const BOOLEAN_STRINGS = ['true', 'false'];
|
|
117
|
+
/** Upper bound for every count measurement. */
|
|
118
|
+
export const MAX_TELEMETRY_COUNT = 10000;
|
|
119
|
+
/** One table drives both the emitters' type buckets and the host validator. */
|
|
120
|
+
const SCHEMA = {
|
|
121
|
+
'vibeEdit.selectMode': {
|
|
122
|
+
properties: { action: SELECT_MODE_ACTIONS },
|
|
123
|
+
measurements: {},
|
|
124
|
+
},
|
|
125
|
+
'vibeEdit.selection': {
|
|
126
|
+
properties: { action: SELECTION_ACTIONS, elementType: SELECTION_ELEMENT_TYPES },
|
|
127
|
+
measurements: { count: { min: 1, max: MAX_TELEMETRY_COUNT } },
|
|
128
|
+
fallbacks: { elementType: 'other' },
|
|
129
|
+
},
|
|
130
|
+
'vibeEdit.promptAbandoned': {
|
|
131
|
+
properties: { hadText: BOOLEAN_STRINGS },
|
|
132
|
+
measurements: { attachmentCount: { min: 0, max: MAX_TELEMETRY_COUNT } },
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
const EVENT_NAME_SET = new Set(TELEMETRY_EVENT_NAMES);
|
|
136
|
+
const ELEMENT_TYPE_SET = new Set(SELECTION_ELEMENT_TYPES);
|
|
137
|
+
const TOP_LEVEL_KEYS = ['schemaVersion', 'name', 'properties', 'measurements'];
|
|
138
|
+
function isPlainObject(value) {
|
|
139
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
const prototype = Reflect.getPrototypeOf(value);
|
|
143
|
+
return prototype === Object.prototype || prototype === null;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Snapshot of an object's own data properties, or null unless its keys are
|
|
147
|
+
* exactly `allowed`. Accessor properties and symbol keys are rejected, so the
|
|
148
|
+
* validated values cannot change between the check and the use.
|
|
149
|
+
*/
|
|
150
|
+
function snapshotExactKeys(value, allowed) {
|
|
151
|
+
const keys = Reflect.ownKeys(value);
|
|
152
|
+
if (keys.length !== allowed.length) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
const snapshot = {};
|
|
156
|
+
for (const key of keys) {
|
|
157
|
+
if (typeof key !== 'string' || !allowed.includes(key)) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(value, key);
|
|
161
|
+
if (!descriptor || !('value' in descriptor)) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
snapshot[key] = descriptor.value;
|
|
165
|
+
}
|
|
166
|
+
return snapshot;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Strict host-side check of an iframe TELEMETRY_EVENT payload. Returns a fresh,
|
|
170
|
+
* validated copy, or null. Nothing is coerced except a string `elementType`
|
|
171
|
+
* outside the closed list, which becomes `'other'` (the schema's `fallbacks`), so
|
|
172
|
+
* the copy still only holds closed-list values. Any other deviation from the
|
|
173
|
+
* schema (unknown name, extra or missing key, out-of-list value, non-string
|
|
174
|
+
* value, non-integer or out-of-range measurement) is rejected. Never throws, even
|
|
175
|
+
* on hostile input (proxies, throwing getters).
|
|
176
|
+
*/
|
|
177
|
+
export function parseTelemetryEvent(value) {
|
|
178
|
+
try {
|
|
179
|
+
if (!isPlainObject(value)) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
const top = snapshotExactKeys(value, TOP_LEVEL_KEYS);
|
|
183
|
+
if (!top || top.schemaVersion !== TELEMETRY_SCHEMA_VERSION) {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
const name = top.name;
|
|
187
|
+
if (typeof name !== 'string' || !EVENT_NAME_SET.has(name)) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
const schema = SCHEMA[name];
|
|
191
|
+
if (!isPlainObject(top.properties) || !isPlainObject(top.measurements)) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
const properties = snapshotExactKeys(top.properties, Object.keys(schema.properties));
|
|
195
|
+
const measurements = snapshotExactKeys(top.measurements, Object.keys(schema.measurements));
|
|
196
|
+
if (!properties || !measurements) {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
const cleanProperties = {};
|
|
200
|
+
for (const [key, allowedValues] of Object.entries(schema.properties)) {
|
|
201
|
+
const propertyValue = properties[key];
|
|
202
|
+
if (typeof propertyValue !== 'string') {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
if (allowedValues.includes(propertyValue)) {
|
|
206
|
+
cleanProperties[key] = propertyValue;
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
const fallback = schema.fallbacks?.[key];
|
|
210
|
+
if (fallback === undefined) {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
cleanProperties[key] = fallback;
|
|
214
|
+
}
|
|
215
|
+
const cleanMeasurements = {};
|
|
216
|
+
for (const [key, range] of Object.entries(schema.measurements)) {
|
|
217
|
+
const measurementValue = measurements[key];
|
|
218
|
+
if (typeof measurementValue !== 'number' ||
|
|
219
|
+
!Number.isInteger(measurementValue) ||
|
|
220
|
+
measurementValue < range.min ||
|
|
221
|
+
measurementValue > range.max) {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
cleanMeasurements[key] = measurementValue;
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
schemaVersion: TELEMETRY_SCHEMA_VERSION,
|
|
228
|
+
name: name,
|
|
229
|
+
properties: cleanProperties,
|
|
230
|
+
measurements: cleanMeasurements,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/** Emitter side: map any element type to a closed bucket (unknown -> 'other'). */
|
|
238
|
+
export function toElementTypeBucket(type) {
|
|
239
|
+
return typeof type === 'string' && ELEMENT_TYPE_SET.has(type)
|
|
240
|
+
? type
|
|
241
|
+
: 'other';
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=telemetryEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetryEvents.js","sourceRoot":"","sources":["../../../../src/sdk/utils/telemetry/telemetryEvents.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,qBAAqB;IACrB,oBAAoB;IACpB,0BAA0B;CAClB,CAAC;AAGX,MAAM,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M,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;YAC/D,MAAM,gBAAgB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;YAC3C,IACE,OAAO,gBAAgB,KAAK,QAAQ;gBACpC,CAAC,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC;gBACnC,gBAAgB,GAAG,KAAK,CAAC,GAAG;gBAC5B,gBAAgB,GAAG,KAAK,CAAC,GAAG,EAC5B,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;YACD,iBAAiB,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC;QAC5C,CAAC;QAED,OAAO;YACL,aAAa,EAAE,wBAAwB;YACvC,IAAI,EAAE,IAA0B;YAChC,UAAU,EAAE,eAAe;YAC3B,YAAY,EAAE,iBAAiB;SAChC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC;QAC3D,CAAC,CAAE,IAA6B;QAChC,CAAC,CAAC,OAAO,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
**/
|
|
7
|
+
/**
|
|
8
|
+
* Host-side relay for the iframe TELEMETRY_EVENT message.
|
|
9
|
+
*
|
|
10
|
+
* The iframe is host-agnostic: it emits the same events whether it runs in VS
|
|
11
|
+
* Code, Builder Central or any other embedder. Each host turns those events into
|
|
12
|
+
* analytics by passing the received payload to `relayTelemetryEvent` with its own
|
|
13
|
+
* `ITelemetry`-shaped sink, so the rules (rate limit, strict validation, host
|
|
14
|
+
* attribution that the iframe cannot override) live here in tested code instead of
|
|
15
|
+
* being re-implemented per host.
|
|
16
|
+
*
|
|
17
|
+
* Node-safe and free of `window`, so any host runtime can import it.
|
|
18
|
+
*/
|
|
19
|
+
import type { ITelemetry } from '../../abstractions/services/ITelemetry.js';
|
|
20
|
+
/** The part of `ITelemetry` the relay needs. */
|
|
21
|
+
export type TelemetrySink = Pick<ITelemetry, 'sendEvent'>;
|
|
22
|
+
export type RelayResult = 'forwarded' | 'invalid' | 'rate_limited';
|
|
23
|
+
/**
|
|
24
|
+
* Sliding-window rate limiter. A host creates one per render target (VS Code) or
|
|
25
|
+
* per iframe (browser hosts) so a misbehaving page cannot flood the sink.
|
|
26
|
+
*
|
|
27
|
+
* The default of 300 per minute leaves room for the worst-case selection flush,
|
|
28
|
+
* which emits one bucket per (add/remove, element type) pair, plus the
|
|
29
|
+
* select-mode and abandon events around it. A single iframe renders one plugin,
|
|
30
|
+
* so a real flush is well below the worst case; the headroom covers a few flushes
|
|
31
|
+
* inside one window (leaving select mode, page hide, the 20 second timer).
|
|
32
|
+
*/
|
|
33
|
+
export declare class TelemetryRateLimiter {
|
|
34
|
+
private readonly maxEvents;
|
|
35
|
+
private readonly windowMs;
|
|
36
|
+
private readonly now;
|
|
37
|
+
private readonly timestamps;
|
|
38
|
+
constructor(maxEvents?: number, windowMs?: number, now?: () => number);
|
|
39
|
+
/** Returns false once the budget for the current window is spent. */
|
|
40
|
+
tryAcquire(): boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface RelayTelemetryOptions {
|
|
43
|
+
/** Where validated events go, typically the host's `ITelemetry`. */
|
|
44
|
+
sink: TelemetrySink;
|
|
45
|
+
/**
|
|
46
|
+
* Properties the host derives from its own state (for example `pluginId`).
|
|
47
|
+
* Spread last, so a host value always wins over anything from the iframe.
|
|
48
|
+
*/
|
|
49
|
+
hostProperties: Record<string, string>;
|
|
50
|
+
/** Rate limit applied before the payload is parsed. Hosts should pass one. */
|
|
51
|
+
limiter?: TelemetryRateLimiter;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Validates an iframe TELEMETRY_EVENT payload and forwards it to the host's sink.
|
|
55
|
+
*
|
|
56
|
+
* Order: rate limit, then `parseTelemetryEvent`, then
|
|
57
|
+
* `sink.sendEvent(name, { ...properties, ...hostProperties }, measurements)`.
|
|
58
|
+
* Never throws: a sink that throws is swallowed and reported as `'invalid'`. The
|
|
59
|
+
* relay does not log; the caller decides what to log from the result. Never echo
|
|
60
|
+
* anything back to the iframe.
|
|
61
|
+
*/
|
|
62
|
+
export declare function relayTelemetryEvent(payload: unknown, options: RelayTelemetryOptions): RelayResult;
|
|
63
|
+
//# sourceMappingURL=telemetryRelay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetryRelay.d.ts","sourceRoot":"","sources":["../../../../src/sdk/utils/telemetry/telemetryRelay.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAG5E,gDAAgD;AAChD,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,cAAc,CAAC;AAEnE;;;;;;;;;GASG;AACH,qBAAa,oBAAoB;IAI7B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IALtB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;gBAGxB,SAAS,GAAE,MAAY,EACvB,QAAQ,GAAE,MAAe,EACzB,GAAG,GAAE,MAAM,MAAiB;IAG/C,qEAAqE;IACrE,UAAU,IAAI,OAAO;CAYtB;AAED,MAAM,WAAW,qBAAqB;IACpC,oEAAoE;IACpE,IAAI,EAAE,aAAa,CAAC;IACpB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,8EAA8E;IAC9E,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,qBAAqB,GAAG,WAAW,CAkBjG"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
**/
|
|
7
|
+
import { parseTelemetryEvent } from './telemetryEvents.js';
|
|
8
|
+
/**
|
|
9
|
+
* Sliding-window rate limiter. A host creates one per render target (VS Code) or
|
|
10
|
+
* per iframe (browser hosts) so a misbehaving page cannot flood the sink.
|
|
11
|
+
*
|
|
12
|
+
* The default of 300 per minute leaves room for the worst-case selection flush,
|
|
13
|
+
* which emits one bucket per (add/remove, element type) pair, plus the
|
|
14
|
+
* select-mode and abandon events around it. A single iframe renders one plugin,
|
|
15
|
+
* so a real flush is well below the worst case; the headroom covers a few flushes
|
|
16
|
+
* inside one window (leaving select mode, page hide, the 20 second timer).
|
|
17
|
+
*/
|
|
18
|
+
export class TelemetryRateLimiter {
|
|
19
|
+
constructor(maxEvents = 300, windowMs = 60000, now = Date.now) {
|
|
20
|
+
this.maxEvents = maxEvents;
|
|
21
|
+
this.windowMs = windowMs;
|
|
22
|
+
this.now = now;
|
|
23
|
+
this.timestamps = [];
|
|
24
|
+
}
|
|
25
|
+
/** Returns false once the budget for the current window is spent. */
|
|
26
|
+
tryAcquire() {
|
|
27
|
+
const now = this.now();
|
|
28
|
+
const windowStart = now - this.windowMs;
|
|
29
|
+
while (this.timestamps.length > 0 && this.timestamps[0] <= windowStart) {
|
|
30
|
+
this.timestamps.shift();
|
|
31
|
+
}
|
|
32
|
+
if (this.timestamps.length >= this.maxEvents) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
this.timestamps.push(now);
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validates an iframe TELEMETRY_EVENT payload and forwards it to the host's sink.
|
|
41
|
+
*
|
|
42
|
+
* Order: rate limit, then `parseTelemetryEvent`, then
|
|
43
|
+
* `sink.sendEvent(name, { ...properties, ...hostProperties }, measurements)`.
|
|
44
|
+
* Never throws: a sink that throws is swallowed and reported as `'invalid'`. The
|
|
45
|
+
* relay does not log; the caller decides what to log from the result. Never echo
|
|
46
|
+
* anything back to the iframe.
|
|
47
|
+
*/
|
|
48
|
+
export function relayTelemetryEvent(payload, options) {
|
|
49
|
+
try {
|
|
50
|
+
if (options.limiter && !options.limiter.tryAcquire()) {
|
|
51
|
+
return 'rate_limited';
|
|
52
|
+
}
|
|
53
|
+
const event = parseTelemetryEvent(payload);
|
|
54
|
+
if (!event) {
|
|
55
|
+
return 'invalid';
|
|
56
|
+
}
|
|
57
|
+
options.sink.sendEvent(event.name, { ...event.properties, ...options.hostProperties }, event.measurements);
|
|
58
|
+
return 'forwarded';
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return 'invalid';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=telemetryRelay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetryRelay.js","sourceRoot":"","sources":["../../../../src/sdk/utils/telemetry/telemetryRelay.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAgBJ,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAO3D;;;;;;;;;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,OAAO,CAAC,cAAc,EAAE,EAClD,KAAK,CAAC,YAAY,CACnB,CAAC;QACF,OAAO,WAAW,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -33,6 +33,16 @@ export declare const WebviewMessageType: {
|
|
|
33
33
|
* platform embeds.
|
|
34
34
|
*/
|
|
35
35
|
readonly SUBMIT_EDIT: "SUBMIT_EDIT";
|
|
36
|
+
/** Host reports the outcome of a correlated VS Code edit submission. */
|
|
37
|
+
readonly SUBMIT_EDIT_RESULT: "SUBMIT_EDIT_RESULT";
|
|
38
|
+
/**
|
|
39
|
+
* Plugin reports an anonymous, aggregate usage event to the host (payload:
|
|
40
|
+
* TelemetryEventPayload, see utils/telemetry). Fire-and-forget: the host never
|
|
41
|
+
* replies. The host MUST validate the payload (relayTelemetryEvent /
|
|
42
|
+
* parseTelemetryEvent) and add its own attribution such as `pluginId`; the
|
|
43
|
+
* plugin never sends one.
|
|
44
|
+
*/
|
|
45
|
+
readonly TELEMETRY_EVENT: "TELEMETRY_EVENT";
|
|
36
46
|
};
|
|
37
47
|
export type WebviewMessageTypeValue = (typeof WebviewMessageType)[keyof typeof WebviewMessageType];
|
|
38
48
|
/**
|
|
@@ -108,6 +118,21 @@ export interface SpatialContext {
|
|
|
108
118
|
xpath?: string;
|
|
109
119
|
};
|
|
110
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Where a vibe edit should land in the agent chat: a brand-new conversation, or
|
|
123
|
+
* a continuation of the current one. The webview composer's routing control
|
|
124
|
+
* produces this; the host maps it onto the Agentforce Vibes conversation
|
|
125
|
+
* lifecycle (a `new` target resets the session so a fresh conversation opens;
|
|
126
|
+
* `existing` reuses the remembered conversationId). `id`/`label` are the
|
|
127
|
+
* composer's own display handles — the host branches only on `kind`.
|
|
128
|
+
*/
|
|
129
|
+
export type ChatTarget = {
|
|
130
|
+
kind: 'new';
|
|
131
|
+
} | {
|
|
132
|
+
kind: 'existing';
|
|
133
|
+
id: string;
|
|
134
|
+
label: string;
|
|
135
|
+
};
|
|
111
136
|
/**
|
|
112
137
|
* Payload for SUBMIT_EDIT: the user's instruction plus one SpatialContext per
|
|
113
138
|
* selected element. The host assembles this into an agent prompt.
|
|
@@ -117,21 +142,38 @@ export interface EditRequest {
|
|
|
117
142
|
prompt: string;
|
|
118
143
|
/** Spatial context for each selected element (one entry per element). */
|
|
119
144
|
attachments: SpatialContext[];
|
|
145
|
+
/**
|
|
146
|
+
* Optional chat routing for this edit. Omitted by the classic panel (web /
|
|
147
|
+
* Builder Central), so those hosts keep the pre-existing shape byte-for-byte;
|
|
148
|
+
* the VS Code composer sets it to drive new-vs-current conversation routing.
|
|
149
|
+
*/
|
|
150
|
+
chatTarget?: ChatTarget;
|
|
151
|
+
/** Stable SelectionGraph ids for host-side reconstruction in trusted hosts. */
|
|
152
|
+
selectionIds?: string[];
|
|
120
153
|
}
|
|
121
154
|
/**
|
|
122
155
|
* Result of a host's attempt to deliver an EditRequest to the embedded agent.
|
|
123
156
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
157
|
+
* Delivery is a single stream channel — an auto-run Agentforce Vibes submission
|
|
158
|
+
* (`vibes.submit`). There is no fallback: `channel` is `'vibes.submit'` on
|
|
159
|
+
* success, or `'none'` when the edit could not be delivered (Vibes unavailable
|
|
160
|
+
* after retries, or a terminal rejection) — in which case the host surfaces an
|
|
161
|
+
* error to the user.
|
|
127
162
|
*/
|
|
128
163
|
export interface EditHandoffResult {
|
|
129
|
-
/** Whether the request was delivered to (or
|
|
164
|
+
/** Whether the request was delivered to (or durably queued for) the agent. */
|
|
130
165
|
delivered: boolean;
|
|
131
|
-
/** Which delivery channel was used. */
|
|
132
|
-
channel: 'vibes.
|
|
133
|
-
/** Optional human-readable detail (e.g. why
|
|
166
|
+
/** Which delivery channel was used (`'none'` when delivery failed). */
|
|
167
|
+
channel: 'vibes.submit' | 'none';
|
|
168
|
+
/** Optional human-readable detail (e.g. why delivery failed). */
|
|
134
169
|
detail?: string;
|
|
170
|
+
/** Conversation created or continued by a typed Vibes acceptance. */
|
|
171
|
+
conversationId?: string;
|
|
172
|
+
}
|
|
173
|
+
/** A correlated VS Code result for one SUBMIT_EDIT request. */
|
|
174
|
+
export interface SubmitEditResult {
|
|
175
|
+
requestId: string;
|
|
176
|
+
result: EditHandoffResult;
|
|
135
177
|
}
|
|
136
178
|
/** Set of all valid message types for whitelist validation */
|
|
137
179
|
export declare const VALID_MESSAGE_TYPES: Set<string>;
|
|
@@ -152,5 +194,7 @@ export interface WebviewMessage {
|
|
|
152
194
|
* expected value.
|
|
153
195
|
*/
|
|
154
196
|
renderId?: string;
|
|
197
|
+
/** Correlates a request/response pair when the host supports acknowledgements. */
|
|
198
|
+
requestId?: string;
|
|
155
199
|
}
|
|
156
200
|
//# sourceMappingURL=webviewMessageTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webviewMessageTypes.d.ts","sourceRoot":"","sources":["../../src/sdk/webviewMessageTypes.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;GAGG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE1E,eAAO,MAAM,kBAAkB;IAC7B,sEAAsE;;IAEtE,sCAAsC;;IAEtC,4CAA4C;;IAE5C,oCAAoC;;IAEpC,0BAA0B;;IAG1B,4CAA4C;;IAG5C,qEAAqE;;IAGrE,8EAA8E;;IAG9E;;;;;OAKG;;CAEK,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAEnG;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,IA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C,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -28,6 +28,16 @@ export const WebviewMessageType = {
|
|
|
28
28
|
* platform embeds.
|
|
29
29
|
*/
|
|
30
30
|
SUBMIT_EDIT: 'SUBMIT_EDIT',
|
|
31
|
+
/** Host reports the outcome of a correlated VS Code edit submission. */
|
|
32
|
+
SUBMIT_EDIT_RESULT: 'SUBMIT_EDIT_RESULT',
|
|
33
|
+
/**
|
|
34
|
+
* Plugin reports an anonymous, aggregate usage event to the host (payload:
|
|
35
|
+
* TelemetryEventPayload, see utils/telemetry). Fire-and-forget: the host never
|
|
36
|
+
* replies. The host MUST validate the payload (relayTelemetryEvent /
|
|
37
|
+
* parseTelemetryEvent) and add its own attribution such as `pluginId`; the
|
|
38
|
+
* plugin never sends one.
|
|
39
|
+
*/
|
|
40
|
+
TELEMETRY_EVENT: 'TELEMETRY_EVENT',
|
|
31
41
|
};
|
|
32
42
|
/** Set of all valid message types for whitelist validation */
|
|
33
43
|
export const VALID_MESSAGE_TYPES = new Set(Object.values(WebviewMessageType));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webviewMessageTypes.js","sourceRoot":"","sources":["../../src/sdk/webviewMessageTypes.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAQJ,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,sEAAsE;IACtE,YAAY,EAAE,cAAc;IAC5B,sCAAsC;IACtC,mBAAmB,EAAE,qBAAqB;IAC1C,4CAA4C;IAC5C,gBAAgB,EAAE,kBAAkB;IACpC,oCAAoC;IACpC,gBAAgB,EAAE,kBAAkB;IACpC,0BAA0B;IAC1B,aAAa,EAAE,cAAc;IAE7B,4CAA4C;IAC5C,mBAAmB,EAAE,qBAAqB;IAE1C,qEAAqE;IACrE,oBAAoB,EAAE,sBAAsB;IAE5C,8EAA8E;IAC9E,kBAAkB,EAAE,oBAAoB;IAExC;;;;;OAKG;IACH,WAAW,EAAE,aAAa;
|
|
1
|
+
{"version":3,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