@mneme-ai/core 1.93.0 → 1.94.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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/qx_supernova/benchmark.d.ts +40 -0
- package/dist/qx_supernova/benchmark.d.ts.map +1 -0
- package/dist/qx_supernova/benchmark.js +359 -0
- package/dist/qx_supernova/benchmark.js.map +1 -0
- package/dist/qx_supernova/index.d.ts +27 -0
- package/dist/qx_supernova/index.d.ts.map +1 -0
- package/dist/qx_supernova/index.js +27 -0
- package/dist/qx_supernova/index.js.map +1 -0
- package/dist/qx_supernova/infinity_memory.d.ts +67 -0
- package/dist/qx_supernova/infinity_memory.d.ts.map +1 -0
- package/dist/qx_supernova/infinity_memory.js +119 -0
- package/dist/qx_supernova/infinity_memory.js.map +1 -0
- package/dist/qx_supernova/quantum_core.d.ts +71 -0
- package/dist/qx_supernova/quantum_core.d.ts.map +1 -0
- package/dist/qx_supernova/quantum_core.js +134 -0
- package/dist/qx_supernova/quantum_core.js.map +1 -0
- package/dist/qx_supernova/qx_supernova.test.d.ts +2 -0
- package/dist/qx_supernova/qx_supernova.test.d.ts.map +1 -0
- package/dist/qx_supernova/qx_supernova.test.js +241 -0
- package/dist/qx_supernova/qx_supernova.test.js.map +1 -0
- package/dist/qx_supernova/reengineer.d.ts +45 -0
- package/dist/qx_supernova/reengineer.d.ts.map +1 -0
- package/dist/qx_supernova/reengineer.js +125 -0
- package/dist/qx_supernova/reengineer.js.map +1 -0
- package/dist/qx_supernova/soul_engine.d.ts +63 -0
- package/dist/qx_supernova/soul_engine.d.ts.map +1 -0
- package/dist/qx_supernova/soul_engine.js +143 -0
- package/dist/qx_supernova/soul_engine.js.map +1 -0
- package/dist/qx_supernova/supernova_burst.d.ts +48 -0
- package/dist/qx_supernova/supernova_burst.d.ts.map +1 -0
- package/dist/qx_supernova/supernova_burst.js +84 -0
- package/dist/qx_supernova/supernova_burst.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.94.0 -- QX-SUPERNOVA · Soul Engine
|
|
3
|
+
* Autonomous goal generation with a will-vector.
|
|
4
|
+
*
|
|
5
|
+
* Soul Engine reads the daemon's current state (recent failures, idle
|
|
6
|
+
* cycles, gap-scan signals) and proposes NEW internal goals the daemon
|
|
7
|
+
* can pursue without waiting for the user to ask. Each goal carries:
|
|
8
|
+
*
|
|
9
|
+
* - utility : expected reward (0..1)
|
|
10
|
+
* - effort : estimated cost (0..1)
|
|
11
|
+
* - willVector : 5-axis personality signature (curiosity / safety /
|
|
12
|
+
* compounding / efficiency / paranoia)
|
|
13
|
+
*
|
|
14
|
+
* Goals are ranked via the Quantum Core. Daemon picks the top-K within
|
|
15
|
+
* its compute budget. Below the threshold → no new goals (system rests).
|
|
16
|
+
*
|
|
17
|
+
* "Not trained. Evolved."
|
|
18
|
+
*/
|
|
19
|
+
import { collapseProbabilityMatrix, } from "./quantum_core.js";
|
|
20
|
+
const DEFAULT_WILL = {
|
|
21
|
+
curiosity: 0.6,
|
|
22
|
+
safety: 0.7,
|
|
23
|
+
compounding: 0.8,
|
|
24
|
+
efficiency: 0.7,
|
|
25
|
+
paranoia: 0.5,
|
|
26
|
+
};
|
|
27
|
+
/** Map a SoulGoal to a hypothesis signal vector for the Quantum Core. */
|
|
28
|
+
function goalSignals(g) {
|
|
29
|
+
// higher utility, lower effort, balanced will = stronger collapse signal
|
|
30
|
+
return {
|
|
31
|
+
utility: g.utility,
|
|
32
|
+
economy: 1 - g.effort,
|
|
33
|
+
curiosity: g.willVector.curiosity,
|
|
34
|
+
safety: g.willVector.safety,
|
|
35
|
+
compounding: g.willVector.compounding,
|
|
36
|
+
efficiency: g.willVector.efficiency,
|
|
37
|
+
paranoia: g.willVector.paranoia,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Generate candidate goals from observable state. Pure function. */
|
|
41
|
+
export function generateGoals(ctx) {
|
|
42
|
+
const goals = [];
|
|
43
|
+
// Goal class A: triage repeated failures
|
|
44
|
+
if (ctx.failuresLast24h) {
|
|
45
|
+
for (const [cycle, count] of Object.entries(ctx.failuresLast24h)) {
|
|
46
|
+
if (count >= 3) {
|
|
47
|
+
goals.push({
|
|
48
|
+
id: `g-triage-${cycle}`,
|
|
49
|
+
description: `Investigate recurring failures in cycle '${cycle}' (${count} in 24h)`,
|
|
50
|
+
utility: Math.min(1, 0.4 + count * 0.05),
|
|
51
|
+
effort: 0.4,
|
|
52
|
+
willVector: { ...DEFAULT_WILL, paranoia: 0.85, safety: 0.85 },
|
|
53
|
+
action: "mneme.supernova.log",
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Goal class B: pre-empt new vaccines when bank too small
|
|
59
|
+
if ((ctx.vaccinesFired ?? 0) > 5 && (ctx.vaccinesFired ?? 0) < 20) {
|
|
60
|
+
goals.push({
|
|
61
|
+
id: "g-vaccine-grow",
|
|
62
|
+
description: "Run gap-scan + auto-synth new vaccines for under-covered strains",
|
|
63
|
+
utility: 0.75,
|
|
64
|
+
effort: 0.3,
|
|
65
|
+
willVector: { ...DEFAULT_WILL, curiosity: 0.9, compounding: 0.9 },
|
|
66
|
+
action: "mneme.antivirus.gap-scan",
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
// Goal class C: idle ticks → curiosity scan
|
|
70
|
+
if ((ctx.idleTicks ?? 0) >= 30) {
|
|
71
|
+
goals.push({
|
|
72
|
+
id: "g-curiosity",
|
|
73
|
+
description: "Idle: explore data-but-no-defense gaps via curiosity scan",
|
|
74
|
+
utility: 0.5,
|
|
75
|
+
effort: 0.2,
|
|
76
|
+
willVector: { ...DEFAULT_WILL, curiosity: 0.95, efficiency: 0.4 },
|
|
77
|
+
action: "mneme.curiosity.scan",
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
// Goal class D: HCI low → repair (high utility, lowest effort + paranoia)
|
|
81
|
+
if (ctx.hci !== undefined && ctx.hci < 75) {
|
|
82
|
+
goals.push({
|
|
83
|
+
id: "g-heal",
|
|
84
|
+
description: `HCI ${ctx.hci}/100 — run selfcheck + repair drifted hooks`,
|
|
85
|
+
utility: 0.96,
|
|
86
|
+
effort: 0.3,
|
|
87
|
+
willVector: { ...DEFAULT_WILL, safety: 0.98, paranoia: 0.92, compounding: 0.9 },
|
|
88
|
+
action: "mneme.selfcheck.run",
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
// Goal class E: token-savings underperforming → tune weights
|
|
92
|
+
if (ctx.tokenSavingsRatio !== undefined && ctx.tokenSavingsRatio < 0.4) {
|
|
93
|
+
goals.push({
|
|
94
|
+
id: "g-token-tune",
|
|
95
|
+
description: `TOKEN-NOVA savings ${(ctx.tokenSavingsRatio * 100).toFixed(1)}% — re-engineer weights`,
|
|
96
|
+
utility: 0.93,
|
|
97
|
+
effort: 0.4,
|
|
98
|
+
willVector: { ...DEFAULT_WILL, efficiency: 0.97, compounding: 0.92 },
|
|
99
|
+
action: "mneme.qx.reengineer",
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// Goal class F: inbox piling up → drain
|
|
103
|
+
if ((ctx.inboxUnsent ?? 0) >= 10) {
|
|
104
|
+
goals.push({
|
|
105
|
+
id: "g-inbox-drain",
|
|
106
|
+
description: `Inbox piling up (${ctx.inboxUnsent} unsent) — drain or escalate`,
|
|
107
|
+
utility: 0.6,
|
|
108
|
+
effort: 0.15,
|
|
109
|
+
willVector: { ...DEFAULT_WILL, efficiency: 0.85 },
|
|
110
|
+
action: "mneme.inbox.drain",
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return goals;
|
|
114
|
+
}
|
|
115
|
+
/** Score + rank goals via the Quantum Core, pick top-K above the floor. */
|
|
116
|
+
export function decideGoals(ctx, opts = {}) {
|
|
117
|
+
const topK = opts.topK ?? 2; // focus: top 2 highest-utility goals only
|
|
118
|
+
const minPosterior = opts.minPosterior ?? 0.15;
|
|
119
|
+
const goals = generateGoals(ctx);
|
|
120
|
+
if (goals.length === 0) {
|
|
121
|
+
return { selected: [], rejected: [], reason: "no goals generated — system at rest" };
|
|
122
|
+
}
|
|
123
|
+
const hyps = goals.map((g) => ({
|
|
124
|
+
id: g.id,
|
|
125
|
+
value: g,
|
|
126
|
+
signals: goalSignals(g),
|
|
127
|
+
}));
|
|
128
|
+
const r = collapseProbabilityMatrix(hyps, {});
|
|
129
|
+
const selected = [];
|
|
130
|
+
const rejected = [];
|
|
131
|
+
for (const h of r.ranked) {
|
|
132
|
+
if (selected.length < topK && h.posterior >= minPosterior)
|
|
133
|
+
selected.push(h.value);
|
|
134
|
+
else
|
|
135
|
+
rejected.push(h.value);
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
selected,
|
|
139
|
+
rejected,
|
|
140
|
+
reason: `picked top-${selected.length} of ${goals.length} (posterior floor ${minPosterior}, verdict ${r.verdict})`,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=soul_engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soul_engine.js","sourceRoot":"","sources":["../../src/qx_supernova/soul_engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,yBAAyB,GAG1B,MAAM,mBAAmB,CAAC;AAkC3B,MAAM,YAAY,GAAe;IAC/B,SAAS,EAAE,GAAG;IACd,MAAM,EAAE,GAAG;IACX,WAAW,EAAE,GAAG;IAChB,UAAU,EAAE,GAAG;IACf,QAAQ,EAAE,GAAG;CACd,CAAC;AAEF,yEAAyE;AACzE,SAAS,WAAW,CAAC,CAAW;IAC9B,yEAAyE;IACzE,OAAO;QACL,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,MA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AC,CAAC,CAAC;IACJ,MAAM,CAAC,GAAG,yBAAyB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAe,EAAE,CAAC;IAChC,MAAM,QAAQ,GAAe,EAAE,CAAC;IAChC,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;QACzB,IAAI,QAAQ,CAAC,MAAM,GAAG,IAAI,IAAI,CAAC,CAAC,SAAS,IAAI,YAAY;YAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;;YAC7E,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,MAAM,EAAE,cAAc,QAAQ,CAAC,MAAM,OAAO,KAAK,CAAC,MAAM,qBAAqB,YAAY,aAAa,CAAC,CAAC,OAAO,GAAG;KACnH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.94.0 -- QX-SUPERNOVA · SuperNova Burst
|
|
3
|
+
* Parallel-fanout intelligence amplification.
|
|
4
|
+
*
|
|
5
|
+
* Premise: instead of running ONE inference, fire N candidates in
|
|
6
|
+
* parallel, then collapse via the Quantum Core. The "1000×" marketing
|
|
7
|
+
* line literalizes as: fanout factor × pruning efficiency × cache hits.
|
|
8
|
+
*
|
|
9
|
+
* Real measured speedup = sequentialEquivalentMs / actualBurstMs.
|
|
10
|
+
*
|
|
11
|
+
* Reported per burst, not promised. No vaporware. If only one generator
|
|
12
|
+
* is given, fanout=1, speedup=1.0.
|
|
13
|
+
*/
|
|
14
|
+
import { type SignalVector, type CollapseResult } from "./quantum_core.js";
|
|
15
|
+
export interface BurstInput<T> {
|
|
16
|
+
/** Each generator yields one candidate result. */
|
|
17
|
+
generators: ReadonlyArray<() => Promise<T>>;
|
|
18
|
+
/** Map a result to its signal vector for collapse. */
|
|
19
|
+
scoreSignal: (result: T) => SignalVector;
|
|
20
|
+
/** Optional per-result prior. Default 1/N. */
|
|
21
|
+
prior?: (result: T) => number;
|
|
22
|
+
/** Per-axis weights for collapse. */
|
|
23
|
+
weights?: Record<string, number>;
|
|
24
|
+
/** Telemetry id for this burst. */
|
|
25
|
+
burstId?: string;
|
|
26
|
+
/** Abort the burst if every generator takes longer than this. */
|
|
27
|
+
timeoutMs?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface BurstResult<T> {
|
|
30
|
+
winner: T | null;
|
|
31
|
+
collapse: CollapseResult<T>;
|
|
32
|
+
fanout: number;
|
|
33
|
+
/** Total wall-clock for the burst (parallel). */
|
|
34
|
+
burstMs: number;
|
|
35
|
+
/** Sum of per-generator wall-clock — what it would have cost serially. */
|
|
36
|
+
sequentialEquivalentMs: number;
|
|
37
|
+
/** sequentialEquivalentMs / burstMs. 1.0 means no benefit. */
|
|
38
|
+
parallelSpeedup: number;
|
|
39
|
+
/** Whether any generator threw. */
|
|
40
|
+
errors: Array<{
|
|
41
|
+
index: number;
|
|
42
|
+
message: string;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
/** Fire N generators in parallel, score each, collapse to a winner.
|
|
46
|
+
* Records per-burst telemetry for the re-engineer loop to consume. */
|
|
47
|
+
export declare function supernovaBurst<T>(input: BurstInput<T>): Promise<BurstResult<T>>;
|
|
48
|
+
//# sourceMappingURL=supernova_burst.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supernova_burst.d.ts","sourceRoot":"","sources":["../../src/qx_supernova/supernova_burst.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,kDAAkD;IAClD,UAAU,EAAE,aAAa,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,sDAAsD;IACtD,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,YAAY,CAAC;IACzC,8CAA8C;IAC9C,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,CAAC;IAC9B,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACjB,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,sBAAsB,EAAE,MAAM,CAAC;IAC/B,8DAA8D;IAC9D,eAAe,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnD;AAED;uEACuE;AACvE,wBAAsB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAgErF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.94.0 -- QX-SUPERNOVA · SuperNova Burst
|
|
3
|
+
* Parallel-fanout intelligence amplification.
|
|
4
|
+
*
|
|
5
|
+
* Premise: instead of running ONE inference, fire N candidates in
|
|
6
|
+
* parallel, then collapse via the Quantum Core. The "1000×" marketing
|
|
7
|
+
* line literalizes as: fanout factor × pruning efficiency × cache hits.
|
|
8
|
+
*
|
|
9
|
+
* Real measured speedup = sequentialEquivalentMs / actualBurstMs.
|
|
10
|
+
*
|
|
11
|
+
* Reported per burst, not promised. No vaporware. If only one generator
|
|
12
|
+
* is given, fanout=1, speedup=1.0.
|
|
13
|
+
*/
|
|
14
|
+
import { collapseProbabilityMatrix, } from "./quantum_core.js";
|
|
15
|
+
/** Fire N generators in parallel, score each, collapse to a winner.
|
|
16
|
+
* Records per-burst telemetry for the re-engineer loop to consume. */
|
|
17
|
+
export async function supernovaBurst(input) {
|
|
18
|
+
const t0 = Date.now();
|
|
19
|
+
const fanout = input.generators.length;
|
|
20
|
+
if (fanout === 0) {
|
|
21
|
+
return {
|
|
22
|
+
winner: null,
|
|
23
|
+
collapse: collapseProbabilityMatrix([], {}),
|
|
24
|
+
fanout: 0,
|
|
25
|
+
burstMs: 0,
|
|
26
|
+
sequentialEquivalentMs: 0,
|
|
27
|
+
parallelSpeedup: 1,
|
|
28
|
+
errors: [],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const errors = [];
|
|
32
|
+
const startTimes = new Array(fanout);
|
|
33
|
+
const endTimes = new Array(fanout);
|
|
34
|
+
const settled = await Promise.all(input.generators.map(async (gen, i) => {
|
|
35
|
+
startTimes[i] = Date.now();
|
|
36
|
+
try {
|
|
37
|
+
const res = await maybeTimeout(gen(), input.timeoutMs);
|
|
38
|
+
endTimes[i] = Date.now();
|
|
39
|
+
return res;
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
endTimes[i] = Date.now();
|
|
43
|
+
errors.push({ index: i, message: e.message });
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
const burstMs = Date.now() - t0;
|
|
48
|
+
let sequentialEquivalentMs = 0;
|
|
49
|
+
for (let i = 0; i < fanout; i++) {
|
|
50
|
+
sequentialEquivalentMs += (endTimes[i] ?? 0) - (startTimes[i] ?? 0);
|
|
51
|
+
}
|
|
52
|
+
const hypotheses = [];
|
|
53
|
+
for (let i = 0; i < settled.length; i++) {
|
|
54
|
+
const result = settled[i];
|
|
55
|
+
if (result === null)
|
|
56
|
+
continue;
|
|
57
|
+
hypotheses.push({
|
|
58
|
+
id: `${input.burstId ?? "burst"}-${i}`,
|
|
59
|
+
value: result,
|
|
60
|
+
prior: input.prior ? input.prior(result) : undefined,
|
|
61
|
+
signals: input.scoreSignal(result),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const collapse = collapseProbabilityMatrix(hypotheses, { weights: input.weights });
|
|
65
|
+
const parallelSpeedup = burstMs > 0 ? sequentialEquivalentMs / burstMs : 1;
|
|
66
|
+
return {
|
|
67
|
+
winner: collapse.winner ? collapse.winner.value : null,
|
|
68
|
+
collapse,
|
|
69
|
+
fanout,
|
|
70
|
+
burstMs,
|
|
71
|
+
sequentialEquivalentMs,
|
|
72
|
+
parallelSpeedup,
|
|
73
|
+
errors,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function maybeTimeout(p, ms) {
|
|
77
|
+
if (!ms || ms <= 0)
|
|
78
|
+
return p;
|
|
79
|
+
return new Promise((resolve, reject) => {
|
|
80
|
+
const t = setTimeout(() => reject(new Error(`burst-timeout-${ms}ms`)), ms);
|
|
81
|
+
p.then((v) => { clearTimeout(t); resolve(v); }, (e) => { clearTimeout(t); reject(e); });
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=supernova_burst.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supernova_burst.js","sourceRoot":"","sources":["../../src/qx_supernova/supernova_burst.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,yBAAyB,GAI1B,MAAM,mBAAmB,CAAC;AA+B3B;uEACuE;AACvE,MAAM,CAAC,KAAK,UAAU,cAAc,CAAI,KAAoB;IAC1D,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACtB,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,M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