@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/plugins.d.ts CHANGED
@@ -1,192 +1,195 @@
1
- import { z, ZodType } from 'zod/v4';
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
- public: "public";
5
- shared: "shared";
6
- restricted: "restricted";
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
- id: string;
13
- toolCallId?: string | undefined;
14
- toolName: string;
15
- summary: string;
16
- completionSummary?: string | undefined;
17
- preview?: string | undefined;
18
- args: unknown;
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
- kind: "tool-approval";
24
- id: string;
25
- toolCallId?: string | undefined;
26
- toolName: string;
27
- input?: Record<string, unknown> | undefined;
28
- summary: string;
29
- completionSummary?: string | undefined;
30
- preview?: string | undefined;
31
- state: ToolApprovalCardState;
32
- output?: unknown;
33
- error?: string | undefined;
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
- entityType?: string | undefined;
37
- entityId?: string | undefined;
38
- attachmentType?: string | undefined;
37
+ entityType?: string | undefined;
38
+ entityId?: string | undefined;
39
+ attachmentType?: string | undefined;
39
40
  }
40
41
  interface AttachmentCardData {
41
- mediaType: string;
42
- url: string;
43
- downloadUrl?: string | undefined;
44
- previewUrl?: string | undefined;
45
- filename?: string | undefined;
46
- sizeBytes?: number | undefined;
47
- source?: AttachmentCardSource | undefined;
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
- kind: "attachment";
51
- id: string;
52
- jobId?: string | undefined;
53
- title: string;
54
- description?: string | undefined;
55
- attachment: AttachmentCardData;
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
- id: string;
59
- title?: string | undefined;
60
- source: string;
61
- url?: string | undefined;
62
- entityType?: string | undefined;
63
- entityId?: string | undefined;
64
- excerpt?: string | undefined;
65
- provenance?: Record<string, unknown> | undefined;
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
- kind: "sources";
69
- id: string;
70
- title?: string | undefined;
71
- sources: SourceCitation[];
69
+ kind: "sources";
70
+ id: string;
71
+ title?: string | undefined;
72
+ sources: SourceCitation[];
72
73
  }
73
74
  interface PromptChatAction {
74
- type: "prompt";
75
- id: string;
76
- label: string;
77
- prompt: string;
78
- description?: string | undefined;
75
+ type: "prompt";
76
+ id: string;
77
+ label: string;
78
+ prompt: string;
79
+ description?: string | undefined;
79
80
  }
80
81
  interface EventChatAction {
81
- type: "event";
82
- id: string;
83
- label: string;
84
- event: string;
85
- fromState?: string | undefined;
86
- description?: string | undefined;
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
- kind: "actions";
91
- id: string;
92
- title?: string | undefined;
93
- defaultOpen?: boolean | undefined;
94
- actions: ChatAction[];
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
- message: string;
99
- code?: string | undefined;
99
+ message: string;
100
+ code?: string | undefined;
100
101
  }
101
102
  interface ToolResultData {
102
- toolName: string;
103
- args?: Record<string, unknown> | undefined;
104
- jobId?: string | undefined;
105
- data?: unknown;
106
- error?: ToolResultErrorData | undefined;
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
- promptTokens: number;
111
- completionTokens: number;
112
- totalTokens: number;
111
+ promptTokens: number;
112
+ completionTokens: number;
113
+ totalTokens: number;
113
114
  }
114
115
  interface AgentResponse {
115
- text: string;
116
- toolResults?: ToolResultData[] | undefined;
117
- cards?: StructuredChatCard[] | undefined;
118
- pendingConfirmations?: PendingConfirmation[] | undefined;
119
- usage: AgentResponseUsage;
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
- id: string;
132
- type: string;
133
- excerpt?: string | undefined;
134
- relevance?: number | undefined;
134
+ id: string;
135
+ type: string;
136
+ excerpt?: string | undefined;
137
+ relevance?: number | undefined;
135
138
  }
136
139
  interface DefaultQueryResponse {
137
- message: string;
138
- summary?: string | undefined;
139
- topics?: string[] | undefined;
140
- sources?: DefaultQuerySource[] | undefined;
141
- metadata?: Record<string, unknown> | undefined;
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
- conversationId?: string;
149
- channelId?: string;
150
- runId?: string;
151
- toolCallId?: string;
152
+ conversationId?: string;
153
+ channelId?: string;
154
+ runId?: string;
155
+ toolCallId?: string;
152
156
  }
153
157
  interface EntityJobOptions {
154
- priority?: number;
155
- maxRetries?: number;
156
- eventContext?: EntityMutationEventContext;
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
- deduplicateId?: boolean;
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
- entityId: string;
171
- jobId: string;
172
- skipped: boolean;
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
- entityType: string;
179
- id: string;
180
- markdown: string;
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
- entityId: string;
187
- entityType: string;
188
- embedding: Float32Array;
189
- contentHash: string;
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
- id: string;
198
- entityType: string;
199
- content: string;
200
- created: string;
201
- updated: string;
202
- visibility: ContentVisibility;
203
- metadata: TMetadata;
204
- /** SHA256 hash of content for change detection */
205
- contentHash: string;
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
- id?: string;
213
- created?: string;
214
- updated?: string;
215
- visibility?: RawContentVisibility;
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
- entity: T;
222
- score: number;
223
- excerpt: string;
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
- generate?: boolean | undefined;
230
- prompt?: string | undefined;
232
+ generate?: boolean | undefined;
233
+ prompt?: string | undefined;
231
234
  }
232
235
  interface CreateFromAttachmentInput {
233
- kind: "entity-attachment";
234
- sourceEntityType: string;
235
- sourceEntityId: string;
236
- attachmentType: string;
236
+ kind: "entity-attachment";
237
+ sourceEntityType: string;
238
+ sourceEntityId: string;
239
+ attachmentType: string;
237
240
  }
238
241
  interface CreateFromUploadInput {
239
- kind: "upload";
240
- id: string;
242
+ kind: "upload";
243
+ id: string;
241
244
  }
242
245
  interface CreateFromConversationMessageInput {
243
- kind: "conversation-message";
244
- messageId?: string | undefined;
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
- entityType: string;
250
- prompt?: string;
251
- title?: string;
252
- content?: string;
253
- url?: string;
254
- from?: CreateFromInput;
255
- transform?: CreateTransform;
256
- replace?: boolean;
257
- sourceEntityType?: string;
258
- sourceEntityId?: string;
259
- sourceEntityIds?: string[];
260
- targetEntityType?: string;
261
- targetEntityId?: string;
262
- coverImage?: boolean | CreateCoverImageInput;
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
- interfaceType: string;
269
- userId: string;
270
- channelId?: string;
271
- channelName?: string;
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
- mediaType: z.ZodString;
278
- url: z.ZodString;
279
- downloadUrl: z.ZodOptional<z.ZodString>;
280
- previewUrl: z.ZodOptional<z.ZodString>;
281
- filename: z.ZodOptional<z.ZodString>;
282
- sizeBytes: z.ZodOptional<z.ZodNumber>;
283
- source: z.ZodOptional<z.ZodObject<{
284
- entityType: z.ZodOptional<z.ZodString>;
285
- entityId: z.ZodOptional<z.ZodString>;
286
- attachmentType: z.ZodOptional<z.ZodString>;
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
- success: true;
292
- data: {
293
- entityId?: string;
294
- jobId?: string;
295
- status: string;
296
- attachment?: CreateResultAttachment;
297
- };
294
+ success: true;
295
+ data: {
296
+ entityId?: string;
297
+ jobId?: string;
298
+ status: string;
299
+ attachment?: CreateResultAttachment;
300
+ };
298
301
  } | {
299
- success: false;
300
- error: string;
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
- kind: "handled";
308
- result: CreateResult;
310
+ kind: "handled";
311
+ result: CreateResult;
309
312
  } | {
310
- kind: "continue";
311
- input: CreateInput;
313
+ kind: "continue";
314
+ input: CreateInput;
312
315
  };
313
316
  type CreateInterceptor = (input: CreateInput, executionContext: CreateExecutionContext) => Promise<CreateInterceptionResult>;
314
317
  interface UploadSaveInput {
315
- upload: CreateFromUploadInput;
316
- title?: string;
318
+ upload: CreateFromUploadInput;
319
+ title?: string;
317
320
  }
318
321
  type UploadSaveHandler = (input: UploadSaveInput, executionContext: CreateExecutionContext) => Promise<CreateResult>;
319
322
  interface UploadSaveHandlerRegistration {
320
- entityType: string;
321
- mediaTypes: string[];
322
- handler: UploadSaveHandler;
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
- entityType: string;
333
- /**
334
- * One declarative sentence describing what this entity type is. This is the
335
- * data the model reads to select `entityType`, replacing hardcoded example
336
- * phrasings in system instructions. Required: every type must define itself.
337
- */
338
- purpose: string;
339
- schema: EntitySchema$1<TEntity>;
340
- toMarkdown(entity: TEntity): string;
341
- fromMarkdown(markdown: string): Partial<TEntity>;
342
- extractMetadata(entity: TEntity): TMetadata;
343
- parseFrontMatter<TFrontmatter>(markdown: string, schema: {
344
- parse(data: unknown): TFrontmatter;
345
- }): TFrontmatter;
346
- generateFrontMatter(entity: TEntity): string;
347
- /** Optional: Zod schema for frontmatter fields. Used by CMS config generation. */
348
- frontmatterSchema?: z.ZodObject<z.ZodRawShape>;
349
- /** Optional: Declares this entity type is a singleton (one file, e.g., identity/identity.md). Used by CMS to generate files collection. */
350
- isSingleton?: boolean;
351
- /** Optional: Whether this entity has a free-form markdown body below frontmatter. Defaults to true. When false, CMS omits the body widget. */
352
- hasBody?: boolean;
353
- /** Returns a markdown body template with section headings for this entity type. Empty string for free-form entities. */
354
- getBodyTemplate(): string;
355
- /** Optional: Declares that this entity type supports cover images via coverImageId in frontmatter */
356
- supportsCoverImage?: boolean;
357
- /** Optional: Extract coverImageId from entity content/frontmatter */
358
- getCoverImageId?(entity: TEntity): string | undefined;
359
- /**
360
- * Optional: build the markdown content and metadata for a queued-generation stub.
361
- * When undefined, this entity type does not support prompt-based queued creation
362
- * via system_create; the tool will reject the call rather than silently degrade.
363
- * The returned metadata must satisfy this entity's metadata schema (with
364
- * status set to "generating"); central code only stamps id/timestamps/visibility.
365
- */
366
- buildStub?(input: {
367
- id: string;
368
- title: string;
369
- }): {
370
- content: string;
371
- metadata: TMetadata;
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
- /** Field to sort by - "created", "updated", or a metadata field name */
379
- field: string;
380
- /** Sort direction */
381
- direction: "asc" | "desc";
382
- /** Sort NULL values before non-NULL values (default: false / SQLite default) */
383
- nullsFirst?: boolean;
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
- limit?: number;
391
- offset?: number;
392
- /** Multi-field sorting - supports system fields (created, updated) and metadata fields */
393
- sortFields?: SortField[];
394
- filter?: {
395
- metadata?: Partial<TMetadata>;
396
- visibilityScope?: ContentVisibility;
397
- };
398
- /** Filter to only entities with metadata.status = "published" */
399
- publishedOnly?: boolean;
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
- limit?: number;
406
- offset?: number;
407
- types?: string[];
408
- excludeTypes?: string[];
409
- sortBy?: "relevance" | "created" | "updated";
410
- sortDirection?: "asc" | "desc";
411
- /** Score multipliers per entity type - applied after initial search */
412
- weight?: Record<string, number>;
413
- visibilityScope?: ContentVisibility;
414
- /** Include queued/failed generation stubs in search results (default: false) */
415
- includeUngenerated?: boolean;
416
- /** Minimum relevance score to return. Omit for no score cutoff. */
417
- minScore?: number;
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
- /** Score multiplier for search results (default: 1.0) */
424
- weight?: number;
425
- /** Whether to generate embeddings for this entity type (default: true).
426
- * Set to false for entity types with non-textual content (e.g., images). */
427
- embeddable?: boolean;
428
- /** Whether this entity type may be used as source material for derived projections (default: true).
429
- * Set to false for projection outputs that would create feedback loops. */
430
- projectionSource?: boolean;
431
- /** Publish semantics for status-bearing entity types. Statuses listed here
432
- * represent publication commitment/execution states and require the
433
- * `publish` entity action when entered or modified. */
434
- publish?: {
435
- publishStatuses: string[];
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
- entityType: string;
444
- id: string;
445
- /**
446
- * Optional visibility scope. Undefined fails closed to "public" — callers
447
- * with elevated access must opt up explicitly.
448
- */
449
- visibilityScope?: ContentVisibility;
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
- entityType: string;
454
- options?: ListOptions | undefined;
456
+ entityType: string;
457
+ options?: ListOptions | undefined;
455
458
  }
456
459
  interface CountEntitiesRequest {
457
- entityType: string;
458
- options?: Pick<ListOptions, "publishedOnly" | "filter"> | undefined;
460
+ entityType: string;
461
+ options?: Pick<ListOptions, "publishedOnly" | "filter"> | undefined;
459
462
  }
460
463
  interface CreateEntityRequest<T extends BaseEntity> {
461
- entity: EntityInput<T>;
462
- options?: CreateEntityOptions | undefined;
464
+ entity: EntityInput<T>;
465
+ options?: CreateEntityOptions | undefined;
463
466
  }
464
467
  interface CreateEntityFromMarkdownRequest {
465
- input: CreateEntityFromMarkdownInput;
466
- options?: CreateEntityOptions | undefined;
468
+ input: CreateEntityFromMarkdownInput;
469
+ options?: CreateEntityOptions | undefined;
467
470
  }
468
471
  interface UpdateEntityRequest<T extends BaseEntity> {
469
- entity: T;
470
- options?: EntityJobOptions | undefined;
472
+ entity: T;
473
+ options?: EntityJobOptions | undefined;
471
474
  }
472
475
  interface DeleteEntityRequest {
473
- entityType: string;
474
- id: string;
476
+ entityType: string;
477
+ id: string;
475
478
  }
476
479
  interface UpsertEntityRequest<T extends BaseEntity> {
477
- entity: T;
478
- options?: EntityJobOptions | undefined;
480
+ entity: T;
481
+ options?: EntityJobOptions | undefined;
479
482
  }
480
483
  interface EntitySearchRequest {
481
- query: string;
482
- options?: SearchOptions | undefined;
484
+ query: string;
485
+ options?: SearchOptions | undefined;
483
486
  }
484
487
  interface SearchWithDistancesRequest {
485
- query: string;
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
- * Whether to filter to only published/complete content
494
- * Set by site-builder: true for production, false for preview
495
- */
496
- publishedOnly?: boolean;
497
- /**
498
- * Scoped entity service that auto-applies publishedOnly filter
499
- * Datasources should use this instead of their injected entityService
500
- * to ensure consistent filtering behavior across environments
501
- */
502
- entityService: EntityService;
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
- * Unique identifier for this data source
514
- */
515
- id: string;
516
- /**
517
- * Human-readable name for this data source
518
- */
519
- name: string;
520
- /**
521
- * Optional description of what this data source provides
522
- */
523
- description?: string;
524
- /**
525
- * Optional: Fetch existing data
526
- * Used by data sources that aggregate or retrieve data (e.g., dashboard stats, API data)
527
- * DataSources validate output using the provided schema
528
- * @param query - Query parameters for fetching data
529
- * @param outputSchema - Schema for validating output data
530
- * @param context - Context with environment
531
- */
532
- fetch?: <T>(query: unknown, outputSchema: z.ZodSchema<T>, context: BaseDataSourceContext) => Promise<T>;
533
- /**
534
- * Optional: Generate new content
535
- * Used by data sources that create content (e.g., AI-generated content, reports)
536
- */
537
- generate?: <T>(request: unknown, schema: z.ZodSchema<T>) => Promise<T>;
538
- /**
539
- * Optional: Transform content between formats
540
- * Used by data sources that convert content (e.g., markdown to HTML, data formatting)
541
- */
542
- transform?: <T>(content: unknown, format: string, schema: z.ZodSchema<T>) => Promise<T>;
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
- getEntity<T extends BaseEntity>(request: GetEntityRequest): Promise<T | null>;
546
- /**
547
- * Get entity without content resolution (raw)
548
- * Used internally to avoid recursion when resolving image references
549
- */
550
- getEntityRaw<T extends BaseEntity>(request: GetEntityRawRequest): Promise<T | null>;
551
- listEntities<T extends BaseEntity>(request: ListEntitiesRequest): Promise<T[]>;
552
- search<T extends BaseEntity = BaseEntity>(request: EntitySearchRequest): Promise<SearchResult<T>[]>;
553
- getEntityTypes(): string[];
554
- hasEntityType(type: string): boolean;
555
- countEntities(request: CountEntitiesRequest): Promise<number>;
556
- /**
557
- * Group counts by entity type. Fails closed: undefined visibilityScope
558
- * filters to public-only counts so aggregate insights cannot reveal
559
- * non-public entity existence.
560
- */
561
- getEntityCounts(visibilityScope?: ContentVisibility): Promise<Array<{
562
- entityType: string;
563
- count: number;
564
- }>>;
565
- /** Get configuration for a specific entity type */
566
- getEntityTypeConfig(type: string): EntityTypeConfig;
567
- /** Get weight map for all registered entity types with non-default weights */
568
- getWeightMap(): Record<string, number>;
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
- /** Register a new entity type with schema and adapter */
575
- register<TEntity extends BaseEntity>(entityType: string, schema: EntitySchema$1<TEntity>, adapter: EntityAdapter<TEntity>, config?: EntityTypeConfig): void;
576
- /**
577
- * Get the adapter for an entity type.
578
- *
579
- * Returns the structural `EntityAdapter<BaseEntity>` view — namespace
580
- * consumers don't narrow by entity type. For typed access tied to a
581
- * specific `TEntity`, use the underlying `EntityRegistry.getAdapter<T>`
582
- * directly (see `entity-serializer.ts`).
583
- */
584
- getAdapter(entityType: string): EntityAdapter<BaseEntity> | undefined;
585
- /** Extend an adapter's frontmatterSchema with additional fields */
586
- extendFrontmatterSchema(type: string, extension: z.ZodObject<z.ZodRawShape>): void;
587
- /** Get effective frontmatter schema (base + extensions) for an entity type */
588
- getEffectiveFrontmatterSchema(type: string): z.ZodObject<z.ZodRawShape> | undefined;
589
- /** Update an existing entity */
590
- update<TEntity extends BaseEntity>(entity: TEntity): Promise<{
591
- entityId: string;
592
- jobId: string;
593
- }>;
594
- /** Register a data source for dynamic content */
595
- registerDataSource(dataSource: DataSource): void;
596
- /** Register a create interceptor for this plugin's entity type */
597
- registerCreateInterceptor(entityType: string, interceptor: CreateInterceptor): void;
598
- /** Register a raw-upload durable save handler for this plugin's entity type */
599
- registerUploadSaveHandler(registration: UploadSaveHandlerRegistration): void;
600
- /** Look up the registered upload-save handler claiming a media type */
601
- getUploadSaveHandler(mediaType: string): UploadSaveHandlerRegistration | undefined;
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
- queued: number;
605
- skipped: number;
607
+ queued: number;
608
+ skipped: number;
606
609
  }
607
610
  interface EmbeddingIndexStats {
608
- missingEmbeddings: number;
609
- staleEmbeddings: number;
610
- failedEmbeddings: number;
611
- /** Entities whose type generates embeddings (non-embeddable types excluded). */
612
- embeddableEntities: number;
613
- /** Embeddable entities whose embedding is present and current. */
614
- embeddedEntities: number;
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
- timeoutMs: number;
618
- intervalMs?: number;
620
+ timeoutMs: number;
621
+ intervalMs?: number;
619
622
  }
620
623
  interface IndexReadinessStatus extends EmbeddingIndexStats {
621
- ready: boolean;
622
- degraded: boolean;
623
- activeEmbeddingJobs: number;
624
+ ready: boolean;
625
+ degraded: boolean;
626
+ activeEmbeddingJobs: number;
624
627
  }
625
628
  interface EntityService extends ICoreEntityService {
626
- createEntity<T extends BaseEntity>(request: CreateEntityRequest<T>): Promise<EntityMutationResult>;
627
- createEntityFromMarkdown(request: CreateEntityFromMarkdownRequest): Promise<EntityMutationResult>;
628
- updateEntity<T extends BaseEntity>(request: UpdateEntityRequest<T>): Promise<EntityMutationResult>;
629
- deleteEntity(request: DeleteEntityRequest): Promise<boolean>;
630
- upsertEntity<T extends BaseEntity>(request: UpsertEntityRequest<T>): Promise<EntityMutationResult & {
631
- created: boolean;
632
- }>;
633
- storeEmbedding(data: StoreEmbeddingData): Promise<void>;
634
- backfillMissingEmbeddings(): Promise<EmbeddingBackfillResult>;
635
- isIndexReady(): boolean;
636
- awaitIndexReady(options: IndexReadinessOptions): Promise<IndexReadinessStatus>;
637
- serializeEntity(entity: BaseEntity): string;
638
- deserializeEntity(markdown: string, entityType: string): Partial<BaseEntity>;
639
- countEmbeddings(): Promise<number>;
640
- searchWithDistances(request: SearchWithDistancesRequest): Promise<Array<{
641
- entityId: string;
642
- entityType: string;
643
- distance: number;
644
- }>>;
645
- initialize(): Promise<void>;
646
- getAsyncJobStatus(jobId: string): Promise<{
647
- status: "pending" | "processing" | "completed" | "failed";
648
- error?: string;
649
- } | null>;
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
- kind: z.ZodString;
665
- id: z.ZodString;
670
+ kind: z.ZodString;
671
+ id: z.ZodString;
666
672
  }>;
667
673
  declare const TextChatAttachmentSchema: z.ZodObject<{
668
- kind: z.ZodLiteral<"text">;
669
- filename: z.ZodString;
670
- mediaType: z.ZodString;
671
- content: z.ZodString;
672
- sizeBytes: z.ZodOptional<z.ZodNumber>;
673
- source: z.ZodOptional<typeof ChatAttachmentSourceSchema>;
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
- kind: z.ZodLiteral<"file">;
678
- filename: z.ZodString;
679
- mediaType: z.ZodString;
680
- data: typeof fileAttachmentDataSchema;
681
- sizeBytes: z.ZodOptional<z.ZodNumber>;
682
- source: z.ZodOptional<typeof ChatAttachmentSourceSchema>;
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
- userPermissionLevel?: "anchor" | "trusted" | "public" | undefined;
691
- interfaceType?: string | undefined;
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
- actor?: {
695
- actorId: string;
696
- canonicalId?: string | undefined;
697
- interfaceType: string;
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
- chat(message: string, conversationId: string, context?: ChatContext): Promise<AgentResponse>;
715
- confirmPendingAction(conversationId: string, confirmed: boolean, approvalId: string, context: ChatContext): Promise<AgentResponse>;
716
- invalidate(): void;
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
- /** Absolute mounted path (e.g. "/cms" or "/cms-config") */
724
- path: string;
725
- /** HTTP method */
726
- method?: WebRouteMethod;
727
- /** Allow unauthenticated access */
728
- public?: boolean;
729
- /** Request handler */
730
- handler: WebRouteHandler;
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
- anchor: "anchor";
741
- trusted: "trusted";
742
- public: "public";
745
+ anchor: "anchor";
746
+ trusted: "trusted";
747
+ public: "public";
743
748
  }>;
744
749
  declare const endpointInfoSchema: z.ZodObject<{
745
- label: z.ZodString;
746
- url: z.ZodString;
747
- pluginId: z.ZodString;
748
- priority: z.ZodDefault<z.ZodNumber>;
749
- visibility: z.ZodDefault<typeof userPermissionLevelSchema>;
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
- human: "human";
753
- agent: "agent";
754
- admin: "admin";
755
- protocol: "protocol";
757
+ human: "human";
758
+ agent: "agent";
759
+ admin: "admin";
760
+ protocol: "protocol";
756
761
  }>;
757
762
  declare const interactionStatusSchema: z.ZodEnum<{
758
- available: "available";
759
- "coming-soon": "coming-soon";
760
- disabled: "disabled";
763
+ available: "available";
764
+ "coming-soon": "coming-soon";
765
+ disabled: "disabled";
761
766
  }>;
762
767
  declare const interactionInfoSchema: z.ZodObject<{
763
- id: z.ZodString;
764
- label: z.ZodString;
765
- description: z.ZodOptional<z.ZodString>;
766
- href: z.ZodString;
767
- kind: typeof interactionKindSchema;
768
- pluginId: z.ZodString;
769
- priority: z.ZodDefault<z.ZodNumber>;
770
- visibility: z.ZodDefault<typeof userPermissionLevelSchema>;
771
- status: z.ZodDefault<typeof interactionStatusSchema>;
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
- entityType: z.ZodString;
775
- count: z.ZodNumber;
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
- prompt: string;
782
- templateName: string;
783
- conversationHistory?: string;
784
- data?: Record<string, unknown>;
785
- interfacePermissionGrant?: UserPermissionLevel;
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
- status: z.ZodEnum<{
790
- healthy: "healthy";
791
- warning: "warning";
792
- error: "error";
793
- unknown: "unknown";
794
- }>;
795
- message: z.ZodOptional<z.ZodString>;
796
- lastCheck: z.ZodOptional<z.ZodString>;
797
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
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
- name: z.ZodString;
801
- pluginId: z.ZodString;
802
- status: z.ZodString;
803
- health: z.ZodOptional<typeof DaemonHealthSchema>;
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
- version: z.ZodString;
808
- uptime: z.ZodNumber;
809
- entities: z.ZodNumber;
810
- entityCounts: z.ZodArray<typeof entityCountSchema>;
811
- embeddings: z.ZodNumber;
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
- id: z.ZodString;
834
- sessionId: z.ZodString;
835
- interfaceType: z.ZodString;
836
- channelId: z.ZodString;
837
- channelName: z.ZodOptional<z.ZodString>;
838
- startedAt: z.ZodString;
839
- lastActiveAt: z.ZodString;
840
- createdAt: z.ZodString;
841
- updatedAt: z.ZodString;
842
- metadata: typeof ExtensionMetadataSchema;
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
- id: z.ZodString;
847
- conversationId: z.ZodString;
848
- role: typeof messageRoleSchema;
849
- content: z.ZodString;
850
- timestamp: z.ZodString;
851
- metadata: typeof ExtensionMetadataSchema;
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
- name: z.ZodString;
857
- role: z.ZodString;
858
- purpose: z.ZodString;
859
- values: z.ZodArray<z.ZodString>;
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
- name: z.ZodString;
864
- kind: z.ZodEnum<{
865
- professional: "professional";
866
- team: "team";
867
- collective: "collective";
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
- organization: z.ZodOptional<z.ZodString>;
870
- description: z.ZodOptional<z.ZodString>;
871
- avatar: z.ZodOptional<z.ZodString>;
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
- declare const MessageResponseSchema: z.ZodUnion<[
889
- z.ZodObject<{
890
- success: z.ZodBoolean;
891
- data: z.ZodOptional<z.ZodUnknown>;
892
- error: z.ZodOptional<z.ZodString>;
893
- }>,
894
- z.ZodObject<{
895
- noop: z.ZodLiteral<true>;
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
- success: boolean;
900
- error?: string | undefined;
906
+ success: boolean;
907
+ error?: string | undefined;
901
908
  } & {
902
- data?: T | undefined;
909
+ data?: T | undefined;
903
910
  }) | {
904
- noop: true;
911
+ noop: true;
905
912
  };
906
913
  declare const BaseMessageSchema: z.ZodObject<{
907
- id: z.ZodString;
908
- timestamp: z.ZodString;
909
- type: z.ZodString;
910
- source: z.ZodString;
911
- target: z.ZodOptional<z.ZodString>;
912
- metadata: z.ZodOptional<typeof ExtensionMetadataSchema>;
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
- payload: T;
923
+ payload: T;
917
924
  };
918
925
  interface MessageSendOptions {
919
- target?: string;
920
- metadata?: z.output<typeof ExtensionMetadataSchema>;
921
- broadcast?: boolean;
926
+ target?: string;
927
+ metadata?: z.output<typeof ExtensionMetadataSchema>;
928
+ broadcast?: boolean;
922
929
  }
923
930
  interface MessageSendRequest<T = unknown> extends MessageSendOptions {
924
- type: string;
925
- payload: T;
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
- userId?: string;
930
- channelId?: string;
931
- messageId?: string;
932
- timestamp?: string;
933
- interfaceType?: string;
934
- userPermissionLevel?: UserPermissionLevel;
935
- threadId?: string;
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
- aspectRatio?: AspectRatio;
949
+ aspectRatio?: AspectRatio;
942
950
  }
943
951
  interface ImageGenerationResult {
944
- base64: string;
945
- dataUrl: string;
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
- /** Query the AI with optional context */
952
- query: (prompt: string, context?: Record<string, unknown>) => Promise<DefaultQueryResponse>;
953
- /** Generate content using AI with template */
954
- generate: <T = unknown>(config: ContentGenerationConfig) => Promise<T>;
955
- /** Generate a structured object using AI with a schema parser */
956
- generateObject: <T>(prompt: string, schema: AIGenerationSchema<T>) => Promise<{
957
- object: T;
958
- }>;
959
- /** Generate an image using AI (requires AI_API_KEY) */
960
- generateImage: (prompt: string, options?: ImageGenerationOptions) => Promise<ImageGenerationResult>;
961
- /** Check if image generation is available */
962
- canGenerateImages: () => boolean;
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
- _input: unknown;
976
+ _input: unknown;
968
977
  }> = T["_input"];
969
978
  interface SafeParserSchema<T> {
970
- safeParse(input: unknown): {
971
- success: true;
972
- data: T;
973
- } | {
974
- success: false;
975
- error: {
976
- message: string;
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
- instruction: string;
982
- material: string;
983
- schema: z.ZodType<T, unknown>;
990
+ instruction: string;
991
+ material: string;
992
+ schema: z.ZodType<T, unknown>;
984
993
  }
985
994
  interface Plugin {
986
- readonly id: string;
987
- readonly version: string;
988
- readonly type: "core" | "entity" | "service" | "interface";
989
- readonly packageName: string;
990
- readonly description?: string;
991
- readonly dependencies?: string[];
992
- ready?(): Promise<void>;
993
- shutdown?(): Promise<void>;
994
- requiresDaemonStartup?(): boolean;
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
- debug(message: string, data?: unknown): void;
999
- info(message: string, data?: unknown): void;
1000
- warn(message: string, data?: unknown): void;
1001
- error(message: string, data?: unknown): void;
1002
- child(context: string): Logger;
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
- progressToken?: string | number;
1006
- sendProgress?: (notification: {
1007
- progress?: number;
1008
- total?: number;
1009
- message?: string;
1010
- }) => Promise<void>;
1011
- interfaceType?: string;
1012
- userId?: string;
1013
- conversationId?: string;
1014
- channelId?: string;
1015
- channelName?: string;
1016
- runId?: string;
1017
- toolCallId?: string;
1018
- userPermissionLevel?: UserPermissionLevel;
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
- success: boolean;
1022
- data?: T;
1023
- error?: string;
1030
+ success: boolean;
1031
+ data?: T;
1032
+ error?: string;
1024
1033
  }
1025
1034
  type ToolVisibility = UserPermissionLevel;
1026
1035
  interface ToolConfirmation {
1027
- required: boolean;
1028
- message?: string;
1036
+ required: boolean;
1037
+ message?: string;
1029
1038
  }
1030
1039
  type ToolSideEffects = "none" | "writes" | "external";
1031
1040
  interface Tool<TArgs = unknown, TResult = unknown> {
1032
- name: string;
1033
- description: string;
1034
- inputSchema: Record<string, unknown>;
1035
- handler: (args: TArgs, context: ToolContext) => Promise<TResult> | TResult;
1036
- visibility?: ToolVisibility;
1037
- confirmation?: ToolConfirmation;
1038
- sideEffects?: ToolSideEffects;
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
- uri: string;
1042
- name: string;
1043
- description?: string;
1044
- mimeType?: string;
1045
- handler: () => Promise<TResult> | TResult;
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
- uriTemplate: K;
1049
- name: string;
1050
- description?: string;
1051
- mimeType?: string;
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
- arguments?: Array<{
1057
- name: string;
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
- rootJobId: string;
1076
+ rootJobId: string;
1068
1077
  }
1069
1078
  interface MessageJobTrackingInfo extends BaseJobTrackingInfo {
1070
- messageId?: string;
1071
- channelId?: string;
1079
+ messageId?: string;
1080
+ channelId?: string;
1072
1081
  }
1073
1082
  type JobProgressStatus = "pending" | "processing" | "completed" | "failed";
1074
1083
  interface JobProgressContext {
1075
- rootJobId: string;
1076
- operationType: "file_operations" | "content_operations" | "data_processing" | "batch_processing";
1077
- pluginId?: string | undefined;
1078
- progressToken?: string | number | undefined;
1079
- operationTarget?: string | undefined;
1080
- interfaceType?: string | undefined;
1081
- conversationId?: string | undefined;
1082
- channelId?: string | undefined;
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
- id: string;
1086
- type: "job" | "batch";
1087
- status: JobProgressStatus;
1088
- message?: string | undefined;
1089
- progress?: {
1090
- current: number;
1091
- total: number;
1092
- percentage: number;
1093
- } | undefined;
1094
- aggregationKey?: string | undefined;
1095
- batchDetails?: {
1096
- totalOperations: number;
1097
- completedOperations: number;
1098
- failedOperations: number;
1099
- currentOperation?: string | undefined;
1100
- errors?: string[] | undefined;
1101
- } | undefined;
1102
- jobDetails?: {
1103
- jobType: string;
1104
- priority: number;
1105
- retryCount: number;
1106
- } | undefined;
1107
- metadata: JobProgressContext;
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
- captureUrls: z.ZodDefault<z.ZodBoolean>;
1111
- blockedUrlDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
1119
+ captureUrls: z.ZodDefault<z.ZodBoolean>;
1120
+ blockedUrlDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
1112
1121
  }>;
1113
1122
  interface Channel<TPayload, TResponse = unknown> {
1114
- readonly name: string;
1115
- readonly schema: SafeParserSchema<TPayload>;
1116
- readonly _response?: TResponse;
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
- get: () => BrainCharacter;
1124
- getProfile: () => AnchorProfile;
1125
- getAppInfo: () => Promise<AppInfo>;
1131
+ get: () => BrainCharacter;
1132
+ getProfile: () => AnchorProfile;
1133
+ getAppInfo: () => Promise<AppInfo>;
1126
1134
  }
1127
1135
  interface IConversationsNamespace {
1128
- get(conversationId: string): Promise<Conversation | null>;
1129
- search(query: string): Promise<Conversation[]>;
1130
- list(options?: {
1131
- limit?: number;
1132
- updatedAfter?: string;
1133
- interfaceType?: string;
1134
- sessionId?: string;
1135
- channelId?: string;
1136
- }): Promise<Conversation[]>;
1137
- getMessages(conversationId: string, options?: {
1138
- limit?: number;
1139
- range?: {
1140
- start: number;
1141
- end: number;
1142
- };
1143
- }): Promise<Message[]>;
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
- send: MessageSender;
1147
- subscribe<T = unknown, R = unknown>(channel: string | Channel<T, R>, handler: (message: MessageWithPayload<T>) => Promise<MessageResponse<R>>): () => void;
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
- registerHandler(handlerId: string, handler: EvalHandler): void;
1160
+ registerHandler(handlerId: string, handler: EvalHandler): void;
1153
1161
  }
1154
1162
  interface IInsightsNamespace {
1155
- register(type: string, handler: InsightHandler): void;
1163
+ register(type: string, handler: InsightHandler): void;
1156
1164
  }
1157
1165
  interface IPermissionsNamespace {
1158
- assertEntityActionAllowed(entityType: string, action: EntityAction, context: {
1159
- userPermissionLevel?: UserPermissionLevel | undefined;
1160
- }): void;
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
- ref: {
1165
- kind: string;
1166
- id: string;
1167
- };
1168
- filename: string;
1169
- mediaType: string;
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
- url: string;
1176
- downloadUrl: string;
1183
+ url: string;
1184
+ downloadUrl: string;
1177
1185
  }
1178
1186
  interface ResolvedRuntimeUpload {
1179
- record: RuntimeUploadRecord;
1180
- content: Buffer;
1187
+ record: RuntimeUploadRecord;
1188
+ content: Buffer;
1181
1189
  }
1182
1190
  interface SaveRuntimeUploadInput {
1183
- filename: string;
1184
- mediaType: string;
1185
- content: Buffer;
1186
- metadata?: Record<string, unknown> | undefined;
1191
+ filename: string;
1192
+ mediaType: string;
1193
+ content: Buffer;
1194
+ metadata?: Record<string, unknown> | undefined;
1187
1195
  }
1188
1196
  interface RuntimeUploadScopeOptions {
1189
- namespace: string;
1190
- refKind: string;
1191
- routePath: string;
1192
- retentionMs?: number | undefined;
1193
- maxCount?: number | undefined;
1197
+ namespace: string;
1198
+ refKind: string;
1199
+ routePath: string;
1200
+ retentionMs?: number | undefined;
1201
+ maxCount?: number | undefined;
1194
1202
  }
1195
1203
  interface RuntimeUploadStore {
1196
- save(input: SaveRuntimeUploadInput): Promise<RuntimeUploadRecord>;
1197
- read(uploadId: string): Promise<ResolvedRuntimeUpload>;
1198
- readRecord(uploadId: string): Promise<RuntimeUploadRecord>;
1199
- toResponseBody(record: RuntimeUploadRecord): RuntimeUploadResponseBody;
1200
- prune(): Promise<void>;
1201
- getUploadDir(uploadId: string): string;
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
- scoped(options: RuntimeUploadScopeOptions): RuntimeUploadStore;
1212
+ scoped(options: RuntimeUploadScopeOptions): RuntimeUploadStore;
1205
1213
  }
1206
1214
  interface BasePluginContext {
1207
- readonly pluginId: string;
1208
- readonly logger: Logger;
1209
- readonly dataDir: string;
1210
- readonly domain: string | undefined;
1211
- readonly siteUrl: string | undefined;
1212
- readonly localSiteUrl: string | undefined;
1213
- readonly previewUrl: string | undefined;
1214
- readonly preferLocalUrls: boolean;
1215
- readonly appInfo: () => Promise<AppInfo>;
1216
- readonly judge: <T>(input: JudgeInput<T>) => Promise<{
1217
- verdict: T;
1218
- usage: {
1219
- promptTokens: number;
1220
- completionTokens: number;
1221
- totalTokens: number;
1222
- };
1223
- }>;
1224
- readonly entityService: IEntityService;
1225
- readonly identity: IIdentityNamespace;
1226
- readonly messaging: IMessagingNamespace;
1227
- readonly conversations: IConversationsNamespace;
1228
- readonly eval: IEvalNamespace;
1229
- readonly insights: IInsightsNamespace;
1230
- readonly permissions: IPermissionsNamespace;
1231
- readonly uploads: IRuntimeUploadsNamespace;
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
- resolve(target: string, fallback: string): Promise<string>;
1242
+ resolve(target: string, fallback: string): Promise<string>;
1235
1243
  }
1236
1244
  interface IServiceTemplatesNamespace {
1237
- register(templates: unknown): void;
1245
+ register(templates: unknown): void;
1238
1246
  }
1239
1247
  interface IViewsNamespace {
1240
- get(name: string): unknown | undefined;
1241
- list(): unknown[];
1242
- hasRenderer(templateName: string, format?: OutputFormat): boolean;
1243
- getRenderer(templateName: string, format?: OutputFormat): unknown | undefined;
1244
- validate(templateName: string, content: unknown): boolean;
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
- parse(data: unknown): unknown;
1255
+ parse(data: unknown): unknown;
1248
1256
  }
1249
1257
  interface EntityPluginEntitiesNamespace extends Omit<IEntitiesNamespace, "getEffectiveFrontmatterSchema"> {
1250
- getEffectiveFrontmatterSchema(type: string): FrontmatterSchemaParser | undefined;
1258
+ getEffectiveFrontmatterSchema(type: string): FrontmatterSchemaParser | undefined;
1251
1259
  }
1252
1260
  interface ServicePluginContext extends BasePluginContext {
1253
- readonly entities: IEntitiesNamespace;
1254
- readonly templates: IServiceTemplatesNamespace;
1255
- readonly views: IViewsNamespace;
1256
- readonly prompts: IPromptsNamespace;
1257
- readonly ai: IEntityAINamespace;
1258
- registerInstructions(instructions: string): void;
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
- readonly entities: EntityPluginEntitiesNamespace;
1262
- readonly prompts: IPromptsNamespace;
1269
+ readonly entities: EntityPluginEntitiesNamespace;
1270
+ readonly prompts: IPromptsNamespace;
1263
1271
  }
1264
1272
  interface InterfacePluginContext extends BasePluginContext {
1265
- readonly agent: AgentNamespace;
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
- readonly type: "entity";
1276
- readonly id: string;
1277
- readonly version: string;
1278
- readonly packageName: string;
1279
- readonly description?: string;
1280
- abstract readonly entityType: string;
1281
- abstract readonly schema: EntitySchema<TEntity>;
1282
- abstract readonly adapter: EntityAdapter<TEntity>;
1283
- private readonly delegate;
1284
- protected constructor(id: string, packageJson: {
1285
- name: string;
1286
- version: string;
1287
- description?: string;
1288
- }, config: TConfigInput, configSchema: PluginConfigSchema<TConfig>);
1289
- protected onRegister(_context: EntityPluginContext): Promise<void>;
1290
- protected onReady(_context: EntityPluginContext): Promise<void>;
1291
- protected onShutdown(): Promise<void>;
1292
- protected getInstructions(): Promise<string | undefined>;
1293
- protected getEntityTypeConfig(): EntityTypeConfig | undefined;
1294
- protected getDataSources(): DataSource[];
1295
- protected interceptCreate(input: CreateInput, _executionContext: CreateExecutionContext, _context: EntityPluginContext): Promise<CreateInterceptionResult>;
1296
- ready(): Promise<void>;
1297
- shutdown(): Promise<void>;
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
- readonly type: "interface";
1302
- readonly id: string;
1303
- readonly version: string;
1304
- readonly packageName: string;
1305
- readonly description?: string;
1306
- private readonly delegate;
1307
- protected constructor(id: string, packageJson: {
1308
- name: string;
1309
- version: string;
1310
- description?: string;
1311
- }, config: TConfigInput, configSchema: PluginConfigSchema<TConfig>);
1312
- protected onRegister(_context: InterfacePluginContext): Promise<void>;
1313
- protected onReady(_context: InterfacePluginContext): Promise<void>;
1314
- protected onShutdown(): Promise<void>;
1315
- protected getTools(): Promise<Tool[]>;
1316
- protected getResources(): Promise<Resource[]>;
1317
- protected getInstructions(): Promise<string | undefined>;
1318
- getWebRoutes(): WebRouteDefinition[];
1319
- requiresDaemonStartup(): boolean;
1320
- ready(): Promise<void>;
1321
- shutdown(): Promise<void>;
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
- card: unknown;
1326
- fallbackText?: string;
1337
+ card: unknown;
1338
+ fallbackText?: string;
1327
1339
  };
1328
1340
  interface SendMessageToChannelRequest {
1329
- /** The channel/room to send to (null for single-channel interfaces like CLI) */
1330
- channelId: string | null;
1331
- /** The message or structured output to send */
1332
- message: MessageInterfaceOutput;
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
- channelId: string | null;
1337
- messageId: string;
1338
- newMessage: MessageInterfaceOutput;
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
- private readonly messageDelegate;
1343
- protected constructor(id: string, packageJson: {
1344
- name: string;
1345
- version: string;
1346
- description?: string;
1347
- }, config: TConfigInput, configSchema: PluginConfigSchema<TConfig>);
1348
- protected abstract sendMessageToChannel(request: SendMessageToChannelRequest): void;
1349
- protected onRegister(_context: InterfacePluginContext): Promise<void>;
1350
- protected onReady(_context: InterfacePluginContext): Promise<void>;
1351
- protected onShutdown(): Promise<void>;
1352
- protected getTools(): Promise<Tool[]>;
1353
- protected getResources(): Promise<Resource[]>;
1354
- protected getInstructions(): Promise<string | undefined>;
1355
- protected sendMessageWithId(_request: SendMessageWithIdRequest): Promise<string | undefined>;
1356
- protected editMessage(_request: EditMessageRequest): Promise<boolean>;
1357
- protected supportsMessageEditing(): boolean;
1358
- protected onProgressUpdate(_event: JobProgressEvent): Promise<void>;
1359
- protected trackAgentResponseForJob(jobId: string, messageId: string, channelId: string): void;
1360
- registerProgressCallback(callback: (events: JobProgressEvent[]) => void): void;
1361
- unregisterProgressCallback(): void;
1362
- getProgressEvents(): JobProgressEvent[];
1363
- getActiveProgressEvents(): JobProgressEvent[];
1364
- startProcessingInput(channelId?: string | null): void;
1365
- endProcessingInput(): void;
1366
- protected getCurrentChannelId(): string | null;
1367
- ready(): Promise<void>;
1368
- shutdown(): Promise<void>;
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
- readonly type: "service";
1373
- readonly id: string;
1374
- readonly version: string;
1375
- readonly packageName: string;
1376
- readonly description?: string;
1377
- private readonly delegate;
1378
- protected constructor(id: string, packageJson: {
1379
- name: string;
1380
- version: string;
1381
- description?: string;
1382
- }, config: TConfigInput, configSchema: PluginConfigSchema<TConfig>);
1383
- protected onRegister(_context: ServicePluginContext): Promise<void>;
1384
- protected onReady(_context: ServicePluginContext): Promise<void>;
1385
- protected onShutdown(): Promise<void>;
1386
- protected getTools(): Promise<Tool[]>;
1387
- protected getResources(): Promise<Resource[]>;
1388
- protected getInstructions(): Promise<string | undefined>;
1389
- ready(): Promise<void>;
1390
- shutdown(): Promise<void>;
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 };