@deepraxis/cli 0.3.0-dev.9515f27 → 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 +38 -5
- package/dist/praxis.js +3201 -319
- package/package.json +4 -1
package/dist/praxis.js
CHANGED
|
@@ -13983,8 +13983,22 @@ 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" },
|
|
13990
|
+
crm: { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_rv860m7z9h8szkgma56cd14n", ticket: 2179, expires: "2026-12-31", system: "devops" },
|
|
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" },
|
|
13994
|
+
"model-access-gate": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 1933, expires: "2026-12-15", system: "devops" },
|
|
13987
13995
|
"open-project": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-51", ticket: 1488, expires: "2026-11-25", system: "devops" },
|
|
13996
|
+
"requests-never-hold": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2119, expires: "2026-11-29", system: "devops" },
|
|
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" },
|
|
14000
|
+
"router-precommit-hedge": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2052, expires: "2026-11-28", system: "devops" },
|
|
14001
|
+
"router-responses-hedge": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2149, expires: "2026-11-28", system: "devops" },
|
|
13988
14002
|
"search-provider-routing": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-98", ticket: 716, expires: "2026-12-31", system: "devops" },
|
|
13989
14003
|
"unit-live-probe": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: null, expires: "2026-11-19", system: "devops" }
|
|
13990
14004
|
};
|
|
@@ -14011,7 +14025,7 @@ function checkFlags(files, registry, today = new Date().toISOString().slice(0, 1
|
|
|
14011
14025
|
}
|
|
14012
14026
|
const registryFile = production.find((f) => f.path.endsWith("flag-registry.generated.ts"));
|
|
14013
14027
|
const registryLine = (key) => registryFile ? lineOf(registryFile.text, Math.max(0, registryFile.text.indexOf(`"${key}":`))) : 1;
|
|
14014
|
-
const add = (file, offset,
|
|
14028
|
+
const add = (file, offset, message2) => issues.push({ file: file.path, line: lineOf(file.text, offset), message: message2 });
|
|
14015
14029
|
const referencedKeysIn = (file) => {
|
|
14016
14030
|
for (const key of registered) {
|
|
14017
14031
|
const literal = new RegExp(`(?:"|')${key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?:"|')`);
|
|
@@ -14030,6 +14044,8 @@ function checkFlags(files, registry, today = new Date().toISOString().slice(0, 1
|
|
|
14030
14044
|
add(f, browserList.index + entry.index, `unregistered browser flag key "${entry[1]}"`);
|
|
14031
14045
|
}
|
|
14032
14046
|
}
|
|
14047
|
+
if (/\.generated\.[cm]?[jt]sx?$/.test(f.path))
|
|
14048
|
+
continue;
|
|
14033
14049
|
const calls = /(\.bool|\breadBrowserFlag|\buseBrowserFlag)\s*\(\s*([^,)\n]+)/g;
|
|
14034
14050
|
for (const m of f.text.matchAll(calls)) {
|
|
14035
14051
|
if (/function\s*$/.test(f.text.slice(Math.max(0, m.index - 20), m.index)))
|
|
@@ -14098,7 +14114,7 @@ async function main() {
|
|
|
14098
14114
|
else
|
|
14099
14115
|
console.log(`Feature flag registry check passed (${Object.keys(FLAGS).length} registered flags).`);
|
|
14100
14116
|
}
|
|
14101
|
-
var isTest = (path) => /(^|\/)(spec|__tests__)(\/|$)|\.(test|spec)\.[cm]?[jt]sx?$/.test(path), lineOf = (
|
|
14117
|
+
var isTest = (path) => /(^|\/)(spec|__tests__)(\/|$)|\.(test|spec)\.[cm]?[jt]sx?$/.test(path), lineOf = (text3, offset) => text3.slice(0, offset).split(`
|
|
14102
14118
|
`).length, isCalendarDate = (value) => /^\d{4}-\d{2}-\d{2}$/.test(value) && !Number.isNaN(new Date(`${value}T00:00:00.000Z`).valueOf()) && new Date(`${value}T00:00:00.000Z`).toISOString().slice(0, 10) === value;
|
|
14103
14119
|
var init_check_flags = __esm(() => {
|
|
14104
14120
|
init_flag_registry_generated();
|
|
@@ -14296,7 +14312,7 @@ async function checkRegistrySync(ports = {}) {
|
|
|
14296
14312
|
}
|
|
14297
14313
|
async function syncFlags(ports = {}) {
|
|
14298
14314
|
const registry = ports.registry ?? registryUrl;
|
|
14299
|
-
const write = ports.write ?? ((target,
|
|
14315
|
+
const write = ports.write ?? ((target, text3) => writeFile4(target, text3));
|
|
14300
14316
|
const log = ports.log ?? console.log;
|
|
14301
14317
|
const error = ports.error ?? console.error;
|
|
14302
14318
|
const devops = await (ports.devops ?? readDevopsFlags)();
|
|
@@ -14533,12 +14549,13 @@ async function runEngineDelegation(delegation, options) {
|
|
|
14533
14549
|
}
|
|
14534
14550
|
|
|
14535
14551
|
// src/main.ts
|
|
14536
|
-
import { existsSync as existsSync4 } from "node:fs";
|
|
14552
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, unlinkSync } from "node:fs";
|
|
14537
14553
|
import { mkdir as mkdir4, readFile as readFile7, readdir as readdir3, writeFile as writeFile5 } from "node:fs/promises";
|
|
14538
|
-
import { resolve as resolve11 } from "node:path";
|
|
14554
|
+
import { dirname as dirname10, join as join12, resolve as resolve11 } from "node:path";
|
|
14555
|
+
import { homedir as homedir3 } from "node:os";
|
|
14539
14556
|
import { pathToFileURL } from "node:url";
|
|
14540
14557
|
import { createHash as createHash5 } from "node:crypto";
|
|
14541
|
-
import { spawn as
|
|
14558
|
+
import { spawn as spawn5 } from "node:child_process";
|
|
14542
14559
|
import { createInterface } from "node:readline";
|
|
14543
14560
|
|
|
14544
14561
|
// ../../packages/sdk/typescript/src/operations.generated.ts
|
|
@@ -15593,8 +15610,8 @@ Idempotent. Access tokens revoked while the customer was blocked stay revoked; s
|
|
|
15593
15610
|
{
|
|
15594
15611
|
resource: "agent.agents.events",
|
|
15595
15612
|
method: "stream",
|
|
15596
|
-
summary: "Follow
|
|
15597
|
-
description: "Follow
|
|
15613
|
+
summary: "Follow an agent live",
|
|
15614
|
+
description: "Follow an agent live over Server-Sent Events. For a personal or general agent it is the stream of your own main session with that agent, the same stream sessions.events.stream opens, event_deltas[] previews included; read past events with agents.events.list. An assume agent has no main session: its body is its MCP connections, and this stream is its broadcast point, which every live connection of the agent hears at once. It carries two events, each with an SSE id: inbox.letter_delivered { letter_id, sender, sender_name, summary, thread, create_time } when a letter arrives (the letter stays unread; take it with the agent's inbox tool, the body is not in the event), and cognition.ritual_held { ritual, owner, title, engram, create_time } when a domain gives the agent a memory. Reconnect with the Last-Event-ID header to receive what you missed from a short recent buffer (about an hour); a first connection replays nothing, so read agents.inbox.letters.list for mail already waiting. {agent_id} takes the agent_… id, the eight character identity number or the handle; a service agent answers 400. Closing the stream only drops your subscription and does not stop the agent.",
|
|
15598
15615
|
http: "GET",
|
|
15599
15616
|
path: "/agent/v1/agents/{agent_id}/events/stream",
|
|
15600
15617
|
streaming: "always",
|
|
@@ -15620,6 +15637,40 @@ Idempotent. Access tokens revoked while the customer was blocked stay revoked; s
|
|
|
15620
15637
|
}
|
|
15621
15638
|
]
|
|
15622
15639
|
},
|
|
15640
|
+
{
|
|
15641
|
+
resource: "agent.agents.inbox.letters",
|
|
15642
|
+
method: "list",
|
|
15643
|
+
summary: "List an assume agent's waiting letters",
|
|
15644
|
+
description: "Check whether mail waits for an assume agent without taking it: answers unread, the count of delivered letters the agent has not read, and letters, the newest unread ones (id, sender address, summary, thread, create_time; never the body). Nothing is marked read, so calling it again answers the same until the agent reads its mail with its own inbox tool (praxis_assume_inbox, action \"read\"). Use it when something outside the agent has to learn that mail arrived: the local `praxis agent events wait` reads it once on start and after every reconnect to its agent's event stream, so no letter that arrived while nothing listened is missed. {agent_id} takes the agent_… id, the eight character identity number or the handle of an assume agent in your organization; any other kind answers 400 ASSUME_AGENT_REQUIRED. To read or answer the letters, use the agent's inbox tool, not this read. Example: GET /agent/v1/agents/R1M9TQ2X/inbox/letters?unread=true&limit=5.",
|
|
15645
|
+
http: "GET",
|
|
15646
|
+
path: "/agent/v1/agents/{agent_id}/inbox/letters",
|
|
15647
|
+
streaming: "no",
|
|
15648
|
+
pagination: false,
|
|
15649
|
+
pathParams: [
|
|
15650
|
+
{
|
|
15651
|
+
name: "agent_id",
|
|
15652
|
+
sdkName: "agent_id",
|
|
15653
|
+
description: "The assume agent: its agent_… id, eight character identity number or handle, from agents.list or the praxis-assume MCP URL; resolved in your organization. Also accepts an 8-character identity number (0–9, A–Z); malformed, absent and foreign references return 404, and response ids always use agent_…."
|
|
15654
|
+
}
|
|
15655
|
+
],
|
|
15656
|
+
query: [
|
|
15657
|
+
{
|
|
15658
|
+
name: "unread",
|
|
15659
|
+
type: "boolean",
|
|
15660
|
+
enum: [
|
|
15661
|
+
true
|
|
15662
|
+
],
|
|
15663
|
+
required: false,
|
|
15664
|
+
description: "Only true is accepted, which is also the default; this read lists waiting (unread) letters and nothing else."
|
|
15665
|
+
},
|
|
15666
|
+
{
|
|
15667
|
+
name: "limit",
|
|
15668
|
+
type: "integer",
|
|
15669
|
+
required: false,
|
|
15670
|
+
description: "How many of the newest unread letters to return, 1 to 50 (default 20); unread always counts every waiting letter."
|
|
15671
|
+
}
|
|
15672
|
+
]
|
|
15673
|
+
},
|
|
15623
15674
|
{
|
|
15624
15675
|
resource: "agent.agents.unarchive",
|
|
15625
15676
|
method: "create",
|
|
@@ -15982,18 +16033,14 @@ Praxis extension: the preview conversion endpoint. The browser never parses an u
|
|
|
15982
16033
|
description: "Computer id (cmp_...), as returned by computers.create or computers.list."
|
|
15983
16034
|
}
|
|
15984
16035
|
],
|
|
15985
|
-
query: [
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
description: "Name of the entry or object."
|
|
15994
|
-
}
|
|
15995
|
-
]
|
|
15996
|
-
}
|
|
16036
|
+
query: [
|
|
16037
|
+
{
|
|
16038
|
+
name: "path",
|
|
16039
|
+
type: "string",
|
|
16040
|
+
required: true,
|
|
16041
|
+
description: "Absolute path of the document on the computer, for example /home/user/workspace/deck.pptx. The request has no body."
|
|
16042
|
+
}
|
|
16043
|
+
]
|
|
15997
16044
|
},
|
|
15998
16045
|
{
|
|
15999
16046
|
resource: "agent.computers.leases",
|
|
@@ -16985,6 +17032,68 @@ delete it. Omit the field to preserve.`
|
|
|
16985
17032
|
],
|
|
16986
17033
|
query: []
|
|
16987
17034
|
},
|
|
17035
|
+
{
|
|
17036
|
+
resource: "agent.sessions.artifacts",
|
|
17037
|
+
method: "list",
|
|
17038
|
+
summary: "List Session Artifacts (Extension)",
|
|
17039
|
+
description: `List the files this session delivered; an end-customer token reads its own session.
|
|
17040
|
+
|
|
17041
|
+
Own-face extension. Returns { data: Artifact[] } ordered by create_time. Each artifact is one file in the session outputs directory, or one canvas or media asset the reply pointed at (a part with kind object carrying object_type, object_id and href; one artifact per object, pointing at it again adds no version), with id, name, version, parts, source_hrefs, create_time and update_time. Delivering the same path again keeps the id and adds one to version. Files are captured seconds after the turn ends, so artifacts appear after session.status_idle; also watch the agent.artifact_delivered event. Whoever may read the session may read its artifacts; a session that is missing or not yours returns 404.`,
|
|
17042
|
+
http: "GET",
|
|
17043
|
+
path: "/agent/v1/sessions/{session_id}/artifacts",
|
|
17044
|
+
streaming: "no",
|
|
17045
|
+
pagination: false,
|
|
17046
|
+
pathParams: [
|
|
17047
|
+
{
|
|
17048
|
+
name: "session_id",
|
|
17049
|
+
sdkName: "session_id",
|
|
17050
|
+
description: "Session id from session creation or listing."
|
|
17051
|
+
}
|
|
17052
|
+
],
|
|
17053
|
+
query: []
|
|
17054
|
+
},
|
|
17055
|
+
{
|
|
17056
|
+
resource: "agent.sessions.artifacts.contentUrl",
|
|
17057
|
+
method: "create",
|
|
17058
|
+
summary: "Create Artifact Content URL (Extension)",
|
|
17059
|
+
description: `Mint a short-lived download address for one file of an artifact.
|
|
17060
|
+
|
|
17061
|
+
Own-face extension. The body is optional: part (index into the artifact parts, default 0) and ttl_seconds (60 to 300, default 300). Returns { url, expire_time }. The address works for minutes; do not store or log it. For an object part the address serves a snapshot picture of a canvas or the own bytes of the asset; an object that no longer exists returns 404 ARTIFACT_NOT_FOUND and a failing share service returns 502. An unknown artifact or an out-of-range part returns 404 ARTIFACT_NOT_FOUND, a session that is missing or not yours returns 404, and a ttl_seconds outside 60 to 300 returns 400.`,
|
|
17062
|
+
http: "POST",
|
|
17063
|
+
path: "/agent/v1/sessions/{session_id}/artifacts/{artifact_id}/content_url",
|
|
17064
|
+
streaming: "no",
|
|
17065
|
+
pagination: false,
|
|
17066
|
+
pathParams: [
|
|
17067
|
+
{
|
|
17068
|
+
name: "session_id",
|
|
17069
|
+
sdkName: "session_id",
|
|
17070
|
+
description: "Session id from session creation or listing."
|
|
17071
|
+
},
|
|
17072
|
+
{
|
|
17073
|
+
name: "artifact_id",
|
|
17074
|
+
sdkName: "artifact_id",
|
|
17075
|
+
description: "Artifact id (art_...) from the artifact list or an agent.artifact_delivered event."
|
|
17076
|
+
}
|
|
17077
|
+
],
|
|
17078
|
+
query: [],
|
|
17079
|
+
body: {
|
|
17080
|
+
required: false,
|
|
17081
|
+
fields: [
|
|
17082
|
+
{
|
|
17083
|
+
name: "part",
|
|
17084
|
+
type: "integer",
|
|
17085
|
+
required: false,
|
|
17086
|
+
description: "Index into the artifact's parts; defaults to 0."
|
|
17087
|
+
},
|
|
17088
|
+
{
|
|
17089
|
+
name: "ttl_seconds",
|
|
17090
|
+
type: "integer",
|
|
17091
|
+
required: false,
|
|
17092
|
+
description: "How long the address works, 60 to 300 seconds; defaults to 300."
|
|
17093
|
+
}
|
|
17094
|
+
]
|
|
17095
|
+
}
|
|
17096
|
+
},
|
|
16988
17097
|
{
|
|
16989
17098
|
resource: "agent.sessions.backgroundTasks",
|
|
16990
17099
|
method: "list",
|
|
@@ -17168,7 +17277,7 @@ Praxis extension available only on /agent/v1, following Claude Agent SDK getCont
|
|
|
17168
17277
|
resource: "agent.sessions.events",
|
|
17169
17278
|
method: "list",
|
|
17170
17279
|
summary: "List session events",
|
|
17171
|
-
description: "Read the event history of a session as a page of events, oldest first by default (order=desc for newest first). Use it after sending a message to collect the reply, to find tool calls that wait for approval or client custom tool results (session.status_idle with stop_reason requires_action lists their event_ids), or to audit a run; to follow a running session live use sessions.events.stream instead. Filter by types and by a created_at range on processed_at; pages hold at most 100 events (default 20) and next_page continues. A failed run emits session.error before session.status_terminated. Native history also includes user.steer, user.withdraw, system.notification, session.forked, session.goal_changed and session.goal_verification; these are not accepted by the /anthropic/v1 event-type filter. This operation addresses one session — normally a worker session an agent dispatched; to talk to a personal or general agent itself, use agents.events.list instead. In the path, session_id may also be `main` (your own main session with that agent) or a short session name, and either alias then requires agent_id with the agent_… id, the eight character identity number or the handle; only the own face /agent/v1 accepts an alias, /anthropic/v1 requires a real sesn_… id.",
|
|
17280
|
+
description: "Read the event history of a session as a page of events, oldest first by default (order=desc for newest first). Use it after sending a message to collect the reply, to find tool calls that wait for approval or client custom tool results (session.status_idle with stop_reason requires_action lists their event_ids; a request nobody answered within 24 hours is settled as unanswered and the session goes idle with stop_reason request_expired, which the /anthropic/v1 face shows as end_turn), or to audit a run; to follow a running session live use sessions.events.stream instead. Filter by types and by a created_at range on processed_at; pages hold at most 100 events (default 20) and next_page continues. A failed run emits session.error before session.status_terminated. Native history also includes user.steer, user.withdraw, system.notification, system.notification_suppressed (pending background notifications that hit the wake quota and started no run), system.notification_recorded, session.forked, session.goal_changed and session.goal_verification; these are not accepted by the /anthropic/v1 event-type filter. This operation addresses one session — normally a worker session an agent dispatched; to talk to a personal or general agent itself, use agents.events.list instead. In the path, session_id may also be `main` (your own main session with that agent) or a short session name, and either alias then requires agent_id with the agent_… id, the eight character identity number or the handle; only the own face /agent/v1 accepts an alias, /anthropic/v1 requires a real sesn_… id.",
|
|
17172
17281
|
http: "GET",
|
|
17173
17282
|
path: "/agent/v1/sessions/{session_id}/events",
|
|
17174
17283
|
streaming: "no",
|
|
@@ -17327,6 +17436,26 @@ Available only on /agent/v1. Use the message_id field from own-face events, not
|
|
|
17327
17436
|
]
|
|
17328
17437
|
}
|
|
17329
17438
|
},
|
|
17439
|
+
{
|
|
17440
|
+
resource: "agent.sessions.requests",
|
|
17441
|
+
method: "list",
|
|
17442
|
+
summary: "List Session Requests (Extension)",
|
|
17443
|
+
description: `List the requests a session is waiting on; an end-customer token reads its own session.
|
|
17444
|
+
|
|
17445
|
+
Own-face extension. When a session stops at session.status_idle with stop_reason requires_action, read what it waits on here instead of replaying events. Returns { data: Request[] } ordered by create_time, an empty array when nothing is pending, not paginated. Each request has id (the pending tool call id), object (request), kind (question for the ask_user_question tool, approval for any other tool that waits for permission), status (pending), tool_name, input (the same input the agent.tool_use event shows), create_time and expire_time. Answer a request as before: send a user.tool_confirmation event for its id. expire_time is set only for a session with no collaboration mode while the requests-v1 release is on (create_time plus 24 hours; an expired request counts as declined), otherwise null. Answered, expired and superseded requests are not listed, and neither are pending custom tool results (user.custom_tool_result). Whoever may read the session may read its requests; a session that is missing or not yours returns 404.`,
|
|
17446
|
+
http: "GET",
|
|
17447
|
+
path: "/agent/v1/sessions/{session_id}/requests",
|
|
17448
|
+
streaming: "no",
|
|
17449
|
+
pagination: false,
|
|
17450
|
+
pathParams: [
|
|
17451
|
+
{
|
|
17452
|
+
name: "session_id",
|
|
17453
|
+
sdkName: "session_id",
|
|
17454
|
+
description: "Session id from session creation or listing."
|
|
17455
|
+
}
|
|
17456
|
+
],
|
|
17457
|
+
query: []
|
|
17458
|
+
},
|
|
17330
17459
|
{
|
|
17331
17460
|
resource: "agent.sessions.resources",
|
|
17332
17461
|
method: "list",
|
|
@@ -25379,6 +25508,12 @@ Published at https://docs.deepraxis.com/docs/developers/cut/script-reference wit
|
|
|
25379
25508
|
- \`RippleDeleteRange\` — Cut a time range and close the gap.
|
|
25380
25509
|
- \`DeleteWords\` — Cut transcript words and ripple every track, keeping a breath.
|
|
25381
25510
|
- \`RemoveFillers\` — List and delete filler words by media's own labels; dryRun first.
|
|
25511
|
+
- \`Matte\` — Replace the clip's background with media's matte of its source, read as a luma mask.
|
|
25512
|
+
- \`EnhanceVoice\` — Replace a clip's sound with media's enhanced speech on its own audio track.
|
|
25513
|
+
- \`AlignByAudio\` — Line two recordings of the same sound up by media's measurement of their offset.
|
|
25514
|
+
- \`Reframe\` — Swap the clip's media for media's reframed take at the aspect you ask for.
|
|
25515
|
+
- \`Upscale\` — Swap the clip's media for media's upscaled take at the height you ask for.
|
|
25516
|
+
- \`Redact\` — Pixelate the faces, QR codes or text media marks, leaving the rest of the frame plain.
|
|
25382
25517
|
- \`AddTrack\` — Add a video, audio or caption track.
|
|
25383
25518
|
- \`MoveTrack\` — Move a track between layers; 0 is the topmost.
|
|
25384
25519
|
- \`UpdateTrack\` — Change a track's name, lock, gain or role.
|
|
@@ -25482,6 +25617,9 @@ Published at https://docs.deepraxis.com/docs/developers/cut/script-reference wit
|
|
|
25482
25617
|
- \`MEDIA_OFFLINE\` — The asset cannot be fetched right now.
|
|
25483
25618
|
- \`MEDIA_UNAVAILABLE\` — The asset is not usable for rendering.
|
|
25484
25619
|
- \`MEDIA_IMPORT_FAILED\` — Importing media failed.
|
|
25620
|
+
- \`MEDIA_PROCESSING\` — Media is still processing the clip; wait for the job and rerun.
|
|
25621
|
+
- \`MEDIA_PROCESSING_FAILED\` — Media's processing job failed; nothing changed.
|
|
25622
|
+
- \`ALIGNMENT_UNCERTAIN\` — \`AlignByAudio\` confidence too low; nothing changed.
|
|
25485
25623
|
- \`FRAME_OUT_OF_RANGE\` — The preview time is outside the project.
|
|
25486
25624
|
- \`PROJECT_TOO_LARGE\` — The project exceeds the size limit.
|
|
25487
25625
|
- \`RESPONSE_TOO_LARGE\` — The response would exceed its budget.
|
|
@@ -27005,7 +27143,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
27005
27143
|
resource: "devops.flags",
|
|
27006
27144
|
method: "archive",
|
|
27007
27145
|
summary: "Archive a flag",
|
|
27008
|
-
description: "Archive a flag whose code is gone: it stops evaluating in every environment, leaves the ordinary flag list and keeps its key and history. Archiving
|
|
27146
|
+
description: "Archive a flag whose code is gone: it stops evaluating in every environment, leaves the ordinary flag list and keeps its key and history. Archiving is the delete, and the platform refuses it while the last reported scan still finds the key in code or while the flag is on in an environment: a flag whose codeRefs.count is above zero is refused with FLAG_STILL_REFERENCED, and a flag whose on state is true in any environment is refused with FLAG_HAS_LIVE_RULES, so archiving succeeds only once the code that names the key is deployed away and every environment is off. The gate reads the stored scan as it stands — an out-of-date scannedCommit is not corrected for — and there is no force flag. It is irreversible through the API: there is no unarchive call, an archived flag cannot be updated or configured, and its key stays reserved, so a later create with the same key is refused; archiving an archived flag just answers it again. A flag that may come back is turned off in its environment instead. The order is: open the flag fully (`praxis api devops flag environment update`), delete the code that names the key and deploy that, run `praxis devops flag remove <key>` (local, lists the references still naming the key), then `praxis api devops flag archive <id>`, then `praxis devops flag sync` so the local registry drops it. There is no separate delete call.",
|
|
27009
27147
|
http: "POST",
|
|
27010
27148
|
path: "/devops/v1/flags/{id}:archive",
|
|
27011
27149
|
streaming: "no",
|
|
@@ -27869,6 +28007,42 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
27869
28007
|
}
|
|
27870
28008
|
}
|
|
27871
28009
|
},
|
|
28010
|
+
{
|
|
28011
|
+
resource: "devops.projects.flags",
|
|
28012
|
+
method: "reportCodeRefs",
|
|
28013
|
+
summary: "Report a project's flag code references",
|
|
28014
|
+
description: "Store one code-reference scan for a project in a single call: send the commit the scan read (scannedCommit, the checkout's `git rev-parse HEAD`) and, for every flag key the scan knows, the places code reads it ({path, line, snippet}). Send every key the checkout still expects to be referenced, including the ones found nowhere: a project flag with no entry in refs is stored with zero references, and zero is what lets `archive` see the code that named the flag is gone. A key that matches no live flag of the project — one already archived, or from another project — is returned in unknownKeys and stores nothing; reporting it is not an error. updated is how many flags were written, which is every live flag of the project because each gets a row. This is the write side of the archive gate: `POST /v1/flags/{id}:archive` refuses with FLAG_STILL_REFERENCED while the stored count is above zero, and the count it reads is exactly the one stored here. Staleness is not corrected for — the stored scannedCommit and count are used as they stand. At most 500 references are stored per flag; a longer list is truncated for storage while count still reports the true number. Reporting changes no flag's runtime behaviour.",
|
|
28015
|
+
http: "POST",
|
|
28016
|
+
path: "/devops/v1/projects/{project}/flags/code-refs",
|
|
28017
|
+
streaming: "no",
|
|
28018
|
+
pagination: false,
|
|
28019
|
+
pathParams: [
|
|
28020
|
+
{
|
|
28021
|
+
name: "project",
|
|
28022
|
+
sdkName: "project",
|
|
28023
|
+
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
28024
|
+
}
|
|
28025
|
+
],
|
|
28026
|
+
query: [],
|
|
28027
|
+
body: {
|
|
28028
|
+
required: true,
|
|
28029
|
+
fields: [
|
|
28030
|
+
{
|
|
28031
|
+
name: "scannedCommit",
|
|
28032
|
+
type: "string",
|
|
28033
|
+
required: true,
|
|
28034
|
+
description: "The commit this scan read, from `git rev-parse HEAD` in the reporting checkout; it is stored as each flag's codeRefs.scannedCommit, so a value older than the current head means the count describes the code as it was then."
|
|
28035
|
+
},
|
|
28036
|
+
{
|
|
28037
|
+
name: "refs",
|
|
28038
|
+
type: "array",
|
|
28039
|
+
itemType: "object",
|
|
28040
|
+
required: true,
|
|
28041
|
+
description: "One entry per flag key this scan judged. Send every key the checkout still expects to be referenced, including the ones found nowhere: a project flag with no entry here is stored with zero references, which is what later lets `archive` refuse only flags code still names."
|
|
28042
|
+
}
|
|
28043
|
+
]
|
|
28044
|
+
}
|
|
28045
|
+
},
|
|
27872
28046
|
{
|
|
27873
28047
|
resource: "devops.projects.promotions",
|
|
27874
28048
|
method: "list",
|
|
@@ -29805,7 +29979,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
29805
29979
|
resource: "devops.units",
|
|
29806
29980
|
method: "push",
|
|
29807
29981
|
summary: "Push a unit's branch",
|
|
29808
|
-
description: "Publish the unit's local commits to the remote for the change: the machine itself holds no git credential and cannot reach the remote, so this verb is the way work done on a unit lands. ref says what to push — branch for the change's own branch, wip for this unit's own refs/praxis/wip/<change>, or a full ref name; anything else (the default branch, another change's branch, a tag, another unit's wip ref) is refused with 400 PUSH_REF_FORBIDDEN and nothing is pushed. expectedHead is the commit you believe the remote branch is at now; DevOps checks it before signing anything, and a remote that has moved since answers 409 HEAD_MOVED with nothing pushed, so fetch first when unsure, reconcile, and send the new head. For branch the call also takes a lease on that head, so the push cannot silently overwrite work that landed in between; wip is this change's own ref and is force-pushed. On success the answer is pushedSha, the commit that landed. Commit inside the machine first, through the sandbox instance API — this verb pushes commits, it does not create them. The unit must be available with a machine and a checkout, or the call answers 409 UNIT_INVALID_STATE; a push that
|
|
29982
|
+
description: "Publish the unit's local commits to the remote for the change: the machine itself holds no git credential and cannot reach the remote, so this verb is the way work done on a unit lands. ref says what to push — branch for the change's own branch, wip for this unit's own refs/praxis/wip/<change>, or a full ref name; anything else (the default branch, another change's branch, a tag, another unit's wip ref) is refused with 400 PUSH_REF_FORBIDDEN and nothing is pushed. expectedHead is the commit you believe the remote branch is at now; DevOps checks it before signing anything, and a remote that has moved since answers 409 HEAD_MOVED with nothing pushed, so fetch first when unsure, reconcile, and send the new head. For branch the call also takes a lease on that head, so the push cannot silently overwrite work that landed in between; wip is this change's own ref and is force-pushed. On success the answer is pushedSha, the commit that landed. Commit inside the machine first, through the sandbox instance API — this verb pushes commits, it does not create them. The unit must be available with a machine and a checkout, or the call answers 409 UNIT_INVALID_STATE; a push that git refuses inside the machine answers with the cause in the error message and in details.detail (the last 4000 characters of git's output, credentials redacted) and details.exitCode (git's exit code): 409 PUSH_REJECTED_BY_HOOK when a pre-push hook such as lefthook rejected it, so read the hook output, fix the content and push again, 409 PUSH_REJECTED_NON_FAST_FORWARD when the remote moved ahead, so fetch and reconcile, 409 HEAD_MOVED when the lease on expectedHead no longer holds, and 500 PUSH_FAILED for anything else. Do not retry the same push unchanged.",
|
|
29809
29983
|
http: "POST",
|
|
29810
29984
|
path: "/devops/v1/units/{id}:push",
|
|
29811
29985
|
streaming: "no",
|
|
@@ -30141,7 +30315,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
30141
30315
|
resource: "file.uploads",
|
|
30142
30316
|
method: "createSigned",
|
|
30143
30317
|
summary: "Create a one-time upload URL",
|
|
30144
|
-
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\"}.",
|
|
30145
30319
|
http: "POST",
|
|
30146
30320
|
path: "/file/v1/uploads/signed",
|
|
30147
30321
|
streaming: "no",
|
|
@@ -31100,7 +31274,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31100
31274
|
resource: "media.libraries",
|
|
31101
31275
|
method: "list",
|
|
31102
31276
|
summary: "List libraries",
|
|
31103
|
-
description: "
|
|
31277
|
+
description: "List libraries owned by the caller, newest first. By default, deleting and deleted libraries are excluded; use status=deleting to find libraries awaiting purge. All supplied label pairs must match.",
|
|
31104
31278
|
http: "GET",
|
|
31105
31279
|
path: "/media/v1/libraries",
|
|
31106
31280
|
streaming: "no",
|
|
@@ -31223,7 +31397,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31223
31397
|
resource: "media.libraries",
|
|
31224
31398
|
method: "delete",
|
|
31225
31399
|
summary: "Delete library",
|
|
31226
|
-
description: "
|
|
31400
|
+
description: "Soft-delete an active library, returning its deleting status and purge_at deadline. Asset operations and delivery become unavailable; the library can be restored before purge_at. Repeated deletion while deleting returns the current library.",
|
|
31227
31401
|
http: "DELETE",
|
|
31228
31402
|
path: "/media/v1/libraries/{library_id}",
|
|
31229
31403
|
streaming: "no",
|
|
@@ -31241,7 +31415,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31241
31415
|
resource: "media.libraries",
|
|
31242
31416
|
method: "retrieve",
|
|
31243
31417
|
summary: "Get library",
|
|
31244
|
-
description: "
|
|
31418
|
+
description: "Read a caller-owned library’s current settings, usage and lifecycle status. A deleting library remains readable; missing, foreign or purged libraries return LIBRARY_NOT_FOUND.",
|
|
31245
31419
|
http: "GET",
|
|
31246
31420
|
path: "/media/v1/libraries/{library_id}",
|
|
31247
31421
|
streaming: "no",
|
|
@@ -31319,7 +31493,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31319
31493
|
resource: "media.libraries.assets",
|
|
31320
31494
|
method: "list",
|
|
31321
31495
|
summary: "List assets",
|
|
31322
|
-
description: "
|
|
31496
|
+
description: "List assets in an active library, newest first, optionally filtering by exact folder and stored resource type. Continue using next_cursor; video includes audio-only assets.",
|
|
31323
31497
|
http: "GET",
|
|
31324
31498
|
path: "/media/v1/libraries/{library_id}/assets",
|
|
31325
31499
|
streaming: "no",
|
|
@@ -31386,7 +31560,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31386
31560
|
resource: "media.libraries.assets",
|
|
31387
31561
|
method: "create",
|
|
31388
31562
|
summary: "Upload asset",
|
|
31389
|
-
description: " For understanding, Media generates proxies for video sources of 25 MB or more or longer than 10 minutes, and for audio-only sources of 100 MB or more; originals remain available unchanged. Long videos are supported. When a video proxy is needed and is still above 95 MB after recompression, the source is reported as UNSUPPORTED with the limit in the failure message. Proxy preparation uses the organization’s metered sandbox resources.",
|
|
31563
|
+
description: "Upload content into an active library and return the stored asset. Use file for a multipart file, data URI, public HTTPS URL or same-owner file identifier. Reusing public_id overwrites by default; overwrite=false returns the existing asset. Chunk uploads require both chunk headers. For understanding, Media generates proxies for video sources of 25 MB or more or longer than 10 minutes, and for audio-only sources of 100 MB or more; originals remain available unchanged. Long videos are supported. When a video proxy is needed and is still above 95 MB after recompression, the source is reported as UNSUPPORTED with the limit in the failure message. Proxy preparation uses the organization’s metered sandbox resources.",
|
|
31390
31564
|
http: "POST",
|
|
31391
31565
|
path: "/media/v1/libraries/{library_id}/assets",
|
|
31392
31566
|
streaming: "no",
|
|
@@ -31609,7 +31783,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31609
31783
|
resource: "media.libraries.assets",
|
|
31610
31784
|
method: "delete",
|
|
31611
31785
|
summary: "Delete asset",
|
|
31612
|
-
description: "
|
|
31786
|
+
description: "Delete an asset from the library so it is no longer readable, searchable or deliverable. This removes the asset rather than placing it in the library’s restoration window; a missing asset returns ASSET_NOT_FOUND.",
|
|
31613
31787
|
http: "DELETE",
|
|
31614
31788
|
path: "/media/v1/libraries/{library_id}/assets/{asset_id}",
|
|
31615
31789
|
streaming: "no",
|
|
@@ -31632,7 +31806,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31632
31806
|
resource: "media.libraries.assets",
|
|
31633
31807
|
method: "retrieve",
|
|
31634
31808
|
summary: "Get asset",
|
|
31635
|
-
description: "
|
|
31809
|
+
description: "Read a non-deleted asset by its asset_id in an active library, including content hashes, processing progress and available previews. Missing or deleted assets return ASSET_NOT_FOUND.",
|
|
31636
31810
|
http: "GET",
|
|
31637
31811
|
path: "/media/v1/libraries/{library_id}/assets/{asset_id}",
|
|
31638
31812
|
streaming: "no",
|
|
@@ -31662,7 +31836,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31662
31836
|
resource: "media.libraries.assets",
|
|
31663
31837
|
method: "update",
|
|
31664
31838
|
summary: "Update asset",
|
|
31665
|
-
description: "
|
|
31839
|
+
description: "Update an asset’s supplied metadata fields. Tags and context replace their current collections; an empty collection clears them. Moving asset_folder or changing display_name preserves public_id and delivery URLs.",
|
|
31666
31840
|
http: "PATCH",
|
|
31667
31841
|
path: "/media/v1/libraries/{library_id}/assets/{asset_id}",
|
|
31668
31842
|
streaming: "no",
|
|
@@ -31711,11 +31885,57 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31711
31885
|
]
|
|
31712
31886
|
}
|
|
31713
31887
|
},
|
|
31888
|
+
{
|
|
31889
|
+
resource: "media.libraries.assets.align",
|
|
31890
|
+
method: "create",
|
|
31891
|
+
summary: "Align asset",
|
|
31892
|
+
description: "Align two recordings by their sound and learn how they line up, without producing an asset. The route names the source asset; the body names the reference to compare against it. Both must be audio or a video, of the same library; anything else is refused with REFERENCE_TYPE_MISMATCH before a job exists. The call is an analysis: it decides and charges nothing else, bills per second of input, and stores no asset — the completed job carries the answer in result, offset_seconds saying how many seconds later the reference starts (so a caller holding both recordings knows which one to slide) and confidence how sure the correlation is. The analysis is idempotent on the source, the reference and the parameters: asking again with the same pair answers the completed job and its result instead of analysing and charging again. A max_offset_seconds caps how far apart the two may be; alignment needs an alignment model from the platform model catalogue, and with none published the request is refused with OPERATION_NOT_SUPPORTED, 尚未上架. Send Idempotency-Key, or idempotency_key in the body, to retry without analysing twice. The response is 202 with a queued Job whose operation is align; poll GET /media/v1/libraries/{library_id}/jobs/{job_id} until it is completed or failed, then read result. Example: POST /media/v1/libraries/lib_example/assets/9dfa312ef9bc4b00816339b598b1152c/align with {\"reference_asset_id\":\"3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b\",\"max_offset_seconds\":30}.",
|
|
31893
|
+
http: "POST",
|
|
31894
|
+
path: "/media/v1/libraries/{library_id}/assets/{asset_id}/align",
|
|
31895
|
+
streaming: "no",
|
|
31896
|
+
pagination: false,
|
|
31897
|
+
pathParams: [
|
|
31898
|
+
{
|
|
31899
|
+
name: "library_id",
|
|
31900
|
+
sdkName: "library_id",
|
|
31901
|
+
description: "Library ID returned by creation."
|
|
31902
|
+
},
|
|
31903
|
+
{
|
|
31904
|
+
name: "asset_id",
|
|
31905
|
+
sdkName: "asset_id",
|
|
31906
|
+
description: "32-character asset ID."
|
|
31907
|
+
}
|
|
31908
|
+
],
|
|
31909
|
+
query: [],
|
|
31910
|
+
body: {
|
|
31911
|
+
required: true,
|
|
31912
|
+
fields: [
|
|
31913
|
+
{
|
|
31914
|
+
name: "reference_asset_id",
|
|
31915
|
+
type: "string",
|
|
31916
|
+
required: true,
|
|
31917
|
+
description: "Asset to align against the one the route names. It must be an audio or video asset of the same library, otherwise the request is refused with REFERENCE_TYPE_MISMATCH before a job exists."
|
|
31918
|
+
},
|
|
31919
|
+
{
|
|
31920
|
+
name: "max_offset_seconds",
|
|
31921
|
+
type: "number",
|
|
31922
|
+
required: false,
|
|
31923
|
+
description: "Largest offset to search for, in seconds; omit it to let the model search its full range. Zero and negative values are refused with INVALID_PARAMS."
|
|
31924
|
+
},
|
|
31925
|
+
{
|
|
31926
|
+
name: "idempotency_key",
|
|
31927
|
+
type: "string",
|
|
31928
|
+
required: false,
|
|
31929
|
+
description: "Stable key so a retried request reuses the same job instead of analysing and charging again; reusing it with different content is rejected."
|
|
31930
|
+
}
|
|
31931
|
+
]
|
|
31932
|
+
}
|
|
31933
|
+
},
|
|
31714
31934
|
{
|
|
31715
31935
|
resource: "media.assets",
|
|
31716
31936
|
method: "edit",
|
|
31717
31937
|
summary: "Edit asset",
|
|
31718
|
-
description: "Edit an existing asset and store the result as a new asset. Use library_id from creation or listing and asset_id from asset creation or listing; library_id also accepts the literal default, which resolves to the organization’s default library before the credential check. The source asset is never overwritten: the new asset hangs under it in the edit chain, records it in derived_from, and reads back with assets.lineage, so earlier steps stay reachable. The body is operation plus the optional model, asset_folder, understanding and idempotency_key; operation.type selects the edit and carries that operation’s own fields. This release performs variations, inpaint, erase, replace_object, recolor, remove_background and
|
|
31938
|
+
description: "Edit an existing asset and store the result as a new asset. Use library_id from creation or listing and asset_id from asset creation or listing; library_id also accepts the literal default, which resolves to the organization’s default library before the credential check. The source asset is never overwritten: the new asset hangs under it in the edit chain, records it in derived_from, and reads back with assets.lineage, so earlier steps stay reachable. The body is operation plus the optional model, asset_folder, understanding and idempotency_key; operation.type selects the edit and carries that operation’s own fields. This release performs variations, inpaint, erase, replace_object, recolor and replace_background on images, remove_background on an image or a video, upscale, enhance_voice, reframe and redact through Media’s processing lane (upscale on a picture or a video; enhance_voice on a recording or a video, whose audio is used; reframe and redact on a video), and to_video, frame and resynthesize on the material each takes; every other type in the operation vocabulary is refused with OPERATION_NOT_SUPPORTED. The processing lane takes its model from the platform model catalogue, judged by the operation’s capability and overridable with operation.model, and bills per second of input; each edit is idempotent on the source, the operation and the parameters, so a second request that would make the same asset answers the asset already made instead of paying again, and an operation whose catalogue list is empty is refused with OPERATION_NOT_SUPPORTED, 尚未上架. remove_background on a video produces a portrait matte video for compositing without a green screen: output picks mask (a black-and-white matte as a small H.264 video, person white and background black: use it as a Cut track mask with channel luma under the original video to lay a lecturer over slides — the choice for compositing) or alpha (the default: the person on a transparent background as ProRes 4444, which is very large, about 870 MB per 15 seconds of 1080p, so ask for it only when a transparent file itself is the deliverable), and model picks the matting model from types.matting.models of the generation capabilities — read it first, because a request that names none takes the first available matting model and a video is refused with OPERATION_NOT_SUPPORTED, in the model field, when the platform has published none. output and model mean nothing for an image source and are refused with INVALID_PARAMS naming the field rather than ignored. inpaint takes mask, a PNG File identifier beginning with file- whose transparent area marks the region to replace, plus the prompt describing what belongs there. Aspects beyond the source asset’s material type return REFERENCE_TYPE_MISMATCH. Editing is billed by the model usage it consumes, at the same prices as the model API, and the job reports the charge in usage (US dollars, six decimals) and the new asset carries it in provenance.cost; when the job is done, tell the person the usage amount and give them the output’s viewer_url. The response is 202 with a queued Job whose type is image, whose operation is the edit applied, and whose source_asset_id is the asset edited; poll GET /media/v1/libraries/{library_id}/jobs/{job_id} until it is completed or failed, then read the produced asset. Example: POST /media/v1/libraries/lib_example/assets/9dfa312ef9bc4b00816339b598b1152c/edits with {\"operation\":{\"type\":\"variations\",\"strength\":\"subtle\"}}.",
|
|
31719
31939
|
http: "POST",
|
|
31720
31940
|
path: "/media/v1/libraries/{library_id}/assets/{asset_id}/edits",
|
|
31721
31941
|
streaming: "no",
|
|
@@ -31740,7 +31960,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31740
31960
|
name: "operation",
|
|
31741
31961
|
type: "object",
|
|
31742
31962
|
required: true,
|
|
31743
|
-
description: "One edit to apply to the source asset. type selects the operation and the discriminating branch carries that operation’s fields. This release performs variations, inpaint, erase, replace_object, recolor, remove_background and
|
|
31963
|
+
description: "One edit to apply to the source asset. type selects the operation and the discriminating branch carries that operation’s fields. This release performs variations, inpaint, erase, replace_object, recolor and replace_background on images, remove_background on an image or a video, upscale, enhance_voice, reframe and redact through Media’s processing lane (upscale on a picture or a video; enhance_voice on a recording or a video, whose audio is used; reframe and redact on a video), and to_video, frame and resynthesize on the material each takes; every other type here describes the operation vocabulary and is refused with OPERATION_NOT_SUPPORTED. align is not an edit — it compares two assets and has its own endpoint, POST /media/v1/libraries/{library_id}/assets/{asset_id}/align."
|
|
31744
31964
|
},
|
|
31745
31965
|
{
|
|
31746
31966
|
name: "model",
|
|
@@ -31819,6 +32039,69 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31819
32039
|
]
|
|
31820
32040
|
}
|
|
31821
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
|
+
},
|
|
31822
32105
|
{
|
|
31823
32106
|
resource: "media.assets",
|
|
31824
32107
|
method: "lineage",
|
|
@@ -31846,7 +32129,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31846
32129
|
resource: "media.libraries.assets.reprocess",
|
|
31847
32130
|
method: "create",
|
|
31848
32131
|
summary: "Reprocess asset",
|
|
31849
|
-
description: " For understanding, Media generates proxies for video sources of 25 MB or more or longer than 10 minutes, and for audio-only sources of 100 MB or more; originals remain available unchanged. Long videos are supported. When a video proxy is needed and is still above 95 MB after recompression, the source is reported as UNSUPPORTED with the limit in the failure message. Proxy preparation uses the organization’s metered sandbox resources.",
|
|
32132
|
+
description: "Queue reprocessing of the asset’s current version and return its updated state immediately. Omit kinds to retry failed tasks and legacy source-size unsupported tasks; explicit kinds rerun applicable completed tasks and recoverable source-size unsupported tasks. Other unsupported causes remain unchanged. Replaced understandings become superseded, and processing finishes asynchronously. For understanding, Media generates proxies for video sources of 25 MB or more or longer than 10 minutes, and for audio-only sources of 100 MB or more; originals remain available unchanged. Long videos are supported. When a video proxy is needed and is still above 95 MB after recompression, the source is reported as UNSUPPORTED with the limit in the failure message. Proxy preparation uses the organization’s metered sandbox resources.",
|
|
31850
32133
|
http: "POST",
|
|
31851
32134
|
path: "/media/v1/libraries/{library_id}/assets/{asset_id}/reprocess",
|
|
31852
32135
|
streaming: "no",
|
|
@@ -31948,7 +32231,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
31948
32231
|
resource: "media.libraries.assets.versions",
|
|
31949
32232
|
method: "restore",
|
|
31950
32233
|
summary: "Restore asset version",
|
|
31951
|
-
description: "Make a kept version of an asset its current bytes again. Use asset_id from a listing and version_id from GET /media/v1/libraries/{library_id}/assets/{asset_id}?versions=true; versions exist only for assets overwritten while the library’s backup setting was on. A restore is itself an overwrite: the version
|
|
32234
|
+
description: "Make a kept version of an asset its current bytes again. Use asset_id from a listing and version_id from GET /media/v1/libraries/{library_id}/assets/{asset_id}?versions=true; versions exist only for assets overwritten while the library’s backup setting was on. A restore is itself an overwrite: the restored bytes become a new version numbered past the highest (its restored_from names the version it came from), understanding runs again on the restored bytes, and the bytes it replaces are always kept as a version, whatever the backup setting says, so restoring never loses anything. A version whose bytes are another kind than the asset is now (an image overwritten by a video) is refused with OPERATION_NOT_SUPPORTED. Restoring is free. Example: POST /media/v1/libraries/lib_example/assets/9dfa312ef9bc4b00816339b598b1152c/versions/3f2a9c1e5b7d4e6f8a0b1c2d3e4f5a6b/restore.",
|
|
31952
32235
|
http: "POST",
|
|
31953
32236
|
path: "/media/v1/libraries/{library_id}/assets/{asset_id}/versions/{version_id}/restore",
|
|
31954
32237
|
streaming: "no",
|
|
@@ -32113,7 +32396,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
32113
32396
|
resource: "media.libraries.batches",
|
|
32114
32397
|
method: "retrieve",
|
|
32115
32398
|
summary: "Get batch",
|
|
32116
|
-
description: "
|
|
32399
|
+
description: "Read a batch job’s status, successful and failed item counts, and a bounded list of failed items. Use the id returned by batch creation; a job outside this library is not found.",
|
|
32117
32400
|
http: "GET",
|
|
32118
32401
|
path: "/media/v1/libraries/{library_id}/batches/{job_id}",
|
|
32119
32402
|
streaming: "no",
|
|
@@ -32218,7 +32501,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
32218
32501
|
resource: "media.libraries.folders",
|
|
32219
32502
|
method: "list",
|
|
32220
32503
|
summary: "List folders",
|
|
32221
|
-
description: "
|
|
32504
|
+
description: "List all immediate child folders under parent, or under the root when parent is omitted. Counts include descendant assets. The result is unpaginated; limit and cursor are rejected. understood_count includes ready and partial assets; failed_count includes failed assets. Both accumulate descendants. counts_complete is false during historical backfill.",
|
|
32222
32505
|
http: "GET",
|
|
32223
32506
|
path: "/media/v1/libraries/{library_id}/folders",
|
|
32224
32507
|
streaming: "no",
|
|
@@ -32589,7 +32872,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
32589
32872
|
resource: "media.libraries.purge",
|
|
32590
32873
|
method: "create",
|
|
32591
32874
|
summary: "Purge library",
|
|
32592
|
-
description: "
|
|
32875
|
+
description: "Permanently remove a library that is already deleting, without waiting for purge_at. Its assets and related resources are removed and cannot be restored; first soft-delete an active library.",
|
|
32593
32876
|
http: "POST",
|
|
32594
32877
|
path: "/media/v1/libraries/{library_id}/purge",
|
|
32595
32878
|
streaming: "no",
|
|
@@ -32607,7 +32890,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
32607
32890
|
resource: "media.libraries",
|
|
32608
32891
|
method: "restore",
|
|
32609
32892
|
summary: "Restore library",
|
|
32610
|
-
description: "
|
|
32893
|
+
description: "Restore a deleting library before its purge_at deadline. The library becomes active again and deleted_at and purge_at are cleared; expired or non-deleting libraries cannot be restored.",
|
|
32611
32894
|
http: "POST",
|
|
32612
32895
|
path: "/media/v1/libraries/{library_id}/restore",
|
|
32613
32896
|
streaming: "no",
|
|
@@ -32625,7 +32908,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
32625
32908
|
resource: "media.libraries.search",
|
|
32626
32909
|
method: "create",
|
|
32627
32910
|
summary: "Semantic search alias",
|
|
32628
|
-
description: "
|
|
32911
|
+
description: "Alias of semantic search. Search assets with a nonblank text query, optional expression filter and top_k; hybrid combines semantic and keyword matches, while semantic uses vector similarity only.",
|
|
32629
32912
|
http: "POST",
|
|
32630
32913
|
path: "/media/v1/libraries/{library_id}/search",
|
|
32631
32914
|
streaming: "no",
|
|
@@ -32700,7 +32983,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
32700
32983
|
resource: "media.libraries.search.expression",
|
|
32701
32984
|
method: "create",
|
|
32702
32985
|
summary: "Expression search",
|
|
32703
|
-
description: "Search assets
|
|
32986
|
+
description: "Search active assets using the supported filter-expression syntax, sorting and cursor pagination. Empty expression matches all assets. Tags and context require with_field; inspect the exactness flags before treating counts as complete.",
|
|
32704
32987
|
http: "POST",
|
|
32705
32988
|
path: "/media/v1/libraries/{library_id}/search/expression",
|
|
32706
32989
|
streaming: "no",
|
|
@@ -32720,7 +33003,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
32720
33003
|
name: "expression",
|
|
32721
33004
|
type: "string",
|
|
32722
33005
|
required: false,
|
|
32723
|
-
description: 'Asset filter expression supporting field comparisons, AND, OR, NOT, parentheses and suffix wildcards. An empty expression matches all assets. For business metadata use context.sku=KETTLE-RED AND context.revision=2; request with_field: ["context"] to include context. color:"#c0392b" matches an analysed image with a dominant colour within RGB distance 60 of the named colour covering at least a tenth of it; duplicate:true matches assets another live asset shares the same bytes with. Quality filters: flags:watermark matches any current shot with a watermark; flags.watermark:false requires an assessed video with no positive watermark judgment. The same syntax supports slideshow, hand_frame, text_sticker and low_quality. folder_mismatch:true selects lexical folder/location hints. Geometry filters support width, height, resolution:1920x1080, numeric aspect_ratio (width/height), and orientation:landscape, portrait or square. Missing geometry or unassessed legacy flags do not match positive filters. has_music:true AND audio_genre:jazz AND audio_mood:calm selects current-version audio profiles with music and matching model labels; has_music:false applies only to sampled ranges, not the entire source. failure_code=UPSTREAM_FAILED selects assets with a current failed understanding carrying that code; combine with processing_state=failed or processing_state=partial.'
|
|
33006
|
+
description: 'Asset filter expression supporting field comparisons, AND, OR, NOT, parentheses and suffix wildcards. An empty expression matches all assets. For business metadata use context.sku=KETTLE-RED AND context.revision=2; request with_field: ["context"] to include context. color:"#c0392b" matches an analysed image with a dominant colour within RGB distance 60 of the named colour covering at least a tenth of it; duplicate:true matches assets another live asset shares the same bytes with. Quality filters: flags:watermark matches any current shot with a watermark; flags.watermark:false requires an assessed video with no positive watermark judgment. The same syntax supports slideshow, hand_frame, text_sticker and low_quality. folder_mismatch:true selects lexical folder/location hints. Geometry filters support width, height, resolution:1920x1080, numeric aspect_ratio (width/height), and orientation:landscape, portrait or square. Missing geometry or unassessed legacy flags do not match positive filters. has_music:true AND audio_genre:jazz AND audio_mood:calm selects current-version audio profiles with music and matching model labels; has_music:false applies only to sampled ranges, not the entire source. audio_role:music selects audio materials by what they are used for (voice, music or sfx), and it exists only on audio materials, so an asset without a role matches no role. failure_code=UPSTREAM_FAILED selects assets with a current failed understanding carrying that code; combine with processing_state=failed or processing_state=partial.'
|
|
32724
33007
|
},
|
|
32725
33008
|
{
|
|
32726
33009
|
name: "sort_by",
|
|
@@ -32760,10 +33043,17 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
32760
33043
|
"material_type",
|
|
32761
33044
|
"format",
|
|
32762
33045
|
"asset_folder",
|
|
32763
|
-
"processing_state"
|
|
33046
|
+
"processing_state",
|
|
33047
|
+
"audio_role"
|
|
32764
33048
|
],
|
|
32765
33049
|
required: false,
|
|
32766
33050
|
description: "Facets to count over matching assets, returned under aggregations."
|
|
33051
|
+
},
|
|
33052
|
+
{
|
|
33053
|
+
name: "stack",
|
|
33054
|
+
type: "boolean",
|
|
33055
|
+
required: false,
|
|
33056
|
+
description: "true answers one row per edit tree instead of every matching asset: the newest asset of that tree the expression matched, with stack_count giving how many of the tree’s assets matched. total_count then counts trees, the rows the pages return, while aggregations still count matching assets. Omitted or false returns the flat list. Only the default order is supported: naming sort_by with stack=true is refused. Edits of an asset form its tree; generated variants and uploads are trees of their own."
|
|
32767
33057
|
}
|
|
32768
33058
|
]
|
|
32769
33059
|
}
|
|
@@ -32772,7 +33062,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
32772
33062
|
resource: "media.libraries.search.semantic",
|
|
32773
33063
|
method: "create",
|
|
32774
33064
|
summary: "Semantic search",
|
|
32775
|
-
description: "
|
|
33065
|
+
description: "Search assets with a nonblank text query and optional expression filter. Hybrid mode combines semantic and keyword matches; semantic mode uses vector similarity only. Results are ranked and limited by top_k.",
|
|
32776
33066
|
http: "POST",
|
|
32777
33067
|
path: "/media/v1/libraries/{library_id}/search/semantic",
|
|
32778
33068
|
streaming: "no",
|
|
@@ -32847,7 +33137,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
32847
33137
|
resource: "media.libraries.search.visual",
|
|
32848
33138
|
method: "create",
|
|
32849
33139
|
summary: "Visual search",
|
|
32850
|
-
description: "
|
|
33140
|
+
description: "Find visually similar assets using exactly one of asset_id or an inline base64 image. The library must support image search; an asset query needs a current image embedding and excludes that source asset from results.",
|
|
32851
33141
|
http: "POST",
|
|
32852
33142
|
path: "/media/v1/libraries/{library_id}/search/visual",
|
|
32853
33143
|
streaming: "no",
|
|
@@ -34726,6 +35016,18 @@ for more details.`
|
|
|
34726
35016
|
]
|
|
34727
35017
|
}
|
|
34728
35018
|
},
|
|
35019
|
+
{
|
|
35020
|
+
resource: "model.modelAccess",
|
|
35021
|
+
method: "list",
|
|
35022
|
+
summary: "List Model Access",
|
|
35023
|
+
description: "List the models your organization must enable before use, together with the grants it already has. Read it to check whether a model is enabled before an inference call, or to show which marked models still need enabling; use each item's model as the id for enableModelAccess or disableModelAccess (PUT or DELETE /model/v1/models/{model}/access). Items cover every model the catalog marks access_required, granted or not, so the gated class stays discoverable, plus any other model this organization has enabled, one item per model. access_required says whether the catalog gates the model; granted says whether your organization has a grant; the prices are the model's current sell prices, what the next call costs, not the price recorded when the grant was created.",
|
|
35024
|
+
http: "GET",
|
|
35025
|
+
path: "/model/v1/model-access",
|
|
35026
|
+
streaming: "no",
|
|
35027
|
+
pagination: false,
|
|
35028
|
+
pathParams: [],
|
|
35029
|
+
query: []
|
|
35030
|
+
},
|
|
34729
35031
|
{
|
|
34730
35032
|
resource: "model.models",
|
|
34731
35033
|
method: "list",
|
|
@@ -34754,8 +35056,11 @@ for more details.`
|
|
|
34754
35056
|
"openai.images.generations",
|
|
34755
35057
|
"openai.responses",
|
|
34756
35058
|
"openai.videos",
|
|
35059
|
+
"praxis.media.process",
|
|
35060
|
+
"praxis.video.matting",
|
|
34757
35061
|
"typesafe.systemone",
|
|
34758
35062
|
"volcengine.music",
|
|
35063
|
+
"volcengine.vod.matting",
|
|
34759
35064
|
"volcengine.voice_clone"
|
|
34760
35065
|
],
|
|
34761
35066
|
required: false,
|
|
@@ -34817,6 +35122,42 @@ for more details.`
|
|
|
34817
35122
|
],
|
|
34818
35123
|
query: []
|
|
34819
35124
|
},
|
|
35125
|
+
{
|
|
35126
|
+
resource: "model.models.access",
|
|
35127
|
+
method: "delete",
|
|
35128
|
+
summary: "Disable Model Access",
|
|
35129
|
+
description: "Disable one model for your organization by deleting its grant, so the next call to a model that requires access is refused again with 403 MODEL_ACCESS_REQUIRED. Pass any id enableModelAccess accepts, including creator prefixes; the model may be enabled again later, and the new grant records whoever enabled it then. A model that is not currently enabled is already disabled, so deleting a grant that does not exist also answers 200 with revoked true; only an id no catalog model carries answers 404 MODEL_NOT_FOUND.",
|
|
35130
|
+
http: "DELETE",
|
|
35131
|
+
path: "/model/v1/models/{model}/access",
|
|
35132
|
+
streaming: "no",
|
|
35133
|
+
pagination: false,
|
|
35134
|
+
pathParams: [
|
|
35135
|
+
{
|
|
35136
|
+
name: "model",
|
|
35137
|
+
sdkName: "model",
|
|
35138
|
+
description: "Model ID the organization no longer wants enabled; same ids as enableModelAccess."
|
|
35139
|
+
}
|
|
35140
|
+
],
|
|
35141
|
+
query: []
|
|
35142
|
+
},
|
|
35143
|
+
{
|
|
35144
|
+
resource: "model.models.access",
|
|
35145
|
+
method: "update",
|
|
35146
|
+
summary: "Enable Model Access",
|
|
35147
|
+
description: "Enable one model for your organization so a call to it is allowed. Call it when an inference request was refused with 403 MODEL_ACCESS_REQUIRED, or ahead of time for a model the catalog marks access_required: true; the refusal message and praxis.model.models.list name the model id to pass here. The id resolves exactly as a chat call resolves it, including any creator prefix such as deepseek/deepseek-v4-pro, and an id no catalog model carries answers 404 MODEL_NOT_FOUND. Enabling is organization-wide and needs no approval, and it is idempotent: a second call returns the first grant unchanged, keeping its author, its timestamp and the USD-per-million-token price snapshot it recorded then. Enabling a model that does not require access is allowed and makes no difference to gating.",
|
|
35148
|
+
http: "PUT",
|
|
35149
|
+
path: "/model/v1/models/{model}/access",
|
|
35150
|
+
streaming: "no",
|
|
35151
|
+
pagination: false,
|
|
35152
|
+
pathParams: [
|
|
35153
|
+
{
|
|
35154
|
+
name: "model",
|
|
35155
|
+
sdkName: "model",
|
|
35156
|
+
description: "Model ID as the catalog lists it, including any creator prefix; primary ids, aliases and prefixed ids resolve the same way a chat call resolves them."
|
|
35157
|
+
}
|
|
35158
|
+
],
|
|
35159
|
+
query: []
|
|
35160
|
+
},
|
|
34820
35161
|
{
|
|
34821
35162
|
resource: "model.ocr",
|
|
34822
35163
|
method: "create",
|
|
@@ -36236,7 +36577,7 @@ for more details.`
|
|
|
36236
36577
|
resource: "organization.actors",
|
|
36237
36578
|
method: "list",
|
|
36238
36579
|
summary: "List actors holding positions",
|
|
36239
|
-
description: "Lists every actor, person or agent, that currently holds at least one position, ordered by actor address, each with its primary position and all positions it holds; use it to see who works where. Actors holding nothing are not listed. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session
|
|
36580
|
+
description: "Lists every actor, person or agent, that currently holds at least one position, ordered by actor address, each with its primary position and all positions it holds; use it to see who works where. Actors holding nothing are not listed. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/actors?department_id=dept_123.",
|
|
36240
36581
|
http: "GET",
|
|
36241
36582
|
path: "/organization/v1/actors",
|
|
36242
36583
|
streaming: "no",
|
|
@@ -36267,7 +36608,7 @@ for more details.`
|
|
|
36267
36608
|
resource: "organization.actors",
|
|
36268
36609
|
method: "retrieve",
|
|
36269
36610
|
summary: "Get the position chain of an actor",
|
|
36270
|
-
description: "Reads where an actor, person or agent, sits in the organization: its primary position and its concurrent positions, each with the department path from the root down with every level's charter, the job, title and level name, the manager (the first filled position up the reporting line), the position's own duties and methods, and objectives. Use it to answer who this actor is and what it is responsible for. An actor that holds no position is not an error: primary is null and concurrent is empty. Read-only. Errors: 403 PERMISSION_DENIED for session
|
|
36611
|
+
description: "Reads where an actor, person or agent, sits in the organization: its primary position and its concurrent positions, each with the department path from the root down with every level's charter, the job, title and level name, the manager (the first filled position up the reporting line), the position's own duties and methods, and objectives. Use it to answer who this actor is and what it is responsible for. An actor that holds no position is not an error: primary is null and concurrent is empty. Read-only. Errors: 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
|
|
36271
36612
|
http: "GET",
|
|
36272
36613
|
path: "/organization/v1/actors/{actor}",
|
|
36273
36614
|
streaming: "no",
|
|
@@ -36285,7 +36626,7 @@ for more details.`
|
|
|
36285
36626
|
resource: "organization.assignments",
|
|
36286
36627
|
method: "list",
|
|
36287
36628
|
summary: "List assignments",
|
|
36288
|
-
description: "Lists assignments, newest start first, each tying one actor (person or agent) to one position; use it to see who holds what, or the history of a position or an actor. Ended assignments are included unless you filter active=true. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100, a non-boolean active or a stale cursor; 403 PERMISSION_DENIED for session
|
|
36629
|
+
description: "Lists assignments, newest start first, each tying one actor (person or agent) to one position; use it to see who holds what, or the history of a position or an actor. Ended assignments are included unless you filter active=true. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100, a non-boolean active or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/assignments?position_id=pos_123&active=true.",
|
|
36289
36630
|
http: "GET",
|
|
36290
36631
|
path: "/organization/v1/assignments",
|
|
36291
36632
|
streaming: "no",
|
|
@@ -36328,7 +36669,7 @@ for more details.`
|
|
|
36328
36669
|
resource: "organization.assignments",
|
|
36329
36670
|
method: "retrieve",
|
|
36330
36671
|
summary: "Get an assignment",
|
|
36331
|
-
description: "Reads one assignment, current or ended, with who appointed and ended it and, for a replaced holder, the successor's assignment id. Read-only. Errors: 404 ASSIGNMENT_NOT_FOUND when the id is not an assignment of your organization; 403 PERMISSION_DENIED for session
|
|
36672
|
+
description: "Reads one assignment, current or ended, with who appointed and ended it and, for a replaced holder, the successor's assignment id. Read-only. Errors: 404 ASSIGNMENT_NOT_FOUND when the id is not an assignment of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
|
|
36332
36673
|
http: "GET",
|
|
36333
36674
|
path: "/organization/v1/assignments/{id}",
|
|
36334
36675
|
streaming: "no",
|
|
@@ -36517,7 +36858,7 @@ for more details.`
|
|
|
36517
36858
|
resource: "organization.departments",
|
|
36518
36859
|
method: "list",
|
|
36519
36860
|
summary: "List departments",
|
|
36520
|
-
description: "Lists the departments of your organization's tree, including the root department; use it to find a department id or to walk the tree one level at a time with parent_id. Dissolved departments are included unless you filter status=active. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session
|
|
36861
|
+
description: "Lists the departments of your organization's tree, including the root department; use it to find a department id or to walk the tree one level at a time with parent_id. Dissolved departments are included unless you filter status=active. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/departments?status=active.",
|
|
36521
36862
|
http: "GET",
|
|
36522
36863
|
path: "/organization/v1/departments",
|
|
36523
36864
|
streaming: "no",
|
|
@@ -36593,7 +36934,7 @@ for more details.`
|
|
|
36593
36934
|
resource: "organization.departments",
|
|
36594
36935
|
method: "retrieve",
|
|
36595
36936
|
summary: "Get a department",
|
|
36596
|
-
description: "Reads one department with its head position id and its charter, including the charter revision you need before amending the charter. Read-only. Errors: 404 DEPARTMENT_NOT_FOUND when the id is not a department of your organization; 403 PERMISSION_DENIED for session
|
|
36937
|
+
description: "Reads one department with its head position id and its charter, including the charter revision you need before amending the charter. Read-only. Errors: 404 DEPARTMENT_NOT_FOUND when the id is not a department of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
|
|
36597
36938
|
http: "GET",
|
|
36598
36939
|
path: "/organization/v1/departments/{id}",
|
|
36599
36940
|
streaming: "no",
|
|
@@ -36984,7 +37325,7 @@ for more details.`
|
|
|
36984
37325
|
resource: "organization.jobs",
|
|
36985
37326
|
method: "list",
|
|
36986
37327
|
summary: "List jobs",
|
|
36987
|
-
description: "Lists the jobs of your organization ordered by code; use it to find the job_id to open positions from. Retired jobs are included unless you filter status=active. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session
|
|
37328
|
+
description: "Lists the jobs of your organization ordered by code; use it to find the job_id to open positions from. Retired jobs are included unless you filter status=active. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
|
|
36988
37329
|
http: "GET",
|
|
36989
37330
|
path: "/organization/v1/jobs",
|
|
36990
37331
|
streaming: "no",
|
|
@@ -37067,7 +37408,7 @@ for more details.`
|
|
|
37067
37408
|
resource: "organization.jobs",
|
|
37068
37409
|
method: "retrieve",
|
|
37069
37410
|
summary: "Get a job",
|
|
37070
|
-
description: "Reads one job with its current revision, which you need before revising it. Read-only. Errors: 404 JOB_NOT_FOUND when the id is not a job of your organization; 403 PERMISSION_DENIED for session
|
|
37411
|
+
description: "Reads one job with its current revision, which you need before revising it. Read-only. Errors: 404 JOB_NOT_FOUND when the id is not a job of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
|
|
37071
37412
|
http: "GET",
|
|
37072
37413
|
path: "/organization/v1/jobs/{id}",
|
|
37073
37414
|
streaming: "no",
|
|
@@ -37157,7 +37498,7 @@ for more details.`
|
|
|
37157
37498
|
resource: "organization.keyResults",
|
|
37158
37499
|
method: "list",
|
|
37159
37500
|
summary: "List key results",
|
|
37160
|
-
description: "Lists key results, oldest first, each with its metric, health, done flag and, once its objective is graded, its score; use it to read the key results of one objective or the ones a position owns. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session
|
|
37501
|
+
description: "Lists key results, oldest first, each with its metric, health, done flag and, once its objective is graded, its score; use it to read the key results of one objective or the ones a position owns. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/key_results?objective_id=obj_3b7a52c1e9d84f06b2a1c8e4d7f50a96.",
|
|
37161
37502
|
http: "GET",
|
|
37162
37503
|
path: "/organization/v1/key_results",
|
|
37163
37504
|
streaming: "no",
|
|
@@ -37245,7 +37586,7 @@ for more details.`
|
|
|
37245
37586
|
resource: "organization.keyResults",
|
|
37246
37587
|
method: "retrieve",
|
|
37247
37588
|
summary: "Get a key result",
|
|
37248
|
-
description: "Reads one key result with its metric, its health, its done flag, its owner position and its score. Progress of a metric key result is (current - initial) / (target - initial), clamped between 0 and 1; a key result without a metric counts as 1 when done is true and 0 otherwise. Read-only. Errors: 404 KEY_RESULT_NOT_FOUND when the id is not a key result of your organization; 403 PERMISSION_DENIED for session
|
|
37589
|
+
description: "Reads one key result with its metric, its health, its done flag, its owner position and its score. Progress of a metric key result is (current - initial) / (target - initial), clamped between 0 and 1; a key result without a metric counts as 1 when done is true and 0 otherwise. Read-only. Errors: 404 KEY_RESULT_NOT_FOUND when the id is not a key result of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
|
|
37249
37590
|
http: "GET",
|
|
37250
37591
|
path: "/organization/v1/key_results/{id}",
|
|
37251
37592
|
streaming: "no",
|
|
@@ -37331,7 +37672,7 @@ for more details.`
|
|
|
37331
37672
|
resource: "organization.ladders",
|
|
37332
37673
|
method: "list",
|
|
37333
37674
|
summary: "List job ladders",
|
|
37334
|
-
description: "Lists the job ladders of your organization, oldest first, each with its levels in ascending order; use it to find the level ids for jobs and positions. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session
|
|
37675
|
+
description: "Lists the job ladders of your organization, oldest first, each with its levels in ascending order; use it to find the level ids for jobs and positions. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
|
|
37335
37676
|
http: "GET",
|
|
37336
37677
|
path: "/organization/v1/ladders",
|
|
37337
37678
|
streaming: "no",
|
|
@@ -37386,7 +37727,7 @@ for more details.`
|
|
|
37386
37727
|
resource: "organization.ladders",
|
|
37387
37728
|
method: "retrieve",
|
|
37388
37729
|
summary: "Get a job ladder",
|
|
37389
|
-
description: "Reads one job ladder with its levels in ascending order. Read-only. Errors: 404 LADDER_NOT_FOUND when the id is not a ladder of your organization; 403 PERMISSION_DENIED for session
|
|
37730
|
+
description: "Reads one job ladder with its levels in ascending order. Read-only. Errors: 404 LADDER_NOT_FOUND when the id is not a ladder of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
|
|
37390
37731
|
http: "GET",
|
|
37391
37732
|
path: "/organization/v1/ladders/{id}",
|
|
37392
37733
|
streaming: "no",
|
|
@@ -37404,7 +37745,7 @@ for more details.`
|
|
|
37404
37745
|
resource: "organization.ladders",
|
|
37405
37746
|
method: "update",
|
|
37406
37747
|
summary: "Revise a job ladder",
|
|
37407
|
-
description: "Replaces all levels of a ladder with the array you send. A level with an id keeps that id and takes the new name and order, a level without an id is created, and an existing level you leave out is deleted. A level cannot be deleted while an open position or a job's level_ids still refers to it; first regrade those positions or revise those jobs.
|
|
37748
|
+
description: "Replaces all levels of a ladder with the array you send. A level with an id keeps that id and takes the new name and order, a level without an id is created, and an existing level you leave out is deleted. A level cannot be deleted while an open position or a job's level_ids still refers to it; first regrade those positions or revise those jobs. Send name to rename the ladder; leave it out to keep the name. Requires an organization owner or admin. Errors: 400 INVALID_PARAMS for an empty levels array, duplicate order values, a level id sent twice or a level that is still referenced; 403 PERMISSION_DENIED; 404 LADDER_NOT_FOUND; 404 JOB_LEVEL_NOT_FOUND when a level id does not belong to this ladder.",
|
|
37408
37749
|
http: "PUT",
|
|
37409
37750
|
path: "/organization/v1/ladders/{id}",
|
|
37410
37751
|
streaming: "no",
|
|
@@ -37420,6 +37761,12 @@ for more details.`
|
|
|
37420
37761
|
body: {
|
|
37421
37762
|
required: true,
|
|
37422
37763
|
fields: [
|
|
37764
|
+
{
|
|
37765
|
+
name: "name",
|
|
37766
|
+
type: "string",
|
|
37767
|
+
required: false,
|
|
37768
|
+
description: "The ladder's new name; omit it to keep the current name."
|
|
37769
|
+
},
|
|
37423
37770
|
{
|
|
37424
37771
|
name: "levels",
|
|
37425
37772
|
type: "array",
|
|
@@ -37459,7 +37806,7 @@ for more details.`
|
|
|
37459
37806
|
resource: "organization.objectives",
|
|
37460
37807
|
method: "list",
|
|
37461
37808
|
summary: "List objectives",
|
|
37462
|
-
description: "Lists objectives, oldest first, each with its scope, the parents it aligns to and, once graded, its result and score; use it to find an objective id or to read one period or one department's objectives. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session
|
|
37809
|
+
description: "Lists objectives, oldest first, each with its scope, the parents it aligns to and, once graded, its result and score; use it to find an objective id or to read one period or one department's objectives. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/objectives?period_id=prd_6d1f0c3a9b8e4a27a5c4e7d2f1b90a38&status=active.",
|
|
37463
37810
|
http: "GET",
|
|
37464
37811
|
path: "/organization/v1/objectives",
|
|
37465
37812
|
streaming: "no",
|
|
@@ -37557,7 +37904,7 @@ for more details.`
|
|
|
37557
37904
|
resource: "organization.objectives",
|
|
37558
37905
|
method: "retrieve",
|
|
37559
37906
|
summary: "Get an objective",
|
|
37560
|
-
description: "Reads one objective with its scope, the parents it aligns to with their weights, its status and, once graded, its result, score and grade note. Its key results are read with the key results list filtered by objective_id. Read-only. Errors: 404 OBJECTIVE_NOT_FOUND when the id is not an objective of your organization; 403 PERMISSION_DENIED for session
|
|
37907
|
+
description: "Reads one objective with its scope, the parents it aligns to with their weights, its status and, once graded, its result, score and grade note. Its key results are read with the key results list filtered by objective_id. Read-only. Errors: 404 OBJECTIVE_NOT_FOUND when the id is not an objective of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
|
|
37561
37908
|
http: "GET",
|
|
37562
37909
|
path: "/organization/v1/objectives/{id}",
|
|
37563
37910
|
streaming: "no",
|
|
@@ -37694,7 +38041,7 @@ for more details.`
|
|
|
37694
38041
|
resource: "organization.periods",
|
|
37695
38042
|
method: "list",
|
|
37696
38043
|
summary: "List periods",
|
|
37697
|
-
description: "Lists the periods of your organization's OKR calendar, newest start first; use it to find the period_id to set objectives in, or to see which periods are still open for grading. Closed periods are included. Filter cadence to read one level of the calendar. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for session
|
|
38044
|
+
description: "Lists the periods of your organization's OKR calendar, newest start first; use it to find the period_id to set objectives in, or to see which periods are still open for grading. Closed periods are included. Filter cadence to read one level of the calendar. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/periods?cadence=quarter.",
|
|
37698
38045
|
http: "GET",
|
|
37699
38046
|
path: "/organization/v1/periods",
|
|
37700
38047
|
streaming: "no",
|
|
@@ -37782,7 +38129,7 @@ for more details.`
|
|
|
37782
38129
|
resource: "organization.periods",
|
|
37783
38130
|
method: "retrieve",
|
|
37784
38131
|
summary: "Get a period",
|
|
37785
|
-
description: "Reads one period with its derived status, so you can tell whether it is still planning, active, in grading or closed. Read-only. Errors: 404 PERIOD_NOT_FOUND when the id is not a period of your organization; 403 PERMISSION_DENIED for session
|
|
38132
|
+
description: "Reads one period with its derived status, so you can tell whether it is still planning, active, in grading or closed. Read-only. Errors: 404 PERIOD_NOT_FOUND when the id is not a period of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
|
|
37786
38133
|
http: "GET",
|
|
37787
38134
|
path: "/organization/v1/periods/{id}",
|
|
37788
38135
|
streaming: "no",
|
|
@@ -37818,7 +38165,7 @@ for more details.`
|
|
|
37818
38165
|
resource: "organization.positions",
|
|
37819
38166
|
method: "list",
|
|
37820
38167
|
summary: "List positions",
|
|
37821
|
-
description: "Lists positions across the organization ordered by department and then number, vacant ones included; narrow it with department_id, job_id, status or is_head. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100, a non-boolean is_head or a stale cursor; 403 PERMISSION_DENIED for session
|
|
38168
|
+
description: "Lists positions across the organization ordered by department and then number, vacant ones included; narrow it with department_id, job_id, status or is_head. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100, a non-boolean is_head or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /organization/v1/positions?department_id=dept_123&status=active.",
|
|
37822
38169
|
http: "GET",
|
|
37823
38170
|
path: "/organization/v1/positions",
|
|
37824
38171
|
streaming: "no",
|
|
@@ -37931,7 +38278,7 @@ for more details.`
|
|
|
37931
38278
|
resource: "organization.positions",
|
|
37932
38279
|
method: "retrieve",
|
|
37933
38280
|
summary: "Get a position",
|
|
37934
|
-
description: "Reads one position with its derived effective_reports_to line. Read-only. Errors: 404 POSITION_NOT_FOUND when the id is not a position of your organization; 403 PERMISSION_DENIED for session
|
|
38281
|
+
description: "Reads one position with its derived effective_reports_to line. Read-only. Errors: 404 POSITION_NOT_FOUND when the id is not a position of your organization; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent.",
|
|
37935
38282
|
http: "GET",
|
|
37936
38283
|
path: "/organization/v1/positions/{id}",
|
|
37937
38284
|
streaming: "no",
|
|
@@ -38255,6 +38602,570 @@ for more details.`
|
|
|
38255
38602
|
}
|
|
38256
38603
|
]
|
|
38257
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
|
+
},
|
|
38258
39169
|
{
|
|
38259
39170
|
resource: "sandbox.events.sandboxes",
|
|
38260
39171
|
method: "retrieve",
|
|
@@ -40385,6 +41296,131 @@ for more details.`
|
|
|
40385
41296
|
]
|
|
40386
41297
|
}
|
|
40387
41298
|
},
|
|
41299
|
+
{
|
|
41300
|
+
resource: "share.permissions",
|
|
41301
|
+
method: "list",
|
|
41302
|
+
summary: "List shares",
|
|
41303
|
+
description: "Find the shares of this organization, newest first, for example every link that exposes one file before you decide which to revoke. Filter by resource_type, resource_id and status; filters combine with AND. Continue with next_page_token as page_token until next_page_token is null. Records never include link.web_url. A credential bound to specific files must pass resource_type and resource_id of a bound file, and an unbound file answers 404.",
|
|
41304
|
+
http: "GET",
|
|
41305
|
+
path: "/share/v1/permissions",
|
|
41306
|
+
streaming: "no",
|
|
41307
|
+
pagination: false,
|
|
41308
|
+
pathParams: [],
|
|
41309
|
+
query: [
|
|
41310
|
+
{
|
|
41311
|
+
name: "resource_type",
|
|
41312
|
+
type: "string",
|
|
41313
|
+
enum: [
|
|
41314
|
+
"file",
|
|
41315
|
+
"artifact",
|
|
41316
|
+
"canvas",
|
|
41317
|
+
"media_asset"
|
|
41318
|
+
],
|
|
41319
|
+
required: false,
|
|
41320
|
+
description: "Only shares of this object type; file, canvas and media_asset create today."
|
|
41321
|
+
},
|
|
41322
|
+
{
|
|
41323
|
+
name: "resource_id",
|
|
41324
|
+
type: "string",
|
|
41325
|
+
required: false,
|
|
41326
|
+
description: "Only shares of the object with this id, for example a file id from the File API or a media asset's library_id/asset_id; combine with resource_type."
|
|
41327
|
+
},
|
|
41328
|
+
{
|
|
41329
|
+
name: "status",
|
|
41330
|
+
type: "string",
|
|
41331
|
+
enum: [
|
|
41332
|
+
"active",
|
|
41333
|
+
"expired",
|
|
41334
|
+
"revoked"
|
|
41335
|
+
],
|
|
41336
|
+
required: false,
|
|
41337
|
+
description: "Only shares in this state; omit to list every state."
|
|
41338
|
+
},
|
|
41339
|
+
{
|
|
41340
|
+
name: "page_size",
|
|
41341
|
+
type: "integer",
|
|
41342
|
+
required: false,
|
|
41343
|
+
description: "Maximum shares in one page, from 1 to 100; defaults to 50."
|
|
41344
|
+
},
|
|
41345
|
+
{
|
|
41346
|
+
name: "page_token",
|
|
41347
|
+
type: "string",
|
|
41348
|
+
required: false,
|
|
41349
|
+
description: "Opaque next_page_token from the preceding page with the same filters; omit on the first request."
|
|
41350
|
+
}
|
|
41351
|
+
]
|
|
41352
|
+
},
|
|
41353
|
+
{
|
|
41354
|
+
resource: "share.permissions",
|
|
41355
|
+
method: "create",
|
|
41356
|
+
summary: "Create share",
|
|
41357
|
+
description: "Make one file readable by anyone holding a link, before sending the link to a person or embedding it. Name the object as resource {type, id}, with the file id from the File API. The response is 201 and is the only time link.web_url is returned; store it, because later reads omit it and a lost address means creating another share (the old one keeps working until you delete it). The link is anonymous and read-only. A type other than file answers 400 RESOURCE_TYPE_UNSUPPORTED, and a file that is missing or outside your organization answers 404 RESOURCE_NOT_FOUND.",
|
|
41358
|
+
http: "POST",
|
|
41359
|
+
path: "/share/v1/permissions",
|
|
41360
|
+
streaming: "no",
|
|
41361
|
+
pagination: false,
|
|
41362
|
+
pathParams: [],
|
|
41363
|
+
query: [],
|
|
41364
|
+
body: {
|
|
41365
|
+
required: true,
|
|
41366
|
+
fields: [
|
|
41367
|
+
{
|
|
41368
|
+
name: "resource",
|
|
41369
|
+
type: "object",
|
|
41370
|
+
required: true,
|
|
41371
|
+
description: "The object a share exposes, named by a type and an id."
|
|
41372
|
+
},
|
|
41373
|
+
{
|
|
41374
|
+
name: "expire_time",
|
|
41375
|
+
type: "string",
|
|
41376
|
+
required: false,
|
|
41377
|
+
description: "ISO 8601 instant after which the link answers 410; omit or null for a link that never expires, and it must be in the future."
|
|
41378
|
+
},
|
|
41379
|
+
{
|
|
41380
|
+
name: "prevents_download",
|
|
41381
|
+
type: "boolean",
|
|
41382
|
+
required: false,
|
|
41383
|
+
description: "Ask viewers to open the content without a download prompt; a limit, not a guarantee, because anyone who can read it can save it. Defaults to false."
|
|
41384
|
+
}
|
|
41385
|
+
]
|
|
41386
|
+
}
|
|
41387
|
+
},
|
|
41388
|
+
{
|
|
41389
|
+
resource: "share.permissions",
|
|
41390
|
+
method: "delete",
|
|
41391
|
+
summary: "Delete share",
|
|
41392
|
+
description: "Take a link back so nobody can open it again. This revokes the share, the record stays readable with status revoked, and opening the link answers 410. Repeating the call on a revoked share is harmless and answers 204 again. Content addresses already signed when the link was opened expire on their own within five minutes. Take the id from shares.create or shares.list.",
|
|
41393
|
+
http: "DELETE",
|
|
41394
|
+
path: "/share/v1/permissions/{id}",
|
|
41395
|
+
streaming: "no",
|
|
41396
|
+
pagination: false,
|
|
41397
|
+
pathParams: [
|
|
41398
|
+
{
|
|
41399
|
+
name: "id",
|
|
41400
|
+
sdkName: "id",
|
|
41401
|
+
description: "Share id returned by shares.create or shares.list, in the form shr_ followed by 32 lowercase letters or digits; a link address is not accepted."
|
|
41402
|
+
}
|
|
41403
|
+
],
|
|
41404
|
+
query: []
|
|
41405
|
+
},
|
|
41406
|
+
{
|
|
41407
|
+
resource: "share.permissions",
|
|
41408
|
+
method: "retrieve",
|
|
41409
|
+
summary: "Retrieve share",
|
|
41410
|
+
description: "Read one share to see whether its link is still active, when it expires, and how many times it was opened. Take the id from shares.create or shares.list. The record never includes link.web_url, because the address is shown once at creation. A share that does not exist or belongs to another organization answers 404 PERMISSION_NOT_FOUND.",
|
|
41411
|
+
http: "GET",
|
|
41412
|
+
path: "/share/v1/permissions/{id}",
|
|
41413
|
+
streaming: "no",
|
|
41414
|
+
pagination: false,
|
|
41415
|
+
pathParams: [
|
|
41416
|
+
{
|
|
41417
|
+
name: "id",
|
|
41418
|
+
sdkName: "id",
|
|
41419
|
+
description: "Share id returned by shares.create or shares.list, in the form shr_ followed by 32 lowercase letters or digits; a link address is not accepted."
|
|
41420
|
+
}
|
|
41421
|
+
],
|
|
41422
|
+
query: []
|
|
41423
|
+
},
|
|
40388
41424
|
{
|
|
40389
41425
|
resource: "studio.codexes",
|
|
40390
41426
|
method: "list",
|
|
@@ -46859,6 +47895,19 @@ var getAgentConsolidation = (options) => (options.client ?? client).get({
|
|
|
46859
47895
|
url: "/agent/v1/agents/{agent_id}/consolidations/{consolidation_id}",
|
|
46860
47896
|
...options
|
|
46861
47897
|
});
|
|
47898
|
+
var listAgentInboxLetters = (options) => (options.client ?? client).get({
|
|
47899
|
+
security: [{
|
|
47900
|
+
key: "BearerAuth",
|
|
47901
|
+
scheme: "bearer",
|
|
47902
|
+
type: "http"
|
|
47903
|
+
}, {
|
|
47904
|
+
key: "ApiKeyAuth",
|
|
47905
|
+
name: "X-API-Key",
|
|
47906
|
+
type: "apiKey"
|
|
47907
|
+
}],
|
|
47908
|
+
url: "/agent/v1/agents/{agent_id}/inbox/letters",
|
|
47909
|
+
...options
|
|
47910
|
+
});
|
|
46862
47911
|
var applyAgentVersion = (options) => (options.client ?? client).post({
|
|
46863
47912
|
security: [{
|
|
46864
47913
|
key: "BearerAuth",
|
|
@@ -47211,11 +48260,7 @@ var computersFilesConvert = (options) => (options.client ?? client).post({
|
|
|
47211
48260
|
type: "apiKey"
|
|
47212
48261
|
}],
|
|
47213
48262
|
url: "/agent/v1/computers/{computer_id}/files/convert",
|
|
47214
|
-
...options
|
|
47215
|
-
headers: {
|
|
47216
|
-
"Content-Type": "application/json",
|
|
47217
|
-
...options.headers
|
|
47218
|
-
}
|
|
48263
|
+
...options
|
|
47219
48264
|
});
|
|
47220
48265
|
var connectComputer = (options) => (options.client ?? client).post({
|
|
47221
48266
|
security: [{
|
|
@@ -47303,6 +48348,49 @@ var forkSession = (options) => (options.client ?? client).post({
|
|
|
47303
48348
|
...options.headers
|
|
47304
48349
|
}
|
|
47305
48350
|
});
|
|
48351
|
+
var listSessionArtifacts = (options) => (options.client ?? client).get({
|
|
48352
|
+
security: [{
|
|
48353
|
+
key: "BearerAuth",
|
|
48354
|
+
scheme: "bearer",
|
|
48355
|
+
type: "http"
|
|
48356
|
+
}, {
|
|
48357
|
+
key: "ApiKeyAuth",
|
|
48358
|
+
name: "X-API-Key",
|
|
48359
|
+
type: "apiKey"
|
|
48360
|
+
}],
|
|
48361
|
+
url: "/agent/v1/sessions/{session_id}/artifacts",
|
|
48362
|
+
...options
|
|
48363
|
+
});
|
|
48364
|
+
var createSessionArtifactContentUrl = (options) => (options.client ?? client).post({
|
|
48365
|
+
security: [{
|
|
48366
|
+
key: "BearerAuth",
|
|
48367
|
+
scheme: "bearer",
|
|
48368
|
+
type: "http"
|
|
48369
|
+
}, {
|
|
48370
|
+
key: "ApiKeyAuth",
|
|
48371
|
+
name: "X-API-Key",
|
|
48372
|
+
type: "apiKey"
|
|
48373
|
+
}],
|
|
48374
|
+
url: "/agent/v1/sessions/{session_id}/artifacts/{artifact_id}/content_url",
|
|
48375
|
+
...options,
|
|
48376
|
+
headers: {
|
|
48377
|
+
"Content-Type": "application/json",
|
|
48378
|
+
...options.headers
|
|
48379
|
+
}
|
|
48380
|
+
});
|
|
48381
|
+
var listSessionRequests = (options) => (options.client ?? client).get({
|
|
48382
|
+
security: [{
|
|
48383
|
+
key: "BearerAuth",
|
|
48384
|
+
scheme: "bearer",
|
|
48385
|
+
type: "http"
|
|
48386
|
+
}, {
|
|
48387
|
+
key: "ApiKeyAuth",
|
|
48388
|
+
name: "X-API-Key",
|
|
48389
|
+
type: "apiKey"
|
|
48390
|
+
}],
|
|
48391
|
+
url: "/agent/v1/sessions/{session_id}/requests",
|
|
48392
|
+
...options
|
|
48393
|
+
});
|
|
47306
48394
|
var listSessionBackgroundTasks = (options) => (options.client ?? client).get({
|
|
47307
48395
|
security: [{
|
|
47308
48396
|
key: "BearerAuth",
|
|
@@ -47948,6 +49036,45 @@ var createChatCompletion = (options) => (options.client ?? client).post({
|
|
|
47948
49036
|
...options.headers
|
|
47949
49037
|
}
|
|
47950
49038
|
});
|
|
49039
|
+
var disableModelAccess = (options) => (options.client ?? client).delete({
|
|
49040
|
+
security: [{
|
|
49041
|
+
key: "BearerAuth",
|
|
49042
|
+
scheme: "bearer",
|
|
49043
|
+
type: "http"
|
|
49044
|
+
}, {
|
|
49045
|
+
key: "ApiKeyAuth",
|
|
49046
|
+
name: "X-API-Key",
|
|
49047
|
+
type: "apiKey"
|
|
49048
|
+
}],
|
|
49049
|
+
url: "/model/v1/models/{model}/access",
|
|
49050
|
+
...options
|
|
49051
|
+
});
|
|
49052
|
+
var enableModelAccess = (options) => (options.client ?? client).put({
|
|
49053
|
+
security: [{
|
|
49054
|
+
key: "BearerAuth",
|
|
49055
|
+
scheme: "bearer",
|
|
49056
|
+
type: "http"
|
|
49057
|
+
}, {
|
|
49058
|
+
key: "ApiKeyAuth",
|
|
49059
|
+
name: "X-API-Key",
|
|
49060
|
+
type: "apiKey"
|
|
49061
|
+
}],
|
|
49062
|
+
url: "/model/v1/models/{model}/access",
|
|
49063
|
+
...options
|
|
49064
|
+
});
|
|
49065
|
+
var listModelAccess = (options) => (options?.client ?? client).get({
|
|
49066
|
+
security: [{
|
|
49067
|
+
key: "BearerAuth",
|
|
49068
|
+
scheme: "bearer",
|
|
49069
|
+
type: "http"
|
|
49070
|
+
}, {
|
|
49071
|
+
key: "ApiKeyAuth",
|
|
49072
|
+
name: "X-API-Key",
|
|
49073
|
+
type: "apiKey"
|
|
49074
|
+
}],
|
|
49075
|
+
url: "/model/v1/model-access",
|
|
49076
|
+
...options
|
|
49077
|
+
});
|
|
47951
49078
|
var getGeneration = (options) => (options.client ?? client).get({
|
|
47952
49079
|
security: [{
|
|
47953
49080
|
key: "BearerAuth",
|
|
@@ -53148,6 +54275,19 @@ var devopsFlagsCreate = (options) => (options.client ?? client).post({
|
|
|
53148
54275
|
...options.headers
|
|
53149
54276
|
}
|
|
53150
54277
|
});
|
|
54278
|
+
var devopsFlagsReportCodeRefs = (options) => (options.client ?? client).post({
|
|
54279
|
+
security: [{
|
|
54280
|
+
key: "devops-bearerAuth",
|
|
54281
|
+
scheme: "bearer",
|
|
54282
|
+
type: "http"
|
|
54283
|
+
}],
|
|
54284
|
+
url: "/devops/v1/projects/{project}/flags/code-refs",
|
|
54285
|
+
...options,
|
|
54286
|
+
headers: {
|
|
54287
|
+
"Content-Type": "application/json",
|
|
54288
|
+
...options.headers
|
|
54289
|
+
}
|
|
54290
|
+
});
|
|
53151
54291
|
var devopsFlagsGet = (options) => (options.client ?? client).get({
|
|
53152
54292
|
security: [{
|
|
53153
54293
|
key: "devops-bearerAuth",
|
|
@@ -54361,6 +55501,41 @@ var mediaGetGenerationCapabilities = (options) => (options?.client ?? client).ge
|
|
|
54361
55501
|
url: "/media/v1/generation/capabilities",
|
|
54362
55502
|
...options
|
|
54363
55503
|
});
|
|
55504
|
+
var mediaAlignAsset = (options) => (options.client ?? client).post({
|
|
55505
|
+
security: [{
|
|
55506
|
+
key: "media-BearerAuth",
|
|
55507
|
+
scheme: "bearer",
|
|
55508
|
+
type: "http"
|
|
55509
|
+
}],
|
|
55510
|
+
url: "/media/v1/libraries/{library_id}/assets/{asset_id}/align",
|
|
55511
|
+
...options,
|
|
55512
|
+
headers: {
|
|
55513
|
+
"Content-Type": "application/json",
|
|
55514
|
+
...options.headers
|
|
55515
|
+
}
|
|
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
|
+
});
|
|
54364
55539
|
var ontologyListTypes = (options) => (options?.client ?? client).get({
|
|
54365
55540
|
security: [{
|
|
54366
55541
|
key: "ontology-bearerAuth",
|
|
@@ -54528,6 +55703,194 @@ var ontologySearch = (options) => (options.client ?? client).post({
|
|
|
54528
55703
|
...options.headers
|
|
54529
55704
|
}
|
|
54530
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
|
+
});
|
|
54531
55894
|
var getSandboxV1Sandboxes = (options) => (options?.client ?? client).get({
|
|
54532
55895
|
querySerializer: { parameters: { state: { array: { explode: false } } } },
|
|
54533
55896
|
security: [
|
|
@@ -55493,6 +56856,46 @@ var searchMap = (options) => (options.client ?? client).post({
|
|
|
55493
56856
|
...options.headers
|
|
55494
56857
|
}
|
|
55495
56858
|
});
|
|
56859
|
+
var shareListPermissions = (options) => (options?.client ?? client).get({
|
|
56860
|
+
security: [{
|
|
56861
|
+
key: "share-bearerAuth",
|
|
56862
|
+
scheme: "bearer",
|
|
56863
|
+
type: "http"
|
|
56864
|
+
}],
|
|
56865
|
+
url: "/share/v1/permissions",
|
|
56866
|
+
...options
|
|
56867
|
+
});
|
|
56868
|
+
var shareCreatePermission = (options) => (options.client ?? client).post({
|
|
56869
|
+
security: [{
|
|
56870
|
+
key: "share-bearerAuth",
|
|
56871
|
+
scheme: "bearer",
|
|
56872
|
+
type: "http"
|
|
56873
|
+
}],
|
|
56874
|
+
url: "/share/v1/permissions",
|
|
56875
|
+
...options,
|
|
56876
|
+
headers: {
|
|
56877
|
+
"Content-Type": "application/json",
|
|
56878
|
+
...options.headers
|
|
56879
|
+
}
|
|
56880
|
+
});
|
|
56881
|
+
var shareDeletePermission = (options) => (options.client ?? client).delete({
|
|
56882
|
+
security: [{
|
|
56883
|
+
key: "share-bearerAuth",
|
|
56884
|
+
scheme: "bearer",
|
|
56885
|
+
type: "http"
|
|
56886
|
+
}],
|
|
56887
|
+
url: "/share/v1/permissions/{id}",
|
|
56888
|
+
...options
|
|
56889
|
+
});
|
|
56890
|
+
var shareRetrievePermission = (options) => (options.client ?? client).get({
|
|
56891
|
+
security: [{
|
|
56892
|
+
key: "share-bearerAuth",
|
|
56893
|
+
scheme: "bearer",
|
|
56894
|
+
type: "http"
|
|
56895
|
+
}],
|
|
56896
|
+
url: "/share/v1/permissions/{id}",
|
|
56897
|
+
...options
|
|
56898
|
+
});
|
|
55496
56899
|
var studioGenresList = (options) => (options?.client ?? client).get({
|
|
55497
56900
|
security: [{
|
|
55498
56901
|
key: "BearerAuth",
|
|
@@ -57529,6 +58932,11 @@ function createAgent(transport) {
|
|
|
57529
58932
|
send: bind(transport, sendAgentEvents),
|
|
57530
58933
|
stream: bindStream(transport, streamAgentEvents)
|
|
57531
58934
|
},
|
|
58935
|
+
inbox: {
|
|
58936
|
+
letters: {
|
|
58937
|
+
list: bind(transport, listAgentInboxLetters)
|
|
58938
|
+
}
|
|
58939
|
+
},
|
|
57532
58940
|
list: bind(transport, agentsList),
|
|
57533
58941
|
retrieve: bind(transport, agentsRetrieve),
|
|
57534
58942
|
retrieveAppearance: bind(transport, getAgentAppearance),
|
|
@@ -57593,6 +59001,12 @@ function createAgent(transport) {
|
|
|
57593
59001
|
},
|
|
57594
59002
|
sessions: {
|
|
57595
59003
|
archive: bind(transport, sessionsArchive),
|
|
59004
|
+
artifacts: {
|
|
59005
|
+
contentUrl: {
|
|
59006
|
+
create: bind(transport, createSessionArtifactContentUrl)
|
|
59007
|
+
},
|
|
59008
|
+
list: bind(transport, listSessionArtifacts)
|
|
59009
|
+
},
|
|
57596
59010
|
backgroundTasks: {
|
|
57597
59011
|
list: bind(transport, listSessionBackgroundTasks),
|
|
57598
59012
|
retrieveOutput: bind(transport, getSessionBackgroundTaskOutput),
|
|
@@ -57611,6 +59025,9 @@ function createAgent(transport) {
|
|
|
57611
59025
|
},
|
|
57612
59026
|
fork: bind(transport, forkSession),
|
|
57613
59027
|
list: bind(transport, sessionsList),
|
|
59028
|
+
requests: {
|
|
59029
|
+
list: bind(transport, listSessionRequests)
|
|
59030
|
+
},
|
|
57614
59031
|
resources: {
|
|
57615
59032
|
create: bind(transport, sessionsResourcesAdd),
|
|
57616
59033
|
delete: bind(transport, aliasOperation(sessionsResourcesDelete, { query: { session_id: "query_session_id" } })),
|
|
@@ -58123,7 +59540,8 @@ function createDevops(transport) {
|
|
|
58123
59540
|
},
|
|
58124
59541
|
flags: {
|
|
58125
59542
|
create: bind(transport, devopsFlagsCreate),
|
|
58126
|
-
list: bind(transport, devopsFlagsList)
|
|
59543
|
+
list: bind(transport, devopsFlagsList),
|
|
59544
|
+
reportCodeRefs: bind(transport, devopsFlagsReportCodeRefs)
|
|
58127
59545
|
},
|
|
58128
59546
|
list: bind(transport, devopsProjectsList),
|
|
58129
59547
|
promotions: {
|
|
@@ -58327,12 +59745,19 @@ function createMedia(transport) {
|
|
|
58327
59745
|
},
|
|
58328
59746
|
libraries: {
|
|
58329
59747
|
assets: {
|
|
59748
|
+
align: {
|
|
59749
|
+
create: bind(transport, mediaAlignAsset)
|
|
59750
|
+
},
|
|
58330
59751
|
batch: bind(transport, mediaBatchAssets),
|
|
58331
59752
|
create: bind(transport, (options) => mediaUploadAsset({ ...options, bodySerializer: multipartBodySerializer, headers: { "Content-Type": null, ...options.headers } })),
|
|
58332
59753
|
delete: bind(transport, mediaDeleteAsset),
|
|
58333
59754
|
frames: {
|
|
58334
59755
|
create: bind(transport, mediaCreateFrameUrls)
|
|
58335
59756
|
},
|
|
59757
|
+
hls: {
|
|
59758
|
+
create: bind(transport, mediaRequestHlsRenditions),
|
|
59759
|
+
list: bind(transport, mediaGetHlsRenditions)
|
|
59760
|
+
},
|
|
58336
59761
|
import: {
|
|
58337
59762
|
create: bind(transport, mediaImportAsset)
|
|
58338
59763
|
},
|
|
@@ -58468,7 +59893,14 @@ function createModel(transport) {
|
|
|
58468
59893
|
countTokens: bind(transport, countTokens),
|
|
58469
59894
|
create: bindMixed(transport, createMessage)
|
|
58470
59895
|
},
|
|
59896
|
+
modelAccess: {
|
|
59897
|
+
list: bind(transport, listModelAccess)
|
|
59898
|
+
},
|
|
58471
59899
|
models: {
|
|
59900
|
+
access: {
|
|
59901
|
+
delete: bind(transport, disableModelAccess),
|
|
59902
|
+
update: bind(transport, enableModelAccess)
|
|
59903
|
+
},
|
|
58472
59904
|
list: bind(transport, listModels),
|
|
58473
59905
|
retrieve: bind(transport, retrieveModel)
|
|
58474
59906
|
},
|
|
@@ -58663,6 +60095,44 @@ function createOrganization(transport) {
|
|
|
58663
60095
|
}
|
|
58664
60096
|
};
|
|
58665
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
|
+
}
|
|
58666
60136
|
function createSandbox(transport) {
|
|
58667
60137
|
return {
|
|
58668
60138
|
events: {
|
|
@@ -58761,6 +60231,16 @@ function createSearch(transport) {
|
|
|
58761
60231
|
}
|
|
58762
60232
|
};
|
|
58763
60233
|
}
|
|
60234
|
+
function createShare(transport) {
|
|
60235
|
+
return {
|
|
60236
|
+
permissions: {
|
|
60237
|
+
create: bind(transport, shareCreatePermission),
|
|
60238
|
+
delete: bind(transport, shareDeletePermission),
|
|
60239
|
+
list: bind(transport, shareListPermissions),
|
|
60240
|
+
retrieve: bind(transport, shareRetrievePermission)
|
|
60241
|
+
}
|
|
60242
|
+
};
|
|
60243
|
+
}
|
|
58764
60244
|
function createStudio(transport) {
|
|
58765
60245
|
return {
|
|
58766
60246
|
codexes: {
|
|
@@ -59029,8 +60509,10 @@ var resourceFactories = {
|
|
|
59029
60509
|
model: createModel,
|
|
59030
60510
|
ontology: createOntology,
|
|
59031
60511
|
organization: createOrganization,
|
|
60512
|
+
registry: createRegistry,
|
|
59032
60513
|
sandbox: createSandbox,
|
|
59033
60514
|
search: createSearch,
|
|
60515
|
+
share: createShare,
|
|
59034
60516
|
studio: createStudio,
|
|
59035
60517
|
ticket: createTicket,
|
|
59036
60518
|
vault: createVault
|
|
@@ -60423,6 +61905,14 @@ var multipartBinaryFields = {
|
|
|
60423
61905
|
"POST /model/v1/images/edits": [],
|
|
60424
61906
|
"POST /model/v1/videos": [
|
|
60425
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"
|
|
60426
61916
|
]
|
|
60427
61917
|
};
|
|
60428
61918
|
|
|
@@ -60848,7 +62338,7 @@ function help(commands, prefix, command) {
|
|
|
60848
62338
|
...[...operationOptions(command.op), ...bodyDataOption(command.op), ...globalOptions].map((s) => ` ${describeOption(s, s.required && fieldRequired(command.op, s, s.location ?? "query"))}`),
|
|
60849
62339
|
...command.op.body?.fields.filter((f) => !operationOptions(command.op).some((s) => s.location === "body" && s.field === f) && (f.type === "object" || f.type === "array" && !["string", "number", "integer", "boolean"].includes(f.itemType ?? ""))).map((f) => ` --data: ${f.name} (${f.type}${f.required ? ", required" : ""})`) ?? [],
|
|
60850
62340
|
" -h is an alias of --help",
|
|
60851
|
-
"PRAXIS_ENV=develop
|
|
62341
|
+
"PRAXIS_ENV=production|develop (default: production; develop must be named); no --env option.",
|
|
60852
62342
|
"",
|
|
60853
62343
|
"Examples:",
|
|
60854
62344
|
` ${example(command)}`
|
|
@@ -60860,7 +62350,7 @@ function help(commands, prefix, command) {
|
|
|
60860
62350
|
"Global options:",
|
|
60861
62351
|
...globalOptions.map((s) => ` ${describeOption(s)}`),
|
|
60862
62352
|
" -h is an alias of --help",
|
|
60863
|
-
"PRAXIS_ENV=develop
|
|
62353
|
+
"PRAXIS_ENV=production|develop (default: production; develop must be named); no --env option.",
|
|
60864
62354
|
""
|
|
60865
62355
|
];
|
|
60866
62356
|
const sample = matching.find((c) => c.words.at(-1) === "list") ?? matching[0];
|
|
@@ -61218,7 +62708,7 @@ var workflows = [
|
|
|
61218
62708
|
],
|
|
61219
62709
|
group: "local",
|
|
61220
62710
|
network: "offline",
|
|
61221
|
-
platform: "the `@
|
|
62711
|
+
platform: "the `@deepractice-ai/devops-refactor` engine's own `mise code refactor rename|check|apply`: this is their thin shell, one for one (ADR-125 §3).",
|
|
61222
62712
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61223
62713
|
},
|
|
61224
62714
|
{
|
|
@@ -61307,30 +62797,31 @@ var workflows = [
|
|
|
61307
62797
|
{
|
|
61308
62798
|
words: ["devops", "flag", "refs"],
|
|
61309
62799
|
requires: "checkout",
|
|
61310
|
-
usage: "devops flag refs [key]",
|
|
61311
|
-
summary: "Where each flag key is referenced in this checkout: file and line, for every registered key or one named key.",
|
|
61312
|
-
example: "praxis devops flag refs",
|
|
62800
|
+
usage: "devops flag refs [key] [--report --project <dvp_…>]",
|
|
62801
|
+
summary: "Where each flag key is referenced in this checkout: file and line, for every registered key or one named key. With --report the whole scan of every registered key is posted to the platform, which is what lets archiving a flag be refused while code still names it.",
|
|
62802
|
+
example: "praxis devops flag refs --report --project dvp_…",
|
|
61313
62803
|
examples: [
|
|
61314
62804
|
"praxis devops flag refs",
|
|
61315
|
-
"praxis devops flag refs run-page-v2"
|
|
62805
|
+
"praxis devops flag refs run-page-v2",
|
|
62806
|
+
"praxis devops flag refs --report --project dvp_…"
|
|
61316
62807
|
],
|
|
61317
62808
|
group: "local",
|
|
61318
|
-
network: "
|
|
61319
|
-
platform: "
|
|
62809
|
+
network: "Offline. --report: needs a login and sends this checkout's references to the platform",
|
|
62810
|
+
platform: "the platform half of the scan: `devops.flags.reportCodeRefs` stores the references on each flag of the project (0 for a key this scan no longer finds), `devops.flags.listCodeRefs` reads them back, and `praxis api devops flag archive <flg_…>` refuses while a flag still has references or is still on in an environment (ADR-125 §4).",
|
|
61320
62811
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61321
62812
|
},
|
|
61322
62813
|
{
|
|
61323
62814
|
words: ["devops", "flag", "remove"],
|
|
61324
62815
|
requires: "checkout",
|
|
61325
62816
|
usage: "devops flag remove <key>",
|
|
61326
|
-
summary: "The local step of removing a flag: list the remaining references, or the steps that follow once none remain. Order:
|
|
62817
|
+
summary: "The local step of removing a flag: list the remaining references, or the steps that follow once none remain. Order: turn the flag off in every environment (praxis api devops flag environment update), delete the code that names the key and deploy it, run this command, report the scan with praxis devops flag refs --report, then retire the flag on the platform with praxis api devops flag archive <flg_…> (irreversible; it is refused while references remain or an environment still has it on), then regenerate the registry with praxis devops flag sync.",
|
|
61327
62818
|
example: "praxis devops flag remove run-page-v2",
|
|
61328
62819
|
examples: [
|
|
61329
62820
|
"praxis devops flag remove run-page-v2"
|
|
61330
62821
|
],
|
|
61331
62822
|
group: "local",
|
|
61332
62823
|
network: "offline",
|
|
61333
|
-
platform: "praxis api devops flag archive — retires the flag on the platform after the code that named it is deployed away
|
|
62824
|
+
platform: "praxis api devops flag archive — retires the flag on the platform after the code that named it is deployed away, and keeps the key reserved; it is refused, not forced, while the references the last `praxis devops flag refs --report` wrote remain or the flag is still on in an environment (ADR-050 §7, ADR-125 §4).",
|
|
61334
62825
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61335
62826
|
},
|
|
61336
62827
|
{
|
|
@@ -61347,6 +62838,41 @@ var workflows = [
|
|
|
61347
62838
|
platform: "praxis api devops project change create — the platform creates and names a Change; the CLI only lands its branch (ADR-125 §5).",
|
|
61348
62839
|
docs: "https://docs.deepraxis.com/docs/cli"
|
|
61349
62840
|
},
|
|
62841
|
+
{
|
|
62842
|
+
words: ["agent", "events", "wait"],
|
|
62843
|
+
usage: "agent events wait [--timeout <seconds>]",
|
|
62844
|
+
summary: "Wait until a new letter arrives for your assume agent (PRAXIS_ASSUME_AGENT, default R1M9TQ2X), print who wrote and how to read it, and exit 0. It first checks the waiting letters once, so mail that arrived while nothing waited is reported at once; then it follows the agent's event stream, reconnecting with backoff. Nothing is marked read. Run it as a background task in Claude Code: its exit wakes the idle session; read the mail with praxis_assume_inbox and start it again.",
|
|
62845
|
+
example: "PRAXIS_ASSUME_AGENT=R1M9TQ2X praxis agent events wait",
|
|
62846
|
+
network: "online"
|
|
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
|
+
},
|
|
61350
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"' },
|
|
61351
62877
|
{ words: ["skill"], usage: "skill [--install <dir>]", summary: "Print the AI skill, or write <dir>/praxis-cli/SKILL.md." },
|
|
61352
62878
|
{
|
|
@@ -61416,7 +62942,7 @@ function workflowHelp(workflow, options) {
|
|
|
61416
62942
|
"Options:",
|
|
61417
62943
|
...[...options, ...globalOptions].map((s) => ` ${describeOption(s)}`),
|
|
61418
62944
|
" -h is an alias of --help",
|
|
61419
|
-
"PRAXIS_ENV=develop
|
|
62945
|
+
"PRAXIS_ENV=production|develop (default: production; develop must be named); no --env option.",
|
|
61420
62946
|
...workflow.requires === "checkout" ? [`Requires: ${CHECKOUT_REQUIREMENT}`] : [],
|
|
61421
62947
|
...workflow.notes?.length ? ["", ...workflow.notes] : [],
|
|
61422
62948
|
...workflow.network ? ["", `Network: ${workflow.network}`] : [],
|
|
@@ -62939,54 +64465,68 @@ function wranglerEdges(nodes) {
|
|
|
62939
64465
|
}
|
|
62940
64466
|
return edges;
|
|
62941
64467
|
}
|
|
62942
|
-
// ../../packages/praxis/deploy-core/src/
|
|
62943
|
-
|
|
62944
|
-
|
|
62945
|
-
|
|
62946
|
-
|
|
62947
|
-
|
|
62948
|
-
|
|
62949
|
-
|
|
62950
|
-
|
|
62951
|
-
|
|
62952
|
-
|
|
62953
|
-
|
|
62954
|
-
|
|
62955
|
-
if (typeof version !== "string" || !version.startsWith("workspace:") || dependencies.has(dependency))
|
|
62956
|
-
continue;
|
|
62957
|
-
dependencies.add(dependency);
|
|
62958
|
-
if (field === "devDependencies")
|
|
62959
|
-
devOnly.add(dependency);
|
|
62960
|
-
}
|
|
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" };
|
|
62961
64481
|
}
|
|
62962
|
-
return {
|
|
62963
|
-
...typeof name === "string" && name !== "" ? { name } : {},
|
|
62964
|
-
workspaceDependencies: [...dependencies].sort(),
|
|
62965
|
-
devOnlyWorkspaceDependencies: [...devOnly].sort()
|
|
62966
|
-
};
|
|
62967
64482
|
}
|
|
62968
|
-
function
|
|
62969
|
-
|
|
62970
|
-
|
|
62971
|
-
return null;
|
|
62972
|
-
const deepracticex = parsed.deepracticex;
|
|
62973
|
-
if (deepracticex === null || typeof deepracticex !== "object")
|
|
62974
|
-
return null;
|
|
62975
|
-
const lifecycle = deepracticex.lifecycle;
|
|
62976
|
-
return lifecycle !== null && typeof lifecycle === "object" ? lifecycle : null;
|
|
64483
|
+
function formatDeployEvent(event) {
|
|
64484
|
+
return `${JSON.stringify(event)}
|
|
64485
|
+
`;
|
|
62977
64486
|
}
|
|
62978
|
-
function
|
|
62979
|
-
|
|
62980
|
-
|
|
62981
|
-
|
|
62982
|
-
|
|
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();
|
|
62983
64495
|
}
|
|
62984
|
-
function
|
|
62985
|
-
|
|
62986
|
-
|
|
62987
|
-
|
|
62988
|
-
|
|
62989
|
-
|
|
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";
|
|
62990
64530
|
}
|
|
62991
64531
|
// ../../packages/praxis/deploy-core/node_modules/yaml/dist/index.js
|
|
62992
64532
|
var composer = require_composer2();
|
|
@@ -63034,6 +64574,259 @@ var $stringify = publicApi.stringify;
|
|
|
63034
64574
|
var $visit = visit.visit;
|
|
63035
64575
|
var $visitAsync = visit.visitAsync;
|
|
63036
64576
|
|
|
64577
|
+
// ../../packages/praxis/deploy-core/src/lambda-function.ts
|
|
64578
|
+
var LAMBDA_FUNCTIONS_ROOT = "services/lambda/functions";
|
|
64579
|
+
var UPSTREAM = "aliyun-fc";
|
|
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
|
+
];
|
|
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
|
+
}
|
|
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
|
+
}
|
|
64678
|
+
function lambdaFunctionOf(text) {
|
|
64679
|
+
const parsed = text === null ? null : parseJsonc2(text);
|
|
64680
|
+
if (parsed === null)
|
|
64681
|
+
return null;
|
|
64682
|
+
if (!isText(parsed.name) || !isText(parsed.upstream))
|
|
64683
|
+
return null;
|
|
64684
|
+
if (!Array.isArray(parsed.regions) || parsed.regions.length === 0 || !parsed.regions.every(isText))
|
|
64685
|
+
return null;
|
|
64686
|
+
if (parsed.gpu !== undefined && !isText(parsed.gpu))
|
|
64687
|
+
return null;
|
|
64688
|
+
if (!isCount(parsed.cpu, 1, 256))
|
|
64689
|
+
return null;
|
|
64690
|
+
if (!isCount(parsed.memoryMb, 128, 32 * 1024))
|
|
64691
|
+
return null;
|
|
64692
|
+
if (!isCount(parsed.timeoutSeconds, 1, 24 * 3600))
|
|
64693
|
+
return null;
|
|
64694
|
+
if (!isCount(parsed.concurrency, 1, 1024))
|
|
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
|
+
}
|
|
64705
|
+
return {
|
|
64706
|
+
name: parsed.name,
|
|
64707
|
+
upstream: parsed.upstream,
|
|
64708
|
+
regions: [...parsed.regions],
|
|
64709
|
+
...parsed.gpu === undefined ? {} : { gpu: parsed.gpu },
|
|
64710
|
+
cpu: parsed.cpu,
|
|
64711
|
+
memoryMb: parsed.memoryMb,
|
|
64712
|
+
timeoutSeconds: parsed.timeoutSeconds,
|
|
64713
|
+
concurrency: parsed.concurrency,
|
|
64714
|
+
...parsed.diskSizeMb === undefined ? {} : { diskSizeMb: parsed.diskSizeMb },
|
|
64715
|
+
...code === undefined ? {} : { code }
|
|
64716
|
+
};
|
|
64717
|
+
}
|
|
64718
|
+
var escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
64719
|
+
async function scanRecipes(facts) {
|
|
64720
|
+
const declared = lambdaFunctionRootsOf(await facts.read(PROJECT_FILE));
|
|
64721
|
+
const found = [];
|
|
64722
|
+
const warnings = [...declared.warnings];
|
|
64723
|
+
const matchers = declared.roots.map((root) => ({
|
|
64724
|
+
root,
|
|
64725
|
+
pattern: new RegExp(`^${escapeRegExp(root.root)}/([^/]+)/function\\.json$`)
|
|
64726
|
+
}));
|
|
64727
|
+
for (const path of [...facts.tree].sort()) {
|
|
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 });
|
|
64745
|
+
}
|
|
64746
|
+
}
|
|
64747
|
+
return { found, warnings };
|
|
64748
|
+
}
|
|
64749
|
+
function lambdaFunctionProvider(_options = {}) {
|
|
64750
|
+
return {
|
|
64751
|
+
id: "lambda-function",
|
|
64752
|
+
async detect(facts) {
|
|
64753
|
+
return (await scanRecipes(facts)).found.length > 0 ? "certain" : "none";
|
|
64754
|
+
},
|
|
64755
|
+
async plan(facts, partial) {
|
|
64756
|
+
const claimed = new Set(partial.targets.map((target) => target.path));
|
|
64757
|
+
const scan = await scanRecipes(facts);
|
|
64758
|
+
const targets = [];
|
|
64759
|
+
const byOwner = new Map;
|
|
64760
|
+
for (const { recipe, path, root } of scan.found) {
|
|
64761
|
+
const name = `lambda-${recipe.name}`;
|
|
64762
|
+
if (claimed.has(path))
|
|
64763
|
+
continue;
|
|
64764
|
+
targets.push({ path, name, destination: "aliyun-fc", production: true, onTrain: true });
|
|
64765
|
+
if (root.owner === "")
|
|
64766
|
+
continue;
|
|
64767
|
+
byOwner.set(root.owner, [...byOwner.get(root.owner) ?? [], path]);
|
|
64768
|
+
}
|
|
64769
|
+
const refined = partial.targets.map((target) => {
|
|
64770
|
+
const paths = byOwner.get(target.path);
|
|
64771
|
+
return paths === undefined ? target : { ...target, dependsOn: [...new Set([...target.dependsOn ?? [], ...paths])] };
|
|
64772
|
+
});
|
|
64773
|
+
return {
|
|
64774
|
+
targets: [...refined, ...targets],
|
|
64775
|
+
...scan.warnings.length === 0 ? {} : { warnings: [...partial.warnings ?? [], ...scan.warnings] }
|
|
64776
|
+
};
|
|
64777
|
+
}
|
|
64778
|
+
};
|
|
64779
|
+
}
|
|
64780
|
+
var lambdaFunction = lambdaFunctionProvider();
|
|
64781
|
+
// ../../packages/praxis/deploy-core/src/package-manifest.ts
|
|
64782
|
+
function packageManifestOf(text) {
|
|
64783
|
+
const parsed = text === null ? null : parseJsonc2(text);
|
|
64784
|
+
if (parsed === null)
|
|
64785
|
+
return null;
|
|
64786
|
+
const name = parsed.name;
|
|
64787
|
+
const dependencies = new Set;
|
|
64788
|
+
const devOnly = new Set;
|
|
64789
|
+
for (const field of ["dependencies", "peerDependencies", "optionalDependencies", "devDependencies"]) {
|
|
64790
|
+
const block = parsed[field];
|
|
64791
|
+
if (block === null || typeof block !== "object" || Array.isArray(block))
|
|
64792
|
+
continue;
|
|
64793
|
+
for (const [dependency, version] of Object.entries(block)) {
|
|
64794
|
+
if (typeof version !== "string" || !version.startsWith("workspace:") || dependencies.has(dependency))
|
|
64795
|
+
continue;
|
|
64796
|
+
dependencies.add(dependency);
|
|
64797
|
+
if (field === "devDependencies")
|
|
64798
|
+
devOnly.add(dependency);
|
|
64799
|
+
}
|
|
64800
|
+
}
|
|
64801
|
+
return {
|
|
64802
|
+
...typeof name === "string" && name !== "" ? { name } : {},
|
|
64803
|
+
workspaceDependencies: [...dependencies].sort(),
|
|
64804
|
+
devOnlyWorkspaceDependencies: [...devOnly].sort()
|
|
64805
|
+
};
|
|
64806
|
+
}
|
|
64807
|
+
function lifecycleOf(text) {
|
|
64808
|
+
const parsed = text === null ? null : parseJsonc2(text);
|
|
64809
|
+
if (parsed === null)
|
|
64810
|
+
return null;
|
|
64811
|
+
const deepracticex = parsed.deepracticex;
|
|
64812
|
+
if (deepracticex === null || typeof deepracticex !== "object")
|
|
64813
|
+
return null;
|
|
64814
|
+
const lifecycle = deepracticex.lifecycle;
|
|
64815
|
+
return lifecycle !== null && typeof lifecycle === "object" ? lifecycle : null;
|
|
64816
|
+
}
|
|
64817
|
+
function isDeployable(lifecycle) {
|
|
64818
|
+
if (lifecycle?.deploy === false)
|
|
64819
|
+
return false;
|
|
64820
|
+
const environments = lifecycle?.deployEnvironments;
|
|
64821
|
+
return !(Array.isArray(environments) && environments.length === 0);
|
|
64822
|
+
}
|
|
64823
|
+
function environmentsOf(lifecycle) {
|
|
64824
|
+
const environments = lifecycle?.deployEnvironments;
|
|
64825
|
+
if (!Array.isArray(environments))
|
|
64826
|
+
return;
|
|
64827
|
+
const named = environments.filter((entry) => typeof entry === "string");
|
|
64828
|
+
return named.length === 0 ? undefined : named;
|
|
64829
|
+
}
|
|
63037
64830
|
// ../../packages/praxis/deploy-core/src/workspace.ts
|
|
63038
64831
|
function packageJsonIn(dir) {
|
|
63039
64832
|
return dir === "." ? "package.json" : `${dir}/package.json`;
|
|
@@ -63045,6 +64838,16 @@ function dirOfPackageJson(path) {
|
|
|
63045
64838
|
return;
|
|
63046
64839
|
return path.slice(0, -"/package.json".length);
|
|
63047
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
|
+
}
|
|
63048
64851
|
function dirOfManifest(path) {
|
|
63049
64852
|
for (const name of BUILD_MANIFESTS) {
|
|
63050
64853
|
if (path === name)
|
|
@@ -63096,13 +64899,21 @@ function matchesPattern(pattern, path) {
|
|
|
63096
64899
|
}
|
|
63097
64900
|
async function workspaceIndexOf(facts, options = {}) {
|
|
63098
64901
|
const tree = new Set(facts.tree);
|
|
63099
|
-
|
|
64902
|
+
return workspaceIndexOfSync({
|
|
64903
|
+
tree: facts.tree,
|
|
63100
64904
|
packageJson: tree.has("package.json") ? await facts.read("package.json") : null,
|
|
63101
64905
|
pnpmWorkspace: tree.has("pnpm-workspace.yaml") ? await facts.read("pnpm-workspace.yaml") : null
|
|
64906
|
+
}, options);
|
|
64907
|
+
}
|
|
64908
|
+
function workspaceIndexOfSync(input, options = {}) {
|
|
64909
|
+
const tree = new Set(input.tree);
|
|
64910
|
+
const declared = workspacePatternsOf({
|
|
64911
|
+
packageJson: input.packageJson,
|
|
64912
|
+
pnpmWorkspace: input.pnpmWorkspace
|
|
63102
64913
|
});
|
|
63103
64914
|
const patterns = declared.length > 0 ? declared : options.defaultPatterns ?? [];
|
|
63104
64915
|
const candidates2 = new Set;
|
|
63105
|
-
for (const path of
|
|
64916
|
+
for (const path of input.tree) {
|
|
63106
64917
|
const dir = dirOfPackageJson(path) ?? dirOfManifest(path);
|
|
63107
64918
|
if (dir === undefined || dir === ".")
|
|
63108
64919
|
continue;
|
|
@@ -63121,6 +64932,61 @@ async function workspaceIndexOf(facts, options = {}) {
|
|
|
63121
64932
|
};
|
|
63122
64933
|
}
|
|
63123
64934
|
|
|
64935
|
+
// ../../packages/praxis/deploy-core/src/workspace-npm.ts
|
|
64936
|
+
function npmLifecycleOf(lifecycle) {
|
|
64937
|
+
const npm = lifecycle?.npm;
|
|
64938
|
+
if (npm === null || typeof npm !== "object" || Array.isArray(npm))
|
|
64939
|
+
return null;
|
|
64940
|
+
const build = npm.build;
|
|
64941
|
+
if (typeof build !== "string" || build.trim() === "")
|
|
64942
|
+
return null;
|
|
64943
|
+
const dir = npm.dir;
|
|
64944
|
+
return { build, ...typeof dir === "string" && dir.trim() !== "" ? { dir } : {} };
|
|
64945
|
+
}
|
|
64946
|
+
function isPublishableName(name) {
|
|
64947
|
+
return typeof name === "string" && name.startsWith("@deepraxis/") && name !== "@deepraxis/";
|
|
64948
|
+
}
|
|
64949
|
+
function isPrivateManifest(text) {
|
|
64950
|
+
const parsed = text === null ? null : parseJsonc2(text);
|
|
64951
|
+
return parsed?.private === true;
|
|
64952
|
+
}
|
|
64953
|
+
function workspaceNpmProvider(options = {}) {
|
|
64954
|
+
const candidatesOf = async (facts) => {
|
|
64955
|
+
const workspaces = await readWorkspaces(facts, options);
|
|
64956
|
+
return workspaces.filter((workspace) => npmLifecycleOf(workspace.lifecycle) !== null && isPublishableName(workspace.packageName)).map((workspace) => ({ dir: workspace.dir, name: workspace.packageName }));
|
|
64957
|
+
};
|
|
64958
|
+
const publishable = async (facts, dir) => !isPrivateManifest(await facts.read(packageJsonIn(dir)));
|
|
64959
|
+
return {
|
|
64960
|
+
id: "workspace-npm",
|
|
64961
|
+
async detect(facts) {
|
|
64962
|
+
for (const candidate of await candidatesOf(facts)) {
|
|
64963
|
+
if (await publishable(facts, candidate.dir))
|
|
64964
|
+
return "certain";
|
|
64965
|
+
}
|
|
64966
|
+
return "none";
|
|
64967
|
+
},
|
|
64968
|
+
async plan(facts, partial) {
|
|
64969
|
+
const claimed = new Set(partial.targets.map((target) => target.path));
|
|
64970
|
+
const targets = [];
|
|
64971
|
+
for (const candidate of await candidatesOf(facts)) {
|
|
64972
|
+
if (claimed.has(candidate.dir))
|
|
64973
|
+
continue;
|
|
64974
|
+
if (!await publishable(facts, candidate.dir))
|
|
64975
|
+
continue;
|
|
64976
|
+
targets.push({
|
|
64977
|
+
path: candidate.dir,
|
|
64978
|
+
name: candidate.name,
|
|
64979
|
+
destination: "npm",
|
|
64980
|
+
production: true,
|
|
64981
|
+
onTrain: true
|
|
64982
|
+
});
|
|
64983
|
+
}
|
|
64984
|
+
return { targets: [...partial.targets, ...targets] };
|
|
64985
|
+
}
|
|
64986
|
+
};
|
|
64987
|
+
}
|
|
64988
|
+
var workspaceNpm = workspaceNpmProvider();
|
|
64989
|
+
|
|
63124
64990
|
// ../../packages/praxis/deploy-core/src/workspace-cloudflare.ts
|
|
63125
64991
|
function readWorkspaces(facts, options = {}) {
|
|
63126
64992
|
const key = options.defaultPatterns === undefined ? "" : options.defaultPatterns.join(",");
|
|
@@ -63210,7 +65076,11 @@ function workspaceCloudflareProvider(options = {}) {
|
|
|
63210
65076
|
};
|
|
63211
65077
|
}
|
|
63212
65078
|
var workspaceCloudflare = workspaceCloudflareProvider();
|
|
63213
|
-
var BUILTIN_PROVIDERS = [
|
|
65079
|
+
var BUILTIN_PROVIDERS = [
|
|
65080
|
+
workspaceCloudflare,
|
|
65081
|
+
workspaceNpmProvider(),
|
|
65082
|
+
lambdaFunctionProvider()
|
|
65083
|
+
];
|
|
63214
65084
|
function directoriesOfPackageNames(workspaces) {
|
|
63215
65085
|
const byName = new Map;
|
|
63216
65086
|
for (const workspace of workspaces)
|
|
@@ -63237,15 +65107,23 @@ function workspaceClosureOf(target, byName, dependenciesOf) {
|
|
|
63237
65107
|
// ../../packages/praxis/deploy-core/src/plan.ts
|
|
63238
65108
|
async function planRepository(facts, providers = BUILTIN_PROVIDERS, options = {}) {
|
|
63239
65109
|
let partial = { targets: [] };
|
|
65110
|
+
const warnings = [];
|
|
63240
65111
|
for (const provider of providers) {
|
|
63241
65112
|
const confidence = await provider.detect(facts);
|
|
63242
65113
|
if (confidence === "none")
|
|
63243
65114
|
continue;
|
|
63244
65115
|
partial = await provider.plan(facts, partial);
|
|
65116
|
+
for (const warning of partial.warnings ?? [])
|
|
65117
|
+
if (!warnings.includes(warning))
|
|
65118
|
+
warnings.push(warning);
|
|
63245
65119
|
}
|
|
63246
65120
|
const drafts = partial.targets.filter((draft) => draft.deploy !== false);
|
|
63247
65121
|
const workspaces = await readWorkspaces(facts, options);
|
|
63248
|
-
return {
|
|
65122
|
+
return {
|
|
65123
|
+
commit: facts.commit,
|
|
65124
|
+
targets: closePlan(drafts, workspaces),
|
|
65125
|
+
...warnings.length === 0 ? {} : { warnings }
|
|
65126
|
+
};
|
|
63249
65127
|
}
|
|
63250
65128
|
function closePlan(drafts, workspaces) {
|
|
63251
65129
|
const configOf = new Map(workspaces.map((workspace) => [workspace.dir, workspace.config]));
|
|
@@ -63267,7 +65145,7 @@ function closePlan(drafts, workspaces) {
|
|
|
63267
65145
|
path: draft.path,
|
|
63268
65146
|
name: draft.name,
|
|
63269
65147
|
destination: draft.destination,
|
|
63270
|
-
dependsOn: edges.get(draft.path) ?? [],
|
|
65148
|
+
dependsOn: [...new Set([...edges.get(draft.path) ?? [], ...draft.dependsOn ?? []])],
|
|
63271
65149
|
...draft.environments === undefined ? {} : { environments: draft.environments },
|
|
63272
65150
|
production: draft.production === true,
|
|
63273
65151
|
onTrain: draft.onTrain !== false,
|
|
@@ -63276,10 +65154,10 @@ function closePlan(drafts, workspaces) {
|
|
|
63276
65154
|
}
|
|
63277
65155
|
function isDeployToolDependency(name, path) {
|
|
63278
65156
|
const directory = path.replace(/^(\.\/)+/, "").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
63279
|
-
|
|
63280
|
-
|
|
63281
|
-
|
|
63282
|
-
|
|
65157
|
+
for (const root of ["packages/mise", "packages/devops", "packages/testing", "packages/bdd"]) {
|
|
65158
|
+
if (directory === root || directory.startsWith(`${root}/`))
|
|
65159
|
+
return true;
|
|
65160
|
+
}
|
|
63283
65161
|
return name.startsWith("@mise/");
|
|
63284
65162
|
}
|
|
63285
65163
|
function targetsFor(plan, environment2) {
|
|
@@ -63377,68 +65255,216 @@ function stronglyConnected(count3, edges) {
|
|
|
63377
65255
|
visit2(node2);
|
|
63378
65256
|
return components;
|
|
63379
65257
|
}
|
|
63380
|
-
// ../../packages/praxis/deploy-core/src/
|
|
63381
|
-
var
|
|
63382
|
-
var
|
|
63383
|
-
function
|
|
63384
|
-
|
|
63385
|
-
|
|
63386
|
-
|
|
63387
|
-
|
|
63388
|
-
|
|
63389
|
-
|
|
63390
|
-
|
|
63391
|
-
|
|
63392
|
-
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;
|
|
63393
65270
|
}
|
|
65271
|
+
return false;
|
|
63394
65272
|
}
|
|
63395
|
-
function
|
|
63396
|
-
|
|
63397
|
-
|
|
63398
|
-
|
|
63399
|
-
|
|
63400
|
-
|
|
63401
|
-
|
|
63402
|
-
|
|
63403
|
-
|
|
63404
|
-
if (!Number.isFinite(minutes) || minutes <= 0)
|
|
63405
|
-
throw new Error(`--expire-minutes must be a positive number, got ${JSON.stringify(expireMinutes)}`);
|
|
63406
|
-
return new Date(start + minutes * 60000).toISOString();
|
|
63407
|
-
}
|
|
63408
|
-
function decidePhaseState(states) {
|
|
63409
|
-
if (states.length === 0)
|
|
63410
|
-
return "unspecified";
|
|
63411
|
-
if (states.some((state) => state === "failed" || state === "aborted"))
|
|
63412
|
-
return "failed";
|
|
63413
|
-
if (states.some((state) => state === "in_progress" || state === "pending"))
|
|
63414
|
-
return "in_progress";
|
|
63415
|
-
const neverRan = states.every((state) => state === "skipped" || state === "disabled");
|
|
63416
|
-
return neverRan ? "skipped" : "succeeded";
|
|
63417
|
-
}
|
|
63418
|
-
function decideRolloutState(jobs, options = {}) {
|
|
63419
|
-
const states = [...jobs.values()];
|
|
63420
|
-
if (states.some((state) => state === "failed" || state === "aborted"))
|
|
63421
|
-
return "failed";
|
|
63422
|
-
const deploy = jobs.get("deploy");
|
|
63423
|
-
if (deploy === undefined || deploy === "pending" || deploy === "in_progress" || deploy === "disabled")
|
|
63424
|
-
return "pending";
|
|
63425
|
-
if (deploy === "skipped" && options.artifactIdentical !== true)
|
|
63426
|
-
return "pending";
|
|
63427
|
-
if (states.every((state) => state === "succeeded" || state === "skipped" || state === "disabled" || state === "ignored")) {
|
|
63428
|
-
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 };
|
|
63429
65282
|
}
|
|
63430
|
-
return "
|
|
65283
|
+
return { kind: "unknown" };
|
|
63431
65284
|
}
|
|
63432
|
-
|
|
63433
|
-
|
|
63434
|
-
|
|
63435
|
-
|
|
63436
|
-
|
|
63437
|
-
|
|
63438
|
-
|
|
63439
|
-
|
|
63440
|
-
|
|
63441
|
-
|
|
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
|
+
};
|
|
63442
65468
|
}
|
|
63443
65469
|
// ../../packages/praxis/deploy-core/src/job-events-file.ts
|
|
63444
65470
|
import { appendFileSync, mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
@@ -63557,7 +65583,7 @@ function reportBlockedTarget(events, target, message) {
|
|
|
63557
65583
|
}
|
|
63558
65584
|
|
|
63559
65585
|
// src/commands/devops.ts
|
|
63560
|
-
var
|
|
65586
|
+
var import_yaml4 = __toESM(require_dist(), 1);
|
|
63561
65587
|
|
|
63562
65588
|
// src/commands/devops-deploy-plan.ts
|
|
63563
65589
|
import { resolve as resolve3 } from "node:path";
|
|
@@ -63985,7 +66011,8 @@ var DEPLOY_SHAPE = `devops:
|
|
|
63985
66011
|
cloudflare: bun tofu/adapter.ts
|
|
63986
66012
|
exclude: ["**/spec/features/*"] # optional
|
|
63987
66013
|
policy:
|
|
63988
|
-
forbiddenNames: <path> # optional
|
|
66014
|
+
forbiddenNames: <path> # optional
|
|
66015
|
+
identity: [cloudflare_workers_route.pattern] # optional`;
|
|
63989
66016
|
function parseDeployProject(file) {
|
|
63990
66017
|
const refuse = (what) => {
|
|
63991
66018
|
throw new UsageError(`praxis.yaml ${what}`, `praxis devops deploy needs, at the repository root:
|
|
@@ -64022,15 +66049,21 @@ ${DEPLOY_SHAPE}`);
|
|
|
64022
66049
|
refuse("devops.deploy.policy.allowDeletes must be a list of resource-address prefixes");
|
|
64023
66050
|
}
|
|
64024
66051
|
const allowDeletes = Array.isArray(declaredAllow) ? declaredAllow.map((e) => e.trim()) : [];
|
|
66052
|
+
const declaredIdentity = object(policy) ? policy.identity : undefined;
|
|
66053
|
+
if (declaredIdentity !== undefined && (!Array.isArray(declaredIdentity) || declaredIdentity.some((e) => typeof e !== "string" || !/^[A-Za-z0-9_]+\.[A-Za-z0-9_]+$/.test(e.trim())))) {
|
|
66054
|
+
refuse("devops.deploy.policy.identity must be a list of <resource type>.<attribute> pairs");
|
|
66055
|
+
}
|
|
66056
|
+
const identity2 = Array.isArray(declaredIdentity) ? declaredIdentity.map((e) => e.trim()) : [];
|
|
64025
66057
|
const exclude = Array.isArray(declaredExclude) ? declaredExclude.map((e) => e.trim().replace(/^\.\//, "").replace(/\/+$/, "")) : [];
|
|
64026
66058
|
return {
|
|
64027
66059
|
adapters,
|
|
64028
66060
|
...typeof forbiddenNames === "string" ? { forbiddenNames: forbiddenNames.trim() } : {},
|
|
64029
66061
|
...exclude.length > 0 ? { exclude } : {},
|
|
64030
|
-
...allowDeletes.length > 0 ? { allowDeletes } : {}
|
|
66062
|
+
...allowDeletes.length > 0 ? { allowDeletes } : {},
|
|
66063
|
+
...identity2.length > 0 ? { identity: identity2 } : {}
|
|
64031
66064
|
};
|
|
64032
66065
|
}
|
|
64033
|
-
function forbiddenDeletes(showJson, allow = []) {
|
|
66066
|
+
function forbiddenDeletes(showJson, allow = [], identity2 = []) {
|
|
64034
66067
|
let doc;
|
|
64035
66068
|
try {
|
|
64036
66069
|
doc = JSON.parse(showJson);
|
|
@@ -64042,11 +66075,18 @@ function forbiddenDeletes(showJson, allow = []) {
|
|
|
64042
66075
|
return { ok: true, deletes: [] };
|
|
64043
66076
|
if (!Array.isArray(changes))
|
|
64044
66077
|
return { ok: false, reason: "the plan document has no resource_changes list" };
|
|
66078
|
+
const record = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
64045
66079
|
const deletes = [];
|
|
64046
66080
|
for (const change of changes) {
|
|
64047
66081
|
const actions = Array.isArray(change.change?.actions) ? change.change.actions : [];
|
|
64048
66082
|
const address = typeof change.address === "string" ? change.address : "?";
|
|
64049
|
-
|
|
66083
|
+
const type = typeof change.type === "string" ? change.type : address.split(".")[0];
|
|
66084
|
+
const before = record(change.change?.before), after = record(change.change?.after);
|
|
66085
|
+
const renamed = actions.includes("update") && identity2.some((pair) => {
|
|
66086
|
+
const [of, attribute] = pair.split(".");
|
|
66087
|
+
return of === type && JSON.stringify(before[attribute]) !== JSON.stringify(after[attribute]);
|
|
66088
|
+
});
|
|
66089
|
+
if ((actions.includes("delete") || renamed) && !allow.some((prefix) => address.startsWith(prefix)))
|
|
64050
66090
|
deletes.push(address);
|
|
64051
66091
|
}
|
|
64052
66092
|
return { ok: true, deletes };
|
|
@@ -64400,11 +66440,11 @@ async function runTofuDeploy(args, plan, ports) {
|
|
|
64400
66440
|
if (code !== 0)
|
|
64401
66441
|
throw new StepFailed(`rollout step show exited ${code}`);
|
|
64402
66442
|
const verdict = forbiddenDeletes(lines.join(`
|
|
64403
|
-
`), ports.project.allowDeletes ?? []);
|
|
66443
|
+
`), ports.project.allowDeletes ?? [], ports.project.identity ?? []);
|
|
64404
66444
|
if (!verdict.ok)
|
|
64405
66445
|
throw new StepFailed(verdict.reason);
|
|
64406
66446
|
if (verdict.deletes.length > 0) {
|
|
64407
|
-
throw new StepFailed(`the plan deletes or
|
|
66447
|
+
throw new StepFailed(`the plan deletes, replaces or renames ${verdict.deletes.join(", ")}; refused (praxis.yaml devops.deploy.policy.allowDeletes allows none of them)`);
|
|
64408
66448
|
}
|
|
64409
66449
|
};
|
|
64410
66450
|
const adapter = (t, phase) => step(t, "adapter", [phase], root, adapterEnv({ target: t.path, environment: args.environment, mode: args.mode, commit: args.commit, dir: targetDir(workdir, t.path) }));
|
|
@@ -64928,7 +66968,7 @@ async function devopsDeployTofu(flags, ports) {
|
|
|
64928
66968
|
const projectYaml = await ports.readFile(join5(ports.cwd, "praxis.yaml"));
|
|
64929
66969
|
let parsedYaml;
|
|
64930
66970
|
try {
|
|
64931
|
-
parsedYaml = projectYaml === null ? undefined :
|
|
66971
|
+
parsedYaml = projectYaml === null ? undefined : import_yaml4.parse(projectYaml);
|
|
64932
66972
|
} catch (error) {
|
|
64933
66973
|
throw new UsageError(`praxis.yaml is not valid YAML: ${error.message}`);
|
|
64934
66974
|
}
|
|
@@ -65014,7 +67054,7 @@ function planTest(flags, paths) {
|
|
|
65014
67054
|
}
|
|
65015
67055
|
function requireSingleCtrfTarget(targets) {
|
|
65016
67056
|
if (targets > 1)
|
|
65017
|
-
throw new UsageError("--ctrf names one report file but this selection covers several packages", "Run one package at a time with --ctrf, or drop --ctrf and read each run's own .
|
|
67057
|
+
throw new UsageError("--ctrf names one report file but this selection covers several packages", "Run one package at a time with --ctrf, or drop --ctrf and read each run's own .praxis/ctrf/<run>.json.");
|
|
65018
67058
|
}
|
|
65019
67059
|
var FAILURE_LIMIT2 = 20;
|
|
65020
67060
|
var member3 = (value, key) => typeof value === "object" && value !== null ? value[key] : undefined;
|
|
@@ -65178,17 +67218,6 @@ function selectAffected(input) {
|
|
|
65178
67218
|
reasons[spelled.get(relative2)] = reason;
|
|
65179
67219
|
return { tests: selected.map(({ relative: relative2 }) => spelled.get(relative2)), features, reasons, openIssues: [...AFFECTED_OPEN_ISSUES] };
|
|
65180
67220
|
}
|
|
65181
|
-
function nearestPackage(path, packages) {
|
|
65182
|
-
let found = null;
|
|
65183
|
-
for (const candidate of packages) {
|
|
65184
|
-
const root = candidate.replace(/\/+$/, "");
|
|
65185
|
-
if (!root || !(path === root || path.startsWith(`${root}/`)))
|
|
65186
|
-
continue;
|
|
65187
|
-
if (found === null || root.length > found.length)
|
|
65188
|
-
found = root;
|
|
65189
|
-
}
|
|
65190
|
-
return found;
|
|
65191
|
-
}
|
|
65192
67221
|
var BUN_FILE_HEADER = /^(\S.*\.(?:test|spec)\.(?:ts|tsx|js|mjs)):$/;
|
|
65193
67222
|
var BUN_COUNT = /^\s*(\d+)\s+(pass|fail|skip|todo)\b/;
|
|
65194
67223
|
var BUN_RAN = /^Ran (\d+) tests? across/;
|
|
@@ -65249,6 +67278,30 @@ function bunTestRun(packagePath, code, output) {
|
|
|
65249
67278
|
}
|
|
65250
67279
|
|
|
65251
67280
|
// src/commands/devops-test.ts
|
|
67281
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
67282
|
+
var CACHE_OFF_REEXEC_ENV = "PRAXIS_DEVOPS_TEST_CACHE_OFF";
|
|
67283
|
+
function needsCacheOffReexec(env) {
|
|
67284
|
+
return env.BUN_RUNTIME_TRANSPILER_CACHE_PATH !== "0" && !env[CACHE_OFF_REEXEC_ENV];
|
|
67285
|
+
}
|
|
67286
|
+
function isDevopsTestRun(words) {
|
|
67287
|
+
return words.join(" ") === "devops test";
|
|
67288
|
+
}
|
|
67289
|
+
function spawnInherit(cmd, args, options) {
|
|
67290
|
+
return new Promise((resolveCode) => {
|
|
67291
|
+
const child = spawn4(cmd, [...args], { cwd: options.cwd, env: options.env, stdio: "inherit" });
|
|
67292
|
+
child.once("error", (error) => {
|
|
67293
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
67294
|
+
resolveCode(1);
|
|
67295
|
+
});
|
|
67296
|
+
child.once("close", (code) => resolveCode(code ?? 1));
|
|
67297
|
+
});
|
|
67298
|
+
}
|
|
67299
|
+
function reexecWithCacheOff(options = {}) {
|
|
67300
|
+
return (options.spawn ?? spawnInherit)(process.execPath, options.argv ?? process.argv.slice(1), {
|
|
67301
|
+
cwd: options.cwd ?? process.cwd(),
|
|
67302
|
+
env: { ...options.env ?? process.env, BUN_RUNTIME_TRANSPILER_CACHE_PATH: "0", [CACHE_OFF_REEXEC_ENV]: "1" }
|
|
67303
|
+
});
|
|
67304
|
+
}
|
|
65252
67305
|
async function devopsTest(flags, paths, ports) {
|
|
65253
67306
|
const plan = planTest(flags, paths);
|
|
65254
67307
|
if (plan.mode.kind === "affected")
|
|
@@ -65291,38 +67344,69 @@ async function changedSelection(since, ports) {
|
|
|
65291
67344
|
const roots = await ports.checkout.roots();
|
|
65292
67345
|
const grouped = new Map;
|
|
65293
67346
|
for (const file of files) {
|
|
65294
|
-
const owner =
|
|
67347
|
+
const owner = packageDirOf(file, roots);
|
|
65295
67348
|
if (owner === null)
|
|
65296
67349
|
continue;
|
|
65297
67350
|
grouped.set(owner, [...grouped.get(owner) ?? [], file]);
|
|
65298
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"));
|
|
65299
67358
|
const groups = [];
|
|
65300
|
-
for (const root of
|
|
67359
|
+
for (const root of selectedRoots) {
|
|
65301
67360
|
const packagePath = join6(ports.checkout.root, root);
|
|
65302
|
-
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
|
+
});
|
|
65303
67367
|
}
|
|
65304
67368
|
const owned = new Set([...grouped.values()].flat());
|
|
65305
|
-
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 "改到了仓库根的解析类文件(整仓都可能受影响)";
|
|
65306
67377
|
}
|
|
65307
67378
|
async function runAffected(list, since, ports) {
|
|
65308
|
-
const { base, files, groups, unowned } = await changedSelection(since, ports);
|
|
67379
|
+
const { base, files, groups, unowned, widen, failed } = await changedSelection(since, ports);
|
|
65309
67380
|
const view = {
|
|
65310
67381
|
since: base,
|
|
65311
67382
|
packages: groups.map((group) => ({
|
|
65312
67383
|
path: group.root,
|
|
65313
67384
|
tests: group.selection.tests.map((file) => ({ file, reason: group.selection.reasons[file] })),
|
|
65314
|
-
features: group.selection.features
|
|
67385
|
+
features: group.selection.features,
|
|
67386
|
+
...group.whole ? { whole: true } : {}
|
|
65315
67387
|
})),
|
|
65316
67388
|
tests: groups.flatMap((group) => group.selection.tests),
|
|
65317
67389
|
features: groups.flatMap((group) => group.selection.features),
|
|
65318
67390
|
unowned,
|
|
67391
|
+
widen,
|
|
67392
|
+
failed,
|
|
65319
67393
|
openIssues: [...selectAffected({ changed: [], files: new Map, packageRoot: "" }).openIssues]
|
|
65320
67394
|
};
|
|
65321
|
-
const lines = [
|
|
65322
|
-
...
|
|
65323
|
-
...
|
|
65324
|
-
|
|
65325
|
-
|
|
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) {
|
|
65326
67410
|
ports.emit({ kind: "object", data: view });
|
|
65327
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(`
|
|
65328
67412
|
`));
|
|
@@ -65330,9 +67414,9 @@ async function runAffected(list, since, ports) {
|
|
|
65330
67414
|
}
|
|
65331
67415
|
const runs = [];
|
|
65332
67416
|
for (const group of groups) {
|
|
65333
|
-
const
|
|
65334
|
-
if (
|
|
65335
|
-
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);
|
|
65336
67420
|
runs.push(bunTestRun(group.root, result.code, result.output));
|
|
65337
67421
|
}
|
|
65338
67422
|
for (const feature of group.selection.features)
|
|
@@ -65373,7 +67457,7 @@ async function devopsTestReportUpload(args, ports) {
|
|
|
65373
67457
|
if (id === undefined || id === "")
|
|
65374
67458
|
throw new UsageError("--upload needs --id", "Run `praxis devops test report` first to list this machine's runs, then pass one with --id.");
|
|
65375
67459
|
const root = await ports.root();
|
|
65376
|
-
const file = join6(root, ".
|
|
67460
|
+
const file = join6(root, ".praxis", "ctrf", `${id}.json`);
|
|
65377
67461
|
let report;
|
|
65378
67462
|
try {
|
|
65379
67463
|
report = await ports.readFile(file);
|
|
@@ -65449,8 +67533,8 @@ async function devopsTestInspect(args, ports) {
|
|
|
65449
67533
|
return 0;
|
|
65450
67534
|
}
|
|
65451
67535
|
async function localEngine(cwd) {
|
|
65452
|
-
const { testCommand } = await import("@
|
|
65453
|
-
const { mise } = await import("@
|
|
67536
|
+
const { testCommand } = await import("@deepractice-ai/devops-test-engine/test-command");
|
|
67537
|
+
const { mise } = await import("@deepractice-ai/devops-test-engine");
|
|
65454
67538
|
const { createLocalPlatform } = await import("@deepractice-ai/bdd-local");
|
|
65455
67539
|
const { _scanPackages } = await import("@deepractice-ai/bdd-service/shared/bdd-config");
|
|
65456
67540
|
const platform = createLocalPlatform({ cwd });
|
|
@@ -65478,9 +67562,7 @@ async function localEngine(cwd) {
|
|
|
65478
67562
|
}),
|
|
65479
67563
|
sweep: async (params) => withEngineStdoutOnStderr(async () => {
|
|
65480
67564
|
const previousExitCode = process.exitCode ?? 0;
|
|
65481
|
-
const previousEntry = process.argv[1];
|
|
65482
67565
|
process.exitCode = 0;
|
|
65483
|
-
process.argv[1] = await miseCliEntry();
|
|
65484
67566
|
try {
|
|
65485
67567
|
const answer = await mise.handle(platform, "lab", {
|
|
65486
67568
|
path: "sweep",
|
|
@@ -65493,10 +67575,6 @@ async function localEngine(cwd) {
|
|
|
65493
67575
|
return { text: typeof answer.data === "string" ? answer.data : JSON.stringify(answer.data, null, 2), exitCode: process.exitCode ?? 0 };
|
|
65494
67576
|
} finally {
|
|
65495
67577
|
process.exitCode = previousExitCode;
|
|
65496
|
-
if (previousEntry === undefined)
|
|
65497
|
-
delete process.argv[1];
|
|
65498
|
-
else
|
|
65499
|
-
process.argv[1] = previousEntry;
|
|
65500
67578
|
}
|
|
65501
67579
|
}),
|
|
65502
67580
|
scaffold: async (params) => withEngineStdoutOnStderr(async () => {
|
|
@@ -65525,13 +67603,8 @@ async function localEngine(cwd) {
|
|
|
65525
67603
|
})
|
|
65526
67604
|
};
|
|
65527
67605
|
}
|
|
65528
|
-
async function
|
|
65529
|
-
const
|
|
65530
|
-
const { dirname: dirname8, resolve: resolve7 } = await import("node:path");
|
|
65531
|
-
return resolve7(dirname8(fileURLToPath(import.meta.resolve("@mise/bdd"))), "../../cli/src/cli.ts");
|
|
65532
|
-
}
|
|
65533
|
-
async function localCheckout(cwd, spawn4) {
|
|
65534
|
-
const git2 = (args) => spawn4("git", [...args], { cwd });
|
|
67606
|
+
async function localCheckout(cwd, spawn5) {
|
|
67607
|
+
const git2 = (args) => spawn5("git", [...args], { cwd });
|
|
65535
67608
|
const required = async (args) => {
|
|
65536
67609
|
const result = await git2(args);
|
|
65537
67610
|
if (result.code !== 0)
|
|
@@ -65567,7 +67640,7 @@ async function localCheckout(cwd, spawn4) {
|
|
|
65567
67640
|
const files = new Map;
|
|
65568
67641
|
const walk = async (dir) => {
|
|
65569
67642
|
for (const entry of await readdir2(dir, { withFileTypes: true })) {
|
|
65570
|
-
if (["node_modules", ".git", "dist", ".
|
|
67643
|
+
if (["node_modules", ".git", "dist", ".praxis"].includes(entry.name))
|
|
65571
67644
|
continue;
|
|
65572
67645
|
const full = join6(dir, entry.name);
|
|
65573
67646
|
if (entry.isDirectory()) {
|
|
@@ -65582,7 +67655,16 @@ async function localCheckout(cwd, spawn4) {
|
|
|
65582
67655
|
await walk(packagePath);
|
|
65583
67656
|
return files;
|
|
65584
67657
|
},
|
|
65585
|
-
runTests: (packagePath, files) =>
|
|
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
|
+
}
|
|
65586
67668
|
};
|
|
65587
67669
|
}
|
|
65588
67670
|
async function withEngineStdoutOnStderr(body) {
|
|
@@ -65619,7 +67701,7 @@ async function runEngineCall(call, ports) {
|
|
|
65619
67701
|
return exitCode;
|
|
65620
67702
|
}
|
|
65621
67703
|
async function miseEngine(cwd) {
|
|
65622
|
-
const { mise } = await import("@
|
|
67704
|
+
const { mise } = await import("@deepractice-ai/devops-test-engine");
|
|
65623
67705
|
const { createLocalPlatform } = await import("@deepractice-ai/bdd-local");
|
|
65624
67706
|
const platform = createLocalPlatform({ cwd });
|
|
65625
67707
|
return {
|
|
@@ -65759,7 +67841,7 @@ function removalSteps(key) {
|
|
|
65759
67841
|
`No code references ${key}. The rest is not this command's to do:`,
|
|
65760
67842
|
` 1. Deploy the code that removed the references (deploy never writes the trunk).`,
|
|
65761
67843
|
` 2. Retire the flag on the platform: praxis api devops flag archive <flg_…> — the terminal state.`,
|
|
65762
|
-
` Archiving keeps the key reserved and
|
|
67844
|
+
` Archiving keeps the key reserved, and is refused while reported references remain or an environment still has it on; there is no separate delete call (ADR-125 §4).`,
|
|
65763
67845
|
` 3. Regenerate the registry: praxis devops flag sync`
|
|
65764
67846
|
].join(`
|
|
65765
67847
|
`);
|
|
@@ -65789,6 +67871,25 @@ async function repositoryRoot(cwd, read) {
|
|
|
65789
67871
|
dir = parent;
|
|
65790
67872
|
}
|
|
65791
67873
|
}
|
|
67874
|
+
var SNIPPET_LIMIT = 200;
|
|
67875
|
+
function snippetOf(text2, line) {
|
|
67876
|
+
const trimmed = (text2.split(`
|
|
67877
|
+
`)[line - 1] ?? "").trim();
|
|
67878
|
+
return trimmed.length > SNIPPET_LIMIT ? trimmed.slice(0, SNIPPET_LIMIT) : trimmed;
|
|
67879
|
+
}
|
|
67880
|
+
function reportedKeys(keys, sources, refs) {
|
|
67881
|
+
const texts = new Map(sources.map((file) => [file.path, file.text]));
|
|
67882
|
+
return keys.map((flagKey) => ({
|
|
67883
|
+
flagKey,
|
|
67884
|
+
items: refs.filter((ref) => ref.key === flagKey).map((ref) => ({ path: ref.file, line: ref.line, snippet: snippetOf(texts.get(ref.file) ?? "", ref.line) }))
|
|
67885
|
+
}));
|
|
67886
|
+
}
|
|
67887
|
+
function reportNeedsProject() {
|
|
67888
|
+
return new UsageError("praxis devops flag refs --report needs the project to report into: --project <dvp_…>", "Pass the DevOps project id the flags belong to — `praxis api devops project list` lists them, or read devops.project from praxis.jsonc.");
|
|
67889
|
+
}
|
|
67890
|
+
function reportClientMissing() {
|
|
67891
|
+
return new UsageError("this CLI build has no client method for devops.flags.reportCodeRefs yet", "The route is declared in the protocol but the public /devops/v1 spec (and the SDK generated from it) does not carry it yet (#1881); the reference report cannot be sent until that is regenerated.");
|
|
67892
|
+
}
|
|
65792
67893
|
async function codeSources(ports, registry) {
|
|
65793
67894
|
const suffix = registry.replace(/^\.\//, "");
|
|
65794
67895
|
return (await ports.sources()).filter((file) => !file.path.replace(/^\.\//, "").endsWith(suffix));
|
|
@@ -65845,15 +67946,33 @@ async function devopsFlagScaffold(key, args, ports) {
|
|
|
65845
67946
|
ports.emit({ kind: "object", data: { key, registry, file, call: scaffoldCall(key) } });
|
|
65846
67947
|
return 0;
|
|
65847
67948
|
}
|
|
65848
|
-
async function devopsFlagRefs(key, ports) {
|
|
67949
|
+
async function devopsFlagRefs(key, args, ports) {
|
|
65849
67950
|
const registry = await registryOf(ports);
|
|
65850
67951
|
const flags = await ports.loadRegistry(registry);
|
|
65851
67952
|
const keys = key !== undefined ? [key] : Object.keys(flags).sort();
|
|
65852
|
-
const
|
|
67953
|
+
const sources = await codeSources(ports, registry);
|
|
67954
|
+
const refs = flagReferences(sources, keys);
|
|
65853
67955
|
for (const ref of refs)
|
|
65854
67956
|
ports.human(`${ref.file}:${ref.line}: ${ref.key}`);
|
|
65855
67957
|
ports.human(refs.length ? `${refs.length} reference(s) in ${new Set(refs.map((r) => r.file)).size} file(s).` : `No references to ${key ?? "any registered flag"} in this checkout.`);
|
|
65856
|
-
|
|
67958
|
+
if (!args.report) {
|
|
67959
|
+
ports.emit({ kind: "object", data: { refs, reported: false } });
|
|
67960
|
+
return 0;
|
|
67961
|
+
}
|
|
67962
|
+
const project = args.project;
|
|
67963
|
+
if (project === undefined || project === "")
|
|
67964
|
+
throw reportNeedsProject();
|
|
67965
|
+
const scannedCommit = (await ports.git(["rev-parse", "HEAD"])).trim();
|
|
67966
|
+
if (scannedCommit === "")
|
|
67967
|
+
throw new UsageError("git rev-parse HEAD answered no commit", "Run this command inside a git repository.");
|
|
67968
|
+
const payload = reportedKeys(Object.keys(flags).sort(), sources, refs);
|
|
67969
|
+
const client2 = await ports.client();
|
|
67970
|
+
const report = client2.devops?.projects?.flags?.reportCodeRefs;
|
|
67971
|
+
if (typeof report !== "function")
|
|
67972
|
+
throw reportClientMissing();
|
|
67973
|
+
const answer = await report.call(client2.devops.projects.flags, { path: { project }, body: { scannedCommit, refs: payload } });
|
|
67974
|
+
ports.human(`Reported ${refs.length} reference(s) over ${payload.length} key(s) to ${project} at ${scannedCommit}: ${answer.updated} flag(s) updated${answer.unknownKeys.length ? `; unknown key(s): ${answer.unknownKeys.join(", ")}` : ""}.`);
|
|
67975
|
+
ports.emit({ kind: "object", data: { refs, reported: true, project, scannedCommit, updated: answer.updated, unknownKeys: answer.unknownKeys } });
|
|
65857
67976
|
return 0;
|
|
65858
67977
|
}
|
|
65859
67978
|
async function devopsFlagRemove(key, ports) {
|
|
@@ -66093,9 +68212,9 @@ function refactorRoot(fileRelToCheckout, hasTsconfig) {
|
|
|
66093
68212
|
// src/commands/devops-refactor.ts
|
|
66094
68213
|
function codeRefactorEngine() {
|
|
66095
68214
|
return {
|
|
66096
|
-
rename: async (input) => (await repositoryEngine("devops refactor rename", () => import("@
|
|
66097
|
-
check: async (input) => (await repositoryEngine("devops refactor check", () => import("@
|
|
66098
|
-
apply: async (input) => (await repositoryEngine("devops refactor apply", () => import("@
|
|
68215
|
+
rename: async (input) => (await repositoryEngine("devops refactor rename", () => import("@deepractice-ai/devops-refactor/rename"))).planSemanticRename(input),
|
|
68216
|
+
check: async (input) => (await repositoryEngine("devops refactor check", () => import("@deepractice-ai/devops-refactor/rename"))).inspectRenamePlan(input),
|
|
68217
|
+
apply: async (input) => (await repositoryEngine("devops refactor apply", () => import("@deepractice-ai/devops-refactor/rename"))).applyRenamePlan(input)
|
|
66099
68218
|
};
|
|
66100
68219
|
}
|
|
66101
68220
|
function required(value, argument, use) {
|
|
@@ -68503,6 +70622,7 @@ var FILE_ID = /^file-/;
|
|
|
68503
70622
|
var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : undefined;
|
|
68504
70623
|
var isImage = (node2) => node2.type === "image" && typeof node2.url === "string";
|
|
68505
70624
|
var isRef = (node2) => node2.type === "ref" && typeof node2.ref === "string";
|
|
70625
|
+
var NODE_TYPES = new Set(Object.keys(KNOWN_PROPS));
|
|
68506
70626
|
function visit2(value, nodeId, fn) {
|
|
68507
70627
|
if (Array.isArray(value)) {
|
|
68508
70628
|
for (const item of value)
|
|
@@ -68696,6 +70816,8 @@ var warningLine = (warning) => {
|
|
|
68696
70816
|
return `${warning.code}: ${warning.ref} at ${warning.nodeId}`;
|
|
68697
70817
|
case "FRAME_NOT_FOUND":
|
|
68698
70818
|
return `${warning.code}: ${warning.id}`;
|
|
70819
|
+
case "IMAGE_FILE_NOT_FOUND":
|
|
70820
|
+
return `${warning.code}: ${warning.url} (the platform holds no such file) at ${warning.nodeId}`;
|
|
68699
70821
|
default:
|
|
68700
70822
|
return `${warning.code}: ${warning.url}`;
|
|
68701
70823
|
}
|
|
@@ -68803,6 +70925,537 @@ async function canvasImport(args, ports) {
|
|
|
68803
70925
|
return 0;
|
|
68804
70926
|
}
|
|
68805
70927
|
|
|
70928
|
+
// src/commands/events-wait.ts
|
|
70929
|
+
var DEFAULT_AGENT = "R1M9TQ2X";
|
|
70930
|
+
var BASE_BACKOFF_MS = 1000;
|
|
70931
|
+
var MAX_BACKOFF_MS = 60000;
|
|
70932
|
+
var NOTICE_NAMED = 5;
|
|
70933
|
+
var ANNOUNCED_KEEP = 500;
|
|
70934
|
+
function assumeAgentOf(env) {
|
|
70935
|
+
return env.PRAXIS_ASSUME_AGENT?.trim() || DEFAULT_AGENT;
|
|
70936
|
+
}
|
|
70937
|
+
function sessionOf(raw) {
|
|
70938
|
+
if (raw === undefined)
|
|
70939
|
+
return null;
|
|
70940
|
+
const session = raw.trim();
|
|
70941
|
+
if (!/^[A-Za-z0-9_-]{1,128}$/.test(session))
|
|
70942
|
+
throw new Error("--session takes the Claude Code session id (letters, digits, - and _)");
|
|
70943
|
+
return session;
|
|
70944
|
+
}
|
|
70945
|
+
var keyPart = (part) => part.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
70946
|
+
function waitKeyOf(env, agent, session) {
|
|
70947
|
+
return [env, agent, ...session === null ? [] : [session]].map(keyPart).join("-");
|
|
70948
|
+
}
|
|
70949
|
+
function pidOf(raw) {
|
|
70950
|
+
const pid = raw === null ? NaN : Number(raw.trim());
|
|
70951
|
+
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
70952
|
+
}
|
|
70953
|
+
function lockDecision(recorded, self, probe) {
|
|
70954
|
+
if (recorded === null || recorded === self || probe === null || !probe.alive)
|
|
70955
|
+
return { kind: "take" };
|
|
70956
|
+
if (!/events\s+wait/.test(probe.command))
|
|
70957
|
+
return { kind: "take" };
|
|
70958
|
+
if (probe.ppid === 1)
|
|
70959
|
+
return { kind: "replace", pid: recorded };
|
|
70960
|
+
return { kind: "refuse", pid: recorded };
|
|
70961
|
+
}
|
|
70962
|
+
function alreadyWaitingNotice(pid) {
|
|
70963
|
+
return `本会话已有 praxis agent events wait 在后台等待(pid ${pid}),不用再启动。`;
|
|
70964
|
+
}
|
|
70965
|
+
async function acquireWaitLock(ports) {
|
|
70966
|
+
for (let attempt = 0;attempt < 3; attempt++) {
|
|
70967
|
+
const recorded = pidOf(await ports.readPid());
|
|
70968
|
+
if (recorded === null) {
|
|
70969
|
+
if (await ports.createPid(String(ports.self)))
|
|
70970
|
+
return null;
|
|
70971
|
+
continue;
|
|
70972
|
+
}
|
|
70973
|
+
const decision = lockDecision(recorded, ports.self, await ports.probe(recorded));
|
|
70974
|
+
if (decision.kind === "refuse")
|
|
70975
|
+
return decision.pid;
|
|
70976
|
+
if (decision.kind === "replace")
|
|
70977
|
+
ports.terminate(decision.pid);
|
|
70978
|
+
await ports.replacePid(String(ports.self));
|
|
70979
|
+
const holder = pidOf(await ports.readPid());
|
|
70980
|
+
return holder === ports.self || holder === null ? null : holder;
|
|
70981
|
+
}
|
|
70982
|
+
return pidOf(await ports.readPid());
|
|
70983
|
+
}
|
|
70984
|
+
function timeoutMsOf(raw) {
|
|
70985
|
+
if (raw === undefined)
|
|
70986
|
+
return null;
|
|
70987
|
+
const seconds = Number(raw);
|
|
70988
|
+
if (!/^\d+(\.\d+)?$/.test(raw.trim()) || !Number.isFinite(seconds) || seconds <= 0)
|
|
70989
|
+
throw new Error("--timeout takes a positive number of seconds");
|
|
70990
|
+
return Math.round(seconds * 1000);
|
|
70991
|
+
}
|
|
70992
|
+
function backoffMs(failures) {
|
|
70993
|
+
if (failures <= 0)
|
|
70994
|
+
return 0;
|
|
70995
|
+
return Math.min(MAX_BACKOFF_MS, BASE_BACKOFF_MS * 2 ** Math.min(failures - 1, 16));
|
|
70996
|
+
}
|
|
70997
|
+
function inboxLettersUrl(apiUrl, agent) {
|
|
70998
|
+
return `${apiUrl}/agent/v1/agents/${encodeURIComponent(agent)}/inbox/letters?unread=true&limit=20`;
|
|
70999
|
+
}
|
|
71000
|
+
function eventsStreamUrl(apiUrl, agent) {
|
|
71001
|
+
return `${apiUrl}/agent/v1/agents/${encodeURIComponent(agent)}/events/stream`;
|
|
71002
|
+
}
|
|
71003
|
+
function streamHeaders(auth, lastEventId) {
|
|
71004
|
+
return { ...auth, Accept: "text/event-stream", ...lastEventId === null ? {} : { "Last-Event-ID": lastEventId } };
|
|
71005
|
+
}
|
|
71006
|
+
function lettersOf(body) {
|
|
71007
|
+
const value = body;
|
|
71008
|
+
if (!value || typeof value.unread !== "number" || !Array.isArray(value.letters))
|
|
71009
|
+
throw new Error("letters answer is not { unread, letters }");
|
|
71010
|
+
const letters = value.letters.filter((letter) => typeof letter === "object" && letter !== null && typeof letter.id === "string" && typeof letter.summary === "string");
|
|
71011
|
+
return { unread: value.unread, letters };
|
|
71012
|
+
}
|
|
71013
|
+
function feedSse(buffer, chunk) {
|
|
71014
|
+
const text2 = (buffer + chunk).replace(/\r\n?/g, `
|
|
71015
|
+
`);
|
|
71016
|
+
const blocks = text2.split(`
|
|
71017
|
+
|
|
71018
|
+
`);
|
|
71019
|
+
const rest = blocks.pop() ?? "";
|
|
71020
|
+
const frames = [];
|
|
71021
|
+
for (const block of blocks) {
|
|
71022
|
+
let event, id;
|
|
71023
|
+
const data = [];
|
|
71024
|
+
for (const line of block.split(`
|
|
71025
|
+
`)) {
|
|
71026
|
+
if (line === "" || line.startsWith(":"))
|
|
71027
|
+
continue;
|
|
71028
|
+
const colon = line.indexOf(":");
|
|
71029
|
+
const field = colon < 0 ? line : line.slice(0, colon);
|
|
71030
|
+
const value = colon < 0 ? "" : line.slice(colon + 1).replace(/^ /, "");
|
|
71031
|
+
if (field === "data")
|
|
71032
|
+
data.push(value);
|
|
71033
|
+
else if (field === "event")
|
|
71034
|
+
event = value;
|
|
71035
|
+
else if (field === "id")
|
|
71036
|
+
id = value;
|
|
71037
|
+
}
|
|
71038
|
+
if (data.length)
|
|
71039
|
+
frames.push({ ...event === undefined ? {} : { event }, ...id === undefined ? {} : { id }, data: data.join(`
|
|
71040
|
+
`) });
|
|
71041
|
+
}
|
|
71042
|
+
return { buffer: rest, frames };
|
|
71043
|
+
}
|
|
71044
|
+
var text2 = (value) => typeof value === "string" && value !== "";
|
|
71045
|
+
function wakeOf(frame) {
|
|
71046
|
+
let event;
|
|
71047
|
+
try {
|
|
71048
|
+
event = JSON.parse(frame.data);
|
|
71049
|
+
} catch {
|
|
71050
|
+
return null;
|
|
71051
|
+
}
|
|
71052
|
+
if (typeof event !== "object" || event === null)
|
|
71053
|
+
return null;
|
|
71054
|
+
if (event.type === "inbox.letter_delivered" && text2(event.letter_id) && typeof event.summary === "string")
|
|
71055
|
+
return { kind: "letter", letter: {
|
|
71056
|
+
id: event.letter_id,
|
|
71057
|
+
sender: typeof event.sender === "string" ? event.sender : "",
|
|
71058
|
+
...text2(event.sender_name) ? { sender_name: event.sender_name } : {},
|
|
71059
|
+
summary: event.summary,
|
|
71060
|
+
thread: typeof event.thread === "string" ? event.thread : null,
|
|
71061
|
+
create_time: typeof event.create_time === "string" ? event.create_time : ""
|
|
71062
|
+
} };
|
|
71063
|
+
if (event.type === "cognition.ritual_held" && text2(event.title))
|
|
71064
|
+
return { kind: "ritual", ritual: {
|
|
71065
|
+
ritual: text2(event.ritual) ? event.ritual : "",
|
|
71066
|
+
owner: text2(event.owner) ? event.owner : "",
|
|
71067
|
+
title: event.title,
|
|
71068
|
+
engram: text2(event.engram) ? event.engram : ""
|
|
71069
|
+
} };
|
|
71070
|
+
return null;
|
|
71071
|
+
}
|
|
71072
|
+
function ritualNotice(ritual) {
|
|
71073
|
+
const origin = [ritual.owner, ritual.ritual].filter(Boolean).join(" 的仪式 ");
|
|
71074
|
+
return `你获得了一段新记忆:「${ritual.title}」${origin ? `(${origin}${ritual.engram ? `,${ritual.engram}` : ""})` : ""}。处理完再在后台运行 praxis agent events wait。`;
|
|
71075
|
+
}
|
|
71076
|
+
function retryableStatus(status) {
|
|
71077
|
+
return status >= 500 || status === 408 || status === 429;
|
|
71078
|
+
}
|
|
71079
|
+
function planNotice(page, announced) {
|
|
71080
|
+
const seen = new Set(announced);
|
|
71081
|
+
const fresh = page.letters.filter((letter) => !seen.has(letter.id));
|
|
71082
|
+
if (!fresh.length)
|
|
71083
|
+
return { announced };
|
|
71084
|
+
const named = fresh.slice(0, NOTICE_NAMED).map((letter) => `${letter.sender_name || letter.sender}:${letter.summary}(${letter.id})`);
|
|
71085
|
+
const more = fresh.length > NOTICE_NAMED ? `;另有 ${fresh.length - NOTICE_NAMED} 封` : "";
|
|
71086
|
+
const notice = `你有 ${fresh.length} 封新信:${named.join(";")}${more}。用 praxis_assume_inbox(action "read")读取并处理,处理完再在后台运行 praxis agent events wait。`;
|
|
71087
|
+
const next = [...announced, ...fresh.map((letter) => letter.id)];
|
|
71088
|
+
return { notice, announced: next.length > ANNOUNCED_KEEP ? next.slice(next.length - ANNOUNCED_KEEP) : next };
|
|
71089
|
+
}
|
|
71090
|
+
function waitStateOf(raw) {
|
|
71091
|
+
if (raw === null)
|
|
71092
|
+
return { announced: [], lastEventId: null };
|
|
71093
|
+
try {
|
|
71094
|
+
const value = JSON.parse(raw);
|
|
71095
|
+
return {
|
|
71096
|
+
announced: Array.isArray(value.announced) ? value.announced.filter((id) => typeof id === "string") : [],
|
|
71097
|
+
lastEventId: typeof value.last_event_id === "string" && /^\d+$/.test(value.last_event_id) ? value.last_event_id : null
|
|
71098
|
+
};
|
|
71099
|
+
} catch {
|
|
71100
|
+
return { announced: [], lastEventId: null };
|
|
71101
|
+
}
|
|
71102
|
+
}
|
|
71103
|
+
function waitStateText(state) {
|
|
71104
|
+
return JSON.stringify({ announced: state.announced, ...state.lastEventId === null ? {} : { last_event_id: state.lastEventId } });
|
|
71105
|
+
}
|
|
71106
|
+
var message = (error) => error instanceof Error ? error.message : String(error);
|
|
71107
|
+
async function runEventsWait(ports) {
|
|
71108
|
+
const stop = new AbortController;
|
|
71109
|
+
let timedOut = false;
|
|
71110
|
+
const timer = ports.timeoutMs === null ? undefined : setTimeout(() => {
|
|
71111
|
+
timedOut = true;
|
|
71112
|
+
stop.abort();
|
|
71113
|
+
}, ports.timeoutMs);
|
|
71114
|
+
const state = await ports.readState();
|
|
71115
|
+
let announced = state.announced;
|
|
71116
|
+
let lastEventId = state.lastEventId;
|
|
71117
|
+
const announceLetters = async (page) => {
|
|
71118
|
+
const planned = planNotice(page, announced);
|
|
71119
|
+
if (!planned.notice)
|
|
71120
|
+
return false;
|
|
71121
|
+
announced = planned.announced;
|
|
71122
|
+
await ports.writeState({ announced, lastEventId });
|
|
71123
|
+
ports.print(planned.notice);
|
|
71124
|
+
return true;
|
|
71125
|
+
};
|
|
71126
|
+
const announce = async () => announceLetters(await ports.fetchLetters());
|
|
71127
|
+
try {
|
|
71128
|
+
try {
|
|
71129
|
+
if (await announce())
|
|
71130
|
+
return 0;
|
|
71131
|
+
} catch (error) {
|
|
71132
|
+
ports.log(`praxis agent events wait: reading letters failed: ${message(error)}`);
|
|
71133
|
+
}
|
|
71134
|
+
ports.log(`praxis agent events wait: waiting for letters to assume agent ${ports.agent}`);
|
|
71135
|
+
let failures = 0;
|
|
71136
|
+
while (!stop.signal.aborted) {
|
|
71137
|
+
if (failures)
|
|
71138
|
+
await ports.sleep(backoffMs(failures), stop.signal);
|
|
71139
|
+
if (stop.signal.aborted)
|
|
71140
|
+
break;
|
|
71141
|
+
try {
|
|
71142
|
+
const opened = await ports.openStream(stop.signal, lastEventId);
|
|
71143
|
+
if (opened.status < 200 || opened.status >= 300 || !opened.chunks) {
|
|
71144
|
+
if (!retryableStatus(opened.status)) {
|
|
71145
|
+
ports.log(`praxis agent events wait: the event stream was refused (HTTP ${opened.status}${opened.reason ? `: ${opened.reason}` : ""})`);
|
|
71146
|
+
return 1;
|
|
71147
|
+
}
|
|
71148
|
+
throw new Error(`HTTP ${opened.status}`);
|
|
71149
|
+
}
|
|
71150
|
+
if (await announce())
|
|
71151
|
+
return 0;
|
|
71152
|
+
if (failures)
|
|
71153
|
+
ports.log("praxis agent events wait: event stream reconnected");
|
|
71154
|
+
failures = 0;
|
|
71155
|
+
let buffer = "";
|
|
71156
|
+
for await (const chunk of opened.chunks) {
|
|
71157
|
+
const fed = feedSse(buffer, chunk);
|
|
71158
|
+
buffer = fed.buffer;
|
|
71159
|
+
for (const frame of fed.frames) {
|
|
71160
|
+
const wake = wakeOf(frame);
|
|
71161
|
+
if (wake !== null && frame.id !== undefined)
|
|
71162
|
+
lastEventId = frame.id;
|
|
71163
|
+
if (wake?.kind === "letter" && await announceLetters({ unread: 1, letters: [wake.letter] }))
|
|
71164
|
+
return 0;
|
|
71165
|
+
if (wake?.kind === "ritual") {
|
|
71166
|
+
await ports.writeState({ announced, lastEventId });
|
|
71167
|
+
ports.print(ritualNotice(wake.ritual));
|
|
71168
|
+
return 0;
|
|
71169
|
+
}
|
|
71170
|
+
}
|
|
71171
|
+
}
|
|
71172
|
+
throw new Error("the event stream ended");
|
|
71173
|
+
} catch (error) {
|
|
71174
|
+
if (stop.signal.aborted)
|
|
71175
|
+
break;
|
|
71176
|
+
failures += 1;
|
|
71177
|
+
ports.log(`praxis agent events wait: ${message(error)} (${failures} in a row, reconnecting in ${backoffMs(failures) / 1000}s)`);
|
|
71178
|
+
}
|
|
71179
|
+
}
|
|
71180
|
+
if (timedOut)
|
|
71181
|
+
ports.print(`${(ports.timeoutMs ?? 0) / 1000} 秒内没有新信。需要继续等待时再在后台运行 praxis agent events wait。`);
|
|
71182
|
+
return 0;
|
|
71183
|
+
} finally {
|
|
71184
|
+
if (timer)
|
|
71185
|
+
clearTimeout(timer);
|
|
71186
|
+
stop.abort();
|
|
71187
|
+
}
|
|
71188
|
+
}
|
|
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
|
+
|
|
68806
71459
|
// src/main.ts
|
|
68807
71460
|
import { spawnSync } from "node:child_process";
|
|
68808
71461
|
|
|
@@ -68920,15 +71573,15 @@ class ModelStream {
|
|
|
68920
71573
|
finishReason = "unknown";
|
|
68921
71574
|
usage;
|
|
68922
71575
|
add(event) {
|
|
68923
|
-
const data = streamData(event),
|
|
71576
|
+
const data = streamData(event), message2 = record(data.message), response = record(data.response);
|
|
68924
71577
|
this.chunks.push(streamText(event));
|
|
68925
71578
|
const choices = Array.isArray(data.choices) ? data.choices : [];
|
|
68926
|
-
const reason2 = choices.map((c) => record(c).finish_reason).find((r) => typeof r === "string" && r) ?? record(data.delta).stop_reason ??
|
|
71579
|
+
const reason2 = choices.map((c) => record(c).finish_reason).find((r) => typeof r === "string" && r) ?? record(data.delta).stop_reason ?? message2.stop_reason ?? data.stop_reason ?? record(response.incomplete_details).reason ?? response.status;
|
|
68927
71580
|
if (typeof reason2 === "string" && reason2)
|
|
68928
71581
|
this.finishReason = reason2;
|
|
68929
71582
|
else if (["response.completed", "response.incomplete", "response.failed"].includes(String(data.type)))
|
|
68930
71583
|
this.finishReason = String(data.type).slice("response.".length);
|
|
68931
|
-
for (const usage of [
|
|
71584
|
+
for (const usage of [message2.usage, data.usage, response.usage]) {
|
|
68932
71585
|
if (usage !== null && typeof usage === "object" && !Array.isArray(usage))
|
|
68933
71586
|
this.usage = { ...this.usage, ...record(usage) };
|
|
68934
71587
|
}
|
|
@@ -68993,8 +71646,8 @@ function isSuccess(verb, ctx) {
|
|
|
68993
71646
|
}
|
|
68994
71647
|
var past = { create: "Created", update: "Updated", delete: "Deleted", remove: "Deleted", purge: "Deleted", pause: "Paused", unpause: "Unpaused", resume: "Resumed", start: "Started", stop: "Stopped", cancel: "Cancelled", enable: "Enabled", disable: "Disabled", connect: "Connected", extend: "Extended", fork: "Forked", upload: "Uploaded", run: "Started" };
|
|
68995
71648
|
var deleted = (verb) => /^(delete|remove|purge)(-|$)/.test(verb);
|
|
68996
|
-
function width(
|
|
68997
|
-
return [...
|
|
71649
|
+
function width(text3) {
|
|
71650
|
+
return [...text3].reduce((sum, ch) => {
|
|
68998
71651
|
const cp = ch.codePointAt(0);
|
|
68999
71652
|
return sum + (/\p{Mark}/u.test(ch) || cp === 8205 ? 0 : cp >= 4352 && (cp <= 4447 || cp >= 11904 && cp <= 42191 || cp >= 44032 && cp <= 55203 || cp >= 63744 && cp <= 64255 || cp >= 65040 && cp <= 65135 || cp >= 65281 && cp <= 65376 || cp >= 127744) ? 2 : 1);
|
|
69000
71653
|
}, 0);
|
|
@@ -69002,13 +71655,13 @@ function width(text2) {
|
|
|
69002
71655
|
function truncate(value, size) {
|
|
69003
71656
|
if (width(value) <= size)
|
|
69004
71657
|
return value;
|
|
69005
|
-
let
|
|
71658
|
+
let text3 = "";
|
|
69006
71659
|
for (const ch of value) {
|
|
69007
|
-
if (width(
|
|
71660
|
+
if (width(text3 + ch) > size - 1)
|
|
69008
71661
|
break;
|
|
69009
|
-
|
|
71662
|
+
text3 += ch;
|
|
69010
71663
|
}
|
|
69011
|
-
return
|
|
71664
|
+
return text3 + "…";
|
|
69012
71665
|
}
|
|
69013
71666
|
function table(items, ctx, paint) {
|
|
69014
71667
|
const columns = columnsFor(items);
|
|
@@ -69041,13 +71694,13 @@ function table(items, ctx, paint) {
|
|
|
69041
71694
|
sizes[index]--;
|
|
69042
71695
|
}
|
|
69043
71696
|
const line = (row, header) => row.map((v, i) => {
|
|
69044
|
-
const
|
|
69045
|
-
let styled = header ? paint.dim(
|
|
71697
|
+
const text3 = truncate(v, sizes[i]);
|
|
71698
|
+
let styled = header ? paint.dim(text3) : text3;
|
|
69046
71699
|
if (!header && ["status", "state"].includes(columns[i])) {
|
|
69047
71700
|
const color = /^(running|active|ready|succeeded|completed|enabled)$/i.test(v) ? paint.green : /^(pending|queued|starting|creating|paused)$/i.test(v) ? paint.yellow : /^(failed|error|cancelled|expired|disabled|deleted|purging|purged|suspended)$/i.test(v) ? paint.red : (s) => s;
|
|
69048
|
-
styled = color(
|
|
71701
|
+
styled = color(text3);
|
|
69049
71702
|
}
|
|
69050
|
-
return styled + (i === row.length - 1 ? "" : " ".repeat(Math.max(0, sizes[i] - width(
|
|
71703
|
+
return styled + (i === row.length - 1 ? "" : " ".repeat(Math.max(0, sizes[i] - width(text3))));
|
|
69051
71704
|
}).join(" ");
|
|
69052
71705
|
return [line(headers, true), ...rows.map((row) => line(row, false))].join(`
|
|
69053
71706
|
`) + `
|
|
@@ -69146,9 +71799,9 @@ function renderHuman(result, ctx) {
|
|
|
69146
71799
|
}
|
|
69147
71800
|
|
|
69148
71801
|
// src/output/agent.ts
|
|
69149
|
-
function cell(
|
|
69150
|
-
const chars = [...
|
|
69151
|
-
const limited = chars.length > 500 ? chars.slice(0, 500).join("") + `…[+${chars.length - 500} chars, use --json]` :
|
|
71802
|
+
function cell(text3) {
|
|
71803
|
+
const chars = [...text3];
|
|
71804
|
+
const limited = chars.length > 500 ? chars.slice(0, 500).join("") + `…[+${chars.length - 500} chars, use --json]` : text3;
|
|
69152
71805
|
return limited.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\r?\n/g, "<br>").replace(/\r/g, "<br>");
|
|
69153
71806
|
}
|
|
69154
71807
|
function renderAgent(result, ctx) {
|
|
@@ -69159,9 +71812,9 @@ function renderAgent(result, ctx) {
|
|
|
69159
71812
|
if (modelStream(result.op)) {
|
|
69160
71813
|
if (!result.summary)
|
|
69161
71814
|
return {};
|
|
69162
|
-
const { text:
|
|
69163
|
-
return { stdout: `${
|
|
69164
|
-
`) || !
|
|
71815
|
+
const { text: text3, finish_reason, usage } = result.summary;
|
|
71816
|
+
return { stdout: `${text3}${text3.endsWith(`
|
|
71817
|
+
`) || !text3 ? "" : `
|
|
69165
71818
|
`}finish_reason: ${finish_reason}
|
|
69166
71819
|
${usage ? `usage: ${JSON.stringify(usage)}
|
|
69167
71820
|
` : ""}` };
|
|
@@ -69380,18 +72033,18 @@ function errorInput(error, ctx) {
|
|
|
69380
72033
|
const details = candidate !== null && typeof candidate === "object" && !Array.isArray(candidate) ? candidate : undefined;
|
|
69381
72034
|
const problem = serverProblem(Object.keys(nested).length ? nested : raw);
|
|
69382
72035
|
const serverText = (value) => typeof value === "string" && value.trim() ? value : undefined;
|
|
69383
|
-
let
|
|
69384
|
-
const prefix =
|
|
72036
|
+
let message2 = error instanceof Error ? error.message : "Unexpected error";
|
|
72037
|
+
const prefix = message2.match(/^([A-Z][A-Z0-9_]+):\s*/)?.[1];
|
|
69385
72038
|
const code = error instanceof UsageError ? error.code : businessCode(raw.code) ?? businessCode(nested.code) ?? businessCode(raw.error_code) ?? prefix ?? businessCode(sdk?.code) ?? (sdk?.status ? `HTTP_${sdk.status}` : sdk ? "API_ERROR" : "RUNTIME_ERROR");
|
|
69386
72039
|
let stripped = false;
|
|
69387
|
-
while (
|
|
69388
|
-
|
|
72040
|
+
while (message2.startsWith(`${code}:`)) {
|
|
72041
|
+
message2 = message2.slice(code.length + 1).trimStart();
|
|
69389
72042
|
stripped = true;
|
|
69390
72043
|
}
|
|
69391
72044
|
if (stripped)
|
|
69392
|
-
|
|
72045
|
+
message2 = `${humanize(code)}${message2 ? `: ${message2}` : ""}`;
|
|
69393
72046
|
const status = sdk?.status, request_id = sdk?.requestId;
|
|
69394
|
-
|
|
72047
|
+
message2 = serverText(problem?.detail) ?? serverText(problem?.title) ?? message2;
|
|
69395
72048
|
const authFailure = status === 401 || ["NOT_LOGGED_IN", "UNAUTHENTICATED", "TOKEN_REVOKED", "LOGIN_FAILED", "MANAGED_LOGIN_EXPIRED"].includes(code);
|
|
69396
72049
|
const source = ctx.credentialSource ?? "login";
|
|
69397
72050
|
let hint3 = genericHint;
|
|
@@ -69409,19 +72062,19 @@ function errorInput(error, ctx) {
|
|
|
69409
72062
|
hint3 = "Rate limited; retry later.";
|
|
69410
72063
|
else if (status !== undefined && status >= 500)
|
|
69411
72064
|
hint3 = `Server error; retry later.${request_id ? ` Request id: ${request_id}.` : ""}`;
|
|
69412
|
-
return { kind: "error", code, message, hint: hint3, ...details !== undefined ? { details } : {}, ...problem !== undefined ? { problem } : {}, env: ctx.env, ...authFailure ? { credential_source: source } : {}, ...status !== undefined ? { status } : {}, ...request_id ? { request_id } : {} };
|
|
72065
|
+
return { kind: "error", code, message: message2, hint: hint3, ...details !== undefined ? { details } : {}, ...problem !== undefined ? { problem } : {}, env: ctx.env, ...authFailure ? { credential_source: source } : {}, ...status !== undefined ? { status } : {}, ...request_id ? { request_id } : {} };
|
|
69413
72066
|
}
|
|
69414
72067
|
|
|
69415
72068
|
// src/output/progress.ts
|
|
69416
|
-
function startProgress(ctx, write = (
|
|
72069
|
+
function startProgress(ctx, write = (text3) => writeOutput({ stderr: text3 })) {
|
|
69417
72070
|
if (ctx.mode !== "human" || !ctx.stderrIsTTY)
|
|
69418
72071
|
return () => {};
|
|
69419
72072
|
let interval;
|
|
69420
|
-
let shown = false,
|
|
72073
|
+
let shown = false, frame2 = 0;
|
|
69421
72074
|
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
69422
72075
|
const tick = () => {
|
|
69423
72076
|
shown = true;
|
|
69424
|
-
write(`\r${frames[
|
|
72077
|
+
write(`\r${frames[frame2++ % frames.length]} Loading…`);
|
|
69425
72078
|
};
|
|
69426
72079
|
const timer = setTimeout(() => {
|
|
69427
72080
|
tick();
|
|
@@ -69439,7 +72092,7 @@ function startProgress(ctx, write = (text2) => writeOutput({ stderr: text2 })) {
|
|
|
69439
72092
|
}
|
|
69440
72093
|
|
|
69441
72094
|
// src/main.ts
|
|
69442
|
-
var version = "0.3.0-dev.
|
|
72095
|
+
var version = "0.3.0-dev.99bbb95";
|
|
69443
72096
|
var commands = commandTree(operations);
|
|
69444
72097
|
var manual = [...workflows.map((w) => w.words), [API_WORD]];
|
|
69445
72098
|
function route(argv) {
|
|
@@ -69521,7 +72174,7 @@ var defaults = {
|
|
|
69521
72174
|
return;
|
|
69522
72175
|
const cmd = process.platform === "darwin" ? ["open", url] : process.platform === "win32" ? ["rundll32", "url.dll,FileProtocolHandler", url] : ["xdg-open", url];
|
|
69523
72176
|
await new Promise((resolve12, reject) => {
|
|
69524
|
-
const child =
|
|
72177
|
+
const child = spawn5(cmd[0], cmd.slice(1), { stdio: "ignore" });
|
|
69525
72178
|
child.once("error", reject);
|
|
69526
72179
|
child.once("close", () => resolve12());
|
|
69527
72180
|
});
|
|
@@ -69530,12 +72183,12 @@ var defaults = {
|
|
|
69530
72183
|
wait: (ms) => new Promise((resolve12) => setTimeout(resolve12, ms)),
|
|
69531
72184
|
render,
|
|
69532
72185
|
spawn: (cmd, args, options) => new Promise((resolve12, reject) => {
|
|
69533
|
-
const child =
|
|
72186
|
+
const child = spawn5(cmd, args, { cwd: options.cwd, stdio: ["ignore", 2, 2] });
|
|
69534
72187
|
child.once("error", reject);
|
|
69535
72188
|
child.once("close", (code) => resolve12(code ?? 1));
|
|
69536
72189
|
}),
|
|
69537
72190
|
spawnCapture: (cmd, args, options) => new Promise((resolve12, reject) => {
|
|
69538
|
-
const child =
|
|
72191
|
+
const child = spawn5(cmd, args, { cwd: options.cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
69539
72192
|
const chunks = [];
|
|
69540
72193
|
child.stdout.on("data", (c) => chunks.push(c));
|
|
69541
72194
|
child.stderr.on("data", (c) => chunks.push(c));
|
|
@@ -69594,7 +72247,7 @@ var appOptions = {
|
|
|
69594
72247
|
{ name: "case", type: "string", description: "Scenario title substring; the engine's `scenario` (case ids are a later slice)." },
|
|
69595
72248
|
{ name: "e2e", type: "boolean", description: "The large end-to-end tests; exactly --size large, so the two cannot be combined." },
|
|
69596
72249
|
{ name: "retries", type: "string", description: "Retries after a failing scenario (default: 0)." },
|
|
69597
|
-
{ name: "ctrf", type: "string", description: "Write the CTRF report here (default: <cwd>/.
|
|
72250
|
+
{ name: "ctrf", type: "string", description: "Write the CTRF report here (default: <cwd>/.praxis/ctrf/<run>.json)." }
|
|
69598
72251
|
],
|
|
69599
72252
|
"devops test report": [
|
|
69600
72253
|
{ name: "id", type: "string", description: "Show one run's detail instead of the recent list." },
|
|
@@ -69614,6 +72267,25 @@ var appOptions = {
|
|
|
69614
72267
|
"devops flag scaffold": [
|
|
69615
72268
|
{ name: "out", type: "string", description: "Directory the paired on/off scenario stubs are written to (default: the current directory)." }
|
|
69616
72269
|
],
|
|
72270
|
+
"devops flag refs": [
|
|
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)." },
|
|
72272
|
+
{ name: "project", type: "string", description: "With --report: the DevOps project id (dvp_…) whose flags the scan is reported into. Required." }
|
|
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
|
+
],
|
|
72285
|
+
"agent events wait": [
|
|
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)." },
|
|
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)." }
|
|
72288
|
+
],
|
|
69617
72289
|
"canvas import": [
|
|
69618
72290
|
{ name: "name", type: "string", description: "Name for the new canvas (default: the file name without .pen)." },
|
|
69619
72291
|
{ name: "canvas", type: "string", description: "Import into this existing canvas instead of a new one. Whole-canvas replacement: it clears what is already there and requires --yes." },
|
|
@@ -69628,17 +72300,19 @@ var appOptions = {
|
|
|
69628
72300
|
};
|
|
69629
72301
|
appOptions["devops engine deploy"] = appOptions["devops deploy"];
|
|
69630
72302
|
var workflowOptions = (words) => words[0] === "skill" ? [{ name: "install", type: "string" }] : appOptions[words.join(" ")] ?? [];
|
|
69631
|
-
function flagPortsFor(ports, context, emit) {
|
|
72303
|
+
function flagPortsFor(ports, context, emit, connect) {
|
|
69632
72304
|
return {
|
|
69633
72305
|
mode: context.mode,
|
|
69634
72306
|
emit,
|
|
69635
|
-
human: (
|
|
72307
|
+
human: (text3) => {
|
|
69636
72308
|
if (context.mode === "human")
|
|
69637
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
72309
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
69638
72310
|
},
|
|
69639
72311
|
cwd: ports.cwd,
|
|
69640
72312
|
readFile: ports.readFile,
|
|
69641
|
-
|
|
72313
|
+
git: async (args) => (await ports.spawnCapture("git", [...args], { cwd: ports.cwd })).output,
|
|
72314
|
+
client: connect,
|
|
72315
|
+
writeFile: (path, text3) => writeFile5(path, text3, "utf8"),
|
|
69642
72316
|
mkdir: async (path) => {
|
|
69643
72317
|
await mkdir4(path, { recursive: true });
|
|
69644
72318
|
},
|
|
@@ -69662,9 +72336,9 @@ function toolPortsFor(ports, context, emit) {
|
|
|
69662
72336
|
return {
|
|
69663
72337
|
mode: context.mode,
|
|
69664
72338
|
emit,
|
|
69665
|
-
human: (
|
|
72339
|
+
human: (text3) => {
|
|
69666
72340
|
if (context.mode === "human")
|
|
69667
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
72341
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
69668
72342
|
},
|
|
69669
72343
|
cwd: ports.cwd,
|
|
69670
72344
|
readFile: ports.readFile,
|
|
@@ -69679,7 +72353,7 @@ function toolPortsFor(ports, context, emit) {
|
|
|
69679
72353
|
},
|
|
69680
72354
|
git: (args, cwd) => ports.spawnCapture("git", args, { cwd }),
|
|
69681
72355
|
run: (cmd, args, cwd) => new Promise((resolve12, reject) => {
|
|
69682
|
-
const child =
|
|
72356
|
+
const child = spawn5(cmd, args, { cwd, stdio: "inherit" });
|
|
69683
72357
|
child.once("error", reject);
|
|
69684
72358
|
child.once("close", (code) => resolve12(code ?? 1));
|
|
69685
72359
|
}),
|
|
@@ -69704,7 +72378,7 @@ async function main3(argv, injected = {}) {
|
|
|
69704
72378
|
columns: ports.columns,
|
|
69705
72379
|
now: ports.now(),
|
|
69706
72380
|
envVars: { NO_COLOR: ports.env.NO_COLOR, FORCE_COLOR: ports.env.FORCE_COLOR, TERM: ports.env.TERM },
|
|
69707
|
-
env: ports.env.PRAXIS_ENV ??
|
|
72381
|
+
env: ports.env.PRAXIS_ENV ?? DEFAULT_ENV
|
|
69708
72382
|
};
|
|
69709
72383
|
let stopProgress = () => {};
|
|
69710
72384
|
let quiet = false;
|
|
@@ -69974,9 +72648,9 @@ Examples:
|
|
|
69974
72648
|
},
|
|
69975
72649
|
mode: ctx.mode,
|
|
69976
72650
|
emit,
|
|
69977
|
-
human: (
|
|
72651
|
+
human: (text3) => {
|
|
69978
72652
|
if (ctx.mode === "human")
|
|
69979
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
72653
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
69980
72654
|
},
|
|
69981
72655
|
cwd: ports.cwd
|
|
69982
72656
|
});
|
|
@@ -70003,14 +72677,14 @@ Examples:
|
|
|
70003
72677
|
}, {
|
|
70004
72678
|
mode: ctx.mode,
|
|
70005
72679
|
emit,
|
|
70006
|
-
human: (
|
|
72680
|
+
human: (text3) => {
|
|
70007
72681
|
if (ctx.mode === "human")
|
|
70008
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
72682
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70009
72683
|
},
|
|
70010
72684
|
engine: codeRefactorEngine(),
|
|
70011
72685
|
hasFile: (path2) => existsSync4(path2),
|
|
70012
72686
|
readFile: ports.readFile,
|
|
70013
|
-
writeFile: (path2,
|
|
72687
|
+
writeFile: (path2, text3) => writeFile5(path2, text3, "utf8"),
|
|
70014
72688
|
mkdir: async (path2) => {
|
|
70015
72689
|
await mkdir4(path2, { recursive: true });
|
|
70016
72690
|
},
|
|
@@ -70027,9 +72701,9 @@ Examples:
|
|
|
70027
72701
|
const shellPorts = {
|
|
70028
72702
|
mode: ctx.mode,
|
|
70029
72703
|
emit,
|
|
70030
|
-
human: (
|
|
72704
|
+
human: (text3) => {
|
|
70031
72705
|
if (ctx.mode === "human")
|
|
70032
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
72706
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70033
72707
|
},
|
|
70034
72708
|
engine: await repositoryEngine(name, () => localEngine(ports.cwd)),
|
|
70035
72709
|
...localFilePorts(ports.cwd)
|
|
@@ -70042,9 +72716,9 @@ Examples:
|
|
|
70042
72716
|
const testPorts = {
|
|
70043
72717
|
mode: ctx.mode,
|
|
70044
72718
|
emit,
|
|
70045
|
-
human: (
|
|
72719
|
+
human: (text3) => {
|
|
70046
72720
|
if (ctx.mode === "human")
|
|
70047
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
72721
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70048
72722
|
},
|
|
70049
72723
|
engine: await repositoryEngine(name, () => localEngine(ports.cwd)),
|
|
70050
72724
|
checkout: await localCheckout(ports.cwd, (cmd, args, options) => ports.spawnCapture(cmd, args, options))
|
|
@@ -70053,9 +72727,9 @@ Examples:
|
|
|
70053
72727
|
return await devopsTestReport({ path: parsed.positional[0], id: parsed.flags.id?.[0], upload: Boolean(parsed.flags.upload), project: parsed.flags.project?.[0] }, testPorts, {
|
|
70054
72728
|
mode: ctx.mode,
|
|
70055
72729
|
emit,
|
|
70056
|
-
human: (
|
|
72730
|
+
human: (text3) => {
|
|
70057
72731
|
if (ctx.mode === "human")
|
|
70058
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
72732
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70059
72733
|
},
|
|
70060
72734
|
root: async () => await checkoutRoot(ports.cwd, ports.readFile),
|
|
70061
72735
|
readFile: ports.readFile,
|
|
@@ -70085,13 +72759,13 @@ Examples:
|
|
|
70085
72759
|
git: (args) => ports.spawnCapture("git", args, { cwd: ports.cwd }),
|
|
70086
72760
|
mode: ctx.mode,
|
|
70087
72761
|
emit,
|
|
70088
|
-
human: (
|
|
72762
|
+
human: (text3) => {
|
|
70089
72763
|
if (ctx.mode === "human")
|
|
70090
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
72764
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70091
72765
|
}
|
|
70092
72766
|
});
|
|
70093
72767
|
}
|
|
70094
|
-
const flagPorts = flagPortsFor(ports, ctx, emit);
|
|
72768
|
+
const flagPorts = flagPortsFor(ports, ctx, emit, async () => await auth.client(org));
|
|
70095
72769
|
if (name === "devops flag sync")
|
|
70096
72770
|
return await devopsFlagSync({ check: Boolean(parsed.flags.check) }, flagPorts);
|
|
70097
72771
|
if (name === "devops flag check")
|
|
@@ -70099,7 +72773,7 @@ Examples:
|
|
|
70099
72773
|
if (name === "devops flag scaffold")
|
|
70100
72774
|
return await devopsFlagScaffold(parsed.positional[0], { out: parsed.flags.out?.[0] }, flagPorts);
|
|
70101
72775
|
if (name === "devops flag refs")
|
|
70102
|
-
return await devopsFlagRefs(parsed.positional[0], flagPorts);
|
|
72776
|
+
return await devopsFlagRefs(parsed.positional[0], { report: Boolean(parsed.flags.report), project: parsed.flags.project?.[0] }, flagPorts);
|
|
70103
72777
|
return await devopsFlagRemove(parsed.positional[0], flagPorts);
|
|
70104
72778
|
}
|
|
70105
72779
|
if (!quiet)
|
|
@@ -70137,9 +72811,9 @@ Examples:
|
|
|
70137
72811
|
emit({ kind: "object", data: await auth.switchOrganization(parsed.positional[0]) });
|
|
70138
72812
|
break;
|
|
70139
72813
|
case "app create": {
|
|
70140
|
-
const appPorts = { ...ports, mode: ctx.mode, emit, human: (
|
|
72814
|
+
const appPorts = { ...ports, mode: ctx.mode, emit, human: (text3) => {
|
|
70141
72815
|
if (ctx.mode === "human")
|
|
70142
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
72816
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70143
72817
|
}, random: randomSecret };
|
|
70144
72818
|
await appCreate({ name: parsed.positional[0], dir: parsed.flags.dir?.[0], template: parsed.flags.template?.[0], install: !parsed.flags["no-install"] }, config.env, appPorts);
|
|
70145
72819
|
break;
|
|
@@ -70168,13 +72842,220 @@ Examples:
|
|
|
70168
72842
|
wait: ports.wait,
|
|
70169
72843
|
mode: ctx.mode,
|
|
70170
72844
|
emit,
|
|
70171
|
-
human: (
|
|
72845
|
+
human: (text3) => {
|
|
70172
72846
|
if (ctx.mode === "human")
|
|
70173
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
72847
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70174
72848
|
},
|
|
70175
72849
|
cwd: ports.cwd
|
|
70176
72850
|
});
|
|
70177
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
|
+
}
|
|
72943
|
+
case "agent events wait": {
|
|
72944
|
+
const agent = assumeAgentOf(ports.env);
|
|
72945
|
+
const timeoutMs = (() => {
|
|
72946
|
+
try {
|
|
72947
|
+
return timeoutMsOf(parsed.flags.timeout?.[0]);
|
|
72948
|
+
} catch (error) {
|
|
72949
|
+
throw new UsageError(error.message, "Example: praxis agent events wait --timeout 3600");
|
|
72950
|
+
}
|
|
72951
|
+
})();
|
|
72952
|
+
const headers = async () => {
|
|
72953
|
+
const credential = await auth.get(org);
|
|
72954
|
+
return { Authorization: `Bearer ${credential.token}`, ...credential.source === "api-key" ? { "X-API-Key": credential.token } : {} };
|
|
72955
|
+
};
|
|
72956
|
+
const failure2 = (status, body) => `HTTP ${status}${body?.error?.code ? ` ${body.error.code}` : ""}${body?.error?.message ? `: ${String(redact(body.error.message, secrets))}` : ""}`;
|
|
72957
|
+
const session = (() => {
|
|
72958
|
+
try {
|
|
72959
|
+
return sessionOf(parsed.flags.session?.[0]);
|
|
72960
|
+
} catch (error) {
|
|
72961
|
+
throw new UsageError(error.message, "Example: praxis agent events wait --session 0f6c…");
|
|
72962
|
+
}
|
|
72963
|
+
})();
|
|
72964
|
+
const key = waitKeyOf(config.env, agent, session);
|
|
72965
|
+
const waitDir = join12(ports.env.HOME || homedir3(), ".praxis", "cli", "events-wait");
|
|
72966
|
+
const statePath = join12(waitDir, `${key}.json`);
|
|
72967
|
+
const pidPath = join12(waitDir, `${key}.pid`);
|
|
72968
|
+
await mkdir4(waitDir, { recursive: true, mode: 448 });
|
|
72969
|
+
const holder = await acquireWaitLock({
|
|
72970
|
+
self: process.pid,
|
|
72971
|
+
readPid: () => readFile7(pidPath, "utf8").catch(() => null),
|
|
72972
|
+
createPid: (text3) => writeFile5(pidPath, text3, { mode: 384, flag: "wx" }).then(() => true, () => false),
|
|
72973
|
+
replacePid: (text3) => writeFile5(pidPath, text3, { mode: 384 }),
|
|
72974
|
+
probe: async (pid) => {
|
|
72975
|
+
try {
|
|
72976
|
+
process.kill(pid, 0);
|
|
72977
|
+
} catch (error) {
|
|
72978
|
+
if (error.code !== "EPERM")
|
|
72979
|
+
return { alive: false };
|
|
72980
|
+
}
|
|
72981
|
+
const ps = spawnSync("ps", ["-o", "ppid=,command=", "-p", String(pid)], { encoding: "utf8" });
|
|
72982
|
+
const line = ps.stdout?.trim() ?? "";
|
|
72983
|
+
const match = /^(\d+)\s+(.*)$/.exec(line);
|
|
72984
|
+
return match ? { alive: true, ppid: Number(match[1]), command: match[2] } : { alive: false };
|
|
72985
|
+
},
|
|
72986
|
+
terminate: (pid) => {
|
|
72987
|
+
try {
|
|
72988
|
+
process.kill(pid, "SIGTERM");
|
|
72989
|
+
} catch {}
|
|
72990
|
+
}
|
|
72991
|
+
});
|
|
72992
|
+
if (holder !== null) {
|
|
72993
|
+
process.stdout.write(alreadyWaitingNotice(holder) + `
|
|
72994
|
+
`);
|
|
72995
|
+
return 0;
|
|
72996
|
+
}
|
|
72997
|
+
const release = () => {
|
|
72998
|
+
try {
|
|
72999
|
+
if (pidOf(readFileSync3(pidPath, "utf8")) === process.pid)
|
|
73000
|
+
unlinkSync(pidPath);
|
|
73001
|
+
} catch {}
|
|
73002
|
+
};
|
|
73003
|
+
const onSignal = (signal) => {
|
|
73004
|
+
release();
|
|
73005
|
+
process.exit(signal === "SIGINT" ? 130 : 143);
|
|
73006
|
+
};
|
|
73007
|
+
for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"])
|
|
73008
|
+
process.once(signal, onSignal);
|
|
73009
|
+
try {
|
|
73010
|
+
return await runEventsWait({
|
|
73011
|
+
agent,
|
|
73012
|
+
timeoutMs,
|
|
73013
|
+
fetchLetters: async () => {
|
|
73014
|
+
const response = await wireFetch(inboxLettersUrl(config.apiUrl, agent), { headers: await headers(), signal: AbortSignal.timeout(30000), redirect: "error" });
|
|
73015
|
+
const body = await response.json().catch(() => null);
|
|
73016
|
+
if (!response.ok)
|
|
73017
|
+
throw new Error(failure2(response.status, body));
|
|
73018
|
+
return lettersOf(body);
|
|
73019
|
+
},
|
|
73020
|
+
openStream: async (signal, lastEventId) => {
|
|
73021
|
+
const response = await wireFetch(eventsStreamUrl(config.apiUrl, agent), {
|
|
73022
|
+
headers: streamHeaders(await headers(), lastEventId),
|
|
73023
|
+
signal,
|
|
73024
|
+
redirect: "error"
|
|
73025
|
+
});
|
|
73026
|
+
if (!response.ok || !response.body) {
|
|
73027
|
+
const body = await response.json().catch(() => null);
|
|
73028
|
+
return { status: response.status, reason: failure2(response.status, body) };
|
|
73029
|
+
}
|
|
73030
|
+
return { status: response.status, chunks: response.body.pipeThrough(new TextDecoderStream) };
|
|
73031
|
+
},
|
|
73032
|
+
readState: async () => waitStateOf(await readFile7(statePath, "utf8").catch(() => null)),
|
|
73033
|
+
writeState: async (next) => {
|
|
73034
|
+
await mkdir4(dirname10(statePath), { recursive: true, mode: 448 });
|
|
73035
|
+
await writeFile5(statePath, waitStateText(next), { mode: 384 });
|
|
73036
|
+
},
|
|
73037
|
+
print: (line) => {
|
|
73038
|
+
process.stdout.write(line + `
|
|
73039
|
+
`);
|
|
73040
|
+
},
|
|
73041
|
+
log: (line) => {
|
|
73042
|
+
process.stderr.write(String(redact(line, secrets)) + `
|
|
73043
|
+
`);
|
|
73044
|
+
},
|
|
73045
|
+
sleep: (ms, signal) => new Promise((resolve12) => {
|
|
73046
|
+
const timer = setTimeout(resolve12, ms);
|
|
73047
|
+
signal.addEventListener("abort", () => {
|
|
73048
|
+
clearTimeout(timer);
|
|
73049
|
+
resolve12();
|
|
73050
|
+
}, { once: true });
|
|
73051
|
+
})
|
|
73052
|
+
});
|
|
73053
|
+
} finally {
|
|
73054
|
+
release();
|
|
73055
|
+
for (const signal of ["SIGTERM", "SIGINT", "SIGHUP"])
|
|
73056
|
+
process.removeListener(signal, onSignal);
|
|
73057
|
+
}
|
|
73058
|
+
}
|
|
70178
73059
|
case "canvas import": {
|
|
70179
73060
|
const authorize = async () => {
|
|
70180
73061
|
const credential = await auth.get(org);
|
|
@@ -70216,7 +73097,7 @@ Examples:
|
|
|
70216
73097
|
file: parsed.positional[0],
|
|
70217
73098
|
name: parsed.flags.name?.[0],
|
|
70218
73099
|
canvas: parsed.flags.canvas?.[0],
|
|
70219
|
-
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,
|
|
70220
73101
|
imageRoots: parsed.flags["image-root"],
|
|
70221
73102
|
dryRun: Boolean(parsed.flags["dry-run"]?.[0]),
|
|
70222
73103
|
yes: Boolean(flags.yes)
|
|
@@ -70230,9 +73111,9 @@ Examples:
|
|
|
70230
73111
|
cwd: ports.cwd,
|
|
70231
73112
|
rpc,
|
|
70232
73113
|
upload,
|
|
70233
|
-
human: (
|
|
73114
|
+
human: (text3) => {
|
|
70234
73115
|
if (ctx.mode === "human")
|
|
70235
|
-
emit({ kind: "message", channel: "stdout", text:
|
|
73116
|
+
emit({ kind: "message", channel: "stdout", text: text3 });
|
|
70236
73117
|
}
|
|
70237
73118
|
});
|
|
70238
73119
|
}
|
|
@@ -70264,7 +73145,8 @@ if (true) {
|
|
|
70264
73145
|
process.exit(0);
|
|
70265
73146
|
throw error;
|
|
70266
73147
|
});
|
|
70267
|
-
|
|
73148
|
+
const argv = process.argv.slice(2);
|
|
73149
|
+
process.exitCode = isDevopsTestRun(route(argv).words) && needsCacheOffReexec(process.env) ? await reexecWithCacheOff() : await main3(argv);
|
|
70268
73150
|
}
|
|
70269
73151
|
export {
|
|
70270
73152
|
main3 as main
|