@miadi/inquiry-weave 0.8.3 → 0.9.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 +14 -0
- package/dist/attention.d.ts +75 -0
- package/dist/attention.d.ts.map +1 -0
- package/dist/attention.js +356 -0
- package/dist/attention.js.map +1 -0
- package/dist/closing.d.ts +60 -0
- package/dist/closing.d.ts.map +1 -0
- package/dist/closing.js +199 -0
- package/dist/closing.js.map +1 -0
- package/dist/git-landing.d.ts +119 -0
- package/dist/git-landing.d.ts.map +1 -0
- package/dist/git-landing.js +280 -0
- package/dist/git-landing.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.d.ts +13 -3
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +326 -4
- package/dist/mcp-server.js.map +1 -1
- package/dist/mint.d.ts +243 -0
- package/dist/mint.d.ts.map +1 -0
- package/dist/mint.js +743 -0
- package/dist/mint.js.map +1 -0
- package/dist/skill.js +1 -1
- package/package.json +1 -1
- package/rispecs/README.rise.md +5 -0
- package/rispecs/RISPEC.md +9 -0
package/dist/closing.js
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The five-stage closing gate for one Chronicle vessel — created, committed,
|
|
3
|
+
* pushed, registered, receipt-verified — each proven by running its probe and
|
|
4
|
+
* reporting what the command ACTUALLY said.
|
|
5
|
+
*
|
|
6
|
+
* Mirrored from packages/voice-mcp/src/closing.ts (proveClosing), probe for
|
|
7
|
+
* probe and drift name for drift name, because that package cannot be imported
|
|
8
|
+
* here (it is a consumer of this one and carries the voice stack). One
|
|
9
|
+
* deliberate difference: William's word of 2026-09-04 gives stages 2 and 3
|
|
10
|
+
* (committed, pushed) to the API, so the owed actions name the door's verb
|
|
11
|
+
* before the raw git commands. voice-mcp's copy is the coordinator's to retire.
|
|
12
|
+
*
|
|
13
|
+
* Ref: jgwill/Miadi#621.
|
|
14
|
+
*/
|
|
15
|
+
import { access, readFile } from "node:fs/promises";
|
|
16
|
+
import { basename, join, relative } from "node:path";
|
|
17
|
+
import { observeGit } from "./git-landing.js";
|
|
18
|
+
/** The retired ceremony wheel. A card registered there is lost; refuse the host. */
|
|
19
|
+
export const POISONED_WHEEL_HOST = "tail3b11eb";
|
|
20
|
+
export const WHEEL_PROBE_TIMEOUT_MS = 5_000;
|
|
21
|
+
export class RefusedWheelError extends Error {
|
|
22
|
+
constructor(url) {
|
|
23
|
+
super(`refusing wheel ${url}: that host is Gaia's ceremony wheel, offline since 2026-07-29 — ` +
|
|
24
|
+
`a Chronicle episode registered there is lost. The chronicle wheel is http://127.0.0.1:8040.`);
|
|
25
|
+
this.name = "RefusedWheelError";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function refusePoisonedWheel(wheelUrl) {
|
|
29
|
+
if (wheelUrl.includes(POISONED_WHEEL_HOST))
|
|
30
|
+
throw new RefusedWheelError(wheelUrl);
|
|
31
|
+
}
|
|
32
|
+
export const MW_RECEIPT_BASENAME = ".mw-registration.json";
|
|
33
|
+
/** GET the episode card off the wheel. `null` means the wheel did not answer at all. */
|
|
34
|
+
export async function readWheelCard(wheelUrl, nodeId, fetchImpl = fetch) {
|
|
35
|
+
const url = `${wheelUrl.replace(/\/+$/, "")}/api/nodes/${nodeId}`;
|
|
36
|
+
const controller = new AbortController();
|
|
37
|
+
const timer = setTimeout(() => controller.abort(), WHEEL_PROBE_TIMEOUT_MS);
|
|
38
|
+
try {
|
|
39
|
+
const response = await fetchImpl(url, { signal: controller.signal });
|
|
40
|
+
return { status: response.status, observed: `HTTP ${response.status} from ${url}` };
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
return {
|
|
44
|
+
status: null,
|
|
45
|
+
observed: `wheel unreachable at ${url}: ${error instanceof Error ? error.message : String(error)}`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
clearTimeout(timer);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function readReceipt(receiptPath) {
|
|
53
|
+
let text;
|
|
54
|
+
try {
|
|
55
|
+
text = await readFile(receiptPath, "utf8");
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return { exists: false, observed: `no receipt at ${receiptPath}` };
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
const parsed = JSON.parse(text);
|
|
62
|
+
return {
|
|
63
|
+
exists: true,
|
|
64
|
+
state: parsed.state,
|
|
65
|
+
url: parsed.url,
|
|
66
|
+
raw: text.trim(),
|
|
67
|
+
observed: `receipt state=${parsed.state ?? "?"} url=${parsed.url ?? "?"}`,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return { exists: true, raw: text.trim(), observed: `receipt at ${receiptPath} is not JSON` };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Run all five proofs for one episode folder, read-only.
|
|
76
|
+
* `folder` is the directory name under the chronicle root.
|
|
77
|
+
*/
|
|
78
|
+
export async function proveEpisodeClosing(config, folder) {
|
|
79
|
+
const vesselPath = join(config.chronicleRoot, folder);
|
|
80
|
+
const rel = relative(config.gitRoot, vesselPath) || `${basename(config.chronicleRoot)}/${folder}`;
|
|
81
|
+
const receiptPath = join(vesselPath, MW_RECEIPT_BASENAME);
|
|
82
|
+
const nodeId = `chronicle:${folder}`;
|
|
83
|
+
const fetchImpl = config.fetchImpl ?? fetch;
|
|
84
|
+
const closing = [];
|
|
85
|
+
const drift = [];
|
|
86
|
+
const owedActions = [];
|
|
87
|
+
// 1 — created
|
|
88
|
+
const yamlPath = join(vesselPath, "episode.yaml");
|
|
89
|
+
let created = false;
|
|
90
|
+
try {
|
|
91
|
+
await access(yamlPath);
|
|
92
|
+
created = true;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
created = false;
|
|
96
|
+
}
|
|
97
|
+
closing.push({
|
|
98
|
+
stage: "created",
|
|
99
|
+
state: created ? "proven" : "failed",
|
|
100
|
+
probe: `ls "${yamlPath}"`,
|
|
101
|
+
observed: created ? yamlPath : `no such file: ${yamlPath}`,
|
|
102
|
+
});
|
|
103
|
+
// 4 first in execution order (the wheel answer also feeds 5 and GHOST-NODE).
|
|
104
|
+
const wheel = await readWheelCard(config.wheelUrl, nodeId, fetchImpl);
|
|
105
|
+
if (!created && wheel.status === 200)
|
|
106
|
+
drift.push("GHOST-NODE");
|
|
107
|
+
// 2 — committed
|
|
108
|
+
const committed = await observeGit(config.gitRoot, ["log", "-1", "--oneline", "--", rel]);
|
|
109
|
+
const isCommitted = committed.ok && committed.out.length > 0;
|
|
110
|
+
closing.push({
|
|
111
|
+
stage: "committed",
|
|
112
|
+
state: isCommitted ? "proven" : "owed",
|
|
113
|
+
probe: `git -C ${config.gitRoot} log -1 --oneline -- "${rel}"`,
|
|
114
|
+
observed: committed.out || "(no commit touches this vessel)",
|
|
115
|
+
});
|
|
116
|
+
if (created && !isCommitted) {
|
|
117
|
+
drift.push("UNCOMMITTED-VESSEL");
|
|
118
|
+
owedActions.push(`POST /api/chronicle/episodes/${folder}/land`, `git -C ${config.gitRoot} add "${rel}/episode.yaml" "${rel}/${MW_RECEIPT_BASENAME}"`, `git -C ${config.gitRoot} commit -m "<name the episode>" -- "${rel}"`);
|
|
119
|
+
}
|
|
120
|
+
// dirty? (not a stage; a drift shape)
|
|
121
|
+
if (isCommitted) {
|
|
122
|
+
const dirty = await observeGit(config.gitRoot, ["status", "--porcelain", "--", rel]);
|
|
123
|
+
if (dirty.ok && dirty.out.length > 0)
|
|
124
|
+
drift.push("DIRTY-VESSEL");
|
|
125
|
+
}
|
|
126
|
+
// 3 — pushed
|
|
127
|
+
const unpushed = await observeGit(config.gitRoot, ["rev-list", "--count", "origin/main..main"]);
|
|
128
|
+
const isPushed = isCommitted && unpushed.ok && unpushed.out === "0";
|
|
129
|
+
closing.push({
|
|
130
|
+
stage: "pushed",
|
|
131
|
+
state: isPushed ? "proven" : "owed",
|
|
132
|
+
probe: `git -C ${config.gitRoot} rev-list --count origin/main..main`,
|
|
133
|
+
observed: unpushed.out,
|
|
134
|
+
});
|
|
135
|
+
if (isCommitted && !isPushed) {
|
|
136
|
+
drift.push("UNPUSHED-VESSEL");
|
|
137
|
+
owedActions.push(`POST /api/chronicle/episodes/${folder}/land`, `git -C ${config.gitRoot} push origin main`);
|
|
138
|
+
}
|
|
139
|
+
// 4 — registered
|
|
140
|
+
const isRegistered = wheel.status === 200;
|
|
141
|
+
closing.push({
|
|
142
|
+
stage: "registered",
|
|
143
|
+
state: isRegistered ? "proven" : wheel.status === null ? "owed" : "failed",
|
|
144
|
+
probe: `curl -sf -o /dev/null -w '%{http_code}' "${config.wheelUrl}/api/nodes/${nodeId}"`,
|
|
145
|
+
observed: wheel.observed,
|
|
146
|
+
});
|
|
147
|
+
// 5 — receipt-verified: the receipt's state and url match what the wheel said.
|
|
148
|
+
const receipt = await readReceipt(receiptPath);
|
|
149
|
+
let receiptState;
|
|
150
|
+
let receiptObserved = receipt.observed;
|
|
151
|
+
if (!receipt.exists) {
|
|
152
|
+
receiptState = created ? "failed" : "owed";
|
|
153
|
+
if (created && isCommitted && !isRegistered)
|
|
154
|
+
drift.push("UNREGISTERED-VESSEL");
|
|
155
|
+
if (created)
|
|
156
|
+
receiptObserved += " — born invisible: registration never ran";
|
|
157
|
+
}
|
|
158
|
+
else if (receipt.url?.includes(POISONED_WHEEL_HOST)) {
|
|
159
|
+
receiptState = "failed";
|
|
160
|
+
drift.push("POISONED-RECEIPT");
|
|
161
|
+
}
|
|
162
|
+
else if (receipt.state === "pending") {
|
|
163
|
+
receiptState = "failed";
|
|
164
|
+
drift.push("PENDING-RECEIPT");
|
|
165
|
+
}
|
|
166
|
+
else if ((receipt.state === "registered" || receipt.state === "already-registered") && !isRegistered) {
|
|
167
|
+
receiptState = "failed";
|
|
168
|
+
if (wheel.status !== null)
|
|
169
|
+
drift.push("LYING-RECEIPT");
|
|
170
|
+
else
|
|
171
|
+
receiptObserved += " — wheel did not answer; the receipt cannot be verified right now";
|
|
172
|
+
}
|
|
173
|
+
else if ((receipt.state === "registered" || receipt.state === "already-registered") && isRegistered) {
|
|
174
|
+
receiptState = "proven";
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
receiptState = "failed";
|
|
178
|
+
receiptObserved += ` — unrecognised state "${receipt.state ?? "?"}"`;
|
|
179
|
+
}
|
|
180
|
+
closing.push({
|
|
181
|
+
stage: "receipt-verified",
|
|
182
|
+
state: receiptState,
|
|
183
|
+
probe: `cat "${receiptPath}" # state and url must match the registered probe`,
|
|
184
|
+
observed: receiptObserved,
|
|
185
|
+
});
|
|
186
|
+
if (drift.includes("PENDING-RECEIPT") ||
|
|
187
|
+
drift.includes("LYING-RECEIPT") ||
|
|
188
|
+
drift.includes("POISONED-RECEIPT") ||
|
|
189
|
+
drift.includes("UNREGISTERED-VESSEL") ||
|
|
190
|
+
(created && !receipt.exists)) {
|
|
191
|
+
owedActions.push(`POST /api/chronicle/episodes/${folder}/register`);
|
|
192
|
+
}
|
|
193
|
+
return { episode: folder, closing, drift, owedActions };
|
|
194
|
+
}
|
|
195
|
+
/** True only when all five stages are proven. */
|
|
196
|
+
export function closingIsProven(report) {
|
|
197
|
+
return report.closing.every((stage) => stage.state === "proven");
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=closing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"closing.js","sourceRoot":"","sources":["../src/closing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,C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eAAe,CAAC;QAC/B,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAClC,KAAK,CAAC,QAAQ,CAAC,qBAAqB,CAAC;QACrC,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAC5B,CAAC;QACD,WAAW,CAAC,IAAI,CAAC,gCAAgC,MAAM,WAAW,CAAC,CAAA;IACrE,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAA;AACzD,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,eAAe,CAAC,MAAsC;IACpE,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAA;AAClE,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git landing for a Chronicle vessel — fetch, integrate, path-limited add,
|
|
3
|
+
* commit, push — on a working tree other seats are editing at the same time.
|
|
4
|
+
*
|
|
5
|
+
* Rules this module keeps, each paid for in /srv/miadi/episodes:
|
|
6
|
+
*
|
|
7
|
+
* - `main` only moves forward. `.githooks/reference-transaction` refuses any
|
|
8
|
+
* non-fast-forward move of `refs/heads/main`, so a rebase (which moves main
|
|
9
|
+
* sideways) is never attempted. Divergence is integrated with a merge, or
|
|
10
|
+
* refused; never with a rewind.
|
|
11
|
+
* - Nothing here runs `stash`, `reset`, `checkout --`, `clean`, or `add .`.
|
|
12
|
+
* Another seat's dirty files are either untouched or the reason the door
|
|
13
|
+
* stops; git itself refuses a merge that would overwrite a dirty file,
|
|
14
|
+
* before touching anything.
|
|
15
|
+
* - The commit is path-limited twice: `git add -- <paths>` stages only the
|
|
16
|
+
* vessel files, and `git commit -- <paths>` commits only those, leaving any
|
|
17
|
+
* path another seat had staged exactly as staged.
|
|
18
|
+
* - Every step reports what git actually said (`observed`), the way
|
|
19
|
+
* voice-mcp's closing.ts `observe()` does. A refusal is data, not a throw.
|
|
20
|
+
*
|
|
21
|
+
* Ref: jgwill/Miadi#621, jgwill/Miadi#501.
|
|
22
|
+
*/
|
|
23
|
+
export declare const GIT_TIMEOUT_MS = 30000;
|
|
24
|
+
export interface GitObservation {
|
|
25
|
+
ok: boolean;
|
|
26
|
+
/** stdout, or stderr when stdout is empty, trimmed and capped at 500 chars. */
|
|
27
|
+
out: string;
|
|
28
|
+
}
|
|
29
|
+
/** Run one git command under `gitRoot` and report what it said. Never throws. */
|
|
30
|
+
export declare function observeGit(gitRoot: string, args: string[], options?: {
|
|
31
|
+
timeoutMs?: number;
|
|
32
|
+
env?: NodeJS.ProcessEnv;
|
|
33
|
+
}): Promise<GitObservation>;
|
|
34
|
+
/** The git root that holds the chronicle — measured, never assumed one level up. */
|
|
35
|
+
export declare function chronicleGitRoot(chronicleRoot: string): Promise<string>;
|
|
36
|
+
export type ChroniclePreflightCode = "chronicle_not_main" | "chronicle_busy";
|
|
37
|
+
export interface ChroniclePreflight {
|
|
38
|
+
ok: boolean;
|
|
39
|
+
branch: string;
|
|
40
|
+
code?: ChroniclePreflightCode;
|
|
41
|
+
message?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The tree must be on `main` with no merge or rebase in flight. A tree in the
|
|
45
|
+
* middle of someone else's operation is theirs to finish; the door reports and
|
|
46
|
+
* waits.
|
|
47
|
+
*/
|
|
48
|
+
export declare function preflightChronicle(gitRoot: string): Promise<ChroniclePreflight>;
|
|
49
|
+
export type IntegrationState = "up-to-date" | "fast-forwarded" | "merged" | "refused" | "fetch-failed" | "would-integrate";
|
|
50
|
+
export interface IntegrationResult {
|
|
51
|
+
state: IntegrationState;
|
|
52
|
+
/** What git said, step by step. */
|
|
53
|
+
observed: string;
|
|
54
|
+
/** Commits on origin/main not on main before integration. */
|
|
55
|
+
behind: number;
|
|
56
|
+
/** Commits on main not on origin/main before integration. */
|
|
57
|
+
ahead: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Fetch origin/main and bring it into main without ever rewinding.
|
|
61
|
+
*
|
|
62
|
+
* origin/main ⊆ main → up-to-date
|
|
63
|
+
* main ⊆ origin/main → merge --ff-only
|
|
64
|
+
* diverged → merge --no-edit (a merge commit is the
|
|
65
|
+
* price of a tree that forbids rewinds)
|
|
66
|
+
*
|
|
67
|
+
* `dryRun` fetches and measures but moves nothing.
|
|
68
|
+
*/
|
|
69
|
+
export declare function integrateOrigin(gitRoot: string, options?: {
|
|
70
|
+
dryRun?: boolean;
|
|
71
|
+
allowMerge?: boolean;
|
|
72
|
+
}): Promise<IntegrationResult>;
|
|
73
|
+
/** Directory names origin/main holds under `subdir` — what other hosts have pushed. */
|
|
74
|
+
export declare function originTreeNames(gitRoot: string, subdir: string): Promise<{
|
|
75
|
+
ok: boolean;
|
|
76
|
+
names: string[];
|
|
77
|
+
observed: string;
|
|
78
|
+
}>;
|
|
79
|
+
export interface CommitOutcome {
|
|
80
|
+
state: "committed" | "owed" | "would-commit";
|
|
81
|
+
subject: string;
|
|
82
|
+
sha?: string;
|
|
83
|
+
observed: string;
|
|
84
|
+
}
|
|
85
|
+
export interface PushOutcome {
|
|
86
|
+
state: "pushed" | "rejected" | "owed" | "would-push";
|
|
87
|
+
observed: string;
|
|
88
|
+
/** Present when a rejected push led to a second integration attempt. */
|
|
89
|
+
retryIntegration?: IntegrationResult;
|
|
90
|
+
}
|
|
91
|
+
export interface LandPathsInput {
|
|
92
|
+
gitRoot: string;
|
|
93
|
+
/** Paths relative to gitRoot. Missing ones are skipped and reported. */
|
|
94
|
+
paths: string[];
|
|
95
|
+
subject: string;
|
|
96
|
+
body: string;
|
|
97
|
+
dryRun?: boolean;
|
|
98
|
+
/** Skip the push (commit only). */
|
|
99
|
+
push?: boolean;
|
|
100
|
+
}
|
|
101
|
+
export interface LandPathsResult {
|
|
102
|
+
integration: IntegrationResult;
|
|
103
|
+
staged: string[];
|
|
104
|
+
skipped: string[];
|
|
105
|
+
commit: CommitOutcome;
|
|
106
|
+
push: PushOutcome;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Integrate, stage exactly `paths`, commit exactly `paths`, push main.
|
|
110
|
+
*
|
|
111
|
+
* A rejected push is a stop: fetch once more, integrate once more (the merge
|
|
112
|
+
* touches only what the remote added), push once more, then report whatever
|
|
113
|
+
* the last push said. Nothing is undone on the way out.
|
|
114
|
+
*/
|
|
115
|
+
export declare function landPaths(input: LandPathsInput): Promise<LandPathsResult>;
|
|
116
|
+
/** Push main; on a rejected push, integrate once and push once more. */
|
|
117
|
+
export declare function pushMain(gitRoot: string): Promise<PushOutcome>;
|
|
118
|
+
export declare function withChronicleLock<T>(gitRoot: string, fn: () => Promise<T>): Promise<T>;
|
|
119
|
+
//# sourceMappingURL=git-landing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-landing.d.ts","sourceRoot":"","sources":["../src/git-landing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AASH,eAAO,MAAM,cAAc,QAAS,CAAA;AAEpC,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,OAAO,CAAA;IACX,+EAA+E;IAC/E,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,iFAAiF;AACjF,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CAAO,GAC5D,OAAO,CAAC,cAAc,CAAC,CAezB;AAED,oFAAoF;AACpF,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM7E;AAED,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,GAAG,gBAAgB,CAAA;AAE5E,MAAM,WAAW,kBAAkB;IACjC,EAAE,E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,EAAE,MAAM,CAAA;IAChB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,iBAAiB,CAAA;CACrC;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,wEAAwE;IACxE,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,mCAAmC;IACnC,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,iBAAiB,CAAA;IAC9B,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,EAAE,aAAa,CAAA;IACrB,IAAI,EAAE,WAAW,CAAA;CAClB;AAKD;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CA0F/E;AAED,wEAAwE;AACxE,wBAAsB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAsBpE;AAOD,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAS5F"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git landing for a Chronicle vessel — fetch, integrate, path-limited add,
|
|
3
|
+
* commit, push — on a working tree other seats are editing at the same time.
|
|
4
|
+
*
|
|
5
|
+
* Rules this module keeps, each paid for in /srv/miadi/episodes:
|
|
6
|
+
*
|
|
7
|
+
* - `main` only moves forward. `.githooks/reference-transaction` refuses any
|
|
8
|
+
* non-fast-forward move of `refs/heads/main`, so a rebase (which moves main
|
|
9
|
+
* sideways) is never attempted. Divergence is integrated with a merge, or
|
|
10
|
+
* refused; never with a rewind.
|
|
11
|
+
* - Nothing here runs `stash`, `reset`, `checkout --`, `clean`, or `add .`.
|
|
12
|
+
* Another seat's dirty files are either untouched or the reason the door
|
|
13
|
+
* stops; git itself refuses a merge that would overwrite a dirty file,
|
|
14
|
+
* before touching anything.
|
|
15
|
+
* - The commit is path-limited twice: `git add -- <paths>` stages only the
|
|
16
|
+
* vessel files, and `git commit -- <paths>` commits only those, leaving any
|
|
17
|
+
* path another seat had staged exactly as staged.
|
|
18
|
+
* - Every step reports what git actually said (`observed`), the way
|
|
19
|
+
* voice-mcp's closing.ts `observe()` does. A refusal is data, not a throw.
|
|
20
|
+
*
|
|
21
|
+
* Ref: jgwill/Miadi#621, jgwill/Miadi#501.
|
|
22
|
+
*/
|
|
23
|
+
import { execFile } from "node:child_process";
|
|
24
|
+
import { existsSync } from "node:fs";
|
|
25
|
+
import { join } from "node:path";
|
|
26
|
+
import { promisify } from "node:util";
|
|
27
|
+
const exec = promisify(execFile);
|
|
28
|
+
export const GIT_TIMEOUT_MS = 30_000;
|
|
29
|
+
/** Run one git command under `gitRoot` and report what it said. Never throws. */
|
|
30
|
+
export async function observeGit(gitRoot, args, options = {}) {
|
|
31
|
+
try {
|
|
32
|
+
const { stdout, stderr } = await exec("git", ["-C", gitRoot, ...args], {
|
|
33
|
+
env: { ...(options.env ?? process.env), GIT_TERMINAL_PROMPT: "0" },
|
|
34
|
+
timeout: options.timeoutMs ?? GIT_TIMEOUT_MS,
|
|
35
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
36
|
+
});
|
|
37
|
+
return { ok: true, out: (stdout.trim() || stderr.trim()).slice(0, 500) };
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
const err = error;
|
|
41
|
+
return {
|
|
42
|
+
ok: false,
|
|
43
|
+
out: (err.stderr?.trim() || err.stdout?.trim() || err.message || String(error)).slice(0, 500),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** The git root that holds the chronicle — measured, never assumed one level up. */
|
|
48
|
+
export async function chronicleGitRoot(chronicleRoot) {
|
|
49
|
+
const top = await observeGit(chronicleRoot, ["rev-parse", "--show-toplevel"]);
|
|
50
|
+
if (!top.ok || !top.out) {
|
|
51
|
+
throw new Error(`${chronicleRoot} is not inside a git repository: ${top.out}`);
|
|
52
|
+
}
|
|
53
|
+
return top.out;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The tree must be on `main` with no merge or rebase in flight. A tree in the
|
|
57
|
+
* middle of someone else's operation is theirs to finish; the door reports and
|
|
58
|
+
* waits.
|
|
59
|
+
*/
|
|
60
|
+
export async function preflightChronicle(gitRoot) {
|
|
61
|
+
const branch = await observeGit(gitRoot, ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
62
|
+
if (!branch.ok) {
|
|
63
|
+
return { ok: false, branch: "", code: "chronicle_busy", message: `git cannot read HEAD: ${branch.out}` };
|
|
64
|
+
}
|
|
65
|
+
if (branch.out !== "main") {
|
|
66
|
+
return {
|
|
67
|
+
ok: false,
|
|
68
|
+
branch: branch.out,
|
|
69
|
+
code: "chronicle_not_main",
|
|
70
|
+
message: `the chronicle checkout is on '${branch.out}', not main — the door only lands on main`,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const gitDir = await observeGit(gitRoot, ["rev-parse", "--git-dir"]);
|
|
74
|
+
const dir = gitDir.ok ? (gitDir.out.startsWith("/") ? gitDir.out : join(gitRoot, gitDir.out)) : join(gitRoot, ".git");
|
|
75
|
+
for (const marker of ["rebase-merge", "rebase-apply", "MERGE_HEAD", "CHERRY_PICK_HEAD"]) {
|
|
76
|
+
if (existsSync(join(dir, marker))) {
|
|
77
|
+
return {
|
|
78
|
+
ok: false,
|
|
79
|
+
branch: branch.out,
|
|
80
|
+
code: "chronicle_busy",
|
|
81
|
+
message: `${marker} is present under ${dir} — another operation is in flight; the door does not resolve it`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return { ok: true, branch: branch.out };
|
|
86
|
+
}
|
|
87
|
+
async function count(gitRoot, range) {
|
|
88
|
+
const result = await observeGit(gitRoot, ["rev-list", "--count", range]);
|
|
89
|
+
return result.ok && /^\d+$/.test(result.out) ? Number(result.out) : -1;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Fetch origin/main and bring it into main without ever rewinding.
|
|
93
|
+
*
|
|
94
|
+
* origin/main ⊆ main → up-to-date
|
|
95
|
+
* main ⊆ origin/main → merge --ff-only
|
|
96
|
+
* diverged → merge --no-edit (a merge commit is the
|
|
97
|
+
* price of a tree that forbids rewinds)
|
|
98
|
+
*
|
|
99
|
+
* `dryRun` fetches and measures but moves nothing.
|
|
100
|
+
*/
|
|
101
|
+
export async function integrateOrigin(gitRoot, options = {}) {
|
|
102
|
+
const fetched = await observeGit(gitRoot, ["fetch", "origin", "main", "--quiet"]);
|
|
103
|
+
if (!fetched.ok) {
|
|
104
|
+
return { state: "fetch-failed", observed: `git fetch origin main: ${fetched.out}`, behind: -1, ahead: -1 };
|
|
105
|
+
}
|
|
106
|
+
const behind = await count(gitRoot, "main..origin/main");
|
|
107
|
+
const ahead = await count(gitRoot, "origin/main..main");
|
|
108
|
+
if (behind === 0) {
|
|
109
|
+
return { state: "up-to-date", observed: `main is up to date with origin/main (ahead ${ahead})`, behind, ahead };
|
|
110
|
+
}
|
|
111
|
+
if (options.dryRun) {
|
|
112
|
+
return {
|
|
113
|
+
state: "would-integrate",
|
|
114
|
+
observed: `main is behind origin/main by ${behind} (ahead ${ahead}); would ${ahead === 0 ? "fast-forward" : "merge"}`,
|
|
115
|
+
behind,
|
|
116
|
+
ahead,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
if (ahead === 0) {
|
|
120
|
+
const ff = await observeGit(gitRoot, ["merge", "--ff-only", "origin/main"]);
|
|
121
|
+
return ff.ok
|
|
122
|
+
? { state: "fast-forwarded", observed: `git merge --ff-only origin/main: ${ff.out}`, behind, ahead }
|
|
123
|
+
: { state: "refused", observed: `git merge --ff-only origin/main refused: ${ff.out}`, behind, ahead };
|
|
124
|
+
}
|
|
125
|
+
if (options.allowMerge === false) {
|
|
126
|
+
return {
|
|
127
|
+
state: "refused",
|
|
128
|
+
observed: `main and origin/main have diverged (behind ${behind}, ahead ${ahead}) and merging is disabled`,
|
|
129
|
+
behind,
|
|
130
|
+
ahead,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const merged = await observeGit(gitRoot, ["merge", "--no-edit", "origin/main"]);
|
|
134
|
+
return merged.ok
|
|
135
|
+
? { state: "merged", observed: `git merge --no-edit origin/main: ${merged.out}`, behind, ahead }
|
|
136
|
+
: { state: "refused", observed: `git merge --no-edit origin/main refused: ${merged.out}`, behind, ahead };
|
|
137
|
+
}
|
|
138
|
+
/** Directory names origin/main holds under `subdir` — what other hosts have pushed. */
|
|
139
|
+
export async function originTreeNames(gitRoot, subdir) {
|
|
140
|
+
const result = await observeGit(gitRoot, ["ls-tree", "--name-only", `origin/main:${subdir}`]);
|
|
141
|
+
if (!result.ok)
|
|
142
|
+
return { ok: false, names: [], observed: `git ls-tree origin/main:${subdir}: ${result.out}` };
|
|
143
|
+
return { ok: true, names: result.out.split("\n").filter(Boolean), observed: `origin/main:${subdir} read` };
|
|
144
|
+
}
|
|
145
|
+
const NOTHING_STAGED = /nothing to commit|no changes added to commit|nothing added to commit/i;
|
|
146
|
+
const PUSH_REJECTED = /rejected|non-fast-forward|fetch first|failed to push/i;
|
|
147
|
+
/**
|
|
148
|
+
* Integrate, stage exactly `paths`, commit exactly `paths`, push main.
|
|
149
|
+
*
|
|
150
|
+
* A rejected push is a stop: fetch once more, integrate once more (the merge
|
|
151
|
+
* touches only what the remote added), push once more, then report whatever
|
|
152
|
+
* the last push said. Nothing is undone on the way out.
|
|
153
|
+
*/
|
|
154
|
+
export async function landPaths(input) {
|
|
155
|
+
const { gitRoot } = input;
|
|
156
|
+
const dryRun = input.dryRun === true;
|
|
157
|
+
const wantPush = input.push !== false;
|
|
158
|
+
const integration = await integrateOrigin(gitRoot, { dryRun });
|
|
159
|
+
const staged = [];
|
|
160
|
+
const skipped = [];
|
|
161
|
+
for (const path of input.paths) {
|
|
162
|
+
if (existsSync(join(gitRoot, path)))
|
|
163
|
+
staged.push(path);
|
|
164
|
+
else
|
|
165
|
+
skipped.push(path);
|
|
166
|
+
}
|
|
167
|
+
if (dryRun) {
|
|
168
|
+
return {
|
|
169
|
+
integration,
|
|
170
|
+
staged,
|
|
171
|
+
skipped,
|
|
172
|
+
commit: { state: "would-commit", subject: input.subject, observed: `would git add -- ${staged.join(" ")} and commit "${input.subject}"` },
|
|
173
|
+
push: { state: wantPush ? "would-push" : "owed", observed: wantPush ? "would git push origin main" : "push not requested" },
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (integration.state === "refused" || integration.state === "fetch-failed") {
|
|
177
|
+
// A fetch that failed is not a reason to refuse a commit — the number check
|
|
178
|
+
// already said what it could see. A refused integration is: main cannot be
|
|
179
|
+
// pushed until it is, so the vessel would be committed onto a branch that
|
|
180
|
+
// cannot land. Commit anyway (the files are real and a commit is safer than
|
|
181
|
+
// uncommitted files on a shared tree), and let the push report the truth.
|
|
182
|
+
}
|
|
183
|
+
if (staged.length === 0) {
|
|
184
|
+
return {
|
|
185
|
+
integration,
|
|
186
|
+
staged,
|
|
187
|
+
skipped,
|
|
188
|
+
commit: { state: "owed", subject: input.subject, observed: `none of the named paths exist: ${input.paths.join(" ")}` },
|
|
189
|
+
push: { state: "owed", observed: "nothing to push" },
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
const added = await observeGit(gitRoot, ["add", "--", ...staged]);
|
|
193
|
+
if (!added.ok) {
|
|
194
|
+
return {
|
|
195
|
+
integration,
|
|
196
|
+
staged,
|
|
197
|
+
skipped,
|
|
198
|
+
commit: { state: "owed", subject: input.subject, observed: `git add -- ${staged.join(" ")}: ${added.out}` },
|
|
199
|
+
push: { state: "owed", observed: "not attempted: nothing was committed" },
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const committed = await observeGit(gitRoot, [
|
|
203
|
+
"commit",
|
|
204
|
+
"--quiet",
|
|
205
|
+
"-m",
|
|
206
|
+
input.subject,
|
|
207
|
+
"-m",
|
|
208
|
+
input.body,
|
|
209
|
+
"--",
|
|
210
|
+
...staged,
|
|
211
|
+
]);
|
|
212
|
+
let commit;
|
|
213
|
+
if (committed.ok) {
|
|
214
|
+
const sha = await observeGit(gitRoot, ["rev-parse", "--short", "HEAD"]);
|
|
215
|
+
commit = {
|
|
216
|
+
state: "committed",
|
|
217
|
+
subject: input.subject,
|
|
218
|
+
sha: sha.ok ? sha.out : undefined,
|
|
219
|
+
observed: `git commit -- ${staged.join(" ")}: ${sha.ok ? sha.out : committed.out || "committed"}`,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
else if (NOTHING_STAGED.test(committed.out)) {
|
|
223
|
+
commit = { state: "owed", subject: input.subject, observed: `nothing to commit for ${staged.join(" ")} (already committed)` };
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
return {
|
|
227
|
+
integration,
|
|
228
|
+
staged,
|
|
229
|
+
skipped,
|
|
230
|
+
commit: { state: "owed", subject: input.subject, observed: `git commit refused: ${committed.out}` },
|
|
231
|
+
push: { state: "owed", observed: "not attempted: nothing was committed" },
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
if (!wantPush) {
|
|
235
|
+
return { integration, staged, skipped, commit, push: { state: "owed", observed: "push not requested" } };
|
|
236
|
+
}
|
|
237
|
+
const push = await pushMain(gitRoot);
|
|
238
|
+
return { integration, staged, skipped, commit, push };
|
|
239
|
+
}
|
|
240
|
+
/** Push main; on a rejected push, integrate once and push once more. */
|
|
241
|
+
export async function pushMain(gitRoot) {
|
|
242
|
+
const unpushed = await count(gitRoot, "origin/main..main");
|
|
243
|
+
if (unpushed === 0)
|
|
244
|
+
return { state: "pushed", observed: "origin/main already holds main (nothing to push)" };
|
|
245
|
+
const first = await observeGit(gitRoot, ["push", "origin", "main"]);
|
|
246
|
+
if (first.ok)
|
|
247
|
+
return { state: "pushed", observed: `git push origin main: ${first.out || "ok"}` };
|
|
248
|
+
if (!PUSH_REJECTED.test(first.out)) {
|
|
249
|
+
return { state: "rejected", observed: `git push origin main: ${first.out}` };
|
|
250
|
+
}
|
|
251
|
+
const retryIntegration = await integrateOrigin(gitRoot);
|
|
252
|
+
if (retryIntegration.state === "refused" || retryIntegration.state === "fetch-failed") {
|
|
253
|
+
return {
|
|
254
|
+
state: "rejected",
|
|
255
|
+
observed: `git push origin main rejected (${first.out}); integration then ${retryIntegration.state}: ${retryIntegration.observed}`,
|
|
256
|
+
retryIntegration,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
const second = await observeGit(gitRoot, ["push", "origin", "main"]);
|
|
260
|
+
return second.ok
|
|
261
|
+
? { state: "pushed", observed: `git push origin main (after ${retryIntegration.state}): ${second.out || "ok"}`, retryIntegration }
|
|
262
|
+
: { state: "rejected", observed: `git push origin main rejected twice: ${second.out}`, retryIntegration };
|
|
263
|
+
}
|
|
264
|
+
// One door, one landing at a time per git root. Two mints racing inside one
|
|
265
|
+
// process would otherwise both allocate the same number between the check and
|
|
266
|
+
// the mkdir. Across processes the guard is mkdir's EEXIST and git's index lock.
|
|
267
|
+
const locks = new Map();
|
|
268
|
+
export async function withChronicleLock(gitRoot, fn) {
|
|
269
|
+
const previous = locks.get(gitRoot) ?? Promise.resolve();
|
|
270
|
+
const next = previous.catch(() => undefined).then(fn);
|
|
271
|
+
locks.set(gitRoot, next);
|
|
272
|
+
try {
|
|
273
|
+
return await next;
|
|
274
|
+
}
|
|
275
|
+
finally {
|
|
276
|
+
if (locks.get(gitRoot) === next)
|
|
277
|
+
locks.delete(gitRoot);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=git-landing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git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E,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAA;IACpE,OAAO,MAAM,CAAC,EAAE;QACd,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,+BAA+B,gBAAgB,CAAC,KAAK,MAAM,MAAM,CAAC,GAAG,IAAI,IAAI,EAAE,EAAE,gBAAgB,EAAE;QAClI,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,wCAAwC,MAAM,CAAC,GAAG,EAAE,EAAE,gBAAgB,EAAE,CAAA;AAC7G,CAAC;AAED,4EAA4E;AAC5E,8EAA8E;AAC9E,gFAAgF;AAChF,MAAM,KAAK,GAAG,IAAI,GAAG,EAA4B,CAAA;AAEjD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAI,OAAe,EAAE,EAAoB;IAC9E,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;IACxD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACrD,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IACxB,IAAI,CAAC;QACH,OAAO,MAAM,IAAI,CAAA;IACnB,CAAC;YAAS,CAAC;QACT,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI;YAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACxD,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,11 @@ export * from "./status.js";
|
|
|
13
13
|
export * from "./register.js";
|
|
14
14
|
export * from "./episode-node.js";
|
|
15
15
|
export * from "./attention-node.js";
|
|
16
|
+
export * from "./attention.js";
|
|
16
17
|
export * from "./catalog.js";
|
|
17
18
|
export * from "./story-library.js";
|
|
19
|
+
export * from "./git-landing.js";
|
|
20
|
+
export * from "./closing.js";
|
|
21
|
+
export * from "./mint.js";
|
|
18
22
|
export { runCli, type RunCliOptions, type CliStreams } from "./cli.js";
|
|
19
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA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