@rizom/brain 0.2.0-alpha.150 → 0.2.0-alpha.151

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.
@@ -1,7 +1,5 @@
1
- import { z } from 'zod/v4';
2
- import { RouteDefinition, RouteDefinitionInput } from '@rizom/site';
3
- export { EntityDisplayEntry, NavigationItem, NavigationSlot, RouteDefinition, RouteDefinitionInput, SectionDefinition } from '@rizom/site';
4
-
1
+ import { z } from "zod/v4";
2
+ //#region ../../shell/templates/src/permission-service.d.ts
5
3
  /**
6
4
  * User permission level schema
7
5
  */
@@ -14,11 +12,11 @@ declare const UserPermissionLevelSchema: z.ZodType<UserPermissionLevel, UserPerm
14
12
  */
15
13
  type EntityActionRequiredLevel = "never" | UserPermissionLevel;
16
14
  interface EntityActionPolicyRule {
17
- create?: EntityActionRequiredLevel | undefined;
18
- update?: EntityActionRequiredLevel | undefined;
19
- delete?: EntityActionRequiredLevel | undefined;
20
- extract?: EntityActionRequiredLevel | undefined;
21
- publish?: EntityActionRequiredLevel | undefined;
15
+ create?: EntityActionRequiredLevel | undefined;
16
+ update?: EntityActionRequiredLevel | undefined;
17
+ delete?: EntityActionRequiredLevel | undefined;
18
+ extract?: EntityActionRequiredLevel | undefined;
19
+ publish?: EntityActionRequiredLevel | undefined;
22
20
  }
23
21
  type EntityActionPolicyRuleInput = EntityActionPolicyRule;
24
22
  type EntityActionPolicyConfigInput = Record<string, EntityActionPolicyRuleInput>;
@@ -26,25 +24,26 @@ type EntityActionPolicyConfigInput = Record<string, EntityActionPolicyRuleInput>
26
24
  * Generic interface for items with visibility
27
25
  */
28
26
  interface WithVisibility {
29
- visibility?: UserPermissionLevel;
27
+ visibility?: UserPermissionLevel;
30
28
  }
31
29
  /**
32
30
  * Permission rule for pattern-based permission matching
33
31
  */
34
32
  interface PermissionRule {
35
- pattern: string;
36
- level: UserPermissionLevel;
33
+ pattern: string;
34
+ level: UserPermissionLevel;
37
35
  }
38
36
  /**
39
37
  * Configuration for the permission system
40
38
  */
41
39
  interface PermissionConfig {
42
- anchors?: string[];
43
- trusted?: string[];
44
- rules?: PermissionRule[];
45
- entityActions?: EntityActionPolicyConfigInput;
40
+ anchors?: string[];
41
+ trusted?: string[];
42
+ rules?: PermissionRule[];
43
+ entityActions?: EntityActionPolicyConfigInput;
46
44
  }
47
-
45
+ //#endregion
46
+ //#region ../../shell/plugins/src/contracts/metadata.d.ts
48
47
  /**
49
48
  * Best-effort extension metadata carried across public DTO boundaries.
50
49
  *
@@ -53,93 +52,172 @@ interface PermissionConfig {
53
52
  * schema and keep this bag only as optional extension data.
54
53
  */
55
54
  declare const ExtensionMetadataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
56
-
57
- declare const MessageResponseSchema: z.ZodUnion<[
58
- z.ZodObject<{
59
- success: z.ZodBoolean;
60
- data: z.ZodOptional<z.ZodUnknown>;
61
- error: z.ZodOptional<z.ZodString>;
62
- }>,
63
- z.ZodObject<{
64
- noop: z.ZodLiteral<true>;
65
- }>
66
- ]>;
55
+ //#endregion
56
+ //#region ../../shell/plugins/src/contracts/messaging.d.ts
57
+ declare const MessageResponseSchema: z.ZodUnion<[z.ZodObject<{
58
+ success: z.ZodBoolean;
59
+ data: z.ZodOptional<z.ZodUnknown>;
60
+ error: z.ZodOptional<z.ZodString>;
61
+ }>, z.ZodObject<{
62
+ noop: z.ZodLiteral<true>;
63
+ }>]>;
67
64
  type MessageResponse<T = unknown> = ({
68
- success: boolean;
69
- error?: string | undefined;
65
+ success: boolean;
66
+ error?: string | undefined;
70
67
  } & {
71
- data?: T | undefined;
68
+ data?: T | undefined;
72
69
  }) | {
73
- noop: true;
70
+ noop: true;
74
71
  };
75
72
  declare const BaseMessageSchema: z.ZodObject<{
76
- id: z.ZodString;
77
- timestamp: z.ZodString;
78
- type: z.ZodString;
79
- source: z.ZodString;
80
- target: z.ZodOptional<z.ZodString>;
81
- metadata: z.ZodOptional<typeof ExtensionMetadataSchema>;
73
+ id: z.ZodString;
74
+ timestamp: z.ZodString;
75
+ type: z.ZodString;
76
+ source: z.ZodString;
77
+ target: z.ZodOptional<z.ZodString>;
78
+ metadata: z.ZodOptional<typeof ExtensionMetadataSchema>;
82
79
  }>;
83
80
  type BaseMessage = z.output<typeof BaseMessageSchema>;
84
81
  type MessageWithPayload<T = unknown> = BaseMessage & {
85
- payload: T;
82
+ payload: T;
86
83
  };
87
84
  interface MessageSendOptions {
88
- target?: string;
89
- metadata?: z.output<typeof ExtensionMetadataSchema>;
90
- broadcast?: boolean;
85
+ target?: string;
86
+ metadata?: z.output<typeof ExtensionMetadataSchema>;
87
+ broadcast?: boolean;
91
88
  }
92
89
  interface MessageSendRequest<T = unknown> extends MessageSendOptions {
93
- type: string;
94
- payload: T;
90
+ type: string;
91
+ payload: T;
95
92
  }
96
93
  type MessageSender<T = unknown, R = unknown> = (request: MessageSendRequest<T>) => Promise<MessageResponse<R>>;
97
94
  interface MessageContext {
98
- userId?: string;
99
- channelId?: string;
100
- messageId?: string;
101
- timestamp?: string;
102
- interfaceType?: string;
103
- userPermissionLevel?: UserPermissionLevel;
104
- threadId?: string;
105
- }
106
-
95
+ userId?: string;
96
+ channelId?: string;
97
+ messageId?: string;
98
+ timestamp?: string;
99
+ interfaceType?: string;
100
+ userPermissionLevel?: UserPermissionLevel;
101
+ threadId?: string;
102
+ }
103
+ //#endregion
104
+ //#region ../site/src/index.d.ts
105
+ /** Navigation slot types exposed to authored routes and generated entity routes. */
106
+ type NavigationSlot = "primary" | "secondary";
107
+ /** Display and behavior metadata for an entity type. */
108
+ interface EntityDisplayEntry {
109
+ label: string;
110
+ pluralName?: string | undefined;
111
+ /** Layout name for this entity type's generated routes (defaults to "default"). */
112
+ layout?: string | undefined;
113
+ /** Enable pagination for list pages. */
114
+ paginate?: boolean | undefined;
115
+ /** Items per page (default: 10). */
116
+ pageSize?: number | undefined;
117
+ navigation?: {
118
+ show?: boolean | undefined;
119
+ slot?: NavigationSlot | undefined;
120
+ priority?: number | undefined;
121
+ } | undefined;
122
+ }
123
+ interface SectionDefinitionInput {
124
+ id: string;
125
+ template: string;
126
+ content?: unknown;
127
+ dataQuery?: {
128
+ entityType?: string | undefined;
129
+ template?: string | undefined;
130
+ query?: Record<string, unknown> | undefined;
131
+ [key: string]: unknown;
132
+ } | undefined;
133
+ order?: number | undefined;
134
+ }
135
+ type SectionDefinition = SectionDefinitionInput;
136
+ interface NavigationMetadataInput {
137
+ show?: boolean | undefined;
138
+ label?: string | undefined;
139
+ slot?: NavigationSlot | undefined;
140
+ priority?: number | undefined;
141
+ }
142
+ interface NavigationMetadata {
143
+ show: boolean;
144
+ label?: string | undefined;
145
+ slot: NavigationSlot;
146
+ priority: number;
147
+ }
148
+ interface RouteDefinitionInput {
149
+ id: string;
150
+ path: string;
151
+ title?: string | undefined;
152
+ /** Bare display label without any page suffix. */
153
+ pageLabel?: string | undefined;
154
+ description?: string | undefined;
155
+ sections?: SectionDefinitionInput[] | undefined;
156
+ layout?: string | undefined;
157
+ fullscreen?: boolean | undefined;
158
+ pluginId?: string | undefined;
159
+ sourceEntityType?: string | undefined;
160
+ external?: boolean | undefined;
161
+ navigation?: NavigationMetadataInput | undefined;
162
+ }
163
+ interface RouteDefinition {
164
+ id: string;
165
+ path: string;
166
+ title: string;
167
+ pageLabel?: string | undefined;
168
+ description: string;
169
+ sections: SectionDefinition[];
170
+ layout: string;
171
+ fullscreen?: boolean | undefined;
172
+ pluginId?: string | undefined;
173
+ sourceEntityType?: string | undefined;
174
+ external?: boolean | undefined;
175
+ navigation?: NavigationMetadata | undefined;
176
+ }
177
+ interface NavigationItem {
178
+ label: string;
179
+ href: string;
180
+ priority: number;
181
+ }
182
+ //#endregion
183
+ //#region ../../shared/site-composition/src/routes.d.ts
107
184
  /** Navigation slot types. */
108
185
  declare const NavigationSlots: readonly ["primary", "secondary"];
109
186
  /** Route definition schema. */
110
187
  declare const RouteDefinitionSchema: z.ZodType<RouteDefinition, RouteDefinitionInput>;
111
188
  interface RegisterRoutesPayload {
112
- routes: RouteDefinition[];
113
- pluginId: string;
189
+ routes: RouteDefinition[];
190
+ pluginId: string;
114
191
  }
115
192
  interface UnregisterRoutesPayload {
116
- paths?: string[] | undefined;
117
- pluginId?: string | undefined;
193
+ paths?: string[] | undefined;
194
+ pluginId?: string | undefined;
118
195
  }
119
196
  interface ListRoutesPayload {
120
- pluginId?: string | undefined;
197
+ pluginId?: string | undefined;
121
198
  }
122
199
  interface GetRoutePayload {
123
- path: string;
200
+ path: string;
124
201
  }
125
202
  /** Message payload schemas for route operations. */
126
203
  declare const RegisterRoutesPayloadSchema: z.ZodType<RegisterRoutesPayload>;
127
204
  declare const UnregisterRoutesPayloadSchema: z.ZodType<UnregisterRoutesPayload>;
128
205
  declare const ListRoutesPayloadSchema: z.ZodType<ListRoutesPayload>;
129
206
  declare const GetRoutePayloadSchema: z.ZodType<GetRoutePayload>;
130
-
207
+ //#endregion
208
+ //#region ../../shell/plugins/src/types/api-routes.d.ts
131
209
  declare const apiRouteDefinitionSchema: z.ZodObject<{
132
- path: z.ZodString;
133
- method: z.ZodDefault<z.ZodEnum<{
134
- GET: "GET";
135
- POST: "POST";
136
- PUT: "PUT";
137
- DELETE: "DELETE";
138
- }>>;
139
- tool: z.ZodString;
140
- public: z.ZodDefault<z.ZodBoolean>;
141
- successRedirect: z.ZodOptional<z.ZodString>;
142
- errorRedirect: z.ZodOptional<z.ZodString>;
210
+ path: z.ZodString;
211
+ method: z.ZodDefault<z.ZodEnum<{
212
+ GET: "GET";
213
+ POST: "POST";
214
+ PUT: "PUT";
215
+ DELETE: "DELETE";
216
+ }>>;
217
+ tool: z.ZodString;
218
+ public: z.ZodDefault<z.ZodBoolean>;
219
+ successRedirect: z.ZodOptional<z.ZodString>;
220
+ errorRedirect: z.ZodOptional<z.ZodString>;
143
221
  }>;
144
222
  type ApiRouteDefinition = z.output<typeof apiRouteDefinitionSchema>;
145
223
  /**
@@ -147,91 +225,92 @@ type ApiRouteDefinition = z.output<typeof apiRouteDefinitionSchema>;
147
225
  * Returned by Shell.getPluginApiRoutes()
148
226
  */
149
227
  interface RegisteredApiRoute {
150
- /** The plugin that registered this route */
151
- pluginId: string;
152
- /** Full path including /api/{pluginId} prefix */
153
- fullPath: string;
154
- /** The original route definition */
155
- definition: ApiRouteDefinition;
156
- }
157
-
228
+ /** The plugin that registered this route */
229
+ pluginId: string;
230
+ /** Full path including /api/{pluginId} prefix */
231
+ fullPath: string;
232
+ /** The original route definition */
233
+ definition: ApiRouteDefinition;
234
+ }
235
+ //#endregion
236
+ //#region ../../shell/plugins/src/types/web-routes.d.ts
158
237
  declare const WebRouteMethods: readonly ["GET", "POST", "PUT", "DELETE", "OPTIONS"];
159
238
  type WebRouteMethod = (typeof WebRouteMethods)[number];
160
239
  type WebRouteHandler = (request: Request) => Response | Promise<Response>;
161
240
  interface WebRouteDefinition {
162
- /** Absolute mounted path (e.g. "/cms" or "/cms-config") */
163
- path: string;
164
- /** HTTP method */
165
- method?: WebRouteMethod;
166
- /** Allow unauthenticated access */
167
- public?: boolean;
168
- /** Request handler */
169
- handler: WebRouteHandler;
241
+ /** Absolute mounted path (e.g. "/cms" or "/cms-config") */
242
+ path: string;
243
+ /** HTTP method */
244
+ method?: WebRouteMethod;
245
+ /** Allow unauthenticated access */
246
+ public?: boolean;
247
+ /** Request handler */
248
+ handler: WebRouteHandler;
170
249
  }
171
250
  interface RegisteredWebRoute {
172
- /** The plugin that registered this route */
173
- pluginId: string;
174
- /** The mounted path */
175
- fullPath: string;
176
- /** The original route definition */
177
- definition: WebRouteDefinition;
178
- }
179
-
251
+ /** The plugin that registered this route */
252
+ pluginId: string;
253
+ /** The mounted path */
254
+ fullPath: string;
255
+ /** The original route definition */
256
+ definition: WebRouteDefinition;
257
+ }
258
+ //#endregion
259
+ //#region ../../shell/plugins/src/manager/daemon-types.d.ts
180
260
  /**
181
261
  * Daemon health status schema
182
262
  */
183
263
  declare const DaemonHealthSchema: z.ZodObject<{
184
- status: z.ZodEnum<{
185
- healthy: "healthy";
186
- warning: "warning";
187
- error: "error";
188
- unknown: "unknown";
189
- }>;
190
- message: z.ZodOptional<z.ZodString>;
191
- lastCheck: z.ZodOptional<z.ZodDate>;
192
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
264
+ status: z.ZodEnum<{
265
+ healthy: "healthy";
266
+ warning: "warning";
267
+ error: "error";
268
+ unknown: "unknown";
269
+ }>;
270
+ message: z.ZodOptional<z.ZodString>;
271
+ lastCheck: z.ZodOptional<z.ZodDate>;
272
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
193
273
  }>;
194
274
  type DaemonHealth = z.output<typeof DaemonHealthSchema>;
195
275
  /**
196
276
  * Daemon status info schema for validation
197
277
  */
198
278
  declare const DaemonStatusInfoSchema: z.ZodObject<{
199
- name: z.ZodString;
200
- pluginId: z.ZodString;
201
- status: z.ZodString;
202
- health: z.ZodOptional<typeof DaemonHealthSchema>;
279
+ name: z.ZodString;
280
+ pluginId: z.ZodString;
281
+ status: z.ZodString;
282
+ health: z.ZodOptional<typeof DaemonHealthSchema>;
203
283
  }>;
204
284
  type DaemonStatusInfo = z.output<typeof DaemonStatusInfoSchema>;
205
285
  /**
206
286
  * Daemon interface for long-running interface processes
207
287
  */
208
288
  interface Daemon {
209
- /**
210
- * Start the daemon - called when plugin is initialized
211
- */
212
- start: () => Promise<void>;
213
- /**
214
- * Stop the daemon - called when plugin is unloaded/shutdown
215
- */
216
- stop: () => Promise<void>;
217
- /**
218
- * Optional health check - called periodically to monitor daemon health
219
- */
220
- healthCheck?: () => Promise<DaemonHealth>;
289
+ /**
290
+ * Start the daemon - called when plugin is initialized
291
+ */
292
+ start: () => Promise<void>;
293
+ /**
294
+ * Stop the daemon - called when plugin is unloaded/shutdown
295
+ */
296
+ stop: () => Promise<void>;
297
+ /**
298
+ * Optional health check - called periodically to monitor daemon health
299
+ */
300
+ healthCheck?: () => Promise<DaemonHealth>;
221
301
  }
222
302
  /**
223
303
  * Information about a registered daemon
224
304
  */
225
305
  interface DaemonInfo {
226
- name: string;
227
- daemon: Daemon;
228
- pluginId: string;
229
- status: "stopped" | "starting" | "running" | "stopping" | "error";
230
- health?: DaemonHealth;
231
- error?: Error;
232
- startedAt?: Date;
233
- stoppedAt?: Date;
234
- }
235
-
236
- export { BaseMessageSchema, GetRoutePayloadSchema, ListRoutesPayloadSchema, MessageResponseSchema, NavigationSlots, RegisterRoutesPayloadSchema, RouteDefinitionSchema, UnregisterRoutesPayloadSchema, UserPermissionLevelSchema };
237
- export type { ApiRouteDefinition, BaseMessage, Daemon, DaemonHealth, DaemonInfo, DaemonStatusInfo, MessageContext, MessageResponse, MessageSendOptions, MessageSender, MessageWithPayload, PermissionConfig, PermissionRule, RegisteredApiRoute, RegisteredWebRoute, UserPermissionLevel, WebRouteDefinition, WebRouteHandler, WebRouteMethod, WithVisibility };
306
+ name: string;
307
+ daemon: Daemon;
308
+ pluginId: string;
309
+ status: "stopped" | "starting" | "running" | "stopping" | "error";
310
+ health?: DaemonHealth;
311
+ error?: Error;
312
+ startedAt?: Date;
313
+ stoppedAt?: Date;
314
+ }
315
+ //#endregion
316
+ export { type ApiRouteDefinition, type BaseMessage, BaseMessageSchema, type Daemon, type DaemonHealth, type DaemonInfo, type DaemonStatusInfo, type EntityDisplayEntry, GetRoutePayloadSchema, ListRoutesPayloadSchema, type MessageContext, type MessageResponse, MessageResponseSchema, type MessageSendOptions, type MessageSender, type MessageWithPayload, type NavigationItem, type NavigationSlot, NavigationSlots, type PermissionConfig, type PermissionRule, RegisterRoutesPayloadSchema, type RegisteredApiRoute, type RegisteredWebRoute, type RouteDefinition, type RouteDefinitionInput, RouteDefinitionSchema, type SectionDefinition, UnregisterRoutesPayloadSchema, type UserPermissionLevel, UserPermissionLevelSchema, type WebRouteDefinition, type WebRouteHandler, type WebRouteMethod, type WithVisibility };