@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.
- package/LICENSE +77 -0
- package/dist/cjs/adapters/webNavigationAdapter.d.ts +31 -0
- package/dist/cjs/adapters/webNavigationAdapter.js +45 -0
- package/dist/cjs/adapters/webStorageAdapter.d.ts +13 -0
- package/dist/cjs/adapters/webStorageAdapter.js +57 -0
- package/dist/cjs/adapters/webVoiceAdapter.d.ts +16 -0
- package/dist/cjs/adapters/webVoiceAdapter.js +477 -0
- package/dist/cjs/api/backendClient.d.ts +31 -0
- package/dist/cjs/api/backendClient.js +182 -0
- package/dist/cjs/api/backendTelemetry.d.ts +23 -0
- package/dist/cjs/api/backendTelemetry.js +80 -0
- package/dist/cjs/api/clientBootstrap.d.ts +44 -0
- package/dist/cjs/api/clientBootstrap.js +68 -0
- package/dist/cjs/api/errors.d.ts +11 -0
- package/dist/cjs/api/errors.js +16 -0
- package/dist/cjs/bridge/createBridge.d.ts +13 -0
- package/dist/cjs/bridge/createBridge.js +15 -0
- package/dist/cjs/config/types.d.ts +63 -0
- package/dist/cjs/config/types.js +9 -0
- package/dist/cjs/context/screenContextStore.d.ts +26 -0
- package/dist/cjs/context/screenContextStore.js +25 -0
- package/dist/cjs/controller/AgentController.d.ts +115 -0
- package/dist/cjs/controller/AgentController.js +594 -0
- package/dist/cjs/core/turnEngine.d.ts +70 -0
- package/dist/cjs/core/turnEngine.js +96 -0
- package/dist/cjs/dropin/createFiodosAgent.d.ts +60 -0
- package/dist/cjs/dropin/createFiodosAgent.js +143 -0
- package/dist/cjs/dropin/createFyodosAgent.d.ts +60 -0
- package/dist/cjs/dropin/createFyodosAgent.js +143 -0
- package/dist/cjs/index.d.ts +45 -0
- package/dist/cjs/index.js +67 -0
- package/dist/cjs/orb/mountOrb.d.ts +24 -0
- package/dist/cjs/orb/mountOrb.js +694 -0
- package/dist/cjs/orb/orbView.d.ts +56 -0
- package/dist/cjs/orb/orbView.js +426 -0
- package/dist/cjs/orb/publishedConfig.d.ts +32 -0
- package/dist/cjs/orb/publishedConfig.js +70 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/speech/speechSession.d.ts +35 -0
- package/dist/cjs/speech/speechSession.js +60 -0
- package/dist/cjs/ui/messages.d.ts +36 -0
- package/dist/cjs/ui/messages.js +41 -0
- package/dist/esm/adapters/webNavigationAdapter.d.ts +31 -0
- package/dist/esm/adapters/webNavigationAdapter.js +41 -0
- package/dist/esm/adapters/webStorageAdapter.d.ts +13 -0
- package/dist/esm/adapters/webStorageAdapter.js +54 -0
- package/dist/esm/adapters/webVoiceAdapter.d.ts +16 -0
- package/dist/esm/adapters/webVoiceAdapter.js +474 -0
- package/dist/esm/api/backendClient.d.ts +31 -0
- package/dist/esm/api/backendClient.js +178 -0
- package/dist/esm/api/backendTelemetry.d.ts +23 -0
- package/dist/esm/api/backendTelemetry.js +77 -0
- package/dist/esm/api/clientBootstrap.d.ts +44 -0
- package/dist/esm/api/clientBootstrap.js +63 -0
- package/dist/esm/api/errors.d.ts +11 -0
- package/dist/esm/api/errors.js +11 -0
- package/dist/esm/bridge/createBridge.d.ts +13 -0
- package/dist/esm/bridge/createBridge.js +12 -0
- package/dist/esm/config/types.d.ts +63 -0
- package/dist/esm/config/types.js +6 -0
- package/dist/esm/context/screenContextStore.d.ts +26 -0
- package/dist/esm/context/screenContextStore.js +22 -0
- package/dist/esm/controller/AgentController.d.ts +115 -0
- package/dist/esm/controller/AgentController.js +590 -0
- package/dist/esm/core/turnEngine.d.ts +70 -0
- package/dist/esm/core/turnEngine.js +92 -0
- package/dist/esm/dropin/createFiodosAgent.d.ts +60 -0
- package/dist/esm/dropin/createFiodosAgent.js +140 -0
- package/dist/esm/dropin/createFyodosAgent.d.ts +60 -0
- package/dist/esm/dropin/createFyodosAgent.js +140 -0
- package/dist/esm/index.d.ts +45 -0
- package/dist/esm/index.js +38 -0
- package/dist/esm/orb/mountOrb.d.ts +24 -0
- package/dist/esm/orb/mountOrb.js +691 -0
- package/dist/esm/orb/orbView.d.ts +56 -0
- package/dist/esm/orb/orbView.js +421 -0
- package/dist/esm/orb/publishedConfig.d.ts +32 -0
- package/dist/esm/orb/publishedConfig.js +67 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/speech/speechSession.d.ts +35 -0
- package/dist/esm/speech/speechSession.js +57 -0
- package/dist/esm/ui/messages.d.ts +36 -0
- package/dist/esm/ui/messages.js +38 -0
- package/package.json +38 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decideAction = decideAction;
|
|
4
|
+
exports.classifyPendingReply = classifyPendingReply;
|
|
5
|
+
/**
|
|
6
|
+
* Framework-free turn decision engine.
|
|
7
|
+
*
|
|
8
|
+
* Concentrates the SECURITY-CRITICAL decision logic of a turn so it can be
|
|
9
|
+
* unit-tested without any framework, and so every web binding (Vue, Svelte,
|
|
10
|
+
* Angular) and React Native share the exact same rules. It does NOT
|
|
11
|
+
* reimplement the engine: it delegates execution, prechecks and confirmation
|
|
12
|
+
* classification to @fiodos/core. It only sequences them.
|
|
13
|
+
*
|
|
14
|
+
* Invariants enforced here (identical to @fiodos/react-native):
|
|
15
|
+
* 1. The source of truth for "needs confirmation" is the MANIFEST
|
|
16
|
+
* (`requireConfirmation`), never the LLM's flag.
|
|
17
|
+
* 2. A sensitive action is NEVER executed by `decideAction`; it returns a
|
|
18
|
+
* PendingConfirmation and waits for an explicit confirmation.
|
|
19
|
+
* 3. Voice confirmation honours the manifest mode: 'disabled' can never be
|
|
20
|
+
* confirmed by voice (tap only); 'strict' requires the exact phrase; a
|
|
21
|
+
* loose "yes" does not confirm a strict action. Negation always wins.
|
|
22
|
+
*/
|
|
23
|
+
const core_1 = require("@fiodos/core");
|
|
24
|
+
function findManifestAction(manifest, intent) {
|
|
25
|
+
if (!intent)
|
|
26
|
+
return undefined;
|
|
27
|
+
return manifest.actions.find((a) => a.intent === intent);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Decides what to do with a backend-proposed action. Sensitive actions are
|
|
31
|
+
* never executed here — they return `needs-confirmation`.
|
|
32
|
+
*/
|
|
33
|
+
async function decideAction(params) {
|
|
34
|
+
const { action, manifest, executor, context, messages, userMessage } = params;
|
|
35
|
+
if (!action || action.type === 'none') {
|
|
36
|
+
return { kind: 'noop' };
|
|
37
|
+
}
|
|
38
|
+
if (action.type === 'navigate') {
|
|
39
|
+
const result = await executor.execute(action);
|
|
40
|
+
return { kind: 'executed', result };
|
|
41
|
+
}
|
|
42
|
+
if (action.type === 'execute') {
|
|
43
|
+
const manifestAction = findManifestAction(manifest, action.intent);
|
|
44
|
+
const needsConfirmation = manifestAction?.requireConfirmation === true;
|
|
45
|
+
if (!needsConfirmation) {
|
|
46
|
+
const result = await executor.execute(action, context);
|
|
47
|
+
return { kind: 'executed', result };
|
|
48
|
+
}
|
|
49
|
+
// Precheck (context + idempotency) BEFORE asking: applying an already-applied
|
|
50
|
+
// state answers directly without bothering the user with a confirmation.
|
|
51
|
+
const pre = await executor.precheck(action, context);
|
|
52
|
+
if (pre.kind === 'done') {
|
|
53
|
+
return { kind: 'precheck-resolved', result: pre.result };
|
|
54
|
+
}
|
|
55
|
+
const voiceMode = manifestAction?.voiceConfirmation ?? 'standard';
|
|
56
|
+
const strictPhrase = voiceMode === 'strict'
|
|
57
|
+
? (manifestAction?.confirmationPhrase ??
|
|
58
|
+
(0, core_1.formatMessage)(messages.strictConfirmationPhraseTemplate, {
|
|
59
|
+
label: (manifestAction?.label ?? action.intent ?? '').toLowerCase(),
|
|
60
|
+
}))
|
|
61
|
+
: null;
|
|
62
|
+
const pending = {
|
|
63
|
+
action,
|
|
64
|
+
context,
|
|
65
|
+
question: manifestAction?.confirmationMessageTemplate ??
|
|
66
|
+
action.confirmationMessage ??
|
|
67
|
+
messages.confirmationFallbackQuestion,
|
|
68
|
+
voiceMode,
|
|
69
|
+
strictPhrase,
|
|
70
|
+
remainingConfirmations: manifestAction?.doubleConfirmation === true ? 2 : 1,
|
|
71
|
+
userMessage,
|
|
72
|
+
intent: action.intent ?? '',
|
|
73
|
+
};
|
|
74
|
+
return { kind: 'needs-confirmation', pending };
|
|
75
|
+
}
|
|
76
|
+
return { kind: 'noop' };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Classifies a spoken reply against a pending confirmation, honouring the
|
|
80
|
+
* manifest's voice mode. Returns 'ambiguous' when voice cannot resolve it
|
|
81
|
+
* (disabled mode, silent turn, or unclear speech) — the caller must then rely
|
|
82
|
+
* on the tactile modal. NEVER returns 'affirmative' for a disabled/silent
|
|
83
|
+
* confirmation.
|
|
84
|
+
*/
|
|
85
|
+
function classifyPendingReply(text, pending, lexicon, opts = {}) {
|
|
86
|
+
// Safety net: a stray transcript can NEVER resolve a tap-only confirmation.
|
|
87
|
+
if (pending.voiceMode === 'disabled' || opts.silent)
|
|
88
|
+
return 'ambiguous';
|
|
89
|
+
const trimmed = text.trim();
|
|
90
|
+
if (trimmed.length < 2)
|
|
91
|
+
return 'ambiguous';
|
|
92
|
+
if (pending.voiceMode === 'strict' && pending.strictPhrase != null) {
|
|
93
|
+
return (0, core_1.classifyStrictConfirmationReply)(trimmed, pending.strictPhrase, lexicon);
|
|
94
|
+
}
|
|
95
|
+
return (0, core_1.classifyConfirmationReply)(trimmed, lexicon);
|
|
96
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vanilla drop-in — assembles the default browser adapters, builds an
|
|
3
|
+
* AgentController and (optionally) mounts the DOM orb in one call. Frameworks
|
|
4
|
+
* use the AgentController + their own components; this is the zero-framework
|
|
5
|
+
* path (and the reference the Vue/Svelte/Angular drop-ins follow).
|
|
6
|
+
*
|
|
7
|
+
* PARITY WITH @fiodos/react's <FiodosAgent/>: when `manifest` is omitted, the
|
|
8
|
+
* agent self-bootstraps — it fetches the published manifest by `apiKey`
|
|
9
|
+
* (GET /v1/client/manifest), assembles default browser adapters, mounts the orb
|
|
10
|
+
* and posts the `orb-seen` heartbeat. So a one-line drop-in needs only an
|
|
11
|
+
* apiKey, exactly like React. Passing a manifest keeps the fully-synchronous,
|
|
12
|
+
* manual path.
|
|
13
|
+
*/
|
|
14
|
+
import { type ActionRegistries, type AppManifest } from '@fiodos/core';
|
|
15
|
+
import { AgentController } from '../controller/AgentController';
|
|
16
|
+
import { type MountOrbOptions, type MountedOrb } from '../orb/mountOrb';
|
|
17
|
+
import type { FiodosWebAgentConfig } from '../config/types';
|
|
18
|
+
export interface CreateFiodosAgentOptions {
|
|
19
|
+
/** Backend base URL. Defaults to the public Fiodos backend. */
|
|
20
|
+
baseUrl?: string;
|
|
21
|
+
/** Client API key (x-api-key). Required when `manifest` is omitted (auto-fetch). */
|
|
22
|
+
apiKey?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The validated app manifest. OPTIONAL: omit it to self-fetch the published
|
|
25
|
+
* manifest by apiKey (the React-parity drop-in path).
|
|
26
|
+
*/
|
|
27
|
+
manifest?: AppManifest;
|
|
28
|
+
/** Action handlers / context validators (defaults to empty registries). */
|
|
29
|
+
registries?: ActionRegistries;
|
|
30
|
+
/** Agent reply locale (e.g. 'es', 'en'). Defaults to the browser language. */
|
|
31
|
+
locale?: string;
|
|
32
|
+
/** STT locale (e.g. 'es-ES', 'en-US'). Defaults to the browser language. */
|
|
33
|
+
sttLocale?: string;
|
|
34
|
+
/** Host router navigate delegate. Defaults to location.assign. */
|
|
35
|
+
navigate?: (route: string) => void;
|
|
36
|
+
/** Host auth check for actions requiring auth. */
|
|
37
|
+
isAuthenticated?: () => boolean;
|
|
38
|
+
/** Voice id forwarded to the backend TTS. */
|
|
39
|
+
ttsVoice?: string | (() => string | undefined);
|
|
40
|
+
/** End-user id for rate limiting / telemetry correlation. */
|
|
41
|
+
getUserId?: () => string | null;
|
|
42
|
+
/** Mount the built-in DOM orb. Default: true. Pass false to render your own. */
|
|
43
|
+
mount?: boolean;
|
|
44
|
+
orb?: MountOrbOptions;
|
|
45
|
+
/** Escape hatch: extra config merged into the controller config. */
|
|
46
|
+
configOverrides?: Partial<FiodosWebAgentConfig>;
|
|
47
|
+
/** Called once the manifest loaded and the orb mounted (auto-fetch path). */
|
|
48
|
+
onReady?: (controller: AgentController) => void;
|
|
49
|
+
/** Called when self-bootstrap fails (network / rejected key / no manifest). */
|
|
50
|
+
onError?: (error: Error) => void;
|
|
51
|
+
}
|
|
52
|
+
export interface FiodosAgentHandle {
|
|
53
|
+
/** Null until the async self-bootstrap resolves (auto-fetch path). */
|
|
54
|
+
controller: AgentController | null;
|
|
55
|
+
orb: MountedOrb | null;
|
|
56
|
+
/** Resolves once the controller is ready (immediately on the manual path). */
|
|
57
|
+
ready: Promise<AgentController | null>;
|
|
58
|
+
destroy(): void;
|
|
59
|
+
}
|
|
60
|
+
export declare function createFiodosAgent(options: CreateFiodosAgentOptions): FiodosAgentHandle;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFiodosAgent = createFiodosAgent;
|
|
4
|
+
/**
|
|
5
|
+
* Vanilla drop-in — assembles the default browser adapters, builds an
|
|
6
|
+
* AgentController and (optionally) mounts the DOM orb in one call. Frameworks
|
|
7
|
+
* use the AgentController + their own components; this is the zero-framework
|
|
8
|
+
* path (and the reference the Vue/Svelte/Angular drop-ins follow).
|
|
9
|
+
*
|
|
10
|
+
* PARITY WITH @fiodos/react's <FiodosAgent/>: when `manifest` is omitted, the
|
|
11
|
+
* agent self-bootstraps — it fetches the published manifest by `apiKey`
|
|
12
|
+
* (GET /v1/client/manifest), assembles default browser adapters, mounts the orb
|
|
13
|
+
* and posts the `orb-seen` heartbeat. So a one-line drop-in needs only an
|
|
14
|
+
* apiKey, exactly like React. Passing a manifest keeps the fully-synchronous,
|
|
15
|
+
* manual path.
|
|
16
|
+
*/
|
|
17
|
+
const core_1 = require("@fiodos/core");
|
|
18
|
+
const backendClient_1 = require("../api/backendClient");
|
|
19
|
+
const backendTelemetry_1 = require("../api/backendTelemetry");
|
|
20
|
+
const webNavigationAdapter_1 = require("../adapters/webNavigationAdapter");
|
|
21
|
+
const webStorageAdapter_1 = require("../adapters/webStorageAdapter");
|
|
22
|
+
const webVoiceAdapter_1 = require("../adapters/webVoiceAdapter");
|
|
23
|
+
const AgentController_1 = require("../controller/AgentController");
|
|
24
|
+
const mountOrb_1 = require("../orb/mountOrb");
|
|
25
|
+
const clientBootstrap_1 = require("../api/clientBootstrap");
|
|
26
|
+
function defaultNavigate(route) {
|
|
27
|
+
if (typeof window !== 'undefined' && window.location)
|
|
28
|
+
window.location.assign(route);
|
|
29
|
+
}
|
|
30
|
+
function browserLocale() {
|
|
31
|
+
const lang = typeof navigator !== 'undefined' && navigator.language ? navigator.language : 'en-US';
|
|
32
|
+
return { locale: lang.split('-')[0] || 'en', sttLocale: lang };
|
|
33
|
+
}
|
|
34
|
+
/** Build the controller + adapters from a known manifest (shared by both paths). */
|
|
35
|
+
function assemble(options, manifest, baseUrl) {
|
|
36
|
+
const fallback = browserLocale();
|
|
37
|
+
const locale = options.locale ?? fallback.locale;
|
|
38
|
+
const sttLocale = options.sttLocale ?? options.locale ?? fallback.sttLocale;
|
|
39
|
+
const backend = (0, backendClient_1.createFiodosBackendClient)({
|
|
40
|
+
baseUrl,
|
|
41
|
+
apiKey: options.apiKey,
|
|
42
|
+
getUserId: options.getUserId,
|
|
43
|
+
});
|
|
44
|
+
const telemetry = (0, backendTelemetry_1.createFiodosTelemetry)({
|
|
45
|
+
baseUrl,
|
|
46
|
+
apiKey: options.apiKey,
|
|
47
|
+
getUserId: options.getUserId,
|
|
48
|
+
});
|
|
49
|
+
const config = {
|
|
50
|
+
manifest,
|
|
51
|
+
locale,
|
|
52
|
+
sttLocale,
|
|
53
|
+
navigation: (0, webNavigationAdapter_1.createWebNavigationAdapter)({ navigate: options.navigate ?? defaultNavigate }),
|
|
54
|
+
registries: options.registries ?? { handlers: {}, idempotencyCheckers: {} },
|
|
55
|
+
backend,
|
|
56
|
+
voice: (0, webVoiceAdapter_1.createWebVoiceAdapter)(),
|
|
57
|
+
storage: (0, webStorageAdapter_1.createWebStorageAdapter)(),
|
|
58
|
+
telemetry,
|
|
59
|
+
isAuthenticated: options.isAuthenticated,
|
|
60
|
+
ttsVoice: options.ttsVoice,
|
|
61
|
+
...options.configOverrides,
|
|
62
|
+
};
|
|
63
|
+
const controller = new AgentController_1.AgentController(config);
|
|
64
|
+
controller.warmUp();
|
|
65
|
+
return controller;
|
|
66
|
+
}
|
|
67
|
+
function createFiodosAgent(options) {
|
|
68
|
+
const baseUrl = (options.baseUrl ?? clientBootstrap_1.DEFAULT_WEB_API_URL).replace(/\/$/, '');
|
|
69
|
+
const shouldMount = options.mount !== false;
|
|
70
|
+
// ── Manual path: manifest provided → fully synchronous (back-compat). ───────
|
|
71
|
+
if (options.manifest) {
|
|
72
|
+
const controller = assemble(options, options.manifest, baseUrl);
|
|
73
|
+
const orb = shouldMount ? (0, mountOrb_1.mountOrb)(controller, options.orb) : null;
|
|
74
|
+
if (shouldMount && options.apiKey) {
|
|
75
|
+
void (0, clientBootstrap_1.sendOrbSeen)({ baseUrl, apiKey: options.apiKey });
|
|
76
|
+
}
|
|
77
|
+
options.onReady?.(controller);
|
|
78
|
+
const handle = {
|
|
79
|
+
controller,
|
|
80
|
+
orb,
|
|
81
|
+
ready: Promise.resolve(controller),
|
|
82
|
+
destroy() {
|
|
83
|
+
orb?.unmount();
|
|
84
|
+
controller.dispose();
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
return handle;
|
|
88
|
+
}
|
|
89
|
+
// ── Auto path (React parity): fetch manifest by apiKey, then assemble. ──────
|
|
90
|
+
const handle = {
|
|
91
|
+
controller: null,
|
|
92
|
+
orb: null,
|
|
93
|
+
ready: Promise.resolve(null),
|
|
94
|
+
destroy() {
|
|
95
|
+
cancelled = true;
|
|
96
|
+
handle.orb?.unmount();
|
|
97
|
+
handle.controller?.dispose();
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
let cancelled = false;
|
|
101
|
+
handle.ready = (async () => {
|
|
102
|
+
try {
|
|
103
|
+
if (!options.apiKey) {
|
|
104
|
+
throw new Error('[fyodos] createFiodosAgent requires either a `manifest` or an `apiKey` ' +
|
|
105
|
+
'(to self-fetch the published manifest).');
|
|
106
|
+
}
|
|
107
|
+
const result = await (0, clientBootstrap_1.fetchClientManifest)({ baseUrl, apiKey: options.apiKey });
|
|
108
|
+
if (cancelled)
|
|
109
|
+
return null;
|
|
110
|
+
if (result.status === 'no-manifest' || !result.manifest) {
|
|
111
|
+
// eslint-disable-next-line no-console
|
|
112
|
+
console.warn('[fyodos] The orb is idle: this project has no published manifest yet. ' +
|
|
113
|
+
'Run the analysis from your Fiodos dashboard, then reload.');
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
// Fail loudly here (not deep inside the controller) so onError is precise.
|
|
117
|
+
const check = (0, core_1.validateManifest)(result.manifest);
|
|
118
|
+
if (!check.valid) {
|
|
119
|
+
throw new Error(`[fyodos] Invalid manifest for "${result.manifest.appId}":\n- ${check.errors.join('\n- ')}`);
|
|
120
|
+
}
|
|
121
|
+
const controller = assemble(options, result.manifest, baseUrl);
|
|
122
|
+
if (cancelled) {
|
|
123
|
+
controller.dispose();
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
handle.controller = controller;
|
|
127
|
+
handle.orb = shouldMount ? (0, mountOrb_1.mountOrb)(controller, options.orb) : null;
|
|
128
|
+
if (shouldMount && options.apiKey) {
|
|
129
|
+
void (0, clientBootstrap_1.sendOrbSeen)({ baseUrl, apiKey: options.apiKey });
|
|
130
|
+
}
|
|
131
|
+
options.onReady?.(controller);
|
|
132
|
+
return controller;
|
|
133
|
+
}
|
|
134
|
+
catch (e) {
|
|
135
|
+
const error = e instanceof Error ? e : new Error(String(e));
|
|
136
|
+
// eslint-disable-next-line no-console
|
|
137
|
+
console.error(error.message);
|
|
138
|
+
options.onError?.(error);
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
})();
|
|
142
|
+
return handle;
|
|
143
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vanilla drop-in — assembles the default browser adapters, builds an
|
|
3
|
+
* AgentController and (optionally) mounts the DOM orb in one call. Frameworks
|
|
4
|
+
* use the AgentController + their own components; this is the zero-framework
|
|
5
|
+
* path (and the reference the Vue/Svelte/Angular drop-ins follow).
|
|
6
|
+
*
|
|
7
|
+
* PARITY WITH @fyodos/react's <FyodosAgent/>: when `manifest` is omitted, the
|
|
8
|
+
* agent self-bootstraps — it fetches the published manifest by `apiKey`
|
|
9
|
+
* (GET /v1/client/manifest), assembles default browser adapters, mounts the orb
|
|
10
|
+
* and posts the `orb-seen` heartbeat. So a one-line drop-in needs only an
|
|
11
|
+
* apiKey, exactly like React. Passing a manifest keeps the fully-synchronous,
|
|
12
|
+
* manual path.
|
|
13
|
+
*/
|
|
14
|
+
import { type ActionRegistries, type AppManifest } from '@fyodos/core';
|
|
15
|
+
import { AgentController } from '../controller/AgentController';
|
|
16
|
+
import { type MountOrbOptions, type MountedOrb } from '../orb/mountOrb';
|
|
17
|
+
import type { FyodosWebAgentConfig } from '../config/types';
|
|
18
|
+
export interface CreateFyodosAgentOptions {
|
|
19
|
+
/** Backend base URL. Defaults to the public Fyodos backend. */
|
|
20
|
+
baseUrl?: string;
|
|
21
|
+
/** Client API key (x-api-key). Required when `manifest` is omitted (auto-fetch). */
|
|
22
|
+
apiKey?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The validated app manifest. OPTIONAL: omit it to self-fetch the published
|
|
25
|
+
* manifest by apiKey (the React-parity drop-in path).
|
|
26
|
+
*/
|
|
27
|
+
manifest?: AppManifest;
|
|
28
|
+
/** Action handlers / context validators (defaults to empty registries). */
|
|
29
|
+
registries?: ActionRegistries;
|
|
30
|
+
/** Agent reply locale (e.g. 'es', 'en'). Defaults to the browser language. */
|
|
31
|
+
locale?: string;
|
|
32
|
+
/** STT locale (e.g. 'es-ES', 'en-US'). Defaults to the browser language. */
|
|
33
|
+
sttLocale?: string;
|
|
34
|
+
/** Host router navigate delegate. Defaults to location.assign. */
|
|
35
|
+
navigate?: (route: string) => void;
|
|
36
|
+
/** Host auth check for actions requiring auth. */
|
|
37
|
+
isAuthenticated?: () => boolean;
|
|
38
|
+
/** Voice id forwarded to the backend TTS. */
|
|
39
|
+
ttsVoice?: string | (() => string | undefined);
|
|
40
|
+
/** End-user id for rate limiting / telemetry correlation. */
|
|
41
|
+
getUserId?: () => string | null;
|
|
42
|
+
/** Mount the built-in DOM orb. Default: true. Pass false to render your own. */
|
|
43
|
+
mount?: boolean;
|
|
44
|
+
orb?: MountOrbOptions;
|
|
45
|
+
/** Escape hatch: extra config merged into the controller config. */
|
|
46
|
+
configOverrides?: Partial<FyodosWebAgentConfig>;
|
|
47
|
+
/** Called once the manifest loaded and the orb mounted (auto-fetch path). */
|
|
48
|
+
onReady?: (controller: AgentController) => void;
|
|
49
|
+
/** Called when self-bootstrap fails (network / rejected key / no manifest). */
|
|
50
|
+
onError?: (error: Error) => void;
|
|
51
|
+
}
|
|
52
|
+
export interface FyodosAgentHandle {
|
|
53
|
+
/** Null until the async self-bootstrap resolves (auto-fetch path). */
|
|
54
|
+
controller: AgentController | null;
|
|
55
|
+
orb: MountedOrb | null;
|
|
56
|
+
/** Resolves once the controller is ready (immediately on the manual path). */
|
|
57
|
+
ready: Promise<AgentController | null>;
|
|
58
|
+
destroy(): void;
|
|
59
|
+
}
|
|
60
|
+
export declare function createFyodosAgent(options: CreateFyodosAgentOptions): FyodosAgentHandle;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFyodosAgent = createFyodosAgent;
|
|
4
|
+
/**
|
|
5
|
+
* Vanilla drop-in — assembles the default browser adapters, builds an
|
|
6
|
+
* AgentController and (optionally) mounts the DOM orb in one call. Frameworks
|
|
7
|
+
* use the AgentController + their own components; this is the zero-framework
|
|
8
|
+
* path (and the reference the Vue/Svelte/Angular drop-ins follow).
|
|
9
|
+
*
|
|
10
|
+
* PARITY WITH @fyodos/react's <FyodosAgent/>: when `manifest` is omitted, the
|
|
11
|
+
* agent self-bootstraps — it fetches the published manifest by `apiKey`
|
|
12
|
+
* (GET /v1/client/manifest), assembles default browser adapters, mounts the orb
|
|
13
|
+
* and posts the `orb-seen` heartbeat. So a one-line drop-in needs only an
|
|
14
|
+
* apiKey, exactly like React. Passing a manifest keeps the fully-synchronous,
|
|
15
|
+
* manual path.
|
|
16
|
+
*/
|
|
17
|
+
const core_1 = require("@fyodos/core");
|
|
18
|
+
const backendClient_1 = require("../api/backendClient");
|
|
19
|
+
const backendTelemetry_1 = require("../api/backendTelemetry");
|
|
20
|
+
const webNavigationAdapter_1 = require("../adapters/webNavigationAdapter");
|
|
21
|
+
const webStorageAdapter_1 = require("../adapters/webStorageAdapter");
|
|
22
|
+
const webVoiceAdapter_1 = require("../adapters/webVoiceAdapter");
|
|
23
|
+
const AgentController_1 = require("../controller/AgentController");
|
|
24
|
+
const mountOrb_1 = require("../orb/mountOrb");
|
|
25
|
+
const clientBootstrap_1 = require("../api/clientBootstrap");
|
|
26
|
+
function defaultNavigate(route) {
|
|
27
|
+
if (typeof window !== 'undefined' && window.location)
|
|
28
|
+
window.location.assign(route);
|
|
29
|
+
}
|
|
30
|
+
function browserLocale() {
|
|
31
|
+
const lang = typeof navigator !== 'undefined' && navigator.language ? navigator.language : 'en-US';
|
|
32
|
+
return { locale: lang.split('-')[0] || 'en', sttLocale: lang };
|
|
33
|
+
}
|
|
34
|
+
/** Build the controller + adapters from a known manifest (shared by both paths). */
|
|
35
|
+
function assemble(options, manifest, baseUrl) {
|
|
36
|
+
const fallback = browserLocale();
|
|
37
|
+
const locale = options.locale ?? fallback.locale;
|
|
38
|
+
const sttLocale = options.sttLocale ?? options.locale ?? fallback.sttLocale;
|
|
39
|
+
const backend = (0, backendClient_1.createFyodosBackendClient)({
|
|
40
|
+
baseUrl,
|
|
41
|
+
apiKey: options.apiKey,
|
|
42
|
+
getUserId: options.getUserId,
|
|
43
|
+
});
|
|
44
|
+
const telemetry = (0, backendTelemetry_1.createFyodosTelemetry)({
|
|
45
|
+
baseUrl,
|
|
46
|
+
apiKey: options.apiKey,
|
|
47
|
+
getUserId: options.getUserId,
|
|
48
|
+
});
|
|
49
|
+
const config = {
|
|
50
|
+
manifest,
|
|
51
|
+
locale,
|
|
52
|
+
sttLocale,
|
|
53
|
+
navigation: (0, webNavigationAdapter_1.createWebNavigationAdapter)({ navigate: options.navigate ?? defaultNavigate }),
|
|
54
|
+
registries: options.registries ?? { handlers: {}, idempotencyCheckers: {} },
|
|
55
|
+
backend,
|
|
56
|
+
voice: (0, webVoiceAdapter_1.createWebVoiceAdapter)(),
|
|
57
|
+
storage: (0, webStorageAdapter_1.createWebStorageAdapter)(),
|
|
58
|
+
telemetry,
|
|
59
|
+
isAuthenticated: options.isAuthenticated,
|
|
60
|
+
ttsVoice: options.ttsVoice,
|
|
61
|
+
...options.configOverrides,
|
|
62
|
+
};
|
|
63
|
+
const controller = new AgentController_1.AgentController(config);
|
|
64
|
+
controller.warmUp();
|
|
65
|
+
return controller;
|
|
66
|
+
}
|
|
67
|
+
function createFyodosAgent(options) {
|
|
68
|
+
const baseUrl = (options.baseUrl ?? clientBootstrap_1.DEFAULT_WEB_API_URL).replace(/\/$/, '');
|
|
69
|
+
const shouldMount = options.mount !== false;
|
|
70
|
+
// ── Manual path: manifest provided → fully synchronous (back-compat). ───────
|
|
71
|
+
if (options.manifest) {
|
|
72
|
+
const controller = assemble(options, options.manifest, baseUrl);
|
|
73
|
+
const orb = shouldMount ? (0, mountOrb_1.mountOrb)(controller, options.orb) : null;
|
|
74
|
+
if (shouldMount && options.apiKey) {
|
|
75
|
+
void (0, clientBootstrap_1.sendOrbSeen)({ baseUrl, apiKey: options.apiKey });
|
|
76
|
+
}
|
|
77
|
+
options.onReady?.(controller);
|
|
78
|
+
const handle = {
|
|
79
|
+
controller,
|
|
80
|
+
orb,
|
|
81
|
+
ready: Promise.resolve(controller),
|
|
82
|
+
destroy() {
|
|
83
|
+
orb?.unmount();
|
|
84
|
+
controller.dispose();
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
return handle;
|
|
88
|
+
}
|
|
89
|
+
// ── Auto path (React parity): fetch manifest by apiKey, then assemble. ──────
|
|
90
|
+
const handle = {
|
|
91
|
+
controller: null,
|
|
92
|
+
orb: null,
|
|
93
|
+
ready: Promise.resolve(null),
|
|
94
|
+
destroy() {
|
|
95
|
+
cancelled = true;
|
|
96
|
+
handle.orb?.unmount();
|
|
97
|
+
handle.controller?.dispose();
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
let cancelled = false;
|
|
101
|
+
handle.ready = (async () => {
|
|
102
|
+
try {
|
|
103
|
+
if (!options.apiKey) {
|
|
104
|
+
throw new Error('[fyodos] createFyodosAgent requires either a `manifest` or an `apiKey` ' +
|
|
105
|
+
'(to self-fetch the published manifest).');
|
|
106
|
+
}
|
|
107
|
+
const result = await (0, clientBootstrap_1.fetchClientManifest)({ baseUrl, apiKey: options.apiKey });
|
|
108
|
+
if (cancelled)
|
|
109
|
+
return null;
|
|
110
|
+
if (result.status === 'no-manifest' || !result.manifest) {
|
|
111
|
+
// eslint-disable-next-line no-console
|
|
112
|
+
console.warn('[fyodos] The orb is idle: this project has no published manifest yet. ' +
|
|
113
|
+
'Run the analysis from your Fyodos dashboard, then reload.');
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
// Fail loudly here (not deep inside the controller) so onError is precise.
|
|
117
|
+
const check = (0, core_1.validateManifest)(result.manifest);
|
|
118
|
+
if (!check.valid) {
|
|
119
|
+
throw new Error(`[fyodos] Invalid manifest for "${result.manifest.appId}":\n- ${check.errors.join('\n- ')}`);
|
|
120
|
+
}
|
|
121
|
+
const controller = assemble(options, result.manifest, baseUrl);
|
|
122
|
+
if (cancelled) {
|
|
123
|
+
controller.dispose();
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
handle.controller = controller;
|
|
127
|
+
handle.orb = shouldMount ? (0, mountOrb_1.mountOrb)(controller, options.orb) : null;
|
|
128
|
+
if (shouldMount && options.apiKey) {
|
|
129
|
+
void (0, clientBootstrap_1.sendOrbSeen)({ baseUrl, apiKey: options.apiKey });
|
|
130
|
+
}
|
|
131
|
+
options.onReady?.(controller);
|
|
132
|
+
return controller;
|
|
133
|
+
}
|
|
134
|
+
catch (e) {
|
|
135
|
+
const error = e instanceof Error ? e : new Error(String(e));
|
|
136
|
+
// eslint-disable-next-line no-console
|
|
137
|
+
console.error(error.message);
|
|
138
|
+
options.onError?.(error);
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
})();
|
|
142
|
+
return handle;
|
|
143
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fiodos/web-core — framework-agnostic browser layer for the Fiodos agent.
|
|
3
|
+
*
|
|
4
|
+
* Contains the vanilla orchestrator (AgentController), the browser adapters,
|
|
5
|
+
* the HTTP client, the decision engine and a vanilla DOM orb — all over
|
|
6
|
+
* @fiodos/core. @fiodos/vue, @fiodos/svelte and @fiodos/angular are thin
|
|
7
|
+
* reactive wrappers around THIS package, so they share identical agent
|
|
8
|
+
* behaviour and security. No framework imports live here.
|
|
9
|
+
*/
|
|
10
|
+
export { AgentController } from './controller/AgentController';
|
|
11
|
+
export type { AgentState, AgentExchange } from './controller/AgentController';
|
|
12
|
+
export { createFiodosAgent } from './dropin/createFiodosAgent';
|
|
13
|
+
export type { CreateFiodosAgentOptions, FiodosAgentHandle } from './dropin/createFiodosAgent';
|
|
14
|
+
export { DEFAULT_WEB_API_URL, fetchClientManifest, sendOrbSeen, } from './api/clientBootstrap';
|
|
15
|
+
export type { ManifestBootstrapResult, ManifestBootstrapStatus, } from './api/clientBootstrap';
|
|
16
|
+
export { mountOrb } from './orb/mountOrb';
|
|
17
|
+
export type { MountOrbOptions, MountedOrb, OrbCorner } from './orb/mountOrb';
|
|
18
|
+
export { createOrbVisual, buildKeyboardChip, DEFAULT_ORB_APPEARANCE } from './orb/orbView';
|
|
19
|
+
export type { OrbAppearance, OrbVisual, OrbVisualState, ChipTheme } from './orb/orbView';
|
|
20
|
+
export { watchPublishedConfig } from './orb/publishedConfig';
|
|
21
|
+
export type { ResolvedOrbConfig, WatchPublishedConfigOptions } from './orb/publishedConfig';
|
|
22
|
+
export { createWebStorageAdapter } from './adapters/webStorageAdapter';
|
|
23
|
+
export type { WebStorageAdapterOptions } from './adapters/webStorageAdapter';
|
|
24
|
+
export { createWebNavigationAdapter, BACK_ROUTE, } from './adapters/webNavigationAdapter';
|
|
25
|
+
export type { WebNavigationAdapter, WebNavigationAdapterOptions, } from './adapters/webNavigationAdapter';
|
|
26
|
+
export { createWebVoiceAdapter } from './adapters/webVoiceAdapter';
|
|
27
|
+
export type { WebVoiceAdapterOptions } from './adapters/webVoiceAdapter';
|
|
28
|
+
export { createFiodosBackendClient, buildManifestPayload } from './api/backendClient';
|
|
29
|
+
export type { FiodosBackendClientOptions } from './api/backendClient';
|
|
30
|
+
export { createFiodosTelemetry } from './api/backendTelemetry';
|
|
31
|
+
export type { FiodosTelemetryOptions } from './api/backendTelemetry';
|
|
32
|
+
export { AgentApiError, isAgentApiError } from './api/errors';
|
|
33
|
+
export type { AgentApiErrorCode } from './api/errors';
|
|
34
|
+
export { createBridge } from './bridge/createBridge';
|
|
35
|
+
export type { Bridge } from './bridge/createBridge';
|
|
36
|
+
export { createScreenContextStore } from './context/screenContextStore';
|
|
37
|
+
export type { ScreenContextStore, AgentScreenSnapshot } from './context/screenContextStore';
|
|
38
|
+
export { createSpeechSession } from './speech/speechSession';
|
|
39
|
+
export type { SpeechSession, SpeechSessionOptions, SpeechSessionState, SpeechSessionSnapshot, } from './speech/speechSession';
|
|
40
|
+
export { DEFAULT_AGENT_TIMINGS } from './config/types';
|
|
41
|
+
export type { FiodosWebAgentConfig, AgentPhase, AgentTimings, TurnGateVerdict, } from './config/types';
|
|
42
|
+
export { resolveUiMessages } from './ui/messages';
|
|
43
|
+
export type { WebUiMessages, ResolveUiMessagesOptions } from './ui/messages';
|
|
44
|
+
export { decideAction, classifyPendingReply } from './core/turnEngine';
|
|
45
|
+
export type { ActionDecision, PendingConfirmation, VoiceConfirmationMode, DecideActionParams, } from './core/turnEngine';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fiodos/web-core — framework-agnostic browser layer for the Fiodos agent.
|
|
4
|
+
*
|
|
5
|
+
* Contains the vanilla orchestrator (AgentController), the browser adapters,
|
|
6
|
+
* the HTTP client, the decision engine and a vanilla DOM orb — all over
|
|
7
|
+
* @fiodos/core. @fiodos/vue, @fiodos/svelte and @fiodos/angular are thin
|
|
8
|
+
* reactive wrappers around THIS package, so they share identical agent
|
|
9
|
+
* behaviour and security. No framework imports live here.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.classifyPendingReply = exports.decideAction = exports.resolveUiMessages = exports.DEFAULT_AGENT_TIMINGS = exports.createSpeechSession = exports.createScreenContextStore = exports.createBridge = exports.isAgentApiError = exports.AgentApiError = exports.createFiodosTelemetry = exports.buildManifestPayload = exports.createFiodosBackendClient = exports.createWebVoiceAdapter = exports.BACK_ROUTE = exports.createWebNavigationAdapter = exports.createWebStorageAdapter = exports.watchPublishedConfig = exports.DEFAULT_ORB_APPEARANCE = exports.buildKeyboardChip = exports.createOrbVisual = exports.mountOrb = exports.sendOrbSeen = exports.fetchClientManifest = exports.DEFAULT_WEB_API_URL = exports.createFiodosAgent = exports.AgentController = void 0;
|
|
13
|
+
// ── Orchestrator ──────────────────────────────────────────────────────────────
|
|
14
|
+
var AgentController_1 = require("./controller/AgentController");
|
|
15
|
+
Object.defineProperty(exports, "AgentController", { enumerable: true, get: function () { return AgentController_1.AgentController; } });
|
|
16
|
+
// ── Drop-in (zero-wiring) ─────────────────────────────────────────────────────
|
|
17
|
+
var createFiodosAgent_1 = require("./dropin/createFiodosAgent");
|
|
18
|
+
Object.defineProperty(exports, "createFiodosAgent", { enumerable: true, get: function () { return createFiodosAgent_1.createFiodosAgent; } });
|
|
19
|
+
// ── Client self-bootstrap (manifest auto-fetch + orb-seen heartbeat) ──────────
|
|
20
|
+
var clientBootstrap_1 = require("./api/clientBootstrap");
|
|
21
|
+
Object.defineProperty(exports, "DEFAULT_WEB_API_URL", { enumerable: true, get: function () { return clientBootstrap_1.DEFAULT_WEB_API_URL; } });
|
|
22
|
+
Object.defineProperty(exports, "fetchClientManifest", { enumerable: true, get: function () { return clientBootstrap_1.fetchClientManifest; } });
|
|
23
|
+
Object.defineProperty(exports, "sendOrbSeen", { enumerable: true, get: function () { return clientBootstrap_1.sendOrbSeen; } });
|
|
24
|
+
// ── Vanilla DOM orb ───────────────────────────────────────────────────────────
|
|
25
|
+
var mountOrb_1 = require("./orb/mountOrb");
|
|
26
|
+
Object.defineProperty(exports, "mountOrb", { enumerable: true, get: function () { return mountOrb_1.mountOrb; } });
|
|
27
|
+
var orbView_1 = require("./orb/orbView");
|
|
28
|
+
Object.defineProperty(exports, "createOrbVisual", { enumerable: true, get: function () { return orbView_1.createOrbVisual; } });
|
|
29
|
+
Object.defineProperty(exports, "buildKeyboardChip", { enumerable: true, get: function () { return orbView_1.buildKeyboardChip; } });
|
|
30
|
+
Object.defineProperty(exports, "DEFAULT_ORB_APPEARANCE", { enumerable: true, get: function () { return orbView_1.DEFAULT_ORB_APPEARANCE; } });
|
|
31
|
+
var publishedConfig_1 = require("./orb/publishedConfig");
|
|
32
|
+
Object.defineProperty(exports, "watchPublishedConfig", { enumerable: true, get: function () { return publishedConfig_1.watchPublishedConfig; } });
|
|
33
|
+
// ── Adapters (browser implementations of @fiodos/core contracts) ──────────────
|
|
34
|
+
var webStorageAdapter_1 = require("./adapters/webStorageAdapter");
|
|
35
|
+
Object.defineProperty(exports, "createWebStorageAdapter", { enumerable: true, get: function () { return webStorageAdapter_1.createWebStorageAdapter; } });
|
|
36
|
+
var webNavigationAdapter_1 = require("./adapters/webNavigationAdapter");
|
|
37
|
+
Object.defineProperty(exports, "createWebNavigationAdapter", { enumerable: true, get: function () { return webNavigationAdapter_1.createWebNavigationAdapter; } });
|
|
38
|
+
Object.defineProperty(exports, "BACK_ROUTE", { enumerable: true, get: function () { return webNavigationAdapter_1.BACK_ROUTE; } });
|
|
39
|
+
var webVoiceAdapter_1 = require("./adapters/webVoiceAdapter");
|
|
40
|
+
Object.defineProperty(exports, "createWebVoiceAdapter", { enumerable: true, get: function () { return webVoiceAdapter_1.createWebVoiceAdapter; } });
|
|
41
|
+
// ── Backend + telemetry (same wire contract as every platform) ────────────────
|
|
42
|
+
var backendClient_1 = require("./api/backendClient");
|
|
43
|
+
Object.defineProperty(exports, "createFiodosBackendClient", { enumerable: true, get: function () { return backendClient_1.createFiodosBackendClient; } });
|
|
44
|
+
Object.defineProperty(exports, "buildManifestPayload", { enumerable: true, get: function () { return backendClient_1.buildManifestPayload; } });
|
|
45
|
+
var backendTelemetry_1 = require("./api/backendTelemetry");
|
|
46
|
+
Object.defineProperty(exports, "createFiodosTelemetry", { enumerable: true, get: function () { return backendTelemetry_1.createFiodosTelemetry; } });
|
|
47
|
+
var errors_1 = require("./api/errors");
|
|
48
|
+
Object.defineProperty(exports, "AgentApiError", { enumerable: true, get: function () { return errors_1.AgentApiError; } });
|
|
49
|
+
Object.defineProperty(exports, "isAgentApiError", { enumerable: true, get: function () { return errors_1.isAgentApiError; } });
|
|
50
|
+
// ── Bridges ───────────────────────────────────────────────────────────────────
|
|
51
|
+
var createBridge_1 = require("./bridge/createBridge");
|
|
52
|
+
Object.defineProperty(exports, "createBridge", { enumerable: true, get: function () { return createBridge_1.createBridge; } });
|
|
53
|
+
// ── Screen context ────────────────────────────────────────────────────────────
|
|
54
|
+
var screenContextStore_1 = require("./context/screenContextStore");
|
|
55
|
+
Object.defineProperty(exports, "createScreenContextStore", { enumerable: true, get: function () { return screenContextStore_1.createScreenContextStore; } });
|
|
56
|
+
// ── Speech session ──────────────────────────────────────────────────────────────
|
|
57
|
+
var speechSession_1 = require("./speech/speechSession");
|
|
58
|
+
Object.defineProperty(exports, "createSpeechSession", { enumerable: true, get: function () { return speechSession_1.createSpeechSession; } });
|
|
59
|
+
// ── Config / i18n ─────────────────────────────────────────────────────────────
|
|
60
|
+
var types_1 = require("./config/types");
|
|
61
|
+
Object.defineProperty(exports, "DEFAULT_AGENT_TIMINGS", { enumerable: true, get: function () { return types_1.DEFAULT_AGENT_TIMINGS; } });
|
|
62
|
+
var messages_1 = require("./ui/messages");
|
|
63
|
+
Object.defineProperty(exports, "resolveUiMessages", { enumerable: true, get: function () { return messages_1.resolveUiMessages; } });
|
|
64
|
+
// ── Decision engine (shared, framework-free; advanced use / testing) ──────────
|
|
65
|
+
var turnEngine_1 = require("./core/turnEngine");
|
|
66
|
+
Object.defineProperty(exports, "decideAction", { enumerable: true, get: function () { return turnEngine_1.decideAction; } });
|
|
67
|
+
Object.defineProperty(exports, "classifyPendingReply", { enumerable: true, get: function () { return turnEngine_1.classifyPendingReply; } });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AgentController } from '../controller/AgentController';
|
|
2
|
+
export type OrbCorner = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
3
|
+
export interface MountOrbOptions {
|
|
4
|
+
/** Where to mount. Defaults to document.body. */
|
|
5
|
+
container?: HTMLElement;
|
|
6
|
+
/** Screen corner for the floating orb (fallback when no published position). */
|
|
7
|
+
corner?: OrbCorner;
|
|
8
|
+
/** Override the orb diameter in px (otherwise the published/default size). */
|
|
9
|
+
size?: number;
|
|
10
|
+
/** Override the accent (fill/border) color (otherwise published/default). */
|
|
11
|
+
accent?: string;
|
|
12
|
+
/** Show the text-input affordance. Default: true. */
|
|
13
|
+
enableTextInput?: boolean;
|
|
14
|
+
/** Base z-index for the orb + modals. Default: 2147483000. */
|
|
15
|
+
zIndex?: number;
|
|
16
|
+
/** Poll interval (ms) for live dashboard config. Default 12000 (0 = off). */
|
|
17
|
+
appearancePollMs?: number;
|
|
18
|
+
/** Honour the dashboard's published screen position. Default: true. */
|
|
19
|
+
usePublishedPosition?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface MountedOrb {
|
|
22
|
+
unmount(): void;
|
|
23
|
+
}
|
|
24
|
+
export declare function mountOrb(controller: AgentController, options?: MountOrbOptions): MountedOrb;
|