@blocklet/pages-kit 0.2.344 → 0.2.345
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/lib/cjs/builtin/async/ai-runtime/hooks/use-agent-admin.js +3 -0
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +2 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime/hooks/use-agent-admin.js +3 -0
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +2 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/builtin/session.d.ts +1 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useIsAgentAdmin = void 0;
|
|
4
4
|
const session_1 = require("../../../session");
|
|
5
|
+
const ADMIN_ROLES = ['admin', 'owner'];
|
|
5
6
|
function useIsAgentAdmin(agent) {
|
|
6
7
|
const { session } = (0, session_1.useSessionContext)();
|
|
7
8
|
if (!session.user)
|
|
8
9
|
return false;
|
|
10
|
+
if (ADMIN_ROLES.includes(session.user.role))
|
|
11
|
+
return true;
|
|
9
12
|
return session.user.did === agent.createdBy;
|
|
10
13
|
}
|
|
11
14
|
exports.useIsAgentAdmin = useIsAgentAdmin;
|
|
@@ -19,6 +19,7 @@ const material_1 = require("@mui/material");
|
|
|
19
19
|
const react_1 = require("react");
|
|
20
20
|
const react_wrap_balancer_1 = __importDefault(require("react-wrap-balancer"));
|
|
21
21
|
const CustomComponentRenderer_1 = __importDefault(require("../../../../../components/CustomComponentRenderer"));
|
|
22
|
+
const AgentErrorBoundary_1 = require("../../components/AgentErrorBoundary");
|
|
22
23
|
const SimpleHeader_1 = __importDefault(require("../../components/Header/SimpleHeader"));
|
|
23
24
|
const SimpleLayout_1 = __importDefault(require("../../components/Layout/SimpleLayout"));
|
|
24
25
|
const ActiveAgent_1 = require("../../contexts/ActiveAgent");
|
|
@@ -48,5 +49,5 @@ const OutputItemView = (0, react_1.memo)(({ message }) => {
|
|
|
48
49
|
const { appearanceOutput } = (0, use_appearances_1.default)({ agentId: message.agentId });
|
|
49
50
|
if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
|
|
50
51
|
return null;
|
|
51
|
-
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 }) }) }) }));
|
|
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
53
|
});
|