@xyne/workflow-sdk 3.2.66 → 3.2.68
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/common/executable-check.d.ts.map +1 -1
- package/dist/common/executable-check.js +21 -4
- package/dist/common/executable-check.js.map +1 -1
- package/dist/connectors/builtin/steps/cycle.step.d.ts +2 -2
- package/dist/connectors/builtin/steps/http-request.step.d.ts +16 -16
- package/dist/connectors/builtin/steps/public-transport.d.ts +19 -0
- package/dist/connectors/builtin/steps/public-transport.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/public-transport.js +170 -0
- package/dist/connectors/builtin/steps/public-transport.js.map +1 -0
- package/dist/connectors/builtin/steps/ssrf-guard.d.ts +1 -1
- package/dist/connectors/builtin/steps/ssrf-guard.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/ssrf-guard.js +4 -11
- package/dist/connectors/builtin/steps/ssrf-guard.js.map +1 -1
- package/dist/conversational-flow/settle.js +1 -1
- package/dist/conversational-flow/settle.js.map +1 -1
- package/dist/engine/workflow-executor.d.ts.map +1 -1
- package/dist/engine/workflow-executor.js +18 -5
- package/dist/engine/workflow-executor.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/persistence/types.d.ts +7 -0
- package/dist/persistence/types.d.ts.map +1 -1
- package/dist/runtime/workflow-runtime.d.ts +2 -1
- package/dist/runtime/workflow-runtime.d.ts.map +1 -1
- package/dist/runtime/workflow-runtime.js +34 -13
- package/dist/runtime/workflow-runtime.js.map +1 -1
- package/dist/storage/files.d.ts +4 -2
- package/dist/storage/files.d.ts.map +1 -1
- package/dist/storage/files.js +12 -6
- package/dist/storage/files.js.map +1 -1
- package/dist/storage/types.d.ts +15 -3
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/types/context.d.ts +8 -0
- package/dist/types/context.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/agents/compaction.d.ts +0 -62
- package/dist/agents/compaction.d.ts.map +0 -1
- package/dist/agents/compaction.js +0 -153
- package/dist/agents/compaction.js.map +0 -1
- package/dist/agents/llm-call-policy.d.ts +0 -48
- package/dist/agents/llm-call-policy.d.ts.map +0 -1
- package/dist/agents/llm-call-policy.js +0 -140
- package/dist/agents/llm-call-policy.js.map +0 -1
- package/dist/expression/recalc.d.ts +0 -26
- package/dist/expression/recalc.d.ts.map +0 -1
- package/dist/expression/recalc.js +0 -62
- package/dist/expression/recalc.js.map +0 -1
- package/dist/types/audit-log.d.ts +0 -55
- package/dist/types/audit-log.d.ts.map +0 -1
- package/dist/types/audit-log.js +0 -2
- package/dist/types/audit-log.js.map +0 -1
- package/dist/util/wait-audit.d.ts +0 -9
- package/dist/util/wait-audit.d.ts.map +0 -1
- package/dist/util/wait-audit.js +0 -75
- package/dist/util/wait-audit.js.map +0 -1
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context compaction for runtimes that drive pi-mono's `agentLoop` directly.
|
|
3
|
-
*
|
|
4
|
-
* `agentLoop` keeps every message and re-sends all of them on every turn, so an
|
|
5
|
-
* agent that reads documents with tools grows its context by each page it
|
|
6
|
-
* prints until the model refuses the request. AgentSession compacts; the raw
|
|
7
|
-
* loop does not. This module gives the raw loop the same safety net through
|
|
8
|
-
* its `transformContext` hook.
|
|
9
|
-
*
|
|
10
|
-
* The hook sees the FULL history on every call (the loop appends to it and
|
|
11
|
-
* never stores what the hook returns), so the compactor keeps its own state:
|
|
12
|
-
* a running summary of everything before `covered`. Each call sends
|
|
13
|
-
*
|
|
14
|
-
* [first user message + summary so far, ...messages from `covered` on]
|
|
15
|
-
*
|
|
16
|
-
* and only summarises more when that view nears the context window.
|
|
17
|
-
*
|
|
18
|
-
* Two rules keep the view valid for strict chat templates (Gemma alternates
|
|
19
|
-
* user/model and rejects two user messages in a row; every tool result must
|
|
20
|
-
* follow the assistant message that called it):
|
|
21
|
-
* - the summary is appended to the first user message, never sent as its own;
|
|
22
|
-
* - the kept tail always starts at an assistant message, so a tool call and
|
|
23
|
-
* its results are summarised or kept together, never split.
|
|
24
|
-
*/
|
|
25
|
-
import { calculateContextTokens, estimateTokens } from '@earendil-works/pi-coding-agent';
|
|
26
|
-
export const DEFAULT_COMPACTION_SETTINGS = {
|
|
27
|
-
enabled: true,
|
|
28
|
-
compactAt: 0.75,
|
|
29
|
-
reserveTokens: 16_384,
|
|
30
|
-
keepRecentTokens: 20_000,
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Agents here copy exact values from documents and cite the page. A summary
|
|
34
|
-
* that drops a figure's page or rounds it breaks the citation, so the
|
|
35
|
-
* summariser is told to carry those over word for word.
|
|
36
|
-
*/
|
|
37
|
-
export const DEFAULT_COMPACTION_INSTRUCTIONS = 'This is a document-reading task. Keep, word for word, every value already found together with where it was '
|
|
38
|
-
+ 'found: the file, the page number, the [source: ...] ref and the exact quote. Never round, convert, paraphrase or '
|
|
39
|
-
+ 'drop a figure, date, name or identifier. List the files and pages already read and the values still to be found, '
|
|
40
|
-
+ 'so the work can continue without reading those pages again.';
|
|
41
|
-
const SUMMARY_HEADING = '\n\n[Earlier turns of this task were summarised to fit the context window. Summary of the work so far:]\n';
|
|
42
|
-
export function createContextCompactor(opts) {
|
|
43
|
-
const { contextWindow, settings, summarize } = opts;
|
|
44
|
-
const threshold = Math.floor(contextWindow * settings.compactAt);
|
|
45
|
-
let summary;
|
|
46
|
-
let covered = 1; // messages[1 .. covered) are in the summary; messages[0] (the task) is always kept
|
|
47
|
-
let compactedAtLength = 0; // provider usage on assistant messages older than this predates the last compaction
|
|
48
|
-
// Tokens of the view a compaction left. When the newest turns alone keep the
|
|
49
|
-
// view over the threshold, compacting again each turn would only re-summarise
|
|
50
|
-
// the turn just read — the agent loses its place and reads it again. So the
|
|
51
|
-
// next compaction waits until the context has grown past this by a margin.
|
|
52
|
-
let leftAfterLast = 0;
|
|
53
|
-
let notices = [];
|
|
54
|
-
const viewOf = (messages) => summary === undefined
|
|
55
|
-
? messages
|
|
56
|
-
: [withSummary(messages[0], summary), ...messages.slice(covered)];
|
|
57
|
-
/**
|
|
58
|
-
* Tokens the view would send. The provider's own count on the latest
|
|
59
|
-
* assistant message is exact, but only for a call made on the CURRENT view:
|
|
60
|
-
* one made before the last compaction counted the old, longer context, and
|
|
61
|
-
* trusting it would compact again on every turn.
|
|
62
|
-
*/
|
|
63
|
-
const tokensOf = (messages) => {
|
|
64
|
-
const view = viewOf(messages);
|
|
65
|
-
const originalIndex = (k) => (summary === undefined ? k : k === 0 ? 0 : covered + k - 1);
|
|
66
|
-
for (let k = view.length - 1; k >= 1; k--) {
|
|
67
|
-
const m = view[k];
|
|
68
|
-
if (m.role !== 'assistant' || !m.usage)
|
|
69
|
-
continue;
|
|
70
|
-
if (originalIndex(k) < compactedAtLength)
|
|
71
|
-
break;
|
|
72
|
-
const counted = calculateContextTokens(m.usage);
|
|
73
|
-
if (!counted)
|
|
74
|
-
break;
|
|
75
|
-
let trailing = 0;
|
|
76
|
-
for (let j = k + 1; j < view.length; j++)
|
|
77
|
-
trailing += estimateTokens(view[j]);
|
|
78
|
-
return counted + trailing;
|
|
79
|
-
}
|
|
80
|
-
return view.reduce((n, m) => n + estimateTokens(m), 0);
|
|
81
|
-
};
|
|
82
|
-
/** Start of the tail to keep: an assistant message after `covered`, about `keepRecentTokens` from the end. */
|
|
83
|
-
const cutPoint = (messages) => {
|
|
84
|
-
let kept = 0;
|
|
85
|
-
let latestTurn = -1;
|
|
86
|
-
for (let i = messages.length - 1; i > covered; i--) {
|
|
87
|
-
kept += estimateTokens(messages[i]);
|
|
88
|
-
if (roleOf(messages[i]) !== 'assistant')
|
|
89
|
-
continue;
|
|
90
|
-
if (latestTurn < 0)
|
|
91
|
-
latestTurn = i;
|
|
92
|
-
if (kept >= settings.keepRecentTokens)
|
|
93
|
-
return i;
|
|
94
|
-
}
|
|
95
|
-
// the recent turns alone are under keepRecentTokens: keep just the latest turn
|
|
96
|
-
return latestTurn;
|
|
97
|
-
};
|
|
98
|
-
return {
|
|
99
|
-
async transform(messages, signal) {
|
|
100
|
-
try {
|
|
101
|
-
if (!settings.enabled || messages.length < 3 || roleOf(messages[0]) !== 'user')
|
|
102
|
-
return messages;
|
|
103
|
-
const before = tokensOf(messages);
|
|
104
|
-
if (before <= threshold)
|
|
105
|
-
return viewOf(messages);
|
|
106
|
-
if (summary !== undefined && before < leftAfterLast + settings.keepRecentTokens / 2)
|
|
107
|
-
return viewOf(messages);
|
|
108
|
-
const cut = cutPoint(messages);
|
|
109
|
-
if (cut <= covered) {
|
|
110
|
-
notices.push({ reason: 'over the context window, but nothing older than the latest turn to summarise', tokensBefore: before, messagesSummarised: 0 });
|
|
111
|
-
return viewOf(messages);
|
|
112
|
-
}
|
|
113
|
-
const older = messages.slice(covered, cut);
|
|
114
|
-
const next = await summarize(older, summary, signal);
|
|
115
|
-
if (!next.trim())
|
|
116
|
-
throw new Error('the summary came back empty');
|
|
117
|
-
summary = next;
|
|
118
|
-
covered = cut;
|
|
119
|
-
compactedAtLength = messages.length;
|
|
120
|
-
leftAfterLast = viewOf(messages).reduce((n, m) => n + estimateTokens(m), 0);
|
|
121
|
-
notices.push({
|
|
122
|
-
reason: `context at ${String(before)} tokens, over ${String(threshold)} (window ${String(contextWindow)}): summarised ${String(older.length)} earlier messages`,
|
|
123
|
-
tokensBefore: before,
|
|
124
|
-
messagesSummarised: older.length,
|
|
125
|
-
});
|
|
126
|
-
return viewOf(messages);
|
|
127
|
-
}
|
|
128
|
-
catch (err) {
|
|
129
|
-
// the hook must not throw: send the uncompacted view and let the model decide
|
|
130
|
-
notices.push({ reason: `compaction failed: ${err instanceof Error ? err.message : String(err)}`, tokensBefore: 0, messagesSummarised: 0 });
|
|
131
|
-
return viewOf(messages);
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
drainNotices() {
|
|
135
|
-
const out = notices;
|
|
136
|
-
notices = [];
|
|
137
|
-
return out;
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
// ─── Helpers ───
|
|
142
|
-
function roleOf(m) {
|
|
143
|
-
return m?.role;
|
|
144
|
-
}
|
|
145
|
-
function withSummary(first, summary) {
|
|
146
|
-
const user = first;
|
|
147
|
-
const text = SUMMARY_HEADING + summary;
|
|
148
|
-
const content = typeof user.content === 'string'
|
|
149
|
-
? user.content + text
|
|
150
|
-
: [...user.content, { type: 'text', text }];
|
|
151
|
-
return { ...user, content };
|
|
152
|
-
}
|
|
153
|
-
//# sourceMappingURL=compaction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compaction.js","sourceRoot":"","sources":["../../src/agents/compaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAgBzF,MAAM,CAAC,MAAM,2BAA2B,GAAuB;IAC7D,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,MAAM;IACrB,gBAAgB,EAAE,MAAM;CACzB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAC1C,6GAA6G;MAC3G,mHAAmH;MACnH,mHAAmH;MACnH,6DAA6D,CAAC;AAElE,MAAM,eAAe,GACnB,2GAA2G,CAAC;AAwB9G,MAAM,UAAU,sBAAsB,CAAC,IAItC;IACC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACpD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IACjE,IAAI,OAA2B,CAAC;IAChC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,mFAAmF;IACpG,IAAI,iBAAiB,GAAG,CAAC,CAAC,CAAC,oFAAoF;IAC/G,6EAA6E;IAC7E,8EAA8E;IAC9E,4EAA4E;IAC5E,2EAA2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KAAK,CAAC,MAAM;iBACjC,CAAC,CAAC;gBACH,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC1B,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,8EAA8E;gBAC9E,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,sBAAsB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,CAAC,CAAC;gBAC3I,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QACD,YAAY;YACV,MAAM,GAAG,GAAG,OAAO,CAAC;YACpB,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC;AAED,kBAAkB;AAElB,SAAS,MAAM,CAAC,CAA2B;IACzC,OAAQ,CAAmC,EAAE,IAAI,CAAC;AACpD,CAAC;AAED,SAAS,WAAW,CAAC,KAAmB,EAAE,OAAe;IACvD,MAAM,IAAI,GAAG,KAAmF,CAAC;IACjG,MAAM,IAAI,GAAG,eAAe,GAAG,OAAO,CAAC;IACvC,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ;QAC9C,CAAC,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI;QACrB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAkB,CAAC;AAC9C,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* How PiMonoRuntime places its model calls: how many may be in flight at once, and which failed calls are tried again.
|
|
3
|
-
*
|
|
4
|
-
* A workflow runs its readers in parallel branches with no limit of its own, and each reader sends one long prompt.
|
|
5
|
-
* Against a single model behind a gateway, the calls queue at the gateway, and the last ones in line wait past its
|
|
6
|
-
* response timeout (Cloudflare answers 524 after about two minutes) or have their connection reset. Holding the extra
|
|
7
|
-
* calls here instead keeps every call that reaches the gateway inside that timeout; retrying covers the gateway's
|
|
8
|
-
* own short outages.
|
|
9
|
-
*
|
|
10
|
-
* Both act on pi-mono's `streamFn`, the function `agentLoop` uses for each model call, so the loop itself is unchanged.
|
|
11
|
-
*/
|
|
12
|
-
import type { StreamFn } from '@earendil-works/pi-agent-core';
|
|
13
|
-
export interface LlmCallPolicy {
|
|
14
|
-
/** Model calls in flight at once, across every agent step this runtime serves. Unset: no limit. */
|
|
15
|
-
maxConcurrency?: number | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Waits before each new attempt of a call that failed with a network or gateway error; one attempt per entry.
|
|
18
|
-
* `false` turns retrying off.
|
|
19
|
-
*/
|
|
20
|
-
retryDelaysMs?: number[] | false | undefined;
|
|
21
|
-
}
|
|
22
|
-
export declare const DEFAULT_RETRY_DELAYS_MS: number[];
|
|
23
|
-
export interface RetryNotice {
|
|
24
|
-
attempt: number;
|
|
25
|
-
delayMs: number;
|
|
26
|
-
error: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* A failure worth trying again: the request never got a model answer because of the network or the gateway
|
|
30
|
-
* (connection reset or refused, timeout, or a 408 / 409 / 429 / 5xx status). Not: a refused request (other 4xx),
|
|
31
|
-
* a context-length error, or anything the model returned.
|
|
32
|
-
*/
|
|
33
|
-
export declare function isTransientLlmError(message: string | undefined): boolean;
|
|
34
|
-
export interface Semaphore {
|
|
35
|
-
acquire(): Promise<() => void>;
|
|
36
|
-
}
|
|
37
|
-
export declare function createSemaphore(limit: number): Semaphore;
|
|
38
|
-
/**
|
|
39
|
-
* `base` with the policy applied. A failed attempt is retried only while nothing of the model's answer has been
|
|
40
|
-
* passed on yet (only its `start` event, which the provider sends as soon as the response headers arrive), so a
|
|
41
|
-
* retried call never repeats output. Each attempt holds a concurrency slot for its whole length.
|
|
42
|
-
*/
|
|
43
|
-
export declare function withCallPolicy(policy: LlmCallPolicy, opts?: {
|
|
44
|
-
base?: StreamFn | undefined;
|
|
45
|
-
onRetry?: ((notice: RetryNotice) => void) | undefined;
|
|
46
|
-
sleep?: ((ms: number, signal?: AbortSignal) => Promise<void>) | undefined;
|
|
47
|
-
}): StreamFn;
|
|
48
|
-
//# sourceMappingURL=llm-call-policy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-call-policy.d.ts","sourceRoot":"","sources":["../../src/agents/llm-call-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAI9D,MAAM,WAAW,aAAa;IAC5B,mGAAmG;IACnG,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,GAAG,SAAS,CAAC;CAC9C;AAED,eAAO,MAAM,uBAAuB,UAAoC,CAAC;AAEzE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAKxE;AAID,MAAM,WAAW,SAAS;IACxB,OAAO,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;CAChC;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAcxD;AASD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EACrB,IAAI,GAAE;IACJ,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACtD,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;CACtE,GACL,QAAQ,CAgDV"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* How PiMonoRuntime places its model calls: how many may be in flight at once, and which failed calls are tried again.
|
|
3
|
-
*
|
|
4
|
-
* A workflow runs its readers in parallel branches with no limit of its own, and each reader sends one long prompt.
|
|
5
|
-
* Against a single model behind a gateway, the calls queue at the gateway, and the last ones in line wait past its
|
|
6
|
-
* response timeout (Cloudflare answers 524 after about two minutes) or have their connection reset. Holding the extra
|
|
7
|
-
* calls here instead keeps every call that reaches the gateway inside that timeout; retrying covers the gateway's
|
|
8
|
-
* own short outages.
|
|
9
|
-
*
|
|
10
|
-
* Both act on pi-mono's `streamFn`, the function `agentLoop` uses for each model call, so the loop itself is unchanged.
|
|
11
|
-
*/
|
|
12
|
-
import { createAssistantMessageEventStream, streamSimple } from '@earendil-works/pi-ai';
|
|
13
|
-
export const DEFAULT_RETRY_DELAYS_MS = [15_000, 30_000, 60_000, 120_000];
|
|
14
|
-
/**
|
|
15
|
-
* A failure worth trying again: the request never got a model answer because of the network or the gateway
|
|
16
|
-
* (connection reset or refused, timeout, or a 408 / 409 / 429 / 5xx status). Not: a refused request (other 4xx),
|
|
17
|
-
* a context-length error, or anything the model returned.
|
|
18
|
-
*/
|
|
19
|
-
export function isTransientLlmError(message) {
|
|
20
|
-
if (!message)
|
|
21
|
-
return false;
|
|
22
|
-
if (/^\s*(408|409|429|5\d\d)\b/.test(message))
|
|
23
|
-
return true;
|
|
24
|
-
return /ECONNRESET|ECONNREFUSED|ETIMEDOUT|EPIPE|EAI_AGAIN|socket connection was closed|socket hang up|fetch failed|other side closed|Connection error|Request timed out|network error/i
|
|
25
|
-
.test(message);
|
|
26
|
-
}
|
|
27
|
-
export function createSemaphore(limit) {
|
|
28
|
-
let active = 0;
|
|
29
|
-
const waiting = [];
|
|
30
|
-
const release = () => {
|
|
31
|
-
active--;
|
|
32
|
-
const next = waiting.shift();
|
|
33
|
-
if (next) {
|
|
34
|
-
active++;
|
|
35
|
-
next();
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
return {
|
|
39
|
-
acquire() {
|
|
40
|
-
if (active < limit) {
|
|
41
|
-
active++;
|
|
42
|
-
return Promise.resolve(once(release));
|
|
43
|
-
}
|
|
44
|
-
return new Promise((resolve) => waiting.push(() => resolve(once(release))));
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function once(fn) {
|
|
49
|
-
let done = false;
|
|
50
|
-
return () => { if (!done) {
|
|
51
|
-
done = true;
|
|
52
|
-
fn();
|
|
53
|
-
} };
|
|
54
|
-
}
|
|
55
|
-
// ─── The wrapped call ───
|
|
56
|
-
/**
|
|
57
|
-
* `base` with the policy applied. A failed attempt is retried only while nothing of the model's answer has been
|
|
58
|
-
* passed on yet (only its `start` event, which the provider sends as soon as the response headers arrive), so a
|
|
59
|
-
* retried call never repeats output. Each attempt holds a concurrency slot for its whole length.
|
|
60
|
-
*/
|
|
61
|
-
export function withCallPolicy(policy, opts = {}) {
|
|
62
|
-
const base = opts.base ?? streamSimple;
|
|
63
|
-
const delays = policy.retryDelaysMs === false ? [] : (policy.retryDelaysMs ?? DEFAULT_RETRY_DELAYS_MS);
|
|
64
|
-
const semaphore = policy.maxConcurrency && policy.maxConcurrency > 0 ? createSemaphore(policy.maxConcurrency) : undefined;
|
|
65
|
-
const sleep = opts.sleep ?? abortableSleep;
|
|
66
|
-
return (model, context, options) => {
|
|
67
|
-
const outer = createAssistantMessageEventStream();
|
|
68
|
-
void (async () => {
|
|
69
|
-
const signal = options?.signal;
|
|
70
|
-
for (let attempt = 0;; attempt++) {
|
|
71
|
-
const release = semaphore ? await semaphore.acquire() : () => { };
|
|
72
|
-
let retryWith;
|
|
73
|
-
try {
|
|
74
|
-
let inner;
|
|
75
|
-
try {
|
|
76
|
-
inner = await base(model, context, options);
|
|
77
|
-
}
|
|
78
|
-
catch (err) {
|
|
79
|
-
// a provider that throws instead of reporting on its stream: report it the same way
|
|
80
|
-
inner = [errorEvent(model, signal?.aborted ? 'aborted' : 'error', err instanceof Error ? err.message : String(err))];
|
|
81
|
-
}
|
|
82
|
-
const held = [];
|
|
83
|
-
let passing = false;
|
|
84
|
-
for await (const event of inner) {
|
|
85
|
-
if (!passing) {
|
|
86
|
-
if (event.type === 'start') {
|
|
87
|
-
held.push(event);
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (event.type === 'error' && attempt < delays.length && !signal?.aborted
|
|
91
|
-
&& isTransientLlmError(event.error.errorMessage)) {
|
|
92
|
-
retryWith = event.error.errorMessage;
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
passing = true;
|
|
96
|
-
for (const h of held)
|
|
97
|
-
outer.push(h);
|
|
98
|
-
}
|
|
99
|
-
outer.push(event);
|
|
100
|
-
}
|
|
101
|
-
if (!retryWith) {
|
|
102
|
-
outer.end();
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
finally {
|
|
107
|
-
release();
|
|
108
|
-
}
|
|
109
|
-
const delayMs = delays[attempt];
|
|
110
|
-
opts.onRetry?.({ attempt: attempt + 1, delayMs, error: retryWith });
|
|
111
|
-
await sleep(delayMs, signal);
|
|
112
|
-
// aborted while waiting: the next attempt sees the signal and reports the abort itself
|
|
113
|
-
}
|
|
114
|
-
})();
|
|
115
|
-
return outer;
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
function errorEvent(model, reason, errorMessage) {
|
|
119
|
-
return {
|
|
120
|
-
type: 'error',
|
|
121
|
-
reason,
|
|
122
|
-
error: {
|
|
123
|
-
role: 'assistant', content: [], api: model.api, provider: model.provider, model: model.id,
|
|
124
|
-
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 0, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
|
|
125
|
-
stopReason: reason, errorMessage, timestamp: Date.now(),
|
|
126
|
-
},
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
function abortableSleep(ms, signal) {
|
|
130
|
-
return new Promise((resolve) => {
|
|
131
|
-
if (signal?.aborted) {
|
|
132
|
-
resolve();
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
const t = setTimeout(done, ms);
|
|
136
|
-
function done() { clearTimeout(t); signal?.removeEventListener('abort', done); resolve(); }
|
|
137
|
-
signal?.addEventListener('abort', done, { once: true });
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
//# sourceMappingURL=llm-call-policy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-call-policy.js","sourceRoot":"","sources":["../../src/agents/llm-call-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,iCAAiC,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAexF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAQzE;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA2B;IAC7D,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,IAAI,2BAA2B,CAAC,IAAI,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3D,OAAO,gLAAgL;SACpL,IAAI,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC;AAQD,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,MAAM,OAAO,GAAsB,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,GAAG,EAA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C,EAAE;YACzF,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;YACjJ,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACxD;KACa,CAAC;AACnB,CAAC;AAED,SAAS,cAAc,CAAC,EAAU,EAAE,MAAoB;IACtD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YAAC,OAAO,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QAC3C,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC/B,SAAS,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC3F,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Recalculation on a wait screen: boxes worked out from other boxes on the same
|
|
3
|
-
* screen, by the recipes a WAIT_FOR_HUMAN step lists in `recalc`.
|
|
4
|
-
*
|
|
5
|
-
* One implementation for both sides of a gate — the screen works the recipes
|
|
6
|
-
* out as the reviewer edits, the server fills in the boxes left empty from what
|
|
7
|
-
* was submitted — so both work a box out the same way.
|
|
8
|
-
*
|
|
9
|
-
* The formulas are the same JSONata as `{% … %}`, run over the screen's values
|
|
10
|
-
* instead of the workflow's context. The recipes are taken as the author wrote
|
|
11
|
-
* them: `dependsOn` has to list every box the formula reads, and a recipe has to
|
|
12
|
-
* come after every recipe whose box it reads.
|
|
13
|
-
*/
|
|
14
|
-
import type { RecalcRule } from '../types/pause-state.js';
|
|
15
|
-
/**
|
|
16
|
-
* Work every recipe out over a screen's values, in the order they are listed,
|
|
17
|
-
* so a recipe reading an earlier recipe's box sees its new value. Returns the
|
|
18
|
-
* values with every recipe's box filled in.
|
|
19
|
-
*
|
|
20
|
-
* Boxes typed as text are read as numbers when they are numbers ("50,00,000" →
|
|
21
|
-
* 5000000) — a form submits what was typed, and JSONata will not add text.
|
|
22
|
-
* A missing input, a division by zero or a formula that fails leaves the box
|
|
23
|
-
* blank (`null`) rather than failing the gate.
|
|
24
|
-
*/
|
|
25
|
-
export declare function runRecalc(rules: RecalcRule[], values: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
26
|
-
//# sourceMappingURL=recalc.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recalc.d.ts","sourceRoot":"","sources":["../../src/expression/recalc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAK1D;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,UAAU,EAAE,EACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAgBlC"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { compileExpression } from './parse.js';
|
|
2
|
-
// ─── Working them out ───
|
|
3
|
-
/**
|
|
4
|
-
* Work every recipe out over a screen's values, in the order they are listed,
|
|
5
|
-
* so a recipe reading an earlier recipe's box sees its new value. Returns the
|
|
6
|
-
* values with every recipe's box filled in.
|
|
7
|
-
*
|
|
8
|
-
* Boxes typed as text are read as numbers when they are numbers ("50,00,000" →
|
|
9
|
-
* 5000000) — a form submits what was typed, and JSONata will not add text.
|
|
10
|
-
* A missing input, a division by zero or a formula that fails leaves the box
|
|
11
|
-
* blank (`null`) rather than failing the gate.
|
|
12
|
-
*/
|
|
13
|
-
export async function runRecalc(rules, values) {
|
|
14
|
-
const out = { ...values };
|
|
15
|
-
const input = asNumbers(values);
|
|
16
|
-
for (const rule of rules) {
|
|
17
|
-
let result;
|
|
18
|
-
try {
|
|
19
|
-
result = await compileExpression(rule.expr).evaluate(input);
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
// A formula that fails leaves its box blank; the run goes on.
|
|
23
|
-
}
|
|
24
|
-
const value = settled(result);
|
|
25
|
-
out[rule.target] = value;
|
|
26
|
-
input[rule.target] = value;
|
|
27
|
-
}
|
|
28
|
-
return out;
|
|
29
|
-
}
|
|
30
|
-
/** Text that is a number: digits with optional grouping commas, a sign and a decimal part. */
|
|
31
|
-
const NUMBER_TEXT = /^\s*[-+]?\d[\d,]*(\.\d+)?\s*$/;
|
|
32
|
-
/** A value with every number written as text turned into a number, and blank text dropped. */
|
|
33
|
-
function asNumbers(value) {
|
|
34
|
-
if (typeof value === 'string') {
|
|
35
|
-
if (value.trim() === '')
|
|
36
|
-
return undefined;
|
|
37
|
-
return NUMBER_TEXT.test(value) ? Number(value.replace(/[\s,]/g, '')) : value;
|
|
38
|
-
}
|
|
39
|
-
if (Array.isArray(value))
|
|
40
|
-
return value.map(asNumbers).filter((item) => item !== undefined);
|
|
41
|
-
if (value !== null && typeof value === 'object') {
|
|
42
|
-
const out = {};
|
|
43
|
-
for (const [key, item] of Object.entries(value)) {
|
|
44
|
-
const next = asNumbers(item);
|
|
45
|
-
if (next !== undefined)
|
|
46
|
-
out[key] = next;
|
|
47
|
-
}
|
|
48
|
-
return out;
|
|
49
|
-
}
|
|
50
|
-
return value;
|
|
51
|
-
}
|
|
52
|
-
/** A JSONata result as a plain value to store: nothing, or a number that is not finite, is blank. */
|
|
53
|
-
function settled(result) {
|
|
54
|
-
if (result === undefined)
|
|
55
|
-
return null;
|
|
56
|
-
if (typeof result === 'number')
|
|
57
|
-
return Number.isFinite(result) ? result : null;
|
|
58
|
-
if (result !== null && typeof result === 'object')
|
|
59
|
-
return JSON.parse(JSON.stringify(result));
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=recalc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recalc.js","sourceRoot":"","sources":["../../src/expression/recalc.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,2BAA2B;AAE3B;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,KAAmB,EACnB,MAA+B;IAE/B,MAAM,GAAG,GAA4B,EAAE,GAAG,MAAM,EAAE,CAAC;IACnD,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAA4B,CAAC;IAE3D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,MAAe,CAAC;QACpB,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC9D,CAAC;QAAC,MAAM,CAAC;YACP,8DAA8D;QAChE,CAAC;QACD,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC9B,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;IAC7B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,8FAA8F;AAC9F,MAAM,WAAW,GAAG,+BAA+B,CAAC;AAEpD,8FAA8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AK,QAAQ;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAY,CAAC;IACxG,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
export interface WaitParameterChange {
|
|
2
|
-
field: string;
|
|
3
|
-
oldValue: unknown;
|
|
4
|
-
newValue: unknown;
|
|
5
|
-
label: string;
|
|
6
|
-
}
|
|
7
|
-
export interface BaseLogs {
|
|
8
|
-
executionId: string;
|
|
9
|
-
workflowId: string;
|
|
10
|
-
}
|
|
11
|
-
export interface WaitLogs {
|
|
12
|
-
nodePath: string;
|
|
13
|
-
actorId: string | null;
|
|
14
|
-
/** The actor's display name and email, filled in by the host when it stores the entry. */
|
|
15
|
-
actorName?: string | undefined;
|
|
16
|
-
actorEmail?: string | undefined;
|
|
17
|
-
actorType: 'user' | 'system' | 'webhook';
|
|
18
|
-
actionKey: string;
|
|
19
|
-
actionLabel?: string | undefined;
|
|
20
|
-
pausedAt: Date;
|
|
21
|
-
actionTakenAt: Date;
|
|
22
|
-
timeExecutionPausedMs: number;
|
|
23
|
-
changes: WaitParameterChange[];
|
|
24
|
-
nodeConfig?: Record<string, unknown> | undefined;
|
|
25
|
-
nodeAnnotations?: {
|
|
26
|
-
title?: string | undefined;
|
|
27
|
-
description?: string | undefined;
|
|
28
|
-
groupId?: string | undefined;
|
|
29
|
-
citations?: Record<string, unknown> | undefined;
|
|
30
|
-
} | undefined;
|
|
31
|
-
revision: number;
|
|
32
|
-
}
|
|
33
|
-
export interface TriggerLogs {
|
|
34
|
-
nodePath: string;
|
|
35
|
-
triggerType: 'Manual' | 'Webhook' | 'Cron' | 'Event';
|
|
36
|
-
actorId: string | null;
|
|
37
|
-
actorName?: string | undefined;
|
|
38
|
-
actorEmail?: string | undefined;
|
|
39
|
-
triggerOccurredAt: Date;
|
|
40
|
-
nodeConfig?: Record<string, unknown> | undefined;
|
|
41
|
-
nodeAnnotations?: {
|
|
42
|
-
title?: string | undefined;
|
|
43
|
-
description?: string | undefined;
|
|
44
|
-
groupId?: string | undefined;
|
|
45
|
-
citations?: Record<string, unknown> | undefined;
|
|
46
|
-
} | undefined;
|
|
47
|
-
}
|
|
48
|
-
export type AuditLogData = WaitLogs | TriggerLogs;
|
|
49
|
-
export interface AuditLogs extends BaseLogs {
|
|
50
|
-
logId: string;
|
|
51
|
-
logType: "wait_node" | "trigger_node";
|
|
52
|
-
createdAt: Date;
|
|
53
|
-
logData: AuditLogData;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=audit-log.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audit-log.d.ts","sourceRoot":"","sources":["../../src/types/audit-log.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,0FAA0F;IAC1F,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,IAAI,CAAC;IACf,aAAa,EAAE,IAAI,CAAC;IACpB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE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CAAC;CACxB"}
|
package/dist/types/audit-log.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audit-log.js","sourceRoot":"","sources":["../../src/types/audit-log.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { WaitParameterChange } from '../types/audit-log.js';
|
|
2
|
-
/**
|
|
3
|
-
* What the person changed on a wait screen: each submitted value that differs
|
|
4
|
-
* from what the screen offered. A value the screen had no default for (a box
|
|
5
|
-
* the layout fills, say) is listed with no old value when something was
|
|
6
|
-
* entered in it.
|
|
7
|
-
*/
|
|
8
|
-
export declare function buildWaitParameterChanges(inputData: Record<string, unknown>, oldValues: Record<string, unknown>, newValues: Record<string, unknown>): WaitParameterChange[];
|
|
9
|
-
//# sourceMappingURL=wait-audit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wait-audit.d.ts","sourceRoot":"","sources":["../../src/util/wait-audit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,mBAAmB,EACtB,MAAM,uBAAuB,CAAC;AA2E/B;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACrC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,mBAAmB,EAAE,CAqBvB"}
|
package/dist/util/wait-audit.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
function getFormFieldDefinitions(inputData) {
|
|
2
|
-
const form = inputData['form'];
|
|
3
|
-
if (!form || typeof form !== 'object' || Array.isArray(form)) {
|
|
4
|
-
return [];
|
|
5
|
-
}
|
|
6
|
-
const fields = form['fields'];
|
|
7
|
-
if (!Array.isArray(fields)) {
|
|
8
|
-
return [];
|
|
9
|
-
}
|
|
10
|
-
return fields.flatMap((field) => {
|
|
11
|
-
if (!field || typeof field !== 'object' || Array.isArray(field)) {
|
|
12
|
-
return [];
|
|
13
|
-
}
|
|
14
|
-
const record = field;
|
|
15
|
-
if (typeof record['name'] !== 'string') {
|
|
16
|
-
return [];
|
|
17
|
-
}
|
|
18
|
-
const label = record['label'];
|
|
19
|
-
return [{
|
|
20
|
-
name: record['name'],
|
|
21
|
-
...(typeof label === 'string'
|
|
22
|
-
? { label }
|
|
23
|
-
: {}),
|
|
24
|
-
}];
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
function resolveFieldLabel(fields, fieldName) {
|
|
28
|
-
return fields.find((field) => field.name === fieldName)?.label ?? fieldName;
|
|
29
|
-
}
|
|
30
|
-
/** Blank in any form: a box left empty is not a change from no default. */
|
|
31
|
-
function isBlank(value) {
|
|
32
|
-
return value === undefined || value === null || (typeof value === 'string' && value.trim() === '');
|
|
33
|
-
}
|
|
34
|
-
/** JSON with object keys sorted, so two equal tables compare equal. */
|
|
35
|
-
function stableJson(value) {
|
|
36
|
-
return JSON.stringify(value, (_key, v) => v && typeof v === 'object' && !Array.isArray(v)
|
|
37
|
-
? Object.fromEntries(Object.entries(v).sort(([a], [b]) => a.localeCompare(b)))
|
|
38
|
-
: v);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Whether a submitted value is what the screen offered. A number box can come
|
|
42
|
-
* back as the string "500000", and tables and lists are compared by content.
|
|
43
|
-
*/
|
|
44
|
-
function sameValue(oldValue, newValue) {
|
|
45
|
-
if (isBlank(oldValue) && isBlank(newValue))
|
|
46
|
-
return true;
|
|
47
|
-
if (typeof oldValue !== 'object' && typeof newValue !== 'object') {
|
|
48
|
-
return String(oldValue) === String(newValue);
|
|
49
|
-
}
|
|
50
|
-
return stableJson(oldValue) === stableJson(newValue);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* What the person changed on a wait screen: each submitted value that differs
|
|
54
|
-
* from what the screen offered. A value the screen had no default for (a box
|
|
55
|
-
* the layout fills, say) is listed with no old value when something was
|
|
56
|
-
* entered in it.
|
|
57
|
-
*/
|
|
58
|
-
export function buildWaitParameterChanges(inputData, oldValues, newValues) {
|
|
59
|
-
const fields = getFormFieldDefinitions(inputData);
|
|
60
|
-
const changes = [];
|
|
61
|
-
for (const [field, newValue] of Object.entries(newValues)) {
|
|
62
|
-
const oldValue = oldValues[field];
|
|
63
|
-
if (sameValue(oldValue, newValue)) {
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
changes.push({
|
|
67
|
-
field,
|
|
68
|
-
label: resolveFieldLabel(fields, field),
|
|
69
|
-
oldValue,
|
|
70
|
-
newValue,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
return changes;
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=wait-audit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wait-audit.js","sourceRoot":"","sources":["../../src/util/wait-audit.ts"],"names":[],"mappings":"AASA,SAAS,uBAAuB,CAC5B,SAAkC;IAElC,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAK,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAK,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7D,OAAO,EAAE,CAAC;IACd,CAAC;IACD,MAAM,MAAM,GAAG,IAAgC,CAAC,QAAQ,CAAC,CAAC;IAC1D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAC5D,CAAC;YACC,OAAO,EAAE,CAAC;QACd,CAAC;QAED,MAAM,MAAM,GAAI,KAAgC,CAAC;QAC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