@dexto/agent-management 1.5.6 → 1.5.8
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/config/config-enrichment.cjs +72 -21
- package/dist/config/config-enrichment.d.ts +10 -2
- package/dist/config/config-enrichment.d.ts.map +1 -1
- package/dist/config/config-enrichment.js +76 -21
- package/dist/config/discover-prompts.cjs +1 -1
- package/dist/config/discover-prompts.d.ts +11 -11
- package/dist/config/discover-prompts.d.ts.map +1 -1
- package/dist/config/discover-prompts.js +1 -1
- package/dist/config/loader.cjs +31 -13
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +31 -13
- package/dist/index.cjs +76 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +78 -0
- package/dist/models/custom-models.cjs +2 -1
- package/dist/models/custom-models.d.ts +7 -6
- package/dist/models/custom-models.d.ts.map +1 -1
- package/dist/models/custom-models.js +2 -1
- package/dist/plugins/discover-plugins.cjs +176 -0
- package/dist/plugins/discover-plugins.d.ts +39 -0
- package/dist/plugins/discover-plugins.d.ts.map +1 -0
- package/dist/plugins/discover-plugins.js +140 -0
- package/dist/plugins/discover-skills.cjs +93 -0
- package/dist/plugins/discover-skills.d.ts +49 -0
- package/dist/plugins/discover-skills.d.ts.map +1 -0
- package/dist/plugins/discover-skills.js +58 -0
- package/dist/plugins/error-codes.cjs +47 -0
- package/dist/plugins/error-codes.d.ts +24 -0
- package/dist/plugins/error-codes.d.ts.map +1 -0
- package/dist/plugins/error-codes.js +23 -0
- package/dist/plugins/errors.cjs +197 -0
- package/dist/plugins/errors.d.ts +68 -0
- package/dist/plugins/errors.d.ts.map +1 -0
- package/dist/plugins/errors.js +173 -0
- package/dist/plugins/index.cjs +144 -0
- package/dist/plugins/index.d.ts +23 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +115 -0
- package/dist/plugins/install-plugin.cjs +211 -0
- package/dist/plugins/install-plugin.d.ts +47 -0
- package/dist/plugins/install-plugin.d.ts.map +1 -0
- package/dist/plugins/install-plugin.js +173 -0
- package/dist/plugins/list-plugins.cjs +134 -0
- package/dist/plugins/list-plugins.d.ts +26 -0
- package/dist/plugins/list-plugins.d.ts.map +1 -0
- package/dist/plugins/list-plugins.js +99 -0
- package/dist/plugins/load-plugin.cjs +197 -0
- package/dist/plugins/load-plugin.d.ts +20 -0
- package/dist/plugins/load-plugin.d.ts.map +1 -0
- package/dist/plugins/load-plugin.js +163 -0
- package/dist/plugins/marketplace/error-codes.cjs +45 -0
- package/dist/plugins/marketplace/error-codes.d.ts +21 -0
- package/dist/plugins/marketplace/error-codes.d.ts.map +1 -0
- package/dist/plugins/marketplace/error-codes.js +21 -0
- package/dist/plugins/marketplace/errors.cjs +188 -0
- package/dist/plugins/marketplace/errors.d.ts +64 -0
- package/dist/plugins/marketplace/errors.d.ts.map +1 -0
- package/dist/plugins/marketplace/errors.js +164 -0
- package/dist/plugins/marketplace/index.cjs +95 -0
- package/dist/plugins/marketplace/index.d.ts +14 -0
- package/dist/plugins/marketplace/index.d.ts.map +1 -0
- package/dist/plugins/marketplace/index.js +74 -0
- package/dist/plugins/marketplace/install-from-marketplace.cjs +152 -0
- package/dist/plugins/marketplace/install-from-marketplace.d.ts +25 -0
- package/dist/plugins/marketplace/install-from-marketplace.d.ts.map +1 -0
- package/dist/plugins/marketplace/install-from-marketplace.js +120 -0
- package/dist/plugins/marketplace/operations.cjs +374 -0
- package/dist/plugins/marketplace/operations.d.ts +43 -0
- package/dist/plugins/marketplace/operations.d.ts.map +1 -0
- package/dist/plugins/marketplace/operations.js +339 -0
- package/dist/plugins/marketplace/registry.cjs +166 -0
- package/dist/plugins/marketplace/registry.d.ts +72 -0
- package/dist/plugins/marketplace/registry.d.ts.map +1 -0
- package/dist/plugins/marketplace/registry.js +119 -0
- package/dist/plugins/marketplace/schemas.cjs +79 -0
- package/dist/plugins/marketplace/schemas.d.ts +260 -0
- package/dist/plugins/marketplace/schemas.d.ts.map +1 -0
- package/dist/plugins/marketplace/schemas.js +49 -0
- package/dist/plugins/marketplace/types.cjs +16 -0
- package/dist/plugins/marketplace/types.d.ts +156 -0
- package/dist/plugins/marketplace/types.d.ts.map +1 -0
- package/dist/plugins/marketplace/types.js +0 -0
- package/dist/plugins/schemas.cjs +74 -0
- package/dist/plugins/schemas.d.ts +262 -0
- package/dist/plugins/schemas.d.ts.map +1 -0
- package/dist/plugins/schemas.js +46 -0
- package/dist/plugins/types.cjs +16 -0
- package/dist/plugins/types.d.ts +186 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +0 -0
- package/dist/plugins/uninstall-plugin.cjs +133 -0
- package/dist/plugins/uninstall-plugin.d.ts +24 -0
- package/dist/plugins/uninstall-plugin.d.ts.map +1 -0
- package/dist/plugins/uninstall-plugin.js +99 -0
- package/dist/plugins/validate-plugin.cjs +180 -0
- package/dist/plugins/validate-plugin.d.ts +53 -0
- package/dist/plugins/validate-plugin.d.ts.map +1 -0
- package/dist/plugins/validate-plugin.js +145 -0
- package/dist/preferences/errors.cjs +11 -0
- package/dist/preferences/errors.d.ts +1 -0
- package/dist/preferences/errors.d.ts.map +1 -1
- package/dist/preferences/errors.js +11 -0
- package/dist/preferences/loader.cjs +119 -6
- package/dist/preferences/loader.d.ts +21 -1
- package/dist/preferences/loader.d.ts.map +1 -1
- package/dist/preferences/loader.js +102 -1
- package/dist/preferences/schemas.cjs +12 -0
- package/dist/preferences/schemas.d.ts +38 -12
- package/dist/preferences/schemas.d.ts.map +1 -1
- package/dist/preferences/schemas.js +10 -0
- package/dist/runtime/AgentRuntime.cjs +1 -2
- package/dist/runtime/AgentRuntime.d.ts.map +1 -1
- package/dist/runtime/AgentRuntime.js +1 -2
- package/dist/tool-provider/llm-resolution.cjs +74 -0
- package/dist/tool-provider/llm-resolution.d.ts +51 -0
- package/dist/tool-provider/llm-resolution.d.ts.map +1 -0
- package/dist/tool-provider/llm-resolution.js +50 -0
- package/dist/tool-provider/runtime-service.cjs +246 -34
- package/dist/tool-provider/runtime-service.d.ts +34 -2
- package/dist/tool-provider/runtime-service.d.ts.map +1 -1
- package/dist/tool-provider/runtime-service.js +236 -34
- package/dist/tool-provider/tool-provider.cjs +154 -1
- package/dist/tool-provider/tool-provider.d.ts +7 -1
- package/dist/tool-provider/tool-provider.d.ts.map +1 -1
- package/dist/tool-provider/tool-provider.js +161 -1
- package/dist/tool-provider/types.d.ts +2 -0
- package/dist/tool-provider/types.d.ts.map +1 -1
- package/dist/utils/api-key-resolver.cjs +5 -2
- package/dist/utils/api-key-resolver.d.ts.map +1 -1
- package/dist/utils/api-key-resolver.js +5 -2
- package/dist/utils/dexto-auth.cjs +83 -0
- package/dist/utils/dexto-auth.d.ts +23 -0
- package/dist/utils/dexto-auth.d.ts.map +1 -0
- package/dist/utils/dexto-auth.js +57 -0
- package/dist/utils/feature-flags.cjs +32 -0
- package/dist/utils/feature-flags.d.ts +21 -0
- package/dist/utils/feature-flags.d.ts.map +1 -0
- package/dist/utils/feature-flags.js +8 -0
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-provider.d.ts","sourceRoot":"","sources":["../../src/tool-provider/tool-provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-provider.d.ts","sourceRoot":"","sources":["../../src/tool-provider/tool-provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,aAAa,CAAC;AAYpE,OAAO,EAA4B,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAmBjF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,yBAAyB,EAAE,kBAAkB,CAAC,eAAe,EAAE,kBAAkB,CAsM7F,CAAC"}
|
|
@@ -1,13 +1,173 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConditionEngine,
|
|
3
|
+
SignalBus,
|
|
4
|
+
TaskRegistry,
|
|
5
|
+
createCheckTaskTool,
|
|
6
|
+
createListTasksTool,
|
|
7
|
+
createWaitForTool
|
|
8
|
+
} from "@dexto/orchestration";
|
|
1
9
|
import { AgentSpawnerConfigSchema } from "./schemas.js";
|
|
2
10
|
import { RuntimeService } from "./runtime-service.js";
|
|
3
11
|
import { createSpawnAgentTool } from "./spawn-agent-tool.js";
|
|
12
|
+
function bindOrchestrationTool(tool, context) {
|
|
13
|
+
return {
|
|
14
|
+
id: tool.id,
|
|
15
|
+
description: tool.description,
|
|
16
|
+
inputSchema: tool.inputSchema,
|
|
17
|
+
execute: (input) => tool.execute(input, context)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
4
20
|
const agentSpawnerToolsProvider = {
|
|
5
21
|
type: "agent-spawner",
|
|
6
22
|
configSchema: AgentSpawnerConfigSchema,
|
|
7
23
|
create: (config, context) => {
|
|
8
24
|
const { logger, agent } = context;
|
|
25
|
+
const signalBus = new SignalBus();
|
|
26
|
+
const taskRegistry = new TaskRegistry(signalBus);
|
|
27
|
+
const conditionEngine = new ConditionEngine(taskRegistry, signalBus, logger);
|
|
28
|
+
const toolContext = {
|
|
29
|
+
taskRegistry,
|
|
30
|
+
conditionEngine,
|
|
31
|
+
signalBus
|
|
32
|
+
};
|
|
9
33
|
const service = new RuntimeService(agent, config, logger);
|
|
10
|
-
|
|
34
|
+
agent.toolManager.setTaskForker(service);
|
|
35
|
+
logger.debug("RuntimeService wired as taskForker for context:fork skill support");
|
|
36
|
+
const taskSessions = /* @__PURE__ */ new Map();
|
|
37
|
+
const emitTasksUpdate = (sessionId) => {
|
|
38
|
+
const tasks = taskRegistry.list({
|
|
39
|
+
status: ["running", "completed", "failed", "cancelled"]
|
|
40
|
+
});
|
|
41
|
+
const scopedTasks = sessionId ? tasks.filter((task) => taskSessions.get(task.taskId) === sessionId) : tasks;
|
|
42
|
+
const runningCount = scopedTasks.filter((task) => task.status === "running").length;
|
|
43
|
+
agent.agentEventBus.emit("service:event", {
|
|
44
|
+
service: "orchestration",
|
|
45
|
+
event: "tasks-updated",
|
|
46
|
+
sessionId: sessionId ?? "",
|
|
47
|
+
data: {
|
|
48
|
+
runningCount,
|
|
49
|
+
tasks: scopedTasks.map((task) => ({
|
|
50
|
+
taskId: task.taskId,
|
|
51
|
+
status: task.status,
|
|
52
|
+
...task.description !== void 0 && { description: task.description }
|
|
53
|
+
}))
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const triggerBackgroundCompletion = (taskId, sessionId) => {
|
|
58
|
+
if (!sessionId) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
agent.agentEventBus.emit("tool:background-completed", {
|
|
62
|
+
toolCallId: taskId,
|
|
63
|
+
sessionId
|
|
64
|
+
});
|
|
65
|
+
const taskInfo = taskRegistry.getInfo(taskId);
|
|
66
|
+
const resultText = (() => {
|
|
67
|
+
if (taskInfo?.status === "failed") {
|
|
68
|
+
return taskInfo.error ?? "Unknown error.";
|
|
69
|
+
}
|
|
70
|
+
if (taskInfo?.result !== void 0) {
|
|
71
|
+
if (typeof taskInfo.result === "string") {
|
|
72
|
+
return taskInfo.result;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
return JSON.stringify(taskInfo.result, null, 2);
|
|
76
|
+
} catch {
|
|
77
|
+
return String(taskInfo.result ?? "<unserializable result>");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return "No result available.";
|
|
81
|
+
})();
|
|
82
|
+
const sanitizeCdata = (value) => value.replace(/\]\]>/g, "]]]]><![CDATA[>");
|
|
83
|
+
const safeDescription = taskInfo?.description ? sanitizeCdata(taskInfo.description) : null;
|
|
84
|
+
const safeResultText = sanitizeCdata(resultText);
|
|
85
|
+
const descriptionTag = safeDescription ? ` <description><![CDATA[${safeDescription}]]></description>
|
|
86
|
+
` : "";
|
|
87
|
+
const statusTag = taskInfo?.status ? ` <status>${taskInfo.status}</status>
|
|
88
|
+
` : "";
|
|
89
|
+
const content = [
|
|
90
|
+
{
|
|
91
|
+
type: "text",
|
|
92
|
+
text: `<background-task-completion>
|
|
93
|
+
<origin>task</origin>
|
|
94
|
+
<note>The following response was reported by the background task (not user input).</note>
|
|
95
|
+
<taskId>${taskId}</taskId>
|
|
96
|
+
` + statusTag + descriptionTag + ` <result><![CDATA[${safeResultText}]]></result>
|
|
97
|
+
</background-task-completion>`
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
agent.isSessionBusy(sessionId).then((isBusy) => {
|
|
101
|
+
if (isBusy) {
|
|
102
|
+
agent.queueMessage(sessionId, {
|
|
103
|
+
content,
|
|
104
|
+
kind: "background"
|
|
105
|
+
}).catch(() => void 0);
|
|
106
|
+
} else {
|
|
107
|
+
agent.agentEventBus.emit("run:invoke", {
|
|
108
|
+
sessionId,
|
|
109
|
+
content,
|
|
110
|
+
source: "external",
|
|
111
|
+
metadata: { taskId }
|
|
112
|
+
});
|
|
113
|
+
agent.generate(content, sessionId).catch(() => void 0);
|
|
114
|
+
}
|
|
115
|
+
}).catch(() => {
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
const handleBackground = (event) => {
|
|
119
|
+
const taskId = event.toolCallId;
|
|
120
|
+
if (taskRegistry.has(taskId)) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (event.sessionId) {
|
|
124
|
+
taskSessions.set(taskId, event.sessionId);
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
taskRegistry.register(
|
|
128
|
+
{
|
|
129
|
+
type: "generic",
|
|
130
|
+
taskId,
|
|
131
|
+
description: event.description ?? `Tool ${event.toolName}`,
|
|
132
|
+
promise: event.promise
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
...event.timeoutMs !== void 0 && { timeout: event.timeoutMs },
|
|
136
|
+
...event.notifyOnComplete !== void 0 && {
|
|
137
|
+
notify: event.notifyOnComplete
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
} catch (error) {
|
|
142
|
+
taskSessions.delete(taskId);
|
|
143
|
+
event.promise.catch(() => void 0);
|
|
144
|
+
logger.warn(
|
|
145
|
+
`Failed to register background task ${taskId}: ${error instanceof Error ? error.message : String(error)}`,
|
|
146
|
+
{ color: "yellow" }
|
|
147
|
+
);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
emitTasksUpdate(event.sessionId);
|
|
151
|
+
event.promise.finally(() => {
|
|
152
|
+
taskSessions.delete(taskId);
|
|
153
|
+
emitTasksUpdate(event.sessionId);
|
|
154
|
+
triggerBackgroundCompletion(taskId, event.sessionId);
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
const backgroundAbortController = new AbortController();
|
|
158
|
+
agent.agentEventBus.on("tool:background", handleBackground, {
|
|
159
|
+
signal: backgroundAbortController.signal
|
|
160
|
+
});
|
|
161
|
+
agent.agentEventBus.on("agent:stopped", () => {
|
|
162
|
+
backgroundAbortController.abort();
|
|
163
|
+
});
|
|
164
|
+
const tool = createSpawnAgentTool(service);
|
|
165
|
+
return [
|
|
166
|
+
tool,
|
|
167
|
+
bindOrchestrationTool(createWaitForTool(), toolContext),
|
|
168
|
+
bindOrchestrationTool(createCheckTaskTool(), toolContext),
|
|
169
|
+
bindOrchestrationTool(createListTasksTool(), toolContext)
|
|
170
|
+
];
|
|
11
171
|
},
|
|
12
172
|
metadata: {
|
|
13
173
|
displayName: "Agent Spawner",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tool-provider/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;IAEjB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tool-provider/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;IAEjB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -32,6 +32,8 @@ const PROVIDER_API_KEY_MAP = {
|
|
|
32
32
|
groq: ["GROQ_API_KEY"],
|
|
33
33
|
cohere: ["COHERE_API_KEY"],
|
|
34
34
|
xai: ["XAI_API_KEY", "X_AI_API_KEY"],
|
|
35
|
+
minimax: ["MINIMAX_API_KEY"],
|
|
36
|
+
glm: ["ZHIPU_API_KEY", "ZHIPUAI_API_KEY"],
|
|
35
37
|
openrouter: ["OPENROUTER_API_KEY"],
|
|
36
38
|
litellm: ["LITELLM_API_KEY", "LITELLM_KEY"],
|
|
37
39
|
glama: ["GLAMA_API_KEY"],
|
|
@@ -47,9 +49,10 @@ const PROVIDER_API_KEY_MAP = {
|
|
|
47
49
|
// Local providers don't require API keys
|
|
48
50
|
local: [],
|
|
49
51
|
// Native node-llama-cpp execution
|
|
50
|
-
ollama: []
|
|
52
|
+
ollama: [],
|
|
51
53
|
// Ollama server (may optionally use OLLAMA_API_KEY for remote servers)
|
|
52
|
-
//
|
|
54
|
+
// Dexto gateway - requires key from `dexto login`
|
|
55
|
+
"dexto-nova": ["DEXTO_API_KEY"]
|
|
53
56
|
// perplexity: ['PERPLEXITY_API_KEY'],
|
|
54
57
|
// together: ['TOGETHER_API_KEY'],
|
|
55
58
|
// fireworks: ['FIREWORKS_API_KEY'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-key-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/api-key-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;GAGG;AAGH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"api-key-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/api-key-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;GAGG;AAGH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,CA+B9D,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAelF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAGpE"}
|
|
@@ -7,6 +7,8 @@ const PROVIDER_API_KEY_MAP = {
|
|
|
7
7
|
groq: ["GROQ_API_KEY"],
|
|
8
8
|
cohere: ["COHERE_API_KEY"],
|
|
9
9
|
xai: ["XAI_API_KEY", "X_AI_API_KEY"],
|
|
10
|
+
minimax: ["MINIMAX_API_KEY"],
|
|
11
|
+
glm: ["ZHIPU_API_KEY", "ZHIPUAI_API_KEY"],
|
|
10
12
|
openrouter: ["OPENROUTER_API_KEY"],
|
|
11
13
|
litellm: ["LITELLM_API_KEY", "LITELLM_KEY"],
|
|
12
14
|
glama: ["GLAMA_API_KEY"],
|
|
@@ -22,9 +24,10 @@ const PROVIDER_API_KEY_MAP = {
|
|
|
22
24
|
// Local providers don't require API keys
|
|
23
25
|
local: [],
|
|
24
26
|
// Native node-llama-cpp execution
|
|
25
|
-
ollama: []
|
|
27
|
+
ollama: [],
|
|
26
28
|
// Ollama server (may optionally use OLLAMA_API_KEY for remote servers)
|
|
27
|
-
//
|
|
29
|
+
// Dexto gateway - requires key from `dexto login`
|
|
30
|
+
"dexto-nova": ["DEXTO_API_KEY"]
|
|
28
31
|
// perplexity: ['PERPLEXITY_API_KEY'],
|
|
29
32
|
// together: ['TOGETHER_API_KEY'],
|
|
30
33
|
// fireworks: ['FIREWORKS_API_KEY'],
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var dexto_auth_exports = {};
|
|
20
|
+
__export(dexto_auth_exports, {
|
|
21
|
+
canUseDextoProvider: () => canUseDextoProvider,
|
|
22
|
+
getDextoApiKeyFromAuth: () => getDextoApiKeyFromAuth,
|
|
23
|
+
isDextoAuthenticated: () => isDextoAuthenticated
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(dexto_auth_exports);
|
|
26
|
+
var import_fs = require("fs");
|
|
27
|
+
var import_zod = require("zod");
|
|
28
|
+
var import_core = require("@dexto/core");
|
|
29
|
+
const AUTH_CONFIG_FILE = "auth.json";
|
|
30
|
+
const AuthConfigSchema = import_zod.z.object({
|
|
31
|
+
token: import_zod.z.string().min(1),
|
|
32
|
+
expiresAt: import_zod.z.number().optional(),
|
|
33
|
+
dextoApiKey: import_zod.z.string().optional()
|
|
34
|
+
});
|
|
35
|
+
async function isDextoAuthenticated() {
|
|
36
|
+
const authPath = (0, import_core.getDextoGlobalPath)("", AUTH_CONFIG_FILE);
|
|
37
|
+
if (!(0, import_fs.existsSync)(authPath)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const content = await import_fs.promises.readFile(authPath, "utf-8");
|
|
42
|
+
const config = JSON.parse(content);
|
|
43
|
+
const validated = AuthConfigSchema.safeParse(config);
|
|
44
|
+
if (!validated.success) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
if (validated.data.expiresAt && validated.data.expiresAt < Date.now()) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
} catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function getDextoApiKeyFromAuth() {
|
|
56
|
+
if (process.env.DEXTO_API_KEY) {
|
|
57
|
+
return process.env.DEXTO_API_KEY;
|
|
58
|
+
}
|
|
59
|
+
const authPath = (0, import_core.getDextoGlobalPath)("", AUTH_CONFIG_FILE);
|
|
60
|
+
if (!(0, import_fs.existsSync)(authPath)) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
const content = await import_fs.promises.readFile(authPath, "utf-8");
|
|
65
|
+
const config = JSON.parse(content);
|
|
66
|
+
return config.dextoApiKey || null;
|
|
67
|
+
} catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function canUseDextoProvider() {
|
|
72
|
+
const authenticated = await isDextoAuthenticated();
|
|
73
|
+
if (!authenticated) return false;
|
|
74
|
+
const apiKey = await getDextoApiKeyFromAuth();
|
|
75
|
+
if (!apiKey) return false;
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
canUseDextoProvider,
|
|
81
|
+
getDextoApiKeyFromAuth,
|
|
82
|
+
isDextoAuthenticated
|
|
83
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dexto Authentication Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides functions to check dexto authentication status.
|
|
5
|
+
* Used by both CLI and server to determine if user can use dexto features.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Check if user is authenticated with Dexto.
|
|
9
|
+
* Returns true if auth.json exists with valid (non-expired) token.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isDextoAuthenticated(): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* Get the dexto API key from auth config or environment.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getDextoApiKeyFromAuth(): Promise<string | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Check if user can use Dexto provider.
|
|
18
|
+
* Requires BOTH:
|
|
19
|
+
* 1. User is authenticated (valid auth token)
|
|
20
|
+
* 2. Has DEXTO_API_KEY (from auth config or environment)
|
|
21
|
+
*/
|
|
22
|
+
export declare function canUseDextoProvider(): Promise<boolean>;
|
|
23
|
+
//# sourceMappingURL=dexto-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dexto-auth.d.ts","sourceRoot":"","sources":["../../src/utils/dexto-auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkBH;;;GAGG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAyB7D;AAED;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoBrE;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAQ5D"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { existsSync, promises as fs } from "fs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { getDextoGlobalPath } from "@dexto/core";
|
|
4
|
+
const AUTH_CONFIG_FILE = "auth.json";
|
|
5
|
+
const AuthConfigSchema = z.object({
|
|
6
|
+
token: z.string().min(1),
|
|
7
|
+
expiresAt: z.number().optional(),
|
|
8
|
+
dextoApiKey: z.string().optional()
|
|
9
|
+
});
|
|
10
|
+
async function isDextoAuthenticated() {
|
|
11
|
+
const authPath = getDextoGlobalPath("", AUTH_CONFIG_FILE);
|
|
12
|
+
if (!existsSync(authPath)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const content = await fs.readFile(authPath, "utf-8");
|
|
17
|
+
const config = JSON.parse(content);
|
|
18
|
+
const validated = AuthConfigSchema.safeParse(config);
|
|
19
|
+
if (!validated.success) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (validated.data.expiresAt && validated.data.expiresAt < Date.now()) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
} catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async function getDextoApiKeyFromAuth() {
|
|
31
|
+
if (process.env.DEXTO_API_KEY) {
|
|
32
|
+
return process.env.DEXTO_API_KEY;
|
|
33
|
+
}
|
|
34
|
+
const authPath = getDextoGlobalPath("", AUTH_CONFIG_FILE);
|
|
35
|
+
if (!existsSync(authPath)) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const content = await fs.readFile(authPath, "utf-8");
|
|
40
|
+
const config = JSON.parse(content);
|
|
41
|
+
return config.dextoApiKey || null;
|
|
42
|
+
} catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function canUseDextoProvider() {
|
|
47
|
+
const authenticated = await isDextoAuthenticated();
|
|
48
|
+
if (!authenticated) return false;
|
|
49
|
+
const apiKey = await getDextoApiKeyFromAuth();
|
|
50
|
+
if (!apiKey) return false;
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
canUseDextoProvider,
|
|
55
|
+
getDextoApiKeyFromAuth,
|
|
56
|
+
isDextoAuthenticated
|
|
57
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var feature_flags_exports = {};
|
|
20
|
+
__export(feature_flags_exports, {
|
|
21
|
+
isDextoAuthEnabled: () => isDextoAuthEnabled
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(feature_flags_exports);
|
|
24
|
+
function isDextoAuthEnabled() {
|
|
25
|
+
const flag = process.env.DEXTO_FEATURE_AUTH;
|
|
26
|
+
if (flag === void 0) return true;
|
|
27
|
+
return flag === "true";
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
isDextoAuthEnabled
|
|
32
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature flags for Dexto
|
|
3
|
+
*
|
|
4
|
+
* These flags control the availability of features that are in development
|
|
5
|
+
* or being rolled out gradually.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Check if Dexto authentication/provider is enabled.
|
|
9
|
+
*
|
|
10
|
+
* When disabled (set DEXTO_FEATURE_AUTH=false), the Dexto provider option is hidden from:
|
|
11
|
+
* - Onboarding/setup wizard
|
|
12
|
+
* - Model selectors (CLI and WebUI)
|
|
13
|
+
* - LLM catalog API responses
|
|
14
|
+
*
|
|
15
|
+
* The underlying auth commands (dexto login, logout, billing) remain functional
|
|
16
|
+
* for users who need to manage their account.
|
|
17
|
+
*
|
|
18
|
+
* Enabled by default. Set DEXTO_FEATURE_AUTH=false to disable.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isDextoAuthEnabled(): boolean;
|
|
21
|
+
//# sourceMappingURL=feature-flags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../src/utils/feature-flags.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAI5C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/agent-management",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"yaml": "^2.7.1",
|
|
18
18
|
"zod": "^3.25.0",
|
|
19
|
-
"@dexto/core": "1.5.
|
|
19
|
+
"@dexto/core": "1.5.8",
|
|
20
|
+
"@dexto/orchestration": "1.5.8"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
22
23
|
"@types/node": "^22.13.5"
|