@frankieai/react 0.2.7 → 0.2.8

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.cjs CHANGED
@@ -376,6 +376,7 @@ function useFrankieChatState() {
376
376
  const [error, setError] = (0, import_react.useState)(void 0);
377
377
  const [restored, setRestored] = (0, import_react.useState)(false);
378
378
  const [loadedSkills, setLoadedSkills] = (0, import_react.useState)(null);
379
+ const [activeApis, setActiveApis] = (0, import_react.useState)(null);
379
380
  const abortRef = (0, import_react.useRef)(null);
380
381
  const mounted = (0, import_react.useRef)(true);
381
382
  const messagesRef = (0, import_react.useRef)([]);
@@ -447,6 +448,7 @@ function useFrankieChatState() {
447
448
  const assistantId = nextId("a");
448
449
  setError(void 0);
449
450
  setLoadedSkills(null);
451
+ setActiveApis(null);
450
452
  setBusy(true);
451
453
  const next = [
452
454
  ...messagesRef.current,
@@ -477,6 +479,10 @@ function useFrankieChatState() {
477
479
  setLoadedSkills(event.skills);
478
480
  return;
479
481
  }
482
+ if (event.type === "tools_active") {
483
+ setActiveApis(event.apis);
484
+ return;
485
+ }
480
486
  if (event.type === "ping" || event.type === "session") return;
481
487
  if (event.type === "text_delta") receivedText = true;
482
488
  if (event.type === "tool_start" || event.type === "tool_end") receivedToolActivity = true;
@@ -527,12 +533,13 @@ function useFrankieChatState() {
527
533
  setBusy(false);
528
534
  setRestored(true);
529
535
  setLoadedSkills(null);
536
+ setActiveApis(null);
530
537
  try {
531
538
  if (client.persist) window.localStorage.removeItem(`${client.namespace}.messages`);
532
539
  } catch {
533
540
  }
534
541
  }, [client]);
535
- return { messages, busy, loadedSkills, restoring: !restored, ...error ? { error } : {}, send, stop, reset };
542
+ return { messages, busy, loadedSkills, activeApis, restoring: !restored, ...error ? { error } : {}, send, stop, reset };
536
543
  }
537
544
  function conversationTitle(messages) {
538
545
  const first = messages.find((message) => message.role === "user" && message.text.trim());
@@ -729,7 +736,7 @@ var import_lucide_react = require("lucide-react");
729
736
  var import_jsx_runtime6 = require("react/jsx-runtime");
730
737
  function AgentContext() {
731
738
  const { loading, configError } = useFrankie();
732
- const { loadedSkills, busy, restoring, error } = useFrankieChat();
739
+ const { loadedSkills, activeApis, busy, restoring, error } = useFrankieChat();
733
740
  const status = configError || error ? "Unavailable" : loading || restoring ? "Connecting" : busy && loadedSkills === null ? "Checking" : loadedSkills?.length ? "Active" : loadedSkills ? "Tools only" : "Ready";
734
741
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "frankie-agent-context-wrap", children: [
735
742
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("details", { className: "frankie-agent-context", children: [
@@ -752,7 +759,18 @@ function AgentContext() {
752
759
  skill.revision
753
760
  ] })
754
761
  ] }, skill.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "Frankie can use the tools approved for this workspace. Drafts and skills without available tools are not loaded." }),
755
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "Published skills and updates are checked on every message. Only approved, available tools can run." })
762
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "Published skills and updates are checked on every message. Only approved, available tools can run." }),
763
+ activeApis?.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: "frankie-active-apis", children: activeApis.map((api) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { children: [
764
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: api.name }),
765
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("small", { children: [
766
+ "spec ",
767
+ api.specHash,
768
+ " \xB7 ",
769
+ api.operationCount,
770
+ " ",
771
+ api.operationCount === 1 ? "operation" : "operations"
772
+ ] })
773
+ ] }, api.name)) }) : null
756
774
  ] })
757
775
  ] }),
758
776
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "frankie-sr-only", role: "status", children: loadedSkills === null ? status : `${loadedSkills.length} ${loadedSkills.length === 1 ? "skill" : "skills"} loaded. ${status}.` })