@40rty/ams-ui 0.3.1 → 0.4.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/dist/agent.js +5 -5
- package/dist/{chunk-MHUEIBJ3.js → chunk-GQURT3IR.js} +3 -47
- package/dist/{chunk-BFZ3YCUY.js → chunk-H6MSAD5M.js} +1 -40
- package/dist/{chunk-ORIOBWTD.js → chunk-PHXP2SKS.js} +5 -1
- package/dist/{chunk-OKP7MC72.js → chunk-RKPDCXL4.js} +241 -195
- package/dist/{chunk-TEPH476O.js → chunk-RMJDSHLA.js} +6 -36
- package/dist/hooks.js +4 -4
- package/dist/index.js +172 -338
- package/dist/presence.js +3 -4
- package/dist/shell.js +419 -570
- package/dist/thread-panel.js +3 -3
- package/dist/types/agent/presence/AgentAsk.d.ts +13 -0
- package/dist/types/agent/presence/index.d.ts +3 -1
- package/dist/types/agent/presence/read-data.d.ts +5 -0
- package/dist/types/components/ecommerce/cart/CartFoot.d.ts +1 -2
- package/dist/types/components/ecommerce/cart/CartLineRow.d.ts +1 -1
- package/dist/types/hooks/index.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/labels.d.ts +6 -0
- package/dist/types/shell/Composer.d.ts +1 -1
- package/dist/types/shell/ShellScaffold.d.ts +2 -1
- package/dist/types/shell/TurnAsk.d.ts +14 -0
- package/dist/types/shell/composer/AttachmentStrip.d.ts +1 -1
- package/dist/types/shell/dock-context.d.ts +1 -1
- package/dist/types/shell/index.d.ts +2 -2
- package/dist/types/shell/mobile/IslandComposeGroup.d.ts +1 -1
- package/dist/types/shell/mobile/IslandInputBar.d.ts +1 -1
- package/dist/types/shell/mobile/MorphIsland.d.ts +1 -1
- package/dist/types/shell/mobile/RestIsland.d.ts +1 -1
- package/dist/types/shell/slots.d.ts +1 -5
- package/package.json +3 -4
- package/dist/types/agent/presence/use-forget-fact.d.ts +0 -56
- package/dist/types/components/ecommerce/cart/use-cart-view.d.ts +0 -50
- package/dist/types/hooks/use-projection.d.ts +0 -24
- package/dist/types/shell/composer/heic-convert.d.ts +0 -6
- package/dist/types/shell/composer/useComposerAttachments.d.ts +0 -37
- package/dist/types/shell/composer/usePromptComposer.d.ts +0 -51
- package/dist/types/shell/use-dock-state.d.ts +0 -54
- package/dist/types/utils/use-is-seed-home.d.ts +0 -13
- package/dist/types/utils/use-safe-cart.d.ts +0 -17
- package/dist/types/utils/use-safe-facts.d.ts +0 -9
- package/dist/types/utils/use-safe-fourty-session.d.ts +0 -15
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
// src/agent/presence/read-data.ts
|
|
4
|
+
import { useVisibleFactList } from "@40rty/ams-sdk";
|
|
4
5
|
function factRegister(fact) {
|
|
5
6
|
if (fact.provenance === "recalled") return "recalled";
|
|
6
7
|
if (fact.provenance !== void 0) return "inferred";
|
|
@@ -34,37 +35,9 @@ function readLabel(frame) {
|
|
|
34
35
|
const l = Reflect.get(frame.data, "label");
|
|
35
36
|
return typeof l === "string" ? l : "";
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
// src/agent/presence/use-forget-fact.ts
|
|
39
|
-
import * as React from "react";
|
|
40
|
-
import { useFourtySession, useOptimisticFlowSet, useReconcileFlowSet, PRESENCE_FACT_DISMISS_SIGNAL } from "@40rty/ams-sdk";
|
|
41
|
-
var DISMISSED_FLOW = "presence.dismissed";
|
|
42
38
|
function useVisibleFacts(frame) {
|
|
43
39
|
return useVisibleFactList(frame !== null ? readFacts(frame) : []);
|
|
44
40
|
}
|
|
45
|
-
function useVisibleFactList(facts) {
|
|
46
|
-
const dismissed = useOptimisticFlowSet(DISMISSED_FLOW);
|
|
47
|
-
return facts.filter((f) => !dismissed.has(f.label));
|
|
48
|
-
}
|
|
49
|
-
var useUndismissedFacts = useVisibleFactList;
|
|
50
|
-
function useForgetFact() {
|
|
51
|
-
const { sendImmediateSignal } = useFourtySession();
|
|
52
|
-
const dismissed = useOptimisticFlowSet(DISMISSED_FLOW);
|
|
53
|
-
const forget = React.useCallback(
|
|
54
|
-
(f) => {
|
|
55
|
-
dismissed.add(f.label);
|
|
56
|
-
sendImmediateSignal({ type: PRESENCE_FACT_DISMISS_SIGNAL, payload: { label: f.label, value: f.value } });
|
|
57
|
-
},
|
|
58
|
-
[dismissed, sendImmediateSignal]
|
|
59
|
-
);
|
|
60
|
-
return { forget };
|
|
61
|
-
}
|
|
62
|
-
function useReconcileDismissed(presentLabels) {
|
|
63
|
-
useReconcileFlowSet(DISMISSED_FLOW, presentLabels);
|
|
64
|
-
}
|
|
65
|
-
function useDismissedLabels() {
|
|
66
|
-
return useOptimisticFlowSet(DISMISSED_FLOW);
|
|
67
|
-
}
|
|
68
41
|
|
|
69
42
|
// src/agent/presence/fact-rail.ts
|
|
70
43
|
var PRESENCE_FACT_LIMIT = 3;
|
|
@@ -180,19 +153,20 @@ function viewHasHeld(view) {
|
|
|
180
153
|
}
|
|
181
154
|
|
|
182
155
|
// src/agent/presence/use-band-facts.ts
|
|
183
|
-
import * as
|
|
156
|
+
import * as React from "react";
|
|
184
157
|
import { usePresenceElements, usePresenceLiveTurn } from "@40rty/ams-sdk";
|
|
158
|
+
import { useReconcileDismissed, useVisibleFactList as useVisibleFactList2 } from "@40rty/ams-sdk";
|
|
185
159
|
function useBandFacts() {
|
|
186
160
|
const elements = usePresenceElements();
|
|
187
161
|
const liveTurnId = usePresenceLiveTurn();
|
|
188
|
-
const rawView =
|
|
162
|
+
const rawView = React.useMemo(
|
|
189
163
|
() => derivePresenceView(elements, liveTurnId),
|
|
190
164
|
[elements, liveTurnId]
|
|
191
165
|
);
|
|
192
166
|
useReconcileDismissed(rawView.heldLabels.length > 0 ? rawView.heldLabels : null);
|
|
193
|
-
const all =
|
|
167
|
+
const all = useVisibleFactList2(rawView.facts);
|
|
194
168
|
const reachable = all;
|
|
195
|
-
const view =
|
|
169
|
+
const view = React.useMemo(
|
|
196
170
|
() => withCappedFacts(rawView, all, reachable, PRESENCE_FACT_LIMIT),
|
|
197
171
|
[rawView, all]
|
|
198
172
|
);
|
|
@@ -205,10 +179,6 @@ export {
|
|
|
205
179
|
factIdentity,
|
|
206
180
|
readLabel,
|
|
207
181
|
useVisibleFacts,
|
|
208
|
-
useVisibleFactList,
|
|
209
|
-
useUndismissedFacts,
|
|
210
|
-
useForgetFact,
|
|
211
|
-
useDismissedLabels,
|
|
212
182
|
PRESENCE_FACT_LIMIT,
|
|
213
183
|
PRESENCE_DURABLE_SLOTS,
|
|
214
184
|
derivePresenceView,
|
package/dist/hooks.js
CHANGED
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
submitOnEnter,
|
|
5
5
|
useDismissOnOutside,
|
|
6
6
|
useFocusOnChange,
|
|
7
|
+
useProjection,
|
|
7
8
|
useScrollThreshold,
|
|
8
9
|
useTextareaAutosize
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PHXP2SKS.js";
|
|
10
11
|
import {
|
|
11
12
|
useContainerWidth,
|
|
12
|
-
useFocusTrap
|
|
13
|
-
|
|
14
|
-
} from "./chunk-MHUEIBJ3.js";
|
|
13
|
+
useFocusTrap
|
|
14
|
+
} from "./chunk-GQURT3IR.js";
|
|
15
15
|
export {
|
|
16
16
|
activateOnSpaceEnter,
|
|
17
17
|
submitOnEnter,
|