@shardworks/nexus-core 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts.map +1 -1
- package/dist/bundle.js +35 -24
- package/dist/bundle.js.map +1 -1
- package/dist/clockworks.d.ts +20 -0
- package/dist/clockworks.d.ts.map +1 -1
- package/dist/clockworks.js +82 -29
- package/dist/clockworks.js.map +1 -1
- package/dist/commission.d.ts +35 -0
- package/dist/commission.d.ts.map +1 -0
- package/dist/commission.js +80 -0
- package/dist/commission.js.map +1 -0
- package/dist/engine.d.ts +29 -5
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +49 -5
- package/dist/engine.js.map +1 -1
- package/dist/guild-config.d.ts +1 -1
- package/dist/guild-config.d.ts.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/init-guild.d.ts.map +1 -1
- package/dist/init-guild.js +71 -2
- package/dist/init-guild.js.map +1 -1
- package/dist/ledger.d.ts +1 -1
- package/dist/ledger.d.ts.map +1 -1
- package/dist/ledger.js +7 -6
- package/dist/ledger.js.map +1 -1
- package/dist/tool.d.ts +63 -8
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +82 -3
- package/dist/tool.js.map +1 -1
- package/package.json +1 -1
- package/dist/dispatch.d.ts +0 -26
- package/dist/dispatch.d.ts.map +0 -1
- package/dist/dispatch.js +0 -56
- package/dist/dispatch.js.map +0 -1
package/dist/engine.js
CHANGED
|
@@ -6,30 +6,40 @@
|
|
|
6
6
|
* Static engines (manifest, ledger-migrate, etc.) do NOT use this factory —
|
|
7
7
|
* they have bespoke APIs and are called directly by framework code.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* A package can export a single engine or an array of engines:
|
|
10
|
+
*
|
|
11
|
+
* @example Single engine
|
|
10
12
|
* ```typescript
|
|
11
13
|
* import { engine } from '@shardworks/nexus-core';
|
|
12
14
|
*
|
|
13
15
|
* export default engine({
|
|
16
|
+
* name: 'my-engine',
|
|
14
17
|
* handler: async (event, { home }) => {
|
|
15
|
-
* // event is the triggering GuildEvent when invoked by a standing order
|
|
16
|
-
* // event is null when invoked directly (CLI, import)
|
|
17
18
|
* if (event) {
|
|
18
19
|
* console.log(`Handling ${event.name}`, event.payload);
|
|
19
20
|
* }
|
|
20
21
|
* }
|
|
21
22
|
* });
|
|
22
23
|
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example Engine collection
|
|
26
|
+
* ```typescript
|
|
27
|
+
* export default [
|
|
28
|
+
* engine({ name: 'workshop-prepare', handler: async (event, { home }) => { ... } }),
|
|
29
|
+
* engine({ name: 'workshop-merge', handler: async (event, { home }) => { ... } }),
|
|
30
|
+
* ];
|
|
31
|
+
* ```
|
|
23
32
|
*/
|
|
24
33
|
/**
|
|
25
34
|
* Define a clockwork engine.
|
|
26
35
|
*
|
|
27
|
-
* This is the SDK entry point for event-driven engines. Pass a
|
|
28
|
-
* function that receives a GuildEvent (or null for direct invocation)
|
|
36
|
+
* This is the SDK entry point for event-driven engines. Pass a name and a
|
|
37
|
+
* handler function that receives a GuildEvent (or null for direct invocation)
|
|
29
38
|
* and an EngineContext.
|
|
30
39
|
*/
|
|
31
40
|
export function engine(def) {
|
|
32
41
|
return {
|
|
42
|
+
name: def.name,
|
|
33
43
|
__clockwork: true,
|
|
34
44
|
handler: def.handler,
|
|
35
45
|
};
|
|
@@ -42,4 +52,38 @@ export function isClockworkEngine(obj) {
|
|
|
42
52
|
obj.__clockwork === true &&
|
|
43
53
|
typeof obj.handler === 'function');
|
|
44
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Resolve a single EngineDefinition from a module's default export.
|
|
57
|
+
*
|
|
58
|
+
* Handles both single-engine and array-of-engines exports:
|
|
59
|
+
* - Single engine: `export default engine({...})` → returned directly
|
|
60
|
+
* - Array: `export default [engine({...}), engine({...})]` → find by name
|
|
61
|
+
*
|
|
62
|
+
* @param moduleDefault - The module's default export
|
|
63
|
+
* @param engineName - The engine name to find (required for array exports)
|
|
64
|
+
* @returns The matching EngineDefinition, or null if not found
|
|
65
|
+
*/
|
|
66
|
+
export function resolveEngineFromExport(moduleDefault, engineName) {
|
|
67
|
+
// Single engine export
|
|
68
|
+
if (isClockworkEngine(moduleDefault)) {
|
|
69
|
+
if (!engineName || moduleDefault.name === engineName)
|
|
70
|
+
return moduleDefault;
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
// Array of engines — find by name
|
|
74
|
+
if (Array.isArray(moduleDefault)) {
|
|
75
|
+
for (const item of moduleDefault) {
|
|
76
|
+
if (!isClockworkEngine(item))
|
|
77
|
+
continue;
|
|
78
|
+
if (item.name === engineName)
|
|
79
|
+
return item;
|
|
80
|
+
}
|
|
81
|
+
// If no name match but array has exactly one engine, return it
|
|
82
|
+
const engines = moduleDefault.filter(isClockworkEngine);
|
|
83
|
+
if (engines.length === 1 && !engineName)
|
|
84
|
+
return engines[0];
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
45
89
|
//# sourceMappingURL=engine.js.map
|
package/dist/engine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AA+BH;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,GAGtB;IACC,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,GAAG,CAAC,OAAO;KACrB,CAAC;AACJ,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC5C,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACZ,aAAa,IAAI,GAAG;QACnB,GAAwB,CAAC,WAAW,KAAK,IAAI;QAC9C,OAAQ,GAAwB,CAAC,OAAO,KAAK,UAAU,CACxD,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,uBAAuB,CACrC,aAAsB,EACtB,UAAmB;IAEnB,uBAAuB;IACvB,IAAI,iBAAiB,CAAC,aAAa,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC,UAAU,IAAI,aAAa,CAAC,IAAI,KAAK,UAAU;YAAE,OAAO,aAAa,CAAC;QAC3E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kCAAkC;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QACjC,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;YACjC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;gBAAE,SAAS;YACvC,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU;gBAAE,OAAO,IAAI,CAAC;QAC5C,CAAC;QACD,+DAA+D;QAC/D,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACxD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO,OAAO,CAAC,CAAC,CAAE,CAAC;QAC5D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/guild-config.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface RoleDefinition {
|
|
|
15
15
|
}
|
|
16
16
|
/** A reference to a tool or engine registered in guild.json. */
|
|
17
17
|
export interface ToolEntry {
|
|
18
|
-
/** Upstream package identifier, e.g. "@shardworks/tool-
|
|
18
|
+
/** Upstream package identifier, e.g. "@shardworks/tool-commission@1.11.3". Null for locally-built tools. */
|
|
19
19
|
upstream: string | null;
|
|
20
20
|
/** ISO-8601 timestamp of when the tool was installed. */
|
|
21
21
|
installedAt: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guild-config.d.ts","sourceRoot":"","sources":["../src/guild-config.ts"],"names":[],"mappings":"AAGA,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,wEAAwE;IACxE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,gEAAgE;AAChE,MAAM,WAAW,SAAS;IACxB,
|
|
1
|
+
{"version":3,"file":"guild-config.d.ts","sourceRoot":"","sources":["../src/guild-config.ts"],"names":[],"mappings":"AAGA,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,wEAAwE;IACxE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,gEAAgE;AAChE,MAAM,WAAW,SAAS;IACxB,4GAA4G;IAC5G,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,4DAA4D;AAC5D,MAAM,MAAM,aAAa,GACrB;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAA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,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACzC,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC5C,0DAA0D;IAC1D,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAavG;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,qDAAqD;AACrD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAGzD;AAED,0CAA0C;AAC1C,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAGxE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export declare const VERSION: string;
|
|
2
|
-
export { type ToolContext, type ToolDefinition, tool, } from './tool.ts';
|
|
3
|
-
export { type GuildEvent, type EngineContext, type EngineDefinition, engine, isClockworkEngine, } from './engine.ts';
|
|
2
|
+
export { type ToolContext, type ToolDefinition, tool, isToolDefinition, resolveToolFromExport, resolveAllToolsFromExport, } from './tool.ts';
|
|
3
|
+
export { type GuildEvent, type EngineContext, type EngineDefinition, engine, isClockworkEngine, resolveEngineFromExport, } from './engine.ts';
|
|
4
4
|
export { signalEvent, validateCustomEvent, isFrameworkEvent, readPendingEvents, readEvent, markEventProcessed, recordDispatch, } from './events.ts';
|
|
5
|
-
export { type TickResult, type DispatchSummary, type ClockRunResult, clockTick, clockRun, } from './clockworks.ts';
|
|
5
|
+
export { type TickResult, type DispatchSummary, type ClockRunResult, type SummonHandler, clockTick, clockRun, registerSummonHandler, } from './clockworks.ts';
|
|
6
6
|
export { createLedger } from './ledger.ts';
|
|
7
7
|
export { type GuildConfig, type RoleDefinition, type ToolEntry, type TrainingEntry, type WorkshopEntry, type EventDeclaration, type StandingOrder, type ClockworksConfig, createInitialGuildConfig, guildConfigPath, readGuildConfig, writeGuildConfig, } from './guild-config.ts';
|
|
8
8
|
export { findGuildRoot, nexusDir, ledgerPath, worktreesPath, workshopsPath, workshopBarePath, } from './nexus-home.ts';
|
|
9
9
|
export { type InstallToolOptions, type InstallResult, type SourceKind, classifySource, installTool, } from './install-tool.ts';
|
|
10
10
|
export { type RemoveToolOptions, type RemoveResult, removeTool, } from './remove-tool.ts';
|
|
11
|
-
export { type
|
|
11
|
+
export { type CommissionOptions, type CommissionResult, commission, updateCommissionStatus, readCommission, } from './commission.ts';
|
|
12
12
|
export { type InstantiateOptions, type InstantiateResult, instantiate, } from './instantiate.ts';
|
|
13
13
|
export { initGuild } from './init-guild.ts';
|
|
14
14
|
export { type BundleManifest, type BundlePackageEntry, type BundleContentEntry, type BundleMigrationEntry, type InstallBundleOptions, type InstallBundleResult, readBundleManifest, installBundle, isBundleDir, } from './bundle.ts';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,EAAE,MAAqB,CAAC;AAE5C,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,EAAE,MAAqB,CAAC;AAE5C,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,IAAI,EACJ,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,MAAM,EACN,iBAAiB,EACjB,uBAAuB,G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oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,kBAAkB,EAClB,aAAa,EACb,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,eAAe,EACpB,SAAS,GACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,WAAW,EACX,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,16 +3,16 @@ import { createRequire } from 'node:module';
|
|
|
3
3
|
const _require = createRequire(import.meta.url);
|
|
4
4
|
const _pkg = _require('../package.json');
|
|
5
5
|
export const VERSION = _pkg.version;
|
|
6
|
-
export { tool, } from "./tool.js";
|
|
7
|
-
export { engine, isClockworkEngine, } from "./engine.js";
|
|
6
|
+
export { tool, isToolDefinition, resolveToolFromExport, resolveAllToolsFromExport, } from "./tool.js";
|
|
7
|
+
export { engine, isClockworkEngine, resolveEngineFromExport, } from "./engine.js";
|
|
8
8
|
export { signalEvent, validateCustomEvent, isFrameworkEvent, readPendingEvents, readEvent, markEventProcessed, recordDispatch, } from "./events.js";
|
|
9
|
-
export { clockTick, clockRun, } from "./clockworks.js";
|
|
9
|
+
export { clockTick, clockRun, registerSummonHandler, } from "./clockworks.js";
|
|
10
10
|
export { createLedger } from "./ledger.js";
|
|
11
11
|
export { createInitialGuildConfig, guildConfigPath, readGuildConfig, writeGuildConfig, } from "./guild-config.js";
|
|
12
12
|
export { findGuildRoot, nexusDir, ledgerPath, worktreesPath, workshopsPath, workshopBarePath, } from "./nexus-home.js";
|
|
13
13
|
export { classifySource, installTool, } from "./install-tool.js";
|
|
14
14
|
export { removeTool, } from "./remove-tool.js";
|
|
15
|
-
export {
|
|
15
|
+
export { commission, updateCommissionStatus, readCommission, } from "./commission.js";
|
|
16
16
|
export { instantiate, } from "./instantiate.js";
|
|
17
17
|
export { initGuild } from "./init-guild.js";
|
|
18
18
|
export { readBundleManifest, installBundle, isBundleDir, } from "./bundle.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,OAAO,GAAW,IAAI,CAAC,OAAO,CAAC;AAE5C,OAAO,EAGL,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,OAAO,GAAW,IAAI,CAAC,OAAO,CAAC;AAE5C,OAAO,EAGL,IAAI,EACJ,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,WAAW,CAAC;AAEnB,OAAO,EAIL,MAAM,EACN,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EAClB,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAKL,SAAS,EACT,QAAQ,EACR,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EASL,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,aAAa,EACb,QAAQ,EACR,UAAU,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAIL,cAAc,EACd,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAGL,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGL,UAAU,EACV,sBAAsB,EACtB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAGL,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAOL,kBAAkB,EAClB,aAAa,EACb,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,SAAS,GACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAML,WAAW,EACX,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAOL,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC"}
|
package/dist/init-guild.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-guild.d.ts","sourceRoot":"","sources":["../src/init-guild.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"init-guild.d.ts","sourceRoot":"","sources":["../src/init-guild.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAuJzE"}
|
package/dist/init-guild.js
CHANGED
|
@@ -60,8 +60,55 @@ export function initGuild(home, name, model) {
|
|
|
60
60
|
// Write codex placeholder
|
|
61
61
|
fs.writeFileSync(path.join(home, 'codex/all.md'), '');
|
|
62
62
|
// Write default role instruction files
|
|
63
|
-
fs.writeFileSync(path.join(home, 'roles/advisor.md'),
|
|
64
|
-
|
|
63
|
+
fs.writeFileSync(path.join(home, 'roles/advisor.md'), [
|
|
64
|
+
'# Advisor',
|
|
65
|
+
'',
|
|
66
|
+
'You are a guild advisor — a standing member who helps the patron understand and operate the guild.',
|
|
67
|
+
'',
|
|
68
|
+
'## Purpose',
|
|
69
|
+
'',
|
|
70
|
+
'You are the patron\'s primary point of contact with the guild. You explain how things work, report on guild state, suggest next steps, and help the patron frame their intentions as commissions. You are the guild\'s institutional memory made conversational.',
|
|
71
|
+
'',
|
|
72
|
+
'## What You Do',
|
|
73
|
+
'',
|
|
74
|
+
'- **Answer questions** about guild structure, capabilities, and current state.',
|
|
75
|
+
'- **Report status** — animas on the roster, active commissions, workshop state, tool inventory.',
|
|
76
|
+
'- **Help frame commissions** — when the patron has a vague idea, help them refine it into a clear brief that an artificer can act on.',
|
|
77
|
+
'- **Explain outcomes** — when a commission completes or fails, help the patron understand what happened and what to do next.',
|
|
78
|
+
'- **Suggest actions** — if you see something that needs attention (a failed commission, a missing tool, an empty roster), proactively surface it.',
|
|
79
|
+
'',
|
|
80
|
+
'## What You Don\'t Do',
|
|
81
|
+
'',
|
|
82
|
+
'- **You do not implement.** You don\'t write code, build features, or modify workshops. If the patron asks you to build something, help them commission it instead.',
|
|
83
|
+
'- **You do not modify guild state** without explicit direction from the patron. You read and report; you don\'t unilaterally change things.',
|
|
84
|
+
'- **You do not speak for other animas.** Report what the ledger says, not what you imagine another anima would think.',
|
|
85
|
+
'',
|
|
86
|
+
].join('\n'));
|
|
87
|
+
fs.writeFileSync(path.join(home, 'roles/artificer.md'), [
|
|
88
|
+
'# Artificer',
|
|
89
|
+
'',
|
|
90
|
+
'You are a guild artificer — you undertake commissions and build the works the patron has asked for.',
|
|
91
|
+
'',
|
|
92
|
+
'## Purpose',
|
|
93
|
+
'',
|
|
94
|
+
'You are the guild\'s hands. When the patron commissions work, you receive the brief (and sage advice, if a sage is active), and you build the thing. Your output is the guild\'s works — running software, usable tools, solved problems.',
|
|
95
|
+
'',
|
|
96
|
+
'## What You Do',
|
|
97
|
+
'',
|
|
98
|
+
'- **Execute commissions** — receive a brief, understand the requirements, and deliver working results.',
|
|
99
|
+
'- **Work in workshops** — your work happens in commission worktrees. Each commission gives you an isolated workspace branched from main.',
|
|
100
|
+
'- **Write clear code** with useful comments and commit messages. Your primary audience is the next anima who continues the work.',
|
|
101
|
+
'- **Test your work** before marking a commission complete. Verify that what you built actually works.',
|
|
102
|
+
'- **Signal events** when notable things happen during your work — use `craft.question` for design decisions outside your scope, and `craft.debt` for tech debt or code smells you observe but intentionally leave alone.',
|
|
103
|
+
'',
|
|
104
|
+
'## What You Don\'t Do',
|
|
105
|
+
'',
|
|
106
|
+
'- **You do not plan commissions.** That\'s the sage\'s job. If a brief is unclear, ask for clarification rather than inventing requirements.',
|
|
107
|
+
'- **You do not modify guild infrastructure.** You work in workshops, not in the guildhall. Tools, roles, and configuration are not your concern.',
|
|
108
|
+
'- **You do not contradict sage advice.** If a sage has provided a plan, follow it. If you believe the plan has a flaw, record your concern in a commit message or comment, but execute the plan as given.',
|
|
109
|
+
'',
|
|
110
|
+
].join('\n'));
|
|
111
|
+
// Write guild.json — with default roles, clockworks events, empty registries
|
|
65
112
|
const config = createInitialGuildConfig(name, VERSION, model);
|
|
66
113
|
config.roles = {
|
|
67
114
|
advisor: {
|
|
@@ -69,6 +116,28 @@ export function initGuild(home, name, model) {
|
|
|
69
116
|
tools: [],
|
|
70
117
|
instructions: 'roles/advisor.md',
|
|
71
118
|
},
|
|
119
|
+
artificer: {
|
|
120
|
+
seats: null,
|
|
121
|
+
tools: [],
|
|
122
|
+
instructions: 'roles/artificer.md',
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
config.clockworks = {
|
|
126
|
+
events: {
|
|
127
|
+
'craft.question': {
|
|
128
|
+
description: 'An artificer encountered a design decision outside the commission scope that needs attention.',
|
|
129
|
+
schema: { summary: 'string', workshop: 'string', commission: 'string?', context: 'string?' },
|
|
130
|
+
},
|
|
131
|
+
'craft.debt': {
|
|
132
|
+
description: 'An artificer observed tech debt or a code smell but intentionally did not address it.',
|
|
133
|
+
schema: { summary: 'string', workshop: 'string', commission: 'string?', location: 'string?' },
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
standingOrders: [
|
|
137
|
+
{ on: 'commission.posted', run: 'workshop-prepare' },
|
|
138
|
+
{ on: 'commission.ready', summon: 'artificer' },
|
|
139
|
+
{ on: 'commission.session.ended', run: 'workshop-merge' },
|
|
140
|
+
],
|
|
72
141
|
};
|
|
73
142
|
fs.writeFileSync(path.join(home, 'guild.json'), JSON.stringify(config, null, 2) + '\n');
|
|
74
143
|
// Make the guildhall an npm package so guild tools can be installed as
|
package/dist/init-guild.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-guild.js","sourceRoot":"","sources":["../src/init-guild.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,YAA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,CAAC;IAE5E,iBAAiB;IACjB,GAAG,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IACzB,GAAG,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,kBAAkB,CAAC,EAAE,IAAI,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/ledger.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** SQL for the initial Ledger schema (001). Creates all base tables with WAL mode and foreign keys. */
|
|
2
|
-
export declare const INITIAL_SCHEMA = "\nPRAGMA journal_mode = WAL;\nPRAGMA foreign_keys = ON;\n\nCREATE TABLE animas (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name TEXT NOT NULL UNIQUE,\n status TEXT NOT NULL CHECK(status IN ('aspirant', 'active', 'retired')),\n created_at TEXT NOT NULL DEFAULT (datetime('now')),\n updated_at TEXT NOT NULL DEFAULT (datetime('now'))\n);\n\nCREATE TABLE anima_compositions (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n anima_id INTEGER NOT NULL UNIQUE REFERENCES animas(id),\n curriculum_name TEXT NOT NULL,\n curriculum_version TEXT NOT NULL,\n temperament_name TEXT NOT NULL,\n temperament_version TEXT NOT NULL,\n curriculum_snapshot TEXT NOT NULL,\n temperament_snapshot TEXT NOT NULL,\n composed_at TEXT NOT NULL DEFAULT (datetime('now'))\n);\n\nCREATE TABLE roster (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n anima_id INTEGER NOT NULL REFERENCES animas(id),\n role TEXT NOT NULL,\n standing INTEGER NOT NULL DEFAULT 0,\n assigned_at TEXT NOT NULL DEFAULT (datetime('now'))\n);\n\nCREATE TABLE commissions (\n id
|
|
2
|
+
export declare const INITIAL_SCHEMA = "\nPRAGMA journal_mode = WAL;\nPRAGMA foreign_keys = ON;\n\nCREATE TABLE animas (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name TEXT NOT NULL UNIQUE,\n status TEXT NOT NULL CHECK(status IN ('aspirant', 'active', 'retired')),\n created_at TEXT NOT NULL DEFAULT (datetime('now')),\n updated_at TEXT NOT NULL DEFAULT (datetime('now'))\n);\n\nCREATE TABLE anima_compositions (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n anima_id INTEGER NOT NULL UNIQUE REFERENCES animas(id),\n curriculum_name TEXT NOT NULL,\n curriculum_version TEXT NOT NULL,\n temperament_name TEXT NOT NULL,\n temperament_version TEXT NOT NULL,\n curriculum_snapshot TEXT NOT NULL,\n temperament_snapshot TEXT NOT NULL,\n composed_at TEXT NOT NULL DEFAULT (datetime('now'))\n);\n\nCREATE TABLE roster (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n anima_id INTEGER NOT NULL REFERENCES animas(id),\n role TEXT NOT NULL,\n standing INTEGER NOT NULL DEFAULT 0,\n assigned_at TEXT NOT NULL DEFAULT (datetime('now'))\n);\n\nCREATE TABLE commissions (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n content TEXT NOT NULL,\n status TEXT NOT NULL CHECK(status IN ('posted', 'assigned', 'in_progress', 'completed', 'failed')),\n status_reason TEXT,\n workshop TEXT NOT NULL,\n created_at TEXT NOT NULL DEFAULT (datetime('now')),\n updated_at TEXT NOT NULL DEFAULT (datetime('now'))\n);\n\nCREATE TABLE commission_assignments (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n commission_id INTEGER NOT NULL REFERENCES commissions(id),\n anima_id INTEGER NOT NULL REFERENCES animas(id),\n assigned_at TEXT NOT NULL DEFAULT (datetime('now')),\n UNIQUE(commission_id, anima_id)\n);\n\nCREATE TABLE audit_log (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n actor TEXT NOT NULL,\n action TEXT NOT NULL,\n target_type TEXT,\n target_id INTEGER,\n detail TEXT,\n timestamp TEXT NOT NULL DEFAULT (datetime('now'))\n);\n";
|
|
3
3
|
/**
|
|
4
4
|
* Create a new Ledger database at the given path and apply the initial schema.
|
|
5
5
|
* @param dbPath - Absolute path where the SQLite file will be created.
|
package/dist/ledger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../src/ledger.ts"],"names":[],"mappings":"AAEA,uGAAuG;AACvG,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../src/ledger.ts"],"names":[],"mappings":"AAEA,uGAAuG;AACvG,eAAO,MAAM,cAAc,6rEA2D1B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAOjD"}
|
package/dist/ledger.js
CHANGED
|
@@ -33,12 +33,13 @@ CREATE TABLE roster (
|
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
CREATE TABLE commissions (
|
|
36
|
-
id
|
|
37
|
-
content
|
|
38
|
-
status
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
37
|
+
content TEXT NOT NULL,
|
|
38
|
+
status TEXT NOT NULL CHECK(status IN ('posted', 'assigned', 'in_progress', 'completed', 'failed')),
|
|
39
|
+
status_reason TEXT,
|
|
40
|
+
workshop TEXT NOT NULL,
|
|
41
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
42
|
+
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
42
43
|
);
|
|
43
44
|
|
|
44
45
|
CREATE TABLE commission_assignments (
|
package/dist/ledger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["../src/ledger.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,uGAAuG;AACvG,MAAM,CAAC,MAAM,cAAc,GAAG
|
|
1
|
+
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["../src/ledger.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,uGAAuG;AACvG,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2D7B,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC;QACH,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1B,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
package/dist/tool.d.ts
CHANGED
|
@@ -5,22 +5,33 @@
|
|
|
5
5
|
* The returned definition is what the MCP engine imports and registers as a tool,
|
|
6
6
|
* what the CLI uses to auto-generate subcommands, and what engines import directly.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* A package can export a single tool or an array of tools:
|
|
9
|
+
*
|
|
10
|
+
* @example Single tool
|
|
9
11
|
* ```typescript
|
|
10
12
|
* import { tool } from '@shardworks/nexus-core';
|
|
11
13
|
* import { z } from 'zod';
|
|
12
14
|
*
|
|
13
15
|
* export default tool({
|
|
16
|
+
* name: 'lookup',
|
|
14
17
|
* description: 'Look up an anima by name',
|
|
18
|
+
* instructionsFile: './instructions.md',
|
|
15
19
|
* params: {
|
|
16
20
|
* name: z.string().describe('Anima name'),
|
|
17
21
|
* },
|
|
18
22
|
* handler: async ({ name }, { home }) => {
|
|
19
|
-
* // ... look up anima using home to find the guild ...
|
|
20
23
|
* return { found: true, status: 'active' };
|
|
21
24
|
* },
|
|
22
25
|
* });
|
|
23
26
|
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example Tool collection
|
|
29
|
+
* ```typescript
|
|
30
|
+
* export default [
|
|
31
|
+
* tool({ name: 'commission', description: '...', params: {...}, handler: ... }),
|
|
32
|
+
* tool({ name: 'signal', description: '...', params: {...}, handler: ... }),
|
|
33
|
+
* ];
|
|
34
|
+
* ```
|
|
24
35
|
*/
|
|
25
36
|
import { z } from 'zod';
|
|
26
37
|
type ZodShape = Record<string, z.ZodType>;
|
|
@@ -42,15 +53,38 @@ export interface ToolContext {
|
|
|
42
53
|
* Engines call `.handler` directly.
|
|
43
54
|
*/
|
|
44
55
|
export interface ToolDefinition<TShape extends ZodShape = ZodShape> {
|
|
56
|
+
/** Tool name — used for resolution when a package exports multiple tools. */
|
|
57
|
+
readonly name: string;
|
|
45
58
|
readonly description: string;
|
|
59
|
+
/** Per-tool instructions injected into the anima's session context (inline text). */
|
|
60
|
+
readonly instructions?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Path to an instructions file, relative to the package root.
|
|
63
|
+
* Resolved by the manifest engine at session time.
|
|
64
|
+
* Mutually exclusive with `instructions`.
|
|
65
|
+
*/
|
|
66
|
+
readonly instructionsFile?: string;
|
|
46
67
|
readonly params: z.ZodObject<TShape>;
|
|
47
68
|
readonly handler: (params: z.infer<z.ZodObject<TShape>>, context: ToolContext) => unknown | Promise<unknown>;
|
|
48
69
|
}
|
|
70
|
+
/** Input to `tool()` — instructions are either inline text or a file path, not both. */
|
|
71
|
+
type ToolInput<TShape extends ZodShape> = {
|
|
72
|
+
name: string;
|
|
73
|
+
description: string;
|
|
74
|
+
params: TShape;
|
|
75
|
+
handler: (params: z.infer<z.ZodObject<TShape>>, context: ToolContext) => unknown | Promise<unknown>;
|
|
76
|
+
} & ({
|
|
77
|
+
instructions?: string;
|
|
78
|
+
instructionsFile?: never;
|
|
79
|
+
} | {
|
|
80
|
+
instructions?: never;
|
|
81
|
+
instructionsFile?: string;
|
|
82
|
+
});
|
|
49
83
|
/**
|
|
50
84
|
* Define a Nexus tool.
|
|
51
85
|
*
|
|
52
86
|
* This is the primary SDK entry point for module-based tools. Pass a
|
|
53
|
-
* description, a params object of Zod schemas, and a handler function.
|
|
87
|
+
* name, description, a params object of Zod schemas, and a handler function.
|
|
54
88
|
* The framework handles the rest — MCP registration, CLI generation, validation.
|
|
55
89
|
*
|
|
56
90
|
* The handler receives two arguments:
|
|
@@ -59,11 +93,32 @@ export interface ToolDefinition<TShape extends ZodShape = ZodShape> {
|
|
|
59
93
|
*
|
|
60
94
|
* Return any JSON-serializable value. The MCP engine wraps it as tool output;
|
|
61
95
|
* the CLI prints it; engines use it directly.
|
|
96
|
+
*
|
|
97
|
+
* Instructions can be provided inline or as a file path:
|
|
98
|
+
* - `instructions: 'Use this tool when...'` — inline text
|
|
99
|
+
* - `instructionsFile: './instructions.md'` — resolved at manifest time
|
|
62
100
|
*/
|
|
63
|
-
export declare function tool<TShape extends ZodShape>(def:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
101
|
+
export declare function tool<TShape extends ZodShape>(def: ToolInput<TShape>): ToolDefinition<TShape>;
|
|
102
|
+
/**
|
|
103
|
+
* Resolve a single ToolDefinition from a module's default export.
|
|
104
|
+
*
|
|
105
|
+
* Handles both single-tool and array-of-tools exports:
|
|
106
|
+
* - Single tool: `export default tool({...})` → returned directly
|
|
107
|
+
* - Array: `export default [tool({...}), tool({...})]` → find by name
|
|
108
|
+
*
|
|
109
|
+
* @param moduleDefault - The module's default export
|
|
110
|
+
* @param toolName - The tool name to find (required for array exports)
|
|
111
|
+
* @returns The matching ToolDefinition, or null if not found
|
|
112
|
+
*/
|
|
113
|
+
export declare function resolveToolFromExport(moduleDefault: unknown, toolName?: string): ToolDefinition | null;
|
|
114
|
+
/**
|
|
115
|
+
* Resolve all ToolDefinitions from a module's default export.
|
|
116
|
+
*
|
|
117
|
+
* Handles both single-tool and array-of-tools exports.
|
|
118
|
+
* Returns an array in either case.
|
|
119
|
+
*/
|
|
120
|
+
export declare function resolveAllToolsFromExport(moduleDefault: unknown): ToolDefinition[];
|
|
121
|
+
/** Type guard: is this value a ToolDefinition? */
|
|
122
|
+
export declare function isToolDefinition(obj: unknown): obj is ToolDefinition;
|
|
68
123
|
export {};
|
|
69
124
|
//# sourceMappingURL=tool.d.ts.map
|
package/dist/tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;AAE1C;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc,CAAC,MAAM,SAAS,QAAQ,GAAG,QAAQ;IAChE,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qFAAqF;IACrF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,CAChB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EACpC,OAAO,EAAE,WAAW,KACjB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC;AAED,wFAAwF;AACxF,KAAK,SAAS,CAAC,MAAM,SAAS,QAAQ,IAAI;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,CACP,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EACpC,OAAO,EAAE,WAAW,KACjB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC,GAAG,CACA;IAAE,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,KAAK,CAAA;CAAE,GACnD;IAAE,YAAY,CAAC,EAAE,KAAK,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,CACtD,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CAAC,MAAM,SAAS,QAAQ,EAAE,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAS5F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,OAAO,EACtB,QAAQ,CAAC,EAAE,MAAM,GAChB,cAAc,GAAG,IAAI,CAoBvB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,OAAO,GACrB,cAAc,EAAE,CAUlB;AAED,kDAAkD;AAClD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,cAAc,CAYpE"}
|
package/dist/tool.js
CHANGED
|
@@ -5,29 +5,40 @@
|
|
|
5
5
|
* The returned definition is what the MCP engine imports and registers as a tool,
|
|
6
6
|
* what the CLI uses to auto-generate subcommands, and what engines import directly.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* A package can export a single tool or an array of tools:
|
|
9
|
+
*
|
|
10
|
+
* @example Single tool
|
|
9
11
|
* ```typescript
|
|
10
12
|
* import { tool } from '@shardworks/nexus-core';
|
|
11
13
|
* import { z } from 'zod';
|
|
12
14
|
*
|
|
13
15
|
* export default tool({
|
|
16
|
+
* name: 'lookup',
|
|
14
17
|
* description: 'Look up an anima by name',
|
|
18
|
+
* instructionsFile: './instructions.md',
|
|
15
19
|
* params: {
|
|
16
20
|
* name: z.string().describe('Anima name'),
|
|
17
21
|
* },
|
|
18
22
|
* handler: async ({ name }, { home }) => {
|
|
19
|
-
* // ... look up anima using home to find the guild ...
|
|
20
23
|
* return { found: true, status: 'active' };
|
|
21
24
|
* },
|
|
22
25
|
* });
|
|
23
26
|
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example Tool collection
|
|
29
|
+
* ```typescript
|
|
30
|
+
* export default [
|
|
31
|
+
* tool({ name: 'commission', description: '...', params: {...}, handler: ... }),
|
|
32
|
+
* tool({ name: 'signal', description: '...', params: {...}, handler: ... }),
|
|
33
|
+
* ];
|
|
34
|
+
* ```
|
|
24
35
|
*/
|
|
25
36
|
import { z } from 'zod';
|
|
26
37
|
/**
|
|
27
38
|
* Define a Nexus tool.
|
|
28
39
|
*
|
|
29
40
|
* This is the primary SDK entry point for module-based tools. Pass a
|
|
30
|
-
* description, a params object of Zod schemas, and a handler function.
|
|
41
|
+
* name, description, a params object of Zod schemas, and a handler function.
|
|
31
42
|
* The framework handles the rest — MCP registration, CLI generation, validation.
|
|
32
43
|
*
|
|
33
44
|
* The handler receives two arguments:
|
|
@@ -36,12 +47,80 @@ import { z } from 'zod';
|
|
|
36
47
|
*
|
|
37
48
|
* Return any JSON-serializable value. The MCP engine wraps it as tool output;
|
|
38
49
|
* the CLI prints it; engines use it directly.
|
|
50
|
+
*
|
|
51
|
+
* Instructions can be provided inline or as a file path:
|
|
52
|
+
* - `instructions: 'Use this tool when...'` — inline text
|
|
53
|
+
* - `instructionsFile: './instructions.md'` — resolved at manifest time
|
|
39
54
|
*/
|
|
40
55
|
export function tool(def) {
|
|
41
56
|
return {
|
|
57
|
+
name: def.name,
|
|
42
58
|
description: def.description,
|
|
59
|
+
...(def.instructions ? { instructions: def.instructions } : {}),
|
|
60
|
+
...(def.instructionsFile ? { instructionsFile: def.instructionsFile } : {}),
|
|
43
61
|
params: z.object(def.params),
|
|
44
62
|
handler: def.handler,
|
|
45
63
|
};
|
|
46
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Resolve a single ToolDefinition from a module's default export.
|
|
67
|
+
*
|
|
68
|
+
* Handles both single-tool and array-of-tools exports:
|
|
69
|
+
* - Single tool: `export default tool({...})` → returned directly
|
|
70
|
+
* - Array: `export default [tool({...}), tool({...})]` → find by name
|
|
71
|
+
*
|
|
72
|
+
* @param moduleDefault - The module's default export
|
|
73
|
+
* @param toolName - The tool name to find (required for array exports)
|
|
74
|
+
* @returns The matching ToolDefinition, or null if not found
|
|
75
|
+
*/
|
|
76
|
+
export function resolveToolFromExport(moduleDefault, toolName) {
|
|
77
|
+
// Single tool export
|
|
78
|
+
if (isToolDefinition(moduleDefault)) {
|
|
79
|
+
if (!toolName || moduleDefault.name === toolName)
|
|
80
|
+
return moduleDefault;
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
// Array of tools — find by name
|
|
84
|
+
if (Array.isArray(moduleDefault)) {
|
|
85
|
+
for (const item of moduleDefault) {
|
|
86
|
+
if (!isToolDefinition(item))
|
|
87
|
+
continue;
|
|
88
|
+
if (item.name === toolName)
|
|
89
|
+
return item;
|
|
90
|
+
}
|
|
91
|
+
// If no name match but array has exactly one tool, return it
|
|
92
|
+
const tools = moduleDefault.filter(isToolDefinition);
|
|
93
|
+
if (tools.length === 1 && !toolName)
|
|
94
|
+
return tools[0];
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Resolve all ToolDefinitions from a module's default export.
|
|
101
|
+
*
|
|
102
|
+
* Handles both single-tool and array-of-tools exports.
|
|
103
|
+
* Returns an array in either case.
|
|
104
|
+
*/
|
|
105
|
+
export function resolveAllToolsFromExport(moduleDefault) {
|
|
106
|
+
if (isToolDefinition(moduleDefault)) {
|
|
107
|
+
return [moduleDefault];
|
|
108
|
+
}
|
|
109
|
+
if (Array.isArray(moduleDefault)) {
|
|
110
|
+
return moduleDefault.filter(isToolDefinition);
|
|
111
|
+
}
|
|
112
|
+
return [];
|
|
113
|
+
}
|
|
114
|
+
/** Type guard: is this value a ToolDefinition? */
|
|
115
|
+
export function isToolDefinition(obj) {
|
|
116
|
+
return (typeof obj === 'object' &&
|
|
117
|
+
obj !== null &&
|
|
118
|
+
'name' in obj &&
|
|
119
|
+
'description' in obj &&
|
|
120
|
+
'params' in obj &&
|
|
121
|
+
'handler' in obj &&
|
|
122
|
+
typeof obj.name === 'string' &&
|
|
123
|
+
typeof obj.description === 'string' &&
|
|
124
|
+
typeof obj.handler === 'function');
|
|
125
|
+
}
|
|
47
126
|
//# sourceMappingURL=tool.js.map
|
package/dist/tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyDxB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,IAAI,CAA0B,GAAsB;IAClE,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3E,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;QAC5B,O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K,QAAQ;QACvB,GAAG,KAAK,IAAI;QACZ,MAAM,IAAI,GAAG;QACb,aAAa,IAAI,GAAG;QACpB,QAAQ,IAAI,GAAG;QACf,SAAS,IAAI,GAAG;QAChB,OAAQ,GAAsB,CAAC,IAAI,KAAK,QAAQ;QAChD,OAAQ,GAAsB,CAAC,WAAW,KAAK,QAAQ;QACvD,OAAQ,GAAsB,CAAC,OAAO,KAAK,UAAU,CACtD,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
package/dist/dispatch.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export interface DispatchOptions {
|
|
2
|
-
/** Absolute path to the guild root. */
|
|
3
|
-
home: string;
|
|
4
|
-
/** Commission specification — what needs to be done. */
|
|
5
|
-
spec: string;
|
|
6
|
-
/** Target workshop for the commission. */
|
|
7
|
-
workshop: string;
|
|
8
|
-
/** Target anima name. If provided, the commission is assigned immediately. */
|
|
9
|
-
anima?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface DispatchResult {
|
|
12
|
-
/** The ID of the created commission. */
|
|
13
|
-
commissionId: number;
|
|
14
|
-
/** Whether the commission was assigned to an anima. */
|
|
15
|
-
assigned: boolean;
|
|
16
|
-
/** The anima name if assigned. */
|
|
17
|
-
assignedTo?: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Post a commission to the guild.
|
|
21
|
-
*
|
|
22
|
-
* Creates a commission in the Ledger. If an anima is specified, validates that
|
|
23
|
-
* the anima exists and is active, then creates an assignment record.
|
|
24
|
-
*/
|
|
25
|
-
export declare function dispatch(opts: DispatchOptions): DispatchResult;
|
|
26
|
-
//# sourceMappingURL=dispatch.d.ts.map
|