@leaflow/sdk 0.0.0-dev.113.g5d6fb99 → 0.0.0-dev.9.gd1c7e65

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 ADDED
@@ -0,0 +1,24 @@
1
+ # leaflow-ts
2
+
3
+ Leaflow 平台的 TypeScript SDK(`@leaflow/sdk`)。
4
+ `gen/` 下全是产物,源在 `LeaflowNET/leaflowapis`。
5
+
6
+ ## 为什么和 Go 分开在两个仓库
7
+
8
+ **它们在同一个仓库里会抢同一个 tag 空间。** Go 的子目录模块要 `go/v1.2.3` 这种带前缀的 tag,
9
+ npm 要 `v1.2.3`——上一版两者挤在一个仓库里,结果是 Go 那半从来没被正确发布过,而没有任何东西
10
+ 会报错(`go get` 只是拿不到)。
11
+
12
+ ## 契约是一个 submodule
13
+
14
+ ```
15
+ leaflowapis/ 钉在某一个 commit 上——那个指针就是「这版 SDK 出自哪版契约」的答案
16
+ ```
17
+
18
+ ```
19
+ git submodule update --remote leaflowapis # 要跟进新契约时才做
20
+ npm run generate
21
+ ```
22
+
23
+ 产物由人在本地跑完提交,CI 只验证不写回:一个会 commit 回来的流水线,在两次推送挨得近时只能靠
24
+ 重试或者强推——前者会打架,后者会丢东西。
@@ -1,68 +1,68 @@
1
1
  export type { paths, components, operations, webhooks } from "./schema.js";
2
2
  import type { operations } from "./schema.js";
3
- /** `POST /v1/attachments` 成功时的响应体。 */
3
+ /** `POST /api/v1/attachments` 成功时的响应体。 */
4
4
  export type UploadAttachmentResult = operations["upload-attachment"]["responses"][201]["content"]["application/json"];
5
- /** `GET /v1/bindings` 成功时的响应体。 */
5
+ /** `GET /api/v1/bindings` 成功时的响应体。 */
6
6
  export type ListBindingsResult = operations["list-bindings"]["responses"][200]["content"]["application/json"];
7
- /** `GET /v1/bindings/{binding}` 成功时的响应体。 */
7
+ /** `GET /api/v1/bindings/{binding}` 成功时的响应体。 */
8
8
  export type GetBindingResult = operations["get-binding"]["responses"][200]["content"]["application/json"];
9
- /** `GET /v1/channels` 成功时的响应体。 */
9
+ /** `GET /api/v1/channels` 成功时的响应体。 */
10
10
  export type ListChannelsResult = operations["list-channels"]["responses"][200]["content"]["application/json"];
11
- /** `POST /v1/channels` 成功时的响应体。 */
11
+ /** `POST /api/v1/channels` 成功时的响应体。 */
12
12
  export type CreateChannelResult = operations["create-channel"]["responses"][201]["content"]["application/json"];
13
- /** `POST /v1/channels` 的请求体。 */
13
+ /** `POST /api/v1/channels` 的请求体。 */
14
14
  export type CreateChannelBody = NonNullable<operations["create-channel"]["requestBody"]>["content"]["application/json"];
15
- /** `GET /v1/channels/{channel}` 成功时的响应体。 */
15
+ /** `GET /api/v1/channels/{channel}` 成功时的响应体。 */
16
16
  export type GetChannelResult = operations["get-channel"]["responses"][200]["content"]["application/json"];
17
- /** `PATCH /v1/channels/{channel}` 成功时的响应体。 */
17
+ /** `PATCH /api/v1/channels/{channel}` 成功时的响应体。 */
18
18
  export type UpdateChannelResult = operations["update-channel"]["responses"][200]["content"]["application/json"];
19
- /** `PATCH /v1/channels/{channel}` 的请求体。 */
19
+ /** `PATCH /api/v1/channels/{channel}` 的请求体。 */
20
20
  export type UpdateChannelBody = NonNullable<operations["update-channel"]["requestBody"]>["content"]["application/json"];
21
- /** `POST /v1/channels/{channel}/binding-codes` 成功时的响应体。 */
21
+ /** `POST /api/v1/channels/{channel}/binding-codes` 成功时的响应体。 */
22
22
  export type CreateBindingCodeResult = operations["create-binding-code"]["responses"][201]["content"]["application/json"];
23
- /** `GET /v1/channels/{channel}/rejections` 成功时的响应体。 */
23
+ /** `GET /api/v1/channels/{channel}/rejections` 成功时的响应体。 */
24
24
  export type ListChannelRejectionsResult = operations["list-channel-rejections"]["responses"][200]["content"]["application/json"];
25
- /** `POST /v1/channels/{channel}/secret` 成功时的响应体。 */
25
+ /** `POST /api/v1/channels/{channel}/secret` 成功时的响应体。 */
26
26
  export type RotateChannelSecretResult = operations["rotate-channel-secret"]["responses"][200]["content"]["application/json"];
27
- /** `POST /v1/channels/{channel}/secret` 的请求体。 */
27
+ /** `POST /api/v1/channels/{channel}/secret` 的请求体。 */
28
28
  export type RotateChannelSecretBody = NonNullable<operations["rotate-channel-secret"]["requestBody"]>["content"]["application/json"];
29
- /** `GET /v1/channels/{channel}/sender-check` 成功时的响应体。 */
29
+ /** `GET /api/v1/channels/{channel}/sender-check` 成功时的响应体。 */
30
30
  export type CheckSenderResult = operations["check-sender"]["responses"][200]["content"]["application/json"];
31
- /** `POST /v1/channels/{channel}/weixin-logins` 成功时的响应体。 */
31
+ /** `POST /api/v1/channels/{channel}/weixin-logins` 成功时的响应体。 */
32
32
  export type BeginWeixinLoginResult = operations["begin-weixin-login"]["responses"][201]["content"]["application/json"];
33
- /** `GET /v1/platforms` 成功时的响应体。 */
33
+ /** `GET /api/v1/platforms` 成功时的响应体。 */
34
34
  export type ListPlatformsResult = operations["list-platforms"]["responses"][200]["content"]["application/json"];
35
- /** `GET /v1/weixin-logins/{login}` 成功时的响应体。 */
35
+ /** `GET /api/v1/weixin-logins/{login}` 成功时的响应体。 */
36
36
  export type GetWeixinLoginResult = operations["get-weixin-login"]["responses"][200]["content"]["application/json"];
37
- /** `POST /v1/weixin-logins/{login}/verify-code` 成功时的响应体。 */
37
+ /** `POST /api/v1/weixin-logins/{login}/verify-code` 成功时的响应体。 */
38
38
  export type SubmitWeixinVerifyCodeResult = operations["submit-weixin-verify-code"]["responses"][200]["content"]["application/json"];
39
- /** `POST /v1/weixin-logins/{login}/verify-code` 的请求体。 */
39
+ /** `POST /api/v1/weixin-logins/{login}/verify-code` 的请求体。 */
40
40
  export type SubmitWeixinVerifyCodeBody = NonNullable<operations["submit-weixin-verify-code"]["requestBody"]>["content"]["application/json"];
41
- /** `GET /v1/models` 成功时的响应体。 */
41
+ /** `GET /api/v1/models` 成功时的响应体。 */
42
42
  export type ListModelsResult = operations["list-models"]["responses"][200]["content"]["application/json"];
43
- /** `GET /v1/threads` 成功时的响应体。 */
43
+ /** `GET /api/v1/threads` 成功时的响应体。 */
44
44
  export type ListThreadsResult = operations["list-threads"]["responses"][200]["content"]["application/json"];
45
- /** `POST /v1/threads` 成功时的响应体。 */
45
+ /** `POST /api/v1/threads` 成功时的响应体。 */
46
46
  export type CreateThreadResult = operations["create-thread"]["responses"][201]["content"]["application/json"];
47
- /** `POST /v1/threads` 的请求体。 */
47
+ /** `POST /api/v1/threads` 的请求体。 */
48
48
  export type CreateThreadBody = NonNullable<operations["create-thread"]["requestBody"]>["content"]["application/json"];
49
- /** `GET /v1/threads/{thread}` 成功时的响应体。 */
49
+ /** `GET /api/v1/threads/{thread}` 成功时的响应体。 */
50
50
  export type GetThreadResult = operations["get-thread"]["responses"][200]["content"]["application/json"];
51
- /** `PATCH /v1/threads/{thread}` 成功时的响应体。 */
51
+ /** `PATCH /api/v1/threads/{thread}` 成功时的响应体。 */
52
52
  export type UpdateThreadResult = operations["update-thread"]["responses"][200]["content"]["application/json"];
53
- /** `PATCH /v1/threads/{thread}` 的请求体。 */
53
+ /** `PATCH /api/v1/threads/{thread}` 的请求体。 */
54
54
  export type UpdateThreadBody = NonNullable<operations["update-thread"]["requestBody"]>["content"]["application/json"];
55
- /** `POST /v1/threads/{thread}/approvals/{batch}` 的请求体。 */
55
+ /** `POST /api/v1/threads/{thread}/approvals/{batch}` 的请求体。 */
56
56
  export type DecideApprovalBody = NonNullable<operations["decide-approval"]["requestBody"]>["content"]["application/json"];
57
- /** `GET /v1/threads/{thread}/earlier` 成功时的响应体。 */
57
+ /** `GET /api/v1/threads/{thread}/earlier` 成功时的响应体。 */
58
58
  export type ListEarlierItemsResult = operations["list-earlier-items"]["responses"][200]["content"]["application/json"];
59
- /** `POST /v1/threads/{thread}/messages` 成功时的响应体。 */
59
+ /** `POST /api/v1/threads/{thread}/messages` 成功时的响应体。 */
60
60
  export type SendMessageResult = operations["send-message"]["responses"][202]["content"]["application/json"];
61
- /** `POST /v1/threads/{thread}/messages` 的请求体。 */
61
+ /** `POST /api/v1/threads/{thread}/messages` 的请求体。 */
62
62
  export type SendMessageBody = NonNullable<operations["send-message"]["requestBody"]>["content"]["application/json"];
63
- /** `POST /v1/threads/{thread}/questions/{item}` 的请求体。 */
63
+ /** `POST /api/v1/threads/{thread}/questions/{item}` 的请求体。 */
64
64
  export type AnswerQuestionBody = NonNullable<operations["answer-question"]["requestBody"]>["content"]["application/json"];
65
- /** `POST /v1/threads/{thread}/revert` 成功时的响应体。 */
65
+ /** `POST /api/v1/threads/{thread}/revert` 成功时的响应体。 */
66
66
  export type RevertThreadResult = operations["revert-thread"]["responses"][200]["content"]["application/json"];
67
- /** `POST /v1/threads/{thread}/revert` 的请求体。 */
67
+ /** `POST /api/v1/threads/{thread}/revert` 的请求体。 */
68
68
  export type RevertThreadBody = NonNullable<operations["revert-thread"]["requestBody"]>["content"]["application/json"];
@@ -3,7 +3,7 @@
3
3
  * Do not make direct changes to the file.
4
4
  */
5
5
  export interface paths {
6
- "/v1/attachments": {
6
+ "/api/v1/attachments": {
7
7
  parameters: {
8
8
  query?: never;
9
9
  header?: never;
@@ -23,7 +23,7 @@ export interface paths {
23
23
  patch?: never;
24
24
  trace?: never;
25
25
  };
26
- "/v1/attachments/{attachment}": {
26
+ "/api/v1/attachments/{attachment}": {
27
27
  parameters: {
28
28
  query?: never;
29
29
  header?: never;
@@ -43,7 +43,7 @@ export interface paths {
43
43
  patch?: never;
44
44
  trace?: never;
45
45
  };
46
- "/v1/bindings": {
46
+ "/api/v1/bindings": {
47
47
  parameters: {
48
48
  query?: never;
49
49
  header?: never;
@@ -63,7 +63,7 @@ export interface paths {
63
63
  patch?: never;
64
64
  trace?: never;
65
65
  };
66
- "/v1/bindings/{binding}": {
66
+ "/api/v1/bindings/{binding}": {
67
67
  parameters: {
68
68
  query?: never;
69
69
  header?: never;
@@ -81,7 +81,7 @@ export interface paths {
81
81
  patch?: never;
82
82
  trace?: never;
83
83
  };
84
- "/v1/channels": {
84
+ "/api/v1/channels": {
85
85
  parameters: {
86
86
  query?: never;
87
87
  header?: never;
@@ -102,7 +102,7 @@ export interface paths {
102
102
  patch?: never;
103
103
  trace?: never;
104
104
  };
105
- "/v1/channels/{channel}": {
105
+ "/api/v1/channels/{channel}": {
106
106
  parameters: {
107
107
  query?: never;
108
108
  header?: never;
@@ -127,7 +127,7 @@ export interface paths {
127
127
  patch: operations["update-channel"];
128
128
  trace?: never;
129
129
  };
130
- "/v1/channels/{channel}/binding-codes": {
130
+ "/api/v1/channels/{channel}/binding-codes": {
131
131
  parameters: {
132
132
  query?: never;
133
133
  header?: never;
@@ -147,7 +147,7 @@ export interface paths {
147
147
  patch?: never;
148
148
  trace?: never;
149
149
  };
150
- "/v1/channels/{channel}/rejections": {
150
+ "/api/v1/channels/{channel}/rejections": {
151
151
  parameters: {
152
152
  query?: never;
153
153
  header?: never;
@@ -167,7 +167,7 @@ export interface paths {
167
167
  patch?: never;
168
168
  trace?: never;
169
169
  };
170
- "/v1/channels/{channel}/secret": {
170
+ "/api/v1/channels/{channel}/secret": {
171
171
  parameters: {
172
172
  query?: never;
173
173
  header?: never;
@@ -187,7 +187,7 @@ export interface paths {
187
187
  patch?: never;
188
188
  trace?: never;
189
189
  };
190
- "/v1/channels/{channel}/sender-check": {
190
+ "/api/v1/channels/{channel}/sender-check": {
191
191
  parameters: {
192
192
  query?: never;
193
193
  header?: never;
@@ -207,7 +207,7 @@ export interface paths {
207
207
  patch?: never;
208
208
  trace?: never;
209
209
  };
210
- "/v1/channels/{channel}/weixin-logins": {
210
+ "/api/v1/channels/{channel}/weixin-logins": {
211
211
  parameters: {
212
212
  query?: never;
213
213
  header?: never;
@@ -227,7 +227,7 @@ export interface paths {
227
227
  patch?: never;
228
228
  trace?: never;
229
229
  };
230
- "/v1/platforms": {
230
+ "/api/v1/platforms": {
231
231
  parameters: {
232
232
  query?: never;
233
233
  header?: never;
@@ -247,7 +247,7 @@ export interface paths {
247
247
  patch?: never;
248
248
  trace?: never;
249
249
  };
250
- "/v1/weixin-logins/{login}": {
250
+ "/api/v1/weixin-logins/{login}": {
251
251
  parameters: {
252
252
  query?: never;
253
253
  header?: never;
@@ -267,7 +267,7 @@ export interface paths {
267
267
  patch?: never;
268
268
  trace?: never;
269
269
  };
270
- "/v1/weixin-logins/{login}/verify-code": {
270
+ "/api/v1/weixin-logins/{login}/verify-code": {
271
271
  parameters: {
272
272
  query?: never;
273
273
  header?: never;
@@ -287,7 +287,7 @@ export interface paths {
287
287
  patch?: never;
288
288
  trace?: never;
289
289
  };
290
- "/v1/models": {
290
+ "/api/v1/models": {
291
291
  parameters: {
292
292
  query?: never;
293
293
  header?: never;
@@ -307,7 +307,7 @@ export interface paths {
307
307
  patch?: never;
308
308
  trace?: never;
309
309
  };
310
- "/v1/threads": {
310
+ "/api/v1/threads": {
311
311
  parameters: {
312
312
  query?: never;
313
313
  header?: never;
@@ -328,7 +328,7 @@ export interface paths {
328
328
  patch?: never;
329
329
  trace?: never;
330
330
  };
331
- "/v1/threads/{thread}": {
331
+ "/api/v1/threads/{thread}": {
332
332
  parameters: {
333
333
  query?: never;
334
334
  header?: never;
@@ -352,7 +352,7 @@ export interface paths {
352
352
  patch: operations["update-thread"];
353
353
  trace?: never;
354
354
  };
355
- "/v1/threads/{thread}/approvals/{batch}": {
355
+ "/api/v1/threads/{thread}/approvals/{batch}": {
356
356
  parameters: {
357
357
  query?: never;
358
358
  header?: never;
@@ -372,7 +372,7 @@ export interface paths {
372
372
  patch?: never;
373
373
  trace?: never;
374
374
  };
375
- "/v1/threads/{thread}/earlier": {
375
+ "/api/v1/threads/{thread}/earlier": {
376
376
  parameters: {
377
377
  query?: never;
378
378
  header?: never;
@@ -392,7 +392,7 @@ export interface paths {
392
392
  patch?: never;
393
393
  trace?: never;
394
394
  };
395
- "/v1/threads/{thread}/interrupt": {
395
+ "/api/v1/threads/{thread}/interrupt": {
396
396
  parameters: {
397
397
  query?: never;
398
398
  header?: never;
@@ -412,7 +412,7 @@ export interface paths {
412
412
  patch?: never;
413
413
  trace?: never;
414
414
  };
415
- "/v1/threads/{thread}/messages": {
415
+ "/api/v1/threads/{thread}/messages": {
416
416
  parameters: {
417
417
  query?: never;
418
418
  header?: never;
@@ -432,7 +432,7 @@ export interface paths {
432
432
  patch?: never;
433
433
  trace?: never;
434
434
  };
435
- "/v1/threads/{thread}/questions/{item}": {
435
+ "/api/v1/threads/{thread}/questions/{item}": {
436
436
  parameters: {
437
437
  query?: never;
438
438
  header?: never;
@@ -452,7 +452,7 @@ export interface paths {
452
452
  patch?: never;
453
453
  trace?: never;
454
454
  };
455
- "/v1/threads/{thread}/read": {
455
+ "/api/v1/threads/{thread}/read": {
456
456
  parameters: {
457
457
  query?: never;
458
458
  header?: never;
@@ -469,7 +469,7 @@ export interface paths {
469
469
  patch?: never;
470
470
  trace?: never;
471
471
  };
472
- "/v1/threads/{thread}/revert": {
472
+ "/api/v1/threads/{thread}/revert": {
473
473
  parameters: {
474
474
  query?: never;
475
475
  header?: never;
@@ -845,13 +845,13 @@ export interface components {
845
845
  DocumentResource: {
846
846
  context: components["schemas"]["ContextResource"];
847
847
  cursor: string | null;
848
- earlier: components["schemas"]["EarlierResource"];
848
+ earlier: components["schemas"]["EarlierResource"] | null;
849
849
  items: components["schemas"]["ItemResource"][] | null;
850
850
  status: string;
851
- stream: components["schemas"]["StreamResource"];
852
- turn: components["schemas"]["TurnResource"];
851
+ stream: components["schemas"]["StreamResource"] | null;
852
+ turn: components["schemas"]["TurnResource"] | null;
853
853
  turnId: string | null;
854
- wait: components["schemas"]["WaitResource"];
854
+ wait: components["schemas"]["WaitResource"] | null;
855
855
  };
856
856
  UpdateThreadRequestBody: {
857
857
  /** @enum {string} */
@@ -949,9 +949,13 @@ export interface operations {
949
949
  /** @description OK */
950
950
  200: {
951
951
  headers: {
952
+ /** @description 私有而且长缓存:这些字节按 id 寻址而 id 永不复用,所以它们永远不会变;而它们属于一个人,所以不能进任何共享缓存。 */
953
+ "Cache-Control"?: string;
952
954
  [name: string]: unknown;
953
955
  };
954
- content?: never;
956
+ content: {
957
+ "image/*": string;
958
+ };
955
959
  };
956
960
  /** @description Error */
957
961
  default: {
@@ -1281,7 +1281,10 @@ export interface components {
1281
1281
  name: string;
1282
1282
  /** Format: int64 */
1283
1283
  size_gb: number;
1284
- /** @description 从该快照恢复。提供时容量只需不小于快照本身 */
1284
+ /**
1285
+ * Format: uuid
1286
+ * @description 从该快照恢复。提供时容量只需不小于快照本身
1287
+ */
1285
1288
  snapshot_id?: string;
1286
1289
  };
1287
1290
  RenameDiskRequestBody: {
@@ -1014,7 +1014,8 @@ export interface components {
1014
1014
  last_error: string;
1015
1015
  /** Format: int64 */
1016
1016
  response_time_threshold_seconds: number;
1017
- result: components["schemas"]["WebCheckResultResource"];
1017
+ /** @description null 表示这个检查还一轮都没跑过。零值会把「还不知道」显示成「响应 0 秒、状态码 0」 */
1018
+ result: components["schemas"]["WebCheckResultResource"] | null;
1018
1019
  /** Format: int64 */
1019
1020
  retries: number;
1020
1021
  /** Format: uuid */
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.0.0-dev.113.g5d6fb99",
3
+ "version": "0.0.0-dev.9.gd1c7e65",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/LeaflowNET/sdk.git"
8
+ "url": "git+https://github.com/LeaflowNET/leaflow-ts.git"
9
9
  },
10
10
  "type": "module",
11
11
  "main": "./dist/index.js",
@@ -49,7 +49,7 @@
49
49
  ],
50
50
  "sideEffects": false,
51
51
  "scripts": {
52
- "generate": "node ../scripts/generate-ts.mjs && python3 ../scripts/generate-go.py",
52
+ "generate": "node scripts/generate.mjs",
53
53
  "build": "tsc -p tsconfig.build.json",
54
54
  "typecheck": "tsc -p tsconfig.json --noEmit",
55
55
  "prepublishOnly": "npm run build"
@@ -57,7 +57,8 @@
57
57
  "devDependencies": {
58
58
  "openapi-typescript": "7.13.0",
59
59
  "typescript": "^5.9.3",
60
- "openapi-fetch": "^0.17.0"
60
+ "openapi-fetch": "^0.17.0",
61
+ "yaml": "^2.8.1"
61
62
  },
62
63
  "publishConfig": {
63
64
  "access": "public"