r1-create 1.0.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 +201 -0
- package/README.md +245 -0
- package/dist/hardware/index.d.ts +87 -0
- package/dist/hardware/index.d.ts.map +1 -0
- package/dist/hardware/index.js +172 -0
- package/dist/hardware/index.js.map +1 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +196 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/index.d.ts +100 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +177 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/media/index.d.ts +176 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/index.js +396 -0
- package/dist/media/index.js.map +1 -0
- package/dist/storage/index.d.ts +115 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +179 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/types/index.d.ts +66 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/index.d.ts +170 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +311 -0
- package/dist/ui/index.js.map +1 -0
- package/examples/README.md +64 -0
- package/examples/basic/index.html +157 -0
- package/package.json +49 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* LLM and messaging module for R1 AI integration
|
|
4
|
+
* Provides structured messaging and LLM interaction capabilities
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.llmHelpers = exports.messaging = exports.LLMHelpers = exports.R1Messaging = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* LLM and messaging API for R1 interactions
|
|
10
|
+
*/
|
|
11
|
+
class R1Messaging {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.messageHandlers = new Set();
|
|
14
|
+
this.isInitialized = false;
|
|
15
|
+
this.initializeMessageHandler();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Send a simple message to the server
|
|
19
|
+
* @param message Message text
|
|
20
|
+
* @param options Message options
|
|
21
|
+
*/
|
|
22
|
+
async sendMessage(message, options = {}) {
|
|
23
|
+
const payload = {
|
|
24
|
+
message,
|
|
25
|
+
...options
|
|
26
|
+
};
|
|
27
|
+
if (typeof PluginMessageHandler !== 'undefined') {
|
|
28
|
+
PluginMessageHandler.postMessage(JSON.stringify(payload));
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
throw new Error('PluginMessageHandler not available. Make sure you are running in R1 environment.');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Send a message and get LLM response
|
|
36
|
+
* @param message Message text
|
|
37
|
+
* @param options LLM options
|
|
38
|
+
*/
|
|
39
|
+
async askLLM(message, options = {}) {
|
|
40
|
+
await this.sendMessage(message, {
|
|
41
|
+
useLLM: true,
|
|
42
|
+
...options
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Ask LLM to speak response through R1 speaker
|
|
47
|
+
* @param message Message text
|
|
48
|
+
* @param saveToJournal Whether to save interaction to journal
|
|
49
|
+
*/
|
|
50
|
+
async askLLMSpeak(message, saveToJournal = false) {
|
|
51
|
+
await this.askLLM(message, {
|
|
52
|
+
wantsR1Response: true,
|
|
53
|
+
wantsJournalEntry: saveToJournal
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Ask LLM for JSON structured response
|
|
58
|
+
* @param message Message text (should specify desired JSON format)
|
|
59
|
+
* @param options LLM options
|
|
60
|
+
*/
|
|
61
|
+
async askLLMJSON(message, options = {}) {
|
|
62
|
+
const jsonMessage = message.includes('JSON') ? message :
|
|
63
|
+
`${message}. Please respond with a valid JSON object.`;
|
|
64
|
+
await this.askLLM(jsonMessage, options);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Add message handler for incoming responses
|
|
68
|
+
* @param handler Function to handle incoming messages
|
|
69
|
+
*/
|
|
70
|
+
onMessage(handler) {
|
|
71
|
+
this.messageHandlers.add(handler);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Remove message handler
|
|
75
|
+
* @param handler Handler function to remove
|
|
76
|
+
*/
|
|
77
|
+
offMessage(handler) {
|
|
78
|
+
this.messageHandlers.delete(handler);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Remove all message handlers
|
|
82
|
+
*/
|
|
83
|
+
removeAllHandlers() {
|
|
84
|
+
this.messageHandlers.clear();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Close the current plugin/webview
|
|
88
|
+
*/
|
|
89
|
+
closePlugin() {
|
|
90
|
+
if (typeof closeWebView !== 'undefined') {
|
|
91
|
+
closeWebView.postMessage('');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
initializeMessageHandler() {
|
|
95
|
+
if (this.isInitialized || typeof window === 'undefined')
|
|
96
|
+
return;
|
|
97
|
+
// Set up global message handler
|
|
98
|
+
window.onPluginMessage = (data) => {
|
|
99
|
+
try {
|
|
100
|
+
// Try to parse data.data as JSON if it exists
|
|
101
|
+
let parsedData = undefined;
|
|
102
|
+
if (data.data) {
|
|
103
|
+
try {
|
|
104
|
+
parsedData = JSON.parse(data.data);
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
// data.data is not valid JSON, keep as string
|
|
108
|
+
parsedData = data.data;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Call all registered handlers
|
|
112
|
+
const enhancedData = { ...data, parsedData };
|
|
113
|
+
this.messageHandlers.forEach(handler => {
|
|
114
|
+
try {
|
|
115
|
+
handler(enhancedData);
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
console.error('Error in message handler:', error);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
console.error('Error processing plugin message:', error);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
this.isInitialized = true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.R1Messaging = R1Messaging;
|
|
130
|
+
/**
|
|
131
|
+
* Convenient helper functions for common LLM interactions
|
|
132
|
+
*/
|
|
133
|
+
class LLMHelpers {
|
|
134
|
+
constructor(messaging) {
|
|
135
|
+
this.messaging = messaging;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Ask LLM about user memories/context
|
|
139
|
+
*/
|
|
140
|
+
async getUserMemories() {
|
|
141
|
+
await this.messaging.askLLMJSON("Tell me what you know about me. Return only a JSON message formatted as {'facts': ['fact1', 'fact2', ...]}");
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Ask LLM to analyze an image or data
|
|
145
|
+
* @param prompt Analysis prompt
|
|
146
|
+
* @param data Optional data to analyze
|
|
147
|
+
*/
|
|
148
|
+
async analyzeData(prompt, data) {
|
|
149
|
+
let message = prompt;
|
|
150
|
+
if (data) {
|
|
151
|
+
message += ` Data: ${JSON.stringify(data)}`;
|
|
152
|
+
}
|
|
153
|
+
message += ' Please respond with a JSON analysis.';
|
|
154
|
+
await this.messaging.askLLMJSON(message);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Ask LLM to perform a task and speak the result
|
|
158
|
+
* @param task Task description
|
|
159
|
+
* @param saveToJournal Whether to save to journal
|
|
160
|
+
*/
|
|
161
|
+
async performTask(task, saveToJournal = true) {
|
|
162
|
+
await this.messaging.askLLMSpeak(task, saveToJournal);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get LLM suggestions for user interface
|
|
166
|
+
* @param context Current UI context
|
|
167
|
+
*/
|
|
168
|
+
async getUISuggestions(context) {
|
|
169
|
+
await this.messaging.askLLMJSON(`Given this UI context: "${context}", provide suggestions for user actions. ` +
|
|
170
|
+
`Respond with JSON format: {"suggestions": [{"action": "action_name", "description": "description"}]}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.LLMHelpers = LLMHelpers;
|
|
174
|
+
// Export singleton instances
|
|
175
|
+
exports.messaging = new R1Messaging();
|
|
176
|
+
exports.llmHelpers = new LLMHelpers(exports.messaging);
|
|
177
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/llm/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAkBH;;GAEG;AACH,MAAa,WAAW;IAItB;QAHQ,oBAAe,GAAwB,IAAI,GAAG,EAAE,CAAC;QACjD,kBAAa,GAAG,KAAK,CAAC;QAG5B,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAW,CAAC,OAAe,EAAE,UAA0B,EAAE;QAC7D,MAAM,OAAO,GAAkB;YAC7B,OAAO;YACP,GAAG,OAAO;SACX,CAAC;QAEF,IAAI,OAAO,oBAAoB,KAAK,WAAW,EAAE,CAAC;YAChD,oBAAoB,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5D,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;QACtG,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,UAAsB,EAAE;QACpD,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;YAC9B,MAAM,EAAE,IAAI;YACZ,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAW,CAAC,OAAe,EAAE,gBAAyB,KAAK;QAC/D,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACzB,eAA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,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACxD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,gBAAgB,CAAC,OAAe;QACpC,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,CAC7B,2BAA2B,OAAO,2CAA2C;YAC7E,sGAAsG,CACvG,CAAC;IACJ,CAAC;CACF;AA9CD,gCA8CC;AAED,6BAA6B;AAChB,QAAA,SAAS,GAAG,IAAI,WAAW,EAAE,CAAC;AAC9B,QAAA,UAAU,GAAG,IAAI,UAAU,CAAC,iBAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media API module for R1 device
|
|
3
|
+
* Provides access to camera, microphone, and speaker using standard web APIs
|
|
4
|
+
* Optimized for R1 hardware limitations and mobile performance
|
|
5
|
+
*/
|
|
6
|
+
export interface MediaDeviceInfo {
|
|
7
|
+
deviceId: string;
|
|
8
|
+
kind: 'audioinput' | 'audiooutput' | 'videoinput';
|
|
9
|
+
label: string;
|
|
10
|
+
groupId: string;
|
|
11
|
+
}
|
|
12
|
+
export interface AudioConfig {
|
|
13
|
+
sampleRate?: number;
|
|
14
|
+
channelCount?: number;
|
|
15
|
+
echoCancellation?: boolean;
|
|
16
|
+
noiseSuppression?: boolean;
|
|
17
|
+
autoGainControl?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface VideoConfig {
|
|
20
|
+
width?: number;
|
|
21
|
+
height?: number;
|
|
22
|
+
frameRate?: number;
|
|
23
|
+
facingMode?: 'user' | 'environment';
|
|
24
|
+
}
|
|
25
|
+
export interface RecordingOptions {
|
|
26
|
+
audio?: boolean | AudioConfig;
|
|
27
|
+
video?: boolean | VideoConfig;
|
|
28
|
+
mimeType?: string;
|
|
29
|
+
audioBitsPerSecond?: number;
|
|
30
|
+
videoBitsPerSecond?: number;
|
|
31
|
+
}
|
|
32
|
+
export type RecordingState = 'inactive' | 'recording' | 'paused';
|
|
33
|
+
/**
|
|
34
|
+
* Camera API for R1 device
|
|
35
|
+
*/
|
|
36
|
+
export declare class CameraAPI {
|
|
37
|
+
private stream;
|
|
38
|
+
private videoElement;
|
|
39
|
+
/**
|
|
40
|
+
* Check if camera is available
|
|
41
|
+
*/
|
|
42
|
+
isAvailable(): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Start camera stream
|
|
45
|
+
* @param config Video configuration
|
|
46
|
+
*/
|
|
47
|
+
start(config?: VideoConfig): Promise<MediaStream>;
|
|
48
|
+
/**
|
|
49
|
+
* Stop camera stream
|
|
50
|
+
*/
|
|
51
|
+
stop(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Get camera stream
|
|
54
|
+
*/
|
|
55
|
+
getStream(): MediaStream | null;
|
|
56
|
+
/**
|
|
57
|
+
* Create video element with stream
|
|
58
|
+
* @param autoplay Whether to autoplay video
|
|
59
|
+
* @param muted Whether to mute video
|
|
60
|
+
*/
|
|
61
|
+
createVideoElement(autoplay?: boolean, muted?: boolean): HTMLVideoElement;
|
|
62
|
+
/**
|
|
63
|
+
* Capture photo from camera stream
|
|
64
|
+
* @param width Image width (default: 240)
|
|
65
|
+
* @param height Image height (default: 282)
|
|
66
|
+
*/
|
|
67
|
+
capturePhoto(width?: number, height?: number): string | null;
|
|
68
|
+
/**
|
|
69
|
+
* Switch camera (front/back)
|
|
70
|
+
*/
|
|
71
|
+
switchCamera(): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Microphone API for R1 device
|
|
75
|
+
*/
|
|
76
|
+
export declare class MicrophoneAPI {
|
|
77
|
+
private stream;
|
|
78
|
+
private mediaRecorder;
|
|
79
|
+
private recordedChunks;
|
|
80
|
+
/**
|
|
81
|
+
* Check if microphone is available
|
|
82
|
+
*/
|
|
83
|
+
isAvailable(): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Start microphone stream
|
|
86
|
+
* @param config Audio configuration
|
|
87
|
+
*/
|
|
88
|
+
start(config?: AudioConfig): Promise<MediaStream>;
|
|
89
|
+
/**
|
|
90
|
+
* Stop microphone stream
|
|
91
|
+
*/
|
|
92
|
+
stop(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Start recording audio
|
|
95
|
+
* @param options Recording options
|
|
96
|
+
*/
|
|
97
|
+
startRecording(options?: RecordingOptions): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Stop recording and get audio blob
|
|
100
|
+
*/
|
|
101
|
+
stopRecording(): Promise<Blob>;
|
|
102
|
+
/**
|
|
103
|
+
* Get current recording state
|
|
104
|
+
*/
|
|
105
|
+
getRecordingState(): RecordingState;
|
|
106
|
+
/**
|
|
107
|
+
* Get audio stream
|
|
108
|
+
*/
|
|
109
|
+
getStream(): MediaStream | null;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Speaker API for R1 device
|
|
113
|
+
*/
|
|
114
|
+
export declare class SpeakerAPI {
|
|
115
|
+
private audioContext;
|
|
116
|
+
private currentAudio;
|
|
117
|
+
/**
|
|
118
|
+
* Initialize audio context
|
|
119
|
+
*/
|
|
120
|
+
private initializeAudioContext;
|
|
121
|
+
/**
|
|
122
|
+
* Play audio from URL or blob
|
|
123
|
+
* @param source Audio source (URL, blob, or base64)
|
|
124
|
+
* @param volume Volume level (0-1)
|
|
125
|
+
*/
|
|
126
|
+
play(source: string | Blob, volume?: number): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Stop current audio playback
|
|
129
|
+
*/
|
|
130
|
+
stop(): void;
|
|
131
|
+
/**
|
|
132
|
+
* Set volume for current audio
|
|
133
|
+
* @param volume Volume level (0-1)
|
|
134
|
+
*/
|
|
135
|
+
setVolume(volume: number): void;
|
|
136
|
+
/**
|
|
137
|
+
* Generate and play tone
|
|
138
|
+
* @param frequency Frequency in Hz
|
|
139
|
+
* @param duration Duration in milliseconds
|
|
140
|
+
* @param volume Volume level (0-1)
|
|
141
|
+
*/
|
|
142
|
+
playTone(frequency: number, duration: number, volume?: number): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Check if audio is currently playing
|
|
145
|
+
*/
|
|
146
|
+
isPlaying(): boolean;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Media device utilities
|
|
150
|
+
*/
|
|
151
|
+
export declare class MediaUtils {
|
|
152
|
+
/**
|
|
153
|
+
* Get available media devices
|
|
154
|
+
*/
|
|
155
|
+
static getDevices(): Promise<MediaDeviceInfo[]>;
|
|
156
|
+
/**
|
|
157
|
+
* Check if specific media type is supported
|
|
158
|
+
* @param type Media type to check
|
|
159
|
+
*/
|
|
160
|
+
static isSupported(type: 'camera' | 'microphone' | 'speaker'): Promise<boolean>;
|
|
161
|
+
/**
|
|
162
|
+
* Convert blob to base64 string
|
|
163
|
+
* @param blob Blob to convert
|
|
164
|
+
*/
|
|
165
|
+
static blobToBase64(blob: Blob): Promise<string>;
|
|
166
|
+
/**
|
|
167
|
+
* Convert base64 string to blob
|
|
168
|
+
* @param base64 Base64 string
|
|
169
|
+
* @param mimeType MIME type
|
|
170
|
+
*/
|
|
171
|
+
static base64ToBlob(base64: string, mimeType: string): Blob;
|
|
172
|
+
}
|
|
173
|
+
export declare const camera: CameraAPI;
|
|
174
|
+
export declare const microphone: MicrophoneAPI;
|
|
175
|
+
export declare const speaker: SpeakerAPI;
|
|
176
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/media/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,YAAY,GAAG,aAAa,GAAG,YAAY,CAAC;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,C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