@rowan-agent/agent 0.9.1 → 0.9.2

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/index.d.ts CHANGED
@@ -611,6 +611,8 @@ type AgentDefinition = Readonly<{
611
611
  prompt: string;
612
612
  tools?: readonly string[];
613
613
  skills?: readonly string[];
614
+ /** Host-supplied Skills private to this Agent Definition/Bundle. */
615
+ bundledSkills?: readonly Skill[];
614
616
  phases?: PhaseRegistrySelection;
615
617
  contexts?: readonly string[];
616
618
  model?: ModelRef;
package/dist/index.js CHANGED
@@ -1046,6 +1046,7 @@ function assertAgentDefinition(value) {
1046
1046
  requiredString(value.prompt, "definition.prompt");
1047
1047
  optionalStringList(value.tools, "definition.tools");
1048
1048
  optionalStringList(value.skills, "definition.skills");
1049
+ optionalBundledSkills(value.bundledSkills, "definition.bundledSkills");
1049
1050
  optionalPhaseRegistrySelection(value.phases, "definition.phases");
1050
1051
  optionalStringList(value.contexts, "definition.contexts");
1051
1052
  if ("extensions" in value) throw new TypeError("definition.extensions is not supported; Extensions are Runtime-global");
@@ -1117,6 +1118,19 @@ function optionalStringList(value, field) {
1117
1118
  }
1118
1119
  return names;
1119
1120
  }
1121
+ function optionalBundledSkills(value, field) {
1122
+ if (value === void 0) return;
1123
+ if (!Array.isArray(value)) throw new TypeError(`${field} must be an array of Skills`);
1124
+ const names = /* @__PURE__ */ new Set();
1125
+ for (const [index, item] of value.entries()) {
1126
+ if (!isRecord(item) || typeof item.name !== "string" || item.name.trim() === "" || typeof item.description !== "string" || typeof item.filePath !== "string" || typeof item.baseDir !== "string" || typeof item.content !== "string" || typeof item.disableModelInvocation !== "boolean") {
1127
+ throw new TypeError(`${field}[${index}] is invalid`);
1128
+ }
1129
+ if (names.has(item.name)) throw new TypeError(`Duplicate bundled Skill "${item.name}".`);
1130
+ names.add(item.name);
1131
+ }
1132
+ return value;
1133
+ }
1120
1134
  function optionalPhaseRegistrySelection(value, field) {
1121
1135
  if (value === void 0) return void 0;
1122
1136
  if (!isRecord(value)) throw new TypeError(`${field} must be an object`);
@@ -1511,6 +1525,13 @@ function selectNamedResources(candidates, names, kind) {
1511
1525
  }
1512
1526
  return selected;
1513
1527
  }
1528
+ function mergeSkills(...layers) {
1529
+ const byName = /* @__PURE__ */ new Map();
1530
+ for (const layer of layers) {
1531
+ for (const skill of layer ?? []) byName.set(skill.name, skill);
1532
+ }
1533
+ return [...byName.values()];
1534
+ }
1514
1535
 
1515
1536
  // src/harness/context/system-prompt.ts
1516
1537
  function buildSystemPrompt(options) {
@@ -2040,7 +2061,7 @@ async function runPhaseLoop(config, state, registry) {
2040
2061
  const toolExecutionManager = createToolExecutionManager();
2041
2062
  const execution = createPhaseExecution(config, state, phase, messageManager, toolExecutionManager, registry);
2042
2063
  const phaseTools = selectPhaseTools(allTools, phase.tools);
2043
- const phaseSkills = phase.name === DEFAULT_PHASE_ID ? config.context.skills : phase.skills ?? [];
2064
+ const phaseSkills = mergeSkills(config.context.skills, phase.skills);
2044
2065
  let phaseContext = {
2045
2066
  systemPrompt: config.context.systemPrompt,
2046
2067
  messages: messageManager.visible(),
@@ -2531,7 +2552,7 @@ async function executeParallelPhase(config, state, registry, phase, payload, con
2531
2552
  const messages = [...context];
2532
2553
  const allTools = buildToolsWithRouting(config, availablePhases);
2533
2554
  const phaseTools = selectPhaseTools(allTools, phase.tools);
2534
- const phaseSkills = phase.name === DEFAULT_PHASE_ID ? config.context.skills : phase.skills ?? [];
2555
+ const phaseSkills = mergeSkills(config.context.skills, phase.skills);
2535
2556
  const systemPrompt = config.context.systemPrompt;
2536
2557
  const phaseContext = {
2537
2558
  systemPrompt,
@@ -3013,6 +3034,9 @@ function snapshotConfig(config) {
3013
3034
  ...config.definition,
3014
3035
  ...config.definition.tools ? { tools: Object.freeze([...config.definition.tools]) } : {},
3015
3036
  ...config.definition.skills ? { skills: Object.freeze([...config.definition.skills]) } : {},
3037
+ ...config.definition.bundledSkills ? {
3038
+ bundledSkills: Object.freeze(config.definition.bundledSkills.map((skill) => Object.freeze({ ...skill })))
3039
+ } : {},
3016
3040
  ...config.definition.phases ? {
3017
3041
  phases: Object.freeze({
3018
3042
  entryPhaseId: config.definition.phases.entryPhaseId,
@@ -3491,10 +3515,9 @@ function resolveDefinitionContext(config, assembled = {}) {
3491
3515
  config.definition.tools,
3492
3516
  "Tool"
3493
3517
  );
3494
- const skills = selectNamedResources(
3495
- config.resources.skills,
3496
- config.definition.skills,
3497
- "Skill"
3518
+ const skills = mergeSkills(
3519
+ selectNamedResources(config.resources.skills, config.definition.skills, "Skill"),
3520
+ config.definition.bundledSkills
3498
3521
  );
3499
3522
  const contexts = selectNamedResources(
3500
3523
  config.resources.contexts ?? [],
@@ -4688,6 +4711,13 @@ var ResourceRegistry = class {
4688
4711
  }
4689
4712
  };
4690
4713
  function snapshotResourceValue(kind, value) {
4714
+ if (kind === "agent") {
4715
+ const agent = value;
4716
+ return Object.freeze({
4717
+ ...agent,
4718
+ ...agent.bundledSkills ? { bundledSkills: Object.freeze(agent.bundledSkills.map((skill) => Object.freeze({ ...skill }))) } : {}
4719
+ });
4720
+ }
4691
4721
  if (kind !== "phase") return value;
4692
4722
  const phase = value;
4693
4723
  const snapshot = {
@@ -4961,7 +4991,10 @@ function resolveConfigurationSnapshot(registry, input) {
4961
4991
  const layer = input.definition.layer;
4962
4992
  const definition = applyDefinitionLayer(base, layer);
4963
4993
  const tools = selectNamedResources(resolved.tools, definition.tools, "Tool");
4964
- const skills = selectNamedResources(resolved.skills, definition.skills, "Skill");
4994
+ const skills = mergeSkills(
4995
+ selectNamedResources(resolved.skills, definition.skills, "Skill"),
4996
+ definition.bundledSkills
4997
+ );
4965
4998
  const phases = resolvePhases(resolved.phases, definition.phases);
4966
4999
  const contexts = selectNamedResources(input.contexts ?? [], base.contexts, "Context");
4967
5000
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowan-agent/agent",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",