vzcode 0.69.0 → 0.71.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.
@@ -206,60 +206,12 @@ function debounceSave() {
206
206
 
207
207
  // Subscribe to listen for modifications
208
208
  shareDBDoc.subscribe(() => {
209
- shareDBDoc.on('op', (op, source) => {
209
+ shareDBDoc.on('op', () => {
210
210
  if (shareDBDoc.data.isInteracting) {
211
211
  throttleSave();
212
212
  } else {
213
213
  debounceSave();
214
214
  }
215
-
216
- // if (
217
- // op !== null &&
218
- // op[0] == 'aiStreams' &&
219
- // source !== 'AIServer' &&
220
- // source !== 'AIAssist'
221
- // ) {
222
- // //This is an insert operation (a new request)
223
- // if (
224
- // op[op.length - 1]['i'] !== undefined &&
225
- // op[op.length - 1]['i']['AIStreamStatus'] !==
226
- // undefined
227
- // ) {
228
- // const input =
229
- // op[op.length - 1]['i']['AIStreamStatus'];
230
-
231
- // generateAIResponse({
232
- // inputText: input.text,
233
- // insertionCursor: input.insertionCursor,
234
- // shareDBDoc: shareDBDoc,
235
- // streamId: op[op.length - 2],
236
- // fileId: input.fileId,
237
- // });
238
-
239
- // const confirmStartOperation = replaceOp(
240
- // [
241
- // ...op.filter(
242
- // (value) => typeof value === 'string',
243
- // ),
244
- // 'AIStreamStatus',
245
- // 'serverIsRunning',
246
- // ],
247
- // true,
248
- // true,
249
- // );
250
-
251
- // shareDBDoc.submitOp(confirmStartOperation, {
252
- // source: 'AIServer',
253
- // });
254
- // }
255
- // if (
256
- // op[op.length - 1]['r'] !== null &&
257
- // op[op.length - 2] == 'clientWantsToStart'
258
- // ) {
259
- // //client wants to halt generation
260
- // haltGeneration(op[1]);
261
- // }
262
- // }
263
215
  });
264
216
  });
265
217
 
package/src/types.ts CHANGED
@@ -76,6 +76,10 @@ export type ShareDBDoc<T> = {
76
76
  event: string,
77
77
  callback: (op: JSONOp, source: boolean) => void,
78
78
  ) => void;
79
+ removeListener: (
80
+ event: string,
81
+ callback: (op: JSONOp, source: boolean) => void,
82
+ ) => void;
79
83
  submitOp: (
80
84
  op: JSONOp,
81
85
  options?: any,
@@ -177,3 +181,9 @@ export type PresenceId = string;
177
181
 
178
182
  // A user name for display in presence.
179
183
  export type Username = string;
184
+
185
+ // The type of a convenience function called `submitOperation`,
186
+ // to submit an operation to ShareDB.
187
+ export type SubmitOperation = (
188
+ next: (content: VZCodeContent) => VZCodeContent,
189
+ ) => void;