@longtable/memory 0.1.9 → 0.1.10
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/state.d.ts +3 -0
- package/dist/state.js +34 -0
- package/dist/types.d.ts +4 -2
- package/package.json +2 -2
package/dist/state.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export declare function addInferredHypothesis(state: ResearchState, hypothesis:
|
|
|
4
4
|
export declare function promoteHypothesisToExplicitState(state: ResearchState, hypothesisText: string, explicitKey: string, explicitValue: unknown): ResearchState;
|
|
5
5
|
export declare function rejectInferredHypothesis(state: ResearchState, hypothesisText: string): ResearchState;
|
|
6
6
|
export declare function appendDecisionRecord(state: ResearchState, decision: DecisionRecord): ResearchState;
|
|
7
|
+
export declare function appendInvocationRecord(state: ResearchState, invocation: NonNullable<ResearchState["invocationLog"]>[number]): ResearchState;
|
|
8
|
+
export declare function appendQuestionRecord(state: ResearchState, question: NonNullable<ResearchState["questionLog"]>[number]): ResearchState;
|
|
9
|
+
export declare function appendQuestionRecords(state: ResearchState, questions: NonNullable<ResearchState["questionLog"]>): ResearchState;
|
|
7
10
|
export declare function recordArtifactProvenance(state: ResearchState, artifact: ArtifactRecord): ResearchState;
|
|
8
11
|
export declare function appendNarrativeTrace(state: ResearchState, trace: NarrativeTrace): ResearchState;
|
|
9
12
|
export declare function attachStudyContract(state: ResearchState, studyContract: ResearchState["studyContract"]): ResearchState;
|
package/dist/state.js
CHANGED
|
@@ -14,6 +14,8 @@ export function createEmptyResearchState() {
|
|
|
14
14
|
inferredHypotheses: [],
|
|
15
15
|
openTensions: [],
|
|
16
16
|
decisionLog: [],
|
|
17
|
+
invocationLog: [],
|
|
18
|
+
questionLog: [],
|
|
17
19
|
artifactRecords: [],
|
|
18
20
|
narrativeTraces: []
|
|
19
21
|
};
|
|
@@ -40,6 +42,8 @@ export function promoteHypothesisToExplicitState(state, hypothesisText, explicit
|
|
|
40
42
|
inferredHypotheses: state.inferredHypotheses.map((entry) => entry.hypothesis === hypothesisText ? { ...entry, status: "confirmed" } : entry),
|
|
41
43
|
openTensions: state.openTensions,
|
|
42
44
|
decisionLog: state.decisionLog,
|
|
45
|
+
invocationLog: state.invocationLog ?? [],
|
|
46
|
+
questionLog: state.questionLog ?? [],
|
|
43
47
|
artifactRecords: state.artifactRecords,
|
|
44
48
|
narrativeTraces: state.narrativeTraces,
|
|
45
49
|
studyContract: state.studyContract
|
|
@@ -63,6 +67,24 @@ export function appendDecisionRecord(state, decision) {
|
|
|
63
67
|
: state.studyContract
|
|
64
68
|
};
|
|
65
69
|
}
|
|
70
|
+
export function appendInvocationRecord(state, invocation) {
|
|
71
|
+
return {
|
|
72
|
+
...state,
|
|
73
|
+
invocationLog: [...(state.invocationLog ?? []), invocation]
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export function appendQuestionRecord(state, question) {
|
|
77
|
+
return {
|
|
78
|
+
...state,
|
|
79
|
+
questionLog: [...(state.questionLog ?? []), question]
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function appendQuestionRecords(state, questions) {
|
|
83
|
+
return {
|
|
84
|
+
...state,
|
|
85
|
+
questionLog: [...(state.questionLog ?? []), ...questions]
|
|
86
|
+
};
|
|
87
|
+
}
|
|
66
88
|
export function recordArtifactProvenance(state, artifact) {
|
|
67
89
|
return {
|
|
68
90
|
...state,
|
|
@@ -88,6 +110,8 @@ export function restoreWorkingState(state) {
|
|
|
88
110
|
inferredHypotheses: [...state.inferredHypotheses],
|
|
89
111
|
openTensions: [...state.openTensions],
|
|
90
112
|
decisionLog: [...state.decisionLog],
|
|
113
|
+
invocationLog: [...(state.invocationLog ?? [])],
|
|
114
|
+
questionLog: [...(state.questionLog ?? [])],
|
|
91
115
|
artifactRecords: [...state.artifactRecords],
|
|
92
116
|
narrativeTraces: [...state.narrativeTraces],
|
|
93
117
|
studyContract: state.studyContract
|
|
@@ -106,6 +130,12 @@ export function summarizeForCheckpoint(state, mode) {
|
|
|
106
130
|
decisionLog: mode === "commit" || mode === "submit"
|
|
107
131
|
? state.decisionLog.slice(-5)
|
|
108
132
|
: state.decisionLog.slice(-2),
|
|
133
|
+
invocationLog: mode === "commit" || mode === "submit"
|
|
134
|
+
? (state.invocationLog ?? []).slice(-5)
|
|
135
|
+
: (state.invocationLog ?? []).slice(-2),
|
|
136
|
+
questionLog: mode === "commit" || mode === "submit"
|
|
137
|
+
? (state.questionLog ?? []).slice(-5)
|
|
138
|
+
: (state.questionLog ?? []).slice(-2),
|
|
109
139
|
artifactRecords: mode === "submit"
|
|
110
140
|
? state.artifactRecords.slice(-5)
|
|
111
141
|
: state.artifactRecords.slice(-2),
|
|
@@ -121,6 +151,8 @@ export function summarizeStateForMode(state, mode) {
|
|
|
121
151
|
inferredHypotheses: [],
|
|
122
152
|
openTensions: [],
|
|
123
153
|
decisionLog: [],
|
|
154
|
+
invocationLog: [],
|
|
155
|
+
questionLog: [],
|
|
124
156
|
artifactRecords: [],
|
|
125
157
|
narrativeTraces: []
|
|
126
158
|
};
|
|
@@ -139,6 +171,8 @@ export function summarizeStateForMode(state, mode) {
|
|
|
139
171
|
inferredHypotheses: state.inferredHypotheses.filter((entry) => entry.status !== "rejected"),
|
|
140
172
|
openTensions: state.openTensions,
|
|
141
173
|
decisionLog: state.decisionLog.slice(-3),
|
|
174
|
+
invocationLog: (state.invocationLog ?? []).slice(-3),
|
|
175
|
+
questionLog: (state.questionLog ?? []).slice(-3),
|
|
142
176
|
artifactRecords: state.artifactRecords.slice(-3),
|
|
143
177
|
narrativeTraces: state.narrativeTraces.slice(-3)
|
|
144
178
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import type { ArtifactRecord, DecisionRecord, InferredHypothesis, NarrativeTrace } from "@longtable/core";
|
|
1
|
+
import type { ArtifactRecord, DecisionRecord, InferredHypothesis, InvocationRecord, NarrativeTrace, QuestionRecord } from "@longtable/core";
|
|
2
2
|
export interface MemorySummary {
|
|
3
3
|
explicitState: Record<string, unknown>;
|
|
4
4
|
workingState: Record<string, unknown>;
|
|
5
5
|
inferredHypotheses: InferredHypothesis[];
|
|
6
6
|
openTensions: string[];
|
|
7
7
|
decisionLog: DecisionRecord[];
|
|
8
|
+
invocationLog: InvocationRecord[];
|
|
9
|
+
questionLog: QuestionRecord[];
|
|
8
10
|
artifactRecords: ArtifactRecord[];
|
|
9
11
|
narrativeTraces: NarrativeTrace[];
|
|
10
12
|
}
|
|
11
|
-
export type { ArtifactRecord, DecisionRecord, InferredHypothesis, InteractionMode, NarrativeTrace, ResearchState } from "@longtable/core";
|
|
13
|
+
export type { ArtifactRecord, DecisionRecord, InferredHypothesis, InteractionMode, InvocationRecord, NarrativeTrace, QuestionRecord, ResearchState } from "@longtable/core";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longtable/memory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Memory contracts for LongTable explicit state, inferred hypotheses, and open tensions",
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@longtable/core": "0.1.
|
|
24
|
+
"@longtable/core": "0.1.10"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"typescript": "^5.6.0"
|