@burdenoff/fe-libs 2026.911.5 → 2026.912.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.
- package/dist/shared/assistant/index.d.ts +3 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/preview/previewTransitions.d.ts +12 -0
- package/dist/shared/assistant/preview/previewTransitions.d.ts.map +1 -1
- package/dist/shared/assistant/preview/previewTransitions.js +57 -44
- package/dist/shared/assistant/preview/runIdentity.d.ts +44 -0
- package/dist/shared/assistant/preview/runIdentity.d.ts.map +1 -0
- package/dist/shared/assistant/preview/runIdentity.js +33 -0
- package/dist/shared/assistant/preview/surfaceState.d.ts +133 -0
- package/dist/shared/assistant/preview/surfaceState.d.ts.map +1 -0
- package/dist/shared/assistant/preview/surfaceState.js +92 -0
- package/dist/shared/assistant/preview/types.d.ts +33 -0
- package/dist/shared/assistant/preview/types.d.ts.map +1 -1
- package/dist/shared/assistant/preview/useAssistantPreviewBridge.d.ts.map +1 -1
- package/dist/shared/assistant/preview/useAssistantPreviewBridge.js +47 -39
- package/dist/shared/assistant/ui/AIAssistantPanel.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AIAssistantPanel.js +67 -63
- package/dist/shared/assistant/ui/AssistantConversationList.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantConversationList.js +1 -1
- package/dist/shared/assistant/ui/AssistantMoreMenu.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMoreMenu.js +58 -59
- package/dist/shared/assistant/ui/composer/AssistantAttachmentButton.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantAttachmentButton.js +49 -50
- package/dist/shared/assistant/ui/panelOverlays.d.ts +52 -3
- package/dist/shared/assistant/ui/panelOverlays.d.ts.map +1 -1
- package/dist/shared/assistant/ui/panelOverlays.js +11 -7
- package/dist/shared/assistant/ui/useDropdownEscape.d.ts +34 -0
- package/dist/shared/assistant/ui/useDropdownEscape.d.ts.map +1 -0
- package/dist/shared/assistant/ui/useDropdownEscape.js +23 -0
- package/dist/shared/assistant/ui/useOverlayFocus.d.ts.map +1 -1
- package/dist/shared/assistant/useAssistantKeyboardShortcuts.d.ts.map +1 -1
- package/dist/shared/assistant/useAssistantKeyboardShortcuts.js +26 -21
- package/dist/shared-assistant.js +46 -43
- package/package.json +1 -1
|
@@ -94,7 +94,10 @@ export * from './ui/composer/connectSource';
|
|
|
94
94
|
export * from './preview/types';
|
|
95
95
|
export * from './preview/context';
|
|
96
96
|
export * from './preview/previewTransitions';
|
|
97
|
+
export * from './preview/surfaceState';
|
|
98
|
+
export * from './preview/runIdentity';
|
|
97
99
|
export * from './ui/panelOverlays';
|
|
100
|
+
export * from './ui/useDropdownEscape';
|
|
98
101
|
export * from './ui/useOverlayFocus';
|
|
99
102
|
export * from './preview/useAssistantPreviewBridge';
|
|
100
103
|
export * from './preview/AssistantPreviewOverlay';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AAGxB,cAAc,wBAAwB,CAAC;AAKvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAG9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,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,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAElC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAE1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAE1C,cAAc,iCAAiC,CAAC;AAGhD,cAAc,OAAO,CAAC;AACtB,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { AssistantConversationStatus } from '../conversation';
|
|
2
2
|
import { AssistantPreviewEvent, AssistantPreviewRun } from './types';
|
|
3
|
+
import { AssistantToolStep } from '../ui/AssistantToolActivity';
|
|
4
|
+
/**
|
|
5
|
+
* ★ Exported so the bridge can ask "is this live?" without naming any status.
|
|
6
|
+
* `previewInvariants` forbids status literals in the bridge precisely so there
|
|
7
|
+
* is one vocabulary for what counts as running, and this keeps that true.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isRunningStatus(status: AssistantConversationStatus): boolean;
|
|
3
10
|
export interface PreviewBridgeState {
|
|
4
11
|
/**
|
|
5
12
|
* ★★ The conversation whose baseline has been established.
|
|
@@ -67,6 +74,11 @@ export interface PreviewInput {
|
|
|
67
74
|
readonly conversationId: string | null;
|
|
68
75
|
readonly status: AssistantConversationStatus;
|
|
69
76
|
readonly content: string | null;
|
|
77
|
+
/**
|
|
78
|
+
* ★ The tool activity for this message, already parsed. Passed IN rather than
|
|
79
|
+
* derived here so this function stays pure and testable without the parser.
|
|
80
|
+
*/
|
|
81
|
+
readonly steps: readonly AssistantToolStep[];
|
|
70
82
|
readonly error?: string | null;
|
|
71
83
|
/** `isStageCopy`, injected so this stays pure and testable without i18n. */
|
|
72
84
|
readonly isFiller: (content: string) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previewTransitions.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/preview/previewTransitions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"previewTransitions.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/preview/previewTransitions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AASrE;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAE5E;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C;;;;;;;;OAQG;IACH,QAAQ,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAChD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,wEAAwE;IACxE,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,kBAAkB,EAAE,kBAKhC,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACzC;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;CACjD;AAkDD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,kBAAkB,EACzB,KAAK,EAAE,YAAY,GAClB;IAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,CAwJhE"}
|
|
@@ -3,94 +3,107 @@ var e = new Set([
|
|
|
3
3
|
"provisioning",
|
|
4
4
|
"connecting",
|
|
5
5
|
"streaming"
|
|
6
|
-
])
|
|
6
|
+
]);
|
|
7
|
+
function t(t) {
|
|
8
|
+
return e.has(t);
|
|
9
|
+
}
|
|
10
|
+
var n = {
|
|
7
11
|
observedConversationId: null,
|
|
8
12
|
startedRun: null,
|
|
9
13
|
lastEndedRunId: null,
|
|
10
14
|
lastSnapshot: null
|
|
11
15
|
};
|
|
12
|
-
function
|
|
13
|
-
|
|
16
|
+
function r(e, t) {
|
|
17
|
+
return `${e}\u0000${t.map((e) => `${e.id}:${e.status}`).join(",")}`;
|
|
18
|
+
}
|
|
19
|
+
function i(e, t, n, i, a) {
|
|
20
|
+
let o = t && !i(t) ? t : "";
|
|
21
|
+
if (!o && n.length === 0) return null;
|
|
22
|
+
let s = r(o, n);
|
|
23
|
+
return s === a ? null : {
|
|
24
|
+
event: {
|
|
25
|
+
kind: "snapshot",
|
|
26
|
+
run: e,
|
|
27
|
+
content: o,
|
|
28
|
+
steps: n
|
|
29
|
+
},
|
|
30
|
+
signature: s
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function a(t, n) {
|
|
34
|
+
let r = [], a = n.run?.runId ?? null, o = n.conversationId ?? n.run?.conversationId ?? null, s = o !== null && t.observedConversationId === o, c = {
|
|
14
35
|
...t,
|
|
15
|
-
observedConversationId:
|
|
16
|
-
},
|
|
17
|
-
if (
|
|
36
|
+
observedConversationId: o ?? t.observedConversationId
|
|
37
|
+
}, l = c.startedRun;
|
|
38
|
+
if (l && l.runId !== a && (r.push({
|
|
18
39
|
kind: "end",
|
|
19
|
-
run:
|
|
40
|
+
run: l,
|
|
20
41
|
outcome: "abandoned",
|
|
21
42
|
error: null
|
|
22
|
-
}),
|
|
23
|
-
...
|
|
43
|
+
}), c = {
|
|
44
|
+
...c,
|
|
24
45
|
startedRun: null,
|
|
25
|
-
lastEndedRunId:
|
|
46
|
+
lastEndedRunId: l.runId
|
|
26
47
|
}), !n.run) return {
|
|
27
48
|
events: r,
|
|
28
|
-
state:
|
|
49
|
+
state: c
|
|
29
50
|
};
|
|
30
51
|
if (e.has(n.status)) {
|
|
31
|
-
|
|
52
|
+
c.startedRun?.runId !== n.run.runId && (r.push({
|
|
32
53
|
kind: "start",
|
|
33
54
|
run: n.run
|
|
34
|
-
}),
|
|
35
|
-
...
|
|
55
|
+
}), c = {
|
|
56
|
+
...c,
|
|
36
57
|
startedRun: n.run,
|
|
37
58
|
lastSnapshot: null
|
|
38
59
|
});
|
|
39
|
-
let e =
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
content: t
|
|
44
|
-
}), s = {
|
|
45
|
-
...s,
|
|
46
|
-
lastSnapshot: t
|
|
60
|
+
let e = i(c.startedRun ?? n.run, n.content, n.steps, n.isFiller, c.lastSnapshot);
|
|
61
|
+
return e && (r.push(e.event), c = {
|
|
62
|
+
...c,
|
|
63
|
+
lastSnapshot: e.signature
|
|
47
64
|
}), {
|
|
48
65
|
events: r,
|
|
49
|
-
state:
|
|
66
|
+
state: c
|
|
50
67
|
};
|
|
51
68
|
}
|
|
52
|
-
if (!
|
|
53
|
-
if (!
|
|
69
|
+
if (!c.startedRun) {
|
|
70
|
+
if (!s || c.lastEndedRunId === n.run.runId) return {
|
|
54
71
|
events: r,
|
|
55
72
|
state: {
|
|
56
|
-
...
|
|
73
|
+
...c,
|
|
57
74
|
lastEndedRunId: n.run.runId
|
|
58
75
|
}
|
|
59
76
|
};
|
|
60
77
|
r.push({
|
|
61
78
|
kind: "start",
|
|
62
79
|
run: n.run
|
|
63
|
-
}),
|
|
64
|
-
...
|
|
80
|
+
}), c = {
|
|
81
|
+
...c,
|
|
65
82
|
startedRun: n.run,
|
|
66
83
|
lastSnapshot: null
|
|
67
84
|
};
|
|
68
85
|
}
|
|
69
|
-
let
|
|
70
|
-
if (
|
|
71
|
-
let e = n.content;
|
|
72
|
-
e &&
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
content: e
|
|
76
|
-
}), s = {
|
|
77
|
-
...s,
|
|
78
|
-
lastSnapshot: e
|
|
86
|
+
let u = c.startedRun;
|
|
87
|
+
if (u && u.runId === n.run.runId) {
|
|
88
|
+
let e = i(u, n.content, n.steps, n.isFiller, c.lastSnapshot);
|
|
89
|
+
e && (r.push(e.event), c = {
|
|
90
|
+
...c,
|
|
91
|
+
lastSnapshot: e.signature
|
|
79
92
|
}), r.push({
|
|
80
93
|
kind: "end",
|
|
81
|
-
run:
|
|
94
|
+
run: u,
|
|
82
95
|
outcome: n.status === "error" ? "error" : "complete",
|
|
83
96
|
error: n.error ?? null
|
|
84
|
-
}),
|
|
85
|
-
...
|
|
97
|
+
}), c = {
|
|
98
|
+
...c,
|
|
86
99
|
startedRun: null,
|
|
87
|
-
lastEndedRunId:
|
|
100
|
+
lastEndedRunId: u.runId
|
|
88
101
|
};
|
|
89
102
|
}
|
|
90
103
|
return {
|
|
91
104
|
events: r,
|
|
92
|
-
state:
|
|
105
|
+
state: c
|
|
93
106
|
};
|
|
94
107
|
}
|
|
95
108
|
//#endregion
|
|
96
|
-
export {
|
|
109
|
+
export { n as IDLE_PREVIEW_STATE, t as isRunningStatus, a as nextPreviewEvents };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { PreviewOwner } from './surfaceState';
|
|
2
|
+
export interface RunIdentityCache {
|
|
3
|
+
/**
|
|
4
|
+
* The owner this run was FIRST seen under. Subsequent calls return that same
|
|
5
|
+
* owner however many times the caller re-reads, and whoever is signed in by
|
|
6
|
+
* then — which is the entire point.
|
|
7
|
+
*/
|
|
8
|
+
ownerFor(runId: string): PreviewOwner;
|
|
9
|
+
/**
|
|
10
|
+
* The owner of a run that has already SETTLED — remembered if we pinned it
|
|
11
|
+
* while it ran, otherwise the current owner — and RELEASED either way.
|
|
12
|
+
*
|
|
13
|
+
* ★★★ THIS EXISTS BECAUSE HOLDING SETTLED RUNS MADE EVICTION REACHABLE.
|
|
14
|
+
* Terminal processing entries persist by design, and the bridge meets one for
|
|
15
|
+
* every conversation the user opens, so storing them filled the map with
|
|
16
|
+
* history. Releasing here is the other half: a settled run can never need its
|
|
17
|
+
* identity again — the transitions mark it ended and consume every later tick
|
|
18
|
+
* without emitting — so an entry that stays only crowds out a run that is
|
|
19
|
+
* still live. With both, the map holds ONLY runs believed to be running, and
|
|
20
|
+
* `DEFAULT_LIMIT` has to cover concurrent turns rather than session history.
|
|
21
|
+
*
|
|
22
|
+
* ★ A miss is not a failure: a settled entry we never saw running is either
|
|
23
|
+
* history, which is consumed without emitting so the identity is never used,
|
|
24
|
+
* or a synchronous failure that settled in this very tick — where the current
|
|
25
|
+
* owner IS the run's owner, and reading it now is correct rather than the
|
|
26
|
+
* self-agreeing guard it would be for a live run.
|
|
27
|
+
*/
|
|
28
|
+
ownerForSettled(runId: string): PreviewOwner;
|
|
29
|
+
/** Test seam: how many runs are currently remembered. */
|
|
30
|
+
size(): number;
|
|
31
|
+
}
|
|
32
|
+
export declare function createRunIdentityCache(readOwner?: () => PreviewOwner, limit?: number,
|
|
33
|
+
/** ★ Injected so expiry is testable without waiting four hours. */
|
|
34
|
+
now?: () => number, maxAgeMs?: number): RunIdentityCache;
|
|
35
|
+
/**
|
|
36
|
+
* The instance the bridge uses.
|
|
37
|
+
*
|
|
38
|
+
* ★ Module scope is deliberate and is what makes this survive a remount. It is
|
|
39
|
+
* shared by every panel on the page, which is safe: run ids carry the
|
|
40
|
+
* conversation id, so two panels on two conversations cannot collide, and two
|
|
41
|
+
* panels on the SAME conversation are the same run and want the same answer.
|
|
42
|
+
*/
|
|
43
|
+
export declare const runIdentities: RunIdentityCache;
|
|
44
|
+
//# sourceMappingURL=runIdentity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runIdentity.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/preview/runIdentity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAwBxE,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC;IACtC;;;;;;;;;;;;;;;;;;OAkBG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC;IAC7C,yDAAyD;IACzD,IAAI,IAAI,MAAM,CAAC;CAChB;AAED,wBAAgB,sBAAsB,CACpC,SAAS,GAAE,MAAM,YAAkC,EACnD,KAAK,GAAE,MAAsB;AAC7B,mEAAmE;AACnE,GAAG,GAAE,MAAM,MAAiB,EAC5B,QAAQ,GAAE,MAA2B,GACpC,gBAAgB,CAgDlB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,kBAA2B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { currentPreviewOwner as e } from "./surfaceState.js";
|
|
2
|
+
//#region src/shared/assistant/preview/runIdentity.ts
|
|
3
|
+
var t = 14400 * 1e3, n = 512;
|
|
4
|
+
function r(r = e, i = n, a = Date.now, o = t) {
|
|
5
|
+
let s = /* @__PURE__ */ new Map();
|
|
6
|
+
return {
|
|
7
|
+
ownerFor(e) {
|
|
8
|
+
let t = s.get(e);
|
|
9
|
+
if (t) return t.at = a(), s.delete(e), s.set(e, t), t.owner;
|
|
10
|
+
let n = r();
|
|
11
|
+
s.set(e, {
|
|
12
|
+
owner: n,
|
|
13
|
+
at: a()
|
|
14
|
+
});
|
|
15
|
+
let c = a() - o;
|
|
16
|
+
for (let [e, t] of s) t.at <= c && s.delete(e);
|
|
17
|
+
for (; s.size > i;) {
|
|
18
|
+
let e = s.keys().next();
|
|
19
|
+
if (e.done) break;
|
|
20
|
+
s.delete(e.value);
|
|
21
|
+
}
|
|
22
|
+
return n;
|
|
23
|
+
},
|
|
24
|
+
ownerForSettled(e) {
|
|
25
|
+
let t = s.get(e);
|
|
26
|
+
return t ? (s.delete(e), t.owner) : r();
|
|
27
|
+
},
|
|
28
|
+
size: () => s.size
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
var i = r();
|
|
32
|
+
//#endregion
|
|
33
|
+
export { r as createRunIdentityCache, i as runIdentities };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { AssistantToolStep } from '../ui/AssistantToolActivity';
|
|
2
|
+
import { AssistantPreviewEvent, AssistantPreviewRun } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The state a product's preview surface shows, and the rules for changing it.
|
|
5
|
+
*
|
|
6
|
+
* ★★★ WHY THIS IS HERE AND NOT IN EACH APP. It was written twice — once in
|
|
7
|
+
* HealthyBowl, once in VibeControls — and over five review rounds the SAME nine
|
|
8
|
+
* defects were found and fixed in both copies, four of them cross-account leaks.
|
|
9
|
+
* Three were introduced by the fix for the previous one. The surface itself is
|
|
10
|
+
* rightly per-product (its copy, its testids, its markdown); the state machine
|
|
11
|
+
* underneath is not, and every day it stayed duplicated it cost two fixes and
|
|
12
|
+
* risked them diverging.
|
|
13
|
+
*
|
|
14
|
+
* What a product still owns: what the reading view LOOKS like. What it no longer
|
|
15
|
+
* owns: deciding which events may write to it.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* ★ `ended` is the run finishing in a way THIS version does not recognise.
|
|
19
|
+
* fe-libs owns `outcome`, so a future one can reach an app that has not been
|
|
20
|
+
* rebuilt. Without a named phase for it the phase became whatever string
|
|
21
|
+
* arrived, and a product's status lookup returned `undefined`.
|
|
22
|
+
*/
|
|
23
|
+
export type PreviewPhase = "idle" | "generating" | "complete" | "error" | "abandoned" | "ended";
|
|
24
|
+
/**
|
|
25
|
+
* Who an answer belongs to.
|
|
26
|
+
*
|
|
27
|
+
* ★★ A STRUCT, NOT A `workspaceId|actorId` STRING. Both apps carried the string
|
|
28
|
+
* form and had to split it to compare halves, which is how one of them ended up
|
|
29
|
+
* validating only the workspace and letting a second account in the same
|
|
30
|
+
* workspace read the first one's answer.
|
|
31
|
+
*/
|
|
32
|
+
export interface PreviewOwner {
|
|
33
|
+
readonly workspaceId: string | null;
|
|
34
|
+
readonly actorId: string | null;
|
|
35
|
+
}
|
|
36
|
+
export interface PreviewState {
|
|
37
|
+
readonly phase: PreviewPhase;
|
|
38
|
+
readonly content: string;
|
|
39
|
+
readonly error: string | null;
|
|
40
|
+
/** The identity this content belongs to. Never inherited across a change. */
|
|
41
|
+
readonly owner: PreviewOwner;
|
|
42
|
+
/**
|
|
43
|
+
* ★★★ THE RUN THIS CONTENT CAME FROM — `null` when nothing is in flight.
|
|
44
|
+
*
|
|
45
|
+
* Content may only be written for the run currently in flight. That single
|
|
46
|
+
* rule closes three separate ways the wrong text reached a user:
|
|
47
|
+
* a snapshot still arriving from an interrupted turn overwriting the new
|
|
48
|
+
* answer; a late terminal event ending a turn that was still streaming; and
|
|
49
|
+
* an event from a previous account being relabelled as the current one's,
|
|
50
|
+
* because a surface reads identity at DELIVERY time.
|
|
51
|
+
*/
|
|
52
|
+
readonly runId: string | null;
|
|
53
|
+
/**
|
|
54
|
+
* ★★ What the assistant has been DOING, not just what it has said.
|
|
55
|
+
*
|
|
56
|
+
* Carried so a surface can render progress — a step rail, a spinner per tool —
|
|
57
|
+
* rather than only the prose. Without it the capability could express "the
|
|
58
|
+
* answer, wider" and nothing else, which is why a "watch it build" surface
|
|
59
|
+
* could not be based on it. Empty for a run that has called no tools, and
|
|
60
|
+
* cleared by `start` so one run's activity never decorates the next.
|
|
61
|
+
*/
|
|
62
|
+
readonly steps: readonly AssistantToolStep[];
|
|
63
|
+
}
|
|
64
|
+
export declare const NO_OWNER: PreviewOwner;
|
|
65
|
+
export declare const IDLE_PREVIEW: PreviewState;
|
|
66
|
+
/** The identity as it is NOW. Read at delivery; never cached. */
|
|
67
|
+
export declare function currentPreviewOwner(): PreviewOwner;
|
|
68
|
+
export declare function sameOwner(a: PreviewOwner, b: PreviewOwner): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Did this run START under this identity?
|
|
71
|
+
*
|
|
72
|
+
* ★★★ BOTH HALVES, which is the whole reason `actorId` was added to
|
|
73
|
+
* `AssistantPreviewRun`. Checking only the workspace left two accounts sharing
|
|
74
|
+
* one workspace indistinguishable: a late `start` from the previous actor was
|
|
75
|
+
* adopted under the new one, and every snapshot after it then matched the run id
|
|
76
|
+
* and painted the previous actor's answer. That case was not closeable in an app
|
|
77
|
+
* at all — the run carried no actor to compare.
|
|
78
|
+
*/
|
|
79
|
+
export declare function runBelongsTo(run: AssistantPreviewRun, owner: PreviewOwner): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* The reducer. Pure, so it can be tested without React or a DOM.
|
|
82
|
+
*
|
|
83
|
+
* ★ `abandoned` is NOT an error. The user interrupted their own turn; showing a
|
|
84
|
+
* failure for that blames them for their own decision. It keeps the text that
|
|
85
|
+
* arrived and says it stopped.
|
|
86
|
+
*/
|
|
87
|
+
export declare function applyPreviewEvent(state: PreviewState, event: AssistantPreviewEvent, owner: PreviewOwner): PreviewState;
|
|
88
|
+
/**
|
|
89
|
+
* The store a product's reading view subscribes to.
|
|
90
|
+
*
|
|
91
|
+
* ★★ EXTERNAL, read through `useSyncExternalStore`. The controller handed to the
|
|
92
|
+
* panel must stay STABLE across renders — the bridge deliberately does not reset
|
|
93
|
+
* on controller identity — so a surface cannot hold its state in a closure the
|
|
94
|
+
* controller captures.
|
|
95
|
+
*/
|
|
96
|
+
export interface AssistantPreviewSurface {
|
|
97
|
+
subscribe(listener: () => void): () => void;
|
|
98
|
+
getSnapshot(): PreviewState;
|
|
99
|
+
/**
|
|
100
|
+
* Reduce an event and publish. ★ The owner is derived HERE, once, so no
|
|
101
|
+
* product can forget to do it or do it differently.
|
|
102
|
+
*/
|
|
103
|
+
deliver(event: AssistantPreviewEvent): void;
|
|
104
|
+
/** Clear. Call when the identity changes. */
|
|
105
|
+
reset(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Re-check the owner and NOTIFY if it changed.
|
|
108
|
+
*
|
|
109
|
+
* ★★★ THE NOTIFICATION PATH THAT `getSnapshot` IS NOT. `getSnapshot` clears
|
|
110
|
+
* on read, which protects any reader that re-renders — but nothing makes it
|
|
111
|
+
* re-render: `getWorkspaceId()`/`getActorId()` are imperative reads of the
|
|
112
|
+
* URL, storage and the JWT, with no change event for the store to subscribe
|
|
113
|
+
* to, and a surface component need not consume the auth context that did
|
|
114
|
+
* change. So on an account switch with no preview event and no unrelated
|
|
115
|
+
* render, the previous owner's answer stayed painted.
|
|
116
|
+
*
|
|
117
|
+
* ★ Products call this from the effect they already key on their auth /
|
|
118
|
+
* workspace context. It is a no-op when the owner has not changed, which is
|
|
119
|
+
* why it is safe to call on every such tick and why it is preferable to
|
|
120
|
+
* `reset()` there — `reset()` would also wipe a live run of the SAME owner
|
|
121
|
+
* whenever an unrelated part of that context ticked.
|
|
122
|
+
*
|
|
123
|
+
* @returns whether the owner had changed (and subscribers were notified).
|
|
124
|
+
*/
|
|
125
|
+
syncOwner(): boolean;
|
|
126
|
+
}
|
|
127
|
+
export declare function createAssistantPreviewSurface(
|
|
128
|
+
/**
|
|
129
|
+
* ★ Injectable so this can be tested without a DOM — `currentPreviewOwner()`
|
|
130
|
+
* reads `window.location`, which a pure test run does not have.
|
|
131
|
+
*/
|
|
132
|
+
readOwner?: () => PreviewOwner): AssistantPreviewSurface;
|
|
133
|
+
//# sourceMappingURL=surfaceState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surfaceState.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/preview/surfaceState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,YAAY,GACZ,UAAU,GACV,OAAO,GACP,WAAW,GACX,OAAO,CAAC;AAEZ;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;;;;;OAQG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC9C;AAED,eAAO,MAAM,QAAQ,EAAE,YAAmD,CAAC;AAE3E,eAAO,MAAM,YAAY,EAAE,YAO1B,CAAC;AAEF,iEAAiE;AACjE,wBAAgB,mBAAmB,IAAI,YAAY,CAOlD;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,OAAO,CAEnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,mBAAmB,EACxB,KAAK,EAAE,YAAY,GAClB,OAAO,CAET;AAUD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,qBAAqB,EAC5B,KAAK,EAAE,YAAY,GAClB,YAAY,CAyCd;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5C,WAAW,IAAI,YAAY,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC5C,6CAA6C;IAC7C,KAAK,IAAI,IAAI,CAAC;IACd;;;;;;;;;;;;;;;;;;OAkBG;IACH,SAAS,IAAI,OAAO,CAAC;CACtB;AAED,wBAAgB,6BAA6B;AAC3C;;;GAGG;AACH,SAAS,GAAE,MAAM,YAAkC,GAClD,uBAAuB,CAqEzB"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { getActorId as e, getWorkspaceId as t } from "../context.js";
|
|
2
|
+
//#region src/shared/assistant/preview/surfaceState.ts
|
|
3
|
+
var n = {
|
|
4
|
+
workspaceId: null,
|
|
5
|
+
actorId: null
|
|
6
|
+
}, r = {
|
|
7
|
+
phase: "idle",
|
|
8
|
+
content: "",
|
|
9
|
+
error: null,
|
|
10
|
+
owner: n,
|
|
11
|
+
runId: null,
|
|
12
|
+
steps: []
|
|
13
|
+
};
|
|
14
|
+
function i() {
|
|
15
|
+
return {
|
|
16
|
+
workspaceId: t() || null,
|
|
17
|
+
actorId: e()
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function a(e, t) {
|
|
21
|
+
return e.workspaceId === t.workspaceId && e.actorId === t.actorId;
|
|
22
|
+
}
|
|
23
|
+
function o(e, t) {
|
|
24
|
+
return e.workspaceId === t.workspaceId && e.actorId === t.actorId;
|
|
25
|
+
}
|
|
26
|
+
var s = new Set([
|
|
27
|
+
"complete",
|
|
28
|
+
"error",
|
|
29
|
+
"abandoned"
|
|
30
|
+
]);
|
|
31
|
+
function c(e, t, n) {
|
|
32
|
+
let i = a(e.owner, n) ? e : {
|
|
33
|
+
...r,
|
|
34
|
+
owner: n
|
|
35
|
+
};
|
|
36
|
+
switch (t.kind) {
|
|
37
|
+
case "start": return o(t.run, n) ? {
|
|
38
|
+
phase: "generating",
|
|
39
|
+
content: "",
|
|
40
|
+
error: null,
|
|
41
|
+
owner: n,
|
|
42
|
+
runId: t.run.runId,
|
|
43
|
+
steps: []
|
|
44
|
+
} : i;
|
|
45
|
+
case "snapshot": return i.runId === null || t.run.runId !== i.runId ? i : {
|
|
46
|
+
...i,
|
|
47
|
+
content: t.content,
|
|
48
|
+
steps: t.steps,
|
|
49
|
+
owner: n
|
|
50
|
+
};
|
|
51
|
+
case "end": return i.runId === null || t.run.runId !== i.runId ? i : {
|
|
52
|
+
phase: s.has(t.outcome) ? t.outcome : "ended",
|
|
53
|
+
content: i.content,
|
|
54
|
+
error: t.error,
|
|
55
|
+
owner: n,
|
|
56
|
+
runId: null,
|
|
57
|
+
steps: i.steps
|
|
58
|
+
};
|
|
59
|
+
default: return i;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function l(e = i) {
|
|
63
|
+
let t = r, n = /* @__PURE__ */ new Set(), o = (e) => {
|
|
64
|
+
t = e;
|
|
65
|
+
for (let e of n) e();
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
subscribe(e) {
|
|
69
|
+
return n.add(e), () => {
|
|
70
|
+
n.delete(e);
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
getSnapshot() {
|
|
74
|
+
return a(t.owner, e()) || (t = r), t;
|
|
75
|
+
},
|
|
76
|
+
deliver(n) {
|
|
77
|
+
o(c(t, n, e()));
|
|
78
|
+
},
|
|
79
|
+
reset() {
|
|
80
|
+
o(r);
|
|
81
|
+
},
|
|
82
|
+
syncOwner() {
|
|
83
|
+
let n = e();
|
|
84
|
+
return a(t.owner, n) ? !1 : (o({
|
|
85
|
+
...r,
|
|
86
|
+
owner: n
|
|
87
|
+
}), !0);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { r as IDLE_PREVIEW, n as NO_OWNER, c as applyPreviewEvent, l as createAssistantPreviewSurface, i as currentPreviewOwner, o as runBelongsTo, a as sameOwner };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { AssistantToolStep } from '../ui/AssistantToolActivity';
|
|
2
3
|
/**
|
|
3
4
|
* One logical run.
|
|
4
5
|
*
|
|
@@ -21,6 +22,20 @@ export interface AssistantPreviewRun {
|
|
|
21
22
|
* workspace it never ran in.
|
|
22
23
|
*/
|
|
23
24
|
readonly workspaceId: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* ★★★ The ACTOR as it was when the run started, for the same reason — and
|
|
27
|
+
* because the workspace alone is not an identity.
|
|
28
|
+
*
|
|
29
|
+
* Added after a surface that validated only `workspaceId` was found to let a
|
|
30
|
+
* second account in the SAME workspace read the first one's answer: a late
|
|
31
|
+
* `start` from the previous actor was adopted under the new one, and every
|
|
32
|
+
* snapshot after it matched the run id. That case could not be fixed in the
|
|
33
|
+
* consuming app at all, because the run carried no actor to compare against.
|
|
34
|
+
*
|
|
35
|
+
* `null` where there is no signed-in actor, which is a real state rather than
|
|
36
|
+
* a missing value — two runs both lacking an actor are the same identity.
|
|
37
|
+
*/
|
|
38
|
+
readonly actorId: string | null;
|
|
24
39
|
}
|
|
25
40
|
/**
|
|
26
41
|
* ★★ SPOKEN TURNS ARE INCLUDED, deliberately. Voice and typed turns share one
|
|
@@ -50,7 +65,25 @@ export type AssistantPreviewEvent = {
|
|
|
50
65
|
} | {
|
|
51
66
|
kind: "snapshot";
|
|
52
67
|
run: AssistantPreviewRun;
|
|
68
|
+
/**
|
|
69
|
+
* ★★ THE PROSE, with the tool-activity lines REMOVED.
|
|
70
|
+
*
|
|
71
|
+
* The assistant's raw message interleaves `Running: <tool>` /
|
|
72
|
+
* `Completed: <tool>` lines with the answer; the transcript splits them
|
|
73
|
+
* out with `parseToolActivity` and renders them as an activity card. The
|
|
74
|
+
* preview used to receive the raw content and render those lines as if
|
|
75
|
+
* they were part of the answer.
|
|
76
|
+
*/
|
|
53
77
|
content: string;
|
|
78
|
+
/**
|
|
79
|
+
* ★★ The same lines, structured — so a surface can show PROGRESS as well
|
|
80
|
+
* as prose.
|
|
81
|
+
*
|
|
82
|
+
* Without this a product could only ever render the answer, which is why
|
|
83
|
+
* a "watch it build" surface (BigConsole has one) could not be based on
|
|
84
|
+
* this capability at all. Empty for a run that has called no tools.
|
|
85
|
+
*/
|
|
86
|
+
steps: readonly AssistantToolStep[];
|
|
54
87
|
} | {
|
|
55
88
|
kind: "end";
|
|
56
89
|
run: AssistantPreviewRun;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/preview/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/preview/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,mBAAmB,CAAA;CAAE,GAC3C;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,mBAAmB,CAAC;IACzB;;;;;;;;OAQG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACrC,GACD;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,mBAAmB,CAAC;IACzB;;;;;;;;OAQG;IACH,OAAO,EAAE,UAAU,GAAG,OAAO,GAAG,WAAW,CAAC;IAC5C;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEN;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;;;;;;OASG;IACH,MAAM,EAAE,MAAM,SAAS,CAAC;IAExB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAEjD,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAssistantPreviewBridge.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/preview/useAssistantPreviewBridge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAssistantPreviewBridge.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/preview/useAssistantPreviewBridge.ts"],"names":[],"mappings":"AA0CA,OAAO,KAAK,EAAE,0BAA0B,EAAyB,MAAM,SAAS,CAAC;AA2CjF,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,0BAA0B,GAAG,IAAI,GAC5C,IAAI,CA0MN"}
|