weifuwu 0.18.2 → 0.18.4

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.
Files changed (78) hide show
  1. package/cli.ts +10 -101
  2. package/dist/cli.js +7 -95
  3. package/dist/dist/agent/client.d.ts +2 -0
  4. package/dist/dist/agent/index.d.ts +2 -0
  5. package/dist/dist/agent/migrate.d.ts +6 -0
  6. package/dist/dist/agent/rest.d.ts +13 -0
  7. package/dist/dist/agent/run.d.ts +17 -0
  8. package/dist/dist/agent/types.d.ts +51 -0
  9. package/dist/dist/ai/workflow.d.ts +14 -0
  10. package/dist/dist/analytics.d.ts +15 -0
  11. package/dist/dist/client-locale.d.ts +5 -0
  12. package/dist/dist/client-pref.d.ts +3 -0
  13. package/dist/dist/client-state.d.ts +22 -0
  14. package/dist/dist/client-theme.d.ts +7 -0
  15. package/dist/dist/compress.d.ts +6 -0
  16. package/dist/dist/cookie.d.ts +12 -0
  17. package/dist/dist/deploy/config.d.ts +2 -0
  18. package/dist/dist/deploy/gateway.d.ts +2 -0
  19. package/dist/dist/deploy/index.d.ts +4 -0
  20. package/dist/dist/deploy/manager.d.ts +16 -0
  21. package/dist/dist/deploy/process.d.ts +14 -0
  22. package/dist/dist/deploy/types.d.ts +62 -0
  23. package/dist/dist/head.d.ts +6 -0
  24. package/dist/dist/helmet.d.ts +18 -0
  25. package/dist/dist/iii/client.d.ts +2 -0
  26. package/dist/dist/iii/index.d.ts +4 -0
  27. package/dist/dist/iii/register-worker.d.ts +10 -0
  28. package/dist/dist/iii/rest.d.ts +3 -0
  29. package/dist/dist/iii/stream.d.ts +82 -0
  30. package/dist/dist/iii/types.d.ts +133 -0
  31. package/dist/dist/iii/worker.d.ts +2 -0
  32. package/dist/dist/iii/ws.d.ts +29 -0
  33. package/dist/dist/index.js +8180 -0
  34. package/dist/dist/messager/agent.d.ts +6 -0
  35. package/dist/dist/messager/client.d.ts +2 -0
  36. package/dist/dist/messager/index.d.ts +2 -0
  37. package/dist/dist/messager/migrate.d.ts +2 -0
  38. package/dist/dist/messager/rest.d.ts +15 -0
  39. package/dist/dist/messager/types.d.ts +56 -0
  40. package/dist/dist/messager/ws.d.ts +14 -0
  41. package/dist/dist/preferences.d.ts +14 -0
  42. package/dist/dist/react.d.ts +12 -0
  43. package/dist/dist/react.js +637 -0
  44. package/dist/dist/request-id.d.ts +6 -0
  45. package/dist/dist/seo.d.ts +39 -0
  46. package/dist/dist/ssr/compile.d.ts +2 -0
  47. package/dist/{ssr → dist/ssr}/index.d.ts +1 -1
  48. package/dist/{ssr → dist/ssr}/index.js +372 -375
  49. package/dist/dist/ssr/ssr.d.ts +2 -0
  50. package/dist/dist/tenant/client.d.ts +2 -0
  51. package/dist/dist/tenant/graphql.d.ts +3 -0
  52. package/dist/dist/tenant/index.d.ts +2 -0
  53. package/dist/dist/tenant/migrate.d.ts +6 -0
  54. package/dist/dist/tenant/rest.d.ts +3 -0
  55. package/dist/dist/tenant/schema.d.ts +5 -0
  56. package/dist/dist/tenant/types.d.ts +48 -0
  57. package/dist/dist/tenant/utils.d.ts +10 -0
  58. package/dist/dist/types.d.ts +19 -0
  59. package/dist/dist/use-flash-message.d.ts +1 -0
  60. package/dist/error-boundary.d.ts +2 -0
  61. package/dist/index.d.ts +7 -0
  62. package/dist/index.js +213 -53
  63. package/dist/layout.d.ts +2 -0
  64. package/dist/live.d.ts +6 -0
  65. package/dist/not-found.d.ts +2 -0
  66. package/dist/router.d.ts +9 -9
  67. package/dist/ssr.d.ts +2 -0
  68. package/dist/stream.d.ts +14 -0
  69. package/dist/tailwind.d.ts +2 -0
  70. package/package.json +3 -4
  71. package/dist/ssr/ssr.d.ts +0 -3
  72. /package/dist/{ssr/compile.d.ts → compile.d.ts} +0 -0
  73. /package/dist/{ssr → dist/ssr}/error-boundary.d.ts +0 -0
  74. /package/dist/{ssr → dist/ssr}/layout.d.ts +0 -0
  75. /package/dist/{ssr → dist/ssr}/live.d.ts +0 -0
  76. /package/dist/{ssr → dist/ssr}/not-found.d.ts +0 -0
  77. /package/dist/{ssr → dist/ssr}/stream.d.ts +0 -0
  78. /package/dist/{ssr → dist/ssr}/tailwind.d.ts +0 -0
@@ -0,0 +1,6 @@
1
+ import type { Sql } from '../vendor.ts';
2
+ import type { AgentModule } from '../agent/types.ts';
3
+ import type { Hub } from '../hub.ts';
4
+ export declare function runAgentRouting(sql: Sql<{}>, messages: {
5
+ insert: (data: any) => Promise<any>;
6
+ }, agents: AgentModule | undefined, hub: Hub, channelId: number, content: string): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { MessagerOptions, MessagerModule } from './types.ts';
2
+ export declare function messager(options: MessagerOptions): MessagerModule;
@@ -0,0 +1,2 @@
1
+ export { messager } from './client.ts';
2
+ export type { MessagerOptions, MessagerModule, Channel, ChannelMember, Message } from './types.ts';
@@ -0,0 +1,2 @@
1
+ import type { Sql } from '../vendor.ts';
2
+ export declare function migrate(sql: Sql<{}>): Promise<void>;
@@ -0,0 +1,15 @@
1
+ import type { Sql } from '../vendor.ts';
2
+ import { Router } from '../router.ts';
3
+ import type { AgentModule } from '../agent/types.ts';
4
+ import type { Hub } from '../hub.ts';
5
+ import type { BoundTable } from '../postgres/schema/index.ts';
6
+ interface RestDeps {
7
+ sql: Sql<{}>;
8
+ channels: BoundTable<any>;
9
+ members: BoundTable<any>;
10
+ messages: BoundTable<any>;
11
+ agents?: AgentModule;
12
+ hub: Hub;
13
+ }
14
+ export declare function buildRouter(deps: RestDeps): Router;
15
+ export {};
@@ -0,0 +1,56 @@
1
+ import type { Router } from '../router.ts';
2
+ import type { AgentModule } from '../agent/types.ts';
3
+ import type { PostgresClient } from '../postgres/types.ts';
4
+ import type { Redis } from '../vendor.ts';
5
+ export interface MessagerOptions {
6
+ pg: PostgresClient;
7
+ agents?: AgentModule;
8
+ webhookTimeout?: number;
9
+ redis?: Redis;
10
+ }
11
+ export interface Channel {
12
+ id: number;
13
+ tenant_id: string | null;
14
+ name: string;
15
+ type: 'channel' | 'dm';
16
+ created_by: number;
17
+ created_at: string;
18
+ }
19
+ export interface ChannelMember {
20
+ id: number;
21
+ channel_id: number;
22
+ member_id: number;
23
+ member_type: 'user' | 'agent' | 'webhook';
24
+ role: 'admin' | 'member';
25
+ last_read_id: number | null;
26
+ }
27
+ export interface Message {
28
+ id: number;
29
+ channel_id: number;
30
+ sender_id: number;
31
+ sender_type: 'user' | 'agent' | 'webhook';
32
+ type: 'text' | 'image' | 'file' | 'system';
33
+ content: string;
34
+ file_url: string | null;
35
+ file_name: string | null;
36
+ file_size: number | null;
37
+ mime_type: string | null;
38
+ created_at: string;
39
+ }
40
+ export interface MessagerModule extends Router {
41
+ migrate: () => Promise<void>;
42
+ wsHandler: () => any;
43
+ send: (channelId: number, content: string, opts?: {
44
+ sender_type?: string;
45
+ sender_id?: number;
46
+ type?: string;
47
+ }) => Promise<Message>;
48
+ close: () => Promise<void>;
49
+ }
50
+ export interface WSMessage {
51
+ type: 'message' | 'typing' | 'read';
52
+ channel_id: number;
53
+ content?: string;
54
+ is_typing?: boolean;
55
+ last_message_id?: number;
56
+ }
@@ -0,0 +1,14 @@
1
+ import type { Sql } from '../vendor.ts';
2
+ import type { AgentModule } from '../agent/types.ts';
3
+ import type { Hub } from '../hub.ts';
4
+ interface WSDeps {
5
+ sql: Sql<{}>;
6
+ agents?: AgentModule;
7
+ redis?: import('../vendor.ts').Redis;
8
+ }
9
+ export declare function broadcastToChannel(hub: Hub | undefined, channelId: number, data: any): void;
10
+ export declare function createWSHandler(deps: WSDeps): {
11
+ handler: any;
12
+ hub: Hub;
13
+ };
14
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { Middleware } from './types.ts';
2
+ export interface PrefOptions {
3
+ dir?: string;
4
+ locale?: {
5
+ default?: string;
6
+ cookie?: string;
7
+ fromAcceptLanguage?: boolean;
8
+ };
9
+ theme?: {
10
+ default?: string;
11
+ cookie?: string;
12
+ };
13
+ }
14
+ export declare function preferences(options: PrefOptions): Middleware;
@@ -0,0 +1,12 @@
1
+ export { useWebsocket } from './use-websocket.ts';
2
+ export type { UseWebsocketOptions, UseWebsocketReturn } from './use-websocket.ts';
3
+ export { useAction } from './use-action.ts';
4
+ export type { UseActionOptions, UseActionReturn } from './use-action.ts';
5
+ export { Link, useNavigate, navigate, useNavigating, addInterceptor } from './client-router.ts';
6
+ export { TsxContext, useLoaderData } from './tsx-context.ts';
7
+ export { Head } from './head.tsx';
8
+ export { createStore, useFetch, useQueryState } from './client-state.ts';
9
+ export type { StoreApi } from './client-state.ts';
10
+ export { useLocale } from './client-locale.ts';
11
+ export { useTheme, applyTheme } from './client-theme.ts';
12
+ export { useFlashMessage } from './use-flash-message.ts';