@j0hanz/thinkseq-mcp 1.0.4 → 1.1.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/README.md +238 -111
- package/dist/app.d.ts +2 -35
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +13 -91
- package/dist/app.js.map +1 -1
- package/dist/appConfig/runDependencies.d.ts +36 -0
- package/dist/appConfig/runDependencies.d.ts.map +1 -0
- package/dist/appConfig/runDependencies.js +65 -0
- package/dist/appConfig/runDependencies.js.map +1 -0
- package/dist/appConfig/shutdown.d.ts +19 -0
- package/dist/appConfig/shutdown.d.ts.map +1 -0
- package/dist/appConfig/shutdown.js +65 -0
- package/dist/appConfig/shutdown.js.map +1 -0
- package/dist/appConfig/types.d.ts +10 -0
- package/dist/appConfig/types.d.ts.map +1 -0
- package/dist/appConfig/types.js +2 -0
- package/dist/appConfig/types.js.map +1 -0
- package/dist/appConfig.d.ts +5 -0
- package/dist/appConfig.d.ts.map +1 -0
- package/dist/appConfig.js +3 -0
- package/dist/appConfig.js.map +1 -0
- package/dist/engine/pruning.d.ts +3 -0
- package/dist/engine/pruning.d.ts.map +1 -0
- package/dist/engine/pruning.js +11 -0
- package/dist/engine/pruning.js.map +1 -0
- package/dist/engine/revision.d.ts +9 -0
- package/dist/engine/revision.d.ts.map +1 -0
- package/dist/engine/revision.js +38 -0
- package/dist/engine/revision.js.map +1 -0
- package/dist/engine/thoughtQueries.d.ts +3 -0
- package/dist/engine/thoughtQueries.d.ts.map +1 -0
- package/dist/engine/thoughtQueries.js +18 -0
- package/dist/engine/thoughtQueries.js.map +1 -0
- package/dist/engine/thoughtStore.d.ts +22 -0
- package/dist/engine/thoughtStore.d.ts.map +1 -0
- package/dist/engine/thoughtStore.js +151 -0
- package/dist/engine/thoughtStore.js.map +1 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +65 -147
- package/dist/engine.js.map +1 -1
- package/dist/engineConfig.d.ts +11 -0
- package/dist/engineConfig.d.ts.map +1 -0
- package/dist/engineConfig.js +12 -0
- package/dist/engineConfig.js.map +1 -0
- package/dist/index.js +35 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/cli.d.ts +14 -0
- package/dist/lib/cli.d.ts.map +1 -0
- package/dist/lib/cli.js +71 -0
- package/dist/lib/cli.js.map +1 -0
- package/dist/lib/context.d.ts +7 -0
- package/dist/lib/context.d.ts.map +1 -0
- package/dist/lib/context.js +15 -0
- package/dist/lib/context.js.map +1 -0
- package/dist/lib/diagnostics.d.ts +9 -8
- package/dist/lib/diagnostics.d.ts.map +1 -1
- package/dist/lib/diagnostics.js +18 -8
- package/dist/lib/diagnostics.js.map +1 -1
- package/dist/lib/engineWorkerHandler.d.ts +12 -0
- package/dist/lib/engineWorkerHandler.d.ts.map +1 -0
- package/dist/lib/engineWorkerHandler.js +44 -0
- package/dist/lib/engineWorkerHandler.js.map +1 -0
- package/dist/lib/package.d.ts.map +1 -1
- package/dist/lib/package.js +17 -7
- package/dist/lib/package.js.map +1 -1
- package/dist/lib/protocolGuards.d.ts.map +1 -1
- package/dist/lib/protocolGuards.js +8 -5
- package/dist/lib/protocolGuards.js.map +1 -1
- package/dist/lib/stdioGuards.d.ts.map +1 -1
- package/dist/lib/stdioGuards.js +23 -12
- package/dist/lib/stdioGuards.js.map +1 -1
- package/dist/lib/types.d.ts +15 -13
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/workerEngineClient.d.ts +23 -0
- package/dist/lib/workerEngineClient.d.ts.map +1 -0
- package/dist/lib/workerEngineClient.js +144 -0
- package/dist/lib/workerEngineClient.js.map +1 -0
- package/dist/lib/workerProtocol.d.ts +21 -0
- package/dist/lib/workerProtocol.d.ts.map +1 -0
- package/dist/lib/workerProtocol.js +22 -0
- package/dist/lib/workerProtocol.js.map +1 -0
- package/dist/schemas/inputs.d.ts +1 -13
- package/dist/schemas/inputs.d.ts.map +1 -1
- package/dist/schemas/inputs.js +5 -27
- package/dist/schemas/inputs.js.map +1 -1
- package/dist/schemas/outputs.d.ts +14 -16
- package/dist/schemas/outputs.d.ts.map +1 -1
- package/dist/schemas/outputs.js +48 -61
- package/dist/schemas/outputs.js.map +1 -1
- package/dist/tools/thinkseq.d.ts +7 -2
- package/dist/tools/thinkseq.d.ts.map +1 -1
- package/dist/tools/thinkseq.js +71 -59
- package/dist/tools/thinkseq.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/workers/engineWorker.d.ts +2 -0
- package/dist/workers/engineWorker.d.ts.map +1 -0
- package/dist/workers/engineWorker.js +15 -0
- package/dist/workers/engineWorker.js.map +1 -0
- package/package.json +8 -6
package/dist/schemas/outputs.js
CHANGED
|
@@ -1,78 +1,65 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
const
|
|
3
|
-
'analysis',
|
|
4
|
-
'hypothesis',
|
|
5
|
-
'verification',
|
|
6
|
-
'revision',
|
|
7
|
-
'conclusion',
|
|
8
|
-
]);
|
|
9
|
-
const ContextSchema = z.strictObject({
|
|
10
|
-
recentThoughts: z
|
|
11
|
-
.array(z.strictObject({
|
|
12
|
-
number: z.number(),
|
|
13
|
-
preview: z.string(),
|
|
14
|
-
type: ThoughtTypeSchema.optional(),
|
|
15
|
-
}))
|
|
16
|
-
.max(5),
|
|
17
|
-
currentBranch: z.string().optional(),
|
|
18
|
-
hasRevisions: z.boolean(),
|
|
19
|
-
});
|
|
20
|
-
const ResultSchema = z.strictObject({
|
|
2
|
+
const ThinkSeqResultSchema = z.object({
|
|
21
3
|
thoughtNumber: z.number(),
|
|
22
4
|
totalThoughts: z.number(),
|
|
23
|
-
|
|
5
|
+
progress: z.number().min(0).max(1),
|
|
6
|
+
isComplete: z.boolean().describe('True when thoughtNumber >= totalThoughts'),
|
|
24
7
|
thoughtHistoryLength: z.number(),
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
hasRevisions: z.boolean().describe('True if any thought has been revised'),
|
|
9
|
+
activePathLength: z
|
|
10
|
+
.number()
|
|
11
|
+
.describe('Count of non-superseded thoughts in active chain'),
|
|
12
|
+
revisableThoughts: z
|
|
13
|
+
.array(z.number())
|
|
14
|
+
.describe('Thought numbers available for revision'),
|
|
15
|
+
context: z.object({
|
|
16
|
+
recentThoughts: z
|
|
17
|
+
.array(z.object({
|
|
18
|
+
number: z.number(),
|
|
19
|
+
preview: z.string(),
|
|
20
|
+
}))
|
|
21
|
+
.max(5),
|
|
22
|
+
revisionInfo: z
|
|
23
|
+
.object({
|
|
24
|
+
revises: z.number(),
|
|
25
|
+
supersedes: z.array(z.number()),
|
|
26
|
+
})
|
|
27
|
+
.optional(),
|
|
28
|
+
}),
|
|
27
29
|
});
|
|
28
|
-
const
|
|
30
|
+
const ThinkSeqErrorSchema = z.object({
|
|
29
31
|
code: z.string(),
|
|
30
32
|
message: z.string(),
|
|
31
33
|
});
|
|
32
|
-
function addSuccessIssues(value, ctx) {
|
|
33
|
-
if (value.result === undefined) {
|
|
34
|
-
ctx.addIssue({
|
|
35
|
-
code: 'custom',
|
|
36
|
-
message: 'result is required when ok is true',
|
|
37
|
-
path: ['result'],
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
if (value.error !== undefined) {
|
|
41
|
-
ctx.addIssue({
|
|
42
|
-
code: 'custom',
|
|
43
|
-
message: 'error must be omitted when ok is true',
|
|
44
|
-
path: ['error'],
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function addFailureIssues(value, ctx) {
|
|
49
|
-
if (value.error === undefined) {
|
|
50
|
-
ctx.addIssue({
|
|
51
|
-
code: 'custom',
|
|
52
|
-
message: 'error is required when ok is false',
|
|
53
|
-
path: ['error'],
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
if (value.result !== undefined) {
|
|
57
|
-
ctx.addIssue({
|
|
58
|
-
code: 'custom',
|
|
59
|
-
message: 'result must be omitted when ok is false',
|
|
60
|
-
path: ['result'],
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
34
|
export const ThinkSeqOutputSchema = z
|
|
65
|
-
.
|
|
35
|
+
.object({
|
|
66
36
|
ok: z.boolean(),
|
|
67
|
-
result:
|
|
68
|
-
error:
|
|
37
|
+
result: ThinkSeqResultSchema.optional(),
|
|
38
|
+
error: ThinkSeqErrorSchema.optional(),
|
|
69
39
|
})
|
|
70
40
|
.superRefine((value, ctx) => {
|
|
71
41
|
if (value.ok) {
|
|
72
|
-
|
|
42
|
+
if (!value.result) {
|
|
43
|
+
ctx.addIssue({
|
|
44
|
+
code: 'custom',
|
|
45
|
+
path: ['result'],
|
|
46
|
+
message: 'result is required when ok is true',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (value.error) {
|
|
50
|
+
ctx.addIssue({
|
|
51
|
+
code: 'custom',
|
|
52
|
+
path: ['error'],
|
|
53
|
+
message: 'error must be undefined when ok is true',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
73
56
|
}
|
|
74
|
-
else {
|
|
75
|
-
|
|
57
|
+
else if (!value.error) {
|
|
58
|
+
ctx.addIssue({
|
|
59
|
+
code: 'custom',
|
|
60
|
+
path: ['error'],
|
|
61
|
+
message: 'error is required when ok is false',
|
|
62
|
+
});
|
|
76
63
|
}
|
|
77
64
|
});
|
|
78
65
|
//# sourceMappingURL=outputs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputs.js","sourceRoot":"","sources":["../../src/schemas/outputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,
|
|
1
|
+
{"version":3,"file":"outputs.js","sourceRoot":"","sources":["../../src/schemas/outputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,aAAa,EAAE,CAAC,C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B,CAAC,QAAQ,EAAE;IACvC,KAAK,EAAE,mBAAmB,CAAC,QAAQ,EAAE;CACtC,CAAC;KACD,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC1B,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC;QACb,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAClB,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,QAAQ,CAAC;gBAChB,OAAO,EAAE,oCAAoC;aAC9C,CAAC,CAAC;QACL,CAAC;QACD,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAChB,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,OAAO,CAAC;gBACf,OAAO,EAAE,yCAAyC;aACnD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;SAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACxB,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,OAAO,CAAC;YACf,OAAO,EAAE,oCAAoC;SAC9C,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/dist/tools/thinkseq.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { ThinkingEngine } from '../engine.js';
|
|
3
|
-
type
|
|
4
|
-
|
|
3
|
+
import type { ThoughtData } from '../lib/types.js';
|
|
4
|
+
interface ToolRegistrar {
|
|
5
|
+
registerTool: McpServer['registerTool'];
|
|
6
|
+
}
|
|
7
|
+
interface EngineLike {
|
|
8
|
+
processThought: (input: ThoughtData) => ReturnType<ThinkingEngine['processThought']> | Promise<ReturnType<ThinkingEngine['processThought']>>;
|
|
9
|
+
}
|
|
5
10
|
export declare function registerThinkSeq(server: ToolRegistrar, engine: EngineLike): void;
|
|
6
11
|
export {};
|
|
7
12
|
//# sourceMappingURL=thinkseq.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thinkseq.d.ts","sourceRoot":"","sources":["../../src/tools/thinkseq.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"thinkseq.d.ts","sourceRoot":"","sources":["../../src/tools/thinkseq.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAKnD,OAAO,KAAK,EAAiB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAiBlE,UAAU,aAAa;IACrB,YAAY,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;CACzC;AAED,UAAU,UAAU;IAClB,cAAc,EAAE,CACd,KAAK,EAAE,WAAW,KAEhB,UAAU,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,GAC5C,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;CAC3D;AA+FD,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,UAAU,GACjB,IAAI,CAIN"}
|
package/dist/tools/thinkseq.js
CHANGED
|
@@ -1,84 +1,96 @@
|
|
|
1
|
+
import { performance } from 'node:perf_hooks';
|
|
2
|
+
import { runWithContext } from '../lib/context.js';
|
|
1
3
|
import { publishToolEvent } from '../lib/diagnostics.js';
|
|
2
4
|
import { createErrorResponse, getErrorMessage } from '../lib/errors.js';
|
|
3
5
|
import { ThinkSeqInputSchema } from '../schemas/inputs.js';
|
|
4
6
|
import { ThinkSeqOutputSchema } from '../schemas/outputs.js';
|
|
5
7
|
const THINKSEQ_TOOL_DEFINITION = {
|
|
6
8
|
title: 'Think Sequentially',
|
|
7
|
-
description: `
|
|
9
|
+
description: `Record a concise thinking step (max 2000 chars). Be brief: capture only the essential insight, calculation, or decision.
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
- Breaking down complex problems into steps
|
|
11
|
-
- Exploring alternative solution paths (branching)
|
|
12
|
-
- Revising earlier thinking based on new insights
|
|
11
|
+
REVISION: If you realize an earlier step was wrong or want to try a different approach, use \`revisesThought\` to correct it. Both versions are preserved for audit.
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- totalThoughts: Estimated total (adjustable)
|
|
18
|
-
- nextThoughtNeeded: false only when done`,
|
|
13
|
+
Example: { "thought": "Better approach: use caching", "revisesThought": 3 }
|
|
14
|
+
|
|
15
|
+
Returns: thoughtNumber, progress (0-1), isComplete, revisableThoughts, and recent thought previews.`,
|
|
19
16
|
inputSchema: ThinkSeqInputSchema,
|
|
20
17
|
outputSchema: ThinkSeqOutputSchema,
|
|
21
18
|
};
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
...(input.thoughtType !== undefined && { thoughtType: input.thoughtType }),
|
|
29
|
-
};
|
|
19
|
+
function publishToolStart() {
|
|
20
|
+
publishToolEvent({
|
|
21
|
+
type: 'tool.start',
|
|
22
|
+
tool: 'thinkseq',
|
|
23
|
+
ts: Date.now(),
|
|
24
|
+
});
|
|
30
25
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
function publishToolSuccess(durationMs) {
|
|
27
|
+
publishToolEvent({
|
|
28
|
+
type: 'tool.end',
|
|
29
|
+
tool: 'thinkseq',
|
|
30
|
+
ts: Date.now(),
|
|
31
|
+
ok: true,
|
|
32
|
+
durationMs,
|
|
33
|
+
});
|
|
38
34
|
}
|
|
39
|
-
function
|
|
35
|
+
function publishToolFailure(errorMessage, durationMs) {
|
|
36
|
+
publishToolEvent({
|
|
37
|
+
type: 'tool.end',
|
|
38
|
+
tool: 'thinkseq',
|
|
39
|
+
ts: Date.now(),
|
|
40
|
+
ok: false,
|
|
41
|
+
errorCode: 'E_THINK',
|
|
42
|
+
errorMessage,
|
|
43
|
+
durationMs,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function buildSuccessResponse(result) {
|
|
47
|
+
if (!result.ok) {
|
|
48
|
+
return createErrorResponse(result.error.code, result.error.message);
|
|
49
|
+
}
|
|
50
|
+
const structured = {
|
|
51
|
+
ok: true,
|
|
52
|
+
result: {
|
|
53
|
+
...result.result,
|
|
54
|
+
context: {
|
|
55
|
+
...result.result.context,
|
|
56
|
+
recentThoughts: [...result.result.context.recentThoughts],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
40
60
|
return {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
totalThoughts: input.totalThoughts,
|
|
44
|
-
nextThoughtNeeded: input.nextThoughtNeeded,
|
|
45
|
-
...getContextFields(input),
|
|
46
|
-
...getBranchFields(input),
|
|
61
|
+
content: [{ type: 'text', text: JSON.stringify(structured) }],
|
|
62
|
+
structuredContent: structured,
|
|
47
63
|
};
|
|
48
64
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
function getDurationMs(start) {
|
|
66
|
+
return Math.max(0, performance.now() - start);
|
|
67
|
+
}
|
|
68
|
+
async function handleThinkSeq(engine, input) {
|
|
69
|
+
return runWithContext(async () => {
|
|
70
|
+
const normalized = {
|
|
71
|
+
thought: input.thought,
|
|
72
|
+
totalThoughts: input.totalThoughts,
|
|
73
|
+
...(input.revisesThought !== undefined && {
|
|
74
|
+
revisesThought: input.revisesThought,
|
|
75
|
+
}),
|
|
76
|
+
};
|
|
77
|
+
publishToolStart();
|
|
78
|
+
const start = performance.now();
|
|
57
79
|
try {
|
|
58
|
-
const result = engine.processThought(normalized);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
ts: Date.now(),
|
|
63
|
-
ok: true,
|
|
64
|
-
});
|
|
65
|
-
return {
|
|
66
|
-
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
67
|
-
structuredContent: result,
|
|
68
|
-
};
|
|
80
|
+
const result = await engine.processThought(normalized);
|
|
81
|
+
const durationMs = getDurationMs(start);
|
|
82
|
+
publishToolSuccess(durationMs);
|
|
83
|
+
return buildSuccessResponse(result);
|
|
69
84
|
}
|
|
70
85
|
catch (err) {
|
|
71
86
|
const errorMessage = getErrorMessage(err);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
tool: 'thinkseq',
|
|
75
|
-
ts: Date.now(),
|
|
76
|
-
ok: false,
|
|
77
|
-
errorCode: 'E_THINK',
|
|
78
|
-
errorMessage,
|
|
79
|
-
});
|
|
87
|
+
const durationMs = getDurationMs(start);
|
|
88
|
+
publishToolFailure(errorMessage, durationMs);
|
|
80
89
|
return createErrorResponse('E_THINK', errorMessage);
|
|
81
90
|
}
|
|
82
91
|
});
|
|
83
92
|
}
|
|
93
|
+
export function registerThinkSeq(server, engine) {
|
|
94
|
+
server.registerTool('thinkseq', THINKSEQ_TOOL_DEFINITION, (input) => handleThinkSeq(engine, input));
|
|
95
|
+
}
|
|
84
96
|
//# sourceMappingURL=thinkseq.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thinkseq.js","sourceRoot":"","sources":["../../src/tools/thinkseq.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"thinkseq.js","sourceRoot":"","sources":["../../src/tools/thinkseq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM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