unagent 0.0.1 → 0.0.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.
Files changed (85) hide show
  1. package/README.md +47 -0
  2. package/dist/clone-DgXhqC05.mjs +104 -0
  3. package/dist/context/index.d.mts +2 -0
  4. package/dist/context/index.mjs +3 -0
  5. package/dist/context-CAk5kS7q.mjs +59 -0
  6. package/dist/{env-BUegcU7a.js → detect-CDtKsCsD.mjs} +1 -1
  7. package/dist/env/{index.d.ts → index.d.mts} +1 -1
  8. package/dist/env/{index.js → index.mjs} +3 -2
  9. package/dist/env-DeXFcrWN.mjs +1 -0
  10. package/dist/exec/index.d.mts +2 -0
  11. package/dist/exec/index.mjs +3 -0
  12. package/dist/exec-Dzl5r4Ui.mjs +116 -0
  13. package/dist/fs/index.d.mts +2 -0
  14. package/dist/fs/index.mjs +3 -0
  15. package/dist/fs-nJz4v9pE.mjs +269 -0
  16. package/dist/git/{index.d.ts → index.d.mts} +1 -1
  17. package/dist/git/index.mjs +4 -0
  18. package/dist/git-D3qsdy9d.mjs +86 -0
  19. package/dist/hooks/index.d.mts +3 -0
  20. package/dist/hooks/index.mjs +3 -0
  21. package/dist/hooks-335rp9Cp.mjs +9 -0
  22. package/dist/index-BZaywR9E.d.mts +97 -0
  23. package/dist/index-Bd1gSwMB.d.mts +31 -0
  24. package/dist/index-Bd4x_1H9.d.mts +33 -0
  25. package/dist/index-C0ulBa5T.d.mts +21 -0
  26. package/dist/{index-DwU61LUW.d.ts → index-C55JaUgw.d.mts} +10 -10
  27. package/dist/index-Csv1G0zj.d.mts +36 -0
  28. package/dist/index-CvCCCs-_.d.mts +20 -0
  29. package/dist/{index-LzafUiEo.d.ts → index-Cy8LThTV.d.mts} +1 -1
  30. package/dist/index-D5A0wwzb.d.mts +55 -0
  31. package/dist/index-DFqD_DAh.d.mts +80 -0
  32. package/dist/index-DShEKmmL.d.mts +43 -0
  33. package/dist/index-DpFup4kC.d.mts +21 -0
  34. package/dist/index-ucMWydcs.d.mts +19 -0
  35. package/dist/index.d.mts +18 -0
  36. package/dist/index.mjs +24 -0
  37. package/dist/link/{index.d.ts → index.d.mts} +1 -1
  38. package/dist/link/{index.js → index.mjs} +2 -1
  39. package/dist/link-BRZABZ3A.mjs +1 -0
  40. package/dist/lock/{index.d.ts → index.d.mts} +1 -1
  41. package/dist/lock/{index.js → index.mjs} +1 -1
  42. package/dist/{lock-BeR43Izo.js → lock-CB9Xr9pv.mjs} +1 -1
  43. package/dist/{path-nPuHl-f5.js → path-Dm-URQvz.mjs} +3 -3
  44. package/dist/registry/index.d.mts +2 -0
  45. package/dist/registry/index.mjs +3 -0
  46. package/dist/registry-DvxT2enn.mjs +30 -0
  47. package/dist/sandbox/index.d.mts +2 -0
  48. package/dist/sandbox/index.mjs +3 -0
  49. package/dist/sandbox-Dyz9jTaL.mjs +139 -0
  50. package/dist/skill/index.d.mts +2 -0
  51. package/dist/skill/index.mjs +9 -0
  52. package/dist/skill-BnKVgm4n.mjs +358 -0
  53. package/dist/source/{index.d.ts → index.d.mts} +1 -1
  54. package/dist/source/{index.js → index.mjs} +2 -1
  55. package/dist/source-BCRylzkW.mjs +1 -0
  56. package/dist/stop/index.d.mts +3 -0
  57. package/dist/stop/index.mjs +4 -0
  58. package/dist/stop-B9w8PiPj.mjs +39 -0
  59. package/dist/stream/index.d.mts +3 -0
  60. package/dist/stream/index.mjs +3 -0
  61. package/dist/stream-CzGvLSeV.mjs +99 -0
  62. package/dist/tool/index.d.mts +2 -0
  63. package/dist/tool/index.mjs +3 -0
  64. package/dist/tool-CESxMfOv.mjs +45 -0
  65. package/dist/usage/index.d.mts +2 -0
  66. package/dist/usage/index.mjs +3 -0
  67. package/dist/usage-DTaeWIUK.mjs +165 -0
  68. package/dist/utils/{index.d.ts → index.d.mts} +1 -1
  69. package/dist/utils/{index.js → index.mjs} +2 -2
  70. package/package.json +104 -34
  71. package/dist/git/index.js +0 -3
  72. package/dist/git-D4ZclaF6.js +0 -132
  73. package/dist/index-y5JZ6STt.d.ts +0 -36
  74. package/dist/index.d.ts +0 -8
  75. package/dist/index.js +0 -10
  76. package/dist/skill/index.d.ts +0 -2
  77. package/dist/skill/index.js +0 -3
  78. package/dist/skill-BmLJYiQz.js +0 -69
  79. /package/dist/{index-CirIJDiq.d.ts → index-CbYchDwg.d.mts} +0 -0
  80. /package/dist/{index-BW91Ai1Y.d.ts → index-CzgY9GU2.d.mts} +0 -0
  81. /package/dist/{index-CFwFmDD-.d.ts → index-DPt7J0hF.d.mts} +0 -0
  82. /package/dist/{index-DmiDvQ8Q.d.ts → index-wTumcHrH.d.mts} +0 -0
  83. /package/dist/{source-IfQxnt_F.js → parse-CEbeorIB.mjs} +0 -0
  84. /package/dist/{link-C4PSDr4v.js → symlink-CbP-heyc.mjs} +0 -0
  85. /package/dist/{utils-CDyPZons.js → utils-bP3i6rq3.mjs} +0 -0
@@ -0,0 +1,86 @@
1
+ import { o as git, s as parseGitStatus } from "./clone-DgXhqC05.mjs";
2
+ import { existsSync } from "node:fs";
3
+
4
+ //#region src/git/operations.ts
5
+ function getGitStatus(dir) {
6
+ if (!existsSync(dir)) return void 0;
7
+ try {
8
+ git(["rev-parse", "--is-inside-work-tree"], { cwd: dir });
9
+ const parsed = parseGitStatus(git([
10
+ "status",
11
+ "--porcelain=v2",
12
+ "--branch"
13
+ ], { cwd: dir }));
14
+ return {
15
+ isRepo: true,
16
+ branch: parsed.branch,
17
+ ahead: parsed.ahead,
18
+ behind: parsed.behind,
19
+ staged: parsed.staged,
20
+ modified: parsed.modified,
21
+ untracked: parsed.untracked,
22
+ hasChanges: parsed.staged.length > 0 || parsed.modified.length > 0 || parsed.untracked.length > 0
23
+ };
24
+ } catch {
25
+ return;
26
+ }
27
+ }
28
+ function getCurrentBranch(dir) {
29
+ try {
30
+ return git([
31
+ "rev-parse",
32
+ "--abbrev-ref",
33
+ "HEAD"
34
+ ], { cwd: dir });
35
+ } catch {
36
+ return;
37
+ }
38
+ }
39
+ function checkout(dir, ref) {
40
+ try {
41
+ git(["checkout", ref], { cwd: dir });
42
+ return true;
43
+ } catch {
44
+ return false;
45
+ }
46
+ }
47
+ function pull(dir) {
48
+ try {
49
+ git(["pull"], { cwd: dir });
50
+ return true;
51
+ } catch {
52
+ return false;
53
+ }
54
+ }
55
+ function fetch(dir, remote = "origin") {
56
+ try {
57
+ git(["fetch", remote], { cwd: dir });
58
+ return true;
59
+ } catch {
60
+ return false;
61
+ }
62
+ }
63
+ function getRemoteUrl(dir, remote = "origin") {
64
+ try {
65
+ return git([
66
+ "remote",
67
+ "get-url",
68
+ remote
69
+ ], { cwd: dir });
70
+ } catch {
71
+ return;
72
+ }
73
+ }
74
+ function getLatestCommitHash(dir) {
75
+ try {
76
+ return git(["rev-parse", "HEAD"], { cwd: dir });
77
+ } catch {
78
+ return;
79
+ }
80
+ }
81
+ function hasUncommittedChanges(dir) {
82
+ return getGitStatus(dir)?.hasChanges ?? false;
83
+ }
84
+
85
+ //#endregion
86
+ export { getLatestCommitHash as a, pull as c, getGitStatus as i, fetch as n, getRemoteUrl as o, getCurrentBranch as r, hasUncommittedChanges as s, checkout as t };
@@ -0,0 +1,3 @@
1
+ import "../index-ucMWydcs.mjs";
2
+ import { a as createHookable, i as createAgentHooks, n as AgentHooksInstance, r as Hookable, t as AgentHooks } from "../index-Csv1G0zj.mjs";
3
+ export { AgentHooks, AgentHooksInstance, Hookable, createAgentHooks, createHookable as createHooks };
@@ -0,0 +1,3 @@
1
+ import { n as createHookable, t as createAgentHooks } from "../hooks-335rp9Cp.mjs";
2
+
3
+ export { createAgentHooks, createHookable as createHooks };
@@ -0,0 +1,9 @@
1
+ import { createHooks as createHookable } from "hookable";
2
+
3
+ //#region src/hooks/index.ts
4
+ function createAgentHooks() {
5
+ return createHookable();
6
+ }
7
+
8
+ //#endregion
9
+ export { createHookable as n, createAgentHooks as t };
@@ -0,0 +1,97 @@
1
+ //#region src/skill/parse.d.ts
2
+ interface SkillFrontmatter {
3
+ "name": string;
4
+ "description": string;
5
+ "license"?: string;
6
+ "compatibility"?: string;
7
+ "metadata"?: Record<string, string>;
8
+ "allowed-tools"?: string;
9
+ "globs"?: string | string[];
10
+ "alwaysApply"?: boolean;
11
+ "tags"?: string[];
12
+ }
13
+ interface ParsedSkill {
14
+ frontmatter: SkillFrontmatter;
15
+ content: string;
16
+ raw: string;
17
+ }
18
+ declare function parseSkillMd(content: string): ParsedSkill;
19
+ declare function extractSkillName(frontmatter: SkillFrontmatter, filename?: string): string;
20
+ /** @deprecated Use validateSkill from './validate' for spec-compliant validation */
21
+ declare function validateSkillMd(parsed: ParsedSkill): string[];
22
+ //#endregion
23
+ //#region src/skill/discover.d.ts
24
+ interface DiscoveredSkill {
25
+ path: string;
26
+ name: string;
27
+ parsed: ParsedSkill;
28
+ }
29
+ interface DiscoverOptions {
30
+ recursive?: boolean;
31
+ }
32
+ declare function discoverSkills(dir: string, options?: DiscoverOptions): DiscoveredSkill[];
33
+ declare function filterSkills(skills: DiscoveredSkill[], query: string): DiscoveredSkill[];
34
+ declare function findSkillByName(skills: DiscoveredSkill[], name: string): DiscoveredSkill | undefined;
35
+ //#endregion
36
+ //#region src/skill/install.d.ts
37
+ interface InstallSkillOptions {
38
+ source: string;
39
+ skills?: string[];
40
+ agents?: string[];
41
+ global?: boolean;
42
+ cwd?: string;
43
+ mode?: "symlink" | "copy";
44
+ }
45
+ interface InstallSkillResultEntry {
46
+ skill: string;
47
+ agent: string;
48
+ path: string;
49
+ }
50
+ interface InstallSkillErrorEntry {
51
+ skill: string;
52
+ agent: string;
53
+ error: string;
54
+ }
55
+ interface InstallSkillResult {
56
+ success: boolean;
57
+ installed: InstallSkillResultEntry[];
58
+ errors: InstallSkillErrorEntry[];
59
+ }
60
+ declare function installSkill(options: InstallSkillOptions): Promise<InstallSkillResult>;
61
+ //#endregion
62
+ //#region src/skill/prompt.d.ts
63
+ declare function toPromptXml(skills: DiscoveredSkill[]): string;
64
+ //#endregion
65
+ //#region src/skill/uninstall.d.ts
66
+ interface UninstallSkillOptions {
67
+ skill: string;
68
+ agents?: string[];
69
+ global?: boolean;
70
+ cwd?: string;
71
+ }
72
+ interface UninstallSkillResultEntry {
73
+ skill: string;
74
+ agent: string;
75
+ path: string;
76
+ }
77
+ interface UninstallSkillErrorEntry {
78
+ skill: string;
79
+ agent: string;
80
+ error: string;
81
+ }
82
+ interface UninstallSkillResult {
83
+ success: boolean;
84
+ removed: UninstallSkillResultEntry[];
85
+ errors: UninstallSkillErrorEntry[];
86
+ }
87
+ declare function uninstallSkill(options: UninstallSkillOptions): Promise<UninstallSkillResult>;
88
+ //#endregion
89
+ //#region src/skill/validate.d.ts
90
+ interface ValidationResult {
91
+ valid: boolean;
92
+ errors: string[];
93
+ warnings: string[];
94
+ }
95
+ declare function validateSkill(skill: ParsedSkill, dirName?: string): ValidationResult;
96
+ //#endregion
97
+ export { validateSkillMd as C, parseSkillMd as S, filterSkills as _, UninstallSkillResult as a, SkillFrontmatter as b, toPromptXml as c, InstallSkillResult as d, InstallSkillResultEntry as f, discoverSkills as g, DiscoveredSkill as h, UninstallSkillOptions as i, InstallSkillErrorEntry as l, DiscoverOptions as m, validateSkill as n, UninstallSkillResultEntry as o, installSkill as p, UninstallSkillErrorEntry as r, uninstallSkill as s, ValidationResult as t, InstallSkillOptions as u, findSkillByName as v, extractSkillName as x, ParsedSkill as y };
@@ -0,0 +1,31 @@
1
+ //#region src/context/index.d.ts
2
+ interface TokenEstimateOptions {
3
+ charsPerToken?: number;
4
+ }
5
+ declare function estimateTokens(text: string, options?: TokenEstimateOptions): number;
6
+ interface TruncateOptions {
7
+ maxTokens: number;
8
+ charsPerToken?: number;
9
+ suffix?: string;
10
+ }
11
+ declare function truncateToFit(content: string, options: TruncateOptions): string;
12
+ interface ContextItem {
13
+ content: string;
14
+ priority?: number;
15
+ id?: string;
16
+ }
17
+ interface BuildContextOptions {
18
+ maxTokens: number;
19
+ charsPerToken?: number;
20
+ separator?: string;
21
+ }
22
+ interface BuildContextResult {
23
+ content: string;
24
+ tokens: number;
25
+ included: string[];
26
+ excluded: string[];
27
+ }
28
+ declare function buildContext(items: ContextItem[], options: BuildContextOptions): BuildContextResult;
29
+ declare function splitByTokens(text: string, maxTokensPerChunk: number, options?: TokenEstimateOptions): string[];
30
+ //#endregion
31
+ export { TruncateOptions as a, splitByTokens as c, TokenEstimateOptions as i, truncateToFit as l, BuildContextResult as n, buildContext as o, ContextItem as r, estimateTokens as s, BuildContextOptions as t };
@@ -0,0 +1,33 @@
1
+ //#region src/sandbox/index.d.ts
2
+ type SandboxProvider = "vercel" | "cloudflare";
3
+ type SandboxType = "docker" | "cloudflare" | "vercel" | "none";
4
+ interface SandboxOptions {
5
+ provider: SandboxProvider;
6
+ runtime?: string;
7
+ timeout?: number;
8
+ memory?: number;
9
+ cpu?: number;
10
+ }
11
+ interface SandboxExecResult {
12
+ ok: boolean;
13
+ stdout: string;
14
+ stderr: string;
15
+ code: number | null;
16
+ }
17
+ interface Sandbox {
18
+ id: string;
19
+ provider: SandboxProvider;
20
+ exec: (command: string, args: string[]) => Promise<SandboxExecResult>;
21
+ writeFile: (path: string, content: string) => Promise<void>;
22
+ readFile: (path: string) => Promise<string>;
23
+ stop: () => Promise<void>;
24
+ }
25
+ interface SandboxDetection {
26
+ type: SandboxType;
27
+ details?: Record<string, string>;
28
+ }
29
+ declare function detectSandbox(): SandboxDetection;
30
+ declare function createSandbox(options: SandboxOptions): Promise<Sandbox>;
31
+ declare function isSandboxAvailable(provider: SandboxProvider): boolean;
32
+ //#endregion
33
+ export { SandboxProvider as a, detectSandbox as c, SandboxOptions as i, isSandboxAvailable as l, SandboxDetection as n, SandboxType as o, SandboxExecResult as r, createSandbox as s, Sandbox as t };
@@ -0,0 +1,21 @@
1
+ //#region src/exec/index.d.ts
2
+ interface ExecOptions {
3
+ cwd?: string;
4
+ timeout?: number;
5
+ maxOutput?: number;
6
+ env?: Record<string, string>;
7
+ stdin?: string;
8
+ }
9
+ interface ExecResult {
10
+ ok: boolean;
11
+ code: number | null;
12
+ stdout: string;
13
+ stderr: string;
14
+ signal: string | null;
15
+ truncated: boolean;
16
+ timedOut: boolean;
17
+ }
18
+ declare function execSafe(command: string, args: string[], options?: ExecOptions): Promise<ExecResult>;
19
+ declare function execSafeSync(command: string, args: string[], options?: Omit<ExecOptions, "stdin">): ExecResult;
20
+ //#endregion
21
+ export { execSafeSync as i, ExecResult as n, execSafe as r, ExecOptions as t };
@@ -15,8 +15,8 @@ interface CloneResult {
15
15
  path: string;
16
16
  error?: string;
17
17
  }
18
- declare function cloneRepo(url: string, dest: string, options?: CloneOptions): Promise<CloneResult>;
19
- declare function cloneToTemp(url: string, options?: CloneOptions): Promise<CloneResult>;
18
+ declare function cloneRepo(url: string, dest: string, options?: CloneOptions): CloneResult;
19
+ declare function cloneToTemp(url: string, options?: CloneOptions): CloneResult;
20
20
  declare function cleanupTempDir(path: string): boolean;
21
21
  declare function isTempDir(path: string): boolean;
22
22
  //#endregion
@@ -31,13 +31,13 @@ interface GitStatus {
31
31
  untracked: string[];
32
32
  hasChanges: boolean;
33
33
  }
34
- declare function getGitStatus(dir: string): Promise<GitStatus | undefined>;
35
- declare function getCurrentBranch(dir: string): Promise<string | undefined>;
36
- declare function checkout(dir: string, ref: string): Promise<boolean>;
37
- declare function pull(dir: string): Promise<boolean>;
38
- declare function fetch(dir: string, remote?: string): Promise<boolean>;
39
- declare function getRemoteUrl(dir: string, remote?: string): Promise<string | undefined>;
40
- declare function getLatestCommitHash(dir: string): Promise<string | undefined>;
41
- declare function hasUncommittedChanges(dir: string): Promise<boolean>;
34
+ declare function getGitStatus(dir: string): GitStatus | undefined;
35
+ declare function getCurrentBranch(dir: string): string | undefined;
36
+ declare function checkout(dir: string, ref: string): boolean;
37
+ declare function pull(dir: string): boolean;
38
+ declare function fetch(dir: string, remote?: string): boolean;
39
+ declare function getRemoteUrl(dir: string, remote?: string): string | undefined;
40
+ declare function getLatestCommitHash(dir: string): string | undefined;
41
+ declare function hasUncommittedChanges(dir: string): boolean;
42
42
  //#endregion
43
43
  export { getGitStatus as a, hasUncommittedChanges as c, CloneResult as d, GitCloneError as f, isTempDir as g, cloneToTemp as h, getCurrentBranch as i, pull as l, cloneRepo as m, checkout as n, getLatestCommitHash as o, cleanupTempDir as p, fetch as r, getRemoteUrl as s, GitStatus as t, CloneOptions as u };
@@ -0,0 +1,36 @@
1
+ import { r as UsageInfo } from "./index-ucMWydcs.mjs";
2
+ import { Hookable, createHooks as createHookable } from "hookable";
3
+
4
+ //#region src/hooks/index.d.ts
5
+ interface AgentHooks {
6
+ "tool:before": (payload: {
7
+ name: string;
8
+ args: unknown;
9
+ }) => void | Promise<void>;
10
+ "tool:after": (payload: {
11
+ name: string;
12
+ args: unknown;
13
+ result: unknown;
14
+ }) => void | Promise<void>;
15
+ "tool:error": (payload: {
16
+ name: string;
17
+ error: Error;
18
+ }) => void | Promise<void>;
19
+ "llm:before": (payload: {
20
+ messages: unknown[];
21
+ }) => void | Promise<void>;
22
+ "llm:after": (payload: {
23
+ response: unknown;
24
+ usage?: UsageInfo;
25
+ }) => void | Promise<void>;
26
+ "iteration:start": (payload: {
27
+ iteration: number;
28
+ }) => void | Promise<void>;
29
+ "iteration:end": (payload: {
30
+ iteration: number;
31
+ }) => void | Promise<void>;
32
+ }
33
+ type AgentHooksInstance = Hookable<AgentHooks>;
34
+ declare function createAgentHooks(): AgentHooksInstance;
35
+ //#endregion
36
+ export { createHookable as a, createAgentHooks as i, AgentHooksInstance as n, Hookable as r, AgentHooks as t };
@@ -0,0 +1,20 @@
1
+ //#region src/registry/index.d.ts
2
+ interface Provider<T, Input = unknown> {
3
+ id: string;
4
+ match: (input: Input) => boolean;
5
+ resolve: (input: Input) => Promise<T> | T;
6
+ priority?: number;
7
+ }
8
+ interface Registry<T, Input = unknown> {
9
+ register: (provider: Provider<T, Input>) => void;
10
+ unregister: (id: string) => boolean;
11
+ resolve: (input: Input) => Promise<T | undefined>;
12
+ list: () => Provider<T, Input>[];
13
+ }
14
+ interface RegistryOptions {
15
+ defaultPriority?: number;
16
+ }
17
+ declare function createRegistry<T, Input = unknown>(options?: RegistryOptions): Registry<T, Input>;
18
+ declare function defineProvider<T, Input = unknown>(provider: Provider<T, Input>): Provider<T, Input>;
19
+ //#endregion
20
+ export { defineProvider as a, createRegistry as i, Registry as n, RegistryOptions as r, Provider as t };
@@ -3,7 +3,7 @@ declare function computeContentHash(content: string): string;
3
3
  declare function computeFileHash(filePath: string): string | undefined;
4
4
  declare function computeDirectoryHash(dirPath: string, exclude?: string[]): string | undefined;
5
5
  //#endregion
6
- //#region src/lock/lock.d.ts
6
+ //#region src/lock/index.d.ts
7
7
  interface SkillLockEntry {
8
8
  name: string;
9
9
  source: string;
@@ -0,0 +1,55 @@
1
+ import { r as UsageInfo } from "./index-ucMWydcs.mjs";
2
+
3
+ //#region src/stream/index.d.ts
4
+ type StreamPart = {
5
+ type: "text";
6
+ data: string;
7
+ } | {
8
+ type: "tool_call";
9
+ data: {
10
+ name: string;
11
+ args: unknown;
12
+ };
13
+ } | {
14
+ type: "tool_result";
15
+ data: {
16
+ name: string;
17
+ result: unknown;
18
+ };
19
+ } | {
20
+ type: "usage";
21
+ data: UsageInfo;
22
+ } | {
23
+ type: "error";
24
+ data: Error;
25
+ } | {
26
+ type: "done";
27
+ data: null;
28
+ };
29
+ interface StreamResult<T> {
30
+ readonly value: Promise<T>;
31
+ readonly stream: AsyncIterable<StreamPart>;
32
+ toResponse: () => Response;
33
+ toSSEResponse: () => Response;
34
+ consumeStream: () => Promise<void>;
35
+ }
36
+ interface StreamResultOptions<T> {
37
+ stream: AsyncIterable<StreamPart>;
38
+ getValue: () => Promise<T>;
39
+ }
40
+ declare function createStreamResult<T>(options: StreamResultOptions<T>): StreamResult<T>;
41
+ declare function formatSSE(event: string, data: unknown): string;
42
+ declare function parseSSE(line: string): {
43
+ event?: string;
44
+ data?: string;
45
+ } | null;
46
+ declare class SSEParser {
47
+ private currentEvent;
48
+ private dataBuffer;
49
+ parse(chunk: string): Array<{
50
+ event?: string;
51
+ data: unknown;
52
+ }>;
53
+ }
54
+ //#endregion
55
+ export { createStreamResult as a, StreamResultOptions as i, StreamPart as n, formatSSE as o, StreamResult as r, parseSSE as s, SSEParser as t };
@@ -0,0 +1,80 @@
1
+ //#region src/fs/index.d.ts
2
+ interface FileStat {
3
+ size: number;
4
+ isFile: boolean;
5
+ isDirectory: boolean;
6
+ mtime?: Date;
7
+ }
8
+ interface VirtualFS {
9
+ readFile: (path: string) => Promise<string>;
10
+ writeFile: (path: string, content: string) => Promise<void>;
11
+ exists: (path: string) => Promise<boolean>;
12
+ readdir: (path: string) => Promise<string[]>;
13
+ mkdir: (path: string, options?: {
14
+ recursive?: boolean;
15
+ }) => Promise<void>;
16
+ rm: (path: string, options?: {
17
+ recursive?: boolean;
18
+ }) => Promise<void>;
19
+ stat: (path: string) => Promise<FileStat>;
20
+ }
21
+ declare class InMemoryFS implements VirtualFS {
22
+ private files;
23
+ private dirs;
24
+ private normalizePath;
25
+ readFile(path: string): Promise<string>;
26
+ writeFile(path: string, content: string): Promise<void>;
27
+ exists(path: string): Promise<boolean>;
28
+ readdir(path: string): Promise<string[]>;
29
+ mkdir(path: string, options?: {
30
+ recursive?: boolean;
31
+ }): Promise<void>;
32
+ rm(path: string, options?: {
33
+ recursive?: boolean;
34
+ }): Promise<void>;
35
+ stat(path: string): Promise<FileStat>;
36
+ }
37
+ declare class OverlayFS implements VirtualFS {
38
+ private base;
39
+ private overlay;
40
+ private deleted;
41
+ constructor(base: VirtualFS);
42
+ private normalizePath;
43
+ readFile(path: string): Promise<string>;
44
+ writeFile(path: string, content: string): Promise<void>;
45
+ exists(path: string): Promise<boolean>;
46
+ readdir(path: string): Promise<string[]>;
47
+ mkdir(path: string, options?: {
48
+ recursive?: boolean;
49
+ }): Promise<void>;
50
+ rm(path: string, options?: {
51
+ recursive?: boolean;
52
+ }): Promise<void>;
53
+ stat(path: string): Promise<FileStat>;
54
+ }
55
+ declare class RealFS implements VirtualFS {
56
+ private basePath;
57
+ private normalizedBase;
58
+ constructor(basePath?: string);
59
+ private resolve;
60
+ readFile(path: string): Promise<string>;
61
+ writeFile(path: string, content: string): Promise<void>;
62
+ exists(path: string): Promise<boolean>;
63
+ readdir(path: string): Promise<string[]>;
64
+ mkdir(path: string, options?: {
65
+ recursive?: boolean;
66
+ }): Promise<void>;
67
+ rm(path: string, options?: {
68
+ recursive?: boolean;
69
+ }): Promise<void>;
70
+ stat(path: string): Promise<FileStat>;
71
+ }
72
+ interface Storage {
73
+ getItem: (key: string) => Promise<string | null> | string | null;
74
+ setItem: (key: string, value: string) => Promise<void> | void;
75
+ removeItem: (key: string) => Promise<void> | void;
76
+ getKeys: (base?: string) => Promise<string[]> | string[];
77
+ }
78
+ declare function createFSFromStorage(storage: Storage): VirtualFS;
79
+ //#endregion
80
+ export { Storage as a, RealFS as i, InMemoryFS as n, VirtualFS as o, OverlayFS as r, createFSFromStorage as s, FileStat as t };
@@ -0,0 +1,43 @@
1
+ //#region src/tool/index.d.ts
2
+ interface ToolParameter {
3
+ type: "string" | "number" | "boolean" | "array" | "object";
4
+ description?: string;
5
+ required?: boolean;
6
+ enum?: (string | number | boolean)[];
7
+ items?: ToolParameter;
8
+ properties?: Record<string, ToolParameter>;
9
+ default?: unknown;
10
+ }
11
+ interface ToolDefinition {
12
+ name: string;
13
+ description: string;
14
+ parameters?: Record<string, ToolParameter>;
15
+ }
16
+ interface JSONSchema {
17
+ type: "object";
18
+ properties: Record<string, JSONSchemaProperty>;
19
+ required?: string[];
20
+ additionalProperties?: boolean;
21
+ }
22
+ interface JSONSchemaProperty {
23
+ type: string | string[];
24
+ description?: string;
25
+ enum?: (string | number | boolean)[];
26
+ items?: JSONSchemaProperty;
27
+ properties?: Record<string, JSONSchemaProperty>;
28
+ required?: string[];
29
+ default?: unknown;
30
+ }
31
+ declare function defineTool<T extends ToolDefinition>(tool: T): T;
32
+ declare function toolToSchema(tool: ToolDefinition): {
33
+ name: string;
34
+ description: string;
35
+ input_schema: JSONSchema;
36
+ };
37
+ declare function toolsToSchema(tools: ToolDefinition[]): {
38
+ name: string;
39
+ description: string;
40
+ input_schema: JSONSchema;
41
+ }[];
42
+ //#endregion
43
+ export { defineTool as a, ToolParameter as i, JSONSchemaProperty as n, toolToSchema as o, ToolDefinition as r, toolsToSchema as s, JSONSchema as t };
@@ -0,0 +1,21 @@
1
+ import { r as UsageInfo, t as CostRates } from "./index-ucMWydcs.mjs";
2
+
3
+ //#region src/stop/index.d.ts
4
+ type StopCondition<Ctx> = (ctx: Ctx) => boolean | Promise<boolean>;
5
+ declare function iterationCountIs(max: number): StopCondition<{
6
+ iteration: number;
7
+ }>;
8
+ declare function tokenCountIs(max: number): StopCondition<{
9
+ usage?: UsageInfo;
10
+ }>;
11
+ declare function costIs(maxDollars: number, rates: CostRates): StopCondition<{
12
+ usage?: UsageInfo;
13
+ }>;
14
+ declare function timeout(ms: number): StopCondition<{
15
+ startTime: number;
16
+ }>;
17
+ declare function and<Ctx>(...conditions: StopCondition<Ctx>[]): StopCondition<Ctx>;
18
+ declare function or<Ctx>(...conditions: StopCondition<Ctx>[]): StopCondition<Ctx>;
19
+ declare function not<Ctx>(condition: StopCondition<Ctx>): StopCondition<Ctx>;
20
+ //#endregion
21
+ export { not as a, tokenCountIs as c, iterationCountIs as i, and as n, or as o, costIs as r, timeout as s, StopCondition as t };
@@ -0,0 +1,19 @@
1
+ //#region src/usage/index.d.ts
2
+ interface UsageInfo {
3
+ inputTokens: number;
4
+ outputTokens: number;
5
+ cacheReadTokens?: number;
6
+ cacheWriteTokens?: number;
7
+ }
8
+ interface CostRates {
9
+ inputCostPerMillionTokens: number;
10
+ outputCostPerMillionTokens: number;
11
+ cacheReadCostPerMillionTokens?: number;
12
+ cacheWriteCostPerMillionTokens?: number;
13
+ }
14
+ declare function calculateCost(usage: UsageInfo, rates: CostRates): number;
15
+ declare function aggregateUsage(...usages: UsageInfo[]): UsageInfo;
16
+ declare const MODEL_PRICING: Record<string, CostRates>;
17
+ declare function getRatesForModel(modelId: string): CostRates | undefined;
18
+ //#endregion
19
+ export { calculateCost as a, aggregateUsage as i, MODEL_PRICING as n, getRatesForModel as o, UsageInfo as r, CostRates as t };
@@ -0,0 +1,18 @@
1
+ import { a as TruncateOptions, c as splitByTokens, i as TokenEstimateOptions, l as truncateToFit, n as BuildContextResult, o as buildContext, r as ContextItem, s as estimateTokens, t as BuildContextOptions } from "./index-Bd1gSwMB.mjs";
2
+ import { _ as getAgentConfig, a as getAgentSkillsDir, c as isCI, d as detectAgentByEnv, f as detectCurrentAgent, g as agents, h as AgentConfig, i as getAgentRulesPath, l as isTTY, m as isRunningInAgent, n as agentConfigExists, o as getXDGPaths, p as detectInstalledAgents, r as getAgentConfigDir, s as hasTTY, t as XDGPaths, u as DetectedAgent, v as getAgentIds, y as getAllAgents } from "./index-CzgY9GU2.mjs";
3
+ import { i as execSafeSync, n as ExecResult, r as execSafe, t as ExecOptions } from "./index-C0ulBa5T.mjs";
4
+ import { a as Storage, i as RealFS, n as InMemoryFS, o as VirtualFS, r as OverlayFS, s as createFSFromStorage, t as FileStat } from "./index-DFqD_DAh.mjs";
5
+ import { a as getGitStatus, c as hasUncommittedChanges, d as CloneResult, f as GitCloneError, g as isTempDir, h as cloneToTemp, i as getCurrentBranch, l as pull, m as cloneRepo, n as checkout, o as getLatestCommitHash, p as cleanupTempDir, r as fetch, s as getRemoteUrl, t as GitStatus, u as CloneOptions } from "./index-C55JaUgw.mjs";
6
+ import { a as calculateCost, i as aggregateUsage, n as MODEL_PRICING, o as getRatesForModel, r as UsageInfo, t as CostRates } from "./index-ucMWydcs.mjs";
7
+ import { a as createHookable, i as createAgentHooks, n as AgentHooksInstance, r as Hookable, t as AgentHooks } from "./index-Csv1G0zj.mjs";
8
+ import { a as removeSymlink, c as validateSymlinkTarget, d as copyDirectory, f as copyFile, i as isSymlink, l as CopyOptions, n as SymlinkResult, o as isPathSafe, p as getDirectorySize, r as createSymlink, s as sanitizeName, t as SymlinkOptions, u as CopyResult } from "./index-DPt7J0hF.mjs";
9
+ import { a as getSkillFromLock, c as listSkillsInLock, d as writeSkillLock, f as computeContentHash, i as createEmptyLock, l as readSkillLock, m as computeFileHash, n as SkillLockEntry, o as hasSkillInLock, p as computeDirectoryHash, r as addSkillToLock, s as isSkillOutdated, t as SkillLock, u as removeSkillFromLock } from "./index-Cy8LThTV.mjs";
10
+ import { a as defineProvider, i as createRegistry, n as Registry, r as RegistryOptions, t as Provider } from "./index-CvCCCs-_.mjs";
11
+ import { a as SandboxProvider, c as detectSandbox, i as SandboxOptions, l as isSandboxAvailable, n as SandboxDetection, o as SandboxType, r as SandboxExecResult, s as createSandbox, t as Sandbox } from "./index-Bd4x_1H9.mjs";
12
+ import { C as validateSkillMd, S as parseSkillMd, _ as filterSkills, a as UninstallSkillResult, b as SkillFrontmatter, c as toPromptXml, d as InstallSkillResult, f as InstallSkillResultEntry, g as discoverSkills, h as DiscoveredSkill, i as UninstallSkillOptions, l as InstallSkillErrorEntry, m as DiscoverOptions, n as validateSkill, o as UninstallSkillResultEntry, p as installSkill, r as UninstallSkillErrorEntry, s as uninstallSkill, t as ValidationResult, u as InstallSkillOptions, v as findSkillByName, x as extractSkillName, y as ParsedSkill } from "./index-BZaywR9E.mjs";
13
+ import { a as parseOwnerRepo, c as SourceProvider, d as getProviderFromUrl, f as parseGitHubUrl, i as isUrl, l as buildGitHubCloneUrl, n as getOwnerRepo, o as parseSource, p as parseGitLabUrl, r as isLocalPath, s as ProviderInfo, t as ParsedSource, u as buildGitLabCloneUrl } from "./index-wTumcHrH.mjs";
14
+ import { a as not, c as tokenCountIs, i as iterationCountIs, n as and, o as or, r as costIs, s as timeout, t as StopCondition } from "./index-DpFup4kC.mjs";
15
+ import { a as createStreamResult, i as StreamResultOptions, n as StreamPart, o as formatSSE, r as StreamResult, s as parseSSE, t as SSEParser } from "./index-D5A0wwzb.mjs";
16
+ import { a as defineTool, i as ToolParameter, n as JSONSchemaProperty, o as toolToSchema, r as ToolDefinition, s as toolsToSchema, t as JSONSchema } from "./index-DShEKmmL.mjs";
17
+ import { a as truncate, c as bold, d as gray, f as green, h as yellow, i as pluralize, l as cyan, m as stripAnsi, n as shortenPath, o as ANSI, p as red, r as formatList, s as blue, t as expandPath, u as dim } from "./index-CbYchDwg.mjs";
18
+ export { ANSI, AgentConfig, AgentHooks, AgentHooksInstance, BuildContextOptions, BuildContextResult, CloneOptions, CloneResult, ContextItem, CopyOptions, CopyResult, CostRates, DetectedAgent, DiscoverOptions, DiscoveredSkill, ExecOptions, ExecResult, FileStat, GitCloneError, GitStatus, Hookable, InMemoryFS, InstallSkillErrorEntry, InstallSkillOptions, InstallSkillResult, InstallSkillResultEntry, JSONSchema, JSONSchemaProperty, MODEL_PRICING, OverlayFS, ParsedSkill, ParsedSource, Provider, ProviderInfo, RealFS, Registry, RegistryOptions, SSEParser, Sandbox, SandboxDetection, SandboxExecResult, SandboxOptions, SandboxProvider, SandboxType, SkillFrontmatter, SkillLock, SkillLockEntry, SourceProvider, StopCondition, Storage, StreamPart, StreamResult, StreamResultOptions, SymlinkOptions, SymlinkResult, TokenEstimateOptions, ToolDefinition, ToolParameter, TruncateOptions, UninstallSkillErrorEntry, UninstallSkillOptions, UninstallSkillResult, UninstallSkillResultEntry, UsageInfo, ValidationResult, VirtualFS, XDGPaths, addSkillToLock, agentConfigExists, agents, aggregateUsage, and, blue, bold, buildContext, buildGitHubCloneUrl, buildGitLabCloneUrl, calculateCost, checkout, cleanupTempDir, cloneRepo, cloneToTemp, computeContentHash, computeDirectoryHash, computeFileHash, copyDirectory, copyFile, costIs, createAgentHooks, createEmptyLock, createFSFromStorage, createHookable as createHooks, createRegistry, createSandbox, createStreamResult, createSymlink, cyan, defineProvider, defineTool, detectAgentByEnv, detectCurrentAgent, detectInstalledAgents, detectSandbox, dim, discoverSkills, estimateTokens, execSafe, execSafeSync, expandPath, extractSkillName, fetch, filterSkills, findSkillByName, formatList, formatSSE, getAgentConfig, getAgentConfigDir, getAgentIds, getAgentRulesPath, getAgentSkillsDir, getAllAgents, getCurrentBranch, getDirectorySize, getGitStatus, getLatestCommitHash, getOwnerRepo, getProviderFromUrl, getRatesForModel, getRemoteUrl, getSkillFromLock, getXDGPaths, gray, green, hasSkillInLock, hasTTY, hasUncommittedChanges, installSkill, isCI, isLocalPath, isPathSafe, isRunningInAgent, isSandboxAvailable, isSkillOutdated, isSymlink, isTTY, isTempDir, isUrl, iterationCountIs, listSkillsInLock, not, or, parseGitHubUrl, parseGitLabUrl, parseOwnerRepo, parseSSE, parseSkillMd, parseSource, pluralize, pull, readSkillLock, red, removeSkillFromLock, removeSymlink, sanitizeName, shortenPath, splitByTokens, stripAnsi, timeout, toPromptXml, tokenCountIs, toolToSchema, toolsToSchema, truncate, truncateToFit, uninstallSkill, validateSkill, validateSkillMd, validateSymlinkTarget, writeSkillLock, yellow };