@assistant-wi/core 0.0.13 → 0.0.14

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.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DMcbwFzr.js"),i=require("./index-14BiCzPY.js");exports.tool=e.index;exports.ui=i.index;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod/v4"),s=e.z.object({id:e.z.string(),chatId:e.z.string(),role:e.z.enum(["user","assistant","system"]),parts:e.z.array(e.z.discriminatedUnion("type",[e.z.object({type:e.z.literal("reasoning"),text:e.z.string(),state:e.z.enum(["streaming","done"])}),e.z.object({type:e.z.literal("text"),text:e.z.string(),state:e.z.enum(["streaming","done"])}),e.z.object({type:e.z.literal("tool"),name:e.z.string(),toolCallId:e.z.string(),input:e.z.unknown(),output:e.z.unknown().optional(),state:e.z.enum(["streaming","call","done","error"]),error:e.z.string().optional()}),e.z.object({type:e.z.literal("unknown")})]))}),t=e.object({type:e.literal("reasoning"),text:e.string(),state:e.enum(["streaming","done"])}),n=e.object({type:e.literal("text"),text:e.string(),state:e.enum(["streaming","done"])}),o=e.object({type:e.literal("tool"),name:e.string(),toolCallId:e.string(),input:e.unknown(),output:e.unknown().optional(),state:e.enum(["streaming","call","done","error"]),error:e.string().optional()}),a=e.object({type:e.literal("unknown")});e.discriminatedUnion("type",[t,n,o,a]);function i(r){return r}const c=e.object({description:e.string(),inputSchema:e.object({jsonSchema:e.record(e.any(),e.any())}),outputSchema:e.object({jsonSchema:e.record(e.any(),e.any())})});exports.messagePartReasoningSchema=t;exports.messagePartTextSchema=n;exports.messagePartToolSchema=o;exports.messagePartUnknownSchema=a;exports.messageSchema=s;exports.tool=i;exports.toolSignatureSchema=c;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,193 @@
1
- export * from './assistant';
2
- export * as tool from './tool';
3
- export * as ui from './ui';
1
+ import { default as default_2 } from 'zod/v4';
2
+ import { Schema } from 'ai';
3
+ import { z } from 'zod/v4';
4
+
5
+ export declare interface Assistant {
6
+ id: string;
7
+ userId: string;
8
+ systemPrompt?: string;
9
+ contextPrompt?: () => string;
10
+ tools?: Record<string, Tool>;
11
+ api?: {
12
+ baseUrl?: string | undefined;
13
+ authToken?: string | undefined;
14
+ };
15
+ }
16
+
17
+ export declare type Chat = z.infer<typeof chatSchema>;
18
+
19
+ declare const chatSchema: z.ZodObject<{
20
+ id: z.ZodString;
21
+ userId: z.ZodString;
22
+ name: z.ZodNullable<z.ZodString>;
23
+ createdAt: z.ZodCoercedDate<unknown>;
24
+ updatedAt: z.ZodCoercedDate<unknown>;
25
+ }, z.core.$strip>;
26
+
27
+ export declare type Message = z.infer<typeof messageSchema>;
28
+
29
+ export declare type MessageKnownPart = Exclude<MessagePart, {
30
+ type: 'unknown';
31
+ }>;
32
+
33
+ export declare type MessagePart = default_2.infer<typeof messagePartSchema>;
34
+
35
+ export declare type MessagePartReasoning = default_2.infer<typeof messagePartReasoningSchema>;
36
+
37
+ export declare const messagePartReasoningSchema: default_2.ZodObject<{
38
+ type: default_2.ZodLiteral<"reasoning">;
39
+ text: default_2.ZodString;
40
+ state: default_2.ZodEnum<{
41
+ streaming: "streaming";
42
+ done: "done";
43
+ }>;
44
+ }, default_2.core.$strip>;
45
+
46
+ declare const messagePartSchema: default_2.ZodDiscriminatedUnion<[default_2.ZodObject<{
47
+ type: default_2.ZodLiteral<"reasoning">;
48
+ text: default_2.ZodString;
49
+ state: default_2.ZodEnum<{
50
+ streaming: "streaming";
51
+ done: "done";
52
+ }>;
53
+ }, default_2.core.$strip>, default_2.ZodObject<{
54
+ type: default_2.ZodLiteral<"text">;
55
+ text: default_2.ZodString;
56
+ state: default_2.ZodEnum<{
57
+ streaming: "streaming";
58
+ done: "done";
59
+ }>;
60
+ }, default_2.core.$strip>, default_2.ZodObject<{
61
+ type: default_2.ZodLiteral<"tool">;
62
+ name: default_2.ZodString;
63
+ toolCallId: default_2.ZodString;
64
+ input: default_2.ZodUnknown;
65
+ output: default_2.ZodOptional<default_2.ZodUnknown>;
66
+ state: default_2.ZodEnum<{
67
+ streaming: "streaming";
68
+ done: "done";
69
+ call: "call";
70
+ error: "error";
71
+ }>;
72
+ error: default_2.ZodOptional<default_2.ZodString>;
73
+ }, default_2.core.$strip>, default_2.ZodObject<{
74
+ type: default_2.ZodLiteral<"unknown">;
75
+ }, default_2.core.$strip>], "type">;
76
+
77
+ export declare type MessagePartText = default_2.infer<typeof messagePartTextSchema>;
78
+
79
+ export declare const messagePartTextSchema: default_2.ZodObject<{
80
+ type: default_2.ZodLiteral<"text">;
81
+ text: default_2.ZodString;
82
+ state: default_2.ZodEnum<{
83
+ streaming: "streaming";
84
+ done: "done";
85
+ }>;
86
+ }, default_2.core.$strip>;
87
+
88
+ export declare type MessagePartTool = default_2.infer<typeof messagePartToolSchema>;
89
+
90
+ export declare const messagePartToolSchema: default_2.ZodObject<{
91
+ type: default_2.ZodLiteral<"tool">;
92
+ name: default_2.ZodString;
93
+ toolCallId: default_2.ZodString;
94
+ input: default_2.ZodUnknown;
95
+ output: default_2.ZodOptional<default_2.ZodUnknown>;
96
+ state: default_2.ZodEnum<{
97
+ streaming: "streaming";
98
+ done: "done";
99
+ call: "call";
100
+ error: "error";
101
+ }>;
102
+ error: default_2.ZodOptional<default_2.ZodString>;
103
+ }, default_2.core.$strip>;
104
+
105
+ export declare type MessagePartUnknown = default_2.infer<typeof messagePartUnknownSchema>;
106
+
107
+ export declare const messagePartUnknownSchema: default_2.ZodObject<{
108
+ type: default_2.ZodLiteral<"unknown">;
109
+ }, default_2.core.$strip>;
110
+
111
+ export declare const messageSchema: z.ZodObject<{
112
+ id: z.ZodString;
113
+ chatId: z.ZodString;
114
+ role: z.ZodEnum<{
115
+ user: "user";
116
+ assistant: "assistant";
117
+ system: "system";
118
+ }>;
119
+ parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
120
+ type: z.ZodLiteral<"reasoning">;
121
+ text: z.ZodString;
122
+ state: z.ZodEnum<{
123
+ streaming: "streaming";
124
+ done: "done";
125
+ }>;
126
+ }, z.core.$strip>, z.ZodObject<{
127
+ type: z.ZodLiteral<"text">;
128
+ text: z.ZodString;
129
+ state: z.ZodEnum<{
130
+ streaming: "streaming";
131
+ done: "done";
132
+ }>;
133
+ }, z.core.$strip>, z.ZodObject<{
134
+ type: z.ZodLiteral<"tool">;
135
+ name: z.ZodString;
136
+ toolCallId: z.ZodString;
137
+ input: z.ZodUnknown;
138
+ output: z.ZodOptional<z.ZodUnknown>;
139
+ state: z.ZodEnum<{
140
+ streaming: "streaming";
141
+ done: "done";
142
+ call: "call";
143
+ error: "error";
144
+ }>;
145
+ error: z.ZodOptional<z.ZodString>;
146
+ }, z.core.$strip>, z.ZodObject<{
147
+ type: z.ZodLiteral<"unknown">;
148
+ }, z.core.$strip>], "type">>;
149
+ }, z.core.$strip>;
150
+
151
+ export declare type Tool<I extends default_2.ZodType = default_2.ZodType, O extends default_2.ZodType = default_2.ZodType, UI = unknown> = {
152
+ description: string;
153
+ inputSchema: I;
154
+ outputSchema: O;
155
+ stages: {
156
+ call: (params: ToolCallParams<I, O, UI>) => Promise<void>;
157
+ done: (params: ToolDoneParams<I, O, UI>) => void;
158
+ };
159
+ };
160
+
161
+ export declare function tool<I extends default_2.ZodType, O extends default_2.ZodType, UI = unknown>(tool: Tool<I, O, UI>): Tool;
162
+
163
+ export declare type ToolCallParams<I extends default_2.ZodType, O extends default_2.ZodType, UI = unknown> = {
164
+ toolCallId: string;
165
+ input: default_2.infer<I>;
166
+ render: (ui: UI) => void;
167
+ commit: (result: default_2.infer<O>) => void;
168
+ };
169
+
170
+ export declare type ToolDoneParams<I extends default_2.ZodType, O extends default_2.ZodType, UI = unknown> = {
171
+ toolCallId: string;
172
+ input: default_2.infer<I>;
173
+ output: default_2.infer<O>;
174
+ render: (ui: UI) => void;
175
+ };
176
+
177
+ export declare type ToolSignature = {
178
+ description: string;
179
+ inputSchema: Schema;
180
+ outputSchema: Schema;
181
+ };
182
+
183
+ export declare const toolSignatureSchema: default_2.ZodObject<{
184
+ description: default_2.ZodString;
185
+ inputSchema: default_2.ZodObject<{
186
+ jsonSchema: default_2.ZodRecord<default_2.ZodAny, default_2.ZodAny>;
187
+ }, default_2.core.$strip>;
188
+ outputSchema: default_2.ZodObject<{
189
+ jsonSchema: default_2.ZodRecord<default_2.ZodAny, default_2.ZodAny>;
190
+ }, default_2.core.$strip>;
191
+ }, default_2.core.$strip>;
192
+
193
+ export { }
package/dist/index.es.js CHANGED
@@ -1,6 +1,77 @@
1
- import { i } from "./index-BXj6EgSG.mjs";
2
- import { i as a } from "./index-8Ln_I-xT.mjs";
1
+ import t, { z as e } from "zod/v4";
2
+ const c = e.object({
3
+ id: e.string(),
4
+ chatId: e.string(),
5
+ role: e.enum(["user", "assistant", "system"]),
6
+ parts: e.array(
7
+ e.discriminatedUnion("type", [
8
+ e.object({
9
+ type: e.literal("reasoning"),
10
+ text: e.string(),
11
+ state: e.enum(["streaming", "done"])
12
+ }),
13
+ e.object({
14
+ type: e.literal("text"),
15
+ text: e.string(),
16
+ state: e.enum(["streaming", "done"])
17
+ }),
18
+ e.object({
19
+ type: e.literal("tool"),
20
+ name: e.string(),
21
+ toolCallId: e.string(),
22
+ input: e.unknown(),
23
+ output: e.unknown().optional(),
24
+ state: e.enum(["streaming", "call", "done", "error"]),
25
+ error: e.string().optional()
26
+ }),
27
+ e.object({
28
+ type: e.literal("unknown")
29
+ })
30
+ ])
31
+ )
32
+ }), o = t.object({
33
+ type: t.literal("reasoning"),
34
+ text: t.string(),
35
+ state: t.enum(["streaming", "done"])
36
+ }), a = t.object({
37
+ type: t.literal("text"),
38
+ text: t.string(),
39
+ state: t.enum(["streaming", "done"])
40
+ }), r = t.object({
41
+ type: t.literal("tool"),
42
+ name: t.string(),
43
+ toolCallId: t.string(),
44
+ input: t.unknown(),
45
+ output: t.unknown().optional(),
46
+ state: t.enum(["streaming", "call", "done", "error"]),
47
+ error: t.string().optional()
48
+ }), s = t.object({
49
+ type: t.literal("unknown")
50
+ });
51
+ t.discriminatedUnion("type", [
52
+ o,
53
+ a,
54
+ r,
55
+ s
56
+ ]);
57
+ function l(n) {
58
+ return n;
59
+ }
60
+ const m = t.object({
61
+ description: t.string(),
62
+ inputSchema: t.object({
63
+ jsonSchema: t.record(t.any(), t.any())
64
+ }),
65
+ outputSchema: t.object({
66
+ jsonSchema: t.record(t.any(), t.any())
67
+ })
68
+ });
3
69
  export {
4
- i as tool,
5
- a as ui
70
+ o as messagePartReasoningSchema,
71
+ a as messagePartTextSchema,
72
+ r as messagePartToolSchema,
73
+ s as messagePartUnknownSchema,
74
+ c as messageSchema,
75
+ l as tool,
76
+ m as toolSignatureSchema
6
77
  };
package/package.json CHANGED
@@ -1,18 +1,16 @@
1
1
  {
2
2
  "name": "@assistant-wi/core",
3
3
  "private": false,
4
- "version": "0.0.13",
4
+ "version": "0.0.14",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
5
8
  "main": "./dist/index.cjs.js",
6
9
  "module": "./dist/index.es.js",
7
10
  "types": "./dist/index.d.ts",
8
11
  "files": [
9
12
  "dist"
10
13
  ],
11
- "sideEffects": false,
12
- "publishConfig": {
13
- "access": "public"
14
- },
15
- "author": "bulatsan",
16
14
  "exports": {
17
15
  ".": {
18
16
  "types": "./dist/index.d.ts",
@@ -20,35 +18,22 @@
20
18
  "require": "./dist/index.cjs.js",
21
19
  "default": "./dist/index.es.js"
22
20
  },
23
- "./tool": {
24
- "types": "./dist/tool/index.d.ts",
25
- "import": "./dist/tool/index.es.js",
26
- "require": "./dist/tool/index.cjs.js",
27
- "default": "./dist/tool/index.es.js"
28
- },
29
- "./ui": {
30
- "types": "./dist/ui/index.d.ts",
31
- "import": "./dist/ui/index.es.js",
32
- "require": "./dist/ui/index.cjs.js",
33
- "default": "./dist/ui/index.es.js"
34
- }
21
+ "./package.json": "./package.json"
35
22
  },
36
- "scripts": {
37
- "b": "tsc -b && vite build -c vite.config.ts",
38
- "build": "tsc -b && vite build -c vite.config.ts",
39
- "lint": "eslint .",
40
- "fmt": "prettier --write .",
41
- "test": "vitest"
23
+ "peerDependencies": {
24
+ "zod": "^4"
42
25
  },
43
26
  "devDependencies": {
44
- "@tsconfig/strictest": "^2.0.5",
45
- "@types/node": "^24.3.0",
46
- "vite": "^7.1.3",
27
+ "@biomejs/biome": "^2.3.11",
28
+ "@tsconfig/strictest": "^2.0.8",
29
+ "@types/node": "^24.10.1",
30
+ "typescript": "^5.9.3",
31
+ "vite": "^7.2.6",
47
32
  "vite-plugin-dts": "^4.5.4",
48
- "vitest": "^3.2.4",
49
- "zod": "^4.1.5"
33
+ "vitest": "^2.1.9",
34
+ "zod": "^4.1.13"
50
35
  },
51
- "peerDependencies": {
52
- "zod": "^4"
36
+ "dependencies": {
37
+ "ai": "^5.0.108"
53
38
  }
54
39
  }
@@ -1,9 +0,0 @@
1
- import { Tool } from './tool';
2
- export type Assistant = AssistantV0;
3
- export interface AssistantV0 {
4
- id: string;
5
- userId: string;
6
- systemPrompt?: string;
7
- contextPrompt?: () => string;
8
- tools?: Record<string, Tool>;
9
- }
@@ -1 +0,0 @@
1
- "use strict";function r(t,o,e){const n={};return v(n,t,o),x(n,t),w(n,t,e),n}function v(t,o,e){for(const n of e)Object.defineProperty(t,n,{value:a=>(o[n]=a,t),enumerable:!1,writable:!1,configurable:!1})}function w(t,o,e){if(!e)return;const n=e(o);for(const a of Object.keys(n))Object.defineProperty(t,a,{value:(...i)=>(n[a]?.(...i),t),enumerable:!1,writable:!1,configurable:!1})}function x(t,o){Object.defineProperty(t,"build",{value:()=>o,enumerable:!1,writable:!1,configurable:!1})}function c(...t){return r({type:"block",nodes:t,width:"auto",align:"start",justify:"start"},["direction","gap","nodes","width","align","justify"],e=>({row(){e.direction="row"},col(){e.direction="col"},addNode(n){e.nodes.push(n)}}))}function l(...t){return c(...t).row()}function d(...t){return c(...t).col()}function f(t){return r({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 m(...t){return r({type:"form",nodes:t,submitTitle:"Submit"},["title","description","submitTitle","onSubmit","nodes"],e=>({addNode(n){e.nodes.push(n)}}))}function p(t){return r({type:"list",pagination:t??(()=>({items:[],hasMore:!1}))},["pagination","title","totalPages"],e=>({staticPagination(n,a){const i=Math.max(1,Math.floor(a||0)),u=Math.ceil(n.length/i);e.totalPages=u,e.pagination=y=>{if(u===0)return{items:[],hasMore:!1};const h=Math.max(1,Math.floor(y||0)),s=Math.min(h,u);return{items:n.slice((s-1)*i,s*i),hasMore:s<u}}}}))}function b(t){return r({type:"text",text:t,animation:null,color:"primary",weight:"normal",size:"md"},["text","color","weight","size","animation"],e=>({primary(){e.color="primary"},muted(){e.color="muted"},shimmering(n={}){e.animation={type:"shimmering",...n}}}))}function g(t){return r({type:"error",text:t},["text"],()=>({}))}const P=Object.freeze(Object.defineProperty({__proto__:null,block:c,button:f,col:d,error:g,form:m,list:p,row:l,text:b},Symbol.toStringTag,{value:"Module"}));exports.block=c;exports.button=f;exports.col=d;exports.error=g;exports.form=m;exports.index=P;exports.list=p;exports.row=l;exports.text=b;
@@ -1,174 +0,0 @@
1
- function r(t, n, e) {
2
- const a = {};
3
- return f(a, t, n), p(a, t), m(a, t, e), a;
4
- }
5
- function f(t, n, e) {
6
- for (const a of e)
7
- Object.defineProperty(t, a, {
8
- value: (o) => (n[a] = o, t),
9
- enumerable: !1,
10
- writable: !1,
11
- configurable: !1
12
- });
13
- }
14
- function m(t, n, e) {
15
- if (!e) return;
16
- const a = e(n);
17
- for (const o of Object.keys(a))
18
- Object.defineProperty(t, o, {
19
- value: (...i) => (a[o]?.(...i), t),
20
- enumerable: !1,
21
- writable: !1,
22
- configurable: !1
23
- });
24
- }
25
- function p(t, n) {
26
- Object.defineProperty(t, "build", {
27
- value: () => n,
28
- enumerable: !1,
29
- writable: !1,
30
- configurable: !1
31
- });
32
- }
33
- function c(...t) {
34
- return r(
35
- {
36
- type: "block",
37
- nodes: t,
38
- width: "auto",
39
- align: "start",
40
- justify: "start"
41
- },
42
- ["direction", "gap", "nodes", "width", "align", "justify"],
43
- (e) => ({
44
- row() {
45
- e.direction = "row";
46
- },
47
- col() {
48
- e.direction = "col";
49
- },
50
- addNode(a) {
51
- e.nodes.push(a);
52
- }
53
- })
54
- );
55
- }
56
- function b(...t) {
57
- return c(...t).row();
58
- }
59
- function g(...t) {
60
- return c(...t).col();
61
- }
62
- function y(t) {
63
- return r({
64
- type: "button",
65
- text: t
66
- }, ["text", "variant", "onClick"], (e) => ({
67
- primary() {
68
- e.variant = "primary";
69
- },
70
- secondary() {
71
- e.variant = "secondary";
72
- },
73
- outline() {
74
- e.variant = "outline";
75
- },
76
- ghost() {
77
- e.variant = "ghost";
78
- },
79
- destructive() {
80
- e.variant = "destructive";
81
- }
82
- }));
83
- }
84
- function h(...t) {
85
- return r(
86
- {
87
- type: "form",
88
- nodes: t,
89
- submitTitle: "Submit"
90
- },
91
- ["title", "description", "submitTitle", "onSubmit", "nodes"],
92
- (e) => ({
93
- addNode(a) {
94
- e.nodes.push(a);
95
- }
96
- })
97
- );
98
- }
99
- function v(t) {
100
- return r({
101
- type: "list",
102
- pagination: t ?? (() => ({ items: [], hasMore: !1 }))
103
- }, ["pagination", "title", "totalPages"], (e) => ({
104
- staticPagination(a, o) {
105
- const i = Math.max(1, Math.floor(o || 0)), s = Math.ceil(a.length / i);
106
- e.totalPages = s, e.pagination = (l) => {
107
- if (s === 0) return { items: [], hasMore: !1 };
108
- const d = Math.max(1, Math.floor(l || 0)), u = Math.min(d, s);
109
- return {
110
- items: a.slice(
111
- (u - 1) * i,
112
- u * i
113
- ),
114
- hasMore: u < s
115
- };
116
- };
117
- }
118
- }));
119
- }
120
- function w(t) {
121
- return r(
122
- {
123
- type: "text",
124
- text: t,
125
- animation: null,
126
- color: "primary",
127
- weight: "normal",
128
- size: "md"
129
- },
130
- ["text", "color", "weight", "size", "animation"],
131
- (e) => ({
132
- primary() {
133
- e.color = "primary";
134
- },
135
- muted() {
136
- e.color = "muted";
137
- },
138
- shimmering(a = {}) {
139
- e.animation = {
140
- type: "shimmering",
141
- ...a
142
- };
143
- }
144
- })
145
- );
146
- }
147
- function P(t) {
148
- return r({
149
- type: "error",
150
- text: t
151
- }, ["text"], () => ({}));
152
- }
153
- const x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154
- __proto__: null,
155
- block: c,
156
- button: y,
157
- col: g,
158
- error: P,
159
- form: h,
160
- list: v,
161
- row: b,
162
- text: w
163
- }, Symbol.toStringTag, { value: "Module" }));
164
- export {
165
- y as a,
166
- c as b,
167
- g as c,
168
- P as e,
169
- h as f,
170
- x as i,
171
- v as l,
172
- b as r,
173
- w as t
174
- };
@@ -1,11 +0,0 @@
1
- function o(e) {
2
- return e;
3
- }
4
- const t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5
- __proto__: null,
6
- createTool: o
7
- }, Symbol.toStringTag, { value: "Module" }));
8
- export {
9
- o as c,
10
- t as i
11
- };
@@ -1 +0,0 @@
1
- "use strict";function e(t){return t}const o=Object.freeze(Object.defineProperty({__proto__:null,createTool:e},Symbol.toStringTag,{value:"Module"}));exports.createTool=e;exports.index=o;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-DMcbwFzr.js");exports.createTool=e.createTool;
@@ -1 +0,0 @@
1
- export * from './tool';
@@ -1,4 +0,0 @@
1
- import { c as r } from "../index-BXj6EgSG.mjs";
2
- export {
3
- r as createTool
4
- };
@@ -1,24 +0,0 @@
1
- import { default as z } from 'zod/v4';
2
- import { UI } from '../ui';
3
- export interface Tool<I extends z.ZodTypeAny = z.ZodTypeAny, O extends z.ZodTypeAny = z.ZodTypeAny> {
4
- description: string;
5
- inputSchema: I;
6
- outputSchema: O;
7
- workflow: {
8
- call: (props: ToolCallProps<I, O>) => Promise<void>;
9
- done: (props: ToolDoneProps<I, O>) => void;
10
- };
11
- }
12
- export interface ToolCallProps<Input extends z.ZodTypeAny, Output extends z.ZodTypeAny> {
13
- toolCallId: string;
14
- input: z.infer<Input>;
15
- render: (ui: UI) => void;
16
- commit: (result: z.infer<Output>) => void;
17
- }
18
- export interface ToolDoneProps<I extends z.ZodTypeAny, O extends z.ZodTypeAny> {
19
- toolCallId: string;
20
- input: z.infer<I>;
21
- output: z.infer<O>;
22
- render: (ui: UI) => void;
23
- }
24
- export declare function createTool<I extends z.ZodTypeAny, O extends z.ZodTypeAny>(tool: Tool<I, O>): Tool<I, O>;
@@ -1,11 +0,0 @@
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>;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index-14BiCzPY.js");exports.block=o.block;exports.button=o.button;exports.col=o.col;exports.error=o.error;exports.form=o.form;exports.list=o.list;exports.row=o.row;exports.text=o.text;
@@ -1,7 +0,0 @@
1
- export * from './ui';
2
- export * from './ui-block';
3
- export * from './ui-button';
4
- export * from './ui-form';
5
- export * from './ui-list';
6
- export * from './ui-text';
7
- export * from './ui-error';
@@ -1,11 +0,0 @@
1
- import { b as o, a as r, c as t, e, f as l, l as b, r as c, t as f } from "../index-8Ln_I-xT.mjs";
2
- export {
3
- o as block,
4
- r as button,
5
- t as col,
6
- e as error,
7
- l as form,
8
- b as list,
9
- c as row,
10
- f as text
11
- };
@@ -1,25 +0,0 @@
1
- import { UI } from './ui';
2
- export interface UIBlock {
3
- type: 'block';
4
- nodes: UI[];
5
- width?: 'auto' | 'full' | `${number}%` | undefined;
6
- direction?: 'row' | 'col' | undefined;
7
- gap?: number | undefined;
8
- align?: 'start' | 'center' | 'end' | undefined;
9
- justify?: 'start' | 'center' | 'end' | undefined;
10
- }
11
- export declare function block(...nodes: UI[]): import('./builder').Builder<UIBlock, ("direction" | "gap" | "nodes" | "width" | "align" | "justify")[], {
12
- row(): void;
13
- col(): void;
14
- addNode(node: UI): void;
15
- }>;
16
- export declare function row(...nodes: UI[]): import('./builder').Builder<UIBlock, ("direction" | "gap" | "nodes" | "width" | "align" | "justify")[], {
17
- row(): void;
18
- col(): void;
19
- addNode(node: UI): void;
20
- }>;
21
- export declare function col(...nodes: UI[]): import('./builder').Builder<UIBlock, ("direction" | "gap" | "nodes" | "width" | "align" | "justify")[], {
22
- row(): void;
23
- col(): void;
24
- addNode(node: UI): void;
25
- }>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,13 +0,0 @@
1
- export interface UIButton {
2
- type: 'button';
3
- text: string;
4
- variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive';
5
- onClick?: () => void | Promise<void>;
6
- }
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
- }>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export interface UIError {
2
- type: 'error';
3
- text: string;
4
- }
5
- export declare function error(text: string): import('./builder').Builder<UIError, "text"[], {}>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,20 +0,0 @@
1
- export interface UIForm {
2
- type: 'form';
3
- title?: string;
4
- description?: string;
5
- nodes: UIFormNode[];
6
- submitTitle?: string;
7
- onSubmit?: (values: Record<string, string>) => void | Promise<void>;
8
- }
9
- export interface UIFormNode {
10
- type: 'text' | 'number' | 'email' | 'tel' | 'url' | 'password';
11
- name: string;
12
- label: string;
13
- placeholder?: string;
14
- required?: boolean;
15
- value?: string;
16
- onChange?: (value: string) => void;
17
- }
18
- export declare function form(...nodes: UIFormNode[]): import('./builder').Builder<UIForm, ("nodes" | "title" | "description" | "submitTitle" | "onSubmit")[], {
19
- addNode(node: UIFormNode): void;
20
- }>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,21 +0,0 @@
1
- export interface UIList {
2
- type: 'list';
3
- pagination: UIListPagination;
4
- title?: string;
5
- totalPages?: number;
6
- }
7
- export interface UIListItem {
8
- id: string;
9
- title: string;
10
- description?: string;
11
- avatar?: string;
12
- onClick?: () => void | Promise<void>;
13
- }
14
- export interface UIListPaginationResponse {
15
- items: UIListItem[];
16
- hasMore?: boolean;
17
- }
18
- export type UIListPagination = (page: number) => UIListPaginationResponse | Promise<UIListPaginationResponse>;
19
- export declare function list(pagination?: UIListPagination): import('./builder').Builder<UIList, ("title" | "pagination" | "totalPages")[], {
20
- staticPagination(items: UIListItem[], itemsPerPage: number): void;
21
- }>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,17 +0,0 @@
1
- export interface UIText {
2
- type: 'text';
3
- text: string;
4
- color?: 'primary' | 'muted';
5
- weight?: 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold';
6
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
7
- animation?: null | UITextAnimationShimmering;
8
- }
9
- export type UITextAnimationShimmering = {
10
- type: 'shimmering';
11
- duration?: number;
12
- };
13
- export declare function text(text: string): import('./builder').Builder<UIText, ("text" | "color" | "weight" | "size" | "animation")[], {
14
- primary(): void;
15
- muted(): void;
16
- shimmering(props?: Omit<UITextAnimationShimmering, "type">): void;
17
- }>;
@@ -1 +0,0 @@
1
- export {};
package/dist/ui/ui.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import { UIBlock } from './ui-block';
2
- import { UIButton } from './ui-button';
3
- import { UIError } from './ui-error';
4
- import { UIForm } from './ui-form';
5
- import { UIList } from './ui-list';
6
- import { UIText } from './ui-text';
7
- export type UI = UIObject | {
8
- build(): UIObject;
9
- };
10
- export type UIObject = UIBlock | UIText | UIError | UIButton | UIForm | UIList;