Skip to content

Commit

Permalink
update wasm pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
nicarq committed Jan 26, 2024
1 parent 693b021 commit 17e9064
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 64 deletions.
4 changes: 2 additions & 2 deletions shinkai-libs/shinkai-message-wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion shinkai-libs/shinkai-message-wasm/pkg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"collaborators": [
"Nico Arqueros <[email protected]>"
],
"version": "0.2.0",
"version": "0.3.1",
"files": [
"shinkai_message_wasm_bg.wasm",
"shinkai_message_wasm.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ export class JobMessageWrapper {
* @param {any} job_id_js
* @param {any} content_js
* @param {any} files_inbox
* @param {any} parent
*/
constructor(job_id_js: any, content_js: any, files_inbox: any);
constructor(job_id_js: any, content_js: any, files_inbox: any, parent: any);
/**
* @returns {any}
*/
Expand All @@ -126,9 +127,10 @@ export class JobMessageWrapper {
* @param {string} job_id
* @param {string} content
* @param {string} files_inbox
* @param {string} parent
* @returns {JobMessageWrapper}
*/
static fromStrings(job_id: string, content: string, files_inbox: string): JobMessageWrapper;
static fromStrings(job_id: string, content: string, files_inbox: string, parent: string): JobMessageWrapper;
}
/**
*/
Expand Down Expand Up @@ -456,6 +458,7 @@ export class ShinkaiMessageBuilderWrapper {
* @param {string} job_id
* @param {string} content
* @param {string} files_inbox
* @param {string} parent
* @param {string} my_encryption_secret_key
* @param {string} my_signature_secret_key
* @param {string} receiver_public_key
Expand All @@ -465,7 +468,7 @@ export class ShinkaiMessageBuilderWrapper {
* @param {string} receiver_subidentity
* @returns {string}
*/
static job_message(job_id: string, content: string, files_inbox: string, my_encryption_secret_key: string, my_signature_secret_key: string, receiver_public_key: string, sender: string, sender_subidentity: string, receiver: string, receiver_subidentity: string): string;
static job_message(job_id: string, content: string, files_inbox: string, parent: string, my_encryption_secret_key: string, my_signature_secret_key: string, receiver_public_key: string, sender: string, sender_subidentity: string, receiver: string, receiver_subidentity: string): string;
/**
* @param {string} my_encryption_secret_key
* @param {string} my_signature_secret_key
Expand Down
67 changes: 38 additions & 29 deletions shinkai-libs/shinkai-message-wasm/pkg/shinkai_message_wasm_bg.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,14 @@ function debugString(val) {
// TODO we could test for more things here, like `Set`s and `Map`s.
return className;
}

let stack_pointer = 128;

function addBorrowedObject(obj) {
if (stack_pointer == 1) throw new Error('out of js stack');
heap[--stack_pointer] = obj;
return stack_pointer;
}
/**
* @param {string} encryption_sk
* @returns {string}
Expand Down Expand Up @@ -236,13 +244,6 @@ export function convert_encryption_sk_string_to_encryption_pk_string(encryption_
}
}

let stack_pointer = 128;

function addBorrowedObject(obj) {
if (stack_pointer == 1) throw new Error('out of js stack');
heap[--stack_pointer] = obj;
return stack_pointer;
}
/**
* @param {string} input
* @returns {string}
Expand Down Expand Up @@ -669,11 +670,12 @@ export class JobMessageWrapper {
* @param {any} job_id_js
* @param {any} content_js
* @param {any} files_inbox
* @param {any} parent
*/
constructor(job_id_js, content_js, files_inbox) {
constructor(job_id_js, content_js, files_inbox, parent) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.jobmessagewrapper_new(retptr, addBorrowedObject(job_id_js), addBorrowedObject(content_js), addBorrowedObject(files_inbox));
wasm.jobmessagewrapper_new(retptr, addBorrowedObject(job_id_js), addBorrowedObject(content_js), addBorrowedObject(files_inbox), addBorrowedObject(parent));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
Expand All @@ -686,6 +688,7 @@ export class JobMessageWrapper {
heap[stack_pointer++] = undefined;
heap[stack_pointer++] = undefined;
heap[stack_pointer++] = undefined;
heap[stack_pointer++] = undefined;
}
}
/**
Expand Down Expand Up @@ -778,16 +781,19 @@ export class JobMessageWrapper {
* @param {string} job_id
* @param {string} content
* @param {string} files_inbox
* @param {string} parent
* @returns {JobMessageWrapper}
*/
static fromStrings(job_id, content, files_inbox) {
static fromStrings(job_id, content, files_inbox, parent) {
const ptr0 = passStringToWasm0(job_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
const ptr2 = passStringToWasm0(files_inbox, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len2 = WASM_VECTOR_LEN;
const ret = wasm.jobmessagewrapper_fromStrings(ptr0, len0, ptr1, len1, ptr2, len2);
const ptr3 = passStringToWasm0(parent, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len3 = WASM_VECTOR_LEN;
const ret = wasm.jobmessagewrapper_fromStrings(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
return JobMessageWrapper.__wrap(ret);
}
}
Expand Down Expand Up @@ -2167,6 +2173,7 @@ export class ShinkaiMessageBuilderWrapper {
* @param {string} job_id
* @param {string} content
* @param {string} files_inbox
* @param {string} parent
* @param {string} my_encryption_secret_key
* @param {string} my_signature_secret_key
* @param {string} receiver_public_key
Expand All @@ -2176,9 +2183,9 @@ export class ShinkaiMessageBuilderWrapper {
* @param {string} receiver_subidentity
* @returns {string}
*/
static job_message(job_id, content, files_inbox, my_encryption_secret_key, my_signature_secret_key, receiver_public_key, sender, sender_subidentity, receiver, receiver_subidentity) {
let deferred12_0;
let deferred12_1;
static job_message(job_id, content, files_inbox, parent, my_encryption_secret_key, my_signature_secret_key, receiver_public_key, sender, sender_subidentity, receiver, receiver_subidentity) {
let deferred13_0;
let deferred13_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(job_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
Expand All @@ -2187,37 +2194,39 @@ export class ShinkaiMessageBuilderWrapper {
const len1 = WASM_VECTOR_LEN;
const ptr2 = passStringToWasm0(files_inbox, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len2 = WASM_VECTOR_LEN;
const ptr3 = passStringToWasm0(my_encryption_secret_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const ptr3 = passStringToWasm0(parent, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len3 = WASM_VECTOR_LEN;
const ptr4 = passStringToWasm0(my_signature_secret_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const ptr4 = passStringToWasm0(my_encryption_secret_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len4 = WASM_VECTOR_LEN;
const ptr5 = passStringToWasm0(receiver_public_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const ptr5 = passStringToWasm0(my_signature_secret_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len5 = WASM_VECTOR_LEN;
const ptr6 = passStringToWasm0(sender, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const ptr6 = passStringToWasm0(receiver_public_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len6 = WASM_VECTOR_LEN;
const ptr7 = passStringToWasm0(sender_subidentity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const ptr7 = passStringToWasm0(sender, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len7 = WASM_VECTOR_LEN;
const ptr8 = passStringToWasm0(receiver, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const ptr8 = passStringToWasm0(sender_subidentity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len8 = WASM_VECTOR_LEN;
const ptr9 = passStringToWasm0(receiver_subidentity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const ptr9 = passStringToWasm0(receiver, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len9 = WASM_VECTOR_LEN;
wasm.shinkaimessagebuilderwrapper_job_message(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9);
const ptr10 = passStringToWasm0(receiver_subidentity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len10 = WASM_VECTOR_LEN;
wasm.shinkaimessagebuilderwrapper_job_message(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, ptr10, len10);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
var r3 = getInt32Memory0()[retptr / 4 + 3];
var ptr11 = r0;
var len11 = r1;
var ptr12 = r0;
var len12 = r1;
if (r3) {
ptr11 = 0; len11 = 0;
ptr12 = 0; len12 = 0;
throw takeObject(r2);
}
deferred12_0 = ptr11;
deferred12_1 = len11;
return getStringFromWasm0(ptr11, len11);
deferred13_0 = ptr12;
deferred13_1 = len12;
return getStringFromWasm0(ptr12, len12);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(deferred12_0, deferred12_1, 1);
wasm.__wbindgen_free(deferred13_0, deferred13_1, 1);
}
}
/**
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,22 @@ export function shinkaimessagebuilderwrapper_read_up_to_time(a: number, b: numbe
export function shinkaimessagebuilderwrapper_create_custom_shinkai_message_to_node(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number): void;
export function shinkaimessagebuilderwrapper_ping_pong_message(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number): void;
export function shinkaimessagebuilderwrapper_job_creation(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number): void;
export function shinkaimessagebuilderwrapper_job_message(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number): void;
export function shinkaimessagebuilderwrapper_job_message(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number): void;
export function shinkaimessagebuilderwrapper_terminate_message(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number): void;
export function shinkaimessagebuilderwrapper_error_message(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number): void;
export function shinkaimessagebuilderwrapper_get_last_unread_messages_from_inbox(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number): void;
export function __wbg_inboxnamewrapper_free(a: number): void;
export function inboxnamewrapper_new(a: number, b: number): void;
export function inboxnamewrapper_to_string(a: number, b: number): void;
export function inboxnamewrapper_get_value(a: number): number;
export function inboxnamewrapper_get_is_e2e(a: number): number;
export function inboxnamewrapper_get_identities(a: number, b: number): void;
export function inboxnamewrapper_get_unique_id(a: number): number;
export function inboxnamewrapper_to_jsvalue(a: number, b: number): void;
export function inboxnamewrapper_to_json_str(a: number, b: number): void;
export function inboxnamewrapper_get_regular_inbox_name_from_params(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number): void;
export function inboxnamewrapper_get_job_inbox_name_from_params(a: number, b: number, c: number): void;
export function inboxnamewrapper_get_inner(a: number): number;
export function __wbg_wasmencryptionmethod_free(a: number): void;
export function wasmencryptionmethod_new(a: number, b: number): number;
export function wasmencryptionmethod_as_str(a: number, b: number): void;
Expand All @@ -60,6 +72,20 @@ export function shinkaimessagewrapper_inner_content_for_hashing(a: number, b: nu
export function shinkaimessagewrapper_calculate_blake3_hash_with_empty_outer_signature(a: number, b: number): void;
export function shinkaimessagewrapper_calculate_blake3_hash_with_empty_inner_signature(a: number, b: number): void;
export function shinkaimessagewrapper_generate_time_now(a: number): void;
export function __wbg_serializedagentwrapper_free(a: number): void;
export function serializedagentwrapper_fromStrings(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number): void;
export function serializedagentwrapper_fromJsValue(a: number, b: number): void;
export function serializedagentwrapper_to_json_str(a: number, b: number): void;
export function serializedagentwrapper_from_json_str(a: number, b: number, c: number): void;
export function serializedagentwrapper_inner(a: number, b: number): void;
export function serializedagentwrapper_new(a: number, b: number): void;
export function serializedagentwrapper_to_jsvalue(a: number, b: number): void;
export function shinkaimessagewrapper_new(a: number, b: number): void;
export function shinkaistringtime_generateTimeNow(a: number): void;
export function shinkaistringtime_generateTimeInFutureWithSecs(a: number, b: number): void;
export function shinkaistringtime_generateSpecificTime(a: number, b: number, c: number, d: number, e: number, f: number, g: number): void;
export function calculate_blake3_hash(a: number, b: number, c: number): void;
export function __wbg_shinkaistringtime_free(a: number): void;
export function __wbg_shinkainamewrapper_free(a: number): void;
export function shinkainamewrapper_new(a: number, b: number): void;
export function shinkainamewrapper_get_full_name(a: number): number;
Expand All @@ -71,25 +97,6 @@ export function shinkainamewrapper_to_jsvalue(a: number, b: number): void;
export function shinkainamewrapper_to_json_str(a: number, b: number): void;
export function shinkainamewrapper_extract_profile(a: number, b: number): void;
export function shinkainamewrapper_extract_node(a: number): number;
export function shinkaimessagewrapper_new(a: number, b: number): void;
export function __wbg_inboxnamewrapper_free(a: number): void;
export function inboxnamewrapper_new(a: number, b: number): void;
export function inboxnamewrapper_to_string(a: number, b: number): void;
export function inboxnamewrapper_get_value(a: number): number;
export function inboxnamewrapper_get_is_e2e(a: number): number;
export function inboxnamewrapper_get_identities(a: number, b: number): void;
export function inboxnamewrapper_get_unique_id(a: number): number;
export function inboxnamewrapper_to_jsvalue(a: number, b: number): void;
export function inboxnamewrapper_to_json_str(a: number, b: number): void;
export function inboxnamewrapper_get_regular_inbox_name_from_params(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number): void;
export function inboxnamewrapper_get_job_inbox_name_from_params(a: number, b: number, c: number): void;
export function inboxnamewrapper_get_inner(a: number): number;
export function __wbg_serializedagentwrapper_free(a: number): void;
export function serializedagentwrapper_fromStrings(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number): void;
export function serializedagentwrapper_fromJsValue(a: number, b: number): void;
export function serializedagentwrapper_to_json_str(a: number, b: number): void;
export function serializedagentwrapper_from_json_str(a: number, b: number, c: number): void;
export function serializedagentwrapper_inner(a: number, b: number): void;
export function __wbg_jobscopewrapper_free(a: number): void;
export function jobscopewrapper_new(a: number, b: number, c: number): void;
export function jobscopewrapper_to_jsvalue(a: number, b: number): void;
Expand All @@ -103,19 +110,12 @@ export function jobcreationwrapper_from_json_str(a: number, b: number, c: number
export function jobcreationwrapper_from_jsvalue(a: number, b: number): void;
export function jobcreationwrapper_empty(a: number): void;
export function __wbg_jobmessagewrapper_free(a: number): void;
export function jobmessagewrapper_new(a: number, b: number, c: number, d: number): void;
export function jobmessagewrapper_new(a: number, b: number, c: number, d: number, e: number): void;
export function jobmessagewrapper_to_jsvalue(a: number, b: number): void;
export function jobmessagewrapper_to_json_str(a: number, b: number): void;
export function jobmessagewrapper_from_json_str(a: number, b: number, c: number): void;
export function jobmessagewrapper_from_jsvalue(a: number, b: number): void;
export function jobmessagewrapper_fromStrings(a: number, b: number, c: number, d: number, e: number, f: number): number;
export function shinkaistringtime_generateTimeNow(a: number): void;
export function shinkaistringtime_generateTimeInFutureWithSecs(a: number, b: number): void;
export function shinkaistringtime_generateSpecificTime(a: number, b: number, c: number, d: number, e: number, f: number, g: number): void;
export function serializedagentwrapper_new(a: number, b: number): void;
export function serializedagentwrapper_to_jsvalue(a: number, b: number): void;
export function __wbg_shinkaistringtime_free(a: number): void;
export function calculate_blake3_hash(a: number, b: number, c: number): void;
export function jobmessagewrapper_fromStrings(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
export function __wbindgen_malloc(a: number, b: number): number;
export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
export function __wbindgen_add_to_stack_pointer(a: number): number;
Expand Down

0 comments on commit 17e9064

Please sign in to comment.