jig-console 0.0.0-stage → 0.1.1

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 (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -2
  3. package/dist/commands/config.d.ts +8 -0
  4. package/dist/commands/config.d.ts.map +1 -0
  5. package/dist/commands/config.js +224 -0
  6. package/dist/commands/config.js.map +1 -0
  7. package/dist/commands/convert.d.ts +10 -0
  8. package/dist/commands/convert.d.ts.map +1 -0
  9. package/dist/commands/convert.js +40 -0
  10. package/dist/commands/convert.js.map +1 -0
  11. package/dist/commands/history.d.ts +8 -0
  12. package/dist/commands/history.d.ts.map +1 -0
  13. package/dist/commands/history.js +112 -0
  14. package/dist/commands/history.js.map +1 -0
  15. package/dist/commands/init.d.ts +7 -0
  16. package/dist/commands/init.d.ts.map +1 -0
  17. package/dist/commands/init.js +225 -0
  18. package/dist/commands/init.js.map +1 -0
  19. package/dist/commands/pipeline.d.ts +17 -0
  20. package/dist/commands/pipeline.d.ts.map +1 -0
  21. package/dist/commands/pipeline.js +137 -0
  22. package/dist/commands/pipeline.js.map +1 -0
  23. package/dist/commands/play.d.ts +13 -0
  24. package/dist/commands/play.d.ts.map +1 -0
  25. package/dist/commands/play.js +109 -0
  26. package/dist/commands/play.js.map +1 -0
  27. package/dist/commands/providers.d.ts +17 -0
  28. package/dist/commands/providers.d.ts.map +1 -0
  29. package/dist/commands/providers.js +161 -0
  30. package/dist/commands/providers.js.map +1 -0
  31. package/dist/commands/recipes.d.ts +16 -0
  32. package/dist/commands/recipes.d.ts.map +1 -0
  33. package/dist/commands/recipes.js +135 -0
  34. package/dist/commands/recipes.js.map +1 -0
  35. package/dist/commands/replay.d.ts +40 -0
  36. package/dist/commands/replay.d.ts.map +1 -0
  37. package/dist/commands/replay.js +206 -0
  38. package/dist/commands/replay.js.map +1 -0
  39. package/dist/commands/run.d.ts +3 -0
  40. package/dist/commands/run.d.ts.map +1 -0
  41. package/dist/commands/run.js +14 -0
  42. package/dist/commands/run.js.map +1 -0
  43. package/dist/commands/show.d.ts +15 -0
  44. package/dist/commands/show.d.ts.map +1 -0
  45. package/dist/commands/show.js +39 -0
  46. package/dist/commands/show.js.map +1 -0
  47. package/dist/commands/status.d.ts +6 -0
  48. package/dist/commands/status.d.ts.map +1 -0
  49. package/dist/commands/status.js +77 -0
  50. package/dist/commands/status.js.map +1 -0
  51. package/dist/commands/validate.d.ts +6 -0
  52. package/dist/commands/validate.d.ts.map +1 -0
  53. package/dist/commands/validate.js +36 -0
  54. package/dist/commands/validate.js.map +1 -0
  55. package/dist/help/jig-help.d.ts +25 -0
  56. package/dist/help/jig-help.d.ts.map +1 -0
  57. package/dist/help/jig-help.js +147 -0
  58. package/dist/help/jig-help.js.map +1 -0
  59. package/dist/index.d.ts +3 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +216 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/keys.d.ts +14 -0
  64. package/dist/keys.d.ts.map +1 -0
  65. package/dist/keys.js +68 -0
  66. package/dist/keys.js.map +1 -0
  67. package/dist/live-view.d.ts +90 -0
  68. package/dist/live-view.d.ts.map +1 -0
  69. package/dist/live-view.js +239 -0
  70. package/dist/live-view.js.map +1 -0
  71. package/dist/permissions.d.ts +40 -0
  72. package/dist/permissions.d.ts.map +1 -0
  73. package/dist/permissions.js +88 -0
  74. package/dist/permissions.js.map +1 -0
  75. package/dist/providers.d.ts +68 -0
  76. package/dist/providers.d.ts.map +1 -0
  77. package/dist/providers.js +230 -0
  78. package/dist/providers.js.map +1 -0
  79. package/dist/session/app.d.ts +28 -0
  80. package/dist/session/app.d.ts.map +1 -0
  81. package/dist/session/app.js +458 -0
  82. package/dist/session/app.js.map +1 -0
  83. package/dist/session/ascii.d.ts +5 -0
  84. package/dist/session/ascii.d.ts.map +1 -0
  85. package/dist/session/ascii.js +39 -0
  86. package/dist/session/ascii.js.map +1 -0
  87. package/dist/session/commands.d.ts +26 -0
  88. package/dist/session/commands.d.ts.map +1 -0
  89. package/dist/session/commands.js +828 -0
  90. package/dist/session/commands.js.map +1 -0
  91. package/dist/session/controller.d.ts +291 -0
  92. package/dist/session/controller.d.ts.map +1 -0
  93. package/dist/session/controller.js +779 -0
  94. package/dist/session/controller.js.map +1 -0
  95. package/dist/session/editor.d.ts +60 -0
  96. package/dist/session/editor.d.ts.map +1 -0
  97. package/dist/session/editor.js +128 -0
  98. package/dist/session/editor.js.map +1 -0
  99. package/dist/session/jig-theme.json +1 -0
  100. package/dist/session/keys.d.ts +26 -0
  101. package/dist/session/keys.d.ts.map +1 -0
  102. package/dist/session/keys.js +95 -0
  103. package/dist/session/keys.js.map +1 -0
  104. package/dist/session/lines.d.ts +65 -0
  105. package/dist/session/lines.d.ts.map +1 -0
  106. package/dist/session/lines.js +370 -0
  107. package/dist/session/lines.js.map +1 -0
  108. package/dist/session/markdown.d.ts +13 -0
  109. package/dist/session/markdown.d.ts.map +1 -0
  110. package/dist/session/markdown.js +188 -0
  111. package/dist/session/markdown.js.map +1 -0
  112. package/dist/session/models.d.ts +24 -0
  113. package/dist/session/models.d.ts.map +1 -0
  114. package/dist/session/models.js +17 -0
  115. package/dist/session/models.js.map +1 -0
  116. package/dist/session/start.d.ts +27 -0
  117. package/dist/session/start.d.ts.map +1 -0
  118. package/dist/session/start.js +140 -0
  119. package/dist/session/start.js.map +1 -0
  120. package/dist/session/theme.d.ts +137 -0
  121. package/dist/session/theme.d.ts.map +1 -0
  122. package/dist/session/theme.js +129 -0
  123. package/dist/session/theme.js.map +1 -0
  124. package/dist/session-runner.d.ts +107 -0
  125. package/dist/session-runner.d.ts.map +1 -0
  126. package/dist/session-runner.js +463 -0
  127. package/dist/session-runner.js.map +1 -0
  128. package/dist/terminal-width.d.ts +7 -0
  129. package/dist/terminal-width.d.ts.map +1 -0
  130. package/dist/terminal-width.js +45 -0
  131. package/dist/terminal-width.js.map +1 -0
  132. package/dist/topology-arg.d.ts +12 -0
  133. package/dist/topology-arg.d.ts.map +1 -0
  134. package/dist/topology-arg.js +26 -0
  135. package/dist/topology-arg.js.map +1 -0
  136. package/docs/jig-help.md +70 -0
  137. package/package.json +73 -4
@@ -0,0 +1,129 @@
1
+ // ============================================
2
+ // Jig's identity in the terminal, as data
3
+ // ============================================
4
+ // Jig is a small topology that dances: three equal round nodes and three
5
+ // straight edges, symmetric at rest, drawn in quadrant blocks. Every
6
+ // deformation is elastic and returns to rest; a missing edge is a state (the
7
+ // base snaps on a failed check, an edge is let go while it waits for you, an
8
+ // edge stretches on a way back). The frames are the design's own, in
9
+ // jig-theme.json; this module only reads them. Swapping the design is a
10
+ // change to these two files alone.
11
+ //
12
+ // Every cell carries one of the grid's Meaning tokens as a letter, so the one
13
+ // style table below draws the logo, the character, the indicators and the
14
+ // topology alike: colour means a run's state and nothing else (CONCEPT.md,
15
+ // section 7), --plain drops every style, 16 colours and light themes follow
16
+ // the terminal's own palette, and each frame has an ASCII twin.
17
+ import data from "./jig-theme.json" with { type: "json" };
18
+ export const poseOf = (state) => (state === "consulting" ? "consult" : state);
19
+ const d = data;
20
+ export const theme = {
21
+ name: d.name,
22
+ tagline: "joint inference graph",
23
+ /** What a jig is, for the lore and the text; it is never drawn. */
24
+ story: d.story,
25
+ clockMs: d.clockMs,
26
+ /** Each cell letter and the Meaning it stands for. */
27
+ cellMeanings: d.cellMeanings,
28
+ /** The graph at rest in two cells. */
29
+ mark: d.mark,
30
+ /** The logo at rest: large (14 by 7) and medium (9 by 4). */
31
+ logo: d.logo,
32
+ /** The startup animation, 18 by 9, about 1.9 seconds. */
33
+ startup: d.startup,
34
+ /** The character's poses, large (18 by 9) and medium (9 by 4, the session's header). */
35
+ character: d.character,
36
+ indicators: d.indicators,
37
+ prompt: { unicode: "›", ascii: ">" },
38
+ cursor: { unicode: "▐", ascii: "_" },
39
+ /** How each Meaning is drawn: colour for a run's state only. */
40
+ styles: {
41
+ "": {},
42
+ ln: { dim: true },
43
+ ink: {},
44
+ dim: { dim: true },
45
+ faint: { color: "gray" },
46
+ b: { bold: true },
47
+ run: { color: "green", bold: true },
48
+ pass: { bold: true },
49
+ fail: { color: "red" },
50
+ you: { color: "yellow" },
51
+ },
52
+ };
53
+ /** The Meaning a cell's letter stands for; a space is unstyled. */
54
+ export const cellMeaning = (letter) => (theme.cellMeanings[letter] ?? "");
55
+ /** A row of text and its Meaning letters as segments, one per run of cells with one meaning. */
56
+ export function cells(text, meanings) {
57
+ const chars = [...text];
58
+ const letters = [...meanings];
59
+ const out = [];
60
+ chars.forEach((ch, i) => {
61
+ const k = ch === " " ? "" : cellMeaning(letters[i] ?? " ");
62
+ const last = out[out.length - 1];
63
+ if (last && last[1] === k)
64
+ last[0] += ch;
65
+ else
66
+ out.push([ch, k]);
67
+ });
68
+ return out;
69
+ }
70
+ /** The frame of a sequence at a time since it began: looped, or held on its last frame once played. */
71
+ function frameAt(frames, elapsed, loop, clock = theme.clockMs) {
72
+ const lengths = frames.map((f) => (f.ms > 0 ? f.ms : clock));
73
+ const total = lengths.reduce((n, x) => n + x, 0);
74
+ if (!loop && elapsed >= total)
75
+ return { frame: frames[frames.length - 1], done: true };
76
+ let t = loop && total > 0 ? ((elapsed % total) + total) % total : Math.max(0, elapsed);
77
+ for (let i = 0; i < frames.length; i++) {
78
+ if (t < lengths[i])
79
+ return { frame: frames[i], done: false };
80
+ t -= lengths[i];
81
+ }
82
+ return { frame: frames[frames.length - 1], done: !loop };
83
+ }
84
+ /** An indicator's three cells at a time since its state began; a one-shot holds its settle frame. */
85
+ export function indicatorCells(state, elapsed, ascii) {
86
+ const ind = theme.indicators[state];
87
+ const { frame, done } = frameAt(ind.frames, elapsed, ind.loop);
88
+ if (done && ind.settle) {
89
+ // A settle mark sits at the right of the indicator's cells, one space before the words, at the same width.
90
+ const text = (ascii ? (ind.asciiSettle ?? ind.settle.unicode) : ind.settle.unicode).trimEnd();
91
+ const letters = ind.settle.meanings.trimEnd();
92
+ const n = [...text].length;
93
+ if (n >= ind.width)
94
+ return cells([...text].slice(0, ind.width).join(""), letters.padEnd(ind.width, letters.slice(-1) || " "));
95
+ const pad = ind.width - 1 - n;
96
+ return cells(`${" ".repeat(pad)}${text} `, `${" ".repeat(pad)}${letters.padEnd(n, letters.slice(-1) || " ")} `);
97
+ }
98
+ // The ASCII twin keeps its own timing; its cells take the meanings of the frame shown at the same moment.
99
+ return cells(ascii ? frameAt(ind.ascii, elapsed, ind.loop).frame.text : frame.unicode, frame.meanings);
100
+ }
101
+ /** An indicator's frame as plain text (no meanings), for a place that draws one character set. */
102
+ export function indicatorText(state, elapsed, ascii) {
103
+ return indicatorCells(state, elapsed, ascii)
104
+ .map(([t]) => t)
105
+ .join("");
106
+ }
107
+ /** The character in a pose at a time since the pose began, as rows of segments. */
108
+ export function poseRows(size, pose, elapsed, ascii) {
109
+ const p = theme.character[size].poses[pose];
110
+ const { frame } = frameAt(p.frames, elapsed, p.loop);
111
+ return frame.unicode.map((row, i) => cells(ascii ? (frame.ascii[i] ?? "") : row, frame.meanings[i] ?? ""));
112
+ }
113
+ /** The startup frame at a time since it began, and whether it has played through. */
114
+ export function startupRows(elapsed, ascii) {
115
+ const { frame, done } = frameAt(theme.startup.frames, elapsed, false);
116
+ return { rows: frame.unicode.map((row, i) => cells(ascii ? (frame.ascii[i] ?? "") : row, frame.meanings[i] ?? "")), done };
117
+ }
118
+ /** How long the startup plays, in milliseconds. */
119
+ export const startupMs = () => theme.startup.frames.reduce((n, f) => n + (f.ms > 0 ? f.ms : theme.clockMs), 0);
120
+ /** The logo at rest, as rows of segments. */
121
+ export function logoRows(size, ascii) {
122
+ const l = theme.logo[size];
123
+ return l.unicode.map((row, i) => cells(ascii ? (l.ascii[i] ?? "") : row, l.meanings[i] ?? ""));
124
+ }
125
+ /** The one-line mark (the graph at rest in two cells), dim when idle. */
126
+ export const markCells = (ascii, meaning = "dim") => [[ascii ? theme.mark.ascii : theme.mark.unicode, meaning]];
127
+ /** The two cells a role's box turns through while it works: the working indicator's, trimmed. */
128
+ export const workingSpin = (elapsed, ascii) => indicatorText("working", elapsed, ascii).trimEnd() || (ascii ? "*" : "▞▚");
129
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/session/theme.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,0CAA0C;AAC1C,+CAA+C;AAC/C,yEAAyE;AACzE,qEAAqE;AACrE,6EAA6E;AAC7E,6EAA6E;AAC7E,qEAAqE;AACrE,wEAAwE;AACxE,mCAAmC;AACnC,EAAE;AACF,8EAA8E;AAC9E,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,gEAAgE;AAGhE,OAAO,IAAI,MAAM,kBAAkB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AA8D1D,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAqB,EAAQ,EAAE,CAAC,CAAC,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAoBpG,MAAM,CAAC,GAAG,IAA4B,CAAC;AAEvC,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,CAAC,CAAC,IAAI;IACZ,OAAO,EAAE,uBAAuB;IAChC,mEAAmE;IACnE,KAAK,EAAE,CAAC,CAAC,KAAK;IACd,OAAO,EAAE,CAAC,CAAC,OAAO;IAClB,sDAAsD;IACtD,YAAY,EAAE,CAAC,CAAC,YAAuC;IACvD,sCAAsC;IACtC,IAAI,EAAE,CAAC,CAAC,IAAI;IACZ,6DAA6D;IAC7D,IAAI,EAAE,CAAC,CAAC,IAAI;IACZ,yDAAyD;IACzD,OAAO,EAAE,CAAC,CAAC,OAAO;IAClB,wFAAwF;IACxF,SAAS,EAAE,CAAC,CAAC,SAAS;IACtB,UAAU,EAAE,CAAC,CAAC,UAAU;IACxB,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAA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AE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AACjG,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAc,EAAE,UAAmB,KAAK,EAAY,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAE5I,iGAAiG;AACjG,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAe,EAAE,KAAc,EAAU,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,107 @@
1
+ import { AgentSession, type AgentRunResult, type LLMProvider, type Storage, type Topology } from "jig-core";
2
+ import { LiveView, type LiveViewOptions } from "./live-view.js";
3
+ export interface TopologyRunOptions {
4
+ topology?: string;
5
+ task?: string;
6
+ prompt?: string;
7
+ plan?: string;
8
+ specs?: string;
9
+ provider?: string;
10
+ model?: string;
11
+ dir?: string;
12
+ iterations?: string;
13
+ delay?: string;
14
+ temperature?: string;
15
+ maxTokens?: string;
16
+ tools?: string;
17
+ param?: string[];
18
+ json?: boolean;
19
+ verbose?: boolean;
20
+ /** A task with its checks, as JSON. */
21
+ taskFile?: string;
22
+ /** Commands the lab runs after the run; each passes when it exits 0. */
23
+ check?: string[];
24
+ /** Files the checks depend on. */
25
+ checkFile?: string[];
26
+ verdictFrom?: string;
27
+ tokenBudget?: string;
28
+ memoryScope?: string;
29
+ /** Draw the run live on the topology's grid (default: in a terminal, unless --json or --verbose). */
30
+ live?: boolean;
31
+ /** Also write every frame of the live view to this file (plain), and its ANSI to <file>.ansi. */
32
+ frames?: string;
33
+ /** Write every frame drawn, clock ticks included, as JSON lines with its time (for a recording). */
34
+ record?: string;
35
+ /** No colour. */
36
+ plain?: boolean;
37
+ /** Columns to draw for (default: the terminal's, or 120). */
38
+ width?: string;
39
+ layout?: string;
40
+ /** default, acceptEdits or plan; nobody is there to ask, so what would ask is denied. */
41
+ permissionMode?: string;
42
+ /** Bypass for this run only, except deny rules, ask rules and dangerous removals (which are denied: nobody to ask). */
43
+ dangerouslySkipPermissions?: boolean;
44
+ addDir?: string[];
45
+ /** Rules for this run only, as Shell(npm test *) or Write(src/**). */
46
+ allow?: string[];
47
+ deny?: string[];
48
+ }
49
+ export interface RunnerIO {
50
+ /** Where events and the summary go (stdout by default). */
51
+ out: (line: string) => void;
52
+ /** Where progress notes go (stderr by default, so --json stays clean). */
53
+ note: (line: string) => void;
54
+ /** Raw text, for the live view's redraws (stdout by default). */
55
+ write?: (text: string) => void;
56
+ /** Whether out is a terminal, and its size. */
57
+ tty?: {
58
+ columns: number;
59
+ rows: number;
60
+ };
61
+ }
62
+ export interface RunnerDeps {
63
+ /** Use this provider instead of building one from the configuration. */
64
+ provider?: LLMProvider;
65
+ /** Use this storage (null for none) instead of the configured one. */
66
+ storage?: Storage | null;
67
+ /** Install the Ctrl+C handler (default true). */
68
+ handleSignals?: boolean;
69
+ /** Called with the session once it exists, before it runs. */
70
+ onSession?: (session: AgentSession) => void;
71
+ /** Skip a Check with nothing to verify (default true, as jig runs); a test of other plumbing turns it off. */
72
+ skipUnverifiable?: boolean;
73
+ }
74
+ export declare const defaultIO: RunnerIO;
75
+ /** Parse repeated --param key=value options, with numbers and booleans typed. */
76
+ export declare function parseParams(pairs?: string[]): Record<string, unknown>;
77
+ /** Keep a result the `history` command can list. */
78
+ export declare function saveHistory(workingDir: string, run: AgentRunResult, options: TopologyRunOptions, providerName: string, model: string): Promise<void>;
79
+ export interface ViewOptions {
80
+ frames?: string;
81
+ record?: string;
82
+ plain?: boolean;
83
+ width?: string;
84
+ layout?: string;
85
+ }
86
+ /**
87
+ * Whether the live view draws in ASCII: asked for (JIG_ASCII, a console known to lack the glyphs), or a
88
+ * terminal that draws ambiguous characters two cells wide, which would push every box border out of line.
89
+ */
90
+ export declare function asciiView(io: RunnerIO): Promise<boolean>;
91
+ /** The live view, on screen or only into a frames file: a run, a dry run, or a replay. */
92
+ export declare function liveView(topology: Topology, source: string, model: string, options: ViewOptions, io: RunnerIO, onScreen: boolean, extra?: Partial<LiveViewOptions>, ascii?: boolean): LiveView;
93
+ /**
94
+ * The command as typed, for the footer, a path shortened to its file's name.
95
+ * When the process is not the CLI (a test, a script), the command is rebuilt
96
+ * from the words given instead.
97
+ */
98
+ export declare function commandLine(fallback: string[], argv?: string[]): string;
99
+ /** Keep the view's size with the terminal's. */
100
+ export declare function followResize(view: LiveView, io: RunnerIO): () => void;
101
+ /** The run's steps, kept beside its history when its storage does not outlive the process. */
102
+ export declare function saveLocalRecord(workingDir: string, run: AgentRunResult, info: Record<string, unknown>): Promise<void>;
103
+ /** Run a topology from the CLI. Throws on configuration errors; returns the run otherwise. */
104
+ export declare function runTopology(options: TopologyRunOptions, io?: RunnerIO, deps?: RunnerDeps): Promise<AgentRunResult>;
105
+ /** Commander action: run, print, and exit non-zero unless the run passed. */
106
+ export declare function runTopologyCommand(options: TopologyRunOptions): Promise<void>;
107
+ //# sourceMappingURL=session-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-runner.d.ts","sourceRoot":"","sources":["../src/session-runner.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,YAAY,EAUZ,KAAK,cAAc,EACnB,KAAK,WAAW,EAGhB,KAAK,OAAO,EACZ,KAAK,QAAQ,EAMd,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,QAAQ,EAAE,KA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