@cuylabs/agent-core 0.9.0 → 0.11.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/README.md +33 -17
- package/dist/chunk-2O4MCSQS.js +780 -0
- package/dist/chunk-2TTOLHBT.js +198 -0
- package/dist/chunk-5FMSGQVX.js +281 -0
- package/dist/chunk-5NVVNXPQ.js +288 -0
- package/dist/{chunk-EKR6PKXU.js → chunk-6HZBHFOL.js} +3 -3
- package/dist/chunk-CJI7PVS2.js +58 -0
- package/dist/{chunk-WKHDSSXG.js → chunk-CMYN2RCB.js} +146 -46
- package/dist/chunk-FII65CN7.js +117 -0
- package/dist/{chunk-UHCJEM2E.js → chunk-ICZ66572.js} +13 -6
- package/dist/chunk-KYLPMBHD.js +316 -0
- package/dist/chunk-MXAP4UG6.js +2956 -0
- package/dist/{chunk-4QFNWPIF.js → chunk-N3VX7FEE.js} +35 -2
- package/dist/{chunk-MAZ5DY5B.js → chunk-NDZWXCBZ.js} +213 -78
- package/dist/{chunk-MHKK374K.js → chunk-Q742PSH3.js} +11 -27
- package/dist/{chunk-WGZAPU6N.js → chunk-QAL3OMI3.js} +15 -1
- package/dist/{chunk-UDCZ673N.js → chunk-RN6WZEUF.js} +27 -23
- package/dist/{chunk-ZXAKHMWH.js → chunk-ROTGCYDW.js} +22 -84
- package/dist/chunk-SPBFQXOT.js +0 -0
- package/dist/chunk-SSFBF3US.js +602 -0
- package/dist/chunk-SZ2XBPTW.js +8 -0
- package/dist/chunk-T4UIX5D7.js +115 -0
- package/dist/{chunk-IYWQOJMQ.js → chunk-TIHPYVAJ.js} +34 -34
- package/dist/{chunk-RKEW5WXI.js → chunk-TOTDGK3P.js} +1 -1
- package/dist/chunk-V4RFNEET.js +563 -0
- package/dist/chunk-VOUEJSW6.js +0 -0
- package/dist/{chunk-J4QDGZIA.js → chunk-WBPOZ7CL.js} +659 -275
- package/dist/chunk-X4VN4GIJ.js +185 -0
- package/dist/dispatch/index.d.ts +93 -0
- package/dist/dispatch/index.js +37 -0
- package/dist/events/index.d.ts +93 -0
- package/dist/events/index.js +6 -0
- package/dist/{runtime → execution}/index.d.ts +120 -35
- package/dist/{runtime → execution}/index.js +17 -11
- package/dist/index.d.ts +489 -115
- package/dist/index.js +1665 -462
- package/dist/inference/errors/index.js +1 -1
- package/dist/inference/index.d.ts +13 -21
- package/dist/inference/index.js +15 -12
- package/dist/instance-DzPiv6EK.d.ts +5723 -0
- package/dist/logger/index.d.ts +50 -0
- package/dist/logger/index.js +11 -0
- package/dist/mcp/index.d.ts +5 -9
- package/dist/mcp/index.js +2 -3
- package/dist/middleware/index.d.ts +10 -150
- package/dist/middleware/index.js +10 -2
- package/dist/model-messages-CJfwfzGe.d.ts +13 -0
- package/dist/models/index.d.ts +5 -2
- package/dist/models/index.js +2 -1
- package/dist/models/reasoning/index.js +2 -1
- package/dist/plugin/index.d.ts +55 -11
- package/dist/plugin/index.js +1 -1
- package/dist/profiles/index.d.ts +55 -0
- package/dist/{presets → profiles}/index.js +10 -10
- package/dist/prompt/index.d.ts +8 -13
- package/dist/safety/index.d.ts +109 -14
- package/dist/safety/index.js +59 -3
- package/dist/sandbox/index.d.ts +81 -0
- package/dist/sandbox/index.js +1 -0
- package/dist/skill/index.d.ts +10 -8
- package/dist/skill/index.js +2 -2
- package/dist/storage/index.d.ts +12 -4
- package/dist/storage/index.js +1 -1
- package/dist/subagents/index.d.ts +177 -0
- package/dist/subagents/index.js +78 -0
- package/dist/team/index.d.ts +544 -0
- package/dist/team/index.js +41 -0
- package/dist/tool/host/index.d.ts +41 -0
- package/dist/tool/host/index.js +10 -0
- package/dist/tool/index.d.ts +111 -21
- package/dist/tool/index.js +20 -13
- package/dist/{types-VQgymC1N.d.ts → types-Bj_J8u_W.d.ts} +44 -64
- package/dist/{types-CHiPh8U2.d.ts → types-C_LCeYNg.d.ts} +7 -7
- package/dist/types-RSCv7nQ4.d.ts +59 -0
- package/package.json +46 -47
- package/dist/builder-BgZ_j4Vs.d.ts +0 -35
- package/dist/chunk-5ARZJWD2.js +0 -259
- package/dist/chunk-DXFBQMXP.js +0 -53
- package/dist/chunk-H3FUYU52.js +0 -81
- package/dist/chunk-JLXG2SH7.js +0 -905
- package/dist/chunk-N7P4PN3O.js +0 -84
- package/dist/chunk-OFDKHNCX.js +0 -727
- package/dist/chunk-SDSBEQXG.js +0 -157
- package/dist/chunk-VEKUXUVF.js +0 -41
- package/dist/chunk-VNQBHPCT.js +0 -398
- package/dist/chunk-WWYYNWEW.js +0 -259
- package/dist/context/index.d.ts +0 -259
- package/dist/context/index.js +0 -26
- package/dist/events-CE72w8W4.d.ts +0 -149
- package/dist/host/index.d.ts +0 -45
- package/dist/host/index.js +0 -8
- package/dist/index-DQuTZ8xL.d.ts +0 -1335
- package/dist/messages-BYWGn8TY.d.ts +0 -110
- package/dist/presets/index.d.ts +0 -53
- package/dist/registry-DwYqsQkX.d.ts +0 -164
- package/dist/runner-CI-XeR16.d.ts +0 -91
- package/dist/scope/index.d.ts +0 -10
- package/dist/scope/index.js +0 -14
- package/dist/session-manager-KbYt2WUh.d.ts +0 -282
- package/dist/signal/index.d.ts +0 -28
- package/dist/signal/index.js +0 -6
- package/dist/sub-agent/index.d.ts +0 -24
- package/dist/sub-agent/index.js +0 -32
- package/dist/tool-CZWN3KbO.d.ts +0 -141
- package/dist/tool-DkhSCV2Y.d.ts +0 -145
- package/dist/tracker-DClqYqTj.d.ts +0 -96
- package/dist/tracking/index.d.ts +0 -111
- package/dist/tracking/index.js +0 -20
- package/dist/types-BfNpU8NS.d.ts +0 -270
- package/dist/types-BlOKk-Bb.d.ts +0 -330
- package/dist/types-BlZwmnuW.d.ts +0 -50
- package/dist/types-CQL-SvTn.d.ts +0 -29
- package/dist/types-CWm-7rvB.d.ts +0 -55
- package/dist/types-DTSkxakL.d.ts +0 -651
- package/dist/types-DmDwi2zI.d.ts +0 -339
- package/dist/types-YuWV4ag7.d.ts +0 -72
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Turn-tracker contracts for @cuylabs/agent-core.
|
|
3
|
-
*/
|
|
4
|
-
/** Configuration for turn tracking. */
|
|
5
|
-
interface TurnTrackerConfig {
|
|
6
|
-
/** Working directory (absolute path) - all paths resolve relative to this */
|
|
7
|
-
cwd: string;
|
|
8
|
-
/** Whether to try git-aware diffs when available. Default: auto-detect */
|
|
9
|
-
useGit?: boolean;
|
|
10
|
-
/** Maximum files to track per turn. Default: 100 */
|
|
11
|
-
maxTrackedFiles?: number;
|
|
12
|
-
}
|
|
13
|
-
/** File baseline captured before modification. */
|
|
14
|
-
interface FileBaseline {
|
|
15
|
-
/** Absolute path */
|
|
16
|
-
path: string;
|
|
17
|
-
/** Content before modification (null if file did not exist) */
|
|
18
|
-
content: string | null;
|
|
19
|
-
/** File mode (permissions) */
|
|
20
|
-
mode: number | null;
|
|
21
|
-
/** Hash of original content for quick comparison */
|
|
22
|
-
hash: string | null;
|
|
23
|
-
/** When baseline was captured */
|
|
24
|
-
capturedAt: Date;
|
|
25
|
-
}
|
|
26
|
-
/** Single file change within a turn. */
|
|
27
|
-
interface TurnFileChange {
|
|
28
|
-
/** Relative path (from cwd) */
|
|
29
|
-
path: string;
|
|
30
|
-
/** Type of change */
|
|
31
|
-
type: "created" | "modified" | "deleted" | "unchanged";
|
|
32
|
-
/** Lines added */
|
|
33
|
-
additions: number;
|
|
34
|
-
/** Lines removed */
|
|
35
|
-
deletions: number;
|
|
36
|
-
/** Unified diff for this file */
|
|
37
|
-
diff?: string;
|
|
38
|
-
}
|
|
39
|
-
/** Summary of a completed turn. */
|
|
40
|
-
interface TurnSummary {
|
|
41
|
-
/** Turn identifier */
|
|
42
|
-
turnId: string;
|
|
43
|
-
/** Files changed */
|
|
44
|
-
files: TurnFileChange[];
|
|
45
|
-
/** Total files tracked */
|
|
46
|
-
totalTracked: number;
|
|
47
|
-
/** Total additions across all files */
|
|
48
|
-
additions: number;
|
|
49
|
-
/** Total deletions across all files */
|
|
50
|
-
deletions: number;
|
|
51
|
-
/** Combined unified diff for all changes */
|
|
52
|
-
diff: string | null;
|
|
53
|
-
/** Turn duration in ms */
|
|
54
|
-
duration: number;
|
|
55
|
-
}
|
|
56
|
-
/** Result of undo operation. */
|
|
57
|
-
interface UndoResult {
|
|
58
|
-
/** Files restored */
|
|
59
|
-
restored: string[];
|
|
60
|
-
/** Files that could not be restored */
|
|
61
|
-
failed: Array<{
|
|
62
|
-
path: string;
|
|
63
|
-
reason: string;
|
|
64
|
-
}>;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Turn Change Tracker - Per-turn file modification tracking.
|
|
69
|
-
*
|
|
70
|
-
* Tracks file changes within a single agent turn for undo/diff capabilities.
|
|
71
|
-
* Unlike checkpoints (session-level snapshots), this only captures files that
|
|
72
|
-
* were actually touched during the active turn.
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
declare class TurnChangeTracker {
|
|
76
|
-
private config;
|
|
77
|
-
private currentTurn;
|
|
78
|
-
private gitDetected;
|
|
79
|
-
constructor(config: TurnTrackerConfig);
|
|
80
|
-
startTurn(turnId: string): void;
|
|
81
|
-
endTurn(): Promise<TurnSummary>;
|
|
82
|
-
isInTurn(): boolean;
|
|
83
|
-
getCurrentTurnId(): string | null;
|
|
84
|
-
beforeWrite(filePath: string): Promise<boolean>;
|
|
85
|
-
getTrackedFiles(): string[];
|
|
86
|
-
isTracking(filePath: string): boolean;
|
|
87
|
-
getDiff(): Promise<string | null>;
|
|
88
|
-
getFileDiff(filePath: string): Promise<string | null>;
|
|
89
|
-
undoTurn(): Promise<UndoResult>;
|
|
90
|
-
undoFiles(filePaths: string[]): Promise<UndoResult>;
|
|
91
|
-
private computeFileChange;
|
|
92
|
-
private isInGitRepo;
|
|
93
|
-
}
|
|
94
|
-
declare function createTurnTracker(config: TurnTrackerConfig): TurnChangeTracker;
|
|
95
|
-
|
|
96
|
-
export { type FileBaseline as F, TurnChangeTracker as T, type UndoResult as U, type TurnFileChange as a, type TurnSummary as b, type TurnTrackerConfig as c, createTurnTracker as d };
|
package/dist/tracking/index.d.ts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { T as TurnChangeTracker } from '../tracker-DClqYqTj.js';
|
|
2
|
-
export { F as FileBaseline, a as TurnFileChange, b as TurnSummary, c as TurnTrackerConfig, U as UndoResult, d as createTurnTracker } from '../tracker-DClqYqTj.js';
|
|
3
|
-
import { F as FileOperationMeta } from '../tool-DkhSCV2Y.js';
|
|
4
|
-
import '../types-CHiPh8U2.js';
|
|
5
|
-
import '../types-CQL-SvTn.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Checkpoint system contracts for @cuylabs/agent-core.
|
|
9
|
-
*/
|
|
10
|
-
/** Configuration for creating a checkpoint manager. */
|
|
11
|
-
interface CheckpointConfig {
|
|
12
|
-
/** Working directory to track (absolute path) */
|
|
13
|
-
workDir: string;
|
|
14
|
-
/** Optional custom storage directory */
|
|
15
|
-
storageDir?: string;
|
|
16
|
-
/** Whether to track file contents (enables restore). Default: true */
|
|
17
|
-
trackContent?: boolean;
|
|
18
|
-
/** Patterns to exclude from tracking (gitignore format) */
|
|
19
|
-
exclude?: string[];
|
|
20
|
-
/** Maximum number of checkpoints to retain. Default: 100 */
|
|
21
|
-
maxCheckpoints?: number;
|
|
22
|
-
}
|
|
23
|
-
/** A saved checkpoint representing a point-in-time state. */
|
|
24
|
-
interface Checkpoint {
|
|
25
|
-
/** Unique checkpoint identifier (git tree hash) */
|
|
26
|
-
id: string;
|
|
27
|
-
/** Human-readable label */
|
|
28
|
-
label: string;
|
|
29
|
-
/** When the checkpoint was created */
|
|
30
|
-
createdAt: Date;
|
|
31
|
-
/** Optional metadata */
|
|
32
|
-
metadata?: Record<string, unknown>;
|
|
33
|
-
}
|
|
34
|
-
/** File change information between checkpoints. */
|
|
35
|
-
interface FileChange {
|
|
36
|
-
/** Relative file path */
|
|
37
|
-
path: string;
|
|
38
|
-
/** Type of change */
|
|
39
|
-
type: "added" | "modified" | "deleted";
|
|
40
|
-
/** Lines added (for text files) */
|
|
41
|
-
additions?: number;
|
|
42
|
-
/** Lines removed (for text files) */
|
|
43
|
-
deletions?: number;
|
|
44
|
-
}
|
|
45
|
-
/** Changes detected between a checkpoint and current state. */
|
|
46
|
-
interface ChangeSet {
|
|
47
|
-
/** Checkpoint being compared from */
|
|
48
|
-
fromCheckpoint: string;
|
|
49
|
-
/** List of changed files */
|
|
50
|
-
files: FileChange[];
|
|
51
|
-
/** Unified diff output */
|
|
52
|
-
diff: string;
|
|
53
|
-
}
|
|
54
|
-
/** Checkpoint manager interface. */
|
|
55
|
-
interface CheckpointManager {
|
|
56
|
-
/** Save current state as a checkpoint */
|
|
57
|
-
save(label?: string, metadata?: Record<string, unknown>): Promise<Checkpoint>;
|
|
58
|
-
/** Restore all files to a checkpoint state */
|
|
59
|
-
restore(checkpointId: string): Promise<void>;
|
|
60
|
-
/** Get changes since a checkpoint */
|
|
61
|
-
changes(checkpointId: string): Promise<ChangeSet>;
|
|
62
|
-
/** Undo changes to specific files (restore them from checkpoint) */
|
|
63
|
-
undoFiles(checkpointId: string, files: string[]): Promise<void>;
|
|
64
|
-
/** List all checkpoints (newest first) */
|
|
65
|
-
list(): Promise<Checkpoint[]>;
|
|
66
|
-
/** Delete a specific checkpoint */
|
|
67
|
-
remove(checkpointId: string): Promise<void>;
|
|
68
|
-
/** Prune old checkpoints beyond maxCheckpoints limit */
|
|
69
|
-
prune(): Promise<number>;
|
|
70
|
-
/** Get the latest checkpoint */
|
|
71
|
-
latest(): Promise<Checkpoint | null>;
|
|
72
|
-
/** Get file content at a specific checkpoint */
|
|
73
|
-
getFileAt(checkpointId: string, filePath: string): Promise<string | null>;
|
|
74
|
-
/** Check if manager is initialized */
|
|
75
|
-
isInitialized(): boolean;
|
|
76
|
-
/** Close and cleanup resources */
|
|
77
|
-
close(): Promise<void>;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Creates a checkpoint manager for tracking file state changes.
|
|
82
|
-
*/
|
|
83
|
-
declare function createCheckpointManager(config: CheckpointConfig): Promise<CheckpointManager>;
|
|
84
|
-
/**
|
|
85
|
-
* Clear all checkpoint data for a working directory.
|
|
86
|
-
*/
|
|
87
|
-
declare function clearCheckpoints(workDir: string): Promise<void>;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Extended tool metadata with file operation info.
|
|
91
|
-
*/
|
|
92
|
-
interface TrackedToolMetadata {
|
|
93
|
-
/** File operation metadata for auto-tracking */
|
|
94
|
-
fileOps?: FileOperationMeta;
|
|
95
|
-
/** Other metadata */
|
|
96
|
-
[key: string]: unknown;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Extract file paths from tool arguments based on metadata.
|
|
100
|
-
*/
|
|
101
|
-
declare function extractFilePathsFromArgs(args: Record<string, unknown>, meta: FileOperationMeta): string[];
|
|
102
|
-
/**
|
|
103
|
-
* Check whether a tool operation should trigger baseline capture.
|
|
104
|
-
*/
|
|
105
|
-
declare function shouldCaptureBaseline(meta: FileOperationMeta): boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Wrap a tool execute function with automatic file tracking.
|
|
108
|
-
*/
|
|
109
|
-
declare function withFileTracking<T extends (...args: unknown[]) => Promise<unknown>>(tracker: TurnChangeTracker, meta: FileOperationMeta, execute: T): T;
|
|
110
|
-
|
|
111
|
-
export { type ChangeSet, type Checkpoint, type CheckpointConfig, type CheckpointManager, type FileChange, type TrackedToolMetadata, TurnChangeTracker, clearCheckpoints, createCheckpointManager, extractFilePathsFromArgs, shouldCaptureBaseline, withFileTracking };
|
package/dist/tracking/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TurnChangeTracker,
|
|
3
|
-
clearCheckpoints,
|
|
4
|
-
createCheckpointManager,
|
|
5
|
-
createTurnTracker
|
|
6
|
-
} from "../chunk-OFDKHNCX.js";
|
|
7
|
-
import {
|
|
8
|
-
extractFilePathsFromArgs,
|
|
9
|
-
shouldCaptureBaseline,
|
|
10
|
-
withFileTracking
|
|
11
|
-
} from "../chunk-VEKUXUVF.js";
|
|
12
|
-
export {
|
|
13
|
-
TurnChangeTracker,
|
|
14
|
-
clearCheckpoints,
|
|
15
|
-
createCheckpointManager,
|
|
16
|
-
createTurnTracker,
|
|
17
|
-
extractFilePathsFromArgs,
|
|
18
|
-
shouldCaptureBaseline,
|
|
19
|
-
withFileTracking
|
|
20
|
-
};
|
package/dist/types-BfNpU8NS.d.ts
DELETED
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill System Types
|
|
3
|
-
*
|
|
4
|
-
* Skills are modular, on-demand knowledge packs that extend an agent's
|
|
5
|
-
* capabilities with specialized instructions, workflows, and resources.
|
|
6
|
-
*
|
|
7
|
-
* Design principles:
|
|
8
|
-
*
|
|
9
|
-
* 1. **Progressive disclosure** — summaries always in context,
|
|
10
|
-
* full content loaded only when needed. Minimizes baseline token cost.
|
|
11
|
-
*
|
|
12
|
-
* 2. **Scoped priority** — project skills override user skills
|
|
13
|
-
* override global skills. Closest scope wins on name collision.
|
|
14
|
-
*
|
|
15
|
-
* 3. **Agent-initiated loading** — the agent decides when to
|
|
16
|
-
* activate a skill by calling the `skill` tool. No guesswork.
|
|
17
|
-
*
|
|
18
|
-
* 4. **Bundled resources** — skills can ship scripts,
|
|
19
|
-
* references, assets, and examples alongside instructions.
|
|
20
|
-
*
|
|
21
|
-
* 5. **Remote sources** — skills can be fetched from URLs,
|
|
22
|
-
* enabling shared skill repositories across teams.
|
|
23
|
-
*
|
|
24
|
-
* The lifecycle:
|
|
25
|
-
*
|
|
26
|
-
* Discovery → Registry → Summary injection → Agent tool call → Full load
|
|
27
|
-
*
|
|
28
|
-
* @packageDocumentation
|
|
29
|
-
*/
|
|
30
|
-
/**
|
|
31
|
-
* Where a skill was discovered, determining its override priority.
|
|
32
|
-
*
|
|
33
|
-
* When two skills share the same name, the narrower scope wins:
|
|
34
|
-
* project > user > global > builtin
|
|
35
|
-
*
|
|
36
|
-
* Uses a 4-tier hierarchy with names that are intuitive for
|
|
37
|
-
* library consumers.
|
|
38
|
-
*/
|
|
39
|
-
type SkillScope = "project" | "user" | "global" | "builtin";
|
|
40
|
-
/**
|
|
41
|
-
* How a skill was obtained — local filesystem or remote URL.
|
|
42
|
-
*/
|
|
43
|
-
type SkillSourceType = "local" | "remote";
|
|
44
|
-
/**
|
|
45
|
-
* Where a skill came from, for provenance tracking.
|
|
46
|
-
*/
|
|
47
|
-
interface SkillSource {
|
|
48
|
-
/** Local or remote origin */
|
|
49
|
-
type: SkillSourceType;
|
|
50
|
-
/** Root directory or URL this skill was discovered under */
|
|
51
|
-
root: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Classification of bundled resources within a skill directory.
|
|
55
|
-
*
|
|
56
|
-
* Resource taxonomy:
|
|
57
|
-
* - `script` — executable code for deterministic tasks (can be run without reading)
|
|
58
|
-
* - `reference` — documentation loaded into context on demand
|
|
59
|
-
* - `asset` — templates, images, fonts used in output (not read into context)
|
|
60
|
-
* - `example` — working code samples for the agent to learn from
|
|
61
|
-
*/
|
|
62
|
-
type SkillResourceType = "script" | "reference" | "asset" | "example";
|
|
63
|
-
/**
|
|
64
|
-
* A file bundled with a skill.
|
|
65
|
-
*
|
|
66
|
-
* Resources are discovered but NOT loaded into memory until the agent
|
|
67
|
-
* explicitly requests them. This is the L3 layer of progressive disclosure.
|
|
68
|
-
*/
|
|
69
|
-
interface SkillResource {
|
|
70
|
-
/** Path relative to the skill's base directory */
|
|
71
|
-
relativePath: string;
|
|
72
|
-
/** Classified resource type */
|
|
73
|
-
type: SkillResourceType;
|
|
74
|
-
/** Absolute path on disk (for local resources) */
|
|
75
|
-
absolutePath: string;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Lightweight skill metadata parsed from SKILL.md YAML frontmatter.
|
|
79
|
-
*
|
|
80
|
-
* This is the **L1 layer** — always present in the system prompt so the
|
|
81
|
-
* agent knows which skills exist. Kept intentionally small (~100 words each)
|
|
82
|
-
* to minimize baseline context cost.
|
|
83
|
-
*
|
|
84
|
-
* Uses YAML frontmatter in a SKILL.md file — the widely-adopted
|
|
85
|
-
* canonical format for skill definitions.
|
|
86
|
-
*/
|
|
87
|
-
interface SkillMetadata {
|
|
88
|
-
/** Unique skill identifier (from frontmatter `name`) */
|
|
89
|
-
name: string;
|
|
90
|
-
/**
|
|
91
|
-
* When to use this skill — the single most important field.
|
|
92
|
-
*
|
|
93
|
-
* This description is what the agent reads to decide whether to
|
|
94
|
-
* activate the skill. Should contain trigger phrases that match
|
|
95
|
-
* task types. Written for another LLM to consume, not humans.
|
|
96
|
-
*/
|
|
97
|
-
description: string;
|
|
98
|
-
/** Semantic version (from frontmatter, optional) */
|
|
99
|
-
version?: string;
|
|
100
|
-
/** Scope that determines override priority */
|
|
101
|
-
scope: SkillScope;
|
|
102
|
-
/** How this skill was obtained */
|
|
103
|
-
source: SkillSource;
|
|
104
|
-
/** Absolute path to the SKILL.md file */
|
|
105
|
-
filePath: string;
|
|
106
|
-
/** Directory containing the skill (parent of SKILL.md) */
|
|
107
|
-
baseDir: string;
|
|
108
|
-
/** Optional tags for categorization */
|
|
109
|
-
tags?: string[];
|
|
110
|
-
/**
|
|
111
|
-
* Names of skills this skill depends on.
|
|
112
|
-
* When this skill is loaded, its dependencies are suggested to be loaded too.
|
|
113
|
-
*/
|
|
114
|
-
dependencies?: string[];
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Full skill content including the markdown body and resource listing.
|
|
118
|
-
*
|
|
119
|
-
* This is the **L2 layer** — loaded only when the agent calls the skill
|
|
120
|
-
* tool. Contains the actual instructions plus awareness of bundled resources.
|
|
121
|
-
*/
|
|
122
|
-
interface SkillContent extends SkillMetadata {
|
|
123
|
-
/**
|
|
124
|
-
* The full markdown body of SKILL.md (everything below the frontmatter).
|
|
125
|
-
* This is the core instructional content injected into the conversation.
|
|
126
|
-
*/
|
|
127
|
-
body: string;
|
|
128
|
-
/**
|
|
129
|
-
* Bundled resources discovered in the skill directory.
|
|
130
|
-
* Listed so the agent knows what's available but not yet loaded.
|
|
131
|
-
*/
|
|
132
|
-
resources: SkillResource[];
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Configuration for skill discovery and loading.
|
|
136
|
-
*
|
|
137
|
-
* Controls where skills are found, how deep to scan, and which
|
|
138
|
-
* external conventions to support.
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* ```typescript
|
|
142
|
-
* const skillConfig: SkillConfig = {
|
|
143
|
-
* // Scan standard locations
|
|
144
|
-
* externalDirs: [".agents", ".claude"],
|
|
145
|
-
* // Add custom skill roots
|
|
146
|
-
* roots: ["./company-skills"],
|
|
147
|
-
* // Limit scan depth for performance
|
|
148
|
-
* maxScanDepth: 4,
|
|
149
|
-
* };
|
|
150
|
-
* ```
|
|
151
|
-
*/
|
|
152
|
-
interface SkillConfig {
|
|
153
|
-
/**
|
|
154
|
-
* Additional directories to scan for skills (absolute or relative to cwd).
|
|
155
|
-
* Each directory is scanned recursively for SKILL.md files.
|
|
156
|
-
*/
|
|
157
|
-
roots?: string[];
|
|
158
|
-
/**
|
|
159
|
-
* External skill directory names to scan in project and home directories.
|
|
160
|
-
*
|
|
161
|
-
* These are checked as `<project>/<dir>/skills/` and `~/<dir>/skills/`.
|
|
162
|
-
* Supports `.claude` and `.agents` directory conventions.
|
|
163
|
-
*
|
|
164
|
-
* @default [".agents", ".claude"]
|
|
165
|
-
*/
|
|
166
|
-
externalDirs?: string[];
|
|
167
|
-
/**
|
|
168
|
-
* Maximum directory depth to scan within each root.
|
|
169
|
-
* Higher values find more deeply nested skills but take longer.
|
|
170
|
-
*
|
|
171
|
-
* @default 4
|
|
172
|
-
*/
|
|
173
|
-
maxScanDepth?: number;
|
|
174
|
-
/**
|
|
175
|
-
* Maximum file size for SKILL.md files in bytes.
|
|
176
|
-
* Skills larger than this are skipped with a warning.
|
|
177
|
-
*
|
|
178
|
-
* @default 102400 (100KB)
|
|
179
|
-
*/
|
|
180
|
-
maxFileSize?: number;
|
|
181
|
-
/**
|
|
182
|
-
* Enable fetching skills from remote URLs.
|
|
183
|
-
* When false, `remoteUrls` is ignored.
|
|
184
|
-
*
|
|
185
|
-
* @default false
|
|
186
|
-
*/
|
|
187
|
-
enableRemote?: boolean;
|
|
188
|
-
/**
|
|
189
|
-
* Remote skill index URLs to fetch.
|
|
190
|
-
*
|
|
191
|
-
* Each URL should serve a JSON index listing available skills.
|
|
192
|
-
* See `RemoteSkillIndex` for the expected format.
|
|
193
|
-
*
|
|
194
|
-
* @example
|
|
195
|
-
* ```typescript
|
|
196
|
-
* remoteUrls: ["https://skills.example.com/index.json"]
|
|
197
|
-
* ```
|
|
198
|
-
*/
|
|
199
|
-
remoteUrls?: string[];
|
|
200
|
-
/**
|
|
201
|
-
* Cache directory for remote skills.
|
|
202
|
-
* Defaults to `~/.cache/cuylabs/skills/`.
|
|
203
|
-
*/
|
|
204
|
-
remoteCacheDir?: string;
|
|
205
|
-
/**
|
|
206
|
-
* Include built-in skills bundled with agent-core.
|
|
207
|
-
* Currently reserved for future use.
|
|
208
|
-
*
|
|
209
|
-
* @default true
|
|
210
|
-
*/
|
|
211
|
-
includeBuiltin?: boolean;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Schema for remote skill index JSON files.
|
|
215
|
-
*
|
|
216
|
-
* Hosted at a URL like `https://skills.example.com/index.json`.
|
|
217
|
-
* Enables team-wide or organization-wide skill sharing.
|
|
218
|
-
*
|
|
219
|
-
* @example
|
|
220
|
-
* ```json
|
|
221
|
-
* {
|
|
222
|
-
* "version": 1,
|
|
223
|
-
* "skills": [
|
|
224
|
-
* {
|
|
225
|
-
* "name": "testing",
|
|
226
|
-
* "files": ["SKILL.md", "scripts/run-tests.sh", "references/patterns.md"]
|
|
227
|
-
* }
|
|
228
|
-
* ]
|
|
229
|
-
* }
|
|
230
|
-
* ```
|
|
231
|
-
*/
|
|
232
|
-
interface RemoteSkillIndex {
|
|
233
|
-
/** Schema version (currently 1) */
|
|
234
|
-
version: number;
|
|
235
|
-
/** List of available skills */
|
|
236
|
-
skills: RemoteSkillEntry[];
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* A single skill listing in a remote index.
|
|
240
|
-
*/
|
|
241
|
-
interface RemoteSkillEntry {
|
|
242
|
-
/** Skill name (must match the `name` in SKILL.md frontmatter) */
|
|
243
|
-
name: string;
|
|
244
|
-
/** Relative file paths to download (SKILL.md is required) */
|
|
245
|
-
files: string[];
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Result of a full skill discovery pass.
|
|
249
|
-
*/
|
|
250
|
-
interface SkillDiscoveryResult {
|
|
251
|
-
/** All discovered skills (deduplicated, scope-prioritized) */
|
|
252
|
-
skills: SkillMetadata[];
|
|
253
|
-
/** Skills that failed to load with reasons */
|
|
254
|
-
errors: SkillDiscoveryError[];
|
|
255
|
-
/** Total directories scanned */
|
|
256
|
-
dirsScanned: number;
|
|
257
|
-
/** Discovery duration in milliseconds */
|
|
258
|
-
durationMs: number;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* An error encountered during skill discovery.
|
|
262
|
-
*/
|
|
263
|
-
interface SkillDiscoveryError {
|
|
264
|
-
/** Path that caused the error */
|
|
265
|
-
path: string;
|
|
266
|
-
/** What went wrong */
|
|
267
|
-
reason: string;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export type { RemoteSkillEntry as R, SkillDiscoveryResult as S, SkillMetadata as a, SkillContent as b, SkillResource as c, SkillConfig as d, RemoteSkillIndex as e, SkillDiscoveryError as f, SkillResourceType as g, SkillScope as h, SkillSource as i, SkillSourceType as j };
|