@theokit/agents 1.0.1 → 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-PTHRG25K.js → chunk-3HI6O5GI.js} +48 -3
- package/dist/chunk-3HI6O5GI.js.map +1 -0
- package/dist/index.d.ts +18 -5
- package/dist/index.js +34 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-PTHRG25K.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",
|
|
@@ -175,10 +183,46 @@ __name(compileSkills, "compileSkills");
|
|
|
175
183
|
|
|
176
184
|
// src/bridge/agent-compiler.ts
|
|
177
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_";
|
|
178
194
|
function toolRuntimeName(namespace, toolName) {
|
|
179
|
-
|
|
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;
|
|
180
212
|
}
|
|
181
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");
|
|
182
226
|
function compileTools(toolboxes, toolboxInstances) {
|
|
183
227
|
const tools = [];
|
|
184
228
|
for (const tb of toolboxes) {
|
|
@@ -3312,10 +3356,11 @@ export {
|
|
|
3312
3356
|
isAgentDefinition,
|
|
3313
3357
|
compileAgentDefinition,
|
|
3314
3358
|
compileSkillsSelection,
|
|
3359
|
+
ConfigurationError,
|
|
3315
3360
|
compileContextWindow,
|
|
3316
3361
|
compileSkills,
|
|
3317
|
-
SDK_TOOL_NAME,
|
|
3318
3362
|
toolRuntimeName,
|
|
3363
|
+
compileHitlGates,
|
|
3319
3364
|
compileTools,
|
|
3320
3365
|
createAgentExecutionContext,
|
|
3321
3366
|
isAgentContext,
|
|
@@ -3379,4 +3424,4 @@ export {
|
|
|
3379
3424
|
generateAgentManifest,
|
|
3380
3425
|
agentsPlugin
|
|
3381
3426
|
};
|
|
3382
|
-
//# sourceMappingURL=chunk-
|
|
3427
|
+
//# sourceMappingURL=chunk-3HI6O5GI.js.map
|