@getengram/cli 0.6.0 → 0.7.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/LICENSE +112 -0
- package/README.md +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +38 -11
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/conversations.d.ts.map +1 -1
- package/dist/commands/conversations.js +8 -2
- package/dist/commands/conversations.js.map +1 -1
- package/dist/commands/exclude.d.ts.map +1 -1
- package/dist/commands/exclude.js +73 -21
- package/dist/commands/exclude.js.map +1 -1
- package/dist/commands/import.d.ts +30 -3
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/commands/import.js +374 -45
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +144 -29
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/search.js +2 -2
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/status.d.ts +16 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +51 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/store.d.ts.map +1 -1
- package/dist/commands/store.js +19 -3
- package/dist/commands/store.js.map +1 -1
- package/dist/commands/upgrade.d.ts +24 -0
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +64 -15
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/commands/usage.d.ts +44 -0
- package/dist/commands/usage.d.ts.map +1 -1
- package/dist/commands/usage.js +79 -19
- package/dist/commands/usage.js.map +1 -1
- package/dist/commands/vault.d.ts +11 -2
- package/dist/commands/vault.d.ts.map +1 -1
- package/dist/commands/vault.js +372 -53
- package/dist/commands/vault.js.map +1 -1
- package/dist/config-file.d.ts +74 -0
- package/dist/config-file.d.ts.map +1 -0
- package/dist/config-file.js +152 -0
- package/dist/config-file.js.map +1 -0
- package/dist/config-guard.d.ts +96 -0
- package/dist/config-guard.d.ts.map +1 -0
- package/dist/config-guard.js +184 -0
- package/dist/config-guard.js.map +1 -0
- package/dist/config.d.ts +48 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +101 -12
- package/dist/config.js.map +1 -1
- package/dist/daemon/as-root.d.ts +46 -0
- package/dist/daemon/as-root.d.ts.map +1 -0
- package/dist/daemon/as-root.js +64 -0
- package/dist/daemon/as-root.js.map +1 -0
- package/dist/daemon/backoff.d.ts +26 -0
- package/dist/daemon/backoff.d.ts.map +1 -0
- package/dist/daemon/backoff.js +37 -0
- package/dist/daemon/backoff.js.map +1 -0
- package/dist/daemon/codex-parser.d.ts +38 -4
- package/dist/daemon/codex-parser.d.ts.map +1 -1
- package/dist/daemon/codex-parser.js +111 -23
- package/dist/daemon/codex-parser.js.map +1 -1
- package/dist/daemon/command-path.d.ts +13 -0
- package/dist/daemon/command-path.d.ts.map +1 -0
- package/dist/daemon/command-path.js +35 -0
- package/dist/daemon/command-path.js.map +1 -0
- package/dist/daemon/commands.d.ts +153 -3
- package/dist/daemon/commands.d.ts.map +1 -1
- package/dist/daemon/commands.js +2775 -235
- package/dist/daemon/commands.js.map +1 -1
- package/dist/daemon/db.d.ts +255 -27
- package/dist/daemon/db.d.ts.map +1 -1
- package/dist/daemon/db.js +749 -53
- package/dist/daemon/db.js.map +1 -1
- package/dist/daemon/exclusions.d.ts +23 -3
- package/dist/daemon/exclusions.d.ts.map +1 -1
- package/dist/daemon/exclusions.js +91 -21
- package/dist/daemon/exclusions.js.map +1 -1
- package/dist/daemon/homebrew.d.ts +26 -0
- package/dist/daemon/homebrew.d.ts.map +1 -0
- package/dist/daemon/homebrew.js +43 -0
- package/dist/daemon/homebrew.js.map +1 -0
- package/dist/daemon/instance.d.ts +427 -0
- package/dist/daemon/instance.d.ts.map +1 -0
- package/dist/daemon/instance.js +1201 -0
- package/dist/daemon/instance.js.map +1 -0
- package/dist/daemon/key-source.d.ts +41 -0
- package/dist/daemon/key-source.d.ts.map +1 -0
- package/dist/daemon/key-source.js +89 -0
- package/dist/daemon/key-source.js.map +1 -0
- package/dist/daemon/launch.d.ts +56 -0
- package/dist/daemon/launch.d.ts.map +1 -0
- package/dist/daemon/launch.js +153 -0
- package/dist/daemon/launch.js.map +1 -0
- package/dist/daemon/launchd.d.ts +215 -0
- package/dist/daemon/launchd.d.ts.map +1 -0
- package/dist/daemon/launchd.js +527 -0
- package/dist/daemon/launchd.js.map +1 -0
- package/dist/daemon/login-start.d.ts +2 -0
- package/dist/daemon/login-start.d.ts.map +1 -0
- package/dist/daemon/login-start.js +25 -0
- package/dist/daemon/login-start.js.map +1 -0
- package/dist/daemon/ownership.d.ts +123 -0
- package/dist/daemon/ownership.d.ts.map +1 -0
- package/dist/daemon/ownership.js +245 -0
- package/dist/daemon/ownership.js.map +1 -0
- package/dist/daemon/package-runner.d.ts +28 -0
- package/dist/daemon/package-runner.d.ts.map +1 -0
- package/dist/daemon/package-runner.js +113 -0
- package/dist/daemon/package-runner.js.map +1 -0
- package/dist/daemon/parser.d.ts +50 -5
- package/dist/daemon/parser.d.ts.map +1 -1
- package/dist/daemon/parser.js +224 -47
- package/dist/daemon/parser.js.map +1 -1
- package/dist/daemon/powershell.d.ts +25 -0
- package/dist/daemon/powershell.d.ts.map +1 -0
- package/dist/daemon/powershell.js +30 -0
- package/dist/daemon/powershell.js.map +1 -0
- package/dist/daemon/preflight.d.ts +0 -17
- package/dist/daemon/preflight.d.ts.map +1 -1
- package/dist/daemon/preflight.js +32 -6
- package/dist/daemon/preflight.js.map +1 -1
- package/dist/daemon/prune.d.ts +101 -0
- package/dist/daemon/prune.d.ts.map +1 -0
- package/dist/daemon/prune.js +287 -0
- package/dist/daemon/prune.js.map +1 -0
- package/dist/daemon/queue-error.d.ts +47 -0
- package/dist/daemon/queue-error.d.ts.map +1 -0
- package/dist/daemon/queue-error.js +59 -0
- package/dist/daemon/queue-error.js.map +1 -0
- package/dist/daemon/root-daemon.d.ts +60 -0
- package/dist/daemon/root-daemon.d.ts.map +1 -0
- package/dist/daemon/root-daemon.js +86 -0
- package/dist/daemon/root-daemon.js.map +1 -0
- package/dist/daemon/scoop.d.ts +52 -0
- package/dist/daemon/scoop.d.ts.map +1 -0
- package/dist/daemon/scoop.js +84 -0
- package/dist/daemon/scoop.js.map +1 -0
- package/dist/daemon/scrubber.d.ts +456 -0
- package/dist/daemon/scrubber.d.ts.map +1 -0
- package/dist/daemon/scrubber.js +994 -0
- package/dist/daemon/scrubber.js.map +1 -0
- package/dist/daemon/status.d.ts +306 -11
- package/dist/daemon/status.d.ts.map +1 -1
- package/dist/daemon/status.js +568 -43
- package/dist/daemon/status.js.map +1 -1
- package/dist/daemon/supervise.d.ts +78 -0
- package/dist/daemon/supervise.d.ts.map +1 -0
- package/dist/daemon/supervise.js +121 -0
- package/dist/daemon/supervise.js.map +1 -0
- package/dist/daemon/supervisor.d.ts +18 -0
- package/dist/daemon/supervisor.d.ts.map +1 -0
- package/dist/daemon/supervisor.js +56 -0
- package/dist/daemon/supervisor.js.map +1 -0
- package/dist/daemon/syncer.d.ts +382 -21
- package/dist/daemon/syncer.d.ts.map +1 -1
- package/dist/daemon/syncer.js +1448 -178
- package/dist/daemon/syncer.js.map +1 -1
- package/dist/daemon/systemd.d.ts +109 -0
- package/dist/daemon/systemd.d.ts.map +1 -0
- package/dist/daemon/systemd.js +363 -0
- package/dist/daemon/systemd.js.map +1 -0
- package/dist/daemon/types.d.ts +58 -6
- package/dist/daemon/types.d.ts.map +1 -1
- package/dist/daemon/vault-changed.d.ts +29 -0
- package/dist/daemon/vault-changed.d.ts.map +1 -0
- package/dist/daemon/vault-changed.js +47 -0
- package/dist/daemon/vault-changed.js.map +1 -0
- package/dist/daemon/vault-key-missing.d.ts +70 -0
- package/dist/daemon/vault-key-missing.d.ts.map +1 -0
- package/dist/daemon/vault-key-missing.js +125 -0
- package/dist/daemon/vault-key-missing.js.map +1 -0
- package/dist/daemon/watcher.d.ts +87 -4
- package/dist/daemon/watcher.d.ts.map +1 -1
- package/dist/daemon/watcher.js +286 -36
- package/dist/daemon/watcher.js.map +1 -1
- package/dist/daemon/worker-main.js +363 -51
- package/dist/daemon/worker-main.js.map +1 -1
- package/dist/daemon/worker.js +19 -1
- package/dist/daemon/worker.js.map +1 -1
- package/dist/import-resume.d.ts +163 -0
- package/dist/import-resume.d.ts.map +1 -0
- package/dist/import-resume.js +267 -0
- package/dist/import-resume.js.map +1 -0
- package/dist/index.js +242 -33
- package/dist/index.js.map +1 -1
- package/dist/message-bounds.d.ts +52 -0
- package/dist/message-bounds.d.ts.map +1 -0
- package/dist/message-bounds.js +157 -0
- package/dist/message-bounds.js.map +1 -0
- package/dist/output.d.ts +14 -0
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +33 -5
- package/dist/output.js.map +1 -1
- package/dist/private-files.d.ts +126 -0
- package/dist/private-files.d.ts.map +1 -0
- package/dist/private-files.js +372 -0
- package/dist/private-files.js.map +1 -0
- package/dist/server-url.d.ts +31 -0
- package/dist/server-url.d.ts.map +1 -0
- package/dist/server-url.js +47 -0
- package/dist/server-url.js.map +1 -0
- package/dist/vault-key.d.ts +122 -0
- package/dist/vault-key.d.ts.map +1 -0
- package/dist/vault-key.js +273 -0
- package/dist/vault-key.js.map +1 -0
- package/package.json +11 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: Get Engram LLC
|
|
6
|
+
Licensed Work: Engram
|
|
7
|
+
The Licensed Work is (c) 2026 Get Engram LLC.
|
|
8
|
+
Additional Use Grant: You may make use of the Licensed Work, provided that
|
|
9
|
+
you may not use the Licensed Work for a Memory Service.
|
|
10
|
+
|
|
11
|
+
A "Memory Service" is a commercial offering that allows
|
|
12
|
+
third parties to access the functionality of the Licensed
|
|
13
|
+
Work by providing conversation storage, semantic search,
|
|
14
|
+
or agent memory capabilities as a hosted or managed
|
|
15
|
+
service.
|
|
16
|
+
|
|
17
|
+
For clarity, the following are NOT restricted:
|
|
18
|
+
- Self-hosting the Licensed Work for your own internal use
|
|
19
|
+
- Using the Licensed Work as part of a product that is not
|
|
20
|
+
primarily a memory or conversation storage service
|
|
21
|
+
- Integrating with the hosted Engram service at
|
|
22
|
+
getengram.app via its APIs
|
|
23
|
+
|
|
24
|
+
Change Date: May 14, 2030
|
|
25
|
+
Change License: Apache License, Version 2.0
|
|
26
|
+
|
|
27
|
+
Exception: The following subdirectory is licensed under the Mozilla
|
|
28
|
+
Public License 2.0, as indicated by a LICENSE file within the directory:
|
|
29
|
+
|
|
30
|
+
- packages/sdk (@getengram/sdk, published to npm)
|
|
31
|
+
|
|
32
|
+
For information about alternative licensing arrangements for the Licensed Work,
|
|
33
|
+
please contact hello@getengram.app.
|
|
34
|
+
|
|
35
|
+
Notice
|
|
36
|
+
|
|
37
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
38
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
39
|
+
under an Open Source License, as stated in this License.
|
|
40
|
+
|
|
41
|
+
License text below is the full BSL 1.1 text copyright MariaDB Corporation Ab.
|
|
42
|
+
|
|
43
|
+
-----------------------------------------------------------------------------
|
|
44
|
+
|
|
45
|
+
Business Source License 1.1
|
|
46
|
+
|
|
47
|
+
Terms
|
|
48
|
+
|
|
49
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
50
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
51
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
52
|
+
production use.
|
|
53
|
+
|
|
54
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
55
|
+
available distribution of a specific version of the Licensed Work under this
|
|
56
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
57
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
58
|
+
above terminate.
|
|
59
|
+
|
|
60
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
61
|
+
currently in effect as described in this License, you must purchase a
|
|
62
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
63
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
64
|
+
|
|
65
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
66
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
67
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
68
|
+
for each version of the Licensed Work released by Licensor.
|
|
69
|
+
|
|
70
|
+
You must conspicuously display this License on each original or modified copy
|
|
71
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
72
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
73
|
+
License apply to your use of that work.
|
|
74
|
+
|
|
75
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
76
|
+
terminate your rights under this License for the current and all other
|
|
77
|
+
versions of the Licensed Work.
|
|
78
|
+
|
|
79
|
+
This License does not grant you any right in any trademark or logo of
|
|
80
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
81
|
+
Licensor as expressly required by this License).
|
|
82
|
+
|
|
83
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
84
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
87
|
+
TITLE.
|
|
88
|
+
|
|
89
|
+
MariaDB hereby grants you permission to use this License's text to license
|
|
90
|
+
your works, and to refer to it using the trademark "Business Source License",
|
|
91
|
+
as long as you comply with the Covenants of Licensor below.
|
|
92
|
+
|
|
93
|
+
Covenants of Licensor
|
|
94
|
+
|
|
95
|
+
In consideration of the right to use this License's text and the "Business
|
|
96
|
+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
97
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
98
|
+
|
|
99
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
100
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
101
|
+
where "compatible" means that software provided under the Change License can
|
|
102
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
103
|
+
later version. Licensor may specify additional Change Licenses without
|
|
104
|
+
limitation.
|
|
105
|
+
|
|
106
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
107
|
+
impose any additional restriction on the right granted in this License, as
|
|
108
|
+
the Additional Use Grant; or (b) insert the text "None".
|
|
109
|
+
|
|
110
|
+
3. To specify a Change Date.
|
|
111
|
+
|
|
112
|
+
4. Not to modify this License in any other way.
|
package/README.md
CHANGED
|
@@ -95,7 +95,7 @@ engram search "deploy" --json | jq '.results[0].score'
|
|
|
95
95
|
|
|
96
96
|
## Configuration
|
|
97
97
|
|
|
98
|
-
Credentials are stored in `~/.engram/config.json
|
|
98
|
+
Credentials are stored in `~/.engram/config.json`, with the folders excluded from capture. If the file is there but can't be read, capture waits and commands that would save it stop, rather than lose your key and exclusions; `engram status` says why.
|
|
99
99
|
|
|
100
100
|
### Environment Variables
|
|
101
101
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAOA,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAyC7D;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CA2BhD;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAchD"}
|
package/dist/commands/auth.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveBaseUrl } from "../config.js";
|
|
2
|
+
import { loadConfigForUpdate, loadConfigForUse, requireWritableConfig, saveConfigOrExit } from "../config-guard.js";
|
|
2
3
|
import { green, red } from "../output.js";
|
|
3
4
|
import { Engram } from "@getengram/sdk";
|
|
4
5
|
import { autoEnableCapture } from "../daemon/commands.js";
|
|
6
|
+
import { engramCommand } from "../daemon/package-runner.js";
|
|
5
7
|
export async function authLogin(args) {
|
|
6
8
|
const key = args[0];
|
|
7
9
|
if (!key) {
|
|
@@ -14,35 +16,60 @@ export async function authLogin(args) {
|
|
|
14
16
|
console.error(red("Invalid API key format. Keys start with engram_sk_live_"));
|
|
15
17
|
process.exit(1);
|
|
16
18
|
}
|
|
17
|
-
//
|
|
19
|
+
// Strict, before the key is sent anywhere (engram#673): read leniently,
|
|
20
|
+
// a file that couldn't be read named no server, so the key went to the
|
|
21
|
+
// default one, and was then saved over the file and what was in it.
|
|
22
|
+
const config = await loadConfigForUpdate();
|
|
23
|
+
// Before the key is sent to be checked (engram#717).
|
|
24
|
+
requireWritableConfig(["So the key wasn't checked or saved."]);
|
|
25
|
+
// Check the key against the server it will be used with, the one every
|
|
26
|
+
// other command and the daemon use (engram#625). This used the SDK's
|
|
27
|
+
// default server whatever was configured: it refused keys for any other
|
|
28
|
+
// server, and sent them to that one.
|
|
18
29
|
try {
|
|
19
|
-
const engram = new Engram({ apiKey: key });
|
|
30
|
+
const engram = new Engram({ apiKey: key, baseUrl: resolveBaseUrl(config) });
|
|
20
31
|
await engram.listConversations({ limit: 1 });
|
|
21
32
|
}
|
|
22
33
|
catch {
|
|
23
34
|
console.error(red("Authentication failed. Check your API key."));
|
|
24
35
|
process.exit(1);
|
|
25
36
|
}
|
|
26
|
-
const config = await loadConfig();
|
|
27
37
|
config.apiKey = key;
|
|
28
|
-
await
|
|
38
|
+
await saveConfigOrExit(config, ["So the key wasn't saved."]);
|
|
29
39
|
console.log(green("✓ Authenticated successfully"));
|
|
30
40
|
console.log(` Key saved to ~/.engram/config.json`);
|
|
31
41
|
console.log(` Prefix: ${key.slice(0, 20)}...`);
|
|
32
|
-
await autoEnableCapture();
|
|
42
|
+
await autoEnableCapture({ after: "login" });
|
|
33
43
|
}
|
|
34
44
|
export async function authLogout() {
|
|
35
|
-
const config = await
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
const config = await loadConfigForUpdate([
|
|
46
|
+
`To sign out anyway: run '${engramCommand("stop")}', then remove the file. The folders you`,
|
|
47
|
+
"excluded from capture go with it.",
|
|
48
|
+
]);
|
|
49
|
+
// With no key saved there's nothing to remove, so nothing is written: a
|
|
50
|
+
// config.json that can't be written isn't a reason to stop (engram#717).
|
|
51
|
+
if (config.apiKey !== undefined) {
|
|
52
|
+
delete config.apiKey;
|
|
53
|
+
await saveConfigOrExit(config, ["You're still signed in, and auto-capture keeps using the key saved there."], "auth logout");
|
|
54
|
+
}
|
|
38
55
|
console.log(green("✓ Logged out"));
|
|
56
|
+
// The daemon reads config.json every few seconds (engram#594).
|
|
57
|
+
console.log(" Auto-capture stops sending within a few seconds.");
|
|
58
|
+
console.log(" Messages already queued stay on this machine and are sent only with a key");
|
|
59
|
+
console.log(" for the account they were captured under.");
|
|
60
|
+
console.log(" Anything written while signed out is captured for the next account that signs in.");
|
|
61
|
+
if (process.env.ENGRAM_API_KEY) {
|
|
62
|
+
console.log(red(" ENGRAM_API_KEY is set in this shell: commands run here, and a daemon started from here,\n") +
|
|
63
|
+
red(" keep using that key. Unset it to sign out completely."));
|
|
64
|
+
}
|
|
39
65
|
}
|
|
40
66
|
export async function authStatus() {
|
|
41
|
-
|
|
67
|
+
// Strict (engram#673): one that can't be read isn't "not authenticated".
|
|
68
|
+
const config = await loadConfigForUse();
|
|
42
69
|
const key = process.env.ENGRAM_API_KEY ?? config.apiKey;
|
|
43
70
|
if (!key) {
|
|
44
71
|
console.log("Not authenticated");
|
|
45
|
-
console.log(
|
|
72
|
+
console.log(`\nRun: ${engramCommand("auth login <api-key>")}`);
|
|
46
73
|
return;
|
|
47
74
|
}
|
|
48
75
|
const source = process.env.ENGRAM_API_KEY ? "ENGRAM_API_KEY env var" : "~/.engram/config.json";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACpH,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAc;IAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAEpB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACpD,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5B,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACvC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC,CAAC;QAC9E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,wEAAwE;IACxE,uEAAuE;IACvE,oEAAoE;IACpE,MAAM,MAAM,GAAG,MAAM,mBAAmB,EAAE,CAAC;IAC3C,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version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/commands/conversations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/commands/conversations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CAiCf;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CAcf;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CAef"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { json, table, green, dim } from "../output.js";
|
|
1
|
+
import { json, table, green, dim, plural } from "../output.js";
|
|
2
2
|
export async function listConversations(engram, args, flags) {
|
|
3
3
|
const result = await engram.listConversations({
|
|
4
4
|
limit: flags.limit ? parseInt(flags.limit) : undefined,
|
|
5
|
+
offset: flags.offset ? parseInt(flags.offset) : undefined,
|
|
5
6
|
agentId: flags.agent,
|
|
6
7
|
tags: flags.tags ? flags.tags.split(",") : undefined,
|
|
7
8
|
sort: flags.sort,
|
|
@@ -11,7 +12,12 @@ export async function listConversations(engram, args, flags) {
|
|
|
11
12
|
json(result);
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
// `total` is the account-wide match count (engram#540); the table below is
|
|
16
|
+
// one page of it, so say so when they differ.
|
|
17
|
+
const shown = result.conversations.length;
|
|
18
|
+
console.log(shown < result.total
|
|
19
|
+
? `Showing ${shown} of ${plural(result.total, "conversation")} ${dim("(--limit/--offset to page)")}\n`
|
|
20
|
+
: `${plural(result.total, "conversation")}\n`);
|
|
15
21
|
table(result.conversations.map((c) => ({
|
|
16
22
|
id: c.id,
|
|
17
23
|
title: c.title ?? dim("(untitled)"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../src/commands/conversations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAO,GAAG,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../src/commands/conversations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAO,GAAG,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAc,EACd,IAAc,EACd,KAA6B;IAE7B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC;QAC5C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;QACtD,MAAM,E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EAAE,oBAAoB,CAAC,CAAC;QACpE,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exclude.d.ts","sourceRoot":"","sources":["../../src/commands/exclude.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exclude.d.ts","sourceRoot":"","sources":["../../src/commands/exclude.ts"],"names":[],"mappings":"AAiDA,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAe9D;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAajE;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAsBjD"}
|
package/dist/commands/exclude.js
CHANGED
|
@@ -1,20 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { loadConfigStrict } from "../config.js";
|
|
2
|
+
import { ConfigUnreadable, excludePathsOf } from "../config-file.js";
|
|
3
|
+
import { loadConfigForUpdate, lockedConfigDir, saveConfigOrExit } from "../config-guard.js";
|
|
4
|
+
import { lockedDirFix, lockedDirReason } from "../daemon/ownership.js";
|
|
5
|
+
import { normalizeExcludePath, samePath, IGNORE_MARKER } from "../daemon/exclusions.js";
|
|
6
|
+
import { engramCommand } from "../daemon/package-runner.js";
|
|
7
|
+
import { bold, dim, red } from "../output.js";
|
|
4
8
|
// `engram exclude` — keep whole repos/directories out of capture (engram#462).
|
|
5
|
-
// The daemon
|
|
6
|
-
// apply to the next
|
|
9
|
+
// The daemon checks config.json for changes before each captured batch, so
|
|
10
|
+
// changes apply to the next one with no restart.
|
|
11
|
+
/**
|
|
12
|
+
* Stop, saying why the excluded folders can't be `what` (engram#673): what
|
|
13
|
+
* is wrong with config.json, or that ~/.engram itself keeps it from being
|
|
14
|
+
* opened (engram#723), when nothing in the file needs fixing.
|
|
15
|
+
*/
|
|
16
|
+
function cantUse(err, what) {
|
|
17
|
+
const locked = err instanceof ConfigUnreadable ? lockedConfigDir(err) : null;
|
|
18
|
+
const why = locked
|
|
19
|
+
? lockedDirReason("opening config.json")
|
|
20
|
+
: err instanceof ConfigUnreadable
|
|
21
|
+
? err.message
|
|
22
|
+
: "~/.engram/config.json can't be read";
|
|
23
|
+
console.error(red(`Error: ${why}, so the folders excluded from capture can't be ${what}.`));
|
|
24
|
+
if (locked) {
|
|
25
|
+
console.error(` ${lockedDirFix(locked)}`);
|
|
26
|
+
console.error(" Then run this again.");
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
console.error(" Fix the file, then run this again.");
|
|
30
|
+
}
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* config.json's settings and the folders excluded in them, for a command
|
|
35
|
+
* that changes the list and saves the file (engram#673). Read leniently, a
|
|
36
|
+
* file that couldn't be read was saved with only the one change: the API
|
|
37
|
+
* key and every other excluded folder were gone.
|
|
38
|
+
*/
|
|
39
|
+
async function loadForUpdate() {
|
|
40
|
+
const config = await loadConfigForUpdate();
|
|
41
|
+
try {
|
|
42
|
+
return { config, paths: excludePathsOf(config) };
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
cantUse(err, "changed");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
7
48
|
export async function excludeAdd(args) {
|
|
8
49
|
const target = normalizeExcludePath(args[0] ?? process.cwd());
|
|
9
|
-
const config = await
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
50
|
+
const { config, paths } = await loadForUpdate();
|
|
51
|
+
// On macOS and Windows, ~/Code/x and ~/code/x are one directory (engram#619).
|
|
52
|
+
const existing = paths.find((p) => samePath(p, target));
|
|
53
|
+
if (existing !== undefined) {
|
|
54
|
+
console.log(`${bold("Already excluded:")} ${existing}`);
|
|
13
55
|
return;
|
|
14
56
|
}
|
|
15
|
-
paths.
|
|
16
|
-
config
|
|
17
|
-
await saveConfig(config);
|
|
57
|
+
config.excludePaths = [...paths, target].sort();
|
|
58
|
+
await saveConfigOrExit(config, [`Not excluded: sessions in ${target} are still captured.`]);
|
|
18
59
|
console.log(`${bold("Excluded from capture:")} ${target}`);
|
|
19
60
|
console.log(dim("Sessions in this directory (and below) will not be saved to Engram."));
|
|
20
61
|
console.log(dim("Applies immediately — no daemon restart needed. Already-captured"));
|
|
@@ -22,21 +63,32 @@ export async function excludeAdd(args) {
|
|
|
22
63
|
}
|
|
23
64
|
export async function excludeRemove(args) {
|
|
24
65
|
const target = normalizeExcludePath(args[0] ?? process.cwd());
|
|
25
|
-
const config = await
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
66
|
+
const { config, paths } = await loadForUpdate();
|
|
67
|
+
const removed = paths.filter((p) => samePath(p, target));
|
|
68
|
+
if (removed.length === 0) {
|
|
28
69
|
console.error(`Not in the exclude list: ${target}`);
|
|
29
|
-
console.error(dim(
|
|
70
|
+
console.error(dim(`Run '${engramCommand("exclude list")}' to see current exclusions.`));
|
|
30
71
|
process.exit(1);
|
|
31
72
|
}
|
|
32
|
-
config.excludePaths = paths.filter((p) => p
|
|
33
|
-
await
|
|
34
|
-
console.log(`${bold("Removed from exclusions:")} ${
|
|
73
|
+
config.excludePaths = paths.filter((p) => !samePath(p, target));
|
|
74
|
+
await saveConfigOrExit(config, [`Still excluded from capture: ${removed.join(", ")}`]);
|
|
75
|
+
console.log(`${bold("Removed from exclusions:")} ${removed.join(", ")}`);
|
|
35
76
|
console.log(dim("New sessions in this directory will be captured again."));
|
|
36
77
|
}
|
|
37
78
|
export async function excludeList() {
|
|
38
|
-
|
|
39
|
-
|
|
79
|
+
let paths;
|
|
80
|
+
try {
|
|
81
|
+
paths = excludePathsOf(await loadConfigStrict());
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
if (!(err instanceof ConfigUnreadable && err.empty))
|
|
85
|
+
cantUse(err, "listed");
|
|
86
|
+
// Capture waits on it (engram#673), and what it listed is gone.
|
|
87
|
+
console.error(red("~/.engram/config.json is empty, so capture waits. Add back any folders you had"));
|
|
88
|
+
console.error(red(` excluded ('${engramCommand("exclude add <path>")}'), then sign in again ('${engramCommand("login")}').`));
|
|
89
|
+
console.error("");
|
|
90
|
+
paths = [];
|
|
91
|
+
}
|
|
40
92
|
if (paths.length === 0) {
|
|
41
93
|
console.log(dim("No excluded paths."));
|
|
42
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exclude.js","sourceRoot":"","sources":["../../src/commands/exclude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"exclude.js","sourceRoot":"","sources":["../../src/commands/exclude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAe,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAE9C,+EAA+E;AAC/E,2EAA2E;AAC3E,iDAAiD;AAEjD;;;;GAIG;AACH,SAAS,OAAO,C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AAC;QAClB,KAAK,GAAG,EAAE,CAAC;IACb,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC;IACzC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC;QAC5C,KAAK,MAAM,CAAC,IAAI,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,mBAAmB,aAAa,oCAAoC,CAAC,CAAC,CAAC;IACvF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC,CAAC;IACnF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Engram,
|
|
1
|
+
import type { Engram, MessageInput } from "@getengram/sdk";
|
|
2
2
|
export { parseStorageFullError, type StorageFullError } from "../storage-error.js";
|
|
3
3
|
/**
|
|
4
4
|
* Import a ChatGPT or Claude data export into Engram. The format is
|
|
@@ -17,6 +17,12 @@ export { parseStorageFullError, type StorageFullError } from "../storage-error.j
|
|
|
17
17
|
* remaining lifetime storage is checked (engram#275) and a warning is
|
|
18
18
|
* shown if the export won't fit; if memory fills up mid-import, the
|
|
19
19
|
* import stops gracefully — everything already imported stays saved.
|
|
20
|
+
*
|
|
21
|
+
* Running it again finishes what an earlier run didn't (engram#751): a
|
|
22
|
+
* conversation cut off partway, by a full memory, a plan limit, a lost
|
|
23
|
+
* connection or Ctrl+C, gets the messages it is missing, as does one that
|
|
24
|
+
* went on after it was imported, and nothing is stored twice. See
|
|
25
|
+
* import-resume.ts.
|
|
20
26
|
*/
|
|
21
27
|
interface ChatNode {
|
|
22
28
|
id?: string;
|
|
@@ -67,6 +73,22 @@ export interface NormalizedConversation {
|
|
|
67
73
|
*/
|
|
68
74
|
sourceId: string | null;
|
|
69
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Most encoded content one store request carries, in bytes (engram#750):
|
|
78
|
+
* far inside the worker's 8 MB request limit, which 100 long messages of
|
|
79
|
+
* pasted documents could pass.
|
|
80
|
+
*/
|
|
81
|
+
export declare const STORE_BATCH_BYTES: number;
|
|
82
|
+
/**
|
|
83
|
+
* A conversation's messages as store requests (engram#750). Each body is
|
|
84
|
+
* bounded the way Engram bounds it on arrival (file payloads replaced with
|
|
85
|
+
* a note, then clipped), so Engram stores the same text, or in one case
|
|
86
|
+
* less (see message-bounds.ts), and each request carries at most
|
|
87
|
+
* STORE_BATCH messages and STORE_BATCH_BYTES of content as sent. A request
|
|
88
|
+
* always carries at least one message; bounded, one is far inside the
|
|
89
|
+
* limit.
|
|
90
|
+
*/
|
|
91
|
+
export declare function storeBatches(messages: readonly MessageInput[]): MessageInput[][];
|
|
70
92
|
/** Walk a ChatGPT export's node tree (current_node → root) into a chronological list. */
|
|
71
93
|
export declare function linearize(convo: ChatConversation): MessageInput[];
|
|
72
94
|
/** Flatten a Claude export conversation into a chronological message list. */
|
|
@@ -101,10 +123,15 @@ export type StoragePrecheck = {
|
|
|
101
123
|
* server enforces the cap anyway.
|
|
102
124
|
*/
|
|
103
125
|
export declare function storagePrecheck(messageCount: number, storage: StorageUsage | null): StoragePrecheck;
|
|
104
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* Human-readable warning for an import that won't fit in remaining memory.
|
|
128
|
+
* `messageCount` is the most the import sends. `exportCount`, when it is
|
|
129
|
+
* more, is how many messages the export has: an earlier import stored part
|
|
130
|
+
* of it, and a re-run doesn't send that again (engram#754).
|
|
131
|
+
*/
|
|
105
132
|
export declare function storageWarning(messageCount: number, check: {
|
|
106
133
|
remaining: number;
|
|
107
134
|
limit: number;
|
|
108
|
-
}): string;
|
|
135
|
+
}, exportCount?: number): string;
|
|
109
136
|
export declare function importHistory(engram: Engram, args: string[], flags: Record<string, string>): Promise<void>;
|
|
110
137
|
//# sourceMappingURL=import.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../src/commands/import.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../src/commands/import.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,MAAM,EAAW,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA2BlF,OAAO,EAAE,qBAAqB,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,UAAU,QAAQ;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC3B,OAAO,CAAC,EAAE;YAAE,YAAY,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAA;SAAE,CAAC;QACvD,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC7B,GAAG,IAAI,CAAC;CACV;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAA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