@assistant-wi/core 0.0.3 → 0.0.5
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/index-Dbt2oV4y.js +112 -0
- package/dist/index-Oe1iY2v9.cjs +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/tool/tool.d.ts +10 -10
- package/dist/ui/builder.d.ts +11 -0
- package/dist/ui/index.cjs.js +1 -1
- package/dist/ui/index.es.js +5 -3
- package/dist/ui/ui-block.d.ts +17 -3
- package/dist/ui/ui-block.test.d.ts +1 -0
- package/dist/ui/ui-button.d.ts +8 -2
- package/dist/ui/ui-button.test.d.ts +1 -0
- package/dist/ui/ui-form.d.ts +4 -2
- package/dist/ui/ui-form.test.d.ts +1 -0
- package/dist/ui/ui-text.d.ts +1 -1
- package/dist/ui/ui.d.ts +4 -1
- package/package.json +3 -2
- package/dist/index-CHYnucAA.cjs +0 -1
- package/dist/index-Dwsbu01L.js +0 -38
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
function a(e, o, t) {
|
|
2
|
+
const n = {};
|
|
3
|
+
return c(n, e, o), l(n, e), s(n, e, t), n;
|
|
4
|
+
}
|
|
5
|
+
function c(e, o, t) {
|
|
6
|
+
for (const n of t)
|
|
7
|
+
Object.defineProperty(e, n, {
|
|
8
|
+
value: (r) => (o[n] = r, e),
|
|
9
|
+
enumerable: !1,
|
|
10
|
+
writable: !1,
|
|
11
|
+
configurable: !1
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function s(e, o, t) {
|
|
15
|
+
if (!t) return;
|
|
16
|
+
const n = t(o);
|
|
17
|
+
for (const r of Object.keys(n))
|
|
18
|
+
Object.defineProperty(e, r, {
|
|
19
|
+
value: (...u) => (n[r]?.(...u), e),
|
|
20
|
+
enumerable: !1,
|
|
21
|
+
writable: !1,
|
|
22
|
+
configurable: !1
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function l(e, o) {
|
|
26
|
+
Object.defineProperty(e, "build", {
|
|
27
|
+
value: () => o,
|
|
28
|
+
enumerable: !1,
|
|
29
|
+
writable: !1,
|
|
30
|
+
configurable: !1
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function i(e) {
|
|
34
|
+
return a({ type: "block", nodes: e ?? [] }, ["direction", "gap", "nodes"], (t) => ({
|
|
35
|
+
row() {
|
|
36
|
+
t.direction = "row";
|
|
37
|
+
},
|
|
38
|
+
col() {
|
|
39
|
+
t.direction = "col";
|
|
40
|
+
},
|
|
41
|
+
addNode(n) {
|
|
42
|
+
t.nodes.push(n);
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
function d(e) {
|
|
47
|
+
return i(e).row();
|
|
48
|
+
}
|
|
49
|
+
function f(e) {
|
|
50
|
+
return i(e).col();
|
|
51
|
+
}
|
|
52
|
+
function b(e) {
|
|
53
|
+
return a({
|
|
54
|
+
type: "button",
|
|
55
|
+
text: e
|
|
56
|
+
}, ["text", "variant", "onClick"], (t) => ({
|
|
57
|
+
primary() {
|
|
58
|
+
t.variant = "primary";
|
|
59
|
+
},
|
|
60
|
+
secondary() {
|
|
61
|
+
t.variant = "secondary";
|
|
62
|
+
},
|
|
63
|
+
outline() {
|
|
64
|
+
t.variant = "outline";
|
|
65
|
+
},
|
|
66
|
+
ghost() {
|
|
67
|
+
t.variant = "ghost";
|
|
68
|
+
},
|
|
69
|
+
destructive() {
|
|
70
|
+
t.variant = "destructive";
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
function p(e) {
|
|
75
|
+
return a(
|
|
76
|
+
{
|
|
77
|
+
type: "form",
|
|
78
|
+
nodes: e ?? [],
|
|
79
|
+
submitTitle: "Submit"
|
|
80
|
+
},
|
|
81
|
+
["title", "description", "submitTitle", "onSubmit"],
|
|
82
|
+
(t) => ({
|
|
83
|
+
addNode(n) {
|
|
84
|
+
t.nodes.push(n);
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
function y(e) {
|
|
90
|
+
return {
|
|
91
|
+
type: "text",
|
|
92
|
+
text: e
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
96
|
+
__proto__: null,
|
|
97
|
+
block: i,
|
|
98
|
+
button: b,
|
|
99
|
+
col: f,
|
|
100
|
+
form: p,
|
|
101
|
+
row: d,
|
|
102
|
+
text: y
|
|
103
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
104
|
+
export {
|
|
105
|
+
b as a,
|
|
106
|
+
i as b,
|
|
107
|
+
f as c,
|
|
108
|
+
p as f,
|
|
109
|
+
m as i,
|
|
110
|
+
d as r,
|
|
111
|
+
y as t
|
|
112
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function a(t,o,e){const n={};return b(n,t,o),y(n,t),p(n,t,e),n}function b(t,o,e){for(const n of e)Object.defineProperty(t,n,{value:r=>(o[n]=r,t),enumerable:!1,writable:!1,configurable:!1})}function p(t,o,e){if(!e)return;const n=e(o);for(const r of Object.keys(n))Object.defineProperty(t,r,{value:(...f)=>(n[r]?.(...f),t),enumerable:!1,writable:!1,configurable:!1})}function y(t,o){Object.defineProperty(t,"build",{value:()=>o,enumerable:!1,writable:!1,configurable:!1})}function i(t){return a({type:"block",nodes:t??[]},["direction","gap","nodes"],e=>({row(){e.direction="row"},col(){e.direction="col"},addNode(n){e.nodes.push(n)}}))}function u(t){return i(t).row()}function c(t){return i(t).col()}function l(t){return a({type:"button",text:t},["text","variant","onClick"],e=>({primary(){e.variant="primary"},secondary(){e.variant="secondary"},outline(){e.variant="outline"},ghost(){e.variant="ghost"},destructive(){e.variant="destructive"}}))}function d(t){return a({type:"form",nodes:t??[],submitTitle:"Submit"},["title","description","submitTitle","onSubmit"],e=>({addNode(n){e.nodes.push(n)}}))}function s(t){return{type:"text",text:t}}const m=Object.freeze(Object.defineProperty({__proto__:null,block:i,button:l,col:c,form:d,row:u,text:s},Symbol.toStringTag,{value:"Module"}));exports.block=i;exports.button=l;exports.col=c;exports.form=d;exports.index=m;exports.row=u;exports.text=s;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DMcbwFzr.cjs"),i=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DMcbwFzr.cjs"),i=require("./index-Oe1iY2v9.cjs");exports.tool=e.index;exports.ui=i.index;
|
package/dist/index.es.js
CHANGED
package/dist/tool/tool.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { default as z } from 'zod/v4';
|
|
2
2
|
import { UI } from '../ui';
|
|
3
|
-
export interface Tool<
|
|
3
|
+
export interface Tool<I extends z.ZodTypeAny = z.ZodTypeAny, O extends z.ZodTypeAny = z.ZodTypeAny> {
|
|
4
4
|
description: string;
|
|
5
|
-
inputSchema:
|
|
6
|
-
outputSchema:
|
|
5
|
+
inputSchema: I;
|
|
6
|
+
outputSchema: O;
|
|
7
7
|
workflow: {
|
|
8
|
-
call: (props: ToolCallProps<
|
|
9
|
-
done: (props: ToolDoneProps<
|
|
8
|
+
call: (props: ToolCallProps<I, O>) => Promise<void>;
|
|
9
|
+
done: (props: ToolDoneProps<I, O>) => void;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
export interface ToolCallProps<Input extends z.
|
|
12
|
+
export interface ToolCallProps<Input extends z.ZodTypeAny, Output extends z.ZodTypeAny> {
|
|
13
13
|
toolCallId: string;
|
|
14
14
|
input: z.infer<Input>;
|
|
15
15
|
render: (ui: UI) => void;
|
|
16
16
|
commit: (result: z.infer<Output>) => void;
|
|
17
17
|
}
|
|
18
|
-
export interface ToolDoneProps<
|
|
18
|
+
export interface ToolDoneProps<I extends z.ZodTypeAny, O extends z.ZodTypeAny> {
|
|
19
19
|
toolCallId: string;
|
|
20
|
-
input: z.infer<
|
|
21
|
-
output: z.infer<
|
|
20
|
+
input: z.infer<I>;
|
|
21
|
+
output: z.infer<O>;
|
|
22
22
|
render: (ui: UI) => void;
|
|
23
23
|
}
|
|
24
|
-
export declare function createTool<
|
|
24
|
+
export declare function createTool<I extends z.ZodTypeAny, O extends z.ZodTypeAny>(tool: Tool<I, O>): Tool<I, O>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type Setters = Record<string, (...args: any[]) => void>;
|
|
2
|
+
export type CustomMutators<T extends object, F extends readonly (keyof T)[], S extends Setters> = {
|
|
3
|
+
[K in keyof S]: S[K] extends (...args: infer Args) => void ? (...args: Args) => Builder<T, F, S> : never;
|
|
4
|
+
};
|
|
5
|
+
export type AutoMutators<T extends object, F extends readonly (keyof T)[], S extends Setters> = {
|
|
6
|
+
[K in F[number]]: (value: T[K]) => Builder<T, F, S>;
|
|
7
|
+
};
|
|
8
|
+
export type Builder<T extends object, F extends readonly (keyof T)[], S extends Setters> = AutoMutators<T, F, S> & CustomMutators<T, F, S> & {
|
|
9
|
+
build(): T;
|
|
10
|
+
};
|
|
11
|
+
export declare function builder<T extends object, F extends readonly (keyof T)[], S extends Setters & Partial<Record<F[number], never>>>(data: T, autoSetterFields: F, customSetterPatterns?: (self: T) => S): Builder<T, F, S>;
|
package/dist/ui/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index-Oe1iY2v9.cjs");exports.block=o.block;exports.button=o.button;exports.col=o.col;exports.form=o.form;exports.row=o.row;exports.text=o.text;
|
package/dist/ui/index.es.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { b as
|
|
1
|
+
import { b as s, a as t, c as r, f as b, r as c, t as f } from "../index-Dbt2oV4y.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
s as block,
|
|
4
|
+
t as button,
|
|
5
|
+
r as col,
|
|
5
6
|
b as form,
|
|
7
|
+
c as row,
|
|
6
8
|
f as text
|
|
7
9
|
};
|
package/dist/ui/ui-block.d.ts
CHANGED
|
@@ -2,7 +2,21 @@ import { UI } from './ui';
|
|
|
2
2
|
export interface UIBlock {
|
|
3
3
|
type: 'block';
|
|
4
4
|
nodes: UI[];
|
|
5
|
-
direction?: 'row' | '
|
|
6
|
-
gap?: number;
|
|
5
|
+
direction?: 'row' | 'col' | undefined;
|
|
6
|
+
gap?: number | undefined;
|
|
7
7
|
}
|
|
8
|
-
export declare function block(
|
|
8
|
+
export declare function block(nodes?: UI[]): import('./builder').Builder<UIBlock, ("direction" | "gap" | "nodes")[], {
|
|
9
|
+
row(): void;
|
|
10
|
+
col(): void;
|
|
11
|
+
addNode(node: UI): void;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function row(nodes?: UI[]): import('./builder').Builder<UIBlock, ("direction" | "gap" | "nodes")[], {
|
|
14
|
+
row(): void;
|
|
15
|
+
col(): void;
|
|
16
|
+
addNode(node: UI): void;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function col(nodes?: UI[]): import('./builder').Builder<UIBlock, ("direction" | "gap" | "nodes")[], {
|
|
19
|
+
row(): void;
|
|
20
|
+
col(): void;
|
|
21
|
+
addNode(node: UI): void;
|
|
22
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/ui/ui-button.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export interface UIButton {
|
|
2
2
|
type: 'button';
|
|
3
|
-
text
|
|
3
|
+
text: string;
|
|
4
4
|
variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive';
|
|
5
5
|
onClick?: () => void;
|
|
6
6
|
}
|
|
7
|
-
export declare function button(
|
|
7
|
+
export declare function button(text: string): import('./builder').Builder<UIButton, ("text" | "variant" | "onClick")[], {
|
|
8
|
+
primary(): void;
|
|
9
|
+
secondary(): void;
|
|
10
|
+
outline(): void;
|
|
11
|
+
ghost(): void;
|
|
12
|
+
destructive(): void;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/ui/ui-form.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface UIForm {
|
|
|
3
3
|
title?: string;
|
|
4
4
|
description?: string;
|
|
5
5
|
nodes: UIFormNode[];
|
|
6
|
-
submitTitle
|
|
6
|
+
submitTitle?: string;
|
|
7
7
|
onSubmit?: (values: Record<string, string>) => Promise<void>;
|
|
8
8
|
}
|
|
9
9
|
export interface UIFormNode {
|
|
@@ -15,4 +15,6 @@ export interface UIFormNode {
|
|
|
15
15
|
value?: string;
|
|
16
16
|
onChange?: (value: string) => void;
|
|
17
17
|
}
|
|
18
|
-
export declare function form(
|
|
18
|
+
export declare function form(nodes?: UIFormNode[]): import('./builder').Builder<UIForm, ("title" | "description" | "submitTitle" | "onSubmit")[], {
|
|
19
|
+
addNode(node: UIFormNode): void;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/ui/ui-text.d.ts
CHANGED
package/dist/ui/ui.d.ts
CHANGED
|
@@ -2,4 +2,7 @@ import { UIBlock } from './ui-block';
|
|
|
2
2
|
import { UIButton } from './ui-button';
|
|
3
3
|
import { UIForm } from './ui-form';
|
|
4
4
|
import { UIText } from './ui-text';
|
|
5
|
-
export type UI =
|
|
5
|
+
export type UI = UIObject | {
|
|
6
|
+
build(): UIObject;
|
|
7
|
+
};
|
|
8
|
+
export type UIObject = UIBlock | UIText | UIButton | UIForm;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-wi/core",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs.js",
|
|
7
7
|
"module": "./dist/index.es.js",
|
|
@@ -44,9 +44,10 @@
|
|
|
44
44
|
"@types/node": "^24.3.0",
|
|
45
45
|
"vite": "^7.1.3",
|
|
46
46
|
"vite-plugin-dts": "^4.5.4",
|
|
47
|
+
"vitest": "^3.2.4",
|
|
47
48
|
"zod": "^4.1.5"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
|
-
"zod": "^
|
|
51
|
+
"zod": "^4"
|
|
51
52
|
}
|
|
52
53
|
}
|
package/dist/index-CHYnucAA.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function e(t){return{type:"block",...t}}function n(t){return{type:"button",...t}}function o(t){return{type:"form",...t}}function r(t){return{type:"text",...t}}const u=Object.freeze(Object.defineProperty({__proto__:null,block:e,button:n,form:o,text:r},Symbol.toStringTag,{value:"Module"}));exports.block=e;exports.button=n;exports.form=o;exports.index=u;exports.text=r;
|
package/dist/index-Dwsbu01L.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
function e(t) {
|
|
2
|
-
return {
|
|
3
|
-
type: "block",
|
|
4
|
-
...t
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
function n(t) {
|
|
8
|
-
return {
|
|
9
|
-
type: "button",
|
|
10
|
-
...t
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
function o(t) {
|
|
14
|
-
return {
|
|
15
|
-
type: "form",
|
|
16
|
-
...t
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function r(t) {
|
|
20
|
-
return {
|
|
21
|
-
type: "text",
|
|
22
|
-
...t
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
const u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
26
|
-
__proto__: null,
|
|
27
|
-
block: e,
|
|
28
|
-
button: n,
|
|
29
|
-
form: o,
|
|
30
|
-
text: r
|
|
31
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
32
|
-
export {
|
|
33
|
-
n as a,
|
|
34
|
-
e as b,
|
|
35
|
-
o as f,
|
|
36
|
-
u as i,
|
|
37
|
-
r as t
|
|
38
|
-
};
|