@rizom/brain 0.2.0-alpha.150 → 0.2.0-alpha.152
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/dist/brain.js +653 -652
- package/dist/deploy.d.ts +8 -8
- package/dist/entities.d.ts +414 -421
- package/dist/index.d.ts +38 -46
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/interfaces.d.ts +211 -132
- package/dist/plugins.d.ts +967 -954
- package/dist/services.d.ts +399 -397
- package/dist/site.d.ts +63 -66
- package/dist/site.js +4 -4
- package/dist/site.js.map +1 -1
- package/dist/templates.d.ts +117 -115
- package/dist/themes.d.ts +3 -2
- package/dist/ui/cms-app.js +177 -162
- package/dist/ui/cms-app.js.map +4 -4
- package/package.json +4 -4
package/dist/plugins.d.ts
CHANGED
|
@@ -1,192 +1,195 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ZodType, z } from "zod/v4";
|
|
2
|
+
//#region ../../shell/entity-service/src/visibility.d.ts
|
|
3
3
|
declare const canonicalContentVisibilitySchema: z.ZodEnum<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
public: "public";
|
|
5
|
+
shared: "shared";
|
|
6
|
+
restricted: "restricted";
|
|
7
7
|
}>;
|
|
8
8
|
type ContentVisibility = z.infer<typeof canonicalContentVisibilitySchema>;
|
|
9
9
|
type RawContentVisibility = ContentVisibility | "private";
|
|
10
|
-
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region ../../shared/contracts/src/agent-response.d.ts
|
|
11
12
|
interface PendingConfirmation {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
id: string;
|
|
14
|
+
toolCallId?: string | undefined;
|
|
15
|
+
toolName: string;
|
|
16
|
+
summary: string;
|
|
17
|
+
completionSummary?: string | undefined;
|
|
18
|
+
preview?: string | undefined;
|
|
19
|
+
args: unknown;
|
|
19
20
|
}
|
|
20
21
|
declare const PendingConfirmationSchema: z.ZodType<PendingConfirmation, PendingConfirmation>;
|
|
21
22
|
type ToolApprovalCardState = "approval-requested" | "approval-responded" | "output-available" | "output-denied" | "output-error";
|
|
22
23
|
interface ToolApprovalCard {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
kind: "tool-approval";
|
|
25
|
+
id: string;
|
|
26
|
+
toolCallId?: string | undefined;
|
|
27
|
+
toolName: string;
|
|
28
|
+
input?: Record<string, unknown> | undefined;
|
|
29
|
+
summary: string;
|
|
30
|
+
completionSummary?: string | undefined;
|
|
31
|
+
preview?: string | undefined;
|
|
32
|
+
state: ToolApprovalCardState;
|
|
33
|
+
output?: unknown;
|
|
34
|
+
error?: string | undefined;
|
|
34
35
|
}
|
|
35
36
|
interface AttachmentCardSource {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
entityType?: string | undefined;
|
|
38
|
+
entityId?: string | undefined;
|
|
39
|
+
attachmentType?: string | undefined;
|
|
39
40
|
}
|
|
40
41
|
interface AttachmentCardData {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
mediaType: string;
|
|
43
|
+
url: string;
|
|
44
|
+
downloadUrl?: string | undefined;
|
|
45
|
+
previewUrl?: string | undefined;
|
|
46
|
+
filename?: string | undefined;
|
|
47
|
+
sizeBytes?: number | undefined;
|
|
48
|
+
source?: AttachmentCardSource | undefined;
|
|
48
49
|
}
|
|
49
50
|
interface AttachmentCard {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
kind: "attachment";
|
|
52
|
+
id: string;
|
|
53
|
+
jobId?: string | undefined;
|
|
54
|
+
title: string;
|
|
55
|
+
description?: string | undefined;
|
|
56
|
+
attachment: AttachmentCardData;
|
|
56
57
|
}
|
|
57
58
|
interface SourceCitation {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
id: string;
|
|
60
|
+
title?: string | undefined;
|
|
61
|
+
source: string;
|
|
62
|
+
url?: string | undefined;
|
|
63
|
+
entityType?: string | undefined;
|
|
64
|
+
entityId?: string | undefined;
|
|
65
|
+
excerpt?: string | undefined;
|
|
66
|
+
provenance?: Record<string, unknown> | undefined;
|
|
66
67
|
}
|
|
67
68
|
interface SourcesCard {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
kind: "sources";
|
|
70
|
+
id: string;
|
|
71
|
+
title?: string | undefined;
|
|
72
|
+
sources: SourceCitation[];
|
|
72
73
|
}
|
|
73
74
|
interface PromptChatAction {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
type: "prompt";
|
|
76
|
+
id: string;
|
|
77
|
+
label: string;
|
|
78
|
+
prompt: string;
|
|
79
|
+
description?: string | undefined;
|
|
79
80
|
}
|
|
80
81
|
interface EventChatAction {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
type: "event";
|
|
83
|
+
id: string;
|
|
84
|
+
label: string;
|
|
85
|
+
event: string;
|
|
86
|
+
fromState?: string | undefined;
|
|
87
|
+
description?: string | undefined;
|
|
87
88
|
}
|
|
88
89
|
type ChatAction = PromptChatAction | EventChatAction;
|
|
89
90
|
interface ActionsCard {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
kind: "actions";
|
|
92
|
+
id: string;
|
|
93
|
+
title?: string | undefined;
|
|
94
|
+
defaultOpen?: boolean | undefined;
|
|
95
|
+
actions: ChatAction[];
|
|
95
96
|
}
|
|
96
97
|
type StructuredChatCard = ToolApprovalCard | AttachmentCard | SourcesCard | ActionsCard;
|
|
97
98
|
interface ToolResultErrorData {
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
message: string;
|
|
100
|
+
code?: string | undefined;
|
|
100
101
|
}
|
|
101
102
|
interface ToolResultData {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
toolName: string;
|
|
104
|
+
args?: Record<string, unknown> | undefined;
|
|
105
|
+
jobId?: string | undefined;
|
|
106
|
+
data?: unknown;
|
|
107
|
+
error?: ToolResultErrorData | undefined;
|
|
107
108
|
}
|
|
108
109
|
declare const ToolResultDataSchema: z.ZodType<ToolResultData, ToolResultData>;
|
|
109
110
|
interface AgentResponseUsage {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
promptTokens: number;
|
|
112
|
+
completionTokens: number;
|
|
113
|
+
totalTokens: number;
|
|
113
114
|
}
|
|
114
115
|
interface AgentResponse {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
text: string;
|
|
117
|
+
toolResults?: ToolResultData[] | undefined;
|
|
118
|
+
cards?: StructuredChatCard[] | undefined;
|
|
119
|
+
pendingConfirmations?: PendingConfirmation[] | undefined;
|
|
120
|
+
usage: AgentResponseUsage;
|
|
120
121
|
}
|
|
121
122
|
declare const AgentResponseSchema: z.ZodType<AgentResponse, AgentResponse>;
|
|
122
|
-
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region ../../shared/contracts/src/message-role.d.ts
|
|
123
125
|
/** Canonical role of a stored conversation message. */
|
|
124
126
|
type MessageRole = "user" | "assistant";
|
|
125
127
|
declare const messageRoleSchema: z.ZodType<MessageRole, MessageRole>;
|
|
126
|
-
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region ../../shared/contracts/src/response-types.d.ts
|
|
127
130
|
/**
|
|
128
131
|
* Query response schemas used throughout the system
|
|
129
132
|
*/
|
|
130
133
|
interface DefaultQuerySource {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
id: string;
|
|
135
|
+
type: string;
|
|
136
|
+
excerpt?: string | undefined;
|
|
137
|
+
relevance?: number | undefined;
|
|
135
138
|
}
|
|
136
139
|
interface DefaultQueryResponse {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
140
|
+
message: string;
|
|
141
|
+
summary?: string | undefined;
|
|
142
|
+
topics?: string[] | undefined;
|
|
143
|
+
sources?: DefaultQuerySource[] | undefined;
|
|
144
|
+
metadata?: Record<string, unknown> | undefined;
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region ../../shell/entity-service/src/types.d.ts
|
|
144
148
|
/**
|
|
145
149
|
* Options for entity mutation operations (create, update, upsert)
|
|
146
150
|
*/
|
|
147
151
|
interface EntityMutationEventContext {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
conversationId?: string;
|
|
153
|
+
channelId?: string;
|
|
154
|
+
runId?: string;
|
|
155
|
+
toolCallId?: string;
|
|
152
156
|
}
|
|
153
157
|
interface EntityJobOptions {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
158
|
+
priority?: number;
|
|
159
|
+
maxRetries?: number;
|
|
160
|
+
eventContext?: EntityMutationEventContext;
|
|
157
161
|
}
|
|
158
|
-
|
|
159
162
|
/**
|
|
160
163
|
* Options for entity creation (extends EntityJobOptions with deduplication)
|
|
161
164
|
*/
|
|
162
165
|
interface CreateEntityOptions extends EntityJobOptions {
|
|
163
|
-
|
|
166
|
+
deduplicateId?: boolean;
|
|
164
167
|
}
|
|
165
168
|
/**
|
|
166
169
|
* Result of an entity mutation that triggers an embedding job.
|
|
167
170
|
* When skipped is true, content was unchanged — no DB write, no event, no embedding job.
|
|
168
171
|
*/
|
|
169
172
|
interface EntityMutationResult {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
+
entityId: string;
|
|
174
|
+
jobId: string;
|
|
175
|
+
skipped: boolean;
|
|
173
176
|
}
|
|
174
177
|
/**
|
|
175
178
|
* Input for adapter-validated direct creation from finalized markdown.
|
|
176
179
|
*/
|
|
177
180
|
interface CreateEntityFromMarkdownInput {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
entityType: string;
|
|
182
|
+
id: string;
|
|
183
|
+
markdown: string;
|
|
181
184
|
}
|
|
182
185
|
/**
|
|
183
186
|
* Data for storing an embedding for an entity
|
|
184
187
|
*/
|
|
185
188
|
interface StoreEmbeddingData {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
189
|
+
entityId: string;
|
|
190
|
+
entityType: string;
|
|
191
|
+
embedding: Float32Array;
|
|
192
|
+
contentHash: string;
|
|
190
193
|
}
|
|
191
194
|
type EntitySchema$1<T> = z.ZodType<T, unknown>;
|
|
192
195
|
/**
|
|
@@ -194,132 +197,132 @@ type EntitySchema$1<T> = z.ZodType<T, unknown>;
|
|
|
194
197
|
* TMetadata defaults to Record<string, unknown> for backward compatibility
|
|
195
198
|
*/
|
|
196
199
|
interface BaseEntity<TMetadata = Record<string, unknown>> {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
200
|
+
id: string;
|
|
201
|
+
entityType: string;
|
|
202
|
+
content: string;
|
|
203
|
+
created: string;
|
|
204
|
+
updated: string;
|
|
205
|
+
visibility: ContentVisibility;
|
|
206
|
+
metadata: TMetadata;
|
|
207
|
+
/** SHA256 hash of content for change detection */
|
|
208
|
+
contentHash: string;
|
|
206
209
|
}
|
|
207
210
|
/**
|
|
208
211
|
* Entity input type for creation - allows partial entities with optional system fields
|
|
209
212
|
* contentHash is excluded because it's computed automatically by the entity service
|
|
210
213
|
*/
|
|
211
214
|
type EntityInput<T extends BaseEntity> = Omit<T, "id" | "created" | "updated" | "contentHash" | "visibility"> & {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
id?: string;
|
|
216
|
+
created?: string;
|
|
217
|
+
updated?: string;
|
|
218
|
+
visibility?: RawContentVisibility;
|
|
216
219
|
};
|
|
217
220
|
/**
|
|
218
221
|
* Search result type
|
|
219
222
|
*/
|
|
220
223
|
interface SearchResult<T extends BaseEntity = BaseEntity> {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
+
entity: T;
|
|
225
|
+
score: number;
|
|
226
|
+
excerpt: string;
|
|
224
227
|
}
|
|
225
228
|
/**
|
|
226
229
|
* Normalized system_create input shape used by plugin create interceptors.
|
|
227
230
|
*/
|
|
228
231
|
interface CreateCoverImageInput {
|
|
229
|
-
|
|
230
|
-
|
|
232
|
+
generate?: boolean | undefined;
|
|
233
|
+
prompt?: string | undefined;
|
|
231
234
|
}
|
|
232
235
|
interface CreateFromAttachmentInput {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
236
|
+
kind: "entity-attachment";
|
|
237
|
+
sourceEntityType: string;
|
|
238
|
+
sourceEntityId: string;
|
|
239
|
+
attachmentType: string;
|
|
237
240
|
}
|
|
238
241
|
interface CreateFromUploadInput {
|
|
239
|
-
|
|
240
|
-
|
|
242
|
+
kind: "upload";
|
|
243
|
+
id: string;
|
|
241
244
|
}
|
|
242
245
|
interface CreateFromConversationMessageInput {
|
|
243
|
-
|
|
244
|
-
|
|
246
|
+
kind: "conversation-message";
|
|
247
|
+
messageId?: string | undefined;
|
|
245
248
|
}
|
|
246
249
|
type CreateFromInput = CreateFromAttachmentInput | CreateFromUploadInput | CreateFromConversationMessageInput;
|
|
247
250
|
type CreateTransform = "extract-markdown" | "preserve";
|
|
248
251
|
interface CreateInput {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
252
|
+
entityType: string;
|
|
253
|
+
prompt?: string;
|
|
254
|
+
title?: string;
|
|
255
|
+
content?: string;
|
|
256
|
+
url?: string;
|
|
257
|
+
from?: CreateFromInput;
|
|
258
|
+
transform?: CreateTransform;
|
|
259
|
+
replace?: boolean;
|
|
260
|
+
sourceEntityType?: string;
|
|
261
|
+
sourceEntityId?: string;
|
|
262
|
+
sourceEntityIds?: string[];
|
|
263
|
+
targetEntityType?: string;
|
|
264
|
+
targetEntityId?: string;
|
|
265
|
+
coverImage?: boolean | CreateCoverImageInput;
|
|
263
266
|
}
|
|
264
267
|
/**
|
|
265
268
|
* Minimal caller context forwarded to plugin create interceptors.
|
|
266
269
|
*/
|
|
267
270
|
interface CreateExecutionContext {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
271
|
+
interfaceType: string;
|
|
272
|
+
userId: string;
|
|
273
|
+
channelId?: string;
|
|
274
|
+
channelName?: string;
|
|
272
275
|
}
|
|
273
276
|
/**
|
|
274
277
|
* Result returned to system_create when a plugin fully handles creation.
|
|
275
278
|
*/
|
|
276
279
|
declare const createResultAttachmentSchema: z.ZodObject<{
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
280
|
+
mediaType: z.ZodString;
|
|
281
|
+
url: z.ZodString;
|
|
282
|
+
downloadUrl: z.ZodOptional<z.ZodString>;
|
|
283
|
+
previewUrl: z.ZodOptional<z.ZodString>;
|
|
284
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
285
|
+
sizeBytes: z.ZodOptional<z.ZodNumber>;
|
|
286
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
287
|
+
entityType: z.ZodOptional<z.ZodString>;
|
|
288
|
+
entityId: z.ZodOptional<z.ZodString>;
|
|
289
|
+
attachmentType: z.ZodOptional<z.ZodString>;
|
|
290
|
+
}>>;
|
|
288
291
|
}>;
|
|
289
292
|
type CreateResultAttachment = z.infer<typeof createResultAttachmentSchema>;
|
|
290
293
|
type CreateResult = {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
294
|
+
success: true;
|
|
295
|
+
data: {
|
|
296
|
+
entityId?: string;
|
|
297
|
+
jobId?: string;
|
|
298
|
+
status: string;
|
|
299
|
+
attachment?: CreateResultAttachment;
|
|
300
|
+
};
|
|
298
301
|
} | {
|
|
299
|
-
|
|
300
|
-
|
|
302
|
+
success: false;
|
|
303
|
+
error: string;
|
|
301
304
|
};
|
|
302
305
|
/**
|
|
303
306
|
* Plugin create interceptors can either fully handle creation,
|
|
304
307
|
* or continue with a rewritten normalized input.
|
|
305
308
|
*/
|
|
306
309
|
type CreateInterceptionResult = {
|
|
307
|
-
|
|
308
|
-
|
|
310
|
+
kind: "handled";
|
|
311
|
+
result: CreateResult;
|
|
309
312
|
} | {
|
|
310
|
-
|
|
311
|
-
|
|
313
|
+
kind: "continue";
|
|
314
|
+
input: CreateInput;
|
|
312
315
|
};
|
|
313
316
|
type CreateInterceptor = (input: CreateInput, executionContext: CreateExecutionContext) => Promise<CreateInterceptionResult>;
|
|
314
317
|
interface UploadSaveInput {
|
|
315
|
-
|
|
316
|
-
|
|
318
|
+
upload: CreateFromUploadInput;
|
|
319
|
+
title?: string;
|
|
317
320
|
}
|
|
318
321
|
type UploadSaveHandler = (input: UploadSaveInput, executionContext: CreateExecutionContext) => Promise<CreateResult>;
|
|
319
322
|
interface UploadSaveHandlerRegistration {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
+
entityType: string;
|
|
324
|
+
mediaTypes: string[];
|
|
325
|
+
handler: UploadSaveHandler;
|
|
323
326
|
}
|
|
324
327
|
/**
|
|
325
328
|
* Interface for entity adapter - handles conversion between entities and markdown
|
|
@@ -329,177 +332,177 @@ interface UploadSaveHandlerRegistration {
|
|
|
329
332
|
* @template TMetadata - The metadata type (defaults to Record<string, unknown>)
|
|
330
333
|
*/
|
|
331
334
|
interface EntityAdapter<TEntity extends BaseEntity<TMetadata>, TMetadata = Record<string, unknown>> {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
335
|
+
entityType: string;
|
|
336
|
+
/**
|
|
337
|
+
* One declarative sentence describing what this entity type is. This is the
|
|
338
|
+
* data the model reads to select `entityType`, replacing hardcoded example
|
|
339
|
+
* phrasings in system instructions. Required: every type must define itself.
|
|
340
|
+
*/
|
|
341
|
+
purpose: string;
|
|
342
|
+
schema: EntitySchema$1<TEntity>;
|
|
343
|
+
toMarkdown(entity: TEntity): string;
|
|
344
|
+
fromMarkdown(markdown: string): Partial<TEntity>;
|
|
345
|
+
extractMetadata(entity: TEntity): TMetadata;
|
|
346
|
+
parseFrontMatter<TFrontmatter>(markdown: string, schema: {
|
|
347
|
+
parse(data: unknown): TFrontmatter;
|
|
348
|
+
}): TFrontmatter;
|
|
349
|
+
generateFrontMatter(entity: TEntity): string;
|
|
350
|
+
/** Optional: Zod schema for frontmatter fields. Used by CMS config generation. */
|
|
351
|
+
frontmatterSchema?: z.ZodObject<z.ZodRawShape>;
|
|
352
|
+
/** Optional: Declares this entity type is a singleton (one file, e.g., identity/identity.md). Used by CMS to generate files collection. */
|
|
353
|
+
isSingleton?: boolean;
|
|
354
|
+
/** Optional: Whether this entity has a free-form markdown body below frontmatter. Defaults to true. When false, CMS omits the body widget. */
|
|
355
|
+
hasBody?: boolean;
|
|
356
|
+
/** Returns a markdown body template with section headings for this entity type. Empty string for free-form entities. */
|
|
357
|
+
getBodyTemplate(): string;
|
|
358
|
+
/** Optional: Declares that this entity type supports cover images via coverImageId in frontmatter */
|
|
359
|
+
supportsCoverImage?: boolean;
|
|
360
|
+
/** Optional: Extract coverImageId from entity content/frontmatter */
|
|
361
|
+
getCoverImageId?(entity: TEntity): string | undefined;
|
|
362
|
+
/**
|
|
363
|
+
* Optional: build the markdown content and metadata for a queued-generation stub.
|
|
364
|
+
* When undefined, this entity type does not support prompt-based queued creation
|
|
365
|
+
* via system_create; the tool will reject the call rather than silently degrade.
|
|
366
|
+
* The returned metadata must satisfy this entity's metadata schema (with
|
|
367
|
+
* status set to "generating"); central code only stamps id/timestamps/visibility.
|
|
368
|
+
*/
|
|
369
|
+
buildStub?(input: {
|
|
370
|
+
id: string;
|
|
371
|
+
title: string;
|
|
372
|
+
}): {
|
|
373
|
+
content: string;
|
|
374
|
+
metadata: TMetadata;
|
|
375
|
+
};
|
|
373
376
|
}
|
|
374
377
|
/**
|
|
375
378
|
* Sort field specification for multi-field sorting
|
|
376
379
|
*/
|
|
377
380
|
interface SortField {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
381
|
+
/** Field to sort by - "created", "updated", or a metadata field name */
|
|
382
|
+
field: string;
|
|
383
|
+
/** Sort direction */
|
|
384
|
+
direction: "asc" | "desc";
|
|
385
|
+
/** Sort NULL values before non-NULL values (default: false / SQLite default) */
|
|
386
|
+
nullsFirst?: boolean;
|
|
384
387
|
}
|
|
385
388
|
/**
|
|
386
389
|
* List entities options
|
|
387
390
|
* Generic over metadata type for type-safe filtering
|
|
388
391
|
*/
|
|
389
392
|
interface ListOptions<TMetadata = Record<string, unknown>> {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
393
|
+
limit?: number;
|
|
394
|
+
offset?: number;
|
|
395
|
+
/** Multi-field sorting - supports system fields (created, updated) and metadata fields */
|
|
396
|
+
sortFields?: SortField[];
|
|
397
|
+
filter?: {
|
|
398
|
+
metadata?: Partial<TMetadata>;
|
|
399
|
+
visibilityScope?: ContentVisibility;
|
|
400
|
+
};
|
|
401
|
+
/** Filter to only entities with metadata.status = "published" */
|
|
402
|
+
publishedOnly?: boolean;
|
|
400
403
|
}
|
|
401
404
|
/**
|
|
402
405
|
* Search options
|
|
403
406
|
*/
|
|
404
407
|
interface SearchOptions {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
408
|
+
limit?: number;
|
|
409
|
+
offset?: number;
|
|
410
|
+
types?: string[];
|
|
411
|
+
excludeTypes?: string[];
|
|
412
|
+
sortBy?: "relevance" | "created" | "updated";
|
|
413
|
+
sortDirection?: "asc" | "desc";
|
|
414
|
+
/** Score multipliers per entity type - applied after initial search */
|
|
415
|
+
weight?: Record<string, number>;
|
|
416
|
+
visibilityScope?: ContentVisibility;
|
|
417
|
+
/** Include queued/failed generation stubs in search results (default: false) */
|
|
418
|
+
includeUngenerated?: boolean;
|
|
419
|
+
/** Minimum relevance score to return. Omit for no score cutoff. */
|
|
420
|
+
minScore?: number;
|
|
418
421
|
}
|
|
419
422
|
/**
|
|
420
423
|
* Configuration for entity type registration
|
|
421
424
|
*/
|
|
422
425
|
interface EntityTypeConfig {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
426
|
+
/** Score multiplier for search results (default: 1.0) */
|
|
427
|
+
weight?: number;
|
|
428
|
+
/** Whether to generate embeddings for this entity type (default: true).
|
|
429
|
+
* Set to false for entity types with non-textual content (e.g., images). */
|
|
430
|
+
embeddable?: boolean;
|
|
431
|
+
/** Whether this entity type may be used as source material for derived projections (default: true).
|
|
432
|
+
* Set to false for projection outputs that would create feedback loops. */
|
|
433
|
+
projectionSource?: boolean;
|
|
434
|
+
/** Publish semantics for status-bearing entity types. Statuses listed here
|
|
435
|
+
* represent publication commitment/execution states and require the
|
|
436
|
+
* `publish` entity action when entered or modified. */
|
|
437
|
+
publish?: {
|
|
438
|
+
publishStatuses: string[];
|
|
439
|
+
};
|
|
437
440
|
}
|
|
438
441
|
/**
|
|
439
442
|
* Core entity service interface for read-only operations
|
|
440
443
|
* Used by core plugins that need entity access but shouldn't modify entities
|
|
441
444
|
*/
|
|
442
445
|
interface GetEntityRequest {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
446
|
+
entityType: string;
|
|
447
|
+
id: string;
|
|
448
|
+
/**
|
|
449
|
+
* Optional visibility scope. Undefined fails closed to "public" — callers
|
|
450
|
+
* with elevated access must opt up explicitly.
|
|
451
|
+
*/
|
|
452
|
+
visibilityScope?: ContentVisibility;
|
|
450
453
|
}
|
|
451
454
|
type GetEntityRawRequest = GetEntityRequest;
|
|
452
455
|
interface ListEntitiesRequest {
|
|
453
|
-
|
|
454
|
-
|
|
456
|
+
entityType: string;
|
|
457
|
+
options?: ListOptions | undefined;
|
|
455
458
|
}
|
|
456
459
|
interface CountEntitiesRequest {
|
|
457
|
-
|
|
458
|
-
|
|
460
|
+
entityType: string;
|
|
461
|
+
options?: Pick<ListOptions, "publishedOnly" | "filter"> | undefined;
|
|
459
462
|
}
|
|
460
463
|
interface CreateEntityRequest<T extends BaseEntity> {
|
|
461
|
-
|
|
462
|
-
|
|
464
|
+
entity: EntityInput<T>;
|
|
465
|
+
options?: CreateEntityOptions | undefined;
|
|
463
466
|
}
|
|
464
467
|
interface CreateEntityFromMarkdownRequest {
|
|
465
|
-
|
|
466
|
-
|
|
468
|
+
input: CreateEntityFromMarkdownInput;
|
|
469
|
+
options?: CreateEntityOptions | undefined;
|
|
467
470
|
}
|
|
468
471
|
interface UpdateEntityRequest<T extends BaseEntity> {
|
|
469
|
-
|
|
470
|
-
|
|
472
|
+
entity: T;
|
|
473
|
+
options?: EntityJobOptions | undefined;
|
|
471
474
|
}
|
|
472
475
|
interface DeleteEntityRequest {
|
|
473
|
-
|
|
474
|
-
|
|
476
|
+
entityType: string;
|
|
477
|
+
id: string;
|
|
475
478
|
}
|
|
476
479
|
interface UpsertEntityRequest<T extends BaseEntity> {
|
|
477
|
-
|
|
478
|
-
|
|
480
|
+
entity: T;
|
|
481
|
+
options?: EntityJobOptions | undefined;
|
|
479
482
|
}
|
|
480
483
|
interface EntitySearchRequest {
|
|
481
|
-
|
|
482
|
-
|
|
484
|
+
query: string;
|
|
485
|
+
options?: SearchOptions | undefined;
|
|
483
486
|
}
|
|
484
487
|
interface SearchWithDistancesRequest {
|
|
485
|
-
|
|
488
|
+
query: string;
|
|
486
489
|
}
|
|
487
490
|
/**
|
|
488
491
|
* Context passed to all DataSource operations
|
|
489
492
|
* Contains internal state that should not be mixed with user query parameters
|
|
490
493
|
*/
|
|
491
494
|
interface BaseDataSourceContext {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
495
|
+
/**
|
|
496
|
+
* Whether to filter to only published/complete content
|
|
497
|
+
* Set by site-builder: true for production, false for preview
|
|
498
|
+
*/
|
|
499
|
+
publishedOnly?: boolean;
|
|
500
|
+
/**
|
|
501
|
+
* Scoped entity service that auto-applies publishedOnly filter
|
|
502
|
+
* Datasources should use this instead of their injected entityService
|
|
503
|
+
* to ensure consistent filtering behavior across environments
|
|
504
|
+
*/
|
|
505
|
+
entityService: EntityService;
|
|
503
506
|
}
|
|
504
507
|
/**
|
|
505
508
|
* DataSource Interface
|
|
@@ -509,227 +512,229 @@ interface BaseDataSourceContext {
|
|
|
509
512
|
* via their dataSourceId property.
|
|
510
513
|
*/
|
|
511
514
|
interface DataSource {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
515
|
+
/**
|
|
516
|
+
* Unique identifier for this data source
|
|
517
|
+
*/
|
|
518
|
+
id: string;
|
|
519
|
+
/**
|
|
520
|
+
* Human-readable name for this data source
|
|
521
|
+
*/
|
|
522
|
+
name: string;
|
|
523
|
+
/**
|
|
524
|
+
* Optional description of what this data source provides
|
|
525
|
+
*/
|
|
526
|
+
description?: string;
|
|
527
|
+
/**
|
|
528
|
+
* Optional: Fetch existing data
|
|
529
|
+
* Used by data sources that aggregate or retrieve data (e.g., dashboard stats, API data)
|
|
530
|
+
* DataSources validate output using the provided schema
|
|
531
|
+
* @param query - Query parameters for fetching data
|
|
532
|
+
* @param outputSchema - Schema for validating output data
|
|
533
|
+
* @param context - Context with environment
|
|
534
|
+
*/
|
|
535
|
+
fetch?: <T>(query: unknown, outputSchema: z.ZodSchema<T>, context: BaseDataSourceContext) => Promise<T>;
|
|
536
|
+
/**
|
|
537
|
+
* Optional: Generate new content
|
|
538
|
+
* Used by data sources that create content (e.g., AI-generated content, reports)
|
|
539
|
+
*/
|
|
540
|
+
generate?: <T>(request: unknown, schema: z.ZodSchema<T>) => Promise<T>;
|
|
541
|
+
/**
|
|
542
|
+
* Optional: Transform content between formats
|
|
543
|
+
* Used by data sources that convert content (e.g., markdown to HTML, data formatting)
|
|
544
|
+
*/
|
|
545
|
+
transform?: <T>(content: unknown, format: string, schema: z.ZodSchema<T>) => Promise<T>;
|
|
543
546
|
}
|
|
544
547
|
interface ICoreEntityService {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
548
|
+
getEntity<T extends BaseEntity>(request: GetEntityRequest): Promise<T | null>;
|
|
549
|
+
/**
|
|
550
|
+
* Get entity without content resolution (raw)
|
|
551
|
+
* Used internally to avoid recursion when resolving image references
|
|
552
|
+
*/
|
|
553
|
+
getEntityRaw<T extends BaseEntity>(request: GetEntityRawRequest): Promise<T | null>;
|
|
554
|
+
listEntities<T extends BaseEntity>(request: ListEntitiesRequest): Promise<T[]>;
|
|
555
|
+
search<T extends BaseEntity = BaseEntity>(request: EntitySearchRequest): Promise<SearchResult<T>[]>;
|
|
556
|
+
getEntityTypes(): string[];
|
|
557
|
+
hasEntityType(type: string): boolean;
|
|
558
|
+
countEntities(request: CountEntitiesRequest): Promise<number>;
|
|
559
|
+
/**
|
|
560
|
+
* Group counts by entity type. Fails closed: undefined visibilityScope
|
|
561
|
+
* filters to public-only counts so aggregate insights cannot reveal
|
|
562
|
+
* non-public entity existence.
|
|
563
|
+
*/
|
|
564
|
+
getEntityCounts(visibilityScope?: ContentVisibility): Promise<Array<{
|
|
565
|
+
entityType: string;
|
|
566
|
+
count: number;
|
|
567
|
+
}>>;
|
|
568
|
+
/** Get configuration for a specific entity type */
|
|
569
|
+
getEntityTypeConfig(type: string): EntityTypeConfig;
|
|
570
|
+
/** Get weight map for all registered entity types with non-default weights */
|
|
571
|
+
getWeightMap(): Record<string, number>;
|
|
569
572
|
}
|
|
570
573
|
/**
|
|
571
574
|
* Entity service interface for managing brain entities
|
|
572
575
|
*/
|
|
573
576
|
interface IEntitiesNamespace {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
577
|
+
/** Register a new entity type with schema and adapter */
|
|
578
|
+
register<TEntity extends BaseEntity>(entityType: string, schema: EntitySchema$1<TEntity>, adapter: EntityAdapter<TEntity>, config?: EntityTypeConfig): void;
|
|
579
|
+
/**
|
|
580
|
+
* Get the adapter for an entity type.
|
|
581
|
+
*
|
|
582
|
+
* Returns the structural `EntityAdapter<BaseEntity>` view — namespace
|
|
583
|
+
* consumers don't narrow by entity type. For typed access tied to a
|
|
584
|
+
* specific `TEntity`, use the underlying `EntityRegistry.getAdapter<T>`
|
|
585
|
+
* directly (see `entity-serializer.ts`).
|
|
586
|
+
*/
|
|
587
|
+
getAdapter(entityType: string): EntityAdapter<BaseEntity> | undefined;
|
|
588
|
+
/** Extend an adapter's frontmatterSchema with additional fields */
|
|
589
|
+
extendFrontmatterSchema(type: string, extension: z.ZodObject<z.ZodRawShape>): void;
|
|
590
|
+
/** Get effective frontmatter schema (base + extensions) for an entity type */
|
|
591
|
+
getEffectiveFrontmatterSchema(type: string): z.ZodObject<z.ZodRawShape> | undefined;
|
|
592
|
+
/** Update an existing entity */
|
|
593
|
+
update<TEntity extends BaseEntity>(entity: TEntity): Promise<{
|
|
594
|
+
entityId: string;
|
|
595
|
+
jobId: string;
|
|
596
|
+
}>;
|
|
597
|
+
/** Register a data source for dynamic content */
|
|
598
|
+
registerDataSource(dataSource: DataSource): void;
|
|
599
|
+
/** Register a create interceptor for this plugin's entity type */
|
|
600
|
+
registerCreateInterceptor(entityType: string, interceptor: CreateInterceptor): void;
|
|
601
|
+
/** Register a raw-upload durable save handler for this plugin's entity type */
|
|
602
|
+
registerUploadSaveHandler(registration: UploadSaveHandlerRegistration): void;
|
|
603
|
+
/** Look up the registered upload-save handler claiming a media type */
|
|
604
|
+
getUploadSaveHandler(mediaType: string): UploadSaveHandlerRegistration | undefined;
|
|
602
605
|
}
|
|
603
606
|
interface EmbeddingBackfillResult {
|
|
604
|
-
|
|
605
|
-
|
|
607
|
+
queued: number;
|
|
608
|
+
skipped: number;
|
|
606
609
|
}
|
|
607
610
|
interface EmbeddingIndexStats {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
611
|
+
missingEmbeddings: number;
|
|
612
|
+
staleEmbeddings: number;
|
|
613
|
+
failedEmbeddings: number;
|
|
614
|
+
/** Entities whose type generates embeddings (non-embeddable types excluded). */
|
|
615
|
+
embeddableEntities: number;
|
|
616
|
+
/** Embeddable entities whose embedding is present and current. */
|
|
617
|
+
embeddedEntities: number;
|
|
615
618
|
}
|
|
616
619
|
interface IndexReadinessOptions {
|
|
617
|
-
|
|
618
|
-
|
|
620
|
+
timeoutMs: number;
|
|
621
|
+
intervalMs?: number;
|
|
619
622
|
}
|
|
620
623
|
interface IndexReadinessStatus extends EmbeddingIndexStats {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
+
ready: boolean;
|
|
625
|
+
degraded: boolean;
|
|
626
|
+
activeEmbeddingJobs: number;
|
|
624
627
|
}
|
|
625
628
|
interface EntityService extends ICoreEntityService {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
}
|
|
651
|
-
|
|
629
|
+
createEntity<T extends BaseEntity>(request: CreateEntityRequest<T>): Promise<EntityMutationResult>;
|
|
630
|
+
createEntityFromMarkdown(request: CreateEntityFromMarkdownRequest): Promise<EntityMutationResult>;
|
|
631
|
+
updateEntity<T extends BaseEntity>(request: UpdateEntityRequest<T>): Promise<EntityMutationResult>;
|
|
632
|
+
deleteEntity(request: DeleteEntityRequest): Promise<boolean>;
|
|
633
|
+
upsertEntity<T extends BaseEntity>(request: UpsertEntityRequest<T>): Promise<EntityMutationResult & {
|
|
634
|
+
created: boolean;
|
|
635
|
+
}>;
|
|
636
|
+
storeEmbedding(data: StoreEmbeddingData): Promise<void>;
|
|
637
|
+
backfillMissingEmbeddings(): Promise<EmbeddingBackfillResult>;
|
|
638
|
+
isIndexReady(): boolean;
|
|
639
|
+
awaitIndexReady(options: IndexReadinessOptions): Promise<IndexReadinessStatus>;
|
|
640
|
+
serializeEntity(entity: BaseEntity): string;
|
|
641
|
+
deserializeEntity(markdown: string, entityType: string): Partial<BaseEntity>;
|
|
642
|
+
countEmbeddings(): Promise<number>;
|
|
643
|
+
searchWithDistances(request: SearchWithDistancesRequest): Promise<Array<{
|
|
644
|
+
entityId: string;
|
|
645
|
+
entityType: string;
|
|
646
|
+
distance: number;
|
|
647
|
+
}>>;
|
|
648
|
+
initialize(): Promise<void>;
|
|
649
|
+
getAsyncJobStatus(jobId: string): Promise<{
|
|
650
|
+
status: "pending" | "processing" | "completed" | "failed";
|
|
651
|
+
error?: string;
|
|
652
|
+
} | null>;
|
|
653
|
+
}
|
|
654
|
+
//#endregion
|
|
655
|
+
//#region ../../shell/templates/src/permission-service.d.ts
|
|
652
656
|
/**
|
|
653
657
|
* User permission level schema
|
|
654
658
|
*/
|
|
655
659
|
type UserPermissionLevel = "anchor" | "trusted" | "public";
|
|
656
660
|
type EntityAction = "create" | "update" | "delete" | "extract" | "publish";
|
|
657
|
-
|
|
661
|
+
//#endregion
|
|
662
|
+
//#region ../../shell/templates/src/render-types.d.ts
|
|
658
663
|
/**
|
|
659
664
|
* Renderer output formats supported by view templates.
|
|
660
665
|
*/
|
|
661
666
|
type OutputFormat = "web" | "image" | "pdf";
|
|
662
|
-
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region ../../shell/plugins/src/contracts/agent.d.ts
|
|
663
669
|
declare const ChatAttachmentSourceSchema: z.ZodObject<{
|
|
664
|
-
|
|
665
|
-
|
|
670
|
+
kind: z.ZodString;
|
|
671
|
+
id: z.ZodString;
|
|
666
672
|
}>;
|
|
667
673
|
declare const TextChatAttachmentSchema: z.ZodObject<{
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
+
kind: z.ZodLiteral<"text">;
|
|
675
|
+
filename: z.ZodString;
|
|
676
|
+
mediaType: z.ZodString;
|
|
677
|
+
content: z.ZodString;
|
|
678
|
+
sizeBytes: z.ZodOptional<z.ZodNumber>;
|
|
679
|
+
source: z.ZodOptional<typeof ChatAttachmentSourceSchema>;
|
|
674
680
|
}>;
|
|
675
681
|
declare const fileAttachmentDataSchema: z.ZodType<Uint8Array, unknown>;
|
|
676
682
|
declare const FileChatAttachmentSchema: z.ZodObject<{
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
+
kind: z.ZodLiteral<"file">;
|
|
684
|
+
filename: z.ZodString;
|
|
685
|
+
mediaType: z.ZodString;
|
|
686
|
+
data: typeof fileAttachmentDataSchema;
|
|
687
|
+
sizeBytes: z.ZodOptional<z.ZodNumber>;
|
|
688
|
+
source: z.ZodOptional<typeof ChatAttachmentSourceSchema>;
|
|
683
689
|
}>;
|
|
684
|
-
declare const ChatAttachmentSchema: z.ZodDiscriminatedUnion<[
|
|
685
|
-
typeof TextChatAttachmentSchema,
|
|
686
|
-
typeof FileChatAttachmentSchema
|
|
687
|
-
], "kind">;
|
|
690
|
+
declare const ChatAttachmentSchema: z.ZodDiscriminatedUnion<[typeof TextChatAttachmentSchema, typeof FileChatAttachmentSchema], "kind">;
|
|
688
691
|
type ChatAttachment = z.output<typeof ChatAttachmentSchema>;
|
|
689
692
|
interface ChatContext {
|
|
690
|
-
|
|
691
|
-
|
|
693
|
+
userPermissionLevel?: "anchor" | "trusted" | "public" | undefined;
|
|
694
|
+
interfaceType?: string | undefined;
|
|
695
|
+
channelId?: string | undefined;
|
|
696
|
+
channelName?: string | undefined;
|
|
697
|
+
actor?: {
|
|
698
|
+
actorId: string;
|
|
699
|
+
canonicalId?: string | undefined;
|
|
700
|
+
interfaceType: string;
|
|
701
|
+
role: "user" | "assistant";
|
|
702
|
+
displayName?: string | undefined;
|
|
703
|
+
username?: string | undefined;
|
|
704
|
+
isBot?: boolean | undefined;
|
|
705
|
+
} | undefined;
|
|
706
|
+
source?: {
|
|
707
|
+
messageId?: string | undefined;
|
|
692
708
|
channelId?: string | undefined;
|
|
693
709
|
channelName?: string | undefined;
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
role: "user" | "assistant";
|
|
699
|
-
displayName?: string | undefined;
|
|
700
|
-
username?: string | undefined;
|
|
701
|
-
isBot?: boolean | undefined;
|
|
702
|
-
} | undefined;
|
|
703
|
-
source?: {
|
|
704
|
-
messageId?: string | undefined;
|
|
705
|
-
channelId?: string | undefined;
|
|
706
|
-
channelName?: string | undefined;
|
|
707
|
-
threadId?: string | undefined;
|
|
708
|
-
metadata?: Record<string, unknown> | undefined;
|
|
709
|
-
} | undefined;
|
|
710
|
-
attachments?: ChatAttachment[] | undefined;
|
|
710
|
+
threadId?: string | undefined;
|
|
711
|
+
metadata?: Record<string, unknown> | undefined;
|
|
712
|
+
} | undefined;
|
|
713
|
+
attachments?: ChatAttachment[] | undefined;
|
|
711
714
|
}
|
|
712
715
|
declare const ChatContextSchema: z.ZodType<ChatContext, unknown>;
|
|
713
716
|
interface AgentNamespace {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
+
chat(message: string, conversationId: string, context?: ChatContext): Promise<AgentResponse>;
|
|
718
|
+
confirmPendingAction(conversationId: string, confirmed: boolean, approvalId: string, context: ChatContext): Promise<AgentResponse>;
|
|
719
|
+
invalidate(): void;
|
|
717
720
|
}
|
|
718
|
-
|
|
721
|
+
//#endregion
|
|
722
|
+
//#region ../../shell/plugins/src/types/web-routes.d.ts
|
|
719
723
|
declare const WebRouteMethods: readonly ["GET", "POST", "PUT", "DELETE", "OPTIONS"];
|
|
720
724
|
type WebRouteMethod = (typeof WebRouteMethods)[number];
|
|
721
725
|
type WebRouteHandler = (request: Request) => Response | Promise<Response>;
|
|
722
726
|
interface WebRouteDefinition {
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
}
|
|
732
|
-
|
|
727
|
+
/** Absolute mounted path (e.g. "/cms" or "/cms-config") */
|
|
728
|
+
path: string;
|
|
729
|
+
/** HTTP method */
|
|
730
|
+
method?: WebRouteMethod;
|
|
731
|
+
/** Allow unauthenticated access */
|
|
732
|
+
public?: boolean;
|
|
733
|
+
/** Request handler */
|
|
734
|
+
handler: WebRouteHandler;
|
|
735
|
+
}
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region ../../shell/plugins/src/interfaces.d.ts
|
|
733
738
|
/**
|
|
734
739
|
* Endpoint info — plugins advertise their user-facing URLs via
|
|
735
740
|
* `context.endpoints.register({...})`. Shell collects and exposes
|
|
@@ -737,88 +742,90 @@ interface WebRouteDefinition {
|
|
|
737
742
|
* can render them without knowing about individual plugins.
|
|
738
743
|
*/
|
|
739
744
|
declare const userPermissionLevelSchema: z.ZodEnum<{
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
745
|
+
anchor: "anchor";
|
|
746
|
+
trusted: "trusted";
|
|
747
|
+
public: "public";
|
|
743
748
|
}>;
|
|
744
749
|
declare const endpointInfoSchema: z.ZodObject<{
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
+
label: z.ZodString;
|
|
751
|
+
url: z.ZodString;
|
|
752
|
+
pluginId: z.ZodString;
|
|
753
|
+
priority: z.ZodDefault<z.ZodNumber>;
|
|
754
|
+
visibility: z.ZodDefault<typeof userPermissionLevelSchema>;
|
|
750
755
|
}>;
|
|
751
756
|
declare const interactionKindSchema: z.ZodEnum<{
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
757
|
+
human: "human";
|
|
758
|
+
agent: "agent";
|
|
759
|
+
admin: "admin";
|
|
760
|
+
protocol: "protocol";
|
|
756
761
|
}>;
|
|
757
762
|
declare const interactionStatusSchema: z.ZodEnum<{
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
763
|
+
available: "available";
|
|
764
|
+
"coming-soon": "coming-soon";
|
|
765
|
+
disabled: "disabled";
|
|
761
766
|
}>;
|
|
762
767
|
declare const interactionInfoSchema: z.ZodObject<{
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
768
|
+
id: z.ZodString;
|
|
769
|
+
label: z.ZodString;
|
|
770
|
+
description: z.ZodOptional<z.ZodString>;
|
|
771
|
+
href: z.ZodString;
|
|
772
|
+
kind: typeof interactionKindSchema;
|
|
773
|
+
pluginId: z.ZodString;
|
|
774
|
+
priority: z.ZodDefault<z.ZodNumber>;
|
|
775
|
+
visibility: z.ZodDefault<typeof userPermissionLevelSchema>;
|
|
776
|
+
status: z.ZodDefault<typeof interactionStatusSchema>;
|
|
772
777
|
}>;
|
|
773
778
|
declare const entityCountSchema: z.ZodObject<{
|
|
774
|
-
|
|
775
|
-
|
|
779
|
+
entityType: z.ZodString;
|
|
780
|
+
count: z.ZodNumber;
|
|
776
781
|
}>;
|
|
777
782
|
/**
|
|
778
783
|
* Content generation configuration - unified config object
|
|
779
784
|
*/
|
|
780
785
|
interface ContentGenerationConfig {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
}
|
|
787
|
-
|
|
786
|
+
prompt: string;
|
|
787
|
+
templateName: string;
|
|
788
|
+
conversationHistory?: string;
|
|
789
|
+
data?: Record<string, unknown>;
|
|
790
|
+
interfacePermissionGrant?: UserPermissionLevel;
|
|
791
|
+
}
|
|
792
|
+
//#endregion
|
|
793
|
+
//#region ../../shell/plugins/src/contracts/app-info.d.ts
|
|
788
794
|
declare const DaemonHealthSchema: z.ZodObject<{
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
795
|
+
status: z.ZodEnum<{
|
|
796
|
+
healthy: "healthy";
|
|
797
|
+
warning: "warning";
|
|
798
|
+
error: "error";
|
|
799
|
+
unknown: "unknown";
|
|
800
|
+
}>;
|
|
801
|
+
message: z.ZodOptional<z.ZodString>;
|
|
802
|
+
lastCheck: z.ZodOptional<z.ZodString>;
|
|
803
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
798
804
|
}>;
|
|
799
805
|
declare const DaemonStatusSchema: z.ZodObject<{
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
806
|
+
name: z.ZodString;
|
|
807
|
+
pluginId: z.ZodString;
|
|
808
|
+
status: z.ZodString;
|
|
809
|
+
health: z.ZodOptional<typeof DaemonHealthSchema>;
|
|
804
810
|
}>;
|
|
805
811
|
declare const AppInfoSchema: z.ZodObject<{
|
|
812
|
+
model: z.ZodString;
|
|
813
|
+
version: z.ZodString;
|
|
814
|
+
uptime: z.ZodNumber;
|
|
815
|
+
entities: z.ZodNumber;
|
|
816
|
+
entityCounts: z.ZodArray<typeof entityCountSchema>;
|
|
817
|
+
embeddings: z.ZodNumber;
|
|
818
|
+
ai: z.ZodObject<{
|
|
806
819
|
model: z.ZodString;
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
ai: z.ZodObject<{
|
|
813
|
-
model: z.ZodString;
|
|
814
|
-
embeddingModel: z.ZodString;
|
|
815
|
-
}>;
|
|
816
|
-
daemons: z.ZodArray<typeof DaemonStatusSchema>;
|
|
817
|
-
endpoints: z.ZodArray<typeof endpointInfoSchema>;
|
|
818
|
-
interactions: z.ZodArray<typeof interactionInfoSchema>;
|
|
820
|
+
embeddingModel: z.ZodString;
|
|
821
|
+
}>;
|
|
822
|
+
daemons: z.ZodArray<typeof DaemonStatusSchema>;
|
|
823
|
+
endpoints: z.ZodArray<typeof endpointInfoSchema>;
|
|
824
|
+
interactions: z.ZodArray<typeof interactionInfoSchema>;
|
|
819
825
|
}>;
|
|
820
826
|
type AppInfo = z.output<typeof AppInfoSchema>;
|
|
821
|
-
|
|
827
|
+
//#endregion
|
|
828
|
+
//#region ../../shell/plugins/src/contracts/metadata.d.ts
|
|
822
829
|
/**
|
|
823
830
|
* Best-effort extension metadata carried across public DTO boundaries.
|
|
824
831
|
*
|
|
@@ -828,567 +835,573 @@ type AppInfo = z.output<typeof AppInfoSchema>;
|
|
|
828
835
|
*/
|
|
829
836
|
declare const ExtensionMetadataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
830
837
|
type ExtensionMetadata = z.output<typeof ExtensionMetadataSchema>;
|
|
831
|
-
|
|
838
|
+
//#endregion
|
|
839
|
+
//#region ../../shell/plugins/src/contracts/conversations.d.ts
|
|
832
840
|
declare const ConversationSchema: z.ZodObject<{
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
841
|
+
id: z.ZodString;
|
|
842
|
+
sessionId: z.ZodString;
|
|
843
|
+
interfaceType: z.ZodString;
|
|
844
|
+
channelId: z.ZodString;
|
|
845
|
+
channelName: z.ZodOptional<z.ZodString>;
|
|
846
|
+
startedAt: z.ZodString;
|
|
847
|
+
lastActiveAt: z.ZodString;
|
|
848
|
+
createdAt: z.ZodString;
|
|
849
|
+
updatedAt: z.ZodString;
|
|
850
|
+
metadata: typeof ExtensionMetadataSchema;
|
|
843
851
|
}>;
|
|
844
852
|
type Conversation = z.output<typeof ConversationSchema>;
|
|
845
853
|
declare const MessageSchema: z.ZodObject<{
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
854
|
+
id: z.ZodString;
|
|
855
|
+
conversationId: z.ZodString;
|
|
856
|
+
role: typeof messageRoleSchema;
|
|
857
|
+
content: z.ZodString;
|
|
858
|
+
timestamp: z.ZodString;
|
|
859
|
+
metadata: typeof ExtensionMetadataSchema;
|
|
852
860
|
}>;
|
|
853
861
|
type Message = z.output<typeof MessageSchema>;
|
|
854
|
-
|
|
862
|
+
//#endregion
|
|
863
|
+
//#region ../../shell/plugins/src/contracts/identity.d.ts
|
|
855
864
|
declare const BrainCharacterSchema: z.ZodObject<{
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
865
|
+
name: z.ZodString;
|
|
866
|
+
role: z.ZodString;
|
|
867
|
+
purpose: z.ZodString;
|
|
868
|
+
values: z.ZodArray<z.ZodString>;
|
|
860
869
|
}>;
|
|
861
870
|
type BrainCharacter = z.output<typeof BrainCharacterSchema>;
|
|
862
871
|
declare const AnchorProfileSchema: z.ZodObject<{
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
872
|
+
name: z.ZodString;
|
|
873
|
+
kind: z.ZodEnum<{
|
|
874
|
+
professional: "professional";
|
|
875
|
+
team: "team";
|
|
876
|
+
collective: "collective";
|
|
877
|
+
}>;
|
|
878
|
+
organization: z.ZodOptional<z.ZodString>;
|
|
879
|
+
description: z.ZodOptional<z.ZodString>;
|
|
880
|
+
avatar: z.ZodOptional<z.ZodString>;
|
|
881
|
+
website: z.ZodOptional<z.ZodString>;
|
|
882
|
+
email: z.ZodOptional<z.ZodString>;
|
|
883
|
+
socialLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
884
|
+
platform: z.ZodEnum<{
|
|
885
|
+
github: "github";
|
|
886
|
+
instagram: "instagram";
|
|
887
|
+
linkedin: "linkedin";
|
|
888
|
+
email: "email";
|
|
889
|
+
website: "website";
|
|
868
890
|
}>;
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
website: z.ZodOptional<z.ZodString>;
|
|
873
|
-
email: z.ZodOptional<z.ZodString>;
|
|
874
|
-
socialLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
875
|
-
platform: z.ZodEnum<{
|
|
876
|
-
github: "github";
|
|
877
|
-
instagram: "instagram";
|
|
878
|
-
linkedin: "linkedin";
|
|
879
|
-
email: "email";
|
|
880
|
-
website: "website";
|
|
881
|
-
}>;
|
|
882
|
-
url: z.ZodString;
|
|
883
|
-
label: z.ZodOptional<z.ZodString>;
|
|
884
|
-
}>>>;
|
|
891
|
+
url: z.ZodString;
|
|
892
|
+
label: z.ZodOptional<z.ZodString>;
|
|
893
|
+
}>>>;
|
|
885
894
|
}>;
|
|
886
895
|
type AnchorProfile = z.output<typeof AnchorProfileSchema>;
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
}>
|
|
897
|
-
]>;
|
|
896
|
+
//#endregion
|
|
897
|
+
//#region ../../shell/plugins/src/contracts/messaging.d.ts
|
|
898
|
+
declare const MessageResponseSchema: z.ZodUnion<[z.ZodObject<{
|
|
899
|
+
success: z.ZodBoolean;
|
|
900
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
901
|
+
error: z.ZodOptional<z.ZodString>;
|
|
902
|
+
}>, z.ZodObject<{
|
|
903
|
+
noop: z.ZodLiteral<true>;
|
|
904
|
+
}>]>;
|
|
898
905
|
type MessageResponse<T = unknown> = ({
|
|
899
|
-
|
|
900
|
-
|
|
906
|
+
success: boolean;
|
|
907
|
+
error?: string | undefined;
|
|
901
908
|
} & {
|
|
902
|
-
|
|
909
|
+
data?: T | undefined;
|
|
903
910
|
}) | {
|
|
904
|
-
|
|
911
|
+
noop: true;
|
|
905
912
|
};
|
|
906
913
|
declare const BaseMessageSchema: z.ZodObject<{
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
914
|
+
id: z.ZodString;
|
|
915
|
+
timestamp: z.ZodString;
|
|
916
|
+
type: z.ZodString;
|
|
917
|
+
source: z.ZodString;
|
|
918
|
+
target: z.ZodOptional<z.ZodString>;
|
|
919
|
+
metadata: z.ZodOptional<typeof ExtensionMetadataSchema>;
|
|
913
920
|
}>;
|
|
914
921
|
type BaseMessage = z.output<typeof BaseMessageSchema>;
|
|
915
922
|
type MessageWithPayload<T = unknown> = BaseMessage & {
|
|
916
|
-
|
|
923
|
+
payload: T;
|
|
917
924
|
};
|
|
918
925
|
interface MessageSendOptions {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
926
|
+
target?: string;
|
|
927
|
+
metadata?: z.output<typeof ExtensionMetadataSchema>;
|
|
928
|
+
broadcast?: boolean;
|
|
922
929
|
}
|
|
923
930
|
interface MessageSendRequest<T = unknown> extends MessageSendOptions {
|
|
924
|
-
|
|
925
|
-
|
|
931
|
+
type: string;
|
|
932
|
+
payload: T;
|
|
926
933
|
}
|
|
927
934
|
type MessageSender<T = unknown, R = unknown> = (request: MessageSendRequest<T>) => Promise<MessageResponse<R>>;
|
|
928
935
|
interface MessageContext {
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
}
|
|
937
|
-
|
|
936
|
+
userId?: string;
|
|
937
|
+
channelId?: string;
|
|
938
|
+
messageId?: string;
|
|
939
|
+
timestamp?: string;
|
|
940
|
+
interfaceType?: string;
|
|
941
|
+
userPermissionLevel?: UserPermissionLevel;
|
|
942
|
+
threadId?: string;
|
|
943
|
+
}
|
|
944
|
+
//#endregion
|
|
945
|
+
//#region ../../shell/plugins/src/entity/context.d.ts
|
|
938
946
|
type AIGenerationSchema<T> = ZodType<T>;
|
|
939
947
|
type AspectRatio = "1:1" | "16:9" | "9:16" | "4:3" | "3:4";
|
|
940
948
|
interface ImageGenerationOptions {
|
|
941
|
-
|
|
949
|
+
aspectRatio?: AspectRatio;
|
|
942
950
|
}
|
|
943
951
|
interface ImageGenerationResult {
|
|
944
|
-
|
|
945
|
-
|
|
952
|
+
base64: string;
|
|
953
|
+
dataUrl: string;
|
|
946
954
|
}
|
|
947
955
|
/**
|
|
948
956
|
* AI namespace for entity plugins — includes generation capabilities
|
|
949
957
|
*/
|
|
950
958
|
interface IEntityAINamespace {
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
}
|
|
964
|
-
|
|
959
|
+
/** Query the AI with optional context */
|
|
960
|
+
query: (prompt: string, context?: Record<string, unknown>) => Promise<DefaultQueryResponse>;
|
|
961
|
+
/** Generate content using AI with template */
|
|
962
|
+
generate: <T = unknown>(config: ContentGenerationConfig) => Promise<T>;
|
|
963
|
+
/** Generate a structured object using AI with a schema parser */
|
|
964
|
+
generateObject: <T>(prompt: string, schema: AIGenerationSchema<T>) => Promise<{
|
|
965
|
+
object: T;
|
|
966
|
+
}>;
|
|
967
|
+
/** Generate an image using AI (requires AI_API_KEY) */
|
|
968
|
+
generateImage: (prompt: string, options?: ImageGenerationOptions) => Promise<ImageGenerationResult>;
|
|
969
|
+
/** Check if image generation is available */
|
|
970
|
+
canGenerateImages: () => boolean;
|
|
971
|
+
}
|
|
972
|
+
//#endregion
|
|
973
|
+
//#region ../../shell/plugins/src/public/types.d.ts
|
|
965
974
|
type PluginConfig = Record<string, unknown>;
|
|
966
975
|
type PluginConfigInput<T extends {
|
|
967
|
-
|
|
976
|
+
_input: unknown;
|
|
968
977
|
}> = T["_input"];
|
|
969
978
|
interface SafeParserSchema<T> {
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
};
|
|
979
|
+
safeParse(input: unknown): {
|
|
980
|
+
success: true;
|
|
981
|
+
data: T;
|
|
982
|
+
} | {
|
|
983
|
+
success: false;
|
|
984
|
+
error: {
|
|
985
|
+
message: string;
|
|
978
986
|
};
|
|
987
|
+
};
|
|
979
988
|
}
|
|
980
989
|
interface JudgeInput<T> {
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
990
|
+
instruction: string;
|
|
991
|
+
material: string;
|
|
992
|
+
schema: z.ZodType<T, unknown>;
|
|
984
993
|
}
|
|
985
994
|
interface Plugin {
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
+
readonly id: string;
|
|
996
|
+
readonly version: string;
|
|
997
|
+
readonly type: "core" | "entity" | "service" | "interface";
|
|
998
|
+
readonly packageName: string;
|
|
999
|
+
readonly description?: string;
|
|
1000
|
+
readonly dependencies?: string[];
|
|
1001
|
+
ready?(): Promise<void>;
|
|
1002
|
+
shutdown?(): Promise<void>;
|
|
1003
|
+
requiresDaemonStartup?(): boolean;
|
|
995
1004
|
}
|
|
996
1005
|
type PluginFactory = (config: PluginConfig) => Plugin | Plugin[];
|
|
997
1006
|
interface Logger {
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1007
|
+
debug(message: string, data?: unknown): void;
|
|
1008
|
+
info(message: string, data?: unknown): void;
|
|
1009
|
+
warn(message: string, data?: unknown): void;
|
|
1010
|
+
error(message: string, data?: unknown): void;
|
|
1011
|
+
child(context: string): Logger;
|
|
1003
1012
|
}
|
|
1004
1013
|
interface ToolContext {
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1014
|
+
progressToken?: string | number;
|
|
1015
|
+
sendProgress?: (notification: {
|
|
1016
|
+
progress?: number;
|
|
1017
|
+
total?: number;
|
|
1018
|
+
message?: string;
|
|
1019
|
+
}) => Promise<void>;
|
|
1020
|
+
interfaceType?: string;
|
|
1021
|
+
userId?: string;
|
|
1022
|
+
conversationId?: string;
|
|
1023
|
+
channelId?: string;
|
|
1024
|
+
channelName?: string;
|
|
1025
|
+
runId?: string;
|
|
1026
|
+
toolCallId?: string;
|
|
1027
|
+
userPermissionLevel?: UserPermissionLevel;
|
|
1019
1028
|
}
|
|
1020
1029
|
interface ToolResponse<T = unknown> {
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1030
|
+
success: boolean;
|
|
1031
|
+
data?: T;
|
|
1032
|
+
error?: string;
|
|
1024
1033
|
}
|
|
1025
1034
|
type ToolVisibility = UserPermissionLevel;
|
|
1026
1035
|
interface ToolConfirmation {
|
|
1027
|
-
|
|
1028
|
-
|
|
1036
|
+
required: boolean;
|
|
1037
|
+
message?: string;
|
|
1029
1038
|
}
|
|
1030
1039
|
type ToolSideEffects = "none" | "writes" | "external";
|
|
1031
1040
|
interface Tool<TArgs = unknown, TResult = unknown> {
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1041
|
+
name: string;
|
|
1042
|
+
description: string;
|
|
1043
|
+
inputSchema: Record<string, unknown>;
|
|
1044
|
+
handler: (args: TArgs, context: ToolContext) => Promise<TResult> | TResult;
|
|
1045
|
+
visibility?: ToolVisibility;
|
|
1046
|
+
confirmation?: ToolConfirmation;
|
|
1047
|
+
sideEffects?: ToolSideEffects;
|
|
1039
1048
|
}
|
|
1040
1049
|
interface Resource<TResult = unknown> {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1050
|
+
uri: string;
|
|
1051
|
+
name: string;
|
|
1052
|
+
description?: string;
|
|
1053
|
+
mimeType?: string;
|
|
1054
|
+
handler: () => Promise<TResult> | TResult;
|
|
1046
1055
|
}
|
|
1047
1056
|
interface ResourceTemplate<K extends string = string> {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1057
|
+
uriTemplate: K;
|
|
1058
|
+
name: string;
|
|
1059
|
+
description?: string;
|
|
1060
|
+
mimeType?: string;
|
|
1052
1061
|
}
|
|
1053
1062
|
interface Prompt {
|
|
1063
|
+
name: string;
|
|
1064
|
+
description?: string;
|
|
1065
|
+
arguments?: Array<{
|
|
1054
1066
|
name: string;
|
|
1055
1067
|
description?: string;
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
description?: string;
|
|
1059
|
-
required?: boolean;
|
|
1060
|
-
}>;
|
|
1068
|
+
required?: boolean;
|
|
1069
|
+
}>;
|
|
1061
1070
|
}
|
|
1062
1071
|
declare function createTool<TArgs = unknown, TResult = unknown>(tool: Tool<TArgs, TResult>): Tool<TArgs, TResult>;
|
|
1063
1072
|
declare function createResource<TResult = unknown>(resource: Resource<TResult>): Resource<TResult>;
|
|
1064
1073
|
declare function toolSuccess<T = unknown>(data?: T): ToolResponse<T>;
|
|
1065
1074
|
declare function toolError(error: string): ToolResponse<never>;
|
|
1066
1075
|
interface BaseJobTrackingInfo {
|
|
1067
|
-
|
|
1076
|
+
rootJobId: string;
|
|
1068
1077
|
}
|
|
1069
1078
|
interface MessageJobTrackingInfo extends BaseJobTrackingInfo {
|
|
1070
|
-
|
|
1071
|
-
|
|
1079
|
+
messageId?: string;
|
|
1080
|
+
channelId?: string;
|
|
1072
1081
|
}
|
|
1073
1082
|
type JobProgressStatus = "pending" | "processing" | "completed" | "failed";
|
|
1074
1083
|
interface JobProgressContext {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1084
|
+
rootJobId: string;
|
|
1085
|
+
operationType: "file_operations" | "content_operations" | "data_processing" | "batch_processing";
|
|
1086
|
+
pluginId?: string | undefined;
|
|
1087
|
+
progressToken?: string | number | undefined;
|
|
1088
|
+
operationTarget?: string | undefined;
|
|
1089
|
+
interfaceType?: string | undefined;
|
|
1090
|
+
conversationId?: string | undefined;
|
|
1091
|
+
channelId?: string | undefined;
|
|
1083
1092
|
}
|
|
1084
1093
|
interface JobProgressEvent {
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1094
|
+
id: string;
|
|
1095
|
+
type: "job" | "batch";
|
|
1096
|
+
status: JobProgressStatus;
|
|
1097
|
+
message?: string | undefined;
|
|
1098
|
+
progress?: {
|
|
1099
|
+
current: number;
|
|
1100
|
+
total: number;
|
|
1101
|
+
percentage: number;
|
|
1102
|
+
} | undefined;
|
|
1103
|
+
aggregationKey?: string | undefined;
|
|
1104
|
+
batchDetails?: {
|
|
1105
|
+
totalOperations: number;
|
|
1106
|
+
completedOperations: number;
|
|
1107
|
+
failedOperations: number;
|
|
1108
|
+
currentOperation?: string | undefined;
|
|
1109
|
+
errors?: string[] | undefined;
|
|
1110
|
+
} | undefined;
|
|
1111
|
+
jobDetails?: {
|
|
1112
|
+
jobType: string;
|
|
1113
|
+
priority: number;
|
|
1114
|
+
retryCount: number;
|
|
1115
|
+
} | undefined;
|
|
1116
|
+
metadata: JobProgressContext;
|
|
1108
1117
|
}
|
|
1109
1118
|
declare const urlCaptureConfigSchema: z.ZodObject<{
|
|
1110
|
-
|
|
1111
|
-
|
|
1119
|
+
captureUrls: z.ZodDefault<z.ZodBoolean>;
|
|
1120
|
+
blockedUrlDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1112
1121
|
}>;
|
|
1113
1122
|
interface Channel<TPayload, TResponse = unknown> {
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1123
|
+
readonly name: string;
|
|
1124
|
+
readonly schema: SafeParserSchema<TPayload>;
|
|
1125
|
+
readonly _response?: TResponse;
|
|
1117
1126
|
}
|
|
1118
1127
|
declare function defineChannel<TPayload, TResponse = unknown>(name: string, schema: SafeParserSchema<TPayload>): Channel<TPayload, TResponse>;
|
|
1119
1128
|
type PublicEntityServiceMethods = "getEntity" | "listEntities" | "search" | "getEntityTypes" | "hasEntityType" | "countEntities" | "getEntityCounts" | "getEntityTypeConfig";
|
|
1120
1129
|
type IEntityService = Pick<ICoreEntityService, PublicEntityServiceMethods>;
|
|
1121
|
-
|
|
1122
1130
|
interface IIdentityNamespace {
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1131
|
+
get: () => BrainCharacter;
|
|
1132
|
+
getProfile: () => AnchorProfile;
|
|
1133
|
+
getAppInfo: () => Promise<AppInfo>;
|
|
1126
1134
|
}
|
|
1127
1135
|
interface IConversationsNamespace {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1136
|
+
get(conversationId: string): Promise<Conversation | null>;
|
|
1137
|
+
search(query: string): Promise<Conversation[]>;
|
|
1138
|
+
list(options?: {
|
|
1139
|
+
limit?: number;
|
|
1140
|
+
updatedAfter?: string;
|
|
1141
|
+
interfaceType?: string;
|
|
1142
|
+
sessionId?: string;
|
|
1143
|
+
channelId?: string;
|
|
1144
|
+
}): Promise<Conversation[]>;
|
|
1145
|
+
getMessages(conversationId: string, options?: {
|
|
1146
|
+
limit?: number;
|
|
1147
|
+
range?: {
|
|
1148
|
+
start: number;
|
|
1149
|
+
end: number;
|
|
1150
|
+
};
|
|
1151
|
+
}): Promise<Message[]>;
|
|
1144
1152
|
}
|
|
1145
1153
|
interface IMessagingNamespace {
|
|
1146
|
-
|
|
1147
|
-
|
|
1154
|
+
send: MessageSender;
|
|
1155
|
+
subscribe<T = unknown, R = unknown>(channel: string | Channel<T, R>, handler: (message: MessageWithPayload<T>) => Promise<MessageResponse<R>>): () => void;
|
|
1148
1156
|
}
|
|
1149
1157
|
type EvalHandler<TInput = unknown, TOutput = unknown> = (input: TInput) => Promise<TOutput>;
|
|
1150
1158
|
type InsightHandler = (entityService: IEntityService, visibilityScope: ContentVisibility) => Promise<Record<string, unknown>>;
|
|
1151
1159
|
interface IEvalNamespace {
|
|
1152
|
-
|
|
1160
|
+
registerHandler(handlerId: string, handler: EvalHandler): void;
|
|
1153
1161
|
}
|
|
1154
1162
|
interface IInsightsNamespace {
|
|
1155
|
-
|
|
1163
|
+
register(type: string, handler: InsightHandler): void;
|
|
1156
1164
|
}
|
|
1157
1165
|
interface IPermissionsNamespace {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1166
|
+
assertEntityActionAllowed(entityType: string, action: EntityAction, context: {
|
|
1167
|
+
userPermissionLevel?: UserPermissionLevel | undefined;
|
|
1168
|
+
}): void;
|
|
1161
1169
|
}
|
|
1162
1170
|
interface RuntimeUploadRecord {
|
|
1171
|
+
id: string;
|
|
1172
|
+
ref: {
|
|
1173
|
+
kind: string;
|
|
1163
1174
|
id: string;
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
sizeBytes: number;
|
|
1171
|
-
createdAt: string;
|
|
1172
|
-
metadata?: Record<string, unknown> | undefined;
|
|
1175
|
+
};
|
|
1176
|
+
filename: string;
|
|
1177
|
+
mediaType: string;
|
|
1178
|
+
sizeBytes: number;
|
|
1179
|
+
createdAt: string;
|
|
1180
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1173
1181
|
}
|
|
1174
1182
|
interface RuntimeUploadResponseBody extends RuntimeUploadRecord {
|
|
1175
|
-
|
|
1176
|
-
|
|
1183
|
+
url: string;
|
|
1184
|
+
downloadUrl: string;
|
|
1177
1185
|
}
|
|
1178
1186
|
interface ResolvedRuntimeUpload {
|
|
1179
|
-
|
|
1180
|
-
|
|
1187
|
+
record: RuntimeUploadRecord;
|
|
1188
|
+
content: Buffer;
|
|
1181
1189
|
}
|
|
1182
1190
|
interface SaveRuntimeUploadInput {
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1191
|
+
filename: string;
|
|
1192
|
+
mediaType: string;
|
|
1193
|
+
content: Buffer;
|
|
1194
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1187
1195
|
}
|
|
1188
1196
|
interface RuntimeUploadScopeOptions {
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1197
|
+
namespace: string;
|
|
1198
|
+
refKind: string;
|
|
1199
|
+
routePath: string;
|
|
1200
|
+
retentionMs?: number | undefined;
|
|
1201
|
+
maxCount?: number | undefined;
|
|
1194
1202
|
}
|
|
1195
1203
|
interface RuntimeUploadStore {
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1204
|
+
save(input: SaveRuntimeUploadInput): Promise<RuntimeUploadRecord>;
|
|
1205
|
+
read(uploadId: string): Promise<ResolvedRuntimeUpload>;
|
|
1206
|
+
readRecord(uploadId: string): Promise<RuntimeUploadRecord>;
|
|
1207
|
+
toResponseBody(record: RuntimeUploadRecord): RuntimeUploadResponseBody;
|
|
1208
|
+
prune(): Promise<void>;
|
|
1209
|
+
getUploadDir(uploadId: string): string;
|
|
1202
1210
|
}
|
|
1203
1211
|
interface IRuntimeUploadsNamespace {
|
|
1204
|
-
|
|
1212
|
+
scoped(options: RuntimeUploadScopeOptions): RuntimeUploadStore;
|
|
1205
1213
|
}
|
|
1206
1214
|
interface BasePluginContext {
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1215
|
+
readonly pluginId: string;
|
|
1216
|
+
readonly logger: Logger;
|
|
1217
|
+
readonly dataDir: string;
|
|
1218
|
+
readonly domain: string | undefined;
|
|
1219
|
+
readonly siteUrl: string | undefined;
|
|
1220
|
+
readonly localSiteUrl: string | undefined;
|
|
1221
|
+
readonly previewUrl: string | undefined;
|
|
1222
|
+
readonly preferLocalUrls: boolean;
|
|
1223
|
+
readonly appInfo: () => Promise<AppInfo>;
|
|
1224
|
+
readonly judge: <T>(input: JudgeInput<T>) => Promise<{
|
|
1225
|
+
verdict: T;
|
|
1226
|
+
usage: {
|
|
1227
|
+
promptTokens: number;
|
|
1228
|
+
completionTokens: number;
|
|
1229
|
+
totalTokens: number;
|
|
1230
|
+
};
|
|
1231
|
+
}>;
|
|
1232
|
+
readonly entityService: IEntityService;
|
|
1233
|
+
readonly identity: IIdentityNamespace;
|
|
1234
|
+
readonly messaging: IMessagingNamespace;
|
|
1235
|
+
readonly conversations: IConversationsNamespace;
|
|
1236
|
+
readonly eval: IEvalNamespace;
|
|
1237
|
+
readonly insights: IInsightsNamespace;
|
|
1238
|
+
readonly permissions: IPermissionsNamespace;
|
|
1239
|
+
readonly uploads: IRuntimeUploadsNamespace;
|
|
1232
1240
|
}
|
|
1233
1241
|
interface IPromptsNamespace {
|
|
1234
|
-
|
|
1242
|
+
resolve(target: string, fallback: string): Promise<string>;
|
|
1235
1243
|
}
|
|
1236
1244
|
interface IServiceTemplatesNamespace {
|
|
1237
|
-
|
|
1245
|
+
register(templates: unknown): void;
|
|
1238
1246
|
}
|
|
1239
1247
|
interface IViewsNamespace {
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1248
|
+
get(name: string): unknown | undefined;
|
|
1249
|
+
list(): unknown[];
|
|
1250
|
+
hasRenderer(templateName: string, format?: OutputFormat): boolean;
|
|
1251
|
+
getRenderer(templateName: string, format?: OutputFormat): unknown | undefined;
|
|
1252
|
+
validate(templateName: string, content: unknown): boolean;
|
|
1245
1253
|
}
|
|
1246
1254
|
interface FrontmatterSchemaParser {
|
|
1247
|
-
|
|
1255
|
+
parse(data: unknown): unknown;
|
|
1248
1256
|
}
|
|
1249
1257
|
interface EntityPluginEntitiesNamespace extends Omit<IEntitiesNamespace, "getEffectiveFrontmatterSchema"> {
|
|
1250
|
-
|
|
1258
|
+
getEffectiveFrontmatterSchema(type: string): FrontmatterSchemaParser | undefined;
|
|
1251
1259
|
}
|
|
1252
1260
|
interface ServicePluginContext extends BasePluginContext {
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1261
|
+
readonly entities: IEntitiesNamespace;
|
|
1262
|
+
readonly templates: IServiceTemplatesNamespace;
|
|
1263
|
+
readonly views: IViewsNamespace;
|
|
1264
|
+
readonly prompts: IPromptsNamespace;
|
|
1265
|
+
readonly ai: IEntityAINamespace;
|
|
1266
|
+
registerInstructions(instructions: string): void;
|
|
1259
1267
|
}
|
|
1260
1268
|
interface EntityPluginContext extends BasePluginContext {
|
|
1261
|
-
|
|
1262
|
-
|
|
1269
|
+
readonly entities: EntityPluginEntitiesNamespace;
|
|
1270
|
+
readonly prompts: IPromptsNamespace;
|
|
1263
1271
|
}
|
|
1264
1272
|
interface InterfacePluginContext extends BasePluginContext {
|
|
1265
|
-
|
|
1273
|
+
readonly agent: AgentNamespace;
|
|
1266
1274
|
}
|
|
1267
|
-
|
|
1275
|
+
//#endregion
|
|
1276
|
+
//#region ../../shell/plugins/src/config.d.ts
|
|
1268
1277
|
/**
|
|
1269
1278
|
* Type helpers for plugin configuration
|
|
1270
1279
|
*/
|
|
1271
1280
|
type PluginConfigSchema<TConfig> = ZodType<TConfig, unknown>;
|
|
1272
|
-
|
|
1281
|
+
//#endregion
|
|
1282
|
+
//#region ../../shell/plugins/src/public/entity-plugin.d.ts
|
|
1273
1283
|
type EntitySchema<TEntity extends BaseEntity> = EntityAdapter<TEntity>["schema"];
|
|
1274
1284
|
declare abstract class EntityPlugin<TEntity extends BaseEntity, TConfig, TConfigInput> implements Plugin {
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1285
|
+
readonly type = "entity";
|
|
1286
|
+
readonly id: string;
|
|
1287
|
+
readonly version: string;
|
|
1288
|
+
readonly packageName: string;
|
|
1289
|
+
readonly description?: string;
|
|
1290
|
+
abstract readonly entityType: string;
|
|
1291
|
+
abstract readonly schema: EntitySchema<TEntity>;
|
|
1292
|
+
abstract readonly adapter: EntityAdapter<TEntity>;
|
|
1293
|
+
private readonly delegate;
|
|
1294
|
+
protected constructor(id: string, packageJson: {
|
|
1295
|
+
name: string;
|
|
1296
|
+
version: string;
|
|
1297
|
+
description?: string;
|
|
1298
|
+
}, config: TConfigInput, configSchema: PluginConfigSchema<TConfig>);
|
|
1299
|
+
protected onRegister(_context: EntityPluginContext): Promise<void>;
|
|
1300
|
+
protected onReady(_context: EntityPluginContext): Promise<void>;
|
|
1301
|
+
protected onShutdown(): Promise<void>;
|
|
1302
|
+
protected getInstructions(): Promise<string | undefined>;
|
|
1303
|
+
protected getEntityTypeConfig(): EntityTypeConfig | undefined;
|
|
1304
|
+
protected getDataSources(): DataSource[];
|
|
1305
|
+
protected interceptCreate(input: CreateInput, _executionContext: CreateExecutionContext, _context: EntityPluginContext): Promise<CreateInterceptionResult>;
|
|
1306
|
+
ready(): Promise<void>;
|
|
1307
|
+
shutdown(): Promise<void>;
|
|
1308
|
+
}
|
|
1309
|
+
//#endregion
|
|
1310
|
+
//#region ../../shell/plugins/src/public/interface-plugin.d.ts
|
|
1300
1311
|
declare abstract class InterfacePlugin<TConfig, TConfigInput, TTrackingInfo extends BaseJobTrackingInfo = BaseJobTrackingInfo> implements Plugin {
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1312
|
+
readonly type = "interface";
|
|
1313
|
+
readonly id: string;
|
|
1314
|
+
readonly version: string;
|
|
1315
|
+
readonly packageName: string;
|
|
1316
|
+
readonly description?: string;
|
|
1317
|
+
private readonly delegate;
|
|
1318
|
+
protected constructor(id: string, packageJson: {
|
|
1319
|
+
name: string;
|
|
1320
|
+
version: string;
|
|
1321
|
+
description?: string;
|
|
1322
|
+
}, config: TConfigInput, configSchema: PluginConfigSchema<TConfig>);
|
|
1323
|
+
protected onRegister(_context: InterfacePluginContext): Promise<void>;
|
|
1324
|
+
protected onReady(_context: InterfacePluginContext): Promise<void>;
|
|
1325
|
+
protected onShutdown(): Promise<void>;
|
|
1326
|
+
protected getTools(): Promise<Tool[]>;
|
|
1327
|
+
protected getResources(): Promise<Resource[]>;
|
|
1328
|
+
protected getInstructions(): Promise<string | undefined>;
|
|
1329
|
+
getWebRoutes(): WebRouteDefinition[];
|
|
1330
|
+
requiresDaemonStartup(): boolean;
|
|
1331
|
+
ready(): Promise<void>;
|
|
1332
|
+
shutdown(): Promise<void>;
|
|
1333
|
+
}
|
|
1334
|
+
//#endregion
|
|
1335
|
+
//#region ../../shell/plugins/src/message-interface/message-interface-plugin.d.ts
|
|
1324
1336
|
type MessageInterfaceOutput = string | {
|
|
1325
|
-
|
|
1326
|
-
|
|
1337
|
+
card: unknown;
|
|
1338
|
+
fallbackText?: string;
|
|
1327
1339
|
};
|
|
1328
1340
|
interface SendMessageToChannelRequest {
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1341
|
+
/** The channel/room to send to (null for single-channel interfaces like CLI) */
|
|
1342
|
+
channelId: string | null;
|
|
1343
|
+
/** The message or structured output to send */
|
|
1344
|
+
message: MessageInterfaceOutput;
|
|
1333
1345
|
}
|
|
1334
1346
|
type SendMessageWithIdRequest = SendMessageToChannelRequest;
|
|
1335
1347
|
interface EditMessageRequest {
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1348
|
+
channelId: string | null;
|
|
1349
|
+
messageId: string;
|
|
1350
|
+
newMessage: MessageInterfaceOutput;
|
|
1339
1351
|
}
|
|
1340
|
-
|
|
1352
|
+
//#endregion
|
|
1353
|
+
//#region ../../shell/plugins/src/public/message-interface-plugin.d.ts
|
|
1341
1354
|
declare abstract class MessageInterfacePlugin<TConfig, TConfigInput, TTrackingInfo extends MessageJobTrackingInfo = MessageJobTrackingInfo> extends InterfacePlugin<TConfig, TConfigInput, TTrackingInfo> {
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1355
|
+
private readonly messageDelegate;
|
|
1356
|
+
protected constructor(id: string, packageJson: {
|
|
1357
|
+
name: string;
|
|
1358
|
+
version: string;
|
|
1359
|
+
description?: string;
|
|
1360
|
+
}, config: TConfigInput, configSchema: PluginConfigSchema<TConfig>);
|
|
1361
|
+
protected abstract sendMessageToChannel(request: SendMessageToChannelRequest): void;
|
|
1362
|
+
protected override onRegister(_context: InterfacePluginContext): Promise<void>;
|
|
1363
|
+
protected override onReady(_context: InterfacePluginContext): Promise<void>;
|
|
1364
|
+
protected override onShutdown(): Promise<void>;
|
|
1365
|
+
protected override getTools(): Promise<Tool[]>;
|
|
1366
|
+
protected override getResources(): Promise<Resource[]>;
|
|
1367
|
+
protected override getInstructions(): Promise<string | undefined>;
|
|
1368
|
+
protected sendMessageWithId(_request: SendMessageWithIdRequest): Promise<string | undefined>;
|
|
1369
|
+
protected editMessage(_request: EditMessageRequest): Promise<boolean>;
|
|
1370
|
+
protected supportsMessageEditing(): boolean;
|
|
1371
|
+
protected onProgressUpdate(_event: JobProgressEvent): Promise<void>;
|
|
1372
|
+
protected trackAgentResponseForJob(jobId: string, messageId: string, channelId: string): void;
|
|
1373
|
+
registerProgressCallback(callback: (events: JobProgressEvent[]) => void): void;
|
|
1374
|
+
unregisterProgressCallback(): void;
|
|
1375
|
+
getProgressEvents(): JobProgressEvent[];
|
|
1376
|
+
getActiveProgressEvents(): JobProgressEvent[];
|
|
1377
|
+
startProcessingInput(channelId?: string | null): void;
|
|
1378
|
+
endProcessingInput(): void;
|
|
1379
|
+
protected getCurrentChannelId(): string | null;
|
|
1380
|
+
override ready(): Promise<void>;
|
|
1381
|
+
override shutdown(): Promise<void>;
|
|
1382
|
+
}
|
|
1383
|
+
//#endregion
|
|
1384
|
+
//#region ../../shell/plugins/src/public/service-plugin.d.ts
|
|
1371
1385
|
declare abstract class ServicePlugin<TConfig, TConfigInput> implements Plugin {
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
export { AgentResponseSchema, AnchorProfileSchema, AppInfoSchema, BaseMessageSchema, BrainCharacterSchema, ChatContextSchema, ConversationSchema, EntityPlugin, ExtensionMetadataSchema, InterfacePlugin, MessageInterfacePlugin, MessageResponseSchema, MessageSchema, PendingConfirmationSchema, ServicePlugin, ToolResultDataSchema, createResource, createTool, defineChannel, toolError, toolSuccess, urlCaptureConfigSchema };
|
|
1394
|
-
export type { AgentNamespace, AgentResponse, AnchorProfile, AppInfo, BaseJobTrackingInfo, BaseMessage, BasePluginContext, BrainCharacter, Channel, ChatContext, Conversation, EntityPluginContext, ExtensionMetadata, IConversationsNamespace, IEntitiesNamespace, IEntityService, IEvalNamespace, IIdentityNamespace, IInsightsNamespace, IMessagingNamespace, IPromptsNamespace, IRuntimeUploadsNamespace, IServiceTemplatesNamespace, IViewsNamespace, InterfacePluginContext, JobProgressContext, JobProgressEvent, JobProgressStatus, Message, MessageContext, MessageJobTrackingInfo, MessageResponse, MessageRole, MessageSendOptions, MessageSender, MessageWithPayload, PendingConfirmation, Plugin, PluginConfig, PluginConfigInput, PluginFactory, Prompt, ResolvedRuntimeUpload, Resource, ResourceTemplate, RuntimeUploadRecord, RuntimeUploadResponseBody, RuntimeUploadScopeOptions, RuntimeUploadStore, SaveRuntimeUploadInput, ServicePluginContext, Tool, ToolConfirmation, ToolContext, ToolResponse, ToolResultData, ToolVisibility };
|
|
1386
|
+
readonly type = "service";
|
|
1387
|
+
readonly id: string;
|
|
1388
|
+
readonly version: string;
|
|
1389
|
+
readonly packageName: string;
|
|
1390
|
+
readonly description?: string;
|
|
1391
|
+
private readonly delegate;
|
|
1392
|
+
protected constructor(id: string, packageJson: {
|
|
1393
|
+
name: string;
|
|
1394
|
+
version: string;
|
|
1395
|
+
description?: string;
|
|
1396
|
+
}, config: TConfigInput, configSchema: PluginConfigSchema<TConfig>);
|
|
1397
|
+
protected onRegister(_context: ServicePluginContext): Promise<void>;
|
|
1398
|
+
protected onReady(_context: ServicePluginContext): Promise<void>;
|
|
1399
|
+
protected onShutdown(): Promise<void>;
|
|
1400
|
+
protected getTools(): Promise<Tool[]>;
|
|
1401
|
+
protected getResources(): Promise<Resource[]>;
|
|
1402
|
+
protected getInstructions(): Promise<string | undefined>;
|
|
1403
|
+
ready(): Promise<void>;
|
|
1404
|
+
shutdown(): Promise<void>;
|
|
1405
|
+
}
|
|
1406
|
+
//#endregion
|
|
1407
|
+
export { type AgentNamespace, type AgentResponse, AgentResponseSchema, type AnchorProfile, AnchorProfileSchema, type AppInfo, AppInfoSchema, type BaseJobTrackingInfo, type BaseMessage, BaseMessageSchema, type BasePluginContext, type BrainCharacter, BrainCharacterSchema, type Channel, type ChatContext, ChatContextSchema, type Conversation, ConversationSchema, EntityPlugin, type EntityPluginContext, type ExtensionMetadata, ExtensionMetadataSchema, type IConversationsNamespace, type IEntitiesNamespace, type IEntityService, type IEvalNamespace, type IIdentityNamespace, type IInsightsNamespace, type IMessagingNamespace, type IPromptsNamespace, type IRuntimeUploadsNamespace, type IServiceTemplatesNamespace, type IViewsNamespace, InterfacePlugin, type InterfacePluginContext, type JobProgressContext, type JobProgressEvent, type JobProgressStatus, type Message, type MessageContext, MessageInterfacePlugin, type MessageJobTrackingInfo, type MessageResponse, MessageResponseSchema, type MessageRole, MessageSchema, type MessageSendOptions, type MessageSender, type MessageWithPayload, type PendingConfirmation, PendingConfirmationSchema, type Plugin, type PluginConfig, type PluginConfigInput, type PluginFactory, type Prompt, type ResolvedRuntimeUpload, type Resource, type ResourceTemplate, type RuntimeUploadRecord, type RuntimeUploadResponseBody, type RuntimeUploadScopeOptions, type RuntimeUploadStore, type SaveRuntimeUploadInput, ServicePlugin, type ServicePluginContext, type Tool, type ToolConfirmation, type ToolContext, type ToolResponse, type ToolResultData, ToolResultDataSchema, type ToolVisibility, createResource, createTool, defineChannel, toolError, toolSuccess, urlCaptureConfigSchema };
|