@silvana-one/coordination 1.0.32 → 1.0.34
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/dist/node/agent.d.ts +34 -1
- package/dist/node/agent.js +103 -33
- package/dist/node/agent.js.map +1 -1
- package/dist/node/index.cjs +96 -31
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/tsconfig.web.tsbuildinfo +1 -1
- package/dist/web/agent.d.ts +34 -1
- package/dist/web/agent.js +103 -33
- package/dist/web/agent.js.map +1 -1
- package/package.json +1 -1
- package/src/agent.ts +176 -73
package/dist/node/index.cjs
CHANGED
|
@@ -666,17 +666,18 @@ var AgentRegistry = class {
|
|
|
666
666
|
this.registry = params.registry;
|
|
667
667
|
}
|
|
668
668
|
static createAgentRegistry(params) {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
transaction.
|
|
669
|
+
const { name, transaction } = params;
|
|
670
|
+
console.log("Creating agent registry", name);
|
|
671
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
672
|
+
tx.moveCall({
|
|
672
673
|
target: `${silvanaRegistryPackage}::registry::create_registry`,
|
|
673
|
-
arguments: [
|
|
674
|
+
arguments: [tx.pure.string(name)]
|
|
674
675
|
});
|
|
675
|
-
return
|
|
676
|
+
return tx;
|
|
676
677
|
}
|
|
677
678
|
createDeveloper(params) {
|
|
678
|
-
const { name, github, image, description, site } = params;
|
|
679
|
-
const tx = new import_transactions6.Transaction();
|
|
679
|
+
const { name, github, image, description, site, transaction } = params;
|
|
680
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
680
681
|
tx.moveCall({
|
|
681
682
|
target: `${silvanaRegistryPackage}::registry::add_developer`,
|
|
682
683
|
arguments: [
|
|
@@ -692,8 +693,8 @@ var AgentRegistry = class {
|
|
|
692
693
|
return tx;
|
|
693
694
|
}
|
|
694
695
|
updateDeveloper(params) {
|
|
695
|
-
const { name, github, image, description, site } = params;
|
|
696
|
-
const tx = new import_transactions6.Transaction();
|
|
696
|
+
const { name, github, image, description, site, transaction } = params;
|
|
697
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
697
698
|
tx.moveCall({
|
|
698
699
|
target: `${silvanaRegistryPackage}::registry::update_developer`,
|
|
699
700
|
arguments: [
|
|
@@ -709,8 +710,8 @@ var AgentRegistry = class {
|
|
|
709
710
|
return tx;
|
|
710
711
|
}
|
|
711
712
|
removeDeveloper(params) {
|
|
712
|
-
const { name, agentNames } = params;
|
|
713
|
-
const tx = new import_transactions6.Transaction();
|
|
713
|
+
const { name, agentNames, transaction } = params;
|
|
714
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
714
715
|
tx.moveCall({
|
|
715
716
|
target: `${silvanaRegistryPackage}::registry::remove_developer`,
|
|
716
717
|
arguments: [
|
|
@@ -723,8 +724,8 @@ var AgentRegistry = class {
|
|
|
723
724
|
return tx;
|
|
724
725
|
}
|
|
725
726
|
createAgent(params) {
|
|
726
|
-
const { developer, name, image, description, site, chains } = params;
|
|
727
|
-
const tx = new import_transactions6.Transaction();
|
|
727
|
+
const { developer, name, image, description, site, chains, transaction } = params;
|
|
728
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
728
729
|
tx.moveCall({
|
|
729
730
|
target: `${silvanaRegistryPackage}::registry::add_agent`,
|
|
730
731
|
arguments: [
|
|
@@ -741,8 +742,8 @@ var AgentRegistry = class {
|
|
|
741
742
|
return tx;
|
|
742
743
|
}
|
|
743
744
|
updateAgent(params) {
|
|
744
|
-
const { developer, name, image, description, site, chains } = params;
|
|
745
|
-
const tx = new import_transactions6.Transaction();
|
|
745
|
+
const { developer, name, image, description, site, chains, transaction } = params;
|
|
746
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
746
747
|
tx.moveCall({
|
|
747
748
|
target: `${silvanaRegistryPackage}::registry::update_agent`,
|
|
748
749
|
arguments: [
|
|
@@ -759,8 +760,8 @@ var AgentRegistry = class {
|
|
|
759
760
|
return tx;
|
|
760
761
|
}
|
|
761
762
|
removeAgent(params) {
|
|
762
|
-
const { developer, agent } = params;
|
|
763
|
-
const tx = new import_transactions6.Transaction();
|
|
763
|
+
const { developer, agent, transaction } = params;
|
|
764
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
764
765
|
tx.moveCall({
|
|
765
766
|
target: `${silvanaRegistryPackage}::registry::remove_agent`,
|
|
766
767
|
arguments: [
|
|
@@ -773,8 +774,8 @@ var AgentRegistry = class {
|
|
|
773
774
|
return tx;
|
|
774
775
|
}
|
|
775
776
|
addAgentMethod(params) {
|
|
776
|
-
const { developer, agent, method, dockerImage, dockerSha256, minMemoryGb, minCpuCores, requiresTee } = params;
|
|
777
|
-
const tx = new import_transactions6.Transaction();
|
|
777
|
+
const { developer, agent, method, dockerImage, dockerSha256, minMemoryGb, minCpuCores, requiresTee, transaction } = params;
|
|
778
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
778
779
|
tx.moveCall({
|
|
779
780
|
target: `${silvanaRegistryPackage}::registry::add_method`,
|
|
780
781
|
arguments: [
|
|
@@ -793,8 +794,8 @@ var AgentRegistry = class {
|
|
|
793
794
|
return tx;
|
|
794
795
|
}
|
|
795
796
|
updateAgentMethod(params) {
|
|
796
|
-
const { developer, agent, method, dockerImage, dockerSha256, minMemoryGb, minCpuCores, requiresTee } = params;
|
|
797
|
-
const tx = new import_transactions6.Transaction();
|
|
797
|
+
const { developer, agent, method, dockerImage, dockerSha256, minMemoryGb, minCpuCores, requiresTee, transaction } = params;
|
|
798
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
798
799
|
tx.moveCall({
|
|
799
800
|
target: `${silvanaRegistryPackage}::registry::update_method`,
|
|
800
801
|
arguments: [
|
|
@@ -813,8 +814,8 @@ var AgentRegistry = class {
|
|
|
813
814
|
return tx;
|
|
814
815
|
}
|
|
815
816
|
removeAgentMethod(params) {
|
|
816
|
-
const { developer, agent, method } = params;
|
|
817
|
-
const tx = new import_transactions6.Transaction();
|
|
817
|
+
const { developer, agent, method, transaction } = params;
|
|
818
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
818
819
|
tx.moveCall({
|
|
819
820
|
target: `${silvanaRegistryPackage}::registry::remove_method`,
|
|
820
821
|
arguments: [
|
|
@@ -828,8 +829,8 @@ var AgentRegistry = class {
|
|
|
828
829
|
return tx;
|
|
829
830
|
}
|
|
830
831
|
addMethodToApp(params) {
|
|
831
|
-
const { appName, methodName, description, developerName, agentName, agentMethod } = params;
|
|
832
|
-
const tx = new import_transactions6.Transaction();
|
|
832
|
+
const { appName, methodName, description, developerName, agentName, agentMethod, transaction } = params;
|
|
833
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
833
834
|
const appMethod = tx.moveCall({
|
|
834
835
|
target: `${silvanaRegistryPackage}::app_method::new`,
|
|
835
836
|
arguments: [
|
|
@@ -851,8 +852,8 @@ var AgentRegistry = class {
|
|
|
851
852
|
return tx;
|
|
852
853
|
}
|
|
853
854
|
addMetadata(params) {
|
|
854
|
-
const { appInstanceId, key, value } = params;
|
|
855
|
-
const tx = new import_transactions6.Transaction();
|
|
855
|
+
const { appInstanceId, key, value, transaction } = params;
|
|
856
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
856
857
|
tx.moveCall({
|
|
857
858
|
target: `${silvanaRegistryPackage}::app_instance::add_metadata`,
|
|
858
859
|
arguments: [
|
|
@@ -864,8 +865,8 @@ var AgentRegistry = class {
|
|
|
864
865
|
return tx;
|
|
865
866
|
}
|
|
866
867
|
setDefaultMethod(params) {
|
|
867
|
-
const { developer, agent, method } = params;
|
|
868
|
-
const tx = new import_transactions6.Transaction();
|
|
868
|
+
const { developer, agent, method, transaction } = params;
|
|
869
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
869
870
|
tx.moveCall({
|
|
870
871
|
target: `${silvanaRegistryPackage}::registry::set_default_method`,
|
|
871
872
|
arguments: [
|
|
@@ -879,8 +880,8 @@ var AgentRegistry = class {
|
|
|
879
880
|
return tx;
|
|
880
881
|
}
|
|
881
882
|
removeDefaultMethod(params) {
|
|
882
|
-
const { developer, agent } = params;
|
|
883
|
-
const tx = new import_transactions6.Transaction();
|
|
883
|
+
const { developer, agent, transaction } = params;
|
|
884
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
884
885
|
tx.moveCall({
|
|
885
886
|
target: `${silvanaRegistryPackage}::registry::remove_default_method`,
|
|
886
887
|
arguments: [
|
|
@@ -1016,6 +1017,70 @@ var AgentRegistry = class {
|
|
|
1016
1017
|
}
|
|
1017
1018
|
return agent;
|
|
1018
1019
|
}
|
|
1020
|
+
async getApp(params) {
|
|
1021
|
+
const appObject = await fetchSuiDynamicField({
|
|
1022
|
+
objectID: this.registry,
|
|
1023
|
+
fieldName: "apps",
|
|
1024
|
+
type: "0x1::string::String",
|
|
1025
|
+
key: params.name
|
|
1026
|
+
});
|
|
1027
|
+
if (!appObject) {
|
|
1028
|
+
return void 0;
|
|
1029
|
+
}
|
|
1030
|
+
const methods = {};
|
|
1031
|
+
const methodsData = appObject?.methods?.fields?.contents;
|
|
1032
|
+
if (methodsData && Array.isArray(methodsData)) {
|
|
1033
|
+
for (const entry of methodsData) {
|
|
1034
|
+
const key = entry?.fields?.key;
|
|
1035
|
+
const value = entry?.fields?.value;
|
|
1036
|
+
if (key && value) {
|
|
1037
|
+
methods[key] = {
|
|
1038
|
+
description: value.description ?? void 0,
|
|
1039
|
+
developer: value.developer,
|
|
1040
|
+
agent: value.agent,
|
|
1041
|
+
agentMethod: value.agent_method
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
const instances = [];
|
|
1047
|
+
const instancesData = appObject?.instances?.fields?.contents;
|
|
1048
|
+
if (instancesData && Array.isArray(instancesData)) {
|
|
1049
|
+
for (const instance of instancesData) {
|
|
1050
|
+
if (instance?.fields?.key) {
|
|
1051
|
+
instances.push(instance.fields.key);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
const app = {
|
|
1056
|
+
id: appObject?.id?.id,
|
|
1057
|
+
name: appObject.name,
|
|
1058
|
+
description: appObject?.description ?? void 0,
|
|
1059
|
+
methods,
|
|
1060
|
+
owner: appObject.owner,
|
|
1061
|
+
createdAt: Number(appObject.created_at),
|
|
1062
|
+
updatedAt: Number(appObject.updated_at),
|
|
1063
|
+
version: Number(appObject.version),
|
|
1064
|
+
instances
|
|
1065
|
+
};
|
|
1066
|
+
if (!app.id || !app.name || !app.owner) {
|
|
1067
|
+
return void 0;
|
|
1068
|
+
}
|
|
1069
|
+
return app;
|
|
1070
|
+
}
|
|
1071
|
+
removeApp(params) {
|
|
1072
|
+
const { name, transaction } = params;
|
|
1073
|
+
const tx = transaction ?? new import_transactions6.Transaction();
|
|
1074
|
+
tx.moveCall({
|
|
1075
|
+
target: `${silvanaRegistryPackage}::registry::remove_app`,
|
|
1076
|
+
arguments: [
|
|
1077
|
+
tx.object(this.registry),
|
|
1078
|
+
tx.pure.string(name),
|
|
1079
|
+
tx.object(import_utils.SUI_CLOCK_OBJECT_ID)
|
|
1080
|
+
]
|
|
1081
|
+
});
|
|
1082
|
+
return tx;
|
|
1083
|
+
}
|
|
1019
1084
|
static async getDockerImageDetails(params) {
|
|
1020
1085
|
try {
|
|
1021
1086
|
const { dockerImage } = params;
|