@triggerix-ai/fn 0.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 imba97 <https://github.com/imba97>
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/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";const prompt=require("@triggerix-ai/prompt"),schema=require("@triggerix-ai/schema"),p="Generate Triggerix interactive output. Call this tool to produce a complete UI bundle: a list of atomic components to render, plus a list of triggers that bind user interactions to backend actions. The output schema constrains event types, action types, and component types to those registered by the developer.",l="Generate Triggerix triggers. Call this tool to produce a list of triggers that bind events to actions under given conditions. The output schema constrains event types and action types to those registered by the developer.";function defineFunctionCalling(e){const{registry:o,component:t}=e,n=e.toolName??"generate_triggerix_output",r=e.toolDescription??(t?p:l),i=prompt.generateSystemPrompt({registry:o,component:t}),s=schema.generateToolSchema({registry:o,component:t});return{systemPrompt:i,tools:[{type:"function",function:{name:n,description:r,parameters:s}}]}}exports.defineFunctionCalling=defineFunctionCalling;
@@ -0,0 +1,46 @@
1
+ import { ComponentRegistry } from '@triggerix-ai/component';
2
+ import { AIRegistry } from '@triggerix-ai/registry';
3
+ import { JSONSchema } from '@triggerix-ai/schema';
4
+
5
+ /** Options accepted by `defineFunctionCalling`. */
6
+ interface DefineFunctionCallingOptions {
7
+ /** Registry of AI-aware events, actions, conditions. */
8
+ registry: AIRegistry;
9
+ /** When provided, switches to component-generation mode. */
10
+ component?: ComponentRegistry;
11
+ /** Override the tool name. Defaults to `'generate_triggerix_output'`. */
12
+ toolName?: string;
13
+ /** Override the tool description (defaults to a generic explanation). */
14
+ toolDescription?: string;
15
+ }
16
+ /**
17
+ * A tool definition in OpenAI-compatible format.
18
+ * Compatible with OpenAI, Anthropic (with light adaptation), and most LLM SDKs.
19
+ */
20
+ interface ToolDefinition {
21
+ type: 'function';
22
+ function: {
23
+ name: string;
24
+ description: string;
25
+ parameters: JSONSchema;
26
+ };
27
+ }
28
+ /** Result of `defineFunctionCalling`. */
29
+ interface FunctionCallingResult {
30
+ /** Complete system prompt (protocol spec + dynamic registry content). */
31
+ systemPrompt: string;
32
+ /** Tool definitions ready to pass to the LLM. */
33
+ tools: ToolDefinition[];
34
+ }
35
+
36
+ /**
37
+ * Build the complete `system` + `tools` payload for an LLM Function Calling call.
38
+ *
39
+ * Two output modes:
40
+ * - **Component-generation mode** (with `component`): the tool returns `{ components, triggers }`
41
+ * - **Trigger-only mode** (no `component`): the tool returns `{ triggers }` only
42
+ */
43
+ declare function defineFunctionCalling(options: DefineFunctionCallingOptions): FunctionCallingResult;
44
+
45
+ export { defineFunctionCalling };
46
+ export type { DefineFunctionCallingOptions, FunctionCallingResult, ToolDefinition };
@@ -0,0 +1,46 @@
1
+ import { ComponentRegistry } from '@triggerix-ai/component';
2
+ import { AIRegistry } from '@triggerix-ai/registry';
3
+ import { JSONSchema } from '@triggerix-ai/schema';
4
+
5
+ /** Options accepted by `defineFunctionCalling`. */
6
+ interface DefineFunctionCallingOptions {
7
+ /** Registry of AI-aware events, actions, conditions. */
8
+ registry: AIRegistry;
9
+ /** When provided, switches to component-generation mode. */
10
+ component?: ComponentRegistry;
11
+ /** Override the tool name. Defaults to `'generate_triggerix_output'`. */
12
+ toolName?: string;
13
+ /** Override the tool description (defaults to a generic explanation). */
14
+ toolDescription?: string;
15
+ }
16
+ /**
17
+ * A tool definition in OpenAI-compatible format.
18
+ * Compatible with OpenAI, Anthropic (with light adaptation), and most LLM SDKs.
19
+ */
20
+ interface ToolDefinition {
21
+ type: 'function';
22
+ function: {
23
+ name: string;
24
+ description: string;
25
+ parameters: JSONSchema;
26
+ };
27
+ }
28
+ /** Result of `defineFunctionCalling`. */
29
+ interface FunctionCallingResult {
30
+ /** Complete system prompt (protocol spec + dynamic registry content). */
31
+ systemPrompt: string;
32
+ /** Tool definitions ready to pass to the LLM. */
33
+ tools: ToolDefinition[];
34
+ }
35
+
36
+ /**
37
+ * Build the complete `system` + `tools` payload for an LLM Function Calling call.
38
+ *
39
+ * Two output modes:
40
+ * - **Component-generation mode** (with `component`): the tool returns `{ components, triggers }`
41
+ * - **Trigger-only mode** (no `component`): the tool returns `{ triggers }` only
42
+ */
43
+ declare function defineFunctionCalling(options: DefineFunctionCallingOptions): FunctionCallingResult;
44
+
45
+ export { defineFunctionCalling };
46
+ export type { DefineFunctionCallingOptions, FunctionCallingResult, ToolDefinition };
@@ -0,0 +1,46 @@
1
+ import { ComponentRegistry } from '@triggerix-ai/component';
2
+ import { AIRegistry } from '@triggerix-ai/registry';
3
+ import { JSONSchema } from '@triggerix-ai/schema';
4
+
5
+ /** Options accepted by `defineFunctionCalling`. */
6
+ interface DefineFunctionCallingOptions {
7
+ /** Registry of AI-aware events, actions, conditions. */
8
+ registry: AIRegistry;
9
+ /** When provided, switches to component-generation mode. */
10
+ component?: ComponentRegistry;
11
+ /** Override the tool name. Defaults to `'generate_triggerix_output'`. */
12
+ toolName?: string;
13
+ /** Override the tool description (defaults to a generic explanation). */
14
+ toolDescription?: string;
15
+ }
16
+ /**
17
+ * A tool definition in OpenAI-compatible format.
18
+ * Compatible with OpenAI, Anthropic (with light adaptation), and most LLM SDKs.
19
+ */
20
+ interface ToolDefinition {
21
+ type: 'function';
22
+ function: {
23
+ name: string;
24
+ description: string;
25
+ parameters: JSONSchema;
26
+ };
27
+ }
28
+ /** Result of `defineFunctionCalling`. */
29
+ interface FunctionCallingResult {
30
+ /** Complete system prompt (protocol spec + dynamic registry content). */
31
+ systemPrompt: string;
32
+ /** Tool definitions ready to pass to the LLM. */
33
+ tools: ToolDefinition[];
34
+ }
35
+
36
+ /**
37
+ * Build the complete `system` + `tools` payload for an LLM Function Calling call.
38
+ *
39
+ * Two output modes:
40
+ * - **Component-generation mode** (with `component`): the tool returns `{ components, triggers }`
41
+ * - **Trigger-only mode** (no `component`): the tool returns `{ triggers }` only
42
+ */
43
+ declare function defineFunctionCalling(options: DefineFunctionCallingOptions): FunctionCallingResult;
44
+
45
+ export { defineFunctionCalling };
46
+ export type { DefineFunctionCallingOptions, FunctionCallingResult, ToolDefinition };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{generateSystemPrompt as a}from"@triggerix-ai/prompt";import{generateToolSchema as c}from"@triggerix-ai/schema";const p="Generate Triggerix interactive output. Call this tool to produce a complete UI bundle: a list of atomic components to render, plus a list of triggers that bind user interactions to backend actions. The output schema constrains event types, action types, and component types to those registered by the developer.",g="Generate Triggerix triggers. Call this tool to produce a list of triggers that bind events to actions under given conditions. The output schema constrains event types and action types to those registered by the developer.";function l(e){const{registry:o,component:t}=e,n=e.toolName??"generate_triggerix_output",r=e.toolDescription??(t?p:g),i=a({registry:o,component:t}),s=c({registry:o,component:t});return{systemPrompt:i,tools:[{type:"function",function:{name:n,description:r,parameters:s}}]}}export{l as defineFunctionCalling};
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@triggerix-ai/fn",
3
+ "type": "module",
4
+ "version": "0.0.0",
5
+ "description": "One-call Function Calling definition generator for Triggerix AI",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/triggerix-lang/triggerix-ai#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git@github.com:triggerix-lang/triggerix-ai.git",
11
+ "directory": "packages/fn"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/triggerix-lang/triggerix-ai/issues"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.mjs",
23
+ "require": "./dist/index.cjs"
24
+ }
25
+ },
26
+ "main": "./dist/index.cjs",
27
+ "module": "./dist/index.mjs",
28
+ "types": "./dist/index.d.ts",
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "dependencies": {
33
+ "@triggerix-ai/component": "0.0.0",
34
+ "@triggerix-ai/prompt": "0.0.0",
35
+ "@triggerix-ai/schema": "0.0.0",
36
+ "@triggerix-ai/registry": "0.0.0"
37
+ },
38
+ "devDependencies": {
39
+ "unbuild": "^3.6.1"
40
+ },
41
+ "scripts": {
42
+ "stub": "unbuild --stub",
43
+ "build": "unbuild"
44
+ }
45
+ }