@paro.io/expert-shared-components 1.14.53 → 1.14.54
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.
|
@@ -102,6 +102,7 @@ const TaxAxisShell = ({ taxAxisApi, userContext = 'expert', initialSessionId, in
|
|
|
102
102
|
const [isBusy, setIsBusy] = (0, react_1.useState)(false);
|
|
103
103
|
const [error, setError] = (0, react_1.useState)(null);
|
|
104
104
|
const [busyMessage, setBusyMessage] = (0, react_1.useState)('Syncing Tax Axis session...');
|
|
105
|
+
const isPollingRef = react_1.default.useRef(false);
|
|
105
106
|
// Derive live strategies from engineOutput so CLIENT_REPORT and PREPARER_WORKPAPER
|
|
106
107
|
// render real engine data instead of the static STRATEGIES catalog.
|
|
107
108
|
const engineOutput = (0, react_1.useMemo)(() => { var _a; return (_a = llmResult === null || llmResult === void 0 ? void 0 : llmResult.engineOutput) !== null && _a !== void 0 ? _a : null; }, [llmResult]);
|
|
@@ -221,6 +222,39 @@ const TaxAxisShell = ({ taxAxisApi, userContext = 'expert', initialSessionId, in
|
|
|
221
222
|
const handleDeleteDocument = (0, react_1.useCallback)((documentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
222
223
|
yield taxAxisApi.deleteDocument(documentId);
|
|
223
224
|
}), [taxAxisApi]);
|
|
225
|
+
const pollForResult = (0, react_1.useCallback)((sid) => __awaiter(void 0, void 0, void 0, function* () {
|
|
226
|
+
const POLL_INTERVAL_MS = 4000;
|
|
227
|
+
const MAX_ATTEMPTS = 4500; // 300 minutes max
|
|
228
|
+
let attempts = 0;
|
|
229
|
+
isPollingRef.current = true;
|
|
230
|
+
const poll = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
231
|
+
attempts++;
|
|
232
|
+
try {
|
|
233
|
+
const session = yield taxAxisApi.getSession(sid);
|
|
234
|
+
if ((session === null || session === void 0 ? void 0 : session.stage) === 'REPORT_READY') {
|
|
235
|
+
if (taxAxisApi.getLlmRun) {
|
|
236
|
+
const run = yield taxAxisApi.getLlmRun(sid, 'GENERATION');
|
|
237
|
+
if (run === null || run === void 0 ? void 0 : run.outputPayload) {
|
|
238
|
+
setLlmResult(run.outputPayload);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
isPollingRef.current = false;
|
|
242
|
+
setStep('DASHBOARD');
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if ((session === null || session === void 0 ? void 0 : session.stage) === 'ERROR' || attempts >= MAX_ATTEMPTS) {
|
|
246
|
+
isPollingRef.current = false;
|
|
247
|
+
setError('Strategy generation timed out. Please try again.');
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
catch (_a) {
|
|
252
|
+
// network blip — keep polling
|
|
253
|
+
}
|
|
254
|
+
setTimeout(poll, POLL_INTERVAL_MS);
|
|
255
|
+
});
|
|
256
|
+
setTimeout(poll, POLL_INTERVAL_MS);
|
|
257
|
+
}), [taxAxisApi]);
|
|
224
258
|
const handleAnalyzeDocuments = (0, react_1.useCallback)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
225
259
|
if (!profile)
|
|
226
260
|
return;
|
|
@@ -236,11 +270,12 @@ const TaxAxisShell = ({ taxAxisApi, userContext = 'expert', initialSessionId, in
|
|
|
236
270
|
setBusyMessage('Verifying all documents are parsed...');
|
|
237
271
|
yield taxAxisApi.analyzeDocuments(ensuredSessionId);
|
|
238
272
|
setBusyMessage('Generating strategy results...');
|
|
273
|
+
yield taxAxisApi.runLlm(ensuredSessionId);
|
|
274
|
+
// runLlm now returns { queued, sessionId } — navigate to processing
|
|
275
|
+
// screen immediately and poll for REPORT_READY in the background.
|
|
239
276
|
setStep('PROCESSING');
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
setLlmResult(llmResponse.outputPayload);
|
|
243
|
-
}
|
|
277
|
+
setIsBusy(false);
|
|
278
|
+
pollForResult(ensuredSessionId);
|
|
244
279
|
}
|
|
245
280
|
catch (requestError) {
|
|
246
281
|
const msg = requestError instanceof Error
|
|
@@ -249,10 +284,8 @@ const TaxAxisShell = ({ taxAxisApi, userContext = 'expert', initialSessionId, in
|
|
|
249
284
|
setError(msg);
|
|
250
285
|
setStep('DOCUMENT_UPLOAD');
|
|
251
286
|
setIsBusy(false);
|
|
252
|
-
return;
|
|
253
287
|
}
|
|
254
|
-
|
|
255
|
-
}), [createSessionIfNeeded, profile, taxAxisApi]);
|
|
288
|
+
}), [createSessionIfNeeded, pollForResult, profile, taxAxisApi]);
|
|
256
289
|
const handleSendReport = (0, react_1.useCallback)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
257
290
|
if (!sessionId) {
|
|
258
291
|
setError('No session id available for sending report.');
|
|
@@ -310,7 +343,10 @@ const TaxAxisShell = ({ taxAxisApi, userContext = 'expert', initialSessionId, in
|
|
|
310
343
|
}), onContinue: handleAnalyzeDocuments, onBack: () => isProspectFlow ? setStep('PROSPECT_REPORT') : setStep('SESSION_SETUP') })));
|
|
311
344
|
case 'PROCESSING':
|
|
312
345
|
return (react_1.default.createElement(ShellContainer, null,
|
|
313
|
-
react_1.default.createElement(TaxAxisProcessing_1.TaxAxisProcessing, { profile: profile, userContext: userContext, onComplete: () =>
|
|
346
|
+
react_1.default.createElement(TaxAxisProcessing_1.TaxAxisProcessing, { profile: profile, userContext: userContext, onComplete: () => {
|
|
347
|
+
if (!isPollingRef.current)
|
|
348
|
+
setStep('DASHBOARD');
|
|
349
|
+
} })));
|
|
314
350
|
case 'PARSED_REVIEW':
|
|
315
351
|
return (react_1.default.createElement(ShellContainer, null,
|
|
316
352
|
react_1.default.createElement(TaxAxisExtractionReview_1.TaxAxisExtractionReview, { userContext: userContext, onBack: () => setStep('DASHBOARD'), onConfirmAndUnlock: () => setStep('DASHBOARD') })));
|
|
@@ -71,6 +71,7 @@ function resolveTimelineBucket(strategyId, roadmap) {
|
|
|
71
71
|
}
|
|
72
72
|
// ── CalculationTrace → StrategyTraceStep[] ───────────────────────────
|
|
73
73
|
function traceFromEngine(trace) {
|
|
74
|
+
var _a, _b;
|
|
74
75
|
const steps = [];
|
|
75
76
|
// Emit formula as step 1
|
|
76
77
|
if (trace.formula) {
|
|
@@ -83,7 +84,7 @@ function traceFromEngine(trace) {
|
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
86
|
// Emit confidence interval as step 2 when present
|
|
86
|
-
if (trace.confidence_interval) {
|
|
87
|
+
if (((_a = trace.confidence_interval) === null || _a === void 0 ? void 0 : _a.low) != null && ((_b = trace.confidence_interval) === null || _b === void 0 ? void 0 : _b.high) != null) {
|
|
87
88
|
steps.push({
|
|
88
89
|
n: 2,
|
|
89
90
|
step: "Confidence range",
|