@fiodos/web-core 0.1.10 → 0.1.12

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.
Files changed (41) hide show
  1. package/dist/cjs/api/backendClient.js +20 -0
  2. package/dist/cjs/config/types.d.ts +24 -0
  3. package/dist/cjs/config/types.js +6 -1
  4. package/dist/cjs/controller/AgentController.d.ts +105 -2
  5. package/dist/cjs/controller/AgentController.js +572 -75
  6. package/dist/cjs/dropin/createFiodosAgent.d.ts +5 -0
  7. package/dist/cjs/dropin/createFiodosAgent.js +7 -0
  8. package/dist/cjs/index.d.ts +3 -3
  9. package/dist/cjs/index.js +2 -1
  10. package/dist/cjs/orb/mountOrb.d.ts +6 -0
  11. package/dist/cjs/orb/mountOrb.js +229 -33
  12. package/dist/cjs/orb/orbView.d.ts +2 -0
  13. package/dist/cjs/orb/publishedConfig.d.ts +18 -0
  14. package/dist/cjs/orb/publishedConfig.js +6 -0
  15. package/dist/cjs/speech/bubbleDictation.d.ts +11 -0
  16. package/dist/cjs/speech/bubbleDictation.js +88 -0
  17. package/dist/cjs/ui/messages.d.ts +15 -0
  18. package/dist/cjs/ui/messages.js +12 -0
  19. package/dist/cjs/version.d.ts +1 -1
  20. package/dist/cjs/version.js +1 -1
  21. package/dist/esm/api/backendClient.js +20 -0
  22. package/dist/esm/config/types.d.ts +24 -0
  23. package/dist/esm/config/types.js +5 -0
  24. package/dist/esm/controller/AgentController.d.ts +105 -2
  25. package/dist/esm/controller/AgentController.js +574 -77
  26. package/dist/esm/dropin/createFiodosAgent.d.ts +5 -0
  27. package/dist/esm/dropin/createFiodosAgent.js +7 -0
  28. package/dist/esm/index.d.ts +3 -3
  29. package/dist/esm/index.js +1 -1
  30. package/dist/esm/orb/mountOrb.d.ts +6 -0
  31. package/dist/esm/orb/mountOrb.js +230 -34
  32. package/dist/esm/orb/orbView.d.ts +2 -0
  33. package/dist/esm/orb/publishedConfig.d.ts +18 -0
  34. package/dist/esm/orb/publishedConfig.js +6 -0
  35. package/dist/esm/speech/bubbleDictation.d.ts +11 -0
  36. package/dist/esm/speech/bubbleDictation.js +84 -0
  37. package/dist/esm/ui/messages.d.ts +15 -0
  38. package/dist/esm/ui/messages.js +12 -0
  39. package/dist/esm/version.d.ts +1 -1
  40. package/dist/esm/version.js +1 -1
  41. package/package.json +2 -2
@@ -0,0 +1,84 @@
1
+ /** Push-to-talk dictation for the text bubble input (Web Speech API). */
2
+ function speechRecognitionCtor() {
3
+ if (typeof window === 'undefined')
4
+ return null;
5
+ const w = window;
6
+ return w.SpeechRecognition ?? w.webkitSpeechRecognition ?? null;
7
+ }
8
+ function speechLocale(locale) {
9
+ return locale.toLowerCase().startsWith('es') ? 'es-ES' : 'en-US';
10
+ }
11
+ /** Keep the trailing dictation visible inside a single-line text input. */
12
+ export function scrollTextInputToEnd(input) {
13
+ const len = input.value.length;
14
+ try {
15
+ input.setSelectionRange(len, len);
16
+ }
17
+ catch {
18
+ /* read-only or unsupported */
19
+ }
20
+ input.scrollLeft = input.scrollWidth;
21
+ }
22
+ export function createBubbleDictation(locale) {
23
+ const Ctor = speechRecognitionCtor();
24
+ let recognition = null;
25
+ let listening = false;
26
+ let baseText = '';
27
+ const stop = () => {
28
+ recognition?.stop();
29
+ };
30
+ const dispose = () => {
31
+ stop();
32
+ recognition = null;
33
+ listening = false;
34
+ };
35
+ return {
36
+ isSupported: () => Ctor != null,
37
+ isListening: () => listening,
38
+ stop,
39
+ dispose,
40
+ toggle(getValue, setValue) {
41
+ if (!Ctor)
42
+ return;
43
+ if (listening) {
44
+ stop();
45
+ return;
46
+ }
47
+ baseText = getValue();
48
+ const rec = new Ctor();
49
+ rec.lang = speechLocale(locale);
50
+ rec.interimResults = true;
51
+ rec.continuous = true;
52
+ let finalText = '';
53
+ rec.onresult = (event) => {
54
+ let interim = '';
55
+ for (let i = event.resultIndex; i < event.results.length; i += 1) {
56
+ const result = event.results[i];
57
+ if (!result)
58
+ continue;
59
+ const chunk = result[0]?.transcript ?? '';
60
+ if (result.isFinal)
61
+ finalText += chunk;
62
+ else
63
+ interim += chunk;
64
+ }
65
+ const dictated = `${finalText}${interim}`.trimStart();
66
+ const combined = baseText
67
+ ? `${baseText}${baseText.endsWith(' ') ? '' : ' '}${dictated}`
68
+ : dictated;
69
+ setValue(combined);
70
+ };
71
+ rec.onend = () => {
72
+ listening = false;
73
+ recognition = null;
74
+ };
75
+ rec.onerror = () => {
76
+ listening = false;
77
+ recognition = null;
78
+ };
79
+ recognition = rec;
80
+ listening = true;
81
+ rec.start();
82
+ },
83
+ };
84
+ }
@@ -26,8 +26,23 @@ export interface WebUiMessages {
26
26
  keyboardChipLabel: string;
27
27
  /** Send button label for the text bubble. */
28
28
  sendLabel: string;
29
+ /** Mic button label for dictating into the text bubble. */
30
+ micLabel: string;
31
+ /** Mic button label while dictation is active. */
32
+ micStopLabel: string;
29
33
  /** Spoken/shown when the browser lacks speech recognition. */
30
34
  voiceUnavailable: string;
35
+ /**
36
+ * REAL live-activity labels for the chat panel (dashboard
37
+ * `agentThinkingStepsEnabled`). Unlike the old canned walk-through, each line
38
+ * is shown only when it is actually true: the request is in flight, a
39
+ * navigation/action from the manifest just ran (`{label}` interpolated), or
40
+ * the agent is waiting for the user's confirmation.
41
+ */
42
+ activityThinking: string;
43
+ activityNavigating: string;
44
+ activityExecuting: string;
45
+ activityWaitingConfirmation: string;
31
46
  }
32
47
  export interface ResolveUiMessagesOptions {
33
48
  catalogs?: Record<string, WebUiMessages>;
@@ -10,7 +10,13 @@ const en = {
10
10
  textPlaceholder: 'Type a message…',
11
11
  keyboardChipLabel: 'Type instead of talking',
12
12
  sendLabel: 'Send',
13
+ micLabel: 'Dictate message',
14
+ micStopLabel: 'Stop dictating',
13
15
  voiceUnavailable: 'Voice input is not available in this browser. You can type instead.',
16
+ activityThinking: 'Thinking…',
17
+ activityNavigating: 'Navigating to {label}…',
18
+ activityExecuting: 'Running {label}…',
19
+ activityWaitingConfirmation: 'Waiting for your confirmation…',
14
20
  };
15
21
  const es = {
16
22
  orbLabel: 'Asistente de voz',
@@ -24,7 +30,13 @@ const es = {
24
30
  textPlaceholder: 'Escribe un mensaje…',
25
31
  keyboardChipLabel: 'Escribir en lugar de hablar',
26
32
  sendLabel: 'Enviar',
33
+ micLabel: 'Dictar mensaje',
34
+ micStopLabel: 'Detener dictado',
27
35
  voiceUnavailable: 'La entrada por voz no está disponible en este navegador. Puedes escribir.',
36
+ activityThinking: 'Pensando…',
37
+ activityNavigating: 'Navegando a {label}…',
38
+ activityExecuting: 'Ejecutando {label}…',
39
+ activityWaitingConfirmation: 'Esperando tu confirmación…',
28
40
  };
29
41
  const CATALOGS = { en, es };
30
42
  function baseLanguage(locale) {
@@ -5,5 +5,5 @@
5
5
  * Auto-generated by scripts/sync-sdk-version.mjs from package.json. Do not edit
6
6
  * by hand — change package.json `version` and re-run the sync/release script.
7
7
  */
8
- export declare const SDK_VERSION = "0.1.10";
8
+ export declare const SDK_VERSION = "0.1.12";
9
9
  export declare const SDK_PACKAGE = "@fiodos/web-core";
@@ -5,5 +5,5 @@
5
5
  * Auto-generated by scripts/sync-sdk-version.mjs from package.json. Do not edit
6
6
  * by hand — change package.json `version` and re-run the sync/release script.
7
7
  */
8
- export const SDK_VERSION = '0.1.10';
8
+ export const SDK_VERSION = '0.1.12';
9
9
  export const SDK_PACKAGE = '@fiodos/web-core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiodos/web-core",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Framework-agnostic browser layer for the Fiodos agent: a vanilla AgentController (orchestrator), DOM adapters (navigation/voice/storage), HTTP client and decision engine over @fiodos/core. Shared base for @fiodos/vue, @fiodos/svelte and @fiodos/angular (no framework imports).",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {
@@ -29,7 +29,7 @@
29
29
  "prepublishOnly": "node ../../scripts/sync-sdk-version.mjs && npm run build"
30
30
  },
31
31
  "dependencies": {
32
- "@fiodos/core": "^0.1.7"
32
+ "@fiodos/core": "^0.1.9"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^22.0.0",