@backbay/glia-agent 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.
- package/dist/audio.d.ts +163 -0
- package/dist/audio.js +39 -0
- package/dist/audio.js.map +1 -0
- package/dist/chunk-LLOGBVQT.js +445 -0
- package/dist/chunk-LLOGBVQT.js.map +1 -0
- package/dist/chunk-VU2XK2NI.js +583 -0
- package/dist/chunk-VU2XK2NI.js.map +1 -0
- package/dist/chunk-XE2IVCKJ.js +743 -0
- package/dist/chunk-XE2IVCKJ.js.map +1 -0
- package/dist/cognition.d.ts +742 -0
- package/dist/cognition.js +25 -0
- package/dist/cognition.js.map +1 -0
- package/dist/emotion.d.ts +288 -0
- package/dist/emotion.js +53 -0
- package/dist/emotion.js.map +1 -0
- package/dist/httpSpeechSynthesisProvider-CIR7L2Zr.d.ts +1698 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -0
- package/dist/types-B0jyNVTH.d.ts +85 -0
- package/dist/types-CRp9rbx0.d.ts +125 -0
- package/package.json +54 -0
|
@@ -0,0 +1,742 @@
|
|
|
1
|
+
import { d as CognitiveMode, c as CognitionState, C as CognitionEvent } from './types-CRp9rbx0.js';
|
|
2
|
+
export { a as CognitionSignals, b as CognitionSnapshot, e as CognitiveSubmode, D as DetailedBalance, f as DynamicsState, E as EvidenceRef, P as PersonaSignals, g as PersonalityConfig, h as PolicyConfig, T as TrapWarning, j as clamp01, i as createInitialCognitionState } from './types-CRp9rbx0.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { b as AnchorState, A as AVO } from './types-B0jyNVTH.js';
|
|
5
|
+
|
|
6
|
+
declare const CognitionStateSchema: z.ZodObject<{
|
|
7
|
+
mode: z.ZodEnum<["idle", "listening", "deliberating", "acting", "explaining", "recovering", "blocked"]>;
|
|
8
|
+
submode: z.ZodOptional<z.ZodEnum<["reading", "searching", "verifying", "waiting", "writing", "tool_call"]>>;
|
|
9
|
+
focusRunId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
attention: z.ZodNumber;
|
|
11
|
+
workload: z.ZodNumber;
|
|
12
|
+
timePressure: z.ZodNumber;
|
|
13
|
+
planDrift: z.ZodNumber;
|
|
14
|
+
costPressure: z.ZodNumber;
|
|
15
|
+
risk: z.ZodNumber;
|
|
16
|
+
uncertainty: z.ZodNumber;
|
|
17
|
+
confidence: z.ZodNumber;
|
|
18
|
+
errorStress: z.ZodNumber;
|
|
19
|
+
personaAnchor: z.ZodNumber;
|
|
20
|
+
personaDriftRisk: z.ZodNumber;
|
|
21
|
+
personaStyle: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
22
|
+
dynamics: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
potentialV: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
actionRate: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
detailedBalance: z.ZodOptional<z.ZodObject<{
|
|
26
|
+
chi2PerNdf: z.ZodNumber;
|
|
27
|
+
passed: z.ZodBoolean;
|
|
28
|
+
threshold: z.ZodNumber;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
chi2PerNdf: number;
|
|
31
|
+
passed: boolean;
|
|
32
|
+
threshold: number;
|
|
33
|
+
}, {
|
|
34
|
+
chi2PerNdf: number;
|
|
35
|
+
passed: boolean;
|
|
36
|
+
threshold: number;
|
|
37
|
+
}>>;
|
|
38
|
+
traps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39
|
+
stateId: z.ZodString;
|
|
40
|
+
reason: z.ZodString;
|
|
41
|
+
recommendation: z.ZodString;
|
|
42
|
+
severity: z.ZodOptional<z.ZodEnum<["info", "warning", "danger"]>>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
stateId: string;
|
|
45
|
+
reason: string;
|
|
46
|
+
recommendation: string;
|
|
47
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
stateId: string;
|
|
50
|
+
reason: string;
|
|
51
|
+
recommendation: string;
|
|
52
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
53
|
+
}>, "many">>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
potentialV?: number | undefined;
|
|
56
|
+
actionRate?: number | undefined;
|
|
57
|
+
detailedBalance?: {
|
|
58
|
+
chi2PerNdf: number;
|
|
59
|
+
passed: boolean;
|
|
60
|
+
threshold: number;
|
|
61
|
+
} | undefined;
|
|
62
|
+
traps?: {
|
|
63
|
+
stateId: string;
|
|
64
|
+
reason: string;
|
|
65
|
+
recommendation: string;
|
|
66
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
67
|
+
}[] | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
potentialV?: number | undefined;
|
|
70
|
+
actionRate?: number | undefined;
|
|
71
|
+
detailedBalance?: {
|
|
72
|
+
chi2PerNdf: number;
|
|
73
|
+
passed: boolean;
|
|
74
|
+
threshold: number;
|
|
75
|
+
} | undefined;
|
|
76
|
+
traps?: {
|
|
77
|
+
stateId: string;
|
|
78
|
+
reason: string;
|
|
79
|
+
recommendation: string;
|
|
80
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
81
|
+
}[] | undefined;
|
|
82
|
+
}>>;
|
|
83
|
+
personality: z.ZodOptional<z.ZodObject<{
|
|
84
|
+
style: z.ZodEnum<["professional", "casual", "terse", "verbose"]>;
|
|
85
|
+
riskTolerance: z.ZodEnum<["conservative", "moderate", "aggressive"]>;
|
|
86
|
+
autonomy: z.ZodEnum<["low", "medium", "high", "full"]>;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
style: "professional" | "casual" | "terse" | "verbose";
|
|
89
|
+
riskTolerance: "conservative" | "moderate" | "aggressive";
|
|
90
|
+
autonomy: "low" | "medium" | "high" | "full";
|
|
91
|
+
}, {
|
|
92
|
+
style: "professional" | "casual" | "terse" | "verbose";
|
|
93
|
+
riskTolerance: "conservative" | "moderate" | "aggressive";
|
|
94
|
+
autonomy: "low" | "medium" | "high" | "full";
|
|
95
|
+
}>>;
|
|
96
|
+
policy: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
safetyMode: z.ZodBoolean;
|
|
98
|
+
trustTier: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
safetyMode: boolean;
|
|
101
|
+
trustTier?: string | undefined;
|
|
102
|
+
}, {
|
|
103
|
+
safetyMode: boolean;
|
|
104
|
+
trustTier?: string | undefined;
|
|
105
|
+
}>>;
|
|
106
|
+
moodAVO: z.ZodObject<{
|
|
107
|
+
arousal: z.ZodNumber;
|
|
108
|
+
valence: z.ZodNumber;
|
|
109
|
+
openness: z.ZodNumber;
|
|
110
|
+
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
arousal: number;
|
|
112
|
+
valence: number;
|
|
113
|
+
openness: number;
|
|
114
|
+
}, {
|
|
115
|
+
arousal: number;
|
|
116
|
+
valence: number;
|
|
117
|
+
openness: number;
|
|
118
|
+
}>;
|
|
119
|
+
emotionAVO: z.ZodObject<{
|
|
120
|
+
arousal: z.ZodNumber;
|
|
121
|
+
valence: z.ZodNumber;
|
|
122
|
+
openness: z.ZodNumber;
|
|
123
|
+
}, "strip", z.ZodTypeAny, {
|
|
124
|
+
arousal: number;
|
|
125
|
+
valence: number;
|
|
126
|
+
openness: number;
|
|
127
|
+
}, {
|
|
128
|
+
arousal: number;
|
|
129
|
+
valence: number;
|
|
130
|
+
openness: number;
|
|
131
|
+
}>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
mode: "idle" | "listening" | "explaining" | "recovering" | "deliberating" | "acting" | "blocked";
|
|
134
|
+
moodAVO: {
|
|
135
|
+
arousal: number;
|
|
136
|
+
valence: number;
|
|
137
|
+
openness: number;
|
|
138
|
+
};
|
|
139
|
+
emotionAVO: {
|
|
140
|
+
arousal: number;
|
|
141
|
+
valence: number;
|
|
142
|
+
openness: number;
|
|
143
|
+
};
|
|
144
|
+
attention: number;
|
|
145
|
+
workload: number;
|
|
146
|
+
timePressure: number;
|
|
147
|
+
planDrift: number;
|
|
148
|
+
costPressure: number;
|
|
149
|
+
risk: number;
|
|
150
|
+
uncertainty: number;
|
|
151
|
+
confidence: number;
|
|
152
|
+
errorStress: number;
|
|
153
|
+
personaAnchor: number;
|
|
154
|
+
personaDriftRisk: number;
|
|
155
|
+
submode?: "reading" | "searching" | "verifying" | "waiting" | "writing" | "tool_call" | undefined;
|
|
156
|
+
focusRunId?: string | undefined;
|
|
157
|
+
dynamics?: {
|
|
158
|
+
potentialV?: number | undefined;
|
|
159
|
+
actionRate?: number | undefined;
|
|
160
|
+
detailedBalance?: {
|
|
161
|
+
chi2PerNdf: number;
|
|
162
|
+
passed: boolean;
|
|
163
|
+
threshold: number;
|
|
164
|
+
} | undefined;
|
|
165
|
+
traps?: {
|
|
166
|
+
stateId: string;
|
|
167
|
+
reason: string;
|
|
168
|
+
recommendation: string;
|
|
169
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
170
|
+
}[] | undefined;
|
|
171
|
+
} | undefined;
|
|
172
|
+
personality?: {
|
|
173
|
+
style: "professional" | "casual" | "terse" | "verbose";
|
|
174
|
+
riskTolerance: "conservative" | "moderate" | "aggressive";
|
|
175
|
+
autonomy: "low" | "medium" | "high" | "full";
|
|
176
|
+
} | undefined;
|
|
177
|
+
policy?: {
|
|
178
|
+
safetyMode: boolean;
|
|
179
|
+
trustTier?: string | undefined;
|
|
180
|
+
} | undefined;
|
|
181
|
+
personaStyle?: string[] | undefined;
|
|
182
|
+
}, {
|
|
183
|
+
mode: "idle" | "listening" | "explaining" | "recovering" | "deliberating" | "acting" | "blocked";
|
|
184
|
+
moodAVO: {
|
|
185
|
+
arousal: number;
|
|
186
|
+
valence: number;
|
|
187
|
+
openness: number;
|
|
188
|
+
};
|
|
189
|
+
emotionAVO: {
|
|
190
|
+
arousal: number;
|
|
191
|
+
valence: number;
|
|
192
|
+
openness: number;
|
|
193
|
+
};
|
|
194
|
+
attention: number;
|
|
195
|
+
workload: number;
|
|
196
|
+
timePressure: number;
|
|
197
|
+
planDrift: number;
|
|
198
|
+
costPressure: number;
|
|
199
|
+
risk: number;
|
|
200
|
+
uncertainty: number;
|
|
201
|
+
confidence: number;
|
|
202
|
+
errorStress: number;
|
|
203
|
+
personaAnchor: number;
|
|
204
|
+
personaDriftRisk: number;
|
|
205
|
+
submode?: "reading" | "searching" | "verifying" | "waiting" | "writing" | "tool_call" | undefined;
|
|
206
|
+
focusRunId?: string | undefined;
|
|
207
|
+
dynamics?: {
|
|
208
|
+
potentialV?: number | undefined;
|
|
209
|
+
actionRate?: number | undefined;
|
|
210
|
+
detailedBalance?: {
|
|
211
|
+
chi2PerNdf: number;
|
|
212
|
+
passed: boolean;
|
|
213
|
+
threshold: number;
|
|
214
|
+
} | undefined;
|
|
215
|
+
traps?: {
|
|
216
|
+
stateId: string;
|
|
217
|
+
reason: string;
|
|
218
|
+
recommendation: string;
|
|
219
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
220
|
+
}[] | undefined;
|
|
221
|
+
} | undefined;
|
|
222
|
+
personality?: {
|
|
223
|
+
style: "professional" | "casual" | "terse" | "verbose";
|
|
224
|
+
riskTolerance: "conservative" | "moderate" | "aggressive";
|
|
225
|
+
autonomy: "low" | "medium" | "high" | "full";
|
|
226
|
+
} | undefined;
|
|
227
|
+
policy?: {
|
|
228
|
+
safetyMode: boolean;
|
|
229
|
+
trustTier?: string | undefined;
|
|
230
|
+
} | undefined;
|
|
231
|
+
personaStyle?: string[] | undefined;
|
|
232
|
+
}>;
|
|
233
|
+
declare const CognitionSnapshotSchema: z.ZodObject<{
|
|
234
|
+
version: z.ZodLiteral<"1.0">;
|
|
235
|
+
timestamp: z.ZodNumber;
|
|
236
|
+
state: z.ZodObject<{
|
|
237
|
+
mode: z.ZodEnum<["idle", "listening", "deliberating", "acting", "explaining", "recovering", "blocked"]>;
|
|
238
|
+
submode: z.ZodOptional<z.ZodEnum<["reading", "searching", "verifying", "waiting", "writing", "tool_call"]>>;
|
|
239
|
+
focusRunId: z.ZodOptional<z.ZodString>;
|
|
240
|
+
attention: z.ZodNumber;
|
|
241
|
+
workload: z.ZodNumber;
|
|
242
|
+
timePressure: z.ZodNumber;
|
|
243
|
+
planDrift: z.ZodNumber;
|
|
244
|
+
costPressure: z.ZodNumber;
|
|
245
|
+
risk: z.ZodNumber;
|
|
246
|
+
uncertainty: z.ZodNumber;
|
|
247
|
+
confidence: z.ZodNumber;
|
|
248
|
+
errorStress: z.ZodNumber;
|
|
249
|
+
personaAnchor: z.ZodNumber;
|
|
250
|
+
personaDriftRisk: z.ZodNumber;
|
|
251
|
+
personaStyle: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
252
|
+
dynamics: z.ZodOptional<z.ZodObject<{
|
|
253
|
+
potentialV: z.ZodOptional<z.ZodNumber>;
|
|
254
|
+
actionRate: z.ZodOptional<z.ZodNumber>;
|
|
255
|
+
detailedBalance: z.ZodOptional<z.ZodObject<{
|
|
256
|
+
chi2PerNdf: z.ZodNumber;
|
|
257
|
+
passed: z.ZodBoolean;
|
|
258
|
+
threshold: z.ZodNumber;
|
|
259
|
+
}, "strip", z.ZodTypeAny, {
|
|
260
|
+
chi2PerNdf: number;
|
|
261
|
+
passed: boolean;
|
|
262
|
+
threshold: number;
|
|
263
|
+
}, {
|
|
264
|
+
chi2PerNdf: number;
|
|
265
|
+
passed: boolean;
|
|
266
|
+
threshold: number;
|
|
267
|
+
}>>;
|
|
268
|
+
traps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
269
|
+
stateId: z.ZodString;
|
|
270
|
+
reason: z.ZodString;
|
|
271
|
+
recommendation: z.ZodString;
|
|
272
|
+
severity: z.ZodOptional<z.ZodEnum<["info", "warning", "danger"]>>;
|
|
273
|
+
}, "strip", z.ZodTypeAny, {
|
|
274
|
+
stateId: string;
|
|
275
|
+
reason: string;
|
|
276
|
+
recommendation: string;
|
|
277
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
278
|
+
}, {
|
|
279
|
+
stateId: string;
|
|
280
|
+
reason: string;
|
|
281
|
+
recommendation: string;
|
|
282
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
283
|
+
}>, "many">>;
|
|
284
|
+
}, "strip", z.ZodTypeAny, {
|
|
285
|
+
potentialV?: number | undefined;
|
|
286
|
+
actionRate?: number | undefined;
|
|
287
|
+
detailedBalance?: {
|
|
288
|
+
chi2PerNdf: number;
|
|
289
|
+
passed: boolean;
|
|
290
|
+
threshold: number;
|
|
291
|
+
} | undefined;
|
|
292
|
+
traps?: {
|
|
293
|
+
stateId: string;
|
|
294
|
+
reason: string;
|
|
295
|
+
recommendation: string;
|
|
296
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
297
|
+
}[] | undefined;
|
|
298
|
+
}, {
|
|
299
|
+
potentialV?: number | undefined;
|
|
300
|
+
actionRate?: number | undefined;
|
|
301
|
+
detailedBalance?: {
|
|
302
|
+
chi2PerNdf: number;
|
|
303
|
+
passed: boolean;
|
|
304
|
+
threshold: number;
|
|
305
|
+
} | undefined;
|
|
306
|
+
traps?: {
|
|
307
|
+
stateId: string;
|
|
308
|
+
reason: string;
|
|
309
|
+
recommendation: string;
|
|
310
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
311
|
+
}[] | undefined;
|
|
312
|
+
}>>;
|
|
313
|
+
personality: z.ZodOptional<z.ZodObject<{
|
|
314
|
+
style: z.ZodEnum<["professional", "casual", "terse", "verbose"]>;
|
|
315
|
+
riskTolerance: z.ZodEnum<["conservative", "moderate", "aggressive"]>;
|
|
316
|
+
autonomy: z.ZodEnum<["low", "medium", "high", "full"]>;
|
|
317
|
+
}, "strip", z.ZodTypeAny, {
|
|
318
|
+
style: "professional" | "casual" | "terse" | "verbose";
|
|
319
|
+
riskTolerance: "conservative" | "moderate" | "aggressive";
|
|
320
|
+
autonomy: "low" | "medium" | "high" | "full";
|
|
321
|
+
}, {
|
|
322
|
+
style: "professional" | "casual" | "terse" | "verbose";
|
|
323
|
+
riskTolerance: "conservative" | "moderate" | "aggressive";
|
|
324
|
+
autonomy: "low" | "medium" | "high" | "full";
|
|
325
|
+
}>>;
|
|
326
|
+
policy: z.ZodOptional<z.ZodObject<{
|
|
327
|
+
safetyMode: z.ZodBoolean;
|
|
328
|
+
trustTier: z.ZodOptional<z.ZodString>;
|
|
329
|
+
}, "strip", z.ZodTypeAny, {
|
|
330
|
+
safetyMode: boolean;
|
|
331
|
+
trustTier?: string | undefined;
|
|
332
|
+
}, {
|
|
333
|
+
safetyMode: boolean;
|
|
334
|
+
trustTier?: string | undefined;
|
|
335
|
+
}>>;
|
|
336
|
+
moodAVO: z.ZodObject<{
|
|
337
|
+
arousal: z.ZodNumber;
|
|
338
|
+
valence: z.ZodNumber;
|
|
339
|
+
openness: z.ZodNumber;
|
|
340
|
+
}, "strip", z.ZodTypeAny, {
|
|
341
|
+
arousal: number;
|
|
342
|
+
valence: number;
|
|
343
|
+
openness: number;
|
|
344
|
+
}, {
|
|
345
|
+
arousal: number;
|
|
346
|
+
valence: number;
|
|
347
|
+
openness: number;
|
|
348
|
+
}>;
|
|
349
|
+
emotionAVO: z.ZodObject<{
|
|
350
|
+
arousal: z.ZodNumber;
|
|
351
|
+
valence: z.ZodNumber;
|
|
352
|
+
openness: z.ZodNumber;
|
|
353
|
+
}, "strip", z.ZodTypeAny, {
|
|
354
|
+
arousal: number;
|
|
355
|
+
valence: number;
|
|
356
|
+
openness: number;
|
|
357
|
+
}, {
|
|
358
|
+
arousal: number;
|
|
359
|
+
valence: number;
|
|
360
|
+
openness: number;
|
|
361
|
+
}>;
|
|
362
|
+
}, "strip", z.ZodTypeAny, {
|
|
363
|
+
mode: "idle" | "listening" | "explaining" | "recovering" | "deliberating" | "acting" | "blocked";
|
|
364
|
+
moodAVO: {
|
|
365
|
+
arousal: number;
|
|
366
|
+
valence: number;
|
|
367
|
+
openness: number;
|
|
368
|
+
};
|
|
369
|
+
emotionAVO: {
|
|
370
|
+
arousal: number;
|
|
371
|
+
valence: number;
|
|
372
|
+
openness: number;
|
|
373
|
+
};
|
|
374
|
+
attention: number;
|
|
375
|
+
workload: number;
|
|
376
|
+
timePressure: number;
|
|
377
|
+
planDrift: number;
|
|
378
|
+
costPressure: number;
|
|
379
|
+
risk: number;
|
|
380
|
+
uncertainty: number;
|
|
381
|
+
confidence: number;
|
|
382
|
+
errorStress: number;
|
|
383
|
+
personaAnchor: number;
|
|
384
|
+
personaDriftRisk: number;
|
|
385
|
+
submode?: "reading" | "searching" | "verifying" | "waiting" | "writing" | "tool_call" | undefined;
|
|
386
|
+
focusRunId?: string | undefined;
|
|
387
|
+
dynamics?: {
|
|
388
|
+
potentialV?: number | undefined;
|
|
389
|
+
actionRate?: number | undefined;
|
|
390
|
+
detailedBalance?: {
|
|
391
|
+
chi2PerNdf: number;
|
|
392
|
+
passed: boolean;
|
|
393
|
+
threshold: number;
|
|
394
|
+
} | undefined;
|
|
395
|
+
traps?: {
|
|
396
|
+
stateId: string;
|
|
397
|
+
reason: string;
|
|
398
|
+
recommendation: string;
|
|
399
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
400
|
+
}[] | undefined;
|
|
401
|
+
} | undefined;
|
|
402
|
+
personality?: {
|
|
403
|
+
style: "professional" | "casual" | "terse" | "verbose";
|
|
404
|
+
riskTolerance: "conservative" | "moderate" | "aggressive";
|
|
405
|
+
autonomy: "low" | "medium" | "high" | "full";
|
|
406
|
+
} | undefined;
|
|
407
|
+
policy?: {
|
|
408
|
+
safetyMode: boolean;
|
|
409
|
+
trustTier?: string | undefined;
|
|
410
|
+
} | undefined;
|
|
411
|
+
personaStyle?: string[] | undefined;
|
|
412
|
+
}, {
|
|
413
|
+
mode: "idle" | "listening" | "explaining" | "recovering" | "deliberating" | "acting" | "blocked";
|
|
414
|
+
moodAVO: {
|
|
415
|
+
arousal: number;
|
|
416
|
+
valence: number;
|
|
417
|
+
openness: number;
|
|
418
|
+
};
|
|
419
|
+
emotionAVO: {
|
|
420
|
+
arousal: number;
|
|
421
|
+
valence: number;
|
|
422
|
+
openness: number;
|
|
423
|
+
};
|
|
424
|
+
attention: number;
|
|
425
|
+
workload: number;
|
|
426
|
+
timePressure: number;
|
|
427
|
+
planDrift: number;
|
|
428
|
+
costPressure: number;
|
|
429
|
+
risk: number;
|
|
430
|
+
uncertainty: number;
|
|
431
|
+
confidence: number;
|
|
432
|
+
errorStress: number;
|
|
433
|
+
personaAnchor: number;
|
|
434
|
+
personaDriftRisk: number;
|
|
435
|
+
submode?: "reading" | "searching" | "verifying" | "waiting" | "writing" | "tool_call" | undefined;
|
|
436
|
+
focusRunId?: string | undefined;
|
|
437
|
+
dynamics?: {
|
|
438
|
+
potentialV?: number | undefined;
|
|
439
|
+
actionRate?: number | undefined;
|
|
440
|
+
detailedBalance?: {
|
|
441
|
+
chi2PerNdf: number;
|
|
442
|
+
passed: boolean;
|
|
443
|
+
threshold: number;
|
|
444
|
+
} | undefined;
|
|
445
|
+
traps?: {
|
|
446
|
+
stateId: string;
|
|
447
|
+
reason: string;
|
|
448
|
+
recommendation: string;
|
|
449
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
450
|
+
}[] | undefined;
|
|
451
|
+
} | undefined;
|
|
452
|
+
personality?: {
|
|
453
|
+
style: "professional" | "casual" | "terse" | "verbose";
|
|
454
|
+
riskTolerance: "conservative" | "moderate" | "aggressive";
|
|
455
|
+
autonomy: "low" | "medium" | "high" | "full";
|
|
456
|
+
} | undefined;
|
|
457
|
+
policy?: {
|
|
458
|
+
safetyMode: boolean;
|
|
459
|
+
trustTier?: string | undefined;
|
|
460
|
+
} | undefined;
|
|
461
|
+
personaStyle?: string[] | undefined;
|
|
462
|
+
}>;
|
|
463
|
+
recentEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
464
|
+
t: z.ZodNumber;
|
|
465
|
+
event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
466
|
+
}, "strip", z.ZodTypeAny, {
|
|
467
|
+
t: number;
|
|
468
|
+
event: Record<string, unknown>;
|
|
469
|
+
}, {
|
|
470
|
+
t: number;
|
|
471
|
+
event: Record<string, unknown>;
|
|
472
|
+
}>, "many">>;
|
|
473
|
+
}, "strip", z.ZodTypeAny, {
|
|
474
|
+
state: {
|
|
475
|
+
mode: "idle" | "listening" | "explaining" | "recovering" | "deliberating" | "acting" | "blocked";
|
|
476
|
+
moodAVO: {
|
|
477
|
+
arousal: number;
|
|
478
|
+
valence: number;
|
|
479
|
+
openness: number;
|
|
480
|
+
};
|
|
481
|
+
emotionAVO: {
|
|
482
|
+
arousal: number;
|
|
483
|
+
valence: number;
|
|
484
|
+
openness: number;
|
|
485
|
+
};
|
|
486
|
+
attention: number;
|
|
487
|
+
workload: number;
|
|
488
|
+
timePressure: number;
|
|
489
|
+
planDrift: number;
|
|
490
|
+
costPressure: number;
|
|
491
|
+
risk: number;
|
|
492
|
+
uncertainty: number;
|
|
493
|
+
confidence: number;
|
|
494
|
+
errorStress: number;
|
|
495
|
+
personaAnchor: number;
|
|
496
|
+
personaDriftRisk: number;
|
|
497
|
+
submode?: "reading" | "searching" | "verifying" | "waiting" | "writing" | "tool_call" | undefined;
|
|
498
|
+
focusRunId?: string | undefined;
|
|
499
|
+
dynamics?: {
|
|
500
|
+
potentialV?: number | undefined;
|
|
501
|
+
actionRate?: number | undefined;
|
|
502
|
+
detailedBalance?: {
|
|
503
|
+
chi2PerNdf: number;
|
|
504
|
+
passed: boolean;
|
|
505
|
+
threshold: number;
|
|
506
|
+
} | undefined;
|
|
507
|
+
traps?: {
|
|
508
|
+
stateId: string;
|
|
509
|
+
reason: string;
|
|
510
|
+
recommendation: string;
|
|
511
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
512
|
+
}[] | undefined;
|
|
513
|
+
} | undefined;
|
|
514
|
+
personality?: {
|
|
515
|
+
style: "professional" | "casual" | "terse" | "verbose";
|
|
516
|
+
riskTolerance: "conservative" | "moderate" | "aggressive";
|
|
517
|
+
autonomy: "low" | "medium" | "high" | "full";
|
|
518
|
+
} | undefined;
|
|
519
|
+
policy?: {
|
|
520
|
+
safetyMode: boolean;
|
|
521
|
+
trustTier?: string | undefined;
|
|
522
|
+
} | undefined;
|
|
523
|
+
personaStyle?: string[] | undefined;
|
|
524
|
+
};
|
|
525
|
+
version: "1.0";
|
|
526
|
+
timestamp: number;
|
|
527
|
+
recentEvents?: {
|
|
528
|
+
t: number;
|
|
529
|
+
event: Record<string, unknown>;
|
|
530
|
+
}[] | undefined;
|
|
531
|
+
}, {
|
|
532
|
+
state: {
|
|
533
|
+
mode: "idle" | "listening" | "explaining" | "recovering" | "deliberating" | "acting" | "blocked";
|
|
534
|
+
moodAVO: {
|
|
535
|
+
arousal: number;
|
|
536
|
+
valence: number;
|
|
537
|
+
openness: number;
|
|
538
|
+
};
|
|
539
|
+
emotionAVO: {
|
|
540
|
+
arousal: number;
|
|
541
|
+
valence: number;
|
|
542
|
+
openness: number;
|
|
543
|
+
};
|
|
544
|
+
attention: number;
|
|
545
|
+
workload: number;
|
|
546
|
+
timePressure: number;
|
|
547
|
+
planDrift: number;
|
|
548
|
+
costPressure: number;
|
|
549
|
+
risk: number;
|
|
550
|
+
uncertainty: number;
|
|
551
|
+
confidence: number;
|
|
552
|
+
errorStress: number;
|
|
553
|
+
personaAnchor: number;
|
|
554
|
+
personaDriftRisk: number;
|
|
555
|
+
submode?: "reading" | "searching" | "verifying" | "waiting" | "writing" | "tool_call" | undefined;
|
|
556
|
+
focusRunId?: string | undefined;
|
|
557
|
+
dynamics?: {
|
|
558
|
+
potentialV?: number | undefined;
|
|
559
|
+
actionRate?: number | undefined;
|
|
560
|
+
detailedBalance?: {
|
|
561
|
+
chi2PerNdf: number;
|
|
562
|
+
passed: boolean;
|
|
563
|
+
threshold: number;
|
|
564
|
+
} | undefined;
|
|
565
|
+
traps?: {
|
|
566
|
+
stateId: string;
|
|
567
|
+
reason: string;
|
|
568
|
+
recommendation: string;
|
|
569
|
+
severity?: "info" | "warning" | "danger" | undefined;
|
|
570
|
+
}[] | undefined;
|
|
571
|
+
} | undefined;
|
|
572
|
+
personality?: {
|
|
573
|
+
style: "professional" | "casual" | "terse" | "verbose";
|
|
574
|
+
riskTolerance: "conservative" | "moderate" | "aggressive";
|
|
575
|
+
autonomy: "low" | "medium" | "high" | "full";
|
|
576
|
+
} | undefined;
|
|
577
|
+
policy?: {
|
|
578
|
+
safetyMode: boolean;
|
|
579
|
+
trustTier?: string | undefined;
|
|
580
|
+
} | undefined;
|
|
581
|
+
personaStyle?: string[] | undefined;
|
|
582
|
+
};
|
|
583
|
+
version: "1.0";
|
|
584
|
+
timestamp: number;
|
|
585
|
+
recentEvents?: {
|
|
586
|
+
t: number;
|
|
587
|
+
event: Record<string, unknown>;
|
|
588
|
+
}[] | undefined;
|
|
589
|
+
}>;
|
|
590
|
+
type CognitionSnapshotInput = z.input<typeof CognitionSnapshotSchema>;
|
|
591
|
+
type CognitionSnapshotOutput = z.output<typeof CognitionSnapshotSchema>;
|
|
592
|
+
interface CognitionSnapshotValidationResult {
|
|
593
|
+
success: boolean;
|
|
594
|
+
data?: CognitionSnapshotOutput;
|
|
595
|
+
error?: z.ZodError;
|
|
596
|
+
}
|
|
597
|
+
declare function validateCognitionSnapshot(input: unknown): CognitionSnapshotValidationResult;
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Cognition State Reducers
|
|
601
|
+
*
|
|
602
|
+
* Pure functions for updating cognition state based on events and time decay.
|
|
603
|
+
*/
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Trigger types that cause mode transitions
|
|
607
|
+
*/
|
|
608
|
+
type CognitionTrigger = 'ui.input_received' | 'ui.user_idle' | 'ui.interrupt' | 'run.started' | 'run.completed' | 'run.event';
|
|
609
|
+
/**
|
|
610
|
+
* Maps trigger events to resulting cognitive modes
|
|
611
|
+
*/
|
|
612
|
+
declare const MODE_TRANSITION_MAP: Record<CognitionTrigger, CognitiveMode>;
|
|
613
|
+
/**
|
|
614
|
+
* Apply exponential decay to time-based signals
|
|
615
|
+
*/
|
|
616
|
+
declare function reduceDecay(state: CognitionState, deltaMs: number): CognitionState;
|
|
617
|
+
/**
|
|
618
|
+
* Main event reducer - handles all cognition events
|
|
619
|
+
*/
|
|
620
|
+
declare function reduceEvent(state: CognitionState, event: CognitionEvent): CognitionState;
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* CognitionController manages the cognitive state lifecycle for the Glyph character.
|
|
624
|
+
*
|
|
625
|
+
* It handles:
|
|
626
|
+
* - Cognitive mode transitions (idle, listening, deliberating, acting, etc.)
|
|
627
|
+
* - Continuous signal processing (attention, workload, risk, etc.)
|
|
628
|
+
* - Event-driven state changes from UI and kernel events
|
|
629
|
+
* - Emotion bridge (mood and emotion AVO dimensions)
|
|
630
|
+
* - Time-based decay of stress signals
|
|
631
|
+
*/
|
|
632
|
+
|
|
633
|
+
type EventHandler<T> = (data: T) => void;
|
|
634
|
+
interface CognitionControllerEvents {
|
|
635
|
+
/** Emitted when any state change occurs */
|
|
636
|
+
change: CognitionState;
|
|
637
|
+
/** Emitted when mode changes */
|
|
638
|
+
modeChange: {
|
|
639
|
+
from: CognitiveMode;
|
|
640
|
+
to: CognitiveMode;
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
interface CognitionControllerOptions {
|
|
644
|
+
/** Initial state overrides */
|
|
645
|
+
initial?: Partial<CognitionState>;
|
|
646
|
+
}
|
|
647
|
+
interface EmotionTarget {
|
|
648
|
+
/** The anchor state name for the current mode */
|
|
649
|
+
anchor: AnchorState;
|
|
650
|
+
/** The target AVO values adjusted by signals */
|
|
651
|
+
avo: AVO;
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* CognitionController manages the cognitive state lifecycle for the Glyph character.
|
|
655
|
+
*/
|
|
656
|
+
declare class CognitionController {
|
|
657
|
+
private _state;
|
|
658
|
+
private _listeners;
|
|
659
|
+
private _disposed;
|
|
660
|
+
constructor(options?: CognitionControllerOptions);
|
|
661
|
+
/**
|
|
662
|
+
* Get current cognition state
|
|
663
|
+
*/
|
|
664
|
+
getState(): CognitionState;
|
|
665
|
+
/**
|
|
666
|
+
* Get the emotion target for the current cognitive state
|
|
667
|
+
* Returns anchor state and AVO values adjusted by signals
|
|
668
|
+
*/
|
|
669
|
+
getEmotionTarget(): EmotionTarget;
|
|
670
|
+
/**
|
|
671
|
+
* Get emotion bridge - derives anchor and AVO from cognitive state
|
|
672
|
+
* @deprecated Use getEmotionTarget() instead
|
|
673
|
+
*/
|
|
674
|
+
getEmotionBridge(): {
|
|
675
|
+
anchor?: AnchorState;
|
|
676
|
+
avo?: AVO;
|
|
677
|
+
};
|
|
678
|
+
/**
|
|
679
|
+
* Handle a cognition event and update state
|
|
680
|
+
*/
|
|
681
|
+
handleEvent(event: CognitionEvent): void;
|
|
682
|
+
/**
|
|
683
|
+
* Process an event and update state
|
|
684
|
+
* @deprecated Use handleEvent() instead
|
|
685
|
+
*/
|
|
686
|
+
emit(event: CognitionEvent): void;
|
|
687
|
+
/**
|
|
688
|
+
* Update tick - call each frame with delta time in milliseconds
|
|
689
|
+
* Applies time-based decay to stress signals
|
|
690
|
+
*/
|
|
691
|
+
tick(deltaMs: number): void;
|
|
692
|
+
/**
|
|
693
|
+
* Subscribe to controller events
|
|
694
|
+
* Returns unsubscribe function
|
|
695
|
+
*/
|
|
696
|
+
on<K extends keyof CognitionControllerEvents>(event: K, handler: EventHandler<CognitionControllerEvents[K]>): () => void;
|
|
697
|
+
/**
|
|
698
|
+
* Dispose controller and clean up resources
|
|
699
|
+
*/
|
|
700
|
+
dispose(): void;
|
|
701
|
+
/**
|
|
702
|
+
* Adjust AVO values based on current signal levels
|
|
703
|
+
*/
|
|
704
|
+
private _adjustAVOBySignals;
|
|
705
|
+
private _emitEvent;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
interface UseCognitionOptions extends CognitionControllerOptions {
|
|
709
|
+
onChange?: (state: CognitionState) => void;
|
|
710
|
+
autoTick?: boolean;
|
|
711
|
+
}
|
|
712
|
+
interface UseCognitionResult {
|
|
713
|
+
state: CognitionState;
|
|
714
|
+
emotion: EmotionTarget;
|
|
715
|
+
handleEvent: (event: CognitionEvent) => void;
|
|
716
|
+
tick: (deltaMs: number) => void;
|
|
717
|
+
/** @deprecated Use handleEvent instead */
|
|
718
|
+
emit: (event: CognitionEvent) => void;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* React hook for managing Glyph cognition state.
|
|
722
|
+
*
|
|
723
|
+
* Creates a CognitionController and provides reactive state updates.
|
|
724
|
+
* Automatically handles RAF-based animation when autoTick is true (default).
|
|
725
|
+
*
|
|
726
|
+
* @example
|
|
727
|
+
* ```tsx
|
|
728
|
+
* const { state, emotion, emit, tick } = useCognition({
|
|
729
|
+
* initial: { mode: 'idle' },
|
|
730
|
+
* onChange: (state) => console.log('Cognition changed:', state),
|
|
731
|
+
* });
|
|
732
|
+
*
|
|
733
|
+
* // Handle agent events
|
|
734
|
+
* emit({ type: 'run.started', runId: 'r1' });
|
|
735
|
+
*
|
|
736
|
+
* // Access emotion bridge for rendering
|
|
737
|
+
* console.log(emotion.anchor, emotion.avo);
|
|
738
|
+
* ```
|
|
739
|
+
*/
|
|
740
|
+
declare function useCognition(options?: UseCognitionOptions): UseCognitionResult;
|
|
741
|
+
|
|
742
|
+
export { CognitionController, type CognitionControllerOptions, CognitionEvent, type CognitionSnapshotInput, type CognitionSnapshotOutput, CognitionSnapshotSchema, type CognitionSnapshotValidationResult, CognitionState, CognitionStateSchema, CognitiveMode, MODE_TRANSITION_MAP, type UseCognitionOptions, type UseCognitionResult, reduceDecay, reduceEvent, useCognition, validateCognitionSnapshot };
|