@blocklet/pages-kit 0.2.381 → 0.2.383

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.
@@ -9,5 +9,5 @@ function useIsAgentAdmin(agent) {
9
9
  return false;
10
10
  if (ADMIN_ROLES.includes(session.user.role))
11
11
  return true;
12
- return session.user.did === agent.createdBy;
12
+ return session.user.did === agent.createdBy || session.user.did === agent.project.createdBy;
13
13
  }
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -9,7 +32,7 @@ const types_1 = require("@blocklet/ai-runtime/types");
9
32
  const material_1 = require("@mui/material");
10
33
  const react_1 = require("react");
11
34
  const CustomComponentRenderer_1 = __importDefault(require("../../../../../components/CustomComponentRenderer"));
12
- const AgentErrorBoundary_1 = __importDefault(require("../../components/AgentErrorBoundary"));
35
+ const AgentErrorBoundary_1 = __importStar(require("../../components/AgentErrorBoundary"));
13
36
  const constants_1 = require("../../constants");
14
37
  const ComponentPreferences_1 = require("../../contexts/ComponentPreferences");
15
38
  const CurrentAgent_1 = require("../../contexts/CurrentAgent");
@@ -25,8 +48,6 @@ function SimpleOutput() {
25
48
  const preferences = (0, ComponentPreferences_1.useComponentPreferences)();
26
49
  const CustomComponentActionsComponent = preferences === null || preferences === void 0 ? void 0 : preferences.customOutputActionsComponent;
27
50
  const { message } = (0, CurrentMessage_1.useCurrentMessage)();
28
- if (message.error)
29
- throw message.error;
30
51
  const { agent } = (0, CurrentAgent_1.useCurrentAgent)();
31
52
  const outputs = (0, react_1.useMemo)(() => {
32
53
  var _a;
@@ -44,5 +65,5 @@ function SimpleOutput() {
44
65
  ((_d = (_c = (_b = message.outputs) === null || _b === void 0 ? void 0 : _b.objects) === null || _c === void 0 ? void 0 : _c.find((i) => i === null || i === void 0 ? void 0 : i[types_1.RuntimeOutputVariable.text])) === null || _d === void 0 ? void 0 : _d[types_1.RuntimeOutputVariable.text])
45
66
  : (_g = (_f = (_e = message.outputs) === null || _e === void 0 ? void 0 : _e.objects) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g[output.name];
46
67
  return ((0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { instanceId: output.id, componentId: output.appearance.componentId, properties: output.appearance.componentProperties, props: Object.assign({ output, outputValue: value, writing: output.name === types_1.RuntimeOutputVariable.text && message.loading }, (((_h = output === null || output === void 0 ? void 0 : output.appearance) === null || _h === void 0 ? void 0 : _h.componentProps) || {})) }, output.id));
47
- }), CustomComponentActionsComponent && ((0, jsx_runtime_1.jsx)(AgentErrorBoundary_1.default, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(CustomComponentActionsComponent, {}) }) }))] }));
68
+ }), message.error && (0, jsx_runtime_1.jsx)(AgentErrorBoundary_1.AgentErrorView, { error: message.error }), CustomComponentActionsComponent && ((0, jsx_runtime_1.jsx)(AgentErrorBoundary_1.default, { children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(CustomComponentActionsComponent, {}) }) }))] }));
48
69
  }
@@ -336,11 +336,15 @@ const createSessionState = ({ aid }) => {
336
336
  }
337
337
  catch (error) {
338
338
  set((state) => {
339
- var _a;
339
+ var _a, _b;
340
340
  const s = (_a = state.sessionMap) === null || _a === void 0 ? void 0 : _a[sessionId];
341
341
  if (!s)
342
342
  return;
343
- s.error = error;
343
+ const msg = message ? (_b = s.messages) === null || _b === void 0 ? void 0 : _b.findLast((i) => i.id === message.id) : undefined;
344
+ if (msg)
345
+ msg.error = error;
346
+ else
347
+ s.error = error;
344
348
  });
345
349
  }
346
350
  finally {