@8wave/ai-elements 0.124.0 → 0.125.0-beta.2

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-vue/index.js CHANGED
@@ -24517,6 +24517,6 @@ var AM = {
24517
24517
  };
24518
24518
  }
24519
24519
  });
24520
- export { JE as AGENT_STATUS_GLYPHS, YE as AGENT_VISIBILITY_GLYPHS, nD as MODEL_CATALOG_KEY, WO as PkAgentSettingsPanel, Ct as PkAuroraCanvas, Zn as PkAvatar, qi as PkBadge, rr as PkChatButton, Ek as PkChatSidebar, sk as PkChatSidebarConversationItem, sr as PkChatbot, We as PkChatbotAuth, ar as PkChatbotEmptyState, Et as PkChatbotError, Qn as PkChatbotFeedbackForm, Jn as PkChatbotFilePreview, ir as PkChatbotInput, g as PkChatbotMessages, tr as PkChatbotStepPayload, nr as PkChatbotStepToolDetail, er as PkChatbotSteps, Tt as PkChatbotViewChat, yt as PkChatbotViewConversations, or as PkChatbotViewProfile, uE as PkCheckboxField, cr as PkChunkPreview, jt as PkCode, TD as PkCopyBlock, lr as PkDocumentHeader, io as PkEditorAgentType, Un as PkEditorCheckboxButtons, vs as PkEditorCode, _o as PkEditorDocumentType, Hs as PkEditorJsonSchema, IT as PkEditorMarkdown, LT as PkEditorMedia, Eo as PkEditorNotificationType, WT as PkEditorPrompt, t as PkEditorRadioButtons, QT as PkEditorRepeater, xs as PkFieldset, Tr as PkFilePreviewDialog, Ts as PkIconOption, iE as PkInfoPopover, dE as PkInfobox, ED as PkInputColor, yE as PkIntegrationProvider, dD as PkLanguageModel, vD as PkLanguageModelCombobox, Gn as PkLazyImg, xE as PkLightbox, TE as PkLoader, DE as PkMedia, Tj as PkMessageDetail, dj as PkMessageParts, _D as PkModelOption, IE as PkOfflineScreen, sM as PkPagination, UE as PkPwaNotices, GE as PkQrCode, Wj as PkReasoningChat, bD as PkReasoningSettings, At as PkRelativeTime, Ok as PkRetryCountdown, Fs as PkSchemaField, qE as PkSkeleton, qe as PkStreamingMarkdown, $n as PkStreamingMarkdownAutoscroll, Yn as PkSvgViewer, mM as PkTableEmpty, yM as PkTableError, qM as PkTableSortable, tD as PkToolApprovalBadge, wr as PkToolChatFile, Er as PkToolRequestGeolocation, Cr as PkToolShareDocument, Mt as PkToolShowArtifact, _r as PkToolShowCalendarEvent, vr as PkToolShowComparison, gr as PkToolShowContactForm, fr as PkToolShowEmail, Wn as PkToolShowForm, xr as PkToolShowImageGallery, yr as PkToolShowLocation, pr as PkToolShowMessage, hr as PkToolShowProductList, br as PkToolShowQrCode, ur as PkToolShowSources, Sr as PkToolShowSuggestedReply, mr as PkToolShowWebPages, Xn as PkUrl, bt as PkVoiceOrb, xt as PkVoiceSession, xD as PkWebSearchSettings, Jj as PkWelcomePopup, Xj as PkWorkingBeam, Ge as VvButtonLocalized, XE as agentStatusGlyph, ZE as agentVisibilityGlyph, hE as integrationProviderIcon, dr as isMcpOAuthReport, ut as localizeSummaryLabels, wt as provideChatFilePreviewDock, Ke as provideChatImagePolicy, rD as provideModelCatalog, St as useChatFilePreview, iD as useModelCatalogEntry };
24520
+ export { JE as AGENT_STATUS_GLYPHS, YE as AGENT_VISIBILITY_GLYPHS, nD as MODEL_CATALOG_KEY, WO as PkAgentSettingsPanel, Ct as PkAuroraCanvas, Zn as PkAvatar, qi as PkBadge, rr as PkChatButton, Ek as PkChatSidebar, sk as PkChatSidebarConversationItem, sr as PkChatbot, We as PkChatbotAuth, ar as PkChatbotEmptyState, Et as PkChatbotError, Qn as PkChatbotFeedbackForm, Jn as PkChatbotFilePreview, ir as PkChatbotInput, g as PkChatbotMessages, tr as PkChatbotStepPayload, nr as PkChatbotStepToolDetail, er as PkChatbotSteps, Tt as PkChatbotViewChat, yt as PkChatbotViewConversations, or as PkChatbotViewProfile, uE as PkCheckboxField, cr as PkChunkPreview, jt as PkCode, TD as PkCopyBlock, lr as PkDocumentHeader, io as PkEditorAgentType, Un as PkEditorCheckboxButtons, vs as PkEditorCode, _o as PkEditorDocumentType, Hs as PkEditorJsonSchema, IT as PkEditorMarkdown, LT as PkEditorMedia, Eo as PkEditorNotificationType, WT as PkEditorPrompt, t as PkEditorRadioButtons, QT as PkEditorRepeater, xs as PkFieldset, Tr as PkFilePreviewDialog, Ts as PkIconOption, iE as PkInfoPopover, dE as PkInfobox, ED as PkInputColor, yE as PkIntegrationProvider, dD as PkLanguageModel, vD as PkLanguageModelCombobox, Gn as PkLazyImg, xE as PkLightbox, TE as PkLoader, DE as PkMedia, Tj as PkMessageDetail, dj as PkMessageParts, _D as PkModelOption, IE as PkOfflineScreen, sM as PkPagination, UE as PkPwaNotices, GE as PkQrCode, Wj as PkReasoningChat, bD as PkReasoningSettings, At as PkRelativeTime, Ok as PkRetryCountdown, Fs as PkSchemaField, qE as PkSkeleton, qe as PkStreamingMarkdown, $n as PkStreamingMarkdownAutoscroll, Yn as PkSvgViewer, mM as PkTableEmpty, yM as PkTableError, qM as PkTableSortable, tD as PkToolApprovalBadge, wr as PkToolChatFile, Er as PkToolRequestGeolocation, Cr as PkToolShareDocument, Mt as PkToolShowArtifact, _r as PkToolShowCalendarEvent, vr as PkToolShowComparison, gr as PkToolShowContactForm, fr as PkToolShowEmail, Wn as PkToolShowForm, xr as PkToolShowImageGallery, yr as PkToolShowLocation, pr as PkToolShowMessage, hr as PkToolShowProductList, br as PkToolShowQrCode, ur as PkToolShowSources, Sr as PkToolShowSuggestedReply, mr as PkToolShowWebPages, Xn as PkUrl, bt as PkVoiceOrb, xt as PkVoiceSession, xD as PkWebSearchSettings, Jj as PkWelcomePopup, Xj as PkWorkingBeam, Ge as VvButtonLocalized, XE as agentStatusGlyph, ZE as agentVisibilityGlyph, hE as integrationProviderIcon, dr as isMcpOAuthReport, ut as localizeSummaryLabels, wt as provideChatFilePreviewDock, Ke as provideChatImagePolicy, rD as provideModelCatalog, at as toolLabel, St as useChatFilePreview, iD as useModelCatalogEntry };
24521
24521
 
24522
24522
  //# sourceMappingURL=index.js.map
@@ -859,8 +859,8 @@ var e = {
859
859
  pagePress: "The agent wants to press {key} on “{name}”. Allow it?",
860
860
  pageFocused: "the focused element",
861
861
  pageBack: "The agent wants to go back to the previous page. Allow it?",
862
- pageNavigate: "The agent wants to open “{url}”. Allow it?",
863
- pageNavigateUnknown: "The agent wants to open “{url}”, which the page does not show. Allow it?"
862
+ pageNavigateUnknown: "The agent wants to open “{url}”, which the page does not show. Allow it?",
863
+ pageNavigate: "The agent wants to open “{url}”. Allow it?"
864
864
  },
865
865
  confirmTitle: {
866
866
  deleteMyConversations: "Delete all your conversations?",
@@ -1772,8 +1772,8 @@ var e = {
1772
1772
  pagePress: "L'agente vuole premere {key} su «{name}». Consenti?",
1773
1773
  pageFocused: "l'elemento attivo",
1774
1774
  pageBack: "L'agente vuole tornare alla pagina precedente. Consenti?",
1775
- pageNavigate: "L'agente vuole aprire «{url}». Consenti?",
1776
- pageNavigateUnknown: "L'agente vuole aprire «{url}», che la pagina non mostra. Consenti?"
1775
+ pageNavigateUnknown: "L'agente vuole aprire «{url}», che la pagina non mostra. Consenti?",
1776
+ pageNavigate: "L'agente vuole aprire «{url}». Consenti?"
1777
1777
  },
1778
1778
  confirmTitle: {
1779
1779
  deleteMyConversations: "Eliminare tutte le vostre conversazioni?",
@@ -60,6 +60,6 @@ export { MODEL_CATALOG_KEY, provideModelCatalog, useModelCatalogEntry, } from '.
60
60
  export { isMcpOAuthReport } from './mcpOAuthReport';
61
61
  export { provideChatImagePolicy } from './chatImagePolicy';
62
62
  export { provideChatFilePreviewDock } from './chatFilePreviewDock';
63
- export { localizeSummaryLabels } from './utils';
63
+ export { localizeSummaryLabels, toolLabel } from './utils';
64
64
  export { useChatFilePreview } from './useChatFilePreview';
65
65
  export { PkAgentSettingsPanel, PkAuroraCanvas, PkAvatar, PkChatSidebar, PkChatSidebarConversationItem, PkChatbot, PkChatbotEmptyState, PkChatbotError, PkChatbotFeedbackForm, PkChatbotFilePreview, PkChatbotInput, PkChatbotMessages, PkChatbotSteps, PkChatbotStepToolDetail, PkChatbotStepPayload, PkChatbotViewChat, PkChunkPreview, PkChatbotViewConversations, PkChatbotViewProfile, PkCode, PkCopyBlock, PkDocumentHeader, PkLanguageModel, PkLanguageModelCombobox, PkModelOption, PkMessageParts, PkMessageDetail, PkStreamingMarkdown, PkStreamingMarkdownAutoscroll, PkToolShowForm, PkToolShowArtifact, PkToolApprovalBadge, PkToolShowEmail, PkToolShowMessage, PkToolShowWebPages, PkToolShowProductList, PkToolShowContactForm, PkToolShowCalendarEvent, PkToolShowComparison, PkToolShowLocation, PkToolShowQrCode, PkToolShowImageGallery, PkToolShowSuggestedReply, PkToolShowSources, PkToolShareDocument, PkToolChatFile, PkFilePreviewDialog, PkToolRequestGeolocation, PkRetryCountdown, PkReasoningChat, PkReasoningSettings, PkWebSearchSettings, PkWelcomePopup, PkChatbotAuth, PkVoiceSession, PkVoiceOrb, PkChatButton, PkWorkingBeam, };
@@ -1,4 +1,4 @@
1
- import { RegisteredHostTool } from './hostTools';
1
+ import { HostToolConfirmation, RegisteredHostTool } from './hostTools';
2
2
  /**
3
3
  * Something the user can do on the screen of an app, offered to the app's
4
4
  * copilot through `app_run` (spec `host-tools.md`, the backoffice copilot).
@@ -11,11 +11,17 @@ export type AppAction = {
11
11
  /** JSON Schema of the input; none for an action that takes nothing. */
12
12
  readonly inputSchema?: Record<string, unknown>;
13
13
  /**
14
- * The question the user answers before the action runs. Every action
15
- * that changes data has one; one that only moves the interface (opens a
16
- * dialog, fills a form the user still saves) has none.
14
+ * The question the user answers before the action runs, or the whole
15
+ * card (a save that lists what it changes). Every action that changes
16
+ * data has one; one that only moves the interface (opens a dialog, fills
17
+ * a form the user still saves) has none.
17
18
  */
18
- confirmation?: (input: unknown) => string;
19
+ confirmation?: (input: unknown) => string | HostToolConfirmation;
20
+ /**
21
+ * Deletes what nothing brings back: its card asks whatever
22
+ * confirmations the user chose (spec `auto-confirmations.md`).
23
+ */
24
+ destructive?: boolean;
19
25
  /** Runs the action: resolves with what the model reads, throws with what went wrong. */
20
26
  run: (input: unknown, signal: AbortSignal) => Promise<string> | string;
21
27
  };
@@ -0,0 +1,56 @@
1
+ /** Characters a value keeps on a confirmation card. */
2
+ export declare const SUMMARY_MAX_VALUE = 80;
3
+ /** `text` on one line, cut with an ellipsis past `max` characters. */
4
+ export declare const oneLine: (text: string | null | undefined, max?: number) => string;
5
+ /**
6
+ * A long value as the card shows it once changed: from shortly before the
7
+ * first character that differs, at the start of a word, so the user reads
8
+ * what the agent wrote and not the opening it left as it was.
9
+ */
10
+ export declare const changedPart: (now: string, before: string) => string;
11
+ /** A setting that changed, as a card lists it: what it was, what it becomes. */
12
+ export type FieldChange = {
13
+ label: string;
14
+ before: string;
15
+ value: string;
16
+ };
17
+ /** The value at a dotted `path` of `data`, or `undefined`. */
18
+ export declare const valueAt: (data: unknown, path: string) => unknown;
19
+ /** True when the two hold the same value, whatever the order of their keys. */
20
+ export declare const sameValue: (a: unknown, b: unknown) => boolean;
21
+ /**
22
+ * The settings a save changes, between what the server holds (`saved`) and
23
+ * what the form sends (`edited`), over the fields the form binds: `paths`
24
+ * maps each field's name to where it lives in the data.
25
+ *
26
+ * A field holding an object of settings (the page access, a localized text)
27
+ * is compared key by key, down to the values: each key is a field of its
28
+ * own, labelled `label.<field><Key>` as the settings panel names them, a
29
+ * language by its name, anything else after its field's label. An object
30
+ * whose values read the same (an empty one, a schema's `null`) is shown
31
+ * whole. A field labels itself `label.<field>`, or the key `labels` gives
32
+ * for it. Values read as the user reads them: `value` for the fields that
33
+ * need words (a model by its name), otherwise yes and no, a list on one
34
+ * line, and a long text from where the two versions part.
35
+ */
36
+ export declare function fieldChanges(saved: unknown, edited: unknown, paths: Readonly<Record<string, string>>, options: {
37
+ t: (key: string) => string;
38
+ te: (key: string) => boolean;
39
+ /** The language of the card, for the names of the languages. */
40
+ locale: string;
41
+ /** The label key of the fields not labelled `label.<field>`. */
42
+ labels?: Readonly<Record<string, string>>;
43
+ /** A value in words, or `undefined` for the plain reading. */
44
+ value?: (field: string, value: unknown) => string | undefined;
45
+ }): FieldChange[];
46
+ /**
47
+ * The fields the server did not keep as a save sent them: every value the
48
+ * form sent (`sent`) on the paths it binds, against what the server answers
49
+ * (`saved`). What the form left empty and the server filled in is no change
50
+ * the user asked for, and neither is a value the server stamps itself
51
+ * (`stamped`, by its path in the data: who accepted something, and when).
52
+ */
53
+ export declare function unsavedFields(sent: unknown, saved: unknown, paths: Readonly<Record<string, string>>, stamped?: readonly string[]): {
54
+ field: string;
55
+ saved: unknown;
56
+ }[];
@@ -57,7 +57,16 @@ export type HostToolConfirmation = {
57
57
  }[];
58
58
  /** What the model reads when the user says no, in place of the plain refusal. */
59
59
  refusal?: string;
60
+ /**
61
+ * Asks whatever confirmations the user chose (spec
62
+ * `auto-confirmations.md`): a deletion, the site's own "are you sure?",
63
+ * an element the site marks, leaving the site. Without it, a card the
64
+ * automatic confirmations may skip.
65
+ */
66
+ keep?: boolean;
60
67
  };
68
+ /** `card` as one that asks whatever confirmations the user chose. */
69
+ export declare const alwaysAsked: (card: string | HostToolConfirmation) => HostToolConfirmation;
61
70
  /**
62
71
  * A tool a page registers on the element, as the registry keeps it: the
63
72
  * public fields only. `policy` belongs to the widget's own tools, so a page
@@ -1,5 +1,6 @@
1
1
  export * from './api';
2
2
  export * from './appTools';
3
+ export * from './fieldChanges';
3
4
  export * from './hostBridge';
4
5
  export * from './hostTools';
5
6
  export * from './types';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8wave/ai-elements",
3
3
  "private": false,
4
- "version": "0.124.0",
4
+ "version": "0.125.0-beta.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite --port 8082 --open --host",