Skip to content

Commit

Permalink
Merge pull request #129 from dcSpark/nico/update-wasm-and-fix-tests
Browse files Browse the repository at this point in the history
fix agent serialization and update wasm
  • Loading branch information
nicarq authored Jan 29, 2024
2 parents b515b36 + c42d7d1 commit eeef181
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 123 deletions.
2 changes: 1 addition & 1 deletion libs/shinkai-message-ts/src/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.3.1",
"version": "0.3.2",
"files": [
"shinkai_message_wasm_bg.wasm",
"shinkai_message_wasm.js",
Expand Down
8 changes: 4 additions & 4 deletions libs/shinkai-message-ts/src/pkg/shinkai_message_wasm.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* tslint:disable */
/* eslint-disable */
/**
* @param {string} encryption_sk
* @param {string} input
* @returns {string}
*/
export function convert_encryption_sk_string_to_encryption_pk_string(encryption_sk: string): string;
export function calculate_blake3_hash(input: string): string;
/**
* @param {string} input
* @param {string} encryption_sk
* @returns {string}
*/
export function calculate_blake3_hash(input: string): string;
export function convert_encryption_sk_string_to_encryption_pk_string(encryption_sk: string): string;
/**
*/
export class InboxNameWrapper {
Expand Down
46 changes: 23 additions & 23 deletions libs/shinkai-message-ts/src/pkg/shinkai_message_wasm_bg.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,29 @@ function addBorrowedObject(obj) {
heap[--stack_pointer] = obj;
return stack_pointer;
}
/**
* @param {string} input
* @returns {string}
*/
export function calculate_blake3_hash(input) {
let deferred2_0;
let deferred2_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.calculate_blake3_hash(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
deferred2_0 = r0;
deferred2_1 = r1;
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
}
}

/**
* @param {string} encryption_sk
* @returns {string}
Expand Down Expand Up @@ -244,29 +267,6 @@ export function convert_encryption_sk_string_to_encryption_pk_string(encryption_
}
}

/**
* @param {string} input
* @returns {string}
*/
export function calculate_blake3_hash(input) {
let deferred2_0;
let deferred2_1;
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.calculate_blake3_hash(retptr, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
deferred2_0 = r0;
deferred2_1 = r1;
return getStringFromWasm0(r0, r1);
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
}
}

function handleError(f, args) {
try {
return f.apply(this, args);
Expand Down
Binary file modified libs/shinkai-message-ts/src/pkg/shinkai_message_wasm_bg.wasm
Binary file not shown.
100 changes: 50 additions & 50 deletions libs/shinkai-message-ts/src/pkg/shinkai_message_wasm_bg.wasm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,56 +36,6 @@ export function shinkaimessagebuilderwrapper_job_message(a: number, b: number, c
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;
export function wasmencryptionmethod_DiffieHellmanChaChaPoly1305(a: number): void;
export function wasmencryptionmethod_None(a: number): void;
export function convert_encryption_sk_string_to_encryption_pk_string(a: number, b: number, c: number): void;
export function __wbg_shinkaimessagewrapper_free(a: number): void;
export function shinkaimessagewrapper_message_body(a: number, b: number): void;
export function shinkaimessagewrapper_set_message_body(a: number, b: number, c: number): void;
export function shinkaimessagewrapper_external_metadata(a: number, b: number): void;
export function shinkaimessagewrapper_set_external_metadata(a: number, b: number, c: number): void;
export function shinkaimessagewrapper_encryption(a: number, b: number): void;
export function shinkaimessagewrapper_set_encryption(a: number, b: number, c: number): void;
export function shinkaimessagewrapper_to_jsvalue(a: number, b: number): void;
export function shinkaimessagewrapper_fromJsValue(a: number, b: number): void;
export function shinkaimessagewrapper_to_json_str(a: number, b: number): void;
export function shinkaimessagewrapper_from_json_str(a: number, b: number, c: number): void;
export function shinkaimessagewrapper_calculate_blake3_hash(a: number, b: number): void;
export function shinkaimessagewrapper_new_with_empty_outer_signature(a: number): number;
export function shinkaimessagewrapper_new_with_empty_inner_signature(a: number, b: number): void;
export function shinkaimessagewrapper_inner_content_for_hashing(a: number, b: number): void;
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 Down Expand Up @@ -116,6 +66,56 @@ 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, g: number, h: number): number;
export function __wbg_shinkaimessagewrapper_free(a: number): void;
export function shinkaimessagewrapper_message_body(a: number, b: number): void;
export function shinkaimessagewrapper_set_message_body(a: number, b: number, c: number): void;
export function shinkaimessagewrapper_external_metadata(a: number, b: number): void;
export function shinkaimessagewrapper_set_external_metadata(a: number, b: number, c: number): void;
export function shinkaimessagewrapper_encryption(a: number, b: number): void;
export function shinkaimessagewrapper_set_encryption(a: number, b: number, c: number): void;
export function shinkaimessagewrapper_to_jsvalue(a: number, b: number): void;
export function shinkaimessagewrapper_fromJsValue(a: number, b: number): void;
export function shinkaimessagewrapper_to_json_str(a: number, b: number): void;
export function shinkaimessagewrapper_from_json_str(a: number, b: number, c: number): void;
export function shinkaimessagewrapper_calculate_blake3_hash(a: number, b: number): void;
export function shinkaimessagewrapper_new_with_empty_outer_signature(a: number): number;
export function shinkaimessagewrapper_new_with_empty_inner_signature(a: number, b: number): void;
export function shinkaimessagewrapper_inner_content_for_hashing(a: number, b: number): void;
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 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 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 shinkaimessagewrapper_new(a: number, b: number): void;
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;
export function wasmencryptionmethod_DiffieHellmanChaChaPoly1305(a: number): void;
export function wasmencryptionmethod_None(a: number): void;
export function convert_encryption_sk_string_to_encryption_pk_string(a: number, b: number, c: 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 __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
4 changes: 2 additions & 2 deletions libs/shinkai-message-ts/src/wasm/JobCreationWrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { JobCreationWrapper } from './JobCreationWrapper';

const jobCreationJson = `{
"scope": {
"database": [],
"vector_fs": [],
"local": []
}
}`;
Expand Down Expand Up @@ -39,7 +39,7 @@ describe('JobCreationWrapper', () => {

expect(JSON.parse(jsonString)).toEqual({
scope: {
database: [],
vector_fs: [],
local: [],
},
});
Expand Down
Loading

0 comments on commit eeef181

Please sign in to comment.