@almadar/skills 2.0.2 → 2.0.3
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 +75 -2
- package/dist/index.js +19 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OrbitalSchema } from '@almadar/core';
|
|
1
|
+
import { OrbitalSchema, ServiceContract } from '@almadar/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Skill Generator Types
|
|
@@ -668,4 +668,77 @@ interface ProviderComparison {
|
|
|
668
668
|
*/
|
|
669
669
|
declare function generateComparisonMatrix(comparisons: ProviderComparison[]): string;
|
|
670
670
|
|
|
671
|
-
|
|
671
|
+
/**
|
|
672
|
+
* Skills Service Contract
|
|
673
|
+
*
|
|
674
|
+
* Defines the call-service-compatible actions for the Skills service.
|
|
675
|
+
* Skills are stateless generators that produce Orbital schemas and
|
|
676
|
+
* domain language definitions from natural-language prompts.
|
|
677
|
+
*
|
|
678
|
+
* These actions can be invoked from `.orb` schemas via
|
|
679
|
+
* `["call-service", "skills", "<action>", {...}]`.
|
|
680
|
+
*
|
|
681
|
+
* @packageDocumentation
|
|
682
|
+
*/
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* All call-service actions exposed by the Skills service.
|
|
686
|
+
*/
|
|
687
|
+
type SkillsServiceActions = {
|
|
688
|
+
/** Generate Orbital schemas from a natural-language prompt. */
|
|
689
|
+
generateOrbitals: {
|
|
690
|
+
params: {
|
|
691
|
+
prompt: string;
|
|
692
|
+
compact?: boolean;
|
|
693
|
+
};
|
|
694
|
+
result: {
|
|
695
|
+
skill: {
|
|
696
|
+
name: string;
|
|
697
|
+
content: string;
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
};
|
|
701
|
+
/** Generate a fix for an existing schema given validation errors. */
|
|
702
|
+
generateFix: {
|
|
703
|
+
params: {
|
|
704
|
+
schema: string;
|
|
705
|
+
errors: string[];
|
|
706
|
+
};
|
|
707
|
+
result: {
|
|
708
|
+
skill: {
|
|
709
|
+
name: string;
|
|
710
|
+
content: string;
|
|
711
|
+
};
|
|
712
|
+
};
|
|
713
|
+
};
|
|
714
|
+
/** Generate a domain language definition from a description. */
|
|
715
|
+
generateDomainLanguage: {
|
|
716
|
+
params: {
|
|
717
|
+
description: string;
|
|
718
|
+
};
|
|
719
|
+
result: {
|
|
720
|
+
skill: {
|
|
721
|
+
name: string;
|
|
722
|
+
content: string;
|
|
723
|
+
};
|
|
724
|
+
};
|
|
725
|
+
};
|
|
726
|
+
/** Generate all available skills. */
|
|
727
|
+
generateAll: {
|
|
728
|
+
params: Record<string, never>;
|
|
729
|
+
result: {
|
|
730
|
+
skills: Array<{
|
|
731
|
+
name: string;
|
|
732
|
+
content: string;
|
|
733
|
+
}>;
|
|
734
|
+
};
|
|
735
|
+
};
|
|
736
|
+
};
|
|
737
|
+
/**
|
|
738
|
+
* The full service contract for the Skills service.
|
|
739
|
+
* Implementations must provide an `execute(action, params)` method
|
|
740
|
+
* that dispatches to the correct action handler.
|
|
741
|
+
*/
|
|
742
|
+
type SkillsServiceContract = ServiceContract<SkillsServiceActions>;
|
|
743
|
+
|
|
744
|
+
export { type CompositionMetrics, EVAL_CASES, type EvalCase, type EvalResult, type GeneratedSkill, type ProviderComparison, type ScoreBreakdown, type SkillFrontmatter, type SkillsServiceActions, type SkillsServiceContract, analyzeComposition, calculateTotalScore, formatFrontmatter, generateAllBuilderSkills, generateComparisonMatrix, generateDomainLanguageSkill, generateKflowOrbitalFixingSkill, generateKflowOrbitalsSkill, generateLeanFixingSkill$1 as generateLeanFixingSkill, generateLeanFixingSkill as generateLeanFixingSkillFull, generateLeanOrbitalSkill$1 as generateLeanOrbitalSkill, generateLeanOrbitalSkill as generateLeanOrbitalSkillFull, getArchitectureSection, getAssetRefSection, getBannedProps, getBindingContextRules, getBindingsCompact, getBindingsGuide, getCommonErrorsSection, getCommonFixPatternsSection, getCompletionRulesSection, getConnectivityCompact, getContextUsageCompact, getContextUsageSection, getCustomTraitCompact, getCustomTraitSection, getDecompositionChecklist, getDecompositionCompact, getDecompositionSection, getDesignErrorsCompact, getDesignErrorsSection, getEfficiencySection, getFieldTypesCompact, getFixingWorkflowSection, getFlowPatternSection, getFullOrbitalPrompt, getGameAsOrbitalsSection, getGameEntityTemplatesSection, getGamePatternsSection, getGameTraitsSection, getGameTypesSection, getIconLibraryCompact, getIconLibrarySection, getKeyBehaviorsReference, getMinimalTypeReference, getMultiFileSection, getOrbitalConnectivitySection, getOrbitalDecompositionPrompt, getOverGenerationSection, getPatternTypesCompact, getPortableOrbitalOutputSection, getRenderUIDesignGuide, getRenderUIQuickRef, getRequirementsDecomposePrompt, getRequirementsTraitPrompt, getSExprQuickRef, getSchemaUpdateCompact, getSchemaUpdateSection, getSubagentSystemPrompt, getThemeGuide, getUsesImportCompact, getUsesImportSection, getValidationHintsSection, writeAllSkills, writeSkill };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { generateBehaviorsDocs, getAllBehaviors, generateModulesDocs, getAllStdOperators } from '@almadar/std';
|
|
4
|
-
import { OPERATORS, UI_SLOTS, PATTERN_TYPES, ViewTypeSchema } from '@almadar/core/types';
|
|
4
|
+
import { OPERATORS, UI_SLOTS, PATTERN_TYPES, ViewTypeSchema, isInlineTrait as isInlineTrait$1 } from '@almadar/core/types';
|
|
5
5
|
import { getPatternPropsCompact, getPatternActionsRef, getAllPatternTypes } from '@almadar/patterns';
|
|
6
|
-
import { BINDING_DOCS, CORE_BINDINGS } from '@almadar/core';
|
|
6
|
+
import { BINDING_DOCS, CORE_BINDINGS, isInlineTrait } from '@almadar/core';
|
|
7
7
|
import { generateDomainLanguageReference } from '@almadar/core/domain-language';
|
|
8
8
|
|
|
9
9
|
// src/generators/utils.ts
|
|
@@ -120,19 +120,21 @@ function getStdBehaviorsWithStateMachines() {
|
|
|
120
120
|
const behaviors = getAllBehaviors();
|
|
121
121
|
const nonGameBehaviors = behaviors.filter((b) => {
|
|
122
122
|
const traits = b.orbitals?.[0]?.traits ?? [];
|
|
123
|
-
const
|
|
124
|
-
const
|
|
123
|
+
const inlineTraits = traits.filter(isInlineTrait$1);
|
|
124
|
+
const hasGameCategory = inlineTraits.some((t) => t.category?.includes("game"));
|
|
125
|
+
const hasStateMachine = inlineTraits.some((t) => t.stateMachine);
|
|
125
126
|
return !hasGameCategory && hasStateMachine;
|
|
126
127
|
});
|
|
127
128
|
return `## Standard Behaviors
|
|
128
129
|
|
|
129
130
|
${nonGameBehaviors.map((behavior) => {
|
|
130
|
-
const
|
|
131
|
+
const inlineTraits = (behavior.orbitals?.[0]?.traits ?? []).filter(isInlineTrait$1);
|
|
132
|
+
const trait = inlineTraits.find((t) => t.stateMachine);
|
|
131
133
|
const sm = trait?.stateMachine;
|
|
132
134
|
return `### ${behavior.name}
|
|
133
135
|
|
|
134
136
|
**States**: ${sm?.states?.map((s) => s.name).join(", ") ?? "N/A"}
|
|
135
|
-
**Events**: ${sm?.events?.map((e) => e.key ?? e.name
|
|
137
|
+
**Events**: ${sm?.events?.map((e) => e.key ?? e.name).join(", ") ?? "N/A"}
|
|
136
138
|
|
|
137
139
|
\`\`\`json
|
|
138
140
|
${JSON.stringify(behavior, null, 2)}
|
|
@@ -4636,8 +4638,6 @@ ${cat.behaviors.map((b) => `- **${b.name}**: ${b.description}`).join("\n")}
|
|
|
4636
4638
|
Use with: \`uses: [{ from: "std/behaviors/crud", as: "CRUD" }]\`
|
|
4637
4639
|
`;
|
|
4638
4640
|
}
|
|
4639
|
-
|
|
4640
|
-
// src/evals/composition-quality.ts
|
|
4641
4641
|
var EVAL_CASES = [
|
|
4642
4642
|
{
|
|
4643
4643
|
name: "task-management-basic",
|
|
@@ -4746,9 +4746,9 @@ function analyzeComposition(schema) {
|
|
|
4746
4746
|
};
|
|
4747
4747
|
for (const orbital of schema.orbitals) {
|
|
4748
4748
|
for (const trait of orbital.traits) {
|
|
4749
|
-
|
|
4750
|
-
if (!
|
|
4751
|
-
for (const transition of
|
|
4749
|
+
if (!isInlineTrait(trait)) continue;
|
|
4750
|
+
if (!trait.stateMachine?.transitions) continue;
|
|
4751
|
+
for (const transition of trait.stateMachine.transitions) {
|
|
4752
4752
|
if (!transition.effects) continue;
|
|
4753
4753
|
for (const effect of transition.effects) {
|
|
4754
4754
|
if (!Array.isArray(effect)) continue;
|
|
@@ -4902,9 +4902,9 @@ function countTransitions(schema) {
|
|
|
4902
4902
|
let count = 0;
|
|
4903
4903
|
for (const orbital of schema.orbitals) {
|
|
4904
4904
|
for (const trait of orbital.traits) {
|
|
4905
|
-
|
|
4906
|
-
if (
|
|
4907
|
-
count +=
|
|
4905
|
+
if (!isInlineTrait(trait)) continue;
|
|
4906
|
+
if (trait.stateMachine?.transitions) {
|
|
4907
|
+
count += trait.stateMachine.transitions.length;
|
|
4908
4908
|
}
|
|
4909
4909
|
}
|
|
4910
4910
|
}
|
|
@@ -4913,17 +4913,17 @@ function countTransitions(schema) {
|
|
|
4913
4913
|
function hasClosedCircuit(schema) {
|
|
4914
4914
|
for (const orbital of schema.orbitals) {
|
|
4915
4915
|
for (const trait of orbital.traits) {
|
|
4916
|
-
|
|
4917
|
-
if (!
|
|
4918
|
-
const states = new Set((
|
|
4916
|
+
if (!isInlineTrait(trait)) continue;
|
|
4917
|
+
if (!trait.stateMachine) continue;
|
|
4918
|
+
const states = new Set((trait.stateMachine.states || []).map((s) => s.name));
|
|
4919
4919
|
const incomingStates = /* @__PURE__ */ new Set();
|
|
4920
4920
|
const outgoingStates = /* @__PURE__ */ new Set();
|
|
4921
|
-
for (const transition of
|
|
4921
|
+
for (const transition of trait.stateMachine.transitions || []) {
|
|
4922
4922
|
incomingStates.add(transition.to);
|
|
4923
4923
|
outgoingStates.add(transition.from);
|
|
4924
4924
|
}
|
|
4925
4925
|
for (const state of states) {
|
|
4926
|
-
const stateObj = (
|
|
4926
|
+
const stateObj = (trait.stateMachine.states || []).find((s) => s.name === state);
|
|
4927
4927
|
if (!stateObj?.isInitial && !incomingStates.has(state)) {
|
|
4928
4928
|
return false;
|
|
4929
4929
|
}
|