@rizom/brain 0.2.0-alpha.45 → 0.2.0-alpha.47

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.
@@ -0,0 +1,129 @@
1
+ import type { z } from "zod";
2
+
3
+ export const UserPermissionLevelSchema: z.ZodSchema<UserPermissionLevel>;
4
+ export type UserPermissionLevel = "public" | "trusted" | "anchor";
5
+ export interface PermissionRule {
6
+ pattern: string;
7
+ level: UserPermissionLevel;
8
+ }
9
+ export interface PermissionConfig {
10
+ rules: PermissionRule[];
11
+ }
12
+ export interface WithVisibility {
13
+ visibility?: UserPermissionLevel;
14
+ }
15
+
16
+ export interface DaemonHealth {
17
+ healthy: boolean;
18
+ message?: string;
19
+ }
20
+ export interface DaemonStatusInfo {
21
+ name: string;
22
+ status: string;
23
+ healthy?: boolean;
24
+ message?: string;
25
+ }
26
+ export type DaemonInfo = DaemonStatusInfo;
27
+ export interface Daemon {
28
+ start(): Promise<void> | void;
29
+ stop(): Promise<void> | void;
30
+ health?(): Promise<DaemonHealth> | DaemonHealth;
31
+ }
32
+
33
+ export const NavigationSlots: readonly ["primary", "secondary"];
34
+ export type NavigationSlot = (typeof NavigationSlots)[number];
35
+ export interface EntityDisplayEntry {
36
+ label: string;
37
+ pluralName?: string;
38
+ layout?: string;
39
+ paginate?: boolean;
40
+ pageSize?: number;
41
+ navigation?: { show?: boolean; slot?: NavigationSlot; priority?: number };
42
+ }
43
+ export interface SectionDefinition {
44
+ id: string;
45
+ template: string;
46
+ content?: unknown;
47
+ dataQuery?: Record<string, unknown>;
48
+ order?: number;
49
+ }
50
+ export interface RouteDefinition {
51
+ id: string;
52
+ path: string;
53
+ title: string;
54
+ description: string;
55
+ sections: SectionDefinition[];
56
+ layout: string;
57
+ fullscreen?: boolean;
58
+ pluginId?: string;
59
+ sourceEntityType?: string;
60
+ external?: boolean;
61
+ navigation?: {
62
+ show?: boolean;
63
+ label?: string;
64
+ slot?: NavigationSlot;
65
+ priority?: number;
66
+ };
67
+ }
68
+ export type RouteDefinitionInput = Partial<RouteDefinition> &
69
+ Pick<RouteDefinition, "id" | "path">;
70
+ export interface NavigationItem {
71
+ label: string;
72
+ href: string;
73
+ priority: number;
74
+ }
75
+ export const RouteDefinitionSchema: z.ZodSchema<RouteDefinition>;
76
+ export const RegisterRoutesPayloadSchema: z.ZodSchema<unknown>;
77
+ export const UnregisterRoutesPayloadSchema: z.ZodSchema<unknown>;
78
+ export const ListRoutesPayloadSchema: z.ZodSchema<unknown>;
79
+ export const GetRoutePayloadSchema: z.ZodSchema<unknown>;
80
+
81
+ export interface ApiRouteDefinition {
82
+ path: string;
83
+ method?: "GET" | "POST" | "PUT" | "DELETE";
84
+ tool: string;
85
+ public?: boolean;
86
+ successRedirect?: string;
87
+ errorRedirect?: string;
88
+ }
89
+ export interface RegisteredApiRoute {
90
+ pluginId: string;
91
+ fullPath: string;
92
+ definition: ApiRouteDefinition;
93
+ }
94
+ export type WebRouteMethod = "GET" | "POST" | "PUT" | "DELETE" | "OPTIONS";
95
+ export type WebRouteHandler = (
96
+ request: Request,
97
+ ) => Response | Promise<Response>;
98
+ export interface WebRouteDefinition {
99
+ path: string;
100
+ method?: WebRouteMethod;
101
+ public?: boolean;
102
+ handler: WebRouteHandler;
103
+ }
104
+ export interface RegisteredWebRoute {
105
+ pluginId: string;
106
+ fullPath: string;
107
+ definition: WebRouteDefinition;
108
+ }
109
+
110
+ export interface MessageResponse<T = unknown> {
111
+ success: boolean;
112
+ data?: T;
113
+ error?: string;
114
+ }
115
+ export type MessageSender = <T = unknown, R = unknown>(
116
+ channel: string,
117
+ payload: T,
118
+ ) => Promise<MessageResponse<R>>;
119
+ export interface MessageWithPayload<T = unknown> {
120
+ channel: string;
121
+ payload: T;
122
+ timestamp?: number;
123
+ }
124
+ export interface MessageContext {
125
+ interfaceType?: string;
126
+ userId?: string;
127
+ channelId?: string;
128
+ [key: string]: unknown;
129
+ }