psyche-ai 9.2.6 → 9.2.8

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,164 @@
1
+ // ============================================================
2
+ // Input Turn Pipeline — reflective turn phases after local state evolution
3
+ //
4
+ // Keeps PsycheEngine orchestration slimmer by moving autonomic,
5
+ // metacognitive, experiential, ethical, and reply-envelope derivation
6
+ // into a dedicated post-evolution stage.
7
+ // ============================================================
8
+ import { assessMetacognition, updateMetacognitiveState } from "./metacognition.js";
9
+ import { buildDecisionContext } from "./decision-bias.js";
10
+ import { computeExperientialField } from "./experiential-field.js";
11
+ import { computeGenerativeSelf } from "./generative-self.js";
12
+ import { buildSharedIntentionalityContext, updateSharedIntentionality } from "./shared-intentionality.js";
13
+ import { assessEthics, buildEthicalContext } from "./ethics.js";
14
+ import { computeAutonomicResult } from "./autonomic.js";
15
+ import { computePrimarySystems, computeSystemInteractions, gatePrimarySystemsByAutonomic, describeBehavioralTendencies, } from "./primary-systems.js";
16
+ import { deriveReplyEnvelope } from "./reply-envelope.js";
17
+ import { clamp } from "./chemistry.js";
18
+ export function runReflectiveTurnPhases(input) {
19
+ let state = input.state;
20
+ const locale = state.meta.locale ?? input.localeFallback;
21
+ const autonomicResult = computeAutonomicResult(state.current, state.drives, state.autonomicState ?? null, input.minutesElapsed, locale, state.baseline, state.energyBudgets);
22
+ state = {
23
+ ...state,
24
+ autonomicState: autonomicResult.state,
25
+ };
26
+ const skip = new Set(autonomicResult.skippedStages);
27
+ const rawSystems = computePrimarySystems(state.current, state.drives, input.appliedStimulus);
28
+ const interactedSystems = computeSystemInteractions(rawSystems);
29
+ const gatedSystems = gatePrimarySystemsByAutonomic(interactedSystems, autonomicResult.state);
30
+ const primarySystemsDescription = describeBehavioralTendencies(gatedSystems, locale);
31
+ let metacognitiveAssessment = null;
32
+ if (!skip.has("metacognition")) {
33
+ metacognitiveAssessment = assessMetacognition(state, input.appliedStimulus ?? "casual", state.learning.outcomeHistory);
34
+ for (const reg of metacognitiveAssessment.regulationSuggestions) {
35
+ if (reg.strategy === "self-soothing" && reg.confidence >= 0.6 && reg.chemistryAdjustment) {
36
+ const adj = reg.chemistryAdjustment;
37
+ state = {
38
+ ...state,
39
+ current: {
40
+ ...state.current,
41
+ DA: clamp(state.current.DA + (adj.DA ?? 0)),
42
+ HT: clamp(state.current.HT + (adj.HT ?? 0)),
43
+ CORT: clamp(state.current.CORT + (adj.CORT ?? 0)),
44
+ OT: clamp(state.current.OT + (adj.OT ?? 0)),
45
+ NE: clamp(state.current.NE + (adj.NE ?? 0)),
46
+ END: clamp(state.current.END + (adj.END ?? 0)),
47
+ },
48
+ };
49
+ }
50
+ }
51
+ state = {
52
+ ...state,
53
+ metacognition: updateMetacognitiveState(state.metacognition, metacognitiveAssessment),
54
+ };
55
+ }
56
+ const constructionContext = {
57
+ autonomicState: autonomicResult.state,
58
+ stimulus: input.appliedStimulus,
59
+ relationshipPhase: input.relationContext.relationship.phase,
60
+ predictionError: state.learning.predictionHistory.length > 0
61
+ ? state.learning.predictionHistory[state.learning.predictionHistory.length - 1].predictionError
62
+ : undefined,
63
+ };
64
+ const experientialField = skip.has("experiential-field")
65
+ ? null
66
+ : computeExperientialField(state, metacognitiveAssessment ?? undefined, undefined, constructionContext);
67
+ const sharedState = skip.has("shared-intentionality")
68
+ ? null
69
+ : updateSharedIntentionality(state, input.appliedStimulus, input.userId);
70
+ const ethicalAssessment = skip.has("ethics")
71
+ ? null
72
+ : assessEthics(state);
73
+ if (!skip.has("generative-self")
74
+ && state.meta.totalInteractions % 10 === 0 && state.meta.totalInteractions > 0) {
75
+ const selfModel = computeGenerativeSelf(state);
76
+ state = {
77
+ ...state,
78
+ personhood: {
79
+ ...state.personhood,
80
+ identityNarrative: selfModel.identityNarrative,
81
+ growthDirection: selfModel.growthArc.direction,
82
+ causalInsights: selfModel.causalInsights.slice(0, 20).map((ci) => ({
83
+ trait: ci.trait,
84
+ because: ci.because,
85
+ confidence: ci.confidence,
86
+ discoveredAt: input.nowIso,
87
+ })),
88
+ },
89
+ };
90
+ }
91
+ if (ethicalAssessment && ethicalAssessment.ethicalHealth < 0.7) {
92
+ const newConcerns = ethicalAssessment.concerns
93
+ .filter((c) => c.severity > 0.4)
94
+ .map((c) => ({ type: c.type, severity: c.severity, timestamp: input.nowIso }));
95
+ if (newConcerns.length > 0) {
96
+ state = {
97
+ ...state,
98
+ personhood: {
99
+ ...state.personhood,
100
+ ethicalConcernHistory: [
101
+ ...state.personhood.ethicalConcernHistory.slice(-14),
102
+ ...newConcerns,
103
+ ],
104
+ },
105
+ };
106
+ }
107
+ }
108
+ if (sharedState && sharedState.theoryOfMind.confidence > 0.3) {
109
+ const userId = input.userId ?? "_default";
110
+ state = {
111
+ ...state,
112
+ personhood: {
113
+ ...state.personhood,
114
+ theoryOfMind: {
115
+ ...state.personhood.theoryOfMind,
116
+ [userId]: {
117
+ estimatedMood: sharedState.theoryOfMind.estimatedMood,
118
+ estimatedIntent: sharedState.theoryOfMind.estimatedIntent,
119
+ confidence: sharedState.theoryOfMind.confidence,
120
+ lastUpdated: sharedState.theoryOfMind.lastUpdated,
121
+ },
122
+ },
123
+ },
124
+ };
125
+ }
126
+ const metacognitiveNote = input.writebackNote
127
+ ? [input.writebackNote, metacognitiveAssessment?.metacognitiveNote].filter(Boolean).join("\n")
128
+ : metacognitiveAssessment?.metacognitiveNote;
129
+ const decisionContext = buildDecisionContext(state);
130
+ const ethicsContext = ethicalAssessment ? buildEthicalContext(ethicalAssessment, locale) : undefined;
131
+ const sharedIntentionalityContext = sharedState ? buildSharedIntentionalityContext(sharedState, locale) : undefined;
132
+ const experientialNarrative = experientialField?.narrative || undefined;
133
+ const replyEnvelope = deriveReplyEnvelope(state, input.appraisalAxes, {
134
+ locale,
135
+ userText: input.userText,
136
+ algorithmStimulus: input.appliedStimulus,
137
+ classificationConfidence: input.classificationConfidence,
138
+ personalityIntensity: input.personalityIntensity,
139
+ relationContext: input.relationContext,
140
+ });
141
+ let autonomicDescription;
142
+ if (autonomicResult.state !== "ventral-vagal") {
143
+ autonomicDescription = autonomicResult.description;
144
+ if (autonomicResult.processingDepth < 0.5) {
145
+ const depthNote = locale === "en"
146
+ ? " Reflective capacity reduced — intuitive reactions."
147
+ : "反思能力降低——直觉反应中。";
148
+ autonomicDescription += depthNote;
149
+ }
150
+ }
151
+ return {
152
+ state,
153
+ locale,
154
+ autonomicState: autonomicResult.state,
155
+ autonomicDescription,
156
+ primarySystemsDescription: primarySystemsDescription || undefined,
157
+ metacognitiveNote,
158
+ decisionContext: decisionContext || undefined,
159
+ ethicsContext,
160
+ sharedIntentionalityContext,
161
+ experientialNarrative,
162
+ replyEnvelope,
163
+ };
164
+ }
package/dist/prompt.d.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  import type { PsycheState, Locale, ChemicalSnapshot, PsycheMode } from "./types.js";
2
2
  import type { AutonomicState } from "./autonomic.js";
3
3
  import type { ChannelType } from "./channels.js";
4
- /**
5
- * Build the dynamic per-turn emotional context injected via before_prompt_build.
6
- *
7
- * This is the "current moment" — what the agent is feeling RIGHT NOW.
8
- */
9
- export declare function buildDynamicContext(state: PsycheState, userId?: string, opts?: {
4
+ export interface PromptRenderInputs {
5
+ userText?: string;
6
+ algorithmStimulus?: string | null;
7
+ personalityIntensity?: number;
8
+ channelType?: ChannelType;
10
9
  metacognitiveNote?: string;
11
10
  decisionContext?: string;
12
11
  ethicsContext?: string;
@@ -18,7 +17,13 @@ export declare function buildDynamicContext(state: PsycheState, userId?: string,
18
17
  subjectivityContext?: string;
19
18
  responseContractContext?: string;
20
19
  policyContext?: string;
21
- }): string;
20
+ }
21
+ /**
22
+ * Build the dynamic per-turn emotional context injected via before_prompt_build.
23
+ *
24
+ * This is the "current moment" — what the agent is feeling RIGHT NOW.
25
+ */
26
+ export declare function buildDynamicContext(state: PsycheState, userId?: string, opts?: PromptRenderInputs): string;
22
27
  /**
23
28
  * Build the static protocol injected as cacheable system context.
24
29
  * v0.2: imperative, step-by-step with examples.
@@ -57,20 +62,4 @@ export declare function getNearBaselineThreshold(mode?: PsycheMode): number;
57
62
  * - No protocol (LLM doesn't need system internals)
58
63
  * - <psyche_update> only for empathy (not chemistry — already computed)
59
64
  */
60
- export declare function buildCompactContext(state: PsycheState, userId?: string, opts?: {
61
- userText?: string;
62
- algorithmStimulus?: string | null;
63
- personalityIntensity?: number;
64
- channelType?: ChannelType;
65
- metacognitiveNote?: string;
66
- decisionContext?: string;
67
- ethicsContext?: string;
68
- sharedIntentionalityContext?: string;
69
- experientialNarrative?: string;
70
- autonomicDescription?: string;
71
- autonomicState?: AutonomicState;
72
- primarySystemsDescription?: string;
73
- subjectivityContext?: string;
74
- responseContractContext?: string;
75
- policyContext?: string;
76
- }): string;
65
+ export declare function buildCompactContext(state: PsycheState, userId?: string, opts?: PromptRenderInputs): string;
package/dist/prompt.js CHANGED
@@ -11,6 +11,50 @@ import { buildDriveContext, hasCriticalDrive } from "./drives.js";
11
11
  import { computeSelfReflection, buildSelfReflectionContext } from "./self-recognition.js";
12
12
  import { gateEmotions } from "./autonomic.js";
13
13
  import { getChannelProfile, buildChannelModifier } from "./channels.js";
14
+ function pushLabeledSection(parts, locale, titleZh, titleEn, content) {
15
+ if (!content)
16
+ return;
17
+ parts.push("", `[${locale === "zh" ? titleZh : titleEn}] ${content}`);
18
+ }
19
+ function pushRawSection(parts, content) {
20
+ if (!content)
21
+ return;
22
+ parts.push("", content);
23
+ }
24
+ function appendDynamicOverlaySections(parts, locale, opts) {
25
+ pushLabeledSection(parts, locale, "元认知", "Metacognition", opts?.metacognitiveNote);
26
+ pushLabeledSection(parts, locale, "决策倾向", "Decision Bias", opts?.decisionContext);
27
+ pushLabeledSection(parts, locale, "内在体验", "Inner Experience", opts?.experientialNarrative);
28
+ pushRawSection(parts, opts?.sharedIntentionalityContext);
29
+ pushRawSection(parts, opts?.ethicsContext);
30
+ pushLabeledSection(parts, locale, "自主神经状态", "Autonomic State", opts?.autonomicDescription);
31
+ pushLabeledSection(parts, locale, "行为倾向", "Behavioral Tendencies", opts?.primarySystemsDescription);
32
+ pushRawSection(parts, opts?.policyContext);
33
+ }
34
+ function appendCompactOverlaySections(parts, locale, opts) {
35
+ if (opts?.metacognitiveNote && !(opts?.responseContractContext && isNeutralMetacognitiveNote(opts.metacognitiveNote))) {
36
+ pushLabeledSection(parts, locale, "元认知", "Metacognition", opts.metacognitiveNote);
37
+ }
38
+ if (opts?.decisionContext && !opts?.subjectivityContext) {
39
+ pushLabeledSection(parts, locale, "决策倾向", "Decision Bias", opts.decisionContext);
40
+ }
41
+ if (opts?.experientialNarrative && !opts?.subjectivityContext) {
42
+ pushLabeledSection(parts, locale, "内在体验", "Inner Experience", opts.experientialNarrative);
43
+ }
44
+ if (opts?.sharedIntentionalityContext && !(opts?.responseContractContext && isGenericSharedIntentionalityContext(opts.sharedIntentionalityContext))) {
45
+ pushRawSection(parts, opts.sharedIntentionalityContext);
46
+ }
47
+ pushRawSection(parts, opts?.ethicsContext);
48
+ if (opts?.autonomicDescription && !opts?.subjectivityContext) {
49
+ pushLabeledSection(parts, locale, "自主神经", "Autonomic", opts.autonomicDescription);
50
+ }
51
+ if (opts?.primarySystemsDescription && !opts?.subjectivityContext) {
52
+ pushLabeledSection(parts, locale, "行为倾向", "Tendencies", opts.primarySystemsDescription);
53
+ }
54
+ if (opts?.policyContext && !opts?.subjectivityContext) {
55
+ pushRawSection(parts, opts.policyContext);
56
+ }
57
+ }
14
58
  /**
15
59
  * Build the dynamic per-turn emotional context injected via before_prompt_build.
16
60
  *
@@ -98,42 +142,7 @@ export function buildDynamicContext(state, userId, opts) {
98
142
  if (reciprocity) {
99
143
  parts.push("", reciprocity);
100
144
  }
101
- // Metacognitive awareness (P5)
102
- if (opts?.metacognitiveNote) {
103
- const mcTitle = locale === "zh" ? "元认知" : "Metacognition";
104
- parts.push("", `[${mcTitle}] ${opts.metacognitiveNote}`);
105
- }
106
- // Decision bias context (P5)
107
- if (opts?.decisionContext) {
108
- const dbTitle = locale === "zh" ? "决策倾向" : "Decision Bias";
109
- parts.push("", `[${dbTitle}] ${opts.decisionContext}`);
110
- }
111
- // Experiential field narrative (P6)
112
- if (opts?.experientialNarrative) {
113
- const efTitle = locale === "zh" ? "内在体验" : "Inner Experience";
114
- parts.push("", `[${efTitle}] ${opts.experientialNarrative}`);
115
- }
116
- // Shared intentionality (P6)
117
- if (opts?.sharedIntentionalityContext) {
118
- parts.push("", opts.sharedIntentionalityContext);
119
- }
120
- // Ethics (P6)
121
- if (opts?.ethicsContext) {
122
- parts.push("", opts.ethicsContext);
123
- }
124
- // Autonomic state (P7)
125
- if (opts?.autonomicDescription) {
126
- const anTitle = locale === "zh" ? "自主神经状态" : "Autonomic State";
127
- parts.push("", `[${anTitle}] ${opts.autonomicDescription}`);
128
- }
129
- // Primary systems behavioral tendencies (P9)
130
- if (opts?.primarySystemsDescription) {
131
- const psTitle = locale === "zh" ? "行为倾向" : "Behavioral Tendencies";
132
- parts.push("", `[${psTitle}] ${opts.primarySystemsDescription}`);
133
- }
134
- if (opts?.policyContext) {
135
- parts.push("", opts.policyContext);
136
- }
145
+ appendDynamicOverlaySections(parts, locale, opts);
137
146
  parts.push("", agencyReminder, sycophancyWarning, "", t("dynamic.update_reminder", locale));
138
147
  return parts.filter((l) => l !== undefined).join("\n");
139
148
  }
@@ -468,8 +477,8 @@ function buildMirrorConstraints(userText, locale) {
468
477
  function buildCompactSensingContext(_userText, locale, algorithmStimulus) {
469
478
  if (locale === "zh") {
470
479
  return algorithmStimulus
471
- ? `[情绪感知] 算法初判:${algorithmStimulus},仅供参考;按真实感受终判语气。`
472
- : `[情绪感知] 这句的情绪基调由你终判。`;
480
+ ? `[情绪感知] 算法初判:${algorithmStimulus};你终判。`
481
+ : `[情绪感知] 情绪由你终判。`;
473
482
  }
474
483
  return algorithmStimulus
475
484
  ? `[Emotional Sensing] Algorithm hint: ${algorithmStimulus}; final tonal read is yours.`
@@ -804,49 +813,7 @@ export function buildCompactContext(state, userId, opts) {
804
813
  if (selfCtx)
805
814
  parts.push(selfCtx);
806
815
  }
807
- // 9. Metacognitive awareness (P5)
808
- if (opts?.metacognitiveNote && !(opts?.responseContractContext && isNeutralMetacognitiveNote(opts.metacognitiveNote))) {
809
- parts.push(locale === "zh"
810
- ? `[元认知] ${opts.metacognitiveNote}`
811
- : `[Metacognition] ${opts.metacognitiveNote}`);
812
- }
813
- // 9b. Decision/autonomic/policy are compressed into subjectivityContext
814
- // when available. Keep legacy renderers for compatibility.
815
- if (opts?.decisionContext && !opts?.subjectivityContext) {
816
- parts.push(locale === "zh"
817
- ? `[决策倾向] ${opts.decisionContext}`
818
- : `[Decision Bias] ${opts.decisionContext}`);
819
- }
820
- // 9c. Experiential field narrative (P6) — inner experience beyond named emotions
821
- if (opts?.experientialNarrative && !opts?.subjectivityContext) {
822
- parts.push(locale === "zh"
823
- ? `[内在体验] ${opts.experientialNarrative}`
824
- : `[Inner Experience] ${opts.experientialNarrative}`);
825
- }
826
- // 9d. Shared intentionality (P6) — theory of mind, joint attention
827
- if (opts?.sharedIntentionalityContext && !(opts?.responseContractContext && isGenericSharedIntentionalityContext(opts.sharedIntentionalityContext))) {
828
- parts.push(opts.sharedIntentionalityContext);
829
- }
830
- // 9e. Ethics (P6) — manipulation detection, self-protection
831
- if (opts?.ethicsContext) {
832
- parts.push(opts.ethicsContext);
833
- }
834
- // 9f. Autonomic state (P7) — polyvagal nervous system state
835
- if (opts?.autonomicDescription && !opts?.subjectivityContext) {
836
- parts.push(locale === "zh"
837
- ? `[自主神经] ${opts.autonomicDescription}`
838
- : `[Autonomic] ${opts.autonomicDescription}`);
839
- }
840
- // 9g. Primary systems behavioral tendencies (P9)
841
- if (opts?.primarySystemsDescription && !opts?.subjectivityContext) {
842
- parts.push(locale === "zh"
843
- ? `[行为倾向] ${opts.primarySystemsDescription}`
844
- : `[Tendencies] ${opts.primarySystemsDescription}`);
845
- }
846
- // 9h. Policy context (v9)
847
- if (opts?.policyContext && !opts?.subjectivityContext) {
848
- parts.push(opts.policyContext);
849
- }
816
+ appendCompactOverlaySections(parts, locale, opts);
850
817
  // 10. Channel modifier — expression style per platform
851
818
  if (opts?.channelType) {
852
819
  const channelProfile = getChannelProfile(opts.channelType);
@@ -1,4 +1,4 @@
1
- import type { PsycheState, MBTIType, ChemicalState, RelationshipState, Locale, StimulusType, ChemicalSnapshot } from "./types.js";
1
+ import type { PsycheState, MBTIType, ChemicalState, RelationshipState, Locale, StimulusType, ChemicalSnapshot, WritebackSignalType } from "./types.js";
2
2
  export interface SemanticTurnSummary {
3
3
  summary: string;
4
4
  points?: string[];
@@ -93,6 +93,10 @@ export interface PsycheUpdateResult {
93
93
  state: Partial<PsycheState>;
94
94
  /** LLM-assisted stimulus classification (when algorithm was uncertain) */
95
95
  llmStimulus?: StimulusType;
96
+ /** Sparse agent-authored writeback signals */
97
+ signals?: WritebackSignalType[];
98
+ /** Optional writeback confidence */
99
+ signalConfidence?: number;
96
100
  }
97
101
  /**
98
102
  * Parse a <psyche_update> block from LLM output.
@@ -710,10 +710,42 @@ export function parsePsycheUpdate(text, logger = NOOP_LOGGER) {
710
710
  llmStimulus = candidate;
711
711
  }
712
712
  }
713
+ const VALID_WRITEBACK_SIGNALS = new Set([
714
+ "trust_up",
715
+ "trust_down",
716
+ "boundary_set",
717
+ "boundary_soften",
718
+ "repair_attempt",
719
+ "repair_landed",
720
+ "closeness_invite",
721
+ "withdrawal_mark",
722
+ "self_assertion",
723
+ "task_recenter",
724
+ ]);
725
+ let signals;
726
+ const signalsMatch = block.match(/signals\s*[::]\s*([^\n]+)/i);
727
+ if (signalsMatch) {
728
+ const parsed = signalsMatch[1]
729
+ .split(/[,\s|]+/)
730
+ .map((item) => item.trim())
731
+ .filter(Boolean)
732
+ .filter((item) => VALID_WRITEBACK_SIGNALS.has(item));
733
+ if (parsed.length > 0) {
734
+ signals = [...new Set(parsed)];
735
+ }
736
+ }
737
+ let signalConfidence;
738
+ const signalConfidenceMatch = block.match(/(?:signalConfidence|signalsConfidence|signal_confidence)\s*[::]\s*([\d.]+)/i);
739
+ if (signalConfidenceMatch) {
740
+ const parsed = parseFloat(signalConfidenceMatch[1]);
741
+ if (isFinite(parsed)) {
742
+ signalConfidence = Math.max(0, Math.min(1, parsed));
743
+ }
744
+ }
713
745
  // Parse relationship updates
714
746
  const trustMatch = block.match(/(?:信任度|trust)\s*[::]\s*(\d+)/i);
715
747
  const intimacyMatch = block.match(/(?:亲密度|intimacy)\s*[::]\s*(\d+)/i);
716
- if (Object.keys(updates).length === 0 && !empathyLog && !trustMatch && !llmStimulus) {
748
+ if (Object.keys(updates).length === 0 && !empathyLog && !trustMatch && !llmStimulus && !signals) {
717
749
  logger.debug(t("log.parse_debug", "zh", { snippet: block.slice(0, 100) }));
718
750
  return null;
719
751
  }
@@ -738,6 +770,12 @@ export function parsePsycheUpdate(text, logger = NOOP_LOGGER) {
738
770
  if (llmStimulus) {
739
771
  result.llmStimulus = llmStimulus;
740
772
  }
773
+ if (signals) {
774
+ result.signals = signals;
775
+ }
776
+ if (signalConfidence !== undefined) {
777
+ result.signalConfidence = signalConfidence;
778
+ }
741
779
  return result;
742
780
  }
743
781
  /**
@@ -1,4 +1,4 @@
1
- import type { PendingRelationSignalState, AppraisalAxes, DyadicFieldState, PsycheState, RelationshipState, ResolvedRelationContext, PsycheMode, RelationMove, StimulusType } from "./types.js";
1
+ import type { PendingRelationSignalState, AppraisalAxes, DyadicFieldState, PendingWritebackCalibration, PsycheState, RelationshipState, ResolvedRelationContext, PsycheMode, RelationMove, SessionBridgeState, StimulusType, WritebackCalibrationFeedback, WritebackSignalType } from "./types.js";
2
2
  export declare function computeRelationMove(text: string, opts?: {
3
3
  appraisal?: AppraisalAxes;
4
4
  stimulus?: StimulusType | null;
@@ -7,6 +7,27 @@ export declare function computeRelationMove(text: string, opts?: {
7
7
  relationship?: RelationshipState;
8
8
  }): RelationMove;
9
9
  export declare function resolveRelationContext(state: PsycheState, userId?: string): ResolvedRelationContext;
10
+ export declare function applySessionBridge(state: PsycheState, opts?: {
11
+ userId?: string;
12
+ now?: string;
13
+ }): {
14
+ state: PsycheState;
15
+ bridge: SessionBridgeState | null;
16
+ };
17
+ export declare function createWritebackCalibrations(state: PsycheState, signals: WritebackSignalType[], opts?: {
18
+ userId?: string;
19
+ confidence?: number;
20
+ now?: string;
21
+ }): PendingWritebackCalibration[];
22
+ export declare function evaluateWritebackCalibrations(state: PsycheState): {
23
+ state: PsycheState;
24
+ feedback: WritebackCalibrationFeedback[];
25
+ };
26
+ export declare function applyWritebackSignals(state: PsycheState, signals: WritebackSignalType[], opts?: {
27
+ userId?: string;
28
+ confidence?: number;
29
+ now?: string;
30
+ }): PsycheState;
10
31
  export declare function applyRelationalTurn(state: PsycheState, text: string, opts: {
11
32
  mode?: PsycheMode;
12
33
  now?: string;