@jungjaehoon/mama-os 0.76.0 → 0.78.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.
Files changed (190) hide show
  1. package/CHANGELOG.md +182 -0
  2. package/README.md +25 -10
  3. package/dist/api/attachment-actions.d.ts.map +1 -1
  4. package/dist/api/attachment-actions.js +8 -7
  5. package/dist/api/attachment-actions.js.map +1 -1
  6. package/dist/api/code-act-actions.d.ts.map +1 -1
  7. package/dist/api/code-act-actions.js +5 -2
  8. package/dist/api/code-act-actions.js.map +1 -1
  9. package/dist/api/drive-actions.d.ts +4 -0
  10. package/dist/api/drive-actions.d.ts.map +1 -1
  11. package/dist/api/drive-actions.js +15 -7
  12. package/dist/api/drive-actions.js.map +1 -1
  13. package/dist/api/drive-delivery.d.ts.map +1 -1
  14. package/dist/api/drive-delivery.js +8 -3
  15. package/dist/api/drive-delivery.js.map +1 -1
  16. package/dist/api/member-enrollment.d.ts +2 -0
  17. package/dist/api/member-enrollment.d.ts.map +1 -1
  18. package/dist/api/member-enrollment.js +1 -1
  19. package/dist/api/member-enrollment.js.map +1 -1
  20. package/dist/api/member-lifecycle.d.ts +2 -0
  21. package/dist/api/member-lifecycle.d.ts.map +1 -1
  22. package/dist/api/member-lifecycle.js +1 -1
  23. package/dist/api/member-lifecycle.js.map +1 -1
  24. package/dist/api/owner-timezone-actions.d.ts +2 -0
  25. package/dist/api/owner-timezone-actions.d.ts.map +1 -1
  26. package/dist/api/owner-timezone-actions.js.map +1 -1
  27. package/dist/api/security-events.d.ts.map +1 -1
  28. package/dist/api/security-events.js +10 -1
  29. package/dist/api/security-events.js.map +1 -1
  30. package/dist/api/viewer-server.d.ts +1 -0
  31. package/dist/api/viewer-server.d.ts.map +1 -1
  32. package/dist/api/viewer-server.js +34 -0
  33. package/dist/api/viewer-server.js.map +1 -1
  34. package/dist/api/work-actions.d.ts.map +1 -1
  35. package/dist/api/work-actions.js +27 -2
  36. package/dist/api/work-actions.js.map +1 -1
  37. package/dist/cli/commands/backfill.d.ts.map +1 -1
  38. package/dist/cli/commands/backfill.js +1 -0
  39. package/dist/cli/commands/backfill.js.map +1 -1
  40. package/dist/cli/commands/backup.d.ts +13 -0
  41. package/dist/cli/commands/backup.d.ts.map +1 -0
  42. package/dist/cli/commands/backup.js +137 -0
  43. package/dist/cli/commands/backup.js.map +1 -0
  44. package/dist/cli/commands/control.d.ts +26 -0
  45. package/dist/cli/commands/control.d.ts.map +1 -0
  46. package/dist/cli/commands/control.js +193 -0
  47. package/dist/cli/commands/control.js.map +1 -0
  48. package/dist/cli/commands/daemon.d.ts +49 -3
  49. package/dist/cli/commands/daemon.d.ts.map +1 -1
  50. package/dist/cli/commands/daemon.js +253 -75
  51. package/dist/cli/commands/daemon.js.map +1 -1
  52. package/dist/cli/commands/doctor.d.ts +13 -0
  53. package/dist/cli/commands/doctor.d.ts.map +1 -0
  54. package/dist/cli/commands/doctor.js +216 -0
  55. package/dist/cli/commands/doctor.js.map +1 -0
  56. package/dist/cli/commands/init.d.ts.map +1 -1
  57. package/dist/cli/commands/init.js +3 -2
  58. package/dist/cli/commands/init.js.map +1 -1
  59. package/dist/cli/commands/logs.d.ts +9 -0
  60. package/dist/cli/commands/logs.d.ts.map +1 -0
  61. package/dist/cli/commands/logs.js +109 -0
  62. package/dist/cli/commands/logs.js.map +1 -0
  63. package/dist/cli/commands/register-owner.d.ts.map +1 -1
  64. package/dist/cli/commands/register-owner.js +12 -0
  65. package/dist/cli/commands/register-owner.js.map +1 -1
  66. package/dist/cli/commands/restore.d.ts +14 -0
  67. package/dist/cli/commands/restore.d.ts.map +1 -0
  68. package/dist/cli/commands/restore.js +130 -0
  69. package/dist/cli/commands/restore.js.map +1 -0
  70. package/dist/cli/commands/service.d.ts +28 -0
  71. package/dist/cli/commands/service.d.ts.map +1 -0
  72. package/dist/cli/commands/service.js +278 -0
  73. package/dist/cli/commands/service.js.map +1 -0
  74. package/dist/cli/commands/uninstall.d.ts +7 -0
  75. package/dist/cli/commands/uninstall.d.ts.map +1 -0
  76. package/dist/cli/commands/uninstall.js +262 -0
  77. package/dist/cli/commands/uninstall.js.map +1 -0
  78. package/dist/cli/index.js +67 -20
  79. package/dist/cli/index.js.map +1 -1
  80. package/dist/cli/launch-files.d.ts +83 -0
  81. package/dist/cli/launch-files.d.ts.map +1 -1
  82. package/dist/cli/launch-files.js +231 -15
  83. package/dist/cli/launch-files.js.map +1 -1
  84. package/dist/cli/runtime/backend-probe.d.ts +34 -0
  85. package/dist/cli/runtime/backend-probe.d.ts.map +1 -0
  86. package/dist/cli/runtime/backend-probe.js +83 -0
  87. package/dist/cli/runtime/backend-probe.js.map +1 -0
  88. package/dist/cli/runtime/backup.d.ts +114 -0
  89. package/dist/cli/runtime/backup.d.ts.map +1 -0
  90. package/dist/cli/runtime/backup.js +564 -0
  91. package/dist/cli/runtime/backup.js.map +1 -0
  92. package/dist/cli/runtime/claude-caller-config.d.ts +3 -1
  93. package/dist/cli/runtime/claude-caller-config.d.ts.map +1 -1
  94. package/dist/cli/runtime/claude-caller-config.js +14 -2
  95. package/dist/cli/runtime/claude-caller-config.js.map +1 -1
  96. package/dist/cli/runtime/daemon-control.d.ts +84 -0
  97. package/dist/cli/runtime/daemon-control.d.ts.map +1 -0
  98. package/dist/cli/runtime/daemon-control.js +266 -0
  99. package/dist/cli/runtime/daemon-control.js.map +1 -0
  100. package/dist/cli/runtime/diagnostics.d.ts +43 -0
  101. package/dist/cli/runtime/diagnostics.d.ts.map +1 -0
  102. package/dist/cli/runtime/diagnostics.js +953 -0
  103. package/dist/cli/runtime/diagnostics.js.map +1 -0
  104. package/dist/cli/runtime/restore.d.ts +98 -0
  105. package/dist/cli/runtime/restore.d.ts.map +1 -0
  106. package/dist/cli/runtime/restore.js +756 -0
  107. package/dist/cli/runtime/restore.js.map +1 -0
  108. package/dist/cli/runtime/systemd-service.d.ts +13 -0
  109. package/dist/cli/runtime/systemd-service.d.ts.map +1 -0
  110. package/dist/cli/runtime/systemd-service.js +32 -0
  111. package/dist/cli/runtime/systemd-service.js.map +1 -0
  112. package/dist/connectors/chatwork/index.js +1 -1
  113. package/dist/connectors/chatwork/index.js.map +1 -1
  114. package/dist/connectors/config-loader.d.ts +2 -1
  115. package/dist/connectors/config-loader.d.ts.map +1 -1
  116. package/dist/connectors/config-loader.js +3 -2
  117. package/dist/connectors/config-loader.js.map +1 -1
  118. package/dist/connectors/framework/polling-scheduler.d.ts.map +1 -1
  119. package/dist/connectors/framework/polling-scheduler.js +12 -11
  120. package/dist/connectors/framework/polling-scheduler.js.map +1 -1
  121. package/dist/connectors/imessage/index.d.ts.map +1 -1
  122. package/dist/connectors/imessage/index.js +2 -1
  123. package/dist/connectors/imessage/index.js.map +1 -1
  124. package/dist/connectors/slack/index.js +1 -1
  125. package/dist/connectors/slack/index.js.map +1 -1
  126. package/dist/runtime/action-surface.d.ts.map +1 -1
  127. package/dist/runtime/action-surface.js +6 -0
  128. package/dist/runtime/action-surface.js.map +1 -1
  129. package/dist/runtime/backend-security.d.ts +3 -0
  130. package/dist/runtime/backend-security.d.ts.map +1 -1
  131. package/dist/runtime/backend-security.js +13 -5
  132. package/dist/runtime/backend-security.js.map +1 -1
  133. package/dist/runtime/claude-caller-hook.d.ts +14 -0
  134. package/dist/runtime/claude-caller-hook.d.ts.map +1 -1
  135. package/dist/runtime/claude-caller-hook.js +21 -1
  136. package/dist/runtime/claude-caller-hook.js.map +1 -1
  137. package/dist/runtime/config.d.ts +8 -0
  138. package/dist/runtime/config.d.ts.map +1 -1
  139. package/dist/runtime/config.js +17 -4
  140. package/dist/runtime/config.js.map +1 -1
  141. package/dist/runtime/connectors.d.ts +21 -1
  142. package/dist/runtime/connectors.d.ts.map +1 -1
  143. package/dist/runtime/connectors.js +28 -17
  144. package/dist/runtime/connectors.js.map +1 -1
  145. package/dist/runtime/core-db.d.ts.map +1 -1
  146. package/dist/runtime/core-db.js +2 -0
  147. package/dist/runtime/core-db.js.map +1 -1
  148. package/dist/runtime/member-session.d.ts.map +1 -1
  149. package/dist/runtime/member-session.js +11 -3
  150. package/dist/runtime/member-session.js.map +1 -1
  151. package/dist/runtime/member-system-prompt.d.ts +2 -0
  152. package/dist/runtime/member-system-prompt.d.ts.map +1 -1
  153. package/dist/runtime/member-system-prompt.js +11 -3
  154. package/dist/runtime/member-system-prompt.js.map +1 -1
  155. package/dist/runtime/native-session.d.ts +2 -0
  156. package/dist/runtime/native-session.d.ts.map +1 -1
  157. package/dist/runtime/native-session.js +25 -4
  158. package/dist/runtime/native-session.js.map +1 -1
  159. package/dist/runtime/owner-authority.d.ts +2 -0
  160. package/dist/runtime/owner-authority.d.ts.map +1 -1
  161. package/dist/runtime/owner-authority.js +4 -0
  162. package/dist/runtime/owner-authority.js.map +1 -1
  163. package/dist/runtime/owner-runtime.d.ts +2 -0
  164. package/dist/runtime/owner-runtime.d.ts.map +1 -1
  165. package/dist/runtime/owner-runtime.js +3 -0
  166. package/dist/runtime/owner-runtime.js.map +1 -1
  167. package/dist/runtime/owner-system-prompt.d.ts.map +1 -1
  168. package/dist/runtime/owner-system-prompt.js +9 -7
  169. package/dist/runtime/owner-system-prompt.js.map +1 -1
  170. package/dist/runtime/principal-access.d.ts.map +1 -1
  171. package/dist/runtime/principal-access.js +1 -0
  172. package/dist/runtime/principal-access.js.map +1 -1
  173. package/dist/runtime/rotating-log.d.ts +44 -0
  174. package/dist/runtime/rotating-log.d.ts.map +1 -0
  175. package/dist/runtime/rotating-log.js +124 -0
  176. package/dist/runtime/rotating-log.js.map +1 -0
  177. package/dist/runtime/web-fetch-scope.d.ts +20 -0
  178. package/dist/runtime/web-fetch-scope.d.ts.map +1 -0
  179. package/dist/runtime/web-fetch-scope.js +68 -0
  180. package/dist/runtime/web-fetch-scope.js.map +1 -0
  181. package/dist/tools/document-toolkit.d.ts +2 -0
  182. package/dist/tools/document-toolkit.d.ts.map +1 -1
  183. package/dist/tools/document-toolkit.js +3 -1
  184. package/dist/tools/document-toolkit.js.map +1 -1
  185. package/dist/tools/office-render.d.ts.map +1 -1
  186. package/dist/tools/office-render.js +3 -0
  187. package/dist/tools/office-render.js.map +1 -1
  188. package/package.json +4 -3
  189. package/toolkit/requirements.in +11 -0
  190. package/toolkit/requirements.lock +984 -5
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MINIMUM_BACKEND_VERSIONS = void 0;
4
+ exports.defaultProbeRun = defaultProbeRun;
5
+ exports.compareVersions = compareVersions;
6
+ exports.probeBackend = probeBackend;
7
+ const node_child_process_1 = require("node:child_process");
8
+ /**
9
+ * The oldest backend CLI versions a MAMA release was verified on. MAMA depends on their sandbox,
10
+ * hook, settings and permission behaviour, so an older CLI is refused; raise these only after
11
+ * verifying a newer one.
12
+ */
13
+ exports.MINIMUM_BACKEND_VERSIONS = {
14
+ claude: '2.1.299',
15
+ codex: '0.160.1',
16
+ };
17
+ function defaultProbeRun(command, args, env) {
18
+ return (0, node_child_process_1.spawnSync)(command, args, { encoding: 'utf8', timeout: 20_000, env: env ?? process.env });
19
+ }
20
+ /** Compare dotted numeric versions; a missing part counts as 0. */
21
+ function compareVersions(left, right) {
22
+ const a = left.split('.').map((part) => Number.parseInt(part, 10) || 0);
23
+ const b = right.split('.').map((part) => Number.parseInt(part, 10) || 0);
24
+ for (let index = 0; index < Math.max(a.length, b.length); index += 1) {
25
+ const difference = (a[index] ?? 0) - (b[index] ?? 0);
26
+ if (difference !== 0)
27
+ return difference;
28
+ }
29
+ return 0;
30
+ }
31
+ /**
32
+ * Read a backend CLI's version and whether it is signed in, without printing anything the CLI
33
+ * says about the account. `env` is the environment the daemon gives the backend, so a login that
34
+ * only this shell's variables provide does not count; Codex is asked about the managed home.
35
+ */
36
+ function probeBackend(backend, executable, options = {}) {
37
+ const run = options.run ?? defaultProbeRun;
38
+ const env = options.env ?? process.env;
39
+ const minimum = exports.MINIMUM_BACKEND_VERSIONS[backend];
40
+ const versionRun = run(executable, ['--version'], env);
41
+ const version = versionRun.error
42
+ ? null
43
+ : (/(\d+\.\d+\.\d+)/.exec(`${versionRun.stdout ?? ''}`)?.[1] ?? null);
44
+ if (version === null) {
45
+ return {
46
+ version: null,
47
+ minimum,
48
+ versionOk: false,
49
+ loggedIn: false,
50
+ problem: `${backend} --version printed no version`,
51
+ };
52
+ }
53
+ const versionOk = compareVersions(version, minimum) >= 0;
54
+ if (backend === 'claude') {
55
+ const status = run(executable, ['auth', 'status', '--json'], env);
56
+ let loggedIn = false;
57
+ try {
58
+ loggedIn = JSON.parse(`${status.stdout ?? ''}`).loggedIn === true;
59
+ }
60
+ catch {
61
+ return {
62
+ version,
63
+ minimum,
64
+ versionOk,
65
+ loggedIn: false,
66
+ problem: 'claude auth status did not answer in JSON',
67
+ };
68
+ }
69
+ return { version, minimum, versionOk, loggedIn, problem: null };
70
+ }
71
+ const status = run(executable, ['login', 'status'], {
72
+ ...env,
73
+ ...(options.codexHome ? { CODEX_HOME: options.codexHome } : {}),
74
+ });
75
+ return {
76
+ version,
77
+ minimum,
78
+ versionOk,
79
+ loggedIn: !status.error && status.status === 0,
80
+ problem: null,
81
+ };
82
+ }
83
+ //# sourceMappingURL=backend-probe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-probe.js","sourceRoot":"","sources":["../../../src/cli/runtime/backend-probe.ts"],"names":[],"mappings":";;;AAoBA,0CAMC;AAGD,0CAQC;AAgBD,oCAiDC;AAtGD,2DAAsE;AAEtE;;;;GAIG;AACU,QAAA,wBAAwB,GAAG;IACtC,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;CACR,CAAC;AAUX,SAAgB,eAAe,CAC7B,OAAe,EACf,IAAc,EACd,GAAuB;IAEvB,OAAO,IAAA,8BAAS,EAAC,OAAO,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAClG,CAAC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AAC,CAAC,CAAC,EAAE,CAAC;KAChE,CAAC,CAAC;IACH,OAAO;QACL,OAAO;QACP,OAAO;QACP,SAAS;QACT,QAAQ,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAC9C,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
@@ -0,0 +1,114 @@
1
+ import { type Stats } from 'node:fs';
2
+ import type { W1Config } from '../../runtime/config.js';
3
+ /** One path in a backup, named by its place in the archive. */
4
+ export interface BackupEntry {
5
+ readonly path: string;
6
+ readonly type: 'file' | 'dir' | 'symlink';
7
+ /** Permission bits as they were. */
8
+ readonly mode: number;
9
+ readonly size?: number;
10
+ readonly sha256?: string;
11
+ /** A symlink's target, as stored. */
12
+ readonly target?: string;
13
+ }
14
+ export interface BackupManifest {
15
+ readonly format: 'mama-backup';
16
+ readonly version: 1;
17
+ readonly createdAt: string;
18
+ readonly mama: string;
19
+ readonly platform: string;
20
+ /** The highest migration applied to the database, or null when it has none. */
21
+ readonly schemaVersion: number | null;
22
+ readonly includesSecrets: boolean;
23
+ readonly includesLogs: boolean;
24
+ /** Each archive prefix and the physical path it came from. */
25
+ readonly roots: Record<string, string>;
26
+ /** Every path the install was configured with, as written and as it really is. */
27
+ readonly configured: Record<string, ConfiguredPath | null>;
28
+ /** MAMA's own databases in the archive, each checked with integrity_check. */
29
+ readonly databases: string[];
30
+ readonly entries: BackupEntry[];
31
+ }
32
+ /** A tree or file archived under `prefix`, and which of its paths to keep. */
33
+ export interface BackupSource {
34
+ readonly prefix: string;
35
+ /** Physical path. */
36
+ readonly path: string;
37
+ readonly keep: (relativePath: string, stat: Stats) => boolean;
38
+ }
39
+ export interface BackupPlan {
40
+ readonly sources: BackupSource[];
41
+ /** The database file boot opens; the archive holds a copy taken with SQLite's backup. */
42
+ readonly database: string;
43
+ readonly configured: Record<string, ConfiguredPath | null>;
44
+ /** Top-level names in the MAMA root that this version does not read. */
45
+ readonly leftOut: string[];
46
+ /** Credentials that exist and were left out because they were not asked for. */
47
+ readonly secretsLeftOut: string[];
48
+ }
49
+ /** runtime/ files the current code reads back; the rest of runtime/ is per boot or per run. */
50
+ /** Files directly in the MAMA root that a backup keeps; restore accepts no other root files. */
51
+ export declare const ROOT_FILES: readonly ["config.yaml", "connectors.json", "owner-policy.md", "report-slots.json", "start.sh"];
52
+ /** Folders in the MAMA root that a backup keeps (logs only when asked), besides the workspace. */
53
+ export declare const ROOT_DIRS: readonly ["connectors", "downloads", "runtime", "logs"];
54
+ /** Folders in runtime/ that a backup keeps. */
55
+ export declare const RUNTIME_DIRS: readonly ["backfill"];
56
+ export declare const RUNTIME_FILES: Set<string>;
57
+ /** Setting paths whose string value sits under a credential name. Values are never read out. */
58
+ export declare function secretShapedKeys(value: unknown): string[];
59
+ /** A configured path as written and as it really is; restore rewrites both. */
60
+ export interface ConfiguredPath {
61
+ readonly configured: string;
62
+ readonly physical: string;
63
+ }
64
+ /**
65
+ * What a backup holds, from what the current code reads and writes (not from what a root happens
66
+ * to contain): the MAMA root's state, the database, the workspace, every person's tree under
67
+ * member_root, the published common skills, the wiki MAMA writes and Jev's vocabulary.
68
+ * Credentials, and any file that can hold one, come only with `includeSecrets`; logs only with
69
+ * `includeLogs`.
70
+ */
71
+ export declare function planBackup(config: W1Config, configPath: string, options: {
72
+ includeSecrets: boolean;
73
+ includeLogs: boolean;
74
+ home: string;
75
+ }): BackupPlan;
76
+ export interface CollectedEntries {
77
+ readonly entries: BackupEntry[];
78
+ /** Each entry's physical path, in archive order. */
79
+ readonly absolutes: string[];
80
+ }
81
+ /**
82
+ * The entries each source keeps, in the order tar will write them. A path reached twice (through
83
+ * overlapping sources) is kept once, under the first source that reached it.
84
+ */
85
+ export declare function collectEntries(sources: readonly BackupSource[]): Promise<CollectedEntries>;
86
+ /** Copy a SQLite database with its backup API and confirm the copy with integrity_check. */
87
+ export declare function copyDatabase(source: string, destination: string): Promise<{
88
+ schemaVersion: number | null;
89
+ }>;
90
+ /**
91
+ * integrity_check must answer ok. For MAMA's main database, also read the highest applied
92
+ * migration; another database's tables are its own.
93
+ */
94
+ export declare function checkDatabase(path: string, options?: {
95
+ schema: boolean;
96
+ }): {
97
+ schemaVersion: number | null;
98
+ };
99
+ /** The raw stores under connectors/: MAMA's own databases besides the main one. */
100
+ export declare function rawStores(root: string): string[];
101
+ /**
102
+ * Write exactly the collected entries, manifest first, each under its archive name, with modes
103
+ * and symlinks as they are. The file is created 0600 and flushed to disk before it returns.
104
+ */
105
+ export declare function writeArchive(file: string, manifestPath: string, collected: CollectedEntries): Promise<void>;
106
+ /** Flush a file or a folder's entries to disk. */
107
+ export declare function syncPath(path: string): void;
108
+ /**
109
+ * Read the archive back: the manifest comes first, every entry it lists is there once with its
110
+ * type and link target, nothing else is, and every file hashes to what the manifest recorded.
111
+ */
112
+ export declare function verifyArchive(file: string, manifest: BackupManifest): Promise<void>;
113
+ export declare function archiveName(now: Date): string;
114
+ //# sourceMappingURL=backup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backup.d.ts","sourceRoot":"","sources":["../../../src/cli/runtime/backup.ts"],"names":[],"mappings":"AACA,OAAO,EAWL,KAAK,KAAK,EACX,MAAM,SAAS,CAAC;AAKjB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAKxD,+DAA+D;AAC/D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;IAC1C,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,qCAAqC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7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