@bitbitpress/client 1.1.0 → 1.1.2
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 +110 -19
- package/dist/data/assets.d.ts +11 -3
- package/dist/data/assets.d.ts.map +1 -1
- package/dist/data/assets.js +2 -2
- package/dist/data/assets.js.map +1 -1
- package/dist/data/index.d.ts +2 -2
- package/dist/generated/openapi.d.ts +503 -24
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/react/index.d.ts +29 -54
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +69 -81
- package/dist/react/index.js.map +1 -1
- package/dist/react-native-expo/index.d.ts +1 -52
- package/dist/react-native-expo/index.d.ts.map +1 -1
- package/dist/react-native-expo/index.js +1 -91
- package/dist/react-native-expo/index.js.map +1 -1
- package/dist/runtime/index.d.ts +60 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +84 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/synthesisUi/context.d.ts +18 -0
- package/dist/synthesisUi/context.d.ts.map +1 -0
- package/dist/synthesisUi/context.js +15 -0
- package/dist/synthesisUi/context.js.map +1 -0
- package/dist/synthesisUi/types.d.ts +30 -0
- package/dist/synthesisUi/types.d.ts.map +1 -0
- package/dist/{synthesisView → synthesisUi}/types.js.map +1 -1
- package/dist/user/index.d.ts +61 -13
- package/dist/user/index.d.ts.map +1 -1
- package/dist/user/index.js +12 -6
- package/dist/user/index.js.map +1 -1
- package/dist/user/interaction.d.ts +5 -0
- package/dist/user/interaction.d.ts.map +1 -1
- package/dist/user/interaction.js +5 -0
- package/dist/user/interaction.js.map +1 -1
- package/dist/user/submissions.d.ts +65 -0
- package/dist/user/submissions.d.ts.map +1 -1
- package/dist/user/submissions.js +57 -0
- package/dist/user/submissions.js.map +1 -1
- package/dist/user/synthesize-batch-manager.js +2 -0
- package/dist/user/synthesize-batch-manager.js.map +1 -1
- package/dist/user/synthesize.d.ts +29 -6
- package/dist/user/synthesize.d.ts.map +1 -1
- package/dist/user/synthesize.js +12 -3
- package/dist/user/synthesize.js.map +1 -1
- package/dist/user/synthesizeUi.d.ts +67 -0
- package/dist/user/synthesizeUi.d.ts.map +1 -0
- package/dist/user/synthesizeUi.js +51 -0
- package/dist/user/synthesizeUi.js.map +1 -0
- package/dist/user/track-batch-manager.d.ts +17 -0
- package/dist/user/track-batch-manager.d.ts.map +1 -0
- package/dist/user/track-batch-manager.js +52 -0
- package/dist/user/track-batch-manager.js.map +1 -0
- package/dist/user/track.d.ts +17 -0
- package/dist/user/track.d.ts.map +1 -0
- package/dist/user/track.js +24 -0
- package/dist/user/track.js.map +1 -0
- package/dist/user/typeDefs.d.ts +9 -3
- package/dist/user/typeDefs.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/react/primitives.d.ts +0 -54
- package/dist/react/primitives.d.ts.map +0 -1
- package/dist/react/primitives.js +0 -223
- package/dist/react/primitives.js.map +0 -1
- package/dist/react-native-expo/primitives.d.ts +0 -58
- package/dist/react-native-expo/primitives.d.ts.map +0 -1
- package/dist/react-native-expo/primitives.js +0 -218
- package/dist/react-native-expo/primitives.js.map +0 -1
- package/dist/synthesisView/context.d.ts +0 -18
- package/dist/synthesisView/context.d.ts.map +0 -1
- package/dist/synthesisView/context.js +0 -15
- package/dist/synthesisView/context.js.map +0 -1
- package/dist/synthesisView/createComponentMap.d.ts +0 -18
- package/dist/synthesisView/createComponentMap.d.ts.map +0 -1
- package/dist/synthesisView/createComponentMap.js +0 -40
- package/dist/synthesisView/createComponentMap.js.map +0 -1
- package/dist/synthesisView/devLog.d.ts +0 -10
- package/dist/synthesisView/devLog.d.ts.map +0 -1
- package/dist/synthesisView/devLog.js +0 -23
- package/dist/synthesisView/devLog.js.map +0 -1
- package/dist/synthesisView/engine.d.ts +0 -35
- package/dist/synthesisView/engine.d.ts.map +0 -1
- package/dist/synthesisView/engine.js +0 -139
- package/dist/synthesisView/engine.js.map +0 -1
- package/dist/synthesisView/primitives.d.ts +0 -180
- package/dist/synthesisView/primitives.d.ts.map +0 -1
- package/dist/synthesisView/primitives.js +0 -29
- package/dist/synthesisView/primitives.js.map +0 -1
- package/dist/synthesisView/resolve.d.ts +0 -17
- package/dist/synthesisView/resolve.d.ts.map +0 -1
- package/dist/synthesisView/resolve.js +0 -42
- package/dist/synthesisView/resolve.js.map +0 -1
- package/dist/synthesisView/types.d.ts +0 -121
- package/dist/synthesisView/types.d.ts.map +0 -1
- package/dist/synthesisView/useEventDrivenView.d.ts +0 -32
- package/dist/synthesisView/useEventDrivenView.d.ts.map +0 -1
- package/dist/synthesisView/useEventDrivenView.js +0 -157
- package/dist/synthesisView/useEventDrivenView.js.map +0 -1
- package/dist/synthesisView/useSynthesisView.d.ts +0 -13
- package/dist/synthesisView/useSynthesisView.d.ts.map +0 -1
- package/dist/synthesisView/useSynthesisView.js +0 -49
- package/dist/synthesisView/useSynthesisView.js.map +0 -1
- package/dist/user/synthesize-view-batch-manager.d.ts +0 -17
- package/dist/user/synthesize-view-batch-manager.d.ts.map +0 -1
- package/dist/user/synthesize-view-batch-manager.js +0 -52
- package/dist/user/synthesize-view-batch-manager.js.map +0 -1
- package/dist/user/synthesizeView.d.ts +0 -41
- package/dist/user/synthesizeView.d.ts.map +0 -1
- package/dist/user/synthesizeView.js +0 -26
- package/dist/user/synthesizeView.js.map +0 -1
- /package/dist/{synthesisView → synthesisUi}/types.js +0 -0
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { useSynthesisView } from './useSynthesisView.js';
|
|
3
|
-
function isPrimitive(node) {
|
|
4
|
-
return node.kind === 'PRIMITIVE';
|
|
5
|
-
}
|
|
6
|
-
/** Stable string key for an event's cache entry. Speculation + real fire
|
|
7
|
-
* produce the same key when the runtime payload matches the declared one. */
|
|
8
|
-
function buildEventKey(componentName, eventName, sourceNodeId, payload) {
|
|
9
|
-
// Sort keys so payload order doesn't matter.
|
|
10
|
-
const payloadStr = payload
|
|
11
|
-
? JSON.stringify(Object.keys(payload)
|
|
12
|
-
.sort()
|
|
13
|
-
.reduce((acc, k) => {
|
|
14
|
-
acc[k] = payload[k];
|
|
15
|
-
return acc;
|
|
16
|
-
}, {}))
|
|
17
|
-
: '';
|
|
18
|
-
return `${componentName}:${eventName}:${sourceNodeId}:${payloadStr}`;
|
|
19
|
-
}
|
|
20
|
-
/** Walks the rendered tree and pulls out AGENT events with empty
|
|
21
|
-
* `payloadSchema` — those have payloads that don't depend on user input,
|
|
22
|
-
* so the SDK can fabricate the request and prefetch the agent's response. */
|
|
23
|
-
function findPreloadCandidates(uiData) {
|
|
24
|
-
const out = [];
|
|
25
|
-
for (const node of uiData) {
|
|
26
|
-
if (!isPrimitive(node) || !node.events)
|
|
27
|
-
continue;
|
|
28
|
-
for (const [, event] of Object.entries(node.events)) {
|
|
29
|
-
const handleWith = event.handleWith ?? 'AGENT';
|
|
30
|
-
if (handleWith !== 'AGENT')
|
|
31
|
-
continue;
|
|
32
|
-
// Skip events that need runtime payload — we can't fabricate the value.
|
|
33
|
-
if (event.payloadSchema)
|
|
34
|
-
continue;
|
|
35
|
-
out.push({
|
|
36
|
-
key: buildEventKey(node.component, event.name, node.id, event.payload),
|
|
37
|
-
event: {
|
|
38
|
-
name: event.name,
|
|
39
|
-
componentName: node.component,
|
|
40
|
-
payload: event.payload,
|
|
41
|
-
sourceNodeId: node.id,
|
|
42
|
-
priorUiData: uiData,
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return out;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Live-view hook on top of `useSynthesisView`. Owns:
|
|
51
|
-
* - the live `uiData` (swaps in place on AGENT events),
|
|
52
|
-
* - a per-tree preload cache so deterministic event sequences are 0ms,
|
|
53
|
-
* - an event dispatcher the renderer calls back into.
|
|
54
|
-
*
|
|
55
|
-
* Resets state whenever the underlying view (keyName / contentInputs)
|
|
56
|
-
* changes — speculative entries from a stale tree aren't relevant to a
|
|
57
|
-
* different view.
|
|
58
|
-
*/
|
|
59
|
-
export function useEventDrivenView(client, keyName, onHostEvent, contentInputs, baseViewInputs, options) {
|
|
60
|
-
const fetched = useSynthesisView(client, keyName, contentInputs, baseViewInputs);
|
|
61
|
-
// Live tree: starts as the fetched one, replaced on AGENT events.
|
|
62
|
-
const [liveUiData, setLiveUiData] = useState(fetched.uiData);
|
|
63
|
-
// Preload cache scoped to the current view; reset on every base refetch.
|
|
64
|
-
const preloadCacheRef = useRef(new Map());
|
|
65
|
-
const inFlightRef = useRef(new Map());
|
|
66
|
-
// Keep `onHostEvent` reachable inside the stable `handleEvent` callback
|
|
67
|
-
// without making the callback identity churn on every render.
|
|
68
|
-
const onHostEventRef = useRef(onHostEvent);
|
|
69
|
-
onHostEventRef.current = onHostEvent;
|
|
70
|
-
const baseViewInputsRef = useRef(baseViewInputs);
|
|
71
|
-
baseViewInputsRef.current = baseViewInputs;
|
|
72
|
-
// When the base fetch produces new uiData (initial load, or a view change),
|
|
73
|
-
// adopt it and drop any stale speculations.
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
setLiveUiData(fetched.uiData);
|
|
76
|
-
preloadCacheRef.current = new Map();
|
|
77
|
-
inFlightRef.current = new Map();
|
|
78
|
-
}, [fetched.uiData]);
|
|
79
|
-
const preload = options?.preloadNextUi ?? true;
|
|
80
|
-
/** Fire one speculative event lookup and stash the result. Idempotent on
|
|
81
|
-
* the cache key — concurrent triggers share the in-flight promise. */
|
|
82
|
-
const speculate = useCallback(async (candidate) => {
|
|
83
|
-
if (preloadCacheRef.current.has(candidate.key)) {
|
|
84
|
-
return preloadCacheRef.current.get(candidate.key) ?? [];
|
|
85
|
-
}
|
|
86
|
-
const existing = inFlightRef.current.get(candidate.key);
|
|
87
|
-
if (existing)
|
|
88
|
-
return existing;
|
|
89
|
-
const promise = client.user
|
|
90
|
-
.synthesizeViewItem({
|
|
91
|
-
keyName,
|
|
92
|
-
contentInputs,
|
|
93
|
-
viewInputs: { ...baseViewInputsRef.current, event: candidate.event },
|
|
94
|
-
})
|
|
95
|
-
.then((res) => {
|
|
96
|
-
const next = Array.isArray(res.uiData) ? res.uiData : [];
|
|
97
|
-
preloadCacheRef.current.set(candidate.key, next);
|
|
98
|
-
inFlightRef.current.delete(candidate.key);
|
|
99
|
-
return next;
|
|
100
|
-
})
|
|
101
|
-
.catch(() => {
|
|
102
|
-
inFlightRef.current.delete(candidate.key);
|
|
103
|
-
return [];
|
|
104
|
-
});
|
|
105
|
-
inFlightRef.current.set(candidate.key, promise);
|
|
106
|
-
return promise;
|
|
107
|
-
},
|
|
108
|
-
// contentInputs object identity changes are tolerated by the
|
|
109
|
-
// fetch path; we only need a fresh `keyName` to invalidate.
|
|
110
|
-
[client, keyName, contentInputs]);
|
|
111
|
-
// Preload pump: whenever the live tree changes, look up speculatable
|
|
112
|
-
// events and prefetch them in the background. Cap so a giant gallery
|
|
113
|
-
// doesn't blow up the LLM budget.
|
|
114
|
-
useEffect(() => {
|
|
115
|
-
if (!preload)
|
|
116
|
-
return;
|
|
117
|
-
const candidates = findPreloadCandidates(liveUiData).slice(0, MAX_SPECULATIONS);
|
|
118
|
-
for (const candidate of candidates)
|
|
119
|
-
void speculate(candidate);
|
|
120
|
-
}, [liveUiData, preload, speculate]);
|
|
121
|
-
const handleEvent = useCallback((event) => {
|
|
122
|
-
if (event.handleWith === 'HOST') {
|
|
123
|
-
onHostEventRef.current?.(event);
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
const key = buildEventKey(event.componentName, event.name, event.nodeId, event.payload);
|
|
127
|
-
const cached = preloadCacheRef.current.get(key);
|
|
128
|
-
if (cached) {
|
|
129
|
-
setLiveUiData(cached);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
// Cache miss → live call. The result joins the cache so a repeat
|
|
133
|
-
// event-sequence step is 0ms.
|
|
134
|
-
const candidate = {
|
|
135
|
-
key,
|
|
136
|
-
event: {
|
|
137
|
-
name: event.name,
|
|
138
|
-
componentName: event.componentName,
|
|
139
|
-
payload: event.payload,
|
|
140
|
-
sourceNodeId: event.nodeId,
|
|
141
|
-
priorUiData: liveUiData,
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
void speculate(candidate).then((next) => {
|
|
145
|
-
if (next.length > 0)
|
|
146
|
-
setLiveUiData(next);
|
|
147
|
-
});
|
|
148
|
-
}, [liveUiData, speculate]);
|
|
149
|
-
return {
|
|
150
|
-
uiData: liveUiData,
|
|
151
|
-
loading: fetched.loading,
|
|
152
|
-
error: fetched.error,
|
|
153
|
-
handleEvent,
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
const MAX_SPECULATIONS = 8;
|
|
157
|
-
//# sourceMappingURL=useEventDrivenView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useEventDrivenView.js","sourceRoot":"","sources":["../../src/synthesisView/useEventDrivenView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAUjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAuBzD,SAAS,WAAW,CAAC,IAAgB;IACnC,OAAO,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC;AACnC,CAAC;AAED;8EAC8E;AAC9E,SAAS,aAAa,CACpB,aAAqB,EACrB,SAAiB,EACjB,YAAoB,EACpB,OAA4C;IAE5C,6CAA6C;IAC7C,MAAM,UAAU,GAAG,OAAO;QACxB,CAAC,CAAC,IAAI,CAAC,SAAS,CACZ,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;aACjB,IAAI,EAAE;aACN,MAAM,CAA0B,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;YAC1C,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YACpB,OAAO,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,CAAC,KAAK;QACpB,WAAW;KACZ,CAAC;AACJ,CAAC;AAED,MAAM,gBAAgB,GAAG,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ContentInput, FlatUiNode, SynthesizeViewFetcher, ViewInputs } from './types.js';
|
|
2
|
-
export type UseSynthesisViewResult = {
|
|
3
|
-
uiData: FlatUiNode[];
|
|
4
|
-
loading: boolean;
|
|
5
|
-
error: string | null;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Fetches a view's `uiData` by keyName and tracks loading/error state.
|
|
9
|
-
* Re-fetches when keyName, contentInputs, or viewInputs change. Calls
|
|
10
|
-
* coalesce with other views' lookups via the SDK's batch manager.
|
|
11
|
-
*/
|
|
12
|
-
export declare function useSynthesisView(client: SynthesizeViewFetcher, keyName: string, contentInputs?: ContentInput[], viewInputs?: ViewInputs): UseSynthesisViewResult;
|
|
13
|
-
//# sourceMappingURL=useSynthesisView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSynthesisView.d.ts","sourceRoot":"","sources":["../../src/synthesisView/useSynthesisView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE9F,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,YAAY,EAAE,EAC9B,UAAU,CAAC,EAAE,UAAU,GACtB,sBAAsB,CA8CxB"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Fetches a view's `uiData` by keyName and tracks loading/error state.
|
|
4
|
-
* Re-fetches when keyName, contentInputs, or viewInputs change. Calls
|
|
5
|
-
* coalesce with other views' lookups via the SDK's batch manager.
|
|
6
|
-
*/
|
|
7
|
-
export function useSynthesisView(client, keyName, contentInputs, viewInputs) {
|
|
8
|
-
const [result, setResult] = useState({
|
|
9
|
-
uiData: [],
|
|
10
|
-
loading: true,
|
|
11
|
-
error: null,
|
|
12
|
-
});
|
|
13
|
-
const contentInputsKey = contentInputs && contentInputs.length > 0 ? JSON.stringify(contentInputs) : '';
|
|
14
|
-
const viewInputsKey = viewInputs ? JSON.stringify(viewInputs) : '';
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
let cancelled = false;
|
|
17
|
-
setResult((prev) => ({ ...prev, loading: true, error: null }));
|
|
18
|
-
const parsedContentInputs = contentInputsKey
|
|
19
|
-
? JSON.parse(contentInputsKey)
|
|
20
|
-
: undefined;
|
|
21
|
-
const parsedViewInputs = viewInputsKey ? JSON.parse(viewInputsKey) : undefined;
|
|
22
|
-
client.user
|
|
23
|
-
.synthesizeViewItem({
|
|
24
|
-
keyName,
|
|
25
|
-
contentInputs: parsedContentInputs,
|
|
26
|
-
viewInputs: parsedViewInputs,
|
|
27
|
-
})
|
|
28
|
-
.then((res) => {
|
|
29
|
-
if (cancelled)
|
|
30
|
-
return;
|
|
31
|
-
const uiData = Array.isArray(res.uiData) ? res.uiData : [];
|
|
32
|
-
setResult({ uiData, loading: false, error: null });
|
|
33
|
-
})
|
|
34
|
-
.catch((err) => {
|
|
35
|
-
if (cancelled)
|
|
36
|
-
return;
|
|
37
|
-
setResult({
|
|
38
|
-
uiData: [],
|
|
39
|
-
loading: false,
|
|
40
|
-
error: err instanceof Error ? err.message : 'Failed to load view',
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
return () => {
|
|
44
|
-
cancelled = true;
|
|
45
|
-
};
|
|
46
|
-
}, [client, keyName, contentInputsKey, viewInputsKey]);
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=useSynthesisView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSynthesisView.js","sourceRoot":"","sources":["../../src/synthesisView/useSynthesisView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAS5C;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAA6B,EAC7B,OAAe,EACf,aAA8B,EAC9B,UAAuB;IAEvB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAyB;QAC3D,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;IAEH,MAAM,gBAAgB,GACpB,aAAa,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACjF,MAAM,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEnE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAE/D,MAAM,mBAAmB,GAAG,gBAAgB;YAC1C,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAoB;YAClD,CAAC,CAAC,SAAS,CAAC;QACd,MAAM,gBAAgB,GAAG,aAAa,CAAC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,aAAa,CAAgB,CAAC,CAAC,CAAC,SAAS,CAAC;QAE/F,MAAM,CAAC,IAAI;aACR,kBAAkB,CAAC;YAClB,OAAO;YACP,aAAa,EAAE,mBAAmB;YAClC,UAAU,EAAE,gBAAgB;SAC7B,CAAC;aACD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YACZ,IAAI,SAAS;gBAAE,OAAO;YACtB,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,GAAG,CAAC,MAAuB,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7E,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;YACtB,IAAI,SAAS;gBAAE,OAAO;YACtB,SAAS,CAAC;gBACR,MAAM,EAAE,EAAE;gBACV,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB;aAClE,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC,CAAC;IAEvD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { RequestConfig } from '../request.js';
|
|
2
|
-
import { type SynthesizeViewRequestItem, type SynthesizeViewResponse } from './synthesizeView.js';
|
|
3
|
-
/**
|
|
4
|
-
* Coalesces individual view lookups (one per `<BitBitView>`) mounted within a
|
|
5
|
-
* short window into a single batched request, resolving each caller from the
|
|
6
|
-
* matching index in the response.
|
|
7
|
-
*/
|
|
8
|
-
export declare class SynthesizeViewBatchManager {
|
|
9
|
-
private queue;
|
|
10
|
-
private timer;
|
|
11
|
-
private getConfig;
|
|
12
|
-
private batchTimeout;
|
|
13
|
-
constructor(getConfig: () => Promise<RequestConfig>, batchTimeout: number);
|
|
14
|
-
addItem(item: SynthesizeViewRequestItem): Promise<SynthesizeViewResponse>;
|
|
15
|
-
private flush;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=synthesize-view-batch-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize-view-batch-manager.d.ts","sourceRoot":"","sources":["../../src/user/synthesize-view-batch-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAE5B,MAAM,qBAAqB,CAAC;AAK7B;;;;GAIG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,KAAK,CAIL;IACR,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,YAAY,CAAS;gBAEjB,SAAS,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,EAAE,YAAY,EAAE,MAAM;IAKzE,OAAO,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,sBAAsB,CAAC;YAQ3D,KAAK;CAsBpB"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SynthesizeViewBatchManager = void 0;
|
|
4
|
-
const synthesizeView_js_1 = require("./synthesizeView.js");
|
|
5
|
-
/**
|
|
6
|
-
* Coalesces individual view lookups (one per `<BitBitView>`) mounted within a
|
|
7
|
-
* short window into a single batched request, resolving each caller from the
|
|
8
|
-
* matching index in the response.
|
|
9
|
-
*/
|
|
10
|
-
class SynthesizeViewBatchManager {
|
|
11
|
-
queue = [];
|
|
12
|
-
timer = null;
|
|
13
|
-
getConfig;
|
|
14
|
-
batchTimeout;
|
|
15
|
-
constructor(getConfig, batchTimeout) {
|
|
16
|
-
this.getConfig = getConfig;
|
|
17
|
-
this.batchTimeout = batchTimeout;
|
|
18
|
-
}
|
|
19
|
-
addItem(item) {
|
|
20
|
-
return new Promise((resolve, reject) => {
|
|
21
|
-
this.queue.push({ item, resolve, reject });
|
|
22
|
-
if (this.timer)
|
|
23
|
-
clearTimeout(this.timer);
|
|
24
|
-
this.timer = setTimeout(() => this.flush(), this.batchTimeout);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
async flush() {
|
|
28
|
-
if (this.queue.length === 0)
|
|
29
|
-
return;
|
|
30
|
-
const batch = [...this.queue];
|
|
31
|
-
this.queue = [];
|
|
32
|
-
this.timer = null;
|
|
33
|
-
try {
|
|
34
|
-
const config = await this.getConfig();
|
|
35
|
-
const results = await (0, synthesizeView_js_1.synthesizeViews)(config, batch.map((b) => b.item));
|
|
36
|
-
batch.forEach((entry, index) => {
|
|
37
|
-
const result = results[index];
|
|
38
|
-
if (result)
|
|
39
|
-
entry.resolve(result);
|
|
40
|
-
else
|
|
41
|
-
entry.reject(new Error('No result for this item in the batch response'));
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
const err = error instanceof Error ? error : new Error(String(error));
|
|
46
|
-
for (const entry of batch)
|
|
47
|
-
entry.reject(err);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.SynthesizeViewBatchManager = SynthesizeViewBatchManager;
|
|
52
|
-
//# sourceMappingURL=synthesize-view-batch-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize-view-batch-manager.js","sourceRoot":"","sources":["../../src/user/synthesize-view-batch-manager.ts"],"names":[],"mappings":";;;AACA,2DAI6B;AAK7B;;;;GAIG;AACH,MAAa,0BAA0B;IAC7B,KAAK,GAIR,EAAE,CAAC;IACA,KAAK,GAAiB,IAAI,CA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CAAC,MAAM,CAAC,CAAC;;oBAC7B,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC,CAAC;YAChF,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACtE,KAAK,MAAM,KAAK,IAAI,KAAK;gBAAE,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;CACF;AA7CD,gEA6CC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { RequestConfig } from '../request.js';
|
|
2
|
-
/** Optional input forwarded to a view's content synthesis (e.g. an article
|
|
3
|
-
* id the view should personalize against). */
|
|
4
|
-
export interface ContentInput {
|
|
5
|
-
type: string;
|
|
6
|
-
value: string;
|
|
7
|
-
}
|
|
8
|
-
/** Render-time view parameters. Independent from `contentInputs` — these
|
|
9
|
-
* affect flattening only and never reach the synthesis agent. */
|
|
10
|
-
export interface ViewInputs {
|
|
11
|
-
/** Provide the dark mode setting of the current UI to the agent. */
|
|
12
|
-
darkMode?: boolean;
|
|
13
|
-
}
|
|
14
|
-
/** One view to resolve in a `synthesizeViews` request. */
|
|
15
|
-
export interface SynthesizeViewRequestItem {
|
|
16
|
-
/** Stable identifier of the view to load. Configured in the BitBitPress
|
|
17
|
-
* CMS; same value you pass as `<BitBitView keyName="…">`. */
|
|
18
|
-
keyName: string;
|
|
19
|
-
/** Optional inputs the view's content synthesis should consider. */
|
|
20
|
-
contentInputs?: ContentInput[];
|
|
21
|
-
/** Render-time view parameters (theme variant, etc.). */
|
|
22
|
-
viewInputs?: ViewInputs;
|
|
23
|
-
}
|
|
24
|
-
export interface SynthesizeViewResponse {
|
|
25
|
-
/** Render-ready array a BB SDK renderer can display directly. Pass it
|
|
26
|
-
* to `<BitBitView>` / `<BitBitViewRenderer>` and you're done. Empty
|
|
27
|
-
* array when the view resolved but had no UI to render. */
|
|
28
|
-
uiData: unknown[];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Resolve one or more synthesis views in a single request. Returns the
|
|
32
|
-
* responses in the same order as `items`; an item that doesn't match any
|
|
33
|
-
* view resolves to `{ uiData: [] }`.
|
|
34
|
-
*
|
|
35
|
-
* Most apps reach this through `<BitBitView keyName="…">` rather than
|
|
36
|
-
* calling it directly — that path also coalesces multiple `<BitBitView>`
|
|
37
|
-
* mounts within a short window into a single request via the SDK's batch
|
|
38
|
-
* manager.
|
|
39
|
-
*/
|
|
40
|
-
export declare function synthesizeViews(config: RequestConfig, items: SynthesizeViewRequestItem[]): Promise<SynthesizeViewResponse[]>;
|
|
41
|
-
//# sourceMappingURL=synthesizeView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"synthesizeView.d.ts","sourceRoot":"","sources":["../../src/user/synthesizeView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD;+CAC+C;AAC/C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;kEACkE;AAClE,MAAM,WAAW,UAAU;IACzB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,0DAA0D;AAC1D,MAAM,WAAW,yBAAyB;IACxC;kEAC8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,yDAAyD;IACzD,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC;;gEAE4D;IAC5D,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,yBAAyB,EAAE,GACjC,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAYnC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.synthesizeViews = synthesizeViews;
|
|
4
|
-
const request_js_1 = require("../request.js");
|
|
5
|
-
/**
|
|
6
|
-
* Resolve one or more synthesis views in a single request. Returns the
|
|
7
|
-
* responses in the same order as `items`; an item that doesn't match any
|
|
8
|
-
* view resolves to `{ uiData: [] }`.
|
|
9
|
-
*
|
|
10
|
-
* Most apps reach this through `<BitBitView keyName="…">` rather than
|
|
11
|
-
* calling it directly — that path also coalesces multiple `<BitBitView>`
|
|
12
|
-
* mounts within a short window into a single request via the SDK's batch
|
|
13
|
-
* manager.
|
|
14
|
-
*/
|
|
15
|
-
async function synthesizeViews(config, items) {
|
|
16
|
-
const response = await (0, request_js_1.makeRequest)(config, {
|
|
17
|
-
method: 'POST',
|
|
18
|
-
path: '/v1/user/synthesize-views',
|
|
19
|
-
body: { items },
|
|
20
|
-
});
|
|
21
|
-
if (!response?.items) {
|
|
22
|
-
throw new Error('Failed to synthesize views: no items in response');
|
|
23
|
-
}
|
|
24
|
-
return response.items;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=synthesizeView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"synthesizeView.js","sourceRoot":"","sources":["../../src/user/synthesizeView.ts"],"names":[],"mappings":";;AA6CA,0CAeC;AA3DD,8CAA4C;AAkC5C;;;;;;;;;GASG;AACI,KAAK,UAAU,eAAe,CACnC,MAAqB,EACrB,KAAkC;IAElC,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAsC,MAAM,EAAE;QAC9E,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,2BAA2B;QACjC,IAAI,EAAE,EAAE,KAAK,EAAE;KAChB,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,QAAQ,CAAC,KAAK,CAAC;AACxB,CAAC"}
|
|
File without changes
|