@dudko.dev/agent-web-ui 0.0.9 → 0.0.10
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 +40 -3
- package/dist/canvas.cjs +285 -1
- package/dist/canvas.d.cts +73 -5
- package/dist/canvas.d.ts +73 -5
- package/dist/canvas.js +278 -1
- package/dist/controller.cjs +41 -4
- package/dist/controller.d.cts +11 -1
- package/dist/controller.d.ts +11 -1
- package/dist/controller.js +39 -4
- package/dist/index.cjs +48 -0
- package/dist/index.d.cts +54 -2
- package/dist/index.d.ts +54 -2
- package/dist/index.js +43 -0
- package/dist/pipeline.cjs +30 -0
- package/dist/pipeline.css +26 -0
- package/dist/pipeline.d.cts +32 -3
- package/dist/pipeline.d.ts +32 -3
- package/dist/pipeline.js +30 -0
- package/dist/styles.css +408 -14
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
AGENT_MOTIONS: () => AGENT_MOTIONS,
|
|
33
34
|
ASK_USER_TOOL_NAME: () => ASK_USER_TOOL_NAME,
|
|
34
35
|
ATTACHMENT_BOUNDS: () => ATTACHMENT_BOUNDS,
|
|
35
36
|
ChatHistoryStore: () => ChatHistoryStore,
|
|
@@ -58,6 +59,7 @@ __export(src_exports, {
|
|
|
58
59
|
activeElementOf: () => activeElementOf,
|
|
59
60
|
addressWithoutQuery: () => addressWithoutQuery,
|
|
60
61
|
agentCoreIfLoaded: () => agentCoreIfLoaded,
|
|
62
|
+
agentMotionOf: () => agentMotionOf,
|
|
61
63
|
agentStateReducer: () => agentStateReducer,
|
|
62
64
|
agentStatusOf: () => agentStatusOf,
|
|
63
65
|
askUserOutputKept: () => askUserOutputKept,
|
|
@@ -102,10 +104,12 @@ __export(src_exports, {
|
|
|
102
104
|
elicitationSettings: () => elicitationSettings,
|
|
103
105
|
elicitationTimeoutOf: () => elicitationTimeoutOf,
|
|
104
106
|
endGap: () => endGap,
|
|
107
|
+
enteringMessageIds: () => enteringMessageIds,
|
|
105
108
|
errMessage: () => errMessage,
|
|
106
109
|
escapeAttribute: () => escapeAttribute,
|
|
107
110
|
eventTargetOf: () => eventTargetOf,
|
|
108
111
|
excerptNote: () => excerptNote,
|
|
112
|
+
exitDurationMs: () => exitDurationMs,
|
|
109
113
|
fileKindOf: () => fileKindOf,
|
|
110
114
|
fileNameOf: () => fileNameOf,
|
|
111
115
|
filterCommands: () => filterCommands,
|
|
@@ -147,6 +151,7 @@ __export(src_exports, {
|
|
|
147
151
|
messageOverLimit: () => messageOverLimit,
|
|
148
152
|
micProblemOf: () => micProblemOf,
|
|
149
153
|
micProblemText: () => micProblemText,
|
|
154
|
+
motionAttribute: () => motionAttribute,
|
|
150
155
|
namedFilesOf: () => namedFilesOf,
|
|
151
156
|
newChatId: () => newChatId,
|
|
152
157
|
notReadyIntent: () => notReadyIntent,
|
|
@@ -3218,6 +3223,44 @@ var webSearchOf = (output) => {
|
|
|
3218
3223
|
};
|
|
3219
3224
|
var formatProbability = (p) => String(Math.round(p * 100) / 100);
|
|
3220
3225
|
|
|
3226
|
+
// src/motion.ts
|
|
3227
|
+
var AGENT_MOTIONS = ["auto", "reduced", "none"];
|
|
3228
|
+
var agentMotionOf = (value) => {
|
|
3229
|
+
if (typeof value !== "string") return void 0;
|
|
3230
|
+
const motion = value.trim().toLowerCase();
|
|
3231
|
+
return AGENT_MOTIONS.includes(motion) ? motion : void 0;
|
|
3232
|
+
};
|
|
3233
|
+
var motionAttribute = (motion) => motion === "reduced" || motion === "none" ? motion : void 0;
|
|
3234
|
+
var enteringMessageIds = (previous, messages) => {
|
|
3235
|
+
if (previous === void 0) return [];
|
|
3236
|
+
const added = messages.length - previous.length;
|
|
3237
|
+
if (added < 1 || added > 2) return [];
|
|
3238
|
+
for (let i = 0; i < previous.length; i += 1) if (messages[i]?.id !== previous[i]) return [];
|
|
3239
|
+
const fresh = messages.slice(previous.length);
|
|
3240
|
+
if (!fresh.some((m) => m.pending === true)) return [];
|
|
3241
|
+
return fresh.map((m) => m.id);
|
|
3242
|
+
};
|
|
3243
|
+
var seconds = (time) => {
|
|
3244
|
+
const t = time.trim();
|
|
3245
|
+
const n = Number.parseFloat(t);
|
|
3246
|
+
if (!Number.isFinite(n)) return 0;
|
|
3247
|
+
return t.endsWith("ms") ? n : n * 1e3;
|
|
3248
|
+
};
|
|
3249
|
+
var exitDurationMs = (style) => {
|
|
3250
|
+
const names = style.animationName.split(",").map((n) => n.trim());
|
|
3251
|
+
if (names.every((n) => n === "" || n === "none")) return 0;
|
|
3252
|
+
const durations = style.animationDuration.split(",");
|
|
3253
|
+
const delays = style.animationDelay.split(",");
|
|
3254
|
+
let longest = 0;
|
|
3255
|
+
names.forEach((name, i) => {
|
|
3256
|
+
if (name === "none") return;
|
|
3257
|
+
const duration = seconds(durations[i % durations.length] ?? "0s");
|
|
3258
|
+
const delay = seconds(delays[i % delays.length] ?? "0s");
|
|
3259
|
+
longest = Math.max(longest, Math.max(0, duration) + delay);
|
|
3260
|
+
});
|
|
3261
|
+
return Math.max(0, longest);
|
|
3262
|
+
};
|
|
3263
|
+
|
|
3221
3264
|
// src/approval-queue.ts
|
|
3222
3265
|
var createApprovalQueue = () => {
|
|
3223
3266
|
const waiting = /* @__PURE__ */ new Map();
|
|
@@ -4624,6 +4667,7 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4624
4667
|
};
|
|
4625
4668
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4626
4669
|
0 && (module.exports = {
|
|
4670
|
+
AGENT_MOTIONS,
|
|
4627
4671
|
ASK_USER_TOOL_NAME,
|
|
4628
4672
|
ATTACHMENT_BOUNDS,
|
|
4629
4673
|
ChatHistoryStore,
|
|
@@ -4652,6 +4696,7 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4652
4696
|
activeElementOf,
|
|
4653
4697
|
addressWithoutQuery,
|
|
4654
4698
|
agentCoreIfLoaded,
|
|
4699
|
+
agentMotionOf,
|
|
4655
4700
|
agentStateReducer,
|
|
4656
4701
|
agentStatusOf,
|
|
4657
4702
|
askUserOutputKept,
|
|
@@ -4696,10 +4741,12 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4696
4741
|
elicitationSettings,
|
|
4697
4742
|
elicitationTimeoutOf,
|
|
4698
4743
|
endGap,
|
|
4744
|
+
enteringMessageIds,
|
|
4699
4745
|
errMessage,
|
|
4700
4746
|
escapeAttribute,
|
|
4701
4747
|
eventTargetOf,
|
|
4702
4748
|
excerptNote,
|
|
4749
|
+
exitDurationMs,
|
|
4703
4750
|
fileKindOf,
|
|
4704
4751
|
fileNameOf,
|
|
4705
4752
|
filterCommands,
|
|
@@ -4741,6 +4788,7 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4741
4788
|
messageOverLimit,
|
|
4742
4789
|
micProblemOf,
|
|
4743
4790
|
micProblemText,
|
|
4791
|
+
motionAttribute,
|
|
4744
4792
|
namedFilesOf,
|
|
4745
4793
|
newChatId,
|
|
4746
4794
|
notReadyIntent,
|
package/dist/index.d.cts
CHANGED
|
@@ -372,6 +372,58 @@ declare const webSearchOf: (output: unknown) => WebSearchView | undefined;
|
|
|
372
372
|
/** 0.934 → "0.93", 0.8 → "0.8", 1 → "1". */
|
|
373
373
|
declare const formatProbability: (p: number) => string;
|
|
374
374
|
|
|
375
|
+
/**
|
|
376
|
+
* Motion: how the chat's parts come and go. The look of it is `styles.css` (the `--awr-motion-*`
|
|
377
|
+
* tokens and the "Motion" section); what a view needs to decide is here, pure - no DOM, no clock.
|
|
378
|
+
*
|
|
379
|
+
* - `AgentMotion`: `'auto'` (the default: soft motion, and only a short fade with no movement when
|
|
380
|
+
* the device asks for reduced motion), `'reduced'` (that fade always), `'none'` (nothing moves:
|
|
381
|
+
* every duration 0). A view puts it on its root as `data-awr-motion` (`motionAttribute`).
|
|
382
|
+
* - `enteringMessageIds`: which messages of the transcript arrive live (and so fade in) - never the
|
|
383
|
+
* messages already there when the transcript is first drawn, nor a saved chat opened.
|
|
384
|
+
* - `exitDurationMs`: how long an element's closing animation runs, from its computed style (0:
|
|
385
|
+
* remove it now).
|
|
386
|
+
*/
|
|
387
|
+
/** How the chat moves (`<AgentChat motion>`, `<dd-agent-chat motion>`, `data-awr-motion`). */
|
|
388
|
+
type AgentMotion = 'auto' | 'reduced' | 'none';
|
|
389
|
+
/** Every value of `AgentMotion`. */
|
|
390
|
+
declare const AGENT_MOTIONS: readonly AgentMotion[];
|
|
391
|
+
/**
|
|
392
|
+
* A value (an attribute, a property) as an `AgentMotion`: the three names, any case, surrounding
|
|
393
|
+
* blanks ignored; anything else is `undefined` (the next source decides, finally `'auto'`).
|
|
394
|
+
*/
|
|
395
|
+
declare const agentMotionOf: (value: unknown) => AgentMotion | undefined;
|
|
396
|
+
/**
|
|
397
|
+
* The `data-awr-motion` attribute for a motion: none for `'auto'` (the stylesheet's default,
|
|
398
|
+
* which follows `prefers-reduced-motion`), else the name.
|
|
399
|
+
*/
|
|
400
|
+
declare const motionAttribute: (motion: AgentMotion | undefined) => "reduced" | "none" | undefined;
|
|
401
|
+
/** What `enteringMessageIds` reads of a message. */
|
|
402
|
+
interface MotionMessage {
|
|
403
|
+
readonly id: string;
|
|
404
|
+
readonly pending?: boolean;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* The messages that arrive live between two drawings of the transcript, which a view lets fade in.
|
|
408
|
+
* `previous` is the ids drawn before (`undefined`: the transcript's first drawing - nothing
|
|
409
|
+
* enters, whatever is there). Live means a turn begun: one or two messages added AFTER every
|
|
410
|
+
* message already drawn (in their order), at least one of them still being written (`pending`).
|
|
411
|
+
* A saved chat opened, a transcript replaced or cut, a reload - nothing enters.
|
|
412
|
+
*/
|
|
413
|
+
declare const enteringMessageIds: (previous: readonly string[] | undefined, messages: readonly MotionMessage[]) => string[];
|
|
414
|
+
/** What `exitDurationMs` reads of an element's computed style. */
|
|
415
|
+
interface MotionStyle {
|
|
416
|
+
readonly animationName: string;
|
|
417
|
+
readonly animationDuration: string;
|
|
418
|
+
readonly animationDelay: string;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* How long (ms) an element's animation runs: the longest of its animations' delay + duration, 0
|
|
422
|
+
* when it has none (`animation-name: none`: a host without the stylesheet, `motion: 'none'`).
|
|
423
|
+
* A view removes a closing element after that, at once for 0.
|
|
424
|
+
*/
|
|
425
|
+
declare const exitDurationMs: (style: MotionStyle) => number;
|
|
426
|
+
|
|
375
427
|
/** The consent requests waiting for a person, by request id. */
|
|
376
428
|
interface ApprovalQueue {
|
|
377
429
|
/**
|
|
@@ -1012,5 +1064,5 @@ interface AudioSpeakerOptions {
|
|
|
1012
1064
|
*/
|
|
1013
1065
|
declare const createAudioSpeaker: (options: AudioSpeakerOptions) => SpeakText;
|
|
1014
1066
|
|
|
1015
|
-
export { AgentUiState, ApprovalView, ChatAttachment, ChatHistoryStore, ChatMessage, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, HTML_PREVIEW_MAX_CHARS, LessonView, MicError, NAMED_FILES_MAX, NAMED_FILES_SCAN_MAX, NAMED_FILES_TEXT_MAX, PROMPT_ARM_MS, RECORDING_DEFAULT_MAX_MS, RECORDING_TYPES, RemoteRunView, SpeechOutputError, SubagentNode, SubagentView, activeElementOf, agentCoreIfLoaded, agentStateReducer, agentStatusOf, attachmentsText, audioExtensionOf, audioTypeOf, buildSandboxedDocument, chatTitle, clampFrameHeight, coalesce, composedContains, createApprovalQueue, createAudioSpeaker, createBrowserSpeaker, createInitialAgentState, createPromptArming, createRecordingRecognizer, cspMetaTag, deepActiveElement, deepElementFromPoint, downscaleImage, endGap, errMessage, escapeAttribute, eventTargetOf, followOtherTabs, followsAfterResize, followsAfterScroll, formatDuration, formatProbability, formatTokens, imageSizeOf, imagesInOutput, isEventInside, isShadowRoot, languageOfText, lessonsOf, linkedFilesOf, listenScrollAround, listenToOtherTabs, loadAgentCore, mergeChatRecord, micProblemOf, namedFilesOf, newChatId, nothingFocused, ownUnsaved, pathsNamedIn, pendingApprovalsOf, pickRecordingType, portalHostOf, previewValue, recordingSupported, remoteAnswerOf, rootOf, sandboxTokens, sandboxedCsp, saveChat, scriptOfLanguage, scriptOfText, shadowRootsAround, speakableText, speechSynthesisSupported, splitForSpeech, startRecording, stopTracks, subagentTree, tokenizeHtml, unchangedSince, voiceFor, voicesOf, webSearchOf, withCspFirst, withPolicyFirst, workspacePathOf };
|
|
1016
|
-
export type { AgentAction, AgentCoreModule, ApprovalQueue, AttachmentTexts, AudioLike, AudioSpeakerOptions, BrowserSpeakerOptions, ChatBase, ChatHistoryStoreOptions, ChatRecord, ChatSummary, DownscaleOptions, ImageSize, MediaRecorderConstructorLike, MediaRecorderLike, MicProblem, NamedFilesOptions, PromptArming, ReadAloudState, RecordedAudio, Recording, RecordingDeps, RecordingRecognizerOptions, SandboxedDocumentOptions, ScrollMeasure, SourceToken, SpeakText, SpeakableOptions, SpeechPlayback, SpeechRecognizerLike, SpeechScript, SpeechSynthesisLike, SpeechUtteranceLike, SpeechVoiceLike, StartRecordingOptions, StorageChangeSource, SynthesizeSpeech, TranscribeAudio, WebSearchResultView, WebSearchView };
|
|
1067
|
+
export { AGENT_MOTIONS, AgentUiState, ApprovalView, ChatAttachment, ChatHistoryStore, ChatMessage, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, HTML_PREVIEW_MAX_CHARS, LessonView, MicError, NAMED_FILES_MAX, NAMED_FILES_SCAN_MAX, NAMED_FILES_TEXT_MAX, PROMPT_ARM_MS, RECORDING_DEFAULT_MAX_MS, RECORDING_TYPES, RemoteRunView, SpeechOutputError, SubagentNode, SubagentView, activeElementOf, agentCoreIfLoaded, agentMotionOf, agentStateReducer, agentStatusOf, attachmentsText, audioExtensionOf, audioTypeOf, buildSandboxedDocument, chatTitle, clampFrameHeight, coalesce, composedContains, createApprovalQueue, createAudioSpeaker, createBrowserSpeaker, createInitialAgentState, createPromptArming, createRecordingRecognizer, cspMetaTag, deepActiveElement, deepElementFromPoint, downscaleImage, endGap, enteringMessageIds, errMessage, escapeAttribute, eventTargetOf, exitDurationMs, followOtherTabs, followsAfterResize, followsAfterScroll, formatDuration, formatProbability, formatTokens, imageSizeOf, imagesInOutput, isEventInside, isShadowRoot, languageOfText, lessonsOf, linkedFilesOf, listenScrollAround, listenToOtherTabs, loadAgentCore, mergeChatRecord, micProblemOf, motionAttribute, namedFilesOf, newChatId, nothingFocused, ownUnsaved, pathsNamedIn, pendingApprovalsOf, pickRecordingType, portalHostOf, previewValue, recordingSupported, remoteAnswerOf, rootOf, sandboxTokens, sandboxedCsp, saveChat, scriptOfLanguage, scriptOfText, shadowRootsAround, speakableText, speechSynthesisSupported, splitForSpeech, startRecording, stopTracks, subagentTree, tokenizeHtml, unchangedSince, voiceFor, voicesOf, webSearchOf, withCspFirst, withPolicyFirst, workspacePathOf };
|
|
1068
|
+
export type { AgentAction, AgentCoreModule, AgentMotion, ApprovalQueue, AttachmentTexts, AudioLike, AudioSpeakerOptions, BrowserSpeakerOptions, ChatBase, ChatHistoryStoreOptions, ChatRecord, ChatSummary, DownscaleOptions, ImageSize, MediaRecorderConstructorLike, MediaRecorderLike, MicProblem, MotionMessage, MotionStyle, NamedFilesOptions, PromptArming, ReadAloudState, RecordedAudio, Recording, RecordingDeps, RecordingRecognizerOptions, SandboxedDocumentOptions, ScrollMeasure, SourceToken, SpeakText, SpeakableOptions, SpeechPlayback, SpeechRecognizerLike, SpeechScript, SpeechSynthesisLike, SpeechUtteranceLike, SpeechVoiceLike, StartRecordingOptions, StorageChangeSource, SynthesizeSpeech, TranscribeAudio, WebSearchResultView, WebSearchView };
|
package/dist/index.d.ts
CHANGED
|
@@ -372,6 +372,58 @@ declare const webSearchOf: (output: unknown) => WebSearchView | undefined;
|
|
|
372
372
|
/** 0.934 → "0.93", 0.8 → "0.8", 1 → "1". */
|
|
373
373
|
declare const formatProbability: (p: number) => string;
|
|
374
374
|
|
|
375
|
+
/**
|
|
376
|
+
* Motion: how the chat's parts come and go. The look of it is `styles.css` (the `--awr-motion-*`
|
|
377
|
+
* tokens and the "Motion" section); what a view needs to decide is here, pure - no DOM, no clock.
|
|
378
|
+
*
|
|
379
|
+
* - `AgentMotion`: `'auto'` (the default: soft motion, and only a short fade with no movement when
|
|
380
|
+
* the device asks for reduced motion), `'reduced'` (that fade always), `'none'` (nothing moves:
|
|
381
|
+
* every duration 0). A view puts it on its root as `data-awr-motion` (`motionAttribute`).
|
|
382
|
+
* - `enteringMessageIds`: which messages of the transcript arrive live (and so fade in) - never the
|
|
383
|
+
* messages already there when the transcript is first drawn, nor a saved chat opened.
|
|
384
|
+
* - `exitDurationMs`: how long an element's closing animation runs, from its computed style (0:
|
|
385
|
+
* remove it now).
|
|
386
|
+
*/
|
|
387
|
+
/** How the chat moves (`<AgentChat motion>`, `<dd-agent-chat motion>`, `data-awr-motion`). */
|
|
388
|
+
type AgentMotion = 'auto' | 'reduced' | 'none';
|
|
389
|
+
/** Every value of `AgentMotion`. */
|
|
390
|
+
declare const AGENT_MOTIONS: readonly AgentMotion[];
|
|
391
|
+
/**
|
|
392
|
+
* A value (an attribute, a property) as an `AgentMotion`: the three names, any case, surrounding
|
|
393
|
+
* blanks ignored; anything else is `undefined` (the next source decides, finally `'auto'`).
|
|
394
|
+
*/
|
|
395
|
+
declare const agentMotionOf: (value: unknown) => AgentMotion | undefined;
|
|
396
|
+
/**
|
|
397
|
+
* The `data-awr-motion` attribute for a motion: none for `'auto'` (the stylesheet's default,
|
|
398
|
+
* which follows `prefers-reduced-motion`), else the name.
|
|
399
|
+
*/
|
|
400
|
+
declare const motionAttribute: (motion: AgentMotion | undefined) => "reduced" | "none" | undefined;
|
|
401
|
+
/** What `enteringMessageIds` reads of a message. */
|
|
402
|
+
interface MotionMessage {
|
|
403
|
+
readonly id: string;
|
|
404
|
+
readonly pending?: boolean;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* The messages that arrive live between two drawings of the transcript, which a view lets fade in.
|
|
408
|
+
* `previous` is the ids drawn before (`undefined`: the transcript's first drawing - nothing
|
|
409
|
+
* enters, whatever is there). Live means a turn begun: one or two messages added AFTER every
|
|
410
|
+
* message already drawn (in their order), at least one of them still being written (`pending`).
|
|
411
|
+
* A saved chat opened, a transcript replaced or cut, a reload - nothing enters.
|
|
412
|
+
*/
|
|
413
|
+
declare const enteringMessageIds: (previous: readonly string[] | undefined, messages: readonly MotionMessage[]) => string[];
|
|
414
|
+
/** What `exitDurationMs` reads of an element's computed style. */
|
|
415
|
+
interface MotionStyle {
|
|
416
|
+
readonly animationName: string;
|
|
417
|
+
readonly animationDuration: string;
|
|
418
|
+
readonly animationDelay: string;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* How long (ms) an element's animation runs: the longest of its animations' delay + duration, 0
|
|
422
|
+
* when it has none (`animation-name: none`: a host without the stylesheet, `motion: 'none'`).
|
|
423
|
+
* A view removes a closing element after that, at once for 0.
|
|
424
|
+
*/
|
|
425
|
+
declare const exitDurationMs: (style: MotionStyle) => number;
|
|
426
|
+
|
|
375
427
|
/** The consent requests waiting for a person, by request id. */
|
|
376
428
|
interface ApprovalQueue {
|
|
377
429
|
/**
|
|
@@ -1012,5 +1064,5 @@ interface AudioSpeakerOptions {
|
|
|
1012
1064
|
*/
|
|
1013
1065
|
declare const createAudioSpeaker: (options: AudioSpeakerOptions) => SpeakText;
|
|
1014
1066
|
|
|
1015
|
-
export { AgentUiState, ApprovalView, ChatAttachment, ChatHistoryStore, ChatMessage, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, HTML_PREVIEW_MAX_CHARS, LessonView, MicError, NAMED_FILES_MAX, NAMED_FILES_SCAN_MAX, NAMED_FILES_TEXT_MAX, PROMPT_ARM_MS, RECORDING_DEFAULT_MAX_MS, RECORDING_TYPES, RemoteRunView, SpeechOutputError, SubagentNode, SubagentView, activeElementOf, agentCoreIfLoaded, agentStateReducer, agentStatusOf, attachmentsText, audioExtensionOf, audioTypeOf, buildSandboxedDocument, chatTitle, clampFrameHeight, coalesce, composedContains, createApprovalQueue, createAudioSpeaker, createBrowserSpeaker, createInitialAgentState, createPromptArming, createRecordingRecognizer, cspMetaTag, deepActiveElement, deepElementFromPoint, downscaleImage, endGap, errMessage, escapeAttribute, eventTargetOf, followOtherTabs, followsAfterResize, followsAfterScroll, formatDuration, formatProbability, formatTokens, imageSizeOf, imagesInOutput, isEventInside, isShadowRoot, languageOfText, lessonsOf, linkedFilesOf, listenScrollAround, listenToOtherTabs, loadAgentCore, mergeChatRecord, micProblemOf, namedFilesOf, newChatId, nothingFocused, ownUnsaved, pathsNamedIn, pendingApprovalsOf, pickRecordingType, portalHostOf, previewValue, recordingSupported, remoteAnswerOf, rootOf, sandboxTokens, sandboxedCsp, saveChat, scriptOfLanguage, scriptOfText, shadowRootsAround, speakableText, speechSynthesisSupported, splitForSpeech, startRecording, stopTracks, subagentTree, tokenizeHtml, unchangedSince, voiceFor, voicesOf, webSearchOf, withCspFirst, withPolicyFirst, workspacePathOf };
|
|
1016
|
-
export type { AgentAction, AgentCoreModule, ApprovalQueue, AttachmentTexts, AudioLike, AudioSpeakerOptions, BrowserSpeakerOptions, ChatBase, ChatHistoryStoreOptions, ChatRecord, ChatSummary, DownscaleOptions, ImageSize, MediaRecorderConstructorLike, MediaRecorderLike, MicProblem, NamedFilesOptions, PromptArming, ReadAloudState, RecordedAudio, Recording, RecordingDeps, RecordingRecognizerOptions, SandboxedDocumentOptions, ScrollMeasure, SourceToken, SpeakText, SpeakableOptions, SpeechPlayback, SpeechRecognizerLike, SpeechScript, SpeechSynthesisLike, SpeechUtteranceLike, SpeechVoiceLike, StartRecordingOptions, StorageChangeSource, SynthesizeSpeech, TranscribeAudio, WebSearchResultView, WebSearchView };
|
|
1067
|
+
export { AGENT_MOTIONS, AgentUiState, ApprovalView, ChatAttachment, ChatHistoryStore, ChatMessage, FOLLOW_LEAVE_PX, FOLLOW_REJOIN_PX, FRAME_MAX_HEIGHT, FRAME_MIN_HEIGHT, HTML_PREVIEW_MAX_CHARS, LessonView, MicError, NAMED_FILES_MAX, NAMED_FILES_SCAN_MAX, NAMED_FILES_TEXT_MAX, PROMPT_ARM_MS, RECORDING_DEFAULT_MAX_MS, RECORDING_TYPES, RemoteRunView, SpeechOutputError, SubagentNode, SubagentView, activeElementOf, agentCoreIfLoaded, agentMotionOf, agentStateReducer, agentStatusOf, attachmentsText, audioExtensionOf, audioTypeOf, buildSandboxedDocument, chatTitle, clampFrameHeight, coalesce, composedContains, createApprovalQueue, createAudioSpeaker, createBrowserSpeaker, createInitialAgentState, createPromptArming, createRecordingRecognizer, cspMetaTag, deepActiveElement, deepElementFromPoint, downscaleImage, endGap, enteringMessageIds, errMessage, escapeAttribute, eventTargetOf, exitDurationMs, followOtherTabs, followsAfterResize, followsAfterScroll, formatDuration, formatProbability, formatTokens, imageSizeOf, imagesInOutput, isEventInside, isShadowRoot, languageOfText, lessonsOf, linkedFilesOf, listenScrollAround, listenToOtherTabs, loadAgentCore, mergeChatRecord, micProblemOf, motionAttribute, namedFilesOf, newChatId, nothingFocused, ownUnsaved, pathsNamedIn, pendingApprovalsOf, pickRecordingType, portalHostOf, previewValue, recordingSupported, remoteAnswerOf, rootOf, sandboxTokens, sandboxedCsp, saveChat, scriptOfLanguage, scriptOfText, shadowRootsAround, speakableText, speechSynthesisSupported, splitForSpeech, startRecording, stopTracks, subagentTree, tokenizeHtml, unchangedSince, voiceFor, voicesOf, webSearchOf, withCspFirst, withPolicyFirst, workspacePathOf };
|
|
1068
|
+
export type { AgentAction, AgentCoreModule, AgentMotion, ApprovalQueue, AttachmentTexts, AudioLike, AudioSpeakerOptions, BrowserSpeakerOptions, ChatBase, ChatHistoryStoreOptions, ChatRecord, ChatSummary, DownscaleOptions, ImageSize, MediaRecorderConstructorLike, MediaRecorderLike, MicProblem, MotionMessage, MotionStyle, NamedFilesOptions, PromptArming, ReadAloudState, RecordedAudio, Recording, RecordingDeps, RecordingRecognizerOptions, SandboxedDocumentOptions, ScrollMeasure, SourceToken, SpeakText, SpeakableOptions, SpeechPlayback, SpeechRecognizerLike, SpeechScript, SpeechSynthesisLike, SpeechUtteranceLike, SpeechVoiceLike, StartRecordingOptions, StorageChangeSource, SynthesizeSpeech, TranscribeAudio, WebSearchResultView, WebSearchView };
|
package/dist/index.js
CHANGED
|
@@ -1184,6 +1184,44 @@ var webSearchOf = (output) => {
|
|
|
1184
1184
|
};
|
|
1185
1185
|
var formatProbability = (p) => String(Math.round(p * 100) / 100);
|
|
1186
1186
|
|
|
1187
|
+
// src/motion.ts
|
|
1188
|
+
var AGENT_MOTIONS = ["auto", "reduced", "none"];
|
|
1189
|
+
var agentMotionOf = (value) => {
|
|
1190
|
+
if (typeof value !== "string") return void 0;
|
|
1191
|
+
const motion = value.trim().toLowerCase();
|
|
1192
|
+
return AGENT_MOTIONS.includes(motion) ? motion : void 0;
|
|
1193
|
+
};
|
|
1194
|
+
var motionAttribute = (motion) => motion === "reduced" || motion === "none" ? motion : void 0;
|
|
1195
|
+
var enteringMessageIds = (previous, messages) => {
|
|
1196
|
+
if (previous === void 0) return [];
|
|
1197
|
+
const added = messages.length - previous.length;
|
|
1198
|
+
if (added < 1 || added > 2) return [];
|
|
1199
|
+
for (let i = 0; i < previous.length; i += 1) if (messages[i]?.id !== previous[i]) return [];
|
|
1200
|
+
const fresh = messages.slice(previous.length);
|
|
1201
|
+
if (!fresh.some((m) => m.pending === true)) return [];
|
|
1202
|
+
return fresh.map((m) => m.id);
|
|
1203
|
+
};
|
|
1204
|
+
var seconds = (time) => {
|
|
1205
|
+
const t = time.trim();
|
|
1206
|
+
const n = Number.parseFloat(t);
|
|
1207
|
+
if (!Number.isFinite(n)) return 0;
|
|
1208
|
+
return t.endsWith("ms") ? n : n * 1e3;
|
|
1209
|
+
};
|
|
1210
|
+
var exitDurationMs = (style) => {
|
|
1211
|
+
const names = style.animationName.split(",").map((n) => n.trim());
|
|
1212
|
+
if (names.every((n) => n === "" || n === "none")) return 0;
|
|
1213
|
+
const durations = style.animationDuration.split(",");
|
|
1214
|
+
const delays = style.animationDelay.split(",");
|
|
1215
|
+
let longest = 0;
|
|
1216
|
+
names.forEach((name, i) => {
|
|
1217
|
+
if (name === "none") return;
|
|
1218
|
+
const duration = seconds(durations[i % durations.length] ?? "0s");
|
|
1219
|
+
const delay = seconds(delays[i % delays.length] ?? "0s");
|
|
1220
|
+
longest = Math.max(longest, Math.max(0, duration) + delay);
|
|
1221
|
+
});
|
|
1222
|
+
return Math.max(0, longest);
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1187
1225
|
// src/elicitation.ts
|
|
1188
1226
|
var ELICITATION_TIMEOUT_MS = 3e5;
|
|
1189
1227
|
var elicitationSettings = (option) => {
|
|
@@ -2376,6 +2414,7 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
2376
2414
|
};
|
|
2377
2415
|
};
|
|
2378
2416
|
export {
|
|
2417
|
+
AGENT_MOTIONS,
|
|
2379
2418
|
ASK_USER_TOOL_NAME,
|
|
2380
2419
|
ATTACHMENT_BOUNDS,
|
|
2381
2420
|
ChatHistoryStore,
|
|
@@ -2404,6 +2443,7 @@ export {
|
|
|
2404
2443
|
activeElementOf,
|
|
2405
2444
|
addressWithoutQuery,
|
|
2406
2445
|
agentCoreIfLoaded,
|
|
2446
|
+
agentMotionOf,
|
|
2407
2447
|
agentStateReducer,
|
|
2408
2448
|
agentStatusOf,
|
|
2409
2449
|
askUserOutputKept,
|
|
@@ -2448,10 +2488,12 @@ export {
|
|
|
2448
2488
|
elicitationSettings,
|
|
2449
2489
|
elicitationTimeoutOf,
|
|
2450
2490
|
endGap,
|
|
2491
|
+
enteringMessageIds,
|
|
2451
2492
|
errMessage,
|
|
2452
2493
|
escapeAttribute,
|
|
2453
2494
|
eventTargetOf,
|
|
2454
2495
|
excerptNote,
|
|
2496
|
+
exitDurationMs,
|
|
2455
2497
|
fileKindOf,
|
|
2456
2498
|
fileNameOf,
|
|
2457
2499
|
filterCommands,
|
|
@@ -2493,6 +2535,7 @@ export {
|
|
|
2493
2535
|
messageOverLimit,
|
|
2494
2536
|
micProblemOf,
|
|
2495
2537
|
micProblemText,
|
|
2538
|
+
motionAttribute,
|
|
2496
2539
|
namedFilesOf,
|
|
2497
2540
|
newChatId,
|
|
2498
2541
|
notReadyIntent,
|
package/dist/pipeline.cjs
CHANGED
|
@@ -32,6 +32,8 @@ __export(pipeline_exports, {
|
|
|
32
32
|
moveNode: () => moveNode,
|
|
33
33
|
nextNodePosition: () => nextNodePosition,
|
|
34
34
|
parsePipelineJson: () => parsePipelineJson,
|
|
35
|
+
pipelineIssueView: () => pipelineIssueView,
|
|
36
|
+
pipelineLoopBound: () => pipelineLoopBound,
|
|
35
37
|
pipelineNodeView: () => pipelineNodeView,
|
|
36
38
|
pipelineStateReducer: () => pipelineStateReducer,
|
|
37
39
|
pipelineToCode: () => pipelineToCode,
|
|
@@ -669,8 +671,11 @@ var defaultPipelineLabels = {
|
|
|
669
671
|
noIssues: "No issues",
|
|
670
672
|
errors: (n) => `${n} error${n === 1 ? "" : "s"}`,
|
|
671
673
|
warnings: (n) => `${n} warning${n === 1 ? "" : "s"}`,
|
|
674
|
+
notes: (n) => `${n} note${n === 1 ? "" : "s"}`,
|
|
672
675
|
issueError: "Error",
|
|
673
676
|
issueWarning: "Warning",
|
|
677
|
+
issueInfo: "Info",
|
|
678
|
+
loopBounded: (visits, runs) => `Has loops — bounded by ${visits} visit${visits === 1 ? "" : "s"} per node and ${runs} node run${runs === 1 ? "" : "s"} in total`,
|
|
674
679
|
canvas: { ...defaultCanvasLabels, canvas: "Pipeline canvas" },
|
|
675
680
|
emptyCanvas: "No nodes yet. Add one to start.",
|
|
676
681
|
nodeDescription: (status, visits) => visits > 1 ? `${status}, visit ${visits}.` : `${status}.`,
|
|
@@ -762,6 +767,7 @@ var defaultPipelineLabels = {
|
|
|
762
767
|
limitDefault: (n) => `default ${n}`,
|
|
763
768
|
counts: (nodes, edges) => `${nodes} node${nodes === 1 ? "" : "s"}, ${edges} connection${edges === 1 ? "" : "s"}`,
|
|
764
769
|
runPlaceholder: "What should the pipeline work on?",
|
|
770
|
+
runHint: "Ctrl+Enter (⌘+Enter on a Mac) runs it; Enter starts a new line.",
|
|
765
771
|
runInput: "Request",
|
|
766
772
|
run: "Run",
|
|
767
773
|
stop: "Stop",
|
|
@@ -813,6 +819,28 @@ var mergePipelineLabels = (base, over) => {
|
|
|
813
819
|
}
|
|
814
820
|
return out;
|
|
815
821
|
};
|
|
822
|
+
|
|
823
|
+
// src/pipeline/issues.ts
|
|
824
|
+
var import_agent_web2 = require("@dudko.dev/agent-web");
|
|
825
|
+
var finiteBound = (value, fallback) => {
|
|
826
|
+
const bound = value ?? fallback;
|
|
827
|
+
return Number.isInteger(bound) && bound >= 1 ? bound : void 0;
|
|
828
|
+
};
|
|
829
|
+
var pipelineLoopBound = (def) => {
|
|
830
|
+
const maxNodeVisits = finiteBound(def.limits?.maxNodeVisits, import_agent_web2.PIPELINE_LIMITS.maxNodeVisits);
|
|
831
|
+
const maxRuns = finiteBound(def.limits?.maxRuns, import_agent_web2.PIPELINE_LIMITS.maxRuns);
|
|
832
|
+
return maxNodeVisits !== void 0 && maxRuns !== void 0 ? { maxNodeVisits, maxRuns } : void 0;
|
|
833
|
+
};
|
|
834
|
+
var pipelineIssueView = (def, validation) => {
|
|
835
|
+
const bound = pipelineLoopBound(def);
|
|
836
|
+
const warnings = [];
|
|
837
|
+
const notes = [];
|
|
838
|
+
for (const issue of validation.warnings) {
|
|
839
|
+
if (issue.code === "cycle" && bound) notes.push({ issue, kind: "loop-bounded", ...bound });
|
|
840
|
+
else warnings.push(issue);
|
|
841
|
+
}
|
|
842
|
+
return { errors: validation.errors, warnings, notes };
|
|
843
|
+
};
|
|
816
844
|
// Annotate the CommonJS export names for ESM import in node:
|
|
817
845
|
0 && (module.exports = {
|
|
818
846
|
addEdge,
|
|
@@ -827,6 +855,8 @@ var mergePipelineLabels = (base, over) => {
|
|
|
827
855
|
moveNode,
|
|
828
856
|
nextNodePosition,
|
|
829
857
|
parsePipelineJson,
|
|
858
|
+
pipelineIssueView,
|
|
859
|
+
pipelineLoopBound,
|
|
830
860
|
pipelineNodeView,
|
|
831
861
|
pipelineStateReducer,
|
|
832
862
|
pipelineToCode,
|
package/dist/pipeline.css
CHANGED
|
@@ -629,6 +629,9 @@
|
|
|
629
629
|
.awr-pissue--warning .awr-pissue__kind {
|
|
630
630
|
color: var(--awr-warn);
|
|
631
631
|
}
|
|
632
|
+
.awr-pissue--info .awr-pissue__kind {
|
|
633
|
+
color: var(--awr-muted);
|
|
634
|
+
}
|
|
632
635
|
.awr-pissue__text {
|
|
633
636
|
min-width: 0;
|
|
634
637
|
overflow-wrap: anywhere;
|
|
@@ -1077,6 +1080,29 @@
|
|
|
1077
1080
|
min-height: 44px;
|
|
1078
1081
|
padding-inline: 14px;
|
|
1079
1082
|
}
|
|
1083
|
+
.awr-pipeline__run-field {
|
|
1084
|
+
flex: 1 1 0;
|
|
1085
|
+
min-width: 0;
|
|
1086
|
+
display: grid;
|
|
1087
|
+
gap: 4px;
|
|
1088
|
+
}
|
|
1089
|
+
.awr-pipeline__run-input--multi {
|
|
1090
|
+
width: 100%;
|
|
1091
|
+
font: inherit;
|
|
1092
|
+
resize: none;
|
|
1093
|
+
padding-block: 10px;
|
|
1094
|
+
line-height: 1.45;
|
|
1095
|
+
/* Grows with its text up to about eight lines, then scrolls inside itself. */
|
|
1096
|
+
max-height: min(12em, 40vh);
|
|
1097
|
+
overflow-y: auto;
|
|
1098
|
+
}
|
|
1099
|
+
.awr-pipeline__run-hint {
|
|
1100
|
+
color: var(--awr-muted);
|
|
1101
|
+
font-size: 12px;
|
|
1102
|
+
}
|
|
1103
|
+
.awr-pipeline__run:has(.awr-pipeline__run-field) {
|
|
1104
|
+
align-items: flex-start;
|
|
1105
|
+
}
|
|
1080
1106
|
.awr-pipeline__run-btn {
|
|
1081
1107
|
min-height: 44px;
|
|
1082
1108
|
min-width: 92px;
|
package/dist/pipeline.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentEvent, PipelineResult, IUsage, PipelineStop, PipelineDefinition, PipelineCondition, PipelineNode, PipelineIssue } from '@dudko.dev/agent-web';
|
|
1
|
+
import { AgentEvent, PipelineResult, IUsage, PipelineStop, PipelineDefinition, PipelineCondition, PipelineNode, PipelineIssue, PipelineValidation } from '@dudko.dev/agent-web';
|
|
2
2
|
import { CanvasLabels } from './canvas.cjs';
|
|
3
3
|
|
|
4
4
|
type PipelineRunStatus = 'idle' | 'running' | 'done' | 'failed' | 'stopped';
|
|
@@ -235,8 +235,13 @@ interface PipelineLabels {
|
|
|
235
235
|
noIssues: string;
|
|
236
236
|
errors: (n: number) => string;
|
|
237
237
|
warnings: (n: number) => string;
|
|
238
|
+
/** Notes: information, nothing to fix (a loop the limits bound). */
|
|
239
|
+
notes: (n: number) => string;
|
|
238
240
|
issueError: string;
|
|
239
241
|
issueWarning: string;
|
|
242
|
+
issueInfo: string;
|
|
243
|
+
/** A loop the limits bound, as a note. */
|
|
244
|
+
loopBounded: (maxNodeVisits: number, maxRuns: number) => string;
|
|
240
245
|
/** The canvas's own strings (its name, its keyboard help, what a port and an edge are called). */
|
|
241
246
|
canvas: CanvasLabels;
|
|
242
247
|
emptyCanvas: string;
|
|
@@ -311,6 +316,8 @@ interface PipelineLabels {
|
|
|
311
316
|
limitDefault: (n: number) => string;
|
|
312
317
|
counts: (nodes: number, edges: number) => string;
|
|
313
318
|
runPlaceholder: string;
|
|
319
|
+
/** Under a multi-line request (`multilineRequest`): how to run it. */
|
|
320
|
+
runHint: string;
|
|
314
321
|
runInput: string;
|
|
315
322
|
run: string;
|
|
316
323
|
stop: string;
|
|
@@ -346,5 +353,27 @@ type PipelineLabelsOverride = Partial<Omit<PipelineLabels, Nested>> & {
|
|
|
346
353
|
/** `base` with `over` applied (nested groups merged, not replaced). */
|
|
347
354
|
declare const mergePipelineLabels: (base: PipelineLabels, over?: PipelineLabelsOverride) => PipelineLabels;
|
|
348
355
|
|
|
349
|
-
|
|
350
|
-
|
|
356
|
+
/** A note: information about the definition, nothing to fix. */
|
|
357
|
+
interface PipelineNote {
|
|
358
|
+
/** The core's issue it stands for (where it leads: its node or edge). */
|
|
359
|
+
issue: PipelineIssue;
|
|
360
|
+
kind: 'loop-bounded';
|
|
361
|
+
/** The bound: visits per node and node runs in total. */
|
|
362
|
+
maxNodeVisits: number;
|
|
363
|
+
maxRuns: number;
|
|
364
|
+
}
|
|
365
|
+
interface PipelineIssueView {
|
|
366
|
+
errors: PipelineIssue[];
|
|
367
|
+
warnings: PipelineIssue[];
|
|
368
|
+
notes: PipelineNote[];
|
|
369
|
+
}
|
|
370
|
+
/** The loop's effective bound, or undefined when the definition has none the engine applies. */
|
|
371
|
+
declare const pipelineLoopBound: (def: Pick<PipelineDefinition, "limits">) => {
|
|
372
|
+
maxNodeVisits: number;
|
|
373
|
+
maxRuns: number;
|
|
374
|
+
} | undefined;
|
|
375
|
+
/** The check as the editor shows it: a bounded loop moved from the warnings to the notes. */
|
|
376
|
+
declare const pipelineIssueView: (def: Pick<PipelineDefinition, "limits">, validation: PipelineValidation) => PipelineIssueView;
|
|
377
|
+
|
|
378
|
+
export { addEdge, addNode, autoLayout, createInitialPipelineState, defaultPipelineLabels, emptyPipeline, ensureEdgeIds, issueTarget, mergePipelineLabels, moveNode, nextNodePosition, parsePipelineJson, pipelineIssueView, pipelineLoopBound, pipelineNodeView, pipelineStateReducer, pipelineToCode, removeEdge, removeNode, renameNode, renameRoute, setEntry, setLimits, setPipelineName, slugifyId, uniqueEdgeId, uniqueNodeId, updateEdge, updateNode };
|
|
379
|
+
export type { AutoLayoutOptions, PipelineAction, PipelineCodeOptions, PipelineCodeTarget, PipelineEdgeView, PipelineIssueView, PipelineLabels, PipelineLabelsOverride, PipelineNodeActivity, PipelineNodeStatus, PipelineNodeView, PipelineNote, PipelineOutputView, PipelineRunStatus, PipelineSelection, PipelineUiState, PipelineVisitView };
|
package/dist/pipeline.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentEvent, PipelineResult, IUsage, PipelineStop, PipelineDefinition, PipelineCondition, PipelineNode, PipelineIssue } from '@dudko.dev/agent-web';
|
|
1
|
+
import { AgentEvent, PipelineResult, IUsage, PipelineStop, PipelineDefinition, PipelineCondition, PipelineNode, PipelineIssue, PipelineValidation } from '@dudko.dev/agent-web';
|
|
2
2
|
import { CanvasLabels } from './canvas.js';
|
|
3
3
|
|
|
4
4
|
type PipelineRunStatus = 'idle' | 'running' | 'done' | 'failed' | 'stopped';
|
|
@@ -235,8 +235,13 @@ interface PipelineLabels {
|
|
|
235
235
|
noIssues: string;
|
|
236
236
|
errors: (n: number) => string;
|
|
237
237
|
warnings: (n: number) => string;
|
|
238
|
+
/** Notes: information, nothing to fix (a loop the limits bound). */
|
|
239
|
+
notes: (n: number) => string;
|
|
238
240
|
issueError: string;
|
|
239
241
|
issueWarning: string;
|
|
242
|
+
issueInfo: string;
|
|
243
|
+
/** A loop the limits bound, as a note. */
|
|
244
|
+
loopBounded: (maxNodeVisits: number, maxRuns: number) => string;
|
|
240
245
|
/** The canvas's own strings (its name, its keyboard help, what a port and an edge are called). */
|
|
241
246
|
canvas: CanvasLabels;
|
|
242
247
|
emptyCanvas: string;
|
|
@@ -311,6 +316,8 @@ interface PipelineLabels {
|
|
|
311
316
|
limitDefault: (n: number) => string;
|
|
312
317
|
counts: (nodes: number, edges: number) => string;
|
|
313
318
|
runPlaceholder: string;
|
|
319
|
+
/** Under a multi-line request (`multilineRequest`): how to run it. */
|
|
320
|
+
runHint: string;
|
|
314
321
|
runInput: string;
|
|
315
322
|
run: string;
|
|
316
323
|
stop: string;
|
|
@@ -346,5 +353,27 @@ type PipelineLabelsOverride = Partial<Omit<PipelineLabels, Nested>> & {
|
|
|
346
353
|
/** `base` with `over` applied (nested groups merged, not replaced). */
|
|
347
354
|
declare const mergePipelineLabels: (base: PipelineLabels, over?: PipelineLabelsOverride) => PipelineLabels;
|
|
348
355
|
|
|
349
|
-
|
|
350
|
-
|
|
356
|
+
/** A note: information about the definition, nothing to fix. */
|
|
357
|
+
interface PipelineNote {
|
|
358
|
+
/** The core's issue it stands for (where it leads: its node or edge). */
|
|
359
|
+
issue: PipelineIssue;
|
|
360
|
+
kind: 'loop-bounded';
|
|
361
|
+
/** The bound: visits per node and node runs in total. */
|
|
362
|
+
maxNodeVisits: number;
|
|
363
|
+
maxRuns: number;
|
|
364
|
+
}
|
|
365
|
+
interface PipelineIssueView {
|
|
366
|
+
errors: PipelineIssue[];
|
|
367
|
+
warnings: PipelineIssue[];
|
|
368
|
+
notes: PipelineNote[];
|
|
369
|
+
}
|
|
370
|
+
/** The loop's effective bound, or undefined when the definition has none the engine applies. */
|
|
371
|
+
declare const pipelineLoopBound: (def: Pick<PipelineDefinition, "limits">) => {
|
|
372
|
+
maxNodeVisits: number;
|
|
373
|
+
maxRuns: number;
|
|
374
|
+
} | undefined;
|
|
375
|
+
/** The check as the editor shows it: a bounded loop moved from the warnings to the notes. */
|
|
376
|
+
declare const pipelineIssueView: (def: Pick<PipelineDefinition, "limits">, validation: PipelineValidation) => PipelineIssueView;
|
|
377
|
+
|
|
378
|
+
export { addEdge, addNode, autoLayout, createInitialPipelineState, defaultPipelineLabels, emptyPipeline, ensureEdgeIds, issueTarget, mergePipelineLabels, moveNode, nextNodePosition, parsePipelineJson, pipelineIssueView, pipelineLoopBound, pipelineNodeView, pipelineStateReducer, pipelineToCode, removeEdge, removeNode, renameNode, renameRoute, setEntry, setLimits, setPipelineName, slugifyId, uniqueEdgeId, uniqueNodeId, updateEdge, updateNode };
|
|
379
|
+
export type { AutoLayoutOptions, PipelineAction, PipelineCodeOptions, PipelineCodeTarget, PipelineEdgeView, PipelineIssueView, PipelineLabels, PipelineLabelsOverride, PipelineNodeActivity, PipelineNodeStatus, PipelineNodeView, PipelineNote, PipelineOutputView, PipelineRunStatus, PipelineSelection, PipelineUiState, PipelineVisitView };
|
package/dist/pipeline.js
CHANGED
|
@@ -603,8 +603,11 @@ var defaultPipelineLabels = {
|
|
|
603
603
|
noIssues: "No issues",
|
|
604
604
|
errors: (n) => `${n} error${n === 1 ? "" : "s"}`,
|
|
605
605
|
warnings: (n) => `${n} warning${n === 1 ? "" : "s"}`,
|
|
606
|
+
notes: (n) => `${n} note${n === 1 ? "" : "s"}`,
|
|
606
607
|
issueError: "Error",
|
|
607
608
|
issueWarning: "Warning",
|
|
609
|
+
issueInfo: "Info",
|
|
610
|
+
loopBounded: (visits, runs) => `Has loops — bounded by ${visits} visit${visits === 1 ? "" : "s"} per node and ${runs} node run${runs === 1 ? "" : "s"} in total`,
|
|
608
611
|
canvas: { ...defaultCanvasLabels, canvas: "Pipeline canvas" },
|
|
609
612
|
emptyCanvas: "No nodes yet. Add one to start.",
|
|
610
613
|
nodeDescription: (status, visits) => visits > 1 ? `${status}, visit ${visits}.` : `${status}.`,
|
|
@@ -696,6 +699,7 @@ var defaultPipelineLabels = {
|
|
|
696
699
|
limitDefault: (n) => `default ${n}`,
|
|
697
700
|
counts: (nodes, edges) => `${nodes} node${nodes === 1 ? "" : "s"}, ${edges} connection${edges === 1 ? "" : "s"}`,
|
|
698
701
|
runPlaceholder: "What should the pipeline work on?",
|
|
702
|
+
runHint: "Ctrl+Enter (⌘+Enter on a Mac) runs it; Enter starts a new line.",
|
|
699
703
|
runInput: "Request",
|
|
700
704
|
run: "Run",
|
|
701
705
|
stop: "Stop",
|
|
@@ -747,6 +751,30 @@ var mergePipelineLabels = (base, over) => {
|
|
|
747
751
|
}
|
|
748
752
|
return out;
|
|
749
753
|
};
|
|
754
|
+
|
|
755
|
+
// src/pipeline/issues.ts
|
|
756
|
+
import {
|
|
757
|
+
PIPELINE_LIMITS
|
|
758
|
+
} from "@dudko.dev/agent-web";
|
|
759
|
+
var finiteBound = (value, fallback) => {
|
|
760
|
+
const bound = value ?? fallback;
|
|
761
|
+
return Number.isInteger(bound) && bound >= 1 ? bound : void 0;
|
|
762
|
+
};
|
|
763
|
+
var pipelineLoopBound = (def) => {
|
|
764
|
+
const maxNodeVisits = finiteBound(def.limits?.maxNodeVisits, PIPELINE_LIMITS.maxNodeVisits);
|
|
765
|
+
const maxRuns = finiteBound(def.limits?.maxRuns, PIPELINE_LIMITS.maxRuns);
|
|
766
|
+
return maxNodeVisits !== void 0 && maxRuns !== void 0 ? { maxNodeVisits, maxRuns } : void 0;
|
|
767
|
+
};
|
|
768
|
+
var pipelineIssueView = (def, validation) => {
|
|
769
|
+
const bound = pipelineLoopBound(def);
|
|
770
|
+
const warnings = [];
|
|
771
|
+
const notes = [];
|
|
772
|
+
for (const issue of validation.warnings) {
|
|
773
|
+
if (issue.code === "cycle" && bound) notes.push({ issue, kind: "loop-bounded", ...bound });
|
|
774
|
+
else warnings.push(issue);
|
|
775
|
+
}
|
|
776
|
+
return { errors: validation.errors, warnings, notes };
|
|
777
|
+
};
|
|
750
778
|
export {
|
|
751
779
|
addEdge,
|
|
752
780
|
addNode,
|
|
@@ -760,6 +788,8 @@ export {
|
|
|
760
788
|
moveNode,
|
|
761
789
|
nextNodePosition,
|
|
762
790
|
parsePipelineJson,
|
|
791
|
+
pipelineIssueView,
|
|
792
|
+
pipelineLoopBound,
|
|
763
793
|
pipelineNodeView,
|
|
764
794
|
pipelineStateReducer,
|
|
765
795
|
pipelineToCode,
|