@etazio/agent-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,689 @@
1
+ import { z } from 'zod';
2
+ import { type AvatarProfile } from './avatar.js';
3
+ /**
4
+ * KI-Agenten als Teilnehmer im Office (SPA-66, `specs/agents-spec.md`).
5
+ *
6
+ * Ein Agent ist ein Client wie der Browser: dieselben Socket-Ereignisse, eigene Identität, eigener
7
+ * Berechtigungsumfang. Die Rollenmatrix (`roles.ts`) bleibt für Menschen – Agenten haben eine eigene,
8
+ * additive Scope-Liste, die serverseitig an genau einer Stelle geprüft wird (`World.mayDo`).
9
+ */
10
+ /** Versionierter Protokollname; Breaking Changes nur über eine neue Version. */
11
+ export declare const AGENT_PROTOCOL = "agent-protocol/v1";
12
+ /** Erkennbares Präfix des Agent-Tokens (wie `sk-`-Muster anderer Dienste). */
13
+ export declare const AGENT_TOKEN_PREFIX = "hag_";
14
+ export declare const AGENT_SCOPES: readonly ['office.read', 'world.presence', 'world.move', 'world.seat', 'world.react', 'chat.read', 'chat.write', 'object.state', 'object.action', 'board.write', 'tv.control', 'zone.knock', 'meeting.audio', 'voice.listen', 'voice.speak', 'tools.use'];
15
+ export type AgentScope = (typeof AGENT_SCOPES)[number];
16
+ /** Beschreibung je Scope – Admin-UI und Doku lesen dieselbe Tabelle. */
17
+ export declare const AGENT_SCOPE_LABELS: Record<AgentScope, string>;
18
+ /** Vorschlag für neue Agenten: sehen, gehen, reden – alles Weitere wird bewusst vergeben. */
19
+ export declare const AGENT_DEFAULT_SCOPES: AgentScope[];
20
+ export declare function hasScope(scopes: readonly AgentScope[] | null | undefined, scope: AgentScope): boolean;
21
+ export declare const AGENT_LIMITS: {
22
+ /** Agenten je Workspace */
23
+ readonly perWorkspace: 10;
24
+ /** Gleichzeitige Verbindungen je Agent */
25
+ readonly connections: 4;
26
+ /** Chat-Nachrichten je Minute */
27
+ readonly chatPerMinute: 30;
28
+ /** Bewegungsbefehle (`agent:goTo`) je Minute */
29
+ readonly goToPerMinute: 20;
30
+ /** Objektzustände je Sekunde */
31
+ readonly statePerSecond: 10;
32
+ /** Objektaktionen je Sekunde */
33
+ readonly actionsPerSecond: 5;
34
+ /** Reaktionen je Sekunde */
35
+ readonly reactPerSecond: 2;
36
+ /** Ereignisse insgesamt je Sekunde (harte Klammer über allem) */
37
+ readonly eventsPerSecond: 40;
38
+ /** So oft darf ein Agent gedrosselt werden, bevor die Verbindung fällt */
39
+ readonly throttleStrikes: 5;
40
+ /** Ohne Lebenszeichen gilt eine Verbindung als hängend (ms) */
41
+ readonly idleMs: number;
42
+ readonly maxName: 60;
43
+ readonly maxDescription: 400;
44
+ /** Zonen, auf die ein Agent hören kann */
45
+ readonly maxZones: 20;
46
+ /** Gleichzeitige Sprachsitzungen je Agent */
47
+ readonly voiceSessions: 3;
48
+ /** Gleichzeitige Sprachsitzungen je Workspace (über alle Agenten) */
49
+ readonly voiceSessionsPerWorkspace: 6;
50
+ /** Gesprochene Sekunden je Minute und Agent – darüber wird gedrosselt */
51
+ readonly voiceSecondsPerMinute: 45;
52
+ /** Stille im Gespräch, nach der der Server die Sitzung beendet (ms) */
53
+ readonly voiceIdleMs: 45000;
54
+ /** Harte Obergrenze für eine einzelne Sprachsitzung (ms) */
55
+ readonly voiceMaxSessionMs: number;
56
+ /** Zustandsmeldungen des Agenten je Sekunde (`agent:voice:state`) */
57
+ readonly voiceStatePerSecond: 10;
58
+ /** Externe Werkzeugaufrufe je Minute und Agent */
59
+ readonly toolCallsPerMinute: 20;
60
+ /** Aufrufe desselben externen Werkzeugs je Minute und Agent */
61
+ readonly toolCallsPerToolPerMinute: 10;
62
+ /** Verbindungen, die ein Workspace verwalten darf */
63
+ readonly connectionsPerWorkspace: 20;
64
+ };
65
+ /** Grund einer Drosselung – der Agent bekommt ihn als `agent:throttled`. */
66
+ export type AgentThrottleReason = 'chat' | 'goto' | 'state' | 'action' | 'react' | 'events' | 'voice' | 'tool';
67
+ export declare const AGENT_CAPABILITIES: readonly ['chat', 'voice', 'board', 'tv', 'move'];
68
+ export type AgentCapability = (typeof AGENT_CAPABILITIES)[number];
69
+ /** Wie ein Mensch den Agenten erreicht (alle Wege erzeugen `agent:address`). */
70
+ export interface AgentAddressing {
71
+ /** `@Name` im Chat */
72
+ mention: boolean;
73
+ /** Hingehen und `E` drücken */
74
+ proximity: boolean;
75
+ /** Betreten einer dieser Zonen meldet den Ankömmling */
76
+ zones: string[];
77
+ /** Ansprache am eigenen Arbeitsplatz */
78
+ desk: boolean;
79
+ }
80
+ export type AgentOperator = 'intern' | 'extern';
81
+ export type AgentStatus = 'active' | 'disabled';
82
+ export declare const AGENT_CONNECTION_KINDS: readonly ['mcp-http', 'notion', 'google'];
83
+ export type AgentConnectionKind = (typeof AGENT_CONNECTION_KINDS)[number];
84
+ export declare const AGENT_CONNECTION_KIND_LABELS: Record<AgentConnectionKind, string>;
85
+ export declare const AGENT_TOOL_ACCESS: readonly ['read', 'read-write'];
86
+ export type AgentToolAccess = (typeof AGENT_TOOL_ACCESS)[number];
87
+ export declare const AGENT_CONNECTION_AUTH: readonly ['none', 'token', 'oauth'];
88
+ export type AgentConnectionAuth = (typeof AGENT_CONNECTION_AUTH)[number];
89
+ export interface AgentToolSummary {
90
+ name: string;
91
+ title: string | null;
92
+ description: string | null;
93
+ /** Ohne ausdrücklichen readOnly-Hinweis gilt ein Werkzeug vorsichtshalber als schreibend. */
94
+ readOnly: boolean;
95
+ }
96
+ export interface AgentConnectionDto {
97
+ id: string;
98
+ workspaceId: string;
99
+ kind: AgentConnectionKind;
100
+ auth: AgentConnectionAuth;
101
+ name: string;
102
+ url: string;
103
+ status: 'active' | 'disabled';
104
+ hasCredentials: boolean;
105
+ oauthConnected: boolean;
106
+ tools: AgentToolSummary[];
107
+ lastCheckedAt: string | null;
108
+ lastUsedAt: string | null;
109
+ lastError: string | null;
110
+ createdAt: string;
111
+ }
112
+ /** Installierbarer Remote-Server aus der offiziellen MCP Registry. */
113
+ export interface AgentMarketplaceItem {
114
+ /** Stabiler Registry-Name, z. B. `com.notion/mcp`. */
115
+ id: string;
116
+ name: string;
117
+ description: string;
118
+ url: string;
119
+ auth: AgentConnectionAuth;
120
+ version: string;
121
+ websiteUrl: string | null;
122
+ repositoryUrl: string | null;
123
+ }
124
+ export interface AgentToolGrant {
125
+ connectionId: string;
126
+ access: AgentToolAccess;
127
+ /** Leer bedeutet: alle Werkzeuge der Verbindung, unter Beachtung von `access`. */
128
+ tools: string[];
129
+ }
130
+ export interface AgentDto {
131
+ id: string;
132
+ workspaceId: string;
133
+ name: string;
134
+ description: string;
135
+ operator: AgentOperator;
136
+ endpointUrl: string | null;
137
+ scopes: AgentScope[];
138
+ capabilities: AgentCapability[];
139
+ toolGrants: AgentToolGrant[];
140
+ addressing: AgentAddressing;
141
+ avatar: AvatarProfile;
142
+ homeDeskId: string | null;
143
+ status: AgentStatus;
144
+ /** Sichtbarer Anfang des Tokens (`hag_ab12cd34…`) – nie das Token selbst */
145
+ tokenPrefix: string;
146
+ tokenRotatedAt: string | null;
147
+ lastSeenAt: string | null;
148
+ lastError: string | null;
149
+ /** Verbindungen gerade offen */
150
+ online: boolean;
151
+ createdAt: string;
152
+ }
153
+ /** Antwort beim Anlegen/Rotieren: das Token ist genau hier einmal sichtbar. */
154
+ export interface AgentSecretDto {
155
+ agent: AgentDto;
156
+ token: string;
157
+ }
158
+ export declare const agentNameSchema: z.ZodString;
159
+ export declare const agentScopeSchema: z.ZodEnum<{
160
+ "board.write": "board.write";
161
+ "chat.read": "chat.read";
162
+ "chat.write": "chat.write";
163
+ "meeting.audio": "meeting.audio";
164
+ "object.action": "object.action";
165
+ "object.state": "object.state";
166
+ "office.read": "office.read";
167
+ "tools.use": "tools.use";
168
+ "tv.control": "tv.control";
169
+ "voice.listen": "voice.listen";
170
+ "voice.speak": "voice.speak";
171
+ "world.move": "world.move";
172
+ "world.presence": "world.presence";
173
+ "world.react": "world.react";
174
+ "world.seat": "world.seat";
175
+ "zone.knock": "zone.knock";
176
+ }>;
177
+ export declare const agentCapabilitySchema: z.ZodEnum<{
178
+ board: "board";
179
+ chat: "chat";
180
+ move: "move";
181
+ tv: "tv";
182
+ voice: "voice";
183
+ }>;
184
+ export declare const agentIdSchema: z.ZodString;
185
+ export declare const agentAddressingSchema: z.ZodObject<{
186
+ mention: z.ZodDefault<z.ZodBoolean>;
187
+ proximity: z.ZodDefault<z.ZodBoolean>;
188
+ zones: z.ZodDefault<z.ZodArray<z.ZodString>>;
189
+ desk: z.ZodDefault<z.ZodBoolean>;
190
+ }, z.core.$strip>;
191
+ /** Fremdagenten dürfen nur https-Endpunkte hinterlegen (reserviert für die Webhook-Zustellung). */
192
+ export declare const agentEndpointSchema: z.ZodString;
193
+ export declare const createAgentSchema: z.ZodObject<{
194
+ name: z.ZodString;
195
+ description: z.ZodDefault<z.ZodString>;
196
+ operator: z.ZodDefault<z.ZodEnum<{
197
+ extern: "extern";
198
+ intern: "intern";
199
+ }>>;
200
+ endpointUrl: z.ZodDefault<z.ZodNullable<z.ZodString>>;
201
+ scopes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
202
+ "board.write": "board.write";
203
+ "chat.read": "chat.read";
204
+ "chat.write": "chat.write";
205
+ "meeting.audio": "meeting.audio";
206
+ "object.action": "object.action";
207
+ "object.state": "object.state";
208
+ "office.read": "office.read";
209
+ "tools.use": "tools.use";
210
+ "tv.control": "tv.control";
211
+ "voice.listen": "voice.listen";
212
+ "voice.speak": "voice.speak";
213
+ "world.move": "world.move";
214
+ "world.presence": "world.presence";
215
+ "world.react": "world.react";
216
+ "world.seat": "world.seat";
217
+ "zone.knock": "zone.knock";
218
+ }>>>;
219
+ capabilities: z.ZodDefault<z.ZodArray<z.ZodEnum<{
220
+ board: "board";
221
+ chat: "chat";
222
+ move: "move";
223
+ tv: "tv";
224
+ voice: "voice";
225
+ }>>>;
226
+ addressing: z.ZodPrefault<z.ZodObject<{
227
+ mention: z.ZodDefault<z.ZodBoolean>;
228
+ proximity: z.ZodDefault<z.ZodBoolean>;
229
+ zones: z.ZodDefault<z.ZodArray<z.ZodString>>;
230
+ desk: z.ZodDefault<z.ZodBoolean>;
231
+ }, z.core.$strip>>;
232
+ avatar: z.ZodOptional<z.ZodPipe<z.ZodObject<{
233
+ rigVersion: z.ZodDefault<z.ZodLiteral<2>>;
234
+ body: z.ZodDefault<z.ZodEnum<{
235
+ broad: "broad";
236
+ slim: "slim";
237
+ standard: "standard";
238
+ }>>;
239
+ height: z.ZodDefault<z.ZodEnum<{
240
+ medium: "medium";
241
+ short: "short";
242
+ tall: "tall";
243
+ }>>;
244
+ hair: z.ZodDefault<z.ZodEnum<{
245
+ bun: "bun";
246
+ long: "long";
247
+ none: "none";
248
+ short: "short";
249
+ }>>;
250
+ top: z.ZodDefault<z.ZodEnum<{
251
+ hoodie: "hoodie";
252
+ longsleeve: "longsleeve";
253
+ tshirt: "tshirt";
254
+ }>>;
255
+ accessories: z.ZodDefault<z.ZodArray<z.ZodEnum<{
256
+ cap: "cap";
257
+ glasses: "glasses";
258
+ headphones: "headphones";
259
+ }>>>;
260
+ colors: z.ZodPrefault<z.ZodObject<{
261
+ skin: z.ZodDefault<z.ZodString>;
262
+ hair: z.ZodDefault<z.ZodString>;
263
+ shirt: z.ZodDefault<z.ZodString>;
264
+ pants: z.ZodDefault<z.ZodString>;
265
+ shoes: z.ZodDefault<z.ZodString>;
266
+ accent: z.ZodDefault<z.ZodString>;
267
+ }, z.core.$strip>>;
268
+ }, z.core.$strip>, z.ZodTransform<{
269
+ rigVersion: 2;
270
+ body: "broad" | "slim" | "standard";
271
+ height: "medium" | "short" | "tall";
272
+ hair: "bun" | "long" | "none" | "short";
273
+ top: "hoodie" | "longsleeve" | "tshirt";
274
+ colors: {
275
+ skin: string;
276
+ hair: string;
277
+ shirt: string;
278
+ pants: string;
279
+ shoes: string;
280
+ accent: string;
281
+ };
282
+ accessories: ("cap" | "glasses" | "headphones")[];
283
+ }, {
284
+ rigVersion: 2;
285
+ body: "broad" | "slim" | "standard";
286
+ height: "medium" | "short" | "tall";
287
+ hair: "bun" | "long" | "none" | "short";
288
+ top: "hoodie" | "longsleeve" | "tshirt";
289
+ accessories: ("cap" | "glasses" | "headphones")[];
290
+ colors: {
291
+ skin: string;
292
+ hair: string;
293
+ shirt: string;
294
+ pants: string;
295
+ shoes: string;
296
+ accent: string;
297
+ };
298
+ }>>>;
299
+ homeDeskId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
300
+ }, z.core.$strip>;
301
+ export type CreateAgentInput = z.output<typeof createAgentSchema>;
302
+ export declare const updateAgentSchema: z.ZodObject<{
303
+ name: z.ZodOptional<z.ZodString>;
304
+ description: z.ZodOptional<z.ZodDefault<z.ZodString>>;
305
+ operator: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
306
+ extern: "extern";
307
+ intern: "intern";
308
+ }>>>;
309
+ endpointUrl: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
310
+ scopes: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodEnum<{
311
+ "board.write": "board.write";
312
+ "chat.read": "chat.read";
313
+ "chat.write": "chat.write";
314
+ "meeting.audio": "meeting.audio";
315
+ "object.action": "object.action";
316
+ "object.state": "object.state";
317
+ "office.read": "office.read";
318
+ "tools.use": "tools.use";
319
+ "tv.control": "tv.control";
320
+ "voice.listen": "voice.listen";
321
+ "voice.speak": "voice.speak";
322
+ "world.move": "world.move";
323
+ "world.presence": "world.presence";
324
+ "world.react": "world.react";
325
+ "world.seat": "world.seat";
326
+ "zone.knock": "zone.knock";
327
+ }>>>>;
328
+ capabilities: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodEnum<{
329
+ board: "board";
330
+ chat: "chat";
331
+ move: "move";
332
+ tv: "tv";
333
+ voice: "voice";
334
+ }>>>>;
335
+ addressing: z.ZodOptional<z.ZodPrefault<z.ZodObject<{
336
+ mention: z.ZodDefault<z.ZodBoolean>;
337
+ proximity: z.ZodDefault<z.ZodBoolean>;
338
+ zones: z.ZodDefault<z.ZodArray<z.ZodString>>;
339
+ desk: z.ZodDefault<z.ZodBoolean>;
340
+ }, z.core.$strip>>>;
341
+ avatar: z.ZodOptional<z.ZodOptional<z.ZodPipe<z.ZodObject<{
342
+ rigVersion: z.ZodDefault<z.ZodLiteral<2>>;
343
+ body: z.ZodDefault<z.ZodEnum<{
344
+ broad: "broad";
345
+ slim: "slim";
346
+ standard: "standard";
347
+ }>>;
348
+ height: z.ZodDefault<z.ZodEnum<{
349
+ medium: "medium";
350
+ short: "short";
351
+ tall: "tall";
352
+ }>>;
353
+ hair: z.ZodDefault<z.ZodEnum<{
354
+ bun: "bun";
355
+ long: "long";
356
+ none: "none";
357
+ short: "short";
358
+ }>>;
359
+ top: z.ZodDefault<z.ZodEnum<{
360
+ hoodie: "hoodie";
361
+ longsleeve: "longsleeve";
362
+ tshirt: "tshirt";
363
+ }>>;
364
+ accessories: z.ZodDefault<z.ZodArray<z.ZodEnum<{
365
+ cap: "cap";
366
+ glasses: "glasses";
367
+ headphones: "headphones";
368
+ }>>>;
369
+ colors: z.ZodPrefault<z.ZodObject<{
370
+ skin: z.ZodDefault<z.ZodString>;
371
+ hair: z.ZodDefault<z.ZodString>;
372
+ shirt: z.ZodDefault<z.ZodString>;
373
+ pants: z.ZodDefault<z.ZodString>;
374
+ shoes: z.ZodDefault<z.ZodString>;
375
+ accent: z.ZodDefault<z.ZodString>;
376
+ }, z.core.$strip>>;
377
+ }, z.core.$strip>, z.ZodTransform<{
378
+ rigVersion: 2;
379
+ body: "broad" | "slim" | "standard";
380
+ height: "medium" | "short" | "tall";
381
+ hair: "bun" | "long" | "none" | "short";
382
+ top: "hoodie" | "longsleeve" | "tshirt";
383
+ colors: {
384
+ skin: string;
385
+ hair: string;
386
+ shirt: string;
387
+ pants: string;
388
+ shoes: string;
389
+ accent: string;
390
+ };
391
+ accessories: ("cap" | "glasses" | "headphones")[];
392
+ }, {
393
+ rigVersion: 2;
394
+ body: "broad" | "slim" | "standard";
395
+ height: "medium" | "short" | "tall";
396
+ hair: "bun" | "long" | "none" | "short";
397
+ top: "hoodie" | "longsleeve" | "tshirt";
398
+ accessories: ("cap" | "glasses" | "headphones")[];
399
+ colors: {
400
+ skin: string;
401
+ hair: string;
402
+ shirt: string;
403
+ pants: string;
404
+ shoes: string;
405
+ accent: string;
406
+ };
407
+ }>>>>;
408
+ homeDeskId: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
409
+ status: z.ZodOptional<z.ZodEnum<{
410
+ active: "active";
411
+ disabled: "disabled";
412
+ }>>;
413
+ }, z.core.$strip>;
414
+ export type UpdateAgentInput = z.output<typeof updateAgentSchema>;
415
+ export declare const workspaceAgentSettingsSchema: z.ZodObject<{
416
+ externalAgentsDisabled: z.ZodBoolean;
417
+ }, z.core.$strip>;
418
+ export declare const createAgentConnectionSchema: z.ZodObject<{
419
+ kind: z.ZodDefault<z.ZodEnum<{
420
+ google: "google";
421
+ "mcp-http": "mcp-http";
422
+ notion: "notion";
423
+ }>>;
424
+ name: z.ZodString;
425
+ url: z.ZodString;
426
+ auth: z.ZodDefault<z.ZodEnum<{
427
+ none: "none";
428
+ oauth: "oauth";
429
+ token: "token";
430
+ }>>;
431
+ token: z.ZodOptional<z.ZodNullable<z.ZodString>>;
432
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
433
+ status: z.ZodDefault<z.ZodEnum<{
434
+ active: "active";
435
+ disabled: "disabled";
436
+ }>>;
437
+ }, z.core.$strip>;
438
+ export type CreateAgentConnectionInput = z.output<typeof createAgentConnectionSchema>;
439
+ export declare const updateAgentConnectionSchema: z.ZodObject<{
440
+ kind: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
441
+ google: "google";
442
+ "mcp-http": "mcp-http";
443
+ notion: "notion";
444
+ }>>>;
445
+ name: z.ZodOptional<z.ZodString>;
446
+ url: z.ZodOptional<z.ZodString>;
447
+ auth: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
448
+ none: "none";
449
+ oauth: "oauth";
450
+ token: "token";
451
+ }>>>;
452
+ token: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
453
+ headers: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
454
+ status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
455
+ active: "active";
456
+ disabled: "disabled";
457
+ }>>>;
458
+ }, z.core.$strip>;
459
+ export type UpdateAgentConnectionInput = z.output<typeof updateAgentConnectionSchema>;
460
+ export declare const agentToolGrantSchema: z.ZodObject<{
461
+ access: z.ZodDefault<z.ZodEnum<{
462
+ read: "read";
463
+ "read-write": "read-write";
464
+ }>>;
465
+ tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
466
+ }, z.core.$strip>;
467
+ export type AgentToolGrantInput = z.output<typeof agentToolGrantSchema>;
468
+ export declare const agentHelloSchema: z.ZodObject<{
469
+ protocol: z.ZodLiteral<"agent-protocol/v1">;
470
+ workspaceId: z.ZodOptional<z.ZodString>;
471
+ capabilities: z.ZodDefault<z.ZodArray<z.ZodEnum<{
472
+ board: "board";
473
+ chat: "chat";
474
+ move: "move";
475
+ tv: "tv";
476
+ voice: "voice";
477
+ }>>>;
478
+ client: z.ZodPrefault<z.ZodObject<{
479
+ name: z.ZodDefault<z.ZodString>;
480
+ version: z.ZodDefault<z.ZodString>;
481
+ }, z.core.$strip>>;
482
+ participantId: z.ZodOptional<z.ZodString>;
483
+ }, z.core.$strip>;
484
+ export type AgentHelloInput = z.output<typeof agentHelloSchema>;
485
+ /** Ziel eines Laufbefehls: Punkt, Zone oder ein anderer Teilnehmer. */
486
+ export declare const agentGoToSchema: z.ZodUnion<readonly [z.ZodObject<{
487
+ x: z.ZodNumber;
488
+ z: z.ZodNumber;
489
+ }, z.core.$strip>, z.ZodObject<{
490
+ zoneId: z.ZodString;
491
+ }, z.core.$strip>, z.ZodObject<{
492
+ participantId: z.ZodString;
493
+ }, z.core.$strip>]>;
494
+ export type AgentGoToInput = z.output<typeof agentGoToSchema>;
495
+ export declare const agentMeetingTokenSchema: z.ZodObject<{
496
+ target: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"office">, z.ZodString]>>;
497
+ }, z.core.$strip>;
498
+ /** Mensch spricht einen Agenten an (Browser → Server) – Hingehen + `E` oder Personen-Menü. */
499
+ export declare const agentInvokeSchema: z.ZodObject<{
500
+ agentParticipantId: z.ZodString;
501
+ text: z.ZodOptional<z.ZodString>;
502
+ voice: z.ZodDefault<z.ZodBoolean>;
503
+ }, z.core.$strip>;
504
+ /** Beschreibung der Welt im Handshake – so viel, dass ein Agent ohne Repo-Kenntnis handeln kann. */
505
+ export interface AgentWorldDigest {
506
+ workspaceId: string;
507
+ workspaceName: string;
508
+ officeId: string;
509
+ revisionId: string;
510
+ zones: Array<{
511
+ id: string;
512
+ name: string;
513
+ private: boolean;
514
+ capacity: number | null;
515
+ center: [number, number];
516
+ }>;
517
+ objects: Array<{
518
+ placementId: string;
519
+ asset: string;
520
+ kind: string;
521
+ label: string;
522
+ position: [number, number];
523
+ action: string | null;
524
+ }>;
525
+ seats: Array<{
526
+ id: string;
527
+ x: number;
528
+ z: number;
529
+ taken: boolean;
530
+ }>;
531
+ participants: Array<{
532
+ id: string;
533
+ name: string;
534
+ kind: 'user' | 'agent';
535
+ zoneId: string | null;
536
+ x: number;
537
+ z: number;
538
+ }>;
539
+ conversations: string[];
540
+ }
541
+ export interface AgentHelloResult {
542
+ protocol: typeof AGENT_PROTOCOL;
543
+ agent: {
544
+ id: string;
545
+ name: string;
546
+ operator: AgentOperator;
547
+ };
548
+ scopes: AgentScope[];
549
+ limits: typeof AGENT_LIMITS;
550
+ participantId: string;
551
+ reconnected: boolean;
552
+ world: AgentWorldDigest;
553
+ }
554
+ /** Ereignis „jemand spricht dich an“ – der eine Kanal für alle vier Ansprachewege. */
555
+ export interface AgentAddressPayload {
556
+ /**
557
+ * `mention` = @Name im Chat, `talk` = hingehen + E, `zone.enter` = Zone betreten,
558
+ * `desk` = am Arbeitsplatz, `card.decision` = jemand hat eine Bestätigungs-Karte entschieden (SPA-117)
559
+ */
560
+ kind: 'mention' | 'talk' | 'zone.enter' | 'desk' | 'card.decision';
561
+ from: {
562
+ participantId: string | null;
563
+ userId: string;
564
+ displayName: string;
565
+ };
566
+ /** Konversation, in der eine Antwort landen sollte (`room:office`, `room:<zone>`, `dm:a:b`) */
567
+ conv: string;
568
+ text: string | null;
569
+ zoneId: string | null;
570
+ at: number;
571
+ /** Nur bei `card.decision`: welche Karte, welche Aktion und wann entschieden wurde (SPA-117) */
572
+ decision?: {
573
+ messageId: string;
574
+ blockId: string;
575
+ actionId: string;
576
+ actionLabel: string;
577
+ at: string;
578
+ };
579
+ }
580
+ export interface AgentThrottledPayload {
581
+ reason: AgentThrottleReason;
582
+ /** Wie oft dieser Agent in dieser Verbindung schon gedrosselt wurde */
583
+ strikes: number;
584
+ /** Verbindung wird nach diesem Ereignis getrennt */
585
+ disconnecting: boolean;
586
+ message: string;
587
+ }
588
+ export interface AgentRevokedPayload {
589
+ reason: 'disabled' | 'token_rotated' | 'deleted' | 'workspace_disabled';
590
+ message: string;
591
+ }
592
+ /** Kennzeichnung eines Agenten am Teilnehmer (UI: Badge, Karte, Teilnehmerliste, Chat). */
593
+ export interface AgentBadge {
594
+ agentId: string;
595
+ operator: AgentOperator;
596
+ description: string;
597
+ }
598
+ /** Autor einer Chat-Nachricht: Mensch oder Agent (Nachrichten tragen die Art mit). */
599
+ export type AuthorKind = 'user' | 'agent';
600
+ /**
601
+ * Sprachschleife im Raum: der Mensch geht hin, drückt `E` und redet – Sprache zu Text beim
602
+ * Agenten-Betreiber, Antwort als eigene Audiospur im selben LiveKit-Raum.
603
+ *
604
+ * Der Server hält dabei nur den **Gesprächszustand**: wer spricht mit wem, seit wann, in welchem
605
+ * Raum. Ton fließt nie über die API. Damit gilt unverändert, was in Phase 5 für Menschen gilt –
606
+ * wer den Raum nicht betreten darf, bekommt kein Token, und ohne offene Sitzung hört ein Agent nichts.
607
+ */
608
+ /** Was der Agent gerade tut – die UI macht daraus die Anzeige am Avatar. */
609
+ export declare const AGENT_VOICE_STATES: readonly ['idle', 'listening', 'thinking', 'speaking'];
610
+ export type AgentVoiceState = (typeof AGENT_VOICE_STATES)[number];
611
+ /** Warum eine Sprachsitzung endete. */
612
+ export type AgentVoiceEndReason =
613
+ /** Der Mensch hat `E` noch einmal gedrückt */
614
+ 'closed'
615
+ /** Reichweite verlassen */
616
+ | 'away'
617
+ /** Zone gewechselt – anderer Raum, anderes Gespräch */
618
+ | 'zone'
619
+ /** Zu lange still */
620
+ | 'idle'
621
+ /** Obergrenze der Sitzungsdauer erreicht */
622
+ | 'expired'
623
+ /** Einer von beiden ist weg (Verbindung, Welt, Workspace) */
624
+ | 'gone'
625
+ /** Budget erschöpft */
626
+ | 'throttled';
627
+ /**
628
+ * Ereignis an den Agenten: ein Gespräch wird eröffnet oder beendet (`agent:voice`).
629
+ *
630
+ * Bei `open` holt sich der Agent mit `agent:meetingToken` (Ziel `target`) sein LiveKit-Token und
631
+ * abonniert **nur** die Spur von `human.identity` – mehr darf er nicht hören.
632
+ */
633
+ export interface AgentVoicePayload {
634
+ kind: 'open' | 'close';
635
+ sessionId: string;
636
+ /** LiveKit-Raum, in dem das Gespräch läuft */
637
+ room: string;
638
+ /** Ziel für `agent:meetingToken` (`office` oder Zonen-ID) */
639
+ target: string;
640
+ /** Der Mensch am anderen Ende; `identity` ist seine LiveKit-Identität (= Teilnehmer-ID) */
641
+ human: {
642
+ participantId: string;
643
+ userId: string;
644
+ displayName: string;
645
+ identity: string;
646
+ };
647
+ /** Konversation für Untertitel (`chat:send`) */
648
+ conv: string;
649
+ zoneId: string | null;
650
+ /** Nur bei `close` */
651
+ reason: AgentVoiceEndReason | null;
652
+ at: number;
653
+ }
654
+ /** Der Agent meldet, was er gerade tut (`agent:voice:state`). */
655
+ export declare const agentVoiceStateSchema: z.ZodObject<{
656
+ sessionId: z.ZodString;
657
+ state: z.ZodEnum<{
658
+ idle: "idle";
659
+ listening: "listening";
660
+ speaking: "speaking";
661
+ thinking: "thinking";
662
+ }>;
663
+ text: z.ZodOptional<z.ZodString>;
664
+ }, z.core.$strip>;
665
+ export type AgentVoiceStateInput = z.output<typeof agentVoiceStateSchema>;
666
+ /** Der Mensch beendet das Gespräch (`voice:close`, Browser → Server). */
667
+ export declare const voiceCloseSchema: z.ZodObject<{
668
+ agentParticipantId: z.ZodString;
669
+ }, z.core.$strip>;
670
+ /**
671
+ * Gesprächszustand für die Oberfläche (`voice:session`, Server → alle im Workspace).
672
+ *
673
+ * `active: false` heißt: das Gespräch ist zu Ende. Die Anzeige am Avatar hängt an genau diesem
674
+ * Ereignis – es gibt keinen zweiten Weg, auf dem ein Sprechzustand in die UI kommt.
675
+ */
676
+ export interface VoiceSessionPayload {
677
+ sessionId: string;
678
+ agentParticipantId: string;
679
+ agentId: string;
680
+ humanParticipantId: string;
681
+ active: boolean;
682
+ /** Zustand des Agenten in diesem Gespräch */
683
+ state: AgentVoiceState;
684
+ reason: AgentVoiceEndReason | null;
685
+ since: number;
686
+ at: number;
687
+ }
688
+ /** Erwähnungen `@Name` aus einem Nachrichtentext ziehen (Groß-/Kleinschreibung egal, Namen mit Leerzeichen). */
689
+ export declare function findMentions(text: string, names: readonly string[]): string[];