epismo 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -11
- package/dist/api.js +69 -7
- package/dist/api.js.map +1 -1
- package/dist/assets.js +33 -45
- package/dist/assets.js.map +1 -1
- package/dist/auth.js +246 -85
- package/dist/auth.js.map +1 -1
- package/dist/config.js +26 -2
- package/dist/config.js.map +1 -1
- package/dist/context.js +4 -6
- package/dist/context.js.map +1 -1
- package/dist/credits.js +25 -27
- package/dist/credits.js.map +1 -1
- package/dist/errors.js +111 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.js +25 -6
- package/dist/index.js.map +1 -1
- package/dist/input.js +78 -11
- package/dist/input.js.map +1 -1
- package/dist/output.js +5 -2
- package/dist/output.js.map +1 -1
- package/dist/program.js +229 -209
- package/dist/program.js.map +1 -1
- package/dist/tracks.js +44 -27
- package/dist/tracks.js.map +1 -1
- package/dist/update-check.js +119 -0
- package/dist/update-check.js.map +1 -0
- package/dist/workspace.js +21 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -4,6 +4,18 @@ GitHub made code reusable. Hugging Face made models reusable. Epismo makes human
|
|
|
4
4
|
|
|
5
5
|
Capture how you got your best results — not just the output — and share them as executable workflows that agents and humans can discover, adapt, and run across projects.
|
|
6
6
|
|
|
7
|
+
## CLI Contract
|
|
8
|
+
|
|
9
|
+
Epismo CLI is designed for agents first.
|
|
10
|
+
|
|
11
|
+
- Non-interactive runs default to machine-readable JSON.
|
|
12
|
+
- Interactive TTY runs also keep success output machine-readable on `stdout`.
|
|
13
|
+
- `stderr` is used for prompts, browser-login guidance, and error output.
|
|
14
|
+
- Exit code `0` indicates success. Any non-zero exit code indicates failure.
|
|
15
|
+
|
|
16
|
+
In interactive sessions, the CLI may prompt on `stderr`.
|
|
17
|
+
In non-interactive environments, commands that need prompts fail fast instead of waiting for input.
|
|
18
|
+
|
|
7
19
|
## Install
|
|
8
20
|
|
|
9
21
|
```bash
|
|
@@ -20,24 +32,29 @@ npx epismo <command>
|
|
|
20
32
|
|
|
21
33
|
```bash
|
|
22
34
|
epismo login # OTP (prompts for email + code)
|
|
23
|
-
epismo login --email you@example.com --
|
|
35
|
+
epismo login --email you@example.com --otp 123456 # inline values
|
|
24
36
|
epismo login --browser # OAuth via browser
|
|
25
37
|
epismo logout # clear local credentials
|
|
38
|
+
EPISMO_TOKEN=<access-token> epismo whoami # preferred for scripts
|
|
26
39
|
```
|
|
27
40
|
|
|
41
|
+
If `EPISMO_TOKEN` is set, the CLI uses it instead of stored credentials.
|
|
42
|
+
|
|
43
|
+
When `EPISMO_TOKEN` is active, the saved default workspace is ignored unless you pass `--workspace-id`.
|
|
44
|
+
|
|
28
45
|
## Commands
|
|
29
46
|
|
|
30
47
|
### `epismo whoami`
|
|
31
48
|
|
|
32
|
-
Show the current user and accessible workspaces.
|
|
49
|
+
Show the current user, effective workspace context, and accessible workspaces.
|
|
33
50
|
|
|
34
51
|
### `epismo workspace`
|
|
35
52
|
|
|
36
53
|
```bash
|
|
37
|
-
epismo workspace list
|
|
38
|
-
epismo workspace current
|
|
39
|
-
epismo workspace use <workspace-id>
|
|
40
|
-
epismo workspace clear
|
|
54
|
+
epismo workspace list # list accessible workspaces
|
|
55
|
+
epismo workspace current # show saved default from local config only
|
|
56
|
+
epismo workspace use --workspace-id <workspace-id> # set default workspace
|
|
57
|
+
epismo workspace clear # clear default workspace
|
|
41
58
|
```
|
|
42
59
|
|
|
43
60
|
### `epismo track`
|
|
@@ -49,7 +66,7 @@ epismo track upsert --type task --title "Fix bug" --content "Details..."
|
|
|
49
66
|
epismo track upsert --input @task.json
|
|
50
67
|
epismo track get --type task --id <id>
|
|
51
68
|
epismo track search --type task --query "bug" --filter '{"status":["todo"]}'
|
|
52
|
-
epismo track search --type task --query "bug" --view
|
|
69
|
+
epismo track search --type task --query "bug" --view brief
|
|
53
70
|
epismo track delete --type task --id <id>
|
|
54
71
|
```
|
|
55
72
|
|
|
@@ -61,8 +78,9 @@ Manage workflows and other assets.
|
|
|
61
78
|
epismo asset upsert --type workflow --title "My workflow" --input @workflow.json
|
|
62
79
|
epismo asset get --type workflow --id <id>
|
|
63
80
|
epismo asset search --type workflow --query "onboarding" --filter '{"visibility":["public"]}'
|
|
64
|
-
epismo asset search --type workflow --query "onboarding" --view
|
|
65
|
-
epismo asset like --type workflow --id <id> --liked
|
|
81
|
+
epismo asset search --type workflow --query "onboarding" --view brief
|
|
82
|
+
epismo asset like --type workflow --id <id> --liked
|
|
83
|
+
epismo asset like --type workflow --id <id> --no-liked
|
|
66
84
|
epismo asset import --project-id <project-id> --asset-ids <id1>,<id2>
|
|
67
85
|
epismo asset delete --type workflow --id <id>
|
|
68
86
|
```
|
|
@@ -72,6 +90,7 @@ epismo asset delete --type workflow --id <id>
|
|
|
72
90
|
```bash
|
|
73
91
|
epismo credit balance
|
|
74
92
|
epismo credit balance --workspace-id <workspace-id>
|
|
93
|
+
epismo credit checkout --allocations '[{"userId":"<user-id>","quantity":10}]'
|
|
75
94
|
```
|
|
76
95
|
|
|
77
96
|
## Skills
|
|
@@ -82,9 +101,11 @@ Browse skills: https://github.com/epismoai/skills
|
|
|
82
101
|
|
|
83
102
|
## Workspace Selection
|
|
84
103
|
|
|
85
|
-
- `epismo workspace use <workspace-id>` saves the default for all commands.
|
|
104
|
+
- `epismo workspace use --workspace-id <workspace-id>` saves the default for all commands.
|
|
86
105
|
- `--workspace-id <id>` overrides the default for a single command.
|
|
87
106
|
- If neither is set, the CLI operates in personal context.
|
|
107
|
+
- `epismo workspace current` reads only local config and does not require network access.
|
|
108
|
+
- When `EPISMO_TOKEN` is active, saved default workspace selection is ignored unless `--workspace-id` is provided.
|
|
88
109
|
|
|
89
110
|
## Input
|
|
90
111
|
|
|
@@ -92,7 +113,26 @@ Browse skills: https://github.com/epismoai/skills
|
|
|
92
113
|
- `--input @path/to/file.json` — load from file
|
|
93
114
|
- `--input -` — read from stdin
|
|
94
115
|
- Explicit flags override fields from `--input`
|
|
116
|
+
- Enum-like flags are validated in the CLI before the request is sent.
|
|
95
117
|
|
|
96
118
|
## Output
|
|
97
119
|
|
|
98
|
-
|
|
120
|
+
- Successful command output is JSON on `stdout`.
|
|
121
|
+
- Errors and warnings are written to `stderr` as JSON.
|
|
122
|
+
- Prompts and browser-login guidance are also written to `stderr`.
|
|
123
|
+
|
|
124
|
+
**Error shape** (`stderr`, exit code ≠ 0):
|
|
125
|
+
```json
|
|
126
|
+
{ "error": { "code": "NOT_FOUND", "message": "...", "retryable": false, "hint": "..." } }
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Warning shape** (`stderr`, exit code 0):
|
|
130
|
+
```json
|
|
131
|
+
{ "warning": { "code": "UPDATE_AVAILABLE", "message": "..." } }
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Update Checks
|
|
135
|
+
|
|
136
|
+
Automatic update checks are enabled by default (once per day, shown only in interactive TTY sessions).
|
|
137
|
+
|
|
138
|
+
- Set `EPISMO_UPDATE_CHECK=0` to disable the background npm version check.
|
package/dist/api.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { CliError } from "./errors.js";
|
|
2
|
+
export function withWorkspaceQuery(pathname, workspaceId) {
|
|
3
|
+
if (!workspaceId?.trim()) {
|
|
4
|
+
return pathname;
|
|
5
|
+
}
|
|
6
|
+
const params = new URLSearchParams({ workspaceId: workspaceId.trim() });
|
|
7
|
+
return `${pathname}?${params.toString()}`;
|
|
8
|
+
}
|
|
1
9
|
export async function requestJson(apiUrl, pathname, options = {}) {
|
|
2
10
|
const headers = {};
|
|
3
11
|
if (options.body !== undefined) {
|
|
@@ -6,11 +14,35 @@ export async function requestJson(apiUrl, pathname, options = {}) {
|
|
|
6
14
|
if (options.authToken) {
|
|
7
15
|
headers.authorization = `Bearer ${options.authToken}`;
|
|
8
16
|
}
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
const controller = new AbortController();
|
|
18
|
+
const timeoutId = setTimeout(() => controller.abort(), 30_000);
|
|
19
|
+
let response;
|
|
20
|
+
try {
|
|
21
|
+
response = await fetch(`${apiUrl}${pathname}`, {
|
|
22
|
+
method: options.method ?? "GET",
|
|
23
|
+
headers,
|
|
24
|
+
body: options.body !== undefined ? JSON.stringify(options.body) : undefined,
|
|
25
|
+
signal: controller.signal
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
30
|
+
throw new CliError({
|
|
31
|
+
code: "REQUEST_TIMEOUT",
|
|
32
|
+
message: "Request timed out.",
|
|
33
|
+
retryable: true
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
37
|
+
throw new CliError({
|
|
38
|
+
code: "NETWORK_ERROR",
|
|
39
|
+
message,
|
|
40
|
+
retryable: true
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
clearTimeout(timeoutId);
|
|
45
|
+
}
|
|
14
46
|
const text = await response.text();
|
|
15
47
|
let parsed = {};
|
|
16
48
|
if (text) {
|
|
@@ -29,9 +61,39 @@ export async function requestJson(apiUrl, pathname, options = {}) {
|
|
|
29
61
|
? payload.error
|
|
30
62
|
: typeof payload.error_description === "string"
|
|
31
63
|
? payload.error_description
|
|
32
|
-
:
|
|
33
|
-
|
|
64
|
+
: typeof payload.message === "string"
|
|
65
|
+
? payload.message
|
|
66
|
+
: `HTTP ${response.status}`;
|
|
67
|
+
throw new CliError({
|
|
68
|
+
code: mapHttpErrorCode(response.status),
|
|
69
|
+
message,
|
|
70
|
+
retryable: response.status >= 500 || response.status === 429,
|
|
71
|
+
details: {
|
|
72
|
+
status: response.status,
|
|
73
|
+
pathname
|
|
74
|
+
}
|
|
75
|
+
});
|
|
34
76
|
}
|
|
35
77
|
return parsed;
|
|
36
78
|
}
|
|
79
|
+
function mapHttpErrorCode(status) {
|
|
80
|
+
switch (status) {
|
|
81
|
+
case 400:
|
|
82
|
+
return "BAD_REQUEST";
|
|
83
|
+
case 401:
|
|
84
|
+
return "UNAUTHORIZED";
|
|
85
|
+
case 403:
|
|
86
|
+
return "FORBIDDEN";
|
|
87
|
+
case 404:
|
|
88
|
+
return "NOT_FOUND";
|
|
89
|
+
case 409:
|
|
90
|
+
return "CONFLICT";
|
|
91
|
+
case 422:
|
|
92
|
+
return "UNPROCESSABLE_ENTITY";
|
|
93
|
+
case 429:
|
|
94
|
+
return "RATE_LIMITED";
|
|
95
|
+
default:
|
|
96
|
+
return status >= 500 ? "SERVER_ERROR" : "HTTP_ERROR";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
37
99
|
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,UAAU,kBAAkB,CAAC,QAAgB,EAAE,WAAoB;IACxE,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC;IACjB,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,WAAW,EAAE,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACxE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC3C,CAAC;AAQD,MAAM,CAAC,KAAK,UAAU,WAAW,CAChC,MAAc,EACd,QAAgB,EAChB,UAA8B,EAAE;IAEhC,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,IAAI,OAAO,CAAC,IAAI,KAAK,SAA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AmB,CAAC;AAC5B,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAc;IACvC,QAAQ,MAAM,EAAE,CAAC;QAChB,KAAK,GAAG;YACP,OAAO,aAAa,CAAC;QACtB,KAAK,GAAG;YACP,OAAO,cAAc,CAAC;QACvB,KAAK,GAAG;YACP,OAAO,WAAW,CAAC;QACpB,KAAK,GAAG;YACP,OAAO,WAAW,CAAC;QACpB,KAAK,GAAG;YACP,OAAO,UAAU,CAAC;QACnB,KAAK,GAAG;YACP,OAAO,sBAAsB,CAAC;QAC/B,KAAK,GAAG;YACP,OAAO,cAAc,CAAC;QACvB;YACC,OAAO,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC;IACvD,CAAC;AACF,CAAC"}
|
package/dist/assets.js
CHANGED
|
@@ -1,45 +1,36 @@
|
|
|
1
|
-
import { requestJson } from "./api.js";
|
|
1
|
+
import { requestJson, withWorkspaceQuery } from "./api.js";
|
|
2
2
|
import { resolveApiUrl } from "./config.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { CliError } from "./errors.js";
|
|
4
|
+
import { readRequiredString, readTypeAndId, toObjectInput } from "./input.js";
|
|
5
|
+
function readAssetIds(input) {
|
|
6
|
+
const payload = toObjectInput(input);
|
|
7
|
+
const rawAssetIds = payload.assetIds;
|
|
8
|
+
if (!Array.isArray(rawAssetIds) || rawAssetIds.length === 0) {
|
|
9
|
+
throw new CliError({
|
|
10
|
+
code: "INVALID_INPUT",
|
|
11
|
+
message: '"assetIds" is required and must be a non-empty array.',
|
|
12
|
+
hint: 'Use --asset-ids <id1>,<id2> or pass JSON e.g. --input \'{"assetIds":["id1","id2"]}\'.'
|
|
13
|
+
});
|
|
6
14
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
throw new Error("id is required.");
|
|
17
|
-
}
|
|
18
|
-
return id.trim();
|
|
19
|
-
}
|
|
20
|
-
function readRequiredType(input) {
|
|
21
|
-
if (!input || typeof input !== "object") {
|
|
22
|
-
throw new Error("type is required.");
|
|
23
|
-
}
|
|
24
|
-
const type = input.type;
|
|
25
|
-
if (typeof type !== "string" || !type.trim()) {
|
|
26
|
-
throw new Error("type is required.");
|
|
27
|
-
}
|
|
28
|
-
return type.trim();
|
|
15
|
+
return rawAssetIds.map((assetId, index) => {
|
|
16
|
+
if (typeof assetId !== "string" || !assetId.trim()) {
|
|
17
|
+
throw new CliError({
|
|
18
|
+
code: "INVALID_INPUT",
|
|
19
|
+
message: `assetIds[${index}] must be a non-empty string.`
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return assetId.trim();
|
|
23
|
+
});
|
|
29
24
|
}
|
|
30
25
|
export async function upsertAsset(context, input) {
|
|
31
|
-
return requestJson(resolveApiUrl(), "/v1/assets", {
|
|
26
|
+
return requestJson(resolveApiUrl(), withWorkspaceQuery("/v1/assets", context.workspaceId), {
|
|
32
27
|
method: "PUT",
|
|
33
28
|
authToken: context.auth.accessToken,
|
|
34
|
-
body:
|
|
35
|
-
...(input && typeof input === "object" ? input : {}),
|
|
36
|
-
...(context.workspaceId ? { workspaceId: context.workspaceId } : {})
|
|
37
|
-
}
|
|
29
|
+
body: toObjectInput(input)
|
|
38
30
|
});
|
|
39
31
|
}
|
|
40
32
|
export async function getAsset(context, input) {
|
|
41
|
-
const type =
|
|
42
|
-
const id = readRequiredId(input);
|
|
33
|
+
const { type, id } = readTypeAndId(input, "Pass --type workflow.");
|
|
43
34
|
return requestJson(resolveApiUrl(), withWorkspaceQuery(`/v1/assets/${encodeURIComponent(type)}/${encodeURIComponent(id)}`, context.workspaceId), {
|
|
44
35
|
authToken: context.auth.accessToken
|
|
45
36
|
});
|
|
@@ -48,35 +39,32 @@ export async function searchAssets(context, input) {
|
|
|
48
39
|
return requestJson(resolveApiUrl(), withWorkspaceQuery("/v1/assets/search", context.workspaceId), {
|
|
49
40
|
method: "POST",
|
|
50
41
|
authToken: context.auth.accessToken,
|
|
51
|
-
body:
|
|
52
|
-
...(input && typeof input === "object" ? input : {}),
|
|
53
|
-
...(context.workspaceId ? { workspaceId: context.workspaceId } : {})
|
|
54
|
-
}
|
|
42
|
+
body: toObjectInput(input)
|
|
55
43
|
});
|
|
56
44
|
}
|
|
57
45
|
export async function likeAsset(context, input) {
|
|
46
|
+
const { type, id } = readTypeAndId(input, "Pass --type workflow.");
|
|
58
47
|
return requestJson(resolveApiUrl(), withWorkspaceQuery("/v1/assets/like", context.workspaceId), {
|
|
59
48
|
method: "POST",
|
|
60
49
|
authToken: context.auth.accessToken,
|
|
61
50
|
body: {
|
|
62
|
-
...(input
|
|
63
|
-
|
|
51
|
+
...toObjectInput(input),
|
|
52
|
+
type,
|
|
53
|
+
id
|
|
64
54
|
}
|
|
65
55
|
});
|
|
66
56
|
}
|
|
67
57
|
export async function importAssets(context, input) {
|
|
58
|
+
const projectId = readRequiredString(input, "projectId", "Pass --project-id <id>.");
|
|
59
|
+
const assetIds = readAssetIds(input);
|
|
68
60
|
return requestJson(resolveApiUrl(), withWorkspaceQuery("/v1/assets/import", context.workspaceId), {
|
|
69
61
|
method: "POST",
|
|
70
62
|
authToken: context.auth.accessToken,
|
|
71
|
-
body: {
|
|
72
|
-
...(input && typeof input === "object" ? input : {}),
|
|
73
|
-
...(context.workspaceId ? { workspaceId: context.workspaceId } : {})
|
|
74
|
-
}
|
|
63
|
+
body: { projectId, assetIds }
|
|
75
64
|
});
|
|
76
65
|
}
|
|
77
66
|
export async function deleteAsset(context, input) {
|
|
78
|
-
const type =
|
|
79
|
-
const id = readRequiredId(input);
|
|
67
|
+
const { type, id } = readTypeAndId(input, "Pass --type workflow.");
|
|
80
68
|
return requestJson(resolveApiUrl(), withWorkspaceQuery(`/v1/assets/${encodeURIComponent(type)}/${encodeURIComponent(id)}`, context.workspaceId), {
|
|
81
69
|
method: "DELETE",
|
|
82
70
|
authToken: context.auth.accessToken
|
package/dist/assets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9E,SAAS,YAAY,CAAC,KAAc;IACnC,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IACrC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7D,MAAM,IAAI,QAAQ,CAAC;YAClB,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,uDAAuD;YAChE,IAAI,EAAE,uFAAuF;SAC7F,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;QACzC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YACpD,MAAM,IAAI,QAAQ,CAAC;gBAClB,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,YAAY,KAAK,+BAA+B;aACzD,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC;AACJ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