@meshagent/meshagent 0.15.0 → 0.17.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/CHANGELOG.md +9 -0
- package/dist/browser/agent-client.d.ts +1 -3
- package/dist/browser/agent-client.js +1 -17
- package/dist/browser/entrypoint.d.ts +4 -2
- package/dist/browser/entrypoint.js +23 -5
- package/dist/esm/agent-client.d.ts +1 -3
- package/dist/esm/agent-client.js +1 -17
- package/dist/esm/entrypoint.d.ts +4 -2
- package/dist/esm/entrypoint.js +22 -6
- package/dist/node/agent-client.d.ts +1 -3
- package/dist/node/agent-client.js +1 -17
- package/dist/node/entrypoint.d.ts +4 -2
- package/dist/node/entrypoint.js +23 -5
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [0.17.0]
|
|
2
|
+
- Updated `yjs` dependency from `^13.6.7` to `^13.6.28`
|
|
3
|
+
- Prevented “maximum call stack size exceeded” when encoding large document state/state vectors by switching to chunked base64 conversion in the entrypoint
|
|
4
|
+
- Breaking: removed `AgentDescription.requires` from the TypeScript agent client model/serialization
|
|
5
|
+
- Updated the Dart/Flutter entrypoint build target to output the bundled JS into the Flutter package
|
|
6
|
+
|
|
7
|
+
## [0.16.0]
|
|
8
|
+
- Stability
|
|
9
|
+
|
|
1
10
|
## [0.15.0]
|
|
2
11
|
- Updated the bundled Luau WASM JavaScript bindings to support per-script environments (`envIndex`) and expose additional Lua operations (metatable/fenv and stack removal).
|
|
3
12
|
|
|
@@ -8,16 +8,14 @@ export declare class AgentDescription {
|
|
|
8
8
|
readonly description: string;
|
|
9
9
|
readonly outputSchema?: Record<string, any>;
|
|
10
10
|
readonly inputSchema?: Record<string, any>;
|
|
11
|
-
readonly requires: Requirement[];
|
|
12
11
|
readonly labels: string[];
|
|
13
12
|
readonly supportsTools: boolean;
|
|
14
|
-
constructor({ name, title, description, outputSchema, inputSchema,
|
|
13
|
+
constructor({ name, title, description, outputSchema, inputSchema, labels, supportsTools, }: {
|
|
15
14
|
name: string;
|
|
16
15
|
title: string;
|
|
17
16
|
description: string;
|
|
18
17
|
outputSchema?: Record<string, any>;
|
|
19
18
|
inputSchema?: Record<string, any>;
|
|
20
|
-
requires?: Requirement[];
|
|
21
19
|
labels?: string[];
|
|
22
20
|
supportsTools: boolean;
|
|
23
21
|
});
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AgentsClient = exports.ToolkitConfiguration = exports.ToolkitDescription = exports.ToolDescription = exports.AgentDescription = void 0;
|
|
4
4
|
const response_1 = require("./response");
|
|
5
|
-
const requirement_1 = require("./requirement");
|
|
6
5
|
class AgentDescription {
|
|
7
|
-
constructor({ name, title, description, outputSchema, inputSchema,
|
|
6
|
+
constructor({ name, title, description, outputSchema, inputSchema, labels, supportsTools, }) {
|
|
8
7
|
this.name = name;
|
|
9
8
|
this.title = title;
|
|
10
9
|
this.description = description;
|
|
11
10
|
this.outputSchema = outputSchema;
|
|
12
11
|
this.inputSchema = inputSchema;
|
|
13
|
-
this.requires = Array.isArray(requires) ? requires : [];
|
|
14
12
|
this.labels = Array.isArray(labels) ? labels : [];
|
|
15
13
|
this.supportsTools = supportsTools ?? false;
|
|
16
14
|
}
|
|
@@ -23,22 +21,9 @@ class AgentDescription {
|
|
|
23
21
|
output_schema: this.outputSchema,
|
|
24
22
|
labels: this.labels,
|
|
25
23
|
supports_tools: this.supportsTools,
|
|
26
|
-
requires: this.requires.map((requirement) => requirement.toJson()),
|
|
27
24
|
};
|
|
28
25
|
}
|
|
29
26
|
static fromJson(a) {
|
|
30
|
-
let requires = [];
|
|
31
|
-
if (Array.isArray(a["requires"])) {
|
|
32
|
-
requires = a["requires"].map((e) => {
|
|
33
|
-
if (e["toolkit"] != null) {
|
|
34
|
-
return requirement_1.RequiredToolkit.fromJson(e);
|
|
35
|
-
}
|
|
36
|
-
if (e["schema"] != null) {
|
|
37
|
-
return requirement_1.RequiredSchema.fromJson(e);
|
|
38
|
-
}
|
|
39
|
-
throw new Error("Invalid requirement object");
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
27
|
let labels = [];
|
|
43
28
|
if (Array.isArray(a["labels"])) {
|
|
44
29
|
labels = a["labels"].filter((item) => typeof item === "string");
|
|
@@ -49,7 +34,6 @@ class AgentDescription {
|
|
|
49
34
|
description: a["description"] ?? "",
|
|
50
35
|
inputSchema: a["input_schema"] ?? undefined,
|
|
51
36
|
outputSchema: a["output_schema"] ?? undefined,
|
|
52
|
-
requires,
|
|
53
37
|
supportsTools: a["supports_tools"] === true,
|
|
54
38
|
labels,
|
|
55
39
|
});
|
|
@@ -49713,9 +49713,11 @@ export var ServerXmlDocument: {
|
|
|
49713
49713
|
};
|
|
49714
49714
|
export function applyBackendChanges(documentID: any, base64Changes: any): void;
|
|
49715
49715
|
export function applyChanges(update: any): void;
|
|
49716
|
-
|
|
49717
|
-
declare function
|
|
49716
|
+
export function base64ToUint8Array(base642: any): Uint8Array<any>;
|
|
49717
|
+
declare function getState2(documentID: any, vector: any): string;
|
|
49718
|
+
declare function getStateVector2(documentID: any): string;
|
|
49718
49719
|
export function registerDocument(id2: any, base64Data: any, undo: boolean | undefined, sendUpdateToBackend: any, sendUpdateToClient: any): void;
|
|
49720
|
+
export function uint8ArrayToBase64(bytes: any): string;
|
|
49719
49721
|
export function unregisterDocument(id2: any): void;
|
|
49720
49722
|
declare var AbstractType: {
|
|
49721
49723
|
};
|
|
@@ -142,9 +142,11 @@ __export(index_exports, {
|
|
|
142
142
|
ServerXmlDocument: () => ServerXmlDocument,
|
|
143
143
|
applyBackendChanges: () => applyBackendChanges,
|
|
144
144
|
applyChanges: () => applyChanges,
|
|
145
|
+
base64ToUint8Array: () => base64ToUint8Array,
|
|
145
146
|
getState: () => getState2,
|
|
146
147
|
getStateVector: () => getStateVector2,
|
|
147
148
|
registerDocument: () => registerDocument,
|
|
149
|
+
uint8ArrayToBase64: () => uint8ArrayToBase64,
|
|
148
150
|
unregisterDocument: () => unregisterDocument
|
|
149
151
|
});
|
|
150
152
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -994,7 +996,7 @@ var varStorage = _localStorage;
|
|
|
994
996
|
|
|
995
997
|
// ../node_modules/lib0/trait/equality.js
|
|
996
998
|
var EqualityTraitSymbol = Symbol("Equality");
|
|
997
|
-
var equals = (a, b) => a === b || a[EqualityTraitSymbol]?.(b) || false;
|
|
999
|
+
var equals = (a, b) => a === b || !!a?.[EqualityTraitSymbol]?.(b) || false;
|
|
998
1000
|
|
|
999
1001
|
// ../node_modules/lib0/object.js
|
|
1000
1002
|
var isObject = (o) => typeof o === "object";
|
|
@@ -9414,6 +9416,23 @@ var ServerXmlDocument = class {
|
|
|
9414
9416
|
|
|
9415
9417
|
// src/entrypoint.ts
|
|
9416
9418
|
var import_base_64 = __toESM(require_base64());
|
|
9419
|
+
function uint8ArrayToBase64(bytes) {
|
|
9420
|
+
let binary = "";
|
|
9421
|
+
const chunkSize = 32768;
|
|
9422
|
+
for (let i = 0; i < bytes.length; i += chunkSize) {
|
|
9423
|
+
binary += String.fromCharCode(...bytes.subarray(i, i + chunkSize));
|
|
9424
|
+
}
|
|
9425
|
+
return btoa(binary);
|
|
9426
|
+
}
|
|
9427
|
+
function base64ToUint8Array(base642) {
|
|
9428
|
+
const binary = atob(base642);
|
|
9429
|
+
const len = binary.length;
|
|
9430
|
+
const bytes = new Uint8Array(len);
|
|
9431
|
+
for (let i = 0; i < len; i++) {
|
|
9432
|
+
bytes[i] = binary.charCodeAt(i);
|
|
9433
|
+
}
|
|
9434
|
+
return bytes;
|
|
9435
|
+
}
|
|
9417
9436
|
var ClientProtocol = class {
|
|
9418
9437
|
constructor(onClientUpdate) {
|
|
9419
9438
|
this.doc = new Doc();
|
|
@@ -9445,7 +9464,7 @@ function getState2(documentID, vector) {
|
|
|
9445
9464
|
} else {
|
|
9446
9465
|
state = encodeStateAsUpdate(server.doc);
|
|
9447
9466
|
}
|
|
9448
|
-
return
|
|
9467
|
+
return uint8ArrayToBase64(state);
|
|
9449
9468
|
}
|
|
9450
9469
|
function getStateVector2(documentID) {
|
|
9451
9470
|
const server = documents.get(documentID);
|
|
@@ -9453,7 +9472,7 @@ function getStateVector2(documentID) {
|
|
|
9453
9472
|
throw new Error("Document not registered: " + documentID);
|
|
9454
9473
|
}
|
|
9455
9474
|
const state = encodeStateVector(server.doc);
|
|
9456
|
-
return
|
|
9475
|
+
return uint8ArrayToBase64(state);
|
|
9457
9476
|
}
|
|
9458
9477
|
function applyBackendChanges(documentID, base64Changes) {
|
|
9459
9478
|
const server = documents.get(documentID);
|
|
@@ -9477,10 +9496,9 @@ function registerDocument(id2, base64Data, undo = false, sendUpdateToBackend, se
|
|
|
9477
9496
|
throw new Error("document is already registered " + id2);
|
|
9478
9497
|
}
|
|
9479
9498
|
const clientProtocol = new ClientProtocol((update) => {
|
|
9480
|
-
const str = String.fromCharCode(...update);
|
|
9481
9499
|
const msg = JSON.stringify({
|
|
9482
9500
|
documentID: id2,
|
|
9483
|
-
data:
|
|
9501
|
+
data: uint8ArrayToBase64(update)
|
|
9484
9502
|
});
|
|
9485
9503
|
const fn = sendUpdateToBackend ?? onSendUpdateToBackend;
|
|
9486
9504
|
if (fn) {
|
|
@@ -8,16 +8,14 @@ export declare class AgentDescription {
|
|
|
8
8
|
readonly description: string;
|
|
9
9
|
readonly outputSchema?: Record<string, any>;
|
|
10
10
|
readonly inputSchema?: Record<string, any>;
|
|
11
|
-
readonly requires: Requirement[];
|
|
12
11
|
readonly labels: string[];
|
|
13
12
|
readonly supportsTools: boolean;
|
|
14
|
-
constructor({ name, title, description, outputSchema, inputSchema,
|
|
13
|
+
constructor({ name, title, description, outputSchema, inputSchema, labels, supportsTools, }: {
|
|
15
14
|
name: string;
|
|
16
15
|
title: string;
|
|
17
16
|
description: string;
|
|
18
17
|
outputSchema?: Record<string, any>;
|
|
19
18
|
inputSchema?: Record<string, any>;
|
|
20
|
-
requires?: Requirement[];
|
|
21
19
|
labels?: string[];
|
|
22
20
|
supportsTools: boolean;
|
|
23
21
|
});
|
package/dist/esm/agent-client.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { JsonResponse } from "./response";
|
|
2
|
-
import { RequiredToolkit, RequiredSchema } from "./requirement";
|
|
3
2
|
export class AgentDescription {
|
|
4
|
-
constructor({ name, title, description, outputSchema, inputSchema,
|
|
3
|
+
constructor({ name, title, description, outputSchema, inputSchema, labels, supportsTools, }) {
|
|
5
4
|
this.name = name;
|
|
6
5
|
this.title = title;
|
|
7
6
|
this.description = description;
|
|
8
7
|
this.outputSchema = outputSchema;
|
|
9
8
|
this.inputSchema = inputSchema;
|
|
10
|
-
this.requires = Array.isArray(requires) ? requires : [];
|
|
11
9
|
this.labels = Array.isArray(labels) ? labels : [];
|
|
12
10
|
this.supportsTools = supportsTools ?? false;
|
|
13
11
|
}
|
|
@@ -20,22 +18,9 @@ export class AgentDescription {
|
|
|
20
18
|
output_schema: this.outputSchema,
|
|
21
19
|
labels: this.labels,
|
|
22
20
|
supports_tools: this.supportsTools,
|
|
23
|
-
requires: this.requires.map((requirement) => requirement.toJson()),
|
|
24
21
|
};
|
|
25
22
|
}
|
|
26
23
|
static fromJson(a) {
|
|
27
|
-
let requires = [];
|
|
28
|
-
if (Array.isArray(a["requires"])) {
|
|
29
|
-
requires = a["requires"].map((e) => {
|
|
30
|
-
if (e["toolkit"] != null) {
|
|
31
|
-
return RequiredToolkit.fromJson(e);
|
|
32
|
-
}
|
|
33
|
-
if (e["schema"] != null) {
|
|
34
|
-
return RequiredSchema.fromJson(e);
|
|
35
|
-
}
|
|
36
|
-
throw new Error("Invalid requirement object");
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
24
|
let labels = [];
|
|
40
25
|
if (Array.isArray(a["labels"])) {
|
|
41
26
|
labels = a["labels"].filter((item) => typeof item === "string");
|
|
@@ -46,7 +31,6 @@ export class AgentDescription {
|
|
|
46
31
|
description: a["description"] ?? "",
|
|
47
32
|
inputSchema: a["input_schema"] ?? undefined,
|
|
48
33
|
outputSchema: a["output_schema"] ?? undefined,
|
|
49
|
-
requires,
|
|
50
34
|
supportsTools: a["supports_tools"] === true,
|
|
51
35
|
labels,
|
|
52
36
|
});
|
package/dist/esm/entrypoint.d.ts
CHANGED
|
@@ -49713,9 +49713,11 @@ export var ServerXmlDocument: {
|
|
|
49713
49713
|
};
|
|
49714
49714
|
export function applyBackendChanges(documentID: any, base64Changes: any): void;
|
|
49715
49715
|
export function applyChanges(update: any): void;
|
|
49716
|
-
|
|
49717
|
-
declare function
|
|
49716
|
+
export function base64ToUint8Array(base642: any): Uint8Array<any>;
|
|
49717
|
+
declare function getState2(documentID: any, vector: any): string;
|
|
49718
|
+
declare function getStateVector2(documentID: any): string;
|
|
49718
49719
|
export function registerDocument(id2: any, base64Data: any, undo: boolean | undefined, sendUpdateToBackend: any, sendUpdateToClient: any): void;
|
|
49720
|
+
export function uint8ArrayToBase64(bytes: any): string;
|
|
49719
49721
|
export function unregisterDocument(id2: any): void;
|
|
49720
49722
|
declare var AbstractType: {
|
|
49721
49723
|
};
|
package/dist/esm/entrypoint.js
CHANGED
|
@@ -811,7 +811,7 @@ catch (e) {
|
|
|
811
811
|
}
|
|
812
812
|
var varStorage = _localStorage;
|
|
813
813
|
var EqualityTraitSymbol = Symbol("Equality");
|
|
814
|
-
var equals = (a, b) => a === b || a[EqualityTraitSymbol]?.(b) || false;
|
|
814
|
+
var equals = (a, b) => a === b || !!a?.[EqualityTraitSymbol]?.(b) || false;
|
|
815
815
|
var isObject = (o) => typeof o === "object";
|
|
816
816
|
var assign = Object.assign;
|
|
817
817
|
var keys = Object.keys;
|
|
@@ -6767,6 +6767,23 @@ var ServerXmlDocument = class {
|
|
|
6767
6767
|
}
|
|
6768
6768
|
};
|
|
6769
6769
|
var import_base_64 = __toESM(require_base64());
|
|
6770
|
+
function uint8ArrayToBase64(bytes) {
|
|
6771
|
+
let binary = "";
|
|
6772
|
+
const chunkSize = 32768;
|
|
6773
|
+
for (let i = 0; i < bytes.length; i += chunkSize) {
|
|
6774
|
+
binary += String.fromCharCode(...bytes.subarray(i, i + chunkSize));
|
|
6775
|
+
}
|
|
6776
|
+
return btoa(binary);
|
|
6777
|
+
}
|
|
6778
|
+
function base64ToUint8Array(base642) {
|
|
6779
|
+
const binary = atob(base642);
|
|
6780
|
+
const len = binary.length;
|
|
6781
|
+
const bytes = new Uint8Array(len);
|
|
6782
|
+
for (let i = 0; i < len; i++) {
|
|
6783
|
+
bytes[i] = binary.charCodeAt(i);
|
|
6784
|
+
}
|
|
6785
|
+
return bytes;
|
|
6786
|
+
}
|
|
6770
6787
|
var ClientProtocol = class {
|
|
6771
6788
|
constructor(onClientUpdate) {
|
|
6772
6789
|
this.doc = new Doc();
|
|
@@ -6799,7 +6816,7 @@ function getState2(documentID, vector) {
|
|
|
6799
6816
|
else {
|
|
6800
6817
|
state = encodeStateAsUpdate(server.doc);
|
|
6801
6818
|
}
|
|
6802
|
-
return
|
|
6819
|
+
return uint8ArrayToBase64(state);
|
|
6803
6820
|
}
|
|
6804
6821
|
function getStateVector2(documentID) {
|
|
6805
6822
|
const server = documents.get(documentID);
|
|
@@ -6807,7 +6824,7 @@ function getStateVector2(documentID) {
|
|
|
6807
6824
|
throw new Error("Document not registered: " + documentID);
|
|
6808
6825
|
}
|
|
6809
6826
|
const state = encodeStateVector(server.doc);
|
|
6810
|
-
return
|
|
6827
|
+
return uint8ArrayToBase64(state);
|
|
6811
6828
|
}
|
|
6812
6829
|
function applyBackendChanges(documentID, base64Changes) {
|
|
6813
6830
|
const server = documents.get(documentID);
|
|
@@ -6826,10 +6843,9 @@ function registerDocument(id2, base64Data, undo = false, sendUpdateToBackend, se
|
|
|
6826
6843
|
throw new Error("document is already registered " + id2);
|
|
6827
6844
|
}
|
|
6828
6845
|
const clientProtocol = new ClientProtocol((update) => {
|
|
6829
|
-
const str = String.fromCharCode(...update);
|
|
6830
6846
|
const msg = JSON.stringify({
|
|
6831
6847
|
documentID: id2,
|
|
6832
|
-
data:
|
|
6848
|
+
data: uint8ArrayToBase64(update)
|
|
6833
6849
|
});
|
|
6834
6850
|
const fn = sendUpdateToBackend ?? onSendUpdateToBackend;
|
|
6835
6851
|
if (fn) {
|
|
@@ -6857,4 +6873,4 @@ function unregisterDocument(id2) {
|
|
|
6857
6873
|
documents.delete(id2);
|
|
6858
6874
|
protocols.delete(id2);
|
|
6859
6875
|
}
|
|
6860
|
-
export { ServerXmlDocument, applyBackendChanges, applyChanges, getState2 as getState, getStateVector2 as getStateVector, registerDocument, unregisterDocument };
|
|
6876
|
+
export { ServerXmlDocument, applyBackendChanges, applyChanges, base64ToUint8Array, getState2 as getState, getStateVector2 as getStateVector, registerDocument, uint8ArrayToBase64, unregisterDocument };
|
|
@@ -8,16 +8,14 @@ export declare class AgentDescription {
|
|
|
8
8
|
readonly description: string;
|
|
9
9
|
readonly outputSchema?: Record<string, any>;
|
|
10
10
|
readonly inputSchema?: Record<string, any>;
|
|
11
|
-
readonly requires: Requirement[];
|
|
12
11
|
readonly labels: string[];
|
|
13
12
|
readonly supportsTools: boolean;
|
|
14
|
-
constructor({ name, title, description, outputSchema, inputSchema,
|
|
13
|
+
constructor({ name, title, description, outputSchema, inputSchema, labels, supportsTools, }: {
|
|
15
14
|
name: string;
|
|
16
15
|
title: string;
|
|
17
16
|
description: string;
|
|
18
17
|
outputSchema?: Record<string, any>;
|
|
19
18
|
inputSchema?: Record<string, any>;
|
|
20
|
-
requires?: Requirement[];
|
|
21
19
|
labels?: string[];
|
|
22
20
|
supportsTools: boolean;
|
|
23
21
|
});
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AgentsClient = exports.ToolkitConfiguration = exports.ToolkitDescription = exports.ToolDescription = exports.AgentDescription = void 0;
|
|
4
4
|
const response_1 = require("./response");
|
|
5
|
-
const requirement_1 = require("./requirement");
|
|
6
5
|
class AgentDescription {
|
|
7
|
-
constructor({ name, title, description, outputSchema, inputSchema,
|
|
6
|
+
constructor({ name, title, description, outputSchema, inputSchema, labels, supportsTools, }) {
|
|
8
7
|
this.name = name;
|
|
9
8
|
this.title = title;
|
|
10
9
|
this.description = description;
|
|
11
10
|
this.outputSchema = outputSchema;
|
|
12
11
|
this.inputSchema = inputSchema;
|
|
13
|
-
this.requires = Array.isArray(requires) ? requires : [];
|
|
14
12
|
this.labels = Array.isArray(labels) ? labels : [];
|
|
15
13
|
this.supportsTools = supportsTools ?? false;
|
|
16
14
|
}
|
|
@@ -23,22 +21,9 @@ class AgentDescription {
|
|
|
23
21
|
output_schema: this.outputSchema,
|
|
24
22
|
labels: this.labels,
|
|
25
23
|
supports_tools: this.supportsTools,
|
|
26
|
-
requires: this.requires.map((requirement) => requirement.toJson()),
|
|
27
24
|
};
|
|
28
25
|
}
|
|
29
26
|
static fromJson(a) {
|
|
30
|
-
let requires = [];
|
|
31
|
-
if (Array.isArray(a["requires"])) {
|
|
32
|
-
requires = a["requires"].map((e) => {
|
|
33
|
-
if (e["toolkit"] != null) {
|
|
34
|
-
return requirement_1.RequiredToolkit.fromJson(e);
|
|
35
|
-
}
|
|
36
|
-
if (e["schema"] != null) {
|
|
37
|
-
return requirement_1.RequiredSchema.fromJson(e);
|
|
38
|
-
}
|
|
39
|
-
throw new Error("Invalid requirement object");
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
27
|
let labels = [];
|
|
43
28
|
if (Array.isArray(a["labels"])) {
|
|
44
29
|
labels = a["labels"].filter((item) => typeof item === "string");
|
|
@@ -49,7 +34,6 @@ class AgentDescription {
|
|
|
49
34
|
description: a["description"] ?? "",
|
|
50
35
|
inputSchema: a["input_schema"] ?? undefined,
|
|
51
36
|
outputSchema: a["output_schema"] ?? undefined,
|
|
52
|
-
requires,
|
|
53
37
|
supportsTools: a["supports_tools"] === true,
|
|
54
38
|
labels,
|
|
55
39
|
});
|
|
@@ -49713,9 +49713,11 @@ export var ServerXmlDocument: {
|
|
|
49713
49713
|
};
|
|
49714
49714
|
export function applyBackendChanges(documentID: any, base64Changes: any): void;
|
|
49715
49715
|
export function applyChanges(update: any): void;
|
|
49716
|
-
|
|
49717
|
-
declare function
|
|
49716
|
+
export function base64ToUint8Array(base642: any): Uint8Array<any>;
|
|
49717
|
+
declare function getState2(documentID: any, vector: any): string;
|
|
49718
|
+
declare function getStateVector2(documentID: any): string;
|
|
49718
49719
|
export function registerDocument(id2: any, base64Data: any, undo: boolean | undefined, sendUpdateToBackend: any, sendUpdateToClient: any): void;
|
|
49720
|
+
export function uint8ArrayToBase64(bytes: any): string;
|
|
49719
49721
|
export function unregisterDocument(id2: any): void;
|
|
49720
49722
|
declare var AbstractType: {
|
|
49721
49723
|
};
|
package/dist/node/entrypoint.js
CHANGED
|
@@ -8,9 +8,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.ServerXmlDocument = void 0;
|
|
9
9
|
exports.applyBackendChanges = applyBackendChanges;
|
|
10
10
|
exports.applyChanges = applyChanges;
|
|
11
|
+
exports.base64ToUint8Array = base64ToUint8Array;
|
|
11
12
|
exports.getState = getState2;
|
|
12
13
|
exports.getStateVector = getStateVector2;
|
|
13
14
|
exports.registerDocument = registerDocument;
|
|
15
|
+
exports.uint8ArrayToBase64 = uint8ArrayToBase64;
|
|
14
16
|
exports.unregisterDocument = unregisterDocument;
|
|
15
17
|
var __create = Object.create;
|
|
16
18
|
var __defProp = Object.defineProperty;
|
|
@@ -820,7 +822,7 @@ catch (e) {
|
|
|
820
822
|
}
|
|
821
823
|
var varStorage = _localStorage;
|
|
822
824
|
var EqualityTraitSymbol = Symbol("Equality");
|
|
823
|
-
var equals = (a, b) => a === b || a[EqualityTraitSymbol]?.(b) || false;
|
|
825
|
+
var equals = (a, b) => a === b || !!a?.[EqualityTraitSymbol]?.(b) || false;
|
|
824
826
|
var isObject = (o) => typeof o === "object";
|
|
825
827
|
var assign = Object.assign;
|
|
826
828
|
var keys = Object.keys;
|
|
@@ -6777,6 +6779,23 @@ var ServerXmlDocument = class {
|
|
|
6777
6779
|
};
|
|
6778
6780
|
exports.ServerXmlDocument = ServerXmlDocument;
|
|
6779
6781
|
var import_base_64 = __toESM(require_base64());
|
|
6782
|
+
function uint8ArrayToBase64(bytes) {
|
|
6783
|
+
let binary = "";
|
|
6784
|
+
const chunkSize = 32768;
|
|
6785
|
+
for (let i = 0; i < bytes.length; i += chunkSize) {
|
|
6786
|
+
binary += String.fromCharCode(...bytes.subarray(i, i + chunkSize));
|
|
6787
|
+
}
|
|
6788
|
+
return btoa(binary);
|
|
6789
|
+
}
|
|
6790
|
+
function base64ToUint8Array(base642) {
|
|
6791
|
+
const binary = atob(base642);
|
|
6792
|
+
const len = binary.length;
|
|
6793
|
+
const bytes = new Uint8Array(len);
|
|
6794
|
+
for (let i = 0; i < len; i++) {
|
|
6795
|
+
bytes[i] = binary.charCodeAt(i);
|
|
6796
|
+
}
|
|
6797
|
+
return bytes;
|
|
6798
|
+
}
|
|
6780
6799
|
var ClientProtocol = class {
|
|
6781
6800
|
constructor(onClientUpdate) {
|
|
6782
6801
|
this.doc = new Doc();
|
|
@@ -6809,7 +6828,7 @@ function getState2(documentID, vector) {
|
|
|
6809
6828
|
else {
|
|
6810
6829
|
state = encodeStateAsUpdate(server.doc);
|
|
6811
6830
|
}
|
|
6812
|
-
return
|
|
6831
|
+
return uint8ArrayToBase64(state);
|
|
6813
6832
|
}
|
|
6814
6833
|
function getStateVector2(documentID) {
|
|
6815
6834
|
const server = documents.get(documentID);
|
|
@@ -6817,7 +6836,7 @@ function getStateVector2(documentID) {
|
|
|
6817
6836
|
throw new Error("Document not registered: " + documentID);
|
|
6818
6837
|
}
|
|
6819
6838
|
const state = encodeStateVector(server.doc);
|
|
6820
|
-
return
|
|
6839
|
+
return uint8ArrayToBase64(state);
|
|
6821
6840
|
}
|
|
6822
6841
|
function applyBackendChanges(documentID, base64Changes) {
|
|
6823
6842
|
const server = documents.get(documentID);
|
|
@@ -6836,10 +6855,9 @@ function registerDocument(id2, base64Data, undo = false, sendUpdateToBackend, se
|
|
|
6836
6855
|
throw new Error("document is already registered " + id2);
|
|
6837
6856
|
}
|
|
6838
6857
|
const clientProtocol = new ClientProtocol((update) => {
|
|
6839
|
-
const str = String.fromCharCode(...update);
|
|
6840
6858
|
const msg = JSON.stringify({
|
|
6841
6859
|
documentID: id2,
|
|
6842
|
-
data:
|
|
6860
|
+
data: uint8ArrayToBase64(update)
|
|
6843
6861
|
});
|
|
6844
6862
|
const fn = sendUpdateToBackend ?? onSendUpdateToBackend;
|
|
6845
6863
|
if (fn) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshagent/meshagent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Meshagent Client",
|
|
5
5
|
"homepage": "https://github.com/meshagent/meshagent-ts",
|
|
6
6
|
"scripts": {
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"livekit-client": "^2.15.5",
|
|
49
49
|
"uuid": "^11.0.5",
|
|
50
50
|
"ws": "^8.18.0",
|
|
51
|
-
"yjs": "^13.6.
|
|
51
|
+
"yjs": "^13.6.28"
|
|
52
52
|
},
|
|
53
53
|
"overrides": {
|
|
54
54
|
"rollup": "4.52.5"
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
}
|