@leaflow/sdk 0.5.0 → 0.6.0

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 (124) hide show
  1. package/dist/generated/assistant/index.d.ts +8 -7
  2. package/dist/generated/assistant/index.js +6 -5
  3. package/dist/generated/assistant/models/bindingCodeResponseBody.d.ts +34 -0
  4. package/dist/generated/assistant/models/bindingCodeResponseBody.js +31 -0
  5. package/dist/generated/assistant/models/bindingResource.d.ts +4 -1
  6. package/dist/generated/assistant/models/bindingResourceConnState.d.ts +37 -0
  7. package/dist/generated/assistant/models/bindingResourceConnState.js +37 -0
  8. package/dist/generated/assistant/models/bindingResourceStatus.d.ts +36 -0
  9. package/dist/generated/assistant/models/bindingResourceStatus.js +36 -0
  10. package/dist/generated/assistant/models/channelResource.d.ts +10 -2
  11. package/dist/generated/assistant/models/channelResourceConnState.d.ts +40 -0
  12. package/dist/generated/assistant/models/channelResourceConnState.js +37 -0
  13. package/dist/generated/assistant/models/channelResourceRuntimeState.d.ts +38 -0
  14. package/dist/generated/assistant/models/channelResourceRuntimeState.js +35 -0
  15. package/dist/generated/assistant/models/channelResourceSenderPolicy.d.ts +35 -0
  16. package/dist/generated/assistant/models/channelResourceSenderPolicy.js +35 -0
  17. package/dist/generated/assistant/models/channelResourceStatus.d.ts +36 -0
  18. package/dist/generated/assistant/models/channelResourceStatus.js +36 -0
  19. package/dist/generated/assistant/models/channelWithSecretResponseBody.d.ts +57 -0
  20. package/dist/generated/assistant/models/channelWithSecretResponseBody.js +1 -0
  21. package/dist/generated/assistant/models/channelWithSecretResponseBodyAllowFrom.d.ts +31 -0
  22. package/dist/generated/assistant/models/channelWithSecretResponseBodyAllowFrom.js +31 -0
  23. package/dist/generated/assistant/models/channelWithSecretResponseBodyConnState.d.ts +40 -0
  24. package/dist/generated/assistant/models/channelWithSecretResponseBodyConnState.js +37 -0
  25. package/dist/generated/assistant/models/channelWithSecretResponseBodyRuntimeState.d.ts +38 -0
  26. package/dist/generated/assistant/models/channelWithSecretResponseBodyRuntimeState.js +35 -0
  27. package/dist/generated/assistant/models/channelWithSecretResponseBodySenderPolicy.d.ts +35 -0
  28. package/dist/generated/assistant/models/channelWithSecretResponseBodySenderPolicy.js +35 -0
  29. package/dist/generated/assistant/models/channelWithSecretResponseBodyStatus.d.ts +36 -0
  30. package/dist/generated/assistant/models/channelWithSecretResponseBodyStatus.js +36 -0
  31. package/dist/generated/assistant/models/channelWithSecretResponseBodyWebhookSecret.d.ts +34 -0
  32. package/dist/generated/assistant/models/channelWithSecretResponseBodyWebhookSecret.js +31 -0
  33. package/dist/generated/assistant/models/channelWithSecretResponseBodyWebhookUrl.d.ts +34 -0
  34. package/dist/generated/assistant/models/channelWithSecretResponseBodyWebhookUrl.js +31 -0
  35. package/dist/generated/assistant/models/createChannelRequestBody.d.ts +3 -2
  36. package/dist/generated/assistant/models/createChannelRequestBodySenderPolicy.d.ts +35 -0
  37. package/dist/generated/assistant/models/createChannelRequestBodySenderPolicy.js +35 -0
  38. package/dist/generated/assistant/models/index.d.ts +17 -1
  39. package/dist/generated/assistant/models/index.js +17 -1
  40. package/dist/generated/assistant/models/itemResourceStatus.d.ts +1 -1
  41. package/dist/generated/assistant/models/itemResourceStatus.js +1 -1
  42. package/dist/generated/assistant/models/itemResourceType.d.ts +1 -0
  43. package/dist/generated/assistant/models/itemResourceType.js +1 -0
  44. package/dist/generated/assistant/models/loginResource.d.ts +5 -2
  45. package/dist/generated/assistant/models/loginResource.js +0 -30
  46. package/dist/generated/assistant/models/loginResourceStatus.d.ts +39 -0
  47. package/dist/generated/assistant/models/loginResourceStatus.js +39 -0
  48. package/dist/generated/assistant/models/updateChannelRequestBodySenderPolicy.d.ts +2 -2
  49. package/dist/generated/assistant/models/updateChannelRequestBodySenderPolicy.js +2 -2
  50. package/dist/generated/tunnel/index.d.ts +142 -0
  51. package/dist/generated/tunnel/index.js +149 -0
  52. package/dist/generated/tunnel/models/actOnTunnelRequestBody.d.ts +28 -0
  53. package/dist/generated/tunnel/models/actOnTunnelRequestBody.js +1 -0
  54. package/dist/generated/tunnel/models/actOnTunnelRequestBodyAction.d.ts +29 -0
  55. package/dist/generated/tunnel/models/actOnTunnelRequestBodyAction.js +29 -0
  56. package/dist/generated/tunnel/models/changeTunnelPlanRequestBody.d.ts +27 -0
  57. package/dist/generated/tunnel/models/changeTunnelPlanRequestBody.js +25 -0
  58. package/dist/generated/tunnel/models/error.d.ts +31 -0
  59. package/dist/generated/tunnel/models/error.js +1 -0
  60. package/dist/generated/tunnel/models/errorMeta.d.ts +27 -0
  61. package/dist/generated/tunnel/models/errorMeta.js +25 -0
  62. package/dist/generated/tunnel/models/index.d.ts +54 -0
  63. package/dist/generated/tunnel/models/index.js +54 -0
  64. package/dist/generated/tunnel/models/lengthAwarePageOperationLogResource.d.ts +35 -0
  65. package/dist/generated/tunnel/models/lengthAwarePageOperationLogResource.js +1 -0
  66. package/dist/generated/tunnel/models/listTunnelOperationLogsParams.d.ts +43 -0
  67. package/dist/generated/tunnel/models/listTunnelOperationLogsParams.js +25 -0
  68. package/dist/generated/tunnel/models/listTunnelUsageSeriesParams.d.ts +32 -0
  69. package/dist/generated/tunnel/models/listTunnelUsageSeriesParams.js +25 -0
  70. package/dist/generated/tunnel/models/openTunnelRequestBody.d.ts +38 -0
  71. package/dist/generated/tunnel/models/openTunnelRequestBody.js +25 -0
  72. package/dist/generated/tunnel/models/operationLogResource.d.ts +38 -0
  73. package/dist/generated/tunnel/models/operationLogResource.js +1 -0
  74. package/dist/generated/tunnel/models/operationLogResourceActor.d.ts +28 -0
  75. package/dist/generated/tunnel/models/operationLogResourceActor.js +25 -0
  76. package/dist/generated/tunnel/models/operationLogResourcePayload.d.ts +27 -0
  77. package/dist/generated/tunnel/models/operationLogResourcePayload.js +25 -0
  78. package/dist/generated/tunnel/models/subscriptionResource.d.ts +33 -0
  79. package/dist/generated/tunnel/models/subscriptionResource.js +1 -0
  80. package/dist/generated/tunnel/models/subscriptionResourceStatus.d.ts +32 -0
  81. package/dist/generated/tunnel/models/subscriptionResourceStatus.js +29 -0
  82. package/dist/generated/tunnel/models/tunnelPlanListResponseBody.d.ts +28 -0
  83. package/dist/generated/tunnel/models/tunnelPlanListResponseBody.js +1 -0
  84. package/dist/generated/tunnel/models/tunnelPlanResource.d.ts +33 -0
  85. package/dist/generated/tunnel/models/tunnelPlanResource.js +25 -0
  86. package/dist/generated/tunnel/models/tunnelResource.d.ts +54 -0
  87. package/dist/generated/tunnel/models/tunnelResource.js +1 -0
  88. package/dist/generated/tunnel/models/tunnelResourceEmail.d.ts +28 -0
  89. package/dist/generated/tunnel/models/tunnelResourceEmail.js +25 -0
  90. package/dist/generated/tunnel/models/tunnelResourceFailure.d.ts +28 -0
  91. package/dist/generated/tunnel/models/tunnelResourceFailure.js +25 -0
  92. package/dist/generated/tunnel/models/tunnelResourceStatus.d.ts +32 -0
  93. package/dist/generated/tunnel/models/tunnelResourceStatus.js +29 -0
  94. package/dist/generated/tunnel/models/tunnelResourceSubscriptionStatus.d.ts +32 -0
  95. package/dist/generated/tunnel/models/tunnelResourceSubscriptionStatus.js +29 -0
  96. package/dist/generated/tunnel/models/tunnelResourceSuspendedAt.d.ts +28 -0
  97. package/dist/generated/tunnel/models/tunnelResourceSuspendedAt.js +25 -0
  98. package/dist/generated/tunnel/models/tunnelUsageSnapshot.d.ts +38 -0
  99. package/dist/generated/tunnel/models/tunnelUsageSnapshot.js +1 -0
  100. package/dist/generated/tunnel/models/tunnelUsageSnapshotSyncedAt.d.ts +28 -0
  101. package/dist/generated/tunnel/models/tunnelUsageSnapshotSyncedAt.js +25 -0
  102. package/dist/generated/tunnel/models/updateTunnelProfileRequestBody.d.ts +34 -0
  103. package/dist/generated/tunnel/models/updateTunnelProfileRequestBody.js +1 -0
  104. package/dist/generated/tunnel/models/updateTunnelProfileRequestBodyEmail.d.ts +29 -0
  105. package/dist/generated/tunnel/models/updateTunnelProfileRequestBodyEmail.js +25 -0
  106. package/dist/generated/tunnel/models/usageDayResource.d.ts +30 -0
  107. package/dist/generated/tunnel/models/usageDayResource.js +25 -0
  108. package/dist/generated/tunnel/models/usageResource.d.ts +43 -0
  109. package/dist/generated/tunnel/models/usageResource.js +1 -0
  110. package/dist/generated/tunnel/models/usageResourceQuotaExceededAt.d.ts +28 -0
  111. package/dist/generated/tunnel/models/usageResourceQuotaExceededAt.js +25 -0
  112. package/dist/generated/tunnel/models/usageSeriesResource.d.ts +30 -0
  113. package/dist/generated/tunnel/models/usageSeriesResource.js +1 -0
  114. package/dist/http.d.ts +26 -0
  115. package/dist/http.js +49 -16
  116. package/dist/index.d.ts +14 -0
  117. package/dist/index.js +18 -3
  118. package/openapi/assistant.version +1 -1
  119. package/openapi/assistant.yaml +147 -25
  120. package/openapi/compute.version +1 -1
  121. package/openapi/monitoring.version +1 -1
  122. package/openapi/tunnel.version +1 -0
  123. package/openapi/tunnel.yaml +773 -0
  124. package/package.json +1 -1
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Generated by orval v7.21.0 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Assistant 用户 API
5
+ * 控制台里的 AI 助手:对话、消息、工具调用与审批、附件,以及把助手接到微信、飞书、Telegram 等即时通讯平台上。
6
+
7
+ ## 一次对话
8
+
9
+ 1. `POST /v1/threads` 创建对话;
10
+ 2. `POST /v1/threads/{thread}/messages` 发送消息,立即返回 `turnId`,助手的执行在后台进行;
11
+ 3. `GET /v1/threads/{thread}` 取回对话文档用于渲染,并按其中的 `stream` 连上实时输出;
12
+ 4. 助手需要用户参与时,文档中的 `wait` 会说明是哪一种:审批一批工具调用(`POST /v1/threads/{thread}/approvals/{batch}`),或回答几个问题(`POST /v1/threads/{thread}/questions/{item}`)。处理完成后助手自动继续。
13
+
14
+ 发送图片分两步:先 `POST /v1/attachments` 上传拿到 id,发送消息时放进 `attachmentIds`。
15
+
16
+ ## 实时输出
17
+
18
+ ```
19
+ GET /v1/turns/{turn}/stream?ticket=<ticket>&cursor=<cursor>
20
+ ```
21
+
22
+ 这是一条 Server-Sent Events 流,因此不在下方的接口列表中。
23
+
24
+ - `path` 与 `ticket` 都取自对话文档的 `stream`。`path` 是相对路径,按取回文档的地址解析;
25
+ - `cursor` 是起始位置,取自对话文档的 `cursor`。不传则从可用范围的开头开始;
26
+ - 推送的每一条都是对那份对话文档的一次增量编辑,套用同一套渲染逻辑即可;
27
+ - 连接有生存期,到时会正常关闭。使用 `EventSource` 时浏览器会自动携带 `Last-Event-ID` 重连并从断点续传,无需额外处理;
28
+ - 三种结束事件:`done` 本次 turn 完成(附带最终状态)、`paused` 助手在等待用户处理(重新取回对话文档读 `wait`)、`stalled` 执行已中断且不会恢复,不要重连。
29
+ * OpenAPI spec version: 1.0.0
30
+ */
31
+ export type CreateChannelRequestBodySenderPolicy = typeof CreateChannelRequestBodySenderPolicy[keyof typeof CreateChannelRequestBodySenderPolicy];
32
+ export declare const CreateChannelRequestBodySenderPolicy: {
33
+ readonly bound_only: "bound_only";
34
+ readonly open: "open";
35
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Generated by orval v7.21.0 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Assistant 用户 API
5
+ * 控制台里的 AI 助手:对话、消息、工具调用与审批、附件,以及把助手接到微信、飞书、Telegram 等即时通讯平台上。
6
+
7
+ ## 一次对话
8
+
9
+ 1. `POST /v1/threads` 创建对话;
10
+ 2. `POST /v1/threads/{thread}/messages` 发送消息,立即返回 `turnId`,助手的执行在后台进行;
11
+ 3. `GET /v1/threads/{thread}` 取回对话文档用于渲染,并按其中的 `stream` 连上实时输出;
12
+ 4. 助手需要用户参与时,文档中的 `wait` 会说明是哪一种:审批一批工具调用(`POST /v1/threads/{thread}/approvals/{batch}`),或回答几个问题(`POST /v1/threads/{thread}/questions/{item}`)。处理完成后助手自动继续。
13
+
14
+ 发送图片分两步:先 `POST /v1/attachments` 上传拿到 id,发送消息时放进 `attachmentIds`。
15
+
16
+ ## 实时输出
17
+
18
+ ```
19
+ GET /v1/turns/{turn}/stream?ticket=<ticket>&cursor=<cursor>
20
+ ```
21
+
22
+ 这是一条 Server-Sent Events 流,因此不在下方的接口列表中。
23
+
24
+ - `path` 与 `ticket` 都取自对话文档的 `stream`。`path` 是相对路径,按取回文档的地址解析;
25
+ - `cursor` 是起始位置,取自对话文档的 `cursor`。不传则从可用范围的开头开始;
26
+ - 推送的每一条都是对那份对话文档的一次增量编辑,套用同一套渲染逻辑即可;
27
+ - 连接有生存期,到时会正常关闭。使用 `EventSource` 时浏览器会自动携带 `Last-Event-ID` 重连并从断点续传,无需额外处理;
28
+ - 三种结束事件:`done` 本次 turn 完成(附带最终状态)、`paused` 助手在等待用户处理(重新取回对话文档读 `wait`)、`stalled` 执行已中断且不会恢复,不要重连。
29
+ * OpenAPI spec version: 1.0.0
30
+ */
31
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
32
+ export const CreateChannelRequestBodySenderPolicy = {
33
+ bound_only: 'bound_only',
34
+ open: 'open',
35
+ };
@@ -31,14 +31,28 @@ GET /v1/turns/{turn}/stream?ticket=<ticket>&cursor=<cursor>
31
31
  export * from './answerRequestBody.js';
32
32
  export * from './answerRequestBodyAnswers.js';
33
33
  export * from './attachmentResource.js';
34
+ export * from './bindingCodeResponseBody.js';
34
35
  export * from './bindingResource.js';
36
+ export * from './bindingResourceConnState.js';
37
+ export * from './bindingResourceStatus.js';
35
38
  export * from './bindingResourceVerifiedAt.js';
36
39
  export * from './channelResource.js';
37
40
  export * from './channelResourceAllowFrom.js';
41
+ export * from './channelResourceConnState.js';
42
+ export * from './channelResourceRuntimeState.js';
43
+ export * from './channelResourceSenderPolicy.js';
44
+ export * from './channelResourceStatus.js';
38
45
  export * from './channelResourceWebhookUrl.js';
46
+ export * from './channelWithSecretResponseBody.js';
47
+ export * from './channelWithSecretResponseBodyAllowFrom.js';
48
+ export * from './channelWithSecretResponseBodyConnState.js';
49
+ export * from './channelWithSecretResponseBodyRuntimeState.js';
50
+ export * from './channelWithSecretResponseBodySenderPolicy.js';
51
+ export * from './channelWithSecretResponseBodyStatus.js';
52
+ export * from './channelWithSecretResponseBodyWebhookSecret.js';
53
+ export * from './channelWithSecretResponseBodyWebhookUrl.js';
39
54
  export * from './checkSenderParams.js';
40
55
  export * from './choice.js';
41
- export * from './claimCodeResponseBody.js';
42
56
  export * from './contextResource.js';
43
57
  export * from './contextResourceCompactAt.js';
44
58
  export * from './contextResourceUsed.js';
@@ -46,6 +60,7 @@ export * from './contextResourceWindow.js';
46
60
  export * from './createChannelRequestBody.js';
47
61
  export * from './createChannelRequestBodyAllowFrom.js';
48
62
  export * from './createChannelRequestBodyCredentials.js';
63
+ export * from './createChannelRequestBodySenderPolicy.js';
49
64
  export * from './createThreadRequestBody.js';
50
65
  export * from './createThreadRequestBodyApprovalMode.js';
51
66
  export * from './credentialFieldResource.js';
@@ -79,6 +94,7 @@ export * from './listChannelsParams.js';
79
94
  export * from './listEarlierItemsParams.js';
80
95
  export * from './listThreadsParams.js';
81
96
  export * from './loginResource.js';
97
+ export * from './loginResourceStatus.js';
82
98
  export * from './modelListResponseBody.js';
83
99
  export * from './modelListResponseBodyModels.js';
84
100
  export * from './modelResource.js';
@@ -31,14 +31,28 @@ GET /v1/turns/{turn}/stream?ticket=<ticket>&cursor=<cursor>
31
31
  export * from './answerRequestBody.js';
32
32
  export * from './answerRequestBodyAnswers.js';
33
33
  export * from './attachmentResource.js';
34
+ export * from './bindingCodeResponseBody.js';
34
35
  export * from './bindingResource.js';
36
+ export * from './bindingResourceConnState.js';
37
+ export * from './bindingResourceStatus.js';
35
38
  export * from './bindingResourceVerifiedAt.js';
36
39
  export * from './channelResource.js';
37
40
  export * from './channelResourceAllowFrom.js';
41
+ export * from './channelResourceConnState.js';
42
+ export * from './channelResourceRuntimeState.js';
43
+ export * from './channelResourceSenderPolicy.js';
44
+ export * from './channelResourceStatus.js';
38
45
  export * from './channelResourceWebhookUrl.js';
46
+ export * from './channelWithSecretResponseBody.js';
47
+ export * from './channelWithSecretResponseBodyAllowFrom.js';
48
+ export * from './channelWithSecretResponseBodyConnState.js';
49
+ export * from './channelWithSecretResponseBodyRuntimeState.js';
50
+ export * from './channelWithSecretResponseBodySenderPolicy.js';
51
+ export * from './channelWithSecretResponseBodyStatus.js';
52
+ export * from './channelWithSecretResponseBodyWebhookSecret.js';
53
+ export * from './channelWithSecretResponseBodyWebhookUrl.js';
39
54
  export * from './checkSenderParams.js';
40
55
  export * from './choice.js';
41
- export * from './claimCodeResponseBody.js';
42
56
  export * from './contextResource.js';
43
57
  export * from './contextResourceCompactAt.js';
44
58
  export * from './contextResourceUsed.js';
@@ -46,6 +60,7 @@ export * from './contextResourceWindow.js';
46
60
  export * from './createChannelRequestBody.js';
47
61
  export * from './createChannelRequestBodyAllowFrom.js';
48
62
  export * from './createChannelRequestBodyCredentials.js';
63
+ export * from './createChannelRequestBodySenderPolicy.js';
49
64
  export * from './createThreadRequestBody.js';
50
65
  export * from './createThreadRequestBodyApprovalMode.js';
51
66
  export * from './credentialFieldResource.js';
@@ -79,6 +94,7 @@ export * from './listChannelsParams.js';
79
94
  export * from './listEarlierItemsParams.js';
80
95
  export * from './listThreadsParams.js';
81
96
  export * from './loginResource.js';
97
+ export * from './loginResourceStatus.js';
82
98
  export * from './modelListResponseBody.js';
83
99
  export * from './modelListResponseBodyModels.js';
84
100
  export * from './modelResource.js';
@@ -35,5 +35,5 @@ export declare const ItemResourceStatus: {
35
35
  readonly completed: "completed";
36
36
  readonly failed: "failed";
37
37
  readonly declined: "declined";
38
- readonly aborted: "aborted";
38
+ readonly interrupted: "interrupted";
39
39
  };
@@ -35,5 +35,5 @@ export const ItemResourceStatus = {
35
35
  completed: 'completed',
36
36
  failed: 'failed',
37
37
  declined: 'declined',
38
- aborted: 'aborted',
38
+ interrupted: 'interrupted',
39
39
  };
@@ -39,4 +39,5 @@ export declare const ItemResourceType: {
39
39
  readonly dynamic_tool_call: "dynamic_tool_call";
40
40
  readonly context_compaction: "context_compaction";
41
41
  readonly token_budget_reminder: "token_budget_reminder";
42
+ readonly turn_failure: "turn_failure";
42
43
  };
@@ -36,4 +36,5 @@ export const ItemResourceType = {
36
36
  dynamic_tool_call: 'dynamic_tool_call',
37
37
  context_compaction: 'context_compaction',
38
38
  token_budget_reminder: 'token_budget_reminder',
39
+ turn_failure: 'turn_failure',
39
40
  };
@@ -28,11 +28,14 @@ GET /v1/turns/{turn}/stream?ticket=<ticket>&cursor=<cursor>
28
28
  - 三种结束事件:`done` 本次 turn 完成(附带最终状态)、`paused` 助手在等待用户处理(重新取回对话文档读 `wait`)、`stalled` 执行已中断且不会恢复,不要重连。
29
29
  * OpenAPI spec version: 1.0.0
30
30
  */
31
+ import type { LoginResourceStatus } from './loginResourceStatus.js';
31
32
  export interface LoginResource {
33
+ /** 这条登录流的截止时间。到点之后不要再轮询,重新发起一次 */
32
34
  expiresAt: string;
33
35
  id: string;
34
- qrcode: string;
36
+ /** 二维码图片内容,直接作为 <img> 的 src 使用。码过期时这条流会自己换一张接着等,所以每次轮询拿到的可能是新的一张 */
35
37
  qrcodeData: string;
38
+ /** 失败原因。仅在 status 为 error 或 expired 时有内容 */
36
39
  reason: string;
37
- status: string;
40
+ status: LoginResourceStatus;
38
41
  }
@@ -1,31 +1 @@
1
- /**
2
- * Generated by orval v7.21.0 🍺
3
- * Do not edit manually.
4
- * Leaflow Assistant 用户 API
5
- * 控制台里的 AI 助手:对话、消息、工具调用与审批、附件,以及把助手接到微信、飞书、Telegram 等即时通讯平台上。
6
-
7
- ## 一次对话
8
-
9
- 1. `POST /v1/threads` 创建对话;
10
- 2. `POST /v1/threads/{thread}/messages` 发送消息,立即返回 `turnId`,助手的执行在后台进行;
11
- 3. `GET /v1/threads/{thread}` 取回对话文档用于渲染,并按其中的 `stream` 连上实时输出;
12
- 4. 助手需要用户参与时,文档中的 `wait` 会说明是哪一种:审批一批工具调用(`POST /v1/threads/{thread}/approvals/{batch}`),或回答几个问题(`POST /v1/threads/{thread}/questions/{item}`)。处理完成后助手自动继续。
13
-
14
- 发送图片分两步:先 `POST /v1/attachments` 上传拿到 id,发送消息时放进 `attachmentIds`。
15
-
16
- ## 实时输出
17
-
18
- ```
19
- GET /v1/turns/{turn}/stream?ticket=<ticket>&cursor=<cursor>
20
- ```
21
-
22
- 这是一条 Server-Sent Events 流,因此不在下方的接口列表中。
23
-
24
- - `path` 与 `ticket` 都取自对话文档的 `stream`。`path` 是相对路径,按取回文档的地址解析;
25
- - `cursor` 是起始位置,取自对话文档的 `cursor`。不传则从可用范围的开头开始;
26
- - 推送的每一条都是对那份对话文档的一次增量编辑,套用同一套渲染逻辑即可;
27
- - 连接有生存期,到时会正常关闭。使用 `EventSource` 时浏览器会自动携带 `Last-Event-ID` 重连并从断点续传,无需额外处理;
28
- - 三种结束事件:`done` 本次 turn 完成(附带最终状态)、`paused` 助手在等待用户处理(重新取回对话文档读 `wait`)、`stalled` 执行已中断且不会恢复,不要重连。
29
- * OpenAPI spec version: 1.0.0
30
- */
31
1
  export {};
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Generated by orval v7.21.0 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Assistant 用户 API
5
+ * 控制台里的 AI 助手:对话、消息、工具调用与审批、附件,以及把助手接到微信、飞书、Telegram 等即时通讯平台上。
6
+
7
+ ## 一次对话
8
+
9
+ 1. `POST /v1/threads` 创建对话;
10
+ 2. `POST /v1/threads/{thread}/messages` 发送消息,立即返回 `turnId`,助手的执行在后台进行;
11
+ 3. `GET /v1/threads/{thread}` 取回对话文档用于渲染,并按其中的 `stream` 连上实时输出;
12
+ 4. 助手需要用户参与时,文档中的 `wait` 会说明是哪一种:审批一批工具调用(`POST /v1/threads/{thread}/approvals/{batch}`),或回答几个问题(`POST /v1/threads/{thread}/questions/{item}`)。处理完成后助手自动继续。
13
+
14
+ 发送图片分两步:先 `POST /v1/attachments` 上传拿到 id,发送消息时放进 `attachmentIds`。
15
+
16
+ ## 实时输出
17
+
18
+ ```
19
+ GET /v1/turns/{turn}/stream?ticket=<ticket>&cursor=<cursor>
20
+ ```
21
+
22
+ 这是一条 Server-Sent Events 流,因此不在下方的接口列表中。
23
+
24
+ - `path` 与 `ticket` 都取自对话文档的 `stream`。`path` 是相对路径,按取回文档的地址解析;
25
+ - `cursor` 是起始位置,取自对话文档的 `cursor`。不传则从可用范围的开头开始;
26
+ - 推送的每一条都是对那份对话文档的一次增量编辑,套用同一套渲染逻辑即可;
27
+ - 连接有生存期,到时会正常关闭。使用 `EventSource` 时浏览器会自动携带 `Last-Event-ID` 重连并从断点续传,无需额外处理;
28
+ - 三种结束事件:`done` 本次 turn 完成(附带最终状态)、`paused` 助手在等待用户处理(重新取回对话文档读 `wait`)、`stalled` 执行已中断且不会恢复,不要重连。
29
+ * OpenAPI spec version: 1.0.0
30
+ */
31
+ export type LoginResourceStatus = typeof LoginResourceStatus[keyof typeof LoginResourceStatus];
32
+ export declare const LoginResourceStatus: {
33
+ readonly wait: "wait";
34
+ readonly scanned: "scanned";
35
+ readonly confirmed: "confirmed";
36
+ readonly expired: "expired";
37
+ readonly error: "error";
38
+ readonly need_verify_code: "need_verify_code";
39
+ };
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Generated by orval v7.21.0 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Assistant 用户 API
5
+ * 控制台里的 AI 助手:对话、消息、工具调用与审批、附件,以及把助手接到微信、飞书、Telegram 等即时通讯平台上。
6
+
7
+ ## 一次对话
8
+
9
+ 1. `POST /v1/threads` 创建对话;
10
+ 2. `POST /v1/threads/{thread}/messages` 发送消息,立即返回 `turnId`,助手的执行在后台进行;
11
+ 3. `GET /v1/threads/{thread}` 取回对话文档用于渲染,并按其中的 `stream` 连上实时输出;
12
+ 4. 助手需要用户参与时,文档中的 `wait` 会说明是哪一种:审批一批工具调用(`POST /v1/threads/{thread}/approvals/{batch}`),或回答几个问题(`POST /v1/threads/{thread}/questions/{item}`)。处理完成后助手自动继续。
13
+
14
+ 发送图片分两步:先 `POST /v1/attachments` 上传拿到 id,发送消息时放进 `attachmentIds`。
15
+
16
+ ## 实时输出
17
+
18
+ ```
19
+ GET /v1/turns/{turn}/stream?ticket=<ticket>&cursor=<cursor>
20
+ ```
21
+
22
+ 这是一条 Server-Sent Events 流,因此不在下方的接口列表中。
23
+
24
+ - `path` 与 `ticket` 都取自对话文档的 `stream`。`path` 是相对路径,按取回文档的地址解析;
25
+ - `cursor` 是起始位置,取自对话文档的 `cursor`。不传则从可用范围的开头开始;
26
+ - 推送的每一条都是对那份对话文档的一次增量编辑,套用同一套渲染逻辑即可;
27
+ - 连接有生存期,到时会正常关闭。使用 `EventSource` 时浏览器会自动携带 `Last-Event-ID` 重连并从断点续传,无需额外处理;
28
+ - 三种结束事件:`done` 本次 turn 完成(附带最终状态)、`paused` 助手在等待用户处理(重新取回对话文档读 `wait`)、`stalled` 执行已中断且不会恢复,不要重连。
29
+ * OpenAPI spec version: 1.0.0
30
+ */
31
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
32
+ export const LoginResourceStatus = {
33
+ wait: 'wait',
34
+ scanned: 'scanned',
35
+ confirmed: 'confirmed',
36
+ expired: 'expired',
37
+ error: 'error',
38
+ need_verify_code: 'need_verify_code',
39
+ };
@@ -33,6 +33,6 @@ GET /v1/turns/{turn}/stream?ticket=<ticket>&cursor=<cursor>
33
33
  */
34
34
  export type UpdateChannelRequestBodySenderPolicy = typeof UpdateChannelRequestBodySenderPolicy[keyof typeof UpdateChannelRequestBodySenderPolicy];
35
35
  export declare const UpdateChannelRequestBodySenderPolicy: {
36
- readonly BOUND_ONLY: "BOUND_ONLY";
37
- readonly OPEN: "OPEN";
36
+ readonly bound_only: "bound_only";
37
+ readonly open: "open";
38
38
  };
@@ -30,6 +30,6 @@ GET /v1/turns/{turn}/stream?ticket=<ticket>&cursor=<cursor>
30
30
  */
31
31
  // eslint-disable-next-line @typescript-eslint/no-redeclare
32
32
  export const UpdateChannelRequestBodySenderPolicy = {
33
- BOUND_ONLY: 'BOUND_ONLY',
34
- OPEN: 'OPEN',
33
+ bound_only: 'bound_only',
34
+ open: 'open',
35
35
  };
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Generated by orval v7.21.0 🍺
3
+ * Do not edit manually.
4
+ * Leaflow 隧道用户 API
5
+ * Leaflow 隧道的用户接口,用于开通与管理项目的加速隧道、订阅地址和流量用量。
6
+
7
+ ## 身份与鉴权
8
+
9
+ 每个请求需携带 `Authorization: Bearer <项目令牌>`。先在 auth.leaflow.net 登录获取账号令牌,再用它向 IAM 换取项目令牌(`POST /api/v1/projects/{projectId}/token`)。一张项目令牌同时说明当前用户和当前项目。
10
+
11
+ **路径和请求头上都没有 `project_id`**:当前项目由令牌决定。
12
+
13
+ 鉴权在网关完成,失败的请求不会到达这些接口。按错误码区分处理方式:`TOKEN_MISSING` 表示没带令牌;`TOKEN_EXPIRED` 表示令牌过期,用账号令牌重新换取即可,无需重新登录;`TOKEN_INVALID` 表示令牌验不过;`NOT_A_MEMBER` 表示当前账号不是该项目成员;`USER_SUSPENDED` / `USER_BANNED` 表示账号本身不能操作。
14
+
15
+ ## 通用约定
16
+
17
+ - **一个项目一条隧道。** 所以路径是单数的 `/tunnel`,不带 id。已经有一条时再开通会被拒绝(`TUNNEL_ALREADY_OPEN`)。
18
+ - **订阅地址是凭据。** 它等同于密码,只由 `GET /tunnel/subscription` 单独返回,不出现在隧道详情或任何列表里。怀疑泄露时用重置接口,它会让已分发的每一份订阅立即失效。
19
+ - **停用不是退订。** 停用保留端口和订阅地址,重新启用后原样回来;退订不可逆,重新开通得到的是全新的地址。
20
+ - **判断超额只看 `billed_bytes`。** 线路可以设置倍率(如 1.5× 或 0×),`raw_bytes` 是实际传输量,两者不一定相等。
21
+ - **用量最多滞后一个采集周期。** 适合用量管控,不适合作为计费结算依据。隧道详情里那份还额外经过一层缓存,`usage.synced_at` 说明它有多旧。
22
+ - **换套餐不是瞬时的。** 多出来的线路马上可用,少掉的那些有宽限期,到期才真正释放。
23
+ * OpenAPI spec version: 1.0.0
24
+ */
25
+ import type { ActOnTunnelRequestBody, ChangeTunnelPlanRequestBody, LengthAwarePageOperationLogResource, ListTunnelOperationLogsParams, ListTunnelUsageSeriesParams, OpenTunnelRequestBody, SubscriptionResource, TunnelPlanListResponseBody, TunnelResource, UpdateTunnelProfileRequestBody, UsageResource, UsageSeriesResource } from './models/index.js';
26
+ import { request } from '../../http.js';
27
+ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
28
+ /**
29
+ * 记录每一次**写**操作:谁、什么时候、做了什么、成功还是失败。读操作不记录。
30
+
31
+ `actor` 为 null 表示该操作由平台执行(例如自动重试删除、项目停服)——平台做了什么是看得到的,但具体是哪位运营人员不会展示。
32
+
33
+ `payload` 只包含路径参数与查询串,且其中像凭据的字段已被替换为占位符。
34
+ * @summary 查看本项目的操作日志
35
+ */
36
+ export declare const listTunnelOperationLogs: (params?: ListTunnelOperationLogsParams, options?: SecondParameter<typeof request<LengthAwarePageOperationLogResource>>) => Promise<LengthAwarePageOperationLogResource>;
37
+ /**
38
+ * 只返回在售的套餐,按 `sort` 升序。已下架的不在其中——但正在用它的隧道仍然正常,下架只是不再接新单。
39
+
40
+ `quota_bytes` 是套餐**标称**的额度,仅供比较;实际额度由上游按线路分组决定,以隧道用量接口返回的 `quota_bytes` 为准。
41
+ * @summary 列出可开通的套餐
42
+ */
43
+ export declare const listTunnelPlans: (options?: SecondParameter<typeof request<TunnelPlanListResponseBody>>) => Promise<TunnelPlanListResponseBody>;
44
+ /**
45
+ * **不可逆。** 上游账户会被删除,订阅地址立刻失效,重新开通得到的是一条全新的隧道和一条全新的订阅地址。
46
+
47
+ 删除是异步的:返回时 `status` 可能仍是 `deleting`,表示上游还没删干净(通常是某台服务器暂时连不上)。平台会自动重试,期间这条隧道仍然出现在查询接口里。退订完成前无法重新开通。
48
+
49
+ 只是暂时不用的话请用停用,它保留端口和订阅地址。
50
+ * @summary 退订隧道
51
+ */
52
+ export declare const closeTunnel: (options?: SecondParameter<typeof request<TunnelResource>>) => Promise<TunnelResource>;
53
+ /**
54
+ * 每个项目最多一条隧道。尚未开通时返回 404(`TUNNEL_NOT_FOUND`)。
55
+
56
+ 响应里的 `usage` 是**缓存**的用量,`usage.synced_at` 说明它是什么时候采集的;为 null 表示尚未采集过,而不是用量为零。需要当前值请调用量接口。
57
+
58
+ **订阅地址不在这里**,它是一条长期有效的凭据,只由订阅接口单独返回。
59
+ * @summary 查看本项目的隧道
60
+ */
61
+ export declare const getTunnel: (options?: SecondParameter<typeof request<TunnelResource>>) => Promise<TunnelResource>;
62
+ /**
63
+ * 改显示名和联系邮箱,**不影响订阅、用量或线路**。
64
+
65
+ `email` 不传表示不改动,传空字符串表示清空。它会被转发给上游面板——上游拿它做什么由面板决定,平台不使用它。
66
+ * @summary 修改隧道的显示信息
67
+ */
68
+ export declare const updateTunnelProfile: (updateTunnelProfileRequestBody: UpdateTunnelProfileRequestBody, options?: SecondParameter<typeof request<TunnelResource>>) => Promise<TunnelResource>;
69
+ /**
70
+ * 为当前项目开通一条隧道,返回时订阅通常处于 `preparing`——节点仍在下发,但**订阅地址此时已经可用**,内容会在拉取那一刻按当时的状态重新派生。
71
+
72
+ 一个项目只能有一条。已经有了返回 `TUNNEL_ALREADY_OPEN`;上一条还在退订中返回 `TUNNEL_CLOSING`,稍后重试即可。
73
+
74
+ 套餐必须处于在售状态,已下架的返回 `TUNNEL_PLAN_RETIRED`。若返回 `TUNNEL_PLAN_GROUPS_MISSING`,说明该套餐在上游对应的线路分组不存在——这是一个配置问题,请联系运营,换一款套餐或稍后重试都不会有帮助。
75
+ * @summary 开通隧道
76
+ */
77
+ export declare const openTunnel: (openTunnelRequestBody: OpenTunnelRequestBody, options?: SecondParameter<typeof request<TunnelResource>>) => Promise<TunnelResource>;
78
+ /**
79
+ * **停用不是退订。** 停用会把这条隧道的实例从上游调度器撤下,但端口保留,重新启用后原样回来,订阅地址也不变。适合「这段时间不用」。
80
+
81
+ 被平台停用的隧道(`suspended` 为 true)无法自行启用,会返回 `TUNNEL_SUSPENDED`——那通常是欠费或违规,需要先处理对应的问题。
82
+ * @summary 启用或停用隧道
83
+ */
84
+ export declare const actOnTunnel: (actOnTunnelRequestBody: ActOnTunnelRequestBody, options?: SecondParameter<typeof request<TunnelResource>>) => Promise<TunnelResource>;
85
+ /**
86
+ * 换套餐会立刻重判线路资格:多出来的线路马上可用,**少掉的那些进入删除队列——宽限期内照常可用,到期才真正释放**。所以换套餐不是一次瞬时切换,订阅内容会在接下来一段时间内变化。
87
+
88
+ 换完之后建议重新拉取一次订阅。
89
+ * @summary 更换套餐
90
+ */
91
+ export declare const changeTunnelPlan: (changeTunnelPlanRequestBody: ChangeTunnelPlanRequestBody, options?: SecondParameter<typeof request<TunnelResource>>) => Promise<TunnelResource>;
92
+ /**
93
+ * **返回的是一条长期有效的凭据,等同于密码。** 拿到它就能取得本项目全部节点与密码,请勿转发、截图或提交到工单。
94
+
95
+ 它不会出现在隧道详情或任何列表里,只由这个接口返回。
96
+
97
+ `status` 为 `preparing` 时链接**照样可用**,内容会在拉取那一刻按当时的状态重新派生。
98
+
99
+ 怀疑泄露时请调用重置接口。
100
+ * @summary 获取订阅地址
101
+ */
102
+ export declare const getTunnelSubscription: (options?: SecondParameter<typeof request<SubscriptionResource>>) => Promise<SubscriptionResource>;
103
+ /**
104
+ * **这是凭据泄露时的处置手段,会让已分发出去的每一份订阅立即失效。**
105
+
106
+ 订阅 token 和节点密码同时更换,所有客户端都必须重新拉取一次订阅才能继续使用。调用前请确认这确实是想要的结果。
107
+
108
+ 重置后再调订阅接口取新地址。
109
+ * @summary 重置订阅地址与节点密码
110
+ */
111
+ export declare const rotateTunnelSubscription: (options?: SecondParameter<typeof request<TunnelResource>>) => Promise<TunnelResource>;
112
+ /**
113
+ * 现场向上游查询,比隧道详情里那份缓存新。
114
+
115
+ **判断是否超额只看 `billed_bytes`**:线路可以设置倍率(如 1.5× 或 0×),`raw_bytes` 是实际传输量,两者不一定相等。`over_quota` 已经算好。
116
+
117
+ 用量由上游定期采集,**最多滞后一个采集周期**,适合用量管控,不适合作为计费结算依据。
118
+ * @summary 查看本期用量
119
+ */
120
+ export declare const getTunnelUsage: (options?: SecondParameter<typeof request<UsageResource>>) => Promise<UsageResource>;
121
+ /**
122
+ * 按**自然日**切分,用于画趋势图。
123
+
124
+ **没有流量的日子不会出现在结果里**(不补零),画图前需要自行补齐日期轴,否则空档会被连成一条斜线。
125
+
126
+ **把这里的天加起来不等于本期用量**,这是有意的:本期用量按计费周期切,而且「重置本期用量」只作用于本期,日汇总一行都不删。两者回答的是不同的问题。
127
+ * @summary 查看按天用量
128
+ */
129
+ export declare const listTunnelUsageSeries: (params?: ListTunnelUsageSeriesParams, options?: SecondParameter<typeof request<UsageSeriesResource>>) => Promise<UsageSeriesResource>;
130
+ export type ListTunnelOperationLogsResult = NonNullable<Awaited<ReturnType<typeof listTunnelOperationLogs>>>;
131
+ export type ListTunnelPlansResult = NonNullable<Awaited<ReturnType<typeof listTunnelPlans>>>;
132
+ export type CloseTunnelResult = NonNullable<Awaited<ReturnType<typeof closeTunnel>>>;
133
+ export type GetTunnelResult = NonNullable<Awaited<ReturnType<typeof getTunnel>>>;
134
+ export type UpdateTunnelProfileResult = NonNullable<Awaited<ReturnType<typeof updateTunnelProfile>>>;
135
+ export type OpenTunnelResult = NonNullable<Awaited<ReturnType<typeof openTunnel>>>;
136
+ export type ActOnTunnelResult = NonNullable<Awaited<ReturnType<typeof actOnTunnel>>>;
137
+ export type ChangeTunnelPlanResult = NonNullable<Awaited<ReturnType<typeof changeTunnelPlan>>>;
138
+ export type GetTunnelSubscriptionResult = NonNullable<Awaited<ReturnType<typeof getTunnelSubscription>>>;
139
+ export type RotateTunnelSubscriptionResult = NonNullable<Awaited<ReturnType<typeof rotateTunnelSubscription>>>;
140
+ export type GetTunnelUsageResult = NonNullable<Awaited<ReturnType<typeof getTunnelUsage>>>;
141
+ export type ListTunnelUsageSeriesResult = NonNullable<Awaited<ReturnType<typeof listTunnelUsageSeries>>>;
142
+ export {};
@@ -0,0 +1,149 @@
1
+ import { request } from '../../http.js';
2
+ /**
3
+ * 记录每一次**写**操作:谁、什么时候、做了什么、成功还是失败。读操作不记录。
4
+
5
+ `actor` 为 null 表示该操作由平台执行(例如自动重试删除、项目停服)——平台做了什么是看得到的,但具体是哪位运营人员不会展示。
6
+
7
+ `payload` 只包含路径参数与查询串,且其中像凭据的字段已被替换为占位符。
8
+ * @summary 查看本项目的操作日志
9
+ */
10
+ export const listTunnelOperationLogs = (params, options) => {
11
+ return request({ url: `/api/v1/operation-logs`, method: 'GET',
12
+ params
13
+ }, options);
14
+ };
15
+ /**
16
+ * 只返回在售的套餐,按 `sort` 升序。已下架的不在其中——但正在用它的隧道仍然正常,下架只是不再接新单。
17
+
18
+ `quota_bytes` 是套餐**标称**的额度,仅供比较;实际额度由上游按线路分组决定,以隧道用量接口返回的 `quota_bytes` 为准。
19
+ * @summary 列出可开通的套餐
20
+ */
21
+ export const listTunnelPlans = (options) => {
22
+ return request({ url: `/api/v1/plans`, method: 'GET'
23
+ }, options);
24
+ };
25
+ /**
26
+ * **不可逆。** 上游账户会被删除,订阅地址立刻失效,重新开通得到的是一条全新的隧道和一条全新的订阅地址。
27
+
28
+ 删除是异步的:返回时 `status` 可能仍是 `deleting`,表示上游还没删干净(通常是某台服务器暂时连不上)。平台会自动重试,期间这条隧道仍然出现在查询接口里。退订完成前无法重新开通。
29
+
30
+ 只是暂时不用的话请用停用,它保留端口和订阅地址。
31
+ * @summary 退订隧道
32
+ */
33
+ export const closeTunnel = (options) => {
34
+ return request({ url: `/api/v1/tunnel`, method: 'DELETE'
35
+ }, options);
36
+ };
37
+ /**
38
+ * 每个项目最多一条隧道。尚未开通时返回 404(`TUNNEL_NOT_FOUND`)。
39
+
40
+ 响应里的 `usage` 是**缓存**的用量,`usage.synced_at` 说明它是什么时候采集的;为 null 表示尚未采集过,而不是用量为零。需要当前值请调用量接口。
41
+
42
+ **订阅地址不在这里**,它是一条长期有效的凭据,只由订阅接口单独返回。
43
+ * @summary 查看本项目的隧道
44
+ */
45
+ export const getTunnel = (options) => {
46
+ return request({ url: `/api/v1/tunnel`, method: 'GET'
47
+ }, options);
48
+ };
49
+ /**
50
+ * 改显示名和联系邮箱,**不影响订阅、用量或线路**。
51
+
52
+ `email` 不传表示不改动,传空字符串表示清空。它会被转发给上游面板——上游拿它做什么由面板决定,平台不使用它。
53
+ * @summary 修改隧道的显示信息
54
+ */
55
+ export const updateTunnelProfile = (updateTunnelProfileRequestBody, options) => {
56
+ return request({ url: `/api/v1/tunnel`, method: 'PATCH',
57
+ headers: { 'Content-Type': 'application/json', },
58
+ data: updateTunnelProfileRequestBody
59
+ }, options);
60
+ };
61
+ /**
62
+ * 为当前项目开通一条隧道,返回时订阅通常处于 `preparing`——节点仍在下发,但**订阅地址此时已经可用**,内容会在拉取那一刻按当时的状态重新派生。
63
+
64
+ 一个项目只能有一条。已经有了返回 `TUNNEL_ALREADY_OPEN`;上一条还在退订中返回 `TUNNEL_CLOSING`,稍后重试即可。
65
+
66
+ 套餐必须处于在售状态,已下架的返回 `TUNNEL_PLAN_RETIRED`。若返回 `TUNNEL_PLAN_GROUPS_MISSING`,说明该套餐在上游对应的线路分组不存在——这是一个配置问题,请联系运营,换一款套餐或稍后重试都不会有帮助。
67
+ * @summary 开通隧道
68
+ */
69
+ export const openTunnel = (openTunnelRequestBody, options) => {
70
+ return request({ url: `/api/v1/tunnel`, method: 'POST',
71
+ headers: { 'Content-Type': 'application/json', },
72
+ data: openTunnelRequestBody
73
+ }, options);
74
+ };
75
+ /**
76
+ * **停用不是退订。** 停用会把这条隧道的实例从上游调度器撤下,但端口保留,重新启用后原样回来,订阅地址也不变。适合「这段时间不用」。
77
+
78
+ 被平台停用的隧道(`suspended` 为 true)无法自行启用,会返回 `TUNNEL_SUSPENDED`——那通常是欠费或违规,需要先处理对应的问题。
79
+ * @summary 启用或停用隧道
80
+ */
81
+ export const actOnTunnel = (actOnTunnelRequestBody, options) => {
82
+ return request({ url: `/api/v1/tunnel/actions`, method: 'POST',
83
+ headers: { 'Content-Type': 'application/json', },
84
+ data: actOnTunnelRequestBody
85
+ }, options);
86
+ };
87
+ /**
88
+ * 换套餐会立刻重判线路资格:多出来的线路马上可用,**少掉的那些进入删除队列——宽限期内照常可用,到期才真正释放**。所以换套餐不是一次瞬时切换,订阅内容会在接下来一段时间内变化。
89
+
90
+ 换完之后建议重新拉取一次订阅。
91
+ * @summary 更换套餐
92
+ */
93
+ export const changeTunnelPlan = (changeTunnelPlanRequestBody, options) => {
94
+ return request({ url: `/api/v1/tunnel/plan`, method: 'PUT',
95
+ headers: { 'Content-Type': 'application/json', },
96
+ data: changeTunnelPlanRequestBody
97
+ }, options);
98
+ };
99
+ /**
100
+ * **返回的是一条长期有效的凭据,等同于密码。** 拿到它就能取得本项目全部节点与密码,请勿转发、截图或提交到工单。
101
+
102
+ 它不会出现在隧道详情或任何列表里,只由这个接口返回。
103
+
104
+ `status` 为 `preparing` 时链接**照样可用**,内容会在拉取那一刻按当时的状态重新派生。
105
+
106
+ 怀疑泄露时请调用重置接口。
107
+ * @summary 获取订阅地址
108
+ */
109
+ export const getTunnelSubscription = (options) => {
110
+ return request({ url: `/api/v1/tunnel/subscription`, method: 'GET'
111
+ }, options);
112
+ };
113
+ /**
114
+ * **这是凭据泄露时的处置手段,会让已分发出去的每一份订阅立即失效。**
115
+
116
+ 订阅 token 和节点密码同时更换,所有客户端都必须重新拉取一次订阅才能继续使用。调用前请确认这确实是想要的结果。
117
+
118
+ 重置后再调订阅接口取新地址。
119
+ * @summary 重置订阅地址与节点密码
120
+ */
121
+ export const rotateTunnelSubscription = (options) => {
122
+ return request({ url: `/api/v1/tunnel/subscription/rotate`, method: 'POST'
123
+ }, options);
124
+ };
125
+ /**
126
+ * 现场向上游查询,比隧道详情里那份缓存新。
127
+
128
+ **判断是否超额只看 `billed_bytes`**:线路可以设置倍率(如 1.5× 或 0×),`raw_bytes` 是实际传输量,两者不一定相等。`over_quota` 已经算好。
129
+
130
+ 用量由上游定期采集,**最多滞后一个采集周期**,适合用量管控,不适合作为计费结算依据。
131
+ * @summary 查看本期用量
132
+ */
133
+ export const getTunnelUsage = (options) => {
134
+ return request({ url: `/api/v1/tunnel/usage`, method: 'GET'
135
+ }, options);
136
+ };
137
+ /**
138
+ * 按**自然日**切分,用于画趋势图。
139
+
140
+ **没有流量的日子不会出现在结果里**(不补零),画图前需要自行补齐日期轴,否则空档会被连成一条斜线。
141
+
142
+ **把这里的天加起来不等于本期用量**,这是有意的:本期用量按计费周期切,而且「重置本期用量」只作用于本期,日汇总一行都不删。两者回答的是不同的问题。
143
+ * @summary 查看按天用量
144
+ */
145
+ export const listTunnelUsageSeries = (params, options) => {
146
+ return request({ url: `/api/v1/tunnel/usage/series`, method: 'GET',
147
+ params
148
+ }, options);
149
+ };