@yeaft/webchat-agent 0.1.798 → 0.1.800
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/package.json +1 -1
- package/unify/dream-v2/schedule.js +5 -1
- package/unify/web-bridge.js +14 -6
package/package.json
CHANGED
|
@@ -50,7 +50,11 @@ export function createDreamScheduler({ run, intervalMs = DEFAULT_INTERVAL_MS, ke
|
|
|
50
50
|
async function fire(opts) {
|
|
51
51
|
if (inflight) {
|
|
52
52
|
log.warn?.('[dream] tick dropped — previous run still in progress');
|
|
53
|
-
return
|
|
53
|
+
return {
|
|
54
|
+
skipped: true,
|
|
55
|
+
skippedReason: 'already-running',
|
|
56
|
+
trigger: opts?.manual ? 'manual' : 'auto',
|
|
57
|
+
};
|
|
54
58
|
}
|
|
55
59
|
inflight = (async () => {
|
|
56
60
|
try {
|
package/unify/web-bridge.js
CHANGED
|
@@ -77,8 +77,8 @@ export function __testSetThreadClassifier(fn) {
|
|
|
77
77
|
* the first's inflight promise and dropped its own scope filter. So
|
|
78
78
|
* "B during A's run" doesn't actually produce a separate scoped pass
|
|
79
79
|
* for B — letting B install a second sink wrapper would only mis-stamp
|
|
80
|
-
* A's events with B's groupId.
|
|
81
|
-
* the honest answer; the user can re-click after A settles.
|
|
80
|
+
* A's events with B's groupId. Reporting B as an explicit skipped
|
|
81
|
+
* result is the honest answer; the user can re-click after A settles.
|
|
82
82
|
* @type {Set<string>}
|
|
83
83
|
*/
|
|
84
84
|
const inflightScopedDreamGroups = new Set();
|
|
@@ -3004,10 +3004,12 @@ export function normalizeDreamResult(result) {
|
|
|
3004
3004
|
.filter(t => t && t.status === 'error')
|
|
3005
3005
|
.map(t => ({ target: t.target || null, error: t.error || 'unknown' }));
|
|
3006
3006
|
const hardError = result?.error || null;
|
|
3007
|
-
const
|
|
3007
|
+
const explicitSkipped = result?.skipped === true;
|
|
3008
|
+
const skipped = !hardError && (explicitSkipped || (groupsProcessed === 0 && targetsApplied === 0));
|
|
3008
3009
|
const skippedReason = skipped
|
|
3009
|
-
? (skippedGroups[0]?.reason || 'no-targets-applied')
|
|
3010
|
+
? (result?.skippedReason || skippedGroups[0]?.reason || 'no-targets-applied')
|
|
3010
3011
|
: null;
|
|
3012
|
+
const trigger = result?.trigger || null;
|
|
3011
3013
|
const success = !hardError && targetErrors.length === 0 && !skipped && targetsApplied > 0;
|
|
3012
3014
|
|
|
3013
3015
|
return {
|
|
@@ -3020,6 +3022,7 @@ export function normalizeDreamResult(result) {
|
|
|
3020
3022
|
targetErrors,
|
|
3021
3023
|
entriesCreated: targetsApplied,
|
|
3022
3024
|
lastDreamAt: result?.startedAt || new Date().toISOString(),
|
|
3025
|
+
trigger,
|
|
3023
3026
|
error: hardError || (targetErrors[0]?.error || null),
|
|
3024
3027
|
};
|
|
3025
3028
|
}
|
|
@@ -3056,11 +3059,16 @@ export async function handleUnifyDreamTrigger(msg = {}) {
|
|
|
3056
3059
|
// dream-v2/schedule.js inflight reuse), so the user-facing semantics
|
|
3057
3060
|
// are unchanged ("you already asked").
|
|
3058
3061
|
if (groupId && inflightScopedDreamGroups.size > 0) {
|
|
3059
|
-
const
|
|
3062
|
+
const skippedResult = {
|
|
3063
|
+
skipped: true,
|
|
3064
|
+
skippedReason: 'already-running',
|
|
3065
|
+
trigger: msg.manual === false ? 'auto' : 'manual',
|
|
3066
|
+
};
|
|
3060
3067
|
sendToServer({
|
|
3061
3068
|
type: 'unify_dream_result',
|
|
3062
3069
|
...tag,
|
|
3063
|
-
...
|
|
3070
|
+
...skippedResult,
|
|
3071
|
+
...normalizeDreamResult(skippedResult),
|
|
3064
3072
|
});
|
|
3065
3073
|
return;
|
|
3066
3074
|
}
|