@codemem/core 0.0.0 → 0.20.0-alpha.2

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 (86) hide show
  1. package/LICENSE +21 -0
  2. package/dist/address-utils.d.ts +24 -0
  3. package/dist/address-utils.d.ts.map +1 -0
  4. package/dist/api-types.d.ts +580 -0
  5. package/dist/api-types.d.ts.map +1 -0
  6. package/dist/claude-hooks.d.ts +62 -0
  7. package/dist/claude-hooks.d.ts.map +1 -0
  8. package/dist/coordinator-api.d.ts +11 -0
  9. package/dist/coordinator-api.d.ts.map +1 -0
  10. package/dist/coordinator-invites.d.ts +28 -0
  11. package/dist/coordinator-invites.d.ts.map +1 -0
  12. package/dist/coordinator-store.d.ts +67 -0
  13. package/dist/coordinator-store.d.ts.map +1 -0
  14. package/dist/db.d.ts +97 -0
  15. package/dist/db.d.ts.map +1 -0
  16. package/dist/embeddings.d.ts +39 -0
  17. package/dist/embeddings.d.ts.map +1 -0
  18. package/dist/export-import.d.ts +48 -0
  19. package/dist/export-import.d.ts.map +1 -0
  20. package/dist/filters.d.ts +34 -0
  21. package/dist/filters.d.ts.map +1 -0
  22. package/dist/index.d.ts +66 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +7287 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/ingest-events.d.ts +34 -0
  27. package/dist/ingest-events.d.ts.map +1 -0
  28. package/dist/ingest-filters.d.ts +16 -0
  29. package/dist/ingest-filters.d.ts.map +1 -0
  30. package/dist/ingest-pipeline.d.ts +56 -0
  31. package/dist/ingest-pipeline.d.ts.map +1 -0
  32. package/dist/ingest-prompts.d.ts +22 -0
  33. package/dist/ingest-prompts.d.ts.map +1 -0
  34. package/dist/ingest-sanitize.d.ts +18 -0
  35. package/dist/ingest-sanitize.d.ts.map +1 -0
  36. package/dist/ingest-transcript.d.ts +41 -0
  37. package/dist/ingest-transcript.d.ts.map +1 -0
  38. package/dist/ingest-types.d.ts +70 -0
  39. package/dist/ingest-types.d.ts.map +1 -0
  40. package/dist/ingest-xml-parser.d.ts +20 -0
  41. package/dist/ingest-xml-parser.d.ts.map +1 -0
  42. package/dist/integers.d.ts +13 -0
  43. package/dist/integers.d.ts.map +1 -0
  44. package/dist/maintenance.d.ts +71 -0
  45. package/dist/maintenance.d.ts.map +1 -0
  46. package/dist/observer-auth.d.ts +65 -0
  47. package/dist/observer-auth.d.ts.map +1 -0
  48. package/dist/observer-client.d.ts +104 -0
  49. package/dist/observer-client.d.ts.map +1 -0
  50. package/dist/observer-config.d.ts +57 -0
  51. package/dist/observer-config.d.ts.map +1 -0
  52. package/dist/pack.d.ts +36 -0
  53. package/dist/pack.d.ts.map +1 -0
  54. package/dist/project.d.ts +12 -0
  55. package/dist/project.d.ts.map +1 -0
  56. package/dist/raw-event-flush.d.ts +43 -0
  57. package/dist/raw-event-flush.d.ts.map +1 -0
  58. package/dist/raw-event-sweeper.d.ts +92 -0
  59. package/dist/raw-event-sweeper.d.ts.map +1 -0
  60. package/dist/schema.d.ts +7368 -0
  61. package/dist/schema.d.ts.map +1 -0
  62. package/dist/search.d.ts +76 -0
  63. package/dist/search.d.ts.map +1 -0
  64. package/dist/store.d.ts +274 -0
  65. package/dist/store.d.ts.map +1 -0
  66. package/dist/sync-auth.d.ts +81 -0
  67. package/dist/sync-auth.d.ts.map +1 -0
  68. package/dist/sync-daemon.d.ts +50 -0
  69. package/dist/sync-daemon.d.ts.map +1 -0
  70. package/dist/sync-discovery.d.ts +93 -0
  71. package/dist/sync-discovery.d.ts.map +1 -0
  72. package/dist/sync-http-client.d.ts +26 -0
  73. package/dist/sync-http-client.d.ts.map +1 -0
  74. package/dist/sync-identity.d.ts +38 -0
  75. package/dist/sync-identity.d.ts.map +1 -0
  76. package/dist/sync-pass.d.ts +63 -0
  77. package/dist/sync-pass.d.ts.map +1 -0
  78. package/dist/sync-replication.d.ts +99 -0
  79. package/dist/sync-replication.d.ts.map +1 -0
  80. package/dist/test-utils.d.ts +27 -0
  81. package/dist/test-utils.d.ts.map +1 -0
  82. package/dist/types.d.ts +414 -0
  83. package/dist/types.d.ts.map +1 -0
  84. package/dist/vectors.d.ts +59 -0
  85. package/dist/vectors.d.ts.map +1 -0
  86. package/package.json +41 -1
@@ -0,0 +1,57 @@
1
+ /**
2
+ * OpenCode provider configuration loading and resolution.
3
+ *
4
+ * Mirrors codemem/observer_config.py — reads ~/.config/opencode/opencode.json{c},
5
+ * resolves custom provider settings (base URL, headers, API keys), and expands
6
+ * environment variable / file placeholders in config values.
7
+ */
8
+ /** Strip JavaScript-style `//` line comments and `/* ... *​/` block comments from JSONC text. */
9
+ export declare function stripJsonComments(text: string): string;
10
+ /** Remove trailing commas before `]` or `}` (outside strings). */
11
+ export declare function stripTrailingCommas(text: string): string;
12
+ /** Load OpenCode config from `~/.config/opencode/opencode.json{c}`. */
13
+ export declare function loadOpenCodeConfig(): Record<string, unknown>;
14
+ /** Expand `~/...` paths like Python's `Path(...).expanduser()`. */
15
+ export declare function expandUserPath(value: string): string;
16
+ /** Env var overrides matching Python's CONFIG_ENV_OVERRIDES. */
17
+ export declare const CODEMEM_CONFIG_ENV_OVERRIDES: Record<string, string>;
18
+ /** Resolve codemem config path with CODEMEM_CONFIG override. */
19
+ export declare function getCodememConfigPath(): string;
20
+ /** Read codemem config file with the same JSON/JSONC behavior as Python. */
21
+ export declare function readCodememConfigFile(): Record<string, unknown>;
22
+ /** Persist the codemem config file as normalized JSON. */
23
+ export declare function writeCodememConfigFile(data: Record<string, unknown>, configPath?: string): string;
24
+ /** Return active env overrides for codemem config keys. */
25
+ export declare function getCodememEnvOverrides(): Record<string, string>;
26
+ type AnyRecord = Record<string, unknown>;
27
+ /** Get provider-specific config block from the opencode config. */
28
+ export declare function getOpenCodeProviderConfig(provider: string): AnyRecord;
29
+ /** List all custom provider keys from the opencode config. */
30
+ export declare function listCustomProviders(): Set<string>;
31
+ /** Extract provider prefix from a model string like `"myprovider/model-name"`. */
32
+ export declare function resolveCustomProviderFromModel(model: string, providers: Set<string>): string | null;
33
+ /**
34
+ * Expand `$ENV_VAR` / `${ENV_VAR}` references and `{file:/path}` placeholders.
35
+ *
36
+ * Environment variable expansion mirrors Python's `os.path.expandvars`.
37
+ * File placeholders read the file content and substitute it inline.
38
+ */
39
+ export declare function resolvePlaceholder(value: string): string;
40
+ /** Extract the `options` sub-object from a provider config block. */
41
+ export declare function getProviderOptions(providerConfig: AnyRecord): AnyRecord;
42
+ /** Extract `baseURL` / `baseUrl` / `base_url` from provider config. */
43
+ export declare function getProviderBaseUrl(providerConfig: AnyRecord): string | null;
44
+ /** Extract and resolve headers (with placeholder expansion) from provider config. */
45
+ export declare function getProviderHeaders(providerConfig: AnyRecord): Record<string, string>;
46
+ /** Extract API key from provider config (direct value or env-var reference). */
47
+ export declare function getProviderApiKey(providerConfig: AnyRecord): string | null;
48
+ /** Find the default model for a custom provider. */
49
+ export declare function resolveCustomProviderDefaultModel(provider: string): string | null;
50
+ /**
51
+ * Resolve base_url, model_id, and headers for a custom provider model.
52
+ *
53
+ * Returns `[baseUrl, modelId, headers]`.
54
+ */
55
+ export declare function resolveCustomProviderModel(provider: string, modelName: string): [baseUrl: string | null, modelId: string | null, headers: Record<string, string>];
56
+ export {};
57
+ //# sourceMappingURL=observer-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observer-config.d.ts","sourceRoot":"","sources":["../src/observer-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,iGAAiG;AACjG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA+CtD;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgCxD;AAMD,uEAAuE;AACvE,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA2B5D;AAED,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAA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C,cAAc,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAa1E;AAMD,oDAAoD;AACpD,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmBjF;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACzC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GACf,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA2BnF"}
package/dist/pack.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Memory pack builder — port of codemem/store/packs.py.
3
+ *
4
+ * Builds a formatted "memory pack" from search results, organized into
5
+ * sections (summary, timeline, observations) with token budgeting.
6
+ *
7
+ * Ported: exact dedup, tag-overlap sorting, summary/observation fallback,
8
+ * support_count, separate section dedup, semantic candidate merging.
9
+ *
10
+ * Semantic candidate merging is supported via `buildMemoryPackAsync` or
11
+ * by passing pre-computed semantic results to `buildMemoryPack`.
12
+ *
13
+ * NOT ported: fuzzy search, task/recall mode detection, pack delta
14
+ * tracking, discovery-token work estimation.
15
+ */
16
+ import type { Database } from "./db.js";
17
+ import type { StoreHandle } from "./search.js";
18
+ import type { MemoryFilters, MemoryResult, PackResponse } from "./types.js";
19
+ /** Rough token estimate: ~4 chars per token. */
20
+ export declare function estimateTokens(text: string): number;
21
+ export declare function buildMemoryPack(store: StoreHandle, context: string, limit?: number, tokenBudget?: number | null, filters?: MemoryFilters, semanticResults?: MemoryResult[]): PackResponse;
22
+ /**
23
+ * Build a memory pack with semantic candidate merging.
24
+ *
25
+ * This is the async version that runs `semanticSearch` against the
26
+ * sqlite-vec `memory_vectors` table, then merges those candidates
27
+ * with FTS results via the sync `buildMemoryPack`.
28
+ *
29
+ * Callers that don't want/need async can still use the sync
30
+ * `buildMemoryPack` directly — semantic candidates simply won't
31
+ * be included.
32
+ */
33
+ export declare function buildMemoryPackAsync(store: StoreHandle & {
34
+ db: Database;
35
+ }, context: string, limit?: number, tokenBudget?: number | null, filters?: MemoryFilters): Promise<PackResponse>;
36
+ //# sourceMappingURL=pack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../src/pack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAY,YAAY,EAAE,MAAM,YAAY,CAAC;AAuBtF,gDAAgD;AAChD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAoKD,wBAAgB,eAAe,CAC9B,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM,EACf,KAAK,SAAK,EACV,WAAW,GAAE,MAAM,GAAG,IAAW,EACjC,OAAO,CAAC,EAAE,aAAa,EACvB,eAAe,CAAC,EAAE,YAAY,EAAE,GAC9B,YAAY,CAiLd;AAMD;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACzC,KAAK,EAAE,WAAW,GAAG;IAAE,EAAE,EAAE,QAAQ,CAAA;CAAE,EACrC,OAAO,EAAE,MAAM,EACf,KAAK,SAAK,EACV,WAAW,GAAE,MAAM,GAAG,IAAW,EACjC,OAAO,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAuCvB"}
@@ -0,0 +1,12 @@
1
+ export declare function projectBasename(value: string): string;
2
+ export declare function projectColumnClause(columnExpr: string, project: string): {
3
+ clause: string;
4
+ params: string[];
5
+ };
6
+ export declare function projectClause(project: string): {
7
+ clause: string;
8
+ params: string[];
9
+ };
10
+ export declare function projectMatchesFilter(projectFilter: string | null | undefined, itemProject: string | null | undefined): boolean;
11
+ export declare function resolveProject(cwd: string, override?: string | null): string | null;
12
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKrD;AAED,wBAAgB,mBAAmB,CAClC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACb;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAStC;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAEnF;AAED,wBAAgB,oBAAoB,CACnC,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACxC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACpC,OAAO,CAUT;AAkCD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAUnF"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Raw event flush orchestration — bridge between the sweeper and the ingest pipeline.
3
+ *
4
+ * Ports the core flush logic from codemem/raw_event_flush.py.
5
+ *
6
+ * Reads unflushed raw events for a session, creates a batch record,
7
+ * builds an IngestPayload, runs it through the ingest pipeline,
8
+ * and updates flush state on success (or records failure details).
9
+ */
10
+ import { type IngestOptions } from "./ingest-pipeline.js";
11
+ import type { SessionContext } from "./ingest-types.js";
12
+ import type { MemoryStore } from "./store.js";
13
+ /**
14
+ * Build session context from raw events — extracts prompt count, tool count,
15
+ * duration, files modified/read, and first user prompt.
16
+ *
17
+ * Port of build_session_context() from raw_event_flush.py.
18
+ */
19
+ export declare function buildSessionContext(events: Record<string, unknown>[]): SessionContext;
20
+ export interface FlushRawEventsOptions {
21
+ opencodeSessionId: string;
22
+ source?: string;
23
+ cwd?: string | null;
24
+ project?: string | null;
25
+ startedAt?: string | null;
26
+ maxEvents?: number | null;
27
+ }
28
+ /**
29
+ * Flush raw events for a single session through the ingest pipeline.
30
+ *
31
+ * 1. Reads unflushed raw events from the store
32
+ * 2. Creates/claims a flush batch for idempotency
33
+ * 3. Builds session context and IngestPayload
34
+ * 4. Calls ingest()
35
+ * 5. Updates flush state on success; records failure details on error
36
+ *
37
+ * Port of flush_raw_events() from raw_event_flush.py.
38
+ */
39
+ export declare function flushRawEvents(store: MemoryStore, ingestOpts: IngestOptions, opts: FlushRawEventsOptions): Promise<{
40
+ flushed: number;
41
+ updatedState: number;
42
+ }>;
43
+ //# sourceMappingURL=raw-event-flush.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raw-event-flush.d.ts","sourceRoot":"","sources":["../src/raw-event-flush.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAU,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA+C9C;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,cAAc,CA6DrF;AAMD,MAAM,WAAW,qBAAqB;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CACnC,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,aAAa,EACzB,IAAI,EAAE,qBAAqB,GACzB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,CAyGpD"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * RawEventSweeper — periodically processes raw events into memories.
3
+ *
4
+ * Ports codemem/viewer_raw_events.py RawEventSweeper class.
5
+ *
6
+ * Uses setInterval (Node single-threaded) instead of Python threads.
7
+ * The sweeper takes a shared MemoryStore and an IngestOptions provider.
8
+ *
9
+ * Each tick():
10
+ * 1. Check if enabled
11
+ * 2. Check auth backoff
12
+ * 3. Purge old events (if retention configured)
13
+ * 4. Mark stuck batches as error
14
+ * 5. Flush sessions with pending queue entries
15
+ * 6. Flush idle sessions with unflushed events
16
+ * 7. Handle auth errors by setting backoff
17
+ */
18
+ import type { IngestOptions } from "./ingest-pipeline.js";
19
+ import type { MemoryStore } from "./store.js";
20
+ export declare class RawEventSweeper {
21
+ private store;
22
+ private ingestOpts;
23
+ private active;
24
+ private running;
25
+ private currentTick;
26
+ private wakeHandle;
27
+ private loopHandle;
28
+ private authBackoffUntil;
29
+ private authErrorLogged;
30
+ constructor(store: MemoryStore, ingestOpts: IngestOptions);
31
+ private enabled;
32
+ private intervalMs;
33
+ private idleMs;
34
+ private limit;
35
+ private workerMaxEvents;
36
+ private retentionMs;
37
+ private stuckBatchMs;
38
+ private handleAuthError;
39
+ /**
40
+ * Reset the auth backoff and wake the worker.
41
+ * Call this after credentials are refreshed.
42
+ */
43
+ resetAuthBackoff(): void;
44
+ /**
45
+ * Return the current auth backoff status.
46
+ */
47
+ authBackoffStatus(): {
48
+ active: boolean;
49
+ remainingS: number;
50
+ };
51
+ /**
52
+ * Start the sweeper loop.
53
+ * Uses a self-scheduling async loop (sleep → tick → sleep) to prevent
54
+ * overlapping ticks. This mirrors the Python threading pattern where
55
+ * the thread sleeps, runs tick() synchronously, then sleeps again.
56
+ * No-op if sweeper is disabled or already running.
57
+ */
58
+ start(): void;
59
+ /**
60
+ * Stop the sweeper. Cancels the next scheduled tick and waits for any
61
+ * in-progress tick to finish before returning.
62
+ */
63
+ stop(): Promise<void>;
64
+ /**
65
+ * Notify the sweeper that config changed.
66
+ * Schedules an extra tick after a short delay.
67
+ */
68
+ notifyConfigChanged(): void;
69
+ /**
70
+ * Notify the sweeper that new events arrived (nudge it to flush soon).
71
+ * Mirrors Python's RawEventFlusher.note_activity() — schedules a near-
72
+ * immediate extra tick so events are processed without waiting for the
73
+ * full interval.
74
+ */
75
+ nudge(): void;
76
+ /** Schedule the next tick after the configured interval. */
77
+ private scheduleNext;
78
+ /** Execute a tick with reentrancy protection. */
79
+ private runTick;
80
+ private wake;
81
+ /**
82
+ * Execute one sweep cycle. Public for testing.
83
+ *
84
+ * 1. Check enabled / auth backoff
85
+ * 2. Purge old events
86
+ * 3. Mark stuck batches
87
+ * 4. Flush pending queue sessions
88
+ * 5. Flush idle sessions
89
+ */
90
+ tick(): Promise<void>;
91
+ }
92
+ //# sourceMappingURL=raw-event-sweeper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raw-event-sweeper.d.ts","sourceRoot":"","sources":["../src/raw-event-sweeper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAyB9C,qBAAa,eAAe;IAC3B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,UAAU,CAA8C;IAChE,OAAO,CAAC,UAAU,CAA8C;IAChE,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO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