@beryl-so/cli 0.54.0 → 0.54.1
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/email-pump.js +6 -4
- package/dist/schema.generated.js +0 -27
- package/dist/skill-tables.js +2 -2
- package/package.json +1 -1
package/dist/email-pump.js
CHANGED
|
@@ -36,16 +36,16 @@ export function startEmailPump(opts) {
|
|
|
36
36
|
while (!stopped && Date.now() < deadline) {
|
|
37
37
|
try {
|
|
38
38
|
const res = (await opts.client.post(`/workspaces/${opts.workspaceId}/mailboxes/${opts.inboxId}/emails/${emailId}/extract`, { extract: req.extract ?? "code", extract_pattern: req.pattern }));
|
|
39
|
-
if (res.source === "ai")
|
|
40
|
-
opts.onEvent?.("await_email: the AI extractor answered");
|
|
41
39
|
return { ok: true, value: res.value };
|
|
42
40
|
}
|
|
43
41
|
catch (err) {
|
|
44
|
-
|
|
42
|
+
// 424 is fatal; 422 walks on; the rest retries.
|
|
43
|
+
if (err instanceof ApiError && (err.status === 422 || err.status === 424)) {
|
|
45
44
|
const detail = typeof err.detail === "string" ? err.detail : err.message;
|
|
46
45
|
return {
|
|
47
46
|
ok: false,
|
|
48
|
-
|
|
47
|
+
fatal: err.status === 424,
|
|
48
|
+
error: detail.replace(/^EMAIL_(EXTRACTION_FAILED|EXTRACTOR_UNAVAILABLE):\s*/, ""),
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
await sleep(EXTRACT_RETRY_MS);
|
|
@@ -76,6 +76,8 @@ export function startEmailPump(opts) {
|
|
|
76
76
|
const extracted = await extractOnServer(email.id, req, deadline);
|
|
77
77
|
if (extracted.ok)
|
|
78
78
|
return extracted.value;
|
|
79
|
+
if (extracted.fatal)
|
|
80
|
+
throw new Error(extracted.error);
|
|
79
81
|
// Same move as the cloud resolver: an email without the artifact (a welcome mail
|
|
80
82
|
// racing the code mail) is consumed and the wait continues for the next one.
|
|
81
83
|
lastExtractError = extracted.error;
|
package/dist/schema.generated.js
CHANGED
|
@@ -901,33 +901,6 @@ export const ACTION_PLAN_SCHEMA = {
|
|
|
901
901
|
"selector"
|
|
902
902
|
]
|
|
903
903
|
}
|
|
904
|
-
},
|
|
905
|
-
{
|
|
906
|
-
"if": {
|
|
907
|
-
"properties": {
|
|
908
|
-
"action": {
|
|
909
|
-
"const": "await_email"
|
|
910
|
-
},
|
|
911
|
-
"extract": {
|
|
912
|
-
"const": "pattern"
|
|
913
|
-
}
|
|
914
|
-
},
|
|
915
|
-
"required": [
|
|
916
|
-
"action",
|
|
917
|
-
"extract"
|
|
918
|
-
]
|
|
919
|
-
},
|
|
920
|
-
"then": {
|
|
921
|
-
"properties": {
|
|
922
|
-
"extract_pattern": {
|
|
923
|
-
"minLength": 1,
|
|
924
|
-
"type": "string"
|
|
925
|
-
}
|
|
926
|
-
},
|
|
927
|
-
"required": [
|
|
928
|
-
"extract_pattern"
|
|
929
|
-
]
|
|
930
|
-
}
|
|
931
904
|
}
|
|
932
905
|
],
|
|
933
906
|
"properties": {
|
package/dist/skill-tables.js
CHANGED
|
@@ -5,7 +5,8 @@ import { ACTION_PLAN_SCHEMA } from "./schema.generated.js";
|
|
|
5
5
|
const defs = ACTION_PLAN_SCHEMA.$defs;
|
|
6
6
|
export const ACTION_TYPES = defs.ActionType.enum;
|
|
7
7
|
export const EXPECT_KINDS = defs.ExpectKind.enum;
|
|
8
|
-
|
|
8
|
+
// `pattern` stays in the schema, but is never offered.
|
|
9
|
+
export const EMAIL_EXTRACTS = defs.EmailExtract.enum.filter((e) => e !== "pattern");
|
|
9
10
|
function actionRequires(action) {
|
|
10
11
|
const rule = defs.PlanStep.allOf.find((r) => r.if.properties.action?.const === action && !r.if.properties.extract);
|
|
11
12
|
return rule?.then.required ?? [];
|
|
@@ -55,7 +56,6 @@ export const EXPECT_DOCS = {
|
|
|
55
56
|
export const EXTRACT_DOCS = {
|
|
56
57
|
code: "the one-time code",
|
|
57
58
|
link: "the sign-in/verify URL",
|
|
58
|
-
pattern: "your own regex in `extract_pattern`, exactly one capture group",
|
|
59
59
|
};
|
|
60
60
|
function table(header, rows) {
|
|
61
61
|
return [
|
package/package.json
CHANGED