@pulsemcp/air-core 0.0.1
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 +60 -0
- package/dist/config.d.ts +27 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +112 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas.d.ts +12 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +84 -0
- package/dist/schemas.js.map +1 -0
- package/dist/types.d.ts +175 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/validator.d.ts +11 -0
- package/dist/validator.d.ts.map +1 -0
- package/dist/validator.js +19 -0
- package/dist/validator.js.map +1 -0
- package/package.json +46 -0
- package/schemas/air.schema.json +57 -0
- package/schemas/hooks.schema.json +88 -0
- package/schemas/mcp.schema.json +135 -0
- package/schemas/plugins.schema.json +76 -0
- package/schemas/references.schema.json +52 -0
- package/schemas/roots.schema.json +97 -0
- package/schemas/schemas/air.schema.json +57 -0
- package/schemas/schemas/hooks.schema.json +88 -0
- package/schemas/schemas/mcp.schema.json +135 -0
- package/schemas/schemas/plugins.schema.json +76 -0
- package/schemas/schemas/references.schema.json +52 -0
- package/schemas/schemas/roots.schema.json +97 -0
- package/schemas/schemas/skills.schema.json +59 -0
- package/schemas/skills.schema.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @pulsemcp/air-core
|
|
2
|
+
|
|
3
|
+
Core package for the [AIR](https://github.com/pulsemcp/air) framework. Provides config resolution, validation, JSON schemas, and extension interfaces.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @pulsemcp/air-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import {
|
|
15
|
+
resolveArtifacts,
|
|
16
|
+
validateJson,
|
|
17
|
+
mergeArtifacts,
|
|
18
|
+
emptyArtifacts,
|
|
19
|
+
} from "@pulsemcp/air-core";
|
|
20
|
+
|
|
21
|
+
// Resolve all artifacts from an air.json file
|
|
22
|
+
const artifacts = await resolveArtifacts("~/.air/air.json");
|
|
23
|
+
|
|
24
|
+
// Validate a JSON file against its AIR schema
|
|
25
|
+
const result = validateJson(data, "skills");
|
|
26
|
+
|
|
27
|
+
// Merge two artifact sets (later wins for matching IDs)
|
|
28
|
+
const merged = mergeArtifacts(base, override);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### With a Catalog Provider (remote URIs)
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { resolveArtifacts } from "@pulsemcp/air-core";
|
|
35
|
+
import { GitHubCatalogProvider } from "@pulsemcp/air-provider-github";
|
|
36
|
+
|
|
37
|
+
const artifacts = await resolveArtifacts("./air.json", {
|
|
38
|
+
providers: [new GitHubCatalogProvider()],
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## What's in this package
|
|
43
|
+
|
|
44
|
+
- **Config resolution** — `resolveArtifacts()`, `loadAirConfig()`, `mergeArtifacts()`, `emptyArtifacts()`
|
|
45
|
+
- **Validation** — `validateJson()` using AJV against AIR JSON Schemas
|
|
46
|
+
- **Schema utilities** — `loadSchema()`, `detectSchemaType()`, `detectSchemaFromValue()`
|
|
47
|
+
- **All artifact types** — `SkillEntry`, `McpServerEntry`, `RootEntry`, `ReferenceEntry`, `PluginEntry`, `HookEntry`
|
|
48
|
+
- **Extension interfaces** — `AgentAdapter`, `CatalogProvider`, `SecretResolver`, `AirExtension`
|
|
49
|
+
- **Session types** — `AgentSessionConfig`, `StartCommand`, `PrepareSessionOptions`, `PreparedSession`
|
|
50
|
+
|
|
51
|
+
## Extension Interfaces
|
|
52
|
+
|
|
53
|
+
Core defines four extension points that other packages implement:
|
|
54
|
+
|
|
55
|
+
| Interface | Purpose | Example |
|
|
56
|
+
|-----------|---------|---------|
|
|
57
|
+
| `AgentAdapter` | Translate AIR config for a specific agent | `@pulsemcp/air-adapter-claude` |
|
|
58
|
+
| `CatalogProvider` | Resolve remote URIs in air.json | `@pulsemcp/air-provider-github` |
|
|
59
|
+
| `SecretResolver` | Resolve `${VAR}` interpolation | Custom vault integrations |
|
|
60
|
+
| `AirExtension` | Extension metadata for CLI discovery | All extension packages |
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AirConfig, ResolvedArtifacts, CatalogProvider } from "./types.js";
|
|
2
|
+
export declare function loadAirConfig(airJsonPath: string): AirConfig;
|
|
3
|
+
/**
|
|
4
|
+
* Default path to the user-level air.json.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getDefaultAirJsonPath(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Get the air.json path, respecting AIR_CONFIG env var override.
|
|
9
|
+
* Returns null if the file doesn't exist.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getAirJsonPath(): string | null;
|
|
12
|
+
export interface ResolveOptions {
|
|
13
|
+
/** Catalog providers for resolving remote URIs (github://, s3://, etc.) */
|
|
14
|
+
providers?: CatalogProvider[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolve all artifacts from an air.json file.
|
|
18
|
+
* Each artifact property is an array of paths; files merge in order.
|
|
19
|
+
* Remote URIs are delegated to the matching CatalogProvider.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveArtifacts(airJsonPath: string, options?: ResolveOptions): Promise<ResolvedArtifacts>;
|
|
22
|
+
/**
|
|
23
|
+
* Merge two resolved artifact sets. Override wins for matching IDs.
|
|
24
|
+
*/
|
|
25
|
+
export declare function mergeArtifacts(base: ResolvedArtifacts, override: ResolvedArtifacts): ResolvedArtifacts;
|
|
26
|
+
export declare function emptyArtifacts(): ResolvedArtifacts;
|
|
27
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EAOjB,eAAe,EAChB,MAAM,YAAY,CAAC;AAiEpB,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAG5D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAM9C;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAG9C;AAED,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,iBAAiB,CAAC,CAqC5B;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,iBAAiB,EACvB,QAAQ,EAAE,iBAAiB,GAC1B,iBAAiB,CASnB;AAED,wBAAgB,cAAc,IAAI,iBAAiB,CASlD"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { readFileSync, existsSync } from "fs";
|
|
2
|
+
import { resolve, dirname } from "path";
|
|
3
|
+
function loadJsonFile(filePath) {
|
|
4
|
+
if (!existsSync(filePath)) {
|
|
5
|
+
return {};
|
|
6
|
+
}
|
|
7
|
+
const content = readFileSync(filePath, "utf-8");
|
|
8
|
+
return JSON.parse(content);
|
|
9
|
+
}
|
|
10
|
+
function stripSchema(data) {
|
|
11
|
+
const { $schema, ...rest } = data;
|
|
12
|
+
return rest;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Check if a path string contains a URI scheme (e.g., "github://", "s3://").
|
|
16
|
+
*/
|
|
17
|
+
function getScheme(path) {
|
|
18
|
+
const match = path.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*):\/\//);
|
|
19
|
+
if (!match)
|
|
20
|
+
return null;
|
|
21
|
+
const scheme = match[1].toLowerCase();
|
|
22
|
+
// "file" scheme is handled as local filesystem, not a provider
|
|
23
|
+
if (scheme === "file")
|
|
24
|
+
return null;
|
|
25
|
+
return scheme;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Load and merge entries from an array of index file paths.
|
|
29
|
+
* Local paths are resolved relative to baseDir.
|
|
30
|
+
* URI paths (with schemes) are delegated to the matching CatalogProvider.
|
|
31
|
+
*/
|
|
32
|
+
async function loadAndMerge(paths, baseDir, providers) {
|
|
33
|
+
let merged = {};
|
|
34
|
+
for (const p of paths) {
|
|
35
|
+
const scheme = getScheme(p);
|
|
36
|
+
let data;
|
|
37
|
+
if (scheme) {
|
|
38
|
+
const provider = providers.find((prov) => prov.scheme === scheme);
|
|
39
|
+
if (!provider) {
|
|
40
|
+
throw new Error(`No catalog provider registered for scheme "${scheme}://" (path: ${p}). ` +
|
|
41
|
+
`Install an extension that handles this scheme.`);
|
|
42
|
+
}
|
|
43
|
+
data = await provider.resolve(p, baseDir);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
data = loadJsonFile(resolve(baseDir, p));
|
|
47
|
+
}
|
|
48
|
+
const entries = stripSchema(data);
|
|
49
|
+
merged = { ...merged, ...entries };
|
|
50
|
+
}
|
|
51
|
+
return merged;
|
|
52
|
+
}
|
|
53
|
+
export function loadAirConfig(airJsonPath) {
|
|
54
|
+
const content = readFileSync(airJsonPath, "utf-8");
|
|
55
|
+
return JSON.parse(content);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Default path to the user-level air.json.
|
|
59
|
+
*/
|
|
60
|
+
export function getDefaultAirJsonPath() {
|
|
61
|
+
return resolve(process.env.HOME || process.env.USERPROFILE || "~", ".air", "air.json");
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get the air.json path, respecting AIR_CONFIG env var override.
|
|
65
|
+
* Returns null if the file doesn't exist.
|
|
66
|
+
*/
|
|
67
|
+
export function getAirJsonPath() {
|
|
68
|
+
const path = process.env.AIR_CONFIG || getDefaultAirJsonPath();
|
|
69
|
+
return existsSync(path) ? path : null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Resolve all artifacts from an air.json file.
|
|
73
|
+
* Each artifact property is an array of paths; files merge in order.
|
|
74
|
+
* Remote URIs are delegated to the matching CatalogProvider.
|
|
75
|
+
*/
|
|
76
|
+
export async function resolveArtifacts(airJsonPath, options) {
|
|
77
|
+
const airConfig = loadAirConfig(airJsonPath);
|
|
78
|
+
const baseDir = dirname(resolve(airJsonPath));
|
|
79
|
+
const providers = options?.providers || [];
|
|
80
|
+
return {
|
|
81
|
+
skills: await loadAndMerge(airConfig.skills || [], baseDir, providers),
|
|
82
|
+
references: await loadAndMerge(airConfig.references || [], baseDir, providers),
|
|
83
|
+
mcp: await loadAndMerge(airConfig.mcp || [], baseDir, providers),
|
|
84
|
+
plugins: await loadAndMerge(airConfig.plugins || [], baseDir, providers),
|
|
85
|
+
roots: await loadAndMerge(airConfig.roots || [], baseDir, providers),
|
|
86
|
+
hooks: await loadAndMerge(airConfig.hooks || [], baseDir, providers),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Merge two resolved artifact sets. Override wins for matching IDs.
|
|
91
|
+
*/
|
|
92
|
+
export function mergeArtifacts(base, override) {
|
|
93
|
+
return {
|
|
94
|
+
skills: { ...base.skills, ...override.skills },
|
|
95
|
+
references: { ...base.references, ...override.references },
|
|
96
|
+
mcp: { ...base.mcp, ...override.mcp },
|
|
97
|
+
plugins: { ...base.plugins, ...override.plugins },
|
|
98
|
+
roots: { ...base.roots, ...override.roots },
|
|
99
|
+
hooks: { ...base.hooks, ...override.hooks },
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export function emptyArtifacts() {
|
|
103
|
+
return {
|
|
104
|
+
skills: {},
|
|
105
|
+
references: {},
|
|
106
|
+
mcp: {},
|
|
107
|
+
plugins: {},
|
|
108
|
+
roots: {},
|
|
109
|
+
hooks: {},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAaxC,SAAS,YAAY,CAAC,QAAgB;IACpC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,WAAW,CAClB,IAA6B;IAE7B,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC7D,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACtC,+DAA+D;IAC/D,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IACnC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,YAAY,CACzB,KAAe,EACf,OAAe,EACf,SAA4B;IAE5B,IAAI,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G,QAAQ,CAAC,UAAU,EAAE;QAC1D,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,GAAG,EAAE;QACrC,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE;QACjD,KAAK,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE;QAC3C,KAAK,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE;KAC5C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,EAAE;QACd,GAAG,EAAE,EAAE;QACP,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,EAAE;KACV,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { AirConfig, ResolvedArtifacts, SkillEntry, ReferenceEntry, McpOAuthConfig, McpServerEntry, PluginEntry, RootEntry, HookEntry, } from "./types.js";
|
|
2
|
+
export type { AgentAdapter, CatalogProvider, SecretResolver, AirExtension, AgentSessionConfig, StartCommand, PrepareSessionOptions, PreparedSession, } from "./types.js";
|
|
3
|
+
export { loadAirConfig, getDefaultAirJsonPath, getAirJsonPath, resolveArtifacts, mergeArtifacts, emptyArtifacts, } from "./config.js";
|
|
4
|
+
export type { ResolveOptions } from "./config.js";
|
|
5
|
+
export { validateJson } from "./validator.js";
|
|
6
|
+
export type { ValidationResult, ValidationError } from "./validator.js";
|
|
7
|
+
export { getSchemasDir, getSchemaPath, loadSchema, detectSchemaType, detectSchemaFromValue, getAllSchemaTypes, isValidSchemaType, } from "./schemas.js";
|
|
8
|
+
export type { SchemaType } from "./schemas.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,WAAW,EACX,SAAS,EACT,SAAS,GACV,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,YAAY,EACZ,eAAe,EACf,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,eAAe,GAChB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Config resolution
|
|
2
|
+
export { loadAirConfig, getDefaultAirJsonPath, getAirJsonPath, resolveArtifacts, mergeArtifacts, emptyArtifacts, } from "./config.js";
|
|
3
|
+
// Validation
|
|
4
|
+
export { validateJson } from "./validator.js";
|
|
5
|
+
// Schemas
|
|
6
|
+
export { getSchemasDir, getSchemaPath, loadSchema, detectSchemaType, detectSchemaFromValue, getAllSchemaTypes, isValidSchemaType, } from "./schemas.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyBA,oBAAoB;AACpB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,aAAa;AACb,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,UAAU;AACV,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type SchemaType = "air" | "skills" | "references" | "mcp" | "plugins" | "roots" | "hooks";
|
|
2
|
+
export declare function getSchemasDir(): string;
|
|
3
|
+
export declare function getSchemaPath(type: SchemaType): string;
|
|
4
|
+
export declare function loadSchema(type: SchemaType): object;
|
|
5
|
+
export declare function detectSchemaType(filename: string): SchemaType | null;
|
|
6
|
+
/**
|
|
7
|
+
* Detect schema type from a $schema value in JSON content.
|
|
8
|
+
*/
|
|
9
|
+
export declare function detectSchemaFromValue(schemaValue: string): SchemaType | null;
|
|
10
|
+
export declare function getAllSchemaTypes(): SchemaType[];
|
|
11
|
+
export declare function isValidSchemaType(type: string): type is SchemaType;
|
|
12
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAgCA,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,QAAQ,GACR,YAAY,GACZ,KAAK,GACL,SAAS,GACT,OAAO,GACP,OAAO,CAAC;AAuBZ,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAEtD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAInD;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAQpE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAQ5E;AAED,wBAAgB,iBAAiB,IAAI,UAAU,EAAE,CAEhD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,UAAU,CAElE"}
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { readFileSync, existsSync } from "fs";
|
|
2
|
+
import { dirname, resolve } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
/**
|
|
6
|
+
* Resolve the schemas directory.
|
|
7
|
+
* In development: ../schemas (relative to src/)
|
|
8
|
+
* In published package: ../schemas (copied by prepare script)
|
|
9
|
+
* Fallback: ../../schemas (monorepo root)
|
|
10
|
+
*/
|
|
11
|
+
function findSchemasDir() {
|
|
12
|
+
// Check sibling of dist/ or src/ (published package or local dev)
|
|
13
|
+
const localSchemas = resolve(__dirname, "../schemas");
|
|
14
|
+
if (existsSync(localSchemas)) {
|
|
15
|
+
return localSchemas;
|
|
16
|
+
}
|
|
17
|
+
// Fallback: monorepo root schemas/
|
|
18
|
+
const monorepoSchemas = resolve(__dirname, "../../../schemas");
|
|
19
|
+
if (existsSync(monorepoSchemas)) {
|
|
20
|
+
return monorepoSchemas;
|
|
21
|
+
}
|
|
22
|
+
throw new Error("Could not find AIR schemas directory. Checked:\n" +
|
|
23
|
+
` ${localSchemas}\n` +
|
|
24
|
+
` ${monorepoSchemas}`);
|
|
25
|
+
}
|
|
26
|
+
const schemasDir = findSchemasDir();
|
|
27
|
+
const SCHEMA_FILES = {
|
|
28
|
+
air: "air.schema.json",
|
|
29
|
+
skills: "skills.schema.json",
|
|
30
|
+
references: "references.schema.json",
|
|
31
|
+
mcp: "mcp.schema.json",
|
|
32
|
+
plugins: "plugins.schema.json",
|
|
33
|
+
roots: "roots.schema.json",
|
|
34
|
+
hooks: "hooks.schema.json",
|
|
35
|
+
};
|
|
36
|
+
// Substrings to match against filenames (checked in order, longest first to avoid false matches)
|
|
37
|
+
const SCHEMA_SUBSTRINGS = [
|
|
38
|
+
["references", "references"],
|
|
39
|
+
["plugins", "plugins"],
|
|
40
|
+
["skills", "skills"],
|
|
41
|
+
["roots", "roots"],
|
|
42
|
+
["hooks", "hooks"],
|
|
43
|
+
["mcp", "mcp"],
|
|
44
|
+
["air", "air"],
|
|
45
|
+
];
|
|
46
|
+
export function getSchemasDir() {
|
|
47
|
+
return schemasDir;
|
|
48
|
+
}
|
|
49
|
+
export function getSchemaPath(type) {
|
|
50
|
+
return resolve(schemasDir, SCHEMA_FILES[type]);
|
|
51
|
+
}
|
|
52
|
+
export function loadSchema(type) {
|
|
53
|
+
const schemaPath = getSchemaPath(type);
|
|
54
|
+
const content = readFileSync(schemaPath, "utf-8");
|
|
55
|
+
return JSON.parse(content);
|
|
56
|
+
}
|
|
57
|
+
export function detectSchemaType(filename) {
|
|
58
|
+
const basename = (filename.split("/").pop() || filename).toLowerCase();
|
|
59
|
+
for (const [substring, type] of SCHEMA_SUBSTRINGS) {
|
|
60
|
+
if (basename.includes(substring)) {
|
|
61
|
+
return type;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Detect schema type from a $schema value in JSON content.
|
|
68
|
+
*/
|
|
69
|
+
export function detectSchemaFromValue(schemaValue) {
|
|
70
|
+
const lower = schemaValue.toLowerCase();
|
|
71
|
+
for (const type of getAllSchemaTypes()) {
|
|
72
|
+
if (lower.includes(SCHEMA_FILES[type])) {
|
|
73
|
+
return type;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
export function getAllSchemaTypes() {
|
|
79
|
+
return Object.keys(SCHEMA_FILES);
|
|
80
|
+
}
|
|
81
|
+
export function isValidSchemaType(type) {
|
|
82
|
+
return type in SCHEMA_FILES;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D;;;;;GAKG;AACH,SAAS,cAAc;IACrB,kEAAkE;IAClE,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACtD,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC7B,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,mCAAmC;IACnC,MAAM,eAAe,GAAG,OAAO,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IAC/D,IAAI,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QAChC,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,MAAM,IAAI,KAAK,CACb,kDAAkD;QAChD,KAAK,YAAY,IAAI;QACrB,KAAK,eAAe,EAAE,CACzB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,GAAG,cAAc,EAAE,CAAC;AAWpC,MAAM,YAAY,GAA+B;IAC/C,GAAG,EAAE,iBAAiB;IACtB,MAAM,EAAE,oBAAoB;IAC5B,UAAU,EAAE,wBAAwB;IACpC,GAAG,EAAE,iBAAiB;IACtB,OAAO,EAAE,qBAAqB;IAC9B,KAAK,EAAE,mBAAmB;IAC1B,KAAK,EAA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xC,KAAK,MAAM,IAAI,IAAI,iBAAiB,EAAE,EAAE,CAAC;QACvC,IAAI,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAiB,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,IAAI,YAAY,CAAC;AAC9B,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
export interface AirConfig {
|
|
2
|
+
name: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
skills?: string[];
|
|
5
|
+
references?: string[];
|
|
6
|
+
mcp?: string[];
|
|
7
|
+
plugins?: string[];
|
|
8
|
+
roots?: string[];
|
|
9
|
+
hooks?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface ResolvedArtifacts {
|
|
12
|
+
skills: Record<string, SkillEntry>;
|
|
13
|
+
references: Record<string, ReferenceEntry>;
|
|
14
|
+
mcp: Record<string, McpServerEntry>;
|
|
15
|
+
plugins: Record<string, PluginEntry>;
|
|
16
|
+
roots: Record<string, RootEntry>;
|
|
17
|
+
hooks: Record<string, HookEntry>;
|
|
18
|
+
}
|
|
19
|
+
export interface SkillEntry {
|
|
20
|
+
id: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
description: string;
|
|
23
|
+
path: string;
|
|
24
|
+
references?: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface ReferenceEntry {
|
|
27
|
+
id: string;
|
|
28
|
+
title?: string;
|
|
29
|
+
description: string;
|
|
30
|
+
file: string;
|
|
31
|
+
}
|
|
32
|
+
export interface McpOAuthConfig {
|
|
33
|
+
clientId?: string;
|
|
34
|
+
scopes?: string[];
|
|
35
|
+
redirectUri?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface McpServerEntry {
|
|
38
|
+
title?: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
type: "stdio" | "sse" | "streamable-http";
|
|
41
|
+
command?: string;
|
|
42
|
+
args?: string[];
|
|
43
|
+
env?: Record<string, string>;
|
|
44
|
+
url?: string;
|
|
45
|
+
headers?: Record<string, string>;
|
|
46
|
+
oauth?: McpOAuthConfig;
|
|
47
|
+
}
|
|
48
|
+
export interface PluginEntry {
|
|
49
|
+
id: string;
|
|
50
|
+
title?: string;
|
|
51
|
+
description: string;
|
|
52
|
+
type: "command";
|
|
53
|
+
command: string;
|
|
54
|
+
args?: string[];
|
|
55
|
+
env?: Record<string, string>;
|
|
56
|
+
timeout_seconds?: number;
|
|
57
|
+
}
|
|
58
|
+
export interface RootEntry {
|
|
59
|
+
name: string;
|
|
60
|
+
display_name?: string;
|
|
61
|
+
description: string;
|
|
62
|
+
url?: string;
|
|
63
|
+
default_branch?: string;
|
|
64
|
+
subdirectory?: string;
|
|
65
|
+
default_mcp_servers?: string[];
|
|
66
|
+
default_skills?: string[];
|
|
67
|
+
default_plugins?: string[];
|
|
68
|
+
default_hooks?: string[];
|
|
69
|
+
user_invocable?: boolean;
|
|
70
|
+
default_stop_condition?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface HookEntry {
|
|
73
|
+
id: string;
|
|
74
|
+
title?: string;
|
|
75
|
+
description: string;
|
|
76
|
+
event: string;
|
|
77
|
+
command: string;
|
|
78
|
+
args?: string[];
|
|
79
|
+
env?: Record<string, string>;
|
|
80
|
+
timeout_seconds?: number;
|
|
81
|
+
matcher?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Agent Adapter — translates AIR artifacts into agent-specific config
|
|
85
|
+
* and knows how to start the agent process.
|
|
86
|
+
*
|
|
87
|
+
* Implementations: @pulsemcp/air-adapter-claude, etc.
|
|
88
|
+
*/
|
|
89
|
+
export interface AgentAdapter {
|
|
90
|
+
/** Unique name for this adapter (e.g., "claude", "opencode") */
|
|
91
|
+
name: string;
|
|
92
|
+
/** Human-readable display name (e.g., "Claude Code") */
|
|
93
|
+
displayName: string;
|
|
94
|
+
/** Check if the agent CLI is installed and available */
|
|
95
|
+
isAvailable(): Promise<boolean>;
|
|
96
|
+
/** Translate resolved AIR artifacts into agent-specific session config */
|
|
97
|
+
generateConfig(artifacts: ResolvedArtifacts, root?: RootEntry, workDir?: string): AgentSessionConfig;
|
|
98
|
+
/** Build the shell command to start the agent */
|
|
99
|
+
buildStartCommand(config: AgentSessionConfig): StartCommand;
|
|
100
|
+
/**
|
|
101
|
+
* Prepare a working directory for an agent session.
|
|
102
|
+
* Writes all files the agent needs: MCP config, skills, hooks, plugins.
|
|
103
|
+
* This is the single entry point for session setup — the adapter owns
|
|
104
|
+
* the full "make this directory ready for my agent" contract.
|
|
105
|
+
*/
|
|
106
|
+
prepareSession(artifacts: ResolvedArtifacts, targetDir: string, options?: PrepareSessionOptions): Promise<PreparedSession>;
|
|
107
|
+
}
|
|
108
|
+
export interface PrepareSessionOptions {
|
|
109
|
+
/** Root to filter artifacts by (uses root's default_* arrays) */
|
|
110
|
+
root?: RootEntry;
|
|
111
|
+
/** Secret resolvers for ${VAR} interpolation in MCP configs */
|
|
112
|
+
secretResolvers?: SecretResolver[];
|
|
113
|
+
}
|
|
114
|
+
export interface PreparedSession {
|
|
115
|
+
/** Paths to config files written (e.g., ".mcp.json") */
|
|
116
|
+
configFiles: string[];
|
|
117
|
+
/** Paths to skill directories created */
|
|
118
|
+
skillPaths: string[];
|
|
119
|
+
/** The command to start the agent in the prepared directory */
|
|
120
|
+
startCommand: StartCommand;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Catalog Provider — resolves remote artifact index URIs.
|
|
124
|
+
*
|
|
125
|
+
* Core handles local filesystem paths (no scheme or file://).
|
|
126
|
+
* Providers handle other schemes: github://, s3://, https://, etc.
|
|
127
|
+
*
|
|
128
|
+
* Implementations: @pulsemcp/air-provider-github, etc.
|
|
129
|
+
*/
|
|
130
|
+
export interface CatalogProvider {
|
|
131
|
+
/** URI scheme this provider handles (e.g., "github", "s3") */
|
|
132
|
+
scheme: string;
|
|
133
|
+
/** Resolve a URI to parsed JSON content */
|
|
134
|
+
resolve(uri: string, baseDir: string): Promise<Record<string, unknown>>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Secret Resolver — resolves ${VAR} interpolation in config values.
|
|
138
|
+
*
|
|
139
|
+
* Adapters accept an array of SecretResolver instances and try them
|
|
140
|
+
* in order. Extensions can implement resolvers for process.env,
|
|
141
|
+
* 1Password, Vault, AWS Secrets Manager, etc.
|
|
142
|
+
*/
|
|
143
|
+
export interface SecretResolver {
|
|
144
|
+
/** Unique name for this resolver (e.g., "env", "1password") */
|
|
145
|
+
name: string;
|
|
146
|
+
/** Resolve a key to its secret value. Returns undefined if not found. */
|
|
147
|
+
resolve(key: string): Promise<string | undefined>;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Extension metadata — the shape every AIR extension package default-exports.
|
|
151
|
+
* Used by the CLI for adapter/provider discovery.
|
|
152
|
+
*/
|
|
153
|
+
export interface AirExtension {
|
|
154
|
+
name: string;
|
|
155
|
+
type: "adapter" | "provider" | "secret-resolver";
|
|
156
|
+
adapter?: AgentAdapter;
|
|
157
|
+
provider?: CatalogProvider;
|
|
158
|
+
secretResolver?: SecretResolver;
|
|
159
|
+
}
|
|
160
|
+
export interface AgentSessionConfig {
|
|
161
|
+
agent: string;
|
|
162
|
+
mcpConfig?: Record<string, unknown>;
|
|
163
|
+
pluginConfigs?: Record<string, unknown>[];
|
|
164
|
+
hookConfigs?: Record<string, unknown>[];
|
|
165
|
+
skillPaths?: string[];
|
|
166
|
+
workDir?: string;
|
|
167
|
+
env?: Record<string, string>;
|
|
168
|
+
}
|
|
169
|
+
export interface StartCommand {
|
|
170
|
+
command: string;
|
|
171
|
+
args: string[];
|
|
172
|
+
env?: Record<string, string>;
|
|
173
|
+
cwd?: string;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC3C,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,I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,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,gEAAgE;AAChE,+DAA+D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SchemaType } from "./schemas.js";
|
|
2
|
+
export interface ValidationResult {
|
|
3
|
+
valid: boolean;
|
|
4
|
+
errors: ValidationError[];
|
|
5
|
+
}
|
|
6
|
+
export interface ValidationError {
|
|
7
|
+
path: string;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function validateJson(data: unknown, schemaType: SchemaType): ValidationResult;
|
|
11
|
+
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,UAAU,GACrB,gBAAgB,CAkBlB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Ajv from "ajv";
|
|
2
|
+
import addFormats from "ajv-formats";
|
|
3
|
+
import { loadSchema } from "./schemas.js";
|
|
4
|
+
export function validateJson(data, schemaType) {
|
|
5
|
+
const ajv = new Ajv({ allErrors: true, strict: false });
|
|
6
|
+
addFormats(ajv);
|
|
7
|
+
const schema = loadSchema(schemaType);
|
|
8
|
+
const validate = ajv.compile(schema);
|
|
9
|
+
const valid = validate(data);
|
|
10
|
+
if (valid) {
|
|
11
|
+
return { valid: true, errors: [] };
|
|
12
|
+
}
|
|
13
|
+
const errors = (validate.errors || []).map((err) => ({
|
|
14
|
+
path: err.instancePath || "/",
|
|
15
|
+
message: err.message || "Unknown validation error",
|
|
16
|
+
}));
|
|
17
|
+
return { valid: false, errors };
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAY3D,MAAM,UAAU,YAAY,CAC1B,IAAa,EACb,UAAsB;IAEtB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACxD,UAAU,CAAC,GAAG,CAAC,CAAC;IAEhB,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE7B,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACrC,CAAC;IAED,MAAM,MAAM,GAAsB,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACtE,IAAI,EAAE,GAAG,CAAC,YAAY,IAAI,GAAG;QAC7B,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,0BAA0B;KACnD,CAAC,CAAC,CAAC;IAEJ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAClC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pulsemcp/air-core",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/pulsemcp/air.git",
|
|
10
|
+
"directory": "packages/core"
|
|
11
|
+
},
|
|
12
|
+
"description": "AIR core — config resolution, validation, schemas, and extension interfaces",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/",
|
|
24
|
+
"schemas/"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "npm run copy-schemas && tsc",
|
|
28
|
+
"copy-schemas": "cp -r ../../schemas ./schemas",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"test:watch": "vitest",
|
|
31
|
+
"lint": "tsc --noEmit",
|
|
32
|
+
"prepare": "npm run copy-schemas"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"ajv": "^8.17.1",
|
|
36
|
+
"ajv-formats": "^3.0.1"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^22.10.0",
|
|
40
|
+
"typescript": "^5.7.0",
|
|
41
|
+
"vitest": "^2.1.0"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18"
|
|
45
|
+
}
|
|
46
|
+
}
|