@mulmochat-plugin/form 0.1.2 → 0.2.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/core/index.d.ts +8 -0
- package/dist/core/plugin.d.ts +12 -0
- package/dist/core/types.d.ts +311 -0
- package/dist/core.cjs +2 -0
- package/dist/core.js +432 -0
- package/dist/index.cjs +1 -2
- package/dist/index.d.ts +16 -8
- package/dist/index.js +7 -992
- package/dist/style.css +1 -1
- package/dist/{plugin → vue}/Preview.vue.d.ts +1 -1
- package/dist/{plugin → vue}/View.vue.d.ts +1 -1
- package/dist/vue/index.d.ts +22 -0
- package/dist/vue/types.d.ts +32 -0
- package/dist/vue.cjs +1 -0
- package/dist/vue.js +582 -0
- package/package.json +11 -1
- package/dist/common/index.d.ts +0 -7
- package/dist/common/types.d.ts +0 -142
- package/dist/plugin/index.d.ts +0 -18
- package/dist/plugin/samples.d.ts +0 -5
- package/dist/plugin/tools.d.ts +0 -121
- package/dist/plugin/types.d.ts +0 -89
package/dist/common/types.d.ts
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MulmoChat Plugin Common Types
|
|
3
|
-
*
|
|
4
|
-
* Core interfaces for building MulmoChat plugins.
|
|
5
|
-
* These types are plugin-agnostic and can be used by any plugin implementation.
|
|
6
|
-
*/
|
|
7
|
-
import type { Component } from "vue";
|
|
8
|
-
/**
|
|
9
|
-
* Backend types that plugins can declare they use.
|
|
10
|
-
* App layer manages actual provider/model settings for each type.
|
|
11
|
-
*/
|
|
12
|
-
export type BackendType = "textLLM" | "imageGen" | "audio" | "search" | "browse" | "map" | "mulmocast";
|
|
13
|
-
/**
|
|
14
|
-
* App interface provided to plugins via context.app
|
|
15
|
-
* Contains backend functions and config accessors
|
|
16
|
-
*/
|
|
17
|
-
export interface ToolContextApp extends Record<string, (...args: any[]) => any> {
|
|
18
|
-
getConfig: <T = unknown>(key: string) => T | undefined;
|
|
19
|
-
setConfig: (key: string, value: unknown) => void;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Context passed to plugin execute function
|
|
23
|
-
*/
|
|
24
|
-
export interface ToolContext {
|
|
25
|
-
currentResult?: ToolResult<unknown> | null;
|
|
26
|
-
app?: ToolContextApp;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Result returned from plugin execution
|
|
30
|
-
*/
|
|
31
|
-
export interface ToolResult<T = unknown, J = unknown> {
|
|
32
|
-
toolName?: string;
|
|
33
|
-
uuid?: string;
|
|
34
|
-
message: string;
|
|
35
|
-
title?: string;
|
|
36
|
-
jsonData?: J;
|
|
37
|
-
instructions?: string;
|
|
38
|
-
instructionsRequired?: boolean;
|
|
39
|
-
updating?: boolean;
|
|
40
|
-
cancelled?: boolean;
|
|
41
|
-
data?: T;
|
|
42
|
-
viewState?: Record<string, unknown>;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* JSON Schema property definition for tool parameters
|
|
46
|
-
*/
|
|
47
|
-
export interface JsonSchemaProperty {
|
|
48
|
-
type?: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
enum?: string[];
|
|
51
|
-
items?: JsonSchemaProperty;
|
|
52
|
-
minimum?: number;
|
|
53
|
-
maximum?: number;
|
|
54
|
-
minItems?: number;
|
|
55
|
-
maxItems?: number;
|
|
56
|
-
properties?: Record<string, JsonSchemaProperty>;
|
|
57
|
-
required?: string[];
|
|
58
|
-
additionalProperties?: boolean;
|
|
59
|
-
oneOf?: JsonSchemaProperty[];
|
|
60
|
-
[key: string]: unknown;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* API response from server start endpoint
|
|
64
|
-
*/
|
|
65
|
-
export interface StartApiResponse {
|
|
66
|
-
hasOpenAIApiKey?: boolean;
|
|
67
|
-
hasAnthropicApiKey?: boolean;
|
|
68
|
-
hasGoogleApiKey?: boolean;
|
|
69
|
-
[key: string]: unknown;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Tool definition for OpenAI-compatible function calling
|
|
73
|
-
*/
|
|
74
|
-
export interface ToolDefinition {
|
|
75
|
-
type: "function";
|
|
76
|
-
name: string;
|
|
77
|
-
description: string;
|
|
78
|
-
parameters?: {
|
|
79
|
-
type: "object";
|
|
80
|
-
properties: Record<string, JsonSchemaProperty>;
|
|
81
|
-
required: string[];
|
|
82
|
-
additionalProperties?: boolean;
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* File upload configuration
|
|
87
|
-
*/
|
|
88
|
-
export interface FileUploadConfig {
|
|
89
|
-
acceptedTypes: string[];
|
|
90
|
-
handleUpload: (fileData: string, fileName: string, ...args: unknown[]) => ToolResult<unknown, unknown>;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Plugin configuration
|
|
94
|
-
*/
|
|
95
|
-
export interface ToolPluginConfig {
|
|
96
|
-
key: string;
|
|
97
|
-
defaultValue: unknown;
|
|
98
|
-
component: Component;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Sample arguments for testing
|
|
102
|
-
*/
|
|
103
|
-
export interface ToolSample {
|
|
104
|
-
name: string;
|
|
105
|
-
args: Record<string, unknown>;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Main plugin interface
|
|
109
|
-
* @template T - Type of data stored in result.data
|
|
110
|
-
* @template J - Type of data stored in result.jsonData
|
|
111
|
-
* @template A - Type of arguments passed to execute
|
|
112
|
-
*/
|
|
113
|
-
export interface ToolPlugin<T = unknown, J = unknown, A extends object = object> {
|
|
114
|
-
/** Tool definition for LLM function calling */
|
|
115
|
-
toolDefinition: ToolDefinition;
|
|
116
|
-
/** Execute the plugin with given context and arguments */
|
|
117
|
-
execute: (context: ToolContext, args: A) => Promise<ToolResult<T, J>>;
|
|
118
|
-
/** Message shown while generating */
|
|
119
|
-
generatingMessage: string;
|
|
120
|
-
/** Message shown while waiting for user action */
|
|
121
|
-
waitingMessage?: string;
|
|
122
|
-
/** Message shown during file upload */
|
|
123
|
-
uploadMessage?: string;
|
|
124
|
-
/** Check if plugin is enabled based on server capabilities */
|
|
125
|
-
isEnabled: (startResponse?: StartApiResponse | null) => boolean;
|
|
126
|
-
/** Delay in ms after execution before proceeding */
|
|
127
|
-
delayAfterExecution?: number;
|
|
128
|
-
/** Vue component for full view */
|
|
129
|
-
viewComponent?: Component;
|
|
130
|
-
/** Vue component for preview/thumbnail */
|
|
131
|
-
previewComponent?: Component;
|
|
132
|
-
/** System prompt additions for this plugin */
|
|
133
|
-
systemPrompt?: string;
|
|
134
|
-
/** Optional file upload configuration */
|
|
135
|
-
fileUpload?: FileUploadConfig;
|
|
136
|
-
/** Optional plugin-specific configuration */
|
|
137
|
-
config?: ToolPluginConfig;
|
|
138
|
-
/** Optional sample arguments for testing */
|
|
139
|
-
samples?: ToolSample[];
|
|
140
|
-
/** Backend types this plugin uses (e.g., ["textLLM", "imageGen"]) */
|
|
141
|
-
backends?: BackendType[];
|
|
142
|
-
}
|
package/dist/plugin/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MulmoChat Form Plugin
|
|
3
|
-
*
|
|
4
|
-
* A plugin for creating structured forms to collect user information.
|
|
5
|
-
*
|
|
6
|
-
* @example Basic usage
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import { plugin } from "@mulmochat-plugin/form";
|
|
9
|
-
* import "@mulmochat-plugin/form/style.css";
|
|
10
|
-
* // Use plugin directly
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
import type { ToolPlugin } from "../common";
|
|
14
|
-
import type { FormData, FormArgs } from "./types";
|
|
15
|
-
/**
|
|
16
|
-
* Form plugin instance
|
|
17
|
-
*/
|
|
18
|
-
export declare const plugin: ToolPlugin<never, FormData, FormArgs>;
|
package/dist/plugin/samples.d.ts
DELETED
package/dist/plugin/tools.d.ts
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Form Tool Definition
|
|
3
|
-
*/
|
|
4
|
-
export declare const TOOL_NAME = "presentForm";
|
|
5
|
-
export declare const TOOL_DEFINITION: {
|
|
6
|
-
type: "function";
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
parameters: {
|
|
10
|
-
type: "object";
|
|
11
|
-
properties: {
|
|
12
|
-
title: {
|
|
13
|
-
type: string;
|
|
14
|
-
description: string;
|
|
15
|
-
};
|
|
16
|
-
description: {
|
|
17
|
-
type: string;
|
|
18
|
-
description: string;
|
|
19
|
-
};
|
|
20
|
-
fields: {
|
|
21
|
-
type: string;
|
|
22
|
-
description: string;
|
|
23
|
-
items: {
|
|
24
|
-
type: string;
|
|
25
|
-
properties: {
|
|
26
|
-
id: {
|
|
27
|
-
type: string;
|
|
28
|
-
description: string;
|
|
29
|
-
};
|
|
30
|
-
type: {
|
|
31
|
-
type: string;
|
|
32
|
-
enum: string[];
|
|
33
|
-
description: string;
|
|
34
|
-
};
|
|
35
|
-
label: {
|
|
36
|
-
type: string;
|
|
37
|
-
description: string;
|
|
38
|
-
};
|
|
39
|
-
description: {
|
|
40
|
-
type: string;
|
|
41
|
-
description: string;
|
|
42
|
-
};
|
|
43
|
-
required: {
|
|
44
|
-
type: string;
|
|
45
|
-
description: string;
|
|
46
|
-
};
|
|
47
|
-
placeholder: {
|
|
48
|
-
type: string;
|
|
49
|
-
description: string;
|
|
50
|
-
};
|
|
51
|
-
validation: {
|
|
52
|
-
type: string;
|
|
53
|
-
description: string;
|
|
54
|
-
};
|
|
55
|
-
minLength: {
|
|
56
|
-
type: string;
|
|
57
|
-
description: string;
|
|
58
|
-
};
|
|
59
|
-
maxLength: {
|
|
60
|
-
type: string;
|
|
61
|
-
description: string;
|
|
62
|
-
};
|
|
63
|
-
rows: {
|
|
64
|
-
type: string;
|
|
65
|
-
description: string;
|
|
66
|
-
};
|
|
67
|
-
choices: {
|
|
68
|
-
type: string;
|
|
69
|
-
items: {
|
|
70
|
-
type: string;
|
|
71
|
-
};
|
|
72
|
-
description: string;
|
|
73
|
-
};
|
|
74
|
-
searchable: {
|
|
75
|
-
type: string;
|
|
76
|
-
description: string;
|
|
77
|
-
};
|
|
78
|
-
minSelections: {
|
|
79
|
-
type: string;
|
|
80
|
-
description: string;
|
|
81
|
-
};
|
|
82
|
-
maxSelections: {
|
|
83
|
-
type: string;
|
|
84
|
-
description: string;
|
|
85
|
-
};
|
|
86
|
-
minDate: {
|
|
87
|
-
type: string;
|
|
88
|
-
description: string;
|
|
89
|
-
};
|
|
90
|
-
maxDate: {
|
|
91
|
-
type: string;
|
|
92
|
-
description: string;
|
|
93
|
-
};
|
|
94
|
-
format: {
|
|
95
|
-
type: string;
|
|
96
|
-
description: string;
|
|
97
|
-
};
|
|
98
|
-
min: {
|
|
99
|
-
type: string;
|
|
100
|
-
description: string;
|
|
101
|
-
};
|
|
102
|
-
max: {
|
|
103
|
-
type: string;
|
|
104
|
-
description: string;
|
|
105
|
-
};
|
|
106
|
-
step: {
|
|
107
|
-
type: string;
|
|
108
|
-
description: string;
|
|
109
|
-
};
|
|
110
|
-
defaultValue: {
|
|
111
|
-
description: string;
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
required: string[];
|
|
115
|
-
};
|
|
116
|
-
minItems: number;
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
required: string[];
|
|
120
|
-
};
|
|
121
|
-
};
|
package/dist/plugin/types.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Form Types
|
|
3
|
-
*/
|
|
4
|
-
/** Field type discriminator */
|
|
5
|
-
export type FieldType = "text" | "textarea" | "radio" | "dropdown" | "checkbox" | "date" | "time" | "number";
|
|
6
|
-
/** Base field interface */
|
|
7
|
-
export interface BaseField {
|
|
8
|
-
id: string;
|
|
9
|
-
type: FieldType;
|
|
10
|
-
label: string;
|
|
11
|
-
description?: string;
|
|
12
|
-
required?: boolean;
|
|
13
|
-
maxLength?: number;
|
|
14
|
-
}
|
|
15
|
-
/** Text field */
|
|
16
|
-
export interface TextField extends BaseField {
|
|
17
|
-
type: "text";
|
|
18
|
-
placeholder?: string;
|
|
19
|
-
validation?: "email" | "url" | "phone" | string;
|
|
20
|
-
defaultValue?: string;
|
|
21
|
-
minLength?: number;
|
|
22
|
-
maxLength?: number;
|
|
23
|
-
}
|
|
24
|
-
/** Textarea field */
|
|
25
|
-
export interface TextareaField extends BaseField {
|
|
26
|
-
type: "textarea";
|
|
27
|
-
placeholder?: string;
|
|
28
|
-
minLength?: number;
|
|
29
|
-
maxLength?: number;
|
|
30
|
-
rows?: number;
|
|
31
|
-
defaultValue?: string;
|
|
32
|
-
}
|
|
33
|
-
/** Radio field */
|
|
34
|
-
export interface RadioField extends BaseField {
|
|
35
|
-
type: "radio";
|
|
36
|
-
choices: string[];
|
|
37
|
-
defaultValue?: string;
|
|
38
|
-
}
|
|
39
|
-
/** Dropdown field */
|
|
40
|
-
export interface DropdownField extends BaseField {
|
|
41
|
-
type: "dropdown";
|
|
42
|
-
choices: string[];
|
|
43
|
-
searchable?: boolean;
|
|
44
|
-
defaultValue?: string;
|
|
45
|
-
}
|
|
46
|
-
/** Checkbox field */
|
|
47
|
-
export interface CheckboxField extends BaseField {
|
|
48
|
-
type: "checkbox";
|
|
49
|
-
choices: string[];
|
|
50
|
-
minSelections?: number;
|
|
51
|
-
maxSelections?: number;
|
|
52
|
-
defaultValue?: string[];
|
|
53
|
-
}
|
|
54
|
-
/** Date field */
|
|
55
|
-
export interface DateField extends BaseField {
|
|
56
|
-
type: "date";
|
|
57
|
-
minDate?: string;
|
|
58
|
-
maxDate?: string;
|
|
59
|
-
format?: string;
|
|
60
|
-
defaultValue?: string;
|
|
61
|
-
}
|
|
62
|
-
/** Time field */
|
|
63
|
-
export interface TimeField extends BaseField {
|
|
64
|
-
type: "time";
|
|
65
|
-
format?: "12hr" | "24hr";
|
|
66
|
-
defaultValue?: string;
|
|
67
|
-
}
|
|
68
|
-
/** Number field */
|
|
69
|
-
export interface NumberField extends BaseField {
|
|
70
|
-
type: "number";
|
|
71
|
-
min?: number;
|
|
72
|
-
max?: number;
|
|
73
|
-
step?: number;
|
|
74
|
-
defaultValue?: number;
|
|
75
|
-
}
|
|
76
|
-
/** Union type for all fields */
|
|
77
|
-
export type FormField = TextField | TextareaField | RadioField | DropdownField | CheckboxField | DateField | TimeField | NumberField;
|
|
78
|
-
/** Form data stored in result.jsonData */
|
|
79
|
-
export interface FormData {
|
|
80
|
-
title?: string;
|
|
81
|
-
description?: string;
|
|
82
|
-
fields: FormField[];
|
|
83
|
-
}
|
|
84
|
-
/** Arguments passed to the form tool */
|
|
85
|
-
export interface FormArgs {
|
|
86
|
-
title?: string;
|
|
87
|
-
description?: string;
|
|
88
|
-
fields: FormField[];
|
|
89
|
-
}
|