@leaflow/sdk 0.18.0 → 0.20.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.
@@ -52,6 +52,18 @@ export type SubmitDynamicCallResultBody = NonNullable<operations["submit-dynamic
52
52
  export type ListMemoriesResult = operations["list-memories"]["responses"][200]["content"]["application/json"];
53
53
  /** `GET /api/v1/models` 成功时的响应体。 */
54
54
  export type ListModelsResult = operations["list-models"]["responses"][200]["content"]["application/json"];
55
+ /** `GET /api/v1/skills` 成功时的响应体。 */
56
+ export type ListSkillsResult = operations["list-skills"]["responses"][200]["content"]["application/json"];
57
+ /** `POST /api/v1/skills` 成功时的响应体。 */
58
+ export type PutSkillResult = operations["put-skill"]["responses"][200]["content"]["application/json"];
59
+ /** `POST /api/v1/skills` 的请求体。 */
60
+ export type PutSkillBody = NonNullable<operations["put-skill"]["requestBody"]>["content"]["application/json"];
61
+ /** `GET /api/v1/skills/{skill}` 成功时的响应体。 */
62
+ export type GetSkillResult = operations["get-skill"]["responses"][200]["content"]["application/json"];
63
+ /** `PATCH /api/v1/skills/{skill}` 成功时的响应体。 */
64
+ export type SetSkillEnabledResult = operations["set-skill-enabled"]["responses"][200]["content"]["application/json"];
65
+ /** `PATCH /api/v1/skills/{skill}` 的请求体。 */
66
+ export type SetSkillEnabledBody = NonNullable<operations["set-skill-enabled"]["requestBody"]>["content"]["application/json"];
55
67
  /** `GET /api/v1/threads` 成功时的响应体。 */
56
68
  export type ListThreadsResult = operations["list-threads"]["responses"][200]["content"]["application/json"];
57
69
  /** `GET /api/v1/threads` 的查询参数。 */
@@ -302,8 +302,7 @@ export interface paths {
302
302
  * with the namespace `dynamic`; the client acts when that entry turns in_progress and reports
303
303
  * back here.
304
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.
305
+ * The first result is the one that counts. A later one is refused rather than replacing it.
307
306
  */
308
307
  post: operations["submit-dynamic-call-result"];
309
308
  delete?: never;
@@ -372,6 +371,71 @@ export interface paths {
372
371
  patch?: never;
373
372
  trace?: never;
374
373
  };
374
+ "/api/v1/skills": {
375
+ parameters: {
376
+ query?: never;
377
+ header?: never;
378
+ path?: never;
379
+ cookie?: never;
380
+ };
381
+ /**
382
+ * List the skills this project can use
383
+ * @description Everything the assistant can reach in this project, including the ones that are turned off —
384
+ * an entry that disappeared once it was switched off could not be switched back on.
385
+ *
386
+ * `origin` says whether a skill can be edited here. Skills belonging to the project are
387
+ * visible to everyone in it, whoever wrote them.
388
+ */
389
+ get: operations["list-skills"];
390
+ put?: never;
391
+ /**
392
+ * Write a skill for this project
393
+ * @description Creates it, or replaces the project's skill of that name. The whole package goes in each
394
+ * time: files left out of a write are removed, so the stored skill is what was sent and not
395
+ * what accumulated.
396
+ *
397
+ * A project skill takes precedence over a built-in one of the same name for this project only.
398
+ * The built-in is untouched and reappears if the project's is deleted.
399
+ */
400
+ post: operations["put-skill"];
401
+ delete?: never;
402
+ options?: never;
403
+ head?: never;
404
+ patch?: never;
405
+ trace?: never;
406
+ };
407
+ "/api/v1/skills/{skill}": {
408
+ parameters: {
409
+ query?: never;
410
+ header?: never;
411
+ path?: never;
412
+ cookie?: never;
413
+ };
414
+ /**
415
+ * Read one skill, with its files
416
+ * @description Works for built-in skills too; they simply cannot be written.
417
+ */
418
+ get: operations["get-skill"];
419
+ put?: never;
420
+ post?: never;
421
+ /**
422
+ * Delete this project's skill
423
+ * @description A built-in skill of the same name, if there was one, becomes visible again.
424
+ */
425
+ delete: operations["delete-skill"];
426
+ options?: never;
427
+ head?: never;
428
+ /**
429
+ * Turn a skill on or off
430
+ * @description Separate from writing it, because this is the frequent one: a skill that is off costs
431
+ * nothing and stays where it is.
432
+ *
433
+ * Only skills belonging to the project can be switched. To keep a built-in one out of the
434
+ * way, write a project skill of the same name and turn that off.
435
+ */
436
+ patch: operations["set-skill-enabled"];
437
+ trace?: never;
438
+ };
375
439
  "/api/v1/threads": {
376
440
  parameters: {
377
441
  query?: never;
@@ -412,7 +476,7 @@ export interface paths {
412
476
  head?: never;
413
477
  /**
414
478
  * Update conversation settings
415
- * @description Changes the model, reasoning level, approval mode and archived state. A change takes effect from the next turn; a turn already running keeps the settings it started with. reasoningEffort only applies when model is given as well.
479
+ * @description Changes the model, reasoning level, approval mode and archived state. A change takes effect from the next turn; a turn already running keeps the settings it started with. Model and reasoning level change independently: sending one leaves the other alone.
416
480
  */
417
481
  patch: operations["update-thread"];
418
482
  trace?: never;
@@ -819,7 +883,64 @@ export interface components {
819
883
  ModelListResponseBody: {
820
884
  models: components["schemas"]["ModelResource"][] | null;
821
885
  };
886
+ SkillResource: {
887
+ /**
888
+ * @description True when the assistant wrote this skill during a conversation rather than a person
889
+ * writing it here.
890
+ *
891
+ * Which conversation is deliberately not returned: skills are shared across the project
892
+ * while conversations belong to one person, so naming one would tell everybody in the
893
+ * project that a particular colleague had it.
894
+ */
895
+ authoredByAssistant: boolean;
896
+ /** @description Why the assistant would open this skill. It sits in every request, so it is the one field worth writing carefully. */
897
+ description: string;
898
+ enabled: boolean;
899
+ /** @description Path to contents, `SKILL.md` among them. Only returned by `get-skill`; the list leaves it out. */
900
+ files?: {
901
+ [key: string]: string;
902
+ } | null;
903
+ name: string;
904
+ /**
905
+ * @description `builtin` — provided by the platform and read-only here.
906
+ * `project` — written for this project and editable by anyone in it.
907
+ * @enum {string}
908
+ */
909
+ origin: "builtin" | "project";
910
+ shortDescription: string | null;
911
+ /**
912
+ * Format: date-time
913
+ * @description Null for built-in skills, which have no edit history here.
914
+ */
915
+ updatedAt: string | null;
916
+ };
917
+ SkillListResponseBody: {
918
+ skills: components["schemas"]["SkillResource"][];
919
+ };
920
+ SkillRequestBody: {
921
+ /** @description Why the assistant would open this skill. It sits in every request; write it as the answer to "when do I need this", not "what does it contain". */
922
+ description: string;
923
+ /** @default true */
924
+ enabled?: boolean;
925
+ /**
926
+ * @description Path to contents. `SKILL.md` is required; anything else it references goes alongside it.
927
+ *
928
+ * Paths are relative to the skill and cannot leave it. At most 32 files, 256 KiB each and
929
+ * 1 MiB in total.
930
+ */
931
+ files: {
932
+ [key: string]: string;
933
+ };
934
+ /** @description Also how the assistant refers to it, so renaming is deleting and writing again. */
935
+ name: string;
936
+ shortDescription?: string;
937
+ };
938
+ SkillEnabledRequestBody: {
939
+ enabled: boolean;
940
+ };
822
941
  ThreadSummaryResource: {
942
+ /** @description The tier this conversation runs at, or null when it follows the model's own default. */
943
+ reasoningEffort: string | null;
823
944
  /** @enum {string} */
824
945
  approvalMode: "guardian" | "manual" | "yolo";
825
946
  archived: boolean;
@@ -843,6 +964,8 @@ export interface components {
843
964
  approvalMode?: "guardian" | "manual" | "yolo";
844
965
  };
845
966
  ContextResource: {
967
+ /** @description The tier this conversation runs at, or null when it follows the model's own default. */
968
+ reasoningEffort: string | null;
846
969
  /** Format: int64 */
847
970
  compactAt: number | null;
848
971
  model: string;
@@ -871,6 +994,17 @@ export interface components {
871
994
  approvalReason?: string | null;
872
995
  arguments?: string;
873
996
  attachments?: components["schemas"]["AttachmentResource"][] | null;
997
+ /**
998
+ * @description The context blocks the client attached to this message.
999
+ *
1000
+ * **Not part of what the operator wrote** — `text` is. Render the message from `text` and
1001
+ * leave these out of the bubble; they are here so a client that did not send them, or one
1002
+ * that reloaded, can still read what the assistant was given.
1003
+ *
1004
+ * The actions declared alongside them are not returned: they are re-declared as they
1005
+ * change and would make every fetch of the conversation carry them again.
1006
+ */
1007
+ clientContext?: components["schemas"]["ClientContextPart"][] | null;
874
1008
  /** Format: date-time */
875
1009
  createdAt: string;
876
1010
  detail?: string | null;
@@ -941,7 +1075,13 @@ export interface components {
941
1075
  approvalMode?: "guardian" | "manual" | "yolo";
942
1076
  archived?: boolean;
943
1077
  model?: string;
944
- reasoningEffort?: string;
1078
+ /**
1079
+ * @description Which reasoning tier to run at, from the model's `reasoningTiers`. Null puts it back to
1080
+ * the model's own default; leaving it out keeps whatever is set.
1081
+ *
1082
+ * Independent of `model` — sending one does not touch the other.
1083
+ */
1084
+ reasoningEffort?: string | null;
945
1085
  };
946
1086
  DecideRequestBody: {
947
1087
  approved: boolean;
@@ -952,57 +1092,96 @@ export interface components {
952
1092
  items: components["schemas"]["ItemResource"][] | null;
953
1093
  };
954
1094
  SendMessageRequestBody: {
955
- /** @description Ids of attachments uploaded earlier that are not yet bound to any message */
956
- attachmentIds?: string[] | null;
957
1095
  client?: components["schemas"]["ClientContextRequest"];
958
- text: string;
1096
+ /**
1097
+ * @description The message, in the order it was written. A message with nothing but text is a single
1098
+ * text part; that is the ordinary case and nothing else is required.
1099
+ */
1100
+ parts: components["schemas"]["MessagePart"][];
959
1101
  };
960
1102
  /**
961
- * @description What this client can do, so the assistant can ask it to do those things while it answers.
1103
+ * @description One piece of a message. `type` says which of the fields below carries it:
1104
+ *
1105
+ * - `text` — the words, in `text`
1106
+ * - `file` — an attachment uploaded earlier, by id in `attachmentId`
1107
+ * - `data-<something>` — context from the client, in `data`. The name after `data-` is yours;
1108
+ * it is shown to the assistant so it can tell one kind of block from another.
962
1109
  *
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.
1110
+ * Order matters: an image belongs where it was written, not at the end.
1111
+ */
1112
+ MessagePart: {
1113
+ /** @description For `file` parts. The attachment must have been uploaded and not yet bound to another message. */
1114
+ attachmentId?: string | null;
1115
+ /** @description For `data-*` parts. Any object; its keys reach the assistant as they are. */
1116
+ data?: {
1117
+ [key: string]: unknown;
1118
+ } | null;
1119
+ /** @description For `text` parts. */
1120
+ text?: string | null;
1121
+ type: string;
1122
+ };
1123
+ /**
1124
+ * @description Which client this is and what it can do, so the assistant can ask it to do those things
1125
+ * while it answers. What the operator is looking at travels as `data-*` parts on the message.
1126
+ *
1127
+ * Send `actions` only when they differ from the last message on this conversation. Sending the
1128
+ * block without `actions` keeps whatever was declared before.
966
1129
  */
967
1130
  ClientContextRequest: {
968
1131
  /** @description The actions on offer right now. Omit when unchanged since the last message. */
969
1132
  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. */
1133
+ /** @description Identifies this client while it stays open. Any stable string; one per tab or process. */
971
1134
  clientId: string;
972
- /** @description How the client calls itself, shown to the model so it can name it — for example "Leaflow console (web)". */
1135
+ /** @description How the client calls itself, for example "Leaflow console (web)". */
973
1136
  label?: string;
974
- page?: components["schemas"]["ClientPageRequest"];
975
1137
  };
1138
+ /** @description A `data-*` part as it was sent. */
1139
+ ClientContextPart: {
1140
+ data: {
1141
+ [key: string]: unknown;
1142
+ };
1143
+ type: string;
1144
+ };
1145
+ /** @description The shape of a tool in the OpenAI Chat Completions API, plus `readOnly` and `timeoutMs`. */
976
1146
  ClientActionRequest: {
1147
+ function: components["schemas"]["ClientFunctionRequest"];
1148
+ /** @description True when the action changes nothing outside the client. Anything else goes through this conversation's approval before it runs. */
1149
+ readOnly: boolean;
1150
+ /**
1151
+ * Format: int64
1152
+ * @description How long the assistant should wait for this action. Omit for the default; longer values are capped.
1153
+ */
1154
+ timeoutMs?: number;
1155
+ /**
1156
+ * @description Only functions are supported.
1157
+ * @default function
1158
+ * @enum {string}
1159
+ */
1160
+ type?: "function";
1161
+ };
1162
+ /** @description The function object from the OpenAI tools format. */
1163
+ ClientFunctionRequest: {
977
1164
  /** @description What the action does, written for the model. An action without one can only be guessed at from its name. */
978
1165
  description: string;
1166
+ /** @description The MCP and Anthropic spelling of `parameters`. Give one or the other, not both. */
1167
+ inputSchema?: {
1168
+ [key: string]: unknown;
1169
+ } | null;
979
1170
  name: string;
980
1171
  /** @description JSON Schema for the arguments. Omit for an action that takes none. */
981
1172
  parameters?: {
982
1173
  [key: string]: unknown;
983
1174
  } | 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
1175
  };
997
1176
  DynamicCallResultRequestBody: {
998
- /** @description The same value sent with the message. A result from a client that is no longer the attached one is refused. */
1177
+ /** @description The same value sent with the message. A result from a different client is refused. */
999
1178
  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. */
1179
+ /** @description Why it failed, when `ok` is false. It reaches the assistant, so write it for a reader who cannot see the screen. */
1001
1180
  error?: string;
1002
1181
  /** @description Pass back when there is more to read. The assistant will call again with it. */
1003
1182
  nextCursor?: string;
1004
1183
  ok: boolean;
1005
- /** @description What the action produced. At most 64 KiB; paginate anything larger rather than truncating it. */
1184
+ /** @description What the action produced. At most 64 KiB; use `nextCursor` for anything larger. */
1006
1185
  output?: string;
1007
1186
  };
1008
1187
  TodoResource: {
@@ -1764,6 +1943,164 @@ export interface operations {
1764
1943
  };
1765
1944
  };
1766
1945
  };
1946
+ "list-skills": {
1947
+ parameters: {
1948
+ query?: never;
1949
+ header?: never;
1950
+ path?: never;
1951
+ cookie?: never;
1952
+ };
1953
+ requestBody?: never;
1954
+ responses: {
1955
+ /** @description OK */
1956
+ 200: {
1957
+ headers: {
1958
+ [name: string]: unknown;
1959
+ };
1960
+ content: {
1961
+ "application/json": components["schemas"]["SkillListResponseBody"];
1962
+ };
1963
+ };
1964
+ /** @description Error */
1965
+ default: {
1966
+ headers: {
1967
+ [name: string]: unknown;
1968
+ };
1969
+ content: {
1970
+ "application/json": components["schemas"]["Error"];
1971
+ };
1972
+ };
1973
+ };
1974
+ };
1975
+ "put-skill": {
1976
+ parameters: {
1977
+ query?: never;
1978
+ header?: never;
1979
+ path?: never;
1980
+ cookie?: never;
1981
+ };
1982
+ requestBody: {
1983
+ content: {
1984
+ "application/json": components["schemas"]["SkillRequestBody"];
1985
+ };
1986
+ };
1987
+ responses: {
1988
+ /** @description OK */
1989
+ 200: {
1990
+ headers: {
1991
+ [name: string]: unknown;
1992
+ };
1993
+ content: {
1994
+ "application/json": components["schemas"]["SkillResource"];
1995
+ };
1996
+ };
1997
+ /** @description Error */
1998
+ default: {
1999
+ headers: {
2000
+ [name: string]: unknown;
2001
+ };
2002
+ content: {
2003
+ "application/json": components["schemas"]["Error"];
2004
+ };
2005
+ };
2006
+ };
2007
+ };
2008
+ "get-skill": {
2009
+ parameters: {
2010
+ query?: never;
2011
+ header?: never;
2012
+ path: {
2013
+ /** @description The skill's name, as `list-skills` returned it. */
2014
+ skill: string;
2015
+ };
2016
+ cookie?: never;
2017
+ };
2018
+ requestBody?: never;
2019
+ responses: {
2020
+ /** @description OK */
2021
+ 200: {
2022
+ headers: {
2023
+ [name: string]: unknown;
2024
+ };
2025
+ content: {
2026
+ "application/json": components["schemas"]["SkillResource"];
2027
+ };
2028
+ };
2029
+ /** @description Error */
2030
+ default: {
2031
+ headers: {
2032
+ [name: string]: unknown;
2033
+ };
2034
+ content: {
2035
+ "application/json": components["schemas"]["Error"];
2036
+ };
2037
+ };
2038
+ };
2039
+ };
2040
+ "delete-skill": {
2041
+ parameters: {
2042
+ query?: never;
2043
+ header?: never;
2044
+ path: {
2045
+ skill: string;
2046
+ };
2047
+ cookie?: never;
2048
+ };
2049
+ requestBody?: never;
2050
+ responses: {
2051
+ /** @description No Content */
2052
+ 204: {
2053
+ headers: {
2054
+ [name: string]: unknown;
2055
+ };
2056
+ content?: never;
2057
+ };
2058
+ /** @description Error */
2059
+ default: {
2060
+ headers: {
2061
+ [name: string]: unknown;
2062
+ };
2063
+ content: {
2064
+ "application/json": components["schemas"]["Error"];
2065
+ };
2066
+ };
2067
+ };
2068
+ };
2069
+ "set-skill-enabled": {
2070
+ parameters: {
2071
+ query?: never;
2072
+ header?: never;
2073
+ path: {
2074
+ skill: string;
2075
+ };
2076
+ cookie?: never;
2077
+ };
2078
+ requestBody: {
2079
+ content: {
2080
+ "application/json": components["schemas"]["SkillEnabledRequestBody"];
2081
+ };
2082
+ };
2083
+ responses: {
2084
+ /** @description OK */
2085
+ 200: {
2086
+ headers: {
2087
+ [name: string]: unknown;
2088
+ };
2089
+ content: {
2090
+ "application/json": components["schemas"]["SkillResource"];
2091
+ };
2092
+ };
2093
+ /** @description Error */
2094
+ default: {
2095
+ headers: {
2096
+ [name: string]: unknown;
2097
+ };
2098
+ content: {
2099
+ "application/json": components["schemas"]["Error"];
2100
+ };
2101
+ };
2102
+ };
2103
+ };
1767
2104
  "list-threads": {
1768
2105
  parameters: {
1769
2106
  query?: {
@@ -14,6 +14,8 @@ export interface paths {
14
14
  * 查看本项目的四层隧道
15
15
  * @description 还没生成过时返回 `TUNNEL_NOT_FOUND`——首屏据此决定画「生成订阅链接」那个按钮还是画结果。
16
16
  *
17
+ * 项目未获开放时返回 403 `TUNNEL_NOT_ENTITLED`,那是另一件事:控制台据此把四层隧道的入口整个收起来,而不是画那个按钮。
18
+ *
17
19
  * 订阅地址、用量、配额各有自己的接口,这里不重复返回。
18
20
  */
19
21
  get: operations["get-l4-tunnel"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {