@belonguniverseai/react-sdk 0.2.0 → 0.3.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/README.md +5 -4
- package/dist/api/client.d.ts +192 -12
- package/dist/api/retry-fetch.d.ts +58 -0
- package/dist/api/task-schedules.d.ts +198 -23
- package/dist/component/{arc-RUGz6lZa.js → arc-B7qwdj5Y.js} +2 -2
- package/dist/component/{architectureDiagram-3BPJPVTR-BX7ivAYH.js → architectureDiagram-3BPJPVTR-DHEfxvGE.js} +3 -3
- package/dist/component/{blockDiagram-GPEHLZMM-DkloXJvD.js → blockDiagram-GPEHLZMM-DO4_lzz8.js} +4 -4
- package/dist/component/{c4Diagram-AAUBKEIU-DpMkd-hu.js → c4Diagram-AAUBKEIU-BFvKjeX3.js} +3 -3
- package/dist/component/{channel-CMrJ5FvL.js → channel-Be_mlBXd.js} +2 -2
- package/dist/component/{chunk-2J33WTMH-BQFG3l5m.js → chunk-2J33WTMH-CJ_JyxkR.js} +2 -2
- package/dist/component/{chunk-4BX2VUAB-DIgdkfba.js → chunk-4BX2VUAB-BRkYFXFB.js} +2 -2
- package/dist/component/{chunk-55IACEB6-kiI_RN43.js → chunk-55IACEB6-D42tDKAF.js} +2 -2
- package/dist/component/{chunk-727SXJPM-B_3F8LLK.js → chunk-727SXJPM-BYOAmsWs.js} +6 -6
- package/dist/component/{chunk-AQP2D5EJ-nUpTDfR9.js → chunk-AQP2D5EJ-CUNDVk4Z.js} +4 -4
- package/dist/component/{chunk-FMBD7UC4-C666L1vx.js → chunk-FMBD7UC4-BQy-2qFB.js} +2 -2
- package/dist/component/{chunk-ND2GUHAM-BG3KaNNT.js → chunk-ND2GUHAM-ktW5vI-y.js} +2 -2
- package/dist/component/{chunk-QZHKN3VN-BekfxLxF.js → chunk-QZHKN3VN-CpSIn4cF.js} +2 -2
- package/dist/component/{classDiagram-4FO5ZUOK-BvcPz5Jy.js → classDiagram-4FO5ZUOK-Cm-1lpI4.js} +3 -3
- package/dist/component/{classDiagram-v2-Q7XG4LA2-BvcPz5Jy.js → classDiagram-v2-Q7XG4LA2-Cm-1lpI4.js} +3 -3
- package/dist/component/{cose-bilkent-S5V4N54A-CWpudsgn.js → cose-bilkent-S5V4N54A-DqixgjwQ.js} +2 -2
- package/dist/component/{dagre-BM42HDAG-COUBqMeu.js → dagre-BM42HDAG-Dv-P7Krm.js} +2 -2
- package/dist/component/{diagram-2AECGRRQ-Bj90e4r1.js → diagram-2AECGRRQ-kQGiD7lD.js} +3 -3
- package/dist/component/{diagram-5GNKFQAL-D50SBQ3H.js → diagram-5GNKFQAL-DoQlkZPU.js} +4 -4
- package/dist/component/{diagram-KO2AKTUF-rdkH6sIq.js → diagram-KO2AKTUF-CHX5UoXH.js} +3 -3
- package/dist/component/{diagram-LMA3HP47-BM-uSIwY.js → diagram-LMA3HP47-D5zUvZVG.js} +3 -3
- package/dist/component/{diagram-OG6HWLK6-BYeMl-HB.js → diagram-OG6HWLK6-B4npobs8.js} +4 -4
- package/dist/component/{erDiagram-TEJ5UH35-DFEfLVvR.js → erDiagram-TEJ5UH35-6z0JmU6m.js} +5 -5
- package/dist/component/{flowDiagram-I6XJVG4X-C785atDH.js → flowDiagram-I6XJVG4X-8Z4MRGGY.js} +7 -7
- package/dist/component/{ganttDiagram-6RSMTGT7-C5H-60U2.js → ganttDiagram-6RSMTGT7-Dx9QEDPc.js} +3 -3
- package/dist/component/{gitGraphDiagram-PVQCEYII-ceA5NW8c.js → gitGraphDiagram-PVQCEYII-BUHDP_7X.js} +4 -4
- package/dist/component/{highlighted-body-OFNGDK62-CshfJCgW.js → highlighted-body-OFNGDK62-DBPWZwq8.js} +2 -2
- package/dist/component/index.js +2 -2
- package/dist/component/{infoDiagram-5YYISTIA-C3KMuwje.js → infoDiagram-5YYISTIA-aiJg6_Qm.js} +2 -2
- package/dist/component/{ishikawaDiagram-YF4QCWOH-BZFrHmHT.js → ishikawaDiagram-YF4QCWOH-DL-CzUme.js} +2 -2
- package/dist/component/{journeyDiagram-JHISSGLW-BJOlgfUi.js → journeyDiagram-JHISSGLW-CYDK3R_C.js} +5 -5
- package/dist/component/{kanban-definition-UN3LZRKU-CfMReYx4.js → kanban-definition-UN3LZRKU-9ZNt06Tr.js} +3 -3
- package/dist/component/{linear-DUkCqmPt.js → linear-CtEJWK1N.js} +2 -2
- package/dist/component/{mermaid-GHXKKRXX-BOTLFr14.js → mermaid-GHXKKRXX-B00yz-X8.js} +30001 -29517
- package/dist/component/{mindmap-definition-RKZ34NQL-Bal8oXYU.js → mindmap-definition-RKZ34NQL-CHx9Cg9G.js} +4 -4
- package/dist/component/{pieDiagram-4H26LBE5-CCy9iJeT.js → pieDiagram-4H26LBE5-B_dLoXY_.js} +4 -4
- package/dist/component/{quadrantDiagram-W4KKPZXB-CZi1MEAc.js → quadrantDiagram-W4KKPZXB-DUL3njPs.js} +3 -3
- package/dist/component/{requirementDiagram-4Y6WPE33-irn_x5lf.js → requirementDiagram-4Y6WPE33-DJodprsF.js} +4 -4
- package/dist/component/{sankeyDiagram-5OEKKPKP-CX2rM6Rj.js → sankeyDiagram-5OEKKPKP-2Nn_RQ9h.js} +2 -2
- package/dist/component/{sequenceDiagram-3UESZ5HK-DmHw71eT.js → sequenceDiagram-3UESZ5HK-xJk0kY4S.js} +4 -4
- package/dist/component/{stateDiagram-AJRCARHV-3u6GXMEg.js → stateDiagram-AJRCARHV-D4QH9oBV.js} +3 -3
- package/dist/component/{stateDiagram-v2-BHNVJYJU-CbUih_UR.js → stateDiagram-v2-BHNVJYJU-C6SRcIR1.js} +3 -3
- package/dist/component/{timeline-definition-PNZ67QCA-BAW-94RV.js → timeline-definition-PNZ67QCA-SaEQyBaf.js} +3 -3
- package/dist/component/{vennDiagram-CIIHVFJN-IF4AwJuP.js → vennDiagram-CIIHVFJN-Bf8QpQpr.js} +2 -2
- package/dist/component/{wardleyDiagram-YWT4CUSO-Bn-uAkHk.js → wardleyDiagram-YWT4CUSO-B0wVwumO.js} +3 -3
- package/dist/component/{xychartDiagram-2RQKCTM6-CvPY-qXp.js → xychartDiagram-2RQKCTM6-Dl5itjjz.js} +3 -3
- package/dist/components/embed/CallButton.d.ts +26 -0
- package/dist/components/embed/EmbedAvatar.d.ts +4 -1
- package/dist/components/embed/EmbedSessions.d.ts +10 -3
- package/dist/components/embed/MobileNavBar.d.ts +39 -0
- package/dist/components/embed/mobile-nav-bar.fixtures.d.ts +3 -0
- package/dist/components/scheduled/ScheduledDetailSurface.d.ts +4 -1
- package/dist/components/scheduled/schedule-dialog-model.d.ts +6 -1
- package/dist/components/scheduled/schedule-format.d.ts +5 -1
- package/dist/embed/copy.d.ts +6 -0
- package/dist/embed/dock-layout.d.ts +23 -0
- package/dist/embed/layout-mode.d.ts +6 -0
- package/dist/embed/slash-commands.d.ts +44 -9
- package/dist/embed/voice/realtime-call.d.ts +8 -3
- package/dist/i18n/messages/en.d.ts +15 -10
- package/dist/i18n/messages/surfaces/aiElements.d.ts +3 -0
- package/dist/i18n/messages/surfaces/app.d.ts +9 -0
- package/dist/i18n/messages/surfaces/scheduled.d.ts +30 -0
- package/dist/i18n/messages/surfaces/stream.d.ts +3 -30
- package/dist/stream/ai-sdk-part-renderers.d.ts +8 -20
- package/dist/stream/belong-data-parts.d.ts +1 -1
- package/dist/stream/sandbox-output.d.ts +8 -4
- package/dist/types/public.d.ts +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,7 +59,8 @@ by voice.
|
|
|
59
59
|
Voice calls require the backend to be configured with an `OPENAI_API_KEY`
|
|
60
60
|
(model/voice are tuned via `OPENAI_REALTIME_MODEL` / `OPENAI_REALTIME_VOICE`);
|
|
61
61
|
on an unconfigured deployment the call button shows "Call mode is not enabled
|
|
62
|
-
on this deployment." when tapped. Embedding hosts
|
|
63
|
-
the
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
on this deployment." when tapped. Embedding hosts need **no CSP changes**:
|
|
63
|
+
the WebRTC handshake (SDP offer/answer) relays through the Belong backend —
|
|
64
|
+
already in your `connect-src` if the dock works at all — and the call audio
|
|
65
|
+
itself is a direct browser↔OpenAI WebRTC media stream, which `connect-src`
|
|
66
|
+
does not govern (audio never relays through the Belong backend).
|
package/dist/api/client.d.ts
CHANGED
|
@@ -1383,6 +1383,55 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
1383
1383
|
}>;
|
|
1384
1384
|
};
|
|
1385
1385
|
};
|
|
1386
|
+
} & {
|
|
1387
|
+
v1: {
|
|
1388
|
+
voice: {
|
|
1389
|
+
"call-sdp": import('hono/client').ClientRequest<string, "/v1/voice/call-sdp", {
|
|
1390
|
+
$post: {
|
|
1391
|
+
input: {};
|
|
1392
|
+
output: string;
|
|
1393
|
+
outputFormat: "body";
|
|
1394
|
+
status: 200;
|
|
1395
|
+
} | {
|
|
1396
|
+
input: {};
|
|
1397
|
+
output: {
|
|
1398
|
+
error: {
|
|
1399
|
+
type: string;
|
|
1400
|
+
};
|
|
1401
|
+
};
|
|
1402
|
+
outputFormat: "json";
|
|
1403
|
+
status: 400;
|
|
1404
|
+
} | {
|
|
1405
|
+
input: {};
|
|
1406
|
+
output: {
|
|
1407
|
+
error: {
|
|
1408
|
+
type: string;
|
|
1409
|
+
};
|
|
1410
|
+
};
|
|
1411
|
+
outputFormat: "json";
|
|
1412
|
+
status: 403;
|
|
1413
|
+
} | {
|
|
1414
|
+
input: {};
|
|
1415
|
+
output: {
|
|
1416
|
+
error: {
|
|
1417
|
+
type: string;
|
|
1418
|
+
};
|
|
1419
|
+
};
|
|
1420
|
+
outputFormat: "json";
|
|
1421
|
+
status: 503;
|
|
1422
|
+
} | {
|
|
1423
|
+
input: {};
|
|
1424
|
+
output: {
|
|
1425
|
+
error: {
|
|
1426
|
+
type: string;
|
|
1427
|
+
};
|
|
1428
|
+
};
|
|
1429
|
+
outputFormat: "json";
|
|
1430
|
+
status: 502;
|
|
1431
|
+
};
|
|
1432
|
+
}>;
|
|
1433
|
+
};
|
|
1434
|
+
};
|
|
1386
1435
|
} & {
|
|
1387
1436
|
v1: {
|
|
1388
1437
|
voice: {
|
|
@@ -2949,10 +2998,27 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
2949
2998
|
timezone: string;
|
|
2950
2999
|
message: string;
|
|
2951
3000
|
clientScheduleId: string;
|
|
3001
|
+
notification?: {
|
|
3002
|
+
kind: "completion_email";
|
|
3003
|
+
} | {
|
|
3004
|
+
kind: "custom_email";
|
|
3005
|
+
templatePath: string;
|
|
3006
|
+
} | undefined;
|
|
2952
3007
|
title?: string | undefined;
|
|
2953
3008
|
mode?: "plan" | "approve" | "balanced" | "bypass" | undefined;
|
|
2954
3009
|
recurrence?: {
|
|
2955
|
-
kind: "none"
|
|
3010
|
+
kind: "none";
|
|
3011
|
+
} | {
|
|
3012
|
+
kind: "daily";
|
|
3013
|
+
} | {
|
|
3014
|
+
kind: "weekdays";
|
|
3015
|
+
} | {
|
|
3016
|
+
kind: "weekly";
|
|
3017
|
+
} | {
|
|
3018
|
+
kind: "manual";
|
|
3019
|
+
} | {
|
|
3020
|
+
kind: "interval";
|
|
3021
|
+
intervalMinutes: number;
|
|
2956
3022
|
} | undefined;
|
|
2957
3023
|
originatingSessionId?: string | undefined;
|
|
2958
3024
|
workspaceExternalId?: string | undefined;
|
|
@@ -2977,10 +3043,27 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
2977
3043
|
timezone: string;
|
|
2978
3044
|
message: string;
|
|
2979
3045
|
clientScheduleId: string;
|
|
3046
|
+
notification?: {
|
|
3047
|
+
kind: "completion_email";
|
|
3048
|
+
} | {
|
|
3049
|
+
kind: "custom_email";
|
|
3050
|
+
templatePath: string;
|
|
3051
|
+
} | undefined;
|
|
2980
3052
|
title?: string | undefined;
|
|
2981
3053
|
mode?: "plan" | "approve" | "balanced" | "bypass" | undefined;
|
|
2982
3054
|
recurrence?: {
|
|
2983
|
-
kind: "none"
|
|
3055
|
+
kind: "none";
|
|
3056
|
+
} | {
|
|
3057
|
+
kind: "daily";
|
|
3058
|
+
} | {
|
|
3059
|
+
kind: "weekdays";
|
|
3060
|
+
} | {
|
|
3061
|
+
kind: "weekly";
|
|
3062
|
+
} | {
|
|
3063
|
+
kind: "manual";
|
|
3064
|
+
} | {
|
|
3065
|
+
kind: "interval";
|
|
3066
|
+
intervalMinutes: number;
|
|
2984
3067
|
} | undefined;
|
|
2985
3068
|
originatingSessionId?: string | undefined;
|
|
2986
3069
|
workspaceExternalId?: string | undefined;
|
|
@@ -2995,7 +3078,7 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
2995
3078
|
scheduledFor: string;
|
|
2996
3079
|
seriesStatus: "active" | "completed" | "paused" | "deleted";
|
|
2997
3080
|
recurrence: {
|
|
2998
|
-
kind: "none" | "daily" | "weekdays" | "weekly";
|
|
3081
|
+
kind: "none" | "manual" | "daily" | "weekdays" | "weekly" | "interval";
|
|
2999
3082
|
};
|
|
3000
3083
|
nextRunAt: string | null;
|
|
3001
3084
|
title: string;
|
|
@@ -3010,10 +3093,27 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
3010
3093
|
timezone: string;
|
|
3011
3094
|
message: string;
|
|
3012
3095
|
clientScheduleId: string;
|
|
3096
|
+
notification?: {
|
|
3097
|
+
kind: "completion_email";
|
|
3098
|
+
} | {
|
|
3099
|
+
kind: "custom_email";
|
|
3100
|
+
templatePath: string;
|
|
3101
|
+
} | undefined;
|
|
3013
3102
|
title?: string | undefined;
|
|
3014
3103
|
mode?: "plan" | "approve" | "balanced" | "bypass" | undefined;
|
|
3015
3104
|
recurrence?: {
|
|
3016
|
-
kind: "none"
|
|
3105
|
+
kind: "none";
|
|
3106
|
+
} | {
|
|
3107
|
+
kind: "daily";
|
|
3108
|
+
} | {
|
|
3109
|
+
kind: "weekdays";
|
|
3110
|
+
} | {
|
|
3111
|
+
kind: "weekly";
|
|
3112
|
+
} | {
|
|
3113
|
+
kind: "manual";
|
|
3114
|
+
} | {
|
|
3115
|
+
kind: "interval";
|
|
3116
|
+
intervalMinutes: number;
|
|
3017
3117
|
} | undefined;
|
|
3018
3118
|
originatingSessionId?: string | undefined;
|
|
3019
3119
|
workspaceExternalId?: string | undefined;
|
|
@@ -3037,10 +3137,27 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
3037
3137
|
timezone: string;
|
|
3038
3138
|
message: string;
|
|
3039
3139
|
clientScheduleId: string;
|
|
3140
|
+
notification?: {
|
|
3141
|
+
kind: "completion_email";
|
|
3142
|
+
} | {
|
|
3143
|
+
kind: "custom_email";
|
|
3144
|
+
templatePath: string;
|
|
3145
|
+
} | undefined;
|
|
3040
3146
|
title?: string | undefined;
|
|
3041
3147
|
mode?: "plan" | "approve" | "balanced" | "bypass" | undefined;
|
|
3042
3148
|
recurrence?: {
|
|
3043
|
-
kind: "none"
|
|
3149
|
+
kind: "none";
|
|
3150
|
+
} | {
|
|
3151
|
+
kind: "daily";
|
|
3152
|
+
} | {
|
|
3153
|
+
kind: "weekdays";
|
|
3154
|
+
} | {
|
|
3155
|
+
kind: "weekly";
|
|
3156
|
+
} | {
|
|
3157
|
+
kind: "manual";
|
|
3158
|
+
} | {
|
|
3159
|
+
kind: "interval";
|
|
3160
|
+
intervalMinutes: number;
|
|
3044
3161
|
} | undefined;
|
|
3045
3162
|
originatingSessionId?: string | undefined;
|
|
3046
3163
|
workspaceExternalId?: string | undefined;
|
|
@@ -3074,7 +3191,8 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
3074
3191
|
title: string;
|
|
3075
3192
|
status: "active" | "completed" | "paused" | "deleted";
|
|
3076
3193
|
recurrence: {
|
|
3077
|
-
|
|
3194
|
+
intervalMinutes?: number | undefined;
|
|
3195
|
+
kind: "none" | "manual" | "daily" | "weekdays" | "weekly" | "interval";
|
|
3078
3196
|
};
|
|
3079
3197
|
timezone: string;
|
|
3080
3198
|
nextRunAt: string | null;
|
|
@@ -3109,6 +3227,12 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
3109
3227
|
output: {
|
|
3110
3228
|
explicitTitle: string | null;
|
|
3111
3229
|
message: string;
|
|
3230
|
+
notification: {
|
|
3231
|
+
kind: "completion_email";
|
|
3232
|
+
} | {
|
|
3233
|
+
kind: "custom_email";
|
|
3234
|
+
templatePath: string;
|
|
3235
|
+
};
|
|
3112
3236
|
mode: "plan" | "approve" | "balanced" | "bypass";
|
|
3113
3237
|
timeExpression: string;
|
|
3114
3238
|
anchorAt: string;
|
|
@@ -3118,7 +3242,8 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
3118
3242
|
title: string;
|
|
3119
3243
|
status: "active" | "completed" | "paused" | "deleted";
|
|
3120
3244
|
recurrence: {
|
|
3121
|
-
|
|
3245
|
+
intervalMinutes?: number | undefined;
|
|
3246
|
+
kind: "none" | "manual" | "daily" | "weekdays" | "weekly" | "interval";
|
|
3122
3247
|
};
|
|
3123
3248
|
timezone: string;
|
|
3124
3249
|
nextRunAt: string | null;
|
|
@@ -3167,7 +3292,18 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
3167
3292
|
timeExpression?: string | undefined;
|
|
3168
3293
|
timezone?: string | undefined;
|
|
3169
3294
|
recurrence?: {
|
|
3170
|
-
kind: "none"
|
|
3295
|
+
kind: "none";
|
|
3296
|
+
} | {
|
|
3297
|
+
kind: "daily";
|
|
3298
|
+
} | {
|
|
3299
|
+
kind: "weekdays";
|
|
3300
|
+
} | {
|
|
3301
|
+
kind: "weekly";
|
|
3302
|
+
} | {
|
|
3303
|
+
kind: "manual";
|
|
3304
|
+
} | {
|
|
3305
|
+
kind: "interval";
|
|
3306
|
+
intervalMinutes: number;
|
|
3171
3307
|
} | undefined;
|
|
3172
3308
|
};
|
|
3173
3309
|
};
|
|
@@ -3197,7 +3333,18 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
3197
3333
|
timeExpression?: string | undefined;
|
|
3198
3334
|
timezone?: string | undefined;
|
|
3199
3335
|
recurrence?: {
|
|
3200
|
-
kind: "none"
|
|
3336
|
+
kind: "none";
|
|
3337
|
+
} | {
|
|
3338
|
+
kind: "daily";
|
|
3339
|
+
} | {
|
|
3340
|
+
kind: "weekdays";
|
|
3341
|
+
} | {
|
|
3342
|
+
kind: "weekly";
|
|
3343
|
+
} | {
|
|
3344
|
+
kind: "manual";
|
|
3345
|
+
} | {
|
|
3346
|
+
kind: "interval";
|
|
3347
|
+
intervalMinutes: number;
|
|
3201
3348
|
} | undefined;
|
|
3202
3349
|
};
|
|
3203
3350
|
};
|
|
@@ -3226,7 +3373,18 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
3226
3373
|
timeExpression?: string | undefined;
|
|
3227
3374
|
timezone?: string | undefined;
|
|
3228
3375
|
recurrence?: {
|
|
3229
|
-
kind: "none"
|
|
3376
|
+
kind: "none";
|
|
3377
|
+
} | {
|
|
3378
|
+
kind: "daily";
|
|
3379
|
+
} | {
|
|
3380
|
+
kind: "weekdays";
|
|
3381
|
+
} | {
|
|
3382
|
+
kind: "weekly";
|
|
3383
|
+
} | {
|
|
3384
|
+
kind: "manual";
|
|
3385
|
+
} | {
|
|
3386
|
+
kind: "interval";
|
|
3387
|
+
intervalMinutes: number;
|
|
3230
3388
|
} | undefined;
|
|
3231
3389
|
};
|
|
3232
3390
|
};
|
|
@@ -3255,7 +3413,18 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
3255
3413
|
timeExpression?: string | undefined;
|
|
3256
3414
|
timezone?: string | undefined;
|
|
3257
3415
|
recurrence?: {
|
|
3258
|
-
kind: "none"
|
|
3416
|
+
kind: "none";
|
|
3417
|
+
} | {
|
|
3418
|
+
kind: "daily";
|
|
3419
|
+
} | {
|
|
3420
|
+
kind: "weekdays";
|
|
3421
|
+
} | {
|
|
3422
|
+
kind: "weekly";
|
|
3423
|
+
} | {
|
|
3424
|
+
kind: "manual";
|
|
3425
|
+
} | {
|
|
3426
|
+
kind: "interval";
|
|
3427
|
+
intervalMinutes: number;
|
|
3259
3428
|
} | undefined;
|
|
3260
3429
|
};
|
|
3261
3430
|
};
|
|
@@ -3284,7 +3453,18 @@ export declare const createApiClient: (baseUrl: string) => {
|
|
|
3284
3453
|
timeExpression?: string | undefined;
|
|
3285
3454
|
timezone?: string | undefined;
|
|
3286
3455
|
recurrence?: {
|
|
3287
|
-
kind: "none"
|
|
3456
|
+
kind: "none";
|
|
3457
|
+
} | {
|
|
3458
|
+
kind: "daily";
|
|
3459
|
+
} | {
|
|
3460
|
+
kind: "weekdays";
|
|
3461
|
+
} | {
|
|
3462
|
+
kind: "weekly";
|
|
3463
|
+
} | {
|
|
3464
|
+
kind: "manual";
|
|
3465
|
+
} | {
|
|
3466
|
+
kind: "interval";
|
|
3467
|
+
intervalMinutes: number;
|
|
3288
3468
|
} | undefined;
|
|
3289
3469
|
};
|
|
3290
3470
|
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transparent retry for transient backend failures.
|
|
3
|
+
*
|
|
4
|
+
* Why: under a burst (many docks reloading at once) Cloud Run can reject
|
|
5
|
+
* requests at the ingress with 429 "no available instance" for the ~15s it
|
|
6
|
+
* takes to scale out — the request NEVER reaches the app, and the browser
|
|
7
|
+
* often reports it as a CORS/`Failed to fetch` TypeError because Google
|
|
8
|
+
* Frontend's reject carries no CORS headers (BEL-145's "CORS mask").
|
|
9
|
+
* Surfacing that to the user as an error is wrong: it self-heals in seconds.
|
|
10
|
+
*
|
|
11
|
+
* Policy:
|
|
12
|
+
* - Retry on the transient status set below and on network-level rejections
|
|
13
|
+
* (`TypeError`), with capped exponential backoff + full jitter.
|
|
14
|
+
* - Everything else (200s, 400/401/403/404/409…) returns/throws untouched —
|
|
15
|
+
* auth handling (401 forced-mint) stays with the callers.
|
|
16
|
+
* - Retrying POSTs here is deliberate: an ingress 429/503 was never
|
|
17
|
+
* processed, and the belong-cloud API is defensively idempotent where it
|
|
18
|
+
* matters (`clientMessageId` dedupe on message posts, §18/§28 state guards
|
|
19
|
+
* on approvals/cancels), so a replay is safe.
|
|
20
|
+
* - `Retry-After` (seconds form) is honored when present, capped like any
|
|
21
|
+
* other delay.
|
|
22
|
+
* - Abort-aware: an aborted `init.signal` short-circuits both the request
|
|
23
|
+
* and any backoff wait — a user cancel must never be held by a retry.
|
|
24
|
+
*
|
|
25
|
+
* Time and randomness are injectable (CLAUDE.md §25/§26); production callers
|
|
26
|
+
* use the exported `retryingFetch` singleton.
|
|
27
|
+
*/
|
|
28
|
+
export declare const TRANSIENT_STATUSES: ReadonlySet<number>;
|
|
29
|
+
/** Total attempts including the first. 5 attempts ≈ 8–12s of cumulative
|
|
30
|
+
* backoff — most of a Cloud Run scale-out window; long-lived surfaces
|
|
31
|
+
* (chat/browser SSE) layer their own reconnect loops on top. */
|
|
32
|
+
export declare const RETRY_MAX_ATTEMPTS = 5;
|
|
33
|
+
export declare const RETRY_BASE_DELAY_MS = 500;
|
|
34
|
+
export declare const RETRY_MAX_DELAY_MS = 6000;
|
|
35
|
+
export type RetryFetchOptions = {
|
|
36
|
+
readonly fetchImpl?: typeof fetch;
|
|
37
|
+
readonly maxAttempts?: number;
|
|
38
|
+
readonly baseDelayMs?: number;
|
|
39
|
+
readonly maxDelayMs?: number;
|
|
40
|
+
/** Injectable delay (§25). Tests pass an instant recorder. */
|
|
41
|
+
readonly sleepMs?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
42
|
+
/** Injectable jitter source (§26). */
|
|
43
|
+
readonly random?: () => number;
|
|
44
|
+
/** Observability hook — fired before each backoff wait. */
|
|
45
|
+
readonly onRetry?: (info: {
|
|
46
|
+
readonly attempt: number;
|
|
47
|
+
readonly status: number | null;
|
|
48
|
+
readonly delayMs: number;
|
|
49
|
+
}) => void;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Build a drop-in `fetch` that absorbs transient failures. The returned
|
|
53
|
+
* function matches `typeof fetch`, so it wires straight into `hc(baseUrl,
|
|
54
|
+
* { fetch })` and any raw call site.
|
|
55
|
+
*/
|
|
56
|
+
export declare const createRetryFetch: (options?: RetryFetchOptions) => typeof fetch;
|
|
57
|
+
/** The production instance every backend call should go through. */
|
|
58
|
+
export declare const retryingFetch: typeof fetch;
|