oricore 1.5.0 → 1.5.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/{chunk-DO76AL42.js → chunk-D5X6YFSK.js} +2 -1
- package/dist/{chunk-4QYFQSAC.js → chunk-E7TB3WLC.js} +321 -88
- package/dist/chunk-E7TB3WLC.js.map +1 -0
- package/dist/{chunk-OYWDQD3F.js → chunk-P4RPHQOE.js} +2 -2
- package/dist/history-WTZON3PI.js +8 -0
- package/dist/index.cjs +609 -102
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +240 -4
- package/dist/index.d.ts +240 -4
- package/dist/index.js +282 -10
- package/dist/index.js.map +1 -1
- package/dist/{session-QMS6OYG2.js → session-Z2XIKFVN.js} +4 -4
- package/dist/undici-NSB7IUB7.js +5 -0
- package/package.json +2 -1
- package/src/core/model/models.ts +149 -0
- package/src/core/model/providers.ts +31 -0
- package/src/index.ts +12 -0
- package/src/skill/bundled.ts +225 -0
- package/src/skill/skill.ts +260 -4
- package/src/tools/tool.ts +14 -4
- package/src/tools/tools/skill.ts +86 -8
- package/dist/chunk-4QYFQSAC.js.map +0 -1
- package/dist/history-AGNMX5YW.js +0 -8
- package/dist/undici-326ZBRKH.js +0 -5
- /package/dist/{chunk-DO76AL42.js.map → chunk-D5X6YFSK.js.map} +0 -0
- /package/dist/{chunk-OYWDQD3F.js.map → chunk-P4RPHQOE.js.map} +0 -0
- /package/dist/{history-AGNMX5YW.js.map → history-WTZON3PI.js.map} +0 -0
- /package/dist/{session-QMS6OYG2.js.map → session-Z2XIKFVN.js.map} +0 -0
- /package/dist/{undici-326ZBRKH.js.map → undici-NSB7IUB7.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -944,18 +944,179 @@ type Plugin = {
|
|
|
944
944
|
}) => Promise<void> | void;
|
|
945
945
|
};
|
|
946
946
|
|
|
947
|
+
/**
|
|
948
|
+
* Bundled skill definition for TypeScript-encoded skills.
|
|
949
|
+
* This allows skills to be defined programmatically with dynamic behavior.
|
|
950
|
+
*/
|
|
951
|
+
interface BundledSkillDefinition {
|
|
952
|
+
/** Unique skill name */
|
|
953
|
+
name: string;
|
|
954
|
+
/** Skill description */
|
|
955
|
+
description: string;
|
|
956
|
+
/**
|
|
957
|
+
* Tools that this skill is allowed to use.
|
|
958
|
+
* If specified, only these tools will be available when the skill executes.
|
|
959
|
+
*/
|
|
960
|
+
allowedTools?: string[];
|
|
961
|
+
/**
|
|
962
|
+
* Execution context for the skill.
|
|
963
|
+
* - 'inline': Skill content is injected into current conversation (default)
|
|
964
|
+
* - 'fork': Skill runs in an isolated sub-agent
|
|
965
|
+
*/
|
|
966
|
+
context?: 'inline' | 'fork';
|
|
967
|
+
/**
|
|
968
|
+
* Agent type to use when context is 'fork'.
|
|
969
|
+
* If not specified, defaults to 'general-purpose'.
|
|
970
|
+
*/
|
|
971
|
+
agent?: string;
|
|
972
|
+
/**
|
|
973
|
+
* Whether this skill can be invoked by users via slash commands.
|
|
974
|
+
* @default true
|
|
975
|
+
*/
|
|
976
|
+
userInvocable?: boolean;
|
|
977
|
+
/**
|
|
978
|
+
* Whether this skill can be invoked by the model via SkillTool.
|
|
979
|
+
* @default true
|
|
980
|
+
*/
|
|
981
|
+
modelInvocable?: boolean;
|
|
982
|
+
/**
|
|
983
|
+
* Aliases for the skill name.
|
|
984
|
+
* Allows the skill to be invoked by alternative names.
|
|
985
|
+
*/
|
|
986
|
+
aliases?: string[];
|
|
987
|
+
/**
|
|
988
|
+
* When to use this skill.
|
|
989
|
+
* Provides guidance to the model about when to invoke this skill.
|
|
990
|
+
*/
|
|
991
|
+
whenToUse?: string;
|
|
992
|
+
/**
|
|
993
|
+
* Hint for arguments that can be passed to the skill.
|
|
994
|
+
* Example: '[file_path] [issue_description]'
|
|
995
|
+
*/
|
|
996
|
+
argumentHint?: string;
|
|
997
|
+
/**
|
|
998
|
+
* Function to determine if this skill is enabled in the current context.
|
|
999
|
+
* Can be a boolean or a function that receives the context.
|
|
1000
|
+
*/
|
|
1001
|
+
isEnabled?: boolean | ((context: Context) => boolean);
|
|
1002
|
+
/**
|
|
1003
|
+
* Embedded reference files that will be extracted when the skill runs.
|
|
1004
|
+
* Key is the filename, value is the file content.
|
|
1005
|
+
*/
|
|
1006
|
+
files?: Record<string, string>;
|
|
1007
|
+
/**
|
|
1008
|
+
* Generate the skill prompt content.
|
|
1009
|
+
* This function is called when the skill is invoked.
|
|
1010
|
+
* @param args Arguments passed to the skill
|
|
1011
|
+
* @param context The execution context
|
|
1012
|
+
* @returns Promise resolving to the skill prompt content
|
|
1013
|
+
*/
|
|
1014
|
+
getPrompt: (args: string, context: Context) => Promise<string> | string;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Registry for bundled skills.
|
|
1018
|
+
* Skills registered here are built into the engine binary.
|
|
1019
|
+
*/
|
|
1020
|
+
declare class BundledSkillRegistry {
|
|
1021
|
+
private skills;
|
|
1022
|
+
private aliases;
|
|
1023
|
+
/**
|
|
1024
|
+
* Register a bundled skill.
|
|
1025
|
+
* @param definition The skill definition
|
|
1026
|
+
*/
|
|
1027
|
+
register(definition: BundledSkillDefinition): void;
|
|
1028
|
+
/**
|
|
1029
|
+
* Get a bundled skill by name or alias.
|
|
1030
|
+
* @param name Skill name or alias
|
|
1031
|
+
* @returns The skill definition or undefined if not found
|
|
1032
|
+
*/
|
|
1033
|
+
get(name: string): BundledSkillDefinition | undefined;
|
|
1034
|
+
/**
|
|
1035
|
+
* Get all registered bundled skills.
|
|
1036
|
+
* @param context Optional context to filter by isEnabled
|
|
1037
|
+
* @returns Array of skill definitions
|
|
1038
|
+
*/
|
|
1039
|
+
getAll(context?: Context): BundledSkillDefinition[];
|
|
1040
|
+
/**
|
|
1041
|
+
* Check if a skill is registered.
|
|
1042
|
+
* @param name Skill name or alias
|
|
1043
|
+
*/
|
|
1044
|
+
has(name: string): boolean;
|
|
1045
|
+
/**
|
|
1046
|
+
* Unregister a skill.
|
|
1047
|
+
* @param name Skill name
|
|
1048
|
+
*/
|
|
1049
|
+
unregister(name: string): void;
|
|
1050
|
+
/**
|
|
1051
|
+
* Clear all registered skills.
|
|
1052
|
+
*/
|
|
1053
|
+
clear(): void;
|
|
1054
|
+
}
|
|
1055
|
+
declare const bundledSkillRegistry: BundledSkillRegistry;
|
|
1056
|
+
/**
|
|
1057
|
+
* Convert a bundled skill definition to SkillMetadata format.
|
|
1058
|
+
* This is used internally when loading bundled skills into the SkillManager.
|
|
1059
|
+
*/
|
|
1060
|
+
declare function bundledSkillToMetadata(definition: BundledSkillDefinition, source?: SkillSource): SkillMetadata;
|
|
1061
|
+
/**
|
|
1062
|
+
* Helper function to create a simple bundled skill.
|
|
1063
|
+
*/
|
|
1064
|
+
declare function createBundledSkill(config: Omit<BundledSkillDefinition, 'getPrompt'> & {
|
|
1065
|
+
prompt: string | ((args: string, context: Context) => Promise<string> | string);
|
|
1066
|
+
}): BundledSkillDefinition;
|
|
1067
|
+
/**
|
|
1068
|
+
* Register a bundled skill using a simplified configuration.
|
|
1069
|
+
*/
|
|
1070
|
+
declare function registerBundledSkill(config: Omit<BundledSkillDefinition, 'getPrompt'> & {
|
|
1071
|
+
prompt: string | ((args: string, context: Context) => Promise<string> | string);
|
|
1072
|
+
}): void;
|
|
1073
|
+
|
|
947
1074
|
declare enum SkillSource {
|
|
948
1075
|
Plugin = "plugin",
|
|
949
1076
|
GlobalClaude = "global-claude",
|
|
950
1077
|
Global = "global",
|
|
951
1078
|
ProjectClaude = "project-claude",
|
|
952
|
-
Project = "project"
|
|
1079
|
+
Project = "project",
|
|
1080
|
+
Builtin = "builtin"
|
|
953
1081
|
}
|
|
1082
|
+
type SkillContext = 'inline' | 'fork';
|
|
954
1083
|
interface SkillMetadata {
|
|
955
1084
|
name: string;
|
|
956
1085
|
description: string;
|
|
957
1086
|
path: string;
|
|
958
1087
|
source: SkillSource;
|
|
1088
|
+
/**
|
|
1089
|
+
* Tools that this skill is allowed to use.
|
|
1090
|
+
* If specified, only these tools will be available when the skill executes.
|
|
1091
|
+
* Example: ['Read', 'Grep', 'Bash']
|
|
1092
|
+
*/
|
|
1093
|
+
allowedTools?: string[];
|
|
1094
|
+
/**
|
|
1095
|
+
* Execution context for the skill.
|
|
1096
|
+
* - 'inline': Skill content is injected into current conversation (default)
|
|
1097
|
+
* - 'fork': Skill runs in an isolated sub-agent
|
|
1098
|
+
*/
|
|
1099
|
+
context?: SkillContext;
|
|
1100
|
+
/**
|
|
1101
|
+
* Agent type to use when context is 'fork'.
|
|
1102
|
+
* If not specified, defaults to a general-purpose agent.
|
|
1103
|
+
*/
|
|
1104
|
+
agent?: string;
|
|
1105
|
+
/**
|
|
1106
|
+
* File path patterns that trigger this skill's availability.
|
|
1107
|
+
* Example: ['src/asterisk/asterisk.ts', '*.test.js']
|
|
1108
|
+
*/
|
|
1109
|
+
paths?: string[];
|
|
1110
|
+
/**
|
|
1111
|
+
* Whether this skill can be invoked by users via slash commands.
|
|
1112
|
+
* @default true
|
|
1113
|
+
*/
|
|
1114
|
+
userInvocable?: boolean;
|
|
1115
|
+
/**
|
|
1116
|
+
* Whether this skill can be invoked by the model via SkillTool.
|
|
1117
|
+
* @default true
|
|
1118
|
+
*/
|
|
1119
|
+
modelInvocable?: boolean;
|
|
959
1120
|
}
|
|
960
1121
|
interface SkillError {
|
|
961
1122
|
path: string;
|
|
@@ -999,15 +1160,90 @@ declare class SkillManager {
|
|
|
999
1160
|
private errors;
|
|
1000
1161
|
private paths;
|
|
1001
1162
|
private context;
|
|
1163
|
+
/**
|
|
1164
|
+
* Tracks which skills are currently "active" based on file operations.
|
|
1165
|
+
* Skills with `paths` frontmatter are activated when matching files are accessed.
|
|
1166
|
+
*/
|
|
1167
|
+
private activeSkillNames;
|
|
1168
|
+
/**
|
|
1169
|
+
* Maps alias names to original skill names for bundled skills.
|
|
1170
|
+
*/
|
|
1171
|
+
private aliasMap;
|
|
1002
1172
|
constructor(opts: SkillManagerOpts);
|
|
1003
|
-
|
|
1173
|
+
/**
|
|
1174
|
+
* Get all loaded skills.
|
|
1175
|
+
* @param options Filter options
|
|
1176
|
+
* @returns Array of skill metadata
|
|
1177
|
+
*/
|
|
1178
|
+
getSkills(options?: {
|
|
1179
|
+
/** Only return skills that are user-invocable */
|
|
1180
|
+
userInvocable?: boolean;
|
|
1181
|
+
/** Only return skills that are model-invocable */
|
|
1182
|
+
modelInvocable?: boolean;
|
|
1183
|
+
/** Only return active skills (those with matching paths) */
|
|
1184
|
+
activeOnly?: boolean;
|
|
1185
|
+
}): SkillMetadata[];
|
|
1186
|
+
/**
|
|
1187
|
+
* Get a specific skill by name.
|
|
1188
|
+
* Automatically resolves aliases to the original skill.
|
|
1189
|
+
* @param name Skill name or alias
|
|
1190
|
+
* @returns Skill metadata or undefined if not found
|
|
1191
|
+
*/
|
|
1004
1192
|
getSkill(name: string): SkillMetadata | undefined;
|
|
1193
|
+
/**
|
|
1194
|
+
* Check if a skill is active (has matching paths for current context).
|
|
1195
|
+
* @param name Skill name
|
|
1196
|
+
*/
|
|
1197
|
+
isSkillActive(name: string): boolean;
|
|
1198
|
+
/**
|
|
1199
|
+
* Activate skills based on file paths.
|
|
1200
|
+
* Skills with `paths` frontmatter that match the given paths will be activated.
|
|
1201
|
+
* @param filePaths Array of file paths to check
|
|
1202
|
+
* @returns Array of newly activated skill names
|
|
1203
|
+
*/
|
|
1204
|
+
activateSkillsForPaths(filePaths: string[]): string[];
|
|
1205
|
+
/**
|
|
1206
|
+
* Clear all active skill activations.
|
|
1207
|
+
* Useful when switching contexts or projects.
|
|
1208
|
+
*/
|
|
1209
|
+
clearActiveSkills(): void;
|
|
1210
|
+
/**
|
|
1211
|
+
* Get all skills that have path-based conditional activation.
|
|
1212
|
+
* @returns Array of skills with paths defined
|
|
1213
|
+
*/
|
|
1214
|
+
getConditionalSkills(): SkillMetadata[];
|
|
1005
1215
|
getErrors(): SkillError[];
|
|
1006
|
-
|
|
1216
|
+
/**
|
|
1217
|
+
* Read the body content of a skill.
|
|
1218
|
+
* For file-based skills, reads from disk.
|
|
1219
|
+
* For bundled skills, generates content via getPrompt.
|
|
1220
|
+
*/
|
|
1221
|
+
readSkillBody(skill: SkillMetadata, args?: string): Promise<string>;
|
|
1222
|
+
/**
|
|
1223
|
+
* Get a bundled skill definition by name.
|
|
1224
|
+
* @param name Bundled skill name
|
|
1225
|
+
* @returns Bundled skill definition or undefined if not found
|
|
1226
|
+
*/
|
|
1227
|
+
getBundledSkill(name: string): BundledSkillDefinition | undefined;
|
|
1228
|
+
/**
|
|
1229
|
+
* Register a bundled skill programmatically.
|
|
1230
|
+
* @param definition Bundled skill definition
|
|
1231
|
+
*/
|
|
1232
|
+
registerBundledSkill(definition: BundledSkillDefinition): void;
|
|
1007
1233
|
loadSkills(): Promise<void>;
|
|
1234
|
+
/**
|
|
1235
|
+
* Load builtin/bundled skills from the registry.
|
|
1236
|
+
*/
|
|
1237
|
+
private loadBuiltinSkills;
|
|
1008
1238
|
private loadSkillsFromDirectory;
|
|
1009
1239
|
private loadSkillFile;
|
|
1010
1240
|
private parseSkillFile;
|
|
1241
|
+
/**
|
|
1242
|
+
* Parse a field that can be either a comma-separated string or an array of strings.
|
|
1243
|
+
* @param value The value to parse
|
|
1244
|
+
* @returns Array of strings or undefined if empty
|
|
1245
|
+
*/
|
|
1246
|
+
private parseStringArrayField;
|
|
1011
1247
|
addSkill(source: string, options?: AddSkillOptions): Promise<AddSkillResult>;
|
|
1012
1248
|
private normalizeSource;
|
|
1013
1249
|
private extractFolderName;
|
|
@@ -1561,4 +1797,4 @@ declare function randomUUID(): string;
|
|
|
1561
1797
|
|
|
1562
1798
|
declare const ENGINE_VERSION = "1.0.0";
|
|
1563
1799
|
|
|
1564
|
-
export { type AddSkillOptions, type AddSkillResult, type BaseMessage, Compression, type CompressionConfig, type ConnectionState, DirectTransport, ENGINE_VERSION, Engine, type EngineConfig, type EngineOptions, type EventHandler, type EventMessage, type ExecOptions, type ExecResult, GlobalData, History, JsonlLogger, type LoopResult, type Message, MessageBus, type MessageHandler, type MessageId, type MessageTransport, type Mode, type ModeConfig, ModeRegistryImpl as ModeRegistry, type ModeType, NodePlatform, Paths, type PlatformAdapter, type PreviewSkillsResult, type PruneResult, type RequestMessage, type ResponseMessage, type SendMessageOptions, Session, type SessionConfig, SessionConfigManager, type SessionId, type SessionOptions, type SkillError, type SkillLoadOutcome, SkillManager, type SkillManagerOpts, type SkillMetadata, type SkillPreview, SkillSource, type Stats, Usage, brainstormMode, builtinModes, createEngine, debugMode, defaultMode, getGlobalDataPath, isOverflow, loadSessionMessages, modeRegistry, nodePlatform, planMode, randomUUID, registerBuiltinModes, reviewMode };
|
|
1800
|
+
export { type AddSkillOptions, type AddSkillResult, type BaseMessage, type BundledSkillDefinition, Compression, type CompressionConfig, type ConnectionState, DirectTransport, ENGINE_VERSION, Engine, type EngineConfig, type EngineOptions, type EventHandler, type EventMessage, type ExecOptions, type ExecResult, GlobalData, History, JsonlLogger, type LoopResult, type Message, MessageBus, type MessageHandler, type MessageId, type MessageTransport, type Mode, type ModeConfig, ModeRegistryImpl as ModeRegistry, type ModeType, NodePlatform, Paths, type PlatformAdapter, type PreviewSkillsResult, type PruneResult, type RequestMessage, type ResponseMessage, type SendMessageOptions, Session, type SessionConfig, SessionConfigManager, type SessionId, type SessionOptions, type SkillContext, type SkillError, type SkillLoadOutcome, SkillManager, type SkillManagerOpts, type SkillMetadata, type SkillPreview, SkillSource, type Stats, Usage, brainstormMode, builtinModes, bundledSkillRegistry, bundledSkillToMetadata, createBundledSkill, createEngine, debugMode, defaultMode, getGlobalDataPath, isOverflow, loadSessionMessages, modeRegistry, nodePlatform, planMode, randomUUID, registerBuiltinModes, registerBundledSkill, reviewMode };
|
package/dist/index.d.ts
CHANGED
|
@@ -944,18 +944,179 @@ type Plugin = {
|
|
|
944
944
|
}) => Promise<void> | void;
|
|
945
945
|
};
|
|
946
946
|
|
|
947
|
+
/**
|
|
948
|
+
* Bundled skill definition for TypeScript-encoded skills.
|
|
949
|
+
* This allows skills to be defined programmatically with dynamic behavior.
|
|
950
|
+
*/
|
|
951
|
+
interface BundledSkillDefinition {
|
|
952
|
+
/** Unique skill name */
|
|
953
|
+
name: string;
|
|
954
|
+
/** Skill description */
|
|
955
|
+
description: string;
|
|
956
|
+
/**
|
|
957
|
+
* Tools that this skill is allowed to use.
|
|
958
|
+
* If specified, only these tools will be available when the skill executes.
|
|
959
|
+
*/
|
|
960
|
+
allowedTools?: string[];
|
|
961
|
+
/**
|
|
962
|
+
* Execution context for the skill.
|
|
963
|
+
* - 'inline': Skill content is injected into current conversation (default)
|
|
964
|
+
* - 'fork': Skill runs in an isolated sub-agent
|
|
965
|
+
*/
|
|
966
|
+
context?: 'inline' | 'fork';
|
|
967
|
+
/**
|
|
968
|
+
* Agent type to use when context is 'fork'.
|
|
969
|
+
* If not specified, defaults to 'general-purpose'.
|
|
970
|
+
*/
|
|
971
|
+
agent?: string;
|
|
972
|
+
/**
|
|
973
|
+
* Whether this skill can be invoked by users via slash commands.
|
|
974
|
+
* @default true
|
|
975
|
+
*/
|
|
976
|
+
userInvocable?: boolean;
|
|
977
|
+
/**
|
|
978
|
+
* Whether this skill can be invoked by the model via SkillTool.
|
|
979
|
+
* @default true
|
|
980
|
+
*/
|
|
981
|
+
modelInvocable?: boolean;
|
|
982
|
+
/**
|
|
983
|
+
* Aliases for the skill name.
|
|
984
|
+
* Allows the skill to be invoked by alternative names.
|
|
985
|
+
*/
|
|
986
|
+
aliases?: string[];
|
|
987
|
+
/**
|
|
988
|
+
* When to use this skill.
|
|
989
|
+
* Provides guidance to the model about when to invoke this skill.
|
|
990
|
+
*/
|
|
991
|
+
whenToUse?: string;
|
|
992
|
+
/**
|
|
993
|
+
* Hint for arguments that can be passed to the skill.
|
|
994
|
+
* Example: '[file_path] [issue_description]'
|
|
995
|
+
*/
|
|
996
|
+
argumentHint?: string;
|
|
997
|
+
/**
|
|
998
|
+
* Function to determine if this skill is enabled in the current context.
|
|
999
|
+
* Can be a boolean or a function that receives the context.
|
|
1000
|
+
*/
|
|
1001
|
+
isEnabled?: boolean | ((context: Context) => boolean);
|
|
1002
|
+
/**
|
|
1003
|
+
* Embedded reference files that will be extracted when the skill runs.
|
|
1004
|
+
* Key is the filename, value is the file content.
|
|
1005
|
+
*/
|
|
1006
|
+
files?: Record<string, string>;
|
|
1007
|
+
/**
|
|
1008
|
+
* Generate the skill prompt content.
|
|
1009
|
+
* This function is called when the skill is invoked.
|
|
1010
|
+
* @param args Arguments passed to the skill
|
|
1011
|
+
* @param context The execution context
|
|
1012
|
+
* @returns Promise resolving to the skill prompt content
|
|
1013
|
+
*/
|
|
1014
|
+
getPrompt: (args: string, context: Context) => Promise<string> | string;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Registry for bundled skills.
|
|
1018
|
+
* Skills registered here are built into the engine binary.
|
|
1019
|
+
*/
|
|
1020
|
+
declare class BundledSkillRegistry {
|
|
1021
|
+
private skills;
|
|
1022
|
+
private aliases;
|
|
1023
|
+
/**
|
|
1024
|
+
* Register a bundled skill.
|
|
1025
|
+
* @param definition The skill definition
|
|
1026
|
+
*/
|
|
1027
|
+
register(definition: BundledSkillDefinition): void;
|
|
1028
|
+
/**
|
|
1029
|
+
* Get a bundled skill by name or alias.
|
|
1030
|
+
* @param name Skill name or alias
|
|
1031
|
+
* @returns The skill definition or undefined if not found
|
|
1032
|
+
*/
|
|
1033
|
+
get(name: string): BundledSkillDefinition | undefined;
|
|
1034
|
+
/**
|
|
1035
|
+
* Get all registered bundled skills.
|
|
1036
|
+
* @param context Optional context to filter by isEnabled
|
|
1037
|
+
* @returns Array of skill definitions
|
|
1038
|
+
*/
|
|
1039
|
+
getAll(context?: Context): BundledSkillDefinition[];
|
|
1040
|
+
/**
|
|
1041
|
+
* Check if a skill is registered.
|
|
1042
|
+
* @param name Skill name or alias
|
|
1043
|
+
*/
|
|
1044
|
+
has(name: string): boolean;
|
|
1045
|
+
/**
|
|
1046
|
+
* Unregister a skill.
|
|
1047
|
+
* @param name Skill name
|
|
1048
|
+
*/
|
|
1049
|
+
unregister(name: string): void;
|
|
1050
|
+
/**
|
|
1051
|
+
* Clear all registered skills.
|
|
1052
|
+
*/
|
|
1053
|
+
clear(): void;
|
|
1054
|
+
}
|
|
1055
|
+
declare const bundledSkillRegistry: BundledSkillRegistry;
|
|
1056
|
+
/**
|
|
1057
|
+
* Convert a bundled skill definition to SkillMetadata format.
|
|
1058
|
+
* This is used internally when loading bundled skills into the SkillManager.
|
|
1059
|
+
*/
|
|
1060
|
+
declare function bundledSkillToMetadata(definition: BundledSkillDefinition, source?: SkillSource): SkillMetadata;
|
|
1061
|
+
/**
|
|
1062
|
+
* Helper function to create a simple bundled skill.
|
|
1063
|
+
*/
|
|
1064
|
+
declare function createBundledSkill(config: Omit<BundledSkillDefinition, 'getPrompt'> & {
|
|
1065
|
+
prompt: string | ((args: string, context: Context) => Promise<string> | string);
|
|
1066
|
+
}): BundledSkillDefinition;
|
|
1067
|
+
/**
|
|
1068
|
+
* Register a bundled skill using a simplified configuration.
|
|
1069
|
+
*/
|
|
1070
|
+
declare function registerBundledSkill(config: Omit<BundledSkillDefinition, 'getPrompt'> & {
|
|
1071
|
+
prompt: string | ((args: string, context: Context) => Promise<string> | string);
|
|
1072
|
+
}): void;
|
|
1073
|
+
|
|
947
1074
|
declare enum SkillSource {
|
|
948
1075
|
Plugin = "plugin",
|
|
949
1076
|
GlobalClaude = "global-claude",
|
|
950
1077
|
Global = "global",
|
|
951
1078
|
ProjectClaude = "project-claude",
|
|
952
|
-
Project = "project"
|
|
1079
|
+
Project = "project",
|
|
1080
|
+
Builtin = "builtin"
|
|
953
1081
|
}
|
|
1082
|
+
type SkillContext = 'inline' | 'fork';
|
|
954
1083
|
interface SkillMetadata {
|
|
955
1084
|
name: string;
|
|
956
1085
|
description: string;
|
|
957
1086
|
path: string;
|
|
958
1087
|
source: SkillSource;
|
|
1088
|
+
/**
|
|
1089
|
+
* Tools that this skill is allowed to use.
|
|
1090
|
+
* If specified, only these tools will be available when the skill executes.
|
|
1091
|
+
* Example: ['Read', 'Grep', 'Bash']
|
|
1092
|
+
*/
|
|
1093
|
+
allowedTools?: string[];
|
|
1094
|
+
/**
|
|
1095
|
+
* Execution context for the skill.
|
|
1096
|
+
* - 'inline': Skill content is injected into current conversation (default)
|
|
1097
|
+
* - 'fork': Skill runs in an isolated sub-agent
|
|
1098
|
+
*/
|
|
1099
|
+
context?: SkillContext;
|
|
1100
|
+
/**
|
|
1101
|
+
* Agent type to use when context is 'fork'.
|
|
1102
|
+
* If not specified, defaults to a general-purpose agent.
|
|
1103
|
+
*/
|
|
1104
|
+
agent?: string;
|
|
1105
|
+
/**
|
|
1106
|
+
* File path patterns that trigger this skill's availability.
|
|
1107
|
+
* Example: ['src/asterisk/asterisk.ts', '*.test.js']
|
|
1108
|
+
*/
|
|
1109
|
+
paths?: string[];
|
|
1110
|
+
/**
|
|
1111
|
+
* Whether this skill can be invoked by users via slash commands.
|
|
1112
|
+
* @default true
|
|
1113
|
+
*/
|
|
1114
|
+
userInvocable?: boolean;
|
|
1115
|
+
/**
|
|
1116
|
+
* Whether this skill can be invoked by the model via SkillTool.
|
|
1117
|
+
* @default true
|
|
1118
|
+
*/
|
|
1119
|
+
modelInvocable?: boolean;
|
|
959
1120
|
}
|
|
960
1121
|
interface SkillError {
|
|
961
1122
|
path: string;
|
|
@@ -999,15 +1160,90 @@ declare class SkillManager {
|
|
|
999
1160
|
private errors;
|
|
1000
1161
|
private paths;
|
|
1001
1162
|
private context;
|
|
1163
|
+
/**
|
|
1164
|
+
* Tracks which skills are currently "active" based on file operations.
|
|
1165
|
+
* Skills with `paths` frontmatter are activated when matching files are accessed.
|
|
1166
|
+
*/
|
|
1167
|
+
private activeSkillNames;
|
|
1168
|
+
/**
|
|
1169
|
+
* Maps alias names to original skill names for bundled skills.
|
|
1170
|
+
*/
|
|
1171
|
+
private aliasMap;
|
|
1002
1172
|
constructor(opts: SkillManagerOpts);
|
|
1003
|
-
|
|
1173
|
+
/**
|
|
1174
|
+
* Get all loaded skills.
|
|
1175
|
+
* @param options Filter options
|
|
1176
|
+
* @returns Array of skill metadata
|
|
1177
|
+
*/
|
|
1178
|
+
getSkills(options?: {
|
|
1179
|
+
/** Only return skills that are user-invocable */
|
|
1180
|
+
userInvocable?: boolean;
|
|
1181
|
+
/** Only return skills that are model-invocable */
|
|
1182
|
+
modelInvocable?: boolean;
|
|
1183
|
+
/** Only return active skills (those with matching paths) */
|
|
1184
|
+
activeOnly?: boolean;
|
|
1185
|
+
}): SkillMetadata[];
|
|
1186
|
+
/**
|
|
1187
|
+
* Get a specific skill by name.
|
|
1188
|
+
* Automatically resolves aliases to the original skill.
|
|
1189
|
+
* @param name Skill name or alias
|
|
1190
|
+
* @returns Skill metadata or undefined if not found
|
|
1191
|
+
*/
|
|
1004
1192
|
getSkill(name: string): SkillMetadata | undefined;
|
|
1193
|
+
/**
|
|
1194
|
+
* Check if a skill is active (has matching paths for current context).
|
|
1195
|
+
* @param name Skill name
|
|
1196
|
+
*/
|
|
1197
|
+
isSkillActive(name: string): boolean;
|
|
1198
|
+
/**
|
|
1199
|
+
* Activate skills based on file paths.
|
|
1200
|
+
* Skills with `paths` frontmatter that match the given paths will be activated.
|
|
1201
|
+
* @param filePaths Array of file paths to check
|
|
1202
|
+
* @returns Array of newly activated skill names
|
|
1203
|
+
*/
|
|
1204
|
+
activateSkillsForPaths(filePaths: string[]): string[];
|
|
1205
|
+
/**
|
|
1206
|
+
* Clear all active skill activations.
|
|
1207
|
+
* Useful when switching contexts or projects.
|
|
1208
|
+
*/
|
|
1209
|
+
clearActiveSkills(): void;
|
|
1210
|
+
/**
|
|
1211
|
+
* Get all skills that have path-based conditional activation.
|
|
1212
|
+
* @returns Array of skills with paths defined
|
|
1213
|
+
*/
|
|
1214
|
+
getConditionalSkills(): SkillMetadata[];
|
|
1005
1215
|
getErrors(): SkillError[];
|
|
1006
|
-
|
|
1216
|
+
/**
|
|
1217
|
+
* Read the body content of a skill.
|
|
1218
|
+
* For file-based skills, reads from disk.
|
|
1219
|
+
* For bundled skills, generates content via getPrompt.
|
|
1220
|
+
*/
|
|
1221
|
+
readSkillBody(skill: SkillMetadata, args?: string): Promise<string>;
|
|
1222
|
+
/**
|
|
1223
|
+
* Get a bundled skill definition by name.
|
|
1224
|
+
* @param name Bundled skill name
|
|
1225
|
+
* @returns Bundled skill definition or undefined if not found
|
|
1226
|
+
*/
|
|
1227
|
+
getBundledSkill(name: string): BundledSkillDefinition | undefined;
|
|
1228
|
+
/**
|
|
1229
|
+
* Register a bundled skill programmatically.
|
|
1230
|
+
* @param definition Bundled skill definition
|
|
1231
|
+
*/
|
|
1232
|
+
registerBundledSkill(definition: BundledSkillDefinition): void;
|
|
1007
1233
|
loadSkills(): Promise<void>;
|
|
1234
|
+
/**
|
|
1235
|
+
* Load builtin/bundled skills from the registry.
|
|
1236
|
+
*/
|
|
1237
|
+
private loadBuiltinSkills;
|
|
1008
1238
|
private loadSkillsFromDirectory;
|
|
1009
1239
|
private loadSkillFile;
|
|
1010
1240
|
private parseSkillFile;
|
|
1241
|
+
/**
|
|
1242
|
+
* Parse a field that can be either a comma-separated string or an array of strings.
|
|
1243
|
+
* @param value The value to parse
|
|
1244
|
+
* @returns Array of strings or undefined if empty
|
|
1245
|
+
*/
|
|
1246
|
+
private parseStringArrayField;
|
|
1011
1247
|
addSkill(source: string, options?: AddSkillOptions): Promise<AddSkillResult>;
|
|
1012
1248
|
private normalizeSource;
|
|
1013
1249
|
private extractFolderName;
|
|
@@ -1561,4 +1797,4 @@ declare function randomUUID(): string;
|
|
|
1561
1797
|
|
|
1562
1798
|
declare const ENGINE_VERSION = "1.0.0";
|
|
1563
1799
|
|
|
1564
|
-
export { type AddSkillOptions, type AddSkillResult, type BaseMessage, Compression, type CompressionConfig, type ConnectionState, DirectTransport, ENGINE_VERSION, Engine, type EngineConfig, type EngineOptions, type EventHandler, type EventMessage, type ExecOptions, type ExecResult, GlobalData, History, JsonlLogger, type LoopResult, type Message, MessageBus, type MessageHandler, type MessageId, type MessageTransport, type Mode, type ModeConfig, ModeRegistryImpl as ModeRegistry, type ModeType, NodePlatform, Paths, type PlatformAdapter, type PreviewSkillsResult, type PruneResult, type RequestMessage, type ResponseMessage, type SendMessageOptions, Session, type SessionConfig, SessionConfigManager, type SessionId, type SessionOptions, type SkillError, type SkillLoadOutcome, SkillManager, type SkillManagerOpts, type SkillMetadata, type SkillPreview, SkillSource, type Stats, Usage, brainstormMode, builtinModes, createEngine, debugMode, defaultMode, getGlobalDataPath, isOverflow, loadSessionMessages, modeRegistry, nodePlatform, planMode, randomUUID, registerBuiltinModes, reviewMode };
|
|
1800
|
+
export { type AddSkillOptions, type AddSkillResult, type BaseMessage, type BundledSkillDefinition, Compression, type CompressionConfig, type ConnectionState, DirectTransport, ENGINE_VERSION, Engine, type EngineConfig, type EngineOptions, type EventHandler, type EventMessage, type ExecOptions, type ExecResult, GlobalData, History, JsonlLogger, type LoopResult, type Message, MessageBus, type MessageHandler, type MessageId, type MessageTransport, type Mode, type ModeConfig, ModeRegistryImpl as ModeRegistry, type ModeType, NodePlatform, Paths, type PlatformAdapter, type PreviewSkillsResult, type PruneResult, type RequestMessage, type ResponseMessage, type SendMessageOptions, Session, type SessionConfig, SessionConfigManager, type SessionId, type SessionOptions, type SkillContext, type SkillError, type SkillLoadOutcome, SkillManager, type SkillManagerOpts, type SkillMetadata, type SkillPreview, SkillSource, type Stats, Usage, brainstormMode, builtinModes, bundledSkillRegistry, bundledSkillToMetadata, createBundledSkill, createEngine, debugMode, defaultMode, getGlobalDataPath, isOverflow, loadSessionMessages, modeRegistry, nodePlatform, planMode, randomUUID, registerBuiltinModes, registerBundledSkill, reviewMode };
|