@burdenoff/fe-libs 2026.1021.12 → 2026.1021.13
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/dist/shared/assistant/api.d.ts +2 -0
- package/dist/shared/assistant/api.js +133 -132
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/pageContextKeys.d.ts +46 -0
- package/dist/shared/assistant/pageContextKeys.js +46 -0
- package/dist/shared-assistant.js +298 -297
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page-context keys the assistant sandbox actually reads, and the host-side
|
|
3
|
+
* filter that keeps every other key in the browser (G52, PR-AI-03 / BOFF-3908).
|
|
4
|
+
*
|
|
5
|
+
* The sandbox (`ai-assistant`) reads `pageContext` in exactly two places:
|
|
6
|
+
*
|
|
7
|
+
* - `src/context-loader.ts` `ALLOWED_CONTEXT_KEYS` — the keys `injectPageContext`
|
|
8
|
+
* writes into the session for the model. Any other key is skipped there.
|
|
9
|
+
* - `src/context-redaction.ts` `CONTEXT_ID_KEYS` — the opaque ids whose values
|
|
10
|
+
* are redacted from the assistant's replies. `organizationId` is on this list
|
|
11
|
+
* but NOT the first, so it must still be forwarded: dropping it would stop the
|
|
12
|
+
* sandbox from redacting an organisation id the model learnt from a tool call.
|
|
13
|
+
*
|
|
14
|
+
* Both lists are private Sets in that repo, and ai-assistant cannot import
|
|
15
|
+
* fe-libs, so they are mirrored here and pinned by a drift test against
|
|
16
|
+
* `__fixtures__/aiAssistantContextKeys.json`, which
|
|
17
|
+
* `scripts/assistant-context-keys/vendor.ts` cuts from an ai-assistant checkout
|
|
18
|
+
* (it records the commit and each source file's SHA-256). Re-vendor, then
|
|
19
|
+
* update these lists, whenever either Set changes.
|
|
20
|
+
*
|
|
21
|
+
* The filter is defence in depth: the sandbox already drops unknown keys before
|
|
22
|
+
* the model sees them, so this changes nothing the model receives. It stops the
|
|
23
|
+
* browser from sending data nobody reads (the user agent, a timestamp, anything
|
|
24
|
+
* a product adds by accident) through the gateway and the sandbox proxy.
|
|
25
|
+
*/
|
|
26
|
+
/** Mirror of ai-assistant `ALLOWED_CONTEXT_KEYS`: the keys the model is shown. */
|
|
27
|
+
export declare const ASSISTANT_MODEL_CONTEXT_KEYS: readonly ["currentUrl", "currentPage", "entityType", "entityId", "entityName", "pageTitle", "pageType", "activeTab", "activeTool", "selectedText", "workspaceId", "workspaceName", "projectId", "projectName", "platform", "version", "viewportSize", "vibeId", "vibeName", "vibePath", "sessionId", "sessionName", "agentId", "agentName"];
|
|
28
|
+
/** Mirror of ai-assistant `CONTEXT_ID_KEYS`: the ids redacted from replies. */
|
|
29
|
+
export declare const ASSISTANT_REDACTED_CONTEXT_ID_KEYS: readonly ["workspaceId", "organizationId", "projectId", "entityId", "vibeId", "sessionId", "agentId"];
|
|
30
|
+
export type AssistantPageContextKey = (typeof ASSISTANT_MODEL_CONTEXT_KEYS)[number] | (typeof ASSISTANT_REDACTED_CONTEXT_ID_KEYS)[number];
|
|
31
|
+
/**
|
|
32
|
+
* Every key a host may send in `pageContext`: the union of the two server
|
|
33
|
+
* lists, in a stable order (model keys first, then the redaction-only ones).
|
|
34
|
+
*/
|
|
35
|
+
export declare const ASSISTANT_PAGE_CONTEXT_KEYS: readonly AssistantPageContextKey[];
|
|
36
|
+
/** Whether the sandbox reads `key` from `pageContext`. */
|
|
37
|
+
export declare function isAssistantPageContextKey(key: string): key is AssistantPageContextKey;
|
|
38
|
+
/**
|
|
39
|
+
* The part of a host's page context that goes on the wire: only allow-listed
|
|
40
|
+
* keys, with their values untouched. `undefined` stays `undefined`, so a turn
|
|
41
|
+
* with no context still produces the body it always did; a context with no
|
|
42
|
+
* allow-listed key becomes `{}`, which the sandbox treats as "no context".
|
|
43
|
+
*
|
|
44
|
+
* Own enumerable keys only — an inherited or prototype key is never forwarded.
|
|
45
|
+
*/
|
|
46
|
+
export declare function filterAssistantPageContext(pageContext: Readonly<Record<string, unknown>> | undefined): Record<string, unknown> | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/shared/assistant/pageContextKeys.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"currentUrl",
|
|
4
|
+
"currentPage",
|
|
5
|
+
"entityType",
|
|
6
|
+
"entityId",
|
|
7
|
+
"entityName",
|
|
8
|
+
"pageTitle",
|
|
9
|
+
"pageType",
|
|
10
|
+
"activeTab",
|
|
11
|
+
"activeTool",
|
|
12
|
+
"selectedText",
|
|
13
|
+
"workspaceId",
|
|
14
|
+
"workspaceName",
|
|
15
|
+
"projectId",
|
|
16
|
+
"projectName",
|
|
17
|
+
"platform",
|
|
18
|
+
"version",
|
|
19
|
+
"viewportSize",
|
|
20
|
+
"vibeId",
|
|
21
|
+
"vibeName",
|
|
22
|
+
"vibePath",
|
|
23
|
+
"sessionId",
|
|
24
|
+
"sessionName",
|
|
25
|
+
"agentId",
|
|
26
|
+
"agentName"
|
|
27
|
+
], t = [
|
|
28
|
+
"workspaceId",
|
|
29
|
+
"organizationId",
|
|
30
|
+
"projectId",
|
|
31
|
+
"entityId",
|
|
32
|
+
"vibeId",
|
|
33
|
+
"sessionId",
|
|
34
|
+
"agentId"
|
|
35
|
+
], n = Object.freeze(Array.from(new Set([...e, ...t]))), r = new Set(n);
|
|
36
|
+
function i(e) {
|
|
37
|
+
return r.has(e);
|
|
38
|
+
}
|
|
39
|
+
function a(e) {
|
|
40
|
+
if (e === void 0) return;
|
|
41
|
+
let t = {};
|
|
42
|
+
for (let [n, i] of Object.entries(e)) r.has(n) && (t[n] = i);
|
|
43
|
+
return t;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { e as ASSISTANT_MODEL_CONTEXT_KEYS, n as ASSISTANT_PAGE_CONTEXT_KEYS, t as ASSISTANT_REDACTED_CONTEXT_ID_KEYS, a as filterAssistantPageContext, i as isAssistantPageContextKey };
|