guideai-app 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/GuideAI.js +1 -1
  2. package/GuideAI.js.map +1 -1
  3. package/README.md +39 -1
  4. package/dist/GuideAI.js +1 -1
  5. package/dist/GuideAI.js.map +1 -1
  6. package/dist/components/TextInput.d.ts +8 -0
  7. package/dist/components/TranscriptBox.d.ts +17 -0
  8. package/dist/index.d.ts +2 -0
  9. package/dist/metric/event-listner.d.ts +113 -0
  10. package/dist/metric/index.d.ts +4 -0
  11. package/dist/metric/metadata-tracker.d.ts +33 -0
  12. package/dist/styles/GuideAI.styles.d.ts +1 -1
  13. package/dist/types/GuideAI.types.d.ts +18 -0
  14. package/dist/types/metadata.types.d.ts +46 -0
  15. package/dist/utils/api.d.ts +4 -0
  16. package/dist/utils/constants.d.ts +1 -1
  17. package/dist/utils/messageStorage.d.ts +1 -1
  18. package/metadata-tracking-example.md +324 -0
  19. package/package.json +1 -1
  20. package/text-input-usage.md +321 -0
  21. package/transcript-toggle-usage.md +267 -0
  22. package/dist/GuideAI.js.LICENSE.txt +0 -16
  23. package/dist/components/Styles.d.ts +0 -3
  24. package/dist/components/Styles.js +0 -6
  25. package/dist/components/Styles.js.map +0 -1
  26. package/dist/hooks/useConversation.d.ts +0 -11
  27. package/dist/hooks/useConversation.js +0 -286
  28. package/dist/hooks/useConversation.js.map +0 -1
  29. package/dist/hooks/useRecording.d.ts +0 -12
  30. package/dist/hooks/useRecording.js +0 -362
  31. package/dist/hooks/useRecording.js.map +0 -1
  32. package/dist/index.esm.js +0 -1
  33. package/dist/index.esm.js.map +0 -1
  34. package/dist/index.js +0 -1
  35. package/dist/index.js.map +0 -1
  36. package/dist/messageStorageUtils.d.ts +0 -26
  37. package/dist/types/index.d.ts +0 -20
  38. package/dist/types/index.js +0 -2
  39. package/dist/types/index.js.map +0 -1
  40. package/dist/types/workflow.d.ts +0 -24
  41. package/dist/types.d.ts +0 -1
  42. package/dist/types.js +0 -2
  43. package/dist/types.js.map +0 -1
  44. package/dist/utils/api-services.d.ts +0 -5
  45. package/dist/utils/api-services.js +0 -203
  46. package/dist/utils/api-services.js.map +0 -1
  47. package/dist/utils/dom-interaction.d.ts +0 -2
  48. package/dist/utils/dom-interaction.js +0 -195
  49. package/dist/utils/dom-interaction.js.map +0 -1
  50. package/dist/utils/dom.d.ts +0 -1
  51. package/dist/utils/messageStorageUtils.d.ts +0 -26
  52. package/dist/utils/react-hooks.d.ts +0 -9
  53. package/dist/utils/react-hooks.js +0 -19
  54. package/dist/utils/react-hooks.js.map +0 -1
  55. package/dist/utils/storage.d.ts +0 -14
  56. package/dist/utils/storage.js +0 -27
  57. package/dist/utils/storage.js.map +0 -1
  58. package/dist/utils/webrtc.d.ts +0 -3
  59. package/dist/utils/webrtc.js +0 -135
  60. package/dist/utils/webrtc.js.map +0 -1
  61. package/dist/utils/workflowUtils.d.ts +0 -17
  62. package/dist/utils/workflowValidator.d.ts +0 -17
  63. package/dist/workflows/certificateWorkflow.d.ts +0 -7
  64. package/dist/workflows/index.d.ts +0 -6
  65. package/todo.md +0 -2
@@ -1,135 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- export var initializeWebRTC = function (audioStream, token, audioElementRef, peerConnectionRef, dataChannelRef, onMessage, onOpen) { return __awaiter(void 0, void 0, void 0, function () {
38
- var pc_1, dc, offer, baseUrl, model, sdpResponse, errorText, answerSdp, answer, error_1;
39
- return __generator(this, function (_a) {
40
- switch (_a.label) {
41
- case 0:
42
- _a.trys.push([0, 8, , 9]);
43
- if (!token) {
44
- console.error('Cannot initialize WebRTC without a valid token');
45
- return [2 /*return*/, false];
46
- }
47
- pc_1 = new RTCPeerConnection();
48
- peerConnectionRef.current = pc_1;
49
- audioStream.getAudioTracks().forEach(function (track) {
50
- pc_1.addTrack(track, audioStream);
51
- });
52
- if (!audioElementRef.current) {
53
- console.error('Audio element ref is not set - responses won\'t be audible');
54
- }
55
- pc_1.ontrack = function (e) {
56
- if (audioElementRef.current && e.track.kind === 'audio') {
57
- var stream = new MediaStream([e.track]);
58
- audioElementRef.current.srcObject = stream;
59
- }
60
- };
61
- dc = pc_1.createDataChannel('oai-events');
62
- dataChannelRef.current = dc;
63
- dc.onopen = function () {
64
- console.log('Data channel opened');
65
- if (onOpen) {
66
- onOpen();
67
- }
68
- };
69
- dc.onmessage = function (e) {
70
- try {
71
- var message = JSON.parse(e.data);
72
- onMessage(message);
73
- }
74
- catch (error) {
75
- console.error('Error handling WebRTC message:', error);
76
- }
77
- };
78
- return [4 /*yield*/, pc_1.createOffer()];
79
- case 1:
80
- offer = _a.sent();
81
- return [4 /*yield*/, pc_1.setLocalDescription(offer)];
82
- case 2:
83
- _a.sent();
84
- if (!pc_1.localDescription || !pc_1.localDescription.sdp) {
85
- throw new Error('Failed to create local SDP offer');
86
- }
87
- baseUrl = 'https://api.openai.com/v1/realtime';
88
- model = "gpt-4o-realtime-preview-2024-12-17";
89
- return [4 /*yield*/, fetch("".concat(baseUrl, "?model=").concat(model), {
90
- method: 'POST',
91
- body: pc_1.localDescription.sdp,
92
- headers: {
93
- Authorization: "Bearer ".concat(token),
94
- 'Content-Type': 'application/sdp'
95
- },
96
- })];
97
- case 3:
98
- sdpResponse = _a.sent();
99
- if (!!sdpResponse.ok) return [3 /*break*/, 5];
100
- return [4 /*yield*/, sdpResponse.text().catch(function () { return 'No error details available'; })];
101
- case 4:
102
- errorText = _a.sent();
103
- console.error('WebRTC connection failed with status:', sdpResponse.status);
104
- console.error('Error details:', errorText);
105
- throw new Error("Failed to connect to OpenAI WebRTC: ".concat(sdpResponse.status, " - ").concat(errorText));
106
- case 5: return [4 /*yield*/, sdpResponse.text()];
107
- case 6:
108
- answerSdp = _a.sent();
109
- answer = {
110
- type: 'answer',
111
- sdp: answerSdp,
112
- };
113
- return [4 /*yield*/, pc_1.setRemoteDescription(answer)];
114
- case 7:
115
- _a.sent();
116
- return [2 /*return*/, true];
117
- case 8:
118
- error_1 = _a.sent();
119
- console.error('Error initializing WebRTC:', error_1);
120
- return [2 /*return*/, false];
121
- case 9: return [2 /*return*/];
122
- }
123
- });
124
- }); };
125
- export var sendMessage = function (dataChannel, message) {
126
- if ((dataChannel === null || dataChannel === void 0 ? void 0 : dataChannel.readyState) === 'open') {
127
- dataChannel.send(JSON.stringify(message));
128
- return true;
129
- }
130
- else {
131
- console.error('Data channel not open, cannot send message');
132
- return false;
133
- }
134
- };
135
- //# sourceMappingURL=webrtc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webrtc.js","sourceRoot":"","sources":["../../src/utils/webrtc.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAC9B,WAAwB,EACxB,KAAa,EACb,eAAkD,EAClD,iBAAmE,EACnE,cAA6D,EAC7D,SAAiC,EACjC,MAAmB;;;;;;gBAGjB,IAAI,CAAC,KAAK,EAAE,CAAC;oBACX,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;oBAChE,sBAAO,KAAK,EAAC;gBACf,CAAC;gBAEK,OAAK,IAAI,iBAAiB,EAAE,CAAC;gBACnC,iBAAiB,CAAC,OAAO,GAAG,IAAE,CAAC;gBAE/B,WAAW,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,UAAA,KAAK;oBACxC,IAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;gBAClC,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;oBAC7B,OAAO,CAAC,KAAK,CAAC,4DAA4D,CAAC,CAAC;gBAC9E,CAAC;gBAED,IAAE,CAAC,OAA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AAE,CAAC;QACvC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAC5D,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- import { Workflow, WorkflowStep } from '../types/workflow';
2
- /**
3
- * Find workflow that matches user input trigger phrases
4
- */
5
- export declare const findWorkflowByTrigger: (userInput: string, workflows: Workflow[]) => Workflow | null;
6
- /**
7
- * Get the next step in a workflow based on current step and user response
8
- */
9
- export declare const getNextStep: (workflow: Workflow, currentStepId: string, userResponse: string) => WorkflowStep | null;
10
- /**
11
- * Get the first step of a workflow
12
- */
13
- export declare const getFirstStep: (workflow: Workflow) => WorkflowStep | null;
14
- /**
15
- * Check if a step is the final step (has no next_step options)
16
- */
17
- export declare const isFinalStep: (step: WorkflowStep) => boolean;
@@ -1,17 +0,0 @@
1
- import { Workflow, WorkflowStep } from '../types/workflow';
2
- /**
3
- * Find workflow that matches user input trigger phrases
4
- */
5
- export declare const findWorkflowByTrigger: (userInput: string, workflows: Workflow[]) => Workflow | null;
6
- /**
7
- * Get the next step in a workflow based on current step and user response
8
- */
9
- export declare const getNextStep: (workflow: Workflow, currentStepId: string, userResponse: string) => WorkflowStep | null;
10
- /**
11
- * Get the first step of a workflow
12
- */
13
- export declare const getFirstStep: (workflow: Workflow) => WorkflowStep | null;
14
- /**
15
- * Check if a step is the final step (has no next_step options)
16
- */
17
- export declare const isFinalStep: (step: WorkflowStep) => boolean;
@@ -1,7 +0,0 @@
1
- import { Workflow } from '../types/workflow';
2
- /**
3
- * Sample workflow: Send Certificate for Insured
4
- * Based on the example from the workflow system PRD
5
- * This serves as a reference example for workflow structure
6
- */
7
- export declare const certificateWorkflow: Workflow;
@@ -1,6 +0,0 @@
1
- /**
2
- * Workflows index - exports workflow types and reference examples
3
- * Note: Actual workflows will be loaded dynamically from the backend
4
- */
5
- export { certificateWorkflow } from './certificateWorkflow';
6
- export type { Workflow, WorkflowStep, WorkflowOption } from '../types/workflow';
package/todo.md DELETED
@@ -1,2 +0,0 @@
1
- output_audio_buffer.completed - find new way to track end of speech
2
- use workflows from site, pull selectors instead of using from prompt