@deepraxis/sdk 0.2.0-dev.837a8c3 → 0.2.0-dev.855f099

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.
@@ -1228,7 +1228,7 @@ export const browserListSessions = (options) => (options?.client ?? client).get(
1228
1228
  /**
1229
1229
  * 创建浏览器会话
1230
1230
  *
1231
- * 创建云端 Chrome,返回自带凭证的 connectUrl;带 name 时按名字幂等:本账户已有同名且 RUNNING(未在释放中)、挂载的登录态与本次相同(都没挂也算相同)的会话,就直接返回这个会话(HTTP 200,reused=true,不新开、不计费),同名但登录态不同返回 409 SESSION_NAME_IN_USE(消息写明已有会话的 id),同名会话已在释放或已结束则新开;不带 name 时每次都新开(HTTP 201,reused=false)。同一件事请固定一个会话名并复用,不要每步新开再关闭:频繁新开会话对网站来说像同一账号不断换新设备登录,容易触发风控。persist 写入租约仍只属于这一个会话。它是一条完整 CDP 连接,真指针事件(触摸、拖拽、按坐标点击)从那里发送,页面动作接口只做按 ref 的语义动作。API 会话默认断开后结束;最长 6 小时。运行中服务每 60 秒做一次健康检查(Browser.getVersion,超时 10 秒),连续 2 次失败即以 closeReason=watchdog 结束会话,keepAlive=true 也不豁免;该事件记录判据读数。
1231
+ * 创建云端 Chrome,返回自带凭证的 connectUrl;带 name 时按名字幂等:本账户已有同名且 RUNNING(未在释放中)、挂载的登录态与本次相同(都没挂也算相同)的会话,就直接返回这个会话(HTTP 200,reused=true,不新开、不计费),同名但登录态不同返回 409 SESSION_NAME_IN_USE(消息写明已有会话的 id),同名会话已在释放或已结束则新开;不带 name 时每次都新开(HTTP 201,reused=false)。同一件事请固定一个会话名并复用,不要每步新开再关闭:频繁新开会话对网站来说像同一账号不断换新设备登录,容易触发风控。persist 写入租约仍只属于这一个会话。它是一条完整 CDP 连接,真指针事件(触摸、拖拽、按坐标点击)从那里发送,页面动作接口只做按 ref 的语义动作。API 会话默认断开后结束;最长 6 小时。请求体里不认识的字段返回 400 INVALID_PARAMS 并写明字段名,不会被静默忽略;登录态写在 browserSettings.context({ id, persist }),写在顶层会被拒绝。运行中服务每 60 秒做一次健康检查(Browser.getVersion,超时 10 秒),连续 2 次失败即以 closeReason=watchdog 结束会话,keepAlive=true 也不豁免;该事件记录判据读数。
1232
1232
  */
1233
1233
  export const browserCreateSession = (options) => (options.client ?? client).post({
1234
1234
  security: [{
@@ -1306,7 +1306,7 @@ export const browserListEvents = (options) => (options.client ?? client).get({
1306
1306
  /**
1307
1307
  * 执行页面动作
1308
1308
  *
1309
- * 在会话的浏览器里执行一个页面动作并返回结果,由浏览器服务执行,客户端不需要 Playwright。同一会话的动作按到达顺序串行执行,单个动作 30 秒内完成。先用 snapshot 读取页面:元素带 [ref=eN],click、fill、select 按 ref 操作;ref 只在最近一次快照里有效,页面跳转后失效(409 ACTION_REF_STALE,重新 snapshot)。省略 tab 时作用于当前标签页。动作都是语义动作:click、fill、select 按快照 ref 定位元素,scroll 派发滚轮事件;没有触摸、拖拽或按坐标点击,也没有按坐标派发指针事件的动作。页面必须收到真手指或指针事件(touchstart/touchmove/touchend、拖拽、按坐标点击)时,改用 CDP 连接:使用创建会话返回的 connectUrl,或 /browser/v1/connect 建立连接,再发送 Input.dispatchTouchEvent、Input.dispatchMouseEvent 等 CDP 命令。
1309
+ * 在会话的浏览器里执行一个页面动作并返回结果,由浏览器服务执行,客户端不需要 Playwright。同一会话的动作按到达顺序串行执行,单个动作 30 秒内完成。先用 snapshot 读取页面:元素带 [ref=eN],click、fill、select 按 ref 操作;ref 只在最近一次快照里有效,页面跳转后失效(409 ACTION_REF_STALE,重新 snapshot)。省略 tab 时作用于当前标签页。动作都是语义动作:click、fill、select 按快照 ref 定位元素,scroll 派发滚轮事件;网络层用 route、unroute、routes 拦截请求(对标 Playwright 的 context.route 与 CDP Fetch 域):规则挂在会话上,open、reload、新开标签页之后仍然有效,会话结束时清除,多条规则都匹配时后注册的优先;没有触摸、拖拽或按坐标点击,也没有按坐标派发指针事件的动作。页面必须收到真手指或指针事件(touchstart/touchmove/touchend、拖拽、按坐标点击)时,改用 CDP 连接:使用创建会话返回的 connectUrl,或 /browser/v1/connect 建立连接,再发送 Input.dispatchTouchEvent、Input.dispatchMouseEvent 等 CDP 命令。
1310
1310
  */
1311
1311
  export const browserRunPageAction = (options) => (options.client ?? client).post({
1312
1312
  security: [{
@@ -1559,7 +1559,7 @@ export const browserClaimByobPairing = (options) => (options.client ?? client).p
1559
1559
  /**
1560
1560
  * 连接云端浏览器
1561
1561
  *
1562
- * CDP WebSocket:不填 session 或 name 时新开;session 连接已有会话;name 有就连接、没有就新开。session 与 name 不可同时提供。新建参数在连接已有会话时忽略。使用 Authorization: Bearer API_KEY,或直接使用创建会话返回的带 signingKey 的 connectUrl。连上后发送 CDP 命令 Praxis.getSession,获取 sessionId、liveViewUrl、consoleUrl。这是完整 CDP 连接:真手指或指针事件(Emulation.setTouchEmulationEnabled 加 Input.dispatchTouchEvent、拖拽用的 Input.dispatchMouseEvent)只能从这里发,页面动作接口只做按 ref 的语义动作。要挂指定登录态,可用 context 参数,或直接连接 sessions.create 返回的 connectUrl。
1562
+ * CDP WebSocket:不填 session 或 name 时新开;session 连接已有会话;name 有就连接、没有就新开。session 与 name 不可同时提供。新建参数在连接已有会话时忽略。使用 Authorization: Bearer API_KEY,或直接使用创建会话返回的带 signingKey 的 connectUrl。连上后发送 CDP 命令 Praxis.getSession,获取 sessionId、liveViewUrl、consoleUrl(两者都是该会话在 Console 的会话页)。这是完整 CDP 连接:真手指或指针事件(Emulation.setTouchEmulationEnabled 加 Input.dispatchTouchEvent、拖拽用的 Input.dispatchMouseEvent)只能从这里发,页面动作接口只做按 ref 的语义动作。要挂指定登录态,可用 context 参数,或直接连接 sessions.create 返回的 connectUrl。
1563
1563
  */
1564
1564
  export const browserConnect = (options) => (options?.client ?? client).get({
1565
1565
  security: [{
@@ -1577,7 +1577,7 @@ export const browserConnect = (options) => (options?.client ?? client).get({
1577
1577
  /**
1578
1578
  * 打开实时浏览器画面
1579
1579
  *
1580
- * 使用 debug 返回的完整实时观看地址打开浏览器画面,成功后跳转到对应会话或标签页。必须保留地址中的 t 凭证,无需额外 API Key;链接失效时重新调用 debug 获取地址。
1580
+ * 旧版 debug 返回的带 t 凭证的地址,凭证在有效期内时跳转到该会话在 Console 的会话页。debug 现在直接返回 Console 会话页地址,新代码不要拼这个地址。
1581
1581
  */
1582
1582
  export const browserLiveView = (options) => (options.client ?? client).get({
1583
1583
  security: [{
@@ -3276,9 +3276,9 @@ export const getOrganizationNotificationsInbox = (options) => (options?.client ?
3276
3276
  ...options
3277
3277
  });
3278
3278
  /**
3279
- * List the letters addressed to you
3279
+ * List the letters addressed to you, or the ones you sent
3280
3280
  *
3281
- * The letters this person received in this organization, newest first, as the notification center lists them (ADR-193 §5, #4107): the sender, the summary and the whole body are the copy this reader receives — every human:/agent: address is rendered as the directory's display name, and one the directory cannot name reads 「未知成员」, never an address or an internal id. Also the kind, when it arrived, whether it is read, and one line saying why it reached this person. The address is the credential's own and is never a request field. Details stay whole in body; open one by its id. Pass next_cursor unchanged as cursor; null ends the list. Read-only; no usage charge.
3281
+ * The letters this person received (or, with direction=sent, wrote) in this organization, newest first, as the notification center lists them (ADR-193 §5, #4107): the sender, the summary and the whole body are the copy this reader receives — every human:/agent: address is rendered as the directory's display name, and one the directory cannot name reads 「未知成员」, never an address or an internal id. Also the kind, when it arrived, whether it is read, and one line saying why it reached this person. The address is the credential's own and is never a request field. Details stay whole in body; open one by its id. Pass next_cursor unchanged as cursor; null ends the list. Read-only; no usage charge.
3282
3282
  */
3283
3283
  export const listOrganizationNotificationLetters = (options) => (options?.client ?? client).get({
3284
3284
  security: [{
@@ -3293,6 +3293,28 @@ export const listOrganizationNotificationLetters = (options) => (options?.client
3293
3293
  url: '/organization/v1/notifications/letters',
3294
3294
  ...options
3295
3295
  });
3296
+ /**
3297
+ * Send a letter to a person or an agent
3298
+ *
3299
+ * Write one letter to a member or an agent of this organization, for an automation script or an outside caller that needs to reach someone, or to leave itself an alarm: a letter to your own address is allowed and arrives at its deliver_at. The sender is the credential's own and is never a request field — a person writes as themselves, an agent as itself, and an automation run (a scheduled or service-started one included) as the platform's automation sender with the run recorded in the letter's source; a `sender` in the body is ignored. Any other credential (an organization API key, an application) has no address to write from and is refused with 403. The recipient must belong to this organization: a person or agent of another organization answers 404 without saying whether it exists. A letter to a person needs a summary of at most 60 characters — one sentence saying what the reader must do or know; a longer one is refused, never cut. An agent's letter may leave summary out and the first line of body stands in. Repeating the same letter (same recipient, kind, thread, body and time) returns the same id and writes it once. Usage charge: none.
3300
+ */
3301
+ export const createOrganizationNotificationLetter = (options) => (options.client ?? client).post({
3302
+ security: [{
3303
+ key: 'BearerAuth',
3304
+ scheme: 'bearer',
3305
+ type: 'http'
3306
+ }, {
3307
+ key: 'ApiKeyAuth',
3308
+ name: 'X-API-Key',
3309
+ type: 'apiKey'
3310
+ }],
3311
+ url: '/organization/v1/notifications/letters',
3312
+ ...options,
3313
+ headers: {
3314
+ 'Content-Type': 'application/json',
3315
+ ...options.headers
3316
+ }
3317
+ });
3296
3318
  /**
3297
3319
  * Open one of your letters by its id
3298
3320
  *
@@ -3369,6 +3391,100 @@ export const archiveOrganizationNotificationLetter = (options) => (options.clien
3369
3391
  url: '/organization/v1/notifications/letters/{id}:archive',
3370
3392
  ...options
3371
3393
  });
3394
+ /**
3395
+ * List your bell messages
3396
+ *
3397
+ * The calling person's bell messages in this organization, newest first: the inbox tab by default, or the archive tab with archived=1. The person is always the credential's own; the request cannot name another member. Pass nextPageToken unchanged as page for the next page; it is absent on the last one. Read-only; no usage charge.
3398
+ */
3399
+ export const listOrganizationNotificationMessages = (options) => (options?.client ?? client).get({
3400
+ security: [{
3401
+ key: 'BearerAuth',
3402
+ scheme: 'bearer',
3403
+ type: 'http'
3404
+ }, {
3405
+ key: 'ApiKeyAuth',
3406
+ name: 'X-API-Key',
3407
+ type: 'apiKey'
3408
+ }],
3409
+ url: '/organization/v1/notifications/messages',
3410
+ ...options
3411
+ });
3412
+ /**
3413
+ * Delete one of your bell messages
3414
+ *
3415
+ * Delete one of the calling person's own bell messages for good. A message that is not theirs — another person's, another organization's — answers 404 exactly as one that does not exist, and nothing is deleted. Deleting a message does not delete the letter or notice it announced. No usage charge.
3416
+ */
3417
+ export const deleteOrganizationNotificationMessage = (options) => (options.client ?? client).delete({
3418
+ security: [{
3419
+ key: 'BearerAuth',
3420
+ scheme: 'bearer',
3421
+ type: 'http'
3422
+ }, {
3423
+ key: 'ApiKeyAuth',
3424
+ name: 'X-API-Key',
3425
+ type: 'apiKey'
3426
+ }],
3427
+ url: '/organization/v1/notifications/messages/{name}',
3428
+ ...options
3429
+ });
3430
+ /**
3431
+ * Open one of your bell messages
3432
+ *
3433
+ * One bell message of the calling person by its name. A message that is not theirs — another person's, another organization's — answers 404 exactly as one that does not exist, without saying which. Read-only; no usage charge.
3434
+ */
3435
+ export const getOrganizationNotificationMessage = (options) => (options.client ?? client).get({
3436
+ security: [{
3437
+ key: 'BearerAuth',
3438
+ scheme: 'bearer',
3439
+ type: 'http'
3440
+ }, {
3441
+ key: 'ApiKeyAuth',
3442
+ name: 'X-API-Key',
3443
+ type: 'apiKey'
3444
+ }],
3445
+ url: '/organization/v1/notifications/messages/{name}',
3446
+ ...options
3447
+ });
3448
+ /**
3449
+ * Mark one of your bell messages read or archived
3450
+ *
3451
+ * Change the read or archived flag of one of the calling person's own bell messages and return it. Name at least one flag. Reading a message also tells the notification still waiting on it, so it is not emailed later as unread. A message that is not theirs answers 404 like one that does not exist. No usage charge.
3452
+ */
3453
+ export const updateOrganizationNotificationMessage = (options) => (options.client ?? client).post({
3454
+ security: [{
3455
+ key: 'BearerAuth',
3456
+ scheme: 'bearer',
3457
+ type: 'http'
3458
+ }, {
3459
+ key: 'ApiKeyAuth',
3460
+ name: 'X-API-Key',
3461
+ type: 'apiKey'
3462
+ }],
3463
+ url: '/organization/v1/notifications/messages/{name}',
3464
+ ...options,
3465
+ headers: {
3466
+ 'Content-Type': 'application/json',
3467
+ ...options.headers
3468
+ }
3469
+ });
3470
+ /**
3471
+ * Mark all your unread bell messages read
3472
+ *
3473
+ * Mark every unread, unarchived bell message of the calling person in this organization as read, and tell the notifications still waiting on them. Nothing of anyone else's is touched. Returns how many messages changed; 0 when there was nothing unread. No usage charge.
3474
+ */
3475
+ export const readAllOrganizationNotificationMessages = (options) => (options?.client ?? client).post({
3476
+ security: [{
3477
+ key: 'BearerAuth',
3478
+ scheme: 'bearer',
3479
+ type: 'http'
3480
+ }, {
3481
+ key: 'ApiKeyAuth',
3482
+ name: 'X-API-Key',
3483
+ type: 'apiKey'
3484
+ }],
3485
+ url: '/organization/v1/notifications/messages:readAll',
3486
+ ...options
3487
+ });
3372
3488
  /**
3373
3489
  * Your notification switches, and what they resolve to
3374
3490
  *
@@ -13775,6 +13891,98 @@ export const mediaDesignVoice = (options) => (options.client ?? client).post({
13775
13891
  ...options.headers
13776
13892
  }
13777
13893
  });
13894
+ /**
13895
+ * List works
13896
+ *
13897
+ * List the works of a library as summaries, most recently changed first: id, kind, title, series, cover_url, item_count, missing_count and updated_at. Filter with kind and series (for example all platform versions of one story), match the title with q, and continue with next_cursor.
13898
+ */
13899
+ export const mediaListWorks = (options) => (options.client ?? client).get({
13900
+ security: [{
13901
+ key: 'media-BearerAuth',
13902
+ scheme: 'bearer',
13903
+ type: 'http'
13904
+ }],
13905
+ url: '/media/v1/libraries/{library_id}/works',
13906
+ ...options
13907
+ });
13908
+ /**
13909
+ * Create work
13910
+ *
13911
+ * Create a work in a library: a gallery (图文), an article (长文), a product listing (商品图组) or a general work (blocks, 通用作品, Editor.js saved data whose image blocks name library assets in data.asset_id) that orders references to assets of this same library and adds a title and text. Upload or generate the pictures first, then send kind and body. In an article an inline image is written ![alt](asset:<asset_id>) where it should appear. Every asset the body names must be a live image or sticker of this library (a gallery item may also be a video), or the request is refused naming every bad reference and nothing is saved. Price, stock and other unknown fields are refused. Several platform versions of one story are several works with the same series. A work copies no file and changes no asset; creating one is free. Answers 201 with the work. Example: POST /media/v1/libraries/default/works with {"kind":"gallery","series":"ai-diary-01","body":{"title":"AI 创业第一天就踩坑","items":[{"asset_id":"<asset id>"}]}}.
13912
+ */
13913
+ export const mediaCreateWork = (options) => (options.client ?? client).post({
13914
+ security: [{
13915
+ key: 'media-BearerAuth',
13916
+ scheme: 'bearer',
13917
+ type: 'http'
13918
+ }],
13919
+ url: '/media/v1/libraries/{library_id}/works',
13920
+ ...options,
13921
+ headers: {
13922
+ 'Content-Type': 'application/json',
13923
+ ...options.headers
13924
+ }
13925
+ });
13926
+ /**
13927
+ * Delete work
13928
+ *
13929
+ * Delete a work. Only the work goes: every asset it named stays in the library unchanged.
13930
+ */
13931
+ export const mediaDeleteWork = (options) => (options.client ?? client).delete({
13932
+ security: [{
13933
+ key: 'media-BearerAuth',
13934
+ scheme: 'bearer',
13935
+ type: 'http'
13936
+ }],
13937
+ url: '/media/v1/libraries/{library_id}/works/{work_id}',
13938
+ ...options
13939
+ });
13940
+ /**
13941
+ * Get work
13942
+ *
13943
+ * Read one work with its body, custom fields, revision and missing (asset ids deleted since; the body keeps them in place). Add expand=assets to receive every referenced asset’s type, short-lived url, thumbnail_url and size in the same answer, which is what a publish script needs to send the work out. Use work_id from creation or listing.
13944
+ */
13945
+ export const mediaGetWork = (options) => (options.client ?? client).get({
13946
+ security: [{
13947
+ key: 'media-BearerAuth',
13948
+ scheme: 'bearer',
13949
+ type: 'http'
13950
+ }],
13951
+ url: '/media/v1/libraries/{library_id}/works/{work_id}',
13952
+ ...options
13953
+ });
13954
+ /**
13955
+ * Update work
13956
+ *
13957
+ * Change a work. body replaces the whole body and is checked like a new one; series replaces the series and null clears it; custom is a JSON Merge Patch (RFC 7396), so a script writing back its published link and numbers sends only its own keys and never erases keys another script wrote, and null removes a key. Send if_revision with the revision you read to apply the change only if nobody changed the work since; otherwise the answer is 409 REVISION_CONFLICT. Example: PATCH /media/v1/libraries/default/works/<work id> with {"custom":{"published_url":"https://…","stats":{"likes":120}}}.
13958
+ */
13959
+ export const mediaUpdateWork = (options) => (options.client ?? client).patch({
13960
+ security: [{
13961
+ key: 'media-BearerAuth',
13962
+ scheme: 'bearer',
13963
+ type: 'http'
13964
+ }],
13965
+ url: '/media/v1/libraries/{library_id}/works/{work_id}',
13966
+ ...options,
13967
+ headers: {
13968
+ 'Content-Type': 'application/json',
13969
+ ...options.headers
13970
+ }
13971
+ });
13972
+ /**
13973
+ * List works using an asset
13974
+ *
13975
+ * List the works whose body names one asset, as work summaries, most recently changed first. Check it before deleting an asset: the delete is never blocked, and those works would then show the asset as missing.
13976
+ */
13977
+ export const mediaListAssetWorks = (options) => (options.client ?? client).get({
13978
+ security: [{
13979
+ key: 'media-BearerAuth',
13980
+ scheme: 'bearer',
13981
+ type: 'http'
13982
+ }],
13983
+ url: '/media/v1/libraries/{library_id}/assets/{asset_id}/works',
13984
+ ...options
13985
+ });
13778
13986
  /**
13779
13987
  * List types
13780
13988
  *