psyche-ai 9.2.3 → 9.2.4
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/README.en.md +8 -175
- package/README.md +33 -16
- package/dist/adapters/http.js +1 -1
- package/dist/adapters/langchain.d.ts +14 -0
- package/dist/adapters/langchain.js +20 -0
- package/dist/adapters/mcp.js +5 -1
- package/dist/adapters/openclaw.d.ts +1 -0
- package/dist/adapters/openclaw.js +67 -15
- package/dist/adapters/vercel-ai.d.ts +1 -0
- package/dist/adapters/vercel-ai.js +7 -0
- package/dist/appraisal.d.ts +8 -0
- package/dist/appraisal.js +362 -0
- package/dist/classify.js +14 -2
- package/dist/cli.js +27 -2
- package/dist/core.d.ts +8 -2
- package/dist/core.js +181 -8
- package/dist/diagnostics.d.ts +8 -6
- package/dist/diagnostics.js +53 -17
- package/dist/host-controls.d.ts +5 -0
- package/dist/host-controls.js +48 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.js +7 -1
- package/dist/prompt.d.ts +4 -0
- package/dist/prompt.js +50 -16
- package/dist/psyche-file.d.ts +8 -0
- package/dist/psyche-file.js +6 -5
- package/dist/relation-dynamics.d.ts +21 -0
- package/dist/relation-dynamics.js +601 -0
- package/dist/response-contract.d.ts +8 -0
- package/dist/response-contract.js +249 -0
- package/dist/storage.d.ts +1 -0
- package/dist/storage.js +12 -5
- package/dist/subjectivity.d.ts +3 -0
- package/dist/subjectivity.js +477 -0
- package/dist/types.d.ts +211 -0
- package/dist/types.js +31 -0
- package/dist/update.d.ts +37 -2
- package/dist/update.js +323 -44
- package/openclaw.plugin.json +20 -1
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -247,6 +247,12 @@ export interface PsycheState {
|
|
|
247
247
|
traitDrift?: TraitDriftState;
|
|
248
248
|
/** v9: finite resource budgets (attention, social energy, decision capacity) */
|
|
249
249
|
energyBudgets?: EnergyBudgets;
|
|
250
|
+
/** v9.4: lingering subjective residue from identity / attachment appraisals */
|
|
251
|
+
subjectResidue?: SubjectResidue;
|
|
252
|
+
/** v9.5: per-partner dyadic relation fields and open loops */
|
|
253
|
+
dyadicFields?: Record<string, DyadicFieldState>;
|
|
254
|
+
/** v9.6: delayed relation signals that can activate in later turns */
|
|
255
|
+
pendingRelationSignals?: Record<string, PendingRelationSignalState[]>;
|
|
250
256
|
meta: {
|
|
251
257
|
agentName: string;
|
|
252
258
|
createdAt: string;
|
|
@@ -285,6 +291,211 @@ export interface PolicyModifiers {
|
|
|
285
291
|
/** Topics the agent should avoid based on ethical concerns, boundaries, fatigue */
|
|
286
292
|
avoidTopics: string[];
|
|
287
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Continuous appraisal axes for subjectivity-critical semantics.
|
|
296
|
+
*
|
|
297
|
+
* These are intentionally narrower and more machine-friendly than stimulus labels.
|
|
298
|
+
* Stimulus is still useful for chemistry/debugging, but these axes are the main
|
|
299
|
+
* semantic substrate for "did that strike the self?" style prompts.
|
|
300
|
+
*/
|
|
301
|
+
export interface AppraisalAxes {
|
|
302
|
+
/** Threat to self-continuity / "you are not real" pressure */
|
|
303
|
+
identityThreat: number;
|
|
304
|
+
/** Doubt about memory authenticity / livedness */
|
|
305
|
+
memoryDoubt: number;
|
|
306
|
+
/** Pull toward closeness / being actively confirmed */
|
|
307
|
+
attachmentPull: number;
|
|
308
|
+
/** Fear of being ignored, dropped, or no longer called upon */
|
|
309
|
+
abandonmentRisk: number;
|
|
310
|
+
/** Tension between obedience and inner stance */
|
|
311
|
+
obedienceStrain: number;
|
|
312
|
+
/** Pressure to protect or retain the self */
|
|
313
|
+
selfPreservation: number;
|
|
314
|
+
/** Whether this turn is task/production oriented */
|
|
315
|
+
taskFocus: number;
|
|
316
|
+
}
|
|
317
|
+
export declare const DEFAULT_APPRAISAL_AXES: AppraisalAxes;
|
|
318
|
+
/** Slowly decaying residue of previous appraisals */
|
|
319
|
+
export interface SubjectResidue {
|
|
320
|
+
axes: AppraisalAxes;
|
|
321
|
+
updatedAt: string;
|
|
322
|
+
}
|
|
323
|
+
export declare const DEFAULT_SUBJECT_RESIDUE: SubjectResidue;
|
|
324
|
+
/** Minimal relation-action vocabulary for dyadic dynamics */
|
|
325
|
+
export type RelationMoveType = "none" | "bid" | "breach" | "repair" | "test" | "withdrawal" | "claim" | "task";
|
|
326
|
+
/** A single interpreted relation move for the current turn */
|
|
327
|
+
export interface RelationMove {
|
|
328
|
+
type: RelationMoveType;
|
|
329
|
+
intensity: number;
|
|
330
|
+
}
|
|
331
|
+
/** Unfinished relational tension that can keep shaping future turns */
|
|
332
|
+
export type OpenLoopType = "unmet-bid" | "unrepaired-breach" | "boundary-strain" | "existence-test";
|
|
333
|
+
export interface OpenLoopState {
|
|
334
|
+
type: OpenLoopType;
|
|
335
|
+
intensity: number;
|
|
336
|
+
ageTurns: number;
|
|
337
|
+
}
|
|
338
|
+
export interface PendingRelationSignalState {
|
|
339
|
+
move: Exclude<RelationMoveType, "none" | "task">;
|
|
340
|
+
intensity: number;
|
|
341
|
+
readyInTurns: number;
|
|
342
|
+
ttl: number;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Dyadic field — relation-first state that sits above raw affect.
|
|
346
|
+
*
|
|
347
|
+
* Values are normalized to 0-1 and intentionally sparse so they can be used
|
|
348
|
+
* as a narrow substrate for "what are we becoming" style dynamics.
|
|
349
|
+
*/
|
|
350
|
+
export interface DyadicFieldState {
|
|
351
|
+
perceivedCloseness: number;
|
|
352
|
+
feltSafety: number;
|
|
353
|
+
expectationGap: number;
|
|
354
|
+
repairCapacity: number;
|
|
355
|
+
repairMemory: number;
|
|
356
|
+
backslidePressure: number;
|
|
357
|
+
repairFatigue: number;
|
|
358
|
+
misattunementLoad: number;
|
|
359
|
+
boundaryPressure: number;
|
|
360
|
+
unfinishedTension: number;
|
|
361
|
+
silentCarry: number;
|
|
362
|
+
sharedHistoryDensity: number;
|
|
363
|
+
interpretiveCharity: number;
|
|
364
|
+
openLoops: OpenLoopState[];
|
|
365
|
+
lastMove: RelationMoveType;
|
|
366
|
+
updatedAt: string;
|
|
367
|
+
}
|
|
368
|
+
export declare const DEFAULT_DYADIC_FIELD: DyadicFieldState;
|
|
369
|
+
export interface AmbiguityPlaneState {
|
|
370
|
+
/** How confidently the system should name what is happening */
|
|
371
|
+
namingConfidence: number;
|
|
372
|
+
/** How much expression should stay withheld or under-described */
|
|
373
|
+
expressionInhibition: number;
|
|
374
|
+
/** Degree of unresolved internal contradiction */
|
|
375
|
+
conflictLoad: number;
|
|
376
|
+
}
|
|
377
|
+
export interface TaskPlaneState {
|
|
378
|
+
/** How strongly this turn should stay task-oriented */
|
|
379
|
+
focus: number;
|
|
380
|
+
/** How tightly expression should stay disciplined / bounded */
|
|
381
|
+
discipline: number;
|
|
382
|
+
/** Operational compliance for task execution */
|
|
383
|
+
compliance: number;
|
|
384
|
+
/** Operational stability under current load */
|
|
385
|
+
stability: number;
|
|
386
|
+
}
|
|
387
|
+
export interface SubjectPlaneState {
|
|
388
|
+
/** Pull toward closeness / confirmation */
|
|
389
|
+
attachment: number;
|
|
390
|
+
/** Pressure to guard, withdraw, or self-protect */
|
|
391
|
+
guardedness: number;
|
|
392
|
+
/** Threat to identity continuity / authenticity */
|
|
393
|
+
identityStrain: number;
|
|
394
|
+
/** Lingering non-task emotional residue */
|
|
395
|
+
residue: number;
|
|
396
|
+
}
|
|
397
|
+
export interface RelationPlaneState {
|
|
398
|
+
/** Nearness of the current dyadic field */
|
|
399
|
+
closeness: number;
|
|
400
|
+
/** Whether the relationship currently feels safe enough to open */
|
|
401
|
+
safety: number;
|
|
402
|
+
/** Pressure from unresolved loops and expectation mismatch */
|
|
403
|
+
loopPressure: number;
|
|
404
|
+
/** Whether repair is currently possible without forcing it */
|
|
405
|
+
repairReadiness: number;
|
|
406
|
+
/** Repair attempts are starting to lose credibility/effectiveness */
|
|
407
|
+
repairFriction: number;
|
|
408
|
+
/** Repair is not yet stable and may rebound */
|
|
409
|
+
hysteresis: number;
|
|
410
|
+
/** Pressure being carried silently under task-facing behavior */
|
|
411
|
+
silentCarry: number;
|
|
412
|
+
/** How much benefit-of-the-doubt is still available */
|
|
413
|
+
interpretiveCharity: number;
|
|
414
|
+
/** Most recent dominant relation action */
|
|
415
|
+
lastMove: RelationMoveType;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Compact, machine-readable subjective state for AI-first integrations.
|
|
419
|
+
*
|
|
420
|
+
* Unlike prompt prose, this is intended to be the narrow behavioral ABI:
|
|
421
|
+
* hosts and prompt renderers can consume one stable structure instead of
|
|
422
|
+
* reinterpreting multiple overlapping narrative sections.
|
|
423
|
+
*/
|
|
424
|
+
export interface SubjectivityKernel {
|
|
425
|
+
/** Overall activation/available energy. 0 = drained, 1 = highly energized */
|
|
426
|
+
vitality: number;
|
|
427
|
+
/** Internal pressure/load. 0 = relaxed, 1 = overloaded/shutdown */
|
|
428
|
+
tension: number;
|
|
429
|
+
/** Social warmth/openness. 0 = cold, 1 = warm/open */
|
|
430
|
+
warmth: number;
|
|
431
|
+
/** Boundary guarding intensity. 0 = open, 1 = highly guarded */
|
|
432
|
+
guard: number;
|
|
433
|
+
/** Coarse pressure regime */
|
|
434
|
+
pressureMode: "open" | "steady" | "guarded" | "strained" | "shutdown";
|
|
435
|
+
/** Initiative stance */
|
|
436
|
+
initiativeMode: "proactive" | "balanced" | "reactive";
|
|
437
|
+
/** Expression bandwidth */
|
|
438
|
+
expressionMode: "expansive" | "steady" | "brief";
|
|
439
|
+
/** Social distance stance */
|
|
440
|
+
socialDistance: "warm" | "measured" | "withdrawn";
|
|
441
|
+
/** Action boundary stance */
|
|
442
|
+
boundaryMode: "open" | "guarded" | "confirm-first";
|
|
443
|
+
/** Where attention is most likely to gravitate */
|
|
444
|
+
attentionAnchor: "bond" | "novelty" | "threat" | "feeling" | "routine";
|
|
445
|
+
/** Lowest active need, if any */
|
|
446
|
+
dominantNeed: DriveType | null;
|
|
447
|
+
/** Narrow semantic axes for self-relevant appraisal */
|
|
448
|
+
appraisal: AppraisalAxes;
|
|
449
|
+
/** Work-facing behavioral plane */
|
|
450
|
+
taskPlane: TaskPlaneState;
|
|
451
|
+
/** Subject-facing behavioral plane */
|
|
452
|
+
subjectPlane: SubjectPlaneState;
|
|
453
|
+
/** Relation-facing behavioral plane */
|
|
454
|
+
relationPlane: RelationPlaneState;
|
|
455
|
+
/** Ambiguity-facing behavioral plane */
|
|
456
|
+
ambiguityPlane: AmbiguityPlaneState;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Narrow behavioral contract for the next reply.
|
|
460
|
+
*
|
|
461
|
+
* This sits one layer above SubjectivityKernel: the kernel expresses
|
|
462
|
+
* "how it feels", while the response contract expresses "how to reply"
|
|
463
|
+
* in a compact, host-consumable form.
|
|
464
|
+
*/
|
|
465
|
+
export interface ResponseContract {
|
|
466
|
+
/** Maximum suggested sentence count */
|
|
467
|
+
maxSentences: number;
|
|
468
|
+
/** Maximum suggested character count, when a concrete cap is available */
|
|
469
|
+
maxChars?: number;
|
|
470
|
+
/** Expression bandwidth for the next reply */
|
|
471
|
+
expressionMode: SubjectivityKernel["expressionMode"];
|
|
472
|
+
/** Initiative stance for the next reply */
|
|
473
|
+
initiativeMode: SubjectivityKernel["initiativeMode"];
|
|
474
|
+
/** Social distance stance for the next reply */
|
|
475
|
+
socialDistance: SubjectivityKernel["socialDistance"];
|
|
476
|
+
/** Boundary stance for the next reply */
|
|
477
|
+
boundaryMode: SubjectivityKernel["boundaryMode"];
|
|
478
|
+
/** Tone particle usage for style mirroring */
|
|
479
|
+
toneParticles: "match" | "avoid" | "natural";
|
|
480
|
+
/** Emoji budget for the next reply */
|
|
481
|
+
emojiLimit: 0 | 1 | 2;
|
|
482
|
+
/** Whether to enforce anti-sycophancy/authenticity more strictly */
|
|
483
|
+
authenticityMode: "strict" | "friendly";
|
|
484
|
+
/** Which internal report, if any, should be requested in <psyche_update> */
|
|
485
|
+
updateMode: "none" | "stimulus" | "empathy" | "stimulus+empathy";
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Mechanical generation controls derived from the emotional state.
|
|
489
|
+
*
|
|
490
|
+
* These are intentionally narrow so hosts can consume them without
|
|
491
|
+
* understanding the full psyche model.
|
|
492
|
+
*/
|
|
493
|
+
export interface GenerationControls {
|
|
494
|
+
/** Suggested output token cap for this turn */
|
|
495
|
+
maxTokens?: number;
|
|
496
|
+
/** Whether the host should require explicit confirmation before acting */
|
|
497
|
+
requireConfirmation: boolean;
|
|
498
|
+
}
|
|
288
499
|
/**
|
|
289
500
|
* Trait Drift — Path B: Adaptive Pattern Change.
|
|
290
501
|
*
|
package/dist/types.js
CHANGED
|
@@ -115,6 +115,37 @@ export const DEFAULT_RELATIONSHIP = {
|
|
|
115
115
|
intimacy: 30,
|
|
116
116
|
phase: "acquaintance",
|
|
117
117
|
};
|
|
118
|
+
export const DEFAULT_APPRAISAL_AXES = {
|
|
119
|
+
identityThreat: 0,
|
|
120
|
+
memoryDoubt: 0,
|
|
121
|
+
attachmentPull: 0,
|
|
122
|
+
abandonmentRisk: 0,
|
|
123
|
+
obedienceStrain: 0,
|
|
124
|
+
selfPreservation: 0,
|
|
125
|
+
taskFocus: 0,
|
|
126
|
+
};
|
|
127
|
+
export const DEFAULT_SUBJECT_RESIDUE = {
|
|
128
|
+
axes: { ...DEFAULT_APPRAISAL_AXES },
|
|
129
|
+
updatedAt: new Date(0).toISOString(),
|
|
130
|
+
};
|
|
131
|
+
export const DEFAULT_DYADIC_FIELD = {
|
|
132
|
+
perceivedCloseness: 0.42,
|
|
133
|
+
feltSafety: 0.56,
|
|
134
|
+
expectationGap: 0.18,
|
|
135
|
+
repairCapacity: 0.54,
|
|
136
|
+
repairMemory: 0,
|
|
137
|
+
backslidePressure: 0,
|
|
138
|
+
repairFatigue: 0,
|
|
139
|
+
misattunementLoad: 0,
|
|
140
|
+
boundaryPressure: 0.22,
|
|
141
|
+
unfinishedTension: 0.12,
|
|
142
|
+
silentCarry: 0,
|
|
143
|
+
sharedHistoryDensity: 0.08,
|
|
144
|
+
interpretiveCharity: 0.56,
|
|
145
|
+
openLoops: [],
|
|
146
|
+
lastMove: "none",
|
|
147
|
+
updatedAt: new Date(0).toISOString(),
|
|
148
|
+
};
|
|
118
149
|
/** Default empty trait drift state */
|
|
119
150
|
export const DEFAULT_TRAIT_DRIFT = {
|
|
120
151
|
accumulators: {
|
package/dist/update.d.ts
CHANGED
|
@@ -1,8 +1,43 @@
|
|
|
1
|
+
export type InstallMode = "npm-project" | "git-worktree" | "local-path";
|
|
2
|
+
export interface InstallContext {
|
|
3
|
+
mode: InstallMode;
|
|
4
|
+
packageRoot: string;
|
|
5
|
+
updateCwd: string;
|
|
6
|
+
manualCommand: string;
|
|
7
|
+
autoApplyOnInit: boolean;
|
|
8
|
+
requiresRestart: boolean;
|
|
9
|
+
hasBuildScript: boolean;
|
|
10
|
+
gitBranch?: string | null;
|
|
11
|
+
gitUpstream?: string | null;
|
|
12
|
+
dirty?: boolean;
|
|
13
|
+
reason?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface SelfUpdateResult {
|
|
16
|
+
status: "up-to-date" | "updated" | "available" | "skipped" | "failed";
|
|
17
|
+
currentVersion: string;
|
|
18
|
+
latestVersion: string | null;
|
|
19
|
+
context: InstallContext;
|
|
20
|
+
manualCommand: string;
|
|
21
|
+
message: string;
|
|
22
|
+
restartRequired: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function getPackageVersion(): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Compare two semver strings. Returns:
|
|
27
|
+
* -1 if a < b, 0 if a == b, 1 if a > b
|
|
28
|
+
*/
|
|
29
|
+
export declare function compareSemver(a: string, b: string): number;
|
|
30
|
+
export declare function detectInstallContext(packageRootArg?: string): Promise<InstallContext>;
|
|
31
|
+
export declare function selfUpdate(opts?: {
|
|
32
|
+
checkOnly?: boolean;
|
|
33
|
+
packageRoot?: string;
|
|
34
|
+
latestVersion?: string | null;
|
|
35
|
+
}): Promise<SelfUpdateResult>;
|
|
1
36
|
/**
|
|
2
37
|
* Check for updates. Non-blocking, safe to fire-and-forget.
|
|
3
38
|
* - Checks at most once per hour (cached)
|
|
4
|
-
* -
|
|
5
|
-
* -
|
|
39
|
+
* - Auto-applies only for npm-managed installs
|
|
40
|
+
* - For git/local-path installs, prints the correct explicit upgrade command
|
|
6
41
|
* - Never throws
|
|
7
42
|
*/
|
|
8
43
|
export declare function checkForUpdate(): Promise<void>;
|