@intelli-1113/stratos-sdk 1.3.2 → 1.3.4
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/package.json +1 -1
- package/src/index.js +69 -11
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -51,21 +51,75 @@ function agentDeps() {
|
|
|
51
51
|
|
|
52
52
|
function detectFramework() {
|
|
53
53
|
if (process.env.STRATOS_FRAMEWORK) return process.env.STRATOS_FRAMEWORK;
|
|
54
|
+
|
|
54
55
|
const deps = agentDeps();
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
if (
|
|
61
|
-
if (
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (
|
|
56
|
+
const inDeps = (n) => n in deps;
|
|
57
|
+
const isResolvable = (n) => resolvableFromCwd(n) || resolvable(n);
|
|
58
|
+
|
|
59
|
+
// 1. FIRST PASS: Check explicit dependencies declared in the user's package.json
|
|
60
|
+
if (inDeps("@google/adk") || inDeps("google-adk") || inDeps("@iqai/adk")) return "google-adk";
|
|
61
|
+
if (inDeps("@openai/agents")) return "openai-agents";
|
|
62
|
+
if (inDeps("llamaindex")) return "llamaindex";
|
|
63
|
+
if (inDeps("crewai")) return "crewai";
|
|
64
|
+
|
|
65
|
+
// If the user explicitly declared langgraph in package.json
|
|
66
|
+
if (inDeps("@langchain/langgraph")) return "langgraph";
|
|
67
|
+
// If the user declared langchain or @langchain/core
|
|
68
|
+
if (inDeps("langchain") || inDeps("@langchain/core")) return "langchain";
|
|
69
|
+
|
|
70
|
+
if (inDeps("ai")) return "vercel-ai";
|
|
71
|
+
if (inDeps("@google/generative-ai") || inDeps("@google/genai")) return "google-genai";
|
|
72
|
+
if (inDeps("@anthropic-ai/sdk")) return "anthropic";
|
|
73
|
+
if (inDeps("openai")) return "openai";
|
|
74
|
+
|
|
75
|
+
// 2. SECOND PASS: Fallback to node_modules inspection if package.json has no direct match
|
|
76
|
+
if (isResolvable("@google/adk") || isResolvable("google-adk") || isResolvable("@iqai/adk")) return "google-adk";
|
|
77
|
+
if (isResolvable("@openai/agents")) return "openai-agents";
|
|
78
|
+
if (isResolvable("llamaindex")) return "llamaindex";
|
|
79
|
+
if (isResolvable("crewai")) return "crewai";
|
|
80
|
+
|
|
81
|
+
// Prioritize langchain over internal transitive langgraph
|
|
82
|
+
if (isResolvable("langchain") || isResolvable("@langchain/core")) return "langchain";
|
|
83
|
+
if (isResolvable("@langchain/langgraph")) return "langgraph";
|
|
84
|
+
|
|
85
|
+
if (isResolvable("ai")) return "vercel-ai";
|
|
86
|
+
if (isResolvable("@google/generative-ai") || isResolvable("@google/genai")) return "google-genai";
|
|
87
|
+
if (isResolvable("@anthropic-ai/sdk")) return "anthropic";
|
|
88
|
+
if (isResolvable("openai")) return "openai";
|
|
89
|
+
|
|
66
90
|
return null;
|
|
67
91
|
}
|
|
68
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Warn user if no supported framework is detected.
|
|
95
|
+
* Provide list of supported frameworks and docs link.
|
|
96
|
+
*/
|
|
97
|
+
function warnUnsupportedFramework(detectedFramework) {
|
|
98
|
+
if (detectedFramework) return false; // Framework detected, no warning needed
|
|
99
|
+
|
|
100
|
+
const supportedFrameworks = [
|
|
101
|
+
"LangChain (@langchain/core, @langchain/langgraph)",
|
|
102
|
+
"OpenAI (@openai/agents, openai)",
|
|
103
|
+
"Anthropic (@anthropic-ai/sdk)",
|
|
104
|
+
"Vercel AI (ai)",
|
|
105
|
+
"Google GenAI (@google/genai, @google/generative-ai)",
|
|
106
|
+
"LlamaIndex (llamaindex)",
|
|
107
|
+
"CrewAI (crewai)",
|
|
108
|
+
"Google ADK (@google/adk, google-adk)",
|
|
109
|
+
"OpenAI Agents (@openai/agents)",
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
const message = [
|
|
113
|
+
"[stratos] ⚠ No supported framework detected.",
|
|
114
|
+
"[stratos] Supported frameworks:",
|
|
115
|
+
...supportedFrameworks.map((fw) => `[stratos] • ${fw}`),
|
|
116
|
+
"[stratos] To add your framework: https://docs.stratos.ai/integrate",
|
|
117
|
+
].join("\n");
|
|
118
|
+
|
|
119
|
+
console.warn(message);
|
|
120
|
+
return true; // Flag indicating unsupported framework
|
|
121
|
+
}
|
|
122
|
+
|
|
69
123
|
function detectModel(opts) {
|
|
70
124
|
return (
|
|
71
125
|
opts.model ||
|
|
@@ -158,6 +212,10 @@ export function start(opts = {}) {
|
|
|
158
212
|
tools: toolsEnv,
|
|
159
213
|
};
|
|
160
214
|
|
|
215
|
+
// Warn if no supported framework is detected
|
|
216
|
+
const isUnsupportedFramework = warnUnsupportedFramework(meta.framework);
|
|
217
|
+
meta.frameworkSupported = !isUnsupportedFramework;
|
|
218
|
+
|
|
161
219
|
// Heartbeat is also how the network guard (enforcement.js) learns whether to
|
|
162
220
|
// freeze this agent — budget exhausted, period crossed, or the agent
|
|
163
221
|
// manually disabled from the Control Tower all collapse into the same
|