@40rty/ams-sdk 0.4.3 → 0.4.4

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/index.js CHANGED
@@ -6772,6 +6772,8 @@ function useConversationPage() {
6772
6772
  const session = useFourtySession();
6773
6773
  const reply = useTurnAskReply();
6774
6774
  const presence = useConversationPresence();
6775
+ const suggestions = useSuggestionsWithDefaults();
6776
+ const followUp = useComposerChipSelect();
6775
6777
  const onWelcomePage = React16.useMemo(
6776
6778
  () => seedLayout !== null && JSON.stringify(layout) === JSON.stringify(seedLayout),
6777
6779
  [layout, seedLayout]
@@ -6785,12 +6787,15 @@ function useConversationPage() {
6785
6787
  if (live !== null) phase = liveTurnTouched(layout, live, messages) ? "composing" : "thinking";
6786
6788
  const inConversation = messages.length > 0 || pending2 !== null;
6787
6789
  const canvasHidden = inConversation && onWelcomePage && !away;
6788
- const base = { phase, hasPage, canvasHidden, presence, reply, goHome, startOver: session.newConversation, visitedHome: onWelcomePage && away };
6790
+ const noFollowUps = [];
6791
+ const base = { phase, hasPage, canvasHidden, presence, reply, followUp, followUps: noFollowUps, goHome, startOver: session.newConversation, visitedHome: onWelcomePage && away };
6789
6792
  if (shown === void 0 || onSeedHome && live === null && !away) {
6790
6793
  return { ...base, place: "welcome", turn: null, crumbs: [] };
6791
6794
  }
6792
6795
  const newest = messages.length === 0 ? void 0 : messages[messages.length - 1];
6793
6796
  const answer = splitAnswer(shown.streams.prose);
6797
+ const settledNewest = live === null && newest !== void 0 && newest.messageId === shown.messageId;
6798
+ const followUps = settledNewest && suggestions !== null ? suggestions.actions.filter((a) => typeof a.label === "string" && a.label.trim().length > 0) : [];
6794
6799
  const turn = {
6795
6800
  key: shown.messageId,
6796
6801
  index: shown.index,
@@ -6798,7 +6803,7 @@ function useConversationPage() {
6798
6803
  headline: answer.headline,
6799
6804
  body: answer.body,
6800
6805
  ask: shown.streams.ask,
6801
- answerable: live === null && newest !== void 0 && newest.messageId === shown.messageId,
6806
+ answerable: settledNewest,
6802
6807
  live: live !== null,
6803
6808
  failed: "error" in shown && shown.error !== void 0
6804
6809
  };
@@ -6811,7 +6816,7 @@ function useConversationPage() {
6811
6816
  { key: shown.messageId, kind: "turn", label: shown.visitorText, open: () => selectMessage(shown.index) },
6812
6817
  ...visited ? [] : [here]
6813
6818
  ];
6814
- return { ...base, place: "away", turn, crumbs: crumbs2 };
6819
+ return { ...base, place: "away", turn, crumbs: crumbs2, followUps };
6815
6820
  }
6816
6821
  const pages = pageTurns(messages, shown.index);
6817
6822
  const liveOpensPage = live !== null && phase === "composing" && !messages.some((m) => m.index === live.index);
@@ -6826,7 +6831,7 @@ function useConversationPage() {
6826
6831
  }))
6827
6832
  ];
6828
6833
  if (liveOpensPage) crumbs.push({ key: live.messageId, kind: "turn", label: live.visitorText, open: null });
6829
- return { ...base, place: "turn", turn, crumbs };
6834
+ return { ...base, place: "turn", turn, crumbs, followUps };
6830
6835
  }
6831
6836
 
6832
6837
  // src/shell/thread-scroll/headroom.ts
@@ -11903,7 +11908,7 @@ function useContentActions() {
11903
11908
  import { useEffect as useEffect19, useState as useState18 } from "react";
11904
11909
 
11905
11910
  // package.json
11906
- var version = "0.4.3";
11911
+ var version = "0.4.4";
11907
11912
 
11908
11913
  // src/host/host-modules.ts
11909
11914
  import * as react from "react";
@@ -1,4 +1,4 @@
1
- import type { TurnAsk } from '../../../../spacestation/src/index';
1
+ import type { SuggestionAction, TurnAsk } from '../../../../spacestation/src/index';
2
2
  import { type ConversationPresence } from './use-conversation-presence';
3
3
  /** Where the live turn is: not running, still thinking (the page is untouched), or composing the page. */
4
4
  export type ConversationPhase = 'idle' | 'thinking' | 'composing';
@@ -52,6 +52,14 @@ export interface ConversationPage {
52
52
  presence: ConversationPresence;
53
53
  /** Send one of `turn.ask`'s answers as the visitor's reply. */
54
54
  reply: (answer: string) => void;
55
+ /**
56
+ * The agent's follow-ups for the newest settled turn — the next moves a page
57
+ * can offer IN the page, under its answer. Empty while a turn runs, on an
58
+ * older turn, and on the welcome page. Chips without a label are dropped.
59
+ */
60
+ followUps: SuggestionAction[];
61
+ /** Take a follow-up — the same dispatch a composer chip makes. */
62
+ followUp: (action: SuggestionAction) => void;
55
63
  goHome: () => void;
56
64
  startOver: () => void;
57
65
  }
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  "react": "^18.3.0 || ^19.0.0",
27
27
  "react-dom": "^18.3.0 || ^19.0.0"
28
28
  },
29
- "version": "0.4.3",
29
+ "version": "0.4.4",
30
30
  "homepage": "https://docs.40rty.ai",
31
31
  "license": "UNLICENSED",
32
32
  "engines": {