@vinkius-core/mcp-fusion 2.6.0 → 2.8.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/dist/cli/fusion.d.ts +101 -0
- package/dist/cli/fusion.d.ts.map +1 -0
- package/dist/cli/fusion.js +333 -0
- package/dist/cli/fusion.js.map +1 -0
- package/dist/client/FusionClient.d.ts +122 -1
- package/dist/client/FusionClient.d.ts.map +1 -1
- package/dist/client/FusionClient.js +173 -11
- package/dist/client/FusionClient.js.map +1 -1
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/core/StandardSchema.d.ts +178 -0
- package/dist/core/StandardSchema.d.ts.map +1 -0
- package/dist/core/StandardSchema.js +166 -0
- package/dist/core/StandardSchema.js.map +1 -0
- package/dist/core/createGroup.d.ts +140 -0
- package/dist/core/createGroup.d.ts.map +1 -0
- package/dist/core/createGroup.js +133 -0
- package/dist/core/createGroup.js.map +1 -0
- package/dist/core/execution/ExecutionPipeline.d.ts.map +1 -1
- package/dist/core/execution/ExecutionPipeline.js +6 -2
- package/dist/core/execution/ExecutionPipeline.js.map +1 -1
- package/dist/core/index.d.ts +7 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/initFusion.d.ts +201 -0
- package/dist/core/initFusion.d.ts.map +1 -0
- package/dist/core/initFusion.js +134 -0
- package/dist/core/initFusion.js.map +1 -0
- package/dist/core/response.d.ts +49 -2
- package/dist/core/response.d.ts.map +1 -1
- package/dist/core/response.js +27 -5
- package/dist/core/response.js.map +1 -1
- package/dist/index.d.ts +57 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -4
- package/dist/index.js.map +1 -1
- package/dist/introspection/BehaviorDigest.d.ts +112 -0
- package/dist/introspection/BehaviorDigest.d.ts.map +1 -0
- package/dist/introspection/BehaviorDigest.js +146 -0
- package/dist/introspection/BehaviorDigest.js.map +1 -0
- package/dist/introspection/CapabilityLockfile.d.ts +259 -0
- package/dist/introspection/CapabilityLockfile.d.ts.map +1 -0
- package/dist/introspection/CapabilityLockfile.js +391 -0
- package/dist/introspection/CapabilityLockfile.js.map +1 -0
- package/dist/introspection/ContractAwareSelfHealing.d.ts +90 -0
- package/dist/introspection/ContractAwareSelfHealing.d.ts.map +1 -0
- package/dist/introspection/ContractAwareSelfHealing.js +132 -0
- package/dist/introspection/ContractAwareSelfHealing.js.map +1 -0
- package/dist/introspection/ContractDiff.d.ts +91 -0
- package/dist/introspection/ContractDiff.d.ts.map +1 -0
- package/dist/introspection/ContractDiff.js +466 -0
- package/dist/introspection/ContractDiff.js.map +1 -0
- package/dist/introspection/CryptoAttestation.d.ts +143 -0
- package/dist/introspection/CryptoAttestation.d.ts.map +1 -0
- package/dist/introspection/CryptoAttestation.js +194 -0
- package/dist/introspection/CryptoAttestation.js.map +1 -0
- package/dist/introspection/EntitlementScanner.d.ts +124 -0
- package/dist/introspection/EntitlementScanner.d.ts.map +1 -0
- package/dist/introspection/EntitlementScanner.js +244 -0
- package/dist/introspection/EntitlementScanner.js.map +1 -0
- package/dist/introspection/GovernanceObserver.d.ts +88 -0
- package/dist/introspection/GovernanceObserver.d.ts.map +1 -0
- package/dist/introspection/GovernanceObserver.js +132 -0
- package/dist/introspection/GovernanceObserver.js.map +1 -0
- package/dist/introspection/SemanticProbe.d.ts +207 -0
- package/dist/introspection/SemanticProbe.d.ts.map +1 -0
- package/dist/introspection/SemanticProbe.js +255 -0
- package/dist/introspection/SemanticProbe.js.map +1 -0
- package/dist/introspection/TokenEconomics.d.ts +210 -0
- package/dist/introspection/TokenEconomics.d.ts.map +1 -0
- package/dist/introspection/TokenEconomics.js +286 -0
- package/dist/introspection/TokenEconomics.js.map +1 -0
- package/dist/introspection/ToolContract.d.ts +159 -0
- package/dist/introspection/ToolContract.d.ts.map +1 -0
- package/dist/introspection/ToolContract.js +191 -0
- package/dist/introspection/ToolContract.js.map +1 -0
- package/dist/introspection/canonicalize.d.ts +20 -0
- package/dist/introspection/canonicalize.d.ts.map +1 -0
- package/dist/introspection/canonicalize.js +51 -0
- package/dist/introspection/canonicalize.js.map +1 -0
- package/dist/introspection/index.d.ts +20 -0
- package/dist/introspection/index.d.ts.map +1 -1
- package/dist/introspection/index.js +20 -0
- package/dist/introspection/index.js.map +1 -1
- package/dist/observability/DebugObserver.d.ts +26 -1
- package/dist/observability/DebugObserver.d.ts.map +1 -1
- package/dist/observability/DebugObserver.js +8 -1
- package/dist/observability/DebugObserver.js.map +1 -1
- package/dist/observability/index.d.ts +1 -1
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js.map +1 -1
- package/dist/presenter/ZodDescriptionExtractor.d.ts +54 -0
- package/dist/presenter/ZodDescriptionExtractor.d.ts.map +1 -0
- package/dist/presenter/ZodDescriptionExtractor.js +131 -0
- package/dist/presenter/ZodDescriptionExtractor.js.map +1 -0
- package/dist/presenter/definePresenter.d.ts +172 -0
- package/dist/presenter/definePresenter.d.ts.map +1 -0
- package/dist/presenter/definePresenter.js +96 -0
- package/dist/presenter/definePresenter.js.map +1 -0
- package/dist/presenter/index.d.ts +3 -0
- package/dist/presenter/index.d.ts.map +1 -1
- package/dist/presenter/index.js +4 -0
- package/dist/presenter/index.js.map +1 -1
- package/dist/server/DevServer.d.ts +96 -0
- package/dist/server/DevServer.d.ts.map +1 -0
- package/dist/server/DevServer.js +187 -0
- package/dist/server/DevServer.js.map +1 -0
- package/dist/server/ServerAttachment.d.ts +41 -0
- package/dist/server/ServerAttachment.d.ts.map +1 -1
- package/dist/server/ServerAttachment.js +25 -1
- package/dist/server/ServerAttachment.js.map +1 -1
- package/dist/server/autoDiscover.d.ts +63 -0
- package/dist/server/autoDiscover.d.ts.map +1 -0
- package/dist/server/autoDiscover.js +157 -0
- package/dist/server/autoDiscover.js.map +1 -0
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +4 -0
- package/dist/server/index.js.map +1 -1
- package/dist/state-sync/PolicyValidator.d.ts +36 -0
- package/dist/state-sync/PolicyValidator.d.ts.map +1 -1
- package/dist/state-sync/PolicyValidator.js +35 -0
- package/dist/state-sync/PolicyValidator.js.map +1 -1
- package/dist/state-sync/ResponseDecorator.d.ts.map +1 -1
- package/dist/state-sync/ResponseDecorator.js +2 -1
- package/dist/state-sync/ResponseDecorator.js.map +1 -1
- package/dist/state-sync/StateSyncLayer.d.ts +5 -4
- package/dist/state-sync/StateSyncLayer.d.ts.map +1 -1
- package/dist/state-sync/StateSyncLayer.js +35 -4
- package/dist/state-sync/StateSyncLayer.js.map +1 -1
- package/dist/state-sync/index.d.ts +3 -1
- package/dist/state-sync/index.d.ts.map +1 -1
- package/dist/state-sync/index.js +1 -0
- package/dist/state-sync/index.js.map +1 -1
- package/dist/state-sync/types.d.ts +62 -0
- package/dist/state-sync/types.d.ts.map +1 -1
- package/package.json +45 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createGroup() — Functional Tool Group Compiler
|
|
3
|
+
*
|
|
4
|
+
* A lightweight, closure-based alternative to the class-heavy
|
|
5
|
+
* `GroupedToolBuilder`. Instead of maintaining internal state via `this._x`,
|
|
6
|
+
* it compiles a group config into a frozen object with pre-composed
|
|
7
|
+
* middleware and an O(1) dispatch function.
|
|
8
|
+
*
|
|
9
|
+
* **Why Functional?**
|
|
10
|
+
* - Closures minify 30-40% better than class methods (Terser can rename local vars)
|
|
11
|
+
* - No prototype chain overhead — zero `this` binding issues
|
|
12
|
+
* - Frozen return type prevents accidental mutation
|
|
13
|
+
* - Compatible with Edge Runtimes (Cloudflare Workers, Deno Deploy)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { createGroup, success } from '@vinkius-core/mcp-fusion';
|
|
18
|
+
*
|
|
19
|
+
* const billing = createGroup({
|
|
20
|
+
* name: 'billing',
|
|
21
|
+
* description: 'Invoice management',
|
|
22
|
+
* middleware: [requireAuth],
|
|
23
|
+
* actions: {
|
|
24
|
+
* get_invoice: {
|
|
25
|
+
* schema: z.object({ id: z.string() }),
|
|
26
|
+
* readOnly: true,
|
|
27
|
+
* handler: async (ctx, args) => success(await ctx.db.invoices.get(args.id)),
|
|
28
|
+
* },
|
|
29
|
+
* pay: {
|
|
30
|
+
* schema: z.object({ invoice_id: z.string(), amount: z.number() }),
|
|
31
|
+
* destructive: true,
|
|
32
|
+
* handler: async (ctx, args) => success(await ctx.db.payments.create(args)),
|
|
33
|
+
* },
|
|
34
|
+
* },
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* // billing.execute(ctx, 'get_invoice', { id: '123' })
|
|
38
|
+
* // billing.name === 'billing'
|
|
39
|
+
* // billing.actionNames === ['get_invoice', 'pay']
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @module
|
|
43
|
+
*/
|
|
44
|
+
import { type ZodObject, type ZodRawShape } from 'zod';
|
|
45
|
+
import { type ToolResponse } from '../core/response.js';
|
|
46
|
+
import { type MiddlewareFn } from '../core/types.js';
|
|
47
|
+
/**
|
|
48
|
+
* A single action definition within a group.
|
|
49
|
+
*/
|
|
50
|
+
export interface GroupAction<TContext> {
|
|
51
|
+
/** Human-readable description for the LLM */
|
|
52
|
+
readonly description?: string;
|
|
53
|
+
/** Zod schema for input validation */
|
|
54
|
+
readonly schema?: ZodObject<ZodRawShape>;
|
|
55
|
+
/** Mark as read-only */
|
|
56
|
+
readonly readOnly?: boolean;
|
|
57
|
+
/** Mark as destructive */
|
|
58
|
+
readonly destructive?: boolean;
|
|
59
|
+
/** Mark as idempotent */
|
|
60
|
+
readonly idempotent?: boolean;
|
|
61
|
+
/** Per-action middleware */
|
|
62
|
+
readonly middleware?: MiddlewareFn<TContext>[];
|
|
63
|
+
/** Handler function */
|
|
64
|
+
readonly handler: (ctx: TContext, args: Record<string, unknown>) => Promise<ToolResponse>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Full configuration for `createGroup()`.
|
|
68
|
+
*/
|
|
69
|
+
export interface GroupConfig<TContext> {
|
|
70
|
+
/** Group/tool name */
|
|
71
|
+
readonly name: string;
|
|
72
|
+
/** Description for the LLM */
|
|
73
|
+
readonly description?: string;
|
|
74
|
+
/** Capability tags */
|
|
75
|
+
readonly tags?: string[];
|
|
76
|
+
/** Shared middleware applied to ALL actions (outermost layer) */
|
|
77
|
+
readonly middleware?: MiddlewareFn<TContext>[];
|
|
78
|
+
/** Action definitions keyed by action name */
|
|
79
|
+
readonly actions: Record<string, GroupAction<TContext>>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A compiled, frozen group ready for execution.
|
|
83
|
+
*/
|
|
84
|
+
export interface CompiledGroup<TContext> {
|
|
85
|
+
/** Group/tool name */
|
|
86
|
+
readonly name: string;
|
|
87
|
+
/** Description */
|
|
88
|
+
readonly description: string | undefined;
|
|
89
|
+
/** Tags */
|
|
90
|
+
readonly tags: readonly string[];
|
|
91
|
+
/** List of action names */
|
|
92
|
+
readonly actionNames: readonly string[];
|
|
93
|
+
/**
|
|
94
|
+
* Execute an action by name.
|
|
95
|
+
*
|
|
96
|
+
* @param ctx - Application context
|
|
97
|
+
* @param action - Action name
|
|
98
|
+
* @param args - Input arguments
|
|
99
|
+
* @returns Tool response
|
|
100
|
+
* @throws If action name is unknown
|
|
101
|
+
*/
|
|
102
|
+
readonly execute: (ctx: TContext, action: string, args: Record<string, unknown>) => Promise<ToolResponse>;
|
|
103
|
+
/**
|
|
104
|
+
* Get metadata for a specific action.
|
|
105
|
+
*/
|
|
106
|
+
readonly getAction: (name: string) => Readonly<GroupAction<TContext>> | undefined;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Create a compiled, frozen tool group from a declarative config.
|
|
110
|
+
*
|
|
111
|
+
* The returned object has O(1) action dispatch via a pre-built Map.
|
|
112
|
+
* All middleware chains are pre-composed at creation time — zero
|
|
113
|
+
* runtime overhead on each call.
|
|
114
|
+
*
|
|
115
|
+
* @typeParam TContext - Application context type
|
|
116
|
+
* @param config - Group configuration with actions
|
|
117
|
+
* @returns A frozen {@link CompiledGroup} ready for execution
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* const tasks = createGroup({
|
|
122
|
+
* name: 'tasks',
|
|
123
|
+
* middleware: [logMiddleware],
|
|
124
|
+
* actions: {
|
|
125
|
+
* list: {
|
|
126
|
+
* readOnly: true,
|
|
127
|
+
* handler: async (ctx) => success(await ctx.db.tasks.findMany()),
|
|
128
|
+
* },
|
|
129
|
+
* create: {
|
|
130
|
+
* schema: z.object({ title: z.string() }),
|
|
131
|
+
* handler: async (ctx, args) => success(await ctx.db.tasks.create(args)),
|
|
132
|
+
* },
|
|
133
|
+
* },
|
|
134
|
+
* });
|
|
135
|
+
*
|
|
136
|
+
* const result = await tasks.execute(ctx, 'create', { title: 'Buy milk' });
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export declare function createGroup<TContext = void>(config: GroupConfig<TContext>): CompiledGroup<TContext>;
|
|
140
|
+
//# sourceMappingURL=createGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGroup.d.ts","sourceRoot":"","sources":["../../src/core/createGroup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AACvD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,QAAQ;IACjC,6CAA6C;IAC7C,QAAQ,CAAC,WAAW,CA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,MAAM,EAAE,CAAC;IACjC,2BAA2B;IAC3B,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1G;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,CAAC;CACrF;AA+BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,WAAW,CAAC,QAAQ,GAAG,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC,CAmDnG"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createGroup() — Functional Tool Group Compiler
|
|
3
|
+
*
|
|
4
|
+
* A lightweight, closure-based alternative to the class-heavy
|
|
5
|
+
* `GroupedToolBuilder`. Instead of maintaining internal state via `this._x`,
|
|
6
|
+
* it compiles a group config into a frozen object with pre-composed
|
|
7
|
+
* middleware and an O(1) dispatch function.
|
|
8
|
+
*
|
|
9
|
+
* **Why Functional?**
|
|
10
|
+
* - Closures minify 30-40% better than class methods (Terser can rename local vars)
|
|
11
|
+
* - No prototype chain overhead — zero `this` binding issues
|
|
12
|
+
* - Frozen return type prevents accidental mutation
|
|
13
|
+
* - Compatible with Edge Runtimes (Cloudflare Workers, Deno Deploy)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { createGroup, success } from '@vinkius-core/mcp-fusion';
|
|
18
|
+
*
|
|
19
|
+
* const billing = createGroup({
|
|
20
|
+
* name: 'billing',
|
|
21
|
+
* description: 'Invoice management',
|
|
22
|
+
* middleware: [requireAuth],
|
|
23
|
+
* actions: {
|
|
24
|
+
* get_invoice: {
|
|
25
|
+
* schema: z.object({ id: z.string() }),
|
|
26
|
+
* readOnly: true,
|
|
27
|
+
* handler: async (ctx, args) => success(await ctx.db.invoices.get(args.id)),
|
|
28
|
+
* },
|
|
29
|
+
* pay: {
|
|
30
|
+
* schema: z.object({ invoice_id: z.string(), amount: z.number() }),
|
|
31
|
+
* destructive: true,
|
|
32
|
+
* handler: async (ctx, args) => success(await ctx.db.payments.create(args)),
|
|
33
|
+
* },
|
|
34
|
+
* },
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* // billing.execute(ctx, 'get_invoice', { id: '123' })
|
|
38
|
+
* // billing.name === 'billing'
|
|
39
|
+
* // billing.actionNames === ['get_invoice', 'pay']
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @module
|
|
43
|
+
*/
|
|
44
|
+
import {} from 'zod';
|
|
45
|
+
import {} from '../core/response.js';
|
|
46
|
+
import {} from '../core/types.js';
|
|
47
|
+
// ── Middleware Composition ────────────────────────────────
|
|
48
|
+
/**
|
|
49
|
+
* Compose an array of middleware into a single function.
|
|
50
|
+
* Right-to-left composition: last middleware is innermost (closest to handler).
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
function composeMiddleware(globalMiddleware, actionMiddleware, handler) {
|
|
54
|
+
const allMiddleware = [...globalMiddleware, ...actionMiddleware];
|
|
55
|
+
if (allMiddleware.length === 0) {
|
|
56
|
+
return handler;
|
|
57
|
+
}
|
|
58
|
+
// Build the chain from right to left
|
|
59
|
+
return allMiddleware.reduceRight((next, mw) => (ctx, args) => mw(ctx, args, () => next(ctx, args)), handler);
|
|
60
|
+
}
|
|
61
|
+
// ── Factory ──────────────────────────────────────────────
|
|
62
|
+
/**
|
|
63
|
+
* Create a compiled, frozen tool group from a declarative config.
|
|
64
|
+
*
|
|
65
|
+
* The returned object has O(1) action dispatch via a pre-built Map.
|
|
66
|
+
* All middleware chains are pre-composed at creation time — zero
|
|
67
|
+
* runtime overhead on each call.
|
|
68
|
+
*
|
|
69
|
+
* @typeParam TContext - Application context type
|
|
70
|
+
* @param config - Group configuration with actions
|
|
71
|
+
* @returns A frozen {@link CompiledGroup} ready for execution
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const tasks = createGroup({
|
|
76
|
+
* name: 'tasks',
|
|
77
|
+
* middleware: [logMiddleware],
|
|
78
|
+
* actions: {
|
|
79
|
+
* list: {
|
|
80
|
+
* readOnly: true,
|
|
81
|
+
* handler: async (ctx) => success(await ctx.db.tasks.findMany()),
|
|
82
|
+
* },
|
|
83
|
+
* create: {
|
|
84
|
+
* schema: z.object({ title: z.string() }),
|
|
85
|
+
* handler: async (ctx, args) => success(await ctx.db.tasks.create(args)),
|
|
86
|
+
* },
|
|
87
|
+
* },
|
|
88
|
+
* });
|
|
89
|
+
*
|
|
90
|
+
* const result = await tasks.execute(ctx, 'create', { title: 'Buy milk' });
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export function createGroup(config) {
|
|
94
|
+
const globalMiddleware = config.middleware ?? [];
|
|
95
|
+
const actionNames = Object.keys(config.actions);
|
|
96
|
+
// Pre-compose middleware chains for each action (O(1) dispatch)
|
|
97
|
+
const dispatchMap = new Map();
|
|
98
|
+
for (const [name, action] of Object.entries(config.actions)) {
|
|
99
|
+
const compiled = composeMiddleware(globalMiddleware, action.middleware ?? [], action.handler);
|
|
100
|
+
dispatchMap.set(name, compiled);
|
|
101
|
+
}
|
|
102
|
+
// Pre-validate action args using Zod schemas
|
|
103
|
+
const schemaMap = new Map();
|
|
104
|
+
for (const [name, action] of Object.entries(config.actions)) {
|
|
105
|
+
if (action.schema) {
|
|
106
|
+
schemaMap.set(name, action.schema);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const execute = async (ctx, action, args) => {
|
|
110
|
+
const chain = dispatchMap.get(action);
|
|
111
|
+
if (!chain) {
|
|
112
|
+
throw new Error(`Unknown action "${action}" in group "${config.name}". Available: ${actionNames.join(', ')}`);
|
|
113
|
+
}
|
|
114
|
+
// Validate with Zod if schema is defined
|
|
115
|
+
const schema = schemaMap.get(action);
|
|
116
|
+
if (schema) {
|
|
117
|
+
schema.strict().parse(args);
|
|
118
|
+
}
|
|
119
|
+
return chain(ctx, args);
|
|
120
|
+
};
|
|
121
|
+
const getAction = (name) => {
|
|
122
|
+
return config.actions[name];
|
|
123
|
+
};
|
|
124
|
+
return Object.freeze({
|
|
125
|
+
name: config.name,
|
|
126
|
+
description: config.description,
|
|
127
|
+
tags: Object.freeze(config.tags ?? []),
|
|
128
|
+
actionNames: Object.freeze(actionNames),
|
|
129
|
+
execute,
|
|
130
|
+
getAction,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=createGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGroup.js","sourceRoot":"","sources":["../../src/core/createGroup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAAoC,MAAM,KAAK,CAAC;AACvD,OAAO,EAAqB,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAqB,MAAM,kBAAkB,CAAC;AAoErD,6DAA6D;AAE7D;;;;GAIG;AACH,SAAS,iBAAiB,CACtB,gBAA0C,EAC1C,gBAA0C,EAC1C,OAAgF;IAEhF,MAAM,aAAa,GAAG,CAAC,GAAG,gBAAgB,EAAE,GAAG,gBAAgB,CAAC,CAAC;IAEjE,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,qCAAqC;IACrC,OAAO,aAAa,CAAC,WAAW,CAC5B,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,CACT,CAAC,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C,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,eAAe,MAAM,CAAC,IAAI,iBAAiB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClH,CAAC;QAED,yCAAyC;QACzC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,MAAM,EAAE,CAAC;YACT,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,CAAC,IAAY,EAA+C,EAAE;QAC5E,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACtC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;QACvC,OAAO;QACP,SAAS;KACZ,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExecutionPipeline.d.ts","sourceRoot":"","sources":["../../../src/core/execution/ExecutionPipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AACvD,OAAO,EAAE,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"ExecutionPipeline.d.ts","sourceRoot":"","sources":["../../../src/core/execution/ExecutionPipeline.ts"],"names":[],"mappings":"AAAA;;;;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AAO,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EACnC,kBAAkB,EAAE,MAAM,GAC3B,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAalC;AAED,kEAAkE;AAClE,wBAAgB,YAAY,CAAC,QAAQ,EACjC,OAAO,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EACnC,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,EAClC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA0BjC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,QAAQ,CAAC,QAAQ,EACnC,OAAO,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EACnC,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,EAClC,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,YAAY,CAAC,EAAE,YAAY,EAC3B,OAAO,UAAQ,EACf,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,YAAY,CAAC,CA8BvB;AAQD;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACpC,QAAQ,CAAC,OAAO,EAAE,yBAAyB,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;CACxE"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Pipeline: ensureBuilt → parseDiscriminator → resolveAction → validateArgs → runChain
|
|
11
11
|
*/
|
|
12
12
|
import {} from 'zod';
|
|
13
|
-
import { error, escapeXml } from '../response.js';
|
|
13
|
+
import { error, escapeXml, toolError } from '../response.js';
|
|
14
14
|
import { formatValidationError } from './ValidationErrorFormatter.js';
|
|
15
15
|
import { succeed, fail } from '../result.js';
|
|
16
16
|
import {} from '../types.js';
|
|
@@ -102,7 +102,11 @@ export async function runChain(execCtx, resolved, ctx, args, progressSink, rethr
|
|
|
102
102
|
if (rethrow)
|
|
103
103
|
throw err;
|
|
104
104
|
const message = err instanceof Error ? err.message : String(err);
|
|
105
|
-
return
|
|
105
|
+
return toolError('INTERNAL_ERROR', {
|
|
106
|
+
message: `[${execCtx.toolName}/${resolved.discriminatorValue}] ${message}`,
|
|
107
|
+
suggestion: 'This may be a transient error. Retry the same call with identical parameters.',
|
|
108
|
+
severity: 'error',
|
|
109
|
+
});
|
|
106
110
|
}
|
|
107
111
|
}
|
|
108
112
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExecutionPipeline.js","sourceRoot":"","sources":["../../../src/core/execution/ExecutionPipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAoC,MAAM,KAAK,CAAC;AACvD,OAAO,EAAqB,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ExecutionPipeline.js","sourceRoot":"","sources":["../../../src/core/execution/ExecutionPipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAoC,MAAM,KAAK,CAAC;AACvD,OAAO,EAAqB,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAe,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAuB,MAAM,aAAa,CAAC;AAClD,OAAO,EAAsB,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAqB,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAoBrE,4DAA4D;AAE5D,sDAAsD;AACtD,MAAM,UAAU,kBAAkB,CAC9B,OAAmC,EACnC,IAA6B;IAE7B,MAAM,GAAG,GA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IAAI,QAAQ,CAAC,kBAAkB,KAAK,OAAO,EAAE;YAC1E,UAAU,EAAE,+EAA+E;YAC3F,QAAQ,EAAE,OAAO;SACpB,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAkBD,gBAAgB;AAChB,SAAS,yBAAyB,CAAC,KAAc;IAC7C,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK;QACjB,KAA8B,CAAC,OAAO,KAAK,yBAAyB,CACxE,CAAC;AACN,CAAC;AAED;;;;;;;;;;GAUG;AACH,KAAK,UAAU,cAAc,CACzB,GAAqD,EACrD,YAA2B,EAC3B,MAAoB;IAEpB,IAAI,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAE9B,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAClB,sDAAsD;QACtD,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YAClB,qDAAqD;YACrD,MAAM,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;YAC9C,OAAO,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,YAAY,IAAI,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAChD,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC;AACxB,CAAC"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* barrel files and re-aggregated in src/index.ts.
|
|
11
11
|
*/
|
|
12
12
|
export { success, error, required, toonSuccess, toolError } from './response.js';
|
|
13
|
-
export type { ToolResponse, ToolErrorOptions } from './response.js';
|
|
13
|
+
export type { ToolResponse, ToolErrorOptions, ErrorCode, ErrorSeverity } from './response.js';
|
|
14
14
|
export { succeed, fail } from './result.js';
|
|
15
15
|
export type { Result, Success, Failure } from './result.js';
|
|
16
16
|
export type { ToolBuilder, ActionMetadata, InternalAction, MiddlewareFn, ActionConfig, } from './types.js';
|
|
@@ -26,4 +26,10 @@ export type { ConcurrencyConfig } from './execution/index.js';
|
|
|
26
26
|
export type { EgressConfig } from './execution/index.js';
|
|
27
27
|
export { defineMiddleware, resolveMiddleware } from './middleware/index.js';
|
|
28
28
|
export type { MiddlewareDefinition, MergeContext, InferContextOut } from './middleware/index.js';
|
|
29
|
+
export { initFusion } from './initFusion.js';
|
|
30
|
+
export type { FusionInstance, FusionToolConfig } from './initFusion.js';
|
|
31
|
+
export { createGroup } from './createGroup.js';
|
|
32
|
+
export type { GroupConfig, GroupAction, CompiledGroup } from './createGroup.js';
|
|
33
|
+
export { toStandardValidator, fromZodSchema, isStandardSchema, autoValidator, } from './StandardSchema.js';
|
|
34
|
+
export type { StandardSchemaV1, StandardSchemaIssue, InferStandardOutput, FusionValidator, ValidationResult, } from './StandardSchema.js';
|
|
29
35
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjF,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjF,YAAY,EAAE,YAAY,EAAE,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AAM,iBAAiB,CAAC;AAGxE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGhF,OAAO,EACH,mBAAmB,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,GACtE,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACR,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAC1D,eAAe,EAAE,gBAAgB,GACpC,MAAM,qBAAqB,CAAC"}
|
package/dist/core/index.js
CHANGED
|
@@ -22,4 +22,10 @@ export { generateToonDescription } from './schema/index.js';
|
|
|
22
22
|
export { progress } from './execution/index.js';
|
|
23
23
|
// ── Middleware (context derivation) ──────────────────────
|
|
24
24
|
export { defineMiddleware, resolveMiddleware } from './middleware/index.js';
|
|
25
|
+
// ── Fusion Initializer (tRPC-style) ─────────────────────
|
|
26
|
+
export { initFusion } from './initFusion.js';
|
|
27
|
+
// ── Functional Core ──────────────────────────────────────
|
|
28
|
+
export { createGroup } from './createGroup.js';
|
|
29
|
+
// ── Standard Schema ──────────────────────────────────────
|
|
30
|
+
export { toStandardValidator, fromZodSchema, isStandardSchema, autoValidator, } from './StandardSchema.js';
|
|
25
31
|
//# sourceMappingURL=index.js.map
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,4DAA4D;AAC5D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAU5C,4DAA4D;AAC5D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAo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 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* initFusion() — tRPC-Style Context Initialization
|
|
3
|
+
*
|
|
4
|
+
* Eliminates the need to pass `<AppContext>` as a generic parameter
|
|
5
|
+
* everywhere. Define your context type once, and every `f.tool()`,
|
|
6
|
+
* `f.presenter()`, `f.prompt()`, and `f.middleware()` call
|
|
7
|
+
* automatically inherits it.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // src/fusion.ts — defined once in the project
|
|
12
|
+
* import { initFusion } from '@vinkius-core/mcp-fusion';
|
|
13
|
+
*
|
|
14
|
+
* interface AppContext {
|
|
15
|
+
* db: PrismaClient;
|
|
16
|
+
* user: { id: string; role: string };
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* export const f = initFusion<AppContext>();
|
|
20
|
+
*
|
|
21
|
+
* // src/tools/billing.ts — daily usage, super clean
|
|
22
|
+
* import { f } from '../fusion';
|
|
23
|
+
* import { z } from 'zod';
|
|
24
|
+
*
|
|
25
|
+
* export const getInvoice = f.tool({
|
|
26
|
+
* name: 'billing.get_invoice',
|
|
27
|
+
* input: z.object({ id: z.string() }),
|
|
28
|
+
* handler: async ({ input, ctx }) => {
|
|
29
|
+
* // ctx is fully typed as AppContext!
|
|
30
|
+
* return await ctx.db.invoices.findUnique(input.id);
|
|
31
|
+
* },
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @module
|
|
36
|
+
*/
|
|
37
|
+
import { type ZodType, type ZodObject, type ZodRawShape } from 'zod';
|
|
38
|
+
import { GroupedToolBuilder } from './builder/GroupedToolBuilder.js';
|
|
39
|
+
import { type ToolResponse } from './response.js';
|
|
40
|
+
import { type MiddlewareFn } from './types.js';
|
|
41
|
+
import { ToolRegistry } from './registry/ToolRegistry.js';
|
|
42
|
+
import { type Presenter } from '../presenter/Presenter.js';
|
|
43
|
+
import { type PresenterConfig } from '../presenter/definePresenter.js';
|
|
44
|
+
import { type MiddlewareDefinition } from './middleware/index.js';
|
|
45
|
+
import { type ToolConfig } from './builder/defineTool.js';
|
|
46
|
+
import { type PromptBuilder, type PromptConfig } from '../prompt/types.js';
|
|
47
|
+
import { type ParamsMap, type InferParams } from './builder/ParamDescriptors.js';
|
|
48
|
+
/**
|
|
49
|
+
* Ergonomic tool config for `f.tool()`.
|
|
50
|
+
*
|
|
51
|
+
* The `handler` receives `{ input, ctx }` instead of `(ctx, args)` —
|
|
52
|
+
* a more intuitive destructured pattern inspired by tRPC v11.
|
|
53
|
+
*
|
|
54
|
+
* @typeParam TContext - Application context (inherited from `initFusion`)
|
|
55
|
+
* @typeParam TInput - Input schema type (inferred from `input`)
|
|
56
|
+
*/
|
|
57
|
+
export interface FusionToolConfig<TContext, TInput extends ZodObject<ZodRawShape> | ParamsMap = ParamsMap> {
|
|
58
|
+
/** Tool name — use `domain.action` convention for flat exposition */
|
|
59
|
+
readonly name: string;
|
|
60
|
+
/** Human-readable description for the LLM */
|
|
61
|
+
readonly description?: string;
|
|
62
|
+
/** Input schema (Zod object or JSON param descriptors) */
|
|
63
|
+
readonly input?: TInput;
|
|
64
|
+
/** Capability tags for filtering */
|
|
65
|
+
readonly tags?: string[];
|
|
66
|
+
/** MCP annotations */
|
|
67
|
+
readonly annotations?: Record<string, unknown>;
|
|
68
|
+
/** Mark as read-only (no side effects) */
|
|
69
|
+
readonly readOnly?: boolean;
|
|
70
|
+
/** Mark as destructive (irreversible) */
|
|
71
|
+
readonly destructive?: boolean;
|
|
72
|
+
/** Mark as idempotent (safe to retry) */
|
|
73
|
+
readonly idempotent?: boolean;
|
|
74
|
+
/** Global middleware */
|
|
75
|
+
readonly middleware?: MiddlewareFn<TContext>[];
|
|
76
|
+
/** MVA Presenter for automatic response formatting */
|
|
77
|
+
readonly returns?: Presenter<unknown>;
|
|
78
|
+
/** Handler function — receives destructured `{ input, ctx }` */
|
|
79
|
+
readonly handler: (args: {
|
|
80
|
+
input: TInput extends ZodObject<ZodRawShape> ? TInput['_output'] : TInput extends ParamsMap ? InferParams<TInput> : Record<string, unknown>;
|
|
81
|
+
ctx: TContext;
|
|
82
|
+
}) => Promise<ToolResponse | unknown>;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The initialized Fusion instance.
|
|
86
|
+
*
|
|
87
|
+
* Provides context-typed factory methods for tools, presenters,
|
|
88
|
+
* prompts, middleware, and registry. Every method automatically
|
|
89
|
+
* inherits the `TContext` defined in `initFusion<TContext>()`.
|
|
90
|
+
*
|
|
91
|
+
* @typeParam TContext - The application context type
|
|
92
|
+
*/
|
|
93
|
+
export interface FusionInstance<TContext> {
|
|
94
|
+
/**
|
|
95
|
+
* Define a tool with automatic context typing.
|
|
96
|
+
*
|
|
97
|
+
* The handler receives `{ input, ctx }` where `ctx` is your `AppContext`
|
|
98
|
+
* and `input` is fully typed from the `input` schema.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* const myTool = f.tool({
|
|
103
|
+
* name: 'users.list',
|
|
104
|
+
* input: z.object({ limit: z.number().optional() }),
|
|
105
|
+
* readOnly: true,
|
|
106
|
+
* handler: async ({ input, ctx }) => {
|
|
107
|
+
* return await ctx.db.users.findMany({ take: input.limit });
|
|
108
|
+
* },
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
tool<TInput extends ZodObject<ZodRawShape> | ParamsMap>(config: FusionToolConfig<TContext, TInput>): GroupedToolBuilder<TContext>;
|
|
113
|
+
/**
|
|
114
|
+
* Define a Presenter with the standard object-config API.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* const InvoicePresenter = f.presenter({
|
|
119
|
+
* name: 'Invoice',
|
|
120
|
+
* schema: invoiceSchema,
|
|
121
|
+
* rules: ['CRITICAL: amount_cents is in CENTS.'],
|
|
122
|
+
* ui: (inv) => [ui.echarts({ ... })],
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
presenter<TSchema extends ZodType>(config: PresenterConfig<TSchema['_output']> & {
|
|
127
|
+
schema: TSchema;
|
|
128
|
+
}): Presenter<TSchema['_output']>;
|
|
129
|
+
/**
|
|
130
|
+
* Define a prompt with automatic context typing.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* const greetPrompt = f.prompt('greet', {
|
|
135
|
+
* args: z.object({ name: z.string() }),
|
|
136
|
+
* handler: async (ctx, args) => ({
|
|
137
|
+
* messages: [PromptMessage.user(`Hello ${args.name}`)],
|
|
138
|
+
* }),
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
prompt(name: string, config: Omit<PromptConfig<TContext>, 'handler'> & {
|
|
143
|
+
handler: PromptConfig<TContext>['handler'];
|
|
144
|
+
}): PromptBuilder<TContext>;
|
|
145
|
+
/**
|
|
146
|
+
* Define a context-derivation middleware.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* const withUser = f.middleware(async (ctx) => ({
|
|
151
|
+
* user: await ctx.db.users.findUnique(ctx.userId),
|
|
152
|
+
* }));
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
middleware<TDerived extends Record<string, unknown>>(derive: (ctx: TContext) => TDerived | Promise<TDerived>): MiddlewareDefinition<TContext, TDerived>;
|
|
156
|
+
/**
|
|
157
|
+
* Create a fully configured tool using the standard `defineTool()` config.
|
|
158
|
+
* For power users who want the full `ToolConfig` API with context typing.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* const platform = f.defineTool('platform', {
|
|
163
|
+
* shared: { workspace_id: 'string' },
|
|
164
|
+
* groups: { users: { actions: { list: { handler: listUsers } } } },
|
|
165
|
+
* });
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
defineTool(name: string, config: ToolConfig<TContext>): GroupedToolBuilder<TContext>;
|
|
169
|
+
/**
|
|
170
|
+
* Create a pre-typed ToolRegistry ready for registration.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* const registry = f.registry();
|
|
175
|
+
* registry.register(myTool);
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
registry(): ToolRegistry<TContext>;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Initialize a Fusion instance with a fixed context type.
|
|
182
|
+
*
|
|
183
|
+
* Call once per project. All factory methods on the returned instance
|
|
184
|
+
* automatically inherit the context type — zero generic repetition.
|
|
185
|
+
*
|
|
186
|
+
* @typeParam TContext - The application-level context type
|
|
187
|
+
* @returns A {@link FusionInstance} with context-typed factories
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* // Single definition, typically in src/fusion.ts
|
|
192
|
+
* export const f = initFusion<AppContext>();
|
|
193
|
+
*
|
|
194
|
+
* // Usage anywhere in the project
|
|
195
|
+
* const tool = f.tool({ name: 'tasks.list', handler: ... });
|
|
196
|
+
* const presenter = f.presenter({ name: 'Task', schema: taskSchema });
|
|
197
|
+
* const registry = f.registry();
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
export declare function initFusion<TContext = void>(): FusionInstance<TContext>;
|
|
201
|
+
//# sourceMappingURL=initFusion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initFusion.d.ts","sourceRoot":"","sources":["../../src/core/initFusion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,KAAK,YAAY,EAA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