@fiodos/web-core 0.1.0

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 (84) hide show
  1. package/LICENSE +77 -0
  2. package/dist/cjs/adapters/webNavigationAdapter.d.ts +31 -0
  3. package/dist/cjs/adapters/webNavigationAdapter.js +45 -0
  4. package/dist/cjs/adapters/webStorageAdapter.d.ts +13 -0
  5. package/dist/cjs/adapters/webStorageAdapter.js +57 -0
  6. package/dist/cjs/adapters/webVoiceAdapter.d.ts +16 -0
  7. package/dist/cjs/adapters/webVoiceAdapter.js +477 -0
  8. package/dist/cjs/api/backendClient.d.ts +31 -0
  9. package/dist/cjs/api/backendClient.js +182 -0
  10. package/dist/cjs/api/backendTelemetry.d.ts +23 -0
  11. package/dist/cjs/api/backendTelemetry.js +80 -0
  12. package/dist/cjs/api/clientBootstrap.d.ts +44 -0
  13. package/dist/cjs/api/clientBootstrap.js +68 -0
  14. package/dist/cjs/api/errors.d.ts +11 -0
  15. package/dist/cjs/api/errors.js +16 -0
  16. package/dist/cjs/bridge/createBridge.d.ts +13 -0
  17. package/dist/cjs/bridge/createBridge.js +15 -0
  18. package/dist/cjs/config/types.d.ts +63 -0
  19. package/dist/cjs/config/types.js +9 -0
  20. package/dist/cjs/context/screenContextStore.d.ts +26 -0
  21. package/dist/cjs/context/screenContextStore.js +25 -0
  22. package/dist/cjs/controller/AgentController.d.ts +115 -0
  23. package/dist/cjs/controller/AgentController.js +594 -0
  24. package/dist/cjs/core/turnEngine.d.ts +70 -0
  25. package/dist/cjs/core/turnEngine.js +96 -0
  26. package/dist/cjs/dropin/createFiodosAgent.d.ts +60 -0
  27. package/dist/cjs/dropin/createFiodosAgent.js +143 -0
  28. package/dist/cjs/dropin/createFyodosAgent.d.ts +60 -0
  29. package/dist/cjs/dropin/createFyodosAgent.js +143 -0
  30. package/dist/cjs/index.d.ts +45 -0
  31. package/dist/cjs/index.js +67 -0
  32. package/dist/cjs/orb/mountOrb.d.ts +24 -0
  33. package/dist/cjs/orb/mountOrb.js +694 -0
  34. package/dist/cjs/orb/orbView.d.ts +56 -0
  35. package/dist/cjs/orb/orbView.js +426 -0
  36. package/dist/cjs/orb/publishedConfig.d.ts +32 -0
  37. package/dist/cjs/orb/publishedConfig.js +70 -0
  38. package/dist/cjs/package.json +1 -0
  39. package/dist/cjs/speech/speechSession.d.ts +35 -0
  40. package/dist/cjs/speech/speechSession.js +60 -0
  41. package/dist/cjs/ui/messages.d.ts +36 -0
  42. package/dist/cjs/ui/messages.js +41 -0
  43. package/dist/esm/adapters/webNavigationAdapter.d.ts +31 -0
  44. package/dist/esm/adapters/webNavigationAdapter.js +41 -0
  45. package/dist/esm/adapters/webStorageAdapter.d.ts +13 -0
  46. package/dist/esm/adapters/webStorageAdapter.js +54 -0
  47. package/dist/esm/adapters/webVoiceAdapter.d.ts +16 -0
  48. package/dist/esm/adapters/webVoiceAdapter.js +474 -0
  49. package/dist/esm/api/backendClient.d.ts +31 -0
  50. package/dist/esm/api/backendClient.js +178 -0
  51. package/dist/esm/api/backendTelemetry.d.ts +23 -0
  52. package/dist/esm/api/backendTelemetry.js +77 -0
  53. package/dist/esm/api/clientBootstrap.d.ts +44 -0
  54. package/dist/esm/api/clientBootstrap.js +63 -0
  55. package/dist/esm/api/errors.d.ts +11 -0
  56. package/dist/esm/api/errors.js +11 -0
  57. package/dist/esm/bridge/createBridge.d.ts +13 -0
  58. package/dist/esm/bridge/createBridge.js +12 -0
  59. package/dist/esm/config/types.d.ts +63 -0
  60. package/dist/esm/config/types.js +6 -0
  61. package/dist/esm/context/screenContextStore.d.ts +26 -0
  62. package/dist/esm/context/screenContextStore.js +22 -0
  63. package/dist/esm/controller/AgentController.d.ts +115 -0
  64. package/dist/esm/controller/AgentController.js +590 -0
  65. package/dist/esm/core/turnEngine.d.ts +70 -0
  66. package/dist/esm/core/turnEngine.js +92 -0
  67. package/dist/esm/dropin/createFiodosAgent.d.ts +60 -0
  68. package/dist/esm/dropin/createFiodosAgent.js +140 -0
  69. package/dist/esm/dropin/createFyodosAgent.d.ts +60 -0
  70. package/dist/esm/dropin/createFyodosAgent.js +140 -0
  71. package/dist/esm/index.d.ts +45 -0
  72. package/dist/esm/index.js +38 -0
  73. package/dist/esm/orb/mountOrb.d.ts +24 -0
  74. package/dist/esm/orb/mountOrb.js +691 -0
  75. package/dist/esm/orb/orbView.d.ts +56 -0
  76. package/dist/esm/orb/orbView.js +421 -0
  77. package/dist/esm/orb/publishedConfig.d.ts +32 -0
  78. package/dist/esm/orb/publishedConfig.js +67 -0
  79. package/dist/esm/package.json +1 -0
  80. package/dist/esm/speech/speechSession.d.ts +35 -0
  81. package/dist/esm/speech/speechSession.js +57 -0
  82. package/dist/esm/ui/messages.d.ts +36 -0
  83. package/dist/esm/ui/messages.js +38 -0
  84. package/package.json +38 -0
package/LICENSE ADDED
@@ -0,0 +1,77 @@
1
+ Fiodos SDK License Agreement
2
+
3
+ Copyright (c) 2026 Fiodos / Rodrigo Martínez. All rights reserved.
4
+
5
+ This is a proprietary, commercial software license. It is NOT an open-source
6
+ license. Please read it carefully before installing or using the Software.
7
+
8
+ 1. Definitions.
9
+ "Software" means the Fiodos SDK packages (including, without limitation, the
10
+ @fiodos/* npm packages and the fiodos_flutter package) together with any
11
+ accompanying files, documentation, and updates provided by the Licensor.
12
+ "Service" means the hosted Fiodos backend, APIs, and related services
13
+ operated by the Licensor.
14
+ "Licensor" means Fiodos / Rodrigo Martínez (and, once incorporated, the
15
+ company that succeeds to these rights).
16
+ "You" means the individual or legal entity that installs or uses the
17
+ Software.
18
+
19
+ 2. Grant of License.
20
+ Subject to Your continued compliance with this Agreement, the Licensor grants
21
+ You a limited, non-exclusive, non-transferable, non-sublicensable, and
22
+ revocable license to install and use the Software solely for the purpose of
23
+ integrating with and accessing the Fiodos Service from within Your own
24
+ applications.
25
+
26
+ 3. Restrictions.
27
+ Except as expressly permitted in Section 2, You may NOT, in whole or in part:
28
+ (a) copy the Software, except for the copying strictly necessary to install
29
+ and run it for its intended purpose;
30
+ (b) modify, adapt, translate, or create derivative works of the Software;
31
+ (c) redistribute, publish, sublicense, sell, rent, lease, lend, or otherwise
32
+ make the Software available to any third party as a standalone item;
33
+ (d) reverse engineer, decompile, or disassemble the Software, or attempt to
34
+ derive its source code, except and only to the extent that this
35
+ restriction is expressly prohibited by applicable law;
36
+ (e) remove, obscure, or alter any copyright, trademark, or other proprietary
37
+ notices contained in the Software; or
38
+ (f) use the Software, or any portion of it, to develop, train, or assist in
39
+ developing a product or service that competes with Fiodos.
40
+
41
+ 4. Reservation of Rights.
42
+ The Software is licensed, not sold. All right, title, and interest in and to
43
+ the Software, including all related intellectual property rights, are and
44
+ shall remain the exclusive property of the Licensor. All rights not expressly
45
+ granted to You under this Agreement are reserved by the Licensor.
46
+
47
+ 5. Termination.
48
+ This license terminates automatically and immediately if You breach any term
49
+ of this Agreement. Upon termination, You must cease all use of the Software
50
+ and delete all copies in Your possession or control. Sections 3, 4, 6, and 7
51
+ survive termination.
52
+
53
+ 6. Disclaimer of Warranty.
54
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
55
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
56
+ FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
57
+
58
+ 7. Limitation of Liability.
59
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL THE
60
+ LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN
61
+ ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
62
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
63
+
64
+ 8. Contact.
65
+ For licensing inquiries, contact Rodrigo Martínez (Fiodos).
66
+
67
+ --------------------------------------------------------------------------------
68
+
69
+ Nota (ES) — Licencia propietaria:
70
+ Se permite INSTALAR y USAR el SDK únicamente para integrar y acceder al servicio
71
+ Fiodos desde tus propias aplicaciones. Quedan PROHIBIDOS: copiar el código (salvo
72
+ la copia imprescindible para instalarlo y ejecutarlo), modificarlo, redistribuirlo,
73
+ sublicenciarlo, venderlo, hacer ingeniería inversa o crear obras derivadas o un
74
+ producto que compita con Fiodos. El software se licencia, no se vende; todos los
75
+ derechos no concedidos expresamente quedan reservados al Licenciante. Este texto
76
+ corresponde a la fase de pruebas y será revisado por un abogado al constituir la
77
+ sociedad.
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Web NavigationAdapter — framework-agnostic. The manifest route strings for a
3
+ * web app are URL paths (e.g. "/cart"). The host provides a `navigate` delegate
4
+ * (Vue Router's `router.push`, SvelteKit's `goto`, Angular Router's
5
+ * `navigateByUrl`, or a plain `location.assign`) and the adapter forwards the
6
+ * opaque route string. The router owns query-string / param interpretation.
7
+ *
8
+ * `setCurrentRoute` lets the host keep `getCurrentRoute()` in sync with the
9
+ * live pathname (telemetry + LLM context). No framework imports here — each
10
+ * binding wires its own router-change subscription.
11
+ */
12
+ import type { NavigationAdapter } from '@fiodos/core';
13
+ export declare const BACK_ROUTE = "BACK";
14
+ export interface WebNavigationAdapterOptions {
15
+ /**
16
+ * Forwards a manifest route string to the host router. MUST throw on failure
17
+ * so the engine can degrade to an ActionResult error.
18
+ */
19
+ navigate: (route: string) => void;
20
+ /** Go back. Defaults to history.back() (or backFallbackRoute when empty). */
21
+ back?: () => void;
22
+ /** Current route. Defaults to location.pathname + location.search. */
23
+ getCurrentRoute?: () => string | null;
24
+ /** Route navigated to when back() is called with no history. */
25
+ backFallbackRoute?: string;
26
+ }
27
+ export interface WebNavigationAdapter extends NavigationAdapter {
28
+ /** Updates the tracked current route (called by the host on route change). */
29
+ setCurrentRoute(route: string | null): void;
30
+ }
31
+ export declare function createWebNavigationAdapter(options: WebNavigationAdapterOptions): WebNavigationAdapter;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BACK_ROUTE = void 0;
4
+ exports.createWebNavigationAdapter = createWebNavigationAdapter;
5
+ exports.BACK_ROUTE = 'BACK';
6
+ function defaultCurrentRoute() {
7
+ if (typeof window === 'undefined' || !window.location)
8
+ return null;
9
+ return `${window.location.pathname}${window.location.search}`;
10
+ }
11
+ function createWebNavigationAdapter(options) {
12
+ let tracked = null;
13
+ let hasNavigated = false;
14
+ return {
15
+ navigate(route) {
16
+ if (!route || route === exports.BACK_ROUTE) {
17
+ this.back();
18
+ return;
19
+ }
20
+ hasNavigated = true;
21
+ options.navigate(route);
22
+ },
23
+ back() {
24
+ if (options.back) {
25
+ options.back();
26
+ return;
27
+ }
28
+ if (hasNavigated && typeof window !== 'undefined' && window.history?.length > 1) {
29
+ window.history.back();
30
+ return;
31
+ }
32
+ if (options.backFallbackRoute) {
33
+ options.navigate(options.backFallbackRoute);
34
+ }
35
+ },
36
+ getCurrentRoute() {
37
+ if (tracked != null)
38
+ return tracked;
39
+ return options.getCurrentRoute ? options.getCurrentRoute() : defaultCurrentRoute();
40
+ },
41
+ setCurrentRoute(route) {
42
+ tracked = route;
43
+ },
44
+ };
45
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Web StorageAdapter — backs the consent manager (and any future per-app
3
+ * preferences) with window.localStorage by default. The @fiodos/core contract
4
+ * is async; localStorage is sync, so we wrap calls in resolved promises. If
5
+ * localStorage is unavailable (private mode, SSR, disabled) we degrade to an
6
+ * in-memory map (consent just won't persist across reloads).
7
+ */
8
+ import type { StorageAdapter } from '@fiodos/core';
9
+ export interface WebStorageAdapterOptions {
10
+ /** Storage backend. Defaults to window.localStorage. */
11
+ backend?: Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
12
+ }
13
+ export declare function createWebStorageAdapter(options?: WebStorageAdapterOptions): StorageAdapter;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createWebStorageAdapter = createWebStorageAdapter;
4
+ function resolveBackend(preferred) {
5
+ if (preferred)
6
+ return preferred;
7
+ try {
8
+ if (typeof window !== 'undefined' && window.localStorage) {
9
+ const probe = '__fyodos_probe__';
10
+ window.localStorage.setItem(probe, '1');
11
+ window.localStorage.removeItem(probe);
12
+ return window.localStorage;
13
+ }
14
+ }
15
+ catch {
16
+ /* localStorage blocked — fall through to memory */
17
+ }
18
+ const mem = new Map();
19
+ return {
20
+ getItem: (k) => (mem.has(k) ? mem.get(k) : null),
21
+ setItem: (k, v) => {
22
+ mem.set(k, v);
23
+ },
24
+ removeItem: (k) => {
25
+ mem.delete(k);
26
+ },
27
+ };
28
+ }
29
+ function createWebStorageAdapter(options = {}) {
30
+ const backend = resolveBackend(options.backend);
31
+ return {
32
+ async getItem(key) {
33
+ try {
34
+ return backend.getItem(key);
35
+ }
36
+ catch {
37
+ return null;
38
+ }
39
+ },
40
+ async setItem(key, value) {
41
+ try {
42
+ backend.setItem(key, value);
43
+ }
44
+ catch {
45
+ /* quota/availability errors are non-fatal for consent */
46
+ }
47
+ },
48
+ async removeItem(key) {
49
+ try {
50
+ backend.removeItem(key);
51
+ }
52
+ catch {
53
+ /* non-fatal */
54
+ }
55
+ },
56
+ };
57
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Web VoiceAdapter — browser STT via the Web Speech API
3
+ * (`SpeechRecognition` / `webkitSpeechRecognition`) and TTS playback of
4
+ * server-generated MP3 (base64) through an <audio> element, with a device
5
+ * SpeechSynthesis fallback. Availability is browser-dependent (Chrome/Edge/
6
+ * Safari yes; Firefox no), so `isRecognitionAvailable()` is honest and the UI
7
+ * must fall back to text input when it returns false.
8
+ *
9
+ * Framework-agnostic: shared by every Fiodos web binding.
10
+ */
11
+ import type { VoiceAdapter } from '@fiodos/core';
12
+ export interface WebVoiceAdapterOptions {
13
+ /** Disable the SpeechSynthesis fallback when server MP3 is missing. */
14
+ disableDeviceTtsFallback?: boolean;
15
+ }
16
+ export declare function createWebVoiceAdapter(options?: WebVoiceAdapterOptions): VoiceAdapter;