@theokit/agents 0.44.3 → 0.44.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/dist/bridge.js
CHANGED
|
@@ -562,9 +562,10 @@ function compileAgentDefinition(def) {
|
|
|
562
562
|
...def.settingSources !== void 0 ? {
|
|
563
563
|
settingSources: def.settingSources
|
|
564
564
|
} : {},
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
565
|
+
// Hooks are converted here — the layer EVERY path converges on — rather than on the builder, so
|
|
566
|
+
// `defineAgent({ hooks })` cannot type-check and silently no-op. A lifecycle hook that is
|
|
567
|
+
// declared but never registered is a security gate that does not gate.
|
|
568
|
+
...compileHooksAndPlugins(def),
|
|
568
569
|
// MCP — builder/`defineAgent` servers converge on the same `mcpServers` field the `@MCP`
|
|
569
570
|
// decorator path populates; the SDK adapter forwards it to `Agent.create({ mcpServers })`.
|
|
570
571
|
...def.mcpServers !== void 0 ? {
|
|
@@ -573,6 +574,33 @@ function compileAgentDefinition(def) {
|
|
|
573
574
|
};
|
|
574
575
|
}
|
|
575
576
|
__name(compileAgentDefinition, "compileAgentDefinition");
|
|
577
|
+
function compileHooksAndPlugins(def) {
|
|
578
|
+
const map = def.hooks;
|
|
579
|
+
const entries = Object.entries(map ?? {}).filter(([, h]) => typeof h === "function");
|
|
580
|
+
const explicit = def.plugins ?? [];
|
|
581
|
+
if (entries.length === 0) {
|
|
582
|
+
return def.plugins !== void 0 ? {
|
|
583
|
+
plugins: def.plugins
|
|
584
|
+
} : {};
|
|
585
|
+
}
|
|
586
|
+
const plugin = {
|
|
587
|
+
name: "theokit-builder-hooks",
|
|
588
|
+
version: "1.0.0",
|
|
589
|
+
kind: "general",
|
|
590
|
+
register(ctx) {
|
|
591
|
+
for (const [hookName, handler] of entries) {
|
|
592
|
+
ctx.on(hookName, handler);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
return {
|
|
597
|
+
plugins: [
|
|
598
|
+
...explicit,
|
|
599
|
+
plugin
|
|
600
|
+
]
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
__name(compileHooksAndPlugins, "compileHooksAndPlugins");
|
|
576
604
|
function compileSkillsSelection(skills) {
|
|
577
605
|
if (skills === void 0) return {};
|
|
578
606
|
if (typeof skills === "function") return {
|
|
@@ -1642,32 +1670,6 @@ function contextualTool(tool, _requiredContext) {
|
|
|
1642
1670
|
return tool;
|
|
1643
1671
|
}
|
|
1644
1672
|
__name(contextualTool, "contextualTool");
|
|
1645
|
-
function withHooksPlugin(config) {
|
|
1646
|
-
const map = config.hooks;
|
|
1647
|
-
if (map === void 0) return config;
|
|
1648
|
-
const entries = Object.entries(map).filter(([, h]) => typeof h === "function");
|
|
1649
|
-
const { hooks: _dropped, ...rest } = config;
|
|
1650
|
-
if (entries.length === 0) return rest;
|
|
1651
|
-
const plugin = {
|
|
1652
|
-
name: "theokit-builder-hooks",
|
|
1653
|
-
version: "1.0.0",
|
|
1654
|
-
kind: "general",
|
|
1655
|
-
register(ctx) {
|
|
1656
|
-
for (const [hookName, handler] of entries) {
|
|
1657
|
-
ctx.on(hookName, handler);
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
};
|
|
1661
|
-
const existing = rest.plugins ?? [];
|
|
1662
|
-
return {
|
|
1663
|
-
...rest,
|
|
1664
|
-
plugins: [
|
|
1665
|
-
...existing,
|
|
1666
|
-
plugin
|
|
1667
|
-
]
|
|
1668
|
-
};
|
|
1669
|
-
}
|
|
1670
|
-
__name(withHooksPlugin, "withHooksPlugin");
|
|
1671
1673
|
function makeBuilder(config) {
|
|
1672
1674
|
const runtime = {
|
|
1673
1675
|
input: /* @__PURE__ */ __name((schema) => makeBuilder({
|
|
@@ -1740,7 +1742,7 @@ function makeBuilder(config) {
|
|
|
1740
1742
|
mcpServers: servers
|
|
1741
1743
|
}), "mcp"),
|
|
1742
1744
|
use: /* @__PURE__ */ __name((preset) => preset(runtime), "use"),
|
|
1743
|
-
build: /* @__PURE__ */ __name(() => defineAgent(
|
|
1745
|
+
build: /* @__PURE__ */ __name(() => defineAgent(config), "build")
|
|
1744
1746
|
};
|
|
1745
1747
|
return runtime;
|
|
1746
1748
|
}
|
|
@@ -3115,4 +3117,4 @@ export {
|
|
|
3115
3117
|
generateAgentManifest,
|
|
3116
3118
|
agentsPlugin
|
|
3117
3119
|
};
|
|
3118
|
-
//# sourceMappingURL=chunk-
|
|
3120
|
+
//# sourceMappingURL=chunk-TFGN3AJV.js.map
|