dewee-webchat 0.2.0 → 0.4.1-beta.1
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/README.md +253 -15
- package/dist/{chunk-YV6PXYJZ.js → chunk-7WT3JK64.js} +621 -45
- package/dist/{chunk-JX6AH37X.js → chunk-USXVB3AC.js} +52 -7
- package/dist/dewee-webchat.js +36 -29
- package/dist/handler-DunrbnSD.d.ts +307 -0
- package/dist/index.d.ts +148 -40
- package/dist/index.js +4 -2
- package/dist/protocol-CLbGE9Ns.d.ts +170 -0
- package/dist/react.d.ts +2 -2
- package/dist/react.js +4 -4
- package/dist/server-identity.d.ts +6 -0
- package/dist/server-identity.js +6 -0
- package/dist/server.d.ts +33 -75
- package/dist/server.js +1507 -41
- package/dist/vue.d.ts +22 -4
- package/dist/vue.js +5 -3
- package/package.json +13 -1
- package/dist/protocol-B72Ry-fY.d.ts +0 -92
package/dist/vue.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
|
-
export { ActionConfirmHook, ActionEventDetail, DeweeChatConfig, DeweeChatElement, PageAction, PageActionContext } from './index.js';
|
|
4
|
-
import './protocol-
|
|
3
|
+
export { ActionConfirmHook, ActionEventDetail, DeweeChatConfig, DeweeChatElement, PageAction, PageActionContext, RequestHeadersOption } from './index.js';
|
|
4
|
+
import './protocol-CLbGE9Ns.js';
|
|
5
5
|
|
|
6
6
|
declare const DeweeChat: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
7
7
|
endpoint: {
|
|
@@ -128,9 +128,17 @@ declare const DeweeChat: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
128
128
|
type: PropType<any>;
|
|
129
129
|
default: undefined;
|
|
130
130
|
};
|
|
131
|
+
headers: {
|
|
132
|
+
type: PropType<any>;
|
|
133
|
+
default: undefined;
|
|
134
|
+
};
|
|
135
|
+
fetch: {
|
|
136
|
+
type: PropType<any>;
|
|
137
|
+
default: undefined;
|
|
138
|
+
};
|
|
131
139
|
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
132
140
|
[key: string]: any;
|
|
133
|
-
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("open" | "
|
|
141
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("open" | "close" | "error" | "send" | "action" | "ready" | "reply")[], "open" | "close" | "error" | "send" | "action" | "ready" | "reply", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
134
142
|
endpoint: {
|
|
135
143
|
type: PropType<any>;
|
|
136
144
|
default: undefined;
|
|
@@ -255,12 +263,20 @@ declare const DeweeChat: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
255
263
|
type: PropType<any>;
|
|
256
264
|
default: undefined;
|
|
257
265
|
};
|
|
266
|
+
headers: {
|
|
267
|
+
type: PropType<any>;
|
|
268
|
+
default: undefined;
|
|
269
|
+
};
|
|
270
|
+
fetch: {
|
|
271
|
+
type: PropType<any>;
|
|
272
|
+
default: undefined;
|
|
273
|
+
};
|
|
258
274
|
}>> & Readonly<{
|
|
259
|
-
onOpen?: ((...args: any[]) => any) | undefined;
|
|
260
275
|
onReady?: ((...args: any[]) => any) | undefined;
|
|
261
276
|
onSend?: ((...args: any[]) => any) | undefined;
|
|
262
277
|
onReply?: ((...args: any[]) => any) | undefined;
|
|
263
278
|
onError?: ((...args: any[]) => any) | undefined;
|
|
279
|
+
onOpen?: ((...args: any[]) => any) | undefined;
|
|
264
280
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
265
281
|
onAction?: ((...args: any[]) => any) | undefined;
|
|
266
282
|
}>, {
|
|
@@ -295,6 +311,8 @@ declare const DeweeChat: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
295
311
|
getPageContext: any;
|
|
296
312
|
maxActionRounds: any;
|
|
297
313
|
actionTimeoutMs: any;
|
|
314
|
+
headers: any;
|
|
315
|
+
fetch: any;
|
|
298
316
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
299
317
|
|
|
300
318
|
export { DeweeChat, DeweeChat as default };
|
package/dist/vue.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineDeweeChat
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-7WT3JK64.js";
|
|
4
|
+
import "./chunk-USXVB3AC.js";
|
|
5
5
|
|
|
6
6
|
// src/vue.ts
|
|
7
7
|
import { defineComponent, h, onMounted, ref, watch } from "vue";
|
|
@@ -36,7 +36,9 @@ var keys = [
|
|
|
36
36
|
"confirm",
|
|
37
37
|
"getPageContext",
|
|
38
38
|
"maxActionRounds",
|
|
39
|
-
"actionTimeoutMs"
|
|
39
|
+
"actionTimeoutMs",
|
|
40
|
+
"headers",
|
|
41
|
+
"fetch"
|
|
40
42
|
];
|
|
41
43
|
var props = Object.fromEntries(keys.map((k) => [k, { type: null, default: void 0 }]));
|
|
42
44
|
var EVENTS = ["ready", "send", "reply", "error", "open", "close", "action"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dewee-webchat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1-beta.1",
|
|
4
4
|
"description": "Embeddable chat widget for Dewee AI agents — web component, React/Vue/Astro wrappers and a secure backend handler (Workers, Next.js, Node, Bun, Deno).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,6 +45,10 @@
|
|
|
45
45
|
"types": "./dist/server.d.ts",
|
|
46
46
|
"import": "./dist/server.js"
|
|
47
47
|
},
|
|
48
|
+
"./server/identity": {
|
|
49
|
+
"types": "./dist/server-identity.d.ts",
|
|
50
|
+
"import": "./dist/server-identity.js"
|
|
51
|
+
},
|
|
48
52
|
"./react": {
|
|
49
53
|
"types": "./dist/react.d.ts",
|
|
50
54
|
"import": "./dist/react.js"
|
|
@@ -67,13 +71,18 @@
|
|
|
67
71
|
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsup",
|
|
68
72
|
"dev": "tsup --watch",
|
|
69
73
|
"test": "vitest run",
|
|
74
|
+
"test:bundlers": "node scripts/bundler-smoke.mjs",
|
|
70
75
|
"typecheck": "tsc --noEmit"
|
|
71
76
|
},
|
|
72
77
|
"peerDependencies": {
|
|
78
|
+
"@dewee/identity": ">=0.1.0-beta.0 <1",
|
|
73
79
|
"react": ">=18",
|
|
74
80
|
"vue": ">=3.3"
|
|
75
81
|
},
|
|
76
82
|
"peerDependenciesMeta": {
|
|
83
|
+
"@dewee/identity": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
77
86
|
"react": {
|
|
78
87
|
"optional": true
|
|
79
88
|
},
|
|
@@ -82,15 +91,18 @@
|
|
|
82
91
|
}
|
|
83
92
|
},
|
|
84
93
|
"devDependencies": {
|
|
94
|
+
"@dewee/identity": "file:../../vendor/dewee-identity-0.1.0-beta.0.tgz",
|
|
85
95
|
"@types/node": "^22.15.0",
|
|
86
96
|
"@types/react": "^19.1.0",
|
|
87
97
|
"@types/ws": "^8.18.2",
|
|
98
|
+
"esbuild": "^0.28.2",
|
|
88
99
|
"happy-dom": "^18.0.1",
|
|
89
100
|
"react": "^19.1.0",
|
|
90
101
|
"tsup": "^8.5.0",
|
|
91
102
|
"typescript": "^5.9.2",
|
|
92
103
|
"vitest": "^3.2.4",
|
|
93
104
|
"vue": "^3.5.18",
|
|
105
|
+
"webpack": "^5.112.0",
|
|
94
106
|
"ws": "^8.22.0"
|
|
95
107
|
},
|
|
96
108
|
"engines": {
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/** Server-Sent Events emitted by `POST {basePath}/chat`. */
|
|
2
|
-
type ChatStreamEvent = {
|
|
3
|
-
type: "start";
|
|
4
|
-
runId?: string;
|
|
5
|
-
conversationId: string;
|
|
6
|
-
agent: string;
|
|
7
|
-
actionsHash?: string;
|
|
8
|
-
} | {
|
|
9
|
-
type: "thinking";
|
|
10
|
-
text: string;
|
|
11
|
-
} | {
|
|
12
|
-
type: "delta";
|
|
13
|
-
text: string;
|
|
14
|
-
} | {
|
|
15
|
-
type: "tool_call";
|
|
16
|
-
id: string;
|
|
17
|
-
name: string;
|
|
18
|
-
arguments?: unknown;
|
|
19
|
-
} | {
|
|
20
|
-
type: "tool_result";
|
|
21
|
-
id: string;
|
|
22
|
-
name: string;
|
|
23
|
-
isError: boolean;
|
|
24
|
-
result?: string;
|
|
25
|
-
} | {
|
|
26
|
-
type: "done";
|
|
27
|
-
content: string;
|
|
28
|
-
usage?: Record<string, number>;
|
|
29
|
-
} | {
|
|
30
|
-
type: "error";
|
|
31
|
-
message: string;
|
|
32
|
-
code?: string;
|
|
33
|
-
};
|
|
34
|
-
interface AgentInfo {
|
|
35
|
-
id: string;
|
|
36
|
-
name?: string;
|
|
37
|
-
description?: string;
|
|
38
|
-
}
|
|
39
|
-
/** Response of `GET {basePath}/config` — safe to expose publicly. */
|
|
40
|
-
interface PublicConfig {
|
|
41
|
-
agents: AgentInfo[];
|
|
42
|
-
defaultAgent: string;
|
|
43
|
-
allowAgentSwitch: boolean;
|
|
44
|
-
allowClientCredentials: boolean;
|
|
45
|
-
turnstileSiteKey?: string;
|
|
46
|
-
maxMessageLength: number;
|
|
47
|
-
version: string;
|
|
48
|
-
}
|
|
49
|
-
/** Response of `POST {basePath}/session`. */
|
|
50
|
-
interface SessionResponse {
|
|
51
|
-
visitorId: string;
|
|
52
|
-
token: string;
|
|
53
|
-
expiresAt: number;
|
|
54
|
-
}
|
|
55
|
-
interface ToolCallView {
|
|
56
|
-
id: string;
|
|
57
|
-
name: string;
|
|
58
|
-
arguments?: unknown;
|
|
59
|
-
result?: string;
|
|
60
|
-
isError?: boolean;
|
|
61
|
-
status: "running" | "done" | "error";
|
|
62
|
-
}
|
|
63
|
-
/** A transcript message as returned by `GET {basePath}/history`. */
|
|
64
|
-
interface HistoryMessage {
|
|
65
|
-
role: "user" | "assistant";
|
|
66
|
-
content: string;
|
|
67
|
-
thinking?: string;
|
|
68
|
-
toolCalls?: ToolCallView[];
|
|
69
|
-
createdAt?: string;
|
|
70
|
-
}
|
|
71
|
-
/** How much an agent-invoked page action can change. `mutate`/`destructive` always need user approval. */
|
|
72
|
-
type ActionSensitivity = "read" | "navigate" | "mutate" | "destructive";
|
|
73
|
-
/** What the backend (and the agent) learns about a page action. Handlers never leave the browser. */
|
|
74
|
-
interface ActionManifestEntry {
|
|
75
|
-
name: string;
|
|
76
|
-
description: string;
|
|
77
|
-
/** JSON Schema subset describing `args` (object). */
|
|
78
|
-
parameters: Record<string, unknown>;
|
|
79
|
-
sensitivity: ActionSensitivity;
|
|
80
|
-
}
|
|
81
|
-
/** Body of `POST {basePath}/chat`. `actions`/`actionsHash`/`pageContext` are optional (page actions). */
|
|
82
|
-
interface ChatRequestBody {
|
|
83
|
-
message: string;
|
|
84
|
-
agent?: string;
|
|
85
|
-
conversationId?: string;
|
|
86
|
-
actions?: ActionManifestEntry[];
|
|
87
|
-
/** Hash from the `start` event of the last completed turn; the manifest is re-sent to the agent only when it differs. */
|
|
88
|
-
actionsHash?: string;
|
|
89
|
-
pageContext?: unknown;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export type { AgentInfo as A, ChatStreamEvent as C, HistoryMessage as H, PublicConfig as P, SessionResponse as S, ToolCallView as T, ActionManifestEntry as a, ActionSensitivity as b, ChatRequestBody as c };
|