@theokit/agents 1.0.0 → 1.1.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/dist/bridge.js +1 -1
- package/dist/{chunk-7KRJJX7W.js → chunk-3HI6O5GI.js} +50 -2
- package/dist/chunk-3HI6O5GI.js.map +1 -0
- package/dist/index.d.ts +18 -5
- package/dist/index.js +35 -24
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-7KRJJX7W.js.map +0 -1
package/dist/bridge.js
CHANGED
|
@@ -138,6 +138,14 @@ function compileApprovals(def) {
|
|
|
138
138
|
}
|
|
139
139
|
__name(compileApprovals, "compileApprovals");
|
|
140
140
|
|
|
141
|
+
// src/errors.ts
|
|
142
|
+
var ConfigurationError = class extends Error {
|
|
143
|
+
static {
|
|
144
|
+
__name(this, "ConfigurationError");
|
|
145
|
+
}
|
|
146
|
+
name = "ConfigurationError";
|
|
147
|
+
};
|
|
148
|
+
|
|
141
149
|
// src/bridge/compile-context-window.ts
|
|
142
150
|
var STRATEGY_KNOBS = [
|
|
143
151
|
"compactionStrategy",
|
|
@@ -174,10 +182,47 @@ function compileSkills(options) {
|
|
|
174
182
|
__name(compileSkills, "compileSkills");
|
|
175
183
|
|
|
176
184
|
// src/bridge/agent-compiler.ts
|
|
185
|
+
var SDK_TOOL_NAME = /^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/;
|
|
186
|
+
var SDK_TOOL_NAME_MAX_LENGTH = 64;
|
|
187
|
+
var SDK_TOOL_NAME_CHARSET = /^[a-zA-Z][a-zA-Z0-9_-]*$/;
|
|
188
|
+
var SDK_RESERVED_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
189
|
+
"shell",
|
|
190
|
+
"memory_search",
|
|
191
|
+
"memory_get"
|
|
192
|
+
]);
|
|
193
|
+
var SDK_RESERVED_TOOL_PREFIX = "mcp_";
|
|
177
194
|
function toolRuntimeName(namespace, toolName) {
|
|
178
|
-
|
|
195
|
+
if (toolName.trim().length === 0) {
|
|
196
|
+
const where = namespace ? ` no namespace "${namespace}"` : "";
|
|
197
|
+
throw new ConfigurationError(`tool: nome vazio${where} \u2014 declare um nome n\xE3o vazio para a tool`);
|
|
198
|
+
}
|
|
199
|
+
const name = namespace ? `${namespace}_${toolName}` : toolName;
|
|
200
|
+
if (!SDK_TOOL_NAME.test(name)) {
|
|
201
|
+
if (SDK_TOOL_NAME_CHARSET.test(name)) {
|
|
202
|
+
throw new ConfigurationError(`tool: nome "${name}" tem comprimento ${name.length} \u2014 a composi\xE7\xE3o namespace + "_" + tool excede o m\xE1ximo de ${SDK_TOOL_NAME_MAX_LENGTH} que o SDK aceita`);
|
|
203
|
+
}
|
|
204
|
+
throw new ConfigurationError(`tool: nome inv\xE1lido "${name}" \u2014 deve casar ${String(SDK_TOOL_NAME)} (o SDK rejeita o resto; verifique o namespace e o nome da tool)`);
|
|
205
|
+
}
|
|
206
|
+
if (SDK_RESERVED_TOOL_NAMES.has(name) || name.startsWith(SDK_RESERVED_TOOL_PREFIX)) {
|
|
207
|
+
throw new ConfigurationError(`tool: nome reservado "${name}" \u2014 o SDK reserva ${[
|
|
208
|
+
...SDK_RESERVED_TOOL_NAMES
|
|
209
|
+
].join(", ")} e o prefixo "${SDK_RESERVED_TOOL_PREFIX}"`);
|
|
210
|
+
}
|
|
211
|
+
return name;
|
|
179
212
|
}
|
|
180
213
|
__name(toolRuntimeName, "toolRuntimeName");
|
|
214
|
+
function compileHitlGates(toolboxes) {
|
|
215
|
+
const gates = /* @__PURE__ */ new Map();
|
|
216
|
+
for (const tb of toolboxes) {
|
|
217
|
+
for (const tool of tb.tools) {
|
|
218
|
+
if (tool.hitl) {
|
|
219
|
+
gates.set(toolRuntimeName(tb.namespace, tool.config.name), tool.hitl);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return gates;
|
|
224
|
+
}
|
|
225
|
+
__name(compileHitlGates, "compileHitlGates");
|
|
181
226
|
function compileTools(toolboxes, toolboxInstances) {
|
|
182
227
|
const tools = [];
|
|
183
228
|
for (const tb of toolboxes) {
|
|
@@ -3311,8 +3356,11 @@ export {
|
|
|
3311
3356
|
isAgentDefinition,
|
|
3312
3357
|
compileAgentDefinition,
|
|
3313
3358
|
compileSkillsSelection,
|
|
3359
|
+
ConfigurationError,
|
|
3314
3360
|
compileContextWindow,
|
|
3315
3361
|
compileSkills,
|
|
3362
|
+
toolRuntimeName,
|
|
3363
|
+
compileHitlGates,
|
|
3316
3364
|
compileTools,
|
|
3317
3365
|
createAgentExecutionContext,
|
|
3318
3366
|
isAgentContext,
|
|
@@ -3376,4 +3424,4 @@ export {
|
|
|
3376
3424
|
generateAgentManifest,
|
|
3377
3425
|
agentsPlugin
|
|
3378
3426
|
};
|
|
3379
|
-
//# sourceMappingURL=chunk-
|
|
3427
|
+
//# sourceMappingURL=chunk-3HI6O5GI.js.map
|