@leaflow/sdk 0.16.0 → 0.18.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.
@@ -46,6 +46,8 @@ export type GetWeixinLoginResult = operations["get-weixin-login"]["responses"][2
46
46
  export type SubmitWeixinVerifyCodeResult = operations["submit-weixin-verify-code"]["responses"][200]["content"]["application/json"];
47
47
  /** `POST /api/v1/weixin-logins/{login}/verify-code` 的请求体。 */
48
48
  export type SubmitWeixinVerifyCodeBody = NonNullable<operations["submit-weixin-verify-code"]["requestBody"]>["content"]["application/json"];
49
+ /** `POST /api/v1/dynamic-calls/{call}/result` 的请求体。 */
50
+ export type SubmitDynamicCallResultBody = NonNullable<operations["submit-dynamic-call-result"]["requestBody"]>["content"]["application/json"];
49
51
  /** `GET /api/v1/memories` 成功时的响应体。 */
50
52
  export type ListMemoriesResult = operations["list-memories"]["responses"][200]["content"]["application/json"];
51
53
  /** `GET /api/v1/models` 成功时的响应体。 */
@@ -287,6 +287,31 @@ export interface paths {
287
287
  patch?: never;
288
288
  trace?: never;
289
289
  };
290
+ "/api/v1/dynamic-calls/{call}/result": {
291
+ parameters: {
292
+ query?: never;
293
+ header?: never;
294
+ path?: never;
295
+ cookie?: never;
296
+ };
297
+ get?: never;
298
+ put?: never;
299
+ /**
300
+ * Report what an action produced
301
+ * @description The assistant asks the client to run an action by adding a tool call to the conversation
302
+ * with the namespace `dynamic`; the client acts when that entry turns in_progress and reports
303
+ * back here.
304
+ *
305
+ * The first result wins. A second one — from another tab, or a retried request — is refused
306
+ * rather than replacing it, because the action already ran once.
307
+ */
308
+ post: operations["submit-dynamic-call-result"];
309
+ delete?: never;
310
+ options?: never;
311
+ head?: never;
312
+ patch?: never;
313
+ trace?: never;
314
+ };
290
315
  "/api/v1/memories": {
291
316
  parameters: {
292
317
  query?: never;
@@ -906,6 +931,8 @@ export interface components {
906
931
  status: string;
907
932
  stream: components["schemas"]["StreamResource"] | null;
908
933
  turn: components["schemas"]["TurnResource"] | null;
934
+ /** @description The assistant's checklist for the work in this conversation, in the order it intends to do it. Empty when it has not written one — short tasks do not get a list. It is rewritten in full each time, so what is here is the current state. */
935
+ todos?: components["schemas"]["TodoResource"][];
909
936
  turnId: string | null;
910
937
  wait: components["schemas"]["WaitResource"] | null;
911
938
  };
@@ -927,8 +954,68 @@ export interface components {
927
954
  SendMessageRequestBody: {
928
955
  /** @description Ids of attachments uploaded earlier that are not yet bound to any message */
929
956
  attachmentIds?: string[] | null;
957
+ client?: components["schemas"]["ClientContextRequest"];
930
958
  text: string;
931
959
  };
960
+ /**
961
+ * @description What this client can do, so the assistant can ask it to do those things while it answers.
962
+ *
963
+ * Send `actions` only when they differ from what was sent last — the list is repeated to the
964
+ * model on every step of the turn, so an unchanged list costs more to resend than to omit.
965
+ * Sending the block without `actions` keeps whatever was declared before.
966
+ */
967
+ ClientContextRequest: {
968
+ /** @description The actions on offer right now. Omit when unchanged since the last message. */
969
+ actions?: components["schemas"]["ClientActionRequest"][] | null;
970
+ /** @description Identifies this client while it stays open. Any stable string is fine; a fresh one per tab is expected. */
971
+ clientId: string;
972
+ /** @description How the client calls itself, shown to the model so it can name it — for example "Leaflow console (web)". */
973
+ label?: string;
974
+ page?: components["schemas"]["ClientPageRequest"];
975
+ };
976
+ ClientActionRequest: {
977
+ /** @description What the action does, written for the model. An action without one can only be guessed at from its name. */
978
+ description: string;
979
+ name: string;
980
+ /** @description JSON Schema for the arguments. Omit for an action that takes none. */
981
+ parameters?: {
982
+ [key: string]: unknown;
983
+ } | null;
984
+ /** @description True when the action changes nothing outside the client. Anything else goes through this conversation's approval before it runs. */
985
+ readOnly?: boolean;
986
+ /**
987
+ * Format: int64
988
+ * @description How long the assistant should wait for this action. 0 uses the default; longer values are capped.
989
+ */
990
+ timeoutMs?: number;
991
+ };
992
+ /** @description What the operator is looking at. The address alone answers most questions about context. */
993
+ ClientPageRequest: {
994
+ title?: string;
995
+ url?: string;
996
+ };
997
+ DynamicCallResultRequestBody: {
998
+ /** @description The same value sent with the message. A result from a client that is no longer the attached one is refused. */
999
+ clientId: string;
1000
+ /** @description Why it failed, when `ok` is false. This reaches the model, so write it for a reader who cannot see the screen. */
1001
+ error?: string;
1002
+ /** @description Pass back when there is more to read. The assistant will call again with it. */
1003
+ nextCursor?: string;
1004
+ ok: boolean;
1005
+ /** @description What the action produced. At most 64 KiB; paginate anything larger rather than truncating it. */
1006
+ output?: string;
1007
+ };
1008
+ TodoResource: {
1009
+ /** @description The same step phrased as happening now — "Installing nginx". Show this one while the item is in progress. */
1010
+ activeForm: string;
1011
+ /** @description The step as an instruction — "Install nginx". */
1012
+ content: string;
1013
+ /**
1014
+ * @description Where this step stands. At most one item is in_progress at any time.
1015
+ * @enum {string}
1016
+ */
1017
+ status: "pending" | "in_progress" | "completed";
1018
+ };
932
1019
  TurnIDResponseBody: {
933
1020
  /** @description True when the assistant was already busy and this message was put in line instead of starting a turn. It is read at the next step of the turn already running, so there is nothing further to do — and turnId is empty in this case. */
934
1021
  queued: boolean;
@@ -1556,6 +1643,40 @@ export interface operations {
1556
1643
  };
1557
1644
  };
1558
1645
  };
1646
+ "submit-dynamic-call-result": {
1647
+ parameters: {
1648
+ query?: never;
1649
+ header?: never;
1650
+ path: {
1651
+ /** @description The id of the tool call entry in the conversation. */
1652
+ call: string;
1653
+ };
1654
+ cookie?: never;
1655
+ };
1656
+ requestBody: {
1657
+ content: {
1658
+ "application/json": components["schemas"]["DynamicCallResultRequestBody"];
1659
+ };
1660
+ };
1661
+ responses: {
1662
+ /** @description No Content */
1663
+ 204: {
1664
+ headers: {
1665
+ [name: string]: unknown;
1666
+ };
1667
+ content?: never;
1668
+ };
1669
+ /** @description Error */
1670
+ default: {
1671
+ headers: {
1672
+ [name: string]: unknown;
1673
+ };
1674
+ content: {
1675
+ "application/json": components["schemas"]["Error"];
1676
+ };
1677
+ };
1678
+ };
1679
+ };
1559
1680
  "list-memories": {
1560
1681
  parameters: {
1561
1682
  query?: never;
@@ -368,7 +368,9 @@ export interface paths {
368
368
  *
369
369
  * Instances are created one by one in order. If the sequence stops part way through, because of a quota limit for example, **the instances already created are kept** and `failure` states why it stopped. A failure on the first instance is treated as a failure of the whole request and no instance is created.
370
370
  *
371
- * Exactly one image source must be given: `image_id` for a platform image, `private_image_id` for a private image. Supplying both or neither is rejected.
371
+ * Exactly one source must be given: `image_id` for a platform image, `private_image_id` for a private image, or `boot_disk_id` to boot a disk you already have. Supplying more than one, or none, is rejected.
372
+ *
373
+ * `boot_disk_id` recovers an instance that can no longer be repaired from the inside. Snapshot its disk, restore that snapshot into a new disk, attach the new disk to another instance and repair it there, then create an instance from it. That disk is not deleted when the instance is released; it is detached and returned to you.
372
374
  *
373
375
  * Instances are created in the availability zone of the instance type. Disks to be attached later must reside in the same zone.
374
376
  *
@@ -1494,6 +1496,11 @@ export interface components {
1494
1496
  hostname: string;
1495
1497
  /** Format: uuid */
1496
1498
  id: string;
1499
+ /**
1500
+ * Format: uuid
1501
+ * @description Non-empty when the instance was created from a disk you already had, instead of from an image
1502
+ */
1503
+ boot_disk_id: string | null;
1497
1504
  /**
1498
1505
  * Format: uuid
1499
1506
  * @description Non-empty when the instance was created from a platform image
@@ -1564,13 +1571,20 @@ export interface components {
1564
1571
  generate_password?: boolean;
1565
1572
  /**
1566
1573
  * Format: uuid
1567
- * @description A platform image. Exactly one of this and `private_image_id`
1574
+ * @description Boot a disk you already have instead of installing an image. The disk must be available, unattached, and in the same availability zone as the instance type. Exactly one of this, `image_id` and `private_image_id`
1575
+ */
1576
+ boot_disk_id?: string;
1577
+ /**
1578
+ * Format: uuid
1579
+ * @description A platform image. Exactly one of this, `private_image_id` and `boot_disk_id`
1568
1580
  */
1569
1581
  image_id?: string;
1570
1582
  /** Format: uuid */
1571
1583
  instance_type_id: string;
1584
+ /** @description The account the disk lets you log in as. Required with `boot_disk_id`, and rejected without it since an image states its own */
1585
+ login_username?: string;
1572
1586
  name: string;
1573
- /** @description Root password. Only the SSH public keys of the project are used when omitted */
1587
+ /** @description The password to set, on the login account and on root. Only the SSH public keys of the project are used when omitted */
1574
1588
  password?: string;
1575
1589
  /**
1576
1590
  * Format: uuid
@@ -1579,12 +1593,12 @@ export interface components {
1579
1593
  port_id?: string;
1580
1594
  /**
1581
1595
  * Format: uuid
1582
- * @description A private image. Exactly one of this and `image_id`
1596
+ * @description A private image. Exactly one of this, `image_id` and `boot_disk_id`
1583
1597
  */
1584
1598
  private_image_id?: string;
1585
1599
  /**
1586
1600
  * Format: int64
1587
- * @description System disk capacity in GB. Chosen automatically from the requirement of the image and the platform minimum when omitted
1601
+ * @description System disk capacity in GB. Chosen automatically from the requirement of the image and the platform minimum when omitted. Ignored with `boot_disk_id`, since that disk already has its capacity
1588
1602
  */
1589
1603
  root_disk_gb?: number;
1590
1604
  /** @description Required when a primary network interface is created, at least one; the default security group is not applied automatically. Ignored together with `port_id`, as the security groups of that interface were fixed when it was created */
@@ -363,6 +363,8 @@ export interface paths {
363
363
  *
364
364
  * To change enrollment settings, use PATCH. This endpoint returns an error when the parameters differ, and does not update an existing configuration.
365
365
  *
366
+ * A failed call leaves the machine recorded with `monitoring_status: FAILED`; the reason is reported in `last_error` via `GET /servers/{serverId}`.
367
+ *
366
368
  * The `tls_psk` in the response is **returned only this once**; store it immediately. If it is lost, it must be rotated.
367
369
  */
368
370
  put: operations["enable-server-monitoring"];
@@ -2685,6 +2687,7 @@ export interface operations {
2685
2687
  query?: never;
2686
2688
  header?: never;
2687
2689
  path: {
2690
+ /** @description Supplied by the caller; no operation issues one. Reuse the identifier the machine already carries in the originating system — a Leaflow Compute instance id, or the caller's own inventory identifier — or allocate a UUID and persist it before the first call. It is the idempotency key of the enrollment. */
2688
2691
  serverId: string;
2689
2692
  };
2690
2693
  cookie?: never;
@@ -640,8 +640,6 @@ export interface components {
640
640
  email_override_verified_at: string | null;
641
641
  /** @description The language notifications are written in, as an IETF language tag */
642
642
  locale: string;
643
- /** @description The IANA time zone times in notifications are stated in */
644
- timezone: string;
645
643
  };
646
644
  /** @description Fields that are omitted are left alone. */
647
645
  UpdatePreferencesRequestBody: {
@@ -649,8 +647,6 @@ export interface components {
649
647
  email_override?: string | null;
650
648
  /** @description An IETF language tag. A language that is not supported is rejected rather than approximated */
651
649
  locale?: string;
652
- /** @description An IANA time zone name, such as Asia/Shanghai */
653
- timezone?: string;
654
650
  };
655
651
  TypePreferenceResource: {
656
652
  /** @description Where this type is delivered */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {