@redplanethq/sdk 0.1.19 → 0.1.21

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/index.js CHANGED
@@ -78,6 +78,163 @@ var GeminiModels = [
78
78
  exports.LLMModelEnum.GEMINI20FLASHLITE
79
79
  ];
80
80
 
81
+ // ../types/dist/llm/providers.js
82
+ var PROVIDER_SPECS = {
83
+ openai: {
84
+ id: "openai",
85
+ label: "OpenAI",
86
+ serverDefault: true,
87
+ byokSupported: true,
88
+ apiKeyVar: "OPENAI_API_KEY",
89
+ apiKeyPlaceholder: "sk-...",
90
+ baseUrl: {
91
+ var: "OPENAI_BASE_URL",
92
+ required: false,
93
+ placeholder: "https://api.openai.com/v1",
94
+ hint: "Leave blank for OpenAI direct, or paste an OpenAI-compatible proxy URL"
95
+ },
96
+ defaultChatModel: "gpt-5.2-2025-12-11"
97
+ },
98
+ anthropic: {
99
+ id: "anthropic",
100
+ label: "Anthropic",
101
+ serverDefault: true,
102
+ byokSupported: true,
103
+ apiKeyVar: "ANTHROPIC_API_KEY",
104
+ apiKeyPlaceholder: "sk-ant-...",
105
+ defaultChatModel: "claude-opus-4-7"
106
+ },
107
+ google: {
108
+ id: "google",
109
+ label: "Google",
110
+ serverDefault: true,
111
+ byokSupported: true,
112
+ apiKeyVar: "GOOGLE_GENERATIVE_AI_API_KEY",
113
+ apiKeyPlaceholder: "AIza...",
114
+ defaultChatModel: "gemini-2.5-pro"
115
+ },
116
+ ollama: {
117
+ id: "ollama",
118
+ label: "Ollama (local)",
119
+ serverDefault: true,
120
+ byokSupported: true,
121
+ apiKeyVar: null,
122
+ apiKeyPlaceholder: "",
123
+ baseUrl: {
124
+ var: "OLLAMA_URL",
125
+ required: true,
126
+ placeholder: "http://localhost:11434",
127
+ hint: "URL of your local Ollama server"
128
+ },
129
+ defaultChatModel: "llama3.2",
130
+ modelHint: "Use model IDs like ollama/llama3.2"
131
+ },
132
+ azure: {
133
+ id: "azure",
134
+ label: "Azure OpenAI",
135
+ serverDefault: true,
136
+ byokSupported: true,
137
+ apiKeyVar: "AZURE_API_KEY",
138
+ apiKeyPlaceholder: "sk-...",
139
+ baseUrl: {
140
+ var: "AZURE_BASE_URL",
141
+ required: true,
142
+ placeholder: "https://<resource>.openai.azure.com/openai/v1",
143
+ hint: "Your Azure OpenAI resource endpoint"
144
+ },
145
+ isAzure: true,
146
+ defaultChatModel: "gpt-4o",
147
+ modelHint: "Use model IDs like azure/gpt-4o (deployment name after azure/)"
148
+ },
149
+ openrouter: {
150
+ id: "openrouter",
151
+ label: "OpenRouter",
152
+ serverDefault: true,
153
+ byokSupported: true,
154
+ apiKeyVar: "OPENROUTER_API_KEY",
155
+ apiKeyPlaceholder: "sk-or-...",
156
+ defaultChatModel: "openrouter/anthropic/claude-3.5-haiku",
157
+ modelHint: "Use model IDs like openrouter/anthropic/claude-3.5-haiku"
158
+ },
159
+ deepseek: {
160
+ id: "deepseek",
161
+ label: "DeepSeek",
162
+ serverDefault: true,
163
+ byokSupported: true,
164
+ apiKeyVar: "DEEPSEEK_API_KEY",
165
+ apiKeyPlaceholder: "sk-...",
166
+ defaultChatModel: "deepseek-chat"
167
+ },
168
+ vercel: {
169
+ id: "vercel",
170
+ label: "Vercel AI Gateway",
171
+ serverDefault: true,
172
+ byokSupported: true,
173
+ apiKeyVar: "VERCEL_AI_GATEWAY_API_KEY",
174
+ apiKeyPlaceholder: "aig-...",
175
+ defaultChatModel: "vercel/anthropic/claude-sonnet-4-5",
176
+ modelHint: "Use model IDs like vercel/anthropic/claude-sonnet-4-5"
177
+ },
178
+ groq: {
179
+ id: "groq",
180
+ label: "Groq",
181
+ serverDefault: true,
182
+ byokSupported: true,
183
+ apiKeyVar: "GROQ_API_KEY",
184
+ apiKeyPlaceholder: "gsk_...",
185
+ defaultChatModel: "groq/llama-3.3-70b-versatile",
186
+ modelHint: "Use model IDs like groq/llama-3.3-70b-versatile"
187
+ },
188
+ mistral: {
189
+ id: "mistral",
190
+ label: "Mistral",
191
+ serverDefault: true,
192
+ byokSupported: true,
193
+ apiKeyVar: "MISTRAL_API_KEY",
194
+ apiKeyPlaceholder: "...",
195
+ defaultChatModel: "mistral-large-latest"
196
+ },
197
+ xai: {
198
+ id: "xai",
199
+ label: "xAI (Grok)",
200
+ serverDefault: true,
201
+ byokSupported: true,
202
+ apiKeyVar: "XAI_API_KEY",
203
+ apiKeyPlaceholder: "xai-...",
204
+ defaultChatModel: "grok-3-mini",
205
+ modelHint: "Use model IDs like grok-3-mini"
206
+ }
207
+ };
208
+ var ALL_PROVIDERS = Object.keys(PROVIDER_SPECS);
209
+ var CHAT_PROVIDERS = ALL_PROVIDERS.filter((id) => PROVIDER_SPECS[id].serverDefault);
210
+ var BYOK_PROVIDERS = ALL_PROVIDERS.filter((id) => PROVIDER_SPECS[id].byokSupported);
211
+ var EMBEDDING_PROVIDERS = [
212
+ "openai",
213
+ "google",
214
+ "ollama",
215
+ "azure"
216
+ ];
217
+ function isSupportedProvider(id) {
218
+ return id in PROVIDER_SPECS;
219
+ }
220
+ __name(isSupportedProvider, "isSupportedProvider");
221
+ function isByokProvider(id) {
222
+ var _a;
223
+ return ((_a = PROVIDER_SPECS[id]) === null || _a === void 0 ? void 0 : _a.byokSupported) === true;
224
+ }
225
+ __name(isByokProvider, "isByokProvider");
226
+ function isChatProvider(id) {
227
+ var _a;
228
+ return ((_a = PROVIDER_SPECS[id]) === null || _a === void 0 ? void 0 : _a.serverDefault) === true;
229
+ }
230
+ __name(isChatProvider, "isChatProvider");
231
+ function getProviderSpec(id) {
232
+ const spec = PROVIDER_SPECS[id];
233
+ if (!spec) throw new Error(`Unknown provider id: ${id}`);
234
+ return spec;
235
+ }
236
+ __name(getProviderSpec, "getProviderSpec");
237
+
81
238
  // ../types/dist/graph/graph.entity.js
82
239
  var EPISODIC_NODE_PROPERTIES = `{
83
240
  uuid: e.uuid,
@@ -550,10 +707,17 @@ var GetDocumentInputSchema = zod.z.object({
550
707
  var GetDocumentResponseSchema = zod.z.object({
551
708
  document: DocumentSchema.nullable()
552
709
  });
710
+ var GetSkillInputSchema = zod.z.object({
711
+ skillId: zod.z.string()
712
+ });
713
+ var GetSkillResponseSchema = zod.z.object({
714
+ skill: DocumentSchema.nullable()
715
+ });
553
716
  var GatewayAgentInfoSchema = zod.z.object({
554
717
  id: zod.z.string(),
555
718
  name: zod.z.string(),
556
719
  description: zod.z.string(),
720
+ baseUrl: zod.z.string(),
557
721
  tools: zod.z.array(zod.z.string()),
558
722
  platform: zod.z.string().nullable(),
559
723
  hostname: zod.z.string().nullable(),
@@ -562,20 +726,18 @@ var GatewayAgentInfoSchema = zod.z.object({
562
726
  "DISCONNECTED"
563
727
  ])
564
728
  });
565
- var GetGatewaysResponseSchema = zod.z.object({
566
- gateways: zod.z.array(GatewayAgentInfoSchema)
567
- });
568
- var ExecuteGatewayInputSchema = zod.z.object({
569
- gatewayId: zod.z.string(),
570
- intent: zod.z.string()
729
+ var RegisterGatewayRequestSchema = zod.z.object({
730
+ intent: zod.z.literal("register"),
731
+ baseUrl: zod.z.string().url(),
732
+ securityKey: zod.z.string().min(10),
733
+ name: zod.z.string().min(1).max(64).optional(),
734
+ description: zod.z.string().max(500).optional()
571
735
  });
572
- var ExecuteGatewayToolInputSchema = zod.z.object({
573
- gatewayId: zod.z.string(),
574
- toolName: zod.z.string(),
575
- params: zod.z.record(zod.z.unknown())
736
+ var RegisterGatewayResponseSchema = zod.z.object({
737
+ gatewayId: zod.z.string()
576
738
  });
577
- var ExecuteGatewayResponseSchema = zod.z.object({
578
- result: zod.z.unknown()
739
+ var GetGatewaysResponseSchema = zod.z.object({
740
+ gateways: zod.z.array(GatewayAgentInfoSchema)
579
741
  });
580
742
  var AuthorizationCodeResponseSchema = zod.z.object({
581
743
  authorizationCode: zod.z.string(),
@@ -765,6 +927,13 @@ var CoreClient = class {
765
927
  return this.request("GET", `/api/v1/documents/${params.documentId}`);
766
928
  }
767
929
  /**
930
+ * Get a single skill by ID.
931
+ * GET /api/v1/skills/:skillId
932
+ */
933
+ async getSkill(params) {
934
+ return this.request("GET", `/api/v1/skills/${params.skillId}`);
935
+ }
936
+ /**
768
937
  * List all connected gateways for the workspace.
769
938
  * GET /api/v1/gateways
770
939
  */
@@ -772,26 +941,17 @@ var CoreClient = class {
772
941
  return this.request("GET", "/api/v1/gateways");
773
942
  }
774
943
  /**
775
- * Run a gateway sub-agent with an intent and return the final text result.
776
- * POST /api/v1/gateways/:gatewayId/execute
777
- */
778
- async executeGateway(params) {
779
- return this.request("POST", `/api/v1/gateways/${params.gatewayId}/execute`, {
780
- body: {
781
- intent: params.intent
782
- }
783
- });
784
- }
785
- /**
786
- * Proxy a single tool call to a gateway via server websocket.
787
- * POST /api/v1/gateways/:gatewayId/execute (mode: "tool")
944
+ * Register a self-hosted gateway with the workspace.
945
+ * POST /api/v1/gateways (body: { intent: "register", baseUrl, securityKey, name?, description? })
946
+ *
947
+ * The webapp probes the gateway's `/verify` to confirm reachability and
948
+ * that the supplied key matches its stored hash before persisting.
788
949
  */
789
- async executeGatewayTool(params) {
790
- return this.request("POST", `/api/v1/gateways/${params.gatewayId}/execute`, {
950
+ async registerGateway(input) {
951
+ return this.request("POST", "/api/v1/gateways", {
791
952
  body: {
792
- mode: "tool",
793
- toolName: params.toolName,
794
- params: params.params
953
+ intent: "register",
954
+ ...input
795
955
  }
796
956
  });
797
957
  }
@@ -829,21 +989,22 @@ var CoreClient = class {
829
989
  }
830
990
  };
831
991
 
992
+ exports.ALL_PROVIDERS = ALL_PROVIDERS;
832
993
  exports.ActionStatus = ActionStatus;
833
994
  exports.AuthorizationCodeResponseSchema = AuthorizationCodeResponseSchema;
995
+ exports.BYOK_PROVIDERS = BYOK_PROVIDERS;
996
+ exports.CHAT_PROVIDERS = CHAT_PROVIDERS;
834
997
  exports.COMPACTED_SESSION_NODE_PROPERTIES = COMPACTED_SESSION_NODE_PROPERTIES;
835
998
  exports.ClaudeModels = ClaudeModels;
836
999
  exports.CoreClient = CoreClient;
837
1000
  exports.CoreClientError = CoreClientError;
838
1001
  exports.DocumentSchema = DocumentSchema;
1002
+ exports.EMBEDDING_PROVIDERS = EMBEDDING_PROVIDERS;
839
1003
  exports.ENTITY_NODE_PROPERTIES = ENTITY_NODE_PROPERTIES;
840
1004
  exports.EPISODIC_NODE_PROPERTIES = EPISODIC_NODE_PROPERTIES;
841
1005
  exports.EXPLICIT_PATTERN_TYPES = EXPLICIT_PATTERN_TYPES;
842
1006
  exports.EntityTypes = EntityTypes;
843
1007
  exports.EpisodeType = EpisodeType;
844
- exports.ExecuteGatewayInputSchema = ExecuteGatewayInputSchema;
845
- exports.ExecuteGatewayResponseSchema = ExecuteGatewayResponseSchema;
846
- exports.ExecuteGatewayToolInputSchema = ExecuteGatewayToolInputSchema;
847
1008
  exports.ExecuteIntegrationActionInputSchema = ExecuteIntegrationActionInputSchema;
848
1009
  exports.ExecuteIntegrationActionResponseSchema = ExecuteIntegrationActionResponseSchema;
849
1010
  exports.GRAPH_ASPECTS = GRAPH_ASPECTS;
@@ -857,6 +1018,8 @@ exports.GetGatewaysResponseSchema = GetGatewaysResponseSchema;
857
1018
  exports.GetIntegrationActionsInputSchema = GetIntegrationActionsInputSchema;
858
1019
  exports.GetIntegrationActionsResponseSchema = GetIntegrationActionsResponseSchema;
859
1020
  exports.GetIntegrationsConnectedResponseSchema = GetIntegrationsConnectedResponseSchema;
1021
+ exports.GetSkillInputSchema = GetSkillInputSchema;
1022
+ exports.GetSkillResponseSchema = GetSkillResponseSchema;
860
1023
  exports.IMPLICIT_PATTERN_TYPES = IMPLICIT_PATTERN_TYPES;
861
1024
  exports.IngestInputSchema = IngestInputSchema;
862
1025
  exports.IngestResponseSchema = IngestResponseSchema;
@@ -867,7 +1030,10 @@ exports.MeResponseSchema = MeResponseSchema;
867
1030
  exports.OAuth2Params = OAuth2Params;
868
1031
  exports.OpenAIModels = OpenAIModels;
869
1032
  exports.PATTERN_TYPES = PATTERN_TYPES;
1033
+ exports.PROVIDER_SPECS = PROVIDER_SPECS;
870
1034
  exports.QUALITY_THRESHOLDS = QUALITY_THRESHOLDS;
1035
+ exports.RegisterGatewayRequestSchema = RegisterGatewayRequestSchema;
1036
+ exports.RegisterGatewayResponseSchema = RegisterGatewayResponseSchema;
871
1037
  exports.STATEMENT_NODE_PROPERTIES = STATEMENT_NODE_PROPERTIES;
872
1038
  exports.SearchInputSchema = SearchInputSchema;
873
1039
  exports.SearchResponseSchema = SearchResponseSchema;
@@ -876,5 +1042,9 @@ exports.StatementAspects = StatementAspects;
876
1042
  exports.TokenExchangeInputSchema = TokenExchangeInputSchema;
877
1043
  exports.TokenExchangeResponseSchema = TokenExchangeResponseSchema;
878
1044
  exports.VOICE_ASPECTS = VOICE_ASPECTS;
1045
+ exports.getProviderSpec = getProviderSpec;
1046
+ exports.isByokProvider = isByokProvider;
1047
+ exports.isChatProvider = isChatProvider;
1048
+ exports.isSupportedProvider = isSupportedProvider;
879
1049
  //# sourceMappingURL=index.js.map
880
1050
  //# sourceMappingURL=index.js.map