@nightowlsdev/engine-mastra 0.1.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/LICENSE +21 -0
- package/README.md +62 -0
- package/dist/index.cjs +56 -0
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +28 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Night Owls contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# @nightowlsdev/engine-mastra
|
|
2
|
+
|
|
3
|
+
> The default Mastra engine, given a name in the `engine-*` family — a re-export facade over `@nightowlsdev/core`.
|
|
4
|
+
|
|
5
|
+
Per the pluggable-engine architecture (`docs/strategy/2026-07-03-pluggable-engine-architecture.md` §2b), this
|
|
6
|
+
package is **v0 = a facade**: the swarm loop physically stays inside `@nightowlsdev/core` until `core@1.0`
|
|
7
|
+
(when the loop + the Mastra half of storage move in one coordinated wave). Installing `engine-mastra` and
|
|
8
|
+
passing `mastraEngine()` to `defineSwarm({ engine })` constructs the **exact same** `SwarmEngine` `defineSwarm`
|
|
9
|
+
builds by default when `engine` is omitted — it changes imports, not behavior.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pnpm add @nightowlsdev/engine-mastra
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { defineSwarm } from "@nightowlsdev/core";
|
|
21
|
+
import { mastraEngine } from "@nightowlsdev/engine-mastra";
|
|
22
|
+
|
|
23
|
+
export default defineSwarm({
|
|
24
|
+
// ...
|
|
25
|
+
engine: mastraEngine(),
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Omitting `engine` entirely is byte-identical — `defineSwarm` defaults to the built-in Mastra `SwarmEngine`
|
|
30
|
+
already. `engine-mastra` exists so the default engine has a named, CLI-installable package in the `engine-*`
|
|
31
|
+
family, matching `engine-ai-sdk` and the adapter tier (`engine-agui`, `engine-eve`, `engine-trigger-chat`).
|
|
32
|
+
|
|
33
|
+
## API
|
|
34
|
+
|
|
35
|
+
### `mastraEngine()`
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
function mastraEngine(): (opts: AssembledEngineOpts) => Engine
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Returns an engine factory for `defineSwarm({ engine })`. Constructs a `SwarmEngine` from the fully-assembled
|
|
42
|
+
`AssembledEngineOpts` `defineSwarm` hands it (composed hooks, skill resolver, workflows, telemetry, secrets,
|
|
43
|
+
`onEvent`, …) — the same construction `defineSwarm` performs internally when `engine` is omitted.
|
|
44
|
+
|
|
45
|
+
### `MastraEngine`
|
|
46
|
+
|
|
47
|
+
Identity re-export of `@nightowlsdev/core`'s `SwarmEngine` class, under its family name.
|
|
48
|
+
|
|
49
|
+
### `MASTRA_ENGINE_CAPABILITIES`
|
|
50
|
+
|
|
51
|
+
Re-export of the Mastra engine's static `EngineCapabilities` descriptor.
|
|
52
|
+
|
|
53
|
+
### `nightOwlsPlugin`
|
|
54
|
+
|
|
55
|
+
The declarative plugin manifest consumed by `@nightowlsdev/cli` (`kind: "engine"`). Data-only — it does not
|
|
56
|
+
import from `@nightowlsdev/cli` (no dependency cycle).
|
|
57
|
+
|
|
58
|
+
## See also
|
|
59
|
+
|
|
60
|
+
- `docs/spec/ENGINE-CONTRACT.md` — the normative structural `Engine` interface + behavioral invariants every
|
|
61
|
+
engine (this one included) must satisfy.
|
|
62
|
+
- `docs/strategy/2026-07-03-pluggable-engine-architecture.md` §2b — why v0 is a facade and when the loop moves.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
MASTRA_ENGINE_CAPABILITIES: () => import_core2.MASTRA_ENGINE_CAPABILITIES,
|
|
24
|
+
MastraEngine: () => import_core2.SwarmEngine,
|
|
25
|
+
mastraEngine: () => mastraEngine,
|
|
26
|
+
nightOwlsPlugin: () => nightOwlsPlugin
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
|
+
var import_core = require("@nightowlsdev/core");
|
|
30
|
+
var import_core2 = require("@nightowlsdev/core");
|
|
31
|
+
function mastraEngine() {
|
|
32
|
+
return (opts) => new import_core.SwarmEngine(opts);
|
|
33
|
+
}
|
|
34
|
+
var nightOwlsPlugin = {
|
|
35
|
+
name: "engine-mastra",
|
|
36
|
+
version: "0.0.0",
|
|
37
|
+
kind: "engine",
|
|
38
|
+
pkg: "@nightowlsdev/engine-mastra",
|
|
39
|
+
description: "The default Mastra engine as a named engine package (re-export facade).",
|
|
40
|
+
env: [],
|
|
41
|
+
config: {
|
|
42
|
+
import: `import { mastraEngine } from "@nightowlsdev/engine-mastra";`,
|
|
43
|
+
snippet: `engine = mastraEngine();`,
|
|
44
|
+
marker: "engine"
|
|
45
|
+
},
|
|
46
|
+
// Print-only (idempotent) — runs on init/install + `owl init engine-mastra`. NEVER connects anywhere.
|
|
47
|
+
init: (ctx) => ctx.log("engine-mastra wired \u2014 defineSwarm({ engine: mastraEngine() }); omitting `engine` is byte-identical."),
|
|
48
|
+
commands: []
|
|
49
|
+
};
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
MASTRA_ENGINE_CAPABILITIES,
|
|
53
|
+
MastraEngine,
|
|
54
|
+
mastraEngine,
|
|
55
|
+
nightOwlsPlugin
|
|
56
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AssembledEngineOpts, Engine } from '@nightowlsdev/core';
|
|
2
|
+
export { AssembledEngineOpts, Engine, EngineCapabilities, MASTRA_ENGINE_CAPABILITIES, SwarmEngine as MastraEngine } from '@nightowlsdev/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Engine factory for `defineSwarm({ engine: mastraEngine() })` — constructs the SAME
|
|
6
|
+
* SwarmEngine `defineSwarm` builds by default. Installing this package + passing the
|
|
7
|
+
* factory changes imports, never behavior.
|
|
8
|
+
*/
|
|
9
|
+
declare function mastraEngine(): (opts: AssembledEngineOpts) => Engine;
|
|
10
|
+
/**
|
|
11
|
+
* The declarative Night Owls plugin manifest consumed by `@nightowlsdev/cli`. STRUCTURALLY matches the CLI's
|
|
12
|
+
* `NightOwlsPlugin` type but does NOT import it (no dependency cycle): all codegen lives in `@nightowlsdev/cli`;
|
|
13
|
+
* this adapter stays data-only. NOTE: the CLI's `kind`/`marker` unions don't include `"engine"` yet (P2-2,
|
|
14
|
+
* a separate task) — this manifest is data-only and structurally typed, so it compiles independently of that.
|
|
15
|
+
*/
|
|
16
|
+
declare const nightOwlsPlugin: {
|
|
17
|
+
readonly name: "engine-mastra";
|
|
18
|
+
readonly version: "0.0.0";
|
|
19
|
+
readonly kind: "engine";
|
|
20
|
+
readonly pkg: "@nightowlsdev/engine-mastra";
|
|
21
|
+
readonly description: "The default Mastra engine as a named engine package (re-export facade).";
|
|
22
|
+
readonly env: readonly [];
|
|
23
|
+
readonly config: {
|
|
24
|
+
readonly import: "import { mastraEngine } from \"@nightowlsdev/engine-mastra\";";
|
|
25
|
+
readonly snippet: "engine = mastraEngine();";
|
|
26
|
+
readonly marker: "engine";
|
|
27
|
+
};
|
|
28
|
+
readonly init: (ctx: {
|
|
29
|
+
cwd: string;
|
|
30
|
+
log: (m: string) => void;
|
|
31
|
+
}) => void;
|
|
32
|
+
readonly commands: readonly [];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { mastraEngine, nightOwlsPlugin };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AssembledEngineOpts, Engine } from '@nightowlsdev/core';
|
|
2
|
+
export { AssembledEngineOpts, Engine, EngineCapabilities, MASTRA_ENGINE_CAPABILITIES, SwarmEngine as MastraEngine } from '@nightowlsdev/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Engine factory for `defineSwarm({ engine: mastraEngine() })` — constructs the SAME
|
|
6
|
+
* SwarmEngine `defineSwarm` builds by default. Installing this package + passing the
|
|
7
|
+
* factory changes imports, never behavior.
|
|
8
|
+
*/
|
|
9
|
+
declare function mastraEngine(): (opts: AssembledEngineOpts) => Engine;
|
|
10
|
+
/**
|
|
11
|
+
* The declarative Night Owls plugin manifest consumed by `@nightowlsdev/cli`. STRUCTURALLY matches the CLI's
|
|
12
|
+
* `NightOwlsPlugin` type but does NOT import it (no dependency cycle): all codegen lives in `@nightowlsdev/cli`;
|
|
13
|
+
* this adapter stays data-only. NOTE: the CLI's `kind`/`marker` unions don't include `"engine"` yet (P2-2,
|
|
14
|
+
* a separate task) — this manifest is data-only and structurally typed, so it compiles independently of that.
|
|
15
|
+
*/
|
|
16
|
+
declare const nightOwlsPlugin: {
|
|
17
|
+
readonly name: "engine-mastra";
|
|
18
|
+
readonly version: "0.0.0";
|
|
19
|
+
readonly kind: "engine";
|
|
20
|
+
readonly pkg: "@nightowlsdev/engine-mastra";
|
|
21
|
+
readonly description: "The default Mastra engine as a named engine package (re-export facade).";
|
|
22
|
+
readonly env: readonly [];
|
|
23
|
+
readonly config: {
|
|
24
|
+
readonly import: "import { mastraEngine } from \"@nightowlsdev/engine-mastra\";";
|
|
25
|
+
readonly snippet: "engine = mastraEngine();";
|
|
26
|
+
readonly marker: "engine";
|
|
27
|
+
};
|
|
28
|
+
readonly init: (ctx: {
|
|
29
|
+
cwd: string;
|
|
30
|
+
log: (m: string) => void;
|
|
31
|
+
}) => void;
|
|
32
|
+
readonly commands: readonly [];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { mastraEngine, nightOwlsPlugin };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { SwarmEngine } from "@nightowlsdev/core";
|
|
3
|
+
import { SwarmEngine as SwarmEngine2, MASTRA_ENGINE_CAPABILITIES } from "@nightowlsdev/core";
|
|
4
|
+
function mastraEngine() {
|
|
5
|
+
return (opts) => new SwarmEngine(opts);
|
|
6
|
+
}
|
|
7
|
+
var nightOwlsPlugin = {
|
|
8
|
+
name: "engine-mastra",
|
|
9
|
+
version: "0.0.0",
|
|
10
|
+
kind: "engine",
|
|
11
|
+
pkg: "@nightowlsdev/engine-mastra",
|
|
12
|
+
description: "The default Mastra engine as a named engine package (re-export facade).",
|
|
13
|
+
env: [],
|
|
14
|
+
config: {
|
|
15
|
+
import: `import { mastraEngine } from "@nightowlsdev/engine-mastra";`,
|
|
16
|
+
snippet: `engine = mastraEngine();`,
|
|
17
|
+
marker: "engine"
|
|
18
|
+
},
|
|
19
|
+
// Print-only (idempotent) — runs on init/install + `owl init engine-mastra`. NEVER connects anywhere.
|
|
20
|
+
init: (ctx) => ctx.log("engine-mastra wired \u2014 defineSwarm({ engine: mastraEngine() }); omitting `engine` is byte-identical."),
|
|
21
|
+
commands: []
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
MASTRA_ENGINE_CAPABILITIES,
|
|
25
|
+
SwarmEngine2 as MastraEngine,
|
|
26
|
+
mastraEngine,
|
|
27
|
+
nightOwlsPlugin
|
|
28
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nightowlsdev/engine-mastra",
|
|
3
|
+
"description": "The default Mastra engine as a named engine package — a re-export facade over @nightowlsdev/core (the loop stays in core until core@1.0).",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/cueplusplus/corale.git",
|
|
13
|
+
"directory": "packages/engine-mastra"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/cueplusplus/corale#readme",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"require": "./dist/index.cjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"main": "./dist/index.cjs",
|
|
25
|
+
"module": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@nightowlsdev/core": "0.13.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"ai": "^6.0.0",
|
|
35
|
+
"tsup": "8.5.1",
|
|
36
|
+
"typescript": "6.0.3",
|
|
37
|
+
"vitest": "^3.2.0",
|
|
38
|
+
"@nightowlsdev/core": "0.13.0",
|
|
39
|
+
"@nightowlsdev/eslint-config": "0.0.0",
|
|
40
|
+
"@nightowlsdev/tsconfig": "0.0.0"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsup",
|
|
44
|
+
"typecheck": "tsc --noEmit",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"lint": "eslint src"
|
|
47
|
+
}
|
|
48
|
+
}
|