@proj-airi/plugin-protocol 0.9.0-alpha.18
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/LICENSE +21 -0
- package/README.md +31 -0
- package/dist/types/index.d.mts +1144 -0
- package/dist/types/index.mjs +88 -0
- package/dist/types/index.mjs.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,1144 @@
|
|
|
1
|
+
import * as _moeru_eventa0 from "@moeru/eventa";
|
|
2
|
+
import { AssistantMessage, CommonContentPart, Message, ToolMessage, UserMessage } from "@xsai/shared-chat";
|
|
3
|
+
|
|
4
|
+
//#region src/types/events.d.ts
|
|
5
|
+
interface DiscordGuildMember {
|
|
6
|
+
nickname: string;
|
|
7
|
+
displayName: string;
|
|
8
|
+
id: string;
|
|
9
|
+
}
|
|
10
|
+
interface Discord {
|
|
11
|
+
guildMember?: DiscordGuildMember;
|
|
12
|
+
guildId?: string;
|
|
13
|
+
guildName?: string;
|
|
14
|
+
channelId?: string;
|
|
15
|
+
}
|
|
16
|
+
interface PluginIdentity {
|
|
17
|
+
/**
|
|
18
|
+
* Stable plugin identifier (shared across instances).
|
|
19
|
+
* Example: "telegram-bot", "stage-tamagotchi".
|
|
20
|
+
*/
|
|
21
|
+
id: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional semantic version for the plugin.
|
|
24
|
+
* Example: "0.8.1-beta.7".
|
|
25
|
+
*/
|
|
26
|
+
version?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Optional labels attached to the plugin manifest.
|
|
29
|
+
* Example: { env: "prod", app: "telegram", devtools: "true" }.
|
|
30
|
+
*/
|
|
31
|
+
labels?: Record<string, string>;
|
|
32
|
+
}
|
|
33
|
+
interface ModuleIdentity {
|
|
34
|
+
/**
|
|
35
|
+
* Unique module instance id for this module run (per process/deployment).
|
|
36
|
+
* Example: "telegram-01", "stage-ui-2f7c9".
|
|
37
|
+
*/
|
|
38
|
+
id: string;
|
|
39
|
+
/**
|
|
40
|
+
* Module identity kind. For now only plugin-backed modules are supported.
|
|
41
|
+
*/
|
|
42
|
+
kind: 'plugin';
|
|
43
|
+
/**
|
|
44
|
+
* Plugin identity associated with this module instance.
|
|
45
|
+
*/
|
|
46
|
+
plugin: PluginIdentity;
|
|
47
|
+
/**
|
|
48
|
+
* K8s-style labels for routing and policy selectors.
|
|
49
|
+
* Example: { env: "prod", app: "telegram", devtools: "true" }.
|
|
50
|
+
*/
|
|
51
|
+
labels?: Record<string, string>;
|
|
52
|
+
}
|
|
53
|
+
type MetadataEventSource = ModuleIdentity;
|
|
54
|
+
/**
|
|
55
|
+
* Static schema metadata for module configuration.
|
|
56
|
+
* This is transport-friendly and can be paired with a JSON Schema-like object.
|
|
57
|
+
*
|
|
58
|
+
* Example:
|
|
59
|
+
* {
|
|
60
|
+
* id: "airi.config.stage-ui",
|
|
61
|
+
* version: 2,
|
|
62
|
+
* schema: { type: "object", properties: { model: { type: "string" } }, required: ["model"] },
|
|
63
|
+
* }
|
|
64
|
+
*/
|
|
65
|
+
interface ModuleConfigSchema {
|
|
66
|
+
id: string;
|
|
67
|
+
version: number;
|
|
68
|
+
/**
|
|
69
|
+
* Optional JSON Schema-like descriptor for tooling/validation.
|
|
70
|
+
* Keep it JSON-serializable and avoid runtime-only values.
|
|
71
|
+
*/
|
|
72
|
+
schema?: Record<string, unknown>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Module dependency declaration.
|
|
76
|
+
*
|
|
77
|
+
* Use this during prepare/probe to describe what a module needs before
|
|
78
|
+
* it can decide its dynamic contributions. Dependencies can change at
|
|
79
|
+
* runtime if peers go offline.
|
|
80
|
+
*
|
|
81
|
+
* Example:
|
|
82
|
+
* { role: "llm:orchestrator", min: "v1", optional: true }
|
|
83
|
+
*/
|
|
84
|
+
interface ModuleDependency {
|
|
85
|
+
/**
|
|
86
|
+
* Logical dependency role (preferred over hard-coded plugin ids).
|
|
87
|
+
* Example: "llm:orchestrator"
|
|
88
|
+
*/
|
|
89
|
+
role: string;
|
|
90
|
+
/**
|
|
91
|
+
* Optional dependency flag.
|
|
92
|
+
*/
|
|
93
|
+
optional?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Version constraint hints.
|
|
96
|
+
*/
|
|
97
|
+
version?: string;
|
|
98
|
+
min?: string;
|
|
99
|
+
max?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Additional constraint metadata (JSON-serializable).
|
|
102
|
+
*/
|
|
103
|
+
constraints?: Record<string, unknown>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Dynamic contributions emitted by a module after configuration.
|
|
107
|
+
*
|
|
108
|
+
* Unlike static manifests, contributions can be updated or revoked at
|
|
109
|
+
* runtime. This is where capabilities, provider registrations, and UI
|
|
110
|
+
* extensions should be declared.
|
|
111
|
+
*
|
|
112
|
+
* Example:
|
|
113
|
+
* {
|
|
114
|
+
* capabilities: ["context.aggregate"],
|
|
115
|
+
* providers: [{ id: "vscode-context", type: "context-source" }],
|
|
116
|
+
* ui: { widgets: ["context-summary-panel"] }
|
|
117
|
+
* }
|
|
118
|
+
*/
|
|
119
|
+
interface ModuleContribution {
|
|
120
|
+
/**
|
|
121
|
+
* Dynamic capabilities exposed by the module.
|
|
122
|
+
*/
|
|
123
|
+
capabilities?: string[];
|
|
124
|
+
/**
|
|
125
|
+
* Provider registry contributions (shape defined by the host).
|
|
126
|
+
*/
|
|
127
|
+
providers?: Array<Record<string, unknown>>;
|
|
128
|
+
/**
|
|
129
|
+
* UI contribution descriptors (widgets, toolbar items, etc).
|
|
130
|
+
*/
|
|
131
|
+
ui?: Record<string, unknown>;
|
|
132
|
+
/**
|
|
133
|
+
* Hook registrations (event handlers, interceptors, etc).
|
|
134
|
+
*/
|
|
135
|
+
hooks?: Array<Record<string, unknown>>;
|
|
136
|
+
/**
|
|
137
|
+
* Additional resources or metadata.
|
|
138
|
+
*/
|
|
139
|
+
resources?: Record<string, unknown>;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Lifecycle phases for module orchestration and UX.
|
|
143
|
+
*/
|
|
144
|
+
type ModulePhase = 'announced' | 'preparing' | 'prepared' | 'configuration-needed' | 'configured' | 'ready' | 'failed';
|
|
145
|
+
type Localizable = string | {
|
|
146
|
+
/**
|
|
147
|
+
* Localization key owned by the module.
|
|
148
|
+
* Example: "config.deprecated.model_driver.legacy"
|
|
149
|
+
*/
|
|
150
|
+
key: string;
|
|
151
|
+
/**
|
|
152
|
+
* Fallback display string when translation is unavailable.
|
|
153
|
+
*/
|
|
154
|
+
fallback?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Params for string interpolation.
|
|
157
|
+
*/
|
|
158
|
+
params?: Record<string, string | number | boolean>;
|
|
159
|
+
};
|
|
160
|
+
interface ModuleConfigNotice {
|
|
161
|
+
/**
|
|
162
|
+
* Machine-friendly key for analytics or client-side mapping.
|
|
163
|
+
*/
|
|
164
|
+
code?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Human readable message or localization key.
|
|
167
|
+
*/
|
|
168
|
+
message?: Localizable;
|
|
169
|
+
/**
|
|
170
|
+
* JSON pointer or dotted path in config.
|
|
171
|
+
* Example: "driver.legacyModelPath"
|
|
172
|
+
*/
|
|
173
|
+
path?: string;
|
|
174
|
+
/**
|
|
175
|
+
* Suggested replacement path or alternative.
|
|
176
|
+
*/
|
|
177
|
+
replacedBy?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Version since the notice applies.
|
|
180
|
+
*/
|
|
181
|
+
since?: number;
|
|
182
|
+
/**
|
|
183
|
+
* Link to docs or migration guide.
|
|
184
|
+
*/
|
|
185
|
+
link?: string;
|
|
186
|
+
}
|
|
187
|
+
interface ModuleConfigStep {
|
|
188
|
+
/**
|
|
189
|
+
* Suggested action to complete configuration.
|
|
190
|
+
* Use code for UI rendering or message for fallback.
|
|
191
|
+
*/
|
|
192
|
+
code?: string;
|
|
193
|
+
message?: Localizable;
|
|
194
|
+
/**
|
|
195
|
+
* Optional targeted field(s).
|
|
196
|
+
*/
|
|
197
|
+
paths?: string[];
|
|
198
|
+
}
|
|
199
|
+
interface ModuleConfigPlan {
|
|
200
|
+
/**
|
|
201
|
+
* Schema that this plan targets.
|
|
202
|
+
*/
|
|
203
|
+
schema: ModuleConfigSchema;
|
|
204
|
+
/**
|
|
205
|
+
* Missing required paths for current schema/version.
|
|
206
|
+
*/
|
|
207
|
+
missing?: string[];
|
|
208
|
+
/**
|
|
209
|
+
* Invalid fields with reasons (runtime validation result).
|
|
210
|
+
*/
|
|
211
|
+
invalid?: Array<{
|
|
212
|
+
path: string;
|
|
213
|
+
reason: string;
|
|
214
|
+
}>;
|
|
215
|
+
/**
|
|
216
|
+
* Recommended defaults computed at runtime (may be environment-specific).
|
|
217
|
+
*/
|
|
218
|
+
defaults?: Record<string, unknown>;
|
|
219
|
+
/**
|
|
220
|
+
* Deprecated fields/behaviors detected in current config.
|
|
221
|
+
*/
|
|
222
|
+
deprecated?: Array<string | ModuleConfigNotice>;
|
|
223
|
+
/**
|
|
224
|
+
* Suggested migration steps between schema versions.
|
|
225
|
+
*/
|
|
226
|
+
migrations?: Array<{
|
|
227
|
+
from: number;
|
|
228
|
+
to: number;
|
|
229
|
+
steps?: Array<string | ModuleConfigStep>;
|
|
230
|
+
notes?: Array<string | ModuleConfigNotice>;
|
|
231
|
+
}>;
|
|
232
|
+
/**
|
|
233
|
+
* Human- or UI-friendly next actions to resolve partial config.
|
|
234
|
+
*/
|
|
235
|
+
nextSteps?: Array<string | ModuleConfigStep>;
|
|
236
|
+
/**
|
|
237
|
+
* Non-blocking issues that should be shown to the user/operator.
|
|
238
|
+
*/
|
|
239
|
+
warnings?: Array<string | ModuleConfigNotice>;
|
|
240
|
+
}
|
|
241
|
+
interface ModuleConfigValidation {
|
|
242
|
+
/**
|
|
243
|
+
* Overall validation status.
|
|
244
|
+
*
|
|
245
|
+
* - valid: all required fields present and valid.
|
|
246
|
+
* - partial: config is structurally OK but missing required fields; can be fixed by patches.
|
|
247
|
+
* - invalid: one or more fields are present but invalid (type/range/format); requires correction.
|
|
248
|
+
*/
|
|
249
|
+
status: 'partial' | 'valid' | 'invalid';
|
|
250
|
+
/**
|
|
251
|
+
* Missing required fields (only for partial/invalid).
|
|
252
|
+
*/
|
|
253
|
+
missing?: string[];
|
|
254
|
+
/**
|
|
255
|
+
* Invalid fields with reasons (only for invalid).
|
|
256
|
+
*/
|
|
257
|
+
invalid?: Array<{
|
|
258
|
+
path: string;
|
|
259
|
+
reason: Localizable;
|
|
260
|
+
}>;
|
|
261
|
+
/**
|
|
262
|
+
* Non-blocking issues (e.g., deprecations, best-practice notices).
|
|
263
|
+
*/
|
|
264
|
+
warnings?: Array<string | ModuleConfigNotice>;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Config payload envelope for plan/apply/validate/commit.
|
|
268
|
+
*
|
|
269
|
+
* Example:
|
|
270
|
+
* {
|
|
271
|
+
* configId: "stage-ui-live2d",
|
|
272
|
+
* revision: 12,
|
|
273
|
+
* schemaVersion: 2,
|
|
274
|
+
* full: { model: "Hiyori", driver: { type: "live2d" } },
|
|
275
|
+
* }
|
|
276
|
+
*/
|
|
277
|
+
interface ModuleConfigEnvelope<C = Record<string, unknown>> {
|
|
278
|
+
configId: string;
|
|
279
|
+
/**
|
|
280
|
+
* Monotonic revision number for this configId.
|
|
281
|
+
*/
|
|
282
|
+
revision: number;
|
|
283
|
+
/**
|
|
284
|
+
* Schema version this config targets.
|
|
285
|
+
*/
|
|
286
|
+
schemaVersion: number;
|
|
287
|
+
/**
|
|
288
|
+
* Optional source identity (who produced this config).
|
|
289
|
+
*/
|
|
290
|
+
source?: ModuleIdentity;
|
|
291
|
+
/**
|
|
292
|
+
* Full config payload (use when first applying or rehydrating).
|
|
293
|
+
*/
|
|
294
|
+
full?: C;
|
|
295
|
+
/**
|
|
296
|
+
* Partial patch payload (use when updating or filling missing fields).
|
|
297
|
+
*/
|
|
298
|
+
patch?: Partial<C>;
|
|
299
|
+
/**
|
|
300
|
+
* If patch is used, baseRevision should be set for optimistic concurrency.
|
|
301
|
+
*/
|
|
302
|
+
baseRevision?: number;
|
|
303
|
+
}
|
|
304
|
+
interface ModuleCapability {
|
|
305
|
+
/**
|
|
306
|
+
* Stable capability id within a module.
|
|
307
|
+
* Example: "memory.write", "vision.ocr".
|
|
308
|
+
*/
|
|
309
|
+
id: string;
|
|
310
|
+
/**
|
|
311
|
+
* Human-friendly name.
|
|
312
|
+
*/
|
|
313
|
+
name?: string;
|
|
314
|
+
/**
|
|
315
|
+
* Optional localized description.
|
|
316
|
+
*/
|
|
317
|
+
description?: Localizable;
|
|
318
|
+
/**
|
|
319
|
+
* Capability-specific config schema (if needed).
|
|
320
|
+
*/
|
|
321
|
+
configSchema?: ModuleConfigSchema;
|
|
322
|
+
/**
|
|
323
|
+
* Additional metadata for tooling/UI.
|
|
324
|
+
*/
|
|
325
|
+
metadata?: Record<string, unknown>;
|
|
326
|
+
}
|
|
327
|
+
type ModulePermissionArea = 'apis' | 'resources' | 'capabilities' | 'processors' | 'pipelines';
|
|
328
|
+
interface ModulePermissionSpec<Area extends ModulePermissionArea = ModulePermissionArea, Action extends string = string> {
|
|
329
|
+
key: string;
|
|
330
|
+
actions: Action[];
|
|
331
|
+
/**
|
|
332
|
+
* Human-facing explanation for consent/permission UI.
|
|
333
|
+
* Prefer i18n key form over raw strings for localization.
|
|
334
|
+
*/
|
|
335
|
+
reason?: Localizable;
|
|
336
|
+
/**
|
|
337
|
+
* Optional short display label for permission prompts.
|
|
338
|
+
* Prefer i18n key form over raw strings for localization.
|
|
339
|
+
*/
|
|
340
|
+
label?: Localizable;
|
|
341
|
+
required?: boolean;
|
|
342
|
+
metadata?: Record<string, unknown>;
|
|
343
|
+
area?: Area;
|
|
344
|
+
}
|
|
345
|
+
interface ModulePermissionDeclaration {
|
|
346
|
+
apis?: ModulePermissionSpec<'apis', 'invoke' | 'emit'>[];
|
|
347
|
+
resources?: ModulePermissionSpec<'resources', 'read' | 'write' | 'subscribe'>[];
|
|
348
|
+
capabilities?: ModulePermissionSpec<'capabilities', 'wait' | 'snapshot'>[];
|
|
349
|
+
processors?: ModulePermissionSpec<'processors', 'register' | 'execute' | 'manage'>[];
|
|
350
|
+
pipelines?: ModulePermissionSpec<'pipelines', 'hook' | 'process' | 'emit' | 'manage'>[];
|
|
351
|
+
}
|
|
352
|
+
type ModulePermissionGrant = ModulePermissionDeclaration;
|
|
353
|
+
/**
|
|
354
|
+
* Describes a single authorization failure produced by host-side permission checks.
|
|
355
|
+
*
|
|
356
|
+
* Protocol expectations:
|
|
357
|
+
* - `area`, `action`, and `key` identify the denied operation
|
|
358
|
+
* - `reason` is intended for user-facing or diagnostic context and may be localized
|
|
359
|
+
* - `recoverable` indicates whether the caller may reasonably retry after obtaining consent,
|
|
360
|
+
* reconfiguration, or a state change
|
|
361
|
+
* - plugins should not treat `reason` as a stable machine-readable code
|
|
362
|
+
*/
|
|
363
|
+
interface ModulePermissionError {
|
|
364
|
+
area: ModulePermissionArea;
|
|
365
|
+
action: string;
|
|
366
|
+
key: string;
|
|
367
|
+
reason?: Localizable;
|
|
368
|
+
recoverable?: boolean;
|
|
369
|
+
}
|
|
370
|
+
type RouteTargetExpression = {
|
|
371
|
+
type: 'and';
|
|
372
|
+
all: RouteTargetExpression[];
|
|
373
|
+
} | {
|
|
374
|
+
type: 'or';
|
|
375
|
+
any: RouteTargetExpression[];
|
|
376
|
+
} | {
|
|
377
|
+
type: 'glob';
|
|
378
|
+
glob: string;
|
|
379
|
+
inverted?: boolean;
|
|
380
|
+
} | {
|
|
381
|
+
type: 'ids';
|
|
382
|
+
ids: string[];
|
|
383
|
+
inverted?: boolean;
|
|
384
|
+
} | {
|
|
385
|
+
type: 'plugin';
|
|
386
|
+
plugins: string[];
|
|
387
|
+
inverted?: boolean;
|
|
388
|
+
} | {
|
|
389
|
+
type: 'instance';
|
|
390
|
+
instances: string[];
|
|
391
|
+
inverted?: boolean;
|
|
392
|
+
} | {
|
|
393
|
+
type: 'label';
|
|
394
|
+
selectors: string[];
|
|
395
|
+
inverted?: boolean;
|
|
396
|
+
} | {
|
|
397
|
+
type: 'module';
|
|
398
|
+
modules: string[];
|
|
399
|
+
inverted?: boolean;
|
|
400
|
+
} | {
|
|
401
|
+
type: 'source';
|
|
402
|
+
sources: string[];
|
|
403
|
+
inverted?: boolean;
|
|
404
|
+
};
|
|
405
|
+
interface RouteConfig {
|
|
406
|
+
destinations?: Array<string | RouteTargetExpression>;
|
|
407
|
+
bypass?: boolean;
|
|
408
|
+
}
|
|
409
|
+
declare enum MessageHeartbeatKind {
|
|
410
|
+
Ping = "ping",
|
|
411
|
+
Pong = "pong"
|
|
412
|
+
}
|
|
413
|
+
declare enum MessageHeartbeat {
|
|
414
|
+
Ping = "\uD83E\uDE75",
|
|
415
|
+
Pong = "\uD83D\uDC9B"
|
|
416
|
+
}
|
|
417
|
+
declare enum WebSocketEventSource {
|
|
418
|
+
Server = "proj-airi:server-runtime",
|
|
419
|
+
StageWeb = "proj-airi:stage-web",
|
|
420
|
+
StageTamagotchi = "proj-airi:stage-tamagotchi"
|
|
421
|
+
}
|
|
422
|
+
interface InputSource {
|
|
423
|
+
'stage-web': boolean;
|
|
424
|
+
'stage-tamagotchi': boolean;
|
|
425
|
+
'discord': Discord;
|
|
426
|
+
}
|
|
427
|
+
interface OutputSource {
|
|
428
|
+
'gen-ai:chat': {
|
|
429
|
+
message: UserMessage;
|
|
430
|
+
contexts: Record<string, ContextUpdate<Record<string, any>, string | CommonContentPart[]>[]>;
|
|
431
|
+
composedMessage: Array<Message>;
|
|
432
|
+
input?: InputEventEnvelope;
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
declare enum ContextUpdateStrategy {
|
|
436
|
+
ReplaceSelf = "replace-self",
|
|
437
|
+
AppendSelf = "append-self"
|
|
438
|
+
}
|
|
439
|
+
interface ContextUpdateDestinationAll {
|
|
440
|
+
all: true;
|
|
441
|
+
}
|
|
442
|
+
interface ContextUpdateDestinationList {
|
|
443
|
+
include?: Array<string>;
|
|
444
|
+
exclude?: Array<string>;
|
|
445
|
+
}
|
|
446
|
+
type ContextUpdateDestinationFilter = ContextUpdateDestinationAll | ContextUpdateDestinationList;
|
|
447
|
+
interface ContextUpdate<Metadata extends Record<string, any> = Record<string, unknown>, Content extends any = undefined> {
|
|
448
|
+
id: string;
|
|
449
|
+
/**
|
|
450
|
+
* Can be the same if same update sends multiple time as attempts
|
|
451
|
+
* and trials, (e.g. notified first but not ACKed, then retried).
|
|
452
|
+
*/
|
|
453
|
+
contextId: string;
|
|
454
|
+
lane?: string;
|
|
455
|
+
ideas?: Array<string>;
|
|
456
|
+
hints?: Array<string>;
|
|
457
|
+
strategy: ContextUpdateStrategy;
|
|
458
|
+
text: string;
|
|
459
|
+
content?: Content;
|
|
460
|
+
destinations?: Array<string> | ContextUpdateDestinationFilter;
|
|
461
|
+
metadata?: Metadata;
|
|
462
|
+
}
|
|
463
|
+
interface InputMessageOverrides {
|
|
464
|
+
sessionId?: string;
|
|
465
|
+
messagePrefix?: string;
|
|
466
|
+
}
|
|
467
|
+
type InputContextUpdate = Omit<ContextUpdate<Record<string, unknown>, string | CommonContentPart[]>, 'id' | 'contextId'> & Partial<Pick<ContextUpdate<Record<string, unknown>, string | CommonContentPart[]>, 'id' | 'contextId'>>;
|
|
468
|
+
interface WebSocketEventInputTextBase {
|
|
469
|
+
text: string;
|
|
470
|
+
textRaw?: string;
|
|
471
|
+
overrides?: InputMessageOverrides;
|
|
472
|
+
contextUpdates?: InputContextUpdate[];
|
|
473
|
+
}
|
|
474
|
+
type WebSocketEventInputText = WebSocketEventInputTextBase & Partial<WithInputSource<'stage-web' | 'stage-tamagotchi' | 'discord'>>;
|
|
475
|
+
interface WebSocketEventInputTextVoiceBase {
|
|
476
|
+
transcription: string;
|
|
477
|
+
textRaw?: string;
|
|
478
|
+
overrides?: InputMessageOverrides;
|
|
479
|
+
contextUpdates?: InputContextUpdate[];
|
|
480
|
+
}
|
|
481
|
+
type WebSocketEventInputTextVoice = WebSocketEventInputTextVoiceBase & Partial<WithInputSource<'stage-web' | 'stage-tamagotchi' | 'discord'>>;
|
|
482
|
+
interface WebSocketEventInputVoiceBase {
|
|
483
|
+
audio: ArrayBuffer;
|
|
484
|
+
overrides?: InputMessageOverrides;
|
|
485
|
+
contextUpdates?: InputContextUpdate[];
|
|
486
|
+
}
|
|
487
|
+
type WebSocketEventInputVoice = WebSocketEventInputVoiceBase & Partial<WithInputSource<'stage-web' | 'stage-tamagotchi' | 'discord'>>;
|
|
488
|
+
type InputEventData = WebSocketEventInputText | WebSocketEventInputTextVoice | WebSocketEventInputVoice;
|
|
489
|
+
type InputEventEnvelope = {
|
|
490
|
+
type: 'input:text';
|
|
491
|
+
data: WebSocketEventInputText;
|
|
492
|
+
} | {
|
|
493
|
+
type: 'input:text:voice';
|
|
494
|
+
data: WebSocketEventInputTextVoice;
|
|
495
|
+
} | {
|
|
496
|
+
type: 'input:voice';
|
|
497
|
+
data: WebSocketEventInputVoice;
|
|
498
|
+
};
|
|
499
|
+
interface EventBaseMetadata {
|
|
500
|
+
source?: ModuleIdentity;
|
|
501
|
+
event?: {
|
|
502
|
+
id?: string;
|
|
503
|
+
parentId?: string;
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
type WithInputSource<Source extends keyof InputSource> = { [S in Source]: InputSource[S] };
|
|
507
|
+
type WithOutputSource<Source extends keyof OutputSource> = { [S in Source]: OutputSource[S] };
|
|
508
|
+
interface ModuleAuthenticateEvent {
|
|
509
|
+
token: string;
|
|
510
|
+
}
|
|
511
|
+
interface ModuleAuthenticatedEvent {
|
|
512
|
+
authenticated: boolean;
|
|
513
|
+
}
|
|
514
|
+
interface ModuleCompatibilityRequestEvent {
|
|
515
|
+
protocolVersion: string;
|
|
516
|
+
apiVersion: string;
|
|
517
|
+
supportedProtocolVersions?: string[];
|
|
518
|
+
supportedApiVersions?: string[];
|
|
519
|
+
}
|
|
520
|
+
interface ModuleCompatibilityResultEvent {
|
|
521
|
+
protocolVersion: string;
|
|
522
|
+
apiVersion: string;
|
|
523
|
+
mode: 'exact' | 'downgraded' | 'rejected';
|
|
524
|
+
reason?: string;
|
|
525
|
+
}
|
|
526
|
+
interface RegistryModulesSyncEvent {
|
|
527
|
+
modules: Array<{
|
|
528
|
+
name: string;
|
|
529
|
+
index?: number;
|
|
530
|
+
identity: ModuleIdentity;
|
|
531
|
+
}>;
|
|
532
|
+
}
|
|
533
|
+
interface ErrorEvent {
|
|
534
|
+
message: string;
|
|
535
|
+
}
|
|
536
|
+
interface ErrorPermissionEvent {
|
|
537
|
+
identity?: ModuleIdentity;
|
|
538
|
+
error: ModulePermissionError;
|
|
539
|
+
}
|
|
540
|
+
interface ModuleAnnounceEvent<C = undefined> {
|
|
541
|
+
name: string;
|
|
542
|
+
identity: ModuleIdentity;
|
|
543
|
+
possibleEvents: Array<(keyof ProtocolEvents<C>)>;
|
|
544
|
+
permissions?: ModulePermissionDeclaration;
|
|
545
|
+
configSchema?: ModuleConfigSchema;
|
|
546
|
+
dependencies?: ModuleDependency[];
|
|
547
|
+
}
|
|
548
|
+
interface ModuleAnnouncedEvent {
|
|
549
|
+
name: string;
|
|
550
|
+
index?: number;
|
|
551
|
+
identity: ModuleIdentity;
|
|
552
|
+
}
|
|
553
|
+
interface ModuleDeAnnouncedEvent {
|
|
554
|
+
name: string;
|
|
555
|
+
index?: number;
|
|
556
|
+
identity: ModuleIdentity;
|
|
557
|
+
reason?: string;
|
|
558
|
+
}
|
|
559
|
+
interface RegistryModulesHealthUnhealthyEvent {
|
|
560
|
+
name: string;
|
|
561
|
+
index?: number;
|
|
562
|
+
identity: ModuleIdentity;
|
|
563
|
+
reason?: string;
|
|
564
|
+
}
|
|
565
|
+
interface RegistryModulesHealthHealthyEvent {
|
|
566
|
+
name: string;
|
|
567
|
+
index?: number;
|
|
568
|
+
identity: ModuleIdentity;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Emitted when a module declares the permissions it may need.
|
|
572
|
+
*
|
|
573
|
+
* Typical use cases:
|
|
574
|
+
* - manifest-time declaration for installation, review, and audit surfaces
|
|
575
|
+
* - runtime declaration when a module can only discover optional integrations later
|
|
576
|
+
*
|
|
577
|
+
* Protocol expectations:
|
|
578
|
+
* - this event communicates intent only and does not grant access
|
|
579
|
+
* - hosts may record, display, audit, or validate this declaration before any request is approved
|
|
580
|
+
* - plugins must not assume any declared permission is usable until it appears in current grants
|
|
581
|
+
* - `source` indicates whether the declaration originated from static manifest data or runtime code
|
|
582
|
+
*/
|
|
583
|
+
interface ModulePermissionsDeclareEvent {
|
|
584
|
+
identity: ModuleIdentity;
|
|
585
|
+
requested: ModulePermissionDeclaration;
|
|
586
|
+
source: 'manifest' | 'runtime';
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Emitted when a module actively asks the host to approve some or all declared permissions.
|
|
590
|
+
*
|
|
591
|
+
* Typical use cases:
|
|
592
|
+
* - deferred consent before first use of a sensitive API or resource
|
|
593
|
+
* - requesting optional capabilities only when a feature is enabled by the user
|
|
594
|
+
*
|
|
595
|
+
* Protocol expectations:
|
|
596
|
+
* - hosts may prompt the user, auto-approve, partially approve, or deny the request
|
|
597
|
+
* - plugins must treat this as a request for evaluation, not as confirmation of access
|
|
598
|
+
* - plugins should provide a user-facing `reason` when approval UX needs explanatory context
|
|
599
|
+
* - the host response may later be expressed through granted, denied, and current permission events
|
|
600
|
+
*/
|
|
601
|
+
interface ModulePermissionsRequestEvent {
|
|
602
|
+
identity: ModuleIdentity;
|
|
603
|
+
requested: ModulePermissionDeclaration;
|
|
604
|
+
reason?: string;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Emitted after the host approves additional permissions for a module.
|
|
608
|
+
*
|
|
609
|
+
* Typical use cases:
|
|
610
|
+
* - notifying the runtime that a previous permission request succeeded
|
|
611
|
+
* - allowing plugin code to resume or unlock gated features
|
|
612
|
+
*
|
|
613
|
+
* Protocol expectations:
|
|
614
|
+
* - `granted` may be narrower than the corresponding request
|
|
615
|
+
* - plugins must inspect the granted payload instead of assuming the full request was approved
|
|
616
|
+
* - `revision` increments when the permission snapshot changes and may be used to invalidate cached state
|
|
617
|
+
* - hosts may emit this event before or together with an updated current snapshot
|
|
618
|
+
*/
|
|
619
|
+
interface ModulePermissionsGrantedEvent {
|
|
620
|
+
identity: ModuleIdentity;
|
|
621
|
+
granted: ModulePermissionGrant;
|
|
622
|
+
revision: number;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Emitted when some requested permissions are rejected or remain unavailable.
|
|
626
|
+
*
|
|
627
|
+
* Typical use cases:
|
|
628
|
+
* - surfacing partial denials after a consent flow
|
|
629
|
+
* - explaining why a feature must stay disabled or degraded
|
|
630
|
+
*
|
|
631
|
+
* Protocol expectations:
|
|
632
|
+
* - `denied` describes the requested permissions that are not available after evaluation
|
|
633
|
+
* - plugins must handle denial gracefully and should provide fallback behavior when feasible
|
|
634
|
+
* - `reason` is intended for diagnostics or UX context and should not be treated as a stable machine-readable code
|
|
635
|
+
* - `revision` identifies the permission-state version associated with this denial result
|
|
636
|
+
*/
|
|
637
|
+
interface ModulePermissionsDeniedEvent {
|
|
638
|
+
identity: ModuleIdentity;
|
|
639
|
+
denied: ModulePermissionDeclaration;
|
|
640
|
+
reason?: string;
|
|
641
|
+
revision: number;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Emitted with the module's reconciled current permission snapshot.
|
|
645
|
+
*
|
|
646
|
+
* Typical use cases:
|
|
647
|
+
* - bootstrapping plugin runtime state after startup or reload
|
|
648
|
+
* - synchronizing UI/debug tools with the final requested vs granted view
|
|
649
|
+
*
|
|
650
|
+
* Protocol expectations:
|
|
651
|
+
* - this is the authoritative event for "what is currently allowed"
|
|
652
|
+
* - `requested` is the normalized declaration baseline known to the host
|
|
653
|
+
* - `granted` is the currently granted subset that authorization checks should follow
|
|
654
|
+
* - plugins should prefer this snapshot over local assumptions when reconciling runtime state
|
|
655
|
+
*/
|
|
656
|
+
interface ModulePermissionsCurrentEvent {
|
|
657
|
+
identity: ModuleIdentity;
|
|
658
|
+
requested: ModulePermissionDeclaration;
|
|
659
|
+
granted: ModulePermissionGrant;
|
|
660
|
+
revision: number;
|
|
661
|
+
}
|
|
662
|
+
interface ModulePreparedEvent {
|
|
663
|
+
identity: ModuleIdentity;
|
|
664
|
+
missingDependencies?: ModuleDependency[];
|
|
665
|
+
}
|
|
666
|
+
interface ModuleConfigurationNeededEvent<C = undefined> {
|
|
667
|
+
identity: ModuleIdentity;
|
|
668
|
+
schema?: ModuleConfigSchema;
|
|
669
|
+
current?: ModuleConfigEnvelope<C>;
|
|
670
|
+
reason?: string;
|
|
671
|
+
}
|
|
672
|
+
interface ModuleStatusEvent {
|
|
673
|
+
identity: ModuleIdentity;
|
|
674
|
+
phase: ModulePhase;
|
|
675
|
+
reason?: string;
|
|
676
|
+
details?: Record<string, unknown>;
|
|
677
|
+
}
|
|
678
|
+
interface ModuleConfigurationValidateRequestEvent<C = undefined> {
|
|
679
|
+
identity: ModuleIdentity;
|
|
680
|
+
current?: ModuleConfigEnvelope<C>;
|
|
681
|
+
}
|
|
682
|
+
interface ModuleConfigurationValidateResponseEvent<C = undefined> {
|
|
683
|
+
identity: ModuleIdentity;
|
|
684
|
+
validation: ModuleConfigValidation;
|
|
685
|
+
plan?: ModuleConfigPlan;
|
|
686
|
+
current?: ModuleConfigEnvelope<C>;
|
|
687
|
+
}
|
|
688
|
+
interface ModuleConfigurationValidateStatusEvent {
|
|
689
|
+
identity: ModuleIdentity;
|
|
690
|
+
state: 'queued' | 'working' | 'done' | 'failed';
|
|
691
|
+
note?: string;
|
|
692
|
+
progress?: number;
|
|
693
|
+
}
|
|
694
|
+
interface ModuleConfigurationPlanRequestEvent<C = undefined> {
|
|
695
|
+
identity: ModuleIdentity;
|
|
696
|
+
plan?: ModuleConfigPlan;
|
|
697
|
+
current?: ModuleConfigEnvelope<C>;
|
|
698
|
+
}
|
|
699
|
+
interface ModuleConfigurationPlanResponseEvent<C = undefined> {
|
|
700
|
+
identity: ModuleIdentity;
|
|
701
|
+
plan: ModuleConfigPlan;
|
|
702
|
+
current?: ModuleConfigEnvelope<C>;
|
|
703
|
+
}
|
|
704
|
+
interface ModuleConfigurationPlanStatusEvent {
|
|
705
|
+
identity: ModuleIdentity;
|
|
706
|
+
state: 'queued' | 'working' | 'done' | 'failed';
|
|
707
|
+
note?: string;
|
|
708
|
+
progress?: number;
|
|
709
|
+
}
|
|
710
|
+
interface ModuleConfigurationCommitEvent<C = undefined> {
|
|
711
|
+
identity: ModuleIdentity;
|
|
712
|
+
config: ModuleConfigEnvelope<C>;
|
|
713
|
+
}
|
|
714
|
+
interface ModuleConfigurationCommitStatusEvent {
|
|
715
|
+
identity: ModuleIdentity;
|
|
716
|
+
state: 'queued' | 'working' | 'done' | 'failed';
|
|
717
|
+
note?: string;
|
|
718
|
+
progress?: number;
|
|
719
|
+
}
|
|
720
|
+
interface ModuleConfigurationConfiguredEvent<C = undefined> {
|
|
721
|
+
identity: ModuleIdentity;
|
|
722
|
+
config: ModuleConfigEnvelope<C>;
|
|
723
|
+
}
|
|
724
|
+
interface ModuleContributeCapabilityOfferEvent {
|
|
725
|
+
identity: ModuleIdentity;
|
|
726
|
+
capability: ModuleCapability;
|
|
727
|
+
}
|
|
728
|
+
interface ModuleContributeCapabilityConfigurationNeededEvent<C = undefined> {
|
|
729
|
+
identity: ModuleIdentity;
|
|
730
|
+
capabilityId: string;
|
|
731
|
+
schema?: ModuleConfigSchema;
|
|
732
|
+
current?: ModuleConfigEnvelope<C>;
|
|
733
|
+
reason?: string;
|
|
734
|
+
}
|
|
735
|
+
interface ModuleContributeCapabilityConfigurationValidateRequestEvent<C = undefined> {
|
|
736
|
+
identity: ModuleIdentity;
|
|
737
|
+
capabilityId: string;
|
|
738
|
+
current?: ModuleConfigEnvelope<C>;
|
|
739
|
+
}
|
|
740
|
+
interface ModuleContributeCapabilityConfigurationValidateResponseEvent<C = undefined> {
|
|
741
|
+
identity: ModuleIdentity;
|
|
742
|
+
capabilityId: string;
|
|
743
|
+
validation: ModuleConfigValidation;
|
|
744
|
+
plan?: ModuleConfigPlan;
|
|
745
|
+
current?: ModuleConfigEnvelope<C>;
|
|
746
|
+
}
|
|
747
|
+
interface ModuleContributeCapabilityConfigurationValidateStatusEvent {
|
|
748
|
+
identity: ModuleIdentity;
|
|
749
|
+
capabilityId: string;
|
|
750
|
+
state: 'queued' | 'working' | 'done' | 'failed';
|
|
751
|
+
note?: string;
|
|
752
|
+
progress?: number;
|
|
753
|
+
}
|
|
754
|
+
interface ModuleContributeCapabilityConfigurationPlanRequestEvent<C = undefined> {
|
|
755
|
+
identity: ModuleIdentity;
|
|
756
|
+
capabilityId: string;
|
|
757
|
+
plan?: ModuleConfigPlan;
|
|
758
|
+
current?: ModuleConfigEnvelope<C>;
|
|
759
|
+
}
|
|
760
|
+
interface ModuleContributeCapabilityConfigurationPlanResponseEvent<C = undefined> {
|
|
761
|
+
identity: ModuleIdentity;
|
|
762
|
+
capabilityId: string;
|
|
763
|
+
plan: ModuleConfigPlan;
|
|
764
|
+
current?: ModuleConfigEnvelope<C>;
|
|
765
|
+
}
|
|
766
|
+
interface ModuleContributeCapabilityConfigurationPlanStatusEvent {
|
|
767
|
+
identity: ModuleIdentity;
|
|
768
|
+
capabilityId: string;
|
|
769
|
+
state: 'queued' | 'working' | 'done' | 'failed';
|
|
770
|
+
note?: string;
|
|
771
|
+
progress?: number;
|
|
772
|
+
}
|
|
773
|
+
interface ModuleContributeCapabilityConfigurationCommitEvent<C = undefined> {
|
|
774
|
+
identity: ModuleIdentity;
|
|
775
|
+
capabilityId: string;
|
|
776
|
+
config: ModuleConfigEnvelope<C>;
|
|
777
|
+
}
|
|
778
|
+
interface ModuleContributeCapabilityConfigurationCommitStatusEvent {
|
|
779
|
+
identity: ModuleIdentity;
|
|
780
|
+
capabilityId: string;
|
|
781
|
+
state: 'queued' | 'working' | 'done' | 'failed';
|
|
782
|
+
note?: string;
|
|
783
|
+
progress?: number;
|
|
784
|
+
}
|
|
785
|
+
interface ModuleContributeCapabilityConfigurationConfiguredEvent<C = undefined> {
|
|
786
|
+
identity: ModuleIdentity;
|
|
787
|
+
capabilityId: string;
|
|
788
|
+
config: ModuleConfigEnvelope<C>;
|
|
789
|
+
}
|
|
790
|
+
interface ModuleContributeCapabilityActivatedEvent {
|
|
791
|
+
identity: ModuleIdentity;
|
|
792
|
+
capabilityId: string;
|
|
793
|
+
active: boolean;
|
|
794
|
+
reason?: string;
|
|
795
|
+
}
|
|
796
|
+
interface ModuleStatusChangeEvent {
|
|
797
|
+
identity: ModuleIdentity;
|
|
798
|
+
phase: ModulePhase;
|
|
799
|
+
reason?: string;
|
|
800
|
+
details?: Record<string, unknown>;
|
|
801
|
+
}
|
|
802
|
+
interface ModuleConfigureEvent<C = undefined> {
|
|
803
|
+
config: C | Record<string, unknown>;
|
|
804
|
+
}
|
|
805
|
+
interface UiConfigureEvent<C = undefined> {
|
|
806
|
+
moduleName: string;
|
|
807
|
+
moduleIndex?: number;
|
|
808
|
+
config: C | Record<string, unknown>;
|
|
809
|
+
}
|
|
810
|
+
type OutputGenAiChatToolCallEvent = {
|
|
811
|
+
toolCalls: ToolMessage[];
|
|
812
|
+
} & Partial<WithInputSource<'stage-web' | 'stage-tamagotchi' | 'discord'>> & Partial<WithOutputSource<'gen-ai:chat'>>;
|
|
813
|
+
type OutputGenAiChatMessageEvent = {
|
|
814
|
+
message: AssistantMessage;
|
|
815
|
+
} & Partial<WithInputSource<'stage-web' | 'stage-tamagotchi' | 'discord'>> & Partial<WithOutputSource<'gen-ai:chat'>>;
|
|
816
|
+
interface OutputGenAiChatUsage {
|
|
817
|
+
promptTokens: number;
|
|
818
|
+
completionTokens: number;
|
|
819
|
+
totalTokens: number;
|
|
820
|
+
source: 'provider-based' | 'estimate-based';
|
|
821
|
+
}
|
|
822
|
+
type OutputGenAiChatCompleteEvent = {
|
|
823
|
+
message: AssistantMessage;
|
|
824
|
+
toolCalls: ToolMessage[];
|
|
825
|
+
usage: OutputGenAiChatUsage;
|
|
826
|
+
} & Partial<WithInputSource<'stage-web' | 'stage-tamagotchi' | 'discord'>> & Partial<WithOutputSource<'gen-ai:chat'>>;
|
|
827
|
+
interface SparkNotifyEvent {
|
|
828
|
+
id: string;
|
|
829
|
+
eventId: string;
|
|
830
|
+
lane?: string;
|
|
831
|
+
kind: 'alarm' | 'ping' | 'reminder';
|
|
832
|
+
urgency: 'immediate' | 'soon' | 'later';
|
|
833
|
+
headline: string;
|
|
834
|
+
note?: string;
|
|
835
|
+
payload?: Record<string, unknown>;
|
|
836
|
+
ttlMs?: number;
|
|
837
|
+
requiresAck?: boolean;
|
|
838
|
+
destinations: Array<string>;
|
|
839
|
+
metadata?: Record<string, unknown>;
|
|
840
|
+
}
|
|
841
|
+
interface SparkEmitEvent {
|
|
842
|
+
id: string;
|
|
843
|
+
eventId?: string;
|
|
844
|
+
state: 'queued' | 'working' | 'done' | 'dropped' | 'blocked' | 'expired';
|
|
845
|
+
note?: string;
|
|
846
|
+
destinations: Array<string>;
|
|
847
|
+
metadata?: Record<string, unknown>;
|
|
848
|
+
}
|
|
849
|
+
interface SparkCommandGuidanceOption {
|
|
850
|
+
label: string;
|
|
851
|
+
steps: Array<string>;
|
|
852
|
+
rationale?: string;
|
|
853
|
+
possibleOutcome?: Array<string>;
|
|
854
|
+
risk?: 'high' | 'medium' | 'low' | 'none';
|
|
855
|
+
fallback?: Array<string>;
|
|
856
|
+
triggers?: Array<string>;
|
|
857
|
+
}
|
|
858
|
+
interface SparkCommandGuidance {
|
|
859
|
+
type: 'proposal' | 'instruction' | 'memory-recall';
|
|
860
|
+
/**
|
|
861
|
+
* Personas can be used to adjust the behavior of sub-agents.
|
|
862
|
+
* For example, when using as NPC in games, or player in Minecraft,
|
|
863
|
+
* the persona can help define the character's traits and decision-making style.
|
|
864
|
+
*
|
|
865
|
+
* Example:
|
|
866
|
+
* persona: {
|
|
867
|
+
* "bravery": "high",
|
|
868
|
+
* "cautiousness": "low",
|
|
869
|
+
* "friendliness": "medium"
|
|
870
|
+
* }
|
|
871
|
+
*/
|
|
872
|
+
persona?: Record<string, 'very-high' | 'high' | 'medium' | 'low' | 'very-low'>;
|
|
873
|
+
options: Array<SparkCommandGuidanceOption>;
|
|
874
|
+
}
|
|
875
|
+
interface SparkCommandEvent {
|
|
876
|
+
id: string;
|
|
877
|
+
eventId?: string;
|
|
878
|
+
parentEventId?: string;
|
|
879
|
+
commandId: string;
|
|
880
|
+
interrupt: 'force' | 'soft' | false;
|
|
881
|
+
priority: 'critical' | 'high' | 'normal' | 'low';
|
|
882
|
+
intent: 'plan' | 'proposal' | 'action' | 'pause' | 'resume' | 'reroute' | 'context';
|
|
883
|
+
ack?: string;
|
|
884
|
+
guidance?: SparkCommandGuidance;
|
|
885
|
+
contexts?: Array<ContextUpdate>;
|
|
886
|
+
destinations: Array<string>;
|
|
887
|
+
}
|
|
888
|
+
interface TransportConnectionHeartbeatEvent {
|
|
889
|
+
kind: MessageHeartbeatKind;
|
|
890
|
+
message: MessageHeartbeat | string;
|
|
891
|
+
at?: number;
|
|
892
|
+
}
|
|
893
|
+
type ContextUpdateEvent = ContextUpdate;
|
|
894
|
+
declare const moduleAuthenticate: _moeru_eventa0.Eventa<ModuleAuthenticateEvent>;
|
|
895
|
+
declare const moduleAuthenticated: _moeru_eventa0.Eventa<ModuleAuthenticatedEvent>;
|
|
896
|
+
declare const moduleCompatibilityRequest: _moeru_eventa0.Eventa<ModuleCompatibilityRequestEvent>;
|
|
897
|
+
declare const moduleCompatibilityResult: _moeru_eventa0.Eventa<ModuleCompatibilityResultEvent>;
|
|
898
|
+
declare const registryModulesSync: _moeru_eventa0.Eventa<RegistryModulesSyncEvent>;
|
|
899
|
+
declare const registryModulesHealthUnhealthy: _moeru_eventa0.Eventa<RegistryModulesHealthUnhealthyEvent>;
|
|
900
|
+
declare const registryModulesHealthHealthy: _moeru_eventa0.Eventa<RegistryModulesHealthHealthyEvent>;
|
|
901
|
+
declare const error: _moeru_eventa0.Eventa<ErrorEvent>;
|
|
902
|
+
/** Permission-check failure event. See `ModulePermissionError`. */
|
|
903
|
+
declare const errorPermission: _moeru_eventa0.Eventa<ErrorPermissionEvent>;
|
|
904
|
+
declare const moduleAnnounce: _moeru_eventa0.Eventa<ModuleAnnounceEvent<undefined>>;
|
|
905
|
+
declare const moduleAnnounced: _moeru_eventa0.Eventa<ModuleAnnouncedEvent>;
|
|
906
|
+
declare const moduleDeAnnounced: _moeru_eventa0.Eventa<ModuleDeAnnouncedEvent>;
|
|
907
|
+
/** Permission declaration lifecycle event. See `ModulePermissionsDeclareEvent`. */
|
|
908
|
+
declare const modulePermissionsDeclare: _moeru_eventa0.Eventa<ModulePermissionsDeclareEvent>;
|
|
909
|
+
/** Permission request lifecycle event. See `ModulePermissionsRequestEvent`. */
|
|
910
|
+
declare const modulePermissionsRequest: _moeru_eventa0.Eventa<ModulePermissionsRequestEvent>;
|
|
911
|
+
/** Permission grant lifecycle event. See `ModulePermissionsGrantedEvent`. */
|
|
912
|
+
declare const modulePermissionsGranted: _moeru_eventa0.Eventa<ModulePermissionsGrantedEvent>;
|
|
913
|
+
/** Permission denial lifecycle event. See `ModulePermissionsDeniedEvent`. */
|
|
914
|
+
declare const modulePermissionsDenied: _moeru_eventa0.Eventa<ModulePermissionsDeniedEvent>;
|
|
915
|
+
/** Current permission snapshot event. See `ModulePermissionsCurrentEvent`. */
|
|
916
|
+
declare const modulePermissionsCurrent: _moeru_eventa0.Eventa<ModulePermissionsCurrentEvent>;
|
|
917
|
+
declare const modulePrepared: _moeru_eventa0.Eventa<ModulePreparedEvent>;
|
|
918
|
+
declare const moduleConfigurationNeeded: _moeru_eventa0.Eventa<ModuleConfigurationNeededEvent<undefined>>;
|
|
919
|
+
declare const moduleStatus: _moeru_eventa0.Eventa<ModuleStatusEvent>;
|
|
920
|
+
declare const moduleConfigurationValidateRequest: _moeru_eventa0.Eventa<ModuleConfigurationValidateRequestEvent<undefined>>;
|
|
921
|
+
declare const moduleConfigurationValidateResponse: _moeru_eventa0.Eventa<ModuleConfigurationValidateResponseEvent<undefined>>;
|
|
922
|
+
declare const moduleConfigurationValidateStatus: _moeru_eventa0.Eventa<ModuleConfigurationValidateStatusEvent>;
|
|
923
|
+
declare const moduleConfigurationPlanRequest: _moeru_eventa0.Eventa<ModuleConfigurationPlanRequestEvent<undefined>>;
|
|
924
|
+
declare const moduleConfigurationPlanResponse: _moeru_eventa0.Eventa<ModuleConfigurationPlanResponseEvent<undefined>>;
|
|
925
|
+
declare const moduleConfigurationPlanStatus: _moeru_eventa0.Eventa<ModuleConfigurationPlanStatusEvent>;
|
|
926
|
+
declare const moduleConfigurationCommit: _moeru_eventa0.Eventa<ModuleConfigurationCommitEvent<undefined>>;
|
|
927
|
+
declare const moduleConfigurationCommitStatus: _moeru_eventa0.Eventa<ModuleConfigurationCommitStatusEvent>;
|
|
928
|
+
declare const moduleConfigurationConfigured: _moeru_eventa0.Eventa<ModuleConfigurationConfiguredEvent<undefined>>;
|
|
929
|
+
declare const moduleContributeCapabilityOffer: _moeru_eventa0.Eventa<ModuleContributeCapabilityOfferEvent>;
|
|
930
|
+
declare const moduleContributeCapabilityConfigurationNeeded: _moeru_eventa0.Eventa<ModuleContributeCapabilityConfigurationNeededEvent<undefined>>;
|
|
931
|
+
declare const moduleContributeCapabilityConfigurationValidateRequest: _moeru_eventa0.Eventa<ModuleContributeCapabilityConfigurationValidateRequestEvent<undefined>>;
|
|
932
|
+
declare const moduleContributeCapabilityConfigurationValidateResponse: _moeru_eventa0.Eventa<ModuleContributeCapabilityConfigurationValidateResponseEvent<undefined>>;
|
|
933
|
+
declare const moduleContributeCapabilityConfigurationValidateStatus: _moeru_eventa0.Eventa<ModuleContributeCapabilityConfigurationValidateStatusEvent>;
|
|
934
|
+
declare const moduleContributeCapabilityConfigurationPlanRequest: _moeru_eventa0.Eventa<ModuleContributeCapabilityConfigurationPlanRequestEvent<undefined>>;
|
|
935
|
+
declare const moduleContributeCapabilityConfigurationPlanResponse: _moeru_eventa0.Eventa<ModuleContributeCapabilityConfigurationPlanResponseEvent<undefined>>;
|
|
936
|
+
declare const moduleContributeCapabilityConfigurationPlanStatus: _moeru_eventa0.Eventa<ModuleContributeCapabilityConfigurationPlanStatusEvent>;
|
|
937
|
+
declare const moduleContributeCapabilityConfigurationCommit: _moeru_eventa0.Eventa<ModuleContributeCapabilityConfigurationCommitEvent<undefined>>;
|
|
938
|
+
declare const moduleContributeCapabilityConfigurationCommitStatus: _moeru_eventa0.Eventa<ModuleContributeCapabilityConfigurationCommitStatusEvent>;
|
|
939
|
+
declare const moduleContributeCapabilityConfigurationConfigured: _moeru_eventa0.Eventa<ModuleContributeCapabilityConfigurationConfiguredEvent<undefined>>;
|
|
940
|
+
declare const moduleContributeCapabilityActivated: _moeru_eventa0.Eventa<ModuleContributeCapabilityActivatedEvent>;
|
|
941
|
+
declare const moduleStatusChange: _moeru_eventa0.Eventa<ModuleStatusChangeEvent>;
|
|
942
|
+
declare const moduleConfigure: _moeru_eventa0.Eventa<ModuleConfigureEvent<undefined>>;
|
|
943
|
+
declare const uiConfigure: _moeru_eventa0.Eventa<UiConfigureEvent<undefined>>;
|
|
944
|
+
declare const inputText: _moeru_eventa0.Eventa<WebSocketEventInputText>;
|
|
945
|
+
declare const inputTextVoice: _moeru_eventa0.Eventa<WebSocketEventInputTextVoice>;
|
|
946
|
+
declare const inputVoice: _moeru_eventa0.Eventa<WebSocketEventInputVoice>;
|
|
947
|
+
declare const outputGenAiChatToolCall: _moeru_eventa0.Eventa<OutputGenAiChatToolCallEvent>;
|
|
948
|
+
declare const outputGenAiChatMessage: _moeru_eventa0.Eventa<OutputGenAiChatMessageEvent>;
|
|
949
|
+
declare const outputGenAiChatComplete: _moeru_eventa0.Eventa<OutputGenAiChatCompleteEvent>;
|
|
950
|
+
declare const sparkNotify: _moeru_eventa0.Eventa<SparkNotifyEvent>;
|
|
951
|
+
declare const sparkEmit: _moeru_eventa0.Eventa<SparkEmitEvent>;
|
|
952
|
+
declare const sparkCommand: _moeru_eventa0.Eventa<SparkCommandEvent>;
|
|
953
|
+
declare const transportConnectionHeartbeat: _moeru_eventa0.Eventa<TransportConnectionHeartbeatEvent>;
|
|
954
|
+
declare const contextUpdate: _moeru_eventa0.Eventa<ContextUpdateEvent>;
|
|
955
|
+
interface ProtocolEvents<C = undefined> {
|
|
956
|
+
'error': ErrorEvent;
|
|
957
|
+
'error:permission': ErrorPermissionEvent;
|
|
958
|
+
'module:authenticate': ModuleAuthenticateEvent;
|
|
959
|
+
'module:authenticated': ModuleAuthenticatedEvent;
|
|
960
|
+
/**
|
|
961
|
+
* Plugin asks host to negotiate protocol + API compatibility.
|
|
962
|
+
*/
|
|
963
|
+
'module:compatibility:request': ModuleCompatibilityRequestEvent;
|
|
964
|
+
/**
|
|
965
|
+
* Host replies with accepted mode/result for protocol + API compatibility.
|
|
966
|
+
*/
|
|
967
|
+
'module:compatibility:result': ModuleCompatibilityResultEvent;
|
|
968
|
+
/**
|
|
969
|
+
* Server-side registry sync for known online modules.
|
|
970
|
+
* Sent to newly authenticated peers to bootstrap module discovery.
|
|
971
|
+
*/
|
|
972
|
+
'registry:modules:sync': RegistryModulesSyncEvent;
|
|
973
|
+
/**
|
|
974
|
+
* Broadcast when a module's heartbeat expires (unhealthy).
|
|
975
|
+
*/
|
|
976
|
+
'registry:modules:health:unhealthy': RegistryModulesHealthUnhealthyEvent;
|
|
977
|
+
/**
|
|
978
|
+
* Broadcast when a previously unhealthy module resumes heartbeating (healthy again).
|
|
979
|
+
*/
|
|
980
|
+
'registry:modules:health:healthy': RegistryModulesHealthHealthyEvent;
|
|
981
|
+
/**
|
|
982
|
+
* Broadcast to all peers when a module announces itself, with its identity, static metadata, and declared dependencies.
|
|
983
|
+
* Host can use this to decide when to prepare/configure modules based on their needs and capabilities.
|
|
984
|
+
* Module that registering self can use this to declare its presence and what it offers, and to trigger orchestration flows in the host or other modules.
|
|
985
|
+
*
|
|
986
|
+
*
|
|
987
|
+
* NOTICE: Modules that would love to discover peers SHOULD NOT wait or listen to this event, instead
|
|
988
|
+
* module:announced or module:de-announced, or registry:modules:sync and registry:modules:health:* events for more reliable discovery and tracking.
|
|
989
|
+
*/
|
|
990
|
+
'module:announce': ModuleAnnounceEvent<C>;
|
|
991
|
+
'module:permissions:declare': ModulePermissionsDeclareEvent;
|
|
992
|
+
'module:permissions:request': ModulePermissionsRequestEvent;
|
|
993
|
+
'module:permissions:granted': ModulePermissionsGrantedEvent;
|
|
994
|
+
'module:permissions:denied': ModulePermissionsDeniedEvent;
|
|
995
|
+
'module:permissions:current': ModulePermissionsCurrentEvent;
|
|
996
|
+
/**
|
|
997
|
+
* Broadcast to all peers when a module successfully announces.
|
|
998
|
+
*/
|
|
999
|
+
'module:announced': ModuleAnnouncedEvent;
|
|
1000
|
+
/**
|
|
1001
|
+
* Broadcast to all peers when a module is unregistered (disconnect, heartbeat expiry, error, etc).
|
|
1002
|
+
*/
|
|
1003
|
+
'module:de-announced': ModuleDeAnnouncedEvent;
|
|
1004
|
+
/**
|
|
1005
|
+
* Prepare completed. Host can move into config apply/validate.
|
|
1006
|
+
*
|
|
1007
|
+
* Example:
|
|
1008
|
+
* module:prepared { missingDependencies: [] }
|
|
1009
|
+
*/
|
|
1010
|
+
'module:prepared': ModulePreparedEvent;
|
|
1011
|
+
/**
|
|
1012
|
+
* Module needs configuration to proceed to prepared/configured.
|
|
1013
|
+
*/
|
|
1014
|
+
'module:configuration:needed': ModuleConfigurationNeededEvent<C>;
|
|
1015
|
+
/**
|
|
1016
|
+
* Lifecycle status updates for orchestration/UX.
|
|
1017
|
+
*
|
|
1018
|
+
* Example:
|
|
1019
|
+
* module:status { phase: "ready" }
|
|
1020
|
+
*/
|
|
1021
|
+
'module:status': ModuleStatusEvent;
|
|
1022
|
+
/**
|
|
1023
|
+
* Ask the module to validate current config (host → module).
|
|
1024
|
+
*/
|
|
1025
|
+
'module:configuration:validate:request': ModuleConfigurationValidateRequestEvent<C>;
|
|
1026
|
+
/**
|
|
1027
|
+
* Validation response (module → host), with optional plan suggestions.
|
|
1028
|
+
*/
|
|
1029
|
+
'module:configuration:validate:response': ModuleConfigurationValidateResponseEvent<C>;
|
|
1030
|
+
/**
|
|
1031
|
+
* Status updates for validation (module → host).
|
|
1032
|
+
*/
|
|
1033
|
+
'module:configuration:validate:status': ModuleConfigurationValidateStatusEvent;
|
|
1034
|
+
/**
|
|
1035
|
+
* Configuration planning request (host → module).
|
|
1036
|
+
*/
|
|
1037
|
+
'module:configuration:plan:request': ModuleConfigurationPlanRequestEvent<C>;
|
|
1038
|
+
/**
|
|
1039
|
+
* Configuration planning response (module → host).
|
|
1040
|
+
*/
|
|
1041
|
+
'module:configuration:plan:response': ModuleConfigurationPlanResponseEvent<C>;
|
|
1042
|
+
/**
|
|
1043
|
+
* Status updates for planning (module → host).
|
|
1044
|
+
*/
|
|
1045
|
+
'module:configuration:plan:status': ModuleConfigurationPlanStatusEvent;
|
|
1046
|
+
/**
|
|
1047
|
+
* Commit a config as "active" (host → module).
|
|
1048
|
+
*/
|
|
1049
|
+
'module:configuration:commit': ModuleConfigurationCommitEvent<C>;
|
|
1050
|
+
/**
|
|
1051
|
+
* Status updates for commit (module → host).
|
|
1052
|
+
*/
|
|
1053
|
+
'module:configuration:commit:status': ModuleConfigurationCommitStatusEvent;
|
|
1054
|
+
/**
|
|
1055
|
+
* Configuration fully applied and active (module → host).
|
|
1056
|
+
*/
|
|
1057
|
+
'module:configuration:configured': ModuleConfigurationConfiguredEvent<C>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Capability offer emitted after module configuration.
|
|
1060
|
+
*/
|
|
1061
|
+
'module:contribute:capability:offer': ModuleContributeCapabilityOfferEvent;
|
|
1062
|
+
/**
|
|
1063
|
+
* Capability needs configuration before activation.
|
|
1064
|
+
*/
|
|
1065
|
+
'module:contribute:capability:configuration:needed': ModuleContributeCapabilityConfigurationNeededEvent<C>;
|
|
1066
|
+
'module:contribute:capability:configuration:validate:request': ModuleContributeCapabilityConfigurationValidateRequestEvent<C>;
|
|
1067
|
+
'module:contribute:capability:configuration:validate:response': ModuleContributeCapabilityConfigurationValidateResponseEvent<C>;
|
|
1068
|
+
'module:contribute:capability:configuration:validate:status': ModuleContributeCapabilityConfigurationValidateStatusEvent;
|
|
1069
|
+
'module:contribute:capability:configuration:plan:request': ModuleContributeCapabilityConfigurationPlanRequestEvent<C>;
|
|
1070
|
+
'module:contribute:capability:configuration:plan:response': ModuleContributeCapabilityConfigurationPlanResponseEvent<C>;
|
|
1071
|
+
'module:contribute:capability:configuration:plan:status': ModuleContributeCapabilityConfigurationPlanStatusEvent;
|
|
1072
|
+
'module:contribute:capability:configuration:commit': ModuleContributeCapabilityConfigurationCommitEvent<C>;
|
|
1073
|
+
'module:contribute:capability:configuration:commit:status': ModuleContributeCapabilityConfigurationCommitStatusEvent;
|
|
1074
|
+
'module:contribute:capability:configuration:configured': ModuleContributeCapabilityConfigurationConfiguredEvent<C>;
|
|
1075
|
+
'module:contribute:capability:activated': ModuleContributeCapabilityActivatedEvent;
|
|
1076
|
+
/**
|
|
1077
|
+
* Request a phase transition (module → host).
|
|
1078
|
+
*/
|
|
1079
|
+
'module:status:change': ModuleStatusChangeEvent;
|
|
1080
|
+
/**
|
|
1081
|
+
* Push configuration down to module (host → module).
|
|
1082
|
+
*/
|
|
1083
|
+
'module:configure': ModuleConfigureEvent<C>;
|
|
1084
|
+
'ui:configure': UiConfigureEvent<C>;
|
|
1085
|
+
'input:text': WebSocketEventInputText;
|
|
1086
|
+
'input:text:voice': WebSocketEventInputTextVoice;
|
|
1087
|
+
'input:voice': WebSocketEventInputVoice;
|
|
1088
|
+
'output:gen-ai:chat:tool-call': OutputGenAiChatToolCallEvent;
|
|
1089
|
+
'output:gen-ai:chat:message': OutputGenAiChatMessageEvent;
|
|
1090
|
+
'output:gen-ai:chat:complete': OutputGenAiChatCompleteEvent;
|
|
1091
|
+
/**
|
|
1092
|
+
* Spark used for allowing agents in a network to raise an event toward the other destinations (e.g. character).
|
|
1093
|
+
*
|
|
1094
|
+
* DO:
|
|
1095
|
+
* - Use notify for episodic events (alarms/pings/reminders) with minimal payload.
|
|
1096
|
+
* - Use command for high-level intent; let sub-agents translate into their own state machines.
|
|
1097
|
+
* - Use emit for ack/progress/completion; include ids for tracing/dedupe.
|
|
1098
|
+
* - Route via destinations; keep payloads small; use context:update for richer ideas.
|
|
1099
|
+
* - Dedupe/log via id/eventId for observability.
|
|
1100
|
+
*
|
|
1101
|
+
* DOn't:
|
|
1102
|
+
* - Stream high-frequency telemetry here (keep a separate channel).
|
|
1103
|
+
* - Stuff large blobs into payload/contexts; prefer refs/summaries.
|
|
1104
|
+
* - Assume exactly-once; add retry/ack on critical paths. You may rely on id/eventId for dedupe.
|
|
1105
|
+
* - Allow untrusted agents to broadcast without auth/capability checks.
|
|
1106
|
+
*
|
|
1107
|
+
* Examples:
|
|
1108
|
+
* - Minecraft attack/death: kind=alarm, urgency=immediate (fast bubble-up).
|
|
1109
|
+
* e.g., fromAgent='minecraft', headline='Under attack by witch', payload includes hp/location/gear.
|
|
1110
|
+
* - Cat bowl empty from HomeAssistant: kind=alarm, urgency=soon.
|
|
1111
|
+
* - IM/email "read now": kind=ping, urgency=immediate.
|
|
1112
|
+
* - Action Required email: kind=reminder, urgency=later.
|
|
1113
|
+
*
|
|
1114
|
+
* destinations controls routing (e.g. ['character'], ['character','minecraft-agent']).
|
|
1115
|
+
*/
|
|
1116
|
+
'spark:notify': SparkNotifyEvent;
|
|
1117
|
+
/**
|
|
1118
|
+
* Acknowledgement/progress/state for a spark or command (bidirectional).
|
|
1119
|
+
* Examples:
|
|
1120
|
+
* - Character: state=working, note="Seen it, responding".
|
|
1121
|
+
* - Sub-agent: state=done, note="Healed and safe".
|
|
1122
|
+
* - Sub-agent: state=blocked/dropped with note when it cannot comply.
|
|
1123
|
+
* - Minecraft: state=working, note="Pillared up; healing" in reply to a command.
|
|
1124
|
+
*/
|
|
1125
|
+
'spark:emit': SparkEmitEvent;
|
|
1126
|
+
/**
|
|
1127
|
+
* Character issues instructions or context to a sub-agent.
|
|
1128
|
+
* interrupt: force = hard preempt; soft = merge/queue.
|
|
1129
|
+
* Examples:
|
|
1130
|
+
* - Witch attack: interrupt=force, priority=critical, intent=action with options (aggressive/cautious).
|
|
1131
|
+
* e.g., options to block/retreat vs push with shield/sword, with fallback steps.
|
|
1132
|
+
* - Prep plan: interrupt=soft, priority=high, intent=plan with steps/fallbacks.
|
|
1133
|
+
* - Contextual hints: intent=context with contextPatch ideas/hints.
|
|
1134
|
+
*/
|
|
1135
|
+
'spark:command': SparkCommandEvent;
|
|
1136
|
+
'transport:connection:heartbeat': TransportConnectionHeartbeatEvent;
|
|
1137
|
+
'context:update': ContextUpdateEvent;
|
|
1138
|
+
}
|
|
1139
|
+
type ProtocolEventOf<E, C = undefined> = E extends keyof ProtocolEvents<C> ? Omit<ProtocolEvents<C>[E], 'metadata'> & {
|
|
1140
|
+
metadata?: Record<string, unknown>;
|
|
1141
|
+
} : never;
|
|
1142
|
+
//#endregion
|
|
1143
|
+
export { ContextUpdate, ContextUpdateDestinationAll, ContextUpdateDestinationFilter, ContextUpdateDestinationList, ContextUpdateStrategy, Discord, DiscordGuildMember, EventBaseMetadata, InputContextUpdate, InputEventData, InputEventEnvelope, InputMessageOverrides, Localizable, MessageHeartbeat, MessageHeartbeatKind, MetadataEventSource, ModuleCapability, ModuleConfigEnvelope, ModuleConfigNotice, ModuleConfigPlan, ModuleConfigSchema, ModuleConfigStep, ModuleConfigValidation, ModuleContribution, ModuleDependency, ModuleIdentity, ModulePermissionArea, ModulePermissionDeclaration, ModulePermissionError, ModulePermissionGrant, ModulePermissionSpec, ModulePhase, PluginIdentity, ProtocolEventOf, ProtocolEvents, RouteConfig, RouteTargetExpression, WebSocketEventInputText, WebSocketEventInputTextBase, WebSocketEventInputTextVoice, WebSocketEventInputTextVoiceBase, WebSocketEventInputVoice, WebSocketEventInputVoiceBase, WebSocketEventSource, WithInputSource, WithOutputSource, contextUpdate, error, errorPermission, inputText, inputTextVoice, inputVoice, moduleAnnounce, moduleAnnounced, moduleAuthenticate, moduleAuthenticated, moduleCompatibilityRequest, moduleCompatibilityResult, moduleConfigurationCommit, moduleConfigurationCommitStatus, moduleConfigurationConfigured, moduleConfigurationNeeded, moduleConfigurationPlanRequest, moduleConfigurationPlanResponse, moduleConfigurationPlanStatus, moduleConfigurationValidateRequest, moduleConfigurationValidateResponse, moduleConfigurationValidateStatus, moduleConfigure, moduleContributeCapabilityActivated, moduleContributeCapabilityConfigurationCommit, moduleContributeCapabilityConfigurationCommitStatus, moduleContributeCapabilityConfigurationConfigured, moduleContributeCapabilityConfigurationNeeded, moduleContributeCapabilityConfigurationPlanRequest, moduleContributeCapabilityConfigurationPlanResponse, moduleContributeCapabilityConfigurationPlanStatus, moduleContributeCapabilityConfigurationValidateRequest, moduleContributeCapabilityConfigurationValidateResponse, moduleContributeCapabilityConfigurationValidateStatus, moduleContributeCapabilityOffer, moduleDeAnnounced, modulePermissionsCurrent, modulePermissionsDeclare, modulePermissionsDenied, modulePermissionsGranted, modulePermissionsRequest, modulePrepared, moduleStatus, moduleStatusChange, outputGenAiChatComplete, outputGenAiChatMessage, outputGenAiChatToolCall, registryModulesHealthHealthy, registryModulesHealthUnhealthy, registryModulesSync, sparkCommand, sparkEmit, sparkNotify, transportConnectionHeartbeat, uiConfigure };
|
|
1144
|
+
//# sourceMappingURL=index.d.mts.map
|