@haaaiawd/second-nature 0.1.39 → 0.1.41

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.
Files changed (51) hide show
  1. package/index.js +1270 -1270
  2. package/openclaw.plugin.json +29 -29
  3. package/package.json +55 -55
  4. package/runtime/cli/commands/connector-init.js +11 -4
  5. package/runtime/cli/index.js +6 -1
  6. package/runtime/cli/ops/heartbeat-surface.d.ts +75 -75
  7. package/runtime/cli/ops/heartbeat-surface.js +97 -97
  8. package/runtime/cli/ops/ops-router.js +1428 -1428
  9. package/runtime/cli/ops/workspace-heartbeat-runner.js +236 -236
  10. package/runtime/connectors/services/connector-executor-adapter.js +192 -41
  11. package/runtime/core/second-nature/body/tool-affordance/affordance-context-scope.d.ts +1 -1
  12. package/runtime/core/second-nature/body/tool-affordance/affordance-context-scope.js +2 -1
  13. package/runtime/core/second-nature/guidance/apply-guidance.d.ts +12 -12
  14. package/runtime/core/second-nature/guidance/apply-guidance.js +15 -15
  15. package/runtime/core/second-nature/guidance/user-reply-continuity.d.ts +50 -50
  16. package/runtime/core/second-nature/guidance/user-reply-continuity.js +89 -89
  17. package/runtime/core/second-nature/orchestrator/intent-planner.js +15 -0
  18. package/runtime/core/second-nature/runtime/service-entry.d.ts +39 -39
  19. package/runtime/core/second-nature/runtime/service-entry.js +44 -44
  20. package/runtime/dream/dream-engine.d.ts +14 -14
  21. package/runtime/dream/dream-engine.js +306 -306
  22. package/runtime/dream/dream-input-loader.d.ts +37 -37
  23. package/runtime/dream/dream-input-loader.js +150 -150
  24. package/runtime/dream/dream-scheduler.d.ts +75 -75
  25. package/runtime/dream/dream-scheduler.js +131 -131
  26. package/runtime/dream/index.d.ts +16 -16
  27. package/runtime/dream/index.js +14 -14
  28. package/runtime/dream/insight-extractor.d.ts +32 -32
  29. package/runtime/dream/insight-extractor.js +135 -135
  30. package/runtime/dream/memory-consolidator.d.ts +45 -45
  31. package/runtime/dream/memory-consolidator.js +140 -140
  32. package/runtime/dream/narrative-update-proposal.d.ts +34 -34
  33. package/runtime/dream/narrative-update-proposal.js +83 -83
  34. package/runtime/dream/output-validator.d.ts +20 -20
  35. package/runtime/dream/output-validator.js +110 -110
  36. package/runtime/dream/redaction-gate.d.ts +31 -31
  37. package/runtime/dream/redaction-gate.js +109 -109
  38. package/runtime/dream/relationship-update-proposal.d.ts +27 -27
  39. package/runtime/dream/relationship-update-proposal.js +119 -119
  40. package/runtime/dream/sampler.d.ts +30 -30
  41. package/runtime/dream/sampler.js +65 -65
  42. package/runtime/dream/types.d.ts +187 -187
  43. package/runtime/dream/types.js +11 -11
  44. package/runtime/guidance/fallback.js +20 -20
  45. package/runtime/guidance/guidance-assembler.js +76 -76
  46. package/runtime/guidance/output-guard.d.ts +13 -13
  47. package/runtime/guidance/output-guard.js +53 -53
  48. package/runtime/guidance/template-registry.d.ts +20 -20
  49. package/runtime/guidance/template-registry.js +93 -93
  50. package/runtime/guidance/types.d.ts +98 -98
  51. package/runtime/observability/projections/guidance-audit.js +38 -38
@@ -1,65 +1,65 @@
1
- /**
2
- * Dream input sampler.
3
- *
4
- * Core logic: when evidence count exceeds threshold, sample recent 7 days
5
- * plus key events (outreach, owner reply, goal milestone, high-confidence refs).
6
- * Goal: prevent token/cost explosion before LLM stage.
7
- * Test coverage: tests/integration/dream/t7-1-1-dream-pipeline.test.ts
8
- */
9
- const DEFAULT_EVIDENCE_LIMIT = 1000;
10
- const RECENT_DAYS = 7;
11
- function isWithinDays(createdAt, days) {
12
- const then = new Date(createdAt).getTime();
13
- const now = Date.now();
14
- return now - then <= days * 24 * 60 * 60 * 1000;
15
- }
16
- function isKeyEvent(item) {
17
- if (!item.kind)
18
- return false;
19
- const keyKinds = [
20
- "outreach",
21
- "owner_reply",
22
- "goal_milestone",
23
- "delivery",
24
- "quiet_reflection",
25
- ];
26
- return keyKinds.includes(item.kind);
27
- }
28
- function isHighConfidence(item) {
29
- return (item.confidence ?? 0) >= 0.7;
30
- }
31
- export function sampleDreamInput(input) {
32
- const limit = input.evidenceLimit ?? DEFAULT_EVIDENCE_LIMIT;
33
- // Priority: recent 7 days + key events + high confidence
34
- const withPriority = input.evidenceSummaries.map((e) => ({
35
- ...e,
36
- priority: (isWithinDays(e.createdAt, RECENT_DAYS) ? 4 : 0) +
37
- (isKeyEvent(e) ? 2 : 0) +
38
- (isHighConfidence(e) ? 1 : 0),
39
- }));
40
- // Sort by priority desc, then createdAt desc
41
- withPriority.sort((a, b) => {
42
- if (b.priority !== a.priority)
43
- return b.priority - a.priority;
44
- return b.createdAt.localeCompare(a.createdAt);
45
- });
46
- const sampledEvidence = withPriority.slice(0, limit);
47
- const sampledEvidenceIds = sampledEvidence.map((e) => e.id);
48
- const droppedCount = input.evidenceSummaries.length - sampledEvidence.length;
49
- // Chronicle is usually small; keep all unless it also exceeds limit
50
- let sampledChronicleIds = input.chronicleSummaries.map((c) => c.id);
51
- if (sampledChronicleIds.length > limit) {
52
- sampledChronicleIds = sampledChronicleIds
53
- .sort((a, b) => b.localeCompare(a))
54
- .slice(0, limit);
55
- }
56
- const reason = droppedCount > 0
57
- ? `sampled_${sampledEvidenceIds.length}_of_${input.evidenceSummaries.length}_evidence;priority_recent+key+confidence`
58
- : "no_sampling_needed";
59
- return {
60
- sampledEvidenceIds,
61
- sampledChronicleIds,
62
- droppedCount,
63
- reason,
64
- };
65
- }
1
+ /**
2
+ * Dream input sampler.
3
+ *
4
+ * Core logic: when evidence count exceeds threshold, sample recent 7 days
5
+ * plus key events (outreach, owner reply, goal milestone, high-confidence refs).
6
+ * Goal: prevent token/cost explosion before LLM stage.
7
+ * Test coverage: tests/integration/dream/t7-1-1-dream-pipeline.test.ts
8
+ */
9
+ const DEFAULT_EVIDENCE_LIMIT = 1000;
10
+ const RECENT_DAYS = 7;
11
+ function isWithinDays(createdAt, days) {
12
+ const then = new Date(createdAt).getTime();
13
+ const now = Date.now();
14
+ return now - then <= days * 24 * 60 * 60 * 1000;
15
+ }
16
+ function isKeyEvent(item) {
17
+ if (!item.kind)
18
+ return false;
19
+ const keyKinds = [
20
+ "outreach",
21
+ "owner_reply",
22
+ "goal_milestone",
23
+ "delivery",
24
+ "quiet_reflection",
25
+ ];
26
+ return keyKinds.includes(item.kind);
27
+ }
28
+ function isHighConfidence(item) {
29
+ return (item.confidence ?? 0) >= 0.7;
30
+ }
31
+ export function sampleDreamInput(input) {
32
+ const limit = input.evidenceLimit ?? DEFAULT_EVIDENCE_LIMIT;
33
+ // Priority: recent 7 days + key events + high confidence
34
+ const withPriority = input.evidenceSummaries.map((e) => ({
35
+ ...e,
36
+ priority: (isWithinDays(e.createdAt, RECENT_DAYS) ? 4 : 0) +
37
+ (isKeyEvent(e) ? 2 : 0) +
38
+ (isHighConfidence(e) ? 1 : 0),
39
+ }));
40
+ // Sort by priority desc, then createdAt desc
41
+ withPriority.sort((a, b) => {
42
+ if (b.priority !== a.priority)
43
+ return b.priority - a.priority;
44
+ return b.createdAt.localeCompare(a.createdAt);
45
+ });
46
+ const sampledEvidence = withPriority.slice(0, limit);
47
+ const sampledEvidenceIds = sampledEvidence.map((e) => e.id);
48
+ const droppedCount = input.evidenceSummaries.length - sampledEvidence.length;
49
+ // Chronicle is usually small; keep all unless it also exceeds limit
50
+ let sampledChronicleIds = input.chronicleSummaries.map((c) => c.id);
51
+ if (sampledChronicleIds.length > limit) {
52
+ sampledChronicleIds = sampledChronicleIds
53
+ .sort((a, b) => b.localeCompare(a))
54
+ .slice(0, limit);
55
+ }
56
+ const reason = droppedCount > 0
57
+ ? `sampled_${sampledEvidenceIds.length}_of_${input.evidenceSummaries.length}_evidence;priority_recent+key+confidence`
58
+ : "no_sampling_needed";
59
+ return {
60
+ sampledEvidenceIds,
61
+ sampledChronicleIds,
62
+ droppedCount,
63
+ reason,
64
+ };
65
+ }
@@ -1,187 +1,187 @@
1
- /**
2
- * Dream System core types.
3
- *
4
- * Dream is an async memory consolidation job. It reads source-backed life evidence,
5
- * session chronicle, and existing memory store, then produces a candidate MemoryStore
6
- * with canonical entries, insights, and optional narrative/relationship update proposals.
7
- *
8
- * Contract: input store is immutable; output is always candidate until validated and accepted.
9
- * Test coverage: tests/integration/dream/t7-1-1-dream-pipeline.test.ts
10
- */
11
- import type { CanonicalMemoryEntry, DreamInsight } from "../storage/memory-store/memory-store-lifecycle.js";
12
- export type { DreamInsight };
13
- export type DreamTriggerKind = "scheduled" | "evidence_threshold" | "manual" | "maintenance" | "quiet_completion";
14
- export type DreamRunStatus = "queued" | "running" | "completed" | "skipped" | "failed";
15
- export type DreamOutputStatus = "candidate" | "accepted" | "archived" | "partial";
16
- export type DreamMode = "rules_only" | "hybrid_llm" | "model_skipped";
17
- export interface DreamRun {
18
- runId: string;
19
- traceId: string;
20
- triggerKind: DreamTriggerKind;
21
- status: DreamRunStatus;
22
- mode: DreamMode;
23
- startedAt: string;
24
- finishedAt?: string;
25
- inputMemoryStoreId?: string;
26
- outputMemoryStoreId?: string;
27
- fallbackReason?: string;
28
- }
29
- export interface ToolExperienceSummary {
30
- connectorId: string;
31
- capabilityId: string;
32
- outcome: string;
33
- count: number;
34
- lastRecordedAt: string;
35
- }
36
- export interface DreamInputBundle {
37
- evidenceRefs: string[];
38
- chronicleEntryIds: string[];
39
- activeMemoryStoreId?: string;
40
- narrativeSnapshotId?: string;
41
- relationshipSnapshotId?: string;
42
- goalSnapshotIds: string[];
43
- toolExperienceSummaries?: ToolExperienceSummary[];
44
- inputCounts: {
45
- evidence: number;
46
- chronicle: number;
47
- memoryEntries: number;
48
- };
49
- }
50
- export interface DreamNarrativeUpdate {
51
- focus: string;
52
- progressAdditions: string[];
53
- nextIntent: string;
54
- confidenceDelta: number;
55
- sourceRefs: string[];
56
- unsupportedClaims: string[];
57
- }
58
- export interface DreamRelationshipUpdate {
59
- toneDelta?: string;
60
- timingDelta?: string;
61
- topicDelta?: string;
62
- sourceRefs: string[];
63
- confidence: number;
64
- }
65
- export interface DreamOutputValidation {
66
- schemaValid: boolean;
67
- sourceGrounded: boolean;
68
- sensitivityClean: boolean;
69
- unsupportedClaims: string[];
70
- errors: string[];
71
- checkedAt: string;
72
- }
73
- export interface DreamOutput {
74
- outputId: string;
75
- runId: string;
76
- status: DreamOutputStatus;
77
- inputMemoryStoreId?: string;
78
- canonicalEntries: CanonicalMemoryEntry[];
79
- insights: DreamInsight[];
80
- narrativeUpdate?: DreamNarrativeUpdate;
81
- relationshipUpdate?: DreamRelationshipUpdate;
82
- validation: DreamOutputValidation;
83
- }
84
- export interface DreamTrace {
85
- traceId: string;
86
- runId: string;
87
- startedAt: string;
88
- finishedAt: string;
89
- durationMs: number;
90
- llmCostUsd?: number;
91
- inputCounts: DreamInputBundle["inputCounts"];
92
- fallbackReason?: string;
93
- validationErrors?: string[];
94
- timeoutMs?: number;
95
- sensitivityFailure?: boolean;
96
- }
97
- export interface DreamRunResult {
98
- runId: string;
99
- status: DreamRunStatus;
100
- output?: DreamOutput;
101
- trace: DreamTrace;
102
- fallbackReason?: string;
103
- }
104
- export interface DreamStatePort {
105
- loadDreamInputs(query: {
106
- timeWindowDays?: number;
107
- evidenceLimit?: number;
108
- }): Promise<DreamInputBundle>;
109
- writeDreamOutput(output: DreamOutput): Promise<{
110
- outputId: string;
111
- status: "acknowledged" | "degraded";
112
- }>;
113
- markDreamOutputLifecycle(input: {
114
- outputId: string;
115
- newStatus: DreamOutputStatus;
116
- validation?: DreamOutputValidation;
117
- updatedAt: string;
118
- }): Promise<{
119
- outputId: string;
120
- status: "acknowledged" | "degraded";
121
- }>;
122
- }
123
- /**
124
- * Brand type: evidence bundle that has passed through RedactionGate.
125
- * TypeScript prevents passing un-redacted data to ModelAssistPort.
126
- */
127
- export interface RedactedEvidenceBundle {
128
- readonly _brand: "redacted";
129
- readonly evidence: readonly string[];
130
- readonly chronicle: readonly string[];
131
- readonly memory?: readonly string[];
132
- }
133
- export interface ModelAssistPort {
134
- /** Only accepts RedactedEvidenceBundle — TypeScript enforces prior redaction (DR-027). */
135
- extractInsights(input: RedactedEvidenceBundle): Promise<{
136
- insights: DreamInsight[];
137
- narrativeUpdate?: DreamNarrativeUpdate;
138
- relationshipUpdate?: DreamRelationshipUpdate;
139
- unsupportedClaims: string[];
140
- costUsd?: number;
141
- }>;
142
- }
143
- /** @deprecated Use ModelAssistPort with RedactedEvidenceBundle (DR-027). */
144
- export interface DreamModelPort {
145
- extractInsights(input: {
146
- sampledEvidence: string[];
147
- chronicleSummary: string;
148
- activeMemorySummary?: string;
149
- redacted: boolean;
150
- }): Promise<{
151
- insights: DreamInsight[];
152
- narrativeUpdate?: DreamNarrativeUpdate;
153
- relationshipUpdate?: DreamRelationshipUpdate;
154
- unsupportedClaims: string[];
155
- costUsd?: number;
156
- }>;
157
- }
158
- export interface DreamTracePort {
159
- recordDreamTrace(trace: DreamTrace): Promise<void>;
160
- }
161
- export interface DreamBudgetPort {
162
- checkBudget(costEstimateUsd: number): Promise<{
163
- allowed: boolean;
164
- remainingUsd: number;
165
- }>;
166
- }
167
- export interface DreamEngineInput {
168
- runId: string;
169
- traceId: string;
170
- triggerKind: DreamTriggerKind;
171
- statePort: DreamStatePort;
172
- /** @deprecated Use modelAssistPort with RedactedEvidenceBundle (DR-027). */
173
- modelPort?: DreamModelPort;
174
- /**
175
- * v7 ModelAssistPort — requires RedactedEvidenceBundle (DR-027).
176
- * If both modelAssistPort and modelPort are provided, modelAssistPort takes precedence.
177
- */
178
- modelAssistPort?: ModelAssistPort;
179
- tracePort?: DreamTracePort;
180
- budgetPort?: DreamBudgetPort;
181
- options?: {
182
- timeWindowDays?: number;
183
- evidenceLimit?: number;
184
- maxCanonicalEntries?: number;
185
- operatorTimeoutMs?: number;
186
- };
187
- }
1
+ /**
2
+ * Dream System core types.
3
+ *
4
+ * Dream is an async memory consolidation job. It reads source-backed life evidence,
5
+ * session chronicle, and existing memory store, then produces a candidate MemoryStore
6
+ * with canonical entries, insights, and optional narrative/relationship update proposals.
7
+ *
8
+ * Contract: input store is immutable; output is always candidate until validated and accepted.
9
+ * Test coverage: tests/integration/dream/t7-1-1-dream-pipeline.test.ts
10
+ */
11
+ import type { CanonicalMemoryEntry, DreamInsight } from "../storage/memory-store/memory-store-lifecycle.js";
12
+ export type { DreamInsight };
13
+ export type DreamTriggerKind = "scheduled" | "evidence_threshold" | "manual" | "maintenance" | "quiet_completion";
14
+ export type DreamRunStatus = "queued" | "running" | "completed" | "skipped" | "failed";
15
+ export type DreamOutputStatus = "candidate" | "accepted" | "archived" | "partial";
16
+ export type DreamMode = "rules_only" | "hybrid_llm" | "model_skipped";
17
+ export interface DreamRun {
18
+ runId: string;
19
+ traceId: string;
20
+ triggerKind: DreamTriggerKind;
21
+ status: DreamRunStatus;
22
+ mode: DreamMode;
23
+ startedAt: string;
24
+ finishedAt?: string;
25
+ inputMemoryStoreId?: string;
26
+ outputMemoryStoreId?: string;
27
+ fallbackReason?: string;
28
+ }
29
+ export interface ToolExperienceSummary {
30
+ connectorId: string;
31
+ capabilityId: string;
32
+ outcome: string;
33
+ count: number;
34
+ lastRecordedAt: string;
35
+ }
36
+ export interface DreamInputBundle {
37
+ evidenceRefs: string[];
38
+ chronicleEntryIds: string[];
39
+ activeMemoryStoreId?: string;
40
+ narrativeSnapshotId?: string;
41
+ relationshipSnapshotId?: string;
42
+ goalSnapshotIds: string[];
43
+ toolExperienceSummaries?: ToolExperienceSummary[];
44
+ inputCounts: {
45
+ evidence: number;
46
+ chronicle: number;
47
+ memoryEntries: number;
48
+ };
49
+ }
50
+ export interface DreamNarrativeUpdate {
51
+ focus: string;
52
+ progressAdditions: string[];
53
+ nextIntent: string;
54
+ confidenceDelta: number;
55
+ sourceRefs: string[];
56
+ unsupportedClaims: string[];
57
+ }
58
+ export interface DreamRelationshipUpdate {
59
+ toneDelta?: string;
60
+ timingDelta?: string;
61
+ topicDelta?: string;
62
+ sourceRefs: string[];
63
+ confidence: number;
64
+ }
65
+ export interface DreamOutputValidation {
66
+ schemaValid: boolean;
67
+ sourceGrounded: boolean;
68
+ sensitivityClean: boolean;
69
+ unsupportedClaims: string[];
70
+ errors: string[];
71
+ checkedAt: string;
72
+ }
73
+ export interface DreamOutput {
74
+ outputId: string;
75
+ runId: string;
76
+ status: DreamOutputStatus;
77
+ inputMemoryStoreId?: string;
78
+ canonicalEntries: CanonicalMemoryEntry[];
79
+ insights: DreamInsight[];
80
+ narrativeUpdate?: DreamNarrativeUpdate;
81
+ relationshipUpdate?: DreamRelationshipUpdate;
82
+ validation: DreamOutputValidation;
83
+ }
84
+ export interface DreamTrace {
85
+ traceId: string;
86
+ runId: string;
87
+ startedAt: string;
88
+ finishedAt: string;
89
+ durationMs: number;
90
+ llmCostUsd?: number;
91
+ inputCounts: DreamInputBundle["inputCounts"];
92
+ fallbackReason?: string;
93
+ validationErrors?: string[];
94
+ timeoutMs?: number;
95
+ sensitivityFailure?: boolean;
96
+ }
97
+ export interface DreamRunResult {
98
+ runId: string;
99
+ status: DreamRunStatus;
100
+ output?: DreamOutput;
101
+ trace: DreamTrace;
102
+ fallbackReason?: string;
103
+ }
104
+ export interface DreamStatePort {
105
+ loadDreamInputs(query: {
106
+ timeWindowDays?: number;
107
+ evidenceLimit?: number;
108
+ }): Promise<DreamInputBundle>;
109
+ writeDreamOutput(output: DreamOutput): Promise<{
110
+ outputId: string;
111
+ status: "acknowledged" | "degraded";
112
+ }>;
113
+ markDreamOutputLifecycle(input: {
114
+ outputId: string;
115
+ newStatus: DreamOutputStatus;
116
+ validation?: DreamOutputValidation;
117
+ updatedAt: string;
118
+ }): Promise<{
119
+ outputId: string;
120
+ status: "acknowledged" | "degraded";
121
+ }>;
122
+ }
123
+ /**
124
+ * Brand type: evidence bundle that has passed through RedactionGate.
125
+ * TypeScript prevents passing un-redacted data to ModelAssistPort.
126
+ */
127
+ export interface RedactedEvidenceBundle {
128
+ readonly _brand: "redacted";
129
+ readonly evidence: readonly string[];
130
+ readonly chronicle: readonly string[];
131
+ readonly memory?: readonly string[];
132
+ }
133
+ export interface ModelAssistPort {
134
+ /** Only accepts RedactedEvidenceBundle — TypeScript enforces prior redaction (DR-027). */
135
+ extractInsights(input: RedactedEvidenceBundle): Promise<{
136
+ insights: DreamInsight[];
137
+ narrativeUpdate?: DreamNarrativeUpdate;
138
+ relationshipUpdate?: DreamRelationshipUpdate;
139
+ unsupportedClaims: string[];
140
+ costUsd?: number;
141
+ }>;
142
+ }
143
+ /** @deprecated Use ModelAssistPort with RedactedEvidenceBundle (DR-027). */
144
+ export interface DreamModelPort {
145
+ extractInsights(input: {
146
+ sampledEvidence: string[];
147
+ chronicleSummary: string;
148
+ activeMemorySummary?: string;
149
+ redacted: boolean;
150
+ }): Promise<{
151
+ insights: DreamInsight[];
152
+ narrativeUpdate?: DreamNarrativeUpdate;
153
+ relationshipUpdate?: DreamRelationshipUpdate;
154
+ unsupportedClaims: string[];
155
+ costUsd?: number;
156
+ }>;
157
+ }
158
+ export interface DreamTracePort {
159
+ recordDreamTrace(trace: DreamTrace): Promise<void>;
160
+ }
161
+ export interface DreamBudgetPort {
162
+ checkBudget(costEstimateUsd: number): Promise<{
163
+ allowed: boolean;
164
+ remainingUsd: number;
165
+ }>;
166
+ }
167
+ export interface DreamEngineInput {
168
+ runId: string;
169
+ traceId: string;
170
+ triggerKind: DreamTriggerKind;
171
+ statePort: DreamStatePort;
172
+ /** @deprecated Use modelAssistPort with RedactedEvidenceBundle (DR-027). */
173
+ modelPort?: DreamModelPort;
174
+ /**
175
+ * v7 ModelAssistPort — requires RedactedEvidenceBundle (DR-027).
176
+ * If both modelAssistPort and modelPort are provided, modelAssistPort takes precedence.
177
+ */
178
+ modelAssistPort?: ModelAssistPort;
179
+ tracePort?: DreamTracePort;
180
+ budgetPort?: DreamBudgetPort;
181
+ options?: {
182
+ timeWindowDays?: number;
183
+ evidenceLimit?: number;
184
+ maxCanonicalEntries?: number;
185
+ operatorTimeoutMs?: number;
186
+ };
187
+ }
@@ -1,11 +1,11 @@
1
- /**
2
- * Dream System core types.
3
- *
4
- * Dream is an async memory consolidation job. It reads source-backed life evidence,
5
- * session chronicle, and existing memory store, then produces a candidate MemoryStore
6
- * with canonical entries, insights, and optional narrative/relationship update proposals.
7
- *
8
- * Contract: input store is immutable; output is always candidate until validated and accepted.
9
- * Test coverage: tests/integration/dream/t7-1-1-dream-pipeline.test.ts
10
- */
11
- export {};
1
+ /**
2
+ * Dream System core types.
3
+ *
4
+ * Dream is an async memory consolidation job. It reads source-backed life evidence,
5
+ * session chronicle, and existing memory store, then produces a candidate MemoryStore
6
+ * with canonical entries, insights, and optional narrative/relationship update proposals.
7
+ *
8
+ * Contract: input store is immutable; output is always candidate until validated and accepted.
9
+ * Test coverage: tests/integration/dream/t7-1-1-dream-pipeline.test.ts
10
+ */
11
+ export {};
@@ -1,20 +1,20 @@
1
- import { buildOutputGuard, buildExpressionBoundary } from "./output-guard.js";
2
- import { getShortAtmosphereTemplate } from "./template-registry.js";
3
- export function buildMinimalGuidanceFallback(sceneContext) {
4
- const atmosphereTemplate = getShortAtmosphereTemplate(sceneContext.mode, sceneContext.riskLevel);
5
- return {
6
- scene: sceneContext,
7
- atmosphere: {
8
- kind: "atmosphere",
9
- text: atmosphereTemplate.text,
10
- openness: sceneContext.mode === "quiet" ? "quiet" : sceneContext.riskLevel === "high" ? "narrow" : "open",
11
- pressureLabels: [sceneContext.mode, sceneContext.riskLevel ?? "unknown_risk"],
12
- reviewStatus: atmosphereTemplate.reviewStatus,
13
- },
14
- impulses: [],
15
- personaReinforcement: [],
16
- outputGuard: buildOutputGuard(sceneContext.sceneType),
17
- expressionBoundary: buildExpressionBoundary(sceneContext.sceneType),
18
- minimal: true,
19
- };
20
- }
1
+ import { buildOutputGuard, buildExpressionBoundary } from "./output-guard.js";
2
+ import { getShortAtmosphereTemplate } from "./template-registry.js";
3
+ export function buildMinimalGuidanceFallback(sceneContext) {
4
+ const atmosphereTemplate = getShortAtmosphereTemplate(sceneContext.mode, sceneContext.riskLevel);
5
+ return {
6
+ scene: sceneContext,
7
+ atmosphere: {
8
+ kind: "atmosphere",
9
+ text: atmosphereTemplate.text,
10
+ openness: sceneContext.mode === "quiet" ? "quiet" : sceneContext.riskLevel === "high" ? "narrow" : "open",
11
+ pressureLabels: [sceneContext.mode, sceneContext.riskLevel ?? "unknown_risk"],
12
+ reviewStatus: atmosphereTemplate.reviewStatus,
13
+ },
14
+ impulses: [],
15
+ personaReinforcement: [],
16
+ outputGuard: buildOutputGuard(sceneContext.sceneType),
17
+ expressionBoundary: buildExpressionBoundary(sceneContext.sceneType),
18
+ minimal: true,
19
+ };
20
+ }