@cleocode/core 2026.10.2 → 2026.10.4
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/dist/build-provenance.json +2 -2
- package/dist/cloud/http.d.ts +2 -0
- package/dist/cloud/http.d.ts.map +1 -1
- package/dist/cloud/http.js +3 -0
- package/dist/cloud/http.js.map +1 -1
- package/dist/cloud/manifest-check.d.ts.map +1 -1
- package/dist/cloud/manifest-check.js +13 -0
- package/dist/cloud/manifest-check.js.map +1 -1
- package/dist/cloud/nexus-enrol.d.ts +9 -0
- package/dist/cloud/nexus-enrol.d.ts.map +1 -1
- package/dist/cloud/nexus-enrol.js +45 -2
- package/dist/cloud/nexus-enrol.js.map +1 -1
- package/dist/cloud/nexus-first-run.d.ts +142 -0
- package/dist/cloud/nexus-first-run.d.ts.map +1 -0
- package/dist/cloud/nexus-first-run.js +352 -0
- package/dist/cloud/nexus-first-run.js.map +1 -0
- package/dist/cloud/nexus-project-names.d.ts +173 -0
- package/dist/cloud/nexus-project-names.d.ts.map +1 -0
- package/dist/cloud/nexus-project-names.js +314 -0
- package/dist/cloud/nexus-project-names.js.map +1 -0
- package/dist/cloud/nexus-vault-keys.d.ts +35 -3
- package/dist/cloud/nexus-vault-keys.d.ts.map +1 -1
- package/dist/cloud/nexus-vault-keys.js +212 -22
- package/dist/cloud/nexus-vault-keys.js.map +1 -1
- package/dist/cloud/nexus-vault.d.ts.map +1 -1
- package/dist/cloud/nexus-vault.js +14 -2
- package/dist/cloud/nexus-vault.js.map +1 -1
- package/dist/dispatch/contracts/derive-output-contract.d.ts +1 -1
- package/dist/dispatch/contracts/derive-output-contract.d.ts.map +1 -1
- package/dist/dispatch/contracts/derive-output-contract.js +2 -1
- package/dist/dispatch/contracts/derive-output-contract.js.map +1 -1
- package/dist/dispatch/contracts/output-contracts.d.ts +2 -1
- package/dist/dispatch/contracts/output-contracts.d.ts.map +1 -1
- package/dist/dispatch/contracts/output-contracts.js +1 -1
- package/dist/dispatch/contracts/output-contracts.js.map +1 -1
- package/dist/dispatch/mvi-projection.d.ts +1 -1
- package/dist/dispatch/mvi-projection.d.ts.map +1 -1
- package/dist/dispatch/mvi-projection.js +1 -1
- package/dist/dispatch/mvi-projection.js.map +1 -1
- package/dist/docs/export-document.js +24462 -24572
- package/dist/docs/export-document.js.map +3 -3
- package/dist/doctor/db-substrate.d.ts +6 -9
- package/dist/doctor/db-substrate.d.ts.map +1 -1
- package/dist/doctor/db-substrate.js +10 -14
- package/dist/doctor/db-substrate.js.map +1 -1
- package/dist/doctor/migrations.d.ts +18 -0
- package/dist/doctor/migrations.d.ts.map +1 -1
- package/dist/doctor/migrations.js +54 -2
- package/dist/doctor/migrations.js.map +1 -1
- package/dist/error-catalog.js +1 -1
- package/dist/error-catalog.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +21 -5
- package/dist/init.js.map +1 -1
- package/dist/llm/conversation.d.ts.map +1 -1
- package/dist/llm/conversation.js +15 -4
- package/dist/llm/conversation.js.map +1 -1
- package/dist/llm/plugin-facade.js +277 -376
- package/dist/llm/plugin-facade.js.map +3 -3
- package/dist/llm/transports/bedrock.d.ts +1 -0
- package/dist/llm/transports/bedrock.d.ts.map +1 -1
- package/dist/llm/transports/bedrock.js +30 -12
- package/dist/llm/transports/bedrock.js.map +1 -1
- package/dist/memory/decision-contradiction.d.ts.map +1 -1
- package/dist/memory/decision-contradiction.js +10 -5
- package/dist/memory/decision-contradiction.js.map +1 -1
- package/dist/memory/dialectic-evaluator.d.ts.map +1 -1
- package/dist/memory/dialectic-evaluator.js +4 -1
- package/dist/memory/dialectic-evaluator.js.map +1 -1
- package/dist/memory/transcript-extractor.d.ts.map +1 -1
- package/dist/memory/transcript-extractor.js +3 -2
- package/dist/memory/transcript-extractor.js.map +1 -1
- package/dist/metrics/token-service.d.ts +16 -0
- package/dist/metrics/token-service.d.ts.map +1 -1
- package/dist/metrics/token-service.js +18 -0
- package/dist/metrics/token-service.js.map +1 -1
- package/dist/nexus/api-contracts.d.ts.map +1 -1
- package/dist/nexus/api-contracts.js +27 -11
- package/dist/nexus/api-contracts.js.map +1 -1
- package/dist/nexus/api-extractors/http-extractor.d.ts +2 -2
- package/dist/nexus/api-extractors/http-extractor.d.ts.map +1 -1
- package/dist/nexus/api-extractors/http-extractor.js +3 -3
- package/dist/nexus/api-extractors/http-extractor.js.map +1 -1
- package/dist/nexus/clusters.js +1 -1
- package/dist/nexus/clusters.js.map +1 -1
- package/dist/nexus/diff.d.ts +1 -1
- package/dist/nexus/diff.d.ts.map +1 -1
- package/dist/nexus/diff.js +3 -2
- package/dist/nexus/diff.js.map +1 -1
- package/dist/nexus/flows.js +1 -1
- package/dist/nexus/flows.js.map +1 -1
- package/dist/nexus/identity.d.ts +8 -0
- package/dist/nexus/identity.d.ts.map +1 -1
- package/dist/nexus/identity.js +17 -1
- package/dist/nexus/identity.js.map +1 -1
- package/dist/nexus/index.d.ts +1 -1
- package/dist/nexus/index.d.ts.map +1 -1
- package/dist/nexus/index.js +2 -2
- package/dist/nexus/index.js.map +1 -1
- package/dist/nexus/nexus-bridge.d.ts.map +1 -1
- package/dist/nexus/nexus-bridge.js +5 -5
- package/dist/nexus/nexus-bridge.js.map +1 -1
- package/dist/nexus/registry.d.ts +22 -0
- package/dist/nexus/registry.d.ts.map +1 -1
- package/dist/nexus/registry.js +76 -1
- package/dist/nexus/registry.js.map +1 -1
- package/dist/paths.js +1 -1
- package/dist/paths.js.map +1 -1
- package/dist/project-scope.js +1 -1
- package/dist/project-scope.js.map +1 -1
- package/dist/project-tombstone.js +1 -1
- package/dist/project-tombstone.js.map +1 -1
- package/dist/release/open.d.ts +3 -6
- package/dist/release/open.d.ts.map +1 -1
- package/dist/release/open.js +59 -23
- package/dist/release/open.js.map +1 -1
- package/dist/release/preflight-skip.d.ts +69 -10
- package/dist/release/preflight-skip.d.ts.map +1 -1
- package/dist/release/preflight-skip.js +195 -47
- package/dist/release/preflight-skip.js.map +1 -1
- package/dist/render/colors.js +1 -19
- package/dist/render/colors.js.map +1 -1
- package/dist/render/tasks/colors.js +1 -1
- package/dist/render/tasks/colors.js.map +1 -1
- package/dist/resources/governor.d.ts +12 -0
- package/dist/resources/governor.d.ts.map +1 -1
- package/dist/resources/governor.js +5 -1
- package/dist/resources/governor.js.map +1 -1
- package/dist/resources/heavy-command-hook-delivery.d.ts +144 -0
- package/dist/resources/heavy-command-hook-delivery.d.ts.map +1 -0
- package/dist/resources/heavy-command-hook-delivery.js +204 -0
- package/dist/resources/heavy-command-hook-delivery.js.map +1 -0
- package/dist/resources/heavy-command.d.ts +69 -0
- package/dist/resources/heavy-command.d.ts.map +1 -1
- package/dist/resources/heavy-command.js +479 -7
- package/dist/resources/heavy-command.js.map +1 -1
- package/dist/resources/run-class.d.ts.map +1 -1
- package/dist/resources/run-class.js +1 -0
- package/dist/resources/run-class.js.map +1 -1
- package/dist/routing/build-command-groups.d.ts +1 -1
- package/dist/routing/build-command-groups.d.ts.map +1 -1
- package/dist/routing/build-command-groups.js +4 -1
- package/dist/routing/build-command-groups.js.map +1 -1
- package/dist/scaffold/ensure-skills.d.ts.map +1 -1
- package/dist/scaffold/ensure-skills.js +58 -2
- package/dist/scaffold/ensure-skills.js.map +1 -1
- package/dist/selfimprove/fix-gen.js +277 -376
- package/dist/selfimprove/fix-gen.js.map +3 -3
- package/dist/sessions/briefing.d.ts.map +1 -1
- package/dist/sessions/briefing.js +11 -0
- package/dist/sessions/briefing.js.map +1 -1
- package/dist/store/dual-scope-db.d.ts.map +1 -1
- package/dist/store/dual-scope-db.js +6 -1
- package/dist/store/dual-scope-db.js.map +1 -1
- package/dist/store/portable-bundle-scan.d.ts +22 -0
- package/dist/store/portable-bundle-scan.d.ts.map +1 -1
- package/dist/store/portable-bundle-scan.js +97 -25
- package/dist/store/portable-bundle-scan.js.map +1 -1
- package/dist/store/portable-bundle.d.ts +7 -0
- package/dist/store/portable-bundle.d.ts.map +1 -1
- package/dist/store/portable-bundle.js +10 -1
- package/dist/store/portable-bundle.js.map +1 -1
- package/dist/store/table-classification.d.ts +27 -0
- package/dist/store/table-classification.d.ts.map +1 -1
- package/dist/store/table-classification.js +32 -0
- package/dist/store/table-classification.js.map +1 -1
- package/dist/store/vault-manifest.d.ts +5 -1
- package/dist/store/vault-manifest.d.ts.map +1 -1
- package/dist/store/vault-manifest.js +9 -2
- package/dist/store/vault-manifest.js.map +1 -1
- package/dist/system/health.d.ts +13 -0
- package/dist/system/health.d.ts.map +1 -1
- package/dist/system/health.js +96 -1
- package/dist/system/health.js.map +1 -1
- package/dist/tasks/affected-packages.d.ts +20 -7
- package/dist/tasks/affected-packages.d.ts.map +1 -1
- package/dist/tasks/affected-packages.js +39 -13
- package/dist/tasks/affected-packages.js.map +1 -1
- package/dist/tasks/affected-template.d.ts +93 -0
- package/dist/tasks/affected-template.d.ts.map +1 -0
- package/dist/tasks/affected-template.js +198 -0
- package/dist/tasks/affected-template.js.map +1 -0
- package/dist/tasks/command-line.d.ts +4 -1
- package/dist/tasks/command-line.d.ts.map +1 -1
- package/dist/tasks/command-line.js +7 -2
- package/dist/tasks/command-line.js.map +1 -1
- package/dist/tasks/done-plan.d.ts.map +1 -1
- package/dist/tasks/done-plan.js +12 -2
- package/dist/tasks/done-plan.js.map +1 -1
- package/dist/tasks/duplicate-detector.d.ts.map +1 -1
- package/dist/tasks/duplicate-detector.js +11 -5
- package/dist/tasks/duplicate-detector.js.map +1 -1
- package/dist/tasks/evidence.d.ts.map +1 -1
- package/dist/tasks/evidence.js +185 -11
- package/dist/tasks/evidence.js.map +1 -1
- package/dist/tasks/heavy-tool-env.d.ts +385 -18
- package/dist/tasks/heavy-tool-env.d.ts.map +1 -1
- package/dist/tasks/heavy-tool-env.js +719 -40
- package/dist/tasks/heavy-tool-env.js.map +1 -1
- package/dist/tasks/index.d.ts +2 -2
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/tasks/index.js +1 -1
- package/dist/tasks/index.js.map +1 -1
- package/dist/tasks/tool-cache-env.d.ts +20 -13
- package/dist/tasks/tool-cache-env.d.ts.map +1 -1
- package/dist/tasks/tool-cache-env.js +27 -48
- package/dist/tasks/tool-cache-env.js.map +1 -1
- package/dist/tasks/tool-cache.d.ts +8 -0
- package/dist/tasks/tool-cache.d.ts.map +1 -1
- package/dist/tasks/tool-cache.js +19 -6
- package/dist/tasks/tool-cache.js.map +1 -1
- package/dist/tasks/tool-semaphore.d.ts +66 -23
- package/dist/tasks/tool-semaphore.d.ts.map +1 -1
- package/dist/tasks/tool-semaphore.js +96 -34
- package/dist/tasks/tool-semaphore.js.map +1 -1
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +37 -4
- package/dist/upgrade.js.map +1 -1
- package/dist/validation/doctor/checks.d.ts +17 -0
- package/dist/validation/doctor/checks.d.ts.map +1 -1
- package/dist/validation/doctor/checks.js +83 -0
- package/dist/validation/doctor/checks.js.map +1 -1
- package/package.json +13 -13
- package/schemas/project-context.schema.json +5 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The guided first run of `cleo login nexus` (T13102, owner decision
|
|
3
|
+
* 2026-10-02: onboarding = A + B + C' + D, so that `cleo login` is the only
|
|
4
|
+
* setup step in practice). It runs after a successful sign-in and never fails
|
|
5
|
+
* it: every problem becomes a state, a warning and the exact next command.
|
|
6
|
+
*
|
|
7
|
+
* - **Inside a CLEO project this device has not linked**: offer "link and
|
|
8
|
+
* back up now". With consent `yes` (`--yes`) it links the project through
|
|
9
|
+
* {@link linkProjectToNexus} (the same path as `cleo project link`, so the
|
|
10
|
+
* project key created at registration comes with it) and then takes the
|
|
11
|
+
* first encrypted backup through {@link pushNexusVault}. With `prompt` (a
|
|
12
|
+
* terminal) it asks first. With `never` (a non-interactive run: an agent)
|
|
13
|
+
* it never asks and reports the exact next command.
|
|
14
|
+
* - **Inside an unlinked project the cloud already backs up**, from another
|
|
15
|
+
* device, and this copy never synced (a fresh clone on a new machine: the
|
|
16
|
+
* project id is tracked in git): a backup would be refused as behind, so
|
|
17
|
+
* the offer is to restore that backup here ({@link restoreNexusVault}, then
|
|
18
|
+
* the same link), under the same consent rules.
|
|
19
|
+
* - **Inside a project linked and attached from this device**: nothing to do.
|
|
20
|
+
* - **Outside a CLEO project**: list the account's projects by name
|
|
21
|
+
* ({@link listNexusNamedProjects}) with the exact `cleo cloud restore`
|
|
22
|
+
* command for each one this machine can restore.
|
|
23
|
+
* - **A read-only device, or device credentials off**: skipped.
|
|
24
|
+
*
|
|
25
|
+
* Every printed command carries `--api-url` when the origin is not the
|
|
26
|
+
* default. No function here logs, prompts or prints: the caller supplies
|
|
27
|
+
* `confirm` and `onStep`.
|
|
28
|
+
*
|
|
29
|
+
* @task T13102
|
|
30
|
+
* @epic T12322
|
|
31
|
+
*/
|
|
32
|
+
import type { CloudPushResult, CloudRestoreResult, NexusFirstRunResult, NexusFirstRunState, NexusProjectLinkResult } from '@cleocode/contracts';
|
|
33
|
+
import { type NexusLinkOptions } from './nexus-link.js';
|
|
34
|
+
import { type NexusNamedProjectsOptions, type NexusNamedProjectsResult } from './nexus-project-names.js';
|
|
35
|
+
import { type NexusVaultCommandOptions, type NexusVaultRestoreOptions } from './nexus-vault.js';
|
|
36
|
+
import type { NexusVaultOptions } from './nexus-vault-keys.js';
|
|
37
|
+
/** The question a terminal is asked before linking and backing up. */
|
|
38
|
+
export declare const NEXUS_FIRST_RUN_QUESTION = "This project is not linked to Cleo Nexus. Link it and back it up now (encrypted)?";
|
|
39
|
+
/** The question a terminal is asked before restoring a backup this copy never synced. */
|
|
40
|
+
export declare const NEXUS_FIRST_RUN_RESTORE_QUESTION = "Cleo Nexus holds a backup of this project from another device. Restore it here now?";
|
|
41
|
+
/** Warning code: linking the project failed. */
|
|
42
|
+
export declare const W_NEXUS_FIRST_RUN_LINK = "W_NEXUS_FIRST_RUN_LINK";
|
|
43
|
+
/** Warning code: the first backup failed. */
|
|
44
|
+
export declare const W_NEXUS_FIRST_RUN_BACKUP = "W_NEXUS_FIRST_RUN_BACKUP";
|
|
45
|
+
/** Warning code: restoring the cloud's backup failed. */
|
|
46
|
+
export declare const W_NEXUS_FIRST_RUN_RESTORE = "W_NEXUS_FIRST_RUN_RESTORE";
|
|
47
|
+
/** Warning code: the account's projects could not be listed. */
|
|
48
|
+
export declare const W_NEXUS_FIRST_RUN_PROJECTS = "W_NEXUS_FIRST_RUN_PROJECTS";
|
|
49
|
+
/** Warning code: a non-fatal problem the link reported. */
|
|
50
|
+
export declare const W_NEXUS_FIRST_RUN_LINK_NOTE = "W_NEXUS_FIRST_RUN_LINK_NOTE";
|
|
51
|
+
/**
|
|
52
|
+
* Whether the first run may act: `yes` does it, `prompt` asks through
|
|
53
|
+
* `confirm`, `never` only reports the next command.
|
|
54
|
+
*/
|
|
55
|
+
export type NexusFirstRunConsent = 'yes' | 'prompt' | 'never';
|
|
56
|
+
/** A step the first run is about to take (for progress lines). */
|
|
57
|
+
export type NexusFirstRunStep = 'link' | 'backup' | 'restore' | 'projects';
|
|
58
|
+
/** What {@link NexusFirstRunOptions.cloudBackup} is asked about. */
|
|
59
|
+
export interface NexusCloudBackupQuery extends NexusVaultOptions {
|
|
60
|
+
/** API origin. */
|
|
61
|
+
apiUrl: string;
|
|
62
|
+
/** The project's root on this machine. */
|
|
63
|
+
projectRoot: string;
|
|
64
|
+
/** The server's project id (the tracked local id, or the link's remote id). */
|
|
65
|
+
projectId: string;
|
|
66
|
+
}
|
|
67
|
+
/** Options of {@link runNexusFirstRun}. */
|
|
68
|
+
export interface NexusFirstRunOptions extends NexusVaultOptions {
|
|
69
|
+
/** `yes` (`--yes`), `prompt` (a terminal) or `never` (non-interactive). */
|
|
70
|
+
consent: NexusFirstRunConsent;
|
|
71
|
+
/**
|
|
72
|
+
* Asks a yes/no question (`prompt` only); `defaultYes` is what an empty answer means
|
|
73
|
+
* (yes for link and back up, no for a restore). Without it, `prompt` acts as `never`.
|
|
74
|
+
*/
|
|
75
|
+
confirm?: (question: string, defaultYes: boolean) => Promise<boolean>;
|
|
76
|
+
/** The device login enrolled, to tell projects attached here from others. */
|
|
77
|
+
deviceId?: string | null;
|
|
78
|
+
/** The device signed in with the read-only profile: it cannot link or back up. */
|
|
79
|
+
readOnly?: boolean;
|
|
80
|
+
/** Called before each step (progress lines). */
|
|
81
|
+
onStep?: (step: NexusFirstRunStep) => void;
|
|
82
|
+
/** Link (tests); defaults to {@link linkProjectToNexus}. */
|
|
83
|
+
link?: (opts: NexusLinkOptions) => Promise<NexusProjectLinkResult>;
|
|
84
|
+
/** Push (tests); defaults to {@link pushNexusVault}. */
|
|
85
|
+
push?: (opts: NexusVaultCommandOptions) => Promise<CloudPushResult>;
|
|
86
|
+
/** Restore (tests); defaults to {@link restoreNexusVault}. */
|
|
87
|
+
restore?: (opts: NexusVaultRestoreOptions) => Promise<CloudRestoreResult>;
|
|
88
|
+
/** Unsynced-backup check (tests); defaults to {@link hasUnsyncedNexusBackup}. */
|
|
89
|
+
cloudBackup?: (query: NexusCloudBackupQuery) => Promise<boolean>;
|
|
90
|
+
/** Project list (tests); defaults to {@link listNexusNamedProjects}. */
|
|
91
|
+
listProjects?: (opts: NexusNamedProjectsOptions) => Promise<NexusNamedProjectsResult>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A first-run result with every field at its empty value.
|
|
95
|
+
*
|
|
96
|
+
* @param state - How it ended.
|
|
97
|
+
* @param fields - Fields to set.
|
|
98
|
+
* @returns The result.
|
|
99
|
+
*/
|
|
100
|
+
export declare function nexusFirstRunResult(state: NexusFirstRunState, fields?: Partial<Omit<NexusFirstRunResult, 'state'>>): NexusFirstRunResult;
|
|
101
|
+
/** The commands a first run names (see {@link nexusFirstRunCommands}). */
|
|
102
|
+
export interface NexusFirstRunCommands {
|
|
103
|
+
/** Link the current project, then push its first backup. */
|
|
104
|
+
linkAndBackUp: string;
|
|
105
|
+
/** Link the current project, then push it as a labelled fork over a newer cloud head. */
|
|
106
|
+
linkAndForkPush: string;
|
|
107
|
+
/** Push the current project. */
|
|
108
|
+
push: string;
|
|
109
|
+
/** Pull the cloud's newest snapshot into the current project. */
|
|
110
|
+
pull: string;
|
|
111
|
+
/** List the account's projects. */
|
|
112
|
+
projects: string;
|
|
113
|
+
/** Restore a project's backup into a directory. */
|
|
114
|
+
restore: (projectId: string, root: string) => string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The commands a first run names, with `--api-url` when the origin is not the default.
|
|
118
|
+
*
|
|
119
|
+
* @param apiUrl - API origin.
|
|
120
|
+
* @returns The link-and-back-up, push, pull, list and restore commands.
|
|
121
|
+
*/
|
|
122
|
+
export declare function nexusFirstRunCommands(apiUrl: string): NexusFirstRunCommands;
|
|
123
|
+
/**
|
|
124
|
+
* Whether Cleo Nexus holds a backup of the project that this copy never
|
|
125
|
+
* synced: the project is registered with a head snapshot (E14, a `GET`), and
|
|
126
|
+
* the vault state records no sync of its stream from this project root. Any
|
|
127
|
+
* failure answers `false`, so the run falls back to link and back up.
|
|
128
|
+
*
|
|
129
|
+
* @param query - API URL, project root and id, stores and test overrides.
|
|
130
|
+
* @returns `true` when a restore, not a backup, is the right first step.
|
|
131
|
+
*/
|
|
132
|
+
export declare function hasUnsyncedNexusBackup(query: NexusCloudBackupQuery): Promise<boolean>;
|
|
133
|
+
/**
|
|
134
|
+
* The guided first run after `cleo login nexus` signed in. Never throws for a
|
|
135
|
+
* flow failure: the result's state, warnings and next command describe it.
|
|
136
|
+
*
|
|
137
|
+
* @param opts - Consent, prompt, device id, profile, API URL, stores and test overrides.
|
|
138
|
+
* @returns How it ended.
|
|
139
|
+
* @throws {NexusAccountError} `E_NEXUS_INVALID_API_URL` only (login has already checked it).
|
|
140
|
+
*/
|
|
141
|
+
export declare function runNexusFirstRun(opts: NexusFirstRunOptions): Promise<NexusFirstRunResult>;
|
|
142
|
+
//# sourceMappingURL=n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erB;AAED,0EAA0E;AAC1E,MAAM,WAAW,qBAAqB;IACpC,4DAA4D;IAC5D,aAAa,EAAE,MAAM,CAAC;IACtB,yFAAyF;IACzF,eAAe,EAAE,MAAM,CAAC;IACxB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACtD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB,CAW3E;AAoCD;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,CAmB3F;AA8LD;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAmC/F"}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The guided first run of `cleo login nexus` (T13102, owner decision
|
|
3
|
+
* 2026-10-02: onboarding = A + B + C' + D, so that `cleo login` is the only
|
|
4
|
+
* setup step in practice). It runs after a successful sign-in and never fails
|
|
5
|
+
* it: every problem becomes a state, a warning and the exact next command.
|
|
6
|
+
*
|
|
7
|
+
* - **Inside a CLEO project this device has not linked**: offer "link and
|
|
8
|
+
* back up now". With consent `yes` (`--yes`) it links the project through
|
|
9
|
+
* {@link linkProjectToNexus} (the same path as `cleo project link`, so the
|
|
10
|
+
* project key created at registration comes with it) and then takes the
|
|
11
|
+
* first encrypted backup through {@link pushNexusVault}. With `prompt` (a
|
|
12
|
+
* terminal) it asks first. With `never` (a non-interactive run: an agent)
|
|
13
|
+
* it never asks and reports the exact next command.
|
|
14
|
+
* - **Inside an unlinked project the cloud already backs up**, from another
|
|
15
|
+
* device, and this copy never synced (a fresh clone on a new machine: the
|
|
16
|
+
* project id is tracked in git): a backup would be refused as behind, so
|
|
17
|
+
* the offer is to restore that backup here ({@link restoreNexusVault}, then
|
|
18
|
+
* the same link), under the same consent rules.
|
|
19
|
+
* - **Inside a project linked and attached from this device**: nothing to do.
|
|
20
|
+
* - **Outside a CLEO project**: list the account's projects by name
|
|
21
|
+
* ({@link listNexusNamedProjects}) with the exact `cleo cloud restore`
|
|
22
|
+
* command for each one this machine can restore.
|
|
23
|
+
* - **A read-only device, or device credentials off**: skipped.
|
|
24
|
+
*
|
|
25
|
+
* Every printed command carries `--api-url` when the origin is not the
|
|
26
|
+
* default. No function here logs, prompts or prints: the caller supplies
|
|
27
|
+
* `confirm` and `onStep`.
|
|
28
|
+
*
|
|
29
|
+
* @task T13102
|
|
30
|
+
* @epic T12322
|
|
31
|
+
*/
|
|
32
|
+
import path from 'node:path';
|
|
33
|
+
import { nexusCloudProjectDetailSchema } from '@cleocode/contracts';
|
|
34
|
+
import { NexusAccountError, resolveNexusApiUrl } from './nexus-auth.js';
|
|
35
|
+
import { connectNexusCloud, currentNexusCloudProject } from './nexus-cloud.js';
|
|
36
|
+
import { isNexusDeviceEnabled } from './nexus-device.js';
|
|
37
|
+
import { linkProjectToNexus, readNexusProjectLink } from './nexus-link.js';
|
|
38
|
+
import { listNexusNamedProjects, nexusApiUrlFlag, shellQuoteWord, } from './nexus-project-names.js';
|
|
39
|
+
import { pushNexusVault, restoreNexusVault, } from './nexus-vault.js';
|
|
40
|
+
import { NexusVaultState } from './nexus-vault-state.js';
|
|
41
|
+
/** The question a terminal is asked before linking and backing up. */
|
|
42
|
+
export const NEXUS_FIRST_RUN_QUESTION = 'This project is not linked to Cleo Nexus. Link it and back it up now (encrypted)?';
|
|
43
|
+
/** The question a terminal is asked before restoring a backup this copy never synced. */
|
|
44
|
+
export const NEXUS_FIRST_RUN_RESTORE_QUESTION = 'Cleo Nexus holds a backup of this project from another device. Restore it here now?';
|
|
45
|
+
/** Warning code: linking the project failed. */
|
|
46
|
+
export const W_NEXUS_FIRST_RUN_LINK = 'W_NEXUS_FIRST_RUN_LINK';
|
|
47
|
+
/** Warning code: the first backup failed. */
|
|
48
|
+
export const W_NEXUS_FIRST_RUN_BACKUP = 'W_NEXUS_FIRST_RUN_BACKUP';
|
|
49
|
+
/** Warning code: restoring the cloud's backup failed. */
|
|
50
|
+
export const W_NEXUS_FIRST_RUN_RESTORE = 'W_NEXUS_FIRST_RUN_RESTORE';
|
|
51
|
+
/** Warning code: the account's projects could not be listed. */
|
|
52
|
+
export const W_NEXUS_FIRST_RUN_PROJECTS = 'W_NEXUS_FIRST_RUN_PROJECTS';
|
|
53
|
+
/** Warning code: a non-fatal problem the link reported. */
|
|
54
|
+
export const W_NEXUS_FIRST_RUN_LINK_NOTE = 'W_NEXUS_FIRST_RUN_LINK_NOTE';
|
|
55
|
+
/**
|
|
56
|
+
* A first-run result with every field at its empty value.
|
|
57
|
+
*
|
|
58
|
+
* @param state - How it ended.
|
|
59
|
+
* @param fields - Fields to set.
|
|
60
|
+
* @returns The result.
|
|
61
|
+
*/
|
|
62
|
+
export function nexusFirstRunResult(state, fields = {}) {
|
|
63
|
+
return {
|
|
64
|
+
state,
|
|
65
|
+
reason: null,
|
|
66
|
+
projectRoot: null,
|
|
67
|
+
link: null,
|
|
68
|
+
offer: null,
|
|
69
|
+
backup: null,
|
|
70
|
+
restore: null,
|
|
71
|
+
projects: [],
|
|
72
|
+
nextCommand: null,
|
|
73
|
+
choices: [],
|
|
74
|
+
warnings: [],
|
|
75
|
+
...fields,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The commands a first run names, with `--api-url` when the origin is not the default.
|
|
80
|
+
*
|
|
81
|
+
* @param apiUrl - API origin.
|
|
82
|
+
* @returns The link-and-back-up, push, pull, list and restore commands.
|
|
83
|
+
*/
|
|
84
|
+
export function nexusFirstRunCommands(apiUrl) {
|
|
85
|
+
const f = nexusApiUrlFlag(apiUrl);
|
|
86
|
+
return {
|
|
87
|
+
linkAndBackUp: `cleo project link${f} && cleo cloud push${f}`,
|
|
88
|
+
linkAndForkPush: `cleo project link${f} && cleo cloud push --force${f}`,
|
|
89
|
+
push: `cleo cloud push${f}`,
|
|
90
|
+
pull: `cleo cloud pull${f}`,
|
|
91
|
+
projects: `cleo cloud projects${f}`,
|
|
92
|
+
restore: (projectId, root) => `cleo cloud restore ${shellQuoteWord(projectId)} --into ${shellQuoteWord(root)}${f}`,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** A failure as one secret-free line: code, message and remedy. */
|
|
96
|
+
function describeFailure(err) {
|
|
97
|
+
if (err instanceof NexusAccountError) {
|
|
98
|
+
return `${err.code}: ${err.message}${err.fix ? `; ${err.fix}` : ''}`;
|
|
99
|
+
}
|
|
100
|
+
return err instanceof Error ? err.message : String(err);
|
|
101
|
+
}
|
|
102
|
+
/** The error's code, when it carries one. */
|
|
103
|
+
function codeOf(err) {
|
|
104
|
+
return err instanceof NexusAccountError ? err.code : null;
|
|
105
|
+
}
|
|
106
|
+
/** The link is attached from this device (or, with no device id known, attached at all). */
|
|
107
|
+
function attachedHere(link, deviceId) {
|
|
108
|
+
if (link === null || !link.replicaId)
|
|
109
|
+
return false;
|
|
110
|
+
return deviceId === null || link.nexusDeviceId === deviceId;
|
|
111
|
+
}
|
|
112
|
+
/** Ask, when asking is allowed; a failed or closed prompt answers no. */
|
|
113
|
+
async function consented(opts, question, defaultYes) {
|
|
114
|
+
if (opts.consent === 'yes')
|
|
115
|
+
return true;
|
|
116
|
+
if (opts.consent !== 'prompt' || !opts.confirm)
|
|
117
|
+
return false;
|
|
118
|
+
try {
|
|
119
|
+
return await opts.confirm(question, defaultYes);
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Whether Cleo Nexus holds a backup of the project that this copy never
|
|
127
|
+
* synced: the project is registered with a head snapshot (E14, a `GET`), and
|
|
128
|
+
* the vault state records no sync of its stream from this project root. Any
|
|
129
|
+
* failure answers `false`, so the run falls back to link and back up.
|
|
130
|
+
*
|
|
131
|
+
* @param query - API URL, project root and id, stores and test overrides.
|
|
132
|
+
* @returns `true` when a restore, not a backup, is the right first step.
|
|
133
|
+
*/
|
|
134
|
+
export async function hasUnsyncedNexusBackup(query) {
|
|
135
|
+
try {
|
|
136
|
+
const conn = await connectNexusCloud(query);
|
|
137
|
+
const detail = await conn.find(`/v1/projects/${encodeURIComponent(query.projectId)}`, nexusCloudProjectDetailSchema);
|
|
138
|
+
const stream = detail?.stream ?? null;
|
|
139
|
+
if (stream === null || stream.headCheckpointId === null)
|
|
140
|
+
return false;
|
|
141
|
+
const synced = (query.vaultState ?? new NexusVaultState()).stream(conn.apiUrl, conn.device.userId, stream.streamId, path.resolve(query.projectRoot));
|
|
142
|
+
return !synced?.lastCheckpointId;
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/** The link step's options from the vault options. */
|
|
149
|
+
function linkOptions(vault, projectRoot) {
|
|
150
|
+
return {
|
|
151
|
+
apiUrl: vault.apiUrl,
|
|
152
|
+
projectRoot,
|
|
153
|
+
...(vault.store ? { store: vault.store } : {}),
|
|
154
|
+
...(vault.fetch ? { fetch: vault.fetch } : {}),
|
|
155
|
+
...(vault.deviceStore ? { deviceStore: vault.deviceStore } : {}),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/** Link the project (the `cleo project link` path), then push its first backup. */
|
|
159
|
+
async function linkAndBackUp(opts, vault, projectRoot) {
|
|
160
|
+
const commands = nexusFirstRunCommands(vault.apiUrl);
|
|
161
|
+
const base = { projectRoot, offer: 'link-and-backup' };
|
|
162
|
+
opts.onStep?.('link');
|
|
163
|
+
let linked;
|
|
164
|
+
try {
|
|
165
|
+
linked = await (opts.link ?? linkProjectToNexus)(linkOptions(vault, projectRoot));
|
|
166
|
+
}
|
|
167
|
+
catch (err) {
|
|
168
|
+
return nexusFirstRunResult('link-failed', {
|
|
169
|
+
...base,
|
|
170
|
+
nextCommand: commands.linkAndBackUp,
|
|
171
|
+
warnings: [{ code: W_NEXUS_FIRST_RUN_LINK, message: describeFailure(err) }],
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
const warnings = linked.warnings.map((message) => ({
|
|
175
|
+
code: W_NEXUS_FIRST_RUN_LINK_NOTE,
|
|
176
|
+
message,
|
|
177
|
+
}));
|
|
178
|
+
if (linked.replica === null) {
|
|
179
|
+
// A push needs this copy attached from this device; the link's warning says why it is not.
|
|
180
|
+
return nexusFirstRunResult('backup-failed', {
|
|
181
|
+
...base,
|
|
182
|
+
link: linked.link,
|
|
183
|
+
nextCommand: commands.linkAndBackUp,
|
|
184
|
+
warnings: [
|
|
185
|
+
...warnings,
|
|
186
|
+
{
|
|
187
|
+
code: W_NEXUS_FIRST_RUN_BACKUP,
|
|
188
|
+
message: `not backed up: this copy is not attached from this device${linked.attachError ? ` (${linked.attachError.code}: ${linked.attachError.message})` : ''}`,
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
opts.onStep?.('backup');
|
|
194
|
+
let pushed;
|
|
195
|
+
try {
|
|
196
|
+
pushed = await (opts.push ?? pushNexusVault)({ ...vault, projectRoot, scope: 'project' });
|
|
197
|
+
}
|
|
198
|
+
catch (err) {
|
|
199
|
+
return nexusFirstRunResult('backup-failed', {
|
|
200
|
+
...base,
|
|
201
|
+
link: linked.link,
|
|
202
|
+
// Behind: another device pushed since this copy last synced; bring that state here first.
|
|
203
|
+
nextCommand: codeOf(err) === 'E_NEXUS_VAULT_BEHIND' ? commands.pull : commands.push,
|
|
204
|
+
warnings: [...warnings, { code: W_NEXUS_FIRST_RUN_BACKUP, message: describeFailure(err) }],
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return nexusFirstRunResult('backed-up', {
|
|
208
|
+
...base,
|
|
209
|
+
link: linked.link,
|
|
210
|
+
backup: { status: pushed.status, snapshot: pushed.snapshot },
|
|
211
|
+
warnings: [...warnings, ...pushed.warnings],
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/** Restore the cloud's backup into this copy, then link it (the `cleo cloud restore` path). */
|
|
215
|
+
async function restoreHere(opts, vault, projectRoot, projectId) {
|
|
216
|
+
const base = { projectRoot, offer: 'restore' };
|
|
217
|
+
opts.onStep?.('restore');
|
|
218
|
+
let restored;
|
|
219
|
+
try {
|
|
220
|
+
restored = await (opts.restore ?? restoreNexusVault)({
|
|
221
|
+
...vault,
|
|
222
|
+
scope: 'project',
|
|
223
|
+
mode: 'restore',
|
|
224
|
+
projectId,
|
|
225
|
+
into: projectRoot,
|
|
226
|
+
relink: async (root) => {
|
|
227
|
+
try {
|
|
228
|
+
return (await (opts.link ?? linkProjectToNexus)(linkOptions(vault, root))).warnings;
|
|
229
|
+
}
|
|
230
|
+
catch (err) {
|
|
231
|
+
return [
|
|
232
|
+
`restored, but linking this copy failed (${describeFailure(err)}); run \`cleo project link\``,
|
|
233
|
+
];
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
catch (err) {
|
|
239
|
+
const commands = nexusFirstRunCommands(vault.apiUrl);
|
|
240
|
+
const restoreCmd = commands.restore(projectId, projectRoot);
|
|
241
|
+
const warnings = [{ code: W_NEXUS_FIRST_RUN_RESTORE, message: describeFailure(err) }];
|
|
242
|
+
if (codeOf(err) === 'E_NEXUS_VAULT_LOCAL_CHANGES') {
|
|
243
|
+
// This copy has rows it never synced: rerunning the restore refuses the same way, so
|
|
244
|
+
// the user chooses which side wins (review LOW-2).
|
|
245
|
+
return nexusFirstRunResult('restore-failed', {
|
|
246
|
+
...base,
|
|
247
|
+
choices: [
|
|
248
|
+
{
|
|
249
|
+
command: `${restoreCmd} --force`,
|
|
250
|
+
effect: "take the cloud's backup; this copy's rows are replaced after a safety backup",
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
command: commands.linkAndForkPush,
|
|
254
|
+
effect: "keep this copy; it is pushed as a labelled fork over the cloud's newest backup",
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
warnings,
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
return nexusFirstRunResult('restore-failed', { ...base, nextCommand: restoreCmd, warnings });
|
|
261
|
+
}
|
|
262
|
+
return nexusFirstRunResult('restored', {
|
|
263
|
+
...base,
|
|
264
|
+
link: readNexusProjectLink(projectRoot, vault.apiUrl),
|
|
265
|
+
restore: {
|
|
266
|
+
status: restored.status,
|
|
267
|
+
snapshot: restored.snapshot,
|
|
268
|
+
tables: restored.tables,
|
|
269
|
+
safetyBackup: restored.safetyBackup,
|
|
270
|
+
},
|
|
271
|
+
warnings: restored.warnings,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
/** Outside a project: the account's projects by name, with their restore commands. */
|
|
275
|
+
async function listProjectsStep(opts, vault) {
|
|
276
|
+
opts.onStep?.('projects');
|
|
277
|
+
try {
|
|
278
|
+
const listed = await (opts.listProjects ?? listNexusNamedProjects)({
|
|
279
|
+
...vault,
|
|
280
|
+
deviceId: opts.deviceId ?? null,
|
|
281
|
+
});
|
|
282
|
+
const restorable = listed.projects.filter((p) => p.restoreCommand !== null);
|
|
283
|
+
return nexusFirstRunResult('projects', {
|
|
284
|
+
projects: listed.projects,
|
|
285
|
+
nextCommand: restorable.length === 1 ? (restorable[0]?.restoreCommand ?? null) : null,
|
|
286
|
+
warnings: listed.warnings,
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
catch (err) {
|
|
290
|
+
return nexusFirstRunResult('projects', {
|
|
291
|
+
nextCommand: nexusFirstRunCommands(vault.apiUrl).projects,
|
|
292
|
+
warnings: [{ code: W_NEXUS_FIRST_RUN_PROJECTS, message: describeFailure(err) }],
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
/** Inside an unlinked project: restore the cloud's backup, or link and back up; asking first. */
|
|
297
|
+
async function offerInProject(opts, vault, project) {
|
|
298
|
+
const projectId = project.link?.remoteProjectId ?? project.projectId;
|
|
299
|
+
const restore = await (opts.cloudBackup ?? hasUnsyncedNexusBackup)({
|
|
300
|
+
...vault,
|
|
301
|
+
projectRoot: project.root,
|
|
302
|
+
projectId,
|
|
303
|
+
});
|
|
304
|
+
const question = restore ? NEXUS_FIRST_RUN_RESTORE_QUESTION : NEXUS_FIRST_RUN_QUESTION;
|
|
305
|
+
// A restore replaces what this copy holds, so an empty answer means no (review LOW-3).
|
|
306
|
+
if (await consented(opts, question, !restore)) {
|
|
307
|
+
return restore
|
|
308
|
+
? restoreHere(opts, vault, project.root, projectId)
|
|
309
|
+
: linkAndBackUp(opts, vault, project.root);
|
|
310
|
+
}
|
|
311
|
+
const commands = nexusFirstRunCommands(vault.apiUrl);
|
|
312
|
+
return nexusFirstRunResult(opts.consent === 'prompt' && opts.confirm ? 'declined' : 'offered', {
|
|
313
|
+
projectRoot: project.root,
|
|
314
|
+
link: project.link,
|
|
315
|
+
offer: restore ? 'restore' : 'link-and-backup',
|
|
316
|
+
nextCommand: restore ? commands.restore(projectId, project.root) : commands.linkAndBackUp,
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* The guided first run after `cleo login nexus` signed in. Never throws for a
|
|
321
|
+
* flow failure: the result's state, warnings and next command describe it.
|
|
322
|
+
*
|
|
323
|
+
* @param opts - Consent, prompt, device id, profile, API URL, stores and test overrides.
|
|
324
|
+
* @returns How it ended.
|
|
325
|
+
* @throws {NexusAccountError} `E_NEXUS_INVALID_API_URL` only (login has already checked it).
|
|
326
|
+
*/
|
|
327
|
+
export async function runNexusFirstRun(opts) {
|
|
328
|
+
if (opts.readOnly === true) {
|
|
329
|
+
return nexusFirstRunResult('skipped', {
|
|
330
|
+
reason: 'this device signed in with the read-only profile, which cannot link or back up',
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
if (!isNexusDeviceEnabled()) {
|
|
334
|
+
return nexusFirstRunResult('skipped', {
|
|
335
|
+
reason: 'device credentials are off (CLEO_NEXUS_DEVICE=0); linking and backups need them',
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
const { consent, confirm, deviceId, readOnly, onStep, link, push, restore, cloudBackup, listProjects, ...rest } = opts;
|
|
339
|
+
const apiUrl = resolveNexusApiUrl(opts.apiUrl);
|
|
340
|
+
const vault = { ...rest, apiUrl };
|
|
341
|
+
const project = currentNexusCloudProject(apiUrl, opts.projectRoot);
|
|
342
|
+
if (project === null)
|
|
343
|
+
return listProjectsStep(opts, vault);
|
|
344
|
+
if (attachedHere(project.link, deviceId ?? null)) {
|
|
345
|
+
return nexusFirstRunResult('already-linked', {
|
|
346
|
+
projectRoot: project.root,
|
|
347
|
+
link: project.link,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
return offerInProject(opts, vault, project);
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=nexus-first-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nexus-first-run.js","sourceRoot":"","sources":["../../src/cloud/nexus-first-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAU7B,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAyB,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAClG,OAAO,EACL,s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