@firmer/mesh 0.0.11 → 0.0.12

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/psi/vm.d.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  import { Context } from './context';
2
2
  import { Page, Paging, Script } from '../types';
3
3
  export declare abstract class VM {
4
+ /**
5
+ * Render the script.
6
+ * 创建脚本脚手架.
7
+ */
8
+ render(script: Script, ctx?: Context): Promise<Record<string, Uint8Array>>;
4
9
  /**
5
10
  * Compile the script.
6
11
  * 编译脚本,编译通即会保存快照.
@@ -72,3 +72,134 @@ export declare class FileEntry {
72
72
  */
73
73
  text: string;
74
74
  }
75
+ export declare class StreamEntity {
76
+ /**
77
+ *
78
+ */
79
+ role: string;
80
+ /**
81
+ * 体系 editor/converser
82
+ * 体系 editor/converser
83
+ */
84
+ party: string;
85
+ /**
86
+ * see ContentType
87
+ * see ContentType
88
+ */
89
+ kind: string;
90
+ /**
91
+ * AI思考过程
92
+ * AI思考过程
93
+ */
94
+ think: string;
95
+ /**
96
+ *
97
+ */
98
+ data: string;
99
+ /**
100
+ * Format mp3, mp4, wav, etc.
101
+ * Format mp3, mp4, wav, etc.
102
+ */
103
+ format: string;
104
+ /**
105
+ * Batch代表一次对话的所有响应
106
+ * Batch代表一次对话的所有响应
107
+ */
108
+ batch: string;
109
+ }
110
+ export declare class StreamOption {
111
+ /**
112
+ *
113
+ */
114
+ searchType: string;
115
+ /**
116
+ *
117
+ */
118
+ deepThink: boolean;
119
+ /**
120
+ *
121
+ */
122
+ deepResearch: boolean;
123
+ /**
124
+ * Model name, e.g., Qwen2-Audio-7B-Instruct
125
+ * Model name, e.g., Qwen2-Audio-7B-Instruct
126
+ */
127
+ model: string;
128
+ /**
129
+ * Scene name, e.g., audio, video, text
130
+ * Scene name, e.g., audio, video, text
131
+ */
132
+ scene: string;
133
+ /**
134
+ * default as generate,rewrite
135
+ * default as generate,rewrite
136
+ */
137
+ operateType: string;
138
+ /**
139
+ * Language of the content, e.g., zh, en
140
+ * Language of the content, e.g., zh, en
141
+ */
142
+ language: string;
143
+ /**
144
+ * 知识库编号
145
+ * 知识库编号
146
+ */
147
+ knowledgeID: string;
148
+ /**
149
+ * 代理地址
150
+ * 代理地址
151
+ */
152
+ proxy: string;
153
+ /**
154
+ * 补充参数
155
+ * 补充参数
156
+ */
157
+ attaches: Record<string, string>;
158
+ }
159
+ export declare class StreamHello {
160
+ /**
161
+ *
162
+ */
163
+ method: string;
164
+ /**
165
+ *
166
+ */
167
+ mode: string;
168
+ /**
169
+ *
170
+ */
171
+ traceId: string;
172
+ /**
173
+ *
174
+ */
175
+ token: string;
176
+ /**
177
+ *
178
+ */
179
+ conversationId: string;
180
+ /**
181
+ *
182
+ */
183
+ contents: StreamEntity[];
184
+ /**
185
+ *
186
+ */
187
+ options: StreamOption;
188
+ }
189
+ export declare class StreamPacket {
190
+ /**
191
+ * Result code
192
+ * Result code
193
+ */
194
+ code: string;
195
+ /**
196
+ * Result message
197
+ * Result message
198
+ */
199
+ message: string;
200
+ /**
201
+ * AI generate content
202
+ * AI generate content
203
+ */
204
+ content: StreamEntity;
205
+ }
@@ -71,3 +71,55 @@ export declare class Script extends Mani {
71
71
  */
72
72
  raw: Record<string, string>;
73
73
  }
74
+ export declare class Manifest {
75
+ /**
76
+ * Script code
77
+ * Script code
78
+ */
79
+ code: string;
80
+ /**
81
+ * Script name
82
+ * Script name
83
+ */
84
+ name: string;
85
+ /**
86
+ * Script kind, EXPRESSION/VALUE/SCRIPT/PROJECT. PROJECT is .tar format
87
+ * Script kind, EXPRESSION/VALUE/SCRIPT/PROJECT. PROJECT is .tar format
88
+ */
89
+ kind: string;
90
+ /**
91
+ * Script lang
92
+ * Script lang
93
+ */
94
+ lang: string;
95
+ /**
96
+ * 标记 1内置
97
+ * 标记 1内置
98
+ */
99
+ flags: number;
100
+ /**
101
+ * Script author
102
+ * Script author
103
+ */
104
+ author: string;
105
+ /**
106
+ * Script version
107
+ * Script version
108
+ */
109
+ version: string;
110
+ /**
111
+ * Script runtime, FE/RE
112
+ * Script runtime, FE/RE
113
+ */
114
+ runtime: string;
115
+ /**
116
+ * Script memo
117
+ * Script memo
118
+ */
119
+ memo: string;
120
+ /**
121
+ * Script icon
122
+ * Script icon
123
+ */
124
+ icon: string;
125
+ }
@@ -0,0 +1,2 @@
1
+ export * from './useAuth';
2
+ export * from './useStream';
@@ -0,0 +1,28 @@
1
+ import { Credential, Session } from '../types';
2
+ import { FC, ReactNode } from 'react';
3
+ export declare const QrParties: {
4
+ label: string;
5
+ value: string;
6
+ }[];
7
+ export type AuthMode = 'sms' | 'qrcode' | 'password';
8
+ declare class AuthContext {
9
+ redirect?: string;
10
+ session?: Session;
11
+ private readonly cacheKey;
12
+ private static readonly tokenizer;
13
+ private static readonly instance;
14
+ authorize(mode: AuthMode, account: Credential): Promise<void>;
15
+ authorized(): boolean;
16
+ authenticate(): Promise<Session>;
17
+ destroy(): Promise<void>;
18
+ static global(): AuthContext;
19
+ }
20
+ export declare const AuthContextProvider: FC<{
21
+ children: ReactNode;
22
+ redirect: string;
23
+ }>;
24
+ export declare const useAuth: () => AuthContext;
25
+ export declare const Authenticator: FC<{
26
+ next: (authorized: boolean, redirect: string) => ReactNode;
27
+ }>;
28
+ export {};
@@ -0,0 +1,16 @@
1
+ import { FC, ReactNode } from 'react';
2
+ import { StreamEntity, StreamHello } from '../types';
3
+ export declare class StreamContext {
4
+ /**
5
+ * SSE context.
6
+ */
7
+ sse(appset: string, hello: StreamHello, onmessage: (content: StreamEntity) => Promise<void>): Promise<void>;
8
+ /**
9
+ * Upload file into OOS.
10
+ */
11
+ fileup(file: File | Blob, bucket?: string, ext?: string, onprogress?: (step: number) => void): Promise<string>;
12
+ }
13
+ export declare const useStream: () => StreamContext;
14
+ export declare const StreamContextProvider: FC<{
15
+ children: ReactNode;
16
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firmer/mesh",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Mesh: A lightweight, distributed, relational network architecture for MPC",
5
5
  "homepage": "mesh",
6
6
  "repository": "git.firmer.tech/firmer/mesh",
@@ -46,6 +46,7 @@
46
46
  "devDependencies": {
47
47
  "@firmer/tsc": "0.0.1",
48
48
  "@types/react": "^19.2.10",
49
+ "@vitejs/plugin-react": "^5.1.3",
49
50
  "reflect-metadata": "^0.2.2",
50
51
  "typescript": "^5.9.3",
51
52
  "vite": "^7.3.1",