@blocklet/pages-kit 0.2.351 → 0.2.352

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.
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AgentErrorView = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const api_1 = require("@blocklet/ai-kit/api");
6
+ const components_1 = require("@blocklet/ai-kit/components");
5
7
  const material_1 = require("@mui/material");
6
8
  const react_error_boundary_1 = require("react-error-boundary");
7
9
  const locale_1 = require("../../../locale");
@@ -16,6 +18,9 @@ function AgentErrorView({ error }) {
16
18
  if (error.type === 'MissingSecretError') {
17
19
  return (0, jsx_runtime_1.jsx)(MissingSecretErrorView, {});
18
20
  }
21
+ if (error.type === api_1.SubscriptionErrorType.UNSUBSCRIBED) {
22
+ return (0, jsx_runtime_1.jsx)(components_1.SubscribeErrorAlert, { error: error });
23
+ }
19
24
  return (0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", children: String(error === null || error === void 0 ? void 0 : error.message) });
20
25
  }
21
26
  exports.AgentErrorView = AgentErrorView;
@@ -21,6 +21,7 @@ const react_1 = require("react");
21
21
  const react_wrap_balancer_1 = __importDefault(require("react-wrap-balancer"));
22
22
  const CustomComponentRenderer_1 = __importDefault(require("../../../../../components/CustomComponentRenderer"));
23
23
  const locale_1 = require("../../../../locale");
24
+ const AgentErrorBoundary_1 = require("../../components/AgentErrorBoundary");
24
25
  const SimpleHeader_1 = __importDefault(require("../../components/Header/SimpleHeader"));
25
26
  const LoadingButton_1 = __importDefault(require("../../components/LoadingButton"));
26
27
  const ActiveAgent_1 = require("../../contexts/ActiveAgent");
@@ -61,5 +62,5 @@ const OutputItemView = (0, react_1.memo)(({ message }) => {
61
62
  const { appearanceOutput } = (0, use_appearances_1.default)({ agentId: message.agentId });
62
63
  if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
63
64
  return null;
64
- return ((0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: message.agentId, children: (0, jsx_runtime_1.jsx)(CurrentMessage_1.default, { message: message, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties }) }) }) }, message.id));
65
+ return ((0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: message.agentId, children: (0, jsx_runtime_1.jsx)(CurrentMessage_1.default, { message: message, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorBoundary_1.AgentErrorView }, message.id) }) }) }, message.id));
65
66
  });
@@ -60,7 +60,7 @@ const MessageView = (0, react_1.memo)(({ message }) => {
60
60
  const { hideAgentAvatar, hideUserInputs } = (_b = (0, ComponentPreferences_1.useComponentPreferences)()) !== null && _b !== void 0 ? _b : {};
61
61
  if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
62
62
  return null;
63
- const agentMessage = ((0, jsx_runtime_1.jsx)(MessageBodyContainer, { messageRole: "assistant", children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorBoundary_1.AgentErrorView }) }));
63
+ const agentMessage = ((0, jsx_runtime_1.jsx)(MessageBodyContainer, { messageRole: "assistant", children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorBoundary_1.AgentErrorView }, message.id) }));
64
64
  return ((0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: message.agentId, children: (0, jsx_runtime_1.jsx)(CurrentMessage_1.default, { message: message, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: 2, children: [!hideUserInputs && ((0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(UserInfo_1.default, { name: (_c = authSession.user) === null || _c === void 0 ? void 0 : _c.fullName, did: (_d = authSession.user) === null || _d === void 0 ? void 0 : _d.did, avatar: (_e = authSession.user) === null || _e === void 0 ? void 0 : _e.avatar, time: message.createdAt, reverse: true, alignItems: "flex-start", UserNameProps: { sx: { color: hasBg ? 'white' : undefined } }, children: (0, jsx_runtime_1.jsx)(material_1.Stack, { sx: { alignItems: 'flex-end' }, children: (0, jsx_runtime_1.jsx)(MessageBodyContainer, { messageRole: "user", children: (0, jsx_runtime_1.jsx)(UserMessageView_1.default, {}) }) }) }) })), (0, jsx_runtime_1.jsx)(material_1.Box, { children: !hideAgentAvatar ? ((0, jsx_runtime_1.jsx)(UserInfo_1.default, { name: profile.name, did: (_f = globalThis.blocklet) === null || _f === void 0 ? void 0 : _f.appId, avatar: profile.avatar, time: message.createdAt, alignItems: "flex-start", UserNameProps: { sx: { color: hasBg ? 'white' : undefined } }, children: agentMessage })) : (agentMessage) })] }) }) }));
65
65
  });
66
66
  exports.default = MessageView;
@@ -49,5 +49,5 @@ const OutputItemView = (0, react_1.memo)(({ message }) => {
49
49
  const { appearanceOutput } = (0, use_appearances_1.default)({ agentId: message.agentId });
50
50
  if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
51
51
  return null;
52
- return ((0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: message.agentId, children: (0, jsx_runtime_1.jsx)(CurrentMessage_1.default, { message: message, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorBoundary_1.AgentErrorView }) }) }) }));
52
+ return ((0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: message.agentId, children: (0, jsx_runtime_1.jsx)(CurrentMessage_1.default, { message: message, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorBoundary_1.AgentErrorView }, message.id) }) }) }));
53
53
  });
@@ -21,6 +21,7 @@ const material_1 = require("@mui/material");
21
21
  const react_2 = require("react");
22
22
  const CustomComponentRenderer_1 = __importDefault(require("../../../../../components/CustomComponentRenderer"));
23
23
  const locale_1 = require("../../../../locale");
24
+ const AgentErrorBoundary_1 = require("../../components/AgentErrorBoundary");
24
25
  const ActiveAgent_1 = require("../../contexts/ActiveAgent");
25
26
  const CurrentAgent_1 = __importDefault(require("../../contexts/CurrentAgent"));
26
27
  const CurrentMessage_1 = __importDefault(require("../../contexts/CurrentMessage"));
@@ -298,5 +299,5 @@ function AgentOutputRender({ message }) {
298
299
  const { appearanceOutput } = (0, use_appearances_1.default)();
299
300
  if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId) || !message)
300
301
  return null;
301
- return ((0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: message.agentId, children: (0, jsx_runtime_1.jsx)(CurrentMessage_1.default, { message: message, children: (0, jsx_runtime_1.jsx)(react_2.Suspense, { children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties }) }) }) }));
302
+ return ((0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: message.agentId, children: (0, jsx_runtime_1.jsx)(CurrentMessage_1.default, { message: message, children: (0, jsx_runtime_1.jsx)(react_2.Suspense, { children: (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorBoundary_1.AgentErrorView }, message.id) }) }) }));
302
303
  }