@ravi-os/sdk 0.2.1 → 0.260519.2
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/README.md +338 -80
- package/dist/client.d.ts +184 -18
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +208 -42
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/schemas.d.ts +704 -104
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +784 -157
- package/dist/schemas.js.map +1 -1
- package/dist/streaming.d.ts +22 -0
- package/dist/streaming.d.ts.map +1 -1
- package/dist/streaming.js +6 -0
- package/dist/streaming.js.map +1 -1
- package/dist/types.d.ts +250 -39
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -257,6 +257,82 @@ export class RaviClient {
|
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
259
|
};
|
|
260
|
+
chats = {
|
|
261
|
+
/** List recent canonical chats */
|
|
262
|
+
list: async (options) => {
|
|
263
|
+
return this.transport.call({
|
|
264
|
+
groupSegments: ["chats"],
|
|
265
|
+
command: "list",
|
|
266
|
+
body: { ...(options ?? {}) },
|
|
267
|
+
});
|
|
268
|
+
},
|
|
269
|
+
lists: {
|
|
270
|
+
/** Add a chat to a reading list */
|
|
271
|
+
add: async (list, chat, options) => {
|
|
272
|
+
return this.transport.call({
|
|
273
|
+
groupSegments: ["chats", "lists"],
|
|
274
|
+
command: "add",
|
|
275
|
+
body: { list, chat, ...(options ?? {}) },
|
|
276
|
+
});
|
|
277
|
+
},
|
|
278
|
+
/** Create or restore a chat reading list */
|
|
279
|
+
create: async (name, options) => {
|
|
280
|
+
return this.transport.call({
|
|
281
|
+
groupSegments: ["chats", "lists"],
|
|
282
|
+
command: "create",
|
|
283
|
+
body: { name, ...(options ?? {}) },
|
|
284
|
+
});
|
|
285
|
+
},
|
|
286
|
+
/** Read what changed in a chat since this list reader cursor */
|
|
287
|
+
delta: async (list, chat, options) => {
|
|
288
|
+
return this.transport.call({
|
|
289
|
+
groupSegments: ["chats", "lists"],
|
|
290
|
+
command: "delta",
|
|
291
|
+
body: { list, chat, ...(options ?? {}) },
|
|
292
|
+
});
|
|
293
|
+
},
|
|
294
|
+
/** List chat reading lists */
|
|
295
|
+
list: async (options) => {
|
|
296
|
+
return this.transport.call({
|
|
297
|
+
groupSegments: ["chats", "lists"],
|
|
298
|
+
command: "list",
|
|
299
|
+
body: { ...(options ?? {}) },
|
|
300
|
+
});
|
|
301
|
+
},
|
|
302
|
+
/** Explicitly advance one reading-list cursor */
|
|
303
|
+
markRead: async (list, chat, options) => {
|
|
304
|
+
return this.transport.call({
|
|
305
|
+
groupSegments: ["chats", "lists"],
|
|
306
|
+
command: "mark-read",
|
|
307
|
+
body: { list, chat, ...(options ?? {}) },
|
|
308
|
+
});
|
|
309
|
+
},
|
|
310
|
+
/** List chats in a reading list with unread counts */
|
|
311
|
+
members: async (list, options) => {
|
|
312
|
+
return this.transport.call({
|
|
313
|
+
groupSegments: ["chats", "lists"],
|
|
314
|
+
command: "members",
|
|
315
|
+
body: { list, ...(options ?? {}) },
|
|
316
|
+
});
|
|
317
|
+
},
|
|
318
|
+
/** Remove a chat from a reading list without deleting cursor history */
|
|
319
|
+
remove: async (list, chat, options) => {
|
|
320
|
+
return this.transport.call({
|
|
321
|
+
groupSegments: ["chats", "lists"],
|
|
322
|
+
command: "remove",
|
|
323
|
+
body: { list, chat, ...(options ?? {}) },
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
/** Read messages from one chat */
|
|
328
|
+
read: async (chat, options) => {
|
|
329
|
+
return this.transport.call({
|
|
330
|
+
groupSegments: ["chats"],
|
|
331
|
+
command: "read",
|
|
332
|
+
body: { chat, ...(options ?? {}) },
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
};
|
|
260
336
|
commands = {
|
|
261
337
|
/** List Ravi commands */
|
|
262
338
|
list: async (options) => {
|
|
@@ -324,6 +400,14 @@ export class RaviClient {
|
|
|
324
400
|
body: { contact, mode, ...(options ?? {}) },
|
|
325
401
|
});
|
|
326
402
|
},
|
|
403
|
+
/** Backfill canonical contacts from captured chats */
|
|
404
|
+
backfill: async (options) => {
|
|
405
|
+
return this.transport.call({
|
|
406
|
+
groupSegments: ["contacts"],
|
|
407
|
+
command: "backfill",
|
|
408
|
+
body: { ...(options ?? {}) },
|
|
409
|
+
});
|
|
410
|
+
},
|
|
327
411
|
/** Block a contact */
|
|
328
412
|
block: async (contact) => {
|
|
329
413
|
return this.transport.call({
|
|
@@ -364,38 +448,6 @@ export class RaviClient {
|
|
|
364
448
|
body: { contact },
|
|
365
449
|
});
|
|
366
450
|
},
|
|
367
|
-
/** Set a contact's tag in a specific group */
|
|
368
|
-
groupTag: async (contact, group, tag) => {
|
|
369
|
-
return this.transport.call({
|
|
370
|
-
groupSegments: ["contacts"],
|
|
371
|
-
command: "group-tag",
|
|
372
|
-
body: { contact, group, tag },
|
|
373
|
-
});
|
|
374
|
-
},
|
|
375
|
-
/** Remove a contact's tag from a specific group */
|
|
376
|
-
groupUntag: async (contact, group) => {
|
|
377
|
-
return this.transport.call({
|
|
378
|
-
groupSegments: ["contacts"],
|
|
379
|
-
command: "group-untag",
|
|
380
|
-
body: { contact, group },
|
|
381
|
-
});
|
|
382
|
-
},
|
|
383
|
-
/** Add an identity to a contact (legacy alias for link) */
|
|
384
|
-
identityAdd: async (contact, platform, value) => {
|
|
385
|
-
return this.transport.call({
|
|
386
|
-
groupSegments: ["contacts"],
|
|
387
|
-
command: "identity-add",
|
|
388
|
-
body: { contact, platform, value },
|
|
389
|
-
});
|
|
390
|
-
},
|
|
391
|
-
/** Remove an identity (legacy alias for unlink) */
|
|
392
|
-
identityRemove: async (platform, value) => {
|
|
393
|
-
return this.transport.call({
|
|
394
|
-
groupSegments: ["contacts"],
|
|
395
|
-
command: "identity-remove",
|
|
396
|
-
body: { platform, value },
|
|
397
|
-
});
|
|
398
|
-
},
|
|
399
451
|
/** Show contact details with all identities */
|
|
400
452
|
info: async (contact) => {
|
|
401
453
|
return this.transport.call({
|
|
@@ -2681,6 +2733,56 @@ export class RaviClient {
|
|
|
2681
2733
|
});
|
|
2682
2734
|
}
|
|
2683
2735
|
};
|
|
2736
|
+
tagRules = {
|
|
2737
|
+
/** Evaluate a rule against a target asset */
|
|
2738
|
+
evaluate: async (ruleId, options) => {
|
|
2739
|
+
return this.transport.call({
|
|
2740
|
+
groupSegments: ["tag-rules"],
|
|
2741
|
+
command: "evaluate",
|
|
2742
|
+
body: { ruleId, ...(options ?? {}) },
|
|
2743
|
+
});
|
|
2744
|
+
},
|
|
2745
|
+
/** Explain which rules currently match a target asset (dry-run) */
|
|
2746
|
+
explain: async (options) => {
|
|
2747
|
+
return this.transport.call({
|
|
2748
|
+
groupSegments: ["tag-rules"],
|
|
2749
|
+
command: "explain",
|
|
2750
|
+
body: { ...(options ?? {}) },
|
|
2751
|
+
});
|
|
2752
|
+
},
|
|
2753
|
+
/** List loaded tag rules from .ravi/tag-rules */
|
|
2754
|
+
list: async (options) => {
|
|
2755
|
+
return this.transport.call({
|
|
2756
|
+
groupSegments: ["tag-rules"],
|
|
2757
|
+
command: "list",
|
|
2758
|
+
body: { ...(options ?? {}) },
|
|
2759
|
+
});
|
|
2760
|
+
},
|
|
2761
|
+
/** Show a single rule definition */
|
|
2762
|
+
show: async (id) => {
|
|
2763
|
+
return this.transport.call({
|
|
2764
|
+
groupSegments: ["tag-rules"],
|
|
2765
|
+
command: "show",
|
|
2766
|
+
body: { id },
|
|
2767
|
+
});
|
|
2768
|
+
},
|
|
2769
|
+
/** Run all rules against all contacts (use for cron/periodic schedules) */
|
|
2770
|
+
tick: async (options) => {
|
|
2771
|
+
return this.transport.call({
|
|
2772
|
+
groupSegments: ["tag-rules"],
|
|
2773
|
+
command: "tick",
|
|
2774
|
+
body: { ...(options ?? {}) },
|
|
2775
|
+
});
|
|
2776
|
+
},
|
|
2777
|
+
/** Validate all rule files without applying */
|
|
2778
|
+
validate: async () => {
|
|
2779
|
+
return this.transport.call({
|
|
2780
|
+
groupSegments: ["tag-rules"],
|
|
2781
|
+
command: "validate",
|
|
2782
|
+
body: {},
|
|
2783
|
+
});
|
|
2784
|
+
}
|
|
2785
|
+
};
|
|
2684
2786
|
tags = {
|
|
2685
2787
|
/** Attach a tag to a Ravi asset */
|
|
2686
2788
|
attach: async (slug, options) => {
|
|
@@ -2947,6 +3049,80 @@ export class RaviClient {
|
|
|
2947
3049
|
});
|
|
2948
3050
|
}
|
|
2949
3051
|
};
|
|
3052
|
+
threads = {
|
|
3053
|
+
/** Render the bounded thread brief used for handoff */
|
|
3054
|
+
brief: async (thread, options) => {
|
|
3055
|
+
return this.transport.call({
|
|
3056
|
+
groupSegments: ["threads"],
|
|
3057
|
+
command: "brief",
|
|
3058
|
+
body: { thread, ...(options ?? {}) },
|
|
3059
|
+
});
|
|
3060
|
+
},
|
|
3061
|
+
/** Close a thread */
|
|
3062
|
+
close: async (thread, options) => {
|
|
3063
|
+
return this.transport.call({
|
|
3064
|
+
groupSegments: ["threads"],
|
|
3065
|
+
command: "close",
|
|
3066
|
+
body: { thread, ...(options ?? {}) },
|
|
3067
|
+
});
|
|
3068
|
+
},
|
|
3069
|
+
/** Append a comment to a thread */
|
|
3070
|
+
comment: async (thread, body, options) => {
|
|
3071
|
+
return this.transport.call({
|
|
3072
|
+
groupSegments: ["threads"],
|
|
3073
|
+
command: "comment",
|
|
3074
|
+
body: { thread, body, ...(options ?? {}) },
|
|
3075
|
+
});
|
|
3076
|
+
},
|
|
3077
|
+
/** Create a Ravi-owned thread */
|
|
3078
|
+
create: async (slug, options) => {
|
|
3079
|
+
return this.transport.call({
|
|
3080
|
+
groupSegments: ["threads"],
|
|
3081
|
+
command: "create",
|
|
3082
|
+
body: { slug, ...(options ?? {}) },
|
|
3083
|
+
});
|
|
3084
|
+
},
|
|
3085
|
+
/** List thread entries */
|
|
3086
|
+
entries: async (thread, options) => {
|
|
3087
|
+
return this.transport.call({
|
|
3088
|
+
groupSegments: ["threads"],
|
|
3089
|
+
command: "entries",
|
|
3090
|
+
body: { thread, ...(options ?? {}) },
|
|
3091
|
+
});
|
|
3092
|
+
},
|
|
3093
|
+
/** Link a thread to another Ravi object */
|
|
3094
|
+
link: async (thread, target, options) => {
|
|
3095
|
+
return this.transport.call({
|
|
3096
|
+
groupSegments: ["threads"],
|
|
3097
|
+
command: "link",
|
|
3098
|
+
body: { thread, target, ...(options ?? {}) },
|
|
3099
|
+
});
|
|
3100
|
+
},
|
|
3101
|
+
/** List Ravi threads */
|
|
3102
|
+
list: async (options) => {
|
|
3103
|
+
return this.transport.call({
|
|
3104
|
+
groupSegments: ["threads"],
|
|
3105
|
+
command: "list",
|
|
3106
|
+
body: { ...(options ?? {}) },
|
|
3107
|
+
});
|
|
3108
|
+
},
|
|
3109
|
+
/** Append a note to a thread */
|
|
3110
|
+
note: async (thread, body, options) => {
|
|
3111
|
+
return this.transport.call({
|
|
3112
|
+
groupSegments: ["threads"],
|
|
3113
|
+
command: "note",
|
|
3114
|
+
body: { thread, body, ...(options ?? {}) },
|
|
3115
|
+
});
|
|
3116
|
+
},
|
|
3117
|
+
/** Show one thread with links and recent entries */
|
|
3118
|
+
show: async (thread, options) => {
|
|
3119
|
+
return this.transport.call({
|
|
3120
|
+
groupSegments: ["threads"],
|
|
3121
|
+
command: "show",
|
|
3122
|
+
body: { thread, ...(options ?? {}) },
|
|
3123
|
+
});
|
|
3124
|
+
}
|
|
3125
|
+
};
|
|
2950
3126
|
tools = {
|
|
2951
3127
|
/** List all available CLI tools */
|
|
2952
3128
|
list: async (options) => {
|
|
@@ -3076,16 +3252,6 @@ export class RaviClient {
|
|
|
3076
3252
|
}
|
|
3077
3253
|
};
|
|
3078
3254
|
whatsapp = {
|
|
3079
|
-
chats: {
|
|
3080
|
-
/** List chats with message activity in the last N days (or since a date) */
|
|
3081
|
-
list: async (options) => {
|
|
3082
|
-
return this.transport.call({
|
|
3083
|
-
groupSegments: ["whatsapp", "chats"],
|
|
3084
|
-
command: "list",
|
|
3085
|
-
body: { ...(options ?? {}) },
|
|
3086
|
-
});
|
|
3087
|
-
}
|
|
3088
|
-
},
|
|
3089
3255
|
dm: {
|
|
3090
3256
|
/** Send read receipt (blue ticks) for a specific message */
|
|
3091
3257
|
ack: async (contact, messageId, options) => {
|