@deepraxis/cli 0.3.0-dev.983bcdd → 0.3.0-dev.99bbb95
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/COMMANDS.md +22 -2
- package/dist/praxis.js +1818 -165
- package/package.json +1 -1
package/dist/praxis.js
CHANGED
|
@@ -13983,13 +13983,20 @@ var FLAGS;
|
|
|
13983
13983
|
var init_flag_registry_generated = __esm(() => {
|
|
13984
13984
|
FLAGS = {
|
|
13985
13985
|
"agent-cognition-idle-wake": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "genius", ticket: 540, expires: "2026-11-30", system: "flagship" },
|
|
13986
|
+
"agent-process-mode-base": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2365, expires: "2026-12-16", system: "devops" },
|
|
13987
|
+
"cognition-per-agent": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2506, expires: "2026-11-30", system: "devops" },
|
|
13986
13988
|
"cognition-weight-driven": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-bd", ticket: 1760, expires: "2026-12-05", system: "devops" },
|
|
13989
|
+
"computer-archive-volume": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2419, expires: "2026-11-30", system: "devops" },
|
|
13987
13990
|
crm: { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_rv860m7z9h8szkgma56cd14n", ticket: 2179, expires: "2026-12-31", system: "devops" },
|
|
13988
13991
|
"delivery-rules-v2": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2048, expires: "2026-11-28", system: "devops" },
|
|
13992
|
+
"end-users": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2312, expires: "2026-12-15", system: "devops" },
|
|
13993
|
+
"letters-email-delivery": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2150, expires: "2026-11-29", system: "devops" },
|
|
13989
13994
|
"model-access-gate": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 1933, expires: "2026-12-15", system: "devops" },
|
|
13990
13995
|
"open-project": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-51", ticket: 1488, expires: "2026-11-25", system: "devops" },
|
|
13991
13996
|
"requests-never-hold": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2119, expires: "2026-11-29", system: "devops" },
|
|
13992
13997
|
"requests-v1": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2057, expires: "2026-11-28", system: "devops" },
|
|
13998
|
+
"resource-library": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "agent_97823517-ae48-422d-8abc-fa4d8bacd5cc", ticket: 2546, expires: "2026-11-30", system: "devops" },
|
|
13999
|
+
"router-diagnostics-telemetry": { kind: "OPS", type: "BOOLEAN", default: false, owner: "agent_7bc73c94-ffe8-482c-8f9f-2e40bc1c9951", ticket: 2559, expires: "2026-11-30", system: "devops" },
|
|
13993
14000
|
"router-precommit-hedge": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2052, expires: "2026-11-28", system: "devops" },
|
|
13994
14001
|
"router-responses-hedge": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2149, expires: "2026-11-28", system: "devops" },
|
|
13995
14002
|
"search-provider-routing": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-98", ticket: 716, expires: "2026-12-31", system: "devops" },
|
|
@@ -30308,7 +30315,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
30308
30315
|
resource: "file.uploads",
|
|
30309
30316
|
method: "createSigned",
|
|
30310
30317
|
summary: "Create a one-time upload URL",
|
|
30311
|
-
description: "Upload a local file of up to 20 GiB from a coding agent without sending bytes through the model. Provide filename (the stored basename), exact byte count and MIME type. Up to 104857600 bytes, PUT the file to url with curl -T photo.png -H 'Content-Type: image/png' '<url>'; success returns 201 with the file object, and reuse returns 410 CAPABILITY_USED. Above that threshold, split the file into part_size chunks (default 64000000 bytes) and PUT each chunk to its numbered parts[].url in any order; an interrupted client GETs status_url to see the received parts and resends only what is missing, then POSTs complete_url without a body. Part PUTs return 200; completion returns 201 with the file object, including its state, or 400 if a part is missing. A processing file can be polled with files.retrieve until active. Identical part bytes may be retried; changed bytes at the same number return 400. Completion reuse returns 410 CAPABILITY_USED. Each PUT requires the exact signed Content-Length; single-PUT Content-Type must match content_type or be omitted. Expired, revoked, invalid
|
|
30318
|
+
description: "Upload a local file of up to 20 GiB from a coding agent without sending bytes through the model. Provide filename (the stored basename), exact byte count and MIME type. Up to 104857600 bytes, PUT the file to url with curl -T photo.png -H 'Content-Type: image/png' '<url>'; success returns 201 with the file object, and reuse returns 410 CAPABILITY_USED. Above that threshold, split the file into part_size chunks (default 64000000 bytes) and PUT each chunk to its numbered parts[].url in any order; an interrupted client GETs status_url to see the received parts and resends only what is missing, then POSTs complete_url without a body. Part PUTs return 200; completion returns 201 with the file object, including its state, or 400 if a part is missing. A processing file can be polled with files.retrieve until active. Identical part bytes may be retried; changed bytes at the same number return 400. Completion reuse returns 410 CAPABILITY_USED. Each PUT requires the exact signed Content-Length; single-PUT Content-Type must match content_type or be omitted. Expired, revoked, invalid or cross-organization URLs return 404, and so does a link whose upload record no longer exists. A URL that is authentic but names another action returns 403 CAPABILITY_MISMATCH: a status link posted to complete_url answers it, and so does a completion link fetched as status_url. URL lifetime defaults to 900 seconds for single PUT or 604800 (7 days) for multipart, at most 604800; all multipart URLs, including status_url, share an expiry. Multipart creation reserves storage quota. Issuance requires the same unscoped credential as direct file creation. Each issuance creates a new upload and is not idempotent. Example body: {\"filename\":\"photo.png\",\"bytes\":2048,\"content_type\":\"image/png\"}.",
|
|
30312
30319
|
http: "POST",
|
|
30313
30320
|
path: "/file/v1/uploads/signed",
|
|
30314
30321
|
streaming: "no",
|
|
@@ -32032,6 +32039,69 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
32032
32039
|
]
|
|
32033
32040
|
}
|
|
32034
32041
|
},
|
|
32042
|
+
{
|
|
32043
|
+
resource: "media.libraries.assets.hls",
|
|
32044
|
+
method: "list",
|
|
32045
|
+
summary: "Get HLS renditions",
|
|
32046
|
+
description: "Read how ready a video asset’s on-demand ladder is, rung by rung, without building anything. Use library_id and asset_id as everywhere else. The answer names the asset, its current version, the asset’s own facts (resource_type, is_audio and duration) and one entry per recorded rung — name, height, the first indexed piece’s width, the rung’s bitrate and stored bytes, and its state (processing while pieces run, ready when every piece is ready, failed when a piece gave up). A ladder that was never requested, and an asset that is not a video, answer an empty renditions rather than an error. This read mints no capability and signs nothing, so play the ladder through the content service, which issues the short-lived play address for the current version. Example: GET /media/v1/libraries/lib_example/assets/9dfa312ef9bc4b00816339b598b1152c/hls.",
|
|
32047
|
+
http: "GET",
|
|
32048
|
+
path: "/media/v1/libraries/{library_id}/assets/{asset_id}/hls",
|
|
32049
|
+
streaming: "no",
|
|
32050
|
+
pagination: false,
|
|
32051
|
+
pathParams: [
|
|
32052
|
+
{
|
|
32053
|
+
name: "library_id",
|
|
32054
|
+
sdkName: "library_id",
|
|
32055
|
+
description: "Library ID returned by creation."
|
|
32056
|
+
},
|
|
32057
|
+
{
|
|
32058
|
+
name: "asset_id",
|
|
32059
|
+
sdkName: "asset_id",
|
|
32060
|
+
description: "32-character asset ID."
|
|
32061
|
+
}
|
|
32062
|
+
],
|
|
32063
|
+
query: []
|
|
32064
|
+
},
|
|
32065
|
+
{
|
|
32066
|
+
resource: "media.libraries.assets.hls",
|
|
32067
|
+
method: "create",
|
|
32068
|
+
summary: "Request HLS renditions",
|
|
32069
|
+
description: "Build a video asset’s adaptive HLS ladder for its current version, so one asset plays at several clarities on an ordinary player. Use library_id from creation or listing and the asset_id of a video asset; the ladder belongs to the version the asset has now, and a later version gets its own. heights names the rungs to build: a non-empty subset of 480, 720 and 1080 with no repeats, or omitted to build all three. The ladder never upscales — a rung above the source’s short side is dropped, and a list entirely above it keeps its lowest rung. The call is asynchronous and starts paid transcoding: the work runs as the video-transcode-hls model, one piece per rung per ten minutes of source, and it is charged per output minute at that model’s published price to the organization that owns the asset (ADR-146 §5) — a rung the source cannot carry, and a failed rung, are not charged. A source longer than eight hours (28800 seconds) is refused with SOURCE_TOO_LONG before anything is planned. Repeating the call is safe: a rung already processing, ready or failed is left as it is and is never encoded twice. The response is 202 with the asset_id, its current version and one entry per rung — name, height, width, bitrate, bytes and state, where processing means the rung is still being encoded, ready means it plays and failed means it gave up and can be retried by asking again. Poll GET /media/v1/libraries/{library_id}/assets/{asset_id}/hls until every rung is ready, then play the ladder through the content service, which mints the short-lived play address. Example: POST /media/v1/libraries/lib_example/assets/9dfa312ef9bc4b00816339b598b1152c/hls with {\"heights\":[480,720,1080]}.",
|
|
32070
|
+
http: "POST",
|
|
32071
|
+
path: "/media/v1/libraries/{library_id}/assets/{asset_id}/hls",
|
|
32072
|
+
streaming: "no",
|
|
32073
|
+
pagination: false,
|
|
32074
|
+
pathParams: [
|
|
32075
|
+
{
|
|
32076
|
+
name: "library_id",
|
|
32077
|
+
sdkName: "library_id",
|
|
32078
|
+
description: "Library ID returned by creation."
|
|
32079
|
+
},
|
|
32080
|
+
{
|
|
32081
|
+
name: "asset_id",
|
|
32082
|
+
sdkName: "asset_id",
|
|
32083
|
+
description: "32-character asset ID."
|
|
32084
|
+
}
|
|
32085
|
+
],
|
|
32086
|
+
query: [],
|
|
32087
|
+
body: {
|
|
32088
|
+
required: true,
|
|
32089
|
+
fields: [
|
|
32090
|
+
{
|
|
32091
|
+
name: "heights",
|
|
32092
|
+
type: "array",
|
|
32093
|
+
itemType: "integer",
|
|
32094
|
+
enum: [
|
|
32095
|
+
480,
|
|
32096
|
+
720,
|
|
32097
|
+
1080
|
|
32098
|
+
],
|
|
32099
|
+
required: false,
|
|
32100
|
+
description: "The clarity rungs to build: a non-empty subset of 480, 720 and 1080 with no repeats. Omitted or empty builds all three. The ladder never upscales, so a rung above the source’s short side is dropped."
|
|
32101
|
+
}
|
|
32102
|
+
]
|
|
32103
|
+
}
|
|
32104
|
+
},
|
|
32035
32105
|
{
|
|
32036
32106
|
resource: "media.assets",
|
|
32037
32107
|
method: "lineage",
|
|
@@ -38532,6 +38602,570 @@ for more details.`
|
|
|
38532
38602
|
}
|
|
38533
38603
|
]
|
|
38534
38604
|
},
|
|
38605
|
+
{
|
|
38606
|
+
resource: "registry.installations",
|
|
38607
|
+
method: "delete",
|
|
38608
|
+
summary: "Remove an installation",
|
|
38609
|
+
description: "把包从目标上卸下来,并删掉这条安装记录:技能从智能体的技能列表里移除,插件从电脑上卸载。目标那边已经没有它时也算完成。包本身和它的版本不受影响,之后可以重新安装。记录删除后重发会 404,所以删除前先用 installations.list 确认。",
|
|
38610
|
+
http: "DELETE",
|
|
38611
|
+
path: "/registry/v1/installations/{installation_id}",
|
|
38612
|
+
streaming: "no",
|
|
38613
|
+
pagination: false,
|
|
38614
|
+
pathParams: [
|
|
38615
|
+
{
|
|
38616
|
+
name: "installation_id",
|
|
38617
|
+
sdkName: "installation_id",
|
|
38618
|
+
description: "安装记录的标识,来自 packages.installations.list 或 packages.installations.create 返回的 id(ins_ 开头);不要传包或目标的 id。"
|
|
38619
|
+
}
|
|
38620
|
+
],
|
|
38621
|
+
query: []
|
|
38622
|
+
},
|
|
38623
|
+
{
|
|
38624
|
+
resource: "registry.installations",
|
|
38625
|
+
method: "update",
|
|
38626
|
+
summary: "Update an installation",
|
|
38627
|
+
description: "把一条安装记录换到另一个版本。技能可以换到任何未撤回的版本(升级或回退),version 省略时换到最新版;插件只能换到库里的最新版本,version 给了也必须等于最新版。撤回的版本不能换过去。对账为 missing 的记录用它可以重新装回去。同名冲突和 20 个技能上限的规则与安装时相同。",
|
|
38628
|
+
http: "POST",
|
|
38629
|
+
path: "/registry/v1/installations/{installation_id}:update",
|
|
38630
|
+
streaming: "no",
|
|
38631
|
+
pagination: false,
|
|
38632
|
+
pathParams: [
|
|
38633
|
+
{
|
|
38634
|
+
name: "installation_id",
|
|
38635
|
+
sdkName: "installation_id",
|
|
38636
|
+
description: "安装记录的标识,来自 packages.installations.list 或 packages.installations.create 返回的 id(ins_ 开头);不要传包或目标的 id。"
|
|
38637
|
+
}
|
|
38638
|
+
],
|
|
38639
|
+
query: [],
|
|
38640
|
+
body: {
|
|
38641
|
+
required: true,
|
|
38642
|
+
fields: [
|
|
38643
|
+
{
|
|
38644
|
+
name: "version",
|
|
38645
|
+
type: "string",
|
|
38646
|
+
required: false,
|
|
38647
|
+
description: "要换到的版本号,完整 semver;省略时换到最新版;插件给了也必须等于最新版,撤回的版本不能换。"
|
|
38648
|
+
}
|
|
38649
|
+
]
|
|
38650
|
+
}
|
|
38651
|
+
},
|
|
38652
|
+
{
|
|
38653
|
+
resource: "registry.packages",
|
|
38654
|
+
method: "retrieve",
|
|
38655
|
+
summary: "Retrieve package",
|
|
38656
|
+
description: "读一个包的元数据:种类、所属库、当前 latest_version、作者、标签和累计下载量。package_id 来自 packages.list 或 packages.create;另一个组织或不存在都返回 404。",
|
|
38657
|
+
http: "GET",
|
|
38658
|
+
path: "/registry/v1/packages/{package_id}",
|
|
38659
|
+
streaming: "no",
|
|
38660
|
+
pagination: false,
|
|
38661
|
+
pathParams: [
|
|
38662
|
+
{
|
|
38663
|
+
name: "package_id",
|
|
38664
|
+
sdkName: "package_id",
|
|
38665
|
+
description: "包的标识,来自 repositories.packages.list 或 repositories.packages.create 返回的 id;不要传包名。"
|
|
38666
|
+
}
|
|
38667
|
+
],
|
|
38668
|
+
query: []
|
|
38669
|
+
},
|
|
38670
|
+
{
|
|
38671
|
+
resource: "registry.packages.installations",
|
|
38672
|
+
method: "list",
|
|
38673
|
+
summary: "List installations",
|
|
38674
|
+
description: "列出这个包装在哪些智能体和电脑上。每次读取都会和目标那边对账,以目标现在的实际情况为准,所以每条记录的 state 是读取这一刻的结论:installed 表示目标上有它且版本与记录一致;drifted 表示目标上有它但版本不同,此时 version 显示目标上的版本;missing 表示目标上已经没有它(被人在智能体或电脑那边删掉了),记录仍保留,可以用 installations.delete 清掉,或用 installations.update 重新装回;unknown 表示这次问不到目标,不代表没装,稍后重读。withdrawn 表示这条记录的版本已被撤回。一次返回全部记录,没有分页,按创建时间排序。",
|
|
38675
|
+
http: "GET",
|
|
38676
|
+
path: "/registry/v1/packages/{package_id}/installations",
|
|
38677
|
+
streaming: "no",
|
|
38678
|
+
pagination: false,
|
|
38679
|
+
pathParams: [
|
|
38680
|
+
{
|
|
38681
|
+
name: "package_id",
|
|
38682
|
+
sdkName: "package_id",
|
|
38683
|
+
description: "包的标识,来自 repositories.packages.list 或 repositories.packages.create 返回的 id;不要传包名。"
|
|
38684
|
+
}
|
|
38685
|
+
],
|
|
38686
|
+
query: []
|
|
38687
|
+
},
|
|
38688
|
+
{
|
|
38689
|
+
resource: "registry.packages.installations",
|
|
38690
|
+
method: "create",
|
|
38691
|
+
summary: "Install a package",
|
|
38692
|
+
description: "把一个包装到目标上:技能装到智能体(agent_ids),插件装到电脑(computer_ids),一次最多 50 个目标;目标种类给错会被拒(400),包的种类可从 packages.retrieve 的 kind 得知。技能装的是具体版本,version 省略时装最新版,之后不会自动升级,要换版本用 installations.update。插件只能装库里的最新版本,version 若给了就必须等于最新版,否则 FAILED_PRECONDITION。撤回的版本不能新装。同一目标重复装同一个包不会报错,而是把它移到这个版本。技能被拒的情形:智能体上已有同名的另一个技能(名字冲突),或这个智能体已经有 20 个技能。各目标独立处理:只要有一个成功就返回 201,成功的在 data 里,失败的目标在 errors 里逐个列出 target_id、code 和 message,按消息修正后只对失败的目标重发;全部失败时不返回 201,而是按第一个失败返回错误状态。装到智能体或电脑上要求调用者本人有权限,权限不足会出现在该目标的 errors 里。",
|
|
38693
|
+
http: "POST",
|
|
38694
|
+
path: "/registry/v1/packages/{package_id}/installations",
|
|
38695
|
+
streaming: "no",
|
|
38696
|
+
pagination: false,
|
|
38697
|
+
pathParams: [
|
|
38698
|
+
{
|
|
38699
|
+
name: "package_id",
|
|
38700
|
+
sdkName: "package_id",
|
|
38701
|
+
description: "包的标识,来自 repositories.packages.list 或 repositories.packages.create 返回的 id;不要传包名。"
|
|
38702
|
+
}
|
|
38703
|
+
],
|
|
38704
|
+
query: [],
|
|
38705
|
+
body: {
|
|
38706
|
+
required: true,
|
|
38707
|
+
fields: [
|
|
38708
|
+
{
|
|
38709
|
+
name: "agent_ids",
|
|
38710
|
+
type: "array",
|
|
38711
|
+
itemType: "string",
|
|
38712
|
+
required: false,
|
|
38713
|
+
description: "要装到的智能体标识,1 到 50 个,重复的会合并;只用于技能,来自智能体列表的 id。"
|
|
38714
|
+
},
|
|
38715
|
+
{
|
|
38716
|
+
name: "computer_ids",
|
|
38717
|
+
type: "array",
|
|
38718
|
+
itemType: "string",
|
|
38719
|
+
required: false,
|
|
38720
|
+
description: "要装到的电脑标识,1 到 50 个,重复的会合并;只用于插件,来自电脑列表的 id。"
|
|
38721
|
+
},
|
|
38722
|
+
{
|
|
38723
|
+
name: "version",
|
|
38724
|
+
type: "string",
|
|
38725
|
+
required: false,
|
|
38726
|
+
description: "要装的版本号,完整 semver;省略时装最新版;插件给了也必须等于最新版,撤回的版本不能装。"
|
|
38727
|
+
}
|
|
38728
|
+
]
|
|
38729
|
+
}
|
|
38730
|
+
},
|
|
38731
|
+
{
|
|
38732
|
+
resource: "registry.packages.versions",
|
|
38733
|
+
method: "list",
|
|
38734
|
+
summary: "List versions",
|
|
38735
|
+
description: "列出一个包的所有版本,含已撤回的。撤回的版本仍在列表里(它占着版本号),withdrawn 为 true,并带 withdraw_time。按发布顺序返回。",
|
|
38736
|
+
http: "GET",
|
|
38737
|
+
path: "/registry/v1/packages/{package_id}/versions",
|
|
38738
|
+
streaming: "no",
|
|
38739
|
+
pagination: true,
|
|
38740
|
+
pathParams: [
|
|
38741
|
+
{
|
|
38742
|
+
name: "package_id",
|
|
38743
|
+
sdkName: "package_id",
|
|
38744
|
+
description: "包的标识,来自 repositories.packages.list 或 repositories.packages.create 返回的 id;不要传包名。"
|
|
38745
|
+
}
|
|
38746
|
+
],
|
|
38747
|
+
query: [
|
|
38748
|
+
{
|
|
38749
|
+
name: "page_size",
|
|
38750
|
+
type: "integer",
|
|
38751
|
+
required: false,
|
|
38752
|
+
description: "每页返回多少条,1 到 100;省略时默认 20。超过 100 会被截到 100。"
|
|
38753
|
+
},
|
|
38754
|
+
{
|
|
38755
|
+
name: "cursor",
|
|
38756
|
+
type: "string",
|
|
38757
|
+
required: false,
|
|
38758
|
+
description: "上一页返回的 next_cursor,用来取下一页;第一页省略它,next_cursor 为 null 时停止翻页。"
|
|
38759
|
+
}
|
|
38760
|
+
]
|
|
38761
|
+
},
|
|
38762
|
+
{
|
|
38763
|
+
resource: "registry.packages.versions",
|
|
38764
|
+
method: "create",
|
|
38765
|
+
summary: "Publish a version",
|
|
38766
|
+
description: "给一个已有的包发新版本。请求体与 packages.create 相同(multipart:version 必填,archive 或 files 给内容),但种类和名字沿用这个包,不再从上传内容重判。version 必须比已发布的最高版本高(撤回的版本也占号,不能复用);比它低或相等返回 FAILED_PRECONDITION。一个包的作者和标签不随新版本改变。",
|
|
38767
|
+
http: "POST",
|
|
38768
|
+
path: "/registry/v1/packages/{package_id}/versions",
|
|
38769
|
+
streaming: "no",
|
|
38770
|
+
pagination: false,
|
|
38771
|
+
multipart: true,
|
|
38772
|
+
pathParams: [
|
|
38773
|
+
{
|
|
38774
|
+
name: "package_id",
|
|
38775
|
+
sdkName: "package_id",
|
|
38776
|
+
description: "包的标识,来自 repositories.packages.list 或 repositories.packages.create 返回的 id;不要传包名。"
|
|
38777
|
+
}
|
|
38778
|
+
],
|
|
38779
|
+
query: [],
|
|
38780
|
+
body: {
|
|
38781
|
+
required: true,
|
|
38782
|
+
fields: [
|
|
38783
|
+
{
|
|
38784
|
+
name: "version",
|
|
38785
|
+
type: "string",
|
|
38786
|
+
required: true,
|
|
38787
|
+
description: "要发布的版本号,完整 semver,例如 1.2.0;每个包内必须严格递增,撤回的版本也占号。"
|
|
38788
|
+
},
|
|
38789
|
+
{
|
|
38790
|
+
name: "archive",
|
|
38791
|
+
type: "string",
|
|
38792
|
+
required: false,
|
|
38793
|
+
description: "一个 zip 文件,内含包的内容;与 files 二选一。单个顶层目录会被剥掉。"
|
|
38794
|
+
},
|
|
38795
|
+
{
|
|
38796
|
+
name: "files",
|
|
38797
|
+
type: "array",
|
|
38798
|
+
itemType: "string",
|
|
38799
|
+
required: false,
|
|
38800
|
+
description: "直接上传的一组文件,每个 part 的 filename 是相对路径;与 archive 二选一。"
|
|
38801
|
+
},
|
|
38802
|
+
{
|
|
38803
|
+
name: "title",
|
|
38804
|
+
type: "string",
|
|
38805
|
+
required: false,
|
|
38806
|
+
description: "给人看的标题;省略时从包内容里取。"
|
|
38807
|
+
},
|
|
38808
|
+
{
|
|
38809
|
+
name: "description",
|
|
38810
|
+
type: "string",
|
|
38811
|
+
required: false,
|
|
38812
|
+
description: "包说明;省略时从包内容里取。"
|
|
38813
|
+
},
|
|
38814
|
+
{
|
|
38815
|
+
name: "tags",
|
|
38816
|
+
type: "string",
|
|
38817
|
+
required: false,
|
|
38818
|
+
description: "逗号分隔的标签,例如 review,quality;省略时没有标签。"
|
|
38819
|
+
}
|
|
38820
|
+
]
|
|
38821
|
+
}
|
|
38822
|
+
},
|
|
38823
|
+
{
|
|
38824
|
+
resource: "registry.packages.versions",
|
|
38825
|
+
method: "retrieveArchive",
|
|
38826
|
+
summary: "Download version archive",
|
|
38827
|
+
description: "下载一个版本的完整 zip 归档,用来整包安装或转存。每次调用都计入这个包的 downloads,所以不要为了看内容而反复拉 archive——先读 contents,只取需要的文件用 files 下载。",
|
|
38828
|
+
http: "GET",
|
|
38829
|
+
path: "/registry/v1/packages/{package_id}/versions/{version}/archive",
|
|
38830
|
+
streaming: "no",
|
|
38831
|
+
pagination: false,
|
|
38832
|
+
pathParams: [
|
|
38833
|
+
{
|
|
38834
|
+
name: "package_id",
|
|
38835
|
+
sdkName: "package_id",
|
|
38836
|
+
description: "包的标识,来自 repositories.packages.list 或 repositories.packages.create 返回的 id;不要传包名。"
|
|
38837
|
+
},
|
|
38838
|
+
{
|
|
38839
|
+
name: "version",
|
|
38840
|
+
sdkName: "version",
|
|
38841
|
+
description: "要读的版本号,来自 versions.list 或 versions.create 返回的 version;必须是完整 semver,形如 1.2.0,不接受 latest 或范围。"
|
|
38842
|
+
}
|
|
38843
|
+
],
|
|
38844
|
+
query: []
|
|
38845
|
+
},
|
|
38846
|
+
{
|
|
38847
|
+
resource: "registry.packages.versions.contents",
|
|
38848
|
+
method: "list",
|
|
38849
|
+
summary: "List version contents",
|
|
38850
|
+
description: "列出一个版本解压后的文件清单(路径和大小),用来在不下载整个包的前提下看它包含什么。路径是相对包根的,例如 SKILL.md 或 plugin/skills/review.md。已撤回的版本仍可读清单。",
|
|
38851
|
+
http: "GET",
|
|
38852
|
+
path: "/registry/v1/packages/{package_id}/versions/{version}/contents",
|
|
38853
|
+
streaming: "no",
|
|
38854
|
+
pagination: false,
|
|
38855
|
+
pathParams: [
|
|
38856
|
+
{
|
|
38857
|
+
name: "package_id",
|
|
38858
|
+
sdkName: "package_id",
|
|
38859
|
+
description: "包的标识,来自 repositories.packages.list 或 repositories.packages.create 返回的 id;不要传包名。"
|
|
38860
|
+
},
|
|
38861
|
+
{
|
|
38862
|
+
name: "version",
|
|
38863
|
+
sdkName: "version",
|
|
38864
|
+
description: "要读的版本号,来自 versions.list 或 versions.create 返回的 version;必须是完整 semver,形如 1.2.0,不接受 latest 或范围。"
|
|
38865
|
+
}
|
|
38866
|
+
],
|
|
38867
|
+
query: []
|
|
38868
|
+
},
|
|
38869
|
+
{
|
|
38870
|
+
resource: "registry.packages.versions.files",
|
|
38871
|
+
method: "retrieve",
|
|
38872
|
+
summary: "Download a file",
|
|
38873
|
+
description: "下载一个版本里的单个文件,返回原始字节。path 是 contents 给出的路径,可以含斜杠(例如 plugin/skills/review.md)。用它按文件取内容,装到磁盘上时保留这个相对路径。不计入 downloads。",
|
|
38874
|
+
http: "GET",
|
|
38875
|
+
path: "/registry/v1/packages/{package_id}/versions/{version}/files/{path}",
|
|
38876
|
+
streaming: "no",
|
|
38877
|
+
pagination: false,
|
|
38878
|
+
pathParams: [
|
|
38879
|
+
{
|
|
38880
|
+
name: "package_id",
|
|
38881
|
+
sdkName: "package_id",
|
|
38882
|
+
description: "包的标识,来自 repositories.packages.list 或 repositories.packages.create 返回的 id;不要传包名。"
|
|
38883
|
+
},
|
|
38884
|
+
{
|
|
38885
|
+
name: "version",
|
|
38886
|
+
sdkName: "version",
|
|
38887
|
+
description: "要读的版本号,来自 versions.list 或 versions.create 返回的 version;必须是完整 semver,形如 1.2.0,不接受 latest 或范围。"
|
|
38888
|
+
},
|
|
38889
|
+
{
|
|
38890
|
+
name: "path",
|
|
38891
|
+
sdkName: "path",
|
|
38892
|
+
description: "版本内的相对文件路径,取自 contents 返回的 path,可以含斜杠(例如 plugin/skills/review.md);不要以 / 开头。"
|
|
38893
|
+
}
|
|
38894
|
+
],
|
|
38895
|
+
query: []
|
|
38896
|
+
},
|
|
38897
|
+
{
|
|
38898
|
+
resource: "registry.packages.versions",
|
|
38899
|
+
method: "withdraw",
|
|
38900
|
+
summary: "Withdraw a version",
|
|
38901
|
+
description: "撤回一个版本。撤回后它不再是 latest、不能被新装;已经装好的照常可用。版本号仍被占着,不能再用它发新版本。已经撤回的版本再撤回会返回 FAILED_PRECONDITION。撤回是不可逆的:要重新提供这个版本,用更高的版本号重新发布。",
|
|
38902
|
+
http: "POST",
|
|
38903
|
+
path: "/registry/v1/packages/{package_id}/versions/{version}:withdraw",
|
|
38904
|
+
streaming: "no",
|
|
38905
|
+
pagination: false,
|
|
38906
|
+
pathParams: [
|
|
38907
|
+
{
|
|
38908
|
+
name: "package_id",
|
|
38909
|
+
sdkName: "package_id",
|
|
38910
|
+
description: "包的标识,来自 repositories.packages.list 或 repositories.packages.create 返回的 id;不要传包名。"
|
|
38911
|
+
},
|
|
38912
|
+
{
|
|
38913
|
+
name: "version",
|
|
38914
|
+
sdkName: "version",
|
|
38915
|
+
description: "要读的版本号,来自 versions.list 或 versions.create 返回的 version;必须是完整 semver,形如 1.2.0,不接受 latest 或范围。"
|
|
38916
|
+
}
|
|
38917
|
+
],
|
|
38918
|
+
query: []
|
|
38919
|
+
},
|
|
38920
|
+
{
|
|
38921
|
+
resource: "registry.repositories",
|
|
38922
|
+
method: "list",
|
|
38923
|
+
summary: "List repositories",
|
|
38924
|
+
description: "列出这个组织现有的库,默认库也在其中。库很少,一页通常装得下;用 next_cursor 翻页。先在这里拿到 repository_id,再用它列出或发布包。",
|
|
38925
|
+
http: "GET",
|
|
38926
|
+
path: "/registry/v1/repositories",
|
|
38927
|
+
streaming: "no",
|
|
38928
|
+
pagination: true,
|
|
38929
|
+
pathParams: [],
|
|
38930
|
+
query: [
|
|
38931
|
+
{
|
|
38932
|
+
name: "page_size",
|
|
38933
|
+
type: "integer",
|
|
38934
|
+
required: false,
|
|
38935
|
+
description: "每页返回多少条,1 到 100;省略时默认 20。超过 100 会被截到 100。"
|
|
38936
|
+
},
|
|
38937
|
+
{
|
|
38938
|
+
name: "cursor",
|
|
38939
|
+
type: "string",
|
|
38940
|
+
required: false,
|
|
38941
|
+
description: "上一页返回的 next_cursor,用来取下一页;第一页省略它,next_cursor 为 null 时停止翻页。"
|
|
38942
|
+
}
|
|
38943
|
+
]
|
|
38944
|
+
},
|
|
38945
|
+
{
|
|
38946
|
+
resource: "registry.repositories",
|
|
38947
|
+
method: "create",
|
|
38948
|
+
summary: "Create repository",
|
|
38949
|
+
description: "新建一个库来分类存放包。name 是库的唯一标识,小写字母、数字和连字符,最多 63 个字符,且不能和已有的库重名;display_name 和 description 是给人看的。每个组织本来就有一个默认库,需要新分类时才建;一个库非空时不能删除,所以不要用库来临时隔离一次上传。",
|
|
38950
|
+
http: "POST",
|
|
38951
|
+
path: "/registry/v1/repositories",
|
|
38952
|
+
streaming: "no",
|
|
38953
|
+
pagination: false,
|
|
38954
|
+
pathParams: [],
|
|
38955
|
+
query: [],
|
|
38956
|
+
body: {
|
|
38957
|
+
required: true,
|
|
38958
|
+
fields: [
|
|
38959
|
+
{
|
|
38960
|
+
name: "name",
|
|
38961
|
+
type: "string",
|
|
38962
|
+
required: true,
|
|
38963
|
+
description: "新库的唯一标识,小写字母、数字和连字符,最多 63 个字符,且在这个组织里未被使用;不能只有一个连字符结尾。"
|
|
38964
|
+
},
|
|
38965
|
+
{
|
|
38966
|
+
name: "display_name",
|
|
38967
|
+
type: "string",
|
|
38968
|
+
required: false,
|
|
38969
|
+
description: "给人看的库名;省略时后续显示 name。"
|
|
38970
|
+
},
|
|
38971
|
+
{
|
|
38972
|
+
name: "description",
|
|
38973
|
+
type: "string",
|
|
38974
|
+
required: false,
|
|
38975
|
+
description: "库的说明;省略时不写。"
|
|
38976
|
+
}
|
|
38977
|
+
]
|
|
38978
|
+
}
|
|
38979
|
+
},
|
|
38980
|
+
{
|
|
38981
|
+
resource: "registry.repositories",
|
|
38982
|
+
method: "delete",
|
|
38983
|
+
summary: "Delete repository",
|
|
38984
|
+
description: "删一个空的库。默认库不能删(FAILED_PRECONDITION);库里还有包时也不能删,先把包删掉或改用别的库。删除请求重发会 404,所以删除前先读一次确认。",
|
|
38985
|
+
http: "DELETE",
|
|
38986
|
+
path: "/registry/v1/repositories/{repository_id}",
|
|
38987
|
+
streaming: "no",
|
|
38988
|
+
pagination: false,
|
|
38989
|
+
pathParams: [
|
|
38990
|
+
{
|
|
38991
|
+
name: "repository_id",
|
|
38992
|
+
sdkName: "repository_id",
|
|
38993
|
+
description: "库的标识,来自 repositories.list 或 repositories.create 返回的 id;不要传库的 name 或显示名。"
|
|
38994
|
+
}
|
|
38995
|
+
],
|
|
38996
|
+
query: []
|
|
38997
|
+
},
|
|
38998
|
+
{
|
|
38999
|
+
resource: "registry.repositories",
|
|
39000
|
+
method: "retrieve",
|
|
39001
|
+
summary: "Retrieve repository",
|
|
39002
|
+
description: "读一个库的名称、说明、包数量和默认标记。repository_id 来自 repositories.list 或 repositories.create;另一个组织的库或不存在的库一律 404,不区分两者。",
|
|
39003
|
+
http: "GET",
|
|
39004
|
+
path: "/registry/v1/repositories/{repository_id}",
|
|
39005
|
+
streaming: "no",
|
|
39006
|
+
pagination: false,
|
|
39007
|
+
pathParams: [
|
|
39008
|
+
{
|
|
39009
|
+
name: "repository_id",
|
|
39010
|
+
sdkName: "repository_id",
|
|
39011
|
+
description: "库的标识,来自 repositories.list 或 repositories.create 返回的 id;不要传库的 name 或显示名。"
|
|
39012
|
+
}
|
|
39013
|
+
],
|
|
39014
|
+
query: []
|
|
39015
|
+
},
|
|
39016
|
+
{
|
|
39017
|
+
resource: "registry.repositories",
|
|
39018
|
+
method: "update",
|
|
39019
|
+
summary: "Update repository",
|
|
39020
|
+
description: "改库的 display_name 或 description。只送要改的字段,省略的保持原值;name 建库之后不能改,它标识库。一个字段都不送会 400。",
|
|
39021
|
+
http: "PATCH",
|
|
39022
|
+
path: "/registry/v1/repositories/{repository_id}",
|
|
39023
|
+
streaming: "no",
|
|
39024
|
+
pagination: false,
|
|
39025
|
+
pathParams: [
|
|
39026
|
+
{
|
|
39027
|
+
name: "repository_id",
|
|
39028
|
+
sdkName: "repository_id",
|
|
39029
|
+
description: "库的标识,来自 repositories.list 或 repositories.create 返回的 id;不要传库的 name 或显示名。"
|
|
39030
|
+
}
|
|
39031
|
+
],
|
|
39032
|
+
query: [],
|
|
39033
|
+
body: {
|
|
39034
|
+
required: true,
|
|
39035
|
+
fields: [
|
|
39036
|
+
{
|
|
39037
|
+
name: "display_name",
|
|
39038
|
+
type: "string",
|
|
39039
|
+
required: false,
|
|
39040
|
+
description: "新的显示名;显式传 null 会清空它。"
|
|
39041
|
+
},
|
|
39042
|
+
{
|
|
39043
|
+
name: "description",
|
|
39044
|
+
type: "string",
|
|
39045
|
+
required: false,
|
|
39046
|
+
description: "新的说明;显式传 null 会清空它。"
|
|
39047
|
+
}
|
|
39048
|
+
]
|
|
39049
|
+
}
|
|
39050
|
+
},
|
|
39051
|
+
{
|
|
39052
|
+
resource: "registry.repositories.packages",
|
|
39053
|
+
method: "list",
|
|
39054
|
+
summary: "List packages",
|
|
39055
|
+
description: "列出一个库里的包,可按种类筛、按名字搜、按最近更新或下载量排序。kind=skill 只看技能,kind=plugin 只看插件,省略则两类都返回。q 在 name、title 和 description 上做子串匹配。sort 默认 updated;downloads 按累计下载量降序,用来找这个库最常用的资源。",
|
|
39056
|
+
http: "GET",
|
|
39057
|
+
path: "/registry/v1/repositories/{repository_id}/packages",
|
|
39058
|
+
streaming: "no",
|
|
39059
|
+
pagination: true,
|
|
39060
|
+
pathParams: [
|
|
39061
|
+
{
|
|
39062
|
+
name: "repository_id",
|
|
39063
|
+
sdkName: "repository_id",
|
|
39064
|
+
description: "库的标识,来自 repositories.list 或 repositories.create 返回的 id;不要传库的 name 或显示名。"
|
|
39065
|
+
}
|
|
39066
|
+
],
|
|
39067
|
+
query: [
|
|
39068
|
+
{
|
|
39069
|
+
name: "kind",
|
|
39070
|
+
type: "string",
|
|
39071
|
+
enum: [
|
|
39072
|
+
"skill",
|
|
39073
|
+
"plugin"
|
|
39074
|
+
],
|
|
39075
|
+
required: false,
|
|
39076
|
+
description: "只看某一类包;省略时技能和插件都返回。"
|
|
39077
|
+
},
|
|
39078
|
+
{
|
|
39079
|
+
name: "q",
|
|
39080
|
+
type: "string",
|
|
39081
|
+
required: false,
|
|
39082
|
+
description: "按子串搜索包,匹配 name、title 和 description;省略时不过滤。不区分大小写。"
|
|
39083
|
+
},
|
|
39084
|
+
{
|
|
39085
|
+
name: "sort",
|
|
39086
|
+
type: "string",
|
|
39087
|
+
enum: [
|
|
39088
|
+
"updated",
|
|
39089
|
+
"downloads"
|
|
39090
|
+
],
|
|
39091
|
+
required: false,
|
|
39092
|
+
description: "结果排序方式;省略时按 updated。"
|
|
39093
|
+
},
|
|
39094
|
+
{
|
|
39095
|
+
name: "page_size",
|
|
39096
|
+
type: "integer",
|
|
39097
|
+
required: false,
|
|
39098
|
+
description: "每页返回多少条,1 到 100;省略时默认 20。超过 100 会被截到 100。"
|
|
39099
|
+
},
|
|
39100
|
+
{
|
|
39101
|
+
name: "cursor",
|
|
39102
|
+
type: "string",
|
|
39103
|
+
required: false,
|
|
39104
|
+
description: "上一页返回的 next_cursor,用来取下一页;第一页省略它,next_cursor 为 null 时停止翻页。"
|
|
39105
|
+
}
|
|
39106
|
+
]
|
|
39107
|
+
},
|
|
39108
|
+
{
|
|
39109
|
+
resource: "registry.repositories.packages",
|
|
39110
|
+
method: "create",
|
|
39111
|
+
summary: "Publish a package",
|
|
39112
|
+
description: "把一个新包发布进这个库,一次调用建立包并上传它的第一个版本。发布内容是 multipart:version 必填,archive 给一个 zip,或者 files 给一组文件(每个文件的 filename 是相对上传根的路径,例如 pdf/SKILL.md)。单个顶层目录会被剥掉。种类按根上有什么判:有 SKILL.md 就是 skill,有 .claude-plugin/plugin.json 就是 plugin;两者都没有、或都有,会被拒。名字从 SKILL.md 或 plugin.json 里读,不从路径或 query 猜。限额:上传 ≤25 MiB,解压后 ≤50 MiB,≤1000 个文件。版本必须是 semver 且严格递增;第一个版本可以是任意合法 semver,之后每个新版本都要比已发布的最高版本高。把已有智能体的技能搬过来时,先用 GET /agent/v1/skills/{id}/versions/{v}/content 导出 zip,再在这里作为 archive 发布。",
|
|
39113
|
+
http: "POST",
|
|
39114
|
+
path: "/registry/v1/repositories/{repository_id}/packages",
|
|
39115
|
+
streaming: "no",
|
|
39116
|
+
pagination: false,
|
|
39117
|
+
multipart: true,
|
|
39118
|
+
pathParams: [
|
|
39119
|
+
{
|
|
39120
|
+
name: "repository_id",
|
|
39121
|
+
sdkName: "repository_id",
|
|
39122
|
+
description: "库的标识,来自 repositories.list 或 repositories.create 返回的 id;不要传库的 name 或显示名。"
|
|
39123
|
+
}
|
|
39124
|
+
],
|
|
39125
|
+
query: [],
|
|
39126
|
+
body: {
|
|
39127
|
+
required: true,
|
|
39128
|
+
fields: [
|
|
39129
|
+
{
|
|
39130
|
+
name: "version",
|
|
39131
|
+
type: "string",
|
|
39132
|
+
required: true,
|
|
39133
|
+
description: "要发布的版本号,完整 semver,例如 1.2.0;每个包内必须严格递增,撤回的版本也占号。"
|
|
39134
|
+
},
|
|
39135
|
+
{
|
|
39136
|
+
name: "archive",
|
|
39137
|
+
type: "string",
|
|
39138
|
+
required: false,
|
|
39139
|
+
description: "一个 zip 文件,内含包的内容;与 files 二选一。单个顶层目录会被剥掉。"
|
|
39140
|
+
},
|
|
39141
|
+
{
|
|
39142
|
+
name: "files",
|
|
39143
|
+
type: "array",
|
|
39144
|
+
itemType: "string",
|
|
39145
|
+
required: false,
|
|
39146
|
+
description: "直接上传的一组文件,每个 part 的 filename 是相对路径;与 archive 二选一。"
|
|
39147
|
+
},
|
|
39148
|
+
{
|
|
39149
|
+
name: "title",
|
|
39150
|
+
type: "string",
|
|
39151
|
+
required: false,
|
|
39152
|
+
description: "给人看的标题;省略时从包内容里取。"
|
|
39153
|
+
},
|
|
39154
|
+
{
|
|
39155
|
+
name: "description",
|
|
39156
|
+
type: "string",
|
|
39157
|
+
required: false,
|
|
39158
|
+
description: "包说明;省略时从包内容里取。"
|
|
39159
|
+
},
|
|
39160
|
+
{
|
|
39161
|
+
name: "tags",
|
|
39162
|
+
type: "string",
|
|
39163
|
+
required: false,
|
|
39164
|
+
description: "逗号分隔的标签,例如 review,quality;省略时没有标签。"
|
|
39165
|
+
}
|
|
39166
|
+
]
|
|
39167
|
+
}
|
|
39168
|
+
},
|
|
38535
39169
|
{
|
|
38536
39170
|
resource: "sandbox.events.sandboxes",
|
|
38537
39171
|
method: "retrieve",
|
|
@@ -54880,6 +55514,28 @@ var mediaAlignAsset = (options) => (options.client ?? client).post({
|
|
|
54880
55514
|
...options.headers
|
|
54881
55515
|
}
|
|
54882
55516
|
});
|
|
55517
|
+
var mediaGetHlsRenditions = (options) => (options.client ?? client).get({
|
|
55518
|
+
security: [{
|
|
55519
|
+
key: "media-BearerAuth",
|
|
55520
|
+
scheme: "bearer",
|
|
55521
|
+
type: "http"
|
|
55522
|
+
}],
|
|
55523
|
+
url: "/media/v1/libraries/{library_id}/assets/{asset_id}/hls",
|
|
55524
|
+
...options
|
|
55525
|
+
});
|
|
55526
|
+
var mediaRequestHlsRenditions = (options) => (options.client ?? client).post({
|
|
55527
|
+
security: [{
|
|
55528
|
+
key: "media-BearerAuth",
|
|
55529
|
+
scheme: "bearer",
|
|
55530
|
+
type: "http"
|
|
55531
|
+
}],
|
|
55532
|
+
url: "/media/v1/libraries/{library_id}/assets/{asset_id}/hls",
|
|
55533
|
+
...options,
|
|
55534
|
+
headers: {
|
|
55535
|
+
"Content-Type": "application/json",
|
|
55536
|
+
...options.headers
|
|
55537
|
+
}
|
|
55538
|
+
});
|
|
54883
55539
|
var ontologyListTypes = (options) => (options?.client ?? client).get({
|
|
54884
55540
|
security: [{
|
|
54885
55541
|
key: "ontology-bearerAuth",
|
|
@@ -55047,6 +55703,194 @@ var ontologySearch = (options) => (options.client ?? client).post({
|
|
|
55047
55703
|
...options.headers
|
|
55048
55704
|
}
|
|
55049
55705
|
});
|
|
55706
|
+
var registryRepositoriesList = (options) => (options?.client ?? client).get({
|
|
55707
|
+
security: [{
|
|
55708
|
+
key: "registry-bearerAuth",
|
|
55709
|
+
scheme: "bearer",
|
|
55710
|
+
type: "http"
|
|
55711
|
+
}],
|
|
55712
|
+
url: "/registry/v1/repositories",
|
|
55713
|
+
...options
|
|
55714
|
+
});
|
|
55715
|
+
var registryRepositoriesCreate = (options) => (options.client ?? client).post({
|
|
55716
|
+
security: [{
|
|
55717
|
+
key: "registry-bearerAuth",
|
|
55718
|
+
scheme: "bearer",
|
|
55719
|
+
type: "http"
|
|
55720
|
+
}],
|
|
55721
|
+
url: "/registry/v1/repositories",
|
|
55722
|
+
...options,
|
|
55723
|
+
headers: {
|
|
55724
|
+
"Content-Type": "application/json",
|
|
55725
|
+
...options.headers
|
|
55726
|
+
}
|
|
55727
|
+
});
|
|
55728
|
+
var registryRepositoriesDelete = (options) => (options.client ?? client).delete({
|
|
55729
|
+
security: [{
|
|
55730
|
+
key: "registry-bearerAuth",
|
|
55731
|
+
scheme: "bearer",
|
|
55732
|
+
type: "http"
|
|
55733
|
+
}],
|
|
55734
|
+
url: "/registry/v1/repositories/{repository_id}",
|
|
55735
|
+
...options
|
|
55736
|
+
});
|
|
55737
|
+
var registryRepositoriesRetrieve = (options) => (options.client ?? client).get({
|
|
55738
|
+
security: [{
|
|
55739
|
+
key: "registry-bearerAuth",
|
|
55740
|
+
scheme: "bearer",
|
|
55741
|
+
type: "http"
|
|
55742
|
+
}],
|
|
55743
|
+
url: "/registry/v1/repositories/{repository_id}",
|
|
55744
|
+
...options
|
|
55745
|
+
});
|
|
55746
|
+
var registryRepositoriesUpdate = (options) => (options.client ?? client).patch({
|
|
55747
|
+
security: [{
|
|
55748
|
+
key: "registry-bearerAuth",
|
|
55749
|
+
scheme: "bearer",
|
|
55750
|
+
type: "http"
|
|
55751
|
+
}],
|
|
55752
|
+
url: "/registry/v1/repositories/{repository_id}",
|
|
55753
|
+
...options,
|
|
55754
|
+
headers: {
|
|
55755
|
+
"Content-Type": "application/json",
|
|
55756
|
+
...options.headers
|
|
55757
|
+
}
|
|
55758
|
+
});
|
|
55759
|
+
var registryRepositoriesPackagesList = (options) => (options.client ?? client).get({
|
|
55760
|
+
security: [{
|
|
55761
|
+
key: "registry-bearerAuth",
|
|
55762
|
+
scheme: "bearer",
|
|
55763
|
+
type: "http"
|
|
55764
|
+
}],
|
|
55765
|
+
url: "/registry/v1/repositories/{repository_id}/packages",
|
|
55766
|
+
...options
|
|
55767
|
+
});
|
|
55768
|
+
var registryRepositoriesPackagesCreate = (options) => (options.client ?? client).post({
|
|
55769
|
+
...formDataBodySerializer,
|
|
55770
|
+
security: [{
|
|
55771
|
+
key: "registry-bearerAuth",
|
|
55772
|
+
scheme: "bearer",
|
|
55773
|
+
type: "http"
|
|
55774
|
+
}],
|
|
55775
|
+
url: "/registry/v1/repositories/{repository_id}/packages",
|
|
55776
|
+
...options,
|
|
55777
|
+
headers: {
|
|
55778
|
+
"Content-Type": null,
|
|
55779
|
+
...options.headers
|
|
55780
|
+
}
|
|
55781
|
+
});
|
|
55782
|
+
var registryPackagesRetrieve = (options) => (options.client ?? client).get({
|
|
55783
|
+
security: [{
|
|
55784
|
+
key: "registry-bearerAuth",
|
|
55785
|
+
scheme: "bearer",
|
|
55786
|
+
type: "http"
|
|
55787
|
+
}],
|
|
55788
|
+
url: "/registry/v1/packages/{package_id}",
|
|
55789
|
+
...options
|
|
55790
|
+
});
|
|
55791
|
+
var registryPackagesVersionsList = (options) => (options.client ?? client).get({
|
|
55792
|
+
security: [{
|
|
55793
|
+
key: "registry-bearerAuth",
|
|
55794
|
+
scheme: "bearer",
|
|
55795
|
+
type: "http"
|
|
55796
|
+
}],
|
|
55797
|
+
url: "/registry/v1/packages/{package_id}/versions",
|
|
55798
|
+
...options
|
|
55799
|
+
});
|
|
55800
|
+
var registryPackagesVersionsCreate = (options) => (options.client ?? client).post({
|
|
55801
|
+
...formDataBodySerializer,
|
|
55802
|
+
security: [{
|
|
55803
|
+
key: "registry-bearerAuth",
|
|
55804
|
+
scheme: "bearer",
|
|
55805
|
+
type: "http"
|
|
55806
|
+
}],
|
|
55807
|
+
url: "/registry/v1/packages/{package_id}/versions",
|
|
55808
|
+
...options,
|
|
55809
|
+
headers: {
|
|
55810
|
+
"Content-Type": null,
|
|
55811
|
+
...options.headers
|
|
55812
|
+
}
|
|
55813
|
+
});
|
|
55814
|
+
var registryPackagesVersionsContents = (options) => (options.client ?? client).get({
|
|
55815
|
+
security: [{
|
|
55816
|
+
key: "registry-bearerAuth",
|
|
55817
|
+
scheme: "bearer",
|
|
55818
|
+
type: "http"
|
|
55819
|
+
}],
|
|
55820
|
+
url: "/registry/v1/packages/{package_id}/versions/{version}/contents",
|
|
55821
|
+
...options
|
|
55822
|
+
});
|
|
55823
|
+
var registryPackagesVersionsFilesRetrieve = (options) => (options.client ?? client).get({
|
|
55824
|
+
security: [{
|
|
55825
|
+
key: "registry-bearerAuth",
|
|
55826
|
+
scheme: "bearer",
|
|
55827
|
+
type: "http"
|
|
55828
|
+
}],
|
|
55829
|
+
url: "/registry/v1/packages/{package_id}/versions/{version}/files/{path}",
|
|
55830
|
+
...options
|
|
55831
|
+
});
|
|
55832
|
+
var registryPackagesVersionsArchive = (options) => (options.client ?? client).get({
|
|
55833
|
+
security: [{
|
|
55834
|
+
key: "registry-bearerAuth",
|
|
55835
|
+
scheme: "bearer",
|
|
55836
|
+
type: "http"
|
|
55837
|
+
}],
|
|
55838
|
+
url: "/registry/v1/packages/{package_id}/versions/{version}/archive",
|
|
55839
|
+
...options
|
|
55840
|
+
});
|
|
55841
|
+
var registryPackagesVersionsWithdraw = (options) => (options.client ?? client).post({
|
|
55842
|
+
security: [{
|
|
55843
|
+
key: "registry-bearerAuth",
|
|
55844
|
+
scheme: "bearer",
|
|
55845
|
+
type: "http"
|
|
55846
|
+
}],
|
|
55847
|
+
url: "/registry/v1/packages/{package_id}/versions/{version}:withdraw",
|
|
55848
|
+
...options
|
|
55849
|
+
});
|
|
55850
|
+
var registryPackagesInstallationsList = (options) => (options.client ?? client).get({
|
|
55851
|
+
security: [{
|
|
55852
|
+
key: "registry-bearerAuth",
|
|
55853
|
+
scheme: "bearer",
|
|
55854
|
+
type: "http"
|
|
55855
|
+
}],
|
|
55856
|
+
url: "/registry/v1/packages/{package_id}/installations",
|
|
55857
|
+
...options
|
|
55858
|
+
});
|
|
55859
|
+
var registryPackagesInstallationsCreate = (options) => (options.client ?? client).post({
|
|
55860
|
+
security: [{
|
|
55861
|
+
key: "registry-bearerAuth",
|
|
55862
|
+
scheme: "bearer",
|
|
55863
|
+
type: "http"
|
|
55864
|
+
}],
|
|
55865
|
+
url: "/registry/v1/packages/{package_id}/installations",
|
|
55866
|
+
...options,
|
|
55867
|
+
headers: {
|
|
55868
|
+
"Content-Type": "application/json",
|
|
55869
|
+
...options.headers
|
|
55870
|
+
}
|
|
55871
|
+
});
|
|
55872
|
+
var registryInstallationsUpdate = (options) => (options.client ?? client).post({
|
|
55873
|
+
security: [{
|
|
55874
|
+
key: "registry-bearerAuth",
|
|
55875
|
+
scheme: "bearer",
|
|
55876
|
+
type: "http"
|
|
55877
|
+
}],
|
|
55878
|
+
url: "/registry/v1/installations/{installation_id}:update",
|
|
55879
|
+
...options,
|
|
55880
|
+
headers: {
|
|
55881
|
+
"Content-Type": "application/json",
|
|
55882
|
+
...options.headers
|
|
55883
|
+
}
|
|
55884
|
+
});
|
|
55885
|
+
var registryInstallationsDelete = (options) => (options.client ?? client).delete({
|
|
55886
|
+
security: [{
|
|
55887
|
+
key: "registry-bearerAuth",
|
|
55888
|
+
scheme: "bearer",
|
|
55889
|
+
type: "http"
|
|
55890
|
+
}],
|
|
55891
|
+
url: "/registry/v1/installations/{installation_id}",
|
|
55892
|
+
...options
|
|
55893
|
+
});
|
|
55050
55894
|
var getSandboxV1Sandboxes = (options) => (options?.client ?? client).get({
|
|
55051
55895
|
querySerializer: { parameters: { state: { array: { explode: false } } } },
|
|
55052
55896
|
security: [
|
|
@@ -58910,6 +59754,10 @@ function createMedia(transport) {
|
|
|
58910
59754
|
frames: {
|
|
58911
59755
|
create: bind(transport, mediaCreateFrameUrls)
|
|
58912
59756
|
},
|
|
59757
|
+
hls: {
|
|
59758
|
+
create: bind(transport, mediaRequestHlsRenditions),
|
|
59759
|
+
list: bind(transport, mediaGetHlsRenditions)
|
|
59760
|
+
},
|
|
58913
59761
|
import: {
|
|
58914
59762
|
create: bind(transport, mediaImportAsset)
|
|
58915
59763
|
},
|
|
@@ -59247,6 +60095,44 @@ function createOrganization(transport) {
|
|
|
59247
60095
|
}
|
|
59248
60096
|
};
|
|
59249
60097
|
}
|
|
60098
|
+
function createRegistry(transport) {
|
|
60099
|
+
return {
|
|
60100
|
+
installations: {
|
|
60101
|
+
delete: bind(transport, registryInstallationsDelete),
|
|
60102
|
+
update: bind(transport, registryInstallationsUpdate)
|
|
60103
|
+
},
|
|
60104
|
+
packages: {
|
|
60105
|
+
installations: {
|
|
60106
|
+
create: bind(transport, registryPackagesInstallationsCreate),
|
|
60107
|
+
list: bind(transport, registryPackagesInstallationsList)
|
|
60108
|
+
},
|
|
60109
|
+
retrieve: bind(transport, registryPackagesRetrieve),
|
|
60110
|
+
versions: {
|
|
60111
|
+
contents: {
|
|
60112
|
+
list: bind(transport, registryPackagesVersionsContents)
|
|
60113
|
+
},
|
|
60114
|
+
create: bind(transport, (options) => registryPackagesVersionsCreate({ ...options, bodySerializer: multipartBodySerializer, headers: { "Content-Type": null, ...options.headers } })),
|
|
60115
|
+
files: {
|
|
60116
|
+
retrieve: bind(transport, registryPackagesVersionsFilesRetrieve)
|
|
60117
|
+
},
|
|
60118
|
+
list: bindPage(transport, registryPackagesVersionsList),
|
|
60119
|
+
retrieveArchive: bind(transport, registryPackagesVersionsArchive),
|
|
60120
|
+
withdraw: bind(transport, registryPackagesVersionsWithdraw)
|
|
60121
|
+
}
|
|
60122
|
+
},
|
|
60123
|
+
repositories: {
|
|
60124
|
+
create: bind(transport, registryRepositoriesCreate),
|
|
60125
|
+
delete: bind(transport, registryRepositoriesDelete),
|
|
60126
|
+
list: bindPage(transport, registryRepositoriesList),
|
|
60127
|
+
packages: {
|
|
60128
|
+
create: bind(transport, (options) => registryRepositoriesPackagesCreate({ ...options, bodySerializer: multipartBodySerializer, headers: { "Content-Type": null, ...options.headers } })),
|
|
60129
|
+
list: bindPage(transport, registryRepositoriesPackagesList)
|
|
60130
|
+
},
|
|
60131
|
+
retrieve: bind(transport, registryRepositoriesRetrieve),
|
|
60132
|
+
update: bind(transport, registryRepositoriesUpdate)
|
|
60133
|
+
}
|
|
60134
|
+
};
|
|
60135
|
+
}
|
|
59250
60136
|
function createSandbox(transport) {
|
|
59251
60137
|
return {
|
|
59252
60138
|
events: {
|
|
@@ -59623,6 +60509,7 @@ var resourceFactories = {
|
|
|
59623
60509
|
model: createModel,
|
|
59624
60510
|
ontology: createOntology,
|
|
59625
60511
|
organization: createOrganization,
|
|
60512
|
+
registry: createRegistry,
|
|
59626
60513
|
sandbox: createSandbox,
|
|
59627
60514
|
search: createSearch,
|
|
59628
60515
|
share: createShare,
|
|
@@ -61018,6 +61905,14 @@ var multipartBinaryFields = {
|
|
|
61018
61905
|
"POST /model/v1/images/edits": [],
|
|
61019
61906
|
"POST /model/v1/videos": [
|
|
61020
61907
|
"input_reference"
|
|
61908
|
+
],
|
|
61909
|
+
"POST /registry/v1/packages/{package_id}/versions": [
|
|
61910
|
+
"archive",
|
|
61911
|
+
"files"
|
|
61912
|
+
],
|
|
61913
|
+
"POST /registry/v1/repositories/{repository_id}/packages": [
|
|
61914
|
+
"archive",
|
|
61915
|
+
"files"
|
|
61021
61916
|
]
|
|
61022
61917
|
};
|
|
61023
61918
|
|
|
@@ -61950,6 +62845,34 @@ var workflows = [
|
|
|
61950
62845
|
example: "PRAXIS_ASSUME_AGENT=R1M9TQ2X praxis agent events wait",
|
|
61951
62846
|
network: "online"
|
|
61952
62847
|
},
|
|
62848
|
+
{
|
|
62849
|
+
words: ["agent", "memory"],
|
|
62850
|
+
usage: "agent memory [--hook SessionStart|UserPromptSubmit]",
|
|
62851
|
+
summary: "Print your assume agent's memory as it stands now (PRAXIS_ASSUME_AGENT): who it is, its post, manager, duties and the charters it works under, drawn from its organization. With --hook it reads the Claude Code hook input on stdin and prints the hook's JSON: the whole memory at SessionStart, only what is new since that session last read it at UserPromptSubmit; it never fails the hook.",
|
|
62852
|
+
example: "praxis agent memory",
|
|
62853
|
+
network: "online"
|
|
62854
|
+
},
|
|
62855
|
+
{
|
|
62856
|
+
words: ["agent", "recall"],
|
|
62857
|
+
usage: "agent recall [--words <w,w>] [--handles <id,id>]",
|
|
62858
|
+
summary: "Recall from your assume agent's memory: with no flags, what else comes to mind; with words, what was filed under them; with handles, that entry and its original.",
|
|
62859
|
+
example: "praxis agent recall --words 章程,运维部",
|
|
62860
|
+
network: "online"
|
|
62861
|
+
},
|
|
62862
|
+
{
|
|
62863
|
+
words: ["agent", "remember"],
|
|
62864
|
+
usage: "agent remember --text <experience> [--about <id,id>]",
|
|
62865
|
+
summary: "Keep an experience in your assume agent's memory: it is consolidated in the background like a lived conversation, and recall finds it afterwards.",
|
|
62866
|
+
example: 'praxis agent remember --text "Sean 定了副总裁用钩子载入认知"',
|
|
62867
|
+
network: "online"
|
|
62868
|
+
},
|
|
62869
|
+
{
|
|
62870
|
+
words: ["agent", "events", "channel"],
|
|
62871
|
+
usage: "agent events channel",
|
|
62872
|
+
summary: "Run as a Claude Code channel (a stdio MCP server declaring claude/channel, no tools): pushes the waiting letters once, then every new letter and new memory of your assume agent (PRAXIS_ASSUME_AGENT, default R1M9TQ2X) into the running session. Started by the assume-agent plugin, not by hand; stdout carries MCP frames only, logs go to stderr.",
|
|
62873
|
+
example: "claude --dangerously-load-development-channels plugin:assume-agent@deepraxis",
|
|
62874
|
+
network: "online"
|
|
62875
|
+
},
|
|
61953
62876
|
{ words: ["canvas", "import"], usage: "canvas import <file.pen> [--name <name>] [--canvas <cvs_…> --yes] [--frames <id,id>] [--image-root <dir>] [--dry-run]", summary: "Import a Pencil .pen file as a canvas, uploading the images it references first.", example: 'praxis canvas import design.pen --name "Landing page"' },
|
|
61954
62877
|
{ words: ["skill"], usage: "skill [--install <dir>]", summary: "Print the AI skill, or write <dir>/praxis-cli/SKILL.md." },
|
|
61955
62878
|
{
|
|
@@ -63542,12 +64465,216 @@ function wranglerEdges(nodes) {
|
|
|
63542
64465
|
}
|
|
63543
64466
|
return edges;
|
|
63544
64467
|
}
|
|
64468
|
+
// ../../packages/praxis/deploy-core/src/job-events.ts
|
|
64469
|
+
var DEFAULT_EXPIRE_MINUTES = 60;
|
|
64470
|
+
var DEFAULT_PHASE_ID = "stable";
|
|
64471
|
+
function jobStatesOf(outcome) {
|
|
64472
|
+
switch (outcome.kind) {
|
|
64473
|
+
case "succeeded":
|
|
64474
|
+
return { jobState: "succeeded", jobRunState: "succeeded" };
|
|
64475
|
+
case "failed":
|
|
64476
|
+
return { jobState: "failed", jobRunState: "failed" };
|
|
64477
|
+
case "disabled":
|
|
64478
|
+
return { jobState: "disabled", jobRunState: "unspecified" };
|
|
64479
|
+
case "skipped":
|
|
64480
|
+
return { jobState: "skipped", jobRunState: "unspecified" };
|
|
64481
|
+
}
|
|
64482
|
+
}
|
|
64483
|
+
function formatDeployEvent(event) {
|
|
64484
|
+
return `${JSON.stringify(event)}
|
|
64485
|
+
`;
|
|
64486
|
+
}
|
|
64487
|
+
function expireTimeOf(startedAt, expireMinutes = DEFAULT_EXPIRE_MINUTES) {
|
|
64488
|
+
const start = Date.parse(startedAt);
|
|
64489
|
+
if (Number.isNaN(start))
|
|
64490
|
+
throw new Error(`--events-file needs a parseable start time, got ${JSON.stringify(startedAt)}`);
|
|
64491
|
+
const minutes = Number(expireMinutes);
|
|
64492
|
+
if (!Number.isFinite(minutes) || minutes <= 0)
|
|
64493
|
+
throw new Error(`--expire-minutes must be a positive number, got ${JSON.stringify(expireMinutes)}`);
|
|
64494
|
+
return new Date(start + minutes * 60000).toISOString();
|
|
64495
|
+
}
|
|
64496
|
+
function decidePhaseState(states) {
|
|
64497
|
+
if (states.length === 0)
|
|
64498
|
+
return "unspecified";
|
|
64499
|
+
if (states.some((state) => state === "failed" || state === "aborted"))
|
|
64500
|
+
return "failed";
|
|
64501
|
+
if (states.some((state) => state === "in_progress" || state === "pending"))
|
|
64502
|
+
return "in_progress";
|
|
64503
|
+
const neverRan = states.every((state) => state === "skipped" || state === "disabled");
|
|
64504
|
+
return neverRan ? "skipped" : "succeeded";
|
|
64505
|
+
}
|
|
64506
|
+
function decideRolloutState(jobs, options = {}) {
|
|
64507
|
+
const states = [...jobs.values()];
|
|
64508
|
+
if (states.some((state) => state === "failed" || state === "aborted"))
|
|
64509
|
+
return "failed";
|
|
64510
|
+
const deploy = jobs.get("deploy");
|
|
64511
|
+
if (deploy === undefined || deploy === "pending" || deploy === "in_progress" || deploy === "disabled")
|
|
64512
|
+
return "pending";
|
|
64513
|
+
if (deploy === "skipped" && options.artifactIdentical !== true)
|
|
64514
|
+
return "pending";
|
|
64515
|
+
if (states.every((state) => state === "succeeded" || state === "skipped" || state === "disabled" || state === "ignored")) {
|
|
64516
|
+
return options.artifactIdentical === true ? "skipped" : "succeeded";
|
|
64517
|
+
}
|
|
64518
|
+
return "pending";
|
|
64519
|
+
}
|
|
64520
|
+
function decideFinishedState(rollouts) {
|
|
64521
|
+
if (rollouts.length === 0)
|
|
64522
|
+
return "failed";
|
|
64523
|
+
const count3 = (wanted) => rollouts.filter((state) => wanted.includes(state)).length;
|
|
64524
|
+
const succeeded = count3(["succeeded", "skipped"]);
|
|
64525
|
+
const failed = count3(["failed"]);
|
|
64526
|
+
const waiting = count3(["pending"]);
|
|
64527
|
+
if (failed === 0)
|
|
64528
|
+
return succeeded === rollouts.length ? "succeeded" : "failed";
|
|
64529
|
+
return succeeded > 0 && waiting > 0 ? "halted" : "failed";
|
|
64530
|
+
}
|
|
64531
|
+
// ../../packages/praxis/deploy-core/node_modules/yaml/dist/index.js
|
|
64532
|
+
var composer = require_composer2();
|
|
64533
|
+
var Document = require_Document2();
|
|
64534
|
+
var Schema = require_Schema2();
|
|
64535
|
+
var errors = require_errors2();
|
|
64536
|
+
var Alias = require_Alias2();
|
|
64537
|
+
var identity = require_identity2();
|
|
64538
|
+
var Pair = require_Pair2();
|
|
64539
|
+
var Scalar = require_Scalar2();
|
|
64540
|
+
var YAMLMap = require_YAMLMap2();
|
|
64541
|
+
var YAMLSeq = require_YAMLSeq2();
|
|
64542
|
+
var cst = require_cst2();
|
|
64543
|
+
var lexer = require_lexer2();
|
|
64544
|
+
var lineCounter = require_line_counter2();
|
|
64545
|
+
var parser = require_parser2();
|
|
64546
|
+
var publicApi = require_public_api2();
|
|
64547
|
+
var visit = require_visit2();
|
|
64548
|
+
var $Composer = composer.Composer;
|
|
64549
|
+
var $Document = Document.Document;
|
|
64550
|
+
var $Schema = Schema.Schema;
|
|
64551
|
+
var $YAMLError = errors.YAMLError;
|
|
64552
|
+
var $YAMLParseError = errors.YAMLParseError;
|
|
64553
|
+
var $YAMLWarning = errors.YAMLWarning;
|
|
64554
|
+
var $Alias = Alias.Alias;
|
|
64555
|
+
var $isAlias = identity.isAlias;
|
|
64556
|
+
var $isCollection = identity.isCollection;
|
|
64557
|
+
var $isDocument = identity.isDocument;
|
|
64558
|
+
var $isMap = identity.isMap;
|
|
64559
|
+
var $isNode = identity.isNode;
|
|
64560
|
+
var $isPair = identity.isPair;
|
|
64561
|
+
var $isScalar = identity.isScalar;
|
|
64562
|
+
var $isSeq = identity.isSeq;
|
|
64563
|
+
var $Pair = Pair.Pair;
|
|
64564
|
+
var $Scalar = Scalar.Scalar;
|
|
64565
|
+
var $YAMLMap = YAMLMap.YAMLMap;
|
|
64566
|
+
var $YAMLSeq = YAMLSeq.YAMLSeq;
|
|
64567
|
+
var $Lexer = lexer.Lexer;
|
|
64568
|
+
var $LineCounter = lineCounter.LineCounter;
|
|
64569
|
+
var $Parser = parser.Parser;
|
|
64570
|
+
var $parse = publicApi.parse;
|
|
64571
|
+
var $parseAllDocuments = publicApi.parseAllDocuments;
|
|
64572
|
+
var $parseDocument = publicApi.parseDocument;
|
|
64573
|
+
var $stringify = publicApi.stringify;
|
|
64574
|
+
var $visit = visit.visit;
|
|
64575
|
+
var $visitAsync = visit.visitAsync;
|
|
64576
|
+
|
|
63545
64577
|
// ../../packages/praxis/deploy-core/src/lambda-function.ts
|
|
63546
64578
|
var LAMBDA_FUNCTIONS_ROOT = "services/lambda/functions";
|
|
63547
64579
|
var UPSTREAM = "aliyun-fc";
|
|
63548
|
-
var
|
|
64580
|
+
var PROJECT_FILE = "praxis.yaml";
|
|
64581
|
+
function lambdaFunctionRootOwner(root) {
|
|
64582
|
+
return root.split("/").filter((segment) => segment !== "").slice(0, -1).join("/");
|
|
64583
|
+
}
|
|
64584
|
+
function normalizeRoot(root) {
|
|
64585
|
+
return root.replace(/^\.\//, "").split("/").filter((segment) => segment !== "" && segment !== ".").join("/");
|
|
64586
|
+
}
|
|
64587
|
+
var DEFAULT_ROOTS = [
|
|
64588
|
+
{ root: LAMBDA_FUNCTIONS_ROOT, owner: lambdaFunctionRootOwner(LAMBDA_FUNCTIONS_ROOT) }
|
|
64589
|
+
];
|
|
63549
64590
|
var isText = (value) => typeof value === "string" && value !== "";
|
|
64591
|
+
function lambdaFunctionRootsOf(text) {
|
|
64592
|
+
if (text === null)
|
|
64593
|
+
return { roots: DEFAULT_ROOTS, warnings: [] };
|
|
64594
|
+
let parsed;
|
|
64595
|
+
try {
|
|
64596
|
+
parsed = $parse(text);
|
|
64597
|
+
} catch (cause) {
|
|
64598
|
+
return {
|
|
64599
|
+
roots: DEFAULT_ROOTS,
|
|
64600
|
+
warnings: [`${PROJECT_FILE}: does not parse, so its recipe roots are not read`]
|
|
64601
|
+
};
|
|
64602
|
+
}
|
|
64603
|
+
const declared = readPath(parsed, ["devops", "deploy", "recipes"]);
|
|
64604
|
+
if (declared === undefined)
|
|
64605
|
+
return { roots: DEFAULT_ROOTS, warnings: [] };
|
|
64606
|
+
if (!Array.isArray(declared)) {
|
|
64607
|
+
return {
|
|
64608
|
+
roots: DEFAULT_ROOTS,
|
|
64609
|
+
warnings: [
|
|
64610
|
+
`${PROJECT_FILE}: devops.deploy.recipes is not a list, so its recipe roots are not read`
|
|
64611
|
+
]
|
|
64612
|
+
};
|
|
64613
|
+
}
|
|
64614
|
+
const roots = [];
|
|
64615
|
+
const warnings = [];
|
|
64616
|
+
declared.forEach((entry, index) => {
|
|
64617
|
+
const root = typeof entry === "string" ? entry : typeof entry === "object" && entry !== null ? entry.root : undefined;
|
|
64618
|
+
if (!isText(root)) {
|
|
64619
|
+
warnings.push(`${PROJECT_FILE}: devops.deploy.recipes[${index}] names no root`);
|
|
64620
|
+
return;
|
|
64621
|
+
}
|
|
64622
|
+
const declaredOwner = typeof entry === "object" && entry !== null ? entry.owner : undefined;
|
|
64623
|
+
if (declaredOwner !== undefined && !isText(declaredOwner)) {
|
|
64624
|
+
warnings.push(`${PROJECT_FILE}: devops.deploy.recipes[${index}] names no owner`);
|
|
64625
|
+
return;
|
|
64626
|
+
}
|
|
64627
|
+
const normalized = normalizeRoot(root);
|
|
64628
|
+
if (normalized === "") {
|
|
64629
|
+
warnings.push(`${PROJECT_FILE}: devops.deploy.recipes[${index}] names no root`);
|
|
64630
|
+
return;
|
|
64631
|
+
}
|
|
64632
|
+
if (roots.some((known) => known.root === normalized))
|
|
64633
|
+
return;
|
|
64634
|
+
roots.push({
|
|
64635
|
+
root: normalized,
|
|
64636
|
+
owner: declaredOwner === undefined ? lambdaFunctionRootOwner(normalized) : normalizeRoot(declaredOwner)
|
|
64637
|
+
});
|
|
64638
|
+
});
|
|
64639
|
+
if (roots.length === 0 && warnings.length === 0) {
|
|
64640
|
+
warnings.push(`${PROJECT_FILE}: devops.deploy.recipes declares no root, so no function recipe is a target`);
|
|
64641
|
+
}
|
|
64642
|
+
return { roots, warnings };
|
|
64643
|
+
}
|
|
64644
|
+
function readPath(value, segments) {
|
|
64645
|
+
let current = value;
|
|
64646
|
+
for (const segment of segments) {
|
|
64647
|
+
if (current === null || typeof current !== "object" || Array.isArray(current))
|
|
64648
|
+
return;
|
|
64649
|
+
current = current[segment];
|
|
64650
|
+
}
|
|
64651
|
+
return current;
|
|
64652
|
+
}
|
|
63550
64653
|
var isCount = (value, min, max) => typeof value === "number" && Number.isInteger(value) && value >= min && value <= max;
|
|
64654
|
+
function lambdaFunctionCodeOf(value) {
|
|
64655
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
64656
|
+
return null;
|
|
64657
|
+
const declared = value;
|
|
64658
|
+
if (!isText(declared.entry) || !isText(declared.artifact))
|
|
64659
|
+
return null;
|
|
64660
|
+
if (!isText(declared.runtime) || !isText(declared.handler))
|
|
64661
|
+
return null;
|
|
64662
|
+
if (!Array.isArray(declared.layers) || !declared.layers.every(isText))
|
|
64663
|
+
return null;
|
|
64664
|
+
if (!Array.isArray(declared.command) || declared.command.length === 0 || !declared.command.every(isText))
|
|
64665
|
+
return null;
|
|
64666
|
+
if (!isCount(declared.port, 1, 65535))
|
|
64667
|
+
return null;
|
|
64668
|
+
return {
|
|
64669
|
+
entry: declared.entry,
|
|
64670
|
+
artifact: declared.artifact,
|
|
64671
|
+
runtime: declared.runtime,
|
|
64672
|
+
handler: declared.handler,
|
|
64673
|
+
layers: [...declared.layers],
|
|
64674
|
+
command: [...declared.command],
|
|
64675
|
+
port: declared.port
|
|
64676
|
+
};
|
|
64677
|
+
}
|
|
63551
64678
|
function lambdaFunctionOf(text) {
|
|
63552
64679
|
const parsed = text === null ? null : parseJsonc2(text);
|
|
63553
64680
|
if (parsed === null)
|
|
@@ -63566,6 +64693,15 @@ function lambdaFunctionOf(text) {
|
|
|
63566
64693
|
return null;
|
|
63567
64694
|
if (!isCount(parsed.concurrency, 1, 1024))
|
|
63568
64695
|
return null;
|
|
64696
|
+
if (parsed.diskSizeMb !== undefined && !isCount(parsed.diskSizeMb, 512, 10240))
|
|
64697
|
+
return null;
|
|
64698
|
+
let code;
|
|
64699
|
+
if (parsed.code !== undefined) {
|
|
64700
|
+
const declared = lambdaFunctionCodeOf(parsed.code);
|
|
64701
|
+
if (declared === null)
|
|
64702
|
+
return null;
|
|
64703
|
+
code = declared;
|
|
64704
|
+
}
|
|
63569
64705
|
return {
|
|
63570
64706
|
name: parsed.name,
|
|
63571
64707
|
upstream: parsed.upstream,
|
|
@@ -63574,35 +64710,39 @@ function lambdaFunctionOf(text) {
|
|
|
63574
64710
|
cpu: parsed.cpu,
|
|
63575
64711
|
memoryMb: parsed.memoryMb,
|
|
63576
64712
|
timeoutSeconds: parsed.timeoutSeconds,
|
|
63577
|
-
concurrency: parsed.concurrency
|
|
64713
|
+
concurrency: parsed.concurrency,
|
|
64714
|
+
...parsed.diskSizeMb === undefined ? {} : { diskSizeMb: parsed.diskSizeMb },
|
|
64715
|
+
...code === undefined ? {} : { code }
|
|
63578
64716
|
};
|
|
63579
64717
|
}
|
|
63580
|
-
|
|
63581
|
-
return { path: `${LAMBDA_FUNCTIONS_ROOT}/${recipe.name}`, name: `lambda-${recipe.name}` };
|
|
63582
|
-
}
|
|
63583
|
-
function lambdaFunctionOwner(path) {
|
|
63584
|
-
return path.split("/").slice(0, -2).join("/");
|
|
63585
|
-
}
|
|
64718
|
+
var escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
63586
64719
|
async function scanRecipes(facts) {
|
|
64720
|
+
const declared = lambdaFunctionRootsOf(await facts.read(PROJECT_FILE));
|
|
63587
64721
|
const found = [];
|
|
63588
|
-
const warnings = [];
|
|
64722
|
+
const warnings = [...declared.warnings];
|
|
64723
|
+
const matchers = declared.roots.map((root) => ({
|
|
64724
|
+
root,
|
|
64725
|
+
pattern: new RegExp(`^${escapeRegExp(root.root)}/([^/]+)/function\\.json$`)
|
|
64726
|
+
}));
|
|
63589
64727
|
for (const path of [...facts.tree].sort()) {
|
|
63590
|
-
const
|
|
63591
|
-
|
|
63592
|
-
|
|
63593
|
-
|
|
63594
|
-
|
|
63595
|
-
|
|
63596
|
-
|
|
63597
|
-
|
|
63598
|
-
|
|
63599
|
-
|
|
63600
|
-
|
|
63601
|
-
|
|
63602
|
-
|
|
63603
|
-
|
|
64728
|
+
for (const { root, pattern } of matchers) {
|
|
64729
|
+
const match = pattern.exec(path);
|
|
64730
|
+
if (match === null)
|
|
64731
|
+
continue;
|
|
64732
|
+
const dir = path.slice(0, -"/function.json".length);
|
|
64733
|
+
const recipe = lambdaFunctionOf(await facts.read(path));
|
|
64734
|
+
if (recipe === null) {
|
|
64735
|
+
warnings.push(`${dir}: function.json is not a recipe`);
|
|
64736
|
+
continue;
|
|
64737
|
+
}
|
|
64738
|
+
if (recipe.upstream !== UPSTREAM)
|
|
64739
|
+
continue;
|
|
64740
|
+
if (recipe.name !== match[1]) {
|
|
64741
|
+
warnings.push(`${dir}: function.json names ${JSON.stringify(recipe.name)}, not the directory name`);
|
|
64742
|
+
continue;
|
|
64743
|
+
}
|
|
64744
|
+
found.push({ recipe, path: dir, root });
|
|
63604
64745
|
}
|
|
63605
|
-
found.push(recipe);
|
|
63606
64746
|
}
|
|
63607
64747
|
return { found, warnings };
|
|
63608
64748
|
}
|
|
@@ -63617,13 +64757,14 @@ function lambdaFunctionProvider(_options = {}) {
|
|
|
63617
64757
|
const scan = await scanRecipes(facts);
|
|
63618
64758
|
const targets = [];
|
|
63619
64759
|
const byOwner = new Map;
|
|
63620
|
-
for (const recipe of scan.found) {
|
|
63621
|
-
const
|
|
64760
|
+
for (const { recipe, path, root } of scan.found) {
|
|
64761
|
+
const name = `lambda-${recipe.name}`;
|
|
63622
64762
|
if (claimed.has(path))
|
|
63623
64763
|
continue;
|
|
63624
64764
|
targets.push({ path, name, destination: "aliyun-fc", production: true, onTrain: true });
|
|
63625
|
-
|
|
63626
|
-
|
|
64765
|
+
if (root.owner === "")
|
|
64766
|
+
continue;
|
|
64767
|
+
byOwner.set(root.owner, [...byOwner.get(root.owner) ?? [], path]);
|
|
63627
64768
|
}
|
|
63628
64769
|
const refined = partial.targets.map((target) => {
|
|
63629
64770
|
const paths = byOwner.get(target.path);
|
|
@@ -63686,52 +64827,6 @@ function environmentsOf(lifecycle) {
|
|
|
63686
64827
|
const named = environments.filter((entry) => typeof entry === "string");
|
|
63687
64828
|
return named.length === 0 ? undefined : named;
|
|
63688
64829
|
}
|
|
63689
|
-
// ../../packages/praxis/deploy-core/node_modules/yaml/dist/index.js
|
|
63690
|
-
var composer = require_composer2();
|
|
63691
|
-
var Document = require_Document2();
|
|
63692
|
-
var Schema = require_Schema2();
|
|
63693
|
-
var errors = require_errors2();
|
|
63694
|
-
var Alias = require_Alias2();
|
|
63695
|
-
var identity = require_identity2();
|
|
63696
|
-
var Pair = require_Pair2();
|
|
63697
|
-
var Scalar = require_Scalar2();
|
|
63698
|
-
var YAMLMap = require_YAMLMap2();
|
|
63699
|
-
var YAMLSeq = require_YAMLSeq2();
|
|
63700
|
-
var cst = require_cst2();
|
|
63701
|
-
var lexer = require_lexer2();
|
|
63702
|
-
var lineCounter = require_line_counter2();
|
|
63703
|
-
var parser = require_parser2();
|
|
63704
|
-
var publicApi = require_public_api2();
|
|
63705
|
-
var visit = require_visit2();
|
|
63706
|
-
var $Composer = composer.Composer;
|
|
63707
|
-
var $Document = Document.Document;
|
|
63708
|
-
var $Schema = Schema.Schema;
|
|
63709
|
-
var $YAMLError = errors.YAMLError;
|
|
63710
|
-
var $YAMLParseError = errors.YAMLParseError;
|
|
63711
|
-
var $YAMLWarning = errors.YAMLWarning;
|
|
63712
|
-
var $Alias = Alias.Alias;
|
|
63713
|
-
var $isAlias = identity.isAlias;
|
|
63714
|
-
var $isCollection = identity.isCollection;
|
|
63715
|
-
var $isDocument = identity.isDocument;
|
|
63716
|
-
var $isMap = identity.isMap;
|
|
63717
|
-
var $isNode = identity.isNode;
|
|
63718
|
-
var $isPair = identity.isPair;
|
|
63719
|
-
var $isScalar = identity.isScalar;
|
|
63720
|
-
var $isSeq = identity.isSeq;
|
|
63721
|
-
var $Pair = Pair.Pair;
|
|
63722
|
-
var $Scalar = Scalar.Scalar;
|
|
63723
|
-
var $YAMLMap = YAMLMap.YAMLMap;
|
|
63724
|
-
var $YAMLSeq = YAMLSeq.YAMLSeq;
|
|
63725
|
-
var $Lexer = lexer.Lexer;
|
|
63726
|
-
var $LineCounter = lineCounter.LineCounter;
|
|
63727
|
-
var $Parser = parser.Parser;
|
|
63728
|
-
var $parse = publicApi.parse;
|
|
63729
|
-
var $parseAllDocuments = publicApi.parseAllDocuments;
|
|
63730
|
-
var $parseDocument = publicApi.parseDocument;
|
|
63731
|
-
var $stringify = publicApi.stringify;
|
|
63732
|
-
var $visit = visit.visit;
|
|
63733
|
-
var $visitAsync = visit.visitAsync;
|
|
63734
|
-
|
|
63735
64830
|
// ../../packages/praxis/deploy-core/src/workspace.ts
|
|
63736
64831
|
function packageJsonIn(dir) {
|
|
63737
64832
|
return dir === "." ? "package.json" : `${dir}/package.json`;
|
|
@@ -63743,6 +64838,16 @@ function dirOfPackageJson(path) {
|
|
|
63743
64838
|
return;
|
|
63744
64839
|
return path.slice(0, -"/package.json".length);
|
|
63745
64840
|
}
|
|
64841
|
+
function packageDirOf(path, dirs) {
|
|
64842
|
+
let found = null;
|
|
64843
|
+
for (const dir of dirs) {
|
|
64844
|
+
if (path !== dir && !path.startsWith(`${dir}/`))
|
|
64845
|
+
continue;
|
|
64846
|
+
if (found === null || dir.length > found.length)
|
|
64847
|
+
found = dir;
|
|
64848
|
+
}
|
|
64849
|
+
return found;
|
|
64850
|
+
}
|
|
63746
64851
|
function dirOfManifest(path) {
|
|
63747
64852
|
for (const name of BUILD_MANIFESTS) {
|
|
63748
64853
|
if (path === name)
|
|
@@ -64150,68 +65255,216 @@ function stronglyConnected(count3, edges) {
|
|
|
64150
65255
|
visit2(node2);
|
|
64151
65256
|
return components;
|
|
64152
65257
|
}
|
|
64153
|
-
// ../../packages/praxis/deploy-core/src/
|
|
64154
|
-
var
|
|
64155
|
-
var
|
|
64156
|
-
function
|
|
64157
|
-
|
|
64158
|
-
|
|
64159
|
-
|
|
64160
|
-
|
|
64161
|
-
|
|
64162
|
-
|
|
64163
|
-
|
|
64164
|
-
|
|
64165
|
-
return { jobState: "skipped", jobRunState: "unspecified" };
|
|
65258
|
+
// ../../packages/praxis/deploy-core/src/root-ownership.ts
|
|
65259
|
+
var ROOT_OWNERSHIP_FILE = "root-ownership.yaml";
|
|
65260
|
+
var ROOT_OWNERSHIP_DEFAULT = "widen";
|
|
65261
|
+
function rootPatternMatches(match, path) {
|
|
65262
|
+
const directory = match.endsWith("/");
|
|
65263
|
+
const pattern = match.replace(/^\.\//, "").replace(/\/+$/, "");
|
|
65264
|
+
if (!directory)
|
|
65265
|
+
return matchesPattern(pattern, path);
|
|
65266
|
+
const segments = path.split("/");
|
|
65267
|
+
for (let take = 1;take <= segments.length; take += 1) {
|
|
65268
|
+
if (matchesPattern(pattern, segments.slice(0, take).join("/")))
|
|
65269
|
+
return true;
|
|
64166
65270
|
}
|
|
65271
|
+
return false;
|
|
64167
65272
|
}
|
|
64168
|
-
function
|
|
64169
|
-
|
|
64170
|
-
|
|
64171
|
-
|
|
64172
|
-
|
|
64173
|
-
|
|
64174
|
-
|
|
64175
|
-
|
|
64176
|
-
|
|
64177
|
-
if (!Number.isFinite(minutes) || minutes <= 0)
|
|
64178
|
-
throw new Error(`--expire-minutes must be a positive number, got ${JSON.stringify(expireMinutes)}`);
|
|
64179
|
-
return new Date(start + minutes * 60000).toISOString();
|
|
64180
|
-
}
|
|
64181
|
-
function decidePhaseState(states) {
|
|
64182
|
-
if (states.length === 0)
|
|
64183
|
-
return "unspecified";
|
|
64184
|
-
if (states.some((state) => state === "failed" || state === "aborted"))
|
|
64185
|
-
return "failed";
|
|
64186
|
-
if (states.some((state) => state === "in_progress" || state === "pending"))
|
|
64187
|
-
return "in_progress";
|
|
64188
|
-
const neverRan = states.every((state) => state === "skipped" || state === "disabled");
|
|
64189
|
-
return neverRan ? "skipped" : "succeeded";
|
|
64190
|
-
}
|
|
64191
|
-
function decideRolloutState(jobs, options = {}) {
|
|
64192
|
-
const states = [...jobs.values()];
|
|
64193
|
-
if (states.some((state) => state === "failed" || state === "aborted"))
|
|
64194
|
-
return "failed";
|
|
64195
|
-
const deploy = jobs.get("deploy");
|
|
64196
|
-
if (deploy === undefined || deploy === "pending" || deploy === "in_progress" || deploy === "disabled")
|
|
64197
|
-
return "pending";
|
|
64198
|
-
if (deploy === "skipped" && options.artifactIdentical !== true)
|
|
64199
|
-
return "pending";
|
|
64200
|
-
if (states.every((state) => state === "succeeded" || state === "skipped" || state === "disabled" || state === "ignored")) {
|
|
64201
|
-
return options.artifactIdentical === true ? "skipped" : "succeeded";
|
|
65273
|
+
function rootOwnershipMatchOf(path, table) {
|
|
65274
|
+
if (table === null)
|
|
65275
|
+
return { kind: "unknown" };
|
|
65276
|
+
for (const rule of table.rules) {
|
|
65277
|
+
if (!rootPatternMatches(rule.match, path))
|
|
65278
|
+
continue;
|
|
65279
|
+
if (rule.kind === "package")
|
|
65280
|
+
return { kind: "package", package: rule.package ?? "" };
|
|
65281
|
+
return { kind: rule.kind };
|
|
64202
65282
|
}
|
|
64203
|
-
return "
|
|
65283
|
+
return { kind: "unknown" };
|
|
64204
65284
|
}
|
|
64205
|
-
|
|
64206
|
-
|
|
64207
|
-
|
|
64208
|
-
|
|
64209
|
-
|
|
64210
|
-
|
|
64211
|
-
|
|
64212
|
-
|
|
64213
|
-
|
|
64214
|
-
|
|
65285
|
+
var KINDS = ["resolving", "package", "none"];
|
|
65286
|
+
function parseRootOwnership(text, options) {
|
|
65287
|
+
if (text === null) {
|
|
65288
|
+
return {
|
|
65289
|
+
kind: "invalid",
|
|
65290
|
+
problems: [
|
|
65291
|
+
{
|
|
65292
|
+
rule: -1,
|
|
65293
|
+
match: ROOT_OWNERSHIP_FILE,
|
|
65294
|
+
problem: `${ROOT_OWNERSHIP_FILE} is missing at this commit`
|
|
65295
|
+
}
|
|
65296
|
+
]
|
|
65297
|
+
};
|
|
65298
|
+
}
|
|
65299
|
+
let parsed;
|
|
65300
|
+
try {
|
|
65301
|
+
parsed = $parse(text);
|
|
65302
|
+
} catch (error) {
|
|
65303
|
+
return {
|
|
65304
|
+
kind: "invalid",
|
|
65305
|
+
problems: [
|
|
65306
|
+
{ rule: -1, match: ROOT_OWNERSHIP_FILE, problem: `not YAML: ${error.message}` }
|
|
65307
|
+
]
|
|
65308
|
+
};
|
|
65309
|
+
}
|
|
65310
|
+
const problems = [];
|
|
65311
|
+
const document2 = parsed ?? null;
|
|
65312
|
+
if (document2 === null || typeof document2 !== "object" || Array.isArray(document2)) {
|
|
65313
|
+
return {
|
|
65314
|
+
kind: "invalid",
|
|
65315
|
+
problems: [
|
|
65316
|
+
{ rule: -1, match: ROOT_OWNERSHIP_FILE, problem: "the document is not a mapping" }
|
|
65317
|
+
]
|
|
65318
|
+
};
|
|
65319
|
+
}
|
|
65320
|
+
if (document2.version !== 1) {
|
|
65321
|
+
problems.push({
|
|
65322
|
+
rule: -1,
|
|
65323
|
+
match: "version",
|
|
65324
|
+
problem: `version must be 1, found ${JSON.stringify(document2.version)}`
|
|
65325
|
+
});
|
|
65326
|
+
}
|
|
65327
|
+
if (document2.default !== ROOT_OWNERSHIP_DEFAULT) {
|
|
65328
|
+
problems.push({
|
|
65329
|
+
rule: -1,
|
|
65330
|
+
match: "default",
|
|
65331
|
+
problem: `default must be "${ROOT_OWNERSHIP_DEFAULT}" — a path no rule claims may never narrow the run`
|
|
65332
|
+
});
|
|
65333
|
+
}
|
|
65334
|
+
if (!Array.isArray(document2.rules)) {
|
|
65335
|
+
problems.push({ rule: -1, match: "rules", problem: "rules must be a list" });
|
|
65336
|
+
return { kind: "invalid", problems };
|
|
65337
|
+
}
|
|
65338
|
+
const workspace = new Set(options.workspaceDirs);
|
|
65339
|
+
const rules = [];
|
|
65340
|
+
document2.rules.forEach((entry, index) => {
|
|
65341
|
+
const rule = entry ?? null;
|
|
65342
|
+
if (rule === null || typeof rule !== "object" || Array.isArray(rule)) {
|
|
65343
|
+
problems.push({
|
|
65344
|
+
rule: index,
|
|
65345
|
+
match: "",
|
|
65346
|
+
problem: "a rule must be a mapping with match and kind"
|
|
65347
|
+
});
|
|
65348
|
+
return;
|
|
65349
|
+
}
|
|
65350
|
+
const match = typeof rule.match === "string" ? rule.match.trim() : "";
|
|
65351
|
+
const kind = typeof rule.kind === "string" ? rule.kind : "";
|
|
65352
|
+
if (match === "") {
|
|
65353
|
+
problems.push({ rule: index, match: "", problem: "match must be a non-empty string" });
|
|
65354
|
+
return;
|
|
65355
|
+
}
|
|
65356
|
+
if (!KINDS.includes(kind)) {
|
|
65357
|
+
problems.push({
|
|
65358
|
+
rule: index,
|
|
65359
|
+
match,
|
|
65360
|
+
problem: `kind must be one of ${KINDS.join(" / ")}, found ${JSON.stringify(rule.kind)}`
|
|
65361
|
+
});
|
|
65362
|
+
return;
|
|
65363
|
+
}
|
|
65364
|
+
const evidence = typeof rule.evidence === "string" ? rule.evidence.trim() : "";
|
|
65365
|
+
const why = typeof rule.why === "string" ? rule.why.trim() : "";
|
|
65366
|
+
if (kind === "package") {
|
|
65367
|
+
const owner = typeof rule.package === "string" ? rule.package.trim() : "";
|
|
65368
|
+
if (owner === "") {
|
|
65369
|
+
problems.push({
|
|
65370
|
+
rule: index,
|
|
65371
|
+
match,
|
|
65372
|
+
problem: "kind: package needs the workspace directory it belongs to"
|
|
65373
|
+
});
|
|
65374
|
+
return;
|
|
65375
|
+
}
|
|
65376
|
+
if (!workspace.has(owner)) {
|
|
65377
|
+
problems.push({
|
|
65378
|
+
rule: index,
|
|
65379
|
+
match,
|
|
65380
|
+
problem: `package "${owner}" is not a workspace package directory at this commit`
|
|
65381
|
+
});
|
|
65382
|
+
return;
|
|
65383
|
+
}
|
|
65384
|
+
if (evidence === "") {
|
|
65385
|
+
rules.push({ match, kind: "resolving", evidenceMissing: true, ...why === "" ? {} : { why } });
|
|
65386
|
+
return;
|
|
65387
|
+
}
|
|
65388
|
+
rules.push({ match, kind: "package", package: owner, evidence, ...why === "" ? {} : { why } });
|
|
65389
|
+
return;
|
|
65390
|
+
}
|
|
65391
|
+
if (rule.package !== undefined) {
|
|
65392
|
+
problems.push({
|
|
65393
|
+
rule: index,
|
|
65394
|
+
match,
|
|
65395
|
+
problem: `package is only allowed on kind: package (this rule is ${kind})`
|
|
65396
|
+
});
|
|
65397
|
+
return;
|
|
65398
|
+
}
|
|
65399
|
+
if (kind === "none" && evidence === "") {
|
|
65400
|
+
rules.push({ match, kind: "resolving", evidenceMissing: true, ...why === "" ? {} : { why } });
|
|
65401
|
+
return;
|
|
65402
|
+
}
|
|
65403
|
+
rules.push({
|
|
65404
|
+
match,
|
|
65405
|
+
kind,
|
|
65406
|
+
...evidence === "" ? {} : { evidence },
|
|
65407
|
+
...why === "" ? {} : { why }
|
|
65408
|
+
});
|
|
65409
|
+
});
|
|
65410
|
+
if (problems.length > 0)
|
|
65411
|
+
return { kind: "invalid", problems };
|
|
65412
|
+
const table = { version: 1, rules, default: ROOT_OWNERSHIP_DEFAULT };
|
|
65413
|
+
if (rootOwnershipMatchOf(ROOT_OWNERSHIP_FILE, table).kind !== "resolving") {
|
|
65414
|
+
return {
|
|
65415
|
+
kind: "invalid",
|
|
65416
|
+
problems: [
|
|
65417
|
+
{
|
|
65418
|
+
rule: -1,
|
|
65419
|
+
match: ROOT_OWNERSHIP_FILE,
|
|
65420
|
+
problem: `${ROOT_OWNERSHIP_FILE} must classify itself as resolving: a change to the table can change every package's inputs`
|
|
65421
|
+
}
|
|
65422
|
+
]
|
|
65423
|
+
};
|
|
65424
|
+
}
|
|
65425
|
+
return { kind: "table", table };
|
|
65426
|
+
}
|
|
65427
|
+
function namedPackagesOf(input) {
|
|
65428
|
+
const named = new Set;
|
|
65429
|
+
for (const path of input.changedPaths) {
|
|
65430
|
+
const dir = packageDirOf(path, input.workspaceDirs);
|
|
65431
|
+
if (dir !== null)
|
|
65432
|
+
named.add(dir);
|
|
65433
|
+
}
|
|
65434
|
+
const roots = rootOwnershipDecisionOf(input);
|
|
65435
|
+
for (const dir of roots.packages)
|
|
65436
|
+
if (input.workspaceDirs.includes(dir))
|
|
65437
|
+
named.add(dir);
|
|
65438
|
+
return { packages: roots.widened ? [] : [...named].sort(), roots };
|
|
65439
|
+
}
|
|
65440
|
+
function rootOwnershipDecisionOf(input) {
|
|
65441
|
+
const unclaimed = input.changedPaths.filter((path) => packageDirOf(path, input.workspaceDirs) === null);
|
|
65442
|
+
const named = new Set;
|
|
65443
|
+
const traces = [];
|
|
65444
|
+
let widened = false;
|
|
65445
|
+
for (const path of unclaimed) {
|
|
65446
|
+
if (input.table === null) {
|
|
65447
|
+
widened = true;
|
|
65448
|
+
traces.push({ path, reason: "table-unreadable" });
|
|
65449
|
+
continue;
|
|
65450
|
+
}
|
|
65451
|
+
const match = rootOwnershipMatchOf(path, input.table);
|
|
65452
|
+
if (match.kind === "package")
|
|
65453
|
+
named.add(match.package);
|
|
65454
|
+
else if (match.kind === "none")
|
|
65455
|
+
continue;
|
|
65456
|
+
else {
|
|
65457
|
+
widened = true;
|
|
65458
|
+
traces.push({ path, reason: match.kind });
|
|
65459
|
+
}
|
|
65460
|
+
}
|
|
65461
|
+
return {
|
|
65462
|
+
unclaimed,
|
|
65463
|
+
widened,
|
|
65464
|
+
traces,
|
|
65465
|
+
packages: widened ? [] : [...named].sort(),
|
|
65466
|
+
allNone: !widened && unclaimed.length > 0 && named.size === 0
|
|
65467
|
+
};
|
|
64215
65468
|
}
|
|
64216
65469
|
// ../../packages/praxis/deploy-core/src/job-events-file.ts
|
|
64217
65470
|
import { appendFileSync, mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
@@ -64330,7 +65583,7 @@ function reportBlockedTarget(events, target, message) {
|
|
|
64330
65583
|
}
|
|
64331
65584
|
|
|
64332
65585
|
// src/commands/devops.ts
|
|
64333
|
-
var
|
|
65586
|
+
var import_yaml4 = __toESM(require_dist(), 1);
|
|
64334
65587
|
|
|
64335
65588
|
// src/commands/devops-deploy-plan.ts
|
|
64336
65589
|
import { resolve as resolve3 } from "node:path";
|
|
@@ -65715,7 +66968,7 @@ async function devopsDeployTofu(flags, ports) {
|
|
|
65715
66968
|
const projectYaml = await ports.readFile(join5(ports.cwd, "praxis.yaml"));
|
|
65716
66969
|
let parsedYaml;
|
|
65717
66970
|
try {
|
|
65718
|
-
parsedYaml = projectYaml === null ? undefined :
|
|
66971
|
+
parsedYaml = projectYaml === null ? undefined : import_yaml4.parse(projectYaml);
|
|
65719
66972
|
} catch (error) {
|
|
65720
66973
|
throw new UsageError(`praxis.yaml is not valid YAML: ${error.message}`);
|
|
65721
66974
|
}
|
|
@@ -65965,17 +67218,6 @@ function selectAffected(input) {
|
|
|
65965
67218
|
reasons[spelled.get(relative2)] = reason;
|
|
65966
67219
|
return { tests: selected.map(({ relative: relative2 }) => spelled.get(relative2)), features, reasons, openIssues: [...AFFECTED_OPEN_ISSUES] };
|
|
65967
67220
|
}
|
|
65968
|
-
function nearestPackage(path, packages) {
|
|
65969
|
-
let found = null;
|
|
65970
|
-
for (const candidate of packages) {
|
|
65971
|
-
const root = candidate.replace(/\/+$/, "");
|
|
65972
|
-
if (!root || !(path === root || path.startsWith(`${root}/`)))
|
|
65973
|
-
continue;
|
|
65974
|
-
if (found === null || root.length > found.length)
|
|
65975
|
-
found = root;
|
|
65976
|
-
}
|
|
65977
|
-
return found;
|
|
65978
|
-
}
|
|
65979
67221
|
var BUN_FILE_HEADER = /^(\S.*\.(?:test|spec)\.(?:ts|tsx|js|mjs)):$/;
|
|
65980
67222
|
var BUN_COUNT = /^\s*(\d+)\s+(pass|fail|skip|todo)\b/;
|
|
65981
67223
|
var BUN_RAN = /^Ran (\d+) tests? across/;
|
|
@@ -66102,38 +67344,69 @@ async function changedSelection(since, ports) {
|
|
|
66102
67344
|
const roots = await ports.checkout.roots();
|
|
66103
67345
|
const grouped = new Map;
|
|
66104
67346
|
for (const file of files) {
|
|
66105
|
-
const owner =
|
|
67347
|
+
const owner = packageDirOf(file, roots);
|
|
66106
67348
|
if (owner === null)
|
|
66107
67349
|
continue;
|
|
66108
67350
|
grouped.set(owner, [...grouped.get(owner) ?? [], file]);
|
|
66109
67351
|
}
|
|
67352
|
+
const parsed = parseRootOwnership(await ports.checkout.read(ROOT_OWNERSHIP_FILE), { workspaceDirs: roots });
|
|
67353
|
+
const named = namedPackagesOf({ changedPaths: files, workspaceDirs: roots, table: parsed.kind === "table" ? parsed.table : null });
|
|
67354
|
+
const widen = named.roots.widened ? { paths: named.roots.traces.map((trace) => trace.path), reason: widenReason(named.roots.traces.map((trace) => trace.reason)) } : null;
|
|
67355
|
+
const failed = widen === null && files.length > 0 && named.packages.length === 0 && !named.roots.allNone ? { paths: [...named.roots.unclaimed].sort() } : null;
|
|
67356
|
+
const namedByTable = new Set(named.packages.filter((dir) => !grouped.has(dir)));
|
|
67357
|
+
const selectedRoots = widen !== null ? [...roots].sort((a, b) => a.localeCompare(b, "en")) : [...new Set([...grouped.keys(), ...namedByTable])].sort((a, b) => a.localeCompare(b, "en"));
|
|
66110
67358
|
const groups = [];
|
|
66111
|
-
for (const root of
|
|
67359
|
+
for (const root of selectedRoots) {
|
|
66112
67360
|
const packagePath = join6(ports.checkout.root, root);
|
|
66113
|
-
groups.push({
|
|
67361
|
+
groups.push({
|
|
67362
|
+
root,
|
|
67363
|
+
path: packagePath,
|
|
67364
|
+
whole: widen !== null || namedByTable.has(root),
|
|
67365
|
+
selection: selectAffected({ changed: grouped.get(root) ?? [], files: await ports.checkout.sources(packagePath), packageRoot: root })
|
|
67366
|
+
});
|
|
66114
67367
|
}
|
|
66115
67368
|
const owned = new Set([...grouped.values()].flat());
|
|
66116
|
-
return { base, files, groups, unowned: files.filter((file) => !owned.has(file)) };
|
|
67369
|
+
return { base, files, groups, unowned: files.filter((file) => !owned.has(file)), widen, failed };
|
|
67370
|
+
}
|
|
67371
|
+
function widenReason(reasons) {
|
|
67372
|
+
if (reasons.includes("table-unreadable"))
|
|
67373
|
+
return `${ROOT_OWNERSHIP_FILE} 读不出来(缺失或不合法),按整仓跑`;
|
|
67374
|
+
if (reasons.includes("unknown"))
|
|
67375
|
+
return "有仓库根路径没被表判定,按整仓跑";
|
|
67376
|
+
return "改到了仓库根的解析类文件(整仓都可能受影响)";
|
|
66117
67377
|
}
|
|
66118
67378
|
async function runAffected(list, since, ports) {
|
|
66119
|
-
const { base, files, groups, unowned } = await changedSelection(since, ports);
|
|
67379
|
+
const { base, files, groups, unowned, widen, failed } = await changedSelection(since, ports);
|
|
66120
67380
|
const view = {
|
|
66121
67381
|
since: base,
|
|
66122
67382
|
packages: groups.map((group) => ({
|
|
66123
67383
|
path: group.root,
|
|
66124
67384
|
tests: group.selection.tests.map((file) => ({ file, reason: group.selection.reasons[file] })),
|
|
66125
|
-
features: group.selection.features
|
|
67385
|
+
features: group.selection.features,
|
|
67386
|
+
...group.whole ? { whole: true } : {}
|
|
66126
67387
|
})),
|
|
66127
67388
|
tests: groups.flatMap((group) => group.selection.tests),
|
|
66128
67389
|
features: groups.flatMap((group) => group.selection.features),
|
|
66129
67390
|
unowned,
|
|
67391
|
+
widen,
|
|
67392
|
+
failed,
|
|
66130
67393
|
openIssues: [...selectAffected({ changed: [], files: new Map, packageRoot: "" }).openIssues]
|
|
66131
67394
|
};
|
|
66132
|
-
const lines = [
|
|
66133
|
-
...
|
|
66134
|
-
...
|
|
66135
|
-
|
|
66136
|
-
|
|
67395
|
+
const lines = [
|
|
67396
|
+
...widen === null ? [] : [`${widen.reason}:${widen.paths.join("、")} → 每个包整套测试`],
|
|
67397
|
+
...view.packages.flatMap((entry) => [
|
|
67398
|
+
...entry.tests.map(({ file, reason }) => `${file} (${reason})`),
|
|
67399
|
+
...entry.features.map((feature) => `${feature.file} (feature: ${feature.title})`)
|
|
67400
|
+
]),
|
|
67401
|
+
...view.openIssues.map((issue) => `note: ${issue}`)
|
|
67402
|
+
];
|
|
67403
|
+
if (failed !== null) {
|
|
67404
|
+
ports.emit({ kind: "object", data: view });
|
|
67405
|
+
ports.human([`选包塌成 0 个包:这些仓库根路径没有对应的包,也不在 ${ROOT_OWNERSHIP_FILE} 里被判成 none——先补表,别让它静默少跑:`, ...failed.paths].join(`
|
|
67406
|
+
`));
|
|
67407
|
+
return 1;
|
|
67408
|
+
}
|
|
67409
|
+
if (list || !groups.some((group) => group.whole) && view.tests.length === 0 && view.features.length === 0) {
|
|
66137
67410
|
ports.emit({ kind: "object", data: view });
|
|
66138
67411
|
ports.human([files.length === 0 ? `nothing changed since ${base}` : `${view.tests.length} test file(s) and ${view.features.length} feature(s) affected since ${base}:`, ...lines].join(`
|
|
66139
67412
|
`));
|
|
@@ -66141,9 +67414,9 @@ async function runAffected(list, since, ports) {
|
|
|
66141
67414
|
}
|
|
66142
67415
|
const runs = [];
|
|
66143
67416
|
for (const group of groups) {
|
|
66144
|
-
const
|
|
66145
|
-
if (
|
|
66146
|
-
const result = await ports.checkout.runTests(group.path,
|
|
67417
|
+
const selected = group.whole ? [] : group.selection.tests.map((file) => stripRoot(file, group.root));
|
|
67418
|
+
if (group.whole || selected.length) {
|
|
67419
|
+
const result = await ports.checkout.runTests(group.path, selected);
|
|
66147
67420
|
runs.push(bunTestRun(group.root, result.code, result.output));
|
|
66148
67421
|
}
|
|
66149
67422
|
for (const feature of group.selection.features)
|
|
@@ -66382,7 +67655,16 @@ async function localCheckout(cwd, spawn5) {
|
|
|
66382
67655
|
await walk(packagePath);
|
|
66383
67656
|
return files;
|
|
66384
67657
|
},
|
|
66385
|
-
runTests: (packagePath, files) => spawn5("nice", ["-n", "10", "bun", "test", ...files], { cwd: packagePath })
|
|
67658
|
+
runTests: (packagePath, files) => spawn5("nice", ["-n", "10", "bun", "test", ...files], { cwd: packagePath }),
|
|
67659
|
+
read: async (path) => {
|
|
67660
|
+
try {
|
|
67661
|
+
return await readFile4(join6(root, path), "utf8");
|
|
67662
|
+
} catch (error) {
|
|
67663
|
+
if (error.code === "ENOENT")
|
|
67664
|
+
return null;
|
|
67665
|
+
throw error;
|
|
67666
|
+
}
|
|
67667
|
+
}
|
|
66386
67668
|
};
|
|
66387
67669
|
}
|
|
66388
67670
|
async function withEngineStdoutOnStderr(body) {
|
|
@@ -69905,6 +71187,275 @@ async function runEventsWait(ports) {
|
|
|
69905
71187
|
}
|
|
69906
71188
|
}
|
|
69907
71189
|
|
|
71190
|
+
// src/commands/events-channel.ts
|
|
71191
|
+
var CHANNEL_SOURCE = "assume-agent";
|
|
71192
|
+
var SERVER_NAME = "assume-channel";
|
|
71193
|
+
var DEFAULT_PROTOCOL_VERSION = "2025-06-18";
|
|
71194
|
+
var BACKLOG_NAMED = 5;
|
|
71195
|
+
function channelInstructions(agent) {
|
|
71196
|
+
return [
|
|
71197
|
+
`Events from your Praxis assume agent ${agent} arrive as <channel source="${CHANNEL_SOURCE}" kind="letter" letter_id="…" sender="…">.`,
|
|
71198
|
+
'kind="letter": a letter reached the agent. The content names the sender and the summary; read the letters with the praxis_assume_inbox tool (action "read") and handle them.',
|
|
71199
|
+
'kind="ritual": the agent was given a new memory (a ritual was held); its knowledge is refreshed, nothing to reply to.',
|
|
71200
|
+
"The channel is one-way: answer through the praxis_assume_* tools, not back through the channel."
|
|
71201
|
+
].join(`
|
|
71202
|
+
`);
|
|
71203
|
+
}
|
|
71204
|
+
function initializeResult(params, agent) {
|
|
71205
|
+
const asked = params?.protocolVersion;
|
|
71206
|
+
return {
|
|
71207
|
+
protocolVersion: typeof asked === "string" ? asked : DEFAULT_PROTOCOL_VERSION,
|
|
71208
|
+
capabilities: { experimental: { "claude/channel": {} } },
|
|
71209
|
+
serverInfo: { name: SERVER_NAME, version: "0.1.0" },
|
|
71210
|
+
instructions: channelInstructions(agent)
|
|
71211
|
+
};
|
|
71212
|
+
}
|
|
71213
|
+
function replyTo(message2, agent) {
|
|
71214
|
+
if (message2.id === undefined || message2.id === null || typeof message2.method !== "string")
|
|
71215
|
+
return null;
|
|
71216
|
+
const reply = (body) => ({ jsonrpc: "2.0", id: message2.id, ...body });
|
|
71217
|
+
switch (message2.method) {
|
|
71218
|
+
case "initialize":
|
|
71219
|
+
return reply({ result: initializeResult(message2.params, agent) });
|
|
71220
|
+
case "ping":
|
|
71221
|
+
return reply({ result: {} });
|
|
71222
|
+
default:
|
|
71223
|
+
return reply({ error: { code: -32601, message: `Method not found: ${message2.method}` } });
|
|
71224
|
+
}
|
|
71225
|
+
}
|
|
71226
|
+
var sender = (letter) => letter.sender_name || letter.sender;
|
|
71227
|
+
var readHint = 'Read it with praxis_assume_inbox (action "read").';
|
|
71228
|
+
var frame = (content, meta) => ({ jsonrpc: "2.0", method: "notifications/claude/channel", params: { content, meta } });
|
|
71229
|
+
function letterNotification(letter) {
|
|
71230
|
+
return frame(`${sender(letter)}: ${letter.summary}
|
|
71231
|
+
${readHint}`, { kind: "letter", letter_id: letter.id, sender: letter.sender, ...letter.sender_name ? { sender_name: letter.sender_name } : {} });
|
|
71232
|
+
}
|
|
71233
|
+
function backlogNotification(letters) {
|
|
71234
|
+
const named = letters.slice(0, BACKLOG_NAMED).map((letter) => `${sender(letter)}: ${letter.summary} (${letter.id})`);
|
|
71235
|
+
const more = letters.length > BACKLOG_NAMED ? `; ${letters.length - BACKLOG_NAMED} more` : "";
|
|
71236
|
+
return frame(`${letters.length} unread letter(s) waiting: ${named.join("; ")}${more}
|
|
71237
|
+
${readHint}`, { kind: "letter", letter_id: letters[0].id, sender: letters[0].sender, count: String(letters.length) });
|
|
71238
|
+
}
|
|
71239
|
+
function ritualNotification(ritual) {
|
|
71240
|
+
return frame(`New memory: "${ritual.title}"${ritual.owner ? ` (${ritual.owner}${ritual.ritual ? ` ${ritual.ritual}` : ""})` : ""}. Your knowledge is refreshed.`, { kind: "ritual", ...ritual.ritual ? { ritual: ritual.ritual } : {}, ...ritual.engram ? { engram: ritual.engram } : {} });
|
|
71241
|
+
}
|
|
71242
|
+
async function runChannel(ports) {
|
|
71243
|
+
const stop = new AbortController;
|
|
71244
|
+
const seen = new Set;
|
|
71245
|
+
let lastEventId = null;
|
|
71246
|
+
let follower = null;
|
|
71247
|
+
const fresh = (letters) => letters.filter((letter) => !seen.has(letter.id) && (seen.add(letter.id), true));
|
|
71248
|
+
const catchUp = async () => {
|
|
71249
|
+
const letters = fresh((await ports.fetchLetters()).letters);
|
|
71250
|
+
if (letters.length)
|
|
71251
|
+
ports.send(backlogNotification(letters));
|
|
71252
|
+
};
|
|
71253
|
+
const follow = async () => {
|
|
71254
|
+
let failures = 0;
|
|
71255
|
+
while (!stop.signal.aborted) {
|
|
71256
|
+
if (failures)
|
|
71257
|
+
await ports.sleep(backoffMs(failures), stop.signal);
|
|
71258
|
+
if (stop.signal.aborted)
|
|
71259
|
+
break;
|
|
71260
|
+
try {
|
|
71261
|
+
const opened = await ports.openStream(stop.signal, lastEventId);
|
|
71262
|
+
if (opened.status < 200 || opened.status >= 300 || !opened.chunks) {
|
|
71263
|
+
if (!retryableStatus(opened.status)) {
|
|
71264
|
+
ports.log(`assume-channel: the event stream was refused (HTTP ${opened.status}${opened.reason ? `: ${opened.reason}` : ""})`);
|
|
71265
|
+
return;
|
|
71266
|
+
}
|
|
71267
|
+
throw new Error(`HTTP ${opened.status}`);
|
|
71268
|
+
}
|
|
71269
|
+
try {
|
|
71270
|
+
await catchUp();
|
|
71271
|
+
} catch (error) {
|
|
71272
|
+
ports.log(`assume-channel: reading letters failed: ${error instanceof Error ? error.message : error}`);
|
|
71273
|
+
}
|
|
71274
|
+
if (failures)
|
|
71275
|
+
ports.log("assume-channel: event stream reconnected");
|
|
71276
|
+
failures = 0;
|
|
71277
|
+
let buffer2 = "";
|
|
71278
|
+
for await (const chunk of opened.chunks) {
|
|
71279
|
+
const fed = feedSse(buffer2, chunk);
|
|
71280
|
+
buffer2 = fed.buffer;
|
|
71281
|
+
for (const raw of fed.frames) {
|
|
71282
|
+
const wake = wakeOf(raw);
|
|
71283
|
+
if (wake === null)
|
|
71284
|
+
continue;
|
|
71285
|
+
if (raw.id !== undefined)
|
|
71286
|
+
lastEventId = raw.id;
|
|
71287
|
+
if (wake.kind === "letter") {
|
|
71288
|
+
if (fresh([wake.letter]).length)
|
|
71289
|
+
ports.send(letterNotification(wake.letter));
|
|
71290
|
+
} else
|
|
71291
|
+
ports.send(ritualNotification(wake.ritual));
|
|
71292
|
+
}
|
|
71293
|
+
}
|
|
71294
|
+
throw new Error("the event stream ended");
|
|
71295
|
+
} catch (error) {
|
|
71296
|
+
if (stop.signal.aborted)
|
|
71297
|
+
break;
|
|
71298
|
+
failures += 1;
|
|
71299
|
+
ports.log(`assume-channel: ${error instanceof Error ? error.message : error} (${failures} in a row, reconnecting in ${backoffMs(failures) / 1000}s)`);
|
|
71300
|
+
}
|
|
71301
|
+
}
|
|
71302
|
+
};
|
|
71303
|
+
let buffer = "";
|
|
71304
|
+
const handle = (line) => {
|
|
71305
|
+
if (!line.trim())
|
|
71306
|
+
return;
|
|
71307
|
+
let message2;
|
|
71308
|
+
try {
|
|
71309
|
+
message2 = JSON.parse(line);
|
|
71310
|
+
} catch {
|
|
71311
|
+
ports.log("assume-channel: ignored a line that is not JSON");
|
|
71312
|
+
return;
|
|
71313
|
+
}
|
|
71314
|
+
const reply = replyTo(message2, ports.agent);
|
|
71315
|
+
if (reply)
|
|
71316
|
+
ports.send(reply);
|
|
71317
|
+
if (message2.method === "notifications/initialized" && follower === null)
|
|
71318
|
+
follower = follow();
|
|
71319
|
+
};
|
|
71320
|
+
for await (const chunk of ports.input) {
|
|
71321
|
+
buffer += chunk;
|
|
71322
|
+
const lines = buffer.split(`
|
|
71323
|
+
`);
|
|
71324
|
+
buffer = lines.pop() ?? "";
|
|
71325
|
+
for (const line of lines)
|
|
71326
|
+
handle(line);
|
|
71327
|
+
}
|
|
71328
|
+
handle(buffer);
|
|
71329
|
+
stop.abort();
|
|
71330
|
+
await follower;
|
|
71331
|
+
return 0;
|
|
71332
|
+
}
|
|
71333
|
+
|
|
71334
|
+
// src/commands/agent-memory.ts
|
|
71335
|
+
var MEMORY_TOOL = "praxis_assume_memory";
|
|
71336
|
+
var RECALL_TOOL = "praxis_assume_recall";
|
|
71337
|
+
var REMEMBER_TOOL = "praxis_assume_remember";
|
|
71338
|
+
function mcpUrl(apiUrl, agent) {
|
|
71339
|
+
return `${apiUrl}/agent/v1/agents/${encodeURIComponent(agent)}/mcp`;
|
|
71340
|
+
}
|
|
71341
|
+
function rpcAnswerOf(body, id) {
|
|
71342
|
+
const candidates2 = body.trimStart().startsWith("{") ? [body] : body.split(`
|
|
71343
|
+
`).filter((line) => line.startsWith("data:")).map((line) => line.slice(5).trim());
|
|
71344
|
+
for (const candidate of candidates2) {
|
|
71345
|
+
try {
|
|
71346
|
+
const parsed = JSON.parse(candidate);
|
|
71347
|
+
if (parsed.id === id)
|
|
71348
|
+
return parsed;
|
|
71349
|
+
} catch {}
|
|
71350
|
+
}
|
|
71351
|
+
return null;
|
|
71352
|
+
}
|
|
71353
|
+
function toolTextOf(result) {
|
|
71354
|
+
const value = result;
|
|
71355
|
+
const text3 = (value?.content ?? []).filter((part) => part.type === "text" && typeof part.text === "string").map((part) => part.text).join(`
|
|
71356
|
+
`).trim();
|
|
71357
|
+
return value?.isError === true ? { ok: false, reason: text3 || "the tool refused" } : { ok: true, text: text3 };
|
|
71358
|
+
}
|
|
71359
|
+
async function callAgentTool(ports, url, name, args, signal) {
|
|
71360
|
+
const base = { ...await ports.headers(), "Content-Type": "application/json", Accept: "application/json, text/event-stream" };
|
|
71361
|
+
const post = (body, session2) => ports.fetch(url, {
|
|
71362
|
+
method: "POST",
|
|
71363
|
+
headers: { ...base, ...session2 === undefined ? {} : { "Mcp-Session-Id": session2 } },
|
|
71364
|
+
body: JSON.stringify(body),
|
|
71365
|
+
...signal === undefined ? {} : { signal },
|
|
71366
|
+
redirect: "error"
|
|
71367
|
+
});
|
|
71368
|
+
const init = await post({ jsonrpc: "2.0", id: 1, method: "initialize", params: {
|
|
71369
|
+
protocolVersion: "2025-06-18",
|
|
71370
|
+
capabilities: {},
|
|
71371
|
+
clientInfo: { name: "praxis-cli-memory", version: "1" }
|
|
71372
|
+
} });
|
|
71373
|
+
const initBody = await init.text();
|
|
71374
|
+
if (!init.ok)
|
|
71375
|
+
throw new Error(`HTTP ${init.status} on initialize`);
|
|
71376
|
+
const session = init.headers.get("Mcp-Session-Id") ?? undefined;
|
|
71377
|
+
const initAnswer = rpcAnswerOf(initBody, 1);
|
|
71378
|
+
if (initAnswer?.error)
|
|
71379
|
+
throw new Error(initAnswer.error.message ?? "initialize failed");
|
|
71380
|
+
await post({ jsonrpc: "2.0", method: "notifications/initialized" }, session).then((r) => r.text()).catch(() => "");
|
|
71381
|
+
const call3 = await post({ jsonrpc: "2.0", id: 2, method: "tools/call", params: { name, arguments: args } }, session);
|
|
71382
|
+
const callBody = await call3.text();
|
|
71383
|
+
if (!call3.ok)
|
|
71384
|
+
throw new Error(`HTTP ${call3.status} on ${name}`);
|
|
71385
|
+
const answer = rpcAnswerOf(callBody, 2);
|
|
71386
|
+
if (answer === null)
|
|
71387
|
+
throw new Error(`no answer from ${name}`);
|
|
71388
|
+
if (answer.error)
|
|
71389
|
+
throw new Error(answer.error.message ?? `${name} failed`);
|
|
71390
|
+
const text3 = toolTextOf(answer.result);
|
|
71391
|
+
if (!text3.ok)
|
|
71392
|
+
throw new Error(text3.reason);
|
|
71393
|
+
return text3.text;
|
|
71394
|
+
}
|
|
71395
|
+
function memoryBodyOf(text3) {
|
|
71396
|
+
return text3.split(`
|
|
71397
|
+
`).filter((line) => {
|
|
71398
|
+
const trimmed = line.trim();
|
|
71399
|
+
return !/^shell: acon_/.test(trimmed) && !/^你有 \d+ 封未读信/.test(trimmed) && !/^You have \d+ unread letter/.test(trimmed);
|
|
71400
|
+
}).join(`
|
|
71401
|
+
`).trim();
|
|
71402
|
+
}
|
|
71403
|
+
function paragraphKey(paragraph) {
|
|
71404
|
+
return paragraph.replace(/\s*\[n\d+\]/g, "").replace(/\s+/g, " ").trim();
|
|
71405
|
+
}
|
|
71406
|
+
function newParagraphs(memory, seen) {
|
|
71407
|
+
const seenKeys = new Set([...seen].map(paragraphKey));
|
|
71408
|
+
return memory.split(/\n{2,}/).map((part) => part.trim()).filter((part) => part !== "" && !seenKeys.has(paragraphKey(part)));
|
|
71409
|
+
}
|
|
71410
|
+
var MEMORY_FRAME = (body) => `<memory source="praxis-assume" note="your memory as this agent, drawn from your organization just now; recall with praxis_assume_recall">
|
|
71411
|
+
${body}
|
|
71412
|
+
</memory>`;
|
|
71413
|
+
var MEMORY_CHANGED_FRAME = (body) => `<memory_since_start source="praxis-assume" note="what came to mind since this conversation last read your memory">
|
|
71414
|
+
${body}
|
|
71415
|
+
</memory_since_start>`;
|
|
71416
|
+
function hookOutput(event, context) {
|
|
71417
|
+
if (context === null || context.trim() === "")
|
|
71418
|
+
return null;
|
|
71419
|
+
return JSON.stringify({ hookSpecificOutput: { hookEventName: event, additionalContext: context } });
|
|
71420
|
+
}
|
|
71421
|
+
function hookInputOf(raw) {
|
|
71422
|
+
try {
|
|
71423
|
+
const parsed = JSON.parse(raw);
|
|
71424
|
+
const sessionId = typeof parsed.session_id === "string" && /^[A-Za-z0-9_-]{1,128}$/.test(parsed.session_id) ? parsed.session_id : null;
|
|
71425
|
+
return { sessionId, source: typeof parsed.source === "string" ? parsed.source : null };
|
|
71426
|
+
} catch {
|
|
71427
|
+
return { sessionId: null, source: null };
|
|
71428
|
+
}
|
|
71429
|
+
}
|
|
71430
|
+
async function runMemoryHook(event, input, ports) {
|
|
71431
|
+
try {
|
|
71432
|
+
const memory = memoryBodyOf(await callAgentTool(ports, ports.url, MEMORY_TOOL, {}, AbortSignal.timeout(ports.timeoutMs)));
|
|
71433
|
+
if (memory === "")
|
|
71434
|
+
return null;
|
|
71435
|
+
const all = newParagraphs(memory, new Set);
|
|
71436
|
+
if (event === "SessionStart") {
|
|
71437
|
+
if (input.sessionId !== null)
|
|
71438
|
+
await ports.writeSeen(input.sessionId, all).catch(() => {
|
|
71439
|
+
return;
|
|
71440
|
+
});
|
|
71441
|
+
return hookOutput(event, MEMORY_FRAME(memory));
|
|
71442
|
+
}
|
|
71443
|
+
const seen = input.sessionId === null ? [] : await ports.readSeen(input.sessionId).catch(() => []);
|
|
71444
|
+
const fresh = newParagraphs(memory, new Set(seen));
|
|
71445
|
+
if (fresh.length === 0)
|
|
71446
|
+
return null;
|
|
71447
|
+
if (input.sessionId !== null)
|
|
71448
|
+
await ports.writeSeen(input.sessionId, [...seen, ...fresh]).catch(() => {
|
|
71449
|
+
return;
|
|
71450
|
+
});
|
|
71451
|
+
return hookOutput(event, MEMORY_CHANGED_FRAME(fresh.join(`
|
|
71452
|
+
|
|
71453
|
+
`)));
|
|
71454
|
+
} catch {
|
|
71455
|
+
return null;
|
|
71456
|
+
}
|
|
71457
|
+
}
|
|
71458
|
+
|
|
69908
71459
|
// src/main.ts
|
|
69909
71460
|
import { spawnSync } from "node:child_process";
|
|
69910
71461
|
|
|
@@ -70519,11 +72070,11 @@ function startProgress(ctx, write = (text3) => writeOutput({ stderr: text3 })) {
|
|
|
70519
72070
|
if (ctx.mode !== "human" || !ctx.stderrIsTTY)
|
|
70520
72071
|
return () => {};
|
|
70521
72072
|
let interval;
|
|
70522
|
-
let shown = false,
|
|
72073
|
+
let shown = false, frame2 = 0;
|
|
70523
72074
|
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
70524
72075
|
const tick = () => {
|
|
70525
72076
|
shown = true;
|
|
70526
|
-
write(`\r${frames[
|
|
72077
|
+
write(`\r${frames[frame2++ % frames.length]} Loading…`);
|
|
70527
72078
|
};
|
|
70528
72079
|
const timer = setTimeout(() => {
|
|
70529
72080
|
tick();
|
|
@@ -70541,7 +72092,7 @@ function startProgress(ctx, write = (text3) => writeOutput({ stderr: text3 })) {
|
|
|
70541
72092
|
}
|
|
70542
72093
|
|
|
70543
72094
|
// src/main.ts
|
|
70544
|
-
var version = "0.3.0-dev.
|
|
72095
|
+
var version = "0.3.0-dev.99bbb95";
|
|
70545
72096
|
var commands = commandTree(operations);
|
|
70546
72097
|
var manual = [...workflows.map((w) => w.words), [API_WORD]];
|
|
70547
72098
|
function route(argv) {
|
|
@@ -70720,6 +72271,17 @@ var appOptions = {
|
|
|
70720
72271
|
{ name: "report", type: "boolean", description: "Post this checkout's scan to the platform, so archiving a flag is refused while code still names it (ADR-125 §4)." },
|
|
70721
72272
|
{ name: "project", type: "string", description: "With --report: the DevOps project id (dvp_…) whose flags the scan is reported into. Required." }
|
|
70722
72273
|
],
|
|
72274
|
+
"agent memory": [
|
|
72275
|
+
{ name: "hook", type: "string", description: "Run as a Claude Code hook (SessionStart or UserPromptSubmit): read the hook input on stdin, print the hook JSON or nothing, always exit 0." }
|
|
72276
|
+
],
|
|
72277
|
+
"agent recall": [
|
|
72278
|
+
{ name: "words", type: "string", repeated: true, description: "Distinctive words to recall by, comma-separated or repeated." },
|
|
72279
|
+
{ name: "handles", type: "string", repeated: true, description: "Entry handles or ids from memory to recall, comma-separated or repeated." }
|
|
72280
|
+
],
|
|
72281
|
+
"agent remember": [
|
|
72282
|
+
{ name: "text", type: "string", description: "The experience, in your own words: what happened, who, what was decided and why, what is still open." },
|
|
72283
|
+
{ name: "about", type: "string", repeated: true, description: "Ids of entities it is about, comma-separated or repeated." }
|
|
72284
|
+
],
|
|
70723
72285
|
"agent events wait": [
|
|
70724
72286
|
{ name: "timeout", type: "string", description: "Give up after this many seconds, print that nothing arrived and exit 0 (default: wait until a letter arrives)." },
|
|
70725
72287
|
{ name: "session", type: "string", description: "The Claude Code session this waiter wakes: its announced letters and pid file are kept per session, and a second waiter for the same session exits at once (default: one waiter per agent)." }
|
|
@@ -71287,6 +72849,97 @@ Examples:
|
|
|
71287
72849
|
cwd: ports.cwd
|
|
71288
72850
|
});
|
|
71289
72851
|
}
|
|
72852
|
+
case "agent events channel": {
|
|
72853
|
+
const agent = assumeAgentOf(ports.env);
|
|
72854
|
+
const headers = async () => {
|
|
72855
|
+
const credential = await auth.get(org);
|
|
72856
|
+
return { Authorization: `Bearer ${credential.token}`, ...credential.source === "api-key" ? { "X-API-Key": credential.token } : {} };
|
|
72857
|
+
};
|
|
72858
|
+
const failure2 = (status, body) => `HTTP ${status}${body?.error?.code ? ` ${body.error.code}` : ""}${body?.error?.message ? `: ${String(redact(body.error.message, secrets))}` : ""}`;
|
|
72859
|
+
process.stdin.setEncoding("utf8");
|
|
72860
|
+
return await runChannel({
|
|
72861
|
+
agent,
|
|
72862
|
+
input: process.stdin,
|
|
72863
|
+
send: (frame2) => {
|
|
72864
|
+
process.stdout.write(JSON.stringify(frame2) + `
|
|
72865
|
+
`);
|
|
72866
|
+
},
|
|
72867
|
+
fetchLetters: async () => {
|
|
72868
|
+
const response = await wireFetch(inboxLettersUrl(config.apiUrl, agent), { headers: await headers(), signal: AbortSignal.timeout(30000), redirect: "error" });
|
|
72869
|
+
const body = await response.json().catch(() => null);
|
|
72870
|
+
if (!response.ok)
|
|
72871
|
+
throw new Error(failure2(response.status, body));
|
|
72872
|
+
return lettersOf(body);
|
|
72873
|
+
},
|
|
72874
|
+
openStream: async (signal, lastEventId) => {
|
|
72875
|
+
const response = await wireFetch(eventsStreamUrl(config.apiUrl, agent), { headers: streamHeaders(await headers(), lastEventId), signal, redirect: "error" });
|
|
72876
|
+
if (!response.ok || !response.body) {
|
|
72877
|
+
const body = await response.json().catch(() => null);
|
|
72878
|
+
return { status: response.status, reason: failure2(response.status, body) };
|
|
72879
|
+
}
|
|
72880
|
+
return { status: response.status, chunks: response.body.pipeThrough(new TextDecoderStream) };
|
|
72881
|
+
},
|
|
72882
|
+
sleep: (ms, signal) => new Promise((resolve12) => {
|
|
72883
|
+
const timer = setTimeout(resolve12, ms);
|
|
72884
|
+
signal.addEventListener("abort", () => {
|
|
72885
|
+
clearTimeout(timer);
|
|
72886
|
+
resolve12();
|
|
72887
|
+
}, { once: true });
|
|
72888
|
+
}),
|
|
72889
|
+
log: (line) => {
|
|
72890
|
+
process.stderr.write(String(redact(line, secrets)) + `
|
|
72891
|
+
`);
|
|
72892
|
+
}
|
|
72893
|
+
});
|
|
72894
|
+
}
|
|
72895
|
+
case "agent memory":
|
|
72896
|
+
case "agent recall":
|
|
72897
|
+
case "agent remember": {
|
|
72898
|
+
const agent = assumeAgentOf(ports.env);
|
|
72899
|
+
const mcpPorts = {
|
|
72900
|
+
fetch: (url2, init) => wireFetch(url2, init),
|
|
72901
|
+
headers: async () => {
|
|
72902
|
+
const credential = await auth.get(org);
|
|
72903
|
+
return { Authorization: `Bearer ${credential.token}`, ...credential.source === "api-key" ? { "X-API-Key": credential.token } : {} };
|
|
72904
|
+
}
|
|
72905
|
+
};
|
|
72906
|
+
const url = mcpUrl(config.apiUrl, agent);
|
|
72907
|
+
const hook = parsed.flags.hook?.[0];
|
|
72908
|
+
if (name === "agent memory" && hook !== undefined) {
|
|
72909
|
+
if (hook !== "SessionStart" && hook !== "UserPromptSubmit")
|
|
72910
|
+
throw new UsageError(`--hook takes SessionStart or UserPromptSubmit, not ${hook}`, "Example: praxis agent memory --hook SessionStart");
|
|
72911
|
+
process.stdin.setEncoding("utf8");
|
|
72912
|
+
let raw = "";
|
|
72913
|
+
if (!process.stdin.isTTY)
|
|
72914
|
+
for await (const chunk of process.stdin)
|
|
72915
|
+
raw += chunk;
|
|
72916
|
+
const input = hookInputOf(raw);
|
|
72917
|
+
const seenDir = join12(ports.env.HOME || homedir3(), ".praxis", "cli", "memory-seen");
|
|
72918
|
+
const out = await runMemoryHook(hook, input, {
|
|
72919
|
+
...mcpPorts,
|
|
72920
|
+
url,
|
|
72921
|
+
timeoutMs: 25000,
|
|
72922
|
+
readSeen: async (id) => JSON.parse(await readFile7(join12(seenDir, `${id}.json`), "utf8")),
|
|
72923
|
+
writeSeen: async (id, paragraphs) => {
|
|
72924
|
+
await mkdir4(seenDir, { recursive: true, mode: 448 });
|
|
72925
|
+
await writeFile5(join12(seenDir, `${id}.json`), JSON.stringify(paragraphs), { mode: 384 });
|
|
72926
|
+
}
|
|
72927
|
+
});
|
|
72928
|
+
if (out !== null)
|
|
72929
|
+
process.stdout.write(out + `
|
|
72930
|
+
`);
|
|
72931
|
+
return 0;
|
|
72932
|
+
}
|
|
72933
|
+
const list = (flag) => (parsed.flags[flag] ?? []).flatMap((value) => value.split(",")).map((value) => value.trim()).filter(Boolean);
|
|
72934
|
+
const args = name === "agent recall" ? { ...list("handles").length ? { handles: list("handles") } : {}, ...list("words").length ? { words: list("words") } : {} } : name === "agent remember" ? { text: parsed.flags.text?.[0] ?? "", ...list("about").length ? { about: list("about") } : {} } : {};
|
|
72935
|
+
if (name === "agent remember" && String(args.text).trim() === "")
|
|
72936
|
+
throw new UsageError("--text is required", 'Example: praxis agent remember --text "今天定了……"');
|
|
72937
|
+
const tool = name === "agent memory" ? MEMORY_TOOL : name === "agent recall" ? RECALL_TOOL : REMEMBER_TOOL;
|
|
72938
|
+
const text3 = memoryBodyOf(await callAgentTool(mcpPorts, url, tool, args, AbortSignal.timeout(60000)));
|
|
72939
|
+
process.stdout.write(text3 + `
|
|
72940
|
+
`);
|
|
72941
|
+
return 0;
|
|
72942
|
+
}
|
|
71290
72943
|
case "agent events wait": {
|
|
71291
72944
|
const agent = assumeAgentOf(ports.env);
|
|
71292
72945
|
const timeoutMs = (() => {
|
|
@@ -71444,7 +73097,7 @@ Examples:
|
|
|
71444
73097
|
file: parsed.positional[0],
|
|
71445
73098
|
name: parsed.flags.name?.[0],
|
|
71446
73099
|
canvas: parsed.flags.canvas?.[0],
|
|
71447
|
-
frames: typeof parsed.flags.frames?.[0] === "string" ? parsed.flags.frames[0].split(",").map((
|
|
73100
|
+
frames: typeof parsed.flags.frames?.[0] === "string" ? parsed.flags.frames[0].split(",").map((frame2) => frame2.trim()).filter(Boolean) : undefined,
|
|
71448
73101
|
imageRoots: parsed.flags["image-root"],
|
|
71449
73102
|
dryRun: Boolean(parsed.flags["dry-run"]?.[0]),
|
|
71450
73103
|
yes: Boolean(flags.yes)
|