@wix/legends-platform-sdk 1.32.0 → 1.33.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/dist/cjs/components/ChromaKey/ChromaKey.js +14 -4
- package/dist/cjs/components/ChromaKey/ChromaKey.js.map +1 -1
- package/dist/cjs/components/ChromaKey/chroma-key.js +3 -0
- package/dist/cjs/components/ChromaKey/chroma-key.js.map +1 -1
- package/dist/cjs/components/LegendsPlatform/LegendsPlatform.js +32 -7
- package/dist/cjs/components/LegendsPlatform/LegendsPlatform.js.map +1 -1
- package/dist/cjs/components/Video/Video.js +16 -2
- package/dist/cjs/components/Video/Video.js.map +1 -1
- package/dist/cjs/components/Video/types.js.map +1 -1
- package/dist/cjs/components/VideoPostProcessor/VideoPostProcessor.js +12 -3
- package/dist/cjs/components/VideoPostProcessor/VideoPostProcessor.js.map +1 -1
- package/dist/cjs/hooks/useConversation/livekit/useConversation.js +24 -14
- package/dist/cjs/hooks/useConversation/livekit/useConversation.js.map +1 -1
- package/dist/cjs/hooks/useCreateConversation/useCreateConversation.js +11 -3
- package/dist/cjs/hooks/useCreateConversation/useCreateConversation.js.map +1 -1
- package/dist/cjs/sdk-consumer/context.js.map +1 -1
- package/dist/cjs/sdk.js +26 -0
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/cjs/startup-telemetry/attempt.js +188 -0
- package/dist/cjs/startup-telemetry/attempt.js.map +1 -0
- package/dist/cjs/startup-telemetry/frame.js +83 -0
- package/dist/cjs/startup-telemetry/frame.js.map +1 -0
- package/dist/cjs/startup-telemetry/useStartupAttempt.js +15 -0
- package/dist/cjs/startup-telemetry/useStartupAttempt.js.map +1 -0
- package/dist/esm/components/ChromaKey/ChromaKey.js +12 -2
- package/dist/esm/components/ChromaKey/ChromaKey.js.map +1 -1
- package/dist/esm/components/ChromaKey/chroma-key.js +3 -0
- package/dist/esm/components/ChromaKey/chroma-key.js.map +1 -1
- package/dist/esm/components/LegendsPlatform/LegendsPlatform.js +28 -3
- package/dist/esm/components/LegendsPlatform/LegendsPlatform.js.map +1 -1
- package/dist/esm/components/Video/Video.js +16 -1
- package/dist/esm/components/Video/Video.js.map +1 -1
- package/dist/esm/components/Video/types.js.map +1 -1
- package/dist/esm/components/VideoPostProcessor/VideoPostProcessor.js +11 -2
- package/dist/esm/components/VideoPostProcessor/VideoPostProcessor.js.map +1 -1
- package/dist/esm/hooks/useConversation/livekit/useConversation.js +24 -14
- package/dist/esm/hooks/useConversation/livekit/useConversation.js.map +1 -1
- package/dist/esm/hooks/useCreateConversation/useCreateConversation.js +11 -3
- package/dist/esm/hooks/useCreateConversation/useCreateConversation.js.map +1 -1
- package/dist/esm/sdk-consumer/context.js.map +1 -1
- package/dist/esm/sdk.js +1 -0
- package/dist/esm/sdk.js.map +1 -1
- package/dist/esm/startup-telemetry/attempt.js +180 -0
- package/dist/esm/startup-telemetry/attempt.js.map +1 -0
- package/dist/esm/startup-telemetry/frame.js +77 -0
- package/dist/esm/startup-telemetry/frame.js.map +1 -0
- package/dist/esm/startup-telemetry/useStartupAttempt.js +10 -0
- package/dist/esm/startup-telemetry/useStartupAttempt.js.map +1 -0
- package/dist/types/components/ChromaKey/ChromaKey.d.ts +2 -0
- package/dist/types/components/ChromaKey/ChromaKey.d.ts.map +1 -1
- package/dist/types/components/ChromaKey/chroma-key.d.ts +1 -0
- package/dist/types/components/ChromaKey/chroma-key.d.ts.map +1 -1
- package/dist/types/components/LegendsPlatform/LegendsPlatform.d.ts +2 -0
- package/dist/types/components/LegendsPlatform/LegendsPlatform.d.ts.map +1 -1
- package/dist/types/components/Video/Video.d.ts +1 -0
- package/dist/types/components/Video/Video.d.ts.map +1 -1
- package/dist/types/components/Video/types.d.ts +2 -0
- package/dist/types/components/Video/types.d.ts.map +1 -1
- package/dist/types/components/VideoPostProcessor/VideoPostProcessor.d.ts +2 -0
- package/dist/types/components/VideoPostProcessor/VideoPostProcessor.d.ts.map +1 -1
- package/dist/types/hooks/useConversation/livekit/useConversation.d.ts.map +1 -1
- package/dist/types/hooks/useCreateConversation/useCreateConversation.d.ts.map +1 -1
- package/dist/types/sdk-consumer/context.d.ts +2 -0
- package/dist/types/sdk-consumer/context.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +2 -0
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/startup-telemetry/attempt.d.ts +71 -0
- package/dist/types/startup-telemetry/attempt.d.ts.map +1 -0
- package/dist/types/startup-telemetry/frame.d.ts +6 -0
- package/dist/types/startup-telemetry/frame.d.ts.map +1 -0
- package/dist/types/startup-telemetry/useStartupAttempt.d.ts +2 -0
- package/dist/types/startup-telemetry/useStartupAttempt.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["invariant","useEffect","useAtom","useSetAtom","useUnmount","state","useSdkConsumer","useEmitConversationEvent","createConversationFailureStatus","limit","useCreateConversation","options","type","chatConfig","config","firstConversation","lastConversationTopic","conversationLanguage","_useSdkConsumer","chatId","namespace","personaChatService","setConversationStatus","conversationStatus","_useAtom","conversation","setConversation","emitEvent","create","then","catch","error","status","destroy","data","result","createInteractiveConversation","
|
|
1
|
+
{"version":3,"names":["invariant","useEffect","useAtom","useSetAtom","useUnmount","state","useSdkConsumer","useEmitConversationEvent","createConversationFailureStatus","limit","useCreateConversation","options","type","chatConfig","config","firstConversation","lastConversationTopic","conversationLanguage","_useSdkConsumer","chatId","namespace","personaChatService","startupTelemetrySession","setConversationStatus","conversationStatus","_useAtom","conversation","setConversation","emitEvent","startupAttempt","start","undefined","mark","create","then","catch","error","finish","status","release","destroy","data","result","createInteractiveConversation","bind","id","url","createVoiceConversation","Error","endInteractiveConversation","conversationId"],"sources":["../../../../src/hooks/useCreateConversation/useCreateConversation.ts"],"sourcesContent":["import invariant from 'invariant';\nimport { useEffect } from 'react';\nimport { useAtom, useSetAtom } from 'jotai';\nimport { useUnmount } from 'react-use';\n\nimport {\n state,\n type ConversationType,\n type Conversation,\n} from '../../conversation';\nimport { useSdkConsumer } from '../../sdk-consumer';\nimport { useEmitConversationEvent } from '../useConversationEvents/useEmitConversationEvent';\nimport { createConversationFailureStatus } from './createConversationFailureStatus';\nimport { limit } from './helpers';\nimport type { StartupAttempt } from '../../startup-telemetry/attempt';\n\nexport type UseCreateConversationOptions = {\n type: ConversationType;\n config?: object;\n /** Whether this is the visitor's first-ever conversation with the persona (drives the opening message). */\n firstConversation?: boolean;\n /** Title of the visitor's last meaningful conversation, for a returning-visitor greeting. */\n lastConversationTopic?: string;\n /** Language or locale for a new voice/video call, e.g. es or en-GB. Omit to keep the default behavior. */\n conversationLanguage?: string;\n};\n\nexport type UseCreateConversationResult = {\n data?: Conversation;\n destroy(): Promise<void>;\n};\n\nexport function useCreateConversation(\n options: UseCreateConversationOptions,\n): UseCreateConversationResult {\n const {\n type,\n config: chatConfig,\n firstConversation,\n lastConversationTopic,\n conversationLanguage,\n } = options;\n\n const { chatId, namespace, personaChatService, startupTelemetrySession } =\n useSdkConsumer();\n\n const setConversationStatus = useSetAtom(state.conversationStatus);\n const [conversation, setConversation] = useAtom(state.conversation);\n const emitEvent = useEmitConversationEvent();\n\n useEffect(() => {\n const startupAttempt =\n type === 'video' ? startupTelemetrySession?.start() : undefined;\n startupAttempt?.mark('api_request');\n void create(startupAttempt)\n .then(() => setConversationStatus('created'))\n .catch((error: unknown) => {\n startupAttempt?.finish('error', 'create_failed');\n const status = createConversationFailureStatus(error);\n if (status === 'plan-minutes-exhausted') {\n emitEvent('planMinutesExhausted', {});\n }\n setConversationStatus(status);\n });\n return () => startupTelemetrySession?.release(startupAttempt);\n // Telemetry changes must not issue another create-conversation request.\n }, [type, chatId]);\n\n useUnmount(() => {\n if (!conversation) {\n return;\n }\n void destroy();\n });\n\n useEffect(() => {\n if (!conversation) {\n return;\n }\n if (conversation.limit === 0) {\n setConversationStatus('exceeded');\n }\n }, [conversation]);\n\n return { data: conversation, destroy };\n\n async function create(startupAttempt?: StartupAttempt) {\n invariant(\n personaChatService,\n 'personaChatService is required. Pass it as a prop to LegendsPlatform.',\n );\n\n switch (type) {\n case 'video': {\n const result = await personaChatService.createInteractiveConversation({\n chatId,\n namespace,\n chatConfig,\n firstConversation,\n lastConversationTopic,\n conversationLanguage,\n });\n startupTelemetrySession?.bind(startupAttempt, result.id);\n startupAttempt?.mark('api_response');\n setConversation({\n type: 'video',\n url: result.url,\n id: result.id,\n limit: limit(result.limit),\n });\n break;\n }\n case 'audio': {\n const result = await personaChatService.createVoiceConversation({\n chatId,\n namespace,\n chatConfig,\n firstConversation,\n lastConversationTopic,\n conversationLanguage,\n });\n setConversation({\n type: 'audio',\n url: result.url,\n id: result.id,\n limit: limit(result.limit),\n });\n break;\n }\n default:\n throw new Error(`Unsupported conversation type: ${type}`);\n }\n }\n\n async function destroy() {\n invariant(conversation, 'Conversation is not ready');\n invariant(personaChatService, 'personaChatService is required.');\n\n setConversationStatus('destroying');\n\n if (conversation.type === 'video') {\n await personaChatService\n .endInteractiveConversation({\n chatId,\n conversationId: conversation.id,\n namespace,\n })\n .catch(() => {});\n }\n\n setConversationStatus('destroyed');\n setConversation(undefined);\n }\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,WAAW;AACjC,SAASC,SAAS,QAAQ,OAAO;AACjC,SAASC,OAAO,EAAEC,UAAU,QAAQ,OAAO;AAC3C,SAASC,UAAU,QAAQ,WAAW;AAEtC,SACEC,KAAK,QAGA,oBAAoB;AAC3B,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,wBAAwB,QAAQ,mDAAmD;AAC5F,SAASC,+BAA+B,QAAQ,mCAAmC;AACnF,SAASC,KAAK,QAAQ,WAAW;AAmBjC,OAAO,SAASC,qBAAqBA,CACnCC,OAAqC,EACR;EAC7B,MACEC,IAAI,GAKFD,OAAO,CALTC,IAAI;IACIC,UAAU,GAIhBF,OAAO,CAJTG,MAAM;IACNC,iBAAiB,GAGfJ,OAAO,CAHTI,iBAAiB;IACjBC,qBAAqB,GAE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CAAC;UACFU,eAAe,CAAC;YACdf,IAAI,EAAE,OAAO;YACbkC,GAAG,EAAEJ,MAAM,CAACI,GAAG;YACfD,EAAE,EAAEH,MAAM,CAACG,EAAE;YACbpC,KAAK,EAAEA,KAAK,CAACiC,MAAM,CAACjC,KAAK;UAC3B,CAAC,CAAC;UACF;QACF;MACA;QACE,MAAM,IAAIuC,KAAK,CAAC,kCAAkCpC,IAAI,EAAE,CAAC;IAC7D;EACF;EAEA,eAAe4B,OAAOA,CAAA,EAAG;IACvBxC,SAAS,CAAC0B,YAAY,EAAE,2BAA2B,CAAC;IACpD1B,SAAS,CAACqB,kBAAkB,EAAE,iCAAiC,CAAC;IAEhEE,qBAAqB,CAAC,YAAY,CAAC;IAEnC,IAAIG,YAAY,CAACd,IAAI,KAAK,OAAO,EAAE;MACjC,MAAMS,kBAAkB,CACrB4B,0BAA0B,CAAC;QAC1B9B,MAAM;QACN+B,cAAc,EAAExB,YAAY,CAACmB,EAAE;QAC/BzB;MACF,CAAC,CAAC,CACDe,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACpB;IAEAZ,qBAAqB,CAAC,WAAW,CAAC;IAClCI,eAAe,CAACI,SAAS,CAAC;EAC5B;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useContext","SdkConsumerContext","chatId","namespace","tools","useSdkConsumer"],"sources":["../../../src/sdk-consumer/context.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nimport type { ToolsRegistry } from '../hooks';\nimport type { IPersonaChatService } from '../types';\n\nexport interface ISdkConsumerContext {\n chatId: string;\n namespace: string;\n tools?: ToolsRegistry;\n personaChatService?: IPersonaChatService;\n}\n\nexport const SdkConsumerContext = createContext<ISdkConsumerContext>({\n chatId: '',\n namespace: '',\n tools: {},\n});\n\nexport function useSdkConsumer() {\n return useContext(SdkConsumerContext);\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;
|
|
1
|
+
{"version":3,"names":["createContext","useContext","SdkConsumerContext","chatId","namespace","tools","useSdkConsumer"],"sources":["../../../src/sdk-consumer/context.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport type { StartupTelemetrySession } from '../startup-telemetry/attempt';\n\nimport type { ToolsRegistry } from '../hooks';\nimport type { IPersonaChatService } from '../types';\n\nexport interface ISdkConsumerContext {\n startupTelemetrySession?: StartupTelemetrySession;\n chatId: string;\n namespace: string;\n tools?: ToolsRegistry;\n personaChatService?: IPersonaChatService;\n}\n\nexport const SdkConsumerContext = createContext<ISdkConsumerContext>({\n chatId: '',\n namespace: '',\n tools: {},\n});\n\nexport function useSdkConsumer() {\n return useContext(SdkConsumerContext);\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAcjD,OAAO,MAAMC,kBAAkB,gBAAGF,aAAa,CAAsB;EACnEG,MAAM,EAAE,EAAE;EACVC,SAAS,EAAE,EAAE;EACbC,KAAK,EAAE,CAAC;AACV,CAAC,CAAC;AAEF,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/B,OAAOL,UAAU,CAACC,kBAAkB,CAAC;AACvC","ignoreList":[]}
|
package/dist/esm/sdk.js
CHANGED
|
@@ -16,4 +16,5 @@ export * from './hooks/usePictureInPicture';
|
|
|
16
16
|
export * from './hooks/useMediaPermissions';
|
|
17
17
|
export * from './hooks/useTools';
|
|
18
18
|
export * from './conversation/types';
|
|
19
|
+
export { createStartupIntent, StartupAttempt } from './startup-telemetry/attempt';
|
|
19
20
|
//# sourceMappingURL=sdk.js.map
|
package/dist/esm/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/sdk.ts"],"sourcesContent":["export * from './types';\n\nexport * from './hooks/useTextChat';\nexport * from './hooks/useTranscriptions';\nexport * from './hooks/useConversationStatus';\nexport * from './hooks/useMicrophone';\nexport * from './hooks/useSpeaker';\nexport * from './hooks/useCamera';\nexport * from './hooks/useMediaRecorder';\nexport * from './hooks/useConversationTimer';\nexport * from './hooks/useConversationEvents';\nexport * from './hooks/useUserActivity';\nexport * from './hooks/useAudio';\nexport * from './hooks/useConnectionState';\nexport * from './hooks/useActivityState';\nexport * from './hooks/usePictureInPicture';\nexport * from './hooks/useMediaPermissions';\nexport * from './hooks/useTools';\n\nexport * from './conversation/types';\n"],"mappings":"AAAA,cAAc,SAAS;AAEvB,cAAc,qBAAqB;AACnC,cAAc,2BAA2B;AACzC,cAAc,+BAA+B;AAC7C,cAAc,uBAAuB;AACrC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,0BAA0B;AACxC,cAAc,8BAA8B;AAC5C,cAAc,+BAA+B;AAC7C,cAAc,yBAAyB;AACvC,cAAc,kBAAkB;AAChC,cAAc,4BAA4B;AAC1C,cAAc,0BAA0B;AACxC,cAAc,6BAA6B;AAC3C,cAAc,6BAA6B;AAC3C,cAAc,kBAAkB;AAEhC,cAAc,sBAAsB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createStartupIntent","StartupAttempt"],"sources":["../../src/sdk.ts"],"sourcesContent":["export * from './types';\n\nexport * from './hooks/useTextChat';\nexport * from './hooks/useTranscriptions';\nexport * from './hooks/useConversationStatus';\nexport * from './hooks/useMicrophone';\nexport * from './hooks/useSpeaker';\nexport * from './hooks/useCamera';\nexport * from './hooks/useMediaRecorder';\nexport * from './hooks/useConversationTimer';\nexport * from './hooks/useConversationEvents';\nexport * from './hooks/useUserActivity';\nexport * from './hooks/useAudio';\nexport * from './hooks/useConnectionState';\nexport * from './hooks/useActivityState';\nexport * from './hooks/usePictureInPicture';\nexport * from './hooks/useMediaPermissions';\nexport * from './hooks/useTools';\n\nexport * from './conversation/types';\n\nexport {\n createStartupIntent,\n StartupAttempt,\n} from './startup-telemetry/attempt';\nexport type {\n StartupIntent,\n StartupReport,\n StartupTelemetryOptions,\n} from './startup-telemetry/attempt';\n"],"mappings":"AAAA,cAAc,SAAS;AAEvB,cAAc,qBAAqB;AACnC,cAAc,2BAA2B;AACzC,cAAc,+BAA+B;AAC7C,cAAc,uBAAuB;AACrC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,0BAA0B;AACxC,cAAc,8BAA8B;AAC5C,cAAc,+BAA+B;AAC7C,cAAc,yBAAyB;AACvC,cAAc,kBAAkB;AAChC,cAAc,4BAA4B;AAC1C,cAAc,0BAA0B;AACxC,cAAc,6BAA6B;AAC3C,cAAc,6BAA6B;AAC3C,cAAc,kBAAkB;AAEhC,cAAc,sBAAsB;AAEpC,SACEA,mBAAmB,EACnBC,cAAc,QACT,6BAA6B","ignoreList":[]}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
/* eslint-env es2020 */
|
|
3
|
+
/** All elapsed times belong to one browser document's monotonic clock. */
|
|
4
|
+
|
|
5
|
+
function newId() {
|
|
6
|
+
var _globalThis$crypto;
|
|
7
|
+
return ((_globalThis$crypto = globalThis.crypto) == null || _globalThis$crypto.randomUUID == null ? void 0 : _globalThis$crypto.randomUUID()) || `startup-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
8
|
+
}
|
|
9
|
+
export function createStartupIntent() {
|
|
10
|
+
return {
|
|
11
|
+
id: newId(),
|
|
12
|
+
startedAt: performance.now(),
|
|
13
|
+
timeOrigin: performance.timeOrigin
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export class StartupAttempt {
|
|
17
|
+
constructor(options, chatId, intent) {
|
|
18
|
+
this.options = options;
|
|
19
|
+
this.chatId = chatId;
|
|
20
|
+
_defineProperty(this, "terminal", false);
|
|
21
|
+
_defineProperty(this, "adoptedBySdk", false);
|
|
22
|
+
_defineProperty(this, "seen", new Set());
|
|
23
|
+
_defineProperty(this, "conversationId", void 0);
|
|
24
|
+
_defineProperty(this, "timeout", void 0);
|
|
25
|
+
_defineProperty(this, "id", void 0);
|
|
26
|
+
_defineProperty(this, "startedAt", void 0);
|
|
27
|
+
_defineProperty(this, "startBoundary", void 0);
|
|
28
|
+
_defineProperty(this, "visibilityChanged", () => {
|
|
29
|
+
if (document.visibilityState !== 'visible') {
|
|
30
|
+
this.finish('unmeasurable', 'hidden_document');
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const now = performance.now();
|
|
34
|
+
const valid = intent && intent.timeOrigin === performance.timeOrigin && Number.isFinite(intent.startedAt) && intent.startedAt >= 0 && intent.startedAt <= now;
|
|
35
|
+
this.id = valid ? intent.id : newId();
|
|
36
|
+
this.startedAt = valid ? intent.startedAt : now;
|
|
37
|
+
this.startBoundary = valid ? 'user_intent' : 'sdk_create';
|
|
38
|
+
this.timeout = setTimeout(() => this.finish('timeout'), Math.max(0, 120000 - (now - this.startedAt)));
|
|
39
|
+
this.mark('attempt_started');
|
|
40
|
+
if (typeof document !== 'undefined') {
|
|
41
|
+
document.addEventListener('visibilitychange', this.visibilityChanged);
|
|
42
|
+
this.visibilityChanged();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** A pre-SDK terminal attempt must be adopted once, not counted again. */
|
|
47
|
+
claimForSdk() {
|
|
48
|
+
if (this.adoptedBySdk) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
this.adoptedBySdk = true;
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
get completed() {
|
|
55
|
+
return this.terminal;
|
|
56
|
+
}
|
|
57
|
+
attachChat(chatId) {
|
|
58
|
+
this.chatId = chatId;
|
|
59
|
+
}
|
|
60
|
+
bind(conversationId) {
|
|
61
|
+
this.conversationId = conversationId;
|
|
62
|
+
}
|
|
63
|
+
mark(milestone, method) {
|
|
64
|
+
if (this.terminal || this.seen.has(milestone)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this.seen.add(milestone);
|
|
68
|
+
this.send(milestone, 'pending', method);
|
|
69
|
+
}
|
|
70
|
+
frame(method) {
|
|
71
|
+
this.finish('success', method);
|
|
72
|
+
}
|
|
73
|
+
finish(outcome, method) {
|
|
74
|
+
if (this.terminal) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this.terminal = true;
|
|
78
|
+
clearTimeout(this.timeout);
|
|
79
|
+
if (typeof document !== 'undefined') {
|
|
80
|
+
document.removeEventListener('visibilitychange', this.visibilityChanged);
|
|
81
|
+
}
|
|
82
|
+
this.send(outcome === 'success' ? 'first_frame' : 'terminal', outcome, method);
|
|
83
|
+
}
|
|
84
|
+
send(milestone, outcome, method) {
|
|
85
|
+
const elapsed = performance.now() - this.startedAt;
|
|
86
|
+
if (!Number.isFinite(elapsed) || elapsed < 0) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
var _this$options$report, _this$options;
|
|
91
|
+
const result = (_this$options$report = (_this$options = this.options).report) == null ? void 0 : _this$options$report.call(_this$options, {
|
|
92
|
+
attemptId: this.id,
|
|
93
|
+
chatId: this.chatId,
|
|
94
|
+
conversationId: this.conversationId,
|
|
95
|
+
milestone,
|
|
96
|
+
elapsedMs: Math.ceil(elapsed),
|
|
97
|
+
clientStartUnixMs: Math.floor(performance.timeOrigin + this.startedAt),
|
|
98
|
+
outcome,
|
|
99
|
+
startBoundary: this.startBoundary,
|
|
100
|
+
method,
|
|
101
|
+
application: this.options.application,
|
|
102
|
+
applicationVersion: this.options.applicationVersion,
|
|
103
|
+
entryCoverage: this.options.entryCoverage || 'sdk_only',
|
|
104
|
+
measurementVersion: 1
|
|
105
|
+
});
|
|
106
|
+
// BI failures must not produce unhandled promise rejections or break media.
|
|
107
|
+
if (result) {
|
|
108
|
+
void Promise.resolve(result).catch(() => undefined);
|
|
109
|
+
}
|
|
110
|
+
} catch {
|
|
111
|
+
/* Reporting is best effort; conversation behavior is unchanged. */
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
export class StartupTelemetrySession {
|
|
116
|
+
constructor(options, chatId) {
|
|
117
|
+
this.options = options;
|
|
118
|
+
this.chatId = chatId;
|
|
119
|
+
_defineProperty(this, "attempts", new Map());
|
|
120
|
+
_defineProperty(this, "leases", new Map());
|
|
121
|
+
_defineProperty(this, "active", void 0);
|
|
122
|
+
_defineProperty(this, "terminalAtCreation", void 0);
|
|
123
|
+
_defineProperty(this, "intentConsumed", false);
|
|
124
|
+
}
|
|
125
|
+
start() {
|
|
126
|
+
if (!this.options.enabled || !this.options.report) {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
if (this.active && (!this.active.completed || this.active === this.terminalAtCreation && (this.leases.get(this.active) || 0) === 0)) {
|
|
130
|
+
this.leases.set(this.active, (this.leases.get(this.active) || 0) + 1);
|
|
131
|
+
return this.active;
|
|
132
|
+
}
|
|
133
|
+
const provided = !this.intentConsumed && this.options.attempt && this.options.attempt.claimForSdk() ? this.options.attempt : undefined;
|
|
134
|
+
const attempt = provided || new StartupAttempt({
|
|
135
|
+
...this.options,
|
|
136
|
+
entryCoverage: 'sdk_only'
|
|
137
|
+
}, this.chatId, this.intentConsumed ? undefined : this.options.intent);
|
|
138
|
+
attempt.attachChat(this.chatId);
|
|
139
|
+
this.intentConsumed = true;
|
|
140
|
+
this.active = attempt;
|
|
141
|
+
this.terminalAtCreation = attempt.completed ? attempt : undefined;
|
|
142
|
+
this.leases.set(attempt, 1);
|
|
143
|
+
return attempt;
|
|
144
|
+
}
|
|
145
|
+
bind(attempt, id) {
|
|
146
|
+
if (!attempt) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
attempt.bind(id);
|
|
150
|
+
this.attempts.set(id, attempt);
|
|
151
|
+
// A provider normally owns one conversation; bound memory across retries.
|
|
152
|
+
if (this.attempts.size > 8) {
|
|
153
|
+
var _this$attempts$get;
|
|
154
|
+
const oldest = this.attempts.keys().next().value;
|
|
155
|
+
(_this$attempts$get = this.attempts.get(oldest)) == null || _this$attempts$get.finish('cancelled');
|
|
156
|
+
this.attempts.delete(oldest);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
get(id) {
|
|
160
|
+
return id ? this.attempts.get(id) : undefined;
|
|
161
|
+
}
|
|
162
|
+
release(attempt) {
|
|
163
|
+
if (!attempt) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
this.leases.set(attempt, Math.max(0, (this.leases.get(attempt) || 0) - 1));
|
|
167
|
+
// StrictMode immediately replays effects. Cancel only if no setup reclaimed
|
|
168
|
+
// this attempt by the microtask boundary; real unmounts still terminate it.
|
|
169
|
+
void Promise.resolve().then(() => {
|
|
170
|
+
if (this.leases.get(attempt) === 0) {
|
|
171
|
+
attempt.finish('cancelled');
|
|
172
|
+
this.leases.delete(attempt);
|
|
173
|
+
if (this.active === attempt) {
|
|
174
|
+
this.active = undefined;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=attempt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["newId","_globalThis$crypto","globalThis","crypto","randomUUID","Date","now","Math","random","toString","slice","createStartupIntent","id","startedAt","performance","timeOrigin","StartupAttempt","constructor","options","chatId","intent","_defineProperty","Set","document","visibilityState","finish","valid","Number","isFinite","startBoundary","timeout","setTimeout","max","mark","addEventListener","visibilityChanged","claimForSdk","adoptedBySdk","completed","terminal","attachChat","bind","conversationId","milestone","method","seen","has","add","send","frame","outcome","clearTimeout","removeEventListener","elapsed","_this$options$report","_this$options","result","report","call","attemptId","elapsedMs","ceil","clientStartUnixMs","floor","application","applicationVersion","entryCoverage","measurementVersion","Promise","resolve","catch","undefined","StartupTelemetrySession","Map","start","enabled","active","terminalAtCreation","leases","get","set","provided","intentConsumed","attempt","attempts","size","_this$attempts$get","oldest","keys","next","value","delete","release","then"],"sources":["../../../src/startup-telemetry/attempt.ts"],"sourcesContent":["/* eslint-env es2020 */\n/** All elapsed times belong to one browser document's monotonic clock. */\nexport type StartupMilestone =\n | 'attempt_started'\n | 'api_request'\n | 'api_response'\n | 'join_requested'\n | 'room_connected'\n | 'agent_joined'\n | 'track_subscribed'\n | 'first_frame'\n | 'terminal';\nexport type StartupOutcome =\n | 'pending'\n | 'success'\n | 'error'\n | 'cancelled'\n | 'timeout'\n | 'unmeasurable';\nexport type StartupIntent = {\n id: string;\n startedAt: number;\n timeOrigin: number;\n};\nexport type StartupReport = {\n attemptId: string;\n chatId: string;\n conversationId?: string;\n milestone: StartupMilestone;\n elapsedMs: number;\n clientStartUnixMs: number;\n outcome: StartupOutcome;\n startBoundary: 'user_intent' | 'sdk_create';\n method?: string;\n application: string;\n applicationVersion?: string;\n entryCoverage: 'user_handler' | 'sdk_only';\n measurementVersion: number;\n};\nexport type StartupTelemetryOptions = {\n enabled: boolean;\n intent?: StartupIntent;\n attempt?: StartupAttempt;\n application: string;\n applicationVersion?: string;\n entryCoverage?: 'user_handler' | 'sdk_only';\n report?: (event: StartupReport) => void | Promise<unknown>;\n};\n\nfunction newId() {\n return (\n globalThis.crypto?.randomUUID?.() ||\n `startup-${Date.now()}-${Math.random().toString(36).slice(2)}`\n );\n}\n\nexport function createStartupIntent(): StartupIntent {\n return {\n id: newId(),\n startedAt: performance.now(),\n timeOrigin: performance.timeOrigin,\n };\n}\n\nexport class StartupAttempt {\n private terminal = false;\n private adoptedBySdk = false;\n private seen = new Set<StartupMilestone>();\n private conversationId?: string;\n private timeout?: ReturnType<typeof setTimeout>;\n readonly id: string;\n readonly startedAt: number;\n readonly startBoundary: 'user_intent' | 'sdk_create';\n private visibilityChanged = () => {\n if (document.visibilityState !== 'visible') {\n this.finish('unmeasurable', 'hidden_document');\n }\n };\n\n constructor(\n private options: StartupTelemetryOptions,\n private chatId: string,\n intent?: StartupIntent,\n ) {\n const now = performance.now();\n const valid =\n intent &&\n intent.timeOrigin === performance.timeOrigin &&\n Number.isFinite(intent.startedAt) &&\n intent.startedAt >= 0 &&\n intent.startedAt <= now;\n this.id = valid ? intent.id : newId();\n this.startedAt = valid ? intent.startedAt : now;\n this.startBoundary = valid ? 'user_intent' : 'sdk_create';\n this.timeout = setTimeout(\n () => this.finish('timeout'),\n Math.max(0, 120000 - (now - this.startedAt)),\n );\n this.mark('attempt_started');\n if (typeof document !== 'undefined') {\n document.addEventListener('visibilitychange', this.visibilityChanged);\n this.visibilityChanged();\n }\n }\n\n /** A pre-SDK terminal attempt must be adopted once, not counted again. */\n claimForSdk() {\n if (this.adoptedBySdk) {\n return false;\n }\n this.adoptedBySdk = true;\n return true;\n }\n\n get completed() {\n return this.terminal;\n }\n\n attachChat(chatId: string) {\n this.chatId = chatId;\n }\n\n bind(conversationId: string) {\n this.conversationId = conversationId;\n }\n\n mark(milestone: StartupMilestone, method?: string) {\n if (this.terminal || this.seen.has(milestone)) {\n return;\n }\n this.seen.add(milestone);\n this.send(milestone, 'pending', method);\n }\n\n frame(method: string) {\n this.finish('success', method);\n }\n\n finish(outcome: Exclude<StartupOutcome, 'pending'>, method?: string) {\n if (this.terminal) {\n return;\n }\n this.terminal = true;\n clearTimeout(this.timeout);\n if (typeof document !== 'undefined') {\n document.removeEventListener('visibilitychange', this.visibilityChanged);\n }\n this.send(\n outcome === 'success' ? 'first_frame' : 'terminal',\n outcome,\n method,\n );\n }\n\n private send(\n milestone: StartupMilestone,\n outcome: StartupOutcome,\n method?: string,\n ) {\n const elapsed = performance.now() - this.startedAt;\n if (!Number.isFinite(elapsed) || elapsed < 0) {\n return;\n }\n try {\n const result = this.options.report?.({\n attemptId: this.id,\n chatId: this.chatId,\n conversationId: this.conversationId,\n milestone,\n elapsedMs: Math.ceil(elapsed),\n clientStartUnixMs: Math.floor(performance.timeOrigin + this.startedAt),\n outcome,\n startBoundary: this.startBoundary,\n method,\n application: this.options.application,\n applicationVersion: this.options.applicationVersion,\n entryCoverage: this.options.entryCoverage || 'sdk_only',\n measurementVersion: 1,\n });\n // BI failures must not produce unhandled promise rejections or break media.\n if (result) {\n void Promise.resolve(result).catch(() => undefined);\n }\n } catch {\n /* Reporting is best effort; conversation behavior is unchanged. */\n }\n }\n}\n\nexport class StartupTelemetrySession {\n private attempts = new Map<string, StartupAttempt>();\n private leases = new Map<StartupAttempt, number>();\n private active?: StartupAttempt;\n private terminalAtCreation?: StartupAttempt;\n private intentConsumed = false;\n constructor(\n private options: StartupTelemetryOptions,\n private chatId: string,\n ) {}\n\n start(): StartupAttempt | undefined {\n if (!this.options.enabled || !this.options.report) {\n return undefined;\n }\n if (\n this.active &&\n (!this.active.completed ||\n (this.active === this.terminalAtCreation &&\n (this.leases.get(this.active) || 0) === 0))\n ) {\n this.leases.set(this.active, (this.leases.get(this.active) || 0) + 1);\n return this.active;\n }\n const provided =\n !this.intentConsumed &&\n this.options.attempt &&\n this.options.attempt.claimForSdk()\n ? this.options.attempt\n : undefined;\n const attempt =\n provided ||\n new StartupAttempt(\n { ...this.options, entryCoverage: 'sdk_only' },\n this.chatId,\n this.intentConsumed ? undefined : this.options.intent,\n );\n attempt.attachChat(this.chatId);\n this.intentConsumed = true;\n this.active = attempt;\n this.terminalAtCreation = attempt.completed ? attempt : undefined;\n this.leases.set(attempt, 1);\n return attempt;\n }\n\n bind(attempt: StartupAttempt | undefined, id: string) {\n if (!attempt) {\n return;\n }\n attempt.bind(id);\n this.attempts.set(id, attempt);\n // A provider normally owns one conversation; bound memory across retries.\n if (this.attempts.size > 8) {\n const oldest = this.attempts.keys().next().value as string;\n this.attempts.get(oldest)?.finish('cancelled');\n this.attempts.delete(oldest);\n }\n }\n\n get(id?: string) {\n return id ? this.attempts.get(id) : undefined;\n }\n release(attempt?: StartupAttempt) {\n if (!attempt) {\n return;\n }\n this.leases.set(attempt, Math.max(0, (this.leases.get(attempt) || 0) - 1));\n // StrictMode immediately replays effects. Cancel only if no setup reclaimed\n // this attempt by the microtask boundary; real unmounts still terminate it.\n void Promise.resolve().then(() => {\n if (this.leases.get(attempt) === 0) {\n attempt.finish('cancelled');\n this.leases.delete(attempt);\n if (this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user attention. */
|
|
2
|
+
export function isSurfaceVisible(element) {
|
|
3
|
+
if (document.visibilityState !== 'visible' || !element.isConnected) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
const bounds = element.getBoundingClientRect();
|
|
7
|
+
if (bounds.width <= 0 || bounds.height <= 0 || bounds.bottom <= 0 || bounds.right <= 0 || bounds.top >= innerHeight || bounds.left >= innerWidth) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
for (let current = element; current; current = current.parentElement) {
|
|
11
|
+
const style = getComputedStyle(current);
|
|
12
|
+
if (style.display === 'none' || style.visibility === 'hidden' || style.visibility === 'collapse' || style.opacity !== '' && Number(style.opacity) === 0) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
export function recordCanvasFrame(attempt, canvas, video) {
|
|
19
|
+
if (!attempt || attempt.completed || video.readyState < 2 || !canvas.width || !canvas.height) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (document.visibilityState !== 'visible') {
|
|
23
|
+
attempt.finish('unmeasurable', 'hidden_document');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (isSurfaceVisible(canvas)) {
|
|
27
|
+
attempt.frame('canvas_draw');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function observeVideoFrame(attempt, video) {
|
|
31
|
+
if (attempt.completed) {
|
|
32
|
+
return () => undefined;
|
|
33
|
+
}
|
|
34
|
+
if (document.visibilityState !== 'visible') {
|
|
35
|
+
attempt.finish('unmeasurable', 'hidden_document');
|
|
36
|
+
return () => undefined;
|
|
37
|
+
}
|
|
38
|
+
if (!video.requestVideoFrameCallback) {
|
|
39
|
+
attempt.finish('unmeasurable', 'unsupported_video_frame_callback');
|
|
40
|
+
return () => undefined;
|
|
41
|
+
}
|
|
42
|
+
let active = true;
|
|
43
|
+
let handle;
|
|
44
|
+
const stop = () => {
|
|
45
|
+
active = false;
|
|
46
|
+
document.removeEventListener('visibilitychange', visibilityChanged);
|
|
47
|
+
if (handle !== undefined) {
|
|
48
|
+
video.cancelVideoFrameCallback(handle);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
function visibilityChanged() {
|
|
52
|
+
if (document.visibilityState !== 'visible') {
|
|
53
|
+
attempt.finish('unmeasurable', 'hidden_document');
|
|
54
|
+
stop();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const frame = () => {
|
|
58
|
+
if (!active || attempt.completed) {
|
|
59
|
+
stop();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (document.visibilityState !== 'visible') {
|
|
63
|
+
visibilityChanged();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (isSurfaceVisible(video)) {
|
|
67
|
+
attempt.frame('video_frame_callback');
|
|
68
|
+
stop();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
handle = video.requestVideoFrameCallback(frame);
|
|
72
|
+
};
|
|
73
|
+
document.addEventListener('visibilitychange', visibilityChanged);
|
|
74
|
+
handle = video.requestVideoFrameCallback(frame);
|
|
75
|
+
return stop;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=frame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isSurfaceVisible","element","document","visibilityState","isConnected","bounds","getBoundingClientRect","width","height","bottom","right","top","innerHeight","left","innerWidth","current","parentElement","style","getComputedStyle","display","visibility","opacity","Number","recordCanvasFrame","attempt","canvas","video","completed","readyState","finish","frame","observeVideoFrame","undefined","requestVideoFrameCallback","active","handle","stop","removeEventListener","visibilityChanged","cancelVideoFrameCallback","addEventListener"],"sources":["../../../src/startup-telemetry/frame.ts"],"sourcesContent":["import type { StartupAttempt } from './attempt';\n\n/** A presentation milestone, not proof of photons or user attention. */\nexport function isSurfaceVisible(element: HTMLElement): boolean {\n if (document.visibilityState !== 'visible' || !element.isConnected) {\n return false;\n }\n const bounds = element.getBoundingClientRect();\n if (\n bounds.width <= 0 ||\n bounds.height <= 0 ||\n bounds.bottom <= 0 ||\n bounds.right <= 0 ||\n bounds.top >= innerHeight ||\n bounds.left >= innerWidth\n ) {\n return false;\n }\n for (\n let current: HTMLElement | null = element;\n current;\n current = current.parentElement\n ) {\n const style = getComputedStyle(current);\n if (\n style.display === 'none' ||\n style.visibility === 'hidden' ||\n style.visibility === 'collapse' ||\n (style.opacity !== '' && Number(style.opacity) === 0)\n ) {\n return false;\n }\n }\n return true;\n}\n\nexport function recordCanvasFrame(\n attempt: StartupAttempt | undefined,\n canvas: HTMLCanvasElement,\n video: HTMLVideoElement,\n) {\n if (\n !attempt ||\n attempt.completed ||\n video.readyState < 2 ||\n !canvas.width ||\n !canvas.height\n ) {\n return;\n }\n if (document.visibilityState !== 'visible') {\n attempt.finish('unmeasurable', 'hidden_document');\n return;\n }\n if (isSurfaceVisible(canvas)) {\n attempt.frame('canvas_draw');\n }\n}\n\nexport function observeVideoFrame(\n attempt: StartupAttempt,\n video: HTMLVideoElement,\n): () => void {\n if (attempt.completed) {\n return () => undefined;\n }\n if (document.visibilityState !== 'visible') {\n attempt.finish('unmeasurable', 'hidden_document');\n return () => undefined;\n }\n if (!video.requestVideoFrameCallback) {\n attempt.finish('unmeasurable', 'unsupported_video_frame_callback');\n return () => undefined;\n }\n let active = true;\n let handle: number | undefined;\n const stop = () => {\n active = false;\n document.removeEventListener('visibilitychange', visibilityChanged);\n if (handle !== undefined) {\n video.cancelVideoFrameCallback(handle);\n }\n };\n function visibilityChanged() {\n if (document.visibilityState !== 'visible') {\n attempt.finish('unmeasurable', 'hidden_document');\n stop();\n }\n }\n const frame = () => {\n if (!active || attempt.completed) {\n stop();\n return;\n }\n if (document.visibilityState !== 'visible') {\n visibilityChanged();\n return;\n }\n if (isSurfaceVisible(video)) {\n attempt.frame('video_frame_callback');\n stop();\n return;\n }\n handle = video.requestVideoFrameCallback(frame);\n };\n document.addEventListener('visibilitychange', visibilityChanged);\n handle = video.requestVideoFrameCallback(frame);\n return stop;\n}\n"],"mappings":"AAEA;AACA,OAAO,SAASA,gBAAgBA,CAACC,OAAoB,EAAW;EAC9D,IAAIC,QAAQ,CAACC,eAAe,KAAK,SAAS,IAAI,CAACF,OAAO,CAACG,WAAW,EAAE;IAClE,OAAO,KAAK;EACd;EACA,MAAMC,MAAM,GAAGJ,OAAO,CAACK,qBAAqB,CAAC,CAAC;EAC9C,IACED,MAAM,CAACE,KAAK,IAAI,CAAC,IACjBF,MAAM,CAACG,MAAM,IAAI,CAAC,IAClBH,MAAM,CAACI,MAAM,IAAI,CAAC,IAClBJ,MAAM,CAACK,KAAK,IAAI,CAAC,IACjBL,MAAM,CAACM,GAAG,IAAIC,WAAW,IACzBP,MAAM,CAACQ,IAAI,IAAIC,UAAU,EACzB;IACA,OAAO,KAAK;EACd;EACA,KACE,IAAIC,OAA2B,GAAGd,OAAO,EACzCc,OAAO,EACPA,OAAO,GAAGA,OAAO,CAACC,aAAa,EAC/B;IACA,MAAMC,KAAK,GAAGC,gBAAgB,CAACH,OAAO,CAAC;IACvC,IACEE,KAAK,CAACE,OAAO,KAAK,MAAM,IACxBF,KAAK,CAACG,UAAU,KAAK,QAAQ,IAC7BH,KAAK,CAACG,UAAU,KAAK,UAAU,IAC9BH,KAAK,CAACI,OAAO,KAAK,EAAE,IAAIC,MAAM,CAACL,KAAK,CAACI,OAAO,CAAC,KAAK,CAAE,EACrD;MACA,OAAO,KAAK;IACd;EACF;EACA,OAAO,IAAI;AACb;AAEA,OAAO,SAASE,iBAAiBA,CAC/BC,OAAmC,EACnCC,MAAyB,EACzBC,KAAuB,EACvB;EACA,IACE,CAACF,OAAO,IACRA,OAAO,CAACG,SAAS,IACjBD,KAAK,CAACE,UAAU,GAAG,CAAC,IACpB,CAACH,MAAM,CAAClB,KAAK,IACb,CAACkB,MAAM,CAACjB,MAAM,EACd;IACA;EACF;EACA,IAAIN,QAAQ,CAACC,eAAe,KAAK,SAAS,EAAE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,iBAAiB,CAAC,CAAC;MACnB;IACF;IACA,IAAItC,gBAAgB,CAAC0B,KAAK,CAAC,EAAE;MAC3BF,OAAO,CAACM,KAAK,CAAC,sBAAsB,CAAC;MACrCM,IAAI,CAAC,CAAC;MACN;IACF;IACAD,MAAM,GAAGT,KAAK,CAACO,yBAAyB,CAACH,KAAK,CAAC;EACjD,CAAC;EACD5B,QAAQ,CAACsC,gBAAgB,CAAC,kBAAkB,EAAEF,iBAAiB,CAAC;EAChEH,MAAM,GAAGT,KAAK,CAACO,yBAAyB,CAACH,KAAK,CAAC;EAC/C,OAAOM,IAAI;AACb","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useAtomValue } from 'jotai';
|
|
2
|
+
import { state } from '../conversation';
|
|
3
|
+
import { useSdkConsumer } from '../sdk-consumer';
|
|
4
|
+
export function useStartupAttempt() {
|
|
5
|
+
const _useSdkConsumer = useSdkConsumer(),
|
|
6
|
+
startupTelemetrySession = _useSdkConsumer.startupTelemetrySession;
|
|
7
|
+
const conversation = useAtomValue(state.conversation);
|
|
8
|
+
return startupTelemetrySession == null ? void 0 : startupTelemetrySession.get(conversation == null ? void 0 : conversation.id);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=useStartupAttempt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useAtomValue","state","useSdkConsumer","useStartupAttempt","_useSdkConsumer","startupTelemetrySession","conversation","get","id"],"sources":["../../../src/startup-telemetry/useStartupAttempt.ts"],"sourcesContent":["import { useAtomValue } from 'jotai';\nimport { state } from '../conversation';\nimport { useSdkConsumer } from '../sdk-consumer';\n\nexport function useStartupAttempt() {\n const { startupTelemetrySession } = useSdkConsumer();\n const conversation = useAtomValue(state.conversation);\n return startupTelemetrySession?.get(conversation?.id);\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,OAAO;AACpC,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,cAAc,QAAQ,iBAAiB;AAEhD,OAAO,SAASC,iBAAiBA,CAAA,EAAG;EAClC,MAAAC,eAAA,GAAoCF,cAAc,CAAC,CAAC;IAA5CG,uBAAuB,GAAAD,eAAA,CAAvBC,uBAAuB;EAC/B,MAAMC,YAAY,GAAGN,YAAY,CAACC,KAAK,CAACK,YAAY,CAAC;EACrD,OAAOD,uBAAuB,oBAAvBA,uBAAuB,CAAEE,GAAG,CAACD,YAAY,oBAAZA,YAAY,CAAEE,EAAE,CAAC;AACvD","ignoreList":[]}
|
|
@@ -9,6 +9,8 @@ interface ChromaKeyProps extends React.HTMLAttributes<HTMLCanvasElement> {
|
|
|
9
9
|
background?: string | null;
|
|
10
10
|
children: React.ReactElement<React.VideoHTMLAttributes<HTMLVideoElement> & {
|
|
11
11
|
ref?: React.Ref<HTMLVideoElement>;
|
|
12
|
+
startupRenderSurface?: 'video' | 'canvas';
|
|
13
|
+
type?: 'agent' | 'user' | 'screen';
|
|
12
14
|
pip?: boolean;
|
|
13
15
|
pipFallback?: React.ReactNode;
|
|
14
16
|
onPiPEnter?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChromaKey.d.ts","sourceRoot":"","sources":["../../../../src/components/ChromaKey/ChromaKey.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChromaKey.d.ts","sourceRoot":"","sources":["../../../../src/components/ChromaKey/ChromaKey.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAS3D,UAAU,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC;IACtE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,YAAY,CAC1B,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;QAC5C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAClC,oBAAoB,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;QAC1C,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;QACnC,GAAG,CAAC,EAAE,OAAO,CAAC;QACd,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC9B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;QACvB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KACrC,CACF,CAAC;CACH;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qBA4K9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chroma-key.d.ts","sourceRoot":"","sources":["../../../../src/components/ChromaKey/chroma-key.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC;AAEzC,wBAAgB,SAAS,CACvB,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE;IACP,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,GACA,eAAe,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"chroma-key.d.ts","sourceRoot":"","sources":["../../../../src/components/ChromaKey/chroma-key.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC;AAEzC,wBAAgB,SAAS,CACvB,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE;IACP,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,GACA,eAAe,GAAG,IAAI,CA0HxB"}
|
|
@@ -3,7 +3,9 @@ import { type Store } from 'jotai/vanilla/store';
|
|
|
3
3
|
import { QueryClient } from '@tanstack/react-query';
|
|
4
4
|
import type { ToolsRegistry } from '../../hooks/useTools/model/types';
|
|
5
5
|
import type { IPersonaChatService } from '../../types/service';
|
|
6
|
+
import { type StartupTelemetryOptions } from '../../startup-telemetry/attempt';
|
|
6
7
|
export type LegendsPlatformProps = {
|
|
8
|
+
startupTelemetry?: StartupTelemetryOptions;
|
|
7
9
|
chatId: string;
|
|
8
10
|
namespace: string;
|
|
9
11
|
apiKey?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendsPlatform.d.ts","sourceRoot":"","sources":["../../../../src/components/LegendsPlatform/LegendsPlatform.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"LegendsPlatform.d.ts","sourceRoot":"","sources":["../../../../src/components/LegendsPlatform/LegendsPlatform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAuB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,iCAAiC,CAAC;AAEzC,MAAM,MAAM,oBAAoB,GAAG;IACjC,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAuF1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Video.d.ts","sourceRoot":"","sources":["../../../../src/components/Video/Video.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Video.d.ts","sourceRoot":"","sources":["../../../../src/components/Video/Video.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAcf,eAAO,MAAM,KAAK;;;;;;eATgF,MAChG,aACI;;;;;kBAO8D,MAAO,SACvE;0GAyFF,CAAC"}
|
|
@@ -3,6 +3,8 @@ export type FallbackProps = {
|
|
|
3
3
|
style?: React.CSSProperties;
|
|
4
4
|
};
|
|
5
5
|
export type VideoProps = {
|
|
6
|
+
/** Internal: canvas wrappers own the final presentation milestone. */
|
|
7
|
+
startupRenderSurface?: 'video' | 'canvas';
|
|
6
8
|
mirror?: boolean;
|
|
7
9
|
automirror?: boolean;
|
|
8
10
|
type: 'user' | 'agent' | 'screen';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/Video/types.ts"],"names":[],"m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,QAAQ,CAAC;IAClC,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;IAC9C,qCAAqC;IACrC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,qCAAqC;IACrC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACpC,2CAA2C;IAC3C,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC/B,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -4,6 +4,8 @@ interface VideoPostProcessorProps {
|
|
|
4
4
|
effects: VideoPostProcessorEffect[];
|
|
5
5
|
children: React.ReactElement<React.VideoHTMLAttributes<HTMLVideoElement> & {
|
|
6
6
|
ref: React.RefObject<HTMLVideoElement>;
|
|
7
|
+
startupRenderSurface?: 'video' | 'canvas';
|
|
8
|
+
type?: 'agent' | 'user' | 'screen';
|
|
7
9
|
}>;
|
|
8
10
|
}
|
|
9
11
|
export declare function VideoPostProcessor({ effects, children, }: VideoPostProcessorProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoPostProcessor.d.ts","sourceRoot":"","sources":["../../../../src/components/VideoPostProcessor/VideoPostProcessor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VideoPostProcessor.d.ts","sourceRoot":"","sources":["../../../../src/components/VideoPostProcessor/VideoPostProcessor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,KAAK,wBAAwB,GAAG,wBAAwB,CAAC;AAEzD,UAAU,uBAAuB;IAC/B,OAAO,EAAE,wBAAwB,EAAE,CAAC;IAEpC,QAAQ,EAAE,KAAK,CAAC,YAAY,CAC1B,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;QAC5C,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACvC,oBAAoB,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;QAC1C,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;KACpC,CACF,CAAC;CACH;AAED,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,QAAQ,GACT,EAAE,uBAAuB,qBAkEzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConversation.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useConversation/livekit/useConversation.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EAEvB,MAAM,UAAU,CAAC;AA6ClB,wBAAgB,eAAe,CAAC,EAC9B,QAAe,EACf,IAAI,EACJ,MAAM,EACN,mBAA2B,EAC3B,eAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,GACrB,EAAE,sBAAsB,GAAG,qBAAqB,
|
|
1
|
+
{"version":3,"file":"useConversation.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useConversation/livekit/useConversation.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EAEvB,MAAM,UAAU,CAAC;AA6ClB,wBAAgB,eAAe,CAAC,EAC9B,QAAe,EACf,IAAI,EACJ,MAAM,EACN,mBAA2B,EAC3B,eAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,GACrB,EAAE,sBAAsB,GAAG,qBAAqB,CA2mBhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateConversation.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCreateConversation/useCreateConversation.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"useCreateConversation.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCreateConversation/useCreateConversation.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAO5B,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2GAA2G;IAC3G,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,6FAA6F;IAC7F,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,0GAA0G;IAC1G,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,2BAA2B,CAuH7B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { StartupTelemetrySession } from '../startup-telemetry/attempt';
|
|
1
2
|
import type { ToolsRegistry } from '../hooks';
|
|
2
3
|
import type { IPersonaChatService } from '../types';
|
|
3
4
|
export interface ISdkConsumerContext {
|
|
5
|
+
startupTelemetrySession?: StartupTelemetrySession;
|
|
4
6
|
chatId: string;
|
|
5
7
|
namespace: string;
|
|
6
8
|
tools?: ToolsRegistry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/sdk-consumer/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/sdk-consumer/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,WAAW,mBAAmB;IAClC,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;CAC1C;AAED,eAAO,MAAM,kBAAkB,8CAI7B,CAAC;AAEH,wBAAgB,cAAc,wBAE7B"}
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -16,4 +16,6 @@ export * from './hooks/usePictureInPicture';
|
|
|
16
16
|
export * from './hooks/useMediaPermissions';
|
|
17
17
|
export * from './hooks/useTools';
|
|
18
18
|
export * from './conversation/types';
|
|
19
|
+
export { createStartupIntent, StartupAttempt, } from './startup-telemetry/attempt';
|
|
20
|
+
export type { StartupIntent, StartupReport, StartupTelemetryOptions, } from './startup-telemetry/attempt';
|
|
19
21
|
//# sourceMappingURL=sdk.d.ts.map
|
package/dist/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AAExB,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AAEjC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AAExB,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AAEjC,cAAc,sBAAsB,CAAC;AAErC,OAAO,EACL,mBAAmB,EACnB,cAAc,GACf,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,aAAa,EACb,aAAa,EACb,uBAAuB,GACxB,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** All elapsed times belong to one browser document's monotonic clock. */
|
|
2
|
+
export type StartupMilestone = 'attempt_started' | 'api_request' | 'api_response' | 'join_requested' | 'room_connected' | 'agent_joined' | 'track_subscribed' | 'first_frame' | 'terminal';
|
|
3
|
+
export type StartupOutcome = 'pending' | 'success' | 'error' | 'cancelled' | 'timeout' | 'unmeasurable';
|
|
4
|
+
export type StartupIntent = {
|
|
5
|
+
id: string;
|
|
6
|
+
startedAt: number;
|
|
7
|
+
timeOrigin: number;
|
|
8
|
+
};
|
|
9
|
+
export type StartupReport = {
|
|
10
|
+
attemptId: string;
|
|
11
|
+
chatId: string;
|
|
12
|
+
conversationId?: string;
|
|
13
|
+
milestone: StartupMilestone;
|
|
14
|
+
elapsedMs: number;
|
|
15
|
+
clientStartUnixMs: number;
|
|
16
|
+
outcome: StartupOutcome;
|
|
17
|
+
startBoundary: 'user_intent' | 'sdk_create';
|
|
18
|
+
method?: string;
|
|
19
|
+
application: string;
|
|
20
|
+
applicationVersion?: string;
|
|
21
|
+
entryCoverage: 'user_handler' | 'sdk_only';
|
|
22
|
+
measurementVersion: number;
|
|
23
|
+
};
|
|
24
|
+
export type StartupTelemetryOptions = {
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
intent?: StartupIntent;
|
|
27
|
+
attempt?: StartupAttempt;
|
|
28
|
+
application: string;
|
|
29
|
+
applicationVersion?: string;
|
|
30
|
+
entryCoverage?: 'user_handler' | 'sdk_only';
|
|
31
|
+
report?: (event: StartupReport) => void | Promise<unknown>;
|
|
32
|
+
};
|
|
33
|
+
export declare function createStartupIntent(): StartupIntent;
|
|
34
|
+
export declare class StartupAttempt {
|
|
35
|
+
private options;
|
|
36
|
+
private chatId;
|
|
37
|
+
private terminal;
|
|
38
|
+
private adoptedBySdk;
|
|
39
|
+
private seen;
|
|
40
|
+
private conversationId?;
|
|
41
|
+
private timeout?;
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly startedAt: number;
|
|
44
|
+
readonly startBoundary: 'user_intent' | 'sdk_create';
|
|
45
|
+
private visibilityChanged;
|
|
46
|
+
constructor(options: StartupTelemetryOptions, chatId: string, intent?: StartupIntent);
|
|
47
|
+
/** A pre-SDK terminal attempt must be adopted once, not counted again. */
|
|
48
|
+
claimForSdk(): boolean;
|
|
49
|
+
get completed(): boolean;
|
|
50
|
+
attachChat(chatId: string): void;
|
|
51
|
+
bind(conversationId: string): void;
|
|
52
|
+
mark(milestone: StartupMilestone, method?: string): void;
|
|
53
|
+
frame(method: string): void;
|
|
54
|
+
finish(outcome: Exclude<StartupOutcome, 'pending'>, method?: string): void;
|
|
55
|
+
private send;
|
|
56
|
+
}
|
|
57
|
+
export declare class StartupTelemetrySession {
|
|
58
|
+
private options;
|
|
59
|
+
private chatId;
|
|
60
|
+
private attempts;
|
|
61
|
+
private leases;
|
|
62
|
+
private active?;
|
|
63
|
+
private terminalAtCreation?;
|
|
64
|
+
private intentConsumed;
|
|
65
|
+
constructor(options: StartupTelemetryOptions, chatId: string);
|
|
66
|
+
start(): StartupAttempt | undefined;
|
|
67
|
+
bind(attempt: StartupAttempt | undefined, id: string): void;
|
|
68
|
+
get(id?: string): StartupAttempt | undefined;
|
|
69
|
+
release(attempt?: StartupAttempt): void;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=attempt.d.ts.map
|